From bcf3ad517865617aa5931fd7e571af845d03c1df Mon Sep 17 00:00:00 2001 From: Kum1ta Date: Mon, 18 Nov 2024 18:08:56 +0100 Subject: [PATCH] remove useless folder --- .../static/javascript/taaaa/3DMLoader.js | 1764 -- .../static/javascript/taaaa/3MFLoader.js | 1480 -- .../taaaa/ACESFilmicToneMappingShader.js | 89 - .../static/javascript/taaaa/AMFLoader.js | 521 - .../nginx/static/javascript/taaaa/ARButton.js | 232 - .../nginx/static/javascript/taaaa/Addons.js | 296 - .../static/javascript/taaaa/AfterimagePass.js | 104 - .../javascript/taaaa/AfterimageShader.js | 58 - .../static/javascript/taaaa/BVHLoader.js | 437 - .../static/javascript/taaaa/BasicShader.js | 29 - .../javascript/taaaa/BleachBypassShader.js | 62 - .../static/javascript/taaaa/BlendShader.js | 49 - .../static/javascript/taaaa/BloomPass.js | 172 - .../static/javascript/taaaa/BokehShader2.js | 397 - .../taaaa/BrightnessContrastShader.js | 56 - .../static/javascript/taaaa/CameraUtils.js | 73 - .../static/javascript/taaaa/ClearPass.js | 46 - .../static/javascript/taaaa/ColladaLoader.js | 4116 ----- .../javascript/taaaa/ColorCorrectionShader.js | 52 - .../static/javascript/taaaa/ColorifyShader.js | 50 - .../javascript/taaaa/ConvolutionShader.js | 103 - .../javascript/taaaa/CubeTexturePass.js | 85 - .../static/javascript/taaaa/DDSLoader.js | 318 - .../javascript/taaaa/DOFMipMapShader.js | 56 - .../static/javascript/taaaa/DRACOLoader.js | 613 - .../taaaa/DepthLimitedBlurShader.js | 171 - .../static/javascript/taaaa/DigitalGlitch.js | 101 - .../static/javascript/taaaa/DotScreenPass.js | 65 - .../javascript/taaaa/DotScreenShader.js | 70 - .../static/javascript/taaaa/EXRLoader.js | 2563 --- .../static/javascript/taaaa/ExposureShader.js | 44 - .../static/javascript/taaaa/FBXLoader.js | 4303 ----- .../static/javascript/taaaa/FXAAShader.js | 286 - .../nginx/static/javascript/taaaa/FilmPass.js | 64 - .../static/javascript/taaaa/FilmShader.js | 59 - .../static/javascript/taaaa/FocusShader.js | 89 - .../static/javascript/taaaa/FontLoader.js | 183 - .../static/javascript/taaaa/FreiChenShader.js | 96 - .../static/javascript/taaaa/GCodeLoader.js | 261 - .../static/javascript/taaaa/GPUStatsPanel.js | 95 - .../nginx/static/javascript/taaaa/GTAOPass.js | 582 - .../static/javascript/taaaa/GTAOShader.js | 424 - .../javascript/taaaa/GammaCorrectionShader.js | 43 - .../taaaa/GeometryCompressionUtils.js | 639 - .../static/javascript/taaaa/GeometryUtils.js | 221 - .../static/javascript/taaaa/GlitchPass.js | 125 - .../static/javascript/taaaa/GodRaysShader.js | 321 - .../javascript/taaaa/HDRCubeTextureLoader.js | 115 - .../static/javascript/taaaa/HalftonePass.js | 79 - .../static/javascript/taaaa/HalftoneShader.js | 312 - .../javascript/taaaa/HorizontalBlurShader.js | 59 - .../taaaa/HorizontalTiltShiftShader.js | 63 - .../javascript/taaaa/HueSaturationShader.js | 67 - .../static/javascript/taaaa/IESLoader.js | 337 - .../static/javascript/taaaa/KMZLoader.js | 130 - .../static/javascript/taaaa/KTX2Loader.js | 925 - .../static/javascript/taaaa/KTXLoader.js | 176 - .../static/javascript/taaaa/KaleidoShader.js | 58 - .../static/javascript/taaaa/LDrawLoader.js | 2471 --- .../static/javascript/taaaa/LDrawUtils.js | 202 - .../static/javascript/taaaa/LUT3dlLoader.js | 168 - .../static/javascript/taaaa/LUTCubeLoader.js | 153 - .../static/javascript/taaaa/LUTImageLoader.js | 149 - .../nginx/static/javascript/taaaa/LUTPass.js | 108 - .../static/javascript/taaaa/LWOLoader.js | 1052 -- .../static/javascript/taaaa/LogLuvLoader.js | 606 - .../static/javascript/taaaa/LottieLoader.js | 77 - .../taaaa/LuminosityHighPassShader.js | 64 - .../javascript/taaaa/LuminosityShader.js | 48 - .../static/javascript/taaaa/MD2Loader.js | 399 - .../static/javascript/taaaa/MDDLoader.js | 102 - .../static/javascript/taaaa/MMDLoader.js | 2295 --- .../static/javascript/taaaa/MMDToonShader.js | 134 - .../static/javascript/taaaa/MTLLoader.js | 567 - .../javascript/taaaa/MaterialXLoader.js | 845 - .../static/javascript/taaaa/MirrorShader.js | 56 - .../static/javascript/taaaa/NRRDLoader.js | 686 - .../javascript/taaaa/NormalMapShader.js | 55 - .../static/javascript/taaaa/OBJLoader.js | 905 - .../javascript/taaaa/OculusHandModel.js | 110 - .../taaaa/OculusHandPointerModel.js | 413 - .../static/javascript/taaaa/OutlinePass.js | 654 - .../static/javascript/taaaa/OutputPass.js | 97 - .../static/javascript/taaaa/OutputShader.js | 85 - .../static/javascript/taaaa/PCDLoader.js | 467 - .../static/javascript/taaaa/PDBLoader.js | 232 - .../static/javascript/taaaa/PLYLoader.js | 771 - .../static/javascript/taaaa/PVRLoader.js | 251 - .../javascript/taaaa/PackedPhongMaterial.js | 178 - .../javascript/taaaa/PoissonDenoiseShader.js | 226 - .../static/javascript/taaaa/RGBELoader.js | 450 - .../static/javascript/taaaa/RGBMLoader.js | 1081 -- .../static/javascript/taaaa/RGBShiftShader.js | 54 - .../javascript/taaaa/RenderPixelatedPass.js | 235 - .../javascript/taaaa/RenderTransitionPass.js | 168 - .../nginx/static/javascript/taaaa/SAOPass.js | 334 - .../static/javascript/taaaa/SAOShader.js | 179 - .../nginx/static/javascript/taaaa/SMAAPass.js | 199 - .../static/javascript/taaaa/SMAAShader.js | 466 - .../static/javascript/taaaa/SSAARenderPass.js | 228 - .../nginx/static/javascript/taaaa/SSAOPass.js | 414 - .../static/javascript/taaaa/SSAOShader.js | 300 - .../nginx/static/javascript/taaaa/SSRPass.js | 641 - .../static/javascript/taaaa/SSRShader.js | 370 - .../static/javascript/taaaa/STLLoader.js | 410 - .../static/javascript/taaaa/SVGLoader.js | 3173 ---- .../nginx/static/javascript/taaaa/SavePass.js | 79 - .../static/javascript/taaaa/SceneUtils.js | 313 - .../static/javascript/taaaa/SepiaShader.js | 52 - .../javascript/taaaa/ShadowMapViewer.js | 210 - .../static/javascript/taaaa/SkeletonUtils.js | 424 - .../javascript/taaaa/SobelOperatorShader.js | 92 - .../static/javascript/taaaa/SortUtils.js | 163 - .../taaaa/SubsurfaceScatteringShader.js | 90 - .../static/javascript/taaaa/TAARenderPass.js | 188 - .../static/javascript/taaaa/TDSLoader.js | 1124 -- .../static/javascript/taaaa/TGALoader.js | 517 - .../static/javascript/taaaa/TIFFLoader.js | 36 - .../static/javascript/taaaa/TTFLoader.js | 214 - .../javascript/taaaa/TechnicolorShader.js | 45 - .../nginx/static/javascript/taaaa/Text2D.js | 38 - .../static/javascript/taaaa/TexturePass.js | 67 - .../static/javascript/taaaa/TextureUtils.js | 98 - .../static/javascript/taaaa/TiltLoader.js | 520 - .../static/javascript/taaaa/ToonShader.js | 326 - .../javascript/taaaa/TriangleBlurShader.js | 74 - .../static/javascript/taaaa/USDZLoader.js | 870 - .../nginx/static/javascript/taaaa/UVsDebug.js | 165 - .../static/javascript/taaaa/UltraHDRLoader.js | 583 - .../javascript/taaaa/UnpackDepthRGBAShader.js | 47 - .../javascript/taaaa/UnrealBloomPass.js | 415 - .../static/javascript/taaaa/VOXLoader.js | 318 - .../static/javascript/taaaa/VRMLLoader.js | 3537 ---- .../static/javascript/taaaa/VTKLoader.js | 1236 -- .../static/javascript/taaaa/VelocityShader.js | 130 - .../javascript/taaaa/VerticalBlurShader.js | 59 - .../taaaa/VerticalTiltShiftShader.js | 63 - .../static/javascript/taaaa/VignetteShader.js | 51 - .../static/javascript/taaaa/VolumeShader.js | 289 - .../javascript/taaaa/WaterRefractionShader.js | 95 - .../static/javascript/taaaa/WorkerPool.js | 102 - .../nginx/static/javascript/taaaa/XRButton.js | 223 - .../javascript/taaaa/XREstimatedLight.js | 223 - .../javascript/taaaa/XRHandMeshModel.js | 114 - .../javascript/taaaa/XRHandModelFactory.js | 107 - .../javascript/taaaa/XRHandPrimitiveModel.js | 103 - .../nginx/static/javascript/taaaa/XRPlanes.js | 100 - .../static/javascript/taaaa/XYZLoader.js | 106 - .../static/javascript/taaaa/ammo.wasm.js | 822 - .../static/javascript/taaaa/ammo.wasm.wasm | Bin 651386 -> 0 bytes .../taaaa/animation/AnimationClipCreator.js | 116 - .../javascript/taaaa/animation/CCDIKSolver.js | 484 - .../taaaa/animation/MMDAnimationHelper.js | 1207 -- .../javascript/taaaa/animation/MMDPhysics.js | 1406 -- .../taaaa/cameras/CinematicCamera.js | 208 - .../javascript/taaaa/capabilities/WebGL.js | 108 - .../javascript/taaaa/capabilities/WebGPU.js | 57 - .../javascript/taaaa/chevrotain.module.min.js | 141 - .../taaaa/controls/ArcballControls.js | 3224 ---- .../javascript/taaaa/controls/DragControls.js | 282 - .../taaaa/controls/FirstPersonControls.js | 325 - .../javascript/taaaa/controls/FlyControls.js | 326 - .../javascript/taaaa/controls/MapControls.js | 28 - .../taaaa/controls/OrbitControls.js | 1532 -- .../taaaa/controls/PointerLockControls.js | 162 - .../taaaa/controls/TrackballControls.js | 828 - .../taaaa/controls/TransformControls.js | 1573 -- .../nginx/static/javascript/taaaa/csm/CSM.js | 384 - .../static/javascript/taaaa/csm/CSMFrustum.js | 152 - .../static/javascript/taaaa/csm/CSMHelper.js | 193 - .../static/javascript/taaaa/csm/CSMShader.js | 295 - .../javascript/taaaa/curves/CurveExtras.js | 422 - .../javascript/taaaa/curves/NURBSCurve.js | 80 - .../javascript/taaaa/curves/NURBSSurface.js | 52 - .../javascript/taaaa/curves/NURBSUtils.js | 542 - .../javascript/taaaa/curves/NURBSVolume.js | 62 - .../static/javascript/taaaa/draco/README.md | 32 - .../javascript/taaaa/draco/draco_decoder.js | 34 - .../javascript/taaaa/draco/draco_decoder.wasm | Bin 285747 -> 0 bytes .../javascript/taaaa/draco/draco_encoder.js | 33 - .../taaaa/draco/draco_wasm_wrapper.js | 117 - .../taaaa/draco/gltf/draco_decoder.js | 33 - .../taaaa/draco/gltf/draco_decoder.wasm | Bin 192420 -> 0 bytes .../taaaa/draco/gltf/draco_encoder.js | 33 - .../taaaa/draco/gltf/draco_wasm_wrapper.js | 116 - .../static/javascript/taaaa/ecsy.module.js | 1792 -- .../taaaa/effects/AnaglyphEffect.js | 154 - .../javascript/taaaa/effects/AsciiEffect.js | 263 - .../javascript/taaaa/effects/OutlineEffect.js | 539 - .../taaaa/effects/ParallaxBarrierEffect.js | 119 - .../taaaa/effects/PeppersGhostEffect.js | 153 - .../javascript/taaaa/effects/StereoEffect.js | 55 - .../taaaa/environments/DebugEnvironment.js | 52 - .../taaaa/environments/RoomEnvironment.js | 144 - .../taaaa/exporters/DRACOExporter.js | 267 - .../javascript/taaaa/exporters/EXRExporter.js | 579 - .../taaaa/exporters/GLTFExporter.js | 3384 ---- .../taaaa/exporters/KTX2Exporter.js | 292 - .../javascript/taaaa/exporters/MMDExporter.js | 217 - .../javascript/taaaa/exporters/OBJExporter.js | 284 - .../javascript/taaaa/exporters/PLYExporter.js | 528 - .../javascript/taaaa/exporters/STLExporter.js | 199 - .../taaaa/exporters/USDZExporter.js | 743 - .../static/javascript/taaaa/fflate.module.js | 2672 --- .../taaaa/geometries/BoxLineGeometry.js | 69 - .../taaaa/geometries/ConvexGeometry.js | 53 - .../taaaa/geometries/DecalGeometry.js | 356 - .../geometries/InstancedPointsGeometry.js | 174 - .../taaaa/geometries/ParametricGeometries.js | 254 - .../taaaa/geometries/ParametricGeometry.js | 139 - .../taaaa/geometries/RoundedBoxGeometry.js | 155 - .../taaaa/geometries/SDFGeometryGenerator.js | 144 - .../taaaa/geometries/TeapotGeometry.js | 704 - .../taaaa/geometries/TextGeometry.js | 65 - .../taaaa/helpers/LightProbeHelper.js | 130 - .../javascript/taaaa/helpers/OctreeHelper.js | 73 - .../taaaa/helpers/PositionalAudioHelper.js | 109 - .../taaaa/helpers/RectAreaLightHelper.js | 85 - .../javascript/taaaa/helpers/TextureHelper.js | 237 - .../taaaa/helpers/VertexNormalsHelper.js | 96 - .../taaaa/helpers/VertexTangentsHelper.js | 88 - .../javascript/taaaa/helpers/ViewHelper.js | 347 - .../javascript/taaaa/interactive/HTMLMesh.js | 570 - .../taaaa/interactive/InteractiveGroup.js | 106 - .../taaaa/interactive/SelectionBox.js | 227 - .../taaaa/interactive/SelectionHelper.js | 104 - .../javascript/taaaa/ktx-parse.module.js | 1 - .../taaaa/lights/LightProbeGenerator.js | 286 - .../taaaa/lights/RectAreaLightTexturesLib.js | 91 - .../taaaa/lights/RectAreaLightUniformsLib.js | 24 - .../javascript/taaaa/lil-gui.module.min.js | 8 - .../static/javascript/taaaa/lines/Line2.js | 19 - .../javascript/taaaa/lines/LineGeometry.js | 79 - .../javascript/taaaa/lines/LineMaterial.js | 603 - .../javascript/taaaa/lines/LineSegments2.js | 376 - .../taaaa/lines/LineSegmentsGeometry.js | 241 - .../javascript/taaaa/lines/Wireframe.js | 71 - .../taaaa/lines/WireframeGeometry2.js | 24 - .../javascript/taaaa/lines/webgpu/Line2.js | 20 - .../taaaa/lines/webgpu/LineSegments2.js | 376 - .../javascript/taaaa/lottie_canvas.module.js | 14849 ---------------- .../static/javascript/taaaa/lwo/IFFParser.js | 1217 -- .../static/javascript/taaaa/lwo/LWO2Parser.js | 414 - .../static/javascript/taaaa/lwo/LWO3Parser.js | 373 - .../taaaa/materials/MeshGouraudMaterial.js | 432 - .../materials/MeshPostProcessingMaterial.js | 144 - .../static/javascript/taaaa/math/Capsule.js | 82 - .../javascript/taaaa/math/ColorConverter.js | 36 - .../javascript/taaaa/math/ConvexHull.js | 1271 -- .../javascript/taaaa/math/ImprovedNoise.js | 71 - .../nginx/static/javascript/taaaa/math/Lut.js | 204 - .../taaaa/math/MeshSurfaceSampler.js | 250 - .../nginx/static/javascript/taaaa/math/OBB.js | 423 - .../static/javascript/taaaa/math/Octree.js | 546 - .../javascript/taaaa/math/SimplexNoise.js | 444 - .../taaaa/meshopt_decoder.module.js | 178 - .../javascript/taaaa/mikktspace.module.js | 128 - .../taaaa/misc/ConvexObjectBreaker.js | 519 - .../taaaa/misc/GPUComputationRenderer.js | 430 - .../static/javascript/taaaa/misc/Gyroscope.js | 66 - .../javascript/taaaa/misc/MD2Character.js | 276 - .../taaaa/misc/MD2CharacterComplex.js | 576 - .../javascript/taaaa/misc/MorphAnimMesh.js | 75 - .../javascript/taaaa/misc/MorphBlendMesh.js | 322 - .../taaaa/misc/ProgressiveLightMap.js | 324 - .../javascript/taaaa/misc/RollerCoaster.js | 566 - .../static/javascript/taaaa/misc/Timer.js | 128 - .../javascript/taaaa/misc/TubePainter.js | 202 - .../static/javascript/taaaa/misc/Volume.js | 473 - .../javascript/taaaa/misc/VolumeSlice.js | 229 - .../javascript/taaaa/mmdparser.module.js | 11530 ------------ .../taaaa/modifiers/CurveModifier.js | 346 - .../taaaa/modifiers/EdgeSplitModifier.js | 279 - .../taaaa/modifiers/SimplifyModifier.js | 618 - .../taaaa/modifiers/TessellateModifier.js | 307 - .../taaaa/objects/GroundedSkybox.js | 50 - .../taaaa/objects/InstancedPoints.js | 21 - .../javascript/taaaa/objects/Lensflare.js | 397 - .../javascript/taaaa/objects/MarchingCubes.js | 1176 -- .../javascript/taaaa/objects/Reflector.js | 264 - .../taaaa/objects/ReflectorForSSRPass.js | 352 - .../javascript/taaaa/objects/Refractor.js | 327 - .../javascript/taaaa/objects/ShadowMesh.js | 80 - .../static/javascript/taaaa/objects/Sky.js | 219 - .../static/javascript/taaaa/objects/Water.js | 333 - .../static/javascript/taaaa/objects/Water2.js | 361 - .../static/javascript/taaaa/offscreen/jank.js | 45 - .../javascript/taaaa/offscreen/offscreen.js | 8 - .../offscreen/renderers/CSS2DRenderer.js | 235 - .../offscreen/renderers/CSS3DRenderer.js | 350 - .../taaaa/offscreen/renderers/Projector.js | 918 - .../taaaa/offscreen/renderers/SVGRenderer.js | 556 - .../javascript/taaaa/offscreen/scene.js | 86 - .../javascript/taaaa/opentype.module.js | 14506 --------------- .../javascript/taaaa/physics/AmmoPhysics.js | 306 - .../javascript/taaaa/physics/JoltPhysics.js | 281 - .../javascript/taaaa/physics/RapierPhysics.js | 220 - .../static/javascript/taaaa/potpack.module.js | 125 - .../javascript/taaaa/rhino3dm/rhino3dm.js | 21 - .../taaaa/rhino3dm/rhino3dm.module.js | 16 - .../javascript/taaaa/rhino3dm/rhino3dm.wasm | Bin 2545991 -> 0 bytes .../static/javascript/taaaa/stats.module.js | 167 - .../static/javascript/taaaa/surfaceNet.js | 201 - .../taaaa/textures/FlakesTexture.js | 40 - .../static/javascript/taaaa/transpiler/AST.js | 270 - .../taaaa/transpiler/GLSLDecoder.js | 983 - .../taaaa/transpiler/ShaderToyDecoder.js | 49 - .../javascript/taaaa/transpiler/TSLEncoder.js | 717 - .../javascript/taaaa/transpiler/Transpiler.js | 18 - .../static/javascript/taaaa/tween.module.js | 876 - .../static/javascript/taaaa/utif.module.js | 1665 -- .../static/javascript/taaaa/zstddec.module.js | 1 - 312 files changed, 160235 deletions(-) delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/3DMLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/3MFLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ACESFilmicToneMappingShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/AMFLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ARButton.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/Addons.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/AfterimagePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/AfterimageShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BVHLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BasicShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BleachBypassShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BlendShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BloomPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BokehShader2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/BrightnessContrastShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/CameraUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ClearPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ColladaLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ColorCorrectionShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ColorifyShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ConvolutionShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/CubeTexturePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DDSLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DOFMipMapShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DRACOLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DepthLimitedBlurShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DigitalGlitch.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/EXRLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ExposureShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FBXLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FXAAShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FilmPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FilmShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FocusShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FontLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/FreiChenShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GCodeLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GPUStatsPanel.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GTAOPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GTAOShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GammaCorrectionShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GeometryCompressionUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GeometryUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GlitchPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/GodRaysShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HDRCubeTextureLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HalftonePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HalftoneShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalBlurShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalTiltShiftShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/HueSaturationShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/IESLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/KMZLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/KTX2Loader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/KTXLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/KaleidoShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LDrawLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LDrawUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LUT3dlLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LUTCubeLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LUTImageLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LUTPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LWOLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LogLuvLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LottieLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityHighPassShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MD2Loader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MDDLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MMDLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MMDToonShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MTLLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MaterialXLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/MirrorShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/NRRDLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/NormalMapShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OBJLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandModel.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandPointerModel.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OutlinePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OutputPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/OutputShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PCDLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PDBLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PLYLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PVRLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PackedPhongMaterial.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/PoissonDenoiseShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/RGBELoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/RGBMLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/RGBShiftShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/RenderPixelatedPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/RenderTransitionPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SAOPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SAOShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SMAAPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SMAAShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SSAARenderPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SSAOPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SSAOShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SSRPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SSRShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/STLLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SVGLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SavePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SceneUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SepiaShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ShadowMapViewer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SkeletonUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SobelOperatorShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SortUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/SubsurfaceScatteringShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TAARenderPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TDSLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TGALoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TIFFLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TTFLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TechnicolorShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/Text2D.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TexturePass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TextureUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TiltLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ToonShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/TriangleBlurShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/USDZLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/UVsDebug.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/UltraHDRLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/UnpackDepthRGBAShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/UnrealBloomPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VOXLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VRMLLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VTKLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VelocityShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VerticalBlurShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VerticalTiltShiftShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VignetteShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/VolumeShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/WaterRefractionShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/WorkerPool.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XRButton.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XREstimatedLight.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XRHandMeshModel.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XRHandModelFactory.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XRHandPrimitiveModel.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XRPlanes.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/XYZLoader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ammo.wasm.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ammo.wasm.wasm delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/animation/AnimationClipCreator.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/animation/CCDIKSolver.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/animation/MMDAnimationHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/animation/MMDPhysics.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/cameras/CinematicCamera.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/capabilities/WebGL.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/capabilities/WebGPU.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/chevrotain.module.min.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/ArcballControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/DragControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/FirstPersonControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/FlyControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/MapControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/OrbitControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/PointerLockControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/TrackballControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/controls/TransformControls.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSM.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMFrustum.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMShader.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/curves/CurveExtras.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSCurve.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSSurface.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSUtils.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSVolume.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/README.md delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_decoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_decoder.wasm delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_encoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_wasm_wrapper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_decoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_decoder.wasm delete mode 100755 docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_encoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_wasm_wrapper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ecsy.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/AnaglyphEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/AsciiEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/OutlineEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/ParallaxBarrierEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/PeppersGhostEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/effects/StereoEffect.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/environments/DebugEnvironment.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/environments/RoomEnvironment.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/DRACOExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/EXRExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/GLTFExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/KTX2Exporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/MMDExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/OBJExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/PLYExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/STLExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/exporters/USDZExporter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/fflate.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/BoxLineGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ConvexGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/DecalGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/InstancedPointsGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometries.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/RoundedBoxGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/SDFGeometryGenerator.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TeapotGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TextGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/LightProbeHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/OctreeHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/PositionalAudioHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/RectAreaLightHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/TextureHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexNormalsHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexTangentsHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/helpers/ViewHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/interactive/HTMLMesh.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/interactive/InteractiveGroup.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionBox.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionHelper.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/ktx-parse.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lights/LightProbeGenerator.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightTexturesLib.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightUniformsLib.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lil-gui.module.min.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/Line2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineMaterial.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegments2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegmentsGeometry.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/Wireframe.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/WireframeGeometry2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/Line2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/LineSegments2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lottie_canvas.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lwo/IFFParser.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO2Parser.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO3Parser.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshGouraudMaterial.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshPostProcessingMaterial.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/Capsule.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/ColorConverter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/ConvexHull.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/ImprovedNoise.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/Lut.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/MeshSurfaceSampler.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/OBB.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/Octree.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/math/SimplexNoise.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/meshopt_decoder.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/mikktspace.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/ConvexObjectBreaker.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/GPUComputationRenderer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/Gyroscope.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2Character.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2CharacterComplex.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphAnimMesh.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphBlendMesh.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/ProgressiveLightMap.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/RollerCoaster.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/Timer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/TubePainter.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/Volume.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/misc/VolumeSlice.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/mmdparser.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/CurveModifier.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/EdgeSplitModifier.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/SimplifyModifier.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/TessellateModifier.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/GroundedSkybox.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/InstancedPoints.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Lensflare.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/MarchingCubes.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Reflector.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/ReflectorForSSRPass.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Refractor.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/ShadowMesh.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Sky.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water2.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/jank.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/offscreen.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS2DRenderer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS3DRenderer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/Projector.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/SVGRenderer.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/scene.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/opentype.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/physics/AmmoPhysics.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/physics/JoltPhysics.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/physics/RapierPhysics.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/potpack.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.wasm delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/stats.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/surfaceNet.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/textures/FlakesTexture.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/transpiler/AST.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/transpiler/GLSLDecoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/transpiler/ShaderToyDecoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/transpiler/TSLEncoder.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/transpiler/Transpiler.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/tween.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/utif.module.js delete mode 100644 docker-compose/requirements/nginx/static/javascript/taaaa/zstddec.module.js diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/3DMLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/3DMLoader.js deleted file mode 100644 index 18905a8..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/3DMLoader.js +++ /dev/null @@ -1,1764 +0,0 @@ -import { - BufferGeometryLoader, - CanvasTexture, - ClampToEdgeWrapping, - Color, - DirectionalLight, - DoubleSide, - FileLoader, - LinearFilter, - Line, - LineBasicMaterial, - Loader, - Matrix4, - Mesh, - MeshPhysicalMaterial, - MeshStandardMaterial, - Object3D, - PointLight, - Points, - PointsMaterial, - RectAreaLight, - RepeatWrapping, - SpotLight, - Sprite, - SpriteMaterial, - TextureLoader -} from '/static/javascript/three/build/three.module.js'; - -import { EXRLoader } from '../loaders/EXRLoader.js'; - -const _taskCache = new WeakMap(); - -class Rhino3dmLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.libraryPath = ''; - this.libraryPending = null; - this.libraryBinary = null; - this.libraryConfig = {}; - - this.url = ''; - - this.workerLimit = 4; - this.workerPool = []; - this.workerNextTaskID = 1; - this.workerSourceURL = ''; - this.workerConfig = {}; - - this.materials = []; - this.warnings = []; - - } - - setLibraryPath( path ) { - - this.libraryPath = path; - - return this; - - } - - setWorkerLimit( workerLimit ) { - - this.workerLimit = workerLimit; - - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new FileLoader( this.manager ); - - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - - this.url = url; - - loader.load( url, ( buffer ) => { - - // Check for an existing task using this buffer. A transferred buffer cannot be transferred - // again from this thread. - if ( _taskCache.has( buffer ) ) { - - const cachedTask = _taskCache.get( buffer ); - - return cachedTask.promise.then( onLoad ).catch( onError ); - - } - - this.decodeObjects( buffer, url ) - .then( result => { - - result.userData.warnings = this.warnings; - onLoad( result ); - - } ) - .catch( e => onError( e ) ); - - }, onProgress, onError ); - - } - - debug() { - - console.log( 'Task load: ', this.workerPool.map( ( worker ) => worker._taskLoad ) ); - - } - - decodeObjects( buffer, url ) { - - let worker; - let taskID; - - const taskCost = buffer.byteLength; - - const objectPending = this._getWorker( taskCost ) - .then( ( _worker ) => { - - worker = _worker; - taskID = this.workerNextTaskID ++; - - return new Promise( ( resolve, reject ) => { - - worker._callbacks[ taskID ] = { resolve, reject }; - - worker.postMessage( { type: 'decode', id: taskID, buffer }, [ buffer ] ); - - // this.debug(); - - } ); - - } ) - .then( ( message ) => this._createGeometry( message.data ) ) - .catch( e => { - - throw e; - - } ); - - // Remove task from the task list. - // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416) - objectPending - .catch( () => true ) - .then( () => { - - if ( worker && taskID ) { - - this._releaseTask( worker, taskID ); - - //this.debug(); - - } - - } ); - - // Cache the task result. - _taskCache.set( buffer, { - - url: url, - promise: objectPending - - } ); - - return objectPending; - - } - - parse( data, onLoad, onError ) { - - this.decodeObjects( data, '' ) - .then( result => { - - result.userData.warnings = this.warnings; - onLoad( result ); - - } ) - .catch( e => onError( e ) ); - - } - - _compareMaterials( material ) { - - const mat = {}; - mat.name = material.name; - mat.color = {}; - mat.color.r = material.color.r; - mat.color.g = material.color.g; - mat.color.b = material.color.b; - mat.type = material.type; - mat.vertexColors = material.vertexColors; - - const json = JSON.stringify( mat ); - - for ( let i = 0; i < this.materials.length; i ++ ) { - - const m = this.materials[ i ]; - const _mat = {}; - _mat.name = m.name; - _mat.color = {}; - _mat.color.r = m.color.r; - _mat.color.g = m.color.g; - _mat.color.b = m.color.b; - _mat.type = m.type; - _mat.vertexColors = m.vertexColors; - - if ( JSON.stringify( _mat ) === json ) { - - return m; - - } - - } - - this.materials.push( material ); - - return material; - - } - - _createMaterial( material, renderEnvironment ) { - - if ( material === undefined ) { - - return new MeshStandardMaterial( { - color: new Color( 1, 1, 1 ), - metalness: 0.8, - name: Loader.DEFAULT_MATERIAL_NAME, - side: DoubleSide - } ); - - } - - //console.log(material) - - const mat = new MeshPhysicalMaterial( { - - color: new Color( material.diffuseColor.r / 255.0, material.diffuseColor.g / 255.0, material.diffuseColor.b / 255.0 ), - emissive: new Color( material.emissionColor.r, material.emissionColor.g, material.emissionColor.b ), - flatShading: material.disableLighting, - ior: material.indexOfRefraction, - name: material.name, - reflectivity: material.reflectivity, - opacity: 1.0 - material.transparency, - side: DoubleSide, - specularColor: material.specularColor, - transparent: material.transparency > 0 ? true : false - - } ); - - mat.userData.id = material.id; - - if ( material.pbrSupported ) { - - const pbr = material.pbr; - - mat.anisotropy = pbr.anisotropic; - mat.anisotropyRotation = pbr.anisotropicRotation; - mat.color = new Color( pbr.baseColor.r, pbr.baseColor.g, pbr.baseColor.b ); - mat.clearcoat = pbr.clearcoat; - mat.clearcoatRoughness = pbr.clearcoatRoughness; - mat.metalness = pbr.metallic; - mat.transmission = 1 - pbr.opacity; - mat.roughness = pbr.roughness; - mat.sheen = pbr.sheen; - mat.specularIntensity = pbr.specular; - mat.thickness = pbr.subsurface; - - } - - if ( material.pbrSupported && material.pbr.opacity === 0 && material.transparency === 1 ) { - - //some compromises - - mat.opacity = 0.2; - mat.transmission = 1.00; - - } - - const textureLoader = new TextureLoader(); - - for ( let i = 0; i < material.textures.length; i ++ ) { - - const texture = material.textures[ i ]; - - if ( texture.image !== null ) { - - const map = textureLoader.load( texture.image ); - - //console.log(texture.type ) - - switch ( texture.type ) { - - case 'Bump': - - mat.bumpMap = map; - - break; - - case 'Diffuse': - - mat.map = map; - - break; - - case 'Emap': - - mat.envMap = map; - - break; - - case 'Opacity': - - mat.transmissionMap = map; - - break; - - case 'Transparency': - - mat.alphaMap = map; - mat.transparent = true; - - break; - - case 'PBR_Alpha': - - mat.alphaMap = map; - mat.transparent = true; - - break; - - case 'PBR_AmbientOcclusion': - - mat.aoMap = map; - - break; - - case 'PBR_Anisotropic': - - mat.anisotropyMap = map; - - break; - - case 'PBR_BaseColor': - - mat.map = map; - - break; - - case 'PBR_Clearcoat': - - mat.clearcoatMap = map; - - break; - - case 'PBR_ClearcoatBump': - - mat.clearcoatNormalMap = map; - - break; - - case 'PBR_ClearcoatRoughness': - - mat.clearcoatRoughnessMap = map; - - break; - - case 'PBR_Displacement': - - mat.displacementMap = map; - - break; - - case 'PBR_Emission': - - mat.emissiveMap = map; - - break; - - case 'PBR_Metallic': - - mat.metalnessMap = map; - - break; - - case 'PBR_Roughness': - - mat.roughnessMap = map; - - break; - - case 'PBR_Sheen': - - mat.sheenColorMap = map; - - break; - - case 'PBR_Specular': - - mat.specularColorMap = map; - - break; - - case 'PBR_Subsurface': - - mat.thicknessMap = map; - - break; - - default: - - this.warnings.push( { - message: `THREE.3DMLoader: No conversion exists for 3dm ${texture.type}.`, - type: 'no conversion' - } ); - - break; - - } - - map.wrapS = texture.wrapU === 0 ? RepeatWrapping : ClampToEdgeWrapping; - map.wrapT = texture.wrapV === 0 ? RepeatWrapping : ClampToEdgeWrapping; - - if ( texture.repeat ) { - - map.repeat.set( texture.repeat[ 0 ], texture.repeat[ 1 ] ); - - } - - } - - } - - if ( renderEnvironment ) { - - new EXRLoader().load( renderEnvironment.image, function ( texture ) { - - texture.mapping = THREE.EquirectangularReflectionMapping; - mat.envMap = texture; - - } ); - - } - - return mat; - - } - - _createGeometry( data ) { - - const object = new Object3D(); - const instanceDefinitionObjects = []; - const instanceDefinitions = []; - const instanceReferences = []; - - object.userData[ 'layers' ] = data.layers; - object.userData[ 'groups' ] = data.groups; - object.userData[ 'settings' ] = data.settings; - object.userData.settings[ 'renderSettings' ] = data.renderSettings; - object.userData[ 'objectType' ] = 'File3dm'; - object.userData[ 'materials' ] = null; - - object.name = this.url; - - let objects = data.objects; - const materials = data.materials; - - for ( let i = 0; i < objects.length; i ++ ) { - - const obj = objects[ i ]; - const attributes = obj.attributes; - - switch ( obj.objectType ) { - - case 'InstanceDefinition': - - instanceDefinitions.push( obj ); - - break; - - case 'InstanceReference': - - instanceReferences.push( obj ); - - break; - - default: - - let matId = null; - - switch ( attributes.materialSource.name ) { - - case 'ObjectMaterialSource_MaterialFromLayer': - //check layer index - if ( attributes.layerIndex >= 0 ) { - - matId = data.layers[ attributes.layerIndex ].renderMaterialIndex; - - } - - break; - - case 'ObjectMaterialSource_MaterialFromObject': - - if ( attributes.materialIndex >= 0 ) { - - matId = attributes.materialIndex; - - } - - break; - - } - - let material = null; - - if ( matId >= 0 ) { - - const rMaterial = materials[ matId ]; - material = this._createMaterial( rMaterial, data.renderEnvironment ); - - - } - - const _object = this._createObject( obj, material ); - - if ( _object === undefined ) { - - continue; - - } - - const layer = data.layers[ attributes.layerIndex ]; - - _object.visible = layer ? data.layers[ attributes.layerIndex ].visible : true; - - if ( attributes.isInstanceDefinitionObject ) { - - instanceDefinitionObjects.push( _object ); - - } else { - - object.add( _object ); - - } - - break; - - } - - } - - for ( let i = 0; i < instanceDefinitions.length; i ++ ) { - - const iDef = instanceDefinitions[ i ]; - - objects = []; - - for ( let j = 0; j < iDef.attributes.objectIds.length; j ++ ) { - - const objId = iDef.attributes.objectIds[ j ]; - - for ( let p = 0; p < instanceDefinitionObjects.length; p ++ ) { - - const idoId = instanceDefinitionObjects[ p ].userData.attributes.id; - - if ( objId === idoId ) { - - objects.push( instanceDefinitionObjects[ p ] ); - - } - - } - - } - - // Currently clones geometry and does not take advantage of instancing - - for ( let j = 0; j < instanceReferences.length; j ++ ) { - - const iRef = instanceReferences[ j ]; - - if ( iRef.geometry.parentIdefId === iDef.attributes.id ) { - - const iRefObject = new Object3D(); - const xf = iRef.geometry.xform.array; - - const matrix = new Matrix4(); - matrix.set( ...xf ); - - iRefObject.applyMatrix4( matrix ); - - for ( let p = 0; p < objects.length; p ++ ) { - - iRefObject.add( objects[ p ].clone( true ) ); - - } - - object.add( iRefObject ); - - } - - } - - } - - object.userData[ 'materials' ] = this.materials; - object.name = ''; - return object; - - } - - _createObject( obj, mat ) { - - const loader = new BufferGeometryLoader(); - - const attributes = obj.attributes; - - let geometry, material, _color, color; - - switch ( obj.objectType ) { - - case 'Point': - case 'PointSet': - - geometry = loader.parse( obj.geometry ); - - if ( geometry.attributes.hasOwnProperty( 'color' ) ) { - - material = new PointsMaterial( { vertexColors: true, sizeAttenuation: false, size: 2 } ); - - } else { - - _color = attributes.drawColor; - color = new Color( _color.r / 255.0, _color.g / 255.0, _color.b / 255.0 ); - material = new PointsMaterial( { color: color, sizeAttenuation: false, size: 2 } ); - - } - - material = this._compareMaterials( material ); - - const points = new Points( geometry, material ); - points.userData[ 'attributes' ] = attributes; - points.userData[ 'objectType' ] = obj.objectType; - - if ( attributes.name ) { - - points.name = attributes.name; - - } - - return points; - - case 'Mesh': - case 'Extrusion': - case 'SubD': - case 'Brep': - - if ( obj.geometry === null ) return; - - geometry = loader.parse( obj.geometry ); - - - if ( mat === null ) { - - mat = this._createMaterial(); - - } - - - if ( geometry.attributes.hasOwnProperty( 'color' ) ) { - - mat.vertexColors = true; - - } - - mat = this._compareMaterials( mat ); - - const mesh = new Mesh( geometry, mat ); - mesh.castShadow = attributes.castsShadows; - mesh.receiveShadow = attributes.receivesShadows; - mesh.userData[ 'attributes' ] = attributes; - mesh.userData[ 'objectType' ] = obj.objectType; - - if ( attributes.name ) { - - mesh.name = attributes.name; - - } - - return mesh; - - case 'Curve': - - geometry = loader.parse( obj.geometry ); - - _color = attributes.drawColor; - color = new Color( _color.r / 255.0, _color.g / 255.0, _color.b / 255.0 ); - - material = new LineBasicMaterial( { color: color } ); - material = this._compareMaterials( material ); - - const lines = new Line( geometry, material ); - lines.userData[ 'attributes' ] = attributes; - lines.userData[ 'objectType' ] = obj.objectType; - - if ( attributes.name ) { - - lines.name = attributes.name; - - } - - return lines; - - case 'TextDot': - - geometry = obj.geometry; - - const ctx = document.createElement( 'canvas' ).getContext( '2d' ); - const font = `${geometry.fontHeight}px ${geometry.fontFace}`; - ctx.font = font; - const width = ctx.measureText( geometry.text ).width + 10; - const height = geometry.fontHeight + 10; - - const r = window.devicePixelRatio; - - ctx.canvas.width = width * r; - ctx.canvas.height = height * r; - ctx.canvas.style.width = width + 'px'; - ctx.canvas.style.height = height + 'px'; - ctx.setTransform( r, 0, 0, r, 0, 0 ); - - ctx.font = font; - ctx.textBaseline = 'middle'; - ctx.textAlign = 'center'; - color = attributes.drawColor; - ctx.fillStyle = `rgba(${color.r},${color.g},${color.b},${color.a})`; - ctx.fillRect( 0, 0, width, height ); - ctx.fillStyle = 'white'; - ctx.fillText( geometry.text, width / 2, height / 2 ); - - const texture = new CanvasTexture( ctx.canvas ); - texture.minFilter = LinearFilter; - texture.wrapS = ClampToEdgeWrapping; - texture.wrapT = ClampToEdgeWrapping; - - material = new SpriteMaterial( { map: texture, depthTest: false } ); - const sprite = new Sprite( material ); - sprite.position.set( geometry.point[ 0 ], geometry.point[ 1 ], geometry.point[ 2 ] ); - sprite.scale.set( width / 10, height / 10, 1.0 ); - - sprite.userData[ 'attributes' ] = attributes; - sprite.userData[ 'objectType' ] = obj.objectType; - - if ( attributes.name ) { - - sprite.name = attributes.name; - - } - - return sprite; - - case 'Light': - - geometry = obj.geometry; - - let light; - - switch ( geometry.lightStyle.name ) { - - case 'LightStyle_WorldPoint': - - light = new PointLight(); - light.castShadow = attributes.castsShadows; - light.position.set( geometry.location[ 0 ], geometry.location[ 1 ], geometry.location[ 2 ] ); - light.shadow.normalBias = 0.1; - - break; - - case 'LightStyle_WorldSpot': - - light = new SpotLight(); - light.castShadow = attributes.castsShadows; - light.position.set( geometry.location[ 0 ], geometry.location[ 1 ], geometry.location[ 2 ] ); - light.target.position.set( geometry.direction[ 0 ], geometry.direction[ 1 ], geometry.direction[ 2 ] ); - light.angle = geometry.spotAngleRadians; - light.shadow.normalBias = 0.1; - - break; - - case 'LightStyle_WorldRectangular': - - light = new RectAreaLight(); - const width = Math.abs( geometry.width[ 2 ] ); - const height = Math.abs( geometry.length[ 0 ] ); - light.position.set( geometry.location[ 0 ] - ( height / 2 ), geometry.location[ 1 ], geometry.location[ 2 ] - ( width / 2 ) ); - light.height = height; - light.width = width; - light.lookAt( geometry.direction[ 0 ], geometry.direction[ 1 ], geometry.direction[ 2 ] ); - - break; - - case 'LightStyle_WorldDirectional': - - light = new DirectionalLight(); - light.castShadow = attributes.castsShadows; - light.position.set( geometry.location[ 0 ], geometry.location[ 1 ], geometry.location[ 2 ] ); - light.target.position.set( geometry.direction[ 0 ], geometry.direction[ 1 ], geometry.direction[ 2 ] ); - light.shadow.normalBias = 0.1; - - break; - - case 'LightStyle_WorldLinear': - // no conversion exists, warning has already been printed to the console - break; - - default: - break; - - } - - if ( light ) { - - light.intensity = geometry.intensity; - _color = geometry.diffuse; - color = new Color( _color.r / 255.0, _color.g / 255.0, _color.b / 255.0 ); - light.color = color; - light.userData[ 'attributes' ] = attributes; - light.userData[ 'objectType' ] = obj.objectType; - - } - - return light; - - } - - } - - _initLibrary() { - - if ( ! this.libraryPending ) { - - // Load rhino3dm wrapper. - const jsLoader = new FileLoader( this.manager ); - jsLoader.setPath( this.libraryPath ); - const jsContent = new Promise( ( resolve, reject ) => { - - jsLoader.load( 'rhino3dm.js', resolve, undefined, reject ); - - } ); - - // Load rhino3dm WASM binary. - const binaryLoader = new FileLoader( this.manager ); - binaryLoader.setPath( this.libraryPath ); - binaryLoader.setResponseType( 'arraybuffer' ); - const binaryContent = new Promise( ( resolve, reject ) => { - - binaryLoader.load( 'rhino3dm.wasm', resolve, undefined, reject ); - - } ); - - this.libraryPending = Promise.all( [ jsContent, binaryContent ] ) - .then( ( [ jsContent, binaryContent ] ) => { - - //this.libraryBinary = binaryContent; - this.libraryConfig.wasmBinary = binaryContent; - - const fn = Rhino3dmWorker.toString(); - - const body = [ - '/* rhino3dm.js */', - jsContent, - '/* worker */', - fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) ) - ].join( '\n' ); - - this.workerSourceURL = URL.createObjectURL( new Blob( [ body ] ) ); - - } ); - - } - - return this.libraryPending; - - } - - _getWorker( taskCost ) { - - return this._initLibrary().then( () => { - - if ( this.workerPool.length < this.workerLimit ) { - - const worker = new Worker( this.workerSourceURL ); - - worker._callbacks = {}; - worker._taskCosts = {}; - worker._taskLoad = 0; - - worker.postMessage( { - type: 'init', - libraryConfig: this.libraryConfig - } ); - - worker.onmessage = e => { - - const message = e.data; - - switch ( message.type ) { - - case 'warning': - this.warnings.push( message.data ); - console.warn( message.data ); - break; - - case 'decode': - worker._callbacks[ message.id ].resolve( message ); - break; - - case 'error': - worker._callbacks[ message.id ].reject( message ); - break; - - default: - console.error( 'THREE.Rhino3dmLoader: Unexpected message, "' + message.type + '"' ); - - } - - }; - - this.workerPool.push( worker ); - - } else { - - this.workerPool.sort( function ( a, b ) { - - return a._taskLoad > b._taskLoad ? - 1 : 1; - - } ); - - } - - const worker = this.workerPool[ this.workerPool.length - 1 ]; - - worker._taskLoad += taskCost; - - return worker; - - } ); - - } - - _releaseTask( worker, taskID ) { - - worker._taskLoad -= worker._taskCosts[ taskID ]; - delete worker._callbacks[ taskID ]; - delete worker._taskCosts[ taskID ]; - - } - - dispose() { - - for ( let i = 0; i < this.workerPool.length; ++ i ) { - - this.workerPool[ i ].terminate(); - - } - - this.workerPool.length = 0; - - return this; - - } - -} - -/* WEB WORKER */ - -function Rhino3dmWorker() { - - let libraryPending; - let libraryConfig; - let rhino; - let taskID; - - onmessage = function ( e ) { - - const message = e.data; - - switch ( message.type ) { - - case 'init': - - libraryConfig = message.libraryConfig; - const wasmBinary = libraryConfig.wasmBinary; - let RhinoModule; - libraryPending = new Promise( function ( resolve ) { - - /* Like Basis Loader */ - RhinoModule = { wasmBinary, onRuntimeInitialized: resolve }; - - rhino3dm( RhinoModule ); // eslint-disable-line no-undef - - } ).then( () => { - - rhino = RhinoModule; - - } ); - - break; - - case 'decode': - - taskID = message.id; - const buffer = message.buffer; - libraryPending.then( () => { - - try { - - const data = decodeObjects( rhino, buffer ); - self.postMessage( { type: 'decode', id: message.id, data } ); - - } catch ( error ) { - - self.postMessage( { type: 'error', id: message.id, error } ); - - } - - } ); - - break; - - } - - }; - - function decodeObjects( rhino, buffer ) { - - const arr = new Uint8Array( buffer ); - const doc = rhino.File3dm.fromByteArray( arr ); - - const objects = []; - const materials = []; - const layers = []; - const views = []; - const namedViews = []; - const groups = []; - const strings = []; - - //Handle objects - - const objs = doc.objects(); - const cnt = objs.count; - - for ( let i = 0; i < cnt; i ++ ) { - - const _object = objs.get( i ); - - const object = extractObjectData( _object, doc ); - - _object.delete(); - - if ( object ) { - - objects.push( object ); - - } - - } - - // Handle instance definitions - // console.log( `Instance Definitions Count: ${doc.instanceDefinitions().count()}` ); - - for ( let i = 0; i < doc.instanceDefinitions().count; i ++ ) { - - const idef = doc.instanceDefinitions().get( i ); - const idefAttributes = extractProperties( idef ); - idefAttributes.objectIds = idef.getObjectIds(); - - objects.push( { geometry: null, attributes: idefAttributes, objectType: 'InstanceDefinition' } ); - - } - - // Handle materials - - const textureTypes = [ - // rhino.TextureType.Bitmap, - rhino.TextureType.Diffuse, - rhino.TextureType.Bump, - rhino.TextureType.Transparency, - rhino.TextureType.Opacity, - rhino.TextureType.Emap - ]; - - const pbrTextureTypes = [ - rhino.TextureType.PBR_BaseColor, - rhino.TextureType.PBR_Subsurface, - rhino.TextureType.PBR_SubsurfaceScattering, - rhino.TextureType.PBR_SubsurfaceScatteringRadius, - rhino.TextureType.PBR_Metallic, - rhino.TextureType.PBR_Specular, - rhino.TextureType.PBR_SpecularTint, - rhino.TextureType.PBR_Roughness, - rhino.TextureType.PBR_Anisotropic, - rhino.TextureType.PBR_Anisotropic_Rotation, - rhino.TextureType.PBR_Sheen, - rhino.TextureType.PBR_SheenTint, - rhino.TextureType.PBR_Clearcoat, - rhino.TextureType.PBR_ClearcoatBump, - rhino.TextureType.PBR_ClearcoatRoughness, - rhino.TextureType.PBR_OpacityIor, - rhino.TextureType.PBR_OpacityRoughness, - rhino.TextureType.PBR_Emission, - rhino.TextureType.PBR_AmbientOcclusion, - rhino.TextureType.PBR_Displacement - ]; - - for ( let i = 0; i < doc.materials().count; i ++ ) { - - const _material = doc.materials().get( i ); - - const material = extractProperties( _material ); - - const textures = []; - - textures.push( ...extractTextures( _material, textureTypes, doc ) ); - - material.pbrSupported = _material.physicallyBased().supported; - - if ( material.pbrSupported ) { - - textures.push( ...extractTextures( _material, pbrTextureTypes, doc ) ); - material.pbr = extractProperties( _material.physicallyBased() ); - - } - - material.textures = textures; - - materials.push( material ); - - _material.delete(); - - } - - // Handle layers - - for ( let i = 0; i < doc.layers().count; i ++ ) { - - const _layer = doc.layers().get( i ); - const layer = extractProperties( _layer ); - - layers.push( layer ); - - _layer.delete(); - - } - - // Handle views - - for ( let i = 0; i < doc.views().count; i ++ ) { - - const _view = doc.views().get( i ); - const view = extractProperties( _view ); - - views.push( view ); - - _view.delete(); - - } - - // Handle named views - - for ( let i = 0; i < doc.namedViews().count; i ++ ) { - - const _namedView = doc.namedViews().get( i ); - const namedView = extractProperties( _namedView ); - - namedViews.push( namedView ); - - _namedView.delete(); - - } - - // Handle groups - - for ( let i = 0; i < doc.groups().count; i ++ ) { - - const _group = doc.groups().get( i ); - const group = extractProperties( _group ); - - groups.push( group ); - - _group.delete(); - - } - - // Handle settings - - const settings = extractProperties( doc.settings() ); - - //TODO: Handle other document stuff like dimstyles, instance definitions, bitmaps etc. - - // Handle dimstyles - // console.log( `Dimstyle Count: ${doc.dimstyles().count()}` ); - - // Handle bitmaps - // console.log( `Bitmap Count: ${doc.bitmaps().count()}` ); - - // Handle strings - // console.log( `Document Strings Count: ${doc.strings().count()}` ); - // Note: doc.strings().documentUserTextCount() counts any doc.strings defined in a section - // console.log( `Document User Text Count: ${doc.strings().documentUserTextCount()}` ); - - const strings_count = doc.strings().count; - - for ( let i = 0; i < strings_count; i ++ ) { - - strings.push( doc.strings().get( i ) ); - - } - - // Handle Render Environments for Material Environment - - // get the id of the active render environment skylight, which we'll use for environment texture - const reflectionId = doc.settings().renderSettings().renderEnvironments.reflectionId; - - const rc = doc.renderContent(); - - let renderEnvironment = null; - - for ( let i = 0; i < rc.count; i ++ ) { - - const content = rc.get( i ); - - switch ( content.kind ) { - - case 'environment': - - const id = content.id; - - // there could be multiple render environments in a 3dm file - if ( id !== reflectionId ) break; - - const renderTexture = content.findChild( 'texture' ); - const fileName = renderTexture.fileName; - - for ( let j = 0; j < doc.embeddedFiles().count; j ++ ) { - - const _fileName = doc.embeddedFiles().get( j ).fileName; - - if ( fileName === _fileName ) { - - const background = doc.getEmbeddedFileAsBase64( fileName ); - const backgroundImage = 'data:image/png;base64,' + background; - renderEnvironment = { type: 'renderEnvironment', image: backgroundImage, name: fileName }; - - } - - } - - break; - - } - - } - - // Handle Render Settings - - const renderSettings = { - ambientLight: doc.settings().renderSettings().ambientLight, - backgroundColorTop: doc.settings().renderSettings().backgroundColorTop, - backgroundColorBottom: doc.settings().renderSettings().backgroundColorBottom, - useHiddenLights: doc.settings().renderSettings().useHiddenLights, - depthCue: doc.settings().renderSettings().depthCue, - flatShade: doc.settings().renderSettings().flatShade, - renderBackFaces: doc.settings().renderSettings().renderBackFaces, - renderPoints: doc.settings().renderSettings().renderPoints, - renderCurves: doc.settings().renderSettings().renderCurves, - renderIsoParams: doc.settings().renderSettings().renderIsoParams, - renderMeshEdges: doc.settings().renderSettings().renderMeshEdges, - renderAnnotations: doc.settings().renderSettings().renderAnnotations, - useViewportSize: doc.settings().renderSettings().useViewportSize, - scaleBackgroundToFit: doc.settings().renderSettings().scaleBackgroundToFit, - transparentBackground: doc.settings().renderSettings().transparentBackground, - imageDpi: doc.settings().renderSettings().imageDpi, - shadowMapLevel: doc.settings().renderSettings().shadowMapLevel, - namedView: doc.settings().renderSettings().namedView, - snapShot: doc.settings().renderSettings().snapShot, - specificViewport: doc.settings().renderSettings().specificViewport, - groundPlane: extractProperties( doc.settings().renderSettings().groundPlane ), - safeFrame: extractProperties( doc.settings().renderSettings().safeFrame ), - dithering: extractProperties( doc.settings().renderSettings().dithering ), - skylight: extractProperties( doc.settings().renderSettings().skylight ), - linearWorkflow: extractProperties( doc.settings().renderSettings().linearWorkflow ), - renderChannels: extractProperties( doc.settings().renderSettings().renderChannels ), - sun: extractProperties( doc.settings().renderSettings().sun ), - renderEnvironments: extractProperties( doc.settings().renderSettings().renderEnvironments ), - postEffects: extractProperties( doc.settings().renderSettings().postEffects ), - - }; - - doc.delete(); - - return { objects, materials, layers, views, namedViews, groups, strings, settings, renderSettings, renderEnvironment }; - - } - - function extractTextures( m, tTypes, d ) { - - const textures = []; - - for ( let i = 0; i < tTypes.length; i ++ ) { - - const _texture = m.getTexture( tTypes[ i ] ); - if ( _texture ) { - - let textureType = tTypes[ i ].constructor.name; - textureType = textureType.substring( 12, textureType.length ); - const texture = extractTextureData( _texture, textureType, d ); - textures.push( texture ); - _texture.delete(); - - } - - } - - return textures; - - } - - function extractTextureData( t, tType, d ) { - - const texture = { type: tType }; - - const image = d.getEmbeddedFileAsBase64( t.fileName ); - - texture.wrapU = t.wrapU; - texture.wrapV = t.wrapV; - texture.wrapW = t.wrapW; - const uvw = t.uvwTransform.toFloatArray( true ); - - texture.repeat = [ uvw[ 0 ], uvw[ 5 ] ]; - - if ( image ) { - - texture.image = 'data:image/png;base64,' + image; - - } else { - - self.postMessage( { type: 'warning', id: taskID, data: { - message: `THREE.3DMLoader: Image for ${tType} texture not embedded in file.`, - type: 'missing resource' - } - - } ); - - texture.image = null; - - } - - return texture; - - } - - function extractObjectData( object, doc ) { - - const _geometry = object.geometry(); - const _attributes = object.attributes(); - let objectType = _geometry.objectType; - let geometry, attributes, position, data, mesh; - - // skip instance definition objects - //if( _attributes.isInstanceDefinitionObject ) { continue; } - - // TODO: handle other geometry types - switch ( objectType ) { - - case rhino.ObjectType.Curve: - - const pts = curveToPoints( _geometry, 100 ); - - position = {}; - attributes = {}; - data = {}; - - position.itemSize = 3; - position.type = 'Float32Array'; - position.array = []; - - for ( let j = 0; j < pts.length; j ++ ) { - - position.array.push( pts[ j ][ 0 ] ); - position.array.push( pts[ j ][ 1 ] ); - position.array.push( pts[ j ][ 2 ] ); - - } - - attributes.position = position; - data.attributes = attributes; - - geometry = { data }; - - break; - - case rhino.ObjectType.Point: - - const pt = _geometry.location; - - position = {}; - const color = {}; - attributes = {}; - data = {}; - - position.itemSize = 3; - position.type = 'Float32Array'; - position.array = [ pt[ 0 ], pt[ 1 ], pt[ 2 ] ]; - - const _color = _attributes.drawColor( doc ); - - color.itemSize = 3; - color.type = 'Float32Array'; - color.array = [ _color.r / 255.0, _color.g / 255.0, _color.b / 255.0 ]; - - attributes.position = position; - attributes.color = color; - data.attributes = attributes; - - geometry = { data }; - - break; - - case rhino.ObjectType.PointSet: - case rhino.ObjectType.Mesh: - - geometry = _geometry.toThreejsJSON(); - - break; - - case rhino.ObjectType.Brep: - - const faces = _geometry.faces(); - mesh = new rhino.Mesh(); - - for ( let faceIndex = 0; faceIndex < faces.count; faceIndex ++ ) { - - const face = faces.get( faceIndex ); - const _mesh = face.getMesh( rhino.MeshType.Any ); - - if ( _mesh ) { - - mesh.append( _mesh ); - _mesh.delete(); - - } - - face.delete(); - - } - - if ( mesh.faces().count > 0 ) { - - mesh.compact(); - geometry = mesh.toThreejsJSON(); - faces.delete(); - - } - - mesh.delete(); - - break; - - case rhino.ObjectType.Extrusion: - - mesh = _geometry.getMesh( rhino.MeshType.Any ); - - if ( mesh ) { - - geometry = mesh.toThreejsJSON(); - mesh.delete(); - - } - - break; - - case rhino.ObjectType.TextDot: - - geometry = extractProperties( _geometry ); - - break; - - case rhino.ObjectType.Light: - - geometry = extractProperties( _geometry ); - - if ( geometry.lightStyle.name === 'LightStyle_WorldLinear' ) { - - self.postMessage( { type: 'warning', id: taskID, data: { - message: `THREE.3DMLoader: No conversion exists for ${objectType.constructor.name} ${geometry.lightStyle.name}`, - type: 'no conversion', - guid: _attributes.id - } - - } ); - - } - - break; - - case rhino.ObjectType.InstanceReference: - - geometry = extractProperties( _geometry ); - geometry.xform = extractProperties( _geometry.xform ); - geometry.xform.array = _geometry.xform.toFloatArray( true ); - - break; - - case rhino.ObjectType.SubD: - - // TODO: precalculate resulting vertices and faces and warn on excessive results - _geometry.subdivide( 3 ); - mesh = rhino.Mesh.createFromSubDControlNet( _geometry, false ); - if ( mesh ) { - - geometry = mesh.toThreejsJSON(); - mesh.delete(); - - } - - break; - - /* - case rhino.ObjectType.Annotation: - case rhino.ObjectType.Hatch: - case rhino.ObjectType.ClipPlane: - */ - - default: - - self.postMessage( { type: 'warning', id: taskID, data: { - message: `THREE.3DMLoader: Conversion not implemented for ${objectType.constructor.name}`, - type: 'not implemented', - guid: _attributes.id - } - - } ); - - break; - - } - - if ( geometry ) { - - attributes = extractProperties( _attributes ); - attributes.geometry = extractProperties( _geometry ); - - if ( _attributes.groupCount > 0 ) { - - attributes.groupIds = _attributes.getGroupList(); - - } - - if ( _attributes.userStringCount > 0 ) { - - attributes.userStrings = _attributes.getUserStrings(); - - } - - if ( _geometry.userStringCount > 0 ) { - - attributes.geometry.userStrings = _geometry.getUserStrings(); - - } - - if ( _attributes.decals().count > 0 ) { - - self.postMessage( { type: 'warning', id: taskID, data: { - message: 'THREE.3DMLoader: No conversion exists for the decals associated with this object.', - type: 'no conversion', - guid: _attributes.id - } - - } ); - - } - - attributes.drawColor = _attributes.drawColor( doc ); - - objectType = objectType.constructor.name; - objectType = objectType.substring( 11, objectType.length ); - - return { geometry, attributes, objectType }; - - } else { - - self.postMessage( { type: 'warning', id: taskID, data: { - message: `THREE.3DMLoader: ${objectType.constructor.name} has no associated mesh geometry.`, - type: 'missing mesh', - guid: _attributes.id - } - - } ); - - } - - } - - function extractProperties( object ) { - - const result = {}; - - for ( const property in object ) { - - const value = object[ property ]; - - if ( typeof value !== 'function' ) { - - if ( typeof value === 'object' && value !== null && value.hasOwnProperty( 'constructor' ) ) { - - result[ property ] = { name: value.constructor.name, value: value.value }; - - } else if ( typeof value === 'object' && value !== null ) { - - result[ property ] = extractProperties( value ); - - } else { - - result[ property ] = value; - - } - - } else { - - // these are functions that could be called to extract more data. - //console.log( `${property}: ${object[ property ].constructor.name}` ); - - } - - } - - return result; - - } - - function curveToPoints( curve, pointLimit ) { - - let pointCount = pointLimit; - let rc = []; - const ts = []; - - if ( curve instanceof rhino.LineCurve ) { - - return [ curve.pointAtStart, curve.pointAtEnd ]; - - } - - if ( curve instanceof rhino.PolylineCurve ) { - - pointCount = curve.pointCount; - for ( let i = 0; i < pointCount; i ++ ) { - - rc.push( curve.point( i ) ); - - } - - return rc; - - } - - if ( curve instanceof rhino.PolyCurve ) { - - const segmentCount = curve.segmentCount; - - for ( let i = 0; i < segmentCount; i ++ ) { - - const segment = curve.segmentCurve( i ); - const segmentArray = curveToPoints( segment, pointCount ); - rc = rc.concat( segmentArray ); - segment.delete(); - - } - - return rc; - - } - - if ( curve instanceof rhino.ArcCurve ) { - - pointCount = Math.floor( curve.angleDegrees / 5 ); - pointCount = pointCount < 2 ? 2 : pointCount; - // alternative to this hardcoded version: https://stackoverflow.com/a/18499923/2179399 - - } - - if ( curve instanceof rhino.NurbsCurve && curve.degree === 1 ) { - - const pLine = curve.tryGetPolyline(); - - for ( let i = 0; i < pLine.count; i ++ ) { - - rc.push( pLine.get( i ) ); - - } - - pLine.delete(); - - return rc; - - } - - const domain = curve.domain; - const divisions = pointCount - 1.0; - - for ( let j = 0; j < pointCount; j ++ ) { - - const t = domain[ 0 ] + ( j / divisions ) * ( domain[ 1 ] - domain[ 0 ] ); - - if ( t === domain[ 0 ] || t === domain[ 1 ] ) { - - ts.push( t ); - continue; - - } - - const tan = curve.tangentAt( t ); - const prevTan = curve.tangentAt( ts.slice( - 1 )[ 0 ] ); - - // Duplicated from THREE.Vector3 - // How to pass imports to worker? - - const tS = tan[ 0 ] * tan[ 0 ] + tan[ 1 ] * tan[ 1 ] + tan[ 2 ] * tan[ 2 ]; - const ptS = prevTan[ 0 ] * prevTan[ 0 ] + prevTan[ 1 ] * prevTan[ 1 ] + prevTan[ 2 ] * prevTan[ 2 ]; - - const denominator = Math.sqrt( tS * ptS ); - - let angle; - - if ( denominator === 0 ) { - - angle = Math.PI / 2; - - } else { - - const theta = ( tan.x * prevTan.x + tan.y * prevTan.y + tan.z * prevTan.z ) / denominator; - angle = Math.acos( Math.max( - 1, Math.min( 1, theta ) ) ); - - } - - if ( angle < 0.1 ) continue; - - ts.push( t ); - - } - - rc = ts.map( t => curve.pointAt( t ) ); - return rc; - - } - -} - -export { Rhino3dmLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/3MFLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/3MFLoader.js deleted file mode 100644 index 10f339b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/3MFLoader.js +++ /dev/null @@ -1,1480 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - ClampToEdgeWrapping, - Color, - FileLoader, - Float32BufferAttribute, - Group, - LinearFilter, - LinearMipmapLinearFilter, - Loader, - Matrix4, - Mesh, - MeshPhongMaterial, - MeshStandardMaterial, - MirroredRepeatWrapping, - NearestFilter, - RepeatWrapping, - TextureLoader, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; - -const COLOR_SPACE_3MF = SRGBColorSpace; - -/** - * - * 3D Manufacturing Format (3MF) specification: https://3mf.io/specification/ - * - * The following features from the core specification are supported: - * - * - 3D Models - * - Object Resources (Meshes and Components) - * - Material Resources (Base Materials) - * - * 3MF Materials and Properties Extension are only partially supported. - * - * - Texture 2D - * - Texture 2D Groups - * - Color Groups (Vertex Colors) - * - Metallic Display Properties (PBR) - */ - -class ThreeMFLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.availableExtensions = []; - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - const loader = new FileLoader( scope.manager ); - loader.setPath( scope.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( buffer ) { - - try { - - onLoad( scope.parse( buffer ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - const scope = this; - const textureLoader = new TextureLoader( this.manager ); - - function loadDocument( data ) { - - let zip = null; - let file = null; - - let relsName; - let modelRelsName; - const modelPartNames = []; - const texturesPartNames = []; - - let modelRels; - const modelParts = {}; - const printTicketParts = {}; - const texturesParts = {}; - - const textDecoder = new TextDecoder(); - - try { - - zip = fflate.unzipSync( new Uint8Array( data ) ); - - } catch ( e ) { - - if ( e instanceof ReferenceError ) { - - console.error( 'THREE.3MFLoader: fflate missing and file is compressed.' ); - return null; - - } - - } - - for ( file in zip ) { - - if ( file.match( /\_rels\/.rels$/ ) ) { - - relsName = file; - - } else if ( file.match( /3D\/_rels\/.*\.model\.rels$/ ) ) { - - modelRelsName = file; - - } else if ( file.match( /^3D\/.*\.model$/ ) ) { - - modelPartNames.push( file ); - - } else if ( file.match( /^3D\/Textures?\/.*/ ) ) { - - texturesPartNames.push( file ); - - } - - } - - if ( relsName === undefined ) throw new Error( 'THREE.ThreeMFLoader: Cannot find relationship file `rels` in 3MF archive.' ); - - // - - const relsView = zip[ relsName ]; - const relsFileText = textDecoder.decode( relsView ); - const rels = parseRelsXml( relsFileText ); - - // - - if ( modelRelsName ) { - - const relsView = zip[ modelRelsName ]; - const relsFileText = textDecoder.decode( relsView ); - modelRels = parseRelsXml( relsFileText ); - - } - - // - - for ( let i = 0; i < modelPartNames.length; i ++ ) { - - const modelPart = modelPartNames[ i ]; - const view = zip[ modelPart ]; - - const fileText = textDecoder.decode( view ); - const xmlData = new DOMParser().parseFromString( fileText, 'application/xml' ); - - if ( xmlData.documentElement.nodeName.toLowerCase() !== 'model' ) { - - console.error( 'THREE.3MFLoader: Error loading 3MF - no 3MF document found: ', modelPart ); - - } - - const modelNode = xmlData.querySelector( 'model' ); - const extensions = {}; - - for ( let i = 0; i < modelNode.attributes.length; i ++ ) { - - const attr = modelNode.attributes[ i ]; - if ( attr.name.match( /^xmlns:(.+)$/ ) ) { - - extensions[ attr.value ] = RegExp.$1; - - } - - } - - const modelData = parseModelNode( modelNode ); - modelData[ 'xml' ] = modelNode; - - if ( 0 < Object.keys( extensions ).length ) { - - modelData[ 'extensions' ] = extensions; - - } - - modelParts[ modelPart ] = modelData; - - } - - // - - for ( let i = 0; i < texturesPartNames.length; i ++ ) { - - const texturesPartName = texturesPartNames[ i ]; - texturesParts[ texturesPartName ] = zip[ texturesPartName ].buffer; - - } - - return { - rels: rels, - modelRels: modelRels, - model: modelParts, - printTicket: printTicketParts, - texture: texturesParts - }; - - } - - function parseRelsXml( relsFileText ) { - - const relationships = []; - - const relsXmlData = new DOMParser().parseFromString( relsFileText, 'application/xml' ); - - const relsNodes = relsXmlData.querySelectorAll( 'Relationship' ); - - for ( let i = 0; i < relsNodes.length; i ++ ) { - - const relsNode = relsNodes[ i ]; - - const relationship = { - target: relsNode.getAttribute( 'Target' ), //required - id: relsNode.getAttribute( 'Id' ), //required - type: relsNode.getAttribute( 'Type' ) //required - }; - - relationships.push( relationship ); - - } - - return relationships; - - } - - function parseMetadataNodes( metadataNodes ) { - - const metadataData = {}; - - for ( let i = 0; i < metadataNodes.length; i ++ ) { - - const metadataNode = metadataNodes[ i ]; - const name = metadataNode.getAttribute( 'name' ); - const validNames = [ - 'Title', - 'Designer', - 'Description', - 'Copyright', - 'LicenseTerms', - 'Rating', - 'CreationDate', - 'ModificationDate' - ]; - - if ( 0 <= validNames.indexOf( name ) ) { - - metadataData[ name ] = metadataNode.textContent; - - } - - } - - return metadataData; - - } - - function parseBasematerialsNode( basematerialsNode ) { - - const basematerialsData = { - id: basematerialsNode.getAttribute( 'id' ), // required - basematerials: [] - }; - - const basematerialNodes = basematerialsNode.querySelectorAll( 'base' ); - - for ( let i = 0; i < basematerialNodes.length; i ++ ) { - - const basematerialNode = basematerialNodes[ i ]; - const basematerialData = parseBasematerialNode( basematerialNode ); - basematerialData.index = i; // the order and count of the material nodes form an implicit 0-based index - basematerialsData.basematerials.push( basematerialData ); - - } - - return basematerialsData; - - } - - function parseTexture2DNode( texture2DNode ) { - - const texture2dData = { - id: texture2DNode.getAttribute( 'id' ), // required - path: texture2DNode.getAttribute( 'path' ), // required - contenttype: texture2DNode.getAttribute( 'contenttype' ), // required - tilestyleu: texture2DNode.getAttribute( 'tilestyleu' ), - tilestylev: texture2DNode.getAttribute( 'tilestylev' ), - filter: texture2DNode.getAttribute( 'filter' ), - }; - - return texture2dData; - - } - - function parseTextures2DGroupNode( texture2DGroupNode ) { - - const texture2DGroupData = { - id: texture2DGroupNode.getAttribute( 'id' ), // required - texid: texture2DGroupNode.getAttribute( 'texid' ), // required - displaypropertiesid: texture2DGroupNode.getAttribute( 'displaypropertiesid' ) - }; - - const tex2coordNodes = texture2DGroupNode.querySelectorAll( 'tex2coord' ); - - const uvs = []; - - for ( let i = 0; i < tex2coordNodes.length; i ++ ) { - - const tex2coordNode = tex2coordNodes[ i ]; - const u = tex2coordNode.getAttribute( 'u' ); - const v = tex2coordNode.getAttribute( 'v' ); - - uvs.push( parseFloat( u ), parseFloat( v ) ); - - } - - texture2DGroupData[ 'uvs' ] = new Float32Array( uvs ); - - return texture2DGroupData; - - } - - function parseColorGroupNode( colorGroupNode ) { - - const colorGroupData = { - id: colorGroupNode.getAttribute( 'id' ), // required - displaypropertiesid: colorGroupNode.getAttribute( 'displaypropertiesid' ) - }; - - const colorNodes = colorGroupNode.querySelectorAll( 'color' ); - - const colors = []; - const colorObject = new Color(); - - for ( let i = 0; i < colorNodes.length; i ++ ) { - - const colorNode = colorNodes[ i ]; - const color = colorNode.getAttribute( 'color' ); - - colorObject.setStyle( color.substring( 0, 7 ), COLOR_SPACE_3MF ); - - colors.push( colorObject.r, colorObject.g, colorObject.b ); - - } - - colorGroupData[ 'colors' ] = new Float32Array( colors ); - - return colorGroupData; - - } - - function parseMetallicDisplaypropertiesNode( metallicDisplaypropetiesNode ) { - - const metallicDisplaypropertiesData = { - id: metallicDisplaypropetiesNode.getAttribute( 'id' ) // required - }; - - const metallicNodes = metallicDisplaypropetiesNode.querySelectorAll( 'pbmetallic' ); - - const metallicData = []; - - for ( let i = 0; i < metallicNodes.length; i ++ ) { - - const metallicNode = metallicNodes[ i ]; - - metallicData.push( { - name: metallicNode.getAttribute( 'name' ), // required - metallicness: parseFloat( metallicNode.getAttribute( 'metallicness' ) ), // required - roughness: parseFloat( metallicNode.getAttribute( 'roughness' ) ) // required - } ); - - } - - metallicDisplaypropertiesData.data = metallicData; - - return metallicDisplaypropertiesData; - - } - - function parseBasematerialNode( basematerialNode ) { - - const basematerialData = {}; - - basematerialData[ 'name' ] = basematerialNode.getAttribute( 'name' ); // required - basematerialData[ 'displaycolor' ] = basematerialNode.getAttribute( 'displaycolor' ); // required - basematerialData[ 'displaypropertiesid' ] = basematerialNode.getAttribute( 'displaypropertiesid' ); - - return basematerialData; - - } - - function parseMeshNode( meshNode ) { - - const meshData = {}; - - const vertices = []; - const vertexNodes = meshNode.querySelectorAll( 'vertices vertex' ); - - for ( let i = 0; i < vertexNodes.length; i ++ ) { - - const vertexNode = vertexNodes[ i ]; - const x = vertexNode.getAttribute( 'x' ); - const y = vertexNode.getAttribute( 'y' ); - const z = vertexNode.getAttribute( 'z' ); - - vertices.push( parseFloat( x ), parseFloat( y ), parseFloat( z ) ); - - } - - meshData[ 'vertices' ] = new Float32Array( vertices ); - - const triangleProperties = []; - const triangles = []; - const triangleNodes = meshNode.querySelectorAll( 'triangles triangle' ); - - for ( let i = 0; i < triangleNodes.length; i ++ ) { - - const triangleNode = triangleNodes[ i ]; - const v1 = triangleNode.getAttribute( 'v1' ); - const v2 = triangleNode.getAttribute( 'v2' ); - const v3 = triangleNode.getAttribute( 'v3' ); - const p1 = triangleNode.getAttribute( 'p1' ); - const p2 = triangleNode.getAttribute( 'p2' ); - const p3 = triangleNode.getAttribute( 'p3' ); - const pid = triangleNode.getAttribute( 'pid' ); - - const triangleProperty = {}; - - triangleProperty[ 'v1' ] = parseInt( v1, 10 ); - triangleProperty[ 'v2' ] = parseInt( v2, 10 ); - triangleProperty[ 'v3' ] = parseInt( v3, 10 ); - - triangles.push( triangleProperty[ 'v1' ], triangleProperty[ 'v2' ], triangleProperty[ 'v3' ] ); - - // optional - - if ( p1 ) { - - triangleProperty[ 'p1' ] = parseInt( p1, 10 ); - - } - - if ( p2 ) { - - triangleProperty[ 'p2' ] = parseInt( p2, 10 ); - - } - - if ( p3 ) { - - triangleProperty[ 'p3' ] = parseInt( p3, 10 ); - - } - - if ( pid ) { - - triangleProperty[ 'pid' ] = pid; - - } - - if ( 0 < Object.keys( triangleProperty ).length ) { - - triangleProperties.push( triangleProperty ); - - } - - } - - meshData[ 'triangleProperties' ] = triangleProperties; - meshData[ 'triangles' ] = new Uint32Array( triangles ); - - return meshData; - - } - - function parseComponentsNode( componentsNode ) { - - const components = []; - - const componentNodes = componentsNode.querySelectorAll( 'component' ); - - for ( let i = 0; i < componentNodes.length; i ++ ) { - - const componentNode = componentNodes[ i ]; - const componentData = parseComponentNode( componentNode ); - components.push( componentData ); - - } - - return components; - - } - - function parseComponentNode( componentNode ) { - - const componentData = {}; - - componentData[ 'objectId' ] = componentNode.getAttribute( 'objectid' ); // required - - const transform = componentNode.getAttribute( 'transform' ); - - if ( transform ) { - - componentData[ 'transform' ] = parseTransform( transform ); - - } - - return componentData; - - } - - function parseTransform( transform ) { - - const t = []; - transform.split( ' ' ).forEach( function ( s ) { - - t.push( parseFloat( s ) ); - - } ); - - const matrix = new Matrix4(); - matrix.set( - t[ 0 ], t[ 3 ], t[ 6 ], t[ 9 ], - t[ 1 ], t[ 4 ], t[ 7 ], t[ 10 ], - t[ 2 ], t[ 5 ], t[ 8 ], t[ 11 ], - 0.0, 0.0, 0.0, 1.0 - ); - - return matrix; - - } - - function parseObjectNode( objectNode ) { - - const objectData = { - type: objectNode.getAttribute( 'type' ) - }; - - const id = objectNode.getAttribute( 'id' ); - - if ( id ) { - - objectData[ 'id' ] = id; - - } - - const pid = objectNode.getAttribute( 'pid' ); - - if ( pid ) { - - objectData[ 'pid' ] = pid; - - } - - const pindex = objectNode.getAttribute( 'pindex' ); - - if ( pindex ) { - - objectData[ 'pindex' ] = pindex; - - } - - const thumbnail = objectNode.getAttribute( 'thumbnail' ); - - if ( thumbnail ) { - - objectData[ 'thumbnail' ] = thumbnail; - - } - - const partnumber = objectNode.getAttribute( 'partnumber' ); - - if ( partnumber ) { - - objectData[ 'partnumber' ] = partnumber; - - } - - const name = objectNode.getAttribute( 'name' ); - - if ( name ) { - - objectData[ 'name' ] = name; - - } - - const meshNode = objectNode.querySelector( 'mesh' ); - - if ( meshNode ) { - - objectData[ 'mesh' ] = parseMeshNode( meshNode ); - - } - - const componentsNode = objectNode.querySelector( 'components' ); - - if ( componentsNode ) { - - objectData[ 'components' ] = parseComponentsNode( componentsNode ); - - } - - return objectData; - - } - - function parseResourcesNode( resourcesNode ) { - - const resourcesData = {}; - - resourcesData[ 'basematerials' ] = {}; - const basematerialsNodes = resourcesNode.querySelectorAll( 'basematerials' ); - - for ( let i = 0; i < basematerialsNodes.length; i ++ ) { - - const basematerialsNode = basematerialsNodes[ i ]; - const basematerialsData = parseBasematerialsNode( basematerialsNode ); - resourcesData[ 'basematerials' ][ basematerialsData[ 'id' ] ] = basematerialsData; - - } - - // - - resourcesData[ 'texture2d' ] = {}; - const textures2DNodes = resourcesNode.querySelectorAll( 'texture2d' ); - - for ( let i = 0; i < textures2DNodes.length; i ++ ) { - - const textures2DNode = textures2DNodes[ i ]; - const texture2DData = parseTexture2DNode( textures2DNode ); - resourcesData[ 'texture2d' ][ texture2DData[ 'id' ] ] = texture2DData; - - } - - // - - resourcesData[ 'colorgroup' ] = {}; - const colorGroupNodes = resourcesNode.querySelectorAll( 'colorgroup' ); - - for ( let i = 0; i < colorGroupNodes.length; i ++ ) { - - const colorGroupNode = colorGroupNodes[ i ]; - const colorGroupData = parseColorGroupNode( colorGroupNode ); - resourcesData[ 'colorgroup' ][ colorGroupData[ 'id' ] ] = colorGroupData; - - } - - // - - resourcesData[ 'pbmetallicdisplayproperties' ] = {}; - const pbmetallicdisplaypropertiesNodes = resourcesNode.querySelectorAll( 'pbmetallicdisplayproperties' ); - - for ( let i = 0; i < pbmetallicdisplaypropertiesNodes.length; i ++ ) { - - const pbmetallicdisplaypropertiesNode = pbmetallicdisplaypropertiesNodes[ i ]; - const pbmetallicdisplaypropertiesData = parseMetallicDisplaypropertiesNode( pbmetallicdisplaypropertiesNode ); - resourcesData[ 'pbmetallicdisplayproperties' ][ pbmetallicdisplaypropertiesData[ 'id' ] ] = pbmetallicdisplaypropertiesData; - - } - - // - - resourcesData[ 'texture2dgroup' ] = {}; - const textures2DGroupNodes = resourcesNode.querySelectorAll( 'texture2dgroup' ); - - for ( let i = 0; i < textures2DGroupNodes.length; i ++ ) { - - const textures2DGroupNode = textures2DGroupNodes[ i ]; - const textures2DGroupData = parseTextures2DGroupNode( textures2DGroupNode ); - resourcesData[ 'texture2dgroup' ][ textures2DGroupData[ 'id' ] ] = textures2DGroupData; - - } - - // - - resourcesData[ 'object' ] = {}; - const objectNodes = resourcesNode.querySelectorAll( 'object' ); - - for ( let i = 0; i < objectNodes.length; i ++ ) { - - const objectNode = objectNodes[ i ]; - const objectData = parseObjectNode( objectNode ); - resourcesData[ 'object' ][ objectData[ 'id' ] ] = objectData; - - } - - return resourcesData; - - } - - function parseBuildNode( buildNode ) { - - const buildData = []; - const itemNodes = buildNode.querySelectorAll( 'item' ); - - for ( let i = 0; i < itemNodes.length; i ++ ) { - - const itemNode = itemNodes[ i ]; - const buildItem = { - objectId: itemNode.getAttribute( 'objectid' ) - }; - const transform = itemNode.getAttribute( 'transform' ); - - if ( transform ) { - - buildItem[ 'transform' ] = parseTransform( transform ); - - } - - buildData.push( buildItem ); - - } - - return buildData; - - } - - function parseModelNode( modelNode ) { - - const modelData = { unit: modelNode.getAttribute( 'unit' ) || 'millimeter' }; - const metadataNodes = modelNode.querySelectorAll( 'metadata' ); - - if ( metadataNodes ) { - - modelData[ 'metadata' ] = parseMetadataNodes( metadataNodes ); - - } - - const resourcesNode = modelNode.querySelector( 'resources' ); - - if ( resourcesNode ) { - - modelData[ 'resources' ] = parseResourcesNode( resourcesNode ); - - } - - const buildNode = modelNode.querySelector( 'build' ); - - if ( buildNode ) { - - modelData[ 'build' ] = parseBuildNode( buildNode ); - - } - - return modelData; - - } - - function buildTexture( texture2dgroup, objects, modelData, textureData ) { - - const texid = texture2dgroup.texid; - const texture2ds = modelData.resources.texture2d; - const texture2d = texture2ds[ texid ]; - - if ( texture2d ) { - - const data = textureData[ texture2d.path ]; - const type = texture2d.contenttype; - - const blob = new Blob( [ data ], { type: type } ); - const sourceURI = URL.createObjectURL( blob ); - - const texture = textureLoader.load( sourceURI, function () { - - URL.revokeObjectURL( sourceURI ); - - } ); - - texture.colorSpace = COLOR_SPACE_3MF; - - // texture parameters - - switch ( texture2d.tilestyleu ) { - - case 'wrap': - texture.wrapS = RepeatWrapping; - break; - - case 'mirror': - texture.wrapS = MirroredRepeatWrapping; - break; - - case 'none': - case 'clamp': - texture.wrapS = ClampToEdgeWrapping; - break; - - default: - texture.wrapS = RepeatWrapping; - - } - - switch ( texture2d.tilestylev ) { - - case 'wrap': - texture.wrapT = RepeatWrapping; - break; - - case 'mirror': - texture.wrapT = MirroredRepeatWrapping; - break; - - case 'none': - case 'clamp': - texture.wrapT = ClampToEdgeWrapping; - break; - - default: - texture.wrapT = RepeatWrapping; - - } - - switch ( texture2d.filter ) { - - case 'auto': - texture.magFilter = LinearFilter; - texture.minFilter = LinearMipmapLinearFilter; - break; - - case 'linear': - texture.magFilter = LinearFilter; - texture.minFilter = LinearFilter; - break; - - case 'nearest': - texture.magFilter = NearestFilter; - texture.minFilter = NearestFilter; - break; - - default: - texture.magFilter = LinearFilter; - texture.minFilter = LinearMipmapLinearFilter; - - } - - return texture; - - } else { - - return null; - - } - - } - - function buildBasematerialsMeshes( basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData ) { - - const objectPindex = objectData.pindex; - - const materialMap = {}; - - for ( let i = 0, l = triangleProperties.length; i < l; i ++ ) { - - const triangleProperty = triangleProperties[ i ]; - const pindex = ( triangleProperty.p1 !== undefined ) ? triangleProperty.p1 : objectPindex; - - if ( materialMap[ pindex ] === undefined ) materialMap[ pindex ] = []; - - materialMap[ pindex ].push( triangleProperty ); - - } - - // - - const keys = Object.keys( materialMap ); - const meshes = []; - - for ( let i = 0, l = keys.length; i < l; i ++ ) { - - const materialIndex = keys[ i ]; - const trianglePropertiesProps = materialMap[ materialIndex ]; - const basematerialData = basematerials.basematerials[ materialIndex ]; - const material = getBuild( basematerialData, objects, modelData, textureData, objectData, buildBasematerial ); - - // - - const geometry = new BufferGeometry(); - - const positionData = []; - - const vertices = meshData.vertices; - - for ( let j = 0, jl = trianglePropertiesProps.length; j < jl; j ++ ) { - - const triangleProperty = trianglePropertiesProps[ j ]; - - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 2 ] ); - - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( positionData, 3 ) ); - - // - - const mesh = new Mesh( geometry, material ); - meshes.push( mesh ); - - } - - return meshes; - - } - - function buildTexturedMesh( texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData ) { - - // geometry - - const geometry = new BufferGeometry(); - - const positionData = []; - const uvData = []; - - const vertices = meshData.vertices; - const uvs = texture2dgroup.uvs; - - for ( let i = 0, l = triangleProperties.length; i < l; i ++ ) { - - const triangleProperty = triangleProperties[ i ]; - - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v1 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v2 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 0 ] ); - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 1 ] ); - positionData.push( vertices[ ( triangleProperty.v3 * 3 ) + 2 ] ); - - // - - uvData.push( uvs[ ( triangleProperty.p1 * 2 ) + 0 ] ); - uvData.push( uvs[ ( triangleProperty.p1 * 2 ) + 1 ] ); - - uvData.push( uvs[ ( triangleProperty.p2 * 2 ) + 0 ] ); - uvData.push( uvs[ ( triangleProperty.p2 * 2 ) + 1 ] ); - - uvData.push( uvs[ ( triangleProperty.p3 * 2 ) + 0 ] ); - uvData.push( uvs[ ( triangleProperty.p3 * 2 ) + 1 ] ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( positionData, 3 ) ); - geometry.setAttribute( 'uv', new Float32BufferAttribute( uvData, 2 ) ); - - // material - - const texture = getBuild( texture2dgroup, objects, modelData, textureData, objectData, buildTexture ); - - const material = new MeshPhongMaterial( { map: texture, flatShading: true } ); - - // mesh - - const mesh = new Mesh( geometry, material ); - - return mesh; - - } - - function buildVertexColorMesh( colorgroup, triangleProperties, meshData, objectData ) { - - // geometry - - const geometry = new BufferGeometry(); - - const positionData = []; - const colorData = []; - - const vertices = meshData.vertices; - const colors = colorgroup.colors; - - for ( let i = 0, l = triangleProperties.length; i < l; i ++ ) { - - const triangleProperty = triangleProperties[ i ]; - - const v1 = triangleProperty.v1; - const v2 = triangleProperty.v2; - const v3 = triangleProperty.v3; - - positionData.push( vertices[ ( v1 * 3 ) + 0 ] ); - positionData.push( vertices[ ( v1 * 3 ) + 1 ] ); - positionData.push( vertices[ ( v1 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( v2 * 3 ) + 0 ] ); - positionData.push( vertices[ ( v2 * 3 ) + 1 ] ); - positionData.push( vertices[ ( v2 * 3 ) + 2 ] ); - - positionData.push( vertices[ ( v3 * 3 ) + 0 ] ); - positionData.push( vertices[ ( v3 * 3 ) + 1 ] ); - positionData.push( vertices[ ( v3 * 3 ) + 2 ] ); - - // - - const p1 = ( triangleProperty.p1 !== undefined ) ? triangleProperty.p1 : objectData.pindex; - const p2 = ( triangleProperty.p2 !== undefined ) ? triangleProperty.p2 : p1; - const p3 = ( triangleProperty.p3 !== undefined ) ? triangleProperty.p3 : p1; - - colorData.push( colors[ ( p1 * 3 ) + 0 ] ); - colorData.push( colors[ ( p1 * 3 ) + 1 ] ); - colorData.push( colors[ ( p1 * 3 ) + 2 ] ); - - colorData.push( colors[ ( p2 * 3 ) + 0 ] ); - colorData.push( colors[ ( p2 * 3 ) + 1 ] ); - colorData.push( colors[ ( p2 * 3 ) + 2 ] ); - - colorData.push( colors[ ( p3 * 3 ) + 0 ] ); - colorData.push( colors[ ( p3 * 3 ) + 1 ] ); - colorData.push( colors[ ( p3 * 3 ) + 2 ] ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( positionData, 3 ) ); - geometry.setAttribute( 'color', new Float32BufferAttribute( colorData, 3 ) ); - - // material - - const material = new MeshPhongMaterial( { vertexColors: true, flatShading: true } ); - - // mesh - - const mesh = new Mesh( geometry, material ); - - return mesh; - - } - - function buildDefaultMesh( meshData ) { - - const geometry = new BufferGeometry(); - geometry.setIndex( new BufferAttribute( meshData[ 'triangles' ], 1 ) ); - geometry.setAttribute( 'position', new BufferAttribute( meshData[ 'vertices' ], 3 ) ); - - const material = new MeshPhongMaterial( { - name: Loader.DEFAULT_MATERIAL_NAME, - color: 0xffffff, - flatShading: true - } ); - - const mesh = new Mesh( geometry, material ); - - return mesh; - - } - - function buildMeshes( resourceMap, meshData, objects, modelData, textureData, objectData ) { - - const keys = Object.keys( resourceMap ); - const meshes = []; - - for ( let i = 0, il = keys.length; i < il; i ++ ) { - - const resourceId = keys[ i ]; - const triangleProperties = resourceMap[ resourceId ]; - const resourceType = getResourceType( resourceId, modelData ); - - switch ( resourceType ) { - - case 'material': - const basematerials = modelData.resources.basematerials[ resourceId ]; - const newMeshes = buildBasematerialsMeshes( basematerials, triangleProperties, meshData, objects, modelData, textureData, objectData ); - - for ( let j = 0, jl = newMeshes.length; j < jl; j ++ ) { - - meshes.push( newMeshes[ j ] ); - - } - - break; - - case 'texture': - const texture2dgroup = modelData.resources.texture2dgroup[ resourceId ]; - meshes.push( buildTexturedMesh( texture2dgroup, triangleProperties, meshData, objects, modelData, textureData, objectData ) ); - break; - - case 'vertexColors': - const colorgroup = modelData.resources.colorgroup[ resourceId ]; - meshes.push( buildVertexColorMesh( colorgroup, triangleProperties, meshData, objectData ) ); - break; - - case 'default': - meshes.push( buildDefaultMesh( meshData ) ); - break; - - default: - console.error( 'THREE.3MFLoader: Unsupported resource type.' ); - - } - - } - - if ( objectData.name ) { - - for ( let i = 0; i < meshes.length; i ++ ) { - - meshes[ i ].name = objectData.name; - - } - - } - - return meshes; - - } - - function getResourceType( pid, modelData ) { - - if ( modelData.resources.texture2dgroup[ pid ] !== undefined ) { - - return 'texture'; - - } else if ( modelData.resources.basematerials[ pid ] !== undefined ) { - - return 'material'; - - } else if ( modelData.resources.colorgroup[ pid ] !== undefined ) { - - return 'vertexColors'; - - } else if ( pid === 'default' ) { - - return 'default'; - - } else { - - return undefined; - - } - - } - - function analyzeObject( meshData, objectData ) { - - const resourceMap = {}; - - const triangleProperties = meshData[ 'triangleProperties' ]; - - const objectPid = objectData.pid; - - for ( let i = 0, l = triangleProperties.length; i < l; i ++ ) { - - const triangleProperty = triangleProperties[ i ]; - let pid = ( triangleProperty.pid !== undefined ) ? triangleProperty.pid : objectPid; - - if ( pid === undefined ) pid = 'default'; - - if ( resourceMap[ pid ] === undefined ) resourceMap[ pid ] = []; - - resourceMap[ pid ].push( triangleProperty ); - - } - - return resourceMap; - - } - - function buildGroup( meshData, objects, modelData, textureData, objectData ) { - - const group = new Group(); - - const resourceMap = analyzeObject( meshData, objectData ); - const meshes = buildMeshes( resourceMap, meshData, objects, modelData, textureData, objectData ); - - for ( let i = 0, l = meshes.length; i < l; i ++ ) { - - group.add( meshes[ i ] ); - - } - - return group; - - } - - function applyExtensions( extensions, meshData, modelXml ) { - - if ( ! extensions ) { - - return; - - } - - const availableExtensions = []; - const keys = Object.keys( extensions ); - - for ( let i = 0; i < keys.length; i ++ ) { - - const ns = keys[ i ]; - - for ( let j = 0; j < scope.availableExtensions.length; j ++ ) { - - const extension = scope.availableExtensions[ j ]; - - if ( extension.ns === ns ) { - - availableExtensions.push( extension ); - - } - - } - - } - - for ( let i = 0; i < availableExtensions.length; i ++ ) { - - const extension = availableExtensions[ i ]; - extension.apply( modelXml, extensions[ extension[ 'ns' ] ], meshData ); - - } - - } - - function getBuild( data, objects, modelData, textureData, objectData, builder ) { - - if ( data.build !== undefined ) return data.build; - - data.build = builder( data, objects, modelData, textureData, objectData ); - - return data.build; - - } - - function buildBasematerial( materialData, objects, modelData ) { - - let material; - - const displaypropertiesid = materialData.displaypropertiesid; - const pbmetallicdisplayproperties = modelData.resources.pbmetallicdisplayproperties; - - if ( displaypropertiesid !== null && pbmetallicdisplayproperties[ displaypropertiesid ] !== undefined ) { - - // metallic display property, use StandardMaterial - - const pbmetallicdisplayproperty = pbmetallicdisplayproperties[ displaypropertiesid ]; - const metallicData = pbmetallicdisplayproperty.data[ materialData.index ]; - - material = new MeshStandardMaterial( { flatShading: true, roughness: metallicData.roughness, metalness: metallicData.metallicness } ); - - } else { - - // otherwise use PhongMaterial - - material = new MeshPhongMaterial( { flatShading: true } ); - - } - - material.name = materialData.name; - - // displaycolor MUST be specified with a value of a 6 or 8 digit hexadecimal number, e.g. "#RRGGBB" or "#RRGGBBAA" - - const displaycolor = materialData.displaycolor; - - const color = displaycolor.substring( 0, 7 ); - material.color.setStyle( color, COLOR_SPACE_3MF ); - - // process alpha if set - - if ( displaycolor.length === 9 ) { - - material.opacity = parseInt( displaycolor.charAt( 7 ) + displaycolor.charAt( 8 ), 16 ) / 255; - - } - - return material; - - } - - function buildComposite( compositeData, objects, modelData, textureData ) { - - const composite = new Group(); - - for ( let j = 0; j < compositeData.length; j ++ ) { - - const component = compositeData[ j ]; - let build = objects[ component.objectId ]; - - if ( build === undefined ) { - - buildObject( component.objectId, objects, modelData, textureData ); - build = objects[ component.objectId ]; - - } - - const object3D = build.clone(); - - // apply component transform - - const transform = component.transform; - - if ( transform ) { - - object3D.applyMatrix4( transform ); - - } - - composite.add( object3D ); - - } - - return composite; - - } - - function buildObject( objectId, objects, modelData, textureData ) { - - const objectData = modelData[ 'resources' ][ 'object' ][ objectId ]; - - if ( objectData[ 'mesh' ] ) { - - const meshData = objectData[ 'mesh' ]; - - const extensions = modelData[ 'extensions' ]; - const modelXml = modelData[ 'xml' ]; - - applyExtensions( extensions, meshData, modelXml ); - - objects[ objectData.id ] = getBuild( meshData, objects, modelData, textureData, objectData, buildGroup ); - - } else { - - const compositeData = objectData[ 'components' ]; - - objects[ objectData.id ] = getBuild( compositeData, objects, modelData, textureData, objectData, buildComposite ); - - } - - if ( objectData.name ) { - - objects[ objectData.id ].name = objectData.name; - - } - - } - - function buildObjects( data3mf ) { - - const modelsData = data3mf.model; - const modelRels = data3mf.modelRels; - const objects = {}; - const modelsKeys = Object.keys( modelsData ); - const textureData = {}; - - // evaluate model relationships to textures - - if ( modelRels ) { - - for ( let i = 0, l = modelRels.length; i < l; i ++ ) { - - const modelRel = modelRels[ i ]; - const textureKey = modelRel.target.substring( 1 ); - - if ( data3mf.texture[ textureKey ] ) { - - textureData[ modelRel.target ] = data3mf.texture[ textureKey ]; - - } - - } - - } - - // start build - - for ( let i = 0; i < modelsKeys.length; i ++ ) { - - const modelsKey = modelsKeys[ i ]; - const modelData = modelsData[ modelsKey ]; - - const objectIds = Object.keys( modelData[ 'resources' ][ 'object' ] ); - - for ( let j = 0; j < objectIds.length; j ++ ) { - - const objectId = objectIds[ j ]; - - buildObject( objectId, objects, modelData, textureData ); - - } - - } - - return objects; - - } - - function fetch3DModelPart( rels ) { - - for ( let i = 0; i < rels.length; i ++ ) { - - const rel = rels[ i ]; - const extension = rel.target.split( '.' ).pop(); - - if ( extension.toLowerCase() === 'model' ) return rel; - - } - - } - - function build( objects, data3mf ) { - - const group = new Group(); - - const relationship = fetch3DModelPart( data3mf[ 'rels' ] ); - const buildData = data3mf.model[ relationship[ 'target' ].substring( 1 ) ][ 'build' ]; - - for ( let i = 0; i < buildData.length; i ++ ) { - - const buildItem = buildData[ i ]; - const object3D = objects[ buildItem[ 'objectId' ] ].clone(); - - // apply transform - - const transform = buildItem[ 'transform' ]; - - if ( transform ) { - - object3D.applyMatrix4( transform ); - - } - - group.add( object3D ); - - } - - return group; - - } - - const data3mf = loadDocument( data ); - const objects = buildObjects( data3mf ); - - return build( objects, data3mf ); - - } - - addExtension( extension ) { - - this.availableExtensions.push( extension ); - - } - -} - -export { ThreeMFLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ACESFilmicToneMappingShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ACESFilmicToneMappingShader.js deleted file mode 100644 index 702b978..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ACESFilmicToneMappingShader.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * ACES Filmic Tone Mapping Shader by Stephen Hill - * source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs - * - * this implementation of ACES is modified to accommodate a brighter viewing environment. - * the scale factor of 1/0.6 is subjective. see discussion in #19621. - */ - -const ACESFilmicToneMappingShader = { - - name: 'ACESFilmicToneMappingShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'exposure': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #define saturate(a) clamp( a, 0.0, 1.0 ) - - uniform sampler2D tDiffuse; - - uniform float exposure; - - varying vec2 vUv; - - 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; - - } - - vec3 ACESFilmicToneMapping( vec3 color ) { - - // sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), // transposed from source - vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - - // ODT_SAT => XYZ => D60_2_D65 => sRGB - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), // transposed from source - vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - - color = ACESInputMat * color; - - // Apply RRT and ODT - color = RRTAndODTFit( color ); - - color = ACESOutputMat * color; - - // Clamp to [0, 1] - return saturate( color ); - - } - - void main() { - - vec4 tex = texture2D( tDiffuse, vUv ); - - tex.rgb *= exposure / 0.6; // pre-exposed, outside of the tone mapping function - - gl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a ); - - }` - -}; - -export { ACESFilmicToneMappingShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/AMFLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/AMFLoader.js deleted file mode 100644 index 12f223a..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/AMFLoader.js +++ /dev/null @@ -1,521 +0,0 @@ -import { - BufferGeometry, - Color, - FileLoader, - Float32BufferAttribute, - Group, - Loader, - Mesh, - MeshPhongMaterial -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; - -/** - * Description: Early release of an AMF Loader following the pattern of the - * example loaders in the three.js project. - * - * Usage: - * const loader = new AMFLoader(); - * loader.load('/path/to/project.amf', function(objecttree) { - * scene.add(objecttree); - * }); - * - * Materials now supported, material colors supported - * Zip support, requires fflate - * No constellation support (yet)! - * - */ - -class AMFLoader 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.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - function loadDocument( data ) { - - let view = new DataView( data ); - const magic = String.fromCharCode( view.getUint8( 0 ), view.getUint8( 1 ) ); - - if ( magic === 'PK' ) { - - let zip = null; - let file = null; - - console.log( 'THREE.AMFLoader: Loading Zip' ); - - try { - - zip = fflate.unzipSync( new Uint8Array( data ) ); - - } catch ( e ) { - - if ( e instanceof ReferenceError ) { - - console.log( 'THREE.AMFLoader: fflate missing and file is compressed.' ); - return null; - - } - - } - - for ( file in zip ) { - - if ( file.toLowerCase().slice( - 4 ) === '.amf' ) { - - break; - - } - - } - - console.log( 'THREE.AMFLoader: Trying to load file asset: ' + file ); - view = new DataView( zip[ file ].buffer ); - - } - - const fileText = new TextDecoder().decode( view ); - const xmlData = new DOMParser().parseFromString( fileText, 'application/xml' ); - - if ( xmlData.documentElement.nodeName.toLowerCase() !== 'amf' ) { - - console.log( 'THREE.AMFLoader: Error loading AMF - no AMF document found.' ); - return null; - - } - - return xmlData; - - } - - function loadDocumentScale( node ) { - - let scale = 1.0; - let unit = 'millimeter'; - - if ( node.documentElement.attributes.unit !== undefined ) { - - unit = node.documentElement.attributes.unit.value.toLowerCase(); - - } - - const scaleUnits = { - millimeter: 1.0, - inch: 25.4, - feet: 304.8, - meter: 1000.0, - micron: 0.001 - }; - - if ( scaleUnits[ unit ] !== undefined ) { - - scale = scaleUnits[ unit ]; - - } - - console.log( 'THREE.AMFLoader: Unit scale: ' + scale ); - return scale; - - } - - function loadMaterials( node ) { - - let matName = 'AMF Material'; - const matId = node.attributes.id.textContent; - let color = { r: 1.0, g: 1.0, b: 1.0, a: 1.0 }; - - let loadedMaterial = null; - - for ( let i = 0; i < node.childNodes.length; i ++ ) { - - const matChildEl = node.childNodes[ i ]; - - if ( matChildEl.nodeName === 'metadata' && matChildEl.attributes.type !== undefined ) { - - if ( matChildEl.attributes.type.value === 'name' ) { - - matName = matChildEl.textContent; - - } - - } else if ( matChildEl.nodeName === 'color' ) { - - color = loadColor( matChildEl ); - - } - - } - - loadedMaterial = new MeshPhongMaterial( { - flatShading: true, - color: new Color( color.r, color.g, color.b ), - name: matName - } ); - - if ( color.a !== 1.0 ) { - - loadedMaterial.transparent = true; - loadedMaterial.opacity = color.a; - - } - - return { id: matId, material: loadedMaterial }; - - } - - function loadColor( node ) { - - const color = { r: 1.0, g: 1.0, b: 1.0, a: 1.0 }; - - for ( let i = 0; i < node.childNodes.length; i ++ ) { - - const matColor = node.childNodes[ i ]; - - if ( matColor.nodeName === 'r' ) { - - color.r = matColor.textContent; - - } else if ( matColor.nodeName === 'g' ) { - - color.g = matColor.textContent; - - } else if ( matColor.nodeName === 'b' ) { - - color.b = matColor.textContent; - - } else if ( matColor.nodeName === 'a' ) { - - color.a = matColor.textContent; - - } - - } - - return color; - - } - - function loadMeshVolume( node ) { - - const volume = { name: '', triangles: [], materialid: null }; - - let currVolumeNode = node.firstElementChild; - - if ( node.attributes.materialid !== undefined ) { - - volume.materialId = node.attributes.materialid.nodeValue; - - } - - while ( currVolumeNode ) { - - if ( currVolumeNode.nodeName === 'metadata' ) { - - if ( currVolumeNode.attributes.type !== undefined ) { - - if ( currVolumeNode.attributes.type.value === 'name' ) { - - volume.name = currVolumeNode.textContent; - - } - - } - - } else if ( currVolumeNode.nodeName === 'triangle' ) { - - const v1 = currVolumeNode.getElementsByTagName( 'v1' )[ 0 ].textContent; - const v2 = currVolumeNode.getElementsByTagName( 'v2' )[ 0 ].textContent; - const v3 = currVolumeNode.getElementsByTagName( 'v3' )[ 0 ].textContent; - - volume.triangles.push( v1, v2, v3 ); - - } - - currVolumeNode = currVolumeNode.nextElementSibling; - - } - - return volume; - - } - - function loadMeshVertices( node ) { - - const vertArray = []; - const normalArray = []; - let currVerticesNode = node.firstElementChild; - - while ( currVerticesNode ) { - - if ( currVerticesNode.nodeName === 'vertex' ) { - - let vNode = currVerticesNode.firstElementChild; - - while ( vNode ) { - - if ( vNode.nodeName === 'coordinates' ) { - - const x = vNode.getElementsByTagName( 'x' )[ 0 ].textContent; - const y = vNode.getElementsByTagName( 'y' )[ 0 ].textContent; - const z = vNode.getElementsByTagName( 'z' )[ 0 ].textContent; - - vertArray.push( x, y, z ); - - } else if ( vNode.nodeName === 'normal' ) { - - const nx = vNode.getElementsByTagName( 'nx' )[ 0 ].textContent; - const ny = vNode.getElementsByTagName( 'ny' )[ 0 ].textContent; - const nz = vNode.getElementsByTagName( 'nz' )[ 0 ].textContent; - - normalArray.push( nx, ny, nz ); - - } - - vNode = vNode.nextElementSibling; - - } - - } - - currVerticesNode = currVerticesNode.nextElementSibling; - - } - - return { 'vertices': vertArray, 'normals': normalArray }; - - } - - function loadObject( node ) { - - const objId = node.attributes.id.textContent; - const loadedObject = { name: 'amfobject', meshes: [] }; - let currColor = null; - let currObjNode = node.firstElementChild; - - while ( currObjNode ) { - - if ( currObjNode.nodeName === 'metadata' ) { - - if ( currObjNode.attributes.type !== undefined ) { - - if ( currObjNode.attributes.type.value === 'name' ) { - - loadedObject.name = currObjNode.textContent; - - } - - } - - } else if ( currObjNode.nodeName === 'color' ) { - - currColor = loadColor( currObjNode ); - - } else if ( currObjNode.nodeName === 'mesh' ) { - - let currMeshNode = currObjNode.firstElementChild; - const mesh = { vertices: [], normals: [], volumes: [], color: currColor }; - - while ( currMeshNode ) { - - if ( currMeshNode.nodeName === 'vertices' ) { - - const loadedVertices = loadMeshVertices( currMeshNode ); - - mesh.normals = mesh.normals.concat( loadedVertices.normals ); - mesh.vertices = mesh.vertices.concat( loadedVertices.vertices ); - - } else if ( currMeshNode.nodeName === 'volume' ) { - - mesh.volumes.push( loadMeshVolume( currMeshNode ) ); - - } - - currMeshNode = currMeshNode.nextElementSibling; - - } - - loadedObject.meshes.push( mesh ); - - } - - currObjNode = currObjNode.nextElementSibling; - - } - - return { 'id': objId, 'obj': loadedObject }; - - } - - const xmlData = loadDocument( data ); - let amfName = ''; - let amfAuthor = ''; - const amfScale = loadDocumentScale( xmlData ); - const amfMaterials = {}; - const amfObjects = {}; - const childNodes = xmlData.documentElement.childNodes; - - let i, j; - - for ( i = 0; i < childNodes.length; i ++ ) { - - const child = childNodes[ i ]; - - if ( child.nodeName === 'metadata' ) { - - if ( child.attributes.type !== undefined ) { - - if ( child.attributes.type.value === 'name' ) { - - amfName = child.textContent; - - } else if ( child.attributes.type.value === 'author' ) { - - amfAuthor = child.textContent; - - } - - } - - } else if ( child.nodeName === 'material' ) { - - const loadedMaterial = loadMaterials( child ); - - amfMaterials[ loadedMaterial.id ] = loadedMaterial.material; - - } else if ( child.nodeName === 'object' ) { - - const loadedObject = loadObject( child ); - - amfObjects[ loadedObject.id ] = loadedObject.obj; - - } - - } - - const sceneObject = new Group(); - const defaultMaterial = new MeshPhongMaterial( { - name: Loader.DEFAULT_MATERIAL_NAME, - color: 0xaaaaff, - flatShading: true - } ); - - sceneObject.name = amfName; - sceneObject.userData.author = amfAuthor; - sceneObject.userData.loader = 'AMF'; - - for ( const id in amfObjects ) { - - const part = amfObjects[ id ]; - const meshes = part.meshes; - const newObject = new Group(); - newObject.name = part.name || ''; - - for ( i = 0; i < meshes.length; i ++ ) { - - let objDefaultMaterial = defaultMaterial; - const mesh = meshes[ i ]; - const vertices = new Float32BufferAttribute( mesh.vertices, 3 ); - let normals = null; - - if ( mesh.normals.length ) { - - normals = new Float32BufferAttribute( mesh.normals, 3 ); - - } - - if ( mesh.color ) { - - const color = mesh.color; - - objDefaultMaterial = defaultMaterial.clone(); - objDefaultMaterial.color = new Color( color.r, color.g, color.b ); - - if ( color.a !== 1.0 ) { - - objDefaultMaterial.transparent = true; - objDefaultMaterial.opacity = color.a; - - } - - } - - const volumes = mesh.volumes; - - for ( j = 0; j < volumes.length; j ++ ) { - - const volume = volumes[ j ]; - const newGeometry = new BufferGeometry(); - let material = objDefaultMaterial; - - newGeometry.setIndex( volume.triangles ); - newGeometry.setAttribute( 'position', vertices.clone() ); - - if ( normals ) { - - newGeometry.setAttribute( 'normal', normals.clone() ); - - } - - if ( amfMaterials[ volume.materialId ] !== undefined ) { - - material = amfMaterials[ volume.materialId ]; - - } - - newGeometry.scale( amfScale, amfScale, amfScale ); - newObject.add( new Mesh( newGeometry, material.clone() ) ); - - } - - } - - sceneObject.add( newObject ); - - } - - return sceneObject; - - } - -} - -export { AMFLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ARButton.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ARButton.js deleted file mode 100644 index 7f4a073..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ARButton.js +++ /dev/null @@ -1,232 +0,0 @@ -class ARButton { - - static createButton( renderer, sessionInit = {} ) { - - const button = document.createElement( 'button' ); - - function showStartAR( /*device*/ ) { - - if ( sessionInit.domOverlay === undefined ) { - - const overlay = document.createElement( 'div' ); - overlay.style.display = 'none'; - document.body.appendChild( overlay ); - - const svg = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' ); - svg.setAttribute( 'width', 38 ); - svg.setAttribute( 'height', 38 ); - svg.style.position = 'absolute'; - svg.style.right = '20px'; - svg.style.top = '20px'; - svg.addEventListener( 'click', function () { - - currentSession.end(); - - } ); - overlay.appendChild( svg ); - - const path = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); - path.setAttribute( 'd', 'M 12,12 L 28,28 M 28,12 12,28' ); - path.setAttribute( 'stroke', '#fff' ); - path.setAttribute( 'stroke-width', 2 ); - svg.appendChild( path ); - - if ( sessionInit.optionalFeatures === undefined ) { - - sessionInit.optionalFeatures = []; - - } - - sessionInit.optionalFeatures.push( 'dom-overlay' ); - sessionInit.domOverlay = { root: overlay }; - - } - - // - - let currentSession = null; - - async function onSessionStarted( session ) { - - session.addEventListener( 'end', onSessionEnded ); - - renderer.xr.setReferenceSpaceType( 'local' ); - - await renderer.xr.setSession( session ); - - button.textContent = 'STOP AR'; - sessionInit.domOverlay.root.style.display = ''; - - currentSession = session; - - } - - function onSessionEnded( /*event*/ ) { - - currentSession.removeEventListener( 'end', onSessionEnded ); - - button.textContent = 'START AR'; - sessionInit.domOverlay.root.style.display = 'none'; - - currentSession = null; - - } - - // - - button.style.display = ''; - - button.style.cursor = 'pointer'; - button.style.left = 'calc(50% - 50px)'; - button.style.width = '100px'; - - button.textContent = 'START AR'; - - button.onmouseenter = function () { - - button.style.opacity = '1.0'; - - }; - - button.onmouseleave = function () { - - button.style.opacity = '0.5'; - - }; - - button.onclick = function () { - - if ( currentSession === null ) { - - navigator.xr.requestSession( 'immersive-ar', sessionInit ).then( onSessionStarted ); - - } else { - - currentSession.end(); - - if ( navigator.xr.offerSession !== undefined ) { - - navigator.xr.offerSession( 'immersive-ar', sessionInit ) - .then( onSessionStarted ) - .catch( ( err ) => { - - console.warn( err ); - - } ); - - } - - } - - }; - - if ( navigator.xr.offerSession !== undefined ) { - - navigator.xr.offerSession( 'immersive-ar', sessionInit ) - .then( onSessionStarted ) - .catch( ( err ) => { - - console.warn( err ); - - } ); - - } - - } - - function disableButton() { - - button.style.display = ''; - - button.style.cursor = 'auto'; - button.style.left = 'calc(50% - 75px)'; - button.style.width = '150px'; - - button.onmouseenter = null; - button.onmouseleave = null; - - button.onclick = null; - - } - - function showARNotSupported() { - - disableButton(); - - button.textContent = 'AR NOT SUPPORTED'; - - } - - function showARNotAllowed( exception ) { - - disableButton(); - - console.warn( 'Exception when trying to call xr.isSessionSupported', exception ); - - button.textContent = 'AR NOT ALLOWED'; - - } - - function stylizeElement( element ) { - - element.style.position = 'absolute'; - element.style.bottom = '20px'; - element.style.padding = '12px 6px'; - element.style.border = '1px solid #fff'; - element.style.borderRadius = '4px'; - element.style.background = 'rgba(0,0,0,0.1)'; - element.style.color = '#fff'; - element.style.font = 'normal 13px sans-serif'; - element.style.textAlign = 'center'; - element.style.opacity = '0.5'; - element.style.outline = 'none'; - element.style.zIndex = '999'; - - } - - if ( 'xr' in navigator ) { - - button.id = 'ARButton'; - button.style.display = 'none'; - - stylizeElement( button ); - - navigator.xr.isSessionSupported( 'immersive-ar' ).then( function ( supported ) { - - supported ? showStartAR() : showARNotSupported(); - - } ).catch( showARNotAllowed ); - - return button; - - } else { - - const message = document.createElement( 'a' ); - - if ( window.isSecureContext === false ) { - - message.href = document.location.href.replace( /^http:/, 'https:' ); - message.innerHTML = 'WEBXR NEEDS HTTPS'; // TODO Improve message - - } else { - - message.href = 'https://immersiveweb.dev/'; - message.innerHTML = 'WEBXR NOT AVAILABLE'; - - } - - message.style.left = 'calc(50% - 90px)'; - message.style.width = '180px'; - message.style.textDecoration = 'none'; - - stylizeElement( message ); - - return message; - - } - - } - -} - -export { ARButton }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/Addons.js b/docker-compose/requirements/nginx/static/javascript/taaaa/Addons.js deleted file mode 100644 index 48fb7a0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/Addons.js +++ /dev/null @@ -1,296 +0,0 @@ -export * from './animation/AnimationClipCreator.js'; -export * from './animation/CCDIKSolver.js'; -export * from './animation/MMDAnimationHelper.js'; -export * from './animation/MMDPhysics.js'; - -export * from './cameras/CinematicCamera.js'; - -export { default as WebGL } from './capabilities/WebGL.js'; - -export * from './controls/ArcballControls.js'; -export * from './controls/DragControls.js'; -export * from './controls/FirstPersonControls.js'; -export * from './controls/FlyControls.js'; -export * from './controls/MapControls.js'; -export * from './controls/OrbitControls.js'; -export * from './controls/PointerLockControls.js'; -export * from './controls/TrackballControls.js'; -export * from './controls/TransformControls.js'; - -export * from './csm/CSM.js'; -export * from './csm/CSMFrustum.js'; -export * from './csm/CSMHelper.js'; -export * from './csm/CSMShader.js'; - -export * as Curves from './curves/CurveExtras.js'; -export * from './curves/NURBSCurve.js'; -export * from './curves/NURBSSurface.js'; -export * from './curves/NURBSVolume.js'; -export * as NURBSUtils from './curves/NURBSUtils.js'; - -export * from './effects/AnaglyphEffect.js'; -export * from './effects/AsciiEffect.js'; -export * from './effects/OutlineEffect.js'; -export * from './effects/ParallaxBarrierEffect.js'; -export * from './effects/PeppersGhostEffect.js'; -export * from './effects/StereoEffect.js'; - -export * from './environments/DebugEnvironment.js'; -export * from './environments/RoomEnvironment.js'; - -export * from './exporters/DRACOExporter.js'; -export * from './exporters/EXRExporter.js'; -export * from './exporters/GLTFExporter.js'; -export * from './exporters/KTX2Exporter.js'; -export * from './exporters/MMDExporter.js'; -export * from './exporters/OBJExporter.js'; -export * from './exporters/PLYExporter.js'; -export * from './exporters/STLExporter.js'; -export * from './exporters/USDZExporter.js'; - -export * from './geometries/BoxLineGeometry.js'; -export * from './geometries/ConvexGeometry.js'; -export * from './geometries/DecalGeometry.js'; -export * from './geometries/ParametricGeometries.js'; -export * from './geometries/ParametricGeometry.js'; -export * from './geometries/RoundedBoxGeometry.js'; -export * from './geometries/TeapotGeometry.js'; -export * from './geometries/TextGeometry.js'; - -export * from './helpers/LightProbeHelper.js'; -export * from './helpers/OctreeHelper.js'; -export * from './helpers/PositionalAudioHelper.js'; -export * from './helpers/RectAreaLightHelper.js'; -export * from './helpers/TextureHelper.js'; -export * from './helpers/VertexNormalsHelper.js'; -export * from './helpers/VertexTangentsHelper.js'; -export * from './helpers/ViewHelper.js'; - -export * from './interactive/HTMLMesh.js'; -export * from './interactive/InteractiveGroup.js'; -export * from './interactive/SelectionBox.js'; -export * from './interactive/SelectionHelper.js'; - -export * from './lights/LightProbeGenerator.js'; -export * from './lights/RectAreaLightTexturesLib.js'; -export * from './lights/RectAreaLightUniformsLib.js'; - -export * from './lines/Line2.js'; -export * from './lines/LineGeometry.js'; -export * from './lines/LineMaterial.js'; -export * from './lines/LineSegments2.js'; -export * from './lines/LineSegmentsGeometry.js'; -export * from './lines/Wireframe.js'; -export * from './lines/WireframeGeometry2.js'; - -export * from './loaders/3DMLoader.js'; -export * from './loaders/3MFLoader.js'; -export * from './loaders/AMFLoader.js'; -export * from './loaders/BVHLoader.js'; -export * from './loaders/ColladaLoader.js'; -export * from './loaders/DDSLoader.js'; -export * from './loaders/DRACOLoader.js'; -export * from './loaders/EXRLoader.js'; -export * from './loaders/FBXLoader.js'; -export * from './loaders/FontLoader.js'; -export * from './loaders/GCodeLoader.js'; -export * from './loaders/GLTFLoader.js'; -export * from './loaders/HDRCubeTextureLoader.js'; -export * from './loaders/IESLoader.js'; -export * from './loaders/KMZLoader.js'; -export * from './loaders/KTX2Loader.js'; -export * from './loaders/KTXLoader.js'; -export * from './loaders/LDrawLoader.js'; -export * from './loaders/LUT3dlLoader.js'; -export * from './loaders/LUTCubeLoader.js'; -export * from './loaders/LWOLoader.js'; -export * from './loaders/LogLuvLoader.js'; -export * from './loaders/LottieLoader.js'; -export * from './loaders/MD2Loader.js'; -export * from './loaders/MDDLoader.js'; -export * from './loaders/MMDLoader.js'; -export * from './loaders/MTLLoader.js'; -export * from './loaders/NRRDLoader.js'; -export * from './loaders/OBJLoader.js'; -export * from './loaders/PCDLoader.js'; -export * from './loaders/PDBLoader.js'; -export * from './loaders/PLYLoader.js'; -export * from './loaders/PVRLoader.js'; -export * from './loaders/RGBELoader.js'; -export * from './loaders/UltraHDRLoader.js'; -export * from './loaders/RGBMLoader.js'; -export * from './loaders/STLLoader.js'; -export * from './loaders/SVGLoader.js'; -export * from './loaders/TDSLoader.js'; -export * from './loaders/TGALoader.js'; -export * from './loaders/TIFFLoader.js'; -export * from './loaders/TTFLoader.js'; -export * from './loaders/TiltLoader.js'; -export * from './loaders/USDZLoader.js'; -export * from './loaders/VOXLoader.js'; -export * from './loaders/VRMLLoader.js'; -export * from './loaders/VTKLoader.js'; -export * from './loaders/XYZLoader.js'; - -export * from './materials/MeshGouraudMaterial.js'; - -export * from './math/Capsule.js'; -export * from './math/ColorConverter.js'; -export * from './math/ConvexHull.js'; -export * from './math/ImprovedNoise.js'; -export * from './math/Lut.js'; -export * from './math/MeshSurfaceSampler.js'; -export * from './math/OBB.js'; -export * from './math/Octree.js'; -export * from './math/SimplexNoise.js'; - -export * from './misc/ConvexObjectBreaker.js'; -export * from './misc/GPUComputationRenderer.js'; -export * from './misc/Gyroscope.js'; -export * from './misc/MD2Character.js'; -export * from './misc/MD2CharacterComplex.js'; -export * from './misc/MorphAnimMesh.js'; -export * from './misc/MorphBlendMesh.js'; -export * from './misc/ProgressiveLightMap.js'; -export * from './misc/RollerCoaster.js'; -export * from './misc/Timer.js'; -export * from './misc/TubePainter.js'; -export * from './misc/Volume.js'; -export * from './misc/VolumeSlice.js'; - -export * from './modifiers/CurveModifier.js'; -export * from './modifiers/EdgeSplitModifier.js'; -export * from './modifiers/SimplifyModifier.js'; -export * from './modifiers/TessellateModifier.js'; - -export * from './objects/GroundedSkybox.js'; -export * from './objects/Lensflare.js'; -export * from './objects/MarchingCubes.js'; -export * from './objects/Reflector.js'; -export * from './objects/ReflectorForSSRPass.js'; -export * from './objects/Refractor.js'; -export * from './objects/ShadowMesh.js'; -export * from './objects/Sky.js'; -export * from './objects/Water.js'; -export { Water as Water2 } from './objects/Water2.js'; - -export * from './physics/AmmoPhysics.js'; -export * from './physics/RapierPhysics.js'; - -export * from './postprocessing/AfterimagePass.js'; -export * from './postprocessing/BloomPass.js'; -export * from './postprocessing/BokehPass.js'; -export * from './postprocessing/ClearPass.js'; -export * from './postprocessing/CubeTexturePass.js'; -export * from './postprocessing/DotScreenPass.js'; -export * from './postprocessing/EffectComposer.js'; -export * from './postprocessing/FilmPass.js'; -export * from './postprocessing/GlitchPass.js'; -export * from './postprocessing/GTAOPass.js'; -export * from './postprocessing/HalftonePass.js'; -export * from './postprocessing/LUTPass.js'; -export * from './postprocessing/MaskPass.js'; -export * from './postprocessing/OutlinePass.js'; -export * from './postprocessing/OutputPass.js'; -export * from './postprocessing/Pass.js'; -export * from './postprocessing/RenderPass.js'; -export * from './postprocessing/RenderPixelatedPass.js'; -export * from './postprocessing/SAOPass.js'; -export * from './postprocessing/SMAAPass.js'; -export * from './postprocessing/SSAARenderPass.js'; -export * from './postprocessing/SSAOPass.js'; -export * from './postprocessing/SSRPass.js'; -export * from './postprocessing/SavePass.js'; -export * from './postprocessing/ShaderPass.js'; -export * from './postprocessing/TAARenderPass.js'; -export * from './postprocessing/TexturePass.js'; -export * from './postprocessing/UnrealBloomPass.js'; - -export * from './renderers/CSS2DRenderer.js'; -export * from './renderers/CSS3DRenderer.js'; -export * from './renderers/Projector.js'; -export * from './renderers/SVGRenderer.js'; - -export * from './shaders/ACESFilmicToneMappingShader.js'; -export * from './shaders/AfterimageShader.js'; -export * from './shaders/BasicShader.js'; -export * from './shaders/BleachBypassShader.js'; -export * from './shaders/BlendShader.js'; -export * from './shaders/BokehShader.js'; -export { BokehShader as BokehShader2 } from './shaders/BokehShader2.js'; -export * from './shaders/BrightnessContrastShader.js'; -export * from './shaders/ColorCorrectionShader.js'; -export * from './shaders/ColorifyShader.js'; -export * from './shaders/ConvolutionShader.js'; -export * from './shaders/CopyShader.js'; -export * from './shaders/DOFMipMapShader.js'; -export * from './shaders/DepthLimitedBlurShader.js'; -export * from './shaders/DigitalGlitch.js'; -export * from './shaders/DotScreenShader.js'; -export * from './shaders/ExposureShader.js'; -export * from './shaders/FXAAShader.js'; -export * from './shaders/FilmShader.js'; -export * from './shaders/FocusShader.js'; -export * from './shaders/FreiChenShader.js'; -export * from './shaders/GammaCorrectionShader.js'; -export * from './shaders/GodRaysShader.js'; -export * from './shaders/GTAOShader.js'; -export * from './shaders/HalftoneShader.js'; -export * from './shaders/HorizontalBlurShader.js'; -export * from './shaders/HorizontalTiltShiftShader.js'; -export * from './shaders/HueSaturationShader.js'; -export * from './shaders/KaleidoShader.js'; -export * from './shaders/LuminosityHighPassShader.js'; -export * from './shaders/LuminosityShader.js'; -export * from './shaders/MMDToonShader.js'; -export * from './shaders/MirrorShader.js'; -export * from './shaders/NormalMapShader.js'; -export * from './shaders/OutputShader.js'; -export * from './shaders/RGBShiftShader.js'; -export * from './shaders/SAOShader.js'; -export * from './shaders/SMAAShader.js'; -export * from './shaders/SSAOShader.js'; -export * from './shaders/SSRShader.js'; -export * from './shaders/SepiaShader.js'; -export * from './shaders/SobelOperatorShader.js'; -export * from './shaders/SubsurfaceScatteringShader.js'; -export * from './shaders/TechnicolorShader.js'; -export * from './shaders/ToonShader.js'; -export * from './shaders/TriangleBlurShader.js'; -export * from './shaders/UnpackDepthRGBAShader.js'; -export * from './shaders/VelocityShader.js'; -export * from './shaders/VerticalBlurShader.js'; -export * from './shaders/VerticalTiltShiftShader.js'; -export * from './shaders/VignetteShader.js'; -export * from './shaders/VolumeShader.js'; -export * from './shaders/WaterRefractionShader.js'; - -export * from './textures/FlakesTexture.js'; - -export * as BufferGeometryUtils from './utils/BufferGeometryUtils.js'; -export * as CameraUtils from './utils/CameraUtils.js'; -export * from './utils/GPUStatsPanel.js'; -export * as GeometryCompressionUtils from './utils/GeometryCompressionUtils.js'; -export * as GeometryUtils from './utils/GeometryUtils.js'; -export * from './utils/LDrawUtils.js'; -export * from './utils/PackedPhongMaterial.js'; -export * as SceneUtils from './utils/SceneUtils.js'; -export * from './utils/ShadowMapViewer.js'; -export * as SkeletonUtils from './utils/SkeletonUtils.js'; -export * as SortUtils from './utils/SortUtils.js'; -export * from './utils/TextureUtils.js'; -export * from './utils/UVsDebug.js'; -export * from './utils/WorkerPool.js'; - -export * from './webxr/ARButton.js'; -export * from './webxr/OculusHandModel.js'; -export * from './webxr/OculusHandPointerModel.js'; -export * from './webxr/Text2D.js'; -export * from './webxr/VRButton.js'; -export * from './webxr/XRButton.js'; -export * from './webxr/XRControllerModelFactory.js'; -export * from './webxr/XREstimatedLight.js'; -export * from './webxr/XRHandMeshModel.js'; -export * from './webxr/XRHandModelFactory.js'; -export * from './webxr/XRHandPrimitiveModel.js'; -export * from './webxr/XRPlanes.js'; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimagePass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimagePass.js deleted file mode 100644 index 36a86ee..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimagePass.js +++ /dev/null @@ -1,104 +0,0 @@ -import { - HalfFloatType, - MeshBasicMaterial, - NearestFilter, - ShaderMaterial, - UniformsUtils, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { AfterimageShader } from'/static/javascript/three/examples/jsm/shaders/AfterimageShader.js'; - -class AfterimagePass extends Pass { - - constructor( damp = 0.96 ) { - - super(); - - this.shader = AfterimageShader; - - this.uniforms = UniformsUtils.clone( this.shader.uniforms ); - - this.uniforms[ 'damp' ].value = damp; - - this.textureComp = new WebGLRenderTarget( window.innerWidth, window.innerHeight, { - magFilter: NearestFilter, - type: HalfFloatType - } ); - - this.textureOld = new WebGLRenderTarget( window.innerWidth, window.innerHeight, { - magFilter: NearestFilter, - type: HalfFloatType - } ); - - this.compFsMaterial = new ShaderMaterial( { - - uniforms: this.uniforms, - vertexShader: this.shader.vertexShader, - fragmentShader: this.shader.fragmentShader - - } ); - - this.compFsQuad = new FullScreenQuad( this.compFsMaterial ); - - this.copyFsMaterial = new MeshBasicMaterial(); - this.copyFsQuad = new FullScreenQuad( this.copyFsMaterial ); - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive*/ ) { - - this.uniforms[ 'tOld' ].value = this.textureOld.texture; - this.uniforms[ 'tNew' ].value = readBuffer.texture; - - renderer.setRenderTarget( this.textureComp ); - this.compFsQuad.render( renderer ); - - this.copyFsQuad.material.map = this.textureComp.texture; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.copyFsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - - if ( this.clear ) renderer.clear(); - - this.copyFsQuad.render( renderer ); - - } - - // Swap buffers. - const temp = this.textureOld; - this.textureOld = this.textureComp; - this.textureComp = temp; - // Now textureOld contains the latest image, ready for the next frame. - - } - - setSize( width, height ) { - - this.textureComp.setSize( width, height ); - this.textureOld.setSize( width, height ); - - } - - dispose() { - - this.textureComp.dispose(); - this.textureOld.dispose(); - - this.compFsMaterial.dispose(); - this.copyFsMaterial.dispose(); - - this.compFsQuad.dispose(); - this.copyFsQuad.dispose(); - - } - -} - -export { AfterimagePass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimageShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimageShader.js deleted file mode 100644 index b1dbdef..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/AfterimageShader.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Afterimage shader - * I created this effect inspired by a demo on codepen: - * https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1& - */ - -const AfterimageShader = { - - name: 'AfterimageShader', - - uniforms: { - - 'damp': { value: 0.96 }, - 'tOld': { value: null }, - 'tNew': { value: null } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float damp; - - uniform sampler2D tOld; - uniform sampler2D tNew; - - varying vec2 vUv; - - vec4 when_gt( vec4 x, float y ) { - - return max( sign( x - y ), 0.0 ); - - } - - void main() { - - vec4 texelOld = texture2D( tOld, vUv ); - vec4 texelNew = texture2D( tNew, vUv ); - - texelOld *= damp * when_gt( texelOld, 0.1 ); - - gl_FragColor = max(texelNew, texelOld); - - }` - -}; - -export { AfterimageShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BVHLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BVHLoader.js deleted file mode 100644 index 65884c9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BVHLoader.js +++ /dev/null @@ -1,437 +0,0 @@ -import { - AnimationClip, - Bone, - FileLoader, - Loader, - Quaternion, - QuaternionKeyframeTrack, - Skeleton, - Vector3, - VectorKeyframeTrack -} from '/static/javascript/three/build/three.module.js'; - -/** - * Description: reads BVH files and outputs a single Skeleton and an AnimationClip - * - * Currently only supports bvh files containing a single root. - * - */ - -class BVHLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.animateBonePositions = true; - this.animateBoneRotations = true; - - } - - 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( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( text ) { - - /* - reads a string array (lines) from a BVH file - and outputs a skeleton structure including motion data - - returns thee root node: - { name: '', channels: [], children: [] } - */ - function readBvh( lines ) { - - // read model structure - - if ( nextLine( lines ) !== 'HIERARCHY' ) { - - console.error( 'THREE.BVHLoader: HIERARCHY expected.' ); - - } - - const list = []; // collects flat array of all bones - const root = readNode( lines, nextLine( lines ), list ); - - // read motion data - - if ( nextLine( lines ) !== 'MOTION' ) { - - console.error( 'THREE.BVHLoader: MOTION expected.' ); - - } - - // number of frames - - let tokens = nextLine( lines ).split( /[\s]+/ ); - const numFrames = parseInt( tokens[ 1 ] ); - - if ( isNaN( numFrames ) ) { - - console.error( 'THREE.BVHLoader: Failed to read number of frames.' ); - - } - - // frame time - - tokens = nextLine( lines ).split( /[\s]+/ ); - const frameTime = parseFloat( tokens[ 2 ] ); - - if ( isNaN( frameTime ) ) { - - console.error( 'THREE.BVHLoader: Failed to read frame time.' ); - - } - - // read frame data line by line - - for ( let i = 0; i < numFrames; i ++ ) { - - tokens = nextLine( lines ).split( /[\s]+/ ); - readFrameData( tokens, i * frameTime, root ); - - } - - return list; - - } - - /* - Recursively reads data from a single frame into the bone hierarchy. - The passed bone hierarchy has to be structured in the same order as the BVH file. - keyframe data is stored in bone.frames. - - - data: splitted string array (frame values), values are shift()ed so - this should be empty after parsing the whole hierarchy. - - frameTime: playback time for this keyframe. - - bone: the bone to read frame data from. - */ - function readFrameData( data, frameTime, bone ) { - - // end sites have no motion data - - if ( bone.type === 'ENDSITE' ) return; - - // add keyframe - - const keyframe = { - time: frameTime, - position: new Vector3(), - rotation: new Quaternion() - }; - - bone.frames.push( keyframe ); - - const quat = new Quaternion(); - - const vx = new Vector3( 1, 0, 0 ); - const vy = new Vector3( 0, 1, 0 ); - const vz = new Vector3( 0, 0, 1 ); - - // parse values for each channel in node - - for ( let i = 0; i < bone.channels.length; i ++ ) { - - switch ( bone.channels[ i ] ) { - - case 'Xposition': - keyframe.position.x = parseFloat( data.shift().trim() ); - break; - case 'Yposition': - keyframe.position.y = parseFloat( data.shift().trim() ); - break; - case 'Zposition': - keyframe.position.z = parseFloat( data.shift().trim() ); - break; - case 'Xrotation': - quat.setFromAxisAngle( vx, parseFloat( data.shift().trim() ) * Math.PI / 180 ); - keyframe.rotation.multiply( quat ); - break; - case 'Yrotation': - quat.setFromAxisAngle( vy, parseFloat( data.shift().trim() ) * Math.PI / 180 ); - keyframe.rotation.multiply( quat ); - break; - case 'Zrotation': - quat.setFromAxisAngle( vz, parseFloat( data.shift().trim() ) * Math.PI / 180 ); - keyframe.rotation.multiply( quat ); - break; - default: - console.warn( 'THREE.BVHLoader: Invalid channel type.' ); - - } - - } - - // parse child nodes - - for ( let i = 0; i < bone.children.length; i ++ ) { - - readFrameData( data, frameTime, bone.children[ i ] ); - - } - - } - - /* - Recursively parses the HIERACHY section of the BVH file - - - lines: all lines of the file. lines are consumed as we go along. - - firstline: line containing the node type and name e.g. 'JOINT hip' - - list: collects a flat list of nodes - - returns: a BVH node including children - */ - function readNode( lines, firstline, list ) { - - const node = { name: '', type: '', frames: [] }; - list.push( node ); - - // parse node type and name - - let tokens = firstline.split( /[\s]+/ ); - - if ( tokens[ 0 ].toUpperCase() === 'END' && tokens[ 1 ].toUpperCase() === 'SITE' ) { - - node.type = 'ENDSITE'; - node.name = 'ENDSITE'; // bvh end sites have no name - - } else { - - node.name = tokens[ 1 ]; - node.type = tokens[ 0 ].toUpperCase(); - - } - - if ( nextLine( lines ) !== '{' ) { - - console.error( 'THREE.BVHLoader: Expected opening { after type & name' ); - - } - - // parse OFFSET - - tokens = nextLine( lines ).split( /[\s]+/ ); - - if ( tokens[ 0 ] !== 'OFFSET' ) { - - console.error( 'THREE.BVHLoader: Expected OFFSET but got: ' + tokens[ 0 ] ); - - } - - if ( tokens.length !== 4 ) { - - console.error( 'THREE.BVHLoader: Invalid number of values for OFFSET.' ); - - } - - const offset = new Vector3( - parseFloat( tokens[ 1 ] ), - parseFloat( tokens[ 2 ] ), - parseFloat( tokens[ 3 ] ) - ); - - if ( isNaN( offset.x ) || isNaN( offset.y ) || isNaN( offset.z ) ) { - - console.error( 'THREE.BVHLoader: Invalid values of OFFSET.' ); - - } - - node.offset = offset; - - // parse CHANNELS definitions - - if ( node.type !== 'ENDSITE' ) { - - tokens = nextLine( lines ).split( /[\s]+/ ); - - if ( tokens[ 0 ] !== 'CHANNELS' ) { - - console.error( 'THREE.BVHLoader: Expected CHANNELS definition.' ); - - } - - const numChannels = parseInt( tokens[ 1 ] ); - node.channels = tokens.splice( 2, numChannels ); - node.children = []; - - } - - // read children - - while ( true ) { - - const line = nextLine( lines ); - - if ( line === '}' ) { - - return node; - - } else { - - node.children.push( readNode( lines, line, list ) ); - - } - - } - - } - - /* - recursively converts the internal bvh node structure to a Bone hierarchy - - source: the bvh root node - list: pass an empty array, collects a flat list of all converted THREE.Bones - - returns the root Bone - */ - function toTHREEBone( source, list ) { - - const bone = new Bone(); - list.push( bone ); - - bone.position.add( source.offset ); - bone.name = source.name; - - if ( source.type !== 'ENDSITE' ) { - - for ( let i = 0; i < source.children.length; i ++ ) { - - bone.add( toTHREEBone( source.children[ i ], list ) ); - - } - - } - - return bone; - - } - - /* - builds a AnimationClip from the keyframe data saved in each bone. - - bone: bvh root node - - returns: a AnimationClip containing position and quaternion tracks - */ - function toTHREEAnimation( bones ) { - - const tracks = []; - - // create a position and quaternion animation track for each node - - for ( let i = 0; i < bones.length; i ++ ) { - - const bone = bones[ i ]; - - if ( bone.type === 'ENDSITE' ) - continue; - - // track data - - const times = []; - const positions = []; - const rotations = []; - - for ( let j = 0; j < bone.frames.length; j ++ ) { - - const frame = bone.frames[ j ]; - - times.push( frame.time ); - - // the animation system animates the position property, - // so we have to add the joint offset to all values - - positions.push( frame.position.x + bone.offset.x ); - positions.push( frame.position.y + bone.offset.y ); - positions.push( frame.position.z + bone.offset.z ); - - rotations.push( frame.rotation.x ); - rotations.push( frame.rotation.y ); - rotations.push( frame.rotation.z ); - rotations.push( frame.rotation.w ); - - } - - if ( scope.animateBonePositions ) { - - tracks.push( new VectorKeyframeTrack( bone.name + '.position', times, positions ) ); - - } - - if ( scope.animateBoneRotations ) { - - tracks.push( new QuaternionKeyframeTrack( bone.name + '.quaternion', times, rotations ) ); - - } - - } - - return new AnimationClip( 'animation', - 1, tracks ); - - } - - /* - returns the next non-empty line in lines - */ - function nextLine( lines ) { - - let line; - // skip empty lines - while ( ( line = lines.shift().trim() ).length === 0 ) { } - - return line; - - } - - const scope = this; - - const lines = text.split( /[\r\n]+/g ); - - const bones = readBvh( lines ); - - const threeBones = []; - toTHREEBone( bones[ 0 ], threeBones ); - - const threeClip = toTHREEAnimation( bones ); - - return { - skeleton: new Skeleton( threeBones ), - clip: threeClip - }; - - } - -} - -export { BVHLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BasicShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BasicShader.js deleted file mode 100644 index f1f1130..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BasicShader.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Simple test shader - */ - -const BasicShader = { - - name: 'BasicShader', - - uniforms: {}, - - vertexShader: /* glsl */` - - void main() { - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - void main() { - - gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 ); - - }` - -}; - -export { BasicShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BleachBypassShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BleachBypassShader.js deleted file mode 100644 index 5694f5d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BleachBypassShader.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass] - * - based on Nvidia example - * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass - */ - -const BleachBypassShader = { - - name: 'BleachBypassShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'opacity': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float opacity; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 base = texture2D( tDiffuse, vUv ); - - vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 ); - float lum = dot( lumCoeff, base.rgb ); - vec3 blend = vec3( lum ); - - float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) ); - - vec3 result1 = 2.0 * base.rgb * blend; - vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb ); - - vec3 newColor = mix( result1, result2, L ); - - float A2 = opacity * base.a; - vec3 mixRGB = A2 * newColor.rgb; - mixRGB += ( ( 1.0 - A2 ) * base.rgb ); - - gl_FragColor = vec4( mixRGB, base.a ); - - }` - -}; - -export { BleachBypassShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BlendShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BlendShader.js deleted file mode 100644 index 530fdc3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BlendShader.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Blend two textures - */ - -const BlendShader = { - - name: 'BlendShader', - - uniforms: { - - 'tDiffuse1': { value: null }, - 'tDiffuse2': { value: null }, - 'mixRatio': { value: 0.5 }, - 'opacity': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float opacity; - uniform float mixRatio; - - uniform sampler2D tDiffuse1; - uniform sampler2D tDiffuse2; - - varying vec2 vUv; - - void main() { - - vec4 texel1 = texture2D( tDiffuse1, vUv ); - vec4 texel2 = texture2D( tDiffuse2, vUv ); - gl_FragColor = opacity * mix( texel1, texel2, mixRatio ); - - }` - -}; - -export { BlendShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BloomPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BloomPass.js deleted file mode 100644 index eb89577..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BloomPass.js +++ /dev/null @@ -1,172 +0,0 @@ -import { - AdditiveBlending, - HalfFloatType, - ShaderMaterial, - UniformsUtils, - Vector2, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { ConvolutionShader } from'/static/javascript/three/examples/jsm/shaders/ConvolutionShader.js'; - -class BloomPass extends Pass { - - constructor( strength = 1, kernelSize = 25, sigma = 4 ) { - - super(); - - // render targets - - this.renderTargetX = new WebGLRenderTarget( 1, 1, { type: HalfFloatType } ); // will be resized later - this.renderTargetX.texture.name = 'BloomPass.x'; - this.renderTargetY = new WebGLRenderTarget( 1, 1, { type: HalfFloatType } ); // will be resized later - this.renderTargetY.texture.name = 'BloomPass.y'; - - // combine material - - this.combineUniforms = UniformsUtils.clone( CombineShader.uniforms ); - - this.combineUniforms[ 'strength' ].value = strength; - - this.materialCombine = new ShaderMaterial( { - - name: CombineShader.name, - uniforms: this.combineUniforms, - vertexShader: CombineShader.vertexShader, - fragmentShader: CombineShader.fragmentShader, - blending: AdditiveBlending, - transparent: true - - } ); - - // convolution material - - const convolutionShader = ConvolutionShader; - - this.convolutionUniforms = UniformsUtils.clone( convolutionShader.uniforms ); - - this.convolutionUniforms[ 'uImageIncrement' ].value = BloomPass.blurX; - this.convolutionUniforms[ 'cKernel' ].value = ConvolutionShader.buildKernel( sigma ); - - this.materialConvolution = new ShaderMaterial( { - - name: convolutionShader.name, - uniforms: this.convolutionUniforms, - vertexShader: convolutionShader.vertexShader, - fragmentShader: convolutionShader.fragmentShader, - defines: { - 'KERNEL_SIZE_FLOAT': kernelSize.toFixed( 1 ), - 'KERNEL_SIZE_INT': kernelSize.toFixed( 0 ) - } - - } ); - - this.needsSwap = false; - - this.fsQuad = new FullScreenQuad( null ); - - } - - render( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) { - - if ( maskActive ) renderer.state.buffers.stencil.setTest( false ); - - // Render quad with blured scene into texture (convolution pass 1) - - this.fsQuad.material = this.materialConvolution; - - this.convolutionUniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.convolutionUniforms[ 'uImageIncrement' ].value = BloomPass.blurX; - - renderer.setRenderTarget( this.renderTargetX ); - renderer.clear(); - this.fsQuad.render( renderer ); - - - // Render quad with blured scene into texture (convolution pass 2) - - this.convolutionUniforms[ 'tDiffuse' ].value = this.renderTargetX.texture; - this.convolutionUniforms[ 'uImageIncrement' ].value = BloomPass.blurY; - - renderer.setRenderTarget( this.renderTargetY ); - renderer.clear(); - this.fsQuad.render( renderer ); - - // Render original scene with superimposed blur to texture - - this.fsQuad.material = this.materialCombine; - - this.combineUniforms[ 'tDiffuse' ].value = this.renderTargetY.texture; - - if ( maskActive ) renderer.state.buffers.stencil.setTest( true ); - - renderer.setRenderTarget( readBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - setSize( width, height ) { - - this.renderTargetX.setSize( width, height ); - this.renderTargetY.setSize( width, height ); - - } - - dispose() { - - this.renderTargetX.dispose(); - this.renderTargetY.dispose(); - - this.materialCombine.dispose(); - this.materialConvolution.dispose(); - - this.fsQuad.dispose(); - - } - -} - -const CombineShader = { - - name: 'CombineShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'strength': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float strength; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 texel = texture2D( tDiffuse, vUv ); - gl_FragColor = strength * texel; - - }` - -}; - -BloomPass.blurX = new Vector2( 0.001953125, 0.0 ); -BloomPass.blurY = new Vector2( 0.0, 0.001953125 ); - -export { BloomPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BokehShader2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BokehShader2.js deleted file mode 100644 index 44387ce..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BokehShader2.js +++ /dev/null @@ -1,397 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Depth-of-field shader with bokeh - * ported from GLSL shader by Martins Upitis - * http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update) - * - * Requires #define RINGS and SAMPLES integers - */ -const BokehShader = { - - name: 'BokehShader', - - uniforms: { - - 'textureWidth': { value: 1.0 }, - 'textureHeight': { value: 1.0 }, - - 'focalDepth': { value: 1.0 }, - 'focalLength': { value: 24.0 }, - 'fstop': { value: 0.9 }, - - 'tColor': { value: null }, - 'tDepth': { value: null }, - - 'maxblur': { value: 1.0 }, - - 'showFocus': { value: 0 }, - 'manualdof': { value: 0 }, - 'vignetting': { value: 0 }, - 'depthblur': { value: 0 }, - - 'threshold': { value: 0.5 }, - 'gain': { value: 2.0 }, - 'bias': { value: 0.5 }, - 'fringe': { value: 0.7 }, - - 'znear': { value: 0.1 }, - 'zfar': { value: 100 }, - - 'noise': { value: 1 }, - 'dithering': { value: 0.0001 }, - 'pentagon': { value: 0 }, - - 'shaderFocus': { value: 1 }, - 'focusCoords': { value: new Vector2() } - - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #include - - varying vec2 vUv; - - uniform sampler2D tColor; - uniform sampler2D tDepth; - uniform float textureWidth; - uniform float textureHeight; - - uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below - uniform float focalLength; //focal length in mm - uniform float fstop; //f-stop value - uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range) - - /* - make sure that these two values are the same for your camera, otherwise distances will be wrong. - */ - - uniform float znear; // camera clipping start - uniform float zfar; // camera clipping end - - //------------------------------------------ - //user variables - - const int samples = SAMPLES; //samples on the first ring - const int rings = RINGS; //ring count - - const int maxringsamples = rings * samples; - - uniform bool manualdof; // manual dof calculation - float ndofstart = 1.0; // near dof blur start - float ndofdist = 2.0; // near dof blur falloff distance - float fdofstart = 1.0; // far dof blur start - float fdofdist = 3.0; // far dof blur falloff distance - - float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm) - - uniform bool vignetting; // use optical lens vignetting - - float vignout = 1.3; // vignetting outer border - float vignin = 0.0; // vignetting inner border - float vignfade = 22.0; // f-stops till vignete fades - - uniform bool shaderFocus; - // disable if you use external focalDepth value - - uniform vec2 focusCoords; - // autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right) - // if center of screen use vec2(0.5, 0.5); - - uniform float maxblur; - //clamp value of max blur (0.0 = no blur, 1.0 default) - - uniform float threshold; // highlight threshold; - uniform float gain; // highlight gain; - - uniform float bias; // bokeh edge bias - uniform float fringe; // bokeh chromatic aberration / fringing - - uniform bool noise; //use noise instead of pattern for sample dithering - - uniform float dithering; - - uniform bool depthblur; // blur the depth buffer - float dbsize = 1.25; // depth blur size - - /* - next part is experimental - not looking good with small sample and ring count - looks okay starting from samples = 4, rings = 4 - */ - - uniform bool pentagon; //use pentagon as bokeh shape? - float feather = 0.4; //pentagon shape feather - - //------------------------------------------ - - float penta(vec2 coords) { - //pentagonal shape - float scale = float(rings) - 1.3; - vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0); - vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0); - vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0); - vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0); - vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0); - vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0); - - vec4 one = vec4( 1.0 ); - - vec4 P = vec4((coords),vec2(scale, scale)); - - vec4 dist = vec4(0.0); - float inorout = -4.0; - - dist.x = dot( P, HS0 ); - dist.y = dot( P, HS1 ); - dist.z = dot( P, HS2 ); - dist.w = dot( P, HS3 ); - - dist = smoothstep( -feather, feather, dist ); - - inorout += dot( dist, one ); - - dist.x = dot( P, HS4 ); - dist.y = HS5.w - abs( P.z ); - - dist = smoothstep( -feather, feather, dist ); - inorout += dist.x; - - return clamp( inorout, 0.0, 1.0 ); - } - - float bdepth(vec2 coords) { - // Depth buffer blur - float d = 0.0; - float kernel[9]; - vec2 offset[9]; - - vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize; - - offset[0] = vec2(-wh.x,-wh.y); - offset[1] = vec2( 0.0, -wh.y); - offset[2] = vec2( wh.x -wh.y); - - offset[3] = vec2(-wh.x, 0.0); - offset[4] = vec2( 0.0, 0.0); - offset[5] = vec2( wh.x, 0.0); - - offset[6] = vec2(-wh.x, wh.y); - offset[7] = vec2( 0.0, wh.y); - offset[8] = vec2( wh.x, wh.y); - - kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0; - kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0; - kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0; - - - for( int i=0; i<9; i++ ) { - float tmp = texture2D(tDepth, coords + offset[i]).r; - d += tmp * kernel[i]; - } - - return d; - } - - - vec3 color(vec2 coords,float blur) { - //processing the sample - - vec3 col = vec3(0.0); - vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight); - - col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r; - col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g; - col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b; - - vec3 lumcoeff = vec3(0.299,0.587,0.114); - float lum = dot(col.rgb, lumcoeff); - float thresh = max((lum-threshold)*gain, 0.0); - return col+mix(vec3(0.0),col,thresh*blur); - } - - vec3 debugFocus(vec3 col, float blur, float depth) { - float edge = 0.002*depth; //distance based edge smoothing - float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0); - float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0); - - col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6); - col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2); - - return col; - } - - float linearize(float depth) { - return -zfar * znear / (depth * (zfar - znear) - zfar); - } - - float vignette() { - float dist = distance(vUv.xy, vec2(0.5,0.5)); - dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist); - return clamp(dist,0.0,1.0); - } - - float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) { - float rings2 = float(rings); - float step = PI*2.0 / float(ringsamples); - float pw = cos(j*step)*i; - float ph = sin(j*step)*i; - float p = 1.0; - if (pentagon) { - p = penta(vec2(pw,ph)); - } - col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p; - return 1.0 * mix(1.0, i /rings2, bias) * p; - } - - void main() { - //scene depth calculation - - float depth = linearize(texture2D(tDepth,vUv.xy).x); - - // Blur depth? - if ( depthblur ) { - depth = linearize(bdepth(vUv.xy)); - } - - //focal plane calculation - - float fDepth = focalDepth; - - if (shaderFocus) { - - fDepth = linearize(texture2D(tDepth,focusCoords).x); - - } - - // dof blur factor calculation - - float blur = 0.0; - - if (manualdof) { - float a = depth-fDepth; // Focal plane - float b = (a-fdofstart)/fdofdist; // Far DoF - float c = (-a-ndofstart)/ndofdist; // Near Dof - blur = (a>0.0) ? b : c; - } else { - float f = focalLength; // focal length in mm - float d = fDepth*1000.0; // focal plane in mm - float o = depth*1000.0; // depth in mm - - float a = (o*f)/(o-f); - float b = (d*f)/(d-f); - float c = (d-f)/(d*fstop*CoC); - - blur = abs(a-b)*c; - } - - blur = clamp(blur,0.0,1.0); - - // calculation of pattern for dithering - - vec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur; - - // getting blur x and y step factor - - float w = (1.0/textureWidth)*blur*maxblur+noise.x; - float h = (1.0/textureHeight)*blur*maxblur+noise.y; - - // calculation of final color - - vec3 col = vec3(0.0); - - if(blur < 0.05) { - //some optimization thingy - col = texture2D(tColor, vUv.xy).rgb; - } else { - col = texture2D(tColor, vUv.xy).rgb; - float s = 1.0; - int ringsamples; - - for (int i = 1; i <= rings; i++) { - /*unboxstart*/ - ringsamples = i * samples; - - for (int j = 0 ; j < maxringsamples ; j++) { - if (j >= ringsamples) break; - s += gather(float(i), float(j), ringsamples, col, w, h, blur); - } - /*unboxend*/ - } - - col /= s; //divide by sample count - } - - if (showFocus) { - col = debugFocus(col, blur, depth); - } - - if (vignetting) { - col *= vignette(); - } - - gl_FragColor.rgb = col; - gl_FragColor.a = 1.0; - - #include - #include - }` - -}; - -const BokehDepthShader = { - - name: 'BokehDepthShader', - - uniforms: { - - 'mNear': { value: 1.0 }, - 'mFar': { value: 1000.0 }, - - }, - - vertexShader: /* glsl */` - - varying float vViewZDepth; - - void main() { - - #include - #include - - vViewZDepth = - mvPosition.z; - - }`, - - fragmentShader: /* glsl */` - - uniform float mNear; - uniform float mFar; - - varying float vViewZDepth; - - void main() { - - float color = 1.0 - smoothstep( mNear, mFar, vViewZDepth ); - gl_FragColor = vec4( vec3( color ), 1.0 ); - - }` - -}; - -export { BokehShader, BokehDepthShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/BrightnessContrastShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/BrightnessContrastShader.js deleted file mode 100644 index c1dea9e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/BrightnessContrastShader.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Brightness and contrast adjustment - * https://github.com/evanw/glfx.js - * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white) - * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) - */ - -const BrightnessContrastShader = { - - name: 'BrightnessContrastShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'brightness': { value: 0 }, - 'contrast': { value: 0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float brightness; - uniform float contrast; - - varying vec2 vUv; - - void main() { - - gl_FragColor = texture2D( tDiffuse, vUv ); - - gl_FragColor.rgb += brightness; - - if (contrast > 0.0) { - gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5; - } else { - gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5; - } - - }` - -}; - -export { BrightnessContrastShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/CameraUtils.js b/docker-compose/requirements/nginx/static/javascript/taaaa/CameraUtils.js deleted file mode 100644 index 7b4ca28..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/CameraUtils.js +++ /dev/null @@ -1,73 +0,0 @@ -import { - MathUtils, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _va = /*@__PURE__*/ new Vector3(), // from pe to pa - _vb = /*@__PURE__*/ new Vector3(), // from pe to pb - _vc = /*@__PURE__*/ new Vector3(), // from pe to pc - _vr = /*@__PURE__*/ new Vector3(), // right axis of screen - _vu = /*@__PURE__*/ new Vector3(), // up axis of screen - _vn = /*@__PURE__*/ new Vector3(), // normal vector of screen - _vec = /*@__PURE__*/ new Vector3(), // temporary vector - _quat = /*@__PURE__*/ new Quaternion(); // temporary quaternion - - -/** Set a PerspectiveCamera's projectionMatrix and quaternion - * to exactly frame the corners of an arbitrary rectangle. - * NOTE: This function ignores the standard parameters; - * do not call updateProjectionMatrix() after this! - * @param {Vector3} bottomLeftCorner - * @param {Vector3} bottomRightCorner - * @param {Vector3} topLeftCorner - * @param {boolean} estimateViewFrustum */ -function frameCorners( camera, bottomLeftCorner, bottomRightCorner, topLeftCorner, estimateViewFrustum = false ) { - - const pa = bottomLeftCorner, pb = bottomRightCorner, pc = topLeftCorner; - const pe = camera.position; // eye position - const n = camera.near; // distance of near clipping plane - const f = camera.far; //distance of far clipping plane - - _vr.copy( pb ).sub( pa ).normalize(); - _vu.copy( pc ).sub( pa ).normalize(); - _vn.crossVectors( _vr, _vu ).normalize(); - - _va.copy( pa ).sub( pe ); // from pe to pa - _vb.copy( pb ).sub( pe ); // from pe to pb - _vc.copy( pc ).sub( pe ); // from pe to pc - - const d = - _va.dot( _vn ); // distance from eye to screen - const l = _vr.dot( _va ) * n / d; // distance to left screen edge - const r = _vr.dot( _vb ) * n / d; // distance to right screen edge - const b = _vu.dot( _va ) * n / d; // distance to bottom screen edge - const t = _vu.dot( _vc ) * n / d; // distance to top screen edge - - // Set the camera rotation to match the focal plane to the corners' plane - _quat.setFromUnitVectors( _vec.set( 0, 1, 0 ), _vu ); - camera.quaternion.setFromUnitVectors( _vec.set( 0, 0, 1 ).applyQuaternion( _quat ), _vn ).multiply( _quat ); - - // Set the off-axis projection matrix to match the corners - camera.projectionMatrix.set( 2.0 * n / ( r - l ), 0.0, - ( r + l ) / ( r - l ), 0.0, 0.0, - 2.0 * n / ( t - b ), - ( t + b ) / ( t - b ), 0.0, 0.0, 0.0, - ( f + n ) / ( n - f ), - 2.0 * f * n / ( n - f ), 0.0, 0.0, - 1.0, 0.0 ); - camera.projectionMatrixInverse.copy( camera.projectionMatrix ).invert(); - - // FoV estimation to fix frustum culling - if ( estimateViewFrustum ) { - - // Set fieldOfView to a conservative estimate - // to make frustum tall/wide enough to encompass it - camera.fov = - MathUtils.RAD2DEG / Math.min( 1.0, camera.aspect ) * - Math.atan( ( _vec.copy( pb ).sub( pa ).length() + - ( _vec.copy( pc ).sub( pa ).length() ) ) / _va.length() ); - - } - -} - -export { frameCorners }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ClearPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ClearPass.js deleted file mode 100644 index f4da0f5..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ClearPass.js +++ /dev/null @@ -1,46 +0,0 @@ -import { - Color -} from '/static/javascript/three/build/three.module.js'; -import { Pass } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; - -class ClearPass extends Pass { - - constructor( clearColor, clearAlpha ) { - - super(); - - this.needsSwap = false; - - this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; - this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; - this._oldClearColor = new Color(); - - } - - render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { - - let oldClearAlpha; - - if ( this.clearColor ) { - - renderer.getClearColor( this._oldClearColor ); - oldClearAlpha = renderer.getClearAlpha(); - - renderer.setClearColor( this.clearColor, this.clearAlpha ); - - } - - renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); - renderer.clear(); - - if ( this.clearColor ) { - - renderer.setClearColor( this._oldClearColor, oldClearAlpha ); - - } - - } - -} - -export { ClearPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ColladaLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ColladaLoader.js deleted file mode 100644 index 5342638..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ColladaLoader.js +++ /dev/null @@ -1,4116 +0,0 @@ -import { - AmbientLight, - AnimationClip, - Bone, - BufferGeometry, - ClampToEdgeWrapping, - Color, - DirectionalLight, - DoubleSide, - FileLoader, - Float32BufferAttribute, - FrontSide, - Group, - Line, - LineBasicMaterial, - LineSegments, - Loader, - LoaderUtils, - MathUtils, - Matrix4, - Mesh, - MeshBasicMaterial, - MeshLambertMaterial, - MeshPhongMaterial, - OrthographicCamera, - PerspectiveCamera, - PointLight, - Quaternion, - QuaternionKeyframeTrack, - RepeatWrapping, - Scene, - Skeleton, - SkinnedMesh, - SpotLight, - TextureLoader, - Vector2, - Vector3, - VectorKeyframeTrack, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; -import { TGALoader } from './TGALoader.js'; - -class ColladaLoader extends Loader { - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path; - - 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( text, path ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( text, path ) { - - function getElementsByTagName( xml, name ) { - - // Non recursive xml.getElementsByTagName() ... - - const array = []; - const childNodes = xml.childNodes; - - for ( let i = 0, l = childNodes.length; i < l; i ++ ) { - - const child = childNodes[ i ]; - - if ( child.nodeName === name ) { - - array.push( child ); - - } - - } - - return array; - - } - - function parseStrings( text ) { - - if ( text.length === 0 ) return []; - - const parts = text.trim().split( /\s+/ ); - const array = new Array( parts.length ); - - for ( let i = 0, l = parts.length; i < l; i ++ ) { - - array[ i ] = parts[ i ]; - - } - - return array; - - } - - function parseFloats( text ) { - - if ( text.length === 0 ) return []; - - const parts = text.trim().split( /\s+/ ); - const array = new Array( parts.length ); - - for ( let i = 0, l = parts.length; i < l; i ++ ) { - - array[ i ] = parseFloat( parts[ i ] ); - - } - - return array; - - } - - function parseInts( text ) { - - if ( text.length === 0 ) return []; - - const parts = text.trim().split( /\s+/ ); - const array = new Array( parts.length ); - - for ( let i = 0, l = parts.length; i < l; i ++ ) { - - array[ i ] = parseInt( parts[ i ] ); - - } - - return array; - - } - - function parseId( text ) { - - return text.substring( 1 ); - - } - - function generateId() { - - return 'three_default_' + ( count ++ ); - - } - - function isEmpty( object ) { - - return Object.keys( object ).length === 0; - - } - - // asset - - function parseAsset( xml ) { - - return { - unit: parseAssetUnit( getElementsByTagName( xml, 'unit' )[ 0 ] ), - upAxis: parseAssetUpAxis( getElementsByTagName( xml, 'up_axis' )[ 0 ] ) - }; - - } - - function parseAssetUnit( xml ) { - - if ( ( xml !== undefined ) && ( xml.hasAttribute( 'meter' ) === true ) ) { - - return parseFloat( xml.getAttribute( 'meter' ) ); - - } else { - - return 1; // default 1 meter - - } - - } - - function parseAssetUpAxis( xml ) { - - return xml !== undefined ? xml.textContent : 'Y_UP'; - - } - - // library - - function parseLibrary( xml, libraryName, nodeName, parser ) { - - const library = getElementsByTagName( xml, libraryName )[ 0 ]; - - if ( library !== undefined ) { - - const elements = getElementsByTagName( library, nodeName ); - - for ( let i = 0; i < elements.length; i ++ ) { - - parser( elements[ i ] ); - - } - - } - - } - - function buildLibrary( data, builder ) { - - for ( const name in data ) { - - const object = data[ name ]; - object.build = builder( data[ name ] ); - - } - - } - - // get - - function getBuild( data, builder ) { - - if ( data.build !== undefined ) return data.build; - - data.build = builder( data ); - - return data.build; - - } - - // animation - - function parseAnimation( xml ) { - - const data = { - sources: {}, - samplers: {}, - channels: {} - }; - - let hasChildren = false; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - let id; - - switch ( child.nodeName ) { - - case 'source': - id = child.getAttribute( 'id' ); - data.sources[ id ] = parseSource( child ); - break; - - case 'sampler': - id = child.getAttribute( 'id' ); - data.samplers[ id ] = parseAnimationSampler( child ); - break; - - case 'channel': - id = child.getAttribute( 'target' ); - data.channels[ id ] = parseAnimationChannel( child ); - break; - - case 'animation': - // hierarchy of related animations - parseAnimation( child ); - hasChildren = true; - break; - - default: - console.log( child ); - - } - - } - - if ( hasChildren === false ) { - - // since 'id' attributes can be optional, it's necessary to generate a UUID for unqiue assignment - - library.animations[ xml.getAttribute( 'id' ) || MathUtils.generateUUID() ] = data; - - } - - } - - function parseAnimationSampler( xml ) { - - const data = { - inputs: {}, - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - const id = parseId( child.getAttribute( 'source' ) ); - const semantic = child.getAttribute( 'semantic' ); - data.inputs[ semantic ] = id; - break; - - } - - } - - return data; - - } - - function parseAnimationChannel( xml ) { - - const data = {}; - - const target = xml.getAttribute( 'target' ); - - // parsing SID Addressing Syntax - - let parts = target.split( '/' ); - - const id = parts.shift(); - let sid = parts.shift(); - - // check selection syntax - - const arraySyntax = ( sid.indexOf( '(' ) !== - 1 ); - const memberSyntax = ( sid.indexOf( '.' ) !== - 1 ); - - if ( memberSyntax ) { - - // member selection access - - parts = sid.split( '.' ); - sid = parts.shift(); - data.member = parts.shift(); - - } else if ( arraySyntax ) { - - // array-access syntax. can be used to express fields in one-dimensional vectors or two-dimensional matrices. - - const indices = sid.split( '(' ); - sid = indices.shift(); - - for ( let i = 0; i < indices.length; i ++ ) { - - indices[ i ] = parseInt( indices[ i ].replace( /\)/, '' ) ); - - } - - data.indices = indices; - - } - - data.id = id; - data.sid = sid; - - data.arraySyntax = arraySyntax; - data.memberSyntax = memberSyntax; - - data.sampler = parseId( xml.getAttribute( 'source' ) ); - - return data; - - } - - function buildAnimation( data ) { - - const tracks = []; - - const channels = data.channels; - const samplers = data.samplers; - const sources = data.sources; - - for ( const target in channels ) { - - if ( channels.hasOwnProperty( target ) ) { - - const channel = channels[ target ]; - const sampler = samplers[ channel.sampler ]; - - const inputId = sampler.inputs.INPUT; - const outputId = sampler.inputs.OUTPUT; - - const inputSource = sources[ inputId ]; - const outputSource = sources[ outputId ]; - - const animation = buildAnimationChannel( channel, inputSource, outputSource ); - - createKeyframeTracks( animation, tracks ); - - } - - } - - return tracks; - - } - - function getAnimation( id ) { - - return getBuild( library.animations[ id ], buildAnimation ); - - } - - function buildAnimationChannel( channel, inputSource, outputSource ) { - - const node = library.nodes[ channel.id ]; - const object3D = getNode( node.id ); - - const transform = node.transforms[ channel.sid ]; - const defaultMatrix = node.matrix.clone().transpose(); - - let time, stride; - let i, il, j, jl; - - const data = {}; - - // the collada spec allows the animation of data in various ways. - // depending on the transform type (matrix, translate, rotate, scale), we execute different logic - - switch ( transform ) { - - case 'matrix': - - for ( i = 0, il = inputSource.array.length; i < il; i ++ ) { - - time = inputSource.array[ i ]; - stride = i * outputSource.stride; - - if ( data[ time ] === undefined ) data[ time ] = {}; - - if ( channel.arraySyntax === true ) { - - const value = outputSource.array[ stride ]; - const index = channel.indices[ 0 ] + 4 * channel.indices[ 1 ]; - - data[ time ][ index ] = value; - - } else { - - for ( j = 0, jl = outputSource.stride; j < jl; j ++ ) { - - data[ time ][ j ] = outputSource.array[ stride + j ]; - - } - - } - - } - - break; - - case 'translate': - console.warn( 'THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform ); - break; - - case 'rotate': - console.warn( 'THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform ); - break; - - case 'scale': - console.warn( 'THREE.ColladaLoader: Animation transform type "%s" not yet implemented.', transform ); - break; - - } - - const keyframes = prepareAnimationData( data, defaultMatrix ); - - const animation = { - name: object3D.uuid, - keyframes: keyframes - }; - - return animation; - - } - - function prepareAnimationData( data, defaultMatrix ) { - - const keyframes = []; - - // transfer data into a sortable array - - for ( const time in data ) { - - keyframes.push( { time: parseFloat( time ), value: data[ time ] } ); - - } - - // ensure keyframes are sorted by time - - keyframes.sort( ascending ); - - // now we clean up all animation data, so we can use them for keyframe tracks - - for ( let i = 0; i < 16; i ++ ) { - - transformAnimationData( keyframes, i, defaultMatrix.elements[ i ] ); - - } - - return keyframes; - - // array sort function - - function ascending( a, b ) { - - return a.time - b.time; - - } - - } - - const position = new Vector3(); - const scale = new Vector3(); - const quaternion = new Quaternion(); - - function createKeyframeTracks( animation, tracks ) { - - const keyframes = animation.keyframes; - const name = animation.name; - - const times = []; - const positionData = []; - const quaternionData = []; - const scaleData = []; - - for ( let i = 0, l = keyframes.length; i < l; i ++ ) { - - const keyframe = keyframes[ i ]; - - const time = keyframe.time; - const value = keyframe.value; - - matrix.fromArray( value ).transpose(); - matrix.decompose( position, quaternion, scale ); - - times.push( time ); - positionData.push( position.x, position.y, position.z ); - quaternionData.push( quaternion.x, quaternion.y, quaternion.z, quaternion.w ); - scaleData.push( scale.x, scale.y, scale.z ); - - } - - if ( positionData.length > 0 ) tracks.push( new VectorKeyframeTrack( name + '.position', times, positionData ) ); - if ( quaternionData.length > 0 ) tracks.push( new QuaternionKeyframeTrack( name + '.quaternion', times, quaternionData ) ); - if ( scaleData.length > 0 ) tracks.push( new VectorKeyframeTrack( name + '.scale', times, scaleData ) ); - - return tracks; - - } - - function transformAnimationData( keyframes, property, defaultValue ) { - - let keyframe; - - let empty = true; - let i, l; - - // check, if values of a property are missing in our keyframes - - for ( i = 0, l = keyframes.length; i < l; i ++ ) { - - keyframe = keyframes[ i ]; - - if ( keyframe.value[ property ] === undefined ) { - - keyframe.value[ property ] = null; // mark as missing - - } else { - - empty = false; - - } - - } - - if ( empty === true ) { - - // no values at all, so we set a default value - - for ( i = 0, l = keyframes.length; i < l; i ++ ) { - - keyframe = keyframes[ i ]; - - keyframe.value[ property ] = defaultValue; - - } - - } else { - - // filling gaps - - createMissingKeyframes( keyframes, property ); - - } - - } - - function createMissingKeyframes( keyframes, property ) { - - let prev, next; - - for ( let i = 0, l = keyframes.length; i < l; i ++ ) { - - const keyframe = keyframes[ i ]; - - if ( keyframe.value[ property ] === null ) { - - prev = getPrev( keyframes, i, property ); - next = getNext( keyframes, i, property ); - - if ( prev === null ) { - - keyframe.value[ property ] = next.value[ property ]; - continue; - - } - - if ( next === null ) { - - keyframe.value[ property ] = prev.value[ property ]; - continue; - - } - - interpolate( keyframe, prev, next, property ); - - } - - } - - } - - function getPrev( keyframes, i, property ) { - - while ( i >= 0 ) { - - const keyframe = keyframes[ i ]; - - if ( keyframe.value[ property ] !== null ) return keyframe; - - i --; - - } - - return null; - - } - - function getNext( keyframes, i, property ) { - - while ( i < keyframes.length ) { - - const keyframe = keyframes[ i ]; - - if ( keyframe.value[ property ] !== null ) return keyframe; - - i ++; - - } - - return null; - - } - - function interpolate( key, prev, next, property ) { - - if ( ( next.time - prev.time ) === 0 ) { - - key.value[ property ] = prev.value[ property ]; - return; - - } - - key.value[ property ] = ( ( key.time - prev.time ) * ( next.value[ property ] - prev.value[ property ] ) / ( next.time - prev.time ) ) + prev.value[ property ]; - - } - - // animation clips - - function parseAnimationClip( xml ) { - - const data = { - name: xml.getAttribute( 'id' ) || 'default', - start: parseFloat( xml.getAttribute( 'start' ) || 0 ), - end: parseFloat( xml.getAttribute( 'end' ) || 0 ), - animations: [] - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'instance_animation': - data.animations.push( parseId( child.getAttribute( 'url' ) ) ); - break; - - } - - } - - library.clips[ xml.getAttribute( 'id' ) ] = data; - - } - - function buildAnimationClip( data ) { - - const tracks = []; - - const name = data.name; - const duration = ( data.end - data.start ) || - 1; - const animations = data.animations; - - for ( let i = 0, il = animations.length; i < il; i ++ ) { - - const animationTracks = getAnimation( animations[ i ] ); - - for ( let j = 0, jl = animationTracks.length; j < jl; j ++ ) { - - tracks.push( animationTracks[ j ] ); - - } - - } - - return new AnimationClip( name, duration, tracks ); - - } - - function getAnimationClip( id ) { - - return getBuild( library.clips[ id ], buildAnimationClip ); - - } - - // controller - - function parseController( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'skin': - // there is exactly one skin per controller - data.id = parseId( child.getAttribute( 'source' ) ); - data.skin = parseSkin( child ); - break; - - case 'morph': - data.id = parseId( child.getAttribute( 'source' ) ); - console.warn( 'THREE.ColladaLoader: Morph target animation not supported yet.' ); - break; - - } - - } - - library.controllers[ xml.getAttribute( 'id' ) ] = data; - - } - - function parseSkin( xml ) { - - const data = { - sources: {} - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'bind_shape_matrix': - data.bindShapeMatrix = parseFloats( child.textContent ); - break; - - case 'source': - const id = child.getAttribute( 'id' ); - data.sources[ id ] = parseSource( child ); - break; - - case 'joints': - data.joints = parseJoints( child ); - break; - - case 'vertex_weights': - data.vertexWeights = parseVertexWeights( child ); - break; - - } - - } - - return data; - - } - - function parseJoints( xml ) { - - const data = { - inputs: {} - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - const semantic = child.getAttribute( 'semantic' ); - const id = parseId( child.getAttribute( 'source' ) ); - data.inputs[ semantic ] = id; - break; - - } - - } - - return data; - - } - - function parseVertexWeights( xml ) { - - const data = { - inputs: {} - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - const semantic = child.getAttribute( 'semantic' ); - const id = parseId( child.getAttribute( 'source' ) ); - const offset = parseInt( child.getAttribute( 'offset' ) ); - data.inputs[ semantic ] = { id: id, offset: offset }; - break; - - case 'vcount': - data.vcount = parseInts( child.textContent ); - break; - - case 'v': - data.v = parseInts( child.textContent ); - break; - - } - - } - - return data; - - } - - function buildController( data ) { - - const build = { - id: data.id - }; - - const geometry = library.geometries[ build.id ]; - - if ( data.skin !== undefined ) { - - build.skin = buildSkin( data.skin ); - - // we enhance the 'sources' property of the corresponding geometry with our skin data - - geometry.sources.skinIndices = build.skin.indices; - geometry.sources.skinWeights = build.skin.weights; - - } - - return build; - - } - - function buildSkin( data ) { - - const BONE_LIMIT = 4; - - const build = { - joints: [], // this must be an array to preserve the joint order - indices: { - array: [], - stride: BONE_LIMIT - }, - weights: { - array: [], - stride: BONE_LIMIT - } - }; - - const sources = data.sources; - const vertexWeights = data.vertexWeights; - - const vcount = vertexWeights.vcount; - const v = vertexWeights.v; - const jointOffset = vertexWeights.inputs.JOINT.offset; - const weightOffset = vertexWeights.inputs.WEIGHT.offset; - - const jointSource = data.sources[ data.joints.inputs.JOINT ]; - const inverseSource = data.sources[ data.joints.inputs.INV_BIND_MATRIX ]; - - const weights = sources[ vertexWeights.inputs.WEIGHT.id ].array; - let stride = 0; - - let i, j, l; - - // process skin data for each vertex - - for ( i = 0, l = vcount.length; i < l; i ++ ) { - - const jointCount = vcount[ i ]; // this is the amount of joints that affect a single vertex - const vertexSkinData = []; - - for ( j = 0; j < jointCount; j ++ ) { - - const skinIndex = v[ stride + jointOffset ]; - const weightId = v[ stride + weightOffset ]; - const skinWeight = weights[ weightId ]; - - vertexSkinData.push( { index: skinIndex, weight: skinWeight } ); - - stride += 2; - - } - - // we sort the joints in descending order based on the weights. - // this ensures, we only procced the most important joints of the vertex - - vertexSkinData.sort( descending ); - - // now we provide for each vertex a set of four index and weight values. - // the order of the skin data matches the order of vertices - - for ( j = 0; j < BONE_LIMIT; j ++ ) { - - const d = vertexSkinData[ j ]; - - if ( d !== undefined ) { - - build.indices.array.push( d.index ); - build.weights.array.push( d.weight ); - - } else { - - build.indices.array.push( 0 ); - build.weights.array.push( 0 ); - - } - - } - - } - - // setup bind matrix - - if ( data.bindShapeMatrix ) { - - build.bindMatrix = new Matrix4().fromArray( data.bindShapeMatrix ).transpose(); - - } else { - - build.bindMatrix = new Matrix4().identity(); - - } - - // process bones and inverse bind matrix data - - for ( i = 0, l = jointSource.array.length; i < l; i ++ ) { - - const name = jointSource.array[ i ]; - const boneInverse = new Matrix4().fromArray( inverseSource.array, i * inverseSource.stride ).transpose(); - - build.joints.push( { name: name, boneInverse: boneInverse } ); - - } - - return build; - - // array sort function - - function descending( a, b ) { - - return b.weight - a.weight; - - } - - } - - function getController( id ) { - - return getBuild( library.controllers[ id ], buildController ); - - } - - // image - - function parseImage( xml ) { - - const data = { - init_from: getElementsByTagName( xml, 'init_from' )[ 0 ].textContent - }; - - library.images[ xml.getAttribute( 'id' ) ] = data; - - } - - function buildImage( data ) { - - if ( data.build !== undefined ) return data.build; - - return data.init_from; - - } - - function getImage( id ) { - - const data = library.images[ id ]; - - if ( data !== undefined ) { - - return getBuild( data, buildImage ); - - } - - console.warn( 'THREE.ColladaLoader: Couldn\'t find image with ID:', id ); - - return null; - - } - - // effect - - function parseEffect( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'profile_COMMON': - data.profile = parseEffectProfileCOMMON( child ); - break; - - } - - } - - library.effects[ xml.getAttribute( 'id' ) ] = data; - - } - - function parseEffectProfileCOMMON( xml ) { - - const data = { - surfaces: {}, - samplers: {} - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'newparam': - parseEffectNewparam( child, data ); - break; - - case 'technique': - data.technique = parseEffectTechnique( child ); - break; - - case 'extra': - data.extra = parseEffectExtra( child ); - break; - - } - - } - - return data; - - } - - function parseEffectNewparam( xml, data ) { - - const sid = xml.getAttribute( 'sid' ); - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'surface': - data.surfaces[ sid ] = parseEffectSurface( child ); - break; - - case 'sampler2D': - data.samplers[ sid ] = parseEffectSampler( child ); - break; - - } - - } - - } - - function parseEffectSurface( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'init_from': - data.init_from = child.textContent; - break; - - } - - } - - return data; - - } - - function parseEffectSampler( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'source': - data.source = child.textContent; - break; - - } - - } - - return data; - - } - - function parseEffectTechnique( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'constant': - case 'lambert': - case 'blinn': - case 'phong': - data.type = child.nodeName; - data.parameters = parseEffectParameters( child ); - break; - - case 'extra': - data.extra = parseEffectExtra( child ); - break; - - } - - } - - return data; - - } - - function parseEffectParameters( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'emission': - case 'diffuse': - case 'specular': - case 'bump': - case 'ambient': - case 'shininess': - case 'transparency': - data[ child.nodeName ] = parseEffectParameter( child ); - break; - case 'transparent': - data[ child.nodeName ] = { - opaque: child.hasAttribute( 'opaque' ) ? child.getAttribute( 'opaque' ) : 'A_ONE', - data: parseEffectParameter( child ) - }; - break; - - } - - } - - return data; - - } - - function parseEffectParameter( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'color': - data[ child.nodeName ] = parseFloats( child.textContent ); - break; - - case 'float': - data[ child.nodeName ] = parseFloat( child.textContent ); - break; - - case 'texture': - data[ child.nodeName ] = { id: child.getAttribute( 'texture' ), extra: parseEffectParameterTexture( child ) }; - break; - - } - - } - - return data; - - } - - function parseEffectParameterTexture( xml ) { - - const data = { - technique: {} - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'extra': - parseEffectParameterTextureExtra( child, data ); - break; - - } - - } - - return data; - - } - - function parseEffectParameterTextureExtra( xml, data ) { - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique': - parseEffectParameterTextureExtraTechnique( child, data ); - break; - - } - - } - - } - - function parseEffectParameterTextureExtraTechnique( xml, data ) { - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'repeatU': - case 'repeatV': - case 'offsetU': - case 'offsetV': - data.technique[ child.nodeName ] = parseFloat( child.textContent ); - break; - - case 'wrapU': - case 'wrapV': - - // some files have values for wrapU/wrapV which become NaN via parseInt - - if ( child.textContent.toUpperCase() === 'TRUE' ) { - - data.technique[ child.nodeName ] = 1; - - } else if ( child.textContent.toUpperCase() === 'FALSE' ) { - - data.technique[ child.nodeName ] = 0; - - } else { - - data.technique[ child.nodeName ] = parseInt( child.textContent ); - - } - - break; - - case 'bump': - data[ child.nodeName ] = parseEffectExtraTechniqueBump( child ); - break; - - } - - } - - } - - function parseEffectExtra( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique': - data.technique = parseEffectExtraTechnique( child ); - break; - - } - - } - - return data; - - } - - function parseEffectExtraTechnique( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'double_sided': - data[ child.nodeName ] = parseInt( child.textContent ); - break; - - case 'bump': - data[ child.nodeName ] = parseEffectExtraTechniqueBump( child ); - break; - - } - - } - - return data; - - } - - function parseEffectExtraTechniqueBump( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'texture': - data[ child.nodeName ] = { id: child.getAttribute( 'texture' ), texcoord: child.getAttribute( 'texcoord' ), extra: parseEffectParameterTexture( child ) }; - break; - - } - - } - - return data; - - } - - function buildEffect( data ) { - - return data; - - } - - function getEffect( id ) { - - return getBuild( library.effects[ id ], buildEffect ); - - } - - // material - - function parseMaterial( xml ) { - - const data = { - name: xml.getAttribute( 'name' ) - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'instance_effect': - data.url = parseId( child.getAttribute( 'url' ) ); - break; - - } - - } - - library.materials[ xml.getAttribute( 'id' ) ] = data; - - } - - function getTextureLoader( image ) { - - let loader; - - let extension = image.slice( ( image.lastIndexOf( '.' ) - 1 >>> 0 ) + 2 ); // http://www.jstips.co/en/javascript/get-file-extension/ - extension = extension.toLowerCase(); - - switch ( extension ) { - - case 'tga': - loader = tgaLoader; - break; - - default: - loader = textureLoader; - - } - - return loader; - - } - - function buildMaterial( data ) { - - const effect = getEffect( data.url ); - const technique = effect.profile.technique; - - let material; - - switch ( technique.type ) { - - case 'phong': - case 'blinn': - material = new MeshPhongMaterial(); - break; - - case 'lambert': - material = new MeshLambertMaterial(); - break; - - default: - material = new MeshBasicMaterial(); - break; - - } - - material.name = data.name || ''; - - function getTexture( textureObject, colorSpace = null ) { - - const sampler = effect.profile.samplers[ textureObject.id ]; - let image = null; - - // get image - - if ( sampler !== undefined ) { - - const surface = effect.profile.surfaces[ sampler.source ]; - image = getImage( surface.init_from ); - - } else { - - console.warn( 'THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).' ); - image = getImage( textureObject.id ); - - } - - // create texture if image is avaiable - - if ( image !== null ) { - - const loader = getTextureLoader( image ); - - if ( loader !== undefined ) { - - const texture = loader.load( image ); - - const extra = textureObject.extra; - - if ( extra !== undefined && extra.technique !== undefined && isEmpty( extra.technique ) === false ) { - - const technique = extra.technique; - - texture.wrapS = technique.wrapU ? RepeatWrapping : ClampToEdgeWrapping; - texture.wrapT = technique.wrapV ? RepeatWrapping : ClampToEdgeWrapping; - - texture.offset.set( technique.offsetU || 0, technique.offsetV || 0 ); - texture.repeat.set( technique.repeatU || 1, technique.repeatV || 1 ); - - } else { - - texture.wrapS = RepeatWrapping; - texture.wrapT = RepeatWrapping; - - } - - if ( colorSpace !== null ) { - - texture.colorSpace = colorSpace; - - } - - return texture; - - } else { - - console.warn( 'THREE.ColladaLoader: Loader for texture %s not found.', image ); - - return null; - - } - - } else { - - console.warn( 'THREE.ColladaLoader: Couldn\'t create texture with ID:', textureObject.id ); - - return null; - - } - - } - - const parameters = technique.parameters; - - for ( const key in parameters ) { - - const parameter = parameters[ key ]; - - switch ( key ) { - - case 'diffuse': - if ( parameter.color ) material.color.fromArray( parameter.color ); - if ( parameter.texture ) material.map = getTexture( parameter.texture, SRGBColorSpace ); - break; - case 'specular': - if ( parameter.color && material.specular ) material.specular.fromArray( parameter.color ); - if ( parameter.texture ) material.specularMap = getTexture( parameter.texture ); - break; - case 'bump': - if ( parameter.texture ) material.normalMap = getTexture( parameter.texture ); - break; - case 'ambient': - if ( parameter.texture ) material.lightMap = getTexture( parameter.texture, SRGBColorSpace ); - break; - case 'shininess': - if ( parameter.float && material.shininess ) material.shininess = parameter.float; - break; - case 'emission': - if ( parameter.color && material.emissive ) material.emissive.fromArray( parameter.color ); - if ( parameter.texture ) material.emissiveMap = getTexture( parameter.texture, SRGBColorSpace ); - break; - - } - - } - - material.color.convertSRGBToLinear(); - if ( material.specular ) material.specular.convertSRGBToLinear(); - if ( material.emissive ) material.emissive.convertSRGBToLinear(); - - // - - let transparent = parameters[ 'transparent' ]; - let transparency = parameters[ 'transparency' ]; - - // does not exist but - - if ( transparency === undefined && transparent ) { - - transparency = { - float: 1 - }; - - } - - // does not exist but - - if ( transparent === undefined && transparency ) { - - transparent = { - opaque: 'A_ONE', - data: { - color: [ 1, 1, 1, 1 ] - } }; - - } - - if ( transparent && transparency ) { - - // handle case if a texture exists but no color - - if ( transparent.data.texture ) { - - // we do not set an alpha map (see #13792) - - material.transparent = true; - - } else { - - const color = transparent.data.color; - - switch ( transparent.opaque ) { - - case 'A_ONE': - material.opacity = color[ 3 ] * transparency.float; - break; - case 'RGB_ZERO': - material.opacity = 1 - ( color[ 0 ] * transparency.float ); - break; - case 'A_ZERO': - material.opacity = 1 - ( color[ 3 ] * transparency.float ); - break; - case 'RGB_ONE': - material.opacity = color[ 0 ] * transparency.float; - break; - default: - console.warn( 'THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.', transparent.opaque ); - - } - - if ( material.opacity < 1 ) material.transparent = true; - - } - - } - - // - - - if ( technique.extra !== undefined && technique.extra.technique !== undefined ) { - - const techniques = technique.extra.technique; - - for ( const k in techniques ) { - - const v = techniques[ k ]; - - switch ( k ) { - - case 'double_sided': - material.side = ( v === 1 ? DoubleSide : FrontSide ); - break; - - case 'bump': - material.normalMap = getTexture( v.texture ); - material.normalScale = new Vector2( 1, 1 ); - break; - - } - - } - - } - - return material; - - } - - function getMaterial( id ) { - - return getBuild( library.materials[ id ], buildMaterial ); - - } - - // camera - - function parseCamera( xml ) { - - const data = { - name: xml.getAttribute( 'name' ) - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'optics': - data.optics = parseCameraOptics( child ); - break; - - } - - } - - library.cameras[ xml.getAttribute( 'id' ) ] = data; - - } - - function parseCameraOptics( xml ) { - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'technique_common': - return parseCameraTechnique( child ); - - } - - } - - return {}; - - } - - function parseCameraTechnique( xml ) { - - const data = {}; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'perspective': - case 'orthographic': - - data.technique = child.nodeName; - data.parameters = parseCameraParameters( child ); - - break; - - } - - } - - return data; - - } - - function parseCameraParameters( xml ) { - - const data = {}; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'xfov': - case 'yfov': - case 'xmag': - case 'ymag': - case 'znear': - case 'zfar': - case 'aspect_ratio': - data[ child.nodeName ] = parseFloat( child.textContent ); - break; - - } - - } - - return data; - - } - - function buildCamera( data ) { - - let camera; - - switch ( data.optics.technique ) { - - case 'perspective': - camera = new PerspectiveCamera( - data.optics.parameters.yfov, - data.optics.parameters.aspect_ratio, - data.optics.parameters.znear, - data.optics.parameters.zfar - ); - break; - - case 'orthographic': - let ymag = data.optics.parameters.ymag; - let xmag = data.optics.parameters.xmag; - const aspectRatio = data.optics.parameters.aspect_ratio; - - xmag = ( xmag === undefined ) ? ( ymag * aspectRatio ) : xmag; - ymag = ( ymag === undefined ) ? ( xmag / aspectRatio ) : ymag; - - xmag *= 0.5; - ymag *= 0.5; - - camera = new OrthographicCamera( - - xmag, xmag, ymag, - ymag, // left, right, top, bottom - data.optics.parameters.znear, - data.optics.parameters.zfar - ); - break; - - default: - camera = new PerspectiveCamera(); - break; - - } - - camera.name = data.name || ''; - - return camera; - - } - - function getCamera( id ) { - - const data = library.cameras[ id ]; - - if ( data !== undefined ) { - - return getBuild( data, buildCamera ); - - } - - console.warn( 'THREE.ColladaLoader: Couldn\'t find camera with ID:', id ); - - return null; - - } - - // light - - function parseLight( xml ) { - - let data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique_common': - data = parseLightTechnique( child ); - break; - - } - - } - - library.lights[ xml.getAttribute( 'id' ) ] = data; - - } - - function parseLightTechnique( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'directional': - case 'point': - case 'spot': - case 'ambient': - - data.technique = child.nodeName; - data.parameters = parseLightParameters( child ); - - } - - } - - return data; - - } - - function parseLightParameters( xml ) { - - const data = {}; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'color': - const array = parseFloats( child.textContent ); - data.color = new Color().fromArray( array ).convertSRGBToLinear(); - break; - - case 'falloff_angle': - data.falloffAngle = parseFloat( child.textContent ); - break; - - case 'quadratic_attenuation': - const f = parseFloat( child.textContent ); - data.distance = f ? Math.sqrt( 1 / f ) : 0; - break; - - } - - } - - return data; - - } - - function buildLight( data ) { - - let light; - - switch ( data.technique ) { - - case 'directional': - light = new DirectionalLight(); - break; - - case 'point': - light = new PointLight(); - break; - - case 'spot': - light = new SpotLight(); - break; - - case 'ambient': - light = new AmbientLight(); - break; - - } - - if ( data.parameters.color ) light.color.copy( data.parameters.color ); - if ( data.parameters.distance ) light.distance = data.parameters.distance; - - return light; - - } - - function getLight( id ) { - - const data = library.lights[ id ]; - - if ( data !== undefined ) { - - return getBuild( data, buildLight ); - - } - - console.warn( 'THREE.ColladaLoader: Couldn\'t find light with ID:', id ); - - return null; - - } - - // geometry - - function parseGeometry( xml ) { - - const data = { - name: xml.getAttribute( 'name' ), - sources: {}, - vertices: {}, - primitives: [] - }; - - const mesh = getElementsByTagName( xml, 'mesh' )[ 0 ]; - - // the following tags inside geometry are not supported yet (see https://github.com/mrdoob/three.js/pull/12606): convex_mesh, spline, brep - if ( mesh === undefined ) return; - - for ( let i = 0; i < mesh.childNodes.length; i ++ ) { - - const child = mesh.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - const id = child.getAttribute( 'id' ); - - switch ( child.nodeName ) { - - case 'source': - data.sources[ id ] = parseSource( child ); - break; - - case 'vertices': - // data.sources[ id ] = data.sources[ parseId( getElementsByTagName( child, 'input' )[ 0 ].getAttribute( 'source' ) ) ]; - data.vertices = parseGeometryVertices( child ); - break; - - case 'polygons': - console.warn( 'THREE.ColladaLoader: Unsupported primitive type: ', child.nodeName ); - break; - - case 'lines': - case 'linestrips': - case 'polylist': - case 'triangles': - data.primitives.push( parseGeometryPrimitive( child ) ); - break; - - default: - console.log( child ); - - } - - } - - library.geometries[ xml.getAttribute( 'id' ) ] = data; - - } - - function parseSource( xml ) { - - const data = { - array: [], - stride: 3 - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'float_array': - data.array = parseFloats( child.textContent ); - break; - - case 'Name_array': - data.array = parseStrings( child.textContent ); - break; - - case 'technique_common': - const accessor = getElementsByTagName( child, 'accessor' )[ 0 ]; - - if ( accessor !== undefined ) { - - data.stride = parseInt( accessor.getAttribute( 'stride' ) ); - - } - - break; - - } - - } - - return data; - - } - - function parseGeometryVertices( xml ) { - - const data = {}; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - data[ child.getAttribute( 'semantic' ) ] = parseId( child.getAttribute( 'source' ) ); - - } - - return data; - - } - - function parseGeometryPrimitive( xml ) { - - const primitive = { - type: xml.nodeName, - material: xml.getAttribute( 'material' ), - count: parseInt( xml.getAttribute( 'count' ) ), - inputs: {}, - stride: 0, - hasUV: false - }; - - for ( let i = 0, l = xml.childNodes.length; i < l; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'input': - const id = parseId( child.getAttribute( 'source' ) ); - const semantic = child.getAttribute( 'semantic' ); - const offset = parseInt( child.getAttribute( 'offset' ) ); - const set = parseInt( child.getAttribute( 'set' ) ); - const inputname = ( set > 0 ? semantic + set : semantic ); - primitive.inputs[ inputname ] = { id: id, offset: offset }; - primitive.stride = Math.max( primitive.stride, offset + 1 ); - if ( semantic === 'TEXCOORD' ) primitive.hasUV = true; - break; - - case 'vcount': - primitive.vcount = parseInts( child.textContent ); - break; - - case 'p': - primitive.p = parseInts( child.textContent ); - break; - - } - - } - - return primitive; - - } - - function groupPrimitives( primitives ) { - - const build = {}; - - for ( let i = 0; i < primitives.length; i ++ ) { - - const primitive = primitives[ i ]; - - if ( build[ primitive.type ] === undefined ) build[ primitive.type ] = []; - - build[ primitive.type ].push( primitive ); - - } - - return build; - - } - - function checkUVCoordinates( primitives ) { - - let count = 0; - - for ( let i = 0, l = primitives.length; i < l; i ++ ) { - - const primitive = primitives[ i ]; - - if ( primitive.hasUV === true ) { - - count ++; - - } - - } - - if ( count > 0 && count < primitives.length ) { - - primitives.uvsNeedsFix = true; - - } - - } - - function buildGeometry( data ) { - - const build = {}; - - const sources = data.sources; - const vertices = data.vertices; - const primitives = data.primitives; - - if ( primitives.length === 0 ) return {}; - - // our goal is to create one buffer geometry for a single type of primitives - // first, we group all primitives by their type - - const groupedPrimitives = groupPrimitives( primitives ); - - for ( const type in groupedPrimitives ) { - - const primitiveType = groupedPrimitives[ type ]; - - // second, ensure consistent uv coordinates for each type of primitives (polylist,triangles or lines) - - checkUVCoordinates( primitiveType ); - - // third, create a buffer geometry for each type of primitives - - build[ type ] = buildGeometryType( primitiveType, sources, vertices ); - - } - - return build; - - } - - function buildGeometryType( primitives, sources, vertices ) { - - const build = {}; - - const position = { array: [], stride: 0 }; - const normal = { array: [], stride: 0 }; - const uv = { array: [], stride: 0 }; - const uv1 = { array: [], stride: 0 }; - const color = { array: [], stride: 0 }; - - const skinIndex = { array: [], stride: 4 }; - const skinWeight = { array: [], stride: 4 }; - - const geometry = new BufferGeometry(); - - const materialKeys = []; - - let start = 0; - - for ( let p = 0; p < primitives.length; p ++ ) { - - const primitive = primitives[ p ]; - const inputs = primitive.inputs; - - // groups - - let count = 0; - - switch ( primitive.type ) { - - case 'lines': - case 'linestrips': - count = primitive.count * 2; - break; - - case 'triangles': - count = primitive.count * 3; - break; - - case 'polylist': - - for ( let g = 0; g < primitive.count; g ++ ) { - - const vc = primitive.vcount[ g ]; - - switch ( vc ) { - - case 3: - count += 3; // single triangle - break; - - case 4: - count += 6; // quad, subdivided into two triangles - break; - - default: - count += ( vc - 2 ) * 3; // polylist with more than four vertices - break; - - } - - } - - break; - - default: - console.warn( 'THREE.ColladaLoader: Unknow primitive type:', primitive.type ); - - } - - geometry.addGroup( start, count, p ); - start += count; - - // material - - if ( primitive.material ) { - - materialKeys.push( primitive.material ); - - } - - // geometry data - - for ( const name in inputs ) { - - const input = inputs[ name ]; - - switch ( name ) { - - case 'VERTEX': - for ( const key in vertices ) { - - const id = vertices[ key ]; - - switch ( key ) { - - case 'POSITION': - const prevLength = position.array.length; - buildGeometryData( primitive, sources[ id ], input.offset, position.array ); - position.stride = sources[ id ].stride; - - if ( sources.skinWeights && sources.skinIndices ) { - - buildGeometryData( primitive, sources.skinIndices, input.offset, skinIndex.array ); - buildGeometryData( primitive, sources.skinWeights, input.offset, skinWeight.array ); - - } - - // see #3803 - - if ( primitive.hasUV === false && primitives.uvsNeedsFix === true ) { - - const count = ( position.array.length - prevLength ) / position.stride; - - for ( let i = 0; i < count; i ++ ) { - - // fill missing uv coordinates - - uv.array.push( 0, 0 ); - - } - - } - - break; - - case 'NORMAL': - buildGeometryData( primitive, sources[ id ], input.offset, normal.array ); - normal.stride = sources[ id ].stride; - break; - - case 'COLOR': - buildGeometryData( primitive, sources[ id ], input.offset, color.array ); - color.stride = sources[ id ].stride; - break; - - case 'TEXCOORD': - buildGeometryData( primitive, sources[ id ], input.offset, uv.array ); - uv.stride = sources[ id ].stride; - break; - - case 'TEXCOORD1': - buildGeometryData( primitive, sources[ id ], input.offset, uv1.array ); - uv.stride = sources[ id ].stride; - break; - - default: - console.warn( 'THREE.ColladaLoader: Semantic "%s" not handled in geometry build process.', key ); - - } - - } - - break; - - case 'NORMAL': - buildGeometryData( primitive, sources[ input.id ], input.offset, normal.array ); - normal.stride = sources[ input.id ].stride; - break; - - case 'COLOR': - buildGeometryData( primitive, sources[ input.id ], input.offset, color.array, true ); - color.stride = sources[ input.id ].stride; - break; - - case 'TEXCOORD': - buildGeometryData( primitive, sources[ input.id ], input.offset, uv.array ); - uv.stride = sources[ input.id ].stride; - break; - - case 'TEXCOORD1': - buildGeometryData( primitive, sources[ input.id ], input.offset, uv1.array ); - uv1.stride = sources[ input.id ].stride; - break; - - } - - } - - } - - // build geometry - - if ( position.array.length > 0 ) geometry.setAttribute( 'position', new Float32BufferAttribute( position.array, position.stride ) ); - if ( normal.array.length > 0 ) geometry.setAttribute( 'normal', new Float32BufferAttribute( normal.array, normal.stride ) ); - if ( color.array.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( color.array, color.stride ) ); - if ( uv.array.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( uv.array, uv.stride ) ); - if ( uv1.array.length > 0 ) geometry.setAttribute( 'uv1', new Float32BufferAttribute( uv1.array, uv1.stride ) ); - - if ( skinIndex.array.length > 0 ) geometry.setAttribute( 'skinIndex', new Float32BufferAttribute( skinIndex.array, skinIndex.stride ) ); - if ( skinWeight.array.length > 0 ) geometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeight.array, skinWeight.stride ) ); - - build.data = geometry; - build.type = primitives[ 0 ].type; - build.materialKeys = materialKeys; - - return build; - - } - - function buildGeometryData( primitive, source, offset, array, isColor = false ) { - - const indices = primitive.p; - const stride = primitive.stride; - const vcount = primitive.vcount; - - function pushVector( i ) { - - let index = indices[ i + offset ] * sourceStride; - const length = index + sourceStride; - - for ( ; index < length; index ++ ) { - - array.push( sourceArray[ index ] ); - - } - - if ( isColor ) { - - // convert the vertex colors from srgb to linear if present - const startIndex = array.length - sourceStride - 1; - tempColor.setRGB( - array[ startIndex + 0 ], - array[ startIndex + 1 ], - array[ startIndex + 2 ] - ).convertSRGBToLinear(); - - array[ startIndex + 0 ] = tempColor.r; - array[ startIndex + 1 ] = tempColor.g; - array[ startIndex + 2 ] = tempColor.b; - - } - - } - - const sourceArray = source.array; - const sourceStride = source.stride; - - if ( primitive.vcount !== undefined ) { - - let index = 0; - - for ( let i = 0, l = vcount.length; i < l; i ++ ) { - - const count = vcount[ i ]; - - if ( count === 4 ) { - - const a = index + stride * 0; - const b = index + stride * 1; - const c = index + stride * 2; - const d = index + stride * 3; - - pushVector( a ); pushVector( b ); pushVector( d ); - pushVector( b ); pushVector( c ); pushVector( d ); - - } else if ( count === 3 ) { - - const a = index + stride * 0; - const b = index + stride * 1; - const c = index + stride * 2; - - pushVector( a ); pushVector( b ); pushVector( c ); - - } else if ( count > 4 ) { - - for ( let k = 1, kl = ( count - 2 ); k <= kl; k ++ ) { - - const a = index + stride * 0; - const b = index + stride * k; - const c = index + stride * ( k + 1 ); - - pushVector( a ); pushVector( b ); pushVector( c ); - - } - - } - - index += stride * count; - - } - - } else { - - for ( let i = 0, l = indices.length; i < l; i += stride ) { - - pushVector( i ); - - } - - } - - } - - function getGeometry( id ) { - - return getBuild( library.geometries[ id ], buildGeometry ); - - } - - // kinematics - - function parseKinematicsModel( xml ) { - - const data = { - name: xml.getAttribute( 'name' ) || '', - joints: {}, - links: [] - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique_common': - parseKinematicsTechniqueCommon( child, data ); - break; - - } - - } - - library.kinematicsModels[ xml.getAttribute( 'id' ) ] = data; - - } - - function buildKinematicsModel( data ) { - - if ( data.build !== undefined ) return data.build; - - return data; - - } - - function getKinematicsModel( id ) { - - return getBuild( library.kinematicsModels[ id ], buildKinematicsModel ); - - } - - function parseKinematicsTechniqueCommon( xml, data ) { - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'joint': - data.joints[ child.getAttribute( 'sid' ) ] = parseKinematicsJoint( child ); - break; - - case 'link': - data.links.push( parseKinematicsLink( child ) ); - break; - - } - - } - - } - - function parseKinematicsJoint( xml ) { - - let data; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'prismatic': - case 'revolute': - data = parseKinematicsJointParameter( child ); - break; - - } - - } - - return data; - - } - - function parseKinematicsJointParameter( xml ) { - - const data = { - sid: xml.getAttribute( 'sid' ), - name: xml.getAttribute( 'name' ) || '', - axis: new Vector3(), - limits: { - min: 0, - max: 0 - }, - type: xml.nodeName, - static: false, - zeroPosition: 0, - middlePosition: 0 - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'axis': - const array = parseFloats( child.textContent ); - data.axis.fromArray( array ); - break; - case 'limits': - const max = child.getElementsByTagName( 'max' )[ 0 ]; - const min = child.getElementsByTagName( 'min' )[ 0 ]; - - data.limits.max = parseFloat( max.textContent ); - data.limits.min = parseFloat( min.textContent ); - break; - - } - - } - - // if min is equal to or greater than max, consider the joint static - - if ( data.limits.min >= data.limits.max ) { - - data.static = true; - - } - - // calculate middle position - - data.middlePosition = ( data.limits.min + data.limits.max ) / 2.0; - - return data; - - } - - function parseKinematicsLink( xml ) { - - const data = { - sid: xml.getAttribute( 'sid' ), - name: xml.getAttribute( 'name' ) || '', - attachments: [], - transforms: [] - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'attachment_full': - data.attachments.push( parseKinematicsAttachment( child ) ); - break; - - case 'matrix': - case 'translate': - case 'rotate': - data.transforms.push( parseKinematicsTransform( child ) ); - break; - - } - - } - - return data; - - } - - function parseKinematicsAttachment( xml ) { - - const data = { - joint: xml.getAttribute( 'joint' ).split( '/' ).pop(), - transforms: [], - links: [] - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'link': - data.links.push( parseKinematicsLink( child ) ); - break; - - case 'matrix': - case 'translate': - case 'rotate': - data.transforms.push( parseKinematicsTransform( child ) ); - break; - - } - - } - - return data; - - } - - function parseKinematicsTransform( xml ) { - - const data = { - type: xml.nodeName - }; - - const array = parseFloats( xml.textContent ); - - switch ( data.type ) { - - case 'matrix': - data.obj = new Matrix4(); - data.obj.fromArray( array ).transpose(); - break; - - case 'translate': - data.obj = new Vector3(); - data.obj.fromArray( array ); - break; - - case 'rotate': - data.obj = new Vector3(); - data.obj.fromArray( array ); - data.angle = MathUtils.degToRad( array[ 3 ] ); - break; - - } - - return data; - - } - - // physics - - function parsePhysicsModel( xml ) { - - const data = { - name: xml.getAttribute( 'name' ) || '', - rigidBodies: {} - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'rigid_body': - data.rigidBodies[ child.getAttribute( 'name' ) ] = {}; - parsePhysicsRigidBody( child, data.rigidBodies[ child.getAttribute( 'name' ) ] ); - break; - - } - - } - - library.physicsModels[ xml.getAttribute( 'id' ) ] = data; - - } - - function parsePhysicsRigidBody( xml, data ) { - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'technique_common': - parsePhysicsTechniqueCommon( child, data ); - break; - - } - - } - - } - - function parsePhysicsTechniqueCommon( xml, data ) { - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'inertia': - data.inertia = parseFloats( child.textContent ); - break; - - case 'mass': - data.mass = parseFloats( child.textContent )[ 0 ]; - break; - - } - - } - - } - - // scene - - function parseKinematicsScene( xml ) { - - const data = { - bindJointAxis: [] - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'bind_joint_axis': - data.bindJointAxis.push( parseKinematicsBindJointAxis( child ) ); - break; - - } - - } - - library.kinematicsScenes[ parseId( xml.getAttribute( 'url' ) ) ] = data; - - } - - function parseKinematicsBindJointAxis( xml ) { - - const data = { - target: xml.getAttribute( 'target' ).split( '/' ).pop() - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - switch ( child.nodeName ) { - - case 'axis': - const param = child.getElementsByTagName( 'param' )[ 0 ]; - data.axis = param.textContent; - const tmpJointIndex = data.axis.split( 'inst_' ).pop().split( 'axis' )[ 0 ]; - data.jointIndex = tmpJointIndex.substring( 0, tmpJointIndex.length - 1 ); - break; - - } - - } - - return data; - - } - - function buildKinematicsScene( data ) { - - if ( data.build !== undefined ) return data.build; - - return data; - - } - - function getKinematicsScene( id ) { - - return getBuild( library.kinematicsScenes[ id ], buildKinematicsScene ); - - } - - function setupKinematics() { - - const kinematicsModelId = Object.keys( library.kinematicsModels )[ 0 ]; - const kinematicsSceneId = Object.keys( library.kinematicsScenes )[ 0 ]; - const visualSceneId = Object.keys( library.visualScenes )[ 0 ]; - - if ( kinematicsModelId === undefined || kinematicsSceneId === undefined ) return; - - const kinematicsModel = getKinematicsModel( kinematicsModelId ); - const kinematicsScene = getKinematicsScene( kinematicsSceneId ); - const visualScene = getVisualScene( visualSceneId ); - - const bindJointAxis = kinematicsScene.bindJointAxis; - const jointMap = {}; - - for ( let i = 0, l = bindJointAxis.length; i < l; i ++ ) { - - const axis = bindJointAxis[ i ]; - - // the result of the following query is an element of type 'translate', 'rotate','scale' or 'matrix' - - const targetElement = collada.querySelector( '[sid="' + axis.target + '"]' ); - - if ( targetElement ) { - - // get the parent of the transform element - - const parentVisualElement = targetElement.parentElement; - - // connect the joint of the kinematics model with the element in the visual scene - - connect( axis.jointIndex, parentVisualElement ); - - } - - } - - function connect( jointIndex, visualElement ) { - - const visualElementName = visualElement.getAttribute( 'name' ); - const joint = kinematicsModel.joints[ jointIndex ]; - - visualScene.traverse( function ( object ) { - - if ( object.name === visualElementName ) { - - jointMap[ jointIndex ] = { - object: object, - transforms: buildTransformList( visualElement ), - joint: joint, - position: joint.zeroPosition - }; - - } - - } ); - - } - - const m0 = new Matrix4(); - - kinematics = { - - joints: kinematicsModel && kinematicsModel.joints, - - getJointValue: function ( jointIndex ) { - - const jointData = jointMap[ jointIndex ]; - - if ( jointData ) { - - return jointData.position; - - } else { - - console.warn( 'THREE.ColladaLoader: Joint ' + jointIndex + ' doesn\'t exist.' ); - - } - - }, - - setJointValue: function ( jointIndex, value ) { - - const jointData = jointMap[ jointIndex ]; - - if ( jointData ) { - - const joint = jointData.joint; - - if ( value > joint.limits.max || value < joint.limits.min ) { - - console.warn( 'THREE.ColladaLoader: Joint ' + jointIndex + ' value ' + value + ' outside of limits (min: ' + joint.limits.min + ', max: ' + joint.limits.max + ').' ); - - } else if ( joint.static ) { - - console.warn( 'THREE.ColladaLoader: Joint ' + jointIndex + ' is static.' ); - - } else { - - const object = jointData.object; - const axis = joint.axis; - const transforms = jointData.transforms; - - matrix.identity(); - - // each update, we have to apply all transforms in the correct order - - for ( let i = 0; i < transforms.length; i ++ ) { - - const transform = transforms[ i ]; - - // if there is a connection of the transform node with a joint, apply the joint value - - if ( transform.sid && transform.sid.indexOf( jointIndex ) !== - 1 ) { - - switch ( joint.type ) { - - case 'revolute': - matrix.multiply( m0.makeRotationAxis( axis, MathUtils.degToRad( value ) ) ); - break; - - case 'prismatic': - matrix.multiply( m0.makeTranslation( axis.x * value, axis.y * value, axis.z * value ) ); - break; - - default: - console.warn( 'THREE.ColladaLoader: Unknown joint type: ' + joint.type ); - break; - - } - - } else { - - switch ( transform.type ) { - - case 'matrix': - matrix.multiply( transform.obj ); - break; - - case 'translate': - matrix.multiply( m0.makeTranslation( transform.obj.x, transform.obj.y, transform.obj.z ) ); - break; - - case 'scale': - matrix.scale( transform.obj ); - break; - - case 'rotate': - matrix.multiply( m0.makeRotationAxis( transform.obj, transform.angle ) ); - break; - - } - - } - - } - - object.matrix.copy( matrix ); - object.matrix.decompose( object.position, object.quaternion, object.scale ); - - jointMap[ jointIndex ].position = value; - - } - - } else { - - console.log( 'THREE.ColladaLoader: ' + jointIndex + ' does not exist.' ); - - } - - } - - }; - - } - - function buildTransformList( node ) { - - const transforms = []; - - const xml = collada.querySelector( '[id="' + node.id + '"]' ); - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - let array, vector; - - switch ( child.nodeName ) { - - case 'matrix': - array = parseFloats( child.textContent ); - const matrix = new Matrix4().fromArray( array ).transpose(); - transforms.push( { - sid: child.getAttribute( 'sid' ), - type: child.nodeName, - obj: matrix - } ); - break; - - case 'translate': - case 'scale': - array = parseFloats( child.textContent ); - vector = new Vector3().fromArray( array ); - transforms.push( { - sid: child.getAttribute( 'sid' ), - type: child.nodeName, - obj: vector - } ); - break; - - case 'rotate': - array = parseFloats( child.textContent ); - vector = new Vector3().fromArray( array ); - const angle = MathUtils.degToRad( array[ 3 ] ); - transforms.push( { - sid: child.getAttribute( 'sid' ), - type: child.nodeName, - obj: vector, - angle: angle - } ); - break; - - } - - } - - return transforms; - - } - - // nodes - - function prepareNodes( xml ) { - - const elements = xml.getElementsByTagName( 'node' ); - - // ensure all node elements have id attributes - - for ( let i = 0; i < elements.length; i ++ ) { - - const element = elements[ i ]; - - if ( element.hasAttribute( 'id' ) === false ) { - - element.setAttribute( 'id', generateId() ); - - } - - } - - } - - const matrix = new Matrix4(); - const vector = new Vector3(); - - function parseNode( xml ) { - - const data = { - name: xml.getAttribute( 'name' ) || '', - type: xml.getAttribute( 'type' ), - id: xml.getAttribute( 'id' ), - sid: xml.getAttribute( 'sid' ), - matrix: new Matrix4(), - nodes: [], - instanceCameras: [], - instanceControllers: [], - instanceLights: [], - instanceGeometries: [], - instanceNodes: [], - transforms: {} - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - if ( child.nodeType !== 1 ) continue; - - let array; - - switch ( child.nodeName ) { - - case 'node': - data.nodes.push( child.getAttribute( 'id' ) ); - parseNode( child ); - break; - - case 'instance_camera': - data.instanceCameras.push( parseId( child.getAttribute( 'url' ) ) ); - break; - - case 'instance_controller': - data.instanceControllers.push( parseNodeInstance( child ) ); - break; - - case 'instance_light': - data.instanceLights.push( parseId( child.getAttribute( 'url' ) ) ); - break; - - case 'instance_geometry': - data.instanceGeometries.push( parseNodeInstance( child ) ); - break; - - case 'instance_node': - data.instanceNodes.push( parseId( child.getAttribute( 'url' ) ) ); - break; - - case 'matrix': - array = parseFloats( child.textContent ); - data.matrix.multiply( matrix.fromArray( array ).transpose() ); - data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName; - break; - - case 'translate': - array = parseFloats( child.textContent ); - vector.fromArray( array ); - data.matrix.multiply( matrix.makeTranslation( vector.x, vector.y, vector.z ) ); - data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName; - break; - - case 'rotate': - array = parseFloats( child.textContent ); - const angle = MathUtils.degToRad( array[ 3 ] ); - data.matrix.multiply( matrix.makeRotationAxis( vector.fromArray( array ), angle ) ); - data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName; - break; - - case 'scale': - array = parseFloats( child.textContent ); - data.matrix.scale( vector.fromArray( array ) ); - data.transforms[ child.getAttribute( 'sid' ) ] = child.nodeName; - break; - - case 'extra': - break; - - default: - console.log( child ); - - } - - } - - if ( hasNode( data.id ) ) { - - console.warn( 'THREE.ColladaLoader: There is already a node with ID %s. Exclude current node from further processing.', data.id ); - - } else { - - library.nodes[ data.id ] = data; - - } - - return data; - - } - - function parseNodeInstance( xml ) { - - const data = { - id: parseId( xml.getAttribute( 'url' ) ), - materials: {}, - skeletons: [] - }; - - for ( let i = 0; i < xml.childNodes.length; i ++ ) { - - const child = xml.childNodes[ i ]; - - switch ( child.nodeName ) { - - case 'bind_material': - const instances = child.getElementsByTagName( 'instance_material' ); - - for ( let j = 0; j < instances.length; j ++ ) { - - const instance = instances[ j ]; - const symbol = instance.getAttribute( 'symbol' ); - const target = instance.getAttribute( 'target' ); - - data.materials[ symbol ] = parseId( target ); - - } - - break; - - case 'skeleton': - data.skeletons.push( parseId( child.textContent ) ); - break; - - default: - break; - - } - - } - - return data; - - } - - function buildSkeleton( skeletons, joints ) { - - const boneData = []; - const sortedBoneData = []; - - let i, j, data; - - // a skeleton can have multiple root bones. collada expresses this - // situtation with multiple "skeleton" tags per controller instance - - for ( i = 0; i < skeletons.length; i ++ ) { - - const skeleton = skeletons[ i ]; - - let root; - - if ( hasNode( skeleton ) ) { - - root = getNode( skeleton ); - buildBoneHierarchy( root, joints, boneData ); - - } else if ( hasVisualScene( skeleton ) ) { - - // handle case where the skeleton refers to the visual scene (#13335) - - const visualScene = library.visualScenes[ skeleton ]; - const children = visualScene.children; - - for ( let j = 0; j < children.length; j ++ ) { - - const child = children[ j ]; - - if ( child.type === 'JOINT' ) { - - const root = getNode( child.id ); - buildBoneHierarchy( root, joints, boneData ); - - } - - } - - } else { - - console.error( 'THREE.ColladaLoader: Unable to find root bone of skeleton with ID:', skeleton ); - - } - - } - - // sort bone data (the order is defined in the corresponding controller) - - for ( i = 0; i < joints.length; i ++ ) { - - for ( j = 0; j < boneData.length; j ++ ) { - - data = boneData[ j ]; - - if ( data.bone.name === joints[ i ].name ) { - - sortedBoneData[ i ] = data; - data.processed = true; - break; - - } - - } - - } - - // add unprocessed bone data at the end of the list - - for ( i = 0; i < boneData.length; i ++ ) { - - data = boneData[ i ]; - - if ( data.processed === false ) { - - sortedBoneData.push( data ); - data.processed = true; - - } - - } - - // setup arrays for skeleton creation - - const bones = []; - const boneInverses = []; - - for ( i = 0; i < sortedBoneData.length; i ++ ) { - - data = sortedBoneData[ i ]; - - bones.push( data.bone ); - boneInverses.push( data.boneInverse ); - - } - - return new Skeleton( bones, boneInverses ); - - } - - function buildBoneHierarchy( root, joints, boneData ) { - - // setup bone data from visual scene - - root.traverse( function ( object ) { - - if ( object.isBone === true ) { - - let boneInverse; - - // retrieve the boneInverse from the controller data - - for ( let i = 0; i < joints.length; i ++ ) { - - const joint = joints[ i ]; - - if ( joint.name === object.name ) { - - boneInverse = joint.boneInverse; - break; - - } - - } - - if ( boneInverse === undefined ) { - - // Unfortunately, there can be joints in the visual scene that are not part of the - // corresponding controller. In this case, we have to create a dummy boneInverse matrix - // for the respective bone. This bone won't affect any vertices, because there are no skin indices - // and weights defined for it. But we still have to add the bone to the sorted bone list in order to - // ensure a correct animation of the model. - - boneInverse = new Matrix4(); - - } - - boneData.push( { bone: object, boneInverse: boneInverse, processed: false } ); - - } - - } ); - - } - - function buildNode( data ) { - - const objects = []; - - const matrix = data.matrix; - const nodes = data.nodes; - const type = data.type; - const instanceCameras = data.instanceCameras; - const instanceControllers = data.instanceControllers; - const instanceLights = data.instanceLights; - const instanceGeometries = data.instanceGeometries; - const instanceNodes = data.instanceNodes; - - // nodes - - for ( let i = 0, l = nodes.length; i < l; i ++ ) { - - objects.push( getNode( nodes[ i ] ) ); - - } - - // instance cameras - - for ( let i = 0, l = instanceCameras.length; i < l; i ++ ) { - - const instanceCamera = getCamera( instanceCameras[ i ] ); - - if ( instanceCamera !== null ) { - - objects.push( instanceCamera.clone() ); - - } - - } - - // instance controllers - - for ( let i = 0, l = instanceControllers.length; i < l; i ++ ) { - - const instance = instanceControllers[ i ]; - const controller = getController( instance.id ); - const geometries = getGeometry( controller.id ); - const newObjects = buildObjects( geometries, instance.materials ); - - const skeletons = instance.skeletons; - const joints = controller.skin.joints; - - const skeleton = buildSkeleton( skeletons, joints ); - - for ( let j = 0, jl = newObjects.length; j < jl; j ++ ) { - - const object = newObjects[ j ]; - - if ( object.isSkinnedMesh ) { - - object.bind( skeleton, controller.skin.bindMatrix ); - object.normalizeSkinWeights(); - - } - - objects.push( object ); - - } - - } - - // instance lights - - for ( let i = 0, l = instanceLights.length; i < l; i ++ ) { - - const instanceLight = getLight( instanceLights[ i ] ); - - if ( instanceLight !== null ) { - - objects.push( instanceLight.clone() ); - - } - - } - - // instance geometries - - for ( let i = 0, l = instanceGeometries.length; i < l; i ++ ) { - - const instance = instanceGeometries[ i ]; - - // a single geometry instance in collada can lead to multiple object3Ds. - // this is the case when primitives are combined like triangles and lines - - const geometries = getGeometry( instance.id ); - const newObjects = buildObjects( geometries, instance.materials ); - - for ( let j = 0, jl = newObjects.length; j < jl; j ++ ) { - - objects.push( newObjects[ j ] ); - - } - - } - - // instance nodes - - for ( let i = 0, l = instanceNodes.length; i < l; i ++ ) { - - objects.push( getNode( instanceNodes[ i ] ).clone() ); - - } - - let object; - - if ( nodes.length === 0 && objects.length === 1 ) { - - object = objects[ 0 ]; - - } else { - - object = ( type === 'JOINT' ) ? new Bone() : new Group(); - - for ( let i = 0; i < objects.length; i ++ ) { - - object.add( objects[ i ] ); - - } - - } - - object.name = ( type === 'JOINT' ) ? data.sid : data.name; - object.matrix.copy( matrix ); - object.matrix.decompose( object.position, object.quaternion, object.scale ); - - return object; - - } - - const fallbackMaterial = new MeshBasicMaterial( { - name: Loader.DEFAULT_MATERIAL_NAME, - color: 0xff00ff - } ); - - function resolveMaterialBinding( keys, instanceMaterials ) { - - const materials = []; - - for ( let i = 0, l = keys.length; i < l; i ++ ) { - - const id = instanceMaterials[ keys[ i ] ]; - - if ( id === undefined ) { - - console.warn( 'THREE.ColladaLoader: Material with key %s not found. Apply fallback material.', keys[ i ] ); - materials.push( fallbackMaterial ); - - } else { - - materials.push( getMaterial( id ) ); - - } - - } - - return materials; - - } - - function buildObjects( geometries, instanceMaterials ) { - - const objects = []; - - for ( const type in geometries ) { - - const geometry = geometries[ type ]; - - const materials = resolveMaterialBinding( geometry.materialKeys, instanceMaterials ); - - // handle case if no materials are defined - - if ( materials.length === 0 ) { - - if ( type === 'lines' || type === 'linestrips' ) { - - materials.push( new LineBasicMaterial() ); - - } else { - - materials.push( new MeshPhongMaterial() ); - - } - - } - - // Collada allows to use phong and lambert materials with lines. Replacing these cases with LineBasicMaterial. - - if ( type === 'lines' || type === 'linestrips' ) { - - for ( let i = 0, l = materials.length; i < l; i ++ ) { - - const material = materials[ i ]; - - if ( material.isMeshPhongMaterial === true || material.isMeshLambertMaterial === true ) { - - const lineMaterial = new LineBasicMaterial(); - - // copy compatible properties - - lineMaterial.color.copy( material.color ); - lineMaterial.opacity = material.opacity; - lineMaterial.transparent = material.transparent; - - // replace material - - materials[ i ] = lineMaterial; - - } - - } - - } - - // regard skinning - - const skinning = ( geometry.data.attributes.skinIndex !== undefined ); - - // choose between a single or multi materials (material array) - - const material = ( materials.length === 1 ) ? materials[ 0 ] : materials; - - // now create a specific 3D object - - let object; - - switch ( type ) { - - case 'lines': - object = new LineSegments( geometry.data, material ); - break; - - case 'linestrips': - object = new Line( geometry.data, material ); - break; - - case 'triangles': - case 'polylist': - if ( skinning ) { - - object = new SkinnedMesh( geometry.data, material ); - - } else { - - object = new Mesh( geometry.data, material ); - - } - - break; - - } - - objects.push( object ); - - } - - return objects; - - } - - function hasNode( id ) { - - return library.nodes[ id ] !== undefined; - - } - - function getNode( id ) { - - return getBuild( library.nodes[ id ], buildNode ); - - } - - // visual scenes - - function parseVisualScene( xml ) { - - const data = { - name: xml.getAttribute( 'name' ), - children: [] - }; - - prepareNodes( xml ); - - const elements = getElementsByTagName( xml, 'node' ); - - for ( let i = 0; i < elements.length; i ++ ) { - - data.children.push( parseNode( elements[ i ] ) ); - - } - - library.visualScenes[ xml.getAttribute( 'id' ) ] = data; - - } - - function buildVisualScene( data ) { - - const group = new Group(); - group.name = data.name; - - const children = data.children; - - for ( let i = 0; i < children.length; i ++ ) { - - const child = children[ i ]; - - group.add( getNode( child.id ) ); - - } - - return group; - - } - - function hasVisualScene( id ) { - - return library.visualScenes[ id ] !== undefined; - - } - - function getVisualScene( id ) { - - return getBuild( library.visualScenes[ id ], buildVisualScene ); - - } - - // scenes - - function parseScene( xml ) { - - const instance = getElementsByTagName( xml, 'instance_visual_scene' )[ 0 ]; - return getVisualScene( parseId( instance.getAttribute( 'url' ) ) ); - - } - - function setupAnimations() { - - const clips = library.clips; - - if ( isEmpty( clips ) === true ) { - - if ( isEmpty( library.animations ) === false ) { - - // if there are animations but no clips, we create a default clip for playback - - const tracks = []; - - for ( const id in library.animations ) { - - const animationTracks = getAnimation( id ); - - for ( let i = 0, l = animationTracks.length; i < l; i ++ ) { - - tracks.push( animationTracks[ i ] ); - - } - - } - - animations.push( new AnimationClip( 'default', - 1, tracks ) ); - - } - - } else { - - for ( const id in clips ) { - - animations.push( getAnimationClip( id ) ); - - } - - } - - } - - // convert the parser error element into text with each child elements text - // separated by new lines. - - function parserErrorToText( parserError ) { - - let result = ''; - const stack = [ parserError ]; - - while ( stack.length ) { - - const node = stack.shift(); - - if ( node.nodeType === Node.TEXT_NODE ) { - - result += node.textContent; - - } else { - - result += '\n'; - stack.push.apply( stack, node.childNodes ); - - } - - } - - return result.trim(); - - } - - if ( text.length === 0 ) { - - return { scene: new Scene() }; - - } - - const xml = new DOMParser().parseFromString( text, 'application/xml' ); - - const collada = getElementsByTagName( xml, 'COLLADA' )[ 0 ]; - - const parserError = xml.getElementsByTagName( 'parsererror' )[ 0 ]; - if ( parserError !== undefined ) { - - // Chrome will return parser error with a div in it - - const errorElement = getElementsByTagName( parserError, 'div' )[ 0 ]; - let errorText; - - if ( errorElement ) { - - errorText = errorElement.textContent; - - } else { - - errorText = parserErrorToText( parserError ); - - } - - console.error( 'THREE.ColladaLoader: Failed to parse collada file.\n', errorText ); - - return null; - - } - - // metadata - - const version = collada.getAttribute( 'version' ); - console.debug( 'THREE.ColladaLoader: File version', version ); - - const asset = parseAsset( getElementsByTagName( collada, 'asset' )[ 0 ] ); - const textureLoader = new TextureLoader( this.manager ); - textureLoader.setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin ); - - let tgaLoader; - - if ( TGALoader ) { - - tgaLoader = new TGALoader( this.manager ); - tgaLoader.setPath( this.resourcePath || path ); - - } - - // - - const tempColor = new Color(); - const animations = []; - let kinematics = {}; - let count = 0; - - // - - const library = { - animations: {}, - clips: {}, - controllers: {}, - images: {}, - effects: {}, - materials: {}, - cameras: {}, - lights: {}, - geometries: {}, - nodes: {}, - visualScenes: {}, - kinematicsModels: {}, - physicsModels: {}, - kinematicsScenes: {} - }; - - parseLibrary( collada, 'library_animations', 'animation', parseAnimation ); - parseLibrary( collada, 'library_animation_clips', 'animation_clip', parseAnimationClip ); - parseLibrary( collada, 'library_controllers', 'controller', parseController ); - parseLibrary( collada, 'library_images', 'image', parseImage ); - parseLibrary( collada, 'library_effects', 'effect', parseEffect ); - parseLibrary( collada, 'library_materials', 'material', parseMaterial ); - parseLibrary( collada, 'library_cameras', 'camera', parseCamera ); - parseLibrary( collada, 'library_lights', 'light', parseLight ); - parseLibrary( collada, 'library_geometries', 'geometry', parseGeometry ); - parseLibrary( collada, 'library_nodes', 'node', parseNode ); - parseLibrary( collada, 'library_visual_scenes', 'visual_scene', parseVisualScene ); - parseLibrary( collada, 'library_kinematics_models', 'kinematics_model', parseKinematicsModel ); - parseLibrary( collada, 'library_physics_models', 'physics_model', parsePhysicsModel ); - parseLibrary( collada, 'scene', 'instance_kinematics_scene', parseKinematicsScene ); - - buildLibrary( library.animations, buildAnimation ); - buildLibrary( library.clips, buildAnimationClip ); - buildLibrary( library.controllers, buildController ); - buildLibrary( library.images, buildImage ); - buildLibrary( library.effects, buildEffect ); - buildLibrary( library.materials, buildMaterial ); - buildLibrary( library.cameras, buildCamera ); - buildLibrary( library.lights, buildLight ); - buildLibrary( library.geometries, buildGeometry ); - buildLibrary( library.visualScenes, buildVisualScene ); - - setupAnimations(); - setupKinematics(); - - const scene = parseScene( getElementsByTagName( collada, 'scene' )[ 0 ] ); - scene.animations = animations; - - if ( asset.upAxis === 'Z_UP' ) { - - console.warn( 'THREE.ColladaLoader: You are loading an asset with a Z-UP coordinate system. The loader just rotates the asset to transform it into Y-UP. The vertex data are not converted, see #24289.' ); - scene.rotation.set( - Math.PI / 2, 0, 0 ); - - } - - scene.scale.multiplyScalar( asset.unit ); - - return { - get animations() { - - console.warn( 'THREE.ColladaLoader: Please access animations over scene.animations now.' ); - return animations; - - }, - kinematics: kinematics, - library: library, - scene: scene - }; - - } - -} - -export { ColladaLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ColorCorrectionShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ColorCorrectionShader.js deleted file mode 100644 index f0ded77..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ColorCorrectionShader.js +++ /dev/null @@ -1,52 +0,0 @@ -import { - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Color correction - */ - -const ColorCorrectionShader = { - - name: 'ColorCorrectionShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'powRGB': { value: new Vector3( 2, 2, 2 ) }, - 'mulRGB': { value: new Vector3( 1, 1, 1 ) }, - 'addRGB': { value: new Vector3( 0, 0, 0 ) } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform vec3 powRGB; - uniform vec3 mulRGB; - uniform vec3 addRGB; - - varying vec2 vUv; - - void main() { - - gl_FragColor = texture2D( tDiffuse, vUv ); - gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB ); - - }` - -}; - -export { ColorCorrectionShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ColorifyShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ColorifyShader.js deleted file mode 100644 index 2fc0566..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ColorifyShader.js +++ /dev/null @@ -1,50 +0,0 @@ -import { - Color -} from '/static/javascript/three/build/three.module.js'; - -/** - * Colorify shader - */ - -const ColorifyShader = { - - name: 'ColorifyShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'color': { value: new Color( 0xffffff ) } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform vec3 color; - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 texel = texture2D( tDiffuse, vUv ); - - float v = luminance( texel.xyz ); - - gl_FragColor = vec4( v * color, texel.w ); - - }` - -}; - -export { ColorifyShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ConvolutionShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ConvolutionShader.js deleted file mode 100644 index 7c7d4b6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ConvolutionShader.js +++ /dev/null @@ -1,103 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Convolution shader - * ported from o3d sample to WebGL / GLSL - */ - -const ConvolutionShader = { - - name: 'ConvolutionShader', - - defines: { - - 'KERNEL_SIZE_FLOAT': '25.0', - 'KERNEL_SIZE_INT': '25' - - }, - - uniforms: { - - 'tDiffuse': { value: null }, - 'uImageIncrement': { value: new Vector2( 0.001953125, 0.0 ) }, - 'cKernel': { value: [] } - - }, - - vertexShader: /* glsl */` - - uniform vec2 uImageIncrement; - - varying vec2 vUv; - - void main() { - - vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float cKernel[ KERNEL_SIZE_INT ]; - - uniform sampler2D tDiffuse; - uniform vec2 uImageIncrement; - - varying vec2 vUv; - - void main() { - - vec2 imageCoord = vUv; - vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 ); - - for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) { - - sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ]; - imageCoord += uImageIncrement; - - } - - gl_FragColor = sum; - - }`, - - buildKernel: function ( sigma ) { - - // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway. - - const kMaxKernelSize = 25; - let kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1; - - if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize; - - const halfWidth = ( kernelSize - 1 ) * 0.5; - - const values = new Array( kernelSize ); - let sum = 0.0; - for ( let i = 0; i < kernelSize; ++ i ) { - - values[ i ] = gauss( i - halfWidth, sigma ); - sum += values[ i ]; - - } - - // normalize the kernel - - for ( let i = 0; i < kernelSize; ++ i ) values[ i ] /= sum; - - return values; - - } - -}; - -function gauss( x, sigma ) { - - return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) ); - -} - -export { ConvolutionShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/CubeTexturePass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/CubeTexturePass.js deleted file mode 100644 index 66da259..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/CubeTexturePass.js +++ /dev/null @@ -1,85 +0,0 @@ -import { - BackSide, - BoxGeometry, - Mesh, - PerspectiveCamera, - Scene, - ShaderLib, - ShaderMaterial, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; -import { Pass } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; - -class CubeTexturePass extends Pass { - - constructor( camera, tCube, opacity = 1 ) { - - super(); - - this.camera = camera; - - this.needsSwap = false; - - this.cubeShader = ShaderLib[ 'cube' ]; - this.cubeMesh = new Mesh( - new BoxGeometry( 10, 10, 10 ), - new ShaderMaterial( { - uniforms: UniformsUtils.clone( this.cubeShader.uniforms ), - vertexShader: this.cubeShader.vertexShader, - fragmentShader: this.cubeShader.fragmentShader, - depthTest: false, - depthWrite: false, - side: BackSide - } ) - ); - - Object.defineProperty( this.cubeMesh.material, 'envMap', { - - get: function () { - - return this.uniforms.tCube.value; - - } - - } ); - - this.tCube = tCube; - this.opacity = opacity; - - this.cubeScene = new Scene(); - this.cubeCamera = new PerspectiveCamera(); - this.cubeScene.add( this.cubeMesh ); - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive*/ ) { - - const oldAutoClear = renderer.autoClear; - renderer.autoClear = false; - - this.cubeCamera.projectionMatrix.copy( this.camera.projectionMatrix ); - this.cubeCamera.quaternion.setFromRotationMatrix( this.camera.matrixWorld ); - - this.cubeMesh.material.uniforms.tCube.value = this.tCube; - this.cubeMesh.material.uniforms.tFlip.value = ( this.tCube.isCubeTexture && this.tCube.isRenderTargetTexture === false ) ? - 1 : 1; - this.cubeMesh.material.uniforms.opacity.value = this.opacity; - this.cubeMesh.material.transparent = ( this.opacity < 1.0 ); - - renderer.setRenderTarget( this.renderToScreen ? null : readBuffer ); - if ( this.clear ) renderer.clear(); - renderer.render( this.cubeScene, this.cubeCamera ); - - renderer.autoClear = oldAutoClear; - - } - - dispose() { - - this.cubeMesh.geometry.dispose(); - this.cubeMesh.material.dispose(); - - } - -} - -export { CubeTexturePass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DDSLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DDSLoader.js deleted file mode 100644 index 656a558..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DDSLoader.js +++ /dev/null @@ -1,318 +0,0 @@ -import { - CompressedTextureLoader, - RGBAFormat, - RGBA_S3TC_DXT3_Format, - RGBA_S3TC_DXT5_Format, - RGB_ETC1_Format, - RGB_S3TC_DXT1_Format, - RGB_BPTC_SIGNED_Format, - RGB_BPTC_UNSIGNED_Format -} from '/static/javascript/three/build/three.module.js'; - -class DDSLoader extends CompressedTextureLoader { - - constructor( manager ) { - - super( manager ); - - } - - parse( buffer, loadMipmaps ) { - - const dds = { mipmaps: [], width: 0, height: 0, format: null, mipmapCount: 1 }; - - // Adapted from @toji's DDS utils - // https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js - - // All values and structures referenced from: - // http://msdn.microsoft.com/en-us/library/bb943991.aspx/ - - const DDS_MAGIC = 0x20534444; - - // const DDSD_CAPS = 0x1; - // const DDSD_HEIGHT = 0x2; - // const DDSD_WIDTH = 0x4; - // const DDSD_PITCH = 0x8; - // const DDSD_PIXELFORMAT = 0x1000; - const DDSD_MIPMAPCOUNT = 0x20000; - // const DDSD_LINEARSIZE = 0x80000; - // const DDSD_DEPTH = 0x800000; - - // const DDSCAPS_COMPLEX = 0x8; - // const DDSCAPS_MIPMAP = 0x400000; - // const DDSCAPS_TEXTURE = 0x1000; - - const DDSCAPS2_CUBEMAP = 0x200; - const DDSCAPS2_CUBEMAP_POSITIVEX = 0x400; - const DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800; - const DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000; - const DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000; - const DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000; - const DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000; - // const DDSCAPS2_VOLUME = 0x200000; - - // const DDPF_ALPHAPIXELS = 0x1; - // const DDPF_ALPHA = 0x2; - // const DDPF_FOURCC = 0x4; - // const DDPF_RGB = 0x40; - // const DDPF_YUV = 0x200; - // const DDPF_LUMINANCE = 0x20000; - - const DXGI_FORMAT_BC6H_UF16 = 95; - const DXGI_FORMAT_BC6H_SF16 = 96; - - function fourCCToInt32( value ) { - - return value.charCodeAt( 0 ) + - ( value.charCodeAt( 1 ) << 8 ) + - ( value.charCodeAt( 2 ) << 16 ) + - ( value.charCodeAt( 3 ) << 24 ); - - } - - function int32ToFourCC( value ) { - - return String.fromCharCode( - value & 0xff, - ( value >> 8 ) & 0xff, - ( value >> 16 ) & 0xff, - ( value >> 24 ) & 0xff - ); - - } - - function loadARGBMip( buffer, dataOffset, width, height ) { - - const dataLength = width * height * 4; - const srcBuffer = new Uint8Array( buffer, dataOffset, dataLength ); - const byteArray = new Uint8Array( dataLength ); - let dst = 0; - let src = 0; - for ( let y = 0; y < height; y ++ ) { - - for ( let x = 0; x < width; x ++ ) { - - const b = srcBuffer[ src ]; src ++; - const g = srcBuffer[ src ]; src ++; - const r = srcBuffer[ src ]; src ++; - const a = srcBuffer[ src ]; src ++; - byteArray[ dst ] = r; dst ++; //r - byteArray[ dst ] = g; dst ++; //g - byteArray[ dst ] = b; dst ++; //b - byteArray[ dst ] = a; dst ++; //a - - } - - } - - return byteArray; - - } - - const FOURCC_DXT1 = fourCCToInt32( 'DXT1' ); - const FOURCC_DXT3 = fourCCToInt32( 'DXT3' ); - const FOURCC_DXT5 = fourCCToInt32( 'DXT5' ); - const FOURCC_ETC1 = fourCCToInt32( 'ETC1' ); - const FOURCC_DX10 = fourCCToInt32( 'DX10' ); - - const headerLengthInt = 31; // The header length in 32 bit ints - const extendedHeaderLengthInt = 5; // The extended header length in 32 bit ints - - // Offsets into the header array - - const off_magic = 0; - - const off_size = 1; - const off_flags = 2; - const off_height = 3; - const off_width = 4; - - const off_mipmapCount = 7; - - // const off_pfFlags = 20; - const off_pfFourCC = 21; - const off_RGBBitCount = 22; - const off_RBitMask = 23; - const off_GBitMask = 24; - const off_BBitMask = 25; - const off_ABitMask = 26; - - // const off_caps = 27; - const off_caps2 = 28; - // const off_caps3 = 29; - // const off_caps4 = 30; - - // If fourCC = DX10, the extended header starts after 32 - const off_dxgiFormat = 0; - - // Parse header - - const header = new Int32Array( buffer, 0, headerLengthInt ); - - if ( header[ off_magic ] !== DDS_MAGIC ) { - - console.error( 'THREE.DDSLoader.parse: Invalid magic number in DDS header.' ); - return dds; - - } - - let blockBytes; - - const fourCC = header[ off_pfFourCC ]; - - let isRGBAUncompressed = false; - - let dataOffset = header[ off_size ] + 4; - - switch ( fourCC ) { - - case FOURCC_DXT1: - - blockBytes = 8; - dds.format = RGB_S3TC_DXT1_Format; - break; - - case FOURCC_DXT3: - - blockBytes = 16; - dds.format = RGBA_S3TC_DXT3_Format; - break; - - case FOURCC_DXT5: - - blockBytes = 16; - dds.format = RGBA_S3TC_DXT5_Format; - break; - - case FOURCC_ETC1: - - blockBytes = 8; - dds.format = RGB_ETC1_Format; - break; - - case FOURCC_DX10: - - dataOffset += extendedHeaderLengthInt * 4; - const extendedHeader = new Int32Array( buffer, ( headerLengthInt + 1 ) * 4, extendedHeaderLengthInt ); - const dxgiFormat = extendedHeader[ off_dxgiFormat ]; - switch ( dxgiFormat ) { - - case DXGI_FORMAT_BC6H_SF16: { - - blockBytes = 16; - dds.format = RGB_BPTC_SIGNED_Format; - break; - - } - - case DXGI_FORMAT_BC6H_UF16: { - - blockBytes = 16; - dds.format = RGB_BPTC_UNSIGNED_Format; - break; - - } - - default: { - - console.error( 'THREE.DDSLoader.parse: Unsupported DXGI_FORMAT code ', dxgiFormat ); - return dds; - - } - - } - - break; - - default: - - if ( header[ off_RGBBitCount ] === 32 - && header[ off_RBitMask ] & 0xff0000 - && header[ off_GBitMask ] & 0xff00 - && header[ off_BBitMask ] & 0xff - && header[ off_ABitMask ] & 0xff000000 ) { - - isRGBAUncompressed = true; - blockBytes = 64; - dds.format = RGBAFormat; - - } else { - - console.error( 'THREE.DDSLoader.parse: Unsupported FourCC code ', int32ToFourCC( fourCC ) ); - return dds; - - } - - } - - dds.mipmapCount = 1; - - if ( header[ off_flags ] & DDSD_MIPMAPCOUNT && loadMipmaps !== false ) { - - dds.mipmapCount = Math.max( 1, header[ off_mipmapCount ] ); - - } - - const caps2 = header[ off_caps2 ]; - dds.isCubemap = caps2 & DDSCAPS2_CUBEMAP ? true : false; - if ( dds.isCubemap && ( - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEX ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEY ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_POSITIVEZ ) || - ! ( caps2 & DDSCAPS2_CUBEMAP_NEGATIVEZ ) - ) ) { - - console.error( 'THREE.DDSLoader.parse: Incomplete cubemap faces' ); - return dds; - - } - - dds.width = header[ off_width ]; - dds.height = header[ off_height ]; - - // Extract mipmaps buffers - - const faces = dds.isCubemap ? 6 : 1; - - for ( let face = 0; face < faces; face ++ ) { - - let width = dds.width; - let height = dds.height; - - for ( let i = 0; i < dds.mipmapCount; i ++ ) { - - let byteArray, dataLength; - - if ( isRGBAUncompressed ) { - - byteArray = loadARGBMip( buffer, dataOffset, width, height ); - dataLength = byteArray.length; - - } else { - - dataLength = Math.max( 4, width ) / 4 * Math.max( 4, height ) / 4 * blockBytes; - byteArray = new Uint8Array( buffer, dataOffset, dataLength ); - - } - - const mipmap = { 'data': byteArray, 'width': width, 'height': height }; - dds.mipmaps.push( mipmap ); - - dataOffset += dataLength; - - width = Math.max( width >> 1, 1 ); - height = Math.max( height >> 1, 1 ); - - } - - } - - return dds; - - } - -} - -export { DDSLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DOFMipMapShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DOFMipMapShader.js deleted file mode 100644 index c0e48df..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DOFMipMapShader.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Depth-of-field shader using mipmaps - * - from Matt Handley @applmak - * - requires power-of-2 sized render target with enabled mipmaps - */ - -const DOFMipMapShader = { - - name: 'DOFMipMapShader', - - uniforms: { - - 'tColor': { value: null }, - 'tDepth': { value: null }, - 'focus': { value: 1.0 }, - 'maxblur': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float focus; - uniform float maxblur; - - uniform sampler2D tColor; - uniform sampler2D tDepth; - - varying vec2 vUv; - - void main() { - - vec4 depth = texture2D( tDepth, vUv ); - - float factor = depth.x - focus; - - vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) ); - - gl_FragColor = col; - gl_FragColor.a = 1.0; - - }` - -}; - -export { DOFMipMapShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DRACOLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DRACOLoader.js deleted file mode 100644 index 238e8e2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DRACOLoader.js +++ /dev/null @@ -1,613 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - FileLoader, - Loader, - LinearSRGBColorSpace, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; - -const _taskCache = new WeakMap(); - -class DRACOLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.decoderPath = ''; - this.decoderConfig = {}; - this.decoderBinary = null; - this.decoderPending = null; - - this.workerLimit = 4; - this.workerPool = []; - this.workerNextTaskID = 1; - this.workerSourceURL = ''; - - this.defaultAttributeIDs = { - position: 'POSITION', - normal: 'NORMAL', - color: 'COLOR', - uv: 'TEX_COORD' - }; - this.defaultAttributeTypes = { - position: 'Float32Array', - normal: 'Float32Array', - color: 'Float32Array', - uv: 'Float32Array' - }; - - } - - setDecoderPath( path ) { - - this.decoderPath = path; - - return this; - - } - - setDecoderConfig( config ) { - - this.decoderConfig = config; - - return this; - - } - - setWorkerLimit( workerLimit ) { - - this.workerLimit = workerLimit; - - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new FileLoader( this.manager ); - - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - - loader.load( url, ( buffer ) => { - - this.parse( buffer, onLoad, onError ); - - }, onProgress, onError ); - - } - - - parse( buffer, onLoad, onError = ()=>{} ) { - - this.decodeDracoFile( buffer, onLoad, null, null, SRGBColorSpace, onError ).catch( onError ); - - } - - decodeDracoFile( buffer, callback, attributeIDs, attributeTypes, vertexColorSpace = LinearSRGBColorSpace, onError = () => {} ) { - - const taskConfig = { - attributeIDs: attributeIDs || this.defaultAttributeIDs, - attributeTypes: attributeTypes || this.defaultAttributeTypes, - useUniqueIDs: !! attributeIDs, - vertexColorSpace: vertexColorSpace, - }; - - return this.decodeGeometry( buffer, taskConfig ).then( callback ).catch( onError ); - - } - - decodeGeometry( buffer, taskConfig ) { - - const taskKey = JSON.stringify( taskConfig ); - - // Check for an existing task using this buffer. A transferred buffer cannot be transferred - // again from this thread. - if ( _taskCache.has( buffer ) ) { - - const cachedTask = _taskCache.get( buffer ); - - if ( cachedTask.key === taskKey ) { - - return cachedTask.promise; - - } else if ( buffer.byteLength === 0 ) { - - // Technically, it would be possible to wait for the previous task to complete, - // transfer the buffer back, and decode again with the second configuration. That - // is complex, and I don't know of any reason to decode a Draco buffer twice in - // different ways, so this is left unimplemented. - throw new Error( - - 'THREE.DRACOLoader: Unable to re-decode a buffer with different ' + - 'settings. Buffer has already been transferred.' - - ); - - } - - } - - // - - let worker; - const taskID = this.workerNextTaskID ++; - const taskCost = buffer.byteLength; - - // Obtain a worker and assign a task, and construct a geometry instance - // when the task completes. - const geometryPending = this._getWorker( taskID, taskCost ) - .then( ( _worker ) => { - - worker = _worker; - - return new Promise( ( resolve, reject ) => { - - worker._callbacks[ taskID ] = { resolve, reject }; - - worker.postMessage( { type: 'decode', id: taskID, taskConfig, buffer }, [ buffer ] ); - - // this.debug(); - - } ); - - } ) - .then( ( message ) => this._createGeometry( message.geometry ) ); - - // Remove task from the task list. - // Note: replaced '.finally()' with '.catch().then()' block - iOS 11 support (#19416) - geometryPending - .catch( () => true ) - .then( () => { - - if ( worker && taskID ) { - - this._releaseTask( worker, taskID ); - - // this.debug(); - - } - - } ); - - // Cache the task result. - _taskCache.set( buffer, { - - key: taskKey, - promise: geometryPending - - } ); - - return geometryPending; - - } - - _createGeometry( geometryData ) { - - const geometry = new BufferGeometry(); - - if ( geometryData.index ) { - - geometry.setIndex( new BufferAttribute( geometryData.index.array, 1 ) ); - - } - - for ( let i = 0; i < geometryData.attributes.length; i ++ ) { - - const result = geometryData.attributes[ i ]; - const name = result.name; - const array = result.array; - const itemSize = result.itemSize; - - const attribute = new BufferAttribute( array, itemSize ); - - if ( name === 'color' ) { - - this._assignVertexColorSpace( attribute, result.vertexColorSpace ); - - attribute.normalized = ( array instanceof Float32Array ) === false; - - } - - geometry.setAttribute( name, attribute ); - - } - - return geometry; - - } - - _assignVertexColorSpace( attribute, inputColorSpace ) { - - // While .drc files do not specify colorspace, the only 'official' tooling - // is PLY and OBJ converters, which use sRGB. We'll assume sRGB when a .drc - // file is passed into .load() or .parse(). GLTFLoader uses internal APIs - // to decode geometry, and vertex colors are already Linear-sRGB in there. - - if ( inputColorSpace !== SRGBColorSpace ) return; - - const _color = new Color(); - - for ( let i = 0, il = attribute.count; i < il; i ++ ) { - - _color.fromBufferAttribute( attribute, i ).convertSRGBToLinear(); - attribute.setXYZ( i, _color.r, _color.g, _color.b ); - - } - - } - - _loadLibrary( url, responseType ) { - - const loader = new FileLoader( this.manager ); - loader.setPath( this.decoderPath ); - loader.setResponseType( responseType ); - loader.setWithCredentials( this.withCredentials ); - - return new Promise( ( resolve, reject ) => { - - loader.load( url, resolve, undefined, reject ); - - } ); - - } - - preload() { - - this._initDecoder(); - - return this; - - } - - _initDecoder() { - - if ( this.decoderPending ) return this.decoderPending; - - const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js'; - const librariesPending = []; - - if ( useJS ) { - - librariesPending.push( this._loadLibrary( 'draco_decoder.js', 'text' ) ); - - } else { - - librariesPending.push( this._loadLibrary( 'draco_wasm_wrapper.js', 'text' ) ); - librariesPending.push( this._loadLibrary( 'draco_decoder.wasm', 'arraybuffer' ) ); - - } - - this.decoderPending = Promise.all( librariesPending ) - .then( ( libraries ) => { - - const jsContent = libraries[ 0 ]; - - if ( ! useJS ) { - - this.decoderConfig.wasmBinary = libraries[ 1 ]; - - } - - const fn = DRACOWorker.toString(); - - const body = [ - '/* draco decoder */', - jsContent, - '', - '/* worker */', - fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) ) - ].join( '\n' ); - - this.workerSourceURL = URL.createObjectURL( new Blob( [ body ] ) ); - - } ); - - return this.decoderPending; - - } - - _getWorker( taskID, taskCost ) { - - return this._initDecoder().then( () => { - - if ( this.workerPool.length < this.workerLimit ) { - - const worker = new Worker( this.workerSourceURL ); - - worker._callbacks = {}; - worker._taskCosts = {}; - worker._taskLoad = 0; - - worker.postMessage( { type: 'init', decoderConfig: this.decoderConfig } ); - - worker.onmessage = function ( e ) { - - const message = e.data; - - switch ( message.type ) { - - case 'decode': - worker._callbacks[ message.id ].resolve( message ); - break; - - case 'error': - worker._callbacks[ message.id ].reject( message ); - break; - - default: - console.error( 'THREE.DRACOLoader: Unexpected message, "' + message.type + '"' ); - - } - - }; - - this.workerPool.push( worker ); - - } else { - - this.workerPool.sort( function ( a, b ) { - - return a._taskLoad > b._taskLoad ? - 1 : 1; - - } ); - - } - - const worker = this.workerPool[ this.workerPool.length - 1 ]; - worker._taskCosts[ taskID ] = taskCost; - worker._taskLoad += taskCost; - return worker; - - } ); - - } - - _releaseTask( worker, taskID ) { - - worker._taskLoad -= worker._taskCosts[ taskID ]; - delete worker._callbacks[ taskID ]; - delete worker._taskCosts[ taskID ]; - - } - - debug() { - - console.log( 'Task load: ', this.workerPool.map( ( worker ) => worker._taskLoad ) ); - - } - - dispose() { - - for ( let i = 0; i < this.workerPool.length; ++ i ) { - - this.workerPool[ i ].terminate(); - - } - - this.workerPool.length = 0; - - if ( this.workerSourceURL !== '' ) { - - URL.revokeObjectURL( this.workerSourceURL ); - - } - - return this; - - } - -} - -/* WEB WORKER */ - -function DRACOWorker() { - - let decoderConfig; - let decoderPending; - - onmessage = function ( e ) { - - const message = e.data; - - switch ( message.type ) { - - case 'init': - decoderConfig = message.decoderConfig; - decoderPending = new Promise( function ( resolve/*, reject*/ ) { - - decoderConfig.onModuleLoaded = function ( draco ) { - - // Module is Promise-like. Wrap before resolving to avoid loop. - resolve( { draco: draco } ); - - }; - - DracoDecoderModule( decoderConfig ); // eslint-disable-line no-undef - - } ); - break; - - case 'decode': - const buffer = message.buffer; - const taskConfig = message.taskConfig; - decoderPending.then( ( module ) => { - - const draco = module.draco; - const decoder = new draco.Decoder(); - - try { - - const geometry = decodeGeometry( draco, decoder, new Int8Array( buffer ), taskConfig ); - - const buffers = geometry.attributes.map( ( attr ) => attr.array.buffer ); - - if ( geometry.index ) buffers.push( geometry.index.array.buffer ); - - self.postMessage( { type: 'decode', id: message.id, geometry }, buffers ); - - } catch ( error ) { - - console.error( error ); - - self.postMessage( { type: 'error', id: message.id, error: error.message } ); - - } finally { - - draco.destroy( decoder ); - - } - - } ); - break; - - } - - }; - - function decodeGeometry( draco, decoder, array, taskConfig ) { - - const attributeIDs = taskConfig.attributeIDs; - const attributeTypes = taskConfig.attributeTypes; - - let dracoGeometry; - let decodingStatus; - - const geometryType = decoder.GetEncodedGeometryType( array ); - - if ( geometryType === draco.TRIANGULAR_MESH ) { - - dracoGeometry = new draco.Mesh(); - decodingStatus = decoder.DecodeArrayToMesh( array, array.byteLength, dracoGeometry ); - - } else if ( geometryType === draco.POINT_CLOUD ) { - - dracoGeometry = new draco.PointCloud(); - decodingStatus = decoder.DecodeArrayToPointCloud( array, array.byteLength, dracoGeometry ); - - } else { - - throw new Error( 'THREE.DRACOLoader: Unexpected geometry type.' ); - - } - - if ( ! decodingStatus.ok() || dracoGeometry.ptr === 0 ) { - - throw new Error( 'THREE.DRACOLoader: Decoding failed: ' + decodingStatus.error_msg() ); - - } - - const geometry = { index: null, attributes: [] }; - - // Gather all vertex attributes. - for ( const attributeName in attributeIDs ) { - - const attributeType = self[ attributeTypes[ attributeName ] ]; - - let attribute; - let attributeID; - - // A Draco file may be created with default vertex attributes, whose attribute IDs - // are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively, - // a Draco file may contain a custom set of attributes, identified by known unique - // IDs. glTF files always do the latter, and `.drc` files typically do the former. - if ( taskConfig.useUniqueIDs ) { - - attributeID = attributeIDs[ attributeName ]; - attribute = decoder.GetAttributeByUniqueId( dracoGeometry, attributeID ); - - } else { - - attributeID = decoder.GetAttributeId( dracoGeometry, draco[ attributeIDs[ attributeName ] ] ); - - if ( attributeID === - 1 ) continue; - - attribute = decoder.GetAttribute( dracoGeometry, attributeID ); - - } - - const attributeResult = decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ); - - if ( attributeName === 'color' ) { - - attributeResult.vertexColorSpace = taskConfig.vertexColorSpace; - - } - - geometry.attributes.push( attributeResult ); - - } - - // Add index. - if ( geometryType === draco.TRIANGULAR_MESH ) { - - geometry.index = decodeIndex( draco, decoder, dracoGeometry ); - - } - - draco.destroy( dracoGeometry ); - - return geometry; - - } - - function decodeIndex( draco, decoder, dracoGeometry ) { - - const numFaces = dracoGeometry.num_faces(); - const numIndices = numFaces * 3; - const byteLength = numIndices * 4; - - const ptr = draco._malloc( byteLength ); - decoder.GetTrianglesUInt32Array( dracoGeometry, byteLength, ptr ); - const index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice(); - draco._free( ptr ); - - return { array: index, itemSize: 1 }; - - } - - function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) { - - const numComponents = attribute.num_components(); - const numPoints = dracoGeometry.num_points(); - const numValues = numPoints * numComponents; - const byteLength = numValues * attributeType.BYTES_PER_ELEMENT; - const dataType = getDracoDataType( draco, attributeType ); - - const ptr = draco._malloc( byteLength ); - decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr ); - const array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice(); - draco._free( ptr ); - - return { - name: attributeName, - array: array, - itemSize: numComponents - }; - - } - - function getDracoDataType( draco, attributeType ) { - - switch ( attributeType ) { - - case Float32Array: return draco.DT_FLOAT32; - case Int8Array: return draco.DT_INT8; - case Int16Array: return draco.DT_INT16; - case Int32Array: return draco.DT_INT32; - case Uint8Array: return draco.DT_UINT8; - case Uint16Array: return draco.DT_UINT16; - case Uint32Array: return draco.DT_UINT32; - - } - - } - -} - -export { DRACOLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DepthLimitedBlurShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DepthLimitedBlurShader.js deleted file mode 100644 index edcd523..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DepthLimitedBlurShader.js +++ /dev/null @@ -1,171 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * TODO - */ - -const DepthLimitedBlurShader = { - - name: 'DepthLimitedBlurShader', - - defines: { - 'KERNEL_RADIUS': 4, - 'DEPTH_PACKING': 1, - 'PERSPECTIVE_CAMERA': 1 - }, - - uniforms: { - 'tDiffuse': { value: null }, - 'size': { value: new Vector2( 512, 512 ) }, - 'sampleUvOffsets': { value: [ new Vector2( 0, 0 ) ] }, - 'sampleWeights': { value: [ 1.0 ] }, - 'tDepth': { value: null }, - 'cameraNear': { value: 10 }, - 'cameraFar': { value: 1000 }, - 'depthCutoff': { value: 10 }, - }, - - vertexShader: /* glsl */` - - #include - - uniform vec2 size; - - varying vec2 vUv; - varying vec2 vInvSize; - - void main() { - vUv = uv; - vInvSize = 1.0 / size; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - - #include - #include - - uniform sampler2D tDiffuse; - uniform sampler2D tDepth; - - uniform float cameraNear; - uniform float cameraFar; - uniform float depthCutoff; - - uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ]; - uniform float sampleWeights[ KERNEL_RADIUS + 1 ]; - - varying vec2 vUv; - varying vec2 vInvSize; - - float getDepth( const in vec2 screenPosition ) { - #if DEPTH_PACKING == 1 - return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) ); - #else - return texture2D( tDepth, screenPosition ).x; - #endif - } - - float getViewZ( const in float depth ) { - #if PERSPECTIVE_CAMERA == 1 - return perspectiveDepthToViewZ( depth, cameraNear, cameraFar ); - #else - return orthographicDepthToViewZ( depth, cameraNear, cameraFar ); - #endif - } - - void main() { - float depth = getDepth( vUv ); - if( depth >= ( 1.0 - EPSILON ) ) { - discard; - } - - float centerViewZ = -getViewZ( depth ); - bool rBreak = false, lBreak = false; - - float weightSum = sampleWeights[0]; - vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum; - - for( int i = 1; i <= KERNEL_RADIUS; i ++ ) { - - float sampleWeight = sampleWeights[i]; - vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize; - - vec2 sampleUv = vUv + sampleUvOffset; - float viewZ = -getViewZ( getDepth( sampleUv ) ); - - if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true; - - if( ! rBreak ) { - diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight; - weightSum += sampleWeight; - } - - sampleUv = vUv - sampleUvOffset; - viewZ = -getViewZ( getDepth( sampleUv ) ); - - if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true; - - if( ! lBreak ) { - diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight; - weightSum += sampleWeight; - } - - } - - gl_FragColor = diffuseSum / weightSum; - }` - -}; - -const BlurShaderUtils = { - - createSampleWeights: function ( kernelRadius, stdDev ) { - - const weights = []; - - for ( let i = 0; i <= kernelRadius; i ++ ) { - - weights.push( gaussian( i, stdDev ) ); - - } - - return weights; - - }, - - createSampleOffsets: function ( kernelRadius, uvIncrement ) { - - const offsets = []; - - for ( let i = 0; i <= kernelRadius; i ++ ) { - - offsets.push( uvIncrement.clone().multiplyScalar( i ) ); - - } - - return offsets; - - }, - - configure: function ( material, kernelRadius, stdDev, uvIncrement ) { - - material.defines[ 'KERNEL_RADIUS' ] = kernelRadius; - material.uniforms[ 'sampleUvOffsets' ].value = BlurShaderUtils.createSampleOffsets( kernelRadius, uvIncrement ); - material.uniforms[ 'sampleWeights' ].value = BlurShaderUtils.createSampleWeights( kernelRadius, stdDev ); - material.needsUpdate = true; - - } - -}; - -function gaussian( x, stdDev ) { - - return Math.exp( - ( x * x ) / ( 2.0 * ( stdDev * stdDev ) ) ) / ( Math.sqrt( 2.0 * Math.PI ) * stdDev ); - -} - -export { DepthLimitedBlurShader, BlurShaderUtils }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DigitalGlitch.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DigitalGlitch.js deleted file mode 100644 index 8e2663f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DigitalGlitch.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * RGB Shift Shader - * Shifts red and blue channels from center in opposite directions - * Ported from http://kriss.cx/tom/2009/05/rgb-shift/ - * by Tom Butterworth / http://kriss.cx/tom/ - * - * amount: shift distance (1 is width of input) - * angle: shift angle in radians - */ - -const DigitalGlitch = { - - uniforms: { - - 'tDiffuse': { value: null }, //diffuse texture - 'tDisp': { value: null }, //displacement texture for digital glitch squares - 'byp': { value: 0 }, //apply the glitch ? - 'amount': { value: 0.08 }, - 'angle': { value: 0.02 }, - 'seed': { value: 0.02 }, - 'seed_x': { value: 0.02 }, //-1,1 - 'seed_y': { value: 0.02 }, //-1,1 - 'distortion_x': { value: 0.5 }, - 'distortion_y': { value: 0.6 }, - 'col_s': { value: 0.05 } - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - - uniform int byp; //should we apply the glitch ? - - uniform sampler2D tDiffuse; - uniform sampler2D tDisp; - - uniform float amount; - uniform float angle; - uniform float seed; - uniform float seed_x; - uniform float seed_y; - uniform float distortion_x; - uniform float distortion_y; - uniform float col_s; - - varying vec2 vUv; - - - float rand(vec2 co){ - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); - } - - void main() { - if(byp<1) { - vec2 p = vUv; - float xs = floor(gl_FragCoord.x / 0.5); - float ys = floor(gl_FragCoord.y / 0.5); - //based on staffantans glitch shader for unity https://github.com/staffantan/unityglitch - float disp = texture2D(tDisp, p*seed*seed).r; - if(p.ydistortion_x-col_s*seed) { - if(seed_x>0.){ - p.y = 1. - (p.y + distortion_y); - } - else { - p.y = distortion_y; - } - } - if(p.xdistortion_y-col_s*seed) { - if(seed_y>0.){ - p.x=distortion_x; - } - else { - p.x = 1. - (p.x + distortion_x); - } - } - p.x+=disp*seed_x*(seed/5.); - p.y+=disp*seed_y*(seed/5.); - //base from RGB shift shader - vec2 offset = amount * vec2( cos(angle), sin(angle)); - vec4 cr = texture2D(tDiffuse, p + offset); - vec4 cga = texture2D(tDiffuse, p); - vec4 cb = texture2D(tDiffuse, p - offset); - gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a); - //add noise - vec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2); - gl_FragColor = gl_FragColor+ snow; - } - else { - gl_FragColor=texture2D (tDiffuse, vUv); - } - }` - -}; - -export { DigitalGlitch }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenPass.js deleted file mode 100644 index 117f5f5..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenPass.js +++ /dev/null @@ -1,65 +0,0 @@ -import { - ShaderMaterial, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { DotScreenShader } from'/static/javascript/three/examples/jsm/shaders/DotScreenShader.js'; - -class DotScreenPass extends Pass { - - constructor( center, angle, scale ) { - - super(); - - const shader = DotScreenShader; - - this.uniforms = UniformsUtils.clone( shader.uniforms ); - - if ( center !== undefined ) this.uniforms[ 'center' ].value.copy( center ); - if ( angle !== undefined ) this.uniforms[ 'angle' ].value = angle; - if ( scale !== undefined ) this.uniforms[ 'scale' ].value = scale; - - this.material = new ShaderMaterial( { - - name: shader.name, - uniforms: this.uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - - } ); - - this.fsQuad = new FullScreenQuad( this.material ); - - } - - render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { - - this.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.uniforms[ 'tSize' ].value.set( readBuffer.width, readBuffer.height ); - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - } - - dispose() { - - this.material.dispose(); - - this.fsQuad.dispose(); - - } - -} - -export { DotScreenPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenShader.js deleted file mode 100644 index 3cb6a02..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/DotScreenShader.js +++ /dev/null @@ -1,70 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Dot screen shader - * based on glfx.js sepia shader - * https://github.com/evanw/glfx.js - */ - -const DotScreenShader = { - - name: 'DotScreenShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'tSize': { value: new Vector2( 256, 256 ) }, - 'center': { value: new Vector2( 0.5, 0.5 ) }, - 'angle': { value: 1.57 }, - 'scale': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform vec2 center; - uniform float angle; - uniform float scale; - uniform vec2 tSize; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - float pattern() { - - float s = sin( angle ), c = cos( angle ); - - vec2 tex = vUv * tSize - center; - vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale; - - return ( sin( point.x ) * sin( point.y ) ) * 4.0; - - } - - void main() { - - vec4 color = texture2D( tDiffuse, vUv ); - - float average = ( color.r + color.g + color.b ) / 3.0; - - gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a ); - - }` - -}; - -export { DotScreenShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/EXRLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/EXRLoader.js deleted file mode 100644 index 3e82fbb..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/EXRLoader.js +++ /dev/null @@ -1,2563 +0,0 @@ -import { - DataTextureLoader, - DataUtils, - FloatType, - HalfFloatType, - NoColorSpace, - LinearFilter, - LinearSRGBColorSpace, - RedFormat, - RGBAFormat -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; - -/** - * OpenEXR loader currently supports uncompressed, ZIP(S), RLE, PIZ and DWA/B compression. - * Supports reading as UnsignedByte, HalfFloat and Float type data texture. - * - * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita - * implementation, so I have preserved their copyright notices. - */ - -// /* -// Copyright (c) 2014 - 2017, Syoyo Fujita -// All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the Syoyo Fujita nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY -// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// */ - -// // TinyEXR contains some OpenEXR code, which is licensed under ------------ - -// /////////////////////////////////////////////////////////////////////////// -// // -// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// // Digital Ltd. LLC -// // -// // All rights reserved. -// // -// // Redistribution and use in source and binary forms, with or without -// // modification, are permitted provided that the following conditions are -// // met: -// // * Redistributions of source code must retain the above copyright -// // notice, this list of conditions and the following disclaimer. -// // * Redistributions in binary form must reproduce the above -// // copyright notice, this list of conditions and the following disclaimer -// // in the documentation and/or other materials provided with the -// // distribution. -// // * Neither the name of Industrial Light & Magic nor the names of -// // its contributors may be used to endorse or promote products derived -// // from this software without specific prior written permission. -// // -// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// // -// /////////////////////////////////////////////////////////////////////////// - -// // End of OpenEXR license ------------------------------------------------- - -class EXRLoader extends DataTextureLoader { - - constructor( manager ) { - - super( manager ); - - this.type = HalfFloatType; - - } - - parse( buffer ) { - - const USHORT_RANGE = ( 1 << 16 ); - const BITMAP_SIZE = ( USHORT_RANGE >> 3 ); - - const HUF_ENCBITS = 16; // literal (value) bit length - const HUF_DECBITS = 14; // decoding bit size (>= 8) - - const HUF_ENCSIZE = ( 1 << HUF_ENCBITS ) + 1; // encoding table size - const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size - const HUF_DECMASK = HUF_DECSIZE - 1; - - const NBITS = 16; - const A_OFFSET = 1 << ( NBITS - 1 ); - const MOD_MASK = ( 1 << NBITS ) - 1; - - const SHORT_ZEROCODE_RUN = 59; - const LONG_ZEROCODE_RUN = 63; - const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN; - - const ULONG_SIZE = 8; - const FLOAT32_SIZE = 4; - const INT32_SIZE = 4; - const INT16_SIZE = 2; - const INT8_SIZE = 1; - - const STATIC_HUFFMAN = 0; - const DEFLATE = 1; - - const UNKNOWN = 0; - const LOSSY_DCT = 1; - const RLE = 2; - - const logBase = Math.pow( 2.7182818, 2.2 ); - - function reverseLutFromBitmap( bitmap, lut ) { - - let k = 0; - - for ( let i = 0; i < USHORT_RANGE; ++ i ) { - - if ( ( i == 0 ) || ( bitmap[ i >> 3 ] & ( 1 << ( i & 7 ) ) ) ) { - - lut[ k ++ ] = i; - - } - - } - - const n = k - 1; - - while ( k < USHORT_RANGE ) lut[ k ++ ] = 0; - - return n; - - } - - function hufClearDecTable( hdec ) { - - for ( let i = 0; i < HUF_DECSIZE; i ++ ) { - - hdec[ i ] = {}; - hdec[ i ].len = 0; - hdec[ i ].lit = 0; - hdec[ i ].p = null; - - } - - } - - const getBitsReturn = { l: 0, c: 0, lc: 0 }; - - function getBits( nBits, c, lc, uInt8Array, inOffset ) { - - while ( lc < nBits ) { - - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; - - } - - lc -= nBits; - - getBitsReturn.l = ( c >> lc ) & ( ( 1 << nBits ) - 1 ); - getBitsReturn.c = c; - getBitsReturn.lc = lc; - - } - - const hufTableBuffer = new Array( 59 ); - - function hufCanonicalCodeTable( hcode ) { - - for ( let i = 0; i <= 58; ++ i ) hufTableBuffer[ i ] = 0; - for ( let i = 0; i < HUF_ENCSIZE; ++ i ) hufTableBuffer[ hcode[ i ] ] += 1; - - let c = 0; - - for ( let i = 58; i > 0; -- i ) { - - const nc = ( ( c + hufTableBuffer[ i ] ) >> 1 ); - hufTableBuffer[ i ] = c; - c = nc; - - } - - for ( let i = 0; i < HUF_ENCSIZE; ++ i ) { - - const l = hcode[ i ]; - if ( l > 0 ) hcode[ i ] = l | ( hufTableBuffer[ l ] ++ << 6 ); - - } - - } - - function hufUnpackEncTable( uInt8Array, inOffset, ni, im, iM, hcode ) { - - const p = inOffset; - let c = 0; - let lc = 0; - - for ( ; im <= iM; im ++ ) { - - if ( p.value - inOffset.value > ni ) return false; - - getBits( 6, c, lc, uInt8Array, p ); - - const l = getBitsReturn.l; - c = getBitsReturn.c; - lc = getBitsReturn.lc; - - hcode[ im ] = l; - - if ( l == LONG_ZEROCODE_RUN ) { - - if ( p.value - inOffset.value > ni ) { - - throw new Error( 'Something wrong with hufUnpackEncTable' ); - - } - - getBits( 8, c, lc, uInt8Array, p ); - - let zerun = getBitsReturn.l + SHORTEST_LONG_RUN; - c = getBitsReturn.c; - lc = getBitsReturn.lc; - - if ( im + zerun > iM + 1 ) { - - throw new Error( 'Something wrong with hufUnpackEncTable' ); - - } - - while ( zerun -- ) hcode[ im ++ ] = 0; - - im --; - - } else if ( l >= SHORT_ZEROCODE_RUN ) { - - let zerun = l - SHORT_ZEROCODE_RUN + 2; - - if ( im + zerun > iM + 1 ) { - - throw new Error( 'Something wrong with hufUnpackEncTable' ); - - } - - while ( zerun -- ) hcode[ im ++ ] = 0; - - im --; - - } - - } - - hufCanonicalCodeTable( hcode ); - - } - - function hufLength( code ) { - - return code & 63; - - } - - function hufCode( code ) { - - return code >> 6; - - } - - function hufBuildDecTable( hcode, im, iM, hdecod ) { - - for ( ; im <= iM; im ++ ) { - - const c = hufCode( hcode[ im ] ); - const l = hufLength( hcode[ im ] ); - - if ( c >> l ) { - - throw new Error( 'Invalid table entry' ); - - } - - if ( l > HUF_DECBITS ) { - - const pl = hdecod[ ( c >> ( l - HUF_DECBITS ) ) ]; - - if ( pl.len ) { - - throw new Error( 'Invalid table entry' ); - - } - - pl.lit ++; - - if ( pl.p ) { - - const p = pl.p; - pl.p = new Array( pl.lit ); - - for ( let i = 0; i < pl.lit - 1; ++ i ) { - - pl.p[ i ] = p[ i ]; - - } - - } else { - - pl.p = new Array( 1 ); - - } - - pl.p[ pl.lit - 1 ] = im; - - } else if ( l ) { - - let plOffset = 0; - - for ( let i = 1 << ( HUF_DECBITS - l ); i > 0; i -- ) { - - const pl = hdecod[ ( c << ( HUF_DECBITS - l ) ) + plOffset ]; - - if ( pl.len || pl.p ) { - - throw new Error( 'Invalid table entry' ); - - } - - pl.len = l; - pl.lit = im; - - plOffset ++; - - } - - } - - } - - return true; - - } - - const getCharReturn = { c: 0, lc: 0 }; - - function getChar( c, lc, uInt8Array, inOffset ) { - - c = ( c << 8 ) | parseUint8Array( uInt8Array, inOffset ); - lc += 8; - - getCharReturn.c = c; - getCharReturn.lc = lc; - - } - - const getCodeReturn = { c: 0, lc: 0 }; - - function getCode( po, rlc, c, lc, uInt8Array, inOffset, outBuffer, outBufferOffset, outBufferEndOffset ) { - - if ( po == rlc ) { - - if ( lc < 8 ) { - - getChar( c, lc, uInt8Array, inOffset ); - c = getCharReturn.c; - lc = getCharReturn.lc; - - } - - lc -= 8; - - let cs = ( c >> lc ); - cs = new Uint8Array( [ cs ] )[ 0 ]; - - if ( outBufferOffset.value + cs > outBufferEndOffset ) { - - return false; - - } - - const s = outBuffer[ outBufferOffset.value - 1 ]; - - while ( cs -- > 0 ) { - - outBuffer[ outBufferOffset.value ++ ] = s; - - } - - } else if ( outBufferOffset.value < outBufferEndOffset ) { - - outBuffer[ outBufferOffset.value ++ ] = po; - - } else { - - return false; - - } - - getCodeReturn.c = c; - getCodeReturn.lc = lc; - - } - - function UInt16( value ) { - - return ( value & 0xFFFF ); - - } - - function Int16( value ) { - - const ref = UInt16( value ); - return ( ref > 0x7FFF ) ? ref - 0x10000 : ref; - - } - - const wdec14Return = { a: 0, b: 0 }; - - function wdec14( l, h ) { - - const ls = Int16( l ); - const hs = Int16( h ); - - const hi = hs; - const ai = ls + ( hi & 1 ) + ( hi >> 1 ); - - const as = ai; - const bs = ai - hi; - - wdec14Return.a = as; - wdec14Return.b = bs; - - } - - function wdec16( l, h ) { - - const m = UInt16( l ); - const d = UInt16( h ); - - const bb = ( m - ( d >> 1 ) ) & MOD_MASK; - const aa = ( d + bb - A_OFFSET ) & MOD_MASK; - - wdec14Return.a = aa; - wdec14Return.b = bb; - - } - - function wav2Decode( buffer, j, nx, ox, ny, oy, mx ) { - - const w14 = mx < ( 1 << 14 ); - const n = ( nx > ny ) ? ny : nx; - let p = 1; - let p2; - let py; - - while ( p <= n ) p <<= 1; - - p >>= 1; - p2 = p; - p >>= 1; - - while ( p >= 1 ) { - - py = 0; - const ey = py + oy * ( ny - p2 ); - const oy1 = oy * p; - const oy2 = oy * p2; - const ox1 = ox * p; - const ox2 = ox * p2; - let i00, i01, i10, i11; - - for ( ; py <= ey; py += oy2 ) { - - let px = py; - const ex = py + ox * ( nx - p2 ); - - for ( ; px <= ex; px += ox2 ) { - - const p01 = px + ox1; - const p10 = px + oy1; - const p11 = p10 + ox1; - - if ( w14 ) { - - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - - i00 = wdec14Return.a; - i10 = wdec14Return.b; - - wdec14( buffer[ p01 + j ], buffer[ p11 + j ] ); - - i01 = wdec14Return.a; - i11 = wdec14Return.b; - - wdec14( i00, i01 ); - - buffer[ px + j ] = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; - - wdec14( i10, i11 ); - - buffer[ p10 + j ] = wdec14Return.a; - buffer[ p11 + j ] = wdec14Return.b; - - } else { - - wdec16( buffer[ px + j ], buffer[ p10 + j ] ); - - i00 = wdec14Return.a; - i10 = wdec14Return.b; - - wdec16( buffer[ p01 + j ], buffer[ p11 + j ] ); - - i01 = wdec14Return.a; - i11 = wdec14Return.b; - - wdec16( i00, i01 ); - - buffer[ px + j ] = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; - - wdec16( i10, i11 ); - - buffer[ p10 + j ] = wdec14Return.a; - buffer[ p11 + j ] = wdec14Return.b; - - - } - - } - - if ( nx & p ) { - - const p10 = px + oy1; - - if ( w14 ) - wdec14( buffer[ px + j ], buffer[ p10 + j ] ); - else - wdec16( buffer[ px + j ], buffer[ p10 + j ] ); - - i00 = wdec14Return.a; - buffer[ p10 + j ] = wdec14Return.b; - - buffer[ px + j ] = i00; - - } - - } - - if ( ny & p ) { - - let px = py; - const ex = py + ox * ( nx - p2 ); - - for ( ; px <= ex; px += ox2 ) { - - const p01 = px + ox1; - - if ( w14 ) - wdec14( buffer[ px + j ], buffer[ p01 + j ] ); - else - wdec16( buffer[ px + j ], buffer[ p01 + j ] ); - - i00 = wdec14Return.a; - buffer[ p01 + j ] = wdec14Return.b; - - buffer[ px + j ] = i00; - - } - - } - - p2 = p; - p >>= 1; - - } - - return py; - - } - - function hufDecode( encodingTable, decodingTable, uInt8Array, inOffset, ni, rlc, no, outBuffer, outOffset ) { - - let c = 0; - let lc = 0; - const outBufferEndOffset = no; - const inOffsetEnd = Math.trunc( inOffset.value + ( ni + 7 ) / 8 ); - - while ( inOffset.value < inOffsetEnd ) { - - getChar( c, lc, uInt8Array, inOffset ); - - c = getCharReturn.c; - lc = getCharReturn.lc; - - while ( lc >= HUF_DECBITS ) { - - const index = ( c >> ( lc - HUF_DECBITS ) ) & HUF_DECMASK; - const pl = decodingTable[ index ]; - - if ( pl.len ) { - - lc -= pl.len; - - getCode( pl.lit, rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset ); - - c = getCodeReturn.c; - lc = getCodeReturn.lc; - - } else { - - if ( ! pl.p ) { - - throw new Error( 'hufDecode issues' ); - - } - - let j; - - for ( j = 0; j < pl.lit; j ++ ) { - - const l = hufLength( encodingTable[ pl.p[ j ] ] ); - - while ( lc < l && inOffset.value < inOffsetEnd ) { - - getChar( c, lc, uInt8Array, inOffset ); - - c = getCharReturn.c; - lc = getCharReturn.lc; - - } - - if ( lc >= l ) { - - if ( hufCode( encodingTable[ pl.p[ j ] ] ) == ( ( c >> ( lc - l ) ) & ( ( 1 << l ) - 1 ) ) ) { - - lc -= l; - - getCode( pl.p[ j ], rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset ); - - c = getCodeReturn.c; - lc = getCodeReturn.lc; - - break; - - } - - } - - } - - if ( j == pl.lit ) { - - throw new Error( 'hufDecode issues' ); - - } - - } - - } - - } - - const i = ( 8 - ni ) & 7; - - c >>= i; - lc -= i; - - while ( lc > 0 ) { - - const pl = decodingTable[ ( c << ( HUF_DECBITS - lc ) ) & HUF_DECMASK ]; - - if ( pl.len ) { - - lc -= pl.len; - - getCode( pl.lit, rlc, c, lc, uInt8Array, inOffset, outBuffer, outOffset, outBufferEndOffset ); - - c = getCodeReturn.c; - lc = getCodeReturn.lc; - - } else { - - throw new Error( 'hufDecode issues' ); - - } - - } - - return true; - - } - - function hufUncompress( uInt8Array, inDataView, inOffset, nCompressed, outBuffer, nRaw ) { - - const outOffset = { value: 0 }; - const initialInOffset = inOffset.value; - - const im = parseUint32( inDataView, inOffset ); - const iM = parseUint32( inDataView, inOffset ); - - inOffset.value += 4; - - const nBits = parseUint32( inDataView, inOffset ); - - inOffset.value += 4; - - if ( im < 0 || im >= HUF_ENCSIZE || iM < 0 || iM >= HUF_ENCSIZE ) { - - throw new Error( 'Something wrong with HUF_ENCSIZE' ); - - } - - const freq = new Array( HUF_ENCSIZE ); - const hdec = new Array( HUF_DECSIZE ); - - hufClearDecTable( hdec ); - - const ni = nCompressed - ( inOffset.value - initialInOffset ); - - hufUnpackEncTable( uInt8Array, inOffset, ni, im, iM, freq ); - - if ( nBits > 8 * ( nCompressed - ( inOffset.value - initialInOffset ) ) ) { - - throw new Error( 'Something wrong with hufUncompress' ); - - } - - hufBuildDecTable( freq, im, iM, hdec ); - - hufDecode( freq, hdec, uInt8Array, inOffset, nBits, iM, nRaw, outBuffer, outOffset ); - - } - - function applyLut( lut, data, nData ) { - - for ( let i = 0; i < nData; ++ i ) { - - data[ i ] = lut[ data[ i ] ]; - - } - - } - - function predictor( source ) { - - for ( let t = 1; t < source.length; t ++ ) { - - const d = source[ t - 1 ] + source[ t ] - 128; - source[ t ] = d; - - } - - } - - function interleaveScalar( source, out ) { - - let t1 = 0; - let t2 = Math.floor( ( source.length + 1 ) / 2 ); - let s = 0; - const stop = source.length - 1; - - while ( true ) { - - if ( s > stop ) break; - out[ s ++ ] = source[ t1 ++ ]; - - if ( s > stop ) break; - out[ s ++ ] = source[ t2 ++ ]; - - } - - } - - function decodeRunLength( source ) { - - let size = source.byteLength; - const out = new Array(); - let p = 0; - - const reader = new DataView( source ); - - while ( size > 0 ) { - - const l = reader.getInt8( p ++ ); - - if ( l < 0 ) { - - const count = - l; - size -= count + 1; - - for ( let i = 0; i < count; i ++ ) { - - out.push( reader.getUint8( p ++ ) ); - - } - - - } else { - - const count = l; - size -= 2; - - const value = reader.getUint8( p ++ ); - - for ( let i = 0; i < count + 1; i ++ ) { - - out.push( value ); - - } - - } - - } - - return out; - - } - - function lossyDctDecode( cscSet, rowPtrs, channelData, acBuffer, dcBuffer, outBuffer ) { - - let dataView = new DataView( outBuffer.buffer ); - - const width = channelData[ cscSet.idx[ 0 ] ].width; - const height = channelData[ cscSet.idx[ 0 ] ].height; - - const numComp = 3; - - const numFullBlocksX = Math.floor( width / 8.0 ); - const numBlocksX = Math.ceil( width / 8.0 ); - const numBlocksY = Math.ceil( height / 8.0 ); - const leftoverX = width - ( numBlocksX - 1 ) * 8; - const leftoverY = height - ( numBlocksY - 1 ) * 8; - - const currAcComp = { value: 0 }; - const currDcComp = new Array( numComp ); - const dctData = new Array( numComp ); - const halfZigBlock = new Array( numComp ); - const rowBlock = new Array( numComp ); - const rowOffsets = new Array( numComp ); - - for ( let comp = 0; comp < numComp; ++ comp ) { - - rowOffsets[ comp ] = rowPtrs[ cscSet.idx[ comp ] ]; - currDcComp[ comp ] = ( comp < 1 ) ? 0 : currDcComp[ comp - 1 ] + numBlocksX * numBlocksY; - dctData[ comp ] = new Float32Array( 64 ); - halfZigBlock[ comp ] = new Uint16Array( 64 ); - rowBlock[ comp ] = new Uint16Array( numBlocksX * 64 ); - - } - - for ( let blocky = 0; blocky < numBlocksY; ++ blocky ) { - - let maxY = 8; - - if ( blocky == numBlocksY - 1 ) - maxY = leftoverY; - - let maxX = 8; - - for ( let blockx = 0; blockx < numBlocksX; ++ blockx ) { - - if ( blockx == numBlocksX - 1 ) - maxX = leftoverX; - - for ( let comp = 0; comp < numComp; ++ comp ) { - - halfZigBlock[ comp ].fill( 0 ); - - // set block DC component - halfZigBlock[ comp ][ 0 ] = dcBuffer[ currDcComp[ comp ] ++ ]; - // set block AC components - unRleAC( currAcComp, acBuffer, halfZigBlock[ comp ] ); - - // UnZigZag block to float - unZigZag( halfZigBlock[ comp ], dctData[ comp ] ); - // decode float dct - dctInverse( dctData[ comp ] ); - - } - - if ( numComp == 3 ) { - - csc709Inverse( dctData ); - - } - - for ( let comp = 0; comp < numComp; ++ comp ) { - - convertToHalf( dctData[ comp ], rowBlock[ comp ], blockx * 64 ); - - } - - } // blockx - - let offset = 0; - - for ( let comp = 0; comp < numComp; ++ comp ) { - - const type = channelData[ cscSet.idx[ comp ] ].type; - - for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) { - - offset = rowOffsets[ comp ][ y ]; - - for ( let blockx = 0; blockx < numFullBlocksX; ++ blockx ) { - - const src = blockx * 64 + ( ( y & 0x7 ) * 8 ); - - dataView.setUint16( offset + 0 * INT16_SIZE * type, rowBlock[ comp ][ src + 0 ], true ); - dataView.setUint16( offset + 1 * INT16_SIZE * type, rowBlock[ comp ][ src + 1 ], true ); - dataView.setUint16( offset + 2 * INT16_SIZE * type, rowBlock[ comp ][ src + 2 ], true ); - dataView.setUint16( offset + 3 * INT16_SIZE * type, rowBlock[ comp ][ src + 3 ], true ); - - dataView.setUint16( offset + 4 * INT16_SIZE * type, rowBlock[ comp ][ src + 4 ], true ); - dataView.setUint16( offset + 5 * INT16_SIZE * type, rowBlock[ comp ][ src + 5 ], true ); - dataView.setUint16( offset + 6 * INT16_SIZE * type, rowBlock[ comp ][ src + 6 ], true ); - dataView.setUint16( offset + 7 * INT16_SIZE * type, rowBlock[ comp ][ src + 7 ], true ); - - offset += 8 * INT16_SIZE * type; - - } - - } - - // handle partial X blocks - if ( numFullBlocksX != numBlocksX ) { - - for ( let y = 8 * blocky; y < 8 * blocky + maxY; ++ y ) { - - const offset = rowOffsets[ comp ][ y ] + 8 * numFullBlocksX * INT16_SIZE * type; - const src = numFullBlocksX * 64 + ( ( y & 0x7 ) * 8 ); - - for ( let x = 0; x < maxX; ++ x ) { - - dataView.setUint16( offset + x * INT16_SIZE * type, rowBlock[ comp ][ src + x ], true ); - - } - - } - - } - - } // comp - - } // blocky - - const halfRow = new Uint16Array( width ); - dataView = new DataView( outBuffer.buffer ); - - // convert channels back to float, if needed - for ( let comp = 0; comp < numComp; ++ comp ) { - - channelData[ cscSet.idx[ comp ] ].decoded = true; - const type = channelData[ cscSet.idx[ comp ] ].type; - - if ( channelData[ comp ].type != 2 ) continue; - - for ( let y = 0; y < height; ++ y ) { - - const offset = rowOffsets[ comp ][ y ]; - - for ( let x = 0; x < width; ++ x ) { - - halfRow[ x ] = dataView.getUint16( offset + x * INT16_SIZE * type, true ); - - } - - for ( let x = 0; x < width; ++ x ) { - - dataView.setFloat32( offset + x * INT16_SIZE * type, decodeFloat16( halfRow[ x ] ), true ); - - } - - } - - } - - } - - function unRleAC( currAcComp, acBuffer, halfZigBlock ) { - - let acValue; - let dctComp = 1; - - while ( dctComp < 64 ) { - - acValue = acBuffer[ currAcComp.value ]; - - if ( acValue == 0xff00 ) { - - dctComp = 64; - - } else if ( acValue >> 8 == 0xff ) { - - dctComp += acValue & 0xff; - - } else { - - halfZigBlock[ dctComp ] = acValue; - dctComp ++; - - } - - currAcComp.value ++; - - } - - } - - function unZigZag( src, dst ) { - - dst[ 0 ] = decodeFloat16( src[ 0 ] ); - dst[ 1 ] = decodeFloat16( src[ 1 ] ); - dst[ 2 ] = decodeFloat16( src[ 5 ] ); - dst[ 3 ] = decodeFloat16( src[ 6 ] ); - dst[ 4 ] = decodeFloat16( src[ 14 ] ); - dst[ 5 ] = decodeFloat16( src[ 15 ] ); - dst[ 6 ] = decodeFloat16( src[ 27 ] ); - dst[ 7 ] = decodeFloat16( src[ 28 ] ); - dst[ 8 ] = decodeFloat16( src[ 2 ] ); - dst[ 9 ] = decodeFloat16( src[ 4 ] ); - - dst[ 10 ] = decodeFloat16( src[ 7 ] ); - dst[ 11 ] = decodeFloat16( src[ 13 ] ); - dst[ 12 ] = decodeFloat16( src[ 16 ] ); - dst[ 13 ] = decodeFloat16( src[ 26 ] ); - dst[ 14 ] = decodeFloat16( src[ 29 ] ); - dst[ 15 ] = decodeFloat16( src[ 42 ] ); - dst[ 16 ] = decodeFloat16( src[ 3 ] ); - dst[ 17 ] = decodeFloat16( src[ 8 ] ); - dst[ 18 ] = decodeFloat16( src[ 12 ] ); - dst[ 19 ] = decodeFloat16( src[ 17 ] ); - - dst[ 20 ] = decodeFloat16( src[ 25 ] ); - dst[ 21 ] = decodeFloat16( src[ 30 ] ); - dst[ 22 ] = decodeFloat16( src[ 41 ] ); - dst[ 23 ] = decodeFloat16( src[ 43 ] ); - dst[ 24 ] = decodeFloat16( src[ 9 ] ); - dst[ 25 ] = decodeFloat16( src[ 11 ] ); - dst[ 26 ] = decodeFloat16( src[ 18 ] ); - dst[ 27 ] = decodeFloat16( src[ 24 ] ); - dst[ 28 ] = decodeFloat16( src[ 31 ] ); - dst[ 29 ] = decodeFloat16( src[ 40 ] ); - - dst[ 30 ] = decodeFloat16( src[ 44 ] ); - dst[ 31 ] = decodeFloat16( src[ 53 ] ); - dst[ 32 ] = decodeFloat16( src[ 10 ] ); - dst[ 33 ] = decodeFloat16( src[ 19 ] ); - dst[ 34 ] = decodeFloat16( src[ 23 ] ); - dst[ 35 ] = decodeFloat16( src[ 32 ] ); - dst[ 36 ] = decodeFloat16( src[ 39 ] ); - dst[ 37 ] = decodeFloat16( src[ 45 ] ); - dst[ 38 ] = decodeFloat16( src[ 52 ] ); - dst[ 39 ] = decodeFloat16( src[ 54 ] ); - - dst[ 40 ] = decodeFloat16( src[ 20 ] ); - dst[ 41 ] = decodeFloat16( src[ 22 ] ); - dst[ 42 ] = decodeFloat16( src[ 33 ] ); - dst[ 43 ] = decodeFloat16( src[ 38 ] ); - dst[ 44 ] = decodeFloat16( src[ 46 ] ); - dst[ 45 ] = decodeFloat16( src[ 51 ] ); - dst[ 46 ] = decodeFloat16( src[ 55 ] ); - dst[ 47 ] = decodeFloat16( src[ 60 ] ); - dst[ 48 ] = decodeFloat16( src[ 21 ] ); - dst[ 49 ] = decodeFloat16( src[ 34 ] ); - - dst[ 50 ] = decodeFloat16( src[ 37 ] ); - dst[ 51 ] = decodeFloat16( src[ 47 ] ); - dst[ 52 ] = decodeFloat16( src[ 50 ] ); - dst[ 53 ] = decodeFloat16( src[ 56 ] ); - dst[ 54 ] = decodeFloat16( src[ 59 ] ); - dst[ 55 ] = decodeFloat16( src[ 61 ] ); - dst[ 56 ] = decodeFloat16( src[ 35 ] ); - dst[ 57 ] = decodeFloat16( src[ 36 ] ); - dst[ 58 ] = decodeFloat16( src[ 48 ] ); - dst[ 59 ] = decodeFloat16( src[ 49 ] ); - - dst[ 60 ] = decodeFloat16( src[ 57 ] ); - dst[ 61 ] = decodeFloat16( src[ 58 ] ); - dst[ 62 ] = decodeFloat16( src[ 62 ] ); - dst[ 63 ] = decodeFloat16( src[ 63 ] ); - - } - - function dctInverse( data ) { - - const a = 0.5 * Math.cos( 3.14159 / 4.0 ); - const b = 0.5 * Math.cos( 3.14159 / 16.0 ); - const c = 0.5 * Math.cos( 3.14159 / 8.0 ); - const d = 0.5 * Math.cos( 3.0 * 3.14159 / 16.0 ); - const e = 0.5 * Math.cos( 5.0 * 3.14159 / 16.0 ); - const f = 0.5 * Math.cos( 3.0 * 3.14159 / 8.0 ); - const g = 0.5 * Math.cos( 7.0 * 3.14159 / 16.0 ); - - const alpha = new Array( 4 ); - const beta = new Array( 4 ); - const theta = new Array( 4 ); - const gamma = new Array( 4 ); - - for ( let row = 0; row < 8; ++ row ) { - - const rowPtr = row * 8; - - alpha[ 0 ] = c * data[ rowPtr + 2 ]; - alpha[ 1 ] = f * data[ rowPtr + 2 ]; - alpha[ 2 ] = c * data[ rowPtr + 6 ]; - alpha[ 3 ] = f * data[ rowPtr + 6 ]; - - beta[ 0 ] = b * data[ rowPtr + 1 ] + d * data[ rowPtr + 3 ] + e * data[ rowPtr + 5 ] + g * data[ rowPtr + 7 ]; - beta[ 1 ] = d * data[ rowPtr + 1 ] - g * data[ rowPtr + 3 ] - b * data[ rowPtr + 5 ] - e * data[ rowPtr + 7 ]; - beta[ 2 ] = e * data[ rowPtr + 1 ] - b * data[ rowPtr + 3 ] + g * data[ rowPtr + 5 ] + d * data[ rowPtr + 7 ]; - beta[ 3 ] = g * data[ rowPtr + 1 ] - e * data[ rowPtr + 3 ] + d * data[ rowPtr + 5 ] - b * data[ rowPtr + 7 ]; - - theta[ 0 ] = a * ( data[ rowPtr + 0 ] + data[ rowPtr + 4 ] ); - theta[ 3 ] = a * ( data[ rowPtr + 0 ] - data[ rowPtr + 4 ] ); - theta[ 1 ] = alpha[ 0 ] + alpha[ 3 ]; - theta[ 2 ] = alpha[ 1 ] - alpha[ 2 ]; - - gamma[ 0 ] = theta[ 0 ] + theta[ 1 ]; - gamma[ 1 ] = theta[ 3 ] + theta[ 2 ]; - gamma[ 2 ] = theta[ 3 ] - theta[ 2 ]; - gamma[ 3 ] = theta[ 0 ] - theta[ 1 ]; - - data[ rowPtr + 0 ] = gamma[ 0 ] + beta[ 0 ]; - data[ rowPtr + 1 ] = gamma[ 1 ] + beta[ 1 ]; - data[ rowPtr + 2 ] = gamma[ 2 ] + beta[ 2 ]; - data[ rowPtr + 3 ] = gamma[ 3 ] + beta[ 3 ]; - - data[ rowPtr + 4 ] = gamma[ 3 ] - beta[ 3 ]; - data[ rowPtr + 5 ] = gamma[ 2 ] - beta[ 2 ]; - data[ rowPtr + 6 ] = gamma[ 1 ] - beta[ 1 ]; - data[ rowPtr + 7 ] = gamma[ 0 ] - beta[ 0 ]; - - } - - for ( let column = 0; column < 8; ++ column ) { - - alpha[ 0 ] = c * data[ 16 + column ]; - alpha[ 1 ] = f * data[ 16 + column ]; - alpha[ 2 ] = c * data[ 48 + column ]; - alpha[ 3 ] = f * data[ 48 + column ]; - - beta[ 0 ] = b * data[ 8 + column ] + d * data[ 24 + column ] + e * data[ 40 + column ] + g * data[ 56 + column ]; - beta[ 1 ] = d * data[ 8 + column ] - g * data[ 24 + column ] - b * data[ 40 + column ] - e * data[ 56 + column ]; - beta[ 2 ] = e * data[ 8 + column ] - b * data[ 24 + column ] + g * data[ 40 + column ] + d * data[ 56 + column ]; - beta[ 3 ] = g * data[ 8 + column ] - e * data[ 24 + column ] + d * data[ 40 + column ] - b * data[ 56 + column ]; - - theta[ 0 ] = a * ( data[ column ] + data[ 32 + column ] ); - theta[ 3 ] = a * ( data[ column ] - data[ 32 + column ] ); - - theta[ 1 ] = alpha[ 0 ] + alpha[ 3 ]; - theta[ 2 ] = alpha[ 1 ] - alpha[ 2 ]; - - gamma[ 0 ] = theta[ 0 ] + theta[ 1 ]; - gamma[ 1 ] = theta[ 3 ] + theta[ 2 ]; - gamma[ 2 ] = theta[ 3 ] - theta[ 2 ]; - gamma[ 3 ] = theta[ 0 ] - theta[ 1 ]; - - data[ 0 + column ] = gamma[ 0 ] + beta[ 0 ]; - data[ 8 + column ] = gamma[ 1 ] + beta[ 1 ]; - data[ 16 + column ] = gamma[ 2 ] + beta[ 2 ]; - data[ 24 + column ] = gamma[ 3 ] + beta[ 3 ]; - - data[ 32 + column ] = gamma[ 3 ] - beta[ 3 ]; - data[ 40 + column ] = gamma[ 2 ] - beta[ 2 ]; - data[ 48 + column ] = gamma[ 1 ] - beta[ 1 ]; - data[ 56 + column ] = gamma[ 0 ] - beta[ 0 ]; - - } - - } - - function csc709Inverse( data ) { - - for ( let i = 0; i < 64; ++ i ) { - - const y = data[ 0 ][ i ]; - const cb = data[ 1 ][ i ]; - const cr = data[ 2 ][ i ]; - - data[ 0 ][ i ] = y + 1.5747 * cr; - data[ 1 ][ i ] = y - 0.1873 * cb - 0.4682 * cr; - data[ 2 ][ i ] = y + 1.8556 * cb; - - } - - } - - function convertToHalf( src, dst, idx ) { - - for ( let i = 0; i < 64; ++ i ) { - - dst[ idx + i ] = DataUtils.toHalfFloat( toLinear( src[ i ] ) ); - - } - - } - - function toLinear( float ) { - - if ( float <= 1 ) { - - return Math.sign( float ) * Math.pow( Math.abs( float ), 2.2 ); - - } else { - - return Math.sign( float ) * Math.pow( logBase, Math.abs( float ) - 1.0 ); - - } - - } - - function uncompressRAW( info ) { - - return new DataView( info.array.buffer, info.offset.value, info.size ); - - } - - function uncompressRLE( info ) { - - const compressed = info.viewer.buffer.slice( info.offset.value, info.offset.value + info.size ); - - const rawBuffer = new Uint8Array( decodeRunLength( compressed ) ); - const tmpBuffer = new Uint8Array( rawBuffer.length ); - - predictor( rawBuffer ); // revert predictor - - interleaveScalar( rawBuffer, tmpBuffer ); // interleave pixels - - return new DataView( tmpBuffer.buffer ); - - } - - function uncompressZIP( info ) { - - const compressed = info.array.slice( info.offset.value, info.offset.value + info.size ); - - const rawBuffer = fflate.unzlibSync( compressed ); - const tmpBuffer = new Uint8Array( rawBuffer.length ); - - predictor( rawBuffer ); // revert predictor - - interleaveScalar( rawBuffer, tmpBuffer ); // interleave pixels - - return new DataView( tmpBuffer.buffer ); - - } - - function uncompressPIZ( info ) { - - const inDataView = info.viewer; - const inOffset = { value: info.offset.value }; - - const outBuffer = new Uint16Array( info.columns * info.lines * ( info.inputChannels.length * info.type ) ); - const bitmap = new Uint8Array( BITMAP_SIZE ); - - // Setup channel info - let outBufferEnd = 0; - const pizChannelData = new Array( info.inputChannels.length ); - for ( let i = 0, il = info.inputChannels.length; i < il; i ++ ) { - - pizChannelData[ i ] = {}; - pizChannelData[ i ][ 'start' ] = outBufferEnd; - pizChannelData[ i ][ 'end' ] = pizChannelData[ i ][ 'start' ]; - pizChannelData[ i ][ 'nx' ] = info.columns; - pizChannelData[ i ][ 'ny' ] = info.lines; - pizChannelData[ i ][ 'size' ] = info.type; - - outBufferEnd += pizChannelData[ i ].nx * pizChannelData[ i ].ny * pizChannelData[ i ].size; - - } - - // Read range compression data - - const minNonZero = parseUint16( inDataView, inOffset ); - const maxNonZero = parseUint16( inDataView, inOffset ); - - if ( maxNonZero >= BITMAP_SIZE ) { - - throw new Error( 'Something is wrong with PIZ_COMPRESSION BITMAP_SIZE' ); - - } - - if ( minNonZero <= maxNonZero ) { - - for ( let i = 0; i < maxNonZero - minNonZero + 1; i ++ ) { - - bitmap[ i + minNonZero ] = parseUint8( inDataView, inOffset ); - - } - - } - - // Reverse LUT - const lut = new Uint16Array( USHORT_RANGE ); - const maxValue = reverseLutFromBitmap( bitmap, lut ); - - const length = parseUint32( inDataView, inOffset ); - - // Huffman decoding - hufUncompress( info.array, inDataView, inOffset, length, outBuffer, outBufferEnd ); - - // Wavelet decoding - for ( let i = 0; i < info.inputChannels.length; ++ i ) { - - const cd = pizChannelData[ i ]; - - for ( let j = 0; j < pizChannelData[ i ].size; ++ j ) { - - wav2Decode( - outBuffer, - cd.start + j, - cd.nx, - cd.size, - cd.ny, - cd.nx * cd.size, - maxValue - ); - - } - - } - - // Expand the pixel data to their original range - applyLut( lut, outBuffer, outBufferEnd ); - - // Rearrange the pixel data into the format expected by the caller. - let tmpOffset = 0; - const tmpBuffer = new Uint8Array( outBuffer.buffer.byteLength ); - for ( let y = 0; y < info.lines; y ++ ) { - - for ( let c = 0; c < info.inputChannels.length; c ++ ) { - - const cd = pizChannelData[ c ]; - - const n = cd.nx * cd.size; - const cp = new Uint8Array( outBuffer.buffer, cd.end * INT16_SIZE, n * INT16_SIZE ); - - tmpBuffer.set( cp, tmpOffset ); - tmpOffset += n * INT16_SIZE; - cd.end += n; - - } - - } - - return new DataView( tmpBuffer.buffer ); - - } - - function uncompressPXR( info ) { - - const compressed = info.array.slice( info.offset.value, info.offset.value + info.size ); - - const rawBuffer = fflate.unzlibSync( compressed ); - - const byteSize = info.inputChannels.length * info.lines * info.columns * info.totalBytes; - const tmpBuffer = new ArrayBuffer( byteSize ); - const viewer = new DataView( tmpBuffer ); - - let tmpBufferEnd = 0; - let writePtr = 0; - const ptr = new Array( 4 ); - - for ( let y = 0; y < info.lines; y ++ ) { - - for ( let c = 0; c < info.inputChannels.length; c ++ ) { - - let pixel = 0; - - const type = info.inputChannels[ c ].pixelType; - switch ( type ) { - - case 1: - - ptr[ 0 ] = tmpBufferEnd; - ptr[ 1 ] = ptr[ 0 ] + info.columns; - tmpBufferEnd = ptr[ 1 ] + info.columns; - - for ( let j = 0; j < info.columns; ++ j ) { - - const diff = ( rawBuffer[ ptr[ 0 ] ++ ] << 8 ) | rawBuffer[ ptr[ 1 ] ++ ]; - - pixel += diff; - - viewer.setUint16( writePtr, pixel, true ); - writePtr += 2; - - } - - break; - - case 2: - - ptr[ 0 ] = tmpBufferEnd; - ptr[ 1 ] = ptr[ 0 ] + info.columns; - ptr[ 2 ] = ptr[ 1 ] + info.columns; - tmpBufferEnd = ptr[ 2 ] + info.columns; - - for ( let j = 0; j < info.columns; ++ j ) { - - const diff = ( rawBuffer[ ptr[ 0 ] ++ ] << 24 ) | ( rawBuffer[ ptr[ 1 ] ++ ] << 16 ) | ( rawBuffer[ ptr[ 2 ] ++ ] << 8 ); - - pixel += diff; - - viewer.setUint32( writePtr, pixel, true ); - writePtr += 4; - - } - - break; - - } - - } - - } - - return viewer; - - } - - function uncompressDWA( info ) { - - const inDataView = info.viewer; - const inOffset = { value: info.offset.value }; - const outBuffer = new Uint8Array( info.columns * info.lines * ( info.inputChannels.length * info.type * INT16_SIZE ) ); - - // Read compression header information - const dwaHeader = { - - version: parseInt64( inDataView, inOffset ), - unknownUncompressedSize: parseInt64( inDataView, inOffset ), - unknownCompressedSize: parseInt64( inDataView, inOffset ), - acCompressedSize: parseInt64( inDataView, inOffset ), - dcCompressedSize: parseInt64( inDataView, inOffset ), - rleCompressedSize: parseInt64( inDataView, inOffset ), - rleUncompressedSize: parseInt64( inDataView, inOffset ), - rleRawSize: parseInt64( inDataView, inOffset ), - totalAcUncompressedCount: parseInt64( inDataView, inOffset ), - totalDcUncompressedCount: parseInt64( inDataView, inOffset ), - acCompression: parseInt64( inDataView, inOffset ) - - }; - - if ( dwaHeader.version < 2 ) - throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' version ' + dwaHeader.version + ' is unsupported' ); - - // Read channel ruleset information - const channelRules = new Array(); - let ruleSize = parseUint16( inDataView, inOffset ) - INT16_SIZE; - - while ( ruleSize > 0 ) { - - const name = parseNullTerminatedString( inDataView.buffer, inOffset ); - const value = parseUint8( inDataView, inOffset ); - const compression = ( value >> 2 ) & 3; - const csc = ( value >> 4 ) - 1; - const index = new Int8Array( [ csc ] )[ 0 ]; - const type = parseUint8( inDataView, inOffset ); - - channelRules.push( { - name: name, - index: index, - type: type, - compression: compression, - } ); - - ruleSize -= name.length + 3; - - } - - // Classify channels - const channels = EXRHeader.channels; - const channelData = new Array( info.inputChannels.length ); - - for ( let i = 0; i < info.inputChannels.length; ++ i ) { - - const cd = channelData[ i ] = {}; - const channel = channels[ i ]; - - cd.name = channel.name; - cd.compression = UNKNOWN; - cd.decoded = false; - cd.type = channel.pixelType; - cd.pLinear = channel.pLinear; - cd.width = info.columns; - cd.height = info.lines; - - } - - const cscSet = { - idx: new Array( 3 ) - }; - - for ( let offset = 0; offset < info.inputChannels.length; ++ offset ) { - - const cd = channelData[ offset ]; - - for ( let i = 0; i < channelRules.length; ++ i ) { - - const rule = channelRules[ i ]; - - if ( cd.name == rule.name ) { - - cd.compression = rule.compression; - - if ( rule.index >= 0 ) { - - cscSet.idx[ rule.index ] = offset; - - } - - cd.offset = offset; - - } - - } - - } - - let acBuffer, dcBuffer, rleBuffer; - - // Read DCT - AC component data - if ( dwaHeader.acCompressedSize > 0 ) { - - switch ( dwaHeader.acCompression ) { - - case STATIC_HUFFMAN: - - acBuffer = new Uint16Array( dwaHeader.totalAcUncompressedCount ); - hufUncompress( info.array, inDataView, inOffset, dwaHeader.acCompressedSize, acBuffer, dwaHeader.totalAcUncompressedCount ); - break; - - case DEFLATE: - - const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.totalAcUncompressedCount ); - const data = fflate.unzlibSync( compressed ); - acBuffer = new Uint16Array( data.buffer ); - inOffset.value += dwaHeader.totalAcUncompressedCount; - break; - - } - - - } - - // Read DCT - DC component data - if ( dwaHeader.dcCompressedSize > 0 ) { - - const zlibInfo = { - array: info.array, - offset: inOffset, - size: dwaHeader.dcCompressedSize - }; - dcBuffer = new Uint16Array( uncompressZIP( zlibInfo ).buffer ); - inOffset.value += dwaHeader.dcCompressedSize; - - } - - // Read RLE compressed data - if ( dwaHeader.rleRawSize > 0 ) { - - const compressed = info.array.slice( inOffset.value, inOffset.value + dwaHeader.rleCompressedSize ); - const data = fflate.unzlibSync( compressed ); - rleBuffer = decodeRunLength( data.buffer ); - - inOffset.value += dwaHeader.rleCompressedSize; - - } - - // Prepare outbuffer data offset - let outBufferEnd = 0; - const rowOffsets = new Array( channelData.length ); - for ( let i = 0; i < rowOffsets.length; ++ i ) { - - rowOffsets[ i ] = new Array(); - - } - - for ( let y = 0; y < info.lines; ++ y ) { - - for ( let chan = 0; chan < channelData.length; ++ chan ) { - - rowOffsets[ chan ].push( outBufferEnd ); - outBufferEnd += channelData[ chan ].width * info.type * INT16_SIZE; - - } - - } - - // Lossy DCT decode RGB channels - lossyDctDecode( cscSet, rowOffsets, channelData, acBuffer, dcBuffer, outBuffer ); - - // Decode other channels - for ( let i = 0; i < channelData.length; ++ i ) { - - const cd = channelData[ i ]; - - if ( cd.decoded ) continue; - - switch ( cd.compression ) { - - case RLE: - - let row = 0; - let rleOffset = 0; - - for ( let y = 0; y < info.lines; ++ y ) { - - let rowOffsetBytes = rowOffsets[ i ][ row ]; - - for ( let x = 0; x < cd.width; ++ x ) { - - for ( let byte = 0; byte < INT16_SIZE * cd.type; ++ byte ) { - - outBuffer[ rowOffsetBytes ++ ] = rleBuffer[ rleOffset + byte * cd.width * cd.height ]; - - } - - rleOffset ++; - - } - - row ++; - - } - - break; - - case LOSSY_DCT: // skip - - default: - throw new Error( 'EXRLoader.parse: unsupported channel compression' ); - - } - - } - - return new DataView( outBuffer.buffer ); - - } - - function parseNullTerminatedString( buffer, offset ) { - - const uintBuffer = new Uint8Array( buffer ); - let endOffset = 0; - - while ( uintBuffer[ offset.value + endOffset ] != 0 ) { - - endOffset += 1; - - } - - const stringValue = new TextDecoder().decode( - uintBuffer.slice( offset.value, offset.value + endOffset ) - ); - - offset.value = offset.value + endOffset + 1; - - return stringValue; - - } - - function parseFixedLengthString( buffer, offset, size ) { - - const stringValue = new TextDecoder().decode( - new Uint8Array( buffer ).slice( offset.value, offset.value + size ) - ); - - offset.value = offset.value + size; - - return stringValue; - - } - - function parseRational( dataView, offset ) { - - const x = parseInt32( dataView, offset ); - const y = parseUint32( dataView, offset ); - - return [ x, y ]; - - } - - function parseTimecode( dataView, offset ) { - - const x = parseUint32( dataView, offset ); - const y = parseUint32( dataView, offset ); - - return [ x, y ]; - - } - - function parseInt32( dataView, offset ) { - - const Int32 = dataView.getInt32( offset.value, true ); - - offset.value = offset.value + INT32_SIZE; - - return Int32; - - } - - function parseUint32( dataView, offset ) { - - const Uint32 = dataView.getUint32( offset.value, true ); - - offset.value = offset.value + INT32_SIZE; - - return Uint32; - - } - - function parseUint8Array( uInt8Array, offset ) { - - const Uint8 = uInt8Array[ offset.value ]; - - offset.value = offset.value + INT8_SIZE; - - return Uint8; - - } - - function parseUint8( dataView, offset ) { - - const Uint8 = dataView.getUint8( offset.value ); - - offset.value = offset.value + INT8_SIZE; - - return Uint8; - - } - - const parseInt64 = function ( dataView, offset ) { - - let int; - - if ( 'getBigInt64' in DataView.prototype ) { - - int = Number( dataView.getBigInt64( offset.value, true ) ); - - } else { - - int = dataView.getUint32( offset.value + 4, true ) + Number( dataView.getUint32( offset.value, true ) << 32 ); - - } - - offset.value += ULONG_SIZE; - - return int; - - }; - - function parseFloat32( dataView, offset ) { - - const float = dataView.getFloat32( offset.value, true ); - - offset.value += FLOAT32_SIZE; - - return float; - - } - - function decodeFloat32( dataView, offset ) { - - return DataUtils.toHalfFloat( parseFloat32( dataView, offset ) ); - - } - - // https://stackoverflow.com/questions/5678432/decompressing-half-precision-floats-in-javascript - function decodeFloat16( binary ) { - - const exponent = ( binary & 0x7C00 ) >> 10, - fraction = binary & 0x03FF; - - return ( binary >> 15 ? - 1 : 1 ) * ( - exponent ? - ( - exponent === 0x1F ? - fraction ? NaN : Infinity : - Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) - ) : - 6.103515625e-5 * ( fraction / 0x400 ) - ); - - } - - function parseUint16( dataView, offset ) { - - const Uint16 = dataView.getUint16( offset.value, true ); - - offset.value += INT16_SIZE; - - return Uint16; - - } - - function parseFloat16( buffer, offset ) { - - return decodeFloat16( parseUint16( buffer, offset ) ); - - } - - function parseChlist( dataView, buffer, offset, size ) { - - const startOffset = offset.value; - const channels = []; - - while ( offset.value < ( startOffset + size - 1 ) ) { - - const name = parseNullTerminatedString( buffer, offset ); - const pixelType = parseInt32( dataView, offset ); - const pLinear = parseUint8( dataView, offset ); - offset.value += 3; // reserved, three chars - const xSampling = parseInt32( dataView, offset ); - const ySampling = parseInt32( dataView, offset ); - - channels.push( { - name: name, - pixelType: pixelType, - pLinear: pLinear, - xSampling: xSampling, - ySampling: ySampling - } ); - - } - - offset.value += 1; - - return channels; - - } - - function parseChromaticities( dataView, offset ) { - - const redX = parseFloat32( dataView, offset ); - const redY = parseFloat32( dataView, offset ); - const greenX = parseFloat32( dataView, offset ); - const greenY = parseFloat32( dataView, offset ); - const blueX = parseFloat32( dataView, offset ); - const blueY = parseFloat32( dataView, offset ); - const whiteX = parseFloat32( dataView, offset ); - const whiteY = parseFloat32( dataView, offset ); - - return { redX: redX, redY: redY, greenX: greenX, greenY: greenY, blueX: blueX, blueY: blueY, whiteX: whiteX, whiteY: whiteY }; - - } - - function parseCompression( dataView, offset ) { - - const compressionCodes = [ - 'NO_COMPRESSION', - 'RLE_COMPRESSION', - 'ZIPS_COMPRESSION', - 'ZIP_COMPRESSION', - 'PIZ_COMPRESSION', - 'PXR24_COMPRESSION', - 'B44_COMPRESSION', - 'B44A_COMPRESSION', - 'DWAA_COMPRESSION', - 'DWAB_COMPRESSION' - ]; - - const compression = parseUint8( dataView, offset ); - - return compressionCodes[ compression ]; - - } - - function parseBox2i( dataView, offset ) { - - const xMin = parseInt32( dataView, offset ); - const yMin = parseInt32( dataView, offset ); - const xMax = parseInt32( dataView, offset ); - const yMax = parseInt32( dataView, offset ); - - return { xMin: xMin, yMin: yMin, xMax: xMax, yMax: yMax }; - - } - - function parseLineOrder( dataView, offset ) { - - const lineOrders = [ - 'INCREASING_Y', - 'DECREASING_Y', - 'RANDOM_Y', - ]; - - const lineOrder = parseUint8( dataView, offset ); - - return lineOrders[ lineOrder ]; - - } - - function parseEnvmap( dataView, offset ) { - - const envmaps = [ - 'ENVMAP_LATLONG', - 'ENVMAP_CUBE' - ]; - - const envmap = parseUint8( dataView, offset ); - - return envmaps[ envmap ]; - - } - - function parseTiledesc( dataView, offset ) { - - const levelModes = [ - 'ONE_LEVEL', - 'MIPMAP_LEVELS', - 'RIPMAP_LEVELS', - ]; - - const roundingModes = [ - 'ROUND_DOWN', - 'ROUND_UP', - ]; - - const xSize = parseUint32( dataView, offset ); - const ySize = parseUint32( dataView, offset ); - const modes = parseUint8( dataView, offset ); - - return { - xSize: xSize, - ySize: ySize, - levelMode: levelModes[ modes & 0xf ], - roundingMode: roundingModes[ modes >> 4 ] - }; - - } - - function parseV2f( dataView, offset ) { - - const x = parseFloat32( dataView, offset ); - const y = parseFloat32( dataView, offset ); - - return [ x, y ]; - - } - - function parseV3f( dataView, offset ) { - - const x = parseFloat32( dataView, offset ); - const y = parseFloat32( dataView, offset ); - const z = parseFloat32( dataView, offset ); - - return [ x, y, z ]; - - } - - function parseValue( dataView, buffer, offset, type, size ) { - - if ( type === 'string' || type === 'stringvector' || type === 'iccProfile' ) { - - return parseFixedLengthString( buffer, offset, size ); - - } else if ( type === 'chlist' ) { - - return parseChlist( dataView, buffer, offset, size ); - - } else if ( type === 'chromaticities' ) { - - return parseChromaticities( dataView, offset ); - - } else if ( type === 'compression' ) { - - return parseCompression( dataView, offset ); - - } else if ( type === 'box2i' ) { - - return parseBox2i( dataView, offset ); - - } else if ( type === 'envmap' ) { - - return parseEnvmap( dataView, offset ); - - } else if ( type === 'tiledesc' ) { - - return parseTiledesc( dataView, offset ); - - } else if ( type === 'lineOrder' ) { - - return parseLineOrder( dataView, offset ); - - } else if ( type === 'float' ) { - - return parseFloat32( dataView, offset ); - - } else if ( type === 'v2f' ) { - - return parseV2f( dataView, offset ); - - } else if ( type === 'v3f' ) { - - return parseV3f( dataView, offset ); - - } else if ( type === 'int' ) { - - return parseInt32( dataView, offset ); - - } else if ( type === 'rational' ) { - - return parseRational( dataView, offset ); - - } else if ( type === 'timecode' ) { - - return parseTimecode( dataView, offset ); - - } else if ( type === 'preview' ) { - - offset.value += size; - return 'skipped'; - - } else { - - offset.value += size; - return undefined; - - } - - } - - function roundLog2( x, mode ) { - - const log2 = Math.log2( x ); - return mode == 'ROUND_DOWN' ? Math.floor( log2 ) : Math.ceil( log2 ); - - } - - function calculateTileLevels( tiledesc, w, h ) { - - let num = 0; - - switch ( tiledesc.levelMode ) { - - case 'ONE_LEVEL': - num = 1; - break; - - case 'MIPMAP_LEVELS': - num = roundLog2( Math.max( w, h ), tiledesc.roundingMode ) + 1; - break; - - case 'RIPMAP_LEVELS': - throw new Error( 'THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.' ); - - } - - return num; - - } - - function calculateTiles( count, dataSize, size, roundingMode ) { - - const tiles = new Array( count ); - - for ( let i = 0; i < count; i ++ ) { - - const b = ( 1 << i ); - let s = ( dataSize / b ) | 0; - - if ( roundingMode == 'ROUND_UP' && s * b < dataSize ) s += 1; - - const l = Math.max( s, 1 ); - - tiles[ i ] = ( ( l + size - 1 ) / size ) | 0; - - } - - return tiles; - - } - - function parseTiles() { - - const EXRDecoder = this; - const offset = EXRDecoder.offset; - const tmpOffset = { value: 0 }; - - for ( let tile = 0; tile < EXRDecoder.tileCount; tile ++ ) { - - const tileX = parseInt32( EXRDecoder.viewer, offset ); - const tileY = parseInt32( EXRDecoder.viewer, offset ); - offset.value += 8; // skip levels - only parsing top-level - EXRDecoder.size = parseUint32( EXRDecoder.viewer, offset ); - - const startX = tileX * EXRDecoder.blockWidth; - const startY = tileY * EXRDecoder.blockHeight; - EXRDecoder.columns = ( startX + EXRDecoder.blockWidth > EXRDecoder.width ) ? EXRDecoder.width - startX : EXRDecoder.blockWidth; - EXRDecoder.lines = ( startY + EXRDecoder.blockHeight > EXRDecoder.height ) ? EXRDecoder.height - startY : EXRDecoder.blockHeight; - - const bytesBlockLine = EXRDecoder.columns * EXRDecoder.totalBytes; - const isCompressed = EXRDecoder.size < EXRDecoder.lines * bytesBlockLine; - const viewer = isCompressed ? EXRDecoder.uncompress( EXRDecoder ) : uncompressRAW( EXRDecoder ); - - offset.value += EXRDecoder.size; - - for ( let line = 0; line < EXRDecoder.lines; line ++ ) { - - const lineOffset = line * EXRDecoder.columns * EXRDecoder.totalBytes; - - for ( let channelID = 0; channelID < EXRDecoder.inputChannels.length; channelID ++ ) { - - const name = EXRHeader.channels[ channelID ].name; - const lOff = EXRDecoder.channelByteOffsets[ name ] * EXRDecoder.columns; - const cOff = EXRDecoder.decodeChannels[ name ]; - - if ( cOff === undefined ) continue; - - tmpOffset.value = lineOffset + lOff; - const outLineOffset = ( EXRDecoder.height - ( 1 + startY + line ) ) * EXRDecoder.outLineWidth; - - for ( let x = 0; x < EXRDecoder.columns; x ++ ) { - - const outIndex = outLineOffset + ( x + startX ) * EXRDecoder.outputChannels + cOff; - EXRDecoder.byteArray[ outIndex ] = EXRDecoder.getter( viewer, tmpOffset ); - - } - - } - - } - - } - - } - - function parseScanline() { - - const EXRDecoder = this; - const offset = EXRDecoder.offset; - const tmpOffset = { value: 0 }; - - for ( let scanlineBlockIdx = 0; scanlineBlockIdx < EXRDecoder.height / EXRDecoder.blockHeight; scanlineBlockIdx ++ ) { - - const line = parseInt32( EXRDecoder.viewer, offset ) - EXRHeader.dataWindow.yMin; // line_no - EXRDecoder.size = parseUint32( EXRDecoder.viewer, offset ); // data_len - EXRDecoder.lines = ( ( line + EXRDecoder.blockHeight > EXRDecoder.height ) ? ( EXRDecoder.height - line ) : EXRDecoder.blockHeight ); - - const bytesPerLine = EXRDecoder.columns * EXRDecoder.totalBytes; - const isCompressed = EXRDecoder.size < EXRDecoder.lines * bytesPerLine; - const viewer = isCompressed ? EXRDecoder.uncompress( EXRDecoder ) : uncompressRAW( EXRDecoder ); - - offset.value += EXRDecoder.size; - - for ( let line_y = 0; line_y < EXRDecoder.blockHeight; line_y ++ ) { - - const scan_y = scanlineBlockIdx * EXRDecoder.blockHeight; - const true_y = line_y + EXRDecoder.scanOrder( scan_y ); - if ( true_y >= EXRDecoder.height ) continue; - - const lineOffset = line_y * bytesPerLine; - const outLineOffset = ( EXRDecoder.height - 1 - true_y ) * EXRDecoder.outLineWidth; - - for ( let channelID = 0; channelID < EXRDecoder.inputChannels.length; channelID ++ ) { - - const name = EXRHeader.channels[ channelID ].name; - const lOff = EXRDecoder.channelByteOffsets[ name ] * EXRDecoder.columns; - const cOff = EXRDecoder.decodeChannels[ name ]; - - if ( cOff === undefined ) continue; - - tmpOffset.value = lineOffset + lOff; - - for ( let x = 0; x < EXRDecoder.columns; x ++ ) { - - const outIndex = outLineOffset + x * EXRDecoder.outputChannels + cOff; - EXRDecoder.byteArray[ outIndex ] = EXRDecoder.getter( viewer, tmpOffset ); - - } - - } - - } - - } - - } - - function parseHeader( dataView, buffer, offset ) { - - const EXRHeader = {}; - - if ( dataView.getUint32( 0, true ) != 20000630 ) { // magic - - throw new Error( 'THREE.EXRLoader: Provided file doesn\'t appear to be in OpenEXR format.' ); - - } - - EXRHeader.version = dataView.getUint8( 4 ); - - const spec = dataView.getUint8( 5 ); // fullMask - - EXRHeader.spec = { - singleTile: !! ( spec & 2 ), - longName: !! ( spec & 4 ), - deepFormat: !! ( spec & 8 ), - multiPart: !! ( spec & 16 ), - }; - - // start of header - - offset.value = 8; // start at 8 - after pre-amble - - let keepReading = true; - - while ( keepReading ) { - - const attributeName = parseNullTerminatedString( buffer, offset ); - - if ( attributeName == 0 ) { - - keepReading = false; - - } else { - - const attributeType = parseNullTerminatedString( buffer, offset ); - const attributeSize = parseUint32( dataView, offset ); - const attributeValue = parseValue( dataView, buffer, offset, attributeType, attributeSize ); - - if ( attributeValue === undefined ) { - - console.warn( `THREE.EXRLoader: Skipped unknown header attribute type \'${attributeType}\'.` ); - - } else { - - EXRHeader[ attributeName ] = attributeValue; - - } - - } - - } - - if ( ( spec & ~ 0x06 ) != 0 ) { // unsupported deep-image, multi-part - - console.error( 'THREE.EXRHeader:', EXRHeader ); - throw new Error( 'THREE.EXRLoader: Provided file is currently unsupported.' ); - - } - - return EXRHeader; - - } - - function setupDecoder( EXRHeader, dataView, uInt8Array, offset, outputType ) { - - const EXRDecoder = { - size: 0, - viewer: dataView, - array: uInt8Array, - offset: offset, - width: EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1, - height: EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1, - inputChannels: EXRHeader.channels, - channelByteOffsets: {}, - scanOrder: null, - totalBytes: null, - columns: null, - lines: null, - type: null, - uncompress: null, - getter: null, - format: null, - colorSpace: LinearSRGBColorSpace, - }; - - switch ( EXRHeader.compression ) { - - case 'NO_COMPRESSION': - EXRDecoder.blockHeight = 1; - EXRDecoder.uncompress = uncompressRAW; - break; - - case 'RLE_COMPRESSION': - EXRDecoder.blockHeight = 1; - EXRDecoder.uncompress = uncompressRLE; - break; - - case 'ZIPS_COMPRESSION': - EXRDecoder.blockHeight = 1; - EXRDecoder.uncompress = uncompressZIP; - break; - - case 'ZIP_COMPRESSION': - EXRDecoder.blockHeight = 16; - EXRDecoder.uncompress = uncompressZIP; - break; - - case 'PIZ_COMPRESSION': - EXRDecoder.blockHeight = 32; - EXRDecoder.uncompress = uncompressPIZ; - break; - - case 'PXR24_COMPRESSION': - EXRDecoder.blockHeight = 16; - EXRDecoder.uncompress = uncompressPXR; - break; - - case 'DWAA_COMPRESSION': - EXRDecoder.blockHeight = 32; - EXRDecoder.uncompress = uncompressDWA; - break; - - case 'DWAB_COMPRESSION': - EXRDecoder.blockHeight = 256; - EXRDecoder.uncompress = uncompressDWA; - break; - - default: - throw new Error( 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported' ); - - } - - const channels = {}; - for ( const channel of EXRHeader.channels ) { - - switch ( channel.name ) { - - case 'Y': - case 'R': - case 'G': - case 'B': - case 'A': - channels[ channel.name ] = true; - EXRDecoder.type = channel.pixelType; - - } - - } - - // RGB images will be converted to RGBA format, preventing software emulation in select devices. - let fillAlpha = false; - - if ( channels.R && channels.G && channels.B ) { - - fillAlpha = ! channels.A; - EXRDecoder.outputChannels = 4; - EXRDecoder.decodeChannels = { R: 0, G: 1, B: 2, A: 3 }; - - } else if ( channels.Y ) { - - EXRDecoder.outputChannels = 1; - EXRDecoder.decodeChannels = { Y: 0 }; - - } else { - - throw new Error( 'EXRLoader.parse: file contains unsupported data channels.' ); - - } - - if ( EXRDecoder.type == 1 ) { - - // half - switch ( outputType ) { - - case FloatType: - EXRDecoder.getter = parseFloat16; - break; - - case HalfFloatType: - EXRDecoder.getter = parseUint16; - break; - - } - - } else if ( EXRDecoder.type == 2 ) { - - // float - switch ( outputType ) { - - case FloatType: - EXRDecoder.getter = parseFloat32; - break; - - case HalfFloatType: - EXRDecoder.getter = decodeFloat32; - - } - - } else { - - throw new Error( 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.' ); - - } - - EXRDecoder.columns = EXRDecoder.width; - const size = EXRDecoder.width * EXRDecoder.height * EXRDecoder.outputChannels; - - switch ( outputType ) { - - case FloatType: - EXRDecoder.byteArray = new Float32Array( size ); - - // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten - if ( fillAlpha ) - EXRDecoder.byteArray.fill( 1, 0, size ); - - break; - - case HalfFloatType: - EXRDecoder.byteArray = new Uint16Array( size ); - - if ( fillAlpha ) - EXRDecoder.byteArray.fill( 0x3C00, 0, size ); // Uint16Array holds half float data, 0x3C00 is 1 - - break; - - default: - console.error( 'THREE.EXRLoader: unsupported type: ', outputType ); - break; - - } - - let byteOffset = 0; - for ( const channel of EXRHeader.channels ) { - - if ( EXRDecoder.decodeChannels[ channel.name ] !== undefined ) { - - EXRDecoder.channelByteOffsets[ channel.name ] = byteOffset; - - } - - byteOffset += channel.pixelType * 2; - - } - - EXRDecoder.totalBytes = byteOffset; - EXRDecoder.outLineWidth = EXRDecoder.width * EXRDecoder.outputChannels; - - if ( EXRHeader.lineOrder === 'INCREASING_Y' ) { - - EXRDecoder.scanOrder = ( y ) => y; - - } else { - - EXRDecoder.scanOrder = ( y ) => EXRDecoder.height - 1 - y; - - } - - if ( EXRDecoder.outputChannels == 4 ) { - - EXRDecoder.format = RGBAFormat; - EXRDecoder.colorSpace = LinearSRGBColorSpace; - - } else { - - EXRDecoder.format = RedFormat; - EXRDecoder.colorSpace = NoColorSpace; - - } - - if ( EXRHeader.spec.singleTile ) { - - EXRDecoder.blockHeight = EXRHeader.tiles.ySize; - EXRDecoder.blockWidth = EXRHeader.tiles.xSize; - - const numXLevels = calculateTileLevels( EXRHeader.tiles, EXRDecoder.width, EXRDecoder.height ); - // const numYLevels = calculateTileLevels( EXRHeader.tiles, EXRDecoder.width, EXRDecoder.height ); - - const numXTiles = calculateTiles( numXLevels, EXRDecoder.width, EXRHeader.tiles.xSize, EXRHeader.tiles.roundingMode ); - const numYTiles = calculateTiles( numXLevels, EXRDecoder.height, EXRHeader.tiles.ySize, EXRHeader.tiles.roundingMode ); - - EXRDecoder.tileCount = numXTiles[ 0 ] * numYTiles[ 0 ]; - - for ( let l = 0; l < numXLevels; l ++ ) - for ( let y = 0; y < numYTiles[ l ]; y ++ ) - for ( let x = 0; x < numXTiles[ l ]; x ++ ) - parseInt64( dataView, offset ); // tileOffset - - EXRDecoder.decode = parseTiles.bind( EXRDecoder ); - - } else { - - EXRDecoder.blockWidth = EXRDecoder.width; - const blockCount = Math.ceil( EXRDecoder.height / EXRDecoder.blockHeight ); - - for ( let i = 0; i < blockCount; i ++ ) - parseInt64( dataView, offset ); // scanlineOffset - - EXRDecoder.decode = parseScanline.bind( EXRDecoder ); - - } - - return EXRDecoder; - - } - - // start parsing file [START] - const offset = { value: 0 }; - const bufferDataView = new DataView( buffer ); - const uInt8Array = new Uint8Array( buffer ); - - // get header information and validate format. - const EXRHeader = parseHeader( bufferDataView, buffer, offset ); - - // get input compression information and prepare decoding. - const EXRDecoder = setupDecoder( EXRHeader, bufferDataView, uInt8Array, offset, this.type ); - - // parse input data - EXRDecoder.decode(); - - return { - header: EXRHeader, - width: EXRDecoder.width, - height: EXRDecoder.height, - data: EXRDecoder.byteArray, - format: EXRDecoder.format, - colorSpace: EXRDecoder.colorSpace, - type: this.type, - }; - - } - - setDataType( value ) { - - this.type = value; - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - function onLoadCallback( texture, texData ) { - - texture.colorSpace = texData.colorSpace; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - texture.flipY = false; - - if ( onLoad ) onLoad( texture, texData ); - - } - - return super.load( url, onLoadCallback, onProgress, onError ); - - } - -} - -export { EXRLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ExposureShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ExposureShader.js deleted file mode 100644 index 3008ab2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ExposureShader.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Exposure shader - */ - -const ExposureShader = { - - name: 'ExposureShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'exposure': { value: 1.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float exposure; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - gl_FragColor = texture2D( tDiffuse, vUv ); - gl_FragColor.rgb *= exposure; - - }` - -}; - -export { ExposureShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FBXLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FBXLoader.js deleted file mode 100644 index 27ea379..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FBXLoader.js +++ /dev/null @@ -1,4303 +0,0 @@ -import { - AmbientLight, - AnimationClip, - Bone, - BufferGeometry, - ClampToEdgeWrapping, - Color, - DirectionalLight, - EquirectangularReflectionMapping, - Euler, - FileLoader, - Float32BufferAttribute, - Group, - Line, - LineBasicMaterial, - Loader, - LoaderUtils, - MathUtils, - Matrix3, - Matrix4, - Mesh, - MeshLambertMaterial, - MeshPhongMaterial, - NumberKeyframeTrack, - Object3D, - OrthographicCamera, - PerspectiveCamera, - PointLight, - PropertyBinding, - Quaternion, - QuaternionKeyframeTrack, - RepeatWrapping, - Skeleton, - SkinnedMesh, - SpotLight, - Texture, - TextureLoader, - Uint16BufferAttribute, - Vector2, - Vector3, - Vector4, - VectorKeyframeTrack, - SRGBColorSpace, - ShapeUtils -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; -import { NURBSCurve } from '../curves/NURBSCurve.js'; - -/** - * Loader loads FBX file and generates Group representing FBX scene. - * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format - * Versions lower than this may load but will probably have errors - * - * Needs Support: - * Morph normals / blend shape normals - * - * FBX format references: - * https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference) - * - * Binary format specification: - * https://code.blender.org/2013/08/fbx-binary-file-format-specification/ - */ - - -let fbxTree; -let connections; -let sceneGraph; - -class FBXLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path; - - const loader = new FileLoader( this.manager ); - loader.setPath( scope.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - - loader.load( url, function ( buffer ) { - - try { - - onLoad( scope.parse( buffer, path ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( FBXBuffer, path ) { - - if ( isFbxFormatBinary( FBXBuffer ) ) { - - fbxTree = new BinaryParser().parse( FBXBuffer ); - - } else { - - const FBXText = convertArrayBufferToString( FBXBuffer ); - - if ( ! isFbxFormatASCII( FBXText ) ) { - - throw new Error( 'THREE.FBXLoader: Unknown format.' ); - - } - - if ( getFbxVersion( FBXText ) < 7000 ) { - - throw new Error( 'THREE.FBXLoader: FBX version not supported, FileVersion: ' + getFbxVersion( FBXText ) ); - - } - - fbxTree = new TextParser().parse( FBXText ); - - } - - // console.log( fbxTree ); - - const textureLoader = new TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin ); - - return new FBXTreeParser( textureLoader, this.manager ).parse( fbxTree ); - - } - -} - -// Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group -class FBXTreeParser { - - constructor( textureLoader, manager ) { - - this.textureLoader = textureLoader; - this.manager = manager; - - } - - parse() { - - connections = this.parseConnections(); - - const images = this.parseImages(); - const textures = this.parseTextures( images ); - const materials = this.parseMaterials( textures ); - const deformers = this.parseDeformers(); - const geometryMap = new GeometryParser().parse( deformers ); - - this.parseScene( deformers, geometryMap, materials ); - - return sceneGraph; - - } - - // Parses FBXTree.Connections which holds parent-child connections between objects (e.g. material -> texture, model->geometry ) - // and details the connection type - parseConnections() { - - const connectionMap = new Map(); - - if ( 'Connections' in fbxTree ) { - - const rawConnections = fbxTree.Connections.connections; - - rawConnections.forEach( function ( rawConnection ) { - - const fromID = rawConnection[ 0 ]; - const toID = rawConnection[ 1 ]; - const relationship = rawConnection[ 2 ]; - - if ( ! connectionMap.has( fromID ) ) { - - connectionMap.set( fromID, { - parents: [], - children: [] - } ); - - } - - const parentRelationship = { ID: toID, relationship: relationship }; - connectionMap.get( fromID ).parents.push( parentRelationship ); - - if ( ! connectionMap.has( toID ) ) { - - connectionMap.set( toID, { - parents: [], - children: [] - } ); - - } - - const childRelationship = { ID: fromID, relationship: relationship }; - connectionMap.get( toID ).children.push( childRelationship ); - - } ); - - } - - return connectionMap; - - } - - // Parse FBXTree.Objects.Video for embedded image data - // These images are connected to textures in FBXTree.Objects.Textures - // via FBXTree.Connections. - parseImages() { - - const images = {}; - const blobs = {}; - - if ( 'Video' in fbxTree.Objects ) { - - const videoNodes = fbxTree.Objects.Video; - - for ( const nodeID in videoNodes ) { - - const videoNode = videoNodes[ nodeID ]; - - const id = parseInt( nodeID ); - - images[ id ] = videoNode.RelativeFilename || videoNode.Filename; - - // raw image data is in videoNode.Content - if ( 'Content' in videoNode ) { - - const arrayBufferContent = ( videoNode.Content instanceof ArrayBuffer ) && ( videoNode.Content.byteLength > 0 ); - const base64Content = ( typeof videoNode.Content === 'string' ) && ( videoNode.Content !== '' ); - - if ( arrayBufferContent || base64Content ) { - - const image = this.parseImage( videoNodes[ nodeID ] ); - - blobs[ videoNode.RelativeFilename || videoNode.Filename ] = image; - - } - - } - - } - - } - - for ( const id in images ) { - - const filename = images[ id ]; - - if ( blobs[ filename ] !== undefined ) images[ id ] = blobs[ filename ]; - else images[ id ] = images[ id ].split( '\\' ).pop(); - - } - - return images; - - } - - // Parse embedded image data in FBXTree.Video.Content - parseImage( videoNode ) { - - const content = videoNode.Content; - const fileName = videoNode.RelativeFilename || videoNode.Filename; - const extension = fileName.slice( fileName.lastIndexOf( '.' ) + 1 ).toLowerCase(); - - let type; - - switch ( extension ) { - - case 'bmp': - - type = 'image/bmp'; - break; - - case 'jpg': - case 'jpeg': - - type = 'image/jpeg'; - break; - - case 'png': - - type = 'image/png'; - break; - - case 'tif': - - type = 'image/tiff'; - break; - - case 'tga': - - if ( this.manager.getHandler( '.tga' ) === null ) { - - console.warn( 'FBXLoader: TGA loader not found, skipping ', fileName ); - - } - - type = 'image/tga'; - break; - - default: - - console.warn( 'FBXLoader: Image type "' + extension + '" is not supported.' ); - return; - - } - - if ( typeof content === 'string' ) { // ASCII format - - return 'data:' + type + ';base64,' + content; - - } else { // Binary Format - - const array = new Uint8Array( content ); - return window.URL.createObjectURL( new Blob( [ array ], { type: type } ) ); - - } - - } - - // Parse nodes in FBXTree.Objects.Texture - // These contain details such as UV scaling, cropping, rotation etc and are connected - // to images in FBXTree.Objects.Video - parseTextures( images ) { - - const textureMap = new Map(); - - if ( 'Texture' in fbxTree.Objects ) { - - const textureNodes = fbxTree.Objects.Texture; - for ( const nodeID in textureNodes ) { - - const texture = this.parseTexture( textureNodes[ nodeID ], images ); - textureMap.set( parseInt( nodeID ), texture ); - - } - - } - - return textureMap; - - } - - // Parse individual node in FBXTree.Objects.Texture - parseTexture( textureNode, images ) { - - const texture = this.loadTexture( textureNode, images ); - - texture.ID = textureNode.id; - - texture.name = textureNode.attrName; - - const wrapModeU = textureNode.WrapModeU; - const wrapModeV = textureNode.WrapModeV; - - const valueU = wrapModeU !== undefined ? wrapModeU.value : 0; - const valueV = wrapModeV !== undefined ? wrapModeV.value : 0; - - // http://download.autodesk.com/us/fbx/SDKdocs/FBX_SDK_Help/files/fbxsdkref/class_k_fbx_texture.html#889640e63e2e681259ea81061b85143a - // 0: repeat(default), 1: clamp - - texture.wrapS = valueU === 0 ? RepeatWrapping : ClampToEdgeWrapping; - texture.wrapT = valueV === 0 ? RepeatWrapping : ClampToEdgeWrapping; - - if ( 'Scaling' in textureNode ) { - - const values = textureNode.Scaling.value; - - texture.repeat.x = values[ 0 ]; - texture.repeat.y = values[ 1 ]; - - } - - if ( 'Translation' in textureNode ) { - - const values = textureNode.Translation.value; - - texture.offset.x = values[ 0 ]; - texture.offset.y = values[ 1 ]; - - } - - return texture; - - } - - // load a texture specified as a blob or data URI, or via an external URL using TextureLoader - loadTexture( textureNode, images ) { - - const nonNativeExtensions = new Set( [ 'tga', 'tif', 'tiff', 'exr', 'dds', 'hdr', 'ktx2' ] ); - - const extension = textureNode.FileName.split( '.' ).pop().toLowerCase(); - - const loader = nonNativeExtensions.has( extension ) ? this.manager.getHandler( `.${extension}` ) : this.textureLoader; - - if ( ! loader ) { - - console.warn( - `FBXLoader: ${extension.toUpperCase()} loader not found, creating placeholder texture for`, - textureNode.RelativeFilename - ); - return new Texture(); - - } - - const loaderPath = loader.path; - - if ( ! loaderPath ) { - - loader.setPath( this.textureLoader.path ); - - } - - const children = connections.get( textureNode.id ).children; - - let fileName; - - if ( children !== undefined && children.length > 0 && images[ children[ 0 ].ID ] !== undefined ) { - - fileName = images[ children[ 0 ].ID ]; - - if ( fileName.indexOf( 'blob:' ) === 0 || fileName.indexOf( 'data:' ) === 0 ) { - - loader.setPath( undefined ); - - } - - } - - const texture = loader.load( fileName ); - - // revert to initial path - loader.setPath( loaderPath ); - - return texture; - - } - - // Parse nodes in FBXTree.Objects.Material - parseMaterials( textureMap ) { - - const materialMap = new Map(); - - if ( 'Material' in fbxTree.Objects ) { - - const materialNodes = fbxTree.Objects.Material; - - for ( const nodeID in materialNodes ) { - - const material = this.parseMaterial( materialNodes[ nodeID ], textureMap ); - - if ( material !== null ) materialMap.set( parseInt( nodeID ), material ); - - } - - } - - return materialMap; - - } - - // Parse single node in FBXTree.Objects.Material - // Materials are connected to texture maps in FBXTree.Objects.Textures - // FBX format currently only supports Lambert and Phong shading models - parseMaterial( materialNode, textureMap ) { - - const ID = materialNode.id; - const name = materialNode.attrName; - let type = materialNode.ShadingModel; - - // Case where FBX wraps shading model in property object. - if ( typeof type === 'object' ) { - - type = type.value; - - } - - // Ignore unused materials which don't have any connections. - if ( ! connections.has( ID ) ) return null; - - const parameters = this.parseParameters( materialNode, textureMap, ID ); - - let material; - - switch ( type.toLowerCase() ) { - - case 'phong': - material = new MeshPhongMaterial(); - break; - case 'lambert': - material = new MeshLambertMaterial(); - break; - default: - console.warn( 'THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.', type ); - material = new MeshPhongMaterial(); - break; - - } - - material.setValues( parameters ); - material.name = name; - - return material; - - } - - // Parse FBX material and return parameters suitable for a three.js material - // Also parse the texture map and return any textures associated with the material - parseParameters( materialNode, textureMap, ID ) { - - const parameters = {}; - - if ( materialNode.BumpFactor ) { - - parameters.bumpScale = materialNode.BumpFactor.value; - - } - - if ( materialNode.Diffuse ) { - - parameters.color = new Color().fromArray( materialNode.Diffuse.value ).convertSRGBToLinear(); - - } else if ( materialNode.DiffuseColor && ( materialNode.DiffuseColor.type === 'Color' || materialNode.DiffuseColor.type === 'ColorRGB' ) ) { - - // The blender exporter exports diffuse here instead of in materialNode.Diffuse - parameters.color = new Color().fromArray( materialNode.DiffuseColor.value ).convertSRGBToLinear(); - - } - - if ( materialNode.DisplacementFactor ) { - - parameters.displacementScale = materialNode.DisplacementFactor.value; - - } - - if ( materialNode.Emissive ) { - - parameters.emissive = new Color().fromArray( materialNode.Emissive.value ).convertSRGBToLinear(); - - } else if ( materialNode.EmissiveColor && ( materialNode.EmissiveColor.type === 'Color' || materialNode.EmissiveColor.type === 'ColorRGB' ) ) { - - // The blender exporter exports emissive color here instead of in materialNode.Emissive - parameters.emissive = new Color().fromArray( materialNode.EmissiveColor.value ).convertSRGBToLinear(); - - } - - if ( materialNode.EmissiveFactor ) { - - parameters.emissiveIntensity = parseFloat( materialNode.EmissiveFactor.value ); - - } - - if ( materialNode.Opacity ) { - - parameters.opacity = parseFloat( materialNode.Opacity.value ); - - } - - if ( parameters.opacity < 1.0 ) { - - parameters.transparent = true; - - } - - if ( materialNode.ReflectionFactor ) { - - parameters.reflectivity = materialNode.ReflectionFactor.value; - - } - - if ( materialNode.Shininess ) { - - parameters.shininess = materialNode.Shininess.value; - - } - - if ( materialNode.Specular ) { - - parameters.specular = new Color().fromArray( materialNode.Specular.value ).convertSRGBToLinear(); - - } else if ( materialNode.SpecularColor && materialNode.SpecularColor.type === 'Color' ) { - - // The blender exporter exports specular color here instead of in materialNode.Specular - parameters.specular = new Color().fromArray( materialNode.SpecularColor.value ).convertSRGBToLinear(); - - } - - const scope = this; - connections.get( ID ).children.forEach( function ( child ) { - - const type = child.relationship; - - switch ( type ) { - - case 'Bump': - parameters.bumpMap = scope.getTexture( textureMap, child.ID ); - break; - - case 'Maya|TEX_ao_map': - parameters.aoMap = scope.getTexture( textureMap, child.ID ); - break; - - case 'DiffuseColor': - case 'Maya|TEX_color_map': - parameters.map = scope.getTexture( textureMap, child.ID ); - if ( parameters.map !== undefined ) { - - parameters.map.colorSpace = SRGBColorSpace; - - } - - break; - - case 'DisplacementColor': - parameters.displacementMap = scope.getTexture( textureMap, child.ID ); - break; - - case 'EmissiveColor': - parameters.emissiveMap = scope.getTexture( textureMap, child.ID ); - if ( parameters.emissiveMap !== undefined ) { - - parameters.emissiveMap.colorSpace = SRGBColorSpace; - - } - - break; - - case 'NormalMap': - case 'Maya|TEX_normal_map': - parameters.normalMap = scope.getTexture( textureMap, child.ID ); - break; - - case 'ReflectionColor': - parameters.envMap = scope.getTexture( textureMap, child.ID ); - if ( parameters.envMap !== undefined ) { - - parameters.envMap.mapping = EquirectangularReflectionMapping; - parameters.envMap.colorSpace = SRGBColorSpace; - - } - - break; - - case 'SpecularColor': - parameters.specularMap = scope.getTexture( textureMap, child.ID ); - if ( parameters.specularMap !== undefined ) { - - parameters.specularMap.colorSpace = SRGBColorSpace; - - } - - break; - - case 'TransparentColor': - case 'TransparencyFactor': - parameters.alphaMap = scope.getTexture( textureMap, child.ID ); - parameters.transparent = true; - break; - - case 'AmbientColor': - case 'ShininessExponent': // AKA glossiness map - case 'SpecularFactor': // AKA specularLevel - case 'VectorDisplacementColor': // NOTE: Seems to be a copy of DisplacementColor - default: - console.warn( 'THREE.FBXLoader: %s map is not supported in three.js, skipping texture.', type ); - break; - - } - - } ); - - return parameters; - - } - - // get a texture from the textureMap for use by a material. - getTexture( textureMap, id ) { - - // if the texture is a layered texture, just use the first layer and issue a warning - if ( 'LayeredTexture' in fbxTree.Objects && id in fbxTree.Objects.LayeredTexture ) { - - console.warn( 'THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer.' ); - id = connections.get( id ).children[ 0 ].ID; - - } - - return textureMap.get( id ); - - } - - // Parse nodes in FBXTree.Objects.Deformer - // Deformer node can contain skinning or Vertex Cache animation data, however only skinning is supported here - // Generates map of Skeleton-like objects for use later when generating and binding skeletons. - parseDeformers() { - - const skeletons = {}; - const morphTargets = {}; - - if ( 'Deformer' in fbxTree.Objects ) { - - const DeformerNodes = fbxTree.Objects.Deformer; - - for ( const nodeID in DeformerNodes ) { - - const deformerNode = DeformerNodes[ nodeID ]; - - const relationships = connections.get( parseInt( nodeID ) ); - - if ( deformerNode.attrType === 'Skin' ) { - - const skeleton = this.parseSkeleton( relationships, DeformerNodes ); - skeleton.ID = nodeID; - - if ( relationships.parents.length > 1 ) console.warn( 'THREE.FBXLoader: skeleton attached to more than one geometry is not supported.' ); - skeleton.geometryID = relationships.parents[ 0 ].ID; - - skeletons[ nodeID ] = skeleton; - - } else if ( deformerNode.attrType === 'BlendShape' ) { - - const morphTarget = { - id: nodeID, - }; - - morphTarget.rawTargets = this.parseMorphTargets( relationships, DeformerNodes ); - morphTarget.id = nodeID; - - if ( relationships.parents.length > 1 ) console.warn( 'THREE.FBXLoader: morph target attached to more than one geometry is not supported.' ); - - morphTargets[ nodeID ] = morphTarget; - - } - - } - - } - - return { - - skeletons: skeletons, - morphTargets: morphTargets, - - }; - - } - - // Parse single nodes in FBXTree.Objects.Deformer - // The top level skeleton node has type 'Skin' and sub nodes have type 'Cluster' - // Each skin node represents a skeleton and each cluster node represents a bone - parseSkeleton( relationships, deformerNodes ) { - - const rawBones = []; - - relationships.children.forEach( function ( child ) { - - const boneNode = deformerNodes[ child.ID ]; - - if ( boneNode.attrType !== 'Cluster' ) return; - - const rawBone = { - - ID: child.ID, - indices: [], - weights: [], - transformLink: new Matrix4().fromArray( boneNode.TransformLink.a ), - // transform: new Matrix4().fromArray( boneNode.Transform.a ), - // linkMode: boneNode.Mode, - - }; - - if ( 'Indexes' in boneNode ) { - - rawBone.indices = boneNode.Indexes.a; - rawBone.weights = boneNode.Weights.a; - - } - - rawBones.push( rawBone ); - - } ); - - return { - - rawBones: rawBones, - bones: [] - - }; - - } - - // The top level morph deformer node has type "BlendShape" and sub nodes have type "BlendShapeChannel" - parseMorphTargets( relationships, deformerNodes ) { - - const rawMorphTargets = []; - - for ( let i = 0; i < relationships.children.length; i ++ ) { - - const child = relationships.children[ i ]; - - const morphTargetNode = deformerNodes[ child.ID ]; - - const rawMorphTarget = { - - name: morphTargetNode.attrName, - initialWeight: morphTargetNode.DeformPercent, - id: morphTargetNode.id, - fullWeights: morphTargetNode.FullWeights.a - - }; - - if ( morphTargetNode.attrType !== 'BlendShapeChannel' ) return; - - rawMorphTarget.geoID = connections.get( parseInt( child.ID ) ).children.filter( function ( child ) { - - return child.relationship === undefined; - - } )[ 0 ].ID; - - rawMorphTargets.push( rawMorphTarget ); - - } - - return rawMorphTargets; - - } - - // create the main Group() to be returned by the loader - parseScene( deformers, geometryMap, materialMap ) { - - sceneGraph = new Group(); - - const modelMap = this.parseModels( deformers.skeletons, geometryMap, materialMap ); - - const modelNodes = fbxTree.Objects.Model; - - const scope = this; - modelMap.forEach( function ( model ) { - - const modelNode = modelNodes[ model.ID ]; - scope.setLookAtProperties( model, modelNode ); - - const parentConnections = connections.get( model.ID ).parents; - - parentConnections.forEach( function ( connection ) { - - const parent = modelMap.get( connection.ID ); - if ( parent !== undefined ) parent.add( model ); - - } ); - - if ( model.parent === null ) { - - sceneGraph.add( model ); - - } - - - } ); - - this.bindSkeleton( deformers.skeletons, geometryMap, modelMap ); - - this.addGlobalSceneSettings(); - - sceneGraph.traverse( function ( node ) { - - if ( node.userData.transformData ) { - - if ( node.parent ) { - - node.userData.transformData.parentMatrix = node.parent.matrix; - node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld; - - } - - const transform = generateTransform( node.userData.transformData ); - - node.applyMatrix4( transform ); - node.updateWorldMatrix(); - - } - - } ); - - const animations = new AnimationParser().parse(); - - // if all the models where already combined in a single group, just return that - if ( sceneGraph.children.length === 1 && sceneGraph.children[ 0 ].isGroup ) { - - sceneGraph.children[ 0 ].animations = animations; - sceneGraph = sceneGraph.children[ 0 ]; - - } - - sceneGraph.animations = animations; - - } - - // parse nodes in FBXTree.Objects.Model - parseModels( skeletons, geometryMap, materialMap ) { - - const modelMap = new Map(); - const modelNodes = fbxTree.Objects.Model; - - for ( const nodeID in modelNodes ) { - - const id = parseInt( nodeID ); - const node = modelNodes[ nodeID ]; - const relationships = connections.get( id ); - - let model = this.buildSkeleton( relationships, skeletons, id, node.attrName ); - - if ( ! model ) { - - switch ( node.attrType ) { - - case 'Camera': - model = this.createCamera( relationships ); - break; - case 'Light': - model = this.createLight( relationships ); - break; - case 'Mesh': - model = this.createMesh( relationships, geometryMap, materialMap ); - break; - case 'NurbsCurve': - model = this.createCurve( relationships, geometryMap ); - break; - case 'LimbNode': - case 'Root': - model = new Bone(); - break; - case 'Null': - default: - model = new Group(); - break; - - } - - model.name = node.attrName ? PropertyBinding.sanitizeNodeName( node.attrName ) : ''; - model.userData.originalName = node.attrName; - - model.ID = id; - - } - - this.getTransformData( model, node ); - modelMap.set( id, model ); - - } - - return modelMap; - - } - - buildSkeleton( relationships, skeletons, id, name ) { - - let bone = null; - - relationships.parents.forEach( function ( parent ) { - - for ( const ID in skeletons ) { - - const skeleton = skeletons[ ID ]; - - skeleton.rawBones.forEach( function ( rawBone, i ) { - - if ( rawBone.ID === parent.ID ) { - - const subBone = bone; - bone = new Bone(); - - bone.matrixWorld.copy( rawBone.transformLink ); - - // set name and id here - otherwise in cases where "subBone" is created it will not have a name / id - - bone.name = name ? PropertyBinding.sanitizeNodeName( name ) : ''; - bone.userData.originalName = name; - bone.ID = id; - - skeleton.bones[ i ] = bone; - - // In cases where a bone is shared between multiple meshes - // duplicate the bone here and and it as a child of the first bone - if ( subBone !== null ) { - - bone.add( subBone ); - - } - - } - - } ); - - } - - } ); - - return bone; - - } - - // create a PerspectiveCamera or OrthographicCamera - createCamera( relationships ) { - - let model; - let cameraAttribute; - - relationships.children.forEach( function ( child ) { - - const attr = fbxTree.Objects.NodeAttribute[ child.ID ]; - - if ( attr !== undefined ) { - - cameraAttribute = attr; - - } - - } ); - - if ( cameraAttribute === undefined ) { - - model = new Object3D(); - - } else { - - let type = 0; - if ( cameraAttribute.CameraProjectionType !== undefined && cameraAttribute.CameraProjectionType.value === 1 ) { - - type = 1; - - } - - let nearClippingPlane = 1; - if ( cameraAttribute.NearPlane !== undefined ) { - - nearClippingPlane = cameraAttribute.NearPlane.value / 1000; - - } - - let farClippingPlane = 1000; - if ( cameraAttribute.FarPlane !== undefined ) { - - farClippingPlane = cameraAttribute.FarPlane.value / 1000; - - } - - - let width = window.innerWidth; - let height = window.innerHeight; - - if ( cameraAttribute.AspectWidth !== undefined && cameraAttribute.AspectHeight !== undefined ) { - - width = cameraAttribute.AspectWidth.value; - height = cameraAttribute.AspectHeight.value; - - } - - const aspect = width / height; - - let fov = 45; - if ( cameraAttribute.FieldOfView !== undefined ) { - - fov = cameraAttribute.FieldOfView.value; - - } - - const focalLength = cameraAttribute.FocalLength ? cameraAttribute.FocalLength.value : null; - - switch ( type ) { - - case 0: // Perspective - model = new PerspectiveCamera( fov, aspect, nearClippingPlane, farClippingPlane ); - if ( focalLength !== null ) model.setFocalLength( focalLength ); - break; - - case 1: // Orthographic - model = new OrthographicCamera( - width / 2, width / 2, height / 2, - height / 2, nearClippingPlane, farClippingPlane ); - break; - - default: - console.warn( 'THREE.FBXLoader: Unknown camera type ' + type + '.' ); - model = new Object3D(); - break; - - } - - } - - return model; - - } - - // Create a DirectionalLight, PointLight or SpotLight - createLight( relationships ) { - - let model; - let lightAttribute; - - relationships.children.forEach( function ( child ) { - - const attr = fbxTree.Objects.NodeAttribute[ child.ID ]; - - if ( attr !== undefined ) { - - lightAttribute = attr; - - } - - } ); - - if ( lightAttribute === undefined ) { - - model = new Object3D(); - - } else { - - let type; - - // LightType can be undefined for Point lights - if ( lightAttribute.LightType === undefined ) { - - type = 0; - - } else { - - type = lightAttribute.LightType.value; - - } - - let color = 0xffffff; - - if ( lightAttribute.Color !== undefined ) { - - color = new Color().fromArray( lightAttribute.Color.value ).convertSRGBToLinear(); - - } - - let intensity = ( lightAttribute.Intensity === undefined ) ? 1 : lightAttribute.Intensity.value / 100; - - // light disabled - if ( lightAttribute.CastLightOnObject !== undefined && lightAttribute.CastLightOnObject.value === 0 ) { - - intensity = 0; - - } - - let distance = 0; - if ( lightAttribute.FarAttenuationEnd !== undefined ) { - - if ( lightAttribute.EnableFarAttenuation !== undefined && lightAttribute.EnableFarAttenuation.value === 0 ) { - - distance = 0; - - } else { - - distance = lightAttribute.FarAttenuationEnd.value; - - } - - } - - // TODO: could this be calculated linearly from FarAttenuationStart to FarAttenuationEnd? - const decay = 1; - - switch ( type ) { - - case 0: // Point - model = new PointLight( color, intensity, distance, decay ); - break; - - case 1: // Directional - model = new DirectionalLight( color, intensity ); - break; - - case 2: // Spot - let angle = Math.PI / 3; - - if ( lightAttribute.InnerAngle !== undefined ) { - - angle = MathUtils.degToRad( lightAttribute.InnerAngle.value ); - - } - - let penumbra = 0; - if ( lightAttribute.OuterAngle !== undefined ) { - - // TODO: this is not correct - FBX calculates outer and inner angle in degrees - // with OuterAngle > InnerAngle && OuterAngle <= Math.PI - // while three.js uses a penumbra between (0, 1) to attenuate the inner angle - penumbra = MathUtils.degToRad( lightAttribute.OuterAngle.value ); - penumbra = Math.max( penumbra, 1 ); - - } - - model = new SpotLight( color, intensity, distance, angle, penumbra, decay ); - break; - - default: - console.warn( 'THREE.FBXLoader: Unknown light type ' + lightAttribute.LightType.value + ', defaulting to a PointLight.' ); - model = new PointLight( color, intensity ); - break; - - } - - if ( lightAttribute.CastShadows !== undefined && lightAttribute.CastShadows.value === 1 ) { - - model.castShadow = true; - - } - - } - - return model; - - } - - createMesh( relationships, geometryMap, materialMap ) { - - let model; - let geometry = null; - let material = null; - const materials = []; - - // get geometry and materials(s) from connections - relationships.children.forEach( function ( child ) { - - if ( geometryMap.has( child.ID ) ) { - - geometry = geometryMap.get( child.ID ); - - } - - if ( materialMap.has( child.ID ) ) { - - materials.push( materialMap.get( child.ID ) ); - - } - - } ); - - if ( materials.length > 1 ) { - - material = materials; - - } else if ( materials.length > 0 ) { - - material = materials[ 0 ]; - - } else { - - material = new MeshPhongMaterial( { - name: Loader.DEFAULT_MATERIAL_NAME, - color: 0xcccccc - } ); - materials.push( material ); - - } - - if ( 'color' in geometry.attributes ) { - - materials.forEach( function ( material ) { - - material.vertexColors = true; - - } ); - - } - - if ( geometry.FBX_Deformer ) { - - model = new SkinnedMesh( geometry, material ); - model.normalizeSkinWeights(); - - } else { - - model = new Mesh( geometry, material ); - - } - - return model; - - } - - createCurve( relationships, geometryMap ) { - - const geometry = relationships.children.reduce( function ( geo, child ) { - - if ( geometryMap.has( child.ID ) ) geo = geometryMap.get( child.ID ); - - return geo; - - }, null ); - - // FBX does not list materials for Nurbs lines, so we'll just put our own in here. - const material = new LineBasicMaterial( { - name: Loader.DEFAULT_MATERIAL_NAME, - color: 0x3300ff, - linewidth: 1 - } ); - return new Line( geometry, material ); - - } - - // parse the model node for transform data - getTransformData( model, modelNode ) { - - const transformData = {}; - - if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value ); - - if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value ); - else transformData.eulerOrder = 'ZYX'; - - if ( 'Lcl_Translation' in modelNode ) transformData.translation = modelNode.Lcl_Translation.value; - - if ( 'PreRotation' in modelNode ) transformData.preRotation = modelNode.PreRotation.value; - if ( 'Lcl_Rotation' in modelNode ) transformData.rotation = modelNode.Lcl_Rotation.value; - if ( 'PostRotation' in modelNode ) transformData.postRotation = modelNode.PostRotation.value; - - if ( 'Lcl_Scaling' in modelNode ) transformData.scale = modelNode.Lcl_Scaling.value; - - if ( 'ScalingOffset' in modelNode ) transformData.scalingOffset = modelNode.ScalingOffset.value; - if ( 'ScalingPivot' in modelNode ) transformData.scalingPivot = modelNode.ScalingPivot.value; - - if ( 'RotationOffset' in modelNode ) transformData.rotationOffset = modelNode.RotationOffset.value; - if ( 'RotationPivot' in modelNode ) transformData.rotationPivot = modelNode.RotationPivot.value; - - model.userData.transformData = transformData; - - } - - setLookAtProperties( model, modelNode ) { - - if ( 'LookAtProperty' in modelNode ) { - - const children = connections.get( model.ID ).children; - - children.forEach( function ( child ) { - - if ( child.relationship === 'LookAtProperty' ) { - - const lookAtTarget = fbxTree.Objects.Model[ child.ID ]; - - if ( 'Lcl_Translation' in lookAtTarget ) { - - const pos = lookAtTarget.Lcl_Translation.value; - - // DirectionalLight, SpotLight - if ( model.target !== undefined ) { - - model.target.position.fromArray( pos ); - sceneGraph.add( model.target ); - - } else { // Cameras and other Object3Ds - - model.lookAt( new Vector3().fromArray( pos ) ); - - } - - } - - } - - } ); - - } - - } - - bindSkeleton( skeletons, geometryMap, modelMap ) { - - const bindMatrices = this.parsePoseNodes(); - - for ( const ID in skeletons ) { - - const skeleton = skeletons[ ID ]; - - const parents = connections.get( parseInt( skeleton.ID ) ).parents; - - parents.forEach( function ( parent ) { - - if ( geometryMap.has( parent.ID ) ) { - - const geoID = parent.ID; - const geoRelationships = connections.get( geoID ); - - geoRelationships.parents.forEach( function ( geoConnParent ) { - - if ( modelMap.has( geoConnParent.ID ) ) { - - const model = modelMap.get( geoConnParent.ID ); - - model.bind( new Skeleton( skeleton.bones ), bindMatrices[ geoConnParent.ID ] ); - - } - - } ); - - } - - } ); - - } - - } - - parsePoseNodes() { - - const bindMatrices = {}; - - if ( 'Pose' in fbxTree.Objects ) { - - const BindPoseNode = fbxTree.Objects.Pose; - - for ( const nodeID in BindPoseNode ) { - - if ( BindPoseNode[ nodeID ].attrType === 'BindPose' && BindPoseNode[ nodeID ].NbPoseNodes > 0 ) { - - const poseNodes = BindPoseNode[ nodeID ].PoseNode; - - if ( Array.isArray( poseNodes ) ) { - - poseNodes.forEach( function ( poseNode ) { - - bindMatrices[ poseNode.Node ] = new Matrix4().fromArray( poseNode.Matrix.a ); - - } ); - - } else { - - bindMatrices[ poseNodes.Node ] = new Matrix4().fromArray( poseNodes.Matrix.a ); - - } - - } - - } - - } - - return bindMatrices; - - } - - addGlobalSceneSettings() { - - if ( 'GlobalSettings' in fbxTree ) { - - if ( 'AmbientColor' in fbxTree.GlobalSettings ) { - - // Parse ambient color - if it's not set to black (default), create an ambient light - - const ambientColor = fbxTree.GlobalSettings.AmbientColor.value; - const r = ambientColor[ 0 ]; - const g = ambientColor[ 1 ]; - const b = ambientColor[ 2 ]; - - if ( r !== 0 || g !== 0 || b !== 0 ) { - - const color = new Color( r, g, b ).convertSRGBToLinear(); - sceneGraph.add( new AmbientLight( color, 1 ) ); - - } - - } - - if ( 'UnitScaleFactor' in fbxTree.GlobalSettings ) { - - sceneGraph.userData.unitScaleFactor = fbxTree.GlobalSettings.UnitScaleFactor.value; - - } - - } - - } - -} - -// parse Geometry data from FBXTree and return map of BufferGeometries -class GeometryParser { - - constructor() { - - this.negativeMaterialIndices = false; - - } - - // Parse nodes in FBXTree.Objects.Geometry - parse( deformers ) { - - const geometryMap = new Map(); - - if ( 'Geometry' in fbxTree.Objects ) { - - const geoNodes = fbxTree.Objects.Geometry; - - for ( const nodeID in geoNodes ) { - - const relationships = connections.get( parseInt( nodeID ) ); - const geo = this.parseGeometry( relationships, geoNodes[ nodeID ], deformers ); - - geometryMap.set( parseInt( nodeID ), geo ); - - } - - } - - // report warnings - - if ( this.negativeMaterialIndices === true ) { - - console.warn( 'THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected.' ); - - } - - return geometryMap; - - } - - // Parse single node in FBXTree.Objects.Geometry - parseGeometry( relationships, geoNode, deformers ) { - - switch ( geoNode.attrType ) { - - case 'Mesh': - return this.parseMeshGeometry( relationships, geoNode, deformers ); - break; - - case 'NurbsCurve': - return this.parseNurbsGeometry( geoNode ); - break; - - } - - } - - // Parse single node mesh geometry in FBXTree.Objects.Geometry - parseMeshGeometry( relationships, geoNode, deformers ) { - - const skeletons = deformers.skeletons; - const morphTargets = []; - - const modelNodes = relationships.parents.map( function ( parent ) { - - return fbxTree.Objects.Model[ parent.ID ]; - - } ); - - // don't create geometry if it is not associated with any models - if ( modelNodes.length === 0 ) return; - - const skeleton = relationships.children.reduce( function ( skeleton, child ) { - - if ( skeletons[ child.ID ] !== undefined ) skeleton = skeletons[ child.ID ]; - - return skeleton; - - }, null ); - - relationships.children.forEach( function ( child ) { - - if ( deformers.morphTargets[ child.ID ] !== undefined ) { - - morphTargets.push( deformers.morphTargets[ child.ID ] ); - - } - - } ); - - // Assume one model and get the preRotation from that - // if there is more than one model associated with the geometry this may cause problems - const modelNode = modelNodes[ 0 ]; - - const transformData = {}; - - if ( 'RotationOrder' in modelNode ) transformData.eulerOrder = getEulerOrder( modelNode.RotationOrder.value ); - if ( 'InheritType' in modelNode ) transformData.inheritType = parseInt( modelNode.InheritType.value ); - - if ( 'GeometricTranslation' in modelNode ) transformData.translation = modelNode.GeometricTranslation.value; - if ( 'GeometricRotation' in modelNode ) transformData.rotation = modelNode.GeometricRotation.value; - if ( 'GeometricScaling' in modelNode ) transformData.scale = modelNode.GeometricScaling.value; - - const transform = generateTransform( transformData ); - - return this.genGeometry( geoNode, skeleton, morphTargets, transform ); - - } - - // Generate a BufferGeometry from a node in FBXTree.Objects.Geometry - genGeometry( geoNode, skeleton, morphTargets, preTransform ) { - - const geo = new BufferGeometry(); - if ( geoNode.attrName ) geo.name = geoNode.attrName; - - const geoInfo = this.parseGeoNode( geoNode, skeleton ); - const buffers = this.genBuffers( geoInfo ); - - const positionAttribute = new Float32BufferAttribute( buffers.vertex, 3 ); - - positionAttribute.applyMatrix4( preTransform ); - - geo.setAttribute( 'position', positionAttribute ); - - if ( buffers.colors.length > 0 ) { - - geo.setAttribute( 'color', new Float32BufferAttribute( buffers.colors, 3 ) ); - - } - - if ( skeleton ) { - - geo.setAttribute( 'skinIndex', new Uint16BufferAttribute( buffers.weightsIndices, 4 ) ); - - geo.setAttribute( 'skinWeight', new Float32BufferAttribute( buffers.vertexWeights, 4 ) ); - - // used later to bind the skeleton to the model - geo.FBX_Deformer = skeleton; - - } - - if ( buffers.normal.length > 0 ) { - - const normalMatrix = new Matrix3().getNormalMatrix( preTransform ); - - const normalAttribute = new Float32BufferAttribute( buffers.normal, 3 ); - normalAttribute.applyNormalMatrix( normalMatrix ); - - geo.setAttribute( 'normal', normalAttribute ); - - } - - buffers.uvs.forEach( function ( uvBuffer, i ) { - - const name = i === 0 ? 'uv' : `uv${ i }`; - - geo.setAttribute( name, new Float32BufferAttribute( buffers.uvs[ i ], 2 ) ); - - } ); - - if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) { - - // Convert the material indices of each vertex into rendering groups on the geometry. - let prevMaterialIndex = buffers.materialIndex[ 0 ]; - let startIndex = 0; - - buffers.materialIndex.forEach( function ( currentIndex, i ) { - - if ( currentIndex !== prevMaterialIndex ) { - - geo.addGroup( startIndex, i - startIndex, prevMaterialIndex ); - - prevMaterialIndex = currentIndex; - startIndex = i; - - } - - } ); - - // the loop above doesn't add the last group, do that here. - if ( geo.groups.length > 0 ) { - - const lastGroup = geo.groups[ geo.groups.length - 1 ]; - const lastIndex = lastGroup.start + lastGroup.count; - - if ( lastIndex !== buffers.materialIndex.length ) { - - geo.addGroup( lastIndex, buffers.materialIndex.length - lastIndex, prevMaterialIndex ); - - } - - } - - // case where there are multiple materials but the whole geometry is only - // using one of them - if ( geo.groups.length === 0 ) { - - geo.addGroup( 0, buffers.materialIndex.length, buffers.materialIndex[ 0 ] ); - - } - - } - - this.addMorphTargets( geo, geoNode, morphTargets, preTransform ); - - return geo; - - } - - parseGeoNode( geoNode, skeleton ) { - - const geoInfo = {}; - - geoInfo.vertexPositions = ( geoNode.Vertices !== undefined ) ? geoNode.Vertices.a : []; - geoInfo.vertexIndices = ( geoNode.PolygonVertexIndex !== undefined ) ? geoNode.PolygonVertexIndex.a : []; - - if ( geoNode.LayerElementColor ) { - - geoInfo.color = this.parseVertexColors( geoNode.LayerElementColor[ 0 ] ); - - } - - if ( geoNode.LayerElementMaterial ) { - - geoInfo.material = this.parseMaterialIndices( geoNode.LayerElementMaterial[ 0 ] ); - - } - - if ( geoNode.LayerElementNormal ) { - - geoInfo.normal = this.parseNormals( geoNode.LayerElementNormal[ 0 ] ); - - } - - if ( geoNode.LayerElementUV ) { - - geoInfo.uv = []; - - let i = 0; - while ( geoNode.LayerElementUV[ i ] ) { - - if ( geoNode.LayerElementUV[ i ].UV ) { - - geoInfo.uv.push( this.parseUVs( geoNode.LayerElementUV[ i ] ) ); - - } - - i ++; - - } - - } - - geoInfo.weightTable = {}; - - if ( skeleton !== null ) { - - geoInfo.skeleton = skeleton; - - skeleton.rawBones.forEach( function ( rawBone, i ) { - - // loop over the bone's vertex indices and weights - rawBone.indices.forEach( function ( index, j ) { - - if ( geoInfo.weightTable[ index ] === undefined ) geoInfo.weightTable[ index ] = []; - - geoInfo.weightTable[ index ].push( { - - id: i, - weight: rawBone.weights[ j ], - - } ); - - } ); - - } ); - - } - - return geoInfo; - - } - - genBuffers( geoInfo ) { - - const buffers = { - vertex: [], - normal: [], - colors: [], - uvs: [], - materialIndex: [], - vertexWeights: [], - weightsIndices: [], - }; - - let polygonIndex = 0; - let faceLength = 0; - let displayedWeightsWarning = false; - - // these will hold data for a single face - let facePositionIndexes = []; - let faceNormals = []; - let faceColors = []; - let faceUVs = []; - let faceWeights = []; - let faceWeightIndices = []; - - const scope = this; - geoInfo.vertexIndices.forEach( function ( vertexIndex, polygonVertexIndex ) { - - let materialIndex; - let endOfFace = false; - - // Face index and vertex index arrays are combined in a single array - // A cube with quad faces looks like this: - // PolygonVertexIndex: *24 { - // a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5 - // } - // Negative numbers mark the end of a face - first face here is 0, 1, 3, -3 - // to find index of last vertex bit shift the index: ^ - 1 - if ( vertexIndex < 0 ) { - - vertexIndex = vertexIndex ^ - 1; // equivalent to ( x * -1 ) - 1 - endOfFace = true; - - } - - let weightIndices = []; - let weights = []; - - facePositionIndexes.push( vertexIndex * 3, vertexIndex * 3 + 1, vertexIndex * 3 + 2 ); - - if ( geoInfo.color ) { - - const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.color ); - - faceColors.push( data[ 0 ], data[ 1 ], data[ 2 ] ); - - } - - if ( geoInfo.skeleton ) { - - if ( geoInfo.weightTable[ vertexIndex ] !== undefined ) { - - geoInfo.weightTable[ vertexIndex ].forEach( function ( wt ) { - - weights.push( wt.weight ); - weightIndices.push( wt.id ); - - } ); - - - } - - if ( weights.length > 4 ) { - - if ( ! displayedWeightsWarning ) { - - console.warn( 'THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights.' ); - displayedWeightsWarning = true; - - } - - const wIndex = [ 0, 0, 0, 0 ]; - const Weight = [ 0, 0, 0, 0 ]; - - weights.forEach( function ( weight, weightIndex ) { - - let currentWeight = weight; - let currentIndex = weightIndices[ weightIndex ]; - - Weight.forEach( function ( comparedWeight, comparedWeightIndex, comparedWeightArray ) { - - if ( currentWeight > comparedWeight ) { - - comparedWeightArray[ comparedWeightIndex ] = currentWeight; - currentWeight = comparedWeight; - - const tmp = wIndex[ comparedWeightIndex ]; - wIndex[ comparedWeightIndex ] = currentIndex; - currentIndex = tmp; - - } - - } ); - - } ); - - weightIndices = wIndex; - weights = Weight; - - } - - // if the weight array is shorter than 4 pad with 0s - while ( weights.length < 4 ) { - - weights.push( 0 ); - weightIndices.push( 0 ); - - } - - for ( let i = 0; i < 4; ++ i ) { - - faceWeights.push( weights[ i ] ); - faceWeightIndices.push( weightIndices[ i ] ); - - } - - } - - if ( geoInfo.normal ) { - - const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.normal ); - - faceNormals.push( data[ 0 ], data[ 1 ], data[ 2 ] ); - - } - - if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) { - - materialIndex = getData( polygonVertexIndex, polygonIndex, vertexIndex, geoInfo.material )[ 0 ]; - - if ( materialIndex < 0 ) { - - scope.negativeMaterialIndices = true; - materialIndex = 0; // fallback - - } - - } - - if ( geoInfo.uv ) { - - geoInfo.uv.forEach( function ( uv, i ) { - - const data = getData( polygonVertexIndex, polygonIndex, vertexIndex, uv ); - - if ( faceUVs[ i ] === undefined ) { - - faceUVs[ i ] = []; - - } - - faceUVs[ i ].push( data[ 0 ] ); - faceUVs[ i ].push( data[ 1 ] ); - - } ); - - } - - faceLength ++; - - if ( endOfFace ) { - - scope.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength ); - - polygonIndex ++; - faceLength = 0; - - // reset arrays for the next face - facePositionIndexes = []; - faceNormals = []; - faceColors = []; - faceUVs = []; - faceWeights = []; - faceWeightIndices = []; - - } - - } ); - - return buffers; - - } - - // See https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal - getNormalNewell( vertices ) { - - const normal = new Vector3( 0.0, 0.0, 0.0 ); - - for ( let i = 0; i < vertices.length; i ++ ) { - - const current = vertices[ i ]; - const next = vertices[ ( i + 1 ) % vertices.length ]; - - normal.x += ( current.y - next.y ) * ( current.z + next.z ); - normal.y += ( current.z - next.z ) * ( current.x + next.x ); - normal.z += ( current.x - next.x ) * ( current.y + next.y ); - - } - - normal.normalize(); - - return normal; - - } - - getNormalTangentAndBitangent( vertices ) { - - const normalVector = this.getNormalNewell( vertices ); - // Avoid up being equal or almost equal to normalVector - const up = Math.abs( normalVector.z ) > 0.5 ? new Vector3( 0.0, 1.0, 0.0 ) : new Vector3( 0.0, 0.0, 1.0 ); - const tangent = up.cross( normalVector ).normalize(); - const bitangent = normalVector.clone().cross( tangent ).normalize(); - - return { - normal: normalVector, - tangent: tangent, - bitangent: bitangent - }; - - } - - flattenVertex( vertex, normalTangent, normalBitangent ) { - - return new Vector2( - vertex.dot( normalTangent ), - vertex.dot( normalBitangent ) - ); - - } - - // Generate data for a single face in a geometry. If the face is a quad then split it into 2 tris - genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength ) { - - let triangles; - - if ( faceLength > 3 ) { - - // Triangulate n-gon using earcut - - const vertices = []; - // in morphing scenario vertexPositions represent morphPositions - // while baseVertexPositions represent the original geometry's positions - const positions = geoInfo.baseVertexPositions || geoInfo.vertexPositions; - for ( let i = 0; i < facePositionIndexes.length; i += 3 ) { - - vertices.push( - new Vector3( - positions[ facePositionIndexes[ i ] ], - positions[ facePositionIndexes[ i + 1 ] ], - positions[ facePositionIndexes[ i + 2 ] ] - ) - ); - - } - - const { tangent, bitangent } = this.getNormalTangentAndBitangent( vertices ); - const triangulationInput = []; - - for ( const vertex of vertices ) { - - triangulationInput.push( this.flattenVertex( vertex, tangent, bitangent ) ); - - } - - // When vertices is an array of [0,0,0] elements (which is the case for vertices not participating in morph) - // the triangulationInput will be an array of [0,0] elements - // resulting in an array of 0 triangles being returned from ShapeUtils.triangulateShape - // leading to not pushing into buffers.vertex the redundant vertices (the vertices that are not morphed). - // That's why, in order to support morphing scenario, "positions" is looking first for baseVertexPositions, - // so that we don't end up with an array of 0 triangles for the faces not participating in morph. - triangles = ShapeUtils.triangulateShape( triangulationInput, [] ); - - } else { - - // Regular triangle, skip earcut triangulation step - triangles = [[ 0, 1, 2 ]]; - - } - - for ( const [ i0, i1, i2 ] of triangles ) { - - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 + 1 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i0 * 3 + 2 ] ] ); - - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 + 1 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i1 * 3 + 2 ] ] ); - - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 + 1 ] ] ); - buffers.vertex.push( geoInfo.vertexPositions[ facePositionIndexes[ i2 * 3 + 2 ] ] ); - - if ( geoInfo.skeleton ) { - - buffers.vertexWeights.push( faceWeights[ i0 * 4 ] ); - buffers.vertexWeights.push( faceWeights[ i0 * 4 + 1 ] ); - buffers.vertexWeights.push( faceWeights[ i0 * 4 + 2 ] ); - buffers.vertexWeights.push( faceWeights[ i0 * 4 + 3 ] ); - - buffers.vertexWeights.push( faceWeights[ i1 * 4 ] ); - buffers.vertexWeights.push( faceWeights[ i1 * 4 + 1 ] ); - buffers.vertexWeights.push( faceWeights[ i1 * 4 + 2 ] ); - buffers.vertexWeights.push( faceWeights[ i1 * 4 + 3 ] ); - - buffers.vertexWeights.push( faceWeights[ i2 * 4 ] ); - buffers.vertexWeights.push( faceWeights[ i2 * 4 + 1 ] ); - buffers.vertexWeights.push( faceWeights[ i2 * 4 + 2 ] ); - buffers.vertexWeights.push( faceWeights[ i2 * 4 + 3 ] ); - - buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 1 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 2 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i0 * 4 + 3 ] ); - - buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 1 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 2 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i1 * 4 + 3 ] ); - - buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 1 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 2 ] ); - buffers.weightsIndices.push( faceWeightIndices[ i2 * 4 + 3 ] ); - - } - - if ( geoInfo.color ) { - - buffers.colors.push( faceColors[ i0 * 3 ] ); - buffers.colors.push( faceColors[ i0 * 3 + 1 ] ); - buffers.colors.push( faceColors[ i0 * 3 + 2 ] ); - - buffers.colors.push( faceColors[ i1 * 3 ] ); - buffers.colors.push( faceColors[ i1 * 3 + 1 ] ); - buffers.colors.push( faceColors[ i1 * 3 + 2 ] ); - - buffers.colors.push( faceColors[ i2 * 3 ] ); - buffers.colors.push( faceColors[ i2 * 3 + 1 ] ); - buffers.colors.push( faceColors[ i2 * 3 + 2 ] ); - - } - - if ( geoInfo.material && geoInfo.material.mappingType !== 'AllSame' ) { - - buffers.materialIndex.push( materialIndex ); - buffers.materialIndex.push( materialIndex ); - buffers.materialIndex.push( materialIndex ); - - } - - if ( geoInfo.normal ) { - - buffers.normal.push( faceNormals[ i0 * 3 ] ); - buffers.normal.push( faceNormals[ i0 * 3 + 1 ] ); - buffers.normal.push( faceNormals[ i0 * 3 + 2 ] ); - - buffers.normal.push( faceNormals[ i1 * 3 ] ); - buffers.normal.push( faceNormals[ i1 * 3 + 1 ] ); - buffers.normal.push( faceNormals[ i1 * 3 + 2 ] ); - - buffers.normal.push( faceNormals[ i2 * 3 ] ); - buffers.normal.push( faceNormals[ i2 * 3 + 1 ] ); - buffers.normal.push( faceNormals[ i2 * 3 + 2 ] ); - - } - - if ( geoInfo.uv ) { - - geoInfo.uv.forEach( function ( uv, j ) { - - if ( buffers.uvs[ j ] === undefined ) buffers.uvs[ j ] = []; - - buffers.uvs[ j ].push( faceUVs[ j ][ i0 * 2 ] ); - buffers.uvs[ j ].push( faceUVs[ j ][ i0 * 2 + 1 ] ); - - buffers.uvs[ j ].push( faceUVs[ j ][ i1 * 2 ] ); - buffers.uvs[ j ].push( faceUVs[ j ][ i1 * 2 + 1 ] ); - - buffers.uvs[ j ].push( faceUVs[ j ][ i2 * 2 ] ); - buffers.uvs[ j ].push( faceUVs[ j ][ i2 * 2 + 1 ] ); - - } ); - - } - - } - - } - - addMorphTargets( parentGeo, parentGeoNode, morphTargets, preTransform ) { - - if ( morphTargets.length === 0 ) return; - - parentGeo.morphTargetsRelative = true; - - parentGeo.morphAttributes.position = []; - // parentGeo.morphAttributes.normal = []; // not implemented - - const scope = this; - morphTargets.forEach( function ( morphTarget ) { - - morphTarget.rawTargets.forEach( function ( rawTarget ) { - - const morphGeoNode = fbxTree.Objects.Geometry[ rawTarget.geoID ]; - - if ( morphGeoNode !== undefined ) { - - scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name ); - - } - - } ); - - } ); - - } - - // a morph geometry node is similar to a standard node, and the node is also contained - // in FBXTree.Objects.Geometry, however it can only have attributes for position, normal - // and a special attribute Index defining which vertices of the original geometry are affected - // Normal and position attributes only have data for the vertices that are affected by the morph - genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, name ) { - - const basePositions = parentGeoNode.Vertices !== undefined ? parentGeoNode.Vertices.a : []; - const baseIndices = parentGeoNode.PolygonVertexIndex !== undefined ? parentGeoNode.PolygonVertexIndex.a : []; - - const morphPositionsSparse = morphGeoNode.Vertices !== undefined ? morphGeoNode.Vertices.a : []; - const morphIndices = morphGeoNode.Indexes !== undefined ? morphGeoNode.Indexes.a : []; - - const length = parentGeo.attributes.position.count * 3; - const morphPositions = new Float32Array( length ); - - for ( let i = 0; i < morphIndices.length; i ++ ) { - - const morphIndex = morphIndices[ i ] * 3; - - morphPositions[ morphIndex ] = morphPositionsSparse[ i * 3 ]; - morphPositions[ morphIndex + 1 ] = morphPositionsSparse[ i * 3 + 1 ]; - morphPositions[ morphIndex + 2 ] = morphPositionsSparse[ i * 3 + 2 ]; - - } - - // TODO: add morph normal support - const morphGeoInfo = { - vertexIndices: baseIndices, - vertexPositions: morphPositions, - baseVertexPositions: basePositions - }; - - const morphBuffers = this.genBuffers( morphGeoInfo ); - - const positionAttribute = new Float32BufferAttribute( morphBuffers.vertex, 3 ); - positionAttribute.name = name || morphGeoNode.attrName; - - positionAttribute.applyMatrix4( preTransform ); - - parentGeo.morphAttributes.position.push( positionAttribute ); - - } - - // Parse normal from FBXTree.Objects.Geometry.LayerElementNormal if it exists - parseNormals( NormalNode ) { - - const mappingType = NormalNode.MappingInformationType; - const referenceType = NormalNode.ReferenceInformationType; - const buffer = NormalNode.Normals.a; - let indexBuffer = []; - if ( referenceType === 'IndexToDirect' ) { - - if ( 'NormalIndex' in NormalNode ) { - - indexBuffer = NormalNode.NormalIndex.a; - - } else if ( 'NormalsIndex' in NormalNode ) { - - indexBuffer = NormalNode.NormalsIndex.a; - - } - - } - - return { - dataSize: 3, - buffer: buffer, - indices: indexBuffer, - mappingType: mappingType, - referenceType: referenceType - }; - - } - - // Parse UVs from FBXTree.Objects.Geometry.LayerElementUV if it exists - parseUVs( UVNode ) { - - const mappingType = UVNode.MappingInformationType; - const referenceType = UVNode.ReferenceInformationType; - const buffer = UVNode.UV.a; - let indexBuffer = []; - if ( referenceType === 'IndexToDirect' ) { - - indexBuffer = UVNode.UVIndex.a; - - } - - return { - dataSize: 2, - buffer: buffer, - indices: indexBuffer, - mappingType: mappingType, - referenceType: referenceType - }; - - } - - // Parse Vertex Colors from FBXTree.Objects.Geometry.LayerElementColor if it exists - parseVertexColors( ColorNode ) { - - const mappingType = ColorNode.MappingInformationType; - const referenceType = ColorNode.ReferenceInformationType; - const buffer = ColorNode.Colors.a; - let indexBuffer = []; - if ( referenceType === 'IndexToDirect' ) { - - indexBuffer = ColorNode.ColorIndex.a; - - } - - for ( let i = 0, c = new Color(); i < buffer.length; i += 4 ) { - - c.fromArray( buffer, i ).convertSRGBToLinear().toArray( buffer, i ); - - } - - return { - dataSize: 4, - buffer: buffer, - indices: indexBuffer, - mappingType: mappingType, - referenceType: referenceType - }; - - } - - // Parse mapping and material data in FBXTree.Objects.Geometry.LayerElementMaterial if it exists - parseMaterialIndices( MaterialNode ) { - - const mappingType = MaterialNode.MappingInformationType; - const referenceType = MaterialNode.ReferenceInformationType; - - if ( mappingType === 'NoMappingInformation' ) { - - return { - dataSize: 1, - buffer: [ 0 ], - indices: [ 0 ], - mappingType: 'AllSame', - referenceType: referenceType - }; - - } - - const materialIndexBuffer = MaterialNode.Materials.a; - - // Since materials are stored as indices, there's a bit of a mismatch between FBX and what - // we expect.So we create an intermediate buffer that points to the index in the buffer, - // for conforming with the other functions we've written for other data. - const materialIndices = []; - - for ( let i = 0; i < materialIndexBuffer.length; ++ i ) { - - materialIndices.push( i ); - - } - - return { - dataSize: 1, - buffer: materialIndexBuffer, - indices: materialIndices, - mappingType: mappingType, - referenceType: referenceType - }; - - } - - // Generate a NurbGeometry from a node in FBXTree.Objects.Geometry - parseNurbsGeometry( geoNode ) { - - const order = parseInt( geoNode.Order ); - - if ( isNaN( order ) ) { - - console.error( 'THREE.FBXLoader: Invalid Order %s given for geometry ID: %s', geoNode.Order, geoNode.id ); - return new BufferGeometry(); - - } - - const degree = order - 1; - - const knots = geoNode.KnotVector.a; - const controlPoints = []; - const pointsValues = geoNode.Points.a; - - for ( let i = 0, l = pointsValues.length; i < l; i += 4 ) { - - controlPoints.push( new Vector4().fromArray( pointsValues, i ) ); - - } - - let startKnot, endKnot; - - if ( geoNode.Form === 'Closed' ) { - - controlPoints.push( controlPoints[ 0 ] ); - - } else if ( geoNode.Form === 'Periodic' ) { - - startKnot = degree; - endKnot = knots.length - 1 - startKnot; - - for ( let i = 0; i < degree; ++ i ) { - - controlPoints.push( controlPoints[ i ] ); - - } - - } - - const curve = new NURBSCurve( degree, knots, controlPoints, startKnot, endKnot ); - const points = curve.getPoints( controlPoints.length * 12 ); - - return new BufferGeometry().setFromPoints( points ); - - } - -} - -// parse animation data from FBXTree -class AnimationParser { - - // take raw animation clips and turn them into three.js animation clips - parse() { - - const animationClips = []; - - const rawClips = this.parseClips(); - - if ( rawClips !== undefined ) { - - for ( const key in rawClips ) { - - const rawClip = rawClips[ key ]; - - const clip = this.addClip( rawClip ); - - animationClips.push( clip ); - - } - - } - - return animationClips; - - } - - parseClips() { - - // since the actual transformation data is stored in FBXTree.Objects.AnimationCurve, - // if this is undefined we can safely assume there are no animations - if ( fbxTree.Objects.AnimationCurve === undefined ) return undefined; - - const curveNodesMap = this.parseAnimationCurveNodes(); - - this.parseAnimationCurves( curveNodesMap ); - - const layersMap = this.parseAnimationLayers( curveNodesMap ); - const rawClips = this.parseAnimStacks( layersMap ); - - return rawClips; - - } - - // parse nodes in FBXTree.Objects.AnimationCurveNode - // each AnimationCurveNode holds data for an animation transform for a model (e.g. left arm rotation ) - // and is referenced by an AnimationLayer - parseAnimationCurveNodes() { - - const rawCurveNodes = fbxTree.Objects.AnimationCurveNode; - - const curveNodesMap = new Map(); - - for ( const nodeID in rawCurveNodes ) { - - const rawCurveNode = rawCurveNodes[ nodeID ]; - - if ( rawCurveNode.attrName.match( /S|R|T|DeformPercent/ ) !== null ) { - - const curveNode = { - - id: rawCurveNode.id, - attr: rawCurveNode.attrName, - curves: {}, - - }; - - curveNodesMap.set( curveNode.id, curveNode ); - - } - - } - - return curveNodesMap; - - } - - // parse nodes in FBXTree.Objects.AnimationCurve and connect them up to - // previously parsed AnimationCurveNodes. Each AnimationCurve holds data for a single animated - // axis ( e.g. times and values of x rotation) - parseAnimationCurves( curveNodesMap ) { - - const rawCurves = fbxTree.Objects.AnimationCurve; - - // TODO: Many values are identical up to roundoff error, but won't be optimised - // e.g. position times: [0, 0.4, 0. 8] - // position values: [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.23538335023477e-7, 93.67518615722656, -0.9982695579528809, 7.235384487103147e-7, 93.67520904541016, -0.9982695579528809] - // clearly, this should be optimised to - // times: [0], positions [7.23538335023477e-7, 93.67518615722656, -0.9982695579528809] - // this shows up in nearly every FBX file, and generally time array is length > 100 - - for ( const nodeID in rawCurves ) { - - const animationCurve = { - - id: rawCurves[ nodeID ].id, - times: rawCurves[ nodeID ].KeyTime.a.map( convertFBXTimeToSeconds ), - values: rawCurves[ nodeID ].KeyValueFloat.a, - - }; - - const relationships = connections.get( animationCurve.id ); - - if ( relationships !== undefined ) { - - const animationCurveID = relationships.parents[ 0 ].ID; - const animationCurveRelationship = relationships.parents[ 0 ].relationship; - - if ( animationCurveRelationship.match( /X/ ) ) { - - curveNodesMap.get( animationCurveID ).curves[ 'x' ] = animationCurve; - - } else if ( animationCurveRelationship.match( /Y/ ) ) { - - curveNodesMap.get( animationCurveID ).curves[ 'y' ] = animationCurve; - - } else if ( animationCurveRelationship.match( /Z/ ) ) { - - curveNodesMap.get( animationCurveID ).curves[ 'z' ] = animationCurve; - - } else if ( animationCurveRelationship.match( /DeformPercent/ ) && curveNodesMap.has( animationCurveID ) ) { - - curveNodesMap.get( animationCurveID ).curves[ 'morph' ] = animationCurve; - - } - - } - - } - - } - - // parse nodes in FBXTree.Objects.AnimationLayer. Each layers holds references - // to various AnimationCurveNodes and is referenced by an AnimationStack node - // note: theoretically a stack can have multiple layers, however in practice there always seems to be one per stack - parseAnimationLayers( curveNodesMap ) { - - const rawLayers = fbxTree.Objects.AnimationLayer; - - const layersMap = new Map(); - - for ( const nodeID in rawLayers ) { - - const layerCurveNodes = []; - - const connection = connections.get( parseInt( nodeID ) ); - - if ( connection !== undefined ) { - - // all the animationCurveNodes used in the layer - const children = connection.children; - - children.forEach( function ( child, i ) { - - if ( curveNodesMap.has( child.ID ) ) { - - const curveNode = curveNodesMap.get( child.ID ); - - // check that the curves are defined for at least one axis, otherwise ignore the curveNode - if ( curveNode.curves.x !== undefined || curveNode.curves.y !== undefined || curveNode.curves.z !== undefined ) { - - if ( layerCurveNodes[ i ] === undefined ) { - - const modelID = connections.get( child.ID ).parents.filter( function ( parent ) { - - return parent.relationship !== undefined; - - } )[ 0 ].ID; - - if ( modelID !== undefined ) { - - const rawModel = fbxTree.Objects.Model[ modelID.toString() ]; - - if ( rawModel === undefined ) { - - console.warn( 'THREE.FBXLoader: Encountered a unused curve.', child ); - return; - - } - - const node = { - - modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '', - ID: rawModel.id, - initialPosition: [ 0, 0, 0 ], - initialRotation: [ 0, 0, 0 ], - initialScale: [ 1, 1, 1 ], - - }; - - sceneGraph.traverse( function ( child ) { - - if ( child.ID === rawModel.id ) { - - node.transform = child.matrix; - - if ( child.userData.transformData ) node.eulerOrder = child.userData.transformData.eulerOrder; - - } - - } ); - - if ( ! node.transform ) node.transform = new Matrix4(); - - // if the animated model is pre rotated, we'll have to apply the pre rotations to every - // animation value as well - if ( 'PreRotation' in rawModel ) node.preRotation = rawModel.PreRotation.value; - if ( 'PostRotation' in rawModel ) node.postRotation = rawModel.PostRotation.value; - - layerCurveNodes[ i ] = node; - - } - - } - - if ( layerCurveNodes[ i ] ) layerCurveNodes[ i ][ curveNode.attr ] = curveNode; - - } else if ( curveNode.curves.morph !== undefined ) { - - if ( layerCurveNodes[ i ] === undefined ) { - - const deformerID = connections.get( child.ID ).parents.filter( function ( parent ) { - - return parent.relationship !== undefined; - - } )[ 0 ].ID; - - const morpherID = connections.get( deformerID ).parents[ 0 ].ID; - const geoID = connections.get( morpherID ).parents[ 0 ].ID; - - // assuming geometry is not used in more than one model - const modelID = connections.get( geoID ).parents[ 0 ].ID; - - const rawModel = fbxTree.Objects.Model[ modelID ]; - - const node = { - - modelName: rawModel.attrName ? PropertyBinding.sanitizeNodeName( rawModel.attrName ) : '', - morphName: fbxTree.Objects.Deformer[ deformerID ].attrName, - - }; - - layerCurveNodes[ i ] = node; - - } - - layerCurveNodes[ i ][ curveNode.attr ] = curveNode; - - } - - } - - } ); - - layersMap.set( parseInt( nodeID ), layerCurveNodes ); - - } - - } - - return layersMap; - - } - - // parse nodes in FBXTree.Objects.AnimationStack. These are the top level node in the animation - // hierarchy. Each Stack node will be used to create a AnimationClip - parseAnimStacks( layersMap ) { - - const rawStacks = fbxTree.Objects.AnimationStack; - - // connect the stacks (clips) up to the layers - const rawClips = {}; - - for ( const nodeID in rawStacks ) { - - const children = connections.get( parseInt( nodeID ) ).children; - - if ( children.length > 1 ) { - - // it seems like stacks will always be associated with a single layer. But just in case there are files - // where there are multiple layers per stack, we'll display a warning - console.warn( 'THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.' ); - - } - - const layer = layersMap.get( children[ 0 ].ID ); - - rawClips[ nodeID ] = { - - name: rawStacks[ nodeID ].attrName, - layer: layer, - - }; - - } - - return rawClips; - - } - - addClip( rawClip ) { - - let tracks = []; - - const scope = this; - rawClip.layer.forEach( function ( rawTracks ) { - - tracks = tracks.concat( scope.generateTracks( rawTracks ) ); - - } ); - - return new AnimationClip( rawClip.name, - 1, tracks ); - - } - - generateTracks( rawTracks ) { - - const tracks = []; - - let initialPosition = new Vector3(); - let initialScale = new Vector3(); - - if ( rawTracks.transform ) rawTracks.transform.decompose( initialPosition, new Quaternion(), initialScale ); - - initialPosition = initialPosition.toArray(); - initialScale = initialScale.toArray(); - - if ( rawTracks.T !== undefined && Object.keys( rawTracks.T.curves ).length > 0 ) { - - const positionTrack = this.generateVectorTrack( rawTracks.modelName, rawTracks.T.curves, initialPosition, 'position' ); - if ( positionTrack !== undefined ) tracks.push( positionTrack ); - - } - - if ( rawTracks.R !== undefined && Object.keys( rawTracks.R.curves ).length > 0 ) { - - const rotationTrack = this.generateRotationTrack( rawTracks.modelName, rawTracks.R.curves, rawTracks.preRotation, rawTracks.postRotation, rawTracks.eulerOrder ); - if ( rotationTrack !== undefined ) tracks.push( rotationTrack ); - - } - - if ( rawTracks.S !== undefined && Object.keys( rawTracks.S.curves ).length > 0 ) { - - const scaleTrack = this.generateVectorTrack( rawTracks.modelName, rawTracks.S.curves, initialScale, 'scale' ); - if ( scaleTrack !== undefined ) tracks.push( scaleTrack ); - - } - - if ( rawTracks.DeformPercent !== undefined ) { - - const morphTrack = this.generateMorphTrack( rawTracks ); - if ( morphTrack !== undefined ) tracks.push( morphTrack ); - - } - - return tracks; - - } - - generateVectorTrack( modelName, curves, initialValue, type ) { - - const times = this.getTimesForAllAxes( curves ); - const values = this.getKeyframeTrackValues( times, curves, initialValue ); - - return new VectorKeyframeTrack( modelName + '.' + type, times, values ); - - } - - generateRotationTrack( modelName, curves, preRotation, postRotation, eulerOrder ) { - - let times; - let values; - - if ( curves.x !== undefined && curves.y !== undefined && curves.z !== undefined ) { - - const result = this.interpolateRotations( curves.x, curves.y, curves.z, eulerOrder ); - - times = result[ 0 ]; - values = result[ 1 ]; - - } - - if ( preRotation !== undefined ) { - - preRotation = preRotation.map( MathUtils.degToRad ); - preRotation.push( eulerOrder ); - - preRotation = new Euler().fromArray( preRotation ); - preRotation = new Quaternion().setFromEuler( preRotation ); - - } - - if ( postRotation !== undefined ) { - - postRotation = postRotation.map( MathUtils.degToRad ); - postRotation.push( eulerOrder ); - - postRotation = new Euler().fromArray( postRotation ); - postRotation = new Quaternion().setFromEuler( postRotation ).invert(); - - } - - const quaternion = new Quaternion(); - const euler = new Euler(); - - const quaternionValues = []; - - if ( ! values || ! times ) return new QuaternionKeyframeTrack( modelName + '.quaternion', [ 0 ], [ 0 ] ); - - for ( let i = 0; i < values.length; i += 3 ) { - - euler.set( values[ i ], values[ i + 1 ], values[ i + 2 ], eulerOrder ); - quaternion.setFromEuler( euler ); - - if ( preRotation !== undefined ) quaternion.premultiply( preRotation ); - if ( postRotation !== undefined ) quaternion.multiply( postRotation ); - - // Check unroll - if ( i > 2 ) { - - const prevQuat = new Quaternion().fromArray( - quaternionValues, - ( ( i - 3 ) / 3 ) * 4 - ); - - if ( prevQuat.dot( quaternion ) < 0 ) { - - quaternion.set( - quaternion.x, - quaternion.y, - quaternion.z, - quaternion.w ); - - } - - } - - quaternion.toArray( quaternionValues, ( i / 3 ) * 4 ); - - } - - return new QuaternionKeyframeTrack( modelName + '.quaternion', times, quaternionValues ); - - } - - generateMorphTrack( rawTracks ) { - - const curves = rawTracks.DeformPercent.curves.morph; - const values = curves.values.map( function ( val ) { - - return val / 100; - - } ); - - const morphNum = sceneGraph.getObjectByName( rawTracks.modelName ).morphTargetDictionary[ rawTracks.morphName ]; - - return new NumberKeyframeTrack( rawTracks.modelName + '.morphTargetInfluences[' + morphNum + ']', curves.times, values ); - - } - - // For all animated objects, times are defined separately for each axis - // Here we'll combine the times into one sorted array without duplicates - getTimesForAllAxes( curves ) { - - let times = []; - - // first join together the times for each axis, if defined - if ( curves.x !== undefined ) times = times.concat( curves.x.times ); - if ( curves.y !== undefined ) times = times.concat( curves.y.times ); - if ( curves.z !== undefined ) times = times.concat( curves.z.times ); - - // then sort them - times = times.sort( function ( a, b ) { - - return a - b; - - } ); - - // and remove duplicates - if ( times.length > 1 ) { - - let targetIndex = 1; - let lastValue = times[ 0 ]; - for ( let i = 1; i < times.length; i ++ ) { - - const currentValue = times[ i ]; - if ( currentValue !== lastValue ) { - - times[ targetIndex ] = currentValue; - lastValue = currentValue; - targetIndex ++; - - } - - } - - times = times.slice( 0, targetIndex ); - - } - - return times; - - } - - getKeyframeTrackValues( times, curves, initialValue ) { - - const prevValue = initialValue; - - const values = []; - - let xIndex = - 1; - let yIndex = - 1; - let zIndex = - 1; - - times.forEach( function ( time ) { - - if ( curves.x ) xIndex = curves.x.times.indexOf( time ); - if ( curves.y ) yIndex = curves.y.times.indexOf( time ); - if ( curves.z ) zIndex = curves.z.times.indexOf( time ); - - // if there is an x value defined for this frame, use that - if ( xIndex !== - 1 ) { - - const xValue = curves.x.values[ xIndex ]; - values.push( xValue ); - prevValue[ 0 ] = xValue; - - } else { - - // otherwise use the x value from the previous frame - values.push( prevValue[ 0 ] ); - - } - - if ( yIndex !== - 1 ) { - - const yValue = curves.y.values[ yIndex ]; - values.push( yValue ); - prevValue[ 1 ] = yValue; - - } else { - - values.push( prevValue[ 1 ] ); - - } - - if ( zIndex !== - 1 ) { - - const zValue = curves.z.values[ zIndex ]; - values.push( zValue ); - prevValue[ 2 ] = zValue; - - } else { - - values.push( prevValue[ 2 ] ); - - } - - } ); - - return values; - - } - - // Rotations are defined as Euler angles which can have values of any size - // These will be converted to quaternions which don't support values greater than - // PI, so we'll interpolate large rotations - interpolateRotations( curvex, curvey, curvez, eulerOrder ) { - - const times = []; - const values = []; - - // Add first frame - times.push( curvex.times[ 0 ] ); - values.push( MathUtils.degToRad( curvex.values[ 0 ] ) ); - values.push( MathUtils.degToRad( curvey.values[ 0 ] ) ); - values.push( MathUtils.degToRad( curvez.values[ 0 ] ) ); - - for ( let i = 1; i < curvex.values.length; i ++ ) { - - const initialValue = [ - curvex.values[ i - 1 ], - curvey.values[ i - 1 ], - curvez.values[ i - 1 ], - ]; - - if ( isNaN( initialValue[ 0 ] ) || isNaN( initialValue[ 1 ] ) || isNaN( initialValue[ 2 ] ) ) { - - continue; - - } - - const initialValueRad = initialValue.map( MathUtils.degToRad ); - - const currentValue = [ - curvex.values[ i ], - curvey.values[ i ], - curvez.values[ i ], - ]; - - if ( isNaN( currentValue[ 0 ] ) || isNaN( currentValue[ 1 ] ) || isNaN( currentValue[ 2 ] ) ) { - - continue; - - } - - const currentValueRad = currentValue.map( MathUtils.degToRad ); - - const valuesSpan = [ - currentValue[ 0 ] - initialValue[ 0 ], - currentValue[ 1 ] - initialValue[ 1 ], - currentValue[ 2 ] - initialValue[ 2 ], - ]; - - const absoluteSpan = [ - Math.abs( valuesSpan[ 0 ] ), - Math.abs( valuesSpan[ 1 ] ), - Math.abs( valuesSpan[ 2 ] ), - ]; - - if ( absoluteSpan[ 0 ] >= 180 || absoluteSpan[ 1 ] >= 180 || absoluteSpan[ 2 ] >= 180 ) { - - const maxAbsSpan = Math.max( ...absoluteSpan ); - - const numSubIntervals = maxAbsSpan / 180; - - const E1 = new Euler( ...initialValueRad, eulerOrder ); - const E2 = new Euler( ...currentValueRad, eulerOrder ); - - const Q1 = new Quaternion().setFromEuler( E1 ); - const Q2 = new Quaternion().setFromEuler( E2 ); - - // Check unroll - if ( Q1.dot( Q2 ) ) { - - Q2.set( - Q2.x, - Q2.y, - Q2.z, - Q2.w ); - - } - - // Interpolate - const initialTime = curvex.times[ i - 1 ]; - const timeSpan = curvex.times[ i ] - initialTime; - - const Q = new Quaternion(); - const E = new Euler(); - for ( let t = 0; t < 1; t += 1 / numSubIntervals ) { - - Q.copy( Q1.clone().slerp( Q2.clone(), t ) ); - - times.push( initialTime + t * timeSpan ); - E.setFromQuaternion( Q, eulerOrder ); - - values.push( E.x ); - values.push( E.y ); - values.push( E.z ); - - } - - } else { - - times.push( curvex.times[ i ] ); - values.push( MathUtils.degToRad( curvex.values[ i ] ) ); - values.push( MathUtils.degToRad( curvey.values[ i ] ) ); - values.push( MathUtils.degToRad( curvez.values[ i ] ) ); - - } - - } - - return [ times, values ]; - - } - -} - -// parse an FBX file in ASCII format -class TextParser { - - getPrevNode() { - - return this.nodeStack[ this.currentIndent - 2 ]; - - } - - getCurrentNode() { - - return this.nodeStack[ this.currentIndent - 1 ]; - - } - - getCurrentProp() { - - return this.currentProp; - - } - - pushStack( node ) { - - this.nodeStack.push( node ); - this.currentIndent += 1; - - } - - popStack() { - - this.nodeStack.pop(); - this.currentIndent -= 1; - - } - - setCurrentProp( val, name ) { - - this.currentProp = val; - this.currentPropName = name; - - } - - parse( text ) { - - this.currentIndent = 0; - - this.allNodes = new FBXTree(); - this.nodeStack = []; - this.currentProp = []; - this.currentPropName = ''; - - const scope = this; - - const split = text.split( /[\r\n]+/ ); - - split.forEach( function ( line, i ) { - - const matchComment = line.match( /^[\s\t]*;/ ); - const matchEmpty = line.match( /^[\s\t]*$/ ); - - if ( matchComment || matchEmpty ) return; - - const matchBeginning = line.match( '^\\t{' + scope.currentIndent + '}(\\w+):(.*){', '' ); - const matchProperty = line.match( '^\\t{' + ( scope.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' ); - const matchEnd = line.match( '^\\t{' + ( scope.currentIndent - 1 ) + '}}' ); - - if ( matchBeginning ) { - - scope.parseNodeBegin( line, matchBeginning ); - - } else if ( matchProperty ) { - - scope.parseNodeProperty( line, matchProperty, split[ ++ i ] ); - - } else if ( matchEnd ) { - - scope.popStack(); - - } else if ( line.match( /^[^\s\t}]/ ) ) { - - // large arrays are split over multiple lines terminated with a ',' character - // if this is encountered the line needs to be joined to the previous line - scope.parseNodePropertyContinued( line ); - - } - - } ); - - return this.allNodes; - - } - - parseNodeBegin( line, property ) { - - const nodeName = property[ 1 ].trim().replace( /^"/, '' ).replace( /"$/, '' ); - - const nodeAttrs = property[ 2 ].split( ',' ).map( function ( attr ) { - - return attr.trim().replace( /^"/, '' ).replace( /"$/, '' ); - - } ); - - const node = { name: nodeName }; - const attrs = this.parseNodeAttr( nodeAttrs ); - - const currentNode = this.getCurrentNode(); - - // a top node - if ( this.currentIndent === 0 ) { - - this.allNodes.add( nodeName, node ); - - } else { // a subnode - - // if the subnode already exists, append it - if ( nodeName in currentNode ) { - - // special case Pose needs PoseNodes as an array - if ( nodeName === 'PoseNode' ) { - - currentNode.PoseNode.push( node ); - - } else if ( currentNode[ nodeName ].id !== undefined ) { - - currentNode[ nodeName ] = {}; - currentNode[ nodeName ][ currentNode[ nodeName ].id ] = currentNode[ nodeName ]; - - } - - if ( attrs.id !== '' ) currentNode[ nodeName ][ attrs.id ] = node; - - } else if ( typeof attrs.id === 'number' ) { - - currentNode[ nodeName ] = {}; - currentNode[ nodeName ][ attrs.id ] = node; - - } else if ( nodeName !== 'Properties70' ) { - - if ( nodeName === 'PoseNode' ) currentNode[ nodeName ] = [ node ]; - else currentNode[ nodeName ] = node; - - } - - } - - if ( typeof attrs.id === 'number' ) node.id = attrs.id; - if ( attrs.name !== '' ) node.attrName = attrs.name; - if ( attrs.type !== '' ) node.attrType = attrs.type; - - this.pushStack( node ); - - } - - parseNodeAttr( attrs ) { - - let id = attrs[ 0 ]; - - if ( attrs[ 0 ] !== '' ) { - - id = parseInt( attrs[ 0 ] ); - - if ( isNaN( id ) ) { - - id = attrs[ 0 ]; - - } - - } - - let name = '', type = ''; - - if ( attrs.length > 1 ) { - - name = attrs[ 1 ].replace( /^(\w+)::/, '' ); - type = attrs[ 2 ]; - - } - - return { id: id, name: name, type: type }; - - } - - parseNodeProperty( line, property, contentLine ) { - - let propName = property[ 1 ].replace( /^"/, '' ).replace( /"$/, '' ).trim(); - let propValue = property[ 2 ].replace( /^"/, '' ).replace( /"$/, '' ).trim(); - - // for special case: base64 image data follows "Content: ," line - // Content: , - // "/9j/4RDaRXhpZgAATU0A..." - if ( propName === 'Content' && propValue === ',' ) { - - propValue = contentLine.replace( /"/g, '' ).replace( /,$/, '' ).trim(); - - } - - const currentNode = this.getCurrentNode(); - const parentName = currentNode.name; - - if ( parentName === 'Properties70' ) { - - this.parseNodeSpecialProperty( line, propName, propValue ); - return; - - } - - // Connections - if ( propName === 'C' ) { - - const connProps = propValue.split( ',' ).slice( 1 ); - const from = parseInt( connProps[ 0 ] ); - const to = parseInt( connProps[ 1 ] ); - - let rest = propValue.split( ',' ).slice( 3 ); - - rest = rest.map( function ( elem ) { - - return elem.trim().replace( /^"/, '' ); - - } ); - - propName = 'connections'; - propValue = [ from, to ]; - append( propValue, rest ); - - if ( currentNode[ propName ] === undefined ) { - - currentNode[ propName ] = []; - - } - - } - - // Node - if ( propName === 'Node' ) currentNode.id = propValue; - - // connections - if ( propName in currentNode && Array.isArray( currentNode[ propName ] ) ) { - - currentNode[ propName ].push( propValue ); - - } else { - - if ( propName !== 'a' ) currentNode[ propName ] = propValue; - else currentNode.a = propValue; - - } - - this.setCurrentProp( currentNode, propName ); - - // convert string to array, unless it ends in ',' in which case more will be added to it - if ( propName === 'a' && propValue.slice( - 1 ) !== ',' ) { - - currentNode.a = parseNumberArray( propValue ); - - } - - } - - parseNodePropertyContinued( line ) { - - const currentNode = this.getCurrentNode(); - - currentNode.a += line; - - // if the line doesn't end in ',' we have reached the end of the property value - // so convert the string to an array - if ( line.slice( - 1 ) !== ',' ) { - - currentNode.a = parseNumberArray( currentNode.a ); - - } - - } - - // parse "Property70" - parseNodeSpecialProperty( line, propName, propValue ) { - - // split this - // P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1 - // into array like below - // ["Lcl Scaling", "Lcl Scaling", "", "A", "1,1,1" ] - const props = propValue.split( '",' ).map( function ( prop ) { - - return prop.trim().replace( /^\"/, '' ).replace( /\s/, '_' ); - - } ); - - const innerPropName = props[ 0 ]; - const innerPropType1 = props[ 1 ]; - const innerPropType2 = props[ 2 ]; - const innerPropFlag = props[ 3 ]; - let innerPropValue = props[ 4 ]; - - // cast values where needed, otherwise leave as strings - switch ( innerPropType1 ) { - - case 'int': - case 'enum': - case 'bool': - case 'ULongLong': - case 'double': - case 'Number': - case 'FieldOfView': - innerPropValue = parseFloat( innerPropValue ); - break; - - case 'Color': - case 'ColorRGB': - case 'Vector3D': - case 'Lcl_Translation': - case 'Lcl_Rotation': - case 'Lcl_Scaling': - innerPropValue = parseNumberArray( innerPropValue ); - break; - - } - - // CAUTION: these props must append to parent's parent - this.getPrevNode()[ innerPropName ] = { - - 'type': innerPropType1, - 'type2': innerPropType2, - 'flag': innerPropFlag, - 'value': innerPropValue - - }; - - this.setCurrentProp( this.getPrevNode(), innerPropName ); - - } - -} - -// Parse an FBX file in Binary format -class BinaryParser { - - parse( buffer ) { - - const reader = new BinaryReader( buffer ); - reader.skip( 23 ); // skip magic 23 bytes - - const version = reader.getUint32(); - - if ( version < 6400 ) { - - throw new Error( 'THREE.FBXLoader: FBX version not supported, FileVersion: ' + version ); - - } - - const allNodes = new FBXTree(); - - while ( ! this.endOfContent( reader ) ) { - - const node = this.parseNode( reader, version ); - if ( node !== null ) allNodes.add( node.name, node ); - - } - - return allNodes; - - } - - // Check if reader has reached the end of content. - endOfContent( reader ) { - - // footer size: 160bytes + 16-byte alignment padding - // - 16bytes: magic - // - padding til 16-byte alignment (at least 1byte?) - // (seems like some exporters embed fixed 15 or 16bytes?) - // - 4bytes: magic - // - 4bytes: version - // - 120bytes: zero - // - 16bytes: magic - if ( reader.size() % 16 === 0 ) { - - return ( ( reader.getOffset() + 160 + 16 ) & ~ 0xf ) >= reader.size(); - - } else { - - return reader.getOffset() + 160 + 16 >= reader.size(); - - } - - } - - // recursively parse nodes until the end of the file is reached - parseNode( reader, version ) { - - const node = {}; - - // The first three data sizes depends on version. - const endOffset = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); - const numProperties = ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); - - ( version >= 7500 ) ? reader.getUint64() : reader.getUint32(); // the returned propertyListLen is not used - - const nameLen = reader.getUint8(); - const name = reader.getString( nameLen ); - - // Regards this node as NULL-record if endOffset is zero - if ( endOffset === 0 ) return null; - - const propertyList = []; - - for ( let i = 0; i < numProperties; i ++ ) { - - propertyList.push( this.parseProperty( reader ) ); - - } - - // Regards the first three elements in propertyList as id, attrName, and attrType - const id = propertyList.length > 0 ? propertyList[ 0 ] : ''; - const attrName = propertyList.length > 1 ? propertyList[ 1 ] : ''; - const attrType = propertyList.length > 2 ? propertyList[ 2 ] : ''; - - // check if this node represents just a single property - // like (name, 0) set or (name2, [0, 1, 2]) set of {name: 0, name2: [0, 1, 2]} - node.singleProperty = ( numProperties === 1 && reader.getOffset() === endOffset ) ? true : false; - - while ( endOffset > reader.getOffset() ) { - - const subNode = this.parseNode( reader, version ); - - if ( subNode !== null ) this.parseSubNode( name, node, subNode ); - - } - - node.propertyList = propertyList; // raw property list used by parent - - if ( typeof id === 'number' ) node.id = id; - if ( attrName !== '' ) node.attrName = attrName; - if ( attrType !== '' ) node.attrType = attrType; - if ( name !== '' ) node.name = name; - - return node; - - } - - parseSubNode( name, node, subNode ) { - - // special case: child node is single property - if ( subNode.singleProperty === true ) { - - const value = subNode.propertyList[ 0 ]; - - if ( Array.isArray( value ) ) { - - node[ subNode.name ] = subNode; - - subNode.a = value; - - } else { - - node[ subNode.name ] = value; - - } - - } else if ( name === 'Connections' && subNode.name === 'C' ) { - - const array = []; - - subNode.propertyList.forEach( function ( property, i ) { - - // first Connection is FBX type (OO, OP, etc.). We'll discard these - if ( i !== 0 ) array.push( property ); - - } ); - - if ( node.connections === undefined ) { - - node.connections = []; - - } - - node.connections.push( array ); - - } else if ( subNode.name === 'Properties70' ) { - - const keys = Object.keys( subNode ); - - keys.forEach( function ( key ) { - - node[ key ] = subNode[ key ]; - - } ); - - } else if ( name === 'Properties70' && subNode.name === 'P' ) { - - let innerPropName = subNode.propertyList[ 0 ]; - let innerPropType1 = subNode.propertyList[ 1 ]; - const innerPropType2 = subNode.propertyList[ 2 ]; - const innerPropFlag = subNode.propertyList[ 3 ]; - let innerPropValue; - - if ( innerPropName.indexOf( 'Lcl ' ) === 0 ) innerPropName = innerPropName.replace( 'Lcl ', 'Lcl_' ); - if ( innerPropType1.indexOf( 'Lcl ' ) === 0 ) innerPropType1 = innerPropType1.replace( 'Lcl ', 'Lcl_' ); - - if ( innerPropType1 === 'Color' || innerPropType1 === 'ColorRGB' || innerPropType1 === 'Vector' || innerPropType1 === 'Vector3D' || innerPropType1.indexOf( 'Lcl_' ) === 0 ) { - - innerPropValue = [ - subNode.propertyList[ 4 ], - subNode.propertyList[ 5 ], - subNode.propertyList[ 6 ] - ]; - - } else { - - innerPropValue = subNode.propertyList[ 4 ]; - - } - - // this will be copied to parent, see above - node[ innerPropName ] = { - - 'type': innerPropType1, - 'type2': innerPropType2, - 'flag': innerPropFlag, - 'value': innerPropValue - - }; - - } else if ( node[ subNode.name ] === undefined ) { - - if ( typeof subNode.id === 'number' ) { - - node[ subNode.name ] = {}; - node[ subNode.name ][ subNode.id ] = subNode; - - } else { - - node[ subNode.name ] = subNode; - - } - - } else { - - if ( subNode.name === 'PoseNode' ) { - - if ( ! Array.isArray( node[ subNode.name ] ) ) { - - node[ subNode.name ] = [ node[ subNode.name ] ]; - - } - - node[ subNode.name ].push( subNode ); - - } else if ( node[ subNode.name ][ subNode.id ] === undefined ) { - - node[ subNode.name ][ subNode.id ] = subNode; - - } - - } - - } - - parseProperty( reader ) { - - const type = reader.getString( 1 ); - let length; - - switch ( type ) { - - case 'C': - return reader.getBoolean(); - - case 'D': - return reader.getFloat64(); - - case 'F': - return reader.getFloat32(); - - case 'I': - return reader.getInt32(); - - case 'L': - return reader.getInt64(); - - case 'R': - length = reader.getUint32(); - return reader.getArrayBuffer( length ); - - case 'S': - length = reader.getUint32(); - return reader.getString( length ); - - case 'Y': - return reader.getInt16(); - - case 'b': - case 'c': - case 'd': - case 'f': - case 'i': - case 'l': - - const arrayLength = reader.getUint32(); - const encoding = reader.getUint32(); // 0: non-compressed, 1: compressed - const compressedLength = reader.getUint32(); - - if ( encoding === 0 ) { - - switch ( type ) { - - case 'b': - case 'c': - return reader.getBooleanArray( arrayLength ); - - case 'd': - return reader.getFloat64Array( arrayLength ); - - case 'f': - return reader.getFloat32Array( arrayLength ); - - case 'i': - return reader.getInt32Array( arrayLength ); - - case 'l': - return reader.getInt64Array( arrayLength ); - - } - - } - - const data = fflate.unzlibSync( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) ); - const reader2 = new BinaryReader( data.buffer ); - - switch ( type ) { - - case 'b': - case 'c': - return reader2.getBooleanArray( arrayLength ); - - case 'd': - return reader2.getFloat64Array( arrayLength ); - - case 'f': - return reader2.getFloat32Array( arrayLength ); - - case 'i': - return reader2.getInt32Array( arrayLength ); - - case 'l': - return reader2.getInt64Array( arrayLength ); - - } - - break; // cannot happen but is required by the DeepScan - - default: - throw new Error( 'THREE.FBXLoader: Unknown property type ' + type ); - - } - - } - -} - -class BinaryReader { - - constructor( buffer, littleEndian ) { - - this.dv = new DataView( buffer ); - this.offset = 0; - this.littleEndian = ( littleEndian !== undefined ) ? littleEndian : true; - this._textDecoder = new TextDecoder(); - - } - - getOffset() { - - return this.offset; - - } - - size() { - - return this.dv.buffer.byteLength; - - } - - skip( length ) { - - this.offset += length; - - } - - // seems like true/false representation depends on exporter. - // true: 1 or 'Y'(=0x59), false: 0 or 'T'(=0x54) - // then sees LSB. - getBoolean() { - - return ( this.getUint8() & 1 ) === 1; - - } - - getBooleanArray( size ) { - - const a = []; - - for ( let i = 0; i < size; i ++ ) { - - a.push( this.getBoolean() ); - - } - - return a; - - } - - getUint8() { - - const value = this.dv.getUint8( this.offset ); - this.offset += 1; - return value; - - } - - getInt16() { - - const value = this.dv.getInt16( this.offset, this.littleEndian ); - this.offset += 2; - return value; - - } - - getInt32() { - - const value = this.dv.getInt32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - } - - getInt32Array( size ) { - - const a = []; - - for ( let i = 0; i < size; i ++ ) { - - a.push( this.getInt32() ); - - } - - return a; - - } - - getUint32() { - - const value = this.dv.getUint32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - } - - // JavaScript doesn't support 64-bit integer so calculate this here - // 1 << 32 will return 1 so using multiply operation instead here. - // There's a possibility that this method returns wrong value if the value - // is out of the range between Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER. - // TODO: safely handle 64-bit integer - getInt64() { - - let low, high; - - if ( this.littleEndian ) { - - low = this.getUint32(); - high = this.getUint32(); - - } else { - - high = this.getUint32(); - low = this.getUint32(); - - } - - // calculate negative value - if ( high & 0x80000000 ) { - - high = ~ high & 0xFFFFFFFF; - low = ~ low & 0xFFFFFFFF; - - if ( low === 0xFFFFFFFF ) high = ( high + 1 ) & 0xFFFFFFFF; - - low = ( low + 1 ) & 0xFFFFFFFF; - - return - ( high * 0x100000000 + low ); - - } - - return high * 0x100000000 + low; - - } - - getInt64Array( size ) { - - const a = []; - - for ( let i = 0; i < size; i ++ ) { - - a.push( this.getInt64() ); - - } - - return a; - - } - - // Note: see getInt64() comment - getUint64() { - - let low, high; - - if ( this.littleEndian ) { - - low = this.getUint32(); - high = this.getUint32(); - - } else { - - high = this.getUint32(); - low = this.getUint32(); - - } - - return high * 0x100000000 + low; - - } - - getFloat32() { - - const value = this.dv.getFloat32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - } - - getFloat32Array( size ) { - - const a = []; - - for ( let i = 0; i < size; i ++ ) { - - a.push( this.getFloat32() ); - - } - - return a; - - } - - getFloat64() { - - const value = this.dv.getFloat64( this.offset, this.littleEndian ); - this.offset += 8; - return value; - - } - - getFloat64Array( size ) { - - const a = []; - - for ( let i = 0; i < size; i ++ ) { - - a.push( this.getFloat64() ); - - } - - return a; - - } - - getArrayBuffer( size ) { - - const value = this.dv.buffer.slice( this.offset, this.offset + size ); - this.offset += size; - return value; - - } - - getString( size ) { - - const start = this.offset; - let a = new Uint8Array( this.dv.buffer, start, size ); - - this.skip( size ); - - const nullByte = a.indexOf( 0 ); - if ( nullByte >= 0 ) a = new Uint8Array( this.dv.buffer, start, nullByte ); - - return this._textDecoder.decode( a ); - - } - -} - -// FBXTree holds a representation of the FBX data, returned by the TextParser ( FBX ASCII format) -// and BinaryParser( FBX Binary format) -class FBXTree { - - add( key, val ) { - - this[ key ] = val; - - } - -} - -// ************** UTILITY FUNCTIONS ************** - -function isFbxFormatBinary( buffer ) { - - const CORRECT = 'Kaydara\u0020FBX\u0020Binary\u0020\u0020\0'; - - return buffer.byteLength >= CORRECT.length && CORRECT === convertArrayBufferToString( buffer, 0, CORRECT.length ); - -} - -function isFbxFormatASCII( text ) { - - const CORRECT = [ 'K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\' ]; - - let cursor = 0; - - function read( offset ) { - - const result = text[ offset - 1 ]; - text = text.slice( cursor + offset ); - cursor ++; - return result; - - } - - for ( let i = 0; i < CORRECT.length; ++ i ) { - - const num = read( 1 ); - if ( num === CORRECT[ i ] ) { - - return false; - - } - - } - - return true; - -} - -function getFbxVersion( text ) { - - const versionRegExp = /FBXVersion: (\d+)/; - const match = text.match( versionRegExp ); - - if ( match ) { - - const version = parseInt( match[ 1 ] ); - return version; - - } - - throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' ); - -} - -// Converts FBX ticks into real time seconds. -function convertFBXTimeToSeconds( time ) { - - return time / 46186158000; - -} - -const dataArray = []; - -// extracts the data from the correct position in the FBX array based on indexing type -function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) { - - let index; - - switch ( infoObject.mappingType ) { - - case 'ByPolygonVertex' : - index = polygonVertexIndex; - break; - case 'ByPolygon' : - index = polygonIndex; - break; - case 'ByVertice' : - index = vertexIndex; - break; - case 'AllSame' : - index = infoObject.indices[ 0 ]; - break; - default : - console.warn( 'THREE.FBXLoader: unknown attribute mapping type ' + infoObject.mappingType ); - - } - - if ( infoObject.referenceType === 'IndexToDirect' ) index = infoObject.indices[ index ]; - - const from = index * infoObject.dataSize; - const to = from + infoObject.dataSize; - - return slice( dataArray, infoObject.buffer, from, to ); - -} - -const tempEuler = new Euler(); -const tempVec = new Vector3(); - -// generate transformation from FBX transform data -// ref: https://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_10CDD63C_79C1_4F2D_BB28_AD2BE65A02ED_htm -// ref: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=cpp_ref/_transformations_2main_8cxx-example.html,topicNumber=cpp_ref__transformations_2main_8cxx_example_htmlfc10a1e1-b18d-4e72-9dc0-70d0f1959f5e -function generateTransform( transformData ) { - - const lTranslationM = new Matrix4(); - const lPreRotationM = new Matrix4(); - const lRotationM = new Matrix4(); - const lPostRotationM = new Matrix4(); - - const lScalingM = new Matrix4(); - const lScalingPivotM = new Matrix4(); - const lScalingOffsetM = new Matrix4(); - const lRotationOffsetM = new Matrix4(); - const lRotationPivotM = new Matrix4(); - - const lParentGX = new Matrix4(); - const lParentLX = new Matrix4(); - const lGlobalT = new Matrix4(); - - const inheritType = ( transformData.inheritType ) ? transformData.inheritType : 0; - - if ( transformData.translation ) lTranslationM.setPosition( tempVec.fromArray( transformData.translation ) ); - - if ( transformData.preRotation ) { - - const array = transformData.preRotation.map( MathUtils.degToRad ); - array.push( transformData.eulerOrder || Euler.DEFAULT_ORDER ); - lPreRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) ); - - } - - if ( transformData.rotation ) { - - const array = transformData.rotation.map( MathUtils.degToRad ); - array.push( transformData.eulerOrder || Euler.DEFAULT_ORDER ); - lRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) ); - - } - - if ( transformData.postRotation ) { - - const array = transformData.postRotation.map( MathUtils.degToRad ); - array.push( transformData.eulerOrder || Euler.DEFAULT_ORDER ); - lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) ); - lPostRotationM.invert(); - - } - - if ( transformData.scale ) lScalingM.scale( tempVec.fromArray( transformData.scale ) ); - - // Pivots and offsets - if ( transformData.scalingOffset ) lScalingOffsetM.setPosition( tempVec.fromArray( transformData.scalingOffset ) ); - if ( transformData.scalingPivot ) lScalingPivotM.setPosition( tempVec.fromArray( transformData.scalingPivot ) ); - if ( transformData.rotationOffset ) lRotationOffsetM.setPosition( tempVec.fromArray( transformData.rotationOffset ) ); - if ( transformData.rotationPivot ) lRotationPivotM.setPosition( tempVec.fromArray( transformData.rotationPivot ) ); - - // parent transform - if ( transformData.parentMatrixWorld ) { - - lParentLX.copy( transformData.parentMatrix ); - lParentGX.copy( transformData.parentMatrixWorld ); - - } - - const lLRM = lPreRotationM.clone().multiply( lRotationM ).multiply( lPostRotationM ); - // Global Rotation - const lParentGRM = new Matrix4(); - lParentGRM.extractRotation( lParentGX ); - - // Global Shear*Scaling - const lParentTM = new Matrix4(); - lParentTM.copyPosition( lParentGX ); - - const lParentGRSM = lParentTM.clone().invert().multiply( lParentGX ); - const lParentGSM = lParentGRM.clone().invert().multiply( lParentGRSM ); - const lLSM = lScalingM; - - const lGlobalRS = new Matrix4(); - - if ( inheritType === 0 ) { - - lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lLSM ); - - } else if ( inheritType === 1 ) { - - lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lLSM ); - - } else { - - const lParentLSM = new Matrix4().scale( new Vector3().setFromMatrixScale( lParentLX ) ); - const lParentLSM_inv = lParentLSM.clone().invert(); - const lParentGSM_noLocal = lParentGSM.clone().multiply( lParentLSM_inv ); - - lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lLSM ); - - } - - const lRotationPivotM_inv = lRotationPivotM.clone().invert(); - const lScalingPivotM_inv = lScalingPivotM.clone().invert(); - // Calculate the local transform matrix - let lTransform = lTranslationM.clone().multiply( lRotationOffsetM ).multiply( lRotationPivotM ).multiply( lPreRotationM ).multiply( lRotationM ).multiply( lPostRotationM ).multiply( lRotationPivotM_inv ).multiply( lScalingOffsetM ).multiply( lScalingPivotM ).multiply( lScalingM ).multiply( lScalingPivotM_inv ); - - const lLocalTWithAllPivotAndOffsetInfo = new Matrix4().copyPosition( lTransform ); - - const lGlobalTranslation = lParentGX.clone().multiply( lLocalTWithAllPivotAndOffsetInfo ); - lGlobalT.copyPosition( lGlobalTranslation ); - - lTransform = lGlobalT.clone().multiply( lGlobalRS ); - - // from global to local - lTransform.premultiply( lParentGX.invert() ); - - return lTransform; - -} - -// Returns the three.js intrinsic Euler order corresponding to FBX extrinsic Euler order -// ref: http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html -function getEulerOrder( order ) { - - order = order || 0; - - const enums = [ - 'ZYX', // -> XYZ extrinsic - 'YZX', // -> XZY extrinsic - 'XZY', // -> YZX extrinsic - 'ZXY', // -> YXZ extrinsic - 'YXZ', // -> ZXY extrinsic - 'XYZ', // -> ZYX extrinsic - //'SphericXYZ', // not possible to support - ]; - - if ( order === 6 ) { - - console.warn( 'THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.' ); - return enums[ 0 ]; - - } - - return enums[ order ]; - -} - -// Parses comma separated list of numbers and returns them an array. -// Used internally by the TextParser -function parseNumberArray( value ) { - - const array = value.split( ',' ).map( function ( val ) { - - return parseFloat( val ); - - } ); - - return array; - -} - -function convertArrayBufferToString( buffer, from, to ) { - - if ( from === undefined ) from = 0; - if ( to === undefined ) to = buffer.byteLength; - - return new TextDecoder().decode( new Uint8Array( buffer, from, to ) ); - -} - -function append( a, b ) { - - for ( let i = 0, j = a.length, l = b.length; i < l; i ++, j ++ ) { - - a[ j ] = b[ i ]; - - } - -} - -function slice( a, b, from, to ) { - - for ( let i = from, j = 0; i < to; i ++, j ++ ) { - - a[ j ] = b[ i ]; - - } - - return a; - -} - - -export { FBXLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FXAAShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FXAAShader.js deleted file mode 100644 index 41605d7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FXAAShader.js +++ /dev/null @@ -1,286 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * NVIDIA FXAA by Timothy Lottes - * https://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf - * - WebGL port by @supereggbert - * http://www.glge.org/demos/fxaa/ - * Further improved by Daniel Sturk - */ - -const FXAAShader = { - - name: 'FXAAShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'resolution': { value: new Vector2( 1 / 1024, 1 / 512 ) } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - precision highp float; - - uniform sampler2D tDiffuse; - - uniform vec2 resolution; - - varying vec2 vUv; - - // FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com) - - //---------------------------------------------------------------------------------- - // File: es3-kepler\FXAA\assets\shaders/FXAA_DefaultES.frag - // SDK Version: v3.00 - // Email: gameworks@nvidia.com - // Site: http://developer.nvidia.com/ - // - // Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. - // - // Redistribution and use in source and binary forms, with or without - // modification, are permitted provided that the following conditions - // are met: - // * Redistributions of source code must retain the above copyright - // notice, this list of conditions and the following disclaimer. - // * Redistributions in binary form must reproduce the above copyright - // notice, this list of conditions and the following disclaimer in the - // documentation and/or other materials provided with the distribution. - // * Neither the name of NVIDIA CORPORATION nor the names of its - // contributors may be used to endorse or promote products derived - // from this software without specific prior written permission. - // - // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY - // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - // - //---------------------------------------------------------------------------------- - - #ifndef FXAA_DISCARD - // - // Only valid for PC OpenGL currently. - // Probably will not work when FXAA_GREEN_AS_LUMA = 1. - // - // 1 = Use discard on pixels which don't need AA. - // For APIs which enable concurrent TEX+ROP from same surface. - // 0 = Return unchanged color on pixels which don't need AA. - // - #define FXAA_DISCARD 0 - #endif - - /*--------------------------------------------------------------------------*/ - #define FxaaTexTop(t, p) texture2D(t, p, -100.0) - #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0) - /*--------------------------------------------------------------------------*/ - - #define NUM_SAMPLES 5 - - // assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha - float contrast( vec4 a, vec4 b ) { - vec4 diff = abs( a - b ); - return max( max( max( diff.r, diff.g ), diff.b ), diff.a ); - } - - /*============================================================================ - - FXAA3 QUALITY - PC - - ============================================================================*/ - - /*--------------------------------------------------------------------------*/ - vec4 FxaaPixelShader( - vec2 posM, - sampler2D tex, - vec2 fxaaQualityRcpFrame, - float fxaaQualityEdgeThreshold, - float fxaaQualityinvEdgeThreshold - ) { - vec4 rgbaM = FxaaTexTop(tex, posM); - vec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy); - vec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy); - vec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy); - vec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy); - // . S . - // W M E - // . N . - - bool earlyExit = max( max( max( - contrast( rgbaM, rgbaN ), - contrast( rgbaM, rgbaS ) ), - contrast( rgbaM, rgbaE ) ), - contrast( rgbaM, rgbaW ) ) - < fxaaQualityEdgeThreshold; - // . 0 . - // 0 0 0 - // . 0 . - - #if (FXAA_DISCARD == 1) - if(earlyExit) FxaaDiscard; - #else - if(earlyExit) return rgbaM; - #endif - - float contrastN = contrast( rgbaM, rgbaN ); - float contrastS = contrast( rgbaM, rgbaS ); - float contrastE = contrast( rgbaM, rgbaE ); - float contrastW = contrast( rgbaM, rgbaW ); - - float relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW ); - relativeVContrast *= fxaaQualityinvEdgeThreshold; - - bool horzSpan = relativeVContrast > 0.; - // . 1 . - // 0 0 0 - // . 1 . - - // 45 deg edge detection and corners of objects, aka V/H contrast is too similar - if( abs( relativeVContrast ) < .3 ) { - // locate the edge - vec2 dirToEdge; - dirToEdge.x = contrastE > contrastW ? 1. : -1.; - dirToEdge.y = contrastS > contrastN ? 1. : -1.; - // . 2 . . 1 . - // 1 0 2 ~= 0 0 1 - // . 1 . . 0 . - - // tap 2 pixels and see which ones are "outside" the edge, to - // determine if the edge is vertical or horizontal - - vec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy); - float matchAlongH = contrast( rgbaM, rgbaAlongH ); - // . 1 . - // 0 0 1 - // . 0 H - - vec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy); - float matchAlongV = contrast( rgbaM, rgbaAlongV ); - // V 1 . - // 0 0 1 - // . 0 . - - relativeVContrast = matchAlongV - matchAlongH; - relativeVContrast *= fxaaQualityinvEdgeThreshold; - - if( abs( relativeVContrast ) < .3 ) { // 45 deg edge - // 1 1 . - // 0 0 1 - // . 0 1 - - // do a simple blur - return mix( - rgbaM, - (rgbaN + rgbaS + rgbaE + rgbaW) * .25, - .4 - ); - } - - horzSpan = relativeVContrast > 0.; - } - - if(!horzSpan) rgbaN = rgbaW; - if(!horzSpan) rgbaS = rgbaE; - // . 0 . 1 - // 1 0 1 -> 0 - // . 0 . 1 - - bool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS ); - if(!pairN) rgbaN = rgbaS; - - vec2 offNP; - offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; - offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; - - bool doneN = false; - bool doneP = false; - - float nDist = 0.; - float pDist = 0.; - - vec2 posN = posM; - vec2 posP = posM; - - int iterationsUsedN = 0; - int iterationsUsedP = 0; - for( int i = 0; i < NUM_SAMPLES; i++ ) { - - float increment = float(i + 1); - - if(!doneN) { - nDist += increment; - posN = posM + offNP * nDist; - vec4 rgbaEndN = FxaaTexTop(tex, posN.xy); - doneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN ); - iterationsUsedN = i; - } - - if(!doneP) { - pDist += increment; - posP = posM - offNP * pDist; - vec4 rgbaEndP = FxaaTexTop(tex, posP.xy); - doneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN ); - iterationsUsedP = i; - } - - if(doneN || doneP) break; - } - - - if ( !doneP && !doneN ) return rgbaM; // failed to find end of edge - - float dist = min( - doneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1., - doneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1. - ); - - // hacky way of reduces blurriness of mostly diagonal edges - // but reduces AA quality - dist = pow(dist, .5); - - dist = 1. - dist; - - return mix( - rgbaM, - rgbaN, - dist * .5 - ); - } - - void main() { - const float edgeDetectionQuality = .2; - const float invEdgeDetectionQuality = 1. / edgeDetectionQuality; - - gl_FragColor = FxaaPixelShader( - vUv, - tDiffuse, - resolution, - edgeDetectionQuality, // [0,1] contrast needed, otherwise early discard - invEdgeDetectionQuality - ); - - } - ` - -}; - -export { FXAAShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FilmPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FilmPass.js deleted file mode 100644 index 8cf8af6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FilmPass.js +++ /dev/null @@ -1,64 +0,0 @@ -import { - ShaderMaterial, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { FilmShader } from '../shaders/FilmShader.js'; - -class FilmPass extends Pass { - - constructor( intensity = 0.5, grayscale = false ) { - - super(); - - const shader = FilmShader; - - this.uniforms = UniformsUtils.clone( shader.uniforms ); - - this.material = new ShaderMaterial( { - - name: shader.name, - uniforms: this.uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - - } ); - - this.uniforms.intensity.value = intensity; // (0 = no effect, 1 = full effect) - this.uniforms.grayscale.value = grayscale; - - this.fsQuad = new FullScreenQuad( this.material ); - - } - - render( renderer, writeBuffer, readBuffer, deltaTime /*, maskActive */ ) { - - this.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.uniforms[ 'time' ].value += deltaTime; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - } - - dispose() { - - this.material.dispose(); - - this.fsQuad.dispose(); - - } - -} - -export { FilmPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FilmShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FilmShader.js deleted file mode 100644 index 56e1090..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FilmShader.js +++ /dev/null @@ -1,59 +0,0 @@ -const FilmShader = { - - name: 'FilmShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'time': { value: 0.0 }, - 'intensity': { value: 0.5 }, - 'grayscale': { value: false } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #include - - uniform float intensity; - uniform bool grayscale; - uniform float time; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 base = texture2D( tDiffuse, vUv ); - - float noise = rand( fract( vUv + time ) ); - - vec3 color = base.rgb + base.rgb * clamp( 0.1 + noise, 0.0, 1.0 ); - - color = mix( base.rgb, color, intensity ); - - if ( grayscale ) { - - color = vec3( luminance( color ) ); // assuming linear-srgb - - } - - gl_FragColor = vec4( color, base.a ); - - }`, - -}; - -export { FilmShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FocusShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FocusShader.js deleted file mode 100644 index 7f43a0f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FocusShader.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Focus shader - * based on PaintEffect postprocess from ro.me - * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js - */ - -const FocusShader = { - - name: 'FocusShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'screenWidth': { value: 1024 }, - 'screenHeight': { value: 1024 }, - 'sampleDistance': { value: 0.94 }, - 'waveFactor': { value: 0.00125 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float screenWidth; - uniform float screenHeight; - uniform float sampleDistance; - uniform float waveFactor; - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 color, org, tmp, add; - float sample_dist, f; - vec2 vin; - vec2 uv = vUv; - - add = color = org = texture2D( tDiffuse, uv ); - - vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 ); - sample_dist = dot( vin, vin ) * 2.0; - - f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0; - - vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f ); - - add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize ); - if( tmp.b < color.b ) color = tmp; - - color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) ); - color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) ); - - gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 ); - - }` - -}; - -export { FocusShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FontLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FontLoader.js deleted file mode 100644 index d3905fb..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FontLoader.js +++ /dev/null @@ -1,183 +0,0 @@ -import { - FileLoader, - Loader, - ShapePath -} from '/static/javascript/three/build/three.module.js'; - -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( this.withCredentials ); - loader.load( url, function ( text ) { - - const font = scope.parse( JSON.parse( text ) ); - - if ( onLoad ) onLoad( font ); - - }, onProgress, onError ); - - } - - parse( json ) { - - return new Font( json ); - - } - -} - -// - -class Font { - - constructor( data ) { - - this.isFont = true; - - 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 ++ ) { - - shapes.push( ...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 }; - -} - -export { FontLoader, Font }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/FreiChenShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/FreiChenShader.js deleted file mode 100644 index 6fd0cae..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/FreiChenShader.js +++ /dev/null @@ -1,96 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Edge Detection Shader using Frei-Chen filter - * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector - * - * aspect: vec2 of (1/width, 1/height) - */ - -const FreiChenShader = { - - name: 'FreiChenShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'aspect': { value: new Vector2( 512, 512 ) } - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - varying vec2 vUv; - - uniform vec2 aspect; - - vec2 texel = vec2( 1.0 / aspect.x, 1.0 / aspect.y ); - - - mat3 G[9]; - - // hard coded matrix values!!!! as suggested in https://github.com/neilmendoza/ofxPostProcessing/blob/master/src/EdgePass.cpp#L45 - - const mat3 g0 = mat3( 0.3535533845424652, 0, -0.3535533845424652, 0.5, 0, -0.5, 0.3535533845424652, 0, -0.3535533845424652 ); - const mat3 g1 = mat3( 0.3535533845424652, 0.5, 0.3535533845424652, 0, 0, 0, -0.3535533845424652, -0.5, -0.3535533845424652 ); - const mat3 g2 = mat3( 0, 0.3535533845424652, -0.5, -0.3535533845424652, 0, 0.3535533845424652, 0.5, -0.3535533845424652, 0 ); - const mat3 g3 = mat3( 0.5, -0.3535533845424652, 0, -0.3535533845424652, 0, 0.3535533845424652, 0, 0.3535533845424652, -0.5 ); - const mat3 g4 = mat3( 0, -0.5, 0, 0.5, 0, 0.5, 0, -0.5, 0 ); - const mat3 g5 = mat3( -0.5, 0, 0.5, 0, 0, 0, 0.5, 0, -0.5 ); - const mat3 g6 = mat3( 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.6666666865348816, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204 ); - const mat3 g7 = mat3( -0.3333333432674408, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, 0.6666666865348816, 0.1666666716337204, -0.3333333432674408, 0.1666666716337204, -0.3333333432674408 ); - const mat3 g8 = mat3( 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408, 0.3333333432674408 ); - - void main(void) - { - - G[0] = g0, - G[1] = g1, - G[2] = g2, - G[3] = g3, - G[4] = g4, - G[5] = g5, - G[6] = g6, - G[7] = g7, - G[8] = g8; - - mat3 I; - float cnv[9]; - vec3 sample; - - /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */ - for (float i=0.0; i<3.0; i++) { - for (float j=0.0; j<3.0; j++) { - sample = texture2D(tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb; - I[int(i)][int(j)] = length(sample); - } - } - - /* calculate the convolution values for all the masks */ - for (int i=0; i<9; i++) { - float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); - cnv[i] = dp3 * dp3; - } - - float M = (cnv[0] + cnv[1]) + (cnv[2] + cnv[3]); - float S = (cnv[4] + cnv[5]) + (cnv[6] + cnv[7]) + (cnv[8] + M); - - gl_FragColor = vec4(vec3(sqrt(M/S)), 1.0); - }` - -}; - -export { FreiChenShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GCodeLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GCodeLoader.js deleted file mode 100644 index 0c37036..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GCodeLoader.js +++ /dev/null @@ -1,261 +0,0 @@ -import { - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Group, - LineBasicMaterial, - LineSegments, - Loader -} from '/static/javascript/three/build/three.module.js'; - -/** - * GCodeLoader is used to load gcode files usually used for 3D printing or CNC applications. - * - * Gcode files are composed by commands used by machines to create objects. - * - * @class GCodeLoader - * @param {Manager} manager Loading manager. - */ - -class GCodeLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.splitLayer = false; - - } - - 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( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - let state = { x: 0, y: 0, z: 0, e: 0, f: 0, extruding: false, relative: false }; - const layers = []; - - let currentLayer = undefined; - - const pathMaterial = new LineBasicMaterial( { color: 0xFF0000 } ); - pathMaterial.name = 'path'; - - const extrudingMaterial = new LineBasicMaterial( { color: 0x00FF00 } ); - extrudingMaterial.name = 'extruded'; - - function newLayer( line ) { - - currentLayer = { vertex: [], pathVertex: [], z: line.z }; - layers.push( currentLayer ); - - } - - //Create lie segment between p1 and p2 - function addSegment( p1, p2 ) { - - if ( currentLayer === undefined ) { - - newLayer( p1 ); - - } - - if ( state.extruding ) { - - currentLayer.vertex.push( p1.x, p1.y, p1.z ); - currentLayer.vertex.push( p2.x, p2.y, p2.z ); - - } else { - - currentLayer.pathVertex.push( p1.x, p1.y, p1.z ); - currentLayer.pathVertex.push( p2.x, p2.y, p2.z ); - - } - - } - - function delta( v1, v2 ) { - - return state.relative ? v2 : v2 - v1; - - } - - function absolute( v1, v2 ) { - - return state.relative ? v1 + v2 : v2; - - } - - const lines = data.replace( /;.+/g, '' ).split( '\n' ); - - for ( let i = 0; i < lines.length; i ++ ) { - - const tokens = lines[ i ].split( ' ' ); - const cmd = tokens[ 0 ].toUpperCase(); - - //Argumments - const args = {}; - tokens.splice( 1 ).forEach( function ( token ) { - - if ( token[ 0 ] !== undefined ) { - - const key = token[ 0 ].toLowerCase(); - const value = parseFloat( token.substring( 1 ) ); - args[ key ] = value; - - } - - } ); - - //Process commands - //G0/G1 – Linear Movement - if ( cmd === 'G0' || cmd === 'G1' ) { - - const line = { - x: args.x !== undefined ? absolute( state.x, args.x ) : state.x, - y: args.y !== undefined ? absolute( state.y, args.y ) : state.y, - z: args.z !== undefined ? absolute( state.z, args.z ) : state.z, - e: args.e !== undefined ? absolute( state.e, args.e ) : state.e, - f: args.f !== undefined ? absolute( state.f, args.f ) : state.f, - }; - - //Layer change detection is or made by watching Z, it's made by watching when we extrude at a new Z position - if ( delta( state.e, line.e ) > 0 ) { - - state.extruding = delta( state.e, line.e ) > 0; - - if ( currentLayer == undefined || line.z != currentLayer.z ) { - - newLayer( line ); - - } - - } - - addSegment( state, line ); - state = line; - - } else if ( cmd === 'G2' || cmd === 'G3' ) { - - //G2/G3 - Arc Movement ( G2 clock wise and G3 counter clock wise ) - //console.warn( 'THREE.GCodeLoader: Arc command not supported' ); - - } else if ( cmd === 'G90' ) { - - //G90: Set to Absolute Positioning - state.relative = false; - - } else if ( cmd === 'G91' ) { - - //G91: Set to state.relative Positioning - state.relative = true; - - } else if ( cmd === 'G92' ) { - - //G92: Set Position - const line = state; - line.x = args.x !== undefined ? args.x : line.x; - line.y = args.y !== undefined ? args.y : line.y; - line.z = args.z !== undefined ? args.z : line.z; - line.e = args.e !== undefined ? args.e : line.e; - - } else { - - //console.warn( 'THREE.GCodeLoader: Command not supported:' + cmd ); - - } - - } - - function addObject( vertex, extruding, i ) { - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( vertex, 3 ) ); - const segments = new LineSegments( geometry, extruding ? extrudingMaterial : pathMaterial ); - segments.name = 'layer' + i; - object.add( segments ); - - } - - const object = new Group(); - object.name = 'gcode'; - - if ( this.splitLayer ) { - - for ( let i = 0; i < layers.length; i ++ ) { - - const layer = layers[ i ]; - addObject( layer.vertex, true, i ); - addObject( layer.pathVertex, false, i ); - - } - - } else { - - const vertex = [], - pathVertex = []; - - for ( let i = 0; i < layers.length; i ++ ) { - - const layer = layers[ i ]; - const layerVertex = layer.vertex; - const layerPathVertex = layer.pathVertex; - - for ( let j = 0; j < layerVertex.length; j ++ ) { - - vertex.push( layerVertex[ j ] ); - - } - - for ( let j = 0; j < layerPathVertex.length; j ++ ) { - - pathVertex.push( layerPathVertex[ j ] ); - - } - - } - - addObject( vertex, true, layers.length ); - addObject( pathVertex, false, layers.length ); - - } - - object.rotation.set( - Math.PI / 2, 0, 0 ); - - return object; - - } - -} - -export { GCodeLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GPUStatsPanel.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GPUStatsPanel.js deleted file mode 100644 index 8f74800..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GPUStatsPanel.js +++ /dev/null @@ -1,95 +0,0 @@ -import Stats from '../libs/stats.module.js'; - -// https://www.khronos.org/registry/webgl/extensions/EXT_disjoint_timer_query_webgl2/ -export class GPUStatsPanel extends Stats.Panel { - - constructor( context, name = 'GPU MS' ) { - - super( name, '#f90', '#210' ); - - const extension = context.getExtension( 'EXT_disjoint_timer_query_webgl2' ); - - if ( extension === null ) { - - console.warn( 'GPUStatsPanel: disjoint_time_query extension not available.' ); - - } - - this.context = context; - this.extension = extension; - this.maxTime = 30; - this.activeQueries = 0; - - this.startQuery = function () { - - const gl = this.context; - const ext = this.extension; - - if ( ext === null ) { - - return; - - } - - // create the query object - const query = gl.createQuery(); - gl.beginQuery( ext.TIME_ELAPSED_EXT, query ); - - this.activeQueries ++; - - const checkQuery = () => { - - // check if the query is available and valid - - const available = gl.getQueryParameter( query, gl.QUERY_RESULT_AVAILABLE ); - const disjoint = gl.getParameter( ext.GPU_DISJOINT_EXT ); - const ns = gl.getQueryParameter( query, gl.QUERY_RESULT ); - - const ms = ns * 1e-6; - - if ( available ) { - - // update the display if it is valid - if ( ! disjoint ) { - - this.update( ms, this.maxTime ); - - } - - gl.deleteQuery( query ); - - this.activeQueries --; - - - } else if ( gl.isContextLost() === false ) { - - // otherwise try again the next frame - requestAnimationFrame( checkQuery ); - - } - - }; - - requestAnimationFrame( checkQuery ); - - }; - - this.endQuery = function () { - - // finish the query measurement - const ext = this.extension; - const gl = this.context; - - if ( ext === null ) { - - return; - - } - - gl.endQuery( ext.TIME_ELAPSED_EXT ); - - }; - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOPass.js deleted file mode 100644 index 8f3ba7f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOPass.js +++ /dev/null @@ -1,582 +0,0 @@ -import { - AddEquation, - Color, - CustomBlending, - DataTexture, - DepthTexture, - DepthStencilFormat, - DstAlphaFactor, - DstColorFactor, - HalfFloatType, - MeshNormalMaterial, - NearestFilter, - NoBlending, - RepeatWrapping, - RGBAFormat, - ShaderMaterial, - UniformsUtils, - UnsignedByteType, - UnsignedInt248Type, - WebGLRenderTarget, - ZeroFactor -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { generateMagicSquareNoise, GTAOShader, GTAODepthShader, GTAOBlendShader } from '../shaders/GTAOShader.js'; -import { generatePdSamplePointInitializer, PoissonDenoiseShader } from '../shaders/PoissonDenoiseShader.js'; -import { CopyShader } from '../shaders/CopyShader.js'; -import { SimplexNoise } from '../math/SimplexNoise.js'; - -class GTAOPass extends Pass { - - constructor( scene, camera, width, height, parameters, aoParameters, pdParameters ) { - - super(); - - this.width = ( width !== undefined ) ? width : 512; - this.height = ( height !== undefined ) ? height : 512; - this.clear = true; - this.camera = camera; - this.scene = scene; - this.output = 0; - this._renderGBuffer = true; - this._visibilityCache = new Map(); - this.blendIntensity = 1.; - - this.pdRings = 2.; - this.pdRadiusExponent = 2.; - this.pdSamples = 16; - - this.gtaoNoiseTexture = generateMagicSquareNoise(); - this.pdNoiseTexture = this.generateNoise(); - - this.gtaoRenderTarget = new WebGLRenderTarget( this.width, this.height, { type: HalfFloatType } ); - this.pdRenderTarget = this.gtaoRenderTarget.clone(); - - this.gtaoMaterial = new ShaderMaterial( { - defines: Object.assign( {}, GTAOShader.defines ), - uniforms: UniformsUtils.clone( GTAOShader.uniforms ), - vertexShader: GTAOShader.vertexShader, - fragmentShader: GTAOShader.fragmentShader, - blending: NoBlending, - depthTest: false, - depthWrite: false, - } ); - this.gtaoMaterial.defines.PERSPECTIVE_CAMERA = this.camera.isPerspectiveCamera ? 1 : 0; - this.gtaoMaterial.uniforms.tNoise.value = this.gtaoNoiseTexture; - this.gtaoMaterial.uniforms.resolution.value.set( this.width, this.height ); - this.gtaoMaterial.uniforms.cameraNear.value = this.camera.near; - this.gtaoMaterial.uniforms.cameraFar.value = this.camera.far; - - this.normalMaterial = new MeshNormalMaterial(); - this.normalMaterial.blending = NoBlending; - - this.pdMaterial = new ShaderMaterial( { - defines: Object.assign( {}, PoissonDenoiseShader.defines ), - uniforms: UniformsUtils.clone( PoissonDenoiseShader.uniforms ), - vertexShader: PoissonDenoiseShader.vertexShader, - fragmentShader: PoissonDenoiseShader.fragmentShader, - depthTest: false, - depthWrite: false, - } ); - this.pdMaterial.uniforms.tDiffuse.value = this.gtaoRenderTarget.texture; - this.pdMaterial.uniforms.tNoise.value = this.pdNoiseTexture; - this.pdMaterial.uniforms.resolution.value.set( this.width, this.height ); - this.pdMaterial.uniforms.lumaPhi.value = 10; - this.pdMaterial.uniforms.depthPhi.value = 2; - this.pdMaterial.uniforms.normalPhi.value = 3; - this.pdMaterial.uniforms.radius.value = 8; - - this.depthRenderMaterial = new ShaderMaterial( { - defines: Object.assign( {}, GTAODepthShader.defines ), - uniforms: UniformsUtils.clone( GTAODepthShader.uniforms ), - vertexShader: GTAODepthShader.vertexShader, - fragmentShader: GTAODepthShader.fragmentShader, - blending: NoBlending - } ); - this.depthRenderMaterial.uniforms.cameraNear.value = this.camera.near; - this.depthRenderMaterial.uniforms.cameraFar.value = this.camera.far; - - this.copyMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( CopyShader.uniforms ), - vertexShader: CopyShader.vertexShader, - fragmentShader: CopyShader.fragmentShader, - transparent: true, - depthTest: false, - depthWrite: false, - blendSrc: DstColorFactor, - blendDst: ZeroFactor, - blendEquation: AddEquation, - blendSrcAlpha: DstAlphaFactor, - blendDstAlpha: ZeroFactor, - blendEquationAlpha: AddEquation - } ); - - this.blendMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( GTAOBlendShader.uniforms ), - vertexShader: GTAOBlendShader.vertexShader, - fragmentShader: GTAOBlendShader.fragmentShader, - transparent: true, - depthTest: false, - depthWrite: false, - blending: CustomBlending, - blendSrc: DstColorFactor, - blendDst: ZeroFactor, - blendEquation: AddEquation, - blendSrcAlpha: DstAlphaFactor, - blendDstAlpha: ZeroFactor, - blendEquationAlpha: AddEquation - } ); - - this.fsQuad = new FullScreenQuad( null ); - - this.originalClearColor = new Color(); - - this.setGBuffer( parameters ? parameters.depthTexture : undefined, parameters ? parameters.normalTexture : undefined ); - - if ( aoParameters !== undefined ) { - - this.updateGtaoMaterial( aoParameters ); - - } - - if ( pdParameters !== undefined ) { - - this.updatePdMaterial( pdParameters ); - - } - - } - - dispose() { - - this.gtaoNoiseTexture.dispose(); - this.pdNoiseTexture.dispose(); - this.normalRenderTarget.dispose(); - this.gtaoRenderTarget.dispose(); - this.pdRenderTarget.dispose(); - this.normalMaterial.dispose(); - this.pdMaterial.dispose(); - this.copyMaterial.dispose(); - this.depthRenderMaterial.dispose(); - this.fsQuad.dispose(); - - } - - get gtaoMap() { - - return this.pdRenderTarget.texture; - - } - - setGBuffer( depthTexture, normalTexture ) { - - if ( depthTexture !== undefined ) { - - this.depthTexture = depthTexture; - this.normalTexture = normalTexture; - this._renderGBuffer = false; - - } else { - - this.depthTexture = new DepthTexture(); - this.depthTexture.format = DepthStencilFormat; - this.depthTexture.type = UnsignedInt248Type; - this.normalRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - depthTexture: this.depthTexture - } ); - this.normalTexture = this.normalRenderTarget.texture; - this._renderGBuffer = true; - - } - - const normalVectorType = ( this.normalTexture ) ? 1 : 0; - const depthValueSource = ( this.depthTexture === this.normalTexture ) ? 'w' : 'x'; - - this.gtaoMaterial.defines.NORMAL_VECTOR_TYPE = normalVectorType; - this.gtaoMaterial.defines.DEPTH_SWIZZLING = depthValueSource; - this.gtaoMaterial.uniforms.tNormal.value = this.normalTexture; - this.gtaoMaterial.uniforms.tDepth.value = this.depthTexture; - - this.pdMaterial.defines.NORMAL_VECTOR_TYPE = normalVectorType; - this.pdMaterial.defines.DEPTH_SWIZZLING = depthValueSource; - this.pdMaterial.uniforms.tNormal.value = this.normalTexture; - this.pdMaterial.uniforms.tDepth.value = this.depthTexture; - - this.depthRenderMaterial.uniforms.tDepth.value = this.normalRenderTarget.depthTexture; - - } - - setSceneClipBox( box ) { - - if ( box ) { - - this.gtaoMaterial.needsUpdate = this.gtaoMaterial.defines.SCENE_CLIP_BOX !== 1; - this.gtaoMaterial.defines.SCENE_CLIP_BOX = 1; - this.gtaoMaterial.uniforms.sceneBoxMin.value.copy( box.min ); - this.gtaoMaterial.uniforms.sceneBoxMax.value.copy( box.max ); - - } else { - - this.gtaoMaterial.needsUpdate = this.gtaoMaterial.defines.SCENE_CLIP_BOX === 0; - this.gtaoMaterial.defines.SCENE_CLIP_BOX = 0; - - } - - } - - updateGtaoMaterial( parameters ) { - - if ( parameters.radius !== undefined ) { - - this.gtaoMaterial.uniforms.radius.value = parameters.radius; - - } - - if ( parameters.distanceExponent !== undefined ) { - - this.gtaoMaterial.uniforms.distanceExponent.value = parameters.distanceExponent; - - } - - if ( parameters.thickness !== undefined ) { - - this.gtaoMaterial.uniforms.thickness.value = parameters.thickness; - - } - - if ( parameters.distanceFallOff !== undefined ) { - - this.gtaoMaterial.uniforms.distanceFallOff.value = parameters.distanceFallOff; - this.gtaoMaterial.needsUpdate = true; - - } - - if ( parameters.scale !== undefined ) { - - this.gtaoMaterial.uniforms.scale.value = parameters.scale; - - } - - if ( parameters.samples !== undefined && parameters.samples !== this.gtaoMaterial.defines.SAMPLES ) { - - this.gtaoMaterial.defines.SAMPLES = parameters.samples; - this.gtaoMaterial.needsUpdate = true; - - } - - if ( parameters.screenSpaceRadius !== undefined && ( parameters.screenSpaceRadius ? 1 : 0 ) !== this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS ) { - - this.gtaoMaterial.defines.SCREEN_SPACE_RADIUS = parameters.screenSpaceRadius ? 1 : 0; - this.gtaoMaterial.needsUpdate = true; - - } - - } - - updatePdMaterial( parameters ) { - - let updateShader = false; - - if ( parameters.lumaPhi !== undefined ) { - - this.pdMaterial.uniforms.lumaPhi.value = parameters.lumaPhi; - - } - - if ( parameters.depthPhi !== undefined ) { - - this.pdMaterial.uniforms.depthPhi.value = parameters.depthPhi; - - } - - if ( parameters.normalPhi !== undefined ) { - - this.pdMaterial.uniforms.normalPhi.value = parameters.normalPhi; - - } - - if ( parameters.radius !== undefined && parameters.radius !== this.radius ) { - - this.pdMaterial.uniforms.radius.value = parameters.radius; - - } - - if ( parameters.radiusExponent !== undefined && parameters.radiusExponent !== this.pdRadiusExponent ) { - - this.pdRadiusExponent = parameters.radiusExponent; - updateShader = true; - - } - - if ( parameters.rings !== undefined && parameters.rings !== this.pdRings ) { - - this.pdRings = parameters.rings; - updateShader = true; - - } - - if ( parameters.samples !== undefined && parameters.samples !== this.pdSamples ) { - - this.pdSamples = parameters.samples; - updateShader = true; - - } - - if ( updateShader ) { - - this.pdMaterial.defines.SAMPLES = this.pdSamples; - this.pdMaterial.defines.SAMPLE_VECTORS = generatePdSamplePointInitializer( this.pdSamples, this.pdRings, this.pdRadiusExponent ); - this.pdMaterial.needsUpdate = true; - - } - - } - - render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { - - // render normals and depth (honor only meshes, points and lines do not contribute to AO) - - if ( this._renderGBuffer ) { - - this.overrideVisibility(); - this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 ); - this.restoreVisibility(); - - } - - // render AO - - this.gtaoMaterial.uniforms.cameraNear.value = this.camera.near; - this.gtaoMaterial.uniforms.cameraFar.value = this.camera.far; - this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy( this.camera.projectionMatrix ); - this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse ); - this.gtaoMaterial.uniforms.cameraWorldMatrix.value.copy( this.camera.matrixWorld ); - this.renderPass( renderer, this.gtaoMaterial, this.gtaoRenderTarget, 0xffffff, 1.0 ); - - // render poisson denoise - - this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse ); - this.renderPass( renderer, this.pdMaterial, this.pdRenderTarget, 0xffffff, 1.0 ); - - // output result to screen - - switch ( this.output ) { - - case GTAOPass.OUTPUT.Off: - break; - - case GTAOPass.OUTPUT.Diffuse: - - this.copyMaterial.uniforms.tDiffuse.value = readBuffer.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case GTAOPass.OUTPUT.AO: - - this.copyMaterial.uniforms.tDiffuse.value = this.gtaoRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case GTAOPass.OUTPUT.Denoise: - - this.copyMaterial.uniforms.tDiffuse.value = this.pdRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case GTAOPass.OUTPUT.Depth: - - this.depthRenderMaterial.uniforms.cameraNear.value = this.camera.near; - this.depthRenderMaterial.uniforms.cameraFar.value = this.camera.far; - this.renderPass( renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case GTAOPass.OUTPUT.Normal: - - this.copyMaterial.uniforms.tDiffuse.value = this.normalRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case GTAOPass.OUTPUT.Default: - - this.copyMaterial.uniforms.tDiffuse.value = readBuffer.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - this.blendMaterial.uniforms.intensity.value = this.blendIntensity; - this.blendMaterial.uniforms.tDiffuse.value = this.pdRenderTarget.texture; - this.renderPass( renderer, this.blendMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - default: - console.warn( 'THREE.GTAOPass: Unknown output type.' ); - - } - - } - - renderPass( renderer, passMaterial, renderTarget, clearColor, clearAlpha ) { - - // save original state - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - - // setup pass state - renderer.autoClear = false; - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.fsQuad.material = passMaterial; - this.fsQuad.render( renderer ); - - // restore original state - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - renderOverride( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) { - - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - renderer.autoClear = false; - - clearColor = overrideMaterial.clearColor || clearColor; - clearAlpha = overrideMaterial.clearAlpha || clearAlpha; - - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.scene.overrideMaterial = overrideMaterial; - renderer.render( this.scene, this.camera ); - this.scene.overrideMaterial = null; - - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - setSize( width, height ) { - - this.width = width; - this.height = height; - - this.gtaoRenderTarget.setSize( width, height ); - this.normalRenderTarget.setSize( width, height ); - this.pdRenderTarget.setSize( width, height ); - - this.gtaoMaterial.uniforms.resolution.value.set( width, height ); - this.gtaoMaterial.uniforms.cameraProjectionMatrix.value.copy( this.camera.projectionMatrix ); - this.gtaoMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse ); - - this.pdMaterial.uniforms.resolution.value.set( width, height ); - this.pdMaterial.uniforms.cameraProjectionMatrixInverse.value.copy( this.camera.projectionMatrixInverse ); - - } - - overrideVisibility() { - - const scene = this.scene; - const cache = this._visibilityCache; - - scene.traverse( function ( object ) { - - cache.set( object, object.visible ); - - if ( object.isPoints || object.isLine ) object.visible = false; - - } ); - - } - - restoreVisibility() { - - const scene = this.scene; - const cache = this._visibilityCache; - - scene.traverse( function ( object ) { - - const visible = cache.get( object ); - object.visible = visible; - - } ); - - cache.clear(); - - } - - generateNoise( size = 64 ) { - - const simplex = new SimplexNoise(); - - const arraySize = size * size * 4; - const data = new Uint8Array( arraySize ); - - for ( let i = 0; i < size; i ++ ) { - - for ( let j = 0; j < size; j ++ ) { - - const x = i; - const y = j; - - data[ ( i * size + j ) * 4 ] = ( simplex.noise( x, y ) * 0.5 + 0.5 ) * 255; - data[ ( i * size + j ) * 4 + 1 ] = ( simplex.noise( x + size, y ) * 0.5 + 0.5 ) * 255; - data[ ( i * size + j ) * 4 + 2 ] = ( simplex.noise( x, y + size ) * 0.5 + 0.5 ) * 255; - data[ ( i * size + j ) * 4 + 3 ] = ( simplex.noise( x + size, y + size ) * 0.5 + 0.5 ) * 255; - - } - - } - - const noiseTexture = new DataTexture( data, size, size, RGBAFormat, UnsignedByteType ); - noiseTexture.wrapS = RepeatWrapping; - noiseTexture.wrapT = RepeatWrapping; - noiseTexture.needsUpdate = true; - - return noiseTexture; - - } - -} - -GTAOPass.OUTPUT = { - 'Off': - 1, - 'Default': 0, - 'Diffuse': 1, - 'Depth': 2, - 'Normal': 3, - 'AO': 4, - 'Denoise': 5, -}; - -export { GTAOPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOShader.js deleted file mode 100644 index 9208585..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GTAOShader.js +++ /dev/null @@ -1,424 +0,0 @@ -import { - DataTexture, - Matrix4, - RepeatWrapping, - Vector2, - Vector3, -} from '/static/javascript/three/build/three.module.js'; - -/** - * References: - * - implemented algorithm - GTAO - * - https://iryoku.com/downloads/Practical-Realtime-Strategies-for-Accurate-Indirect-Occlusion.pdf - * - https://github.com/Patapom/GodComplex/blob/master/Tests/TestHBIL/2018%20Mayaux%20-%20Horizon-Based%20Indirect%20Lighting%20(HBIL).pdf - * - * - other AO algorithms that are not implemented here: - * - Screen Space Ambient Occlusion (SSAO), see also SSAOShader.js - * - http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html - * - https://learnopengl.com/Advanced-Lighting/SSAO - * - https://creativecoding.soe.ucsc.edu/courses/cmpm164/_schedule/AmbientOcclusion.pdf - * - https://drive.google.com/file/d/1SyagcEVplIm2KkRD3WQYSO9O0Iyi1hfy/edit - * - Scalable Ambient Occlusion (SAO), see also SAOShader.js - * - https://casual-effects.com/research/McGuire2012SAO/index.html - * - https://research.nvidia.com/sites/default/files/pubs/2012-06_Scalable-Ambient-Obscurance/McGuire12SAO.pdf - * - N8HO - * - https://github.com/N8python/n8ao - * - Horizon Based Ambient Occlusion (HBAO) - * - http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.577.2286&rep=rep1&type=pdf - * - https://www.derschmale.com/2013/12/20/an-alternative-implementation-for-hbao-2/ - * - * - further reading - * - https://ceur-ws.org/Vol-3027/paper5.pdf - * - https://www.comp.nus.edu.sg/~lowkl/publications/mssao_visual_computer_2012.pdf - * - https://web.ics.purdue.edu/~tmcgraw/papers/mcgraw-ao-2008.pdf - * - https://www.activision.com/cdn/research/Practical_Real_Time_Strategies_for_Accurate_Indirect_Occlusion_NEW%20VERSION_COLOR.pdf - * - https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.390.2463&rep=rep1&type=pdf - * - https://www.intel.com/content/www/us/en/developer/articles/technical/adaptive-screen-space-ambient-occlusion.html - */ - -const GTAOShader = { - - name: 'GTAOShader', - - defines: { - PERSPECTIVE_CAMERA: 1, - SAMPLES: 16, - NORMAL_VECTOR_TYPE: 1, - DEPTH_SWIZZLING: 'x', - SCREEN_SPACE_RADIUS: 0, - SCREEN_SPACE_RADIUS_SCALE: 100.0, - SCENE_CLIP_BOX: 0, - }, - - uniforms: { - tNormal: { value: null }, - tDepth: { value: null }, - tNoise: { value: null }, - resolution: { value: new Vector2() }, - cameraNear: { value: null }, - cameraFar: { value: null }, - cameraProjectionMatrix: { value: new Matrix4() }, - cameraProjectionMatrixInverse: { value: new Matrix4() }, - cameraWorldMatrix: { value: new Matrix4() }, - radius: { value: 0.25 }, - distanceExponent: { value: 1. }, - thickness: { value: 1. }, - distanceFallOff: { value: 1. }, - scale: { value: 1. }, - sceneBoxMin: { value: new Vector3( - 1, - 1, - 1 ) }, - sceneBoxMax: { value: new Vector3( 1, 1, 1 ) }, - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - varying vec2 vUv; - uniform highp sampler2D tNormal; - uniform highp sampler2D tDepth; - uniform sampler2D tNoise; - uniform vec2 resolution; - uniform float cameraNear; - uniform float cameraFar; - uniform mat4 cameraProjectionMatrix; - uniform mat4 cameraProjectionMatrixInverse; - uniform mat4 cameraWorldMatrix; - uniform float radius; - uniform float distanceExponent; - uniform float thickness; - uniform float distanceFallOff; - uniform float scale; - #if SCENE_CLIP_BOX == 1 - uniform vec3 sceneBoxMin; - uniform vec3 sceneBoxMax; - #endif - - #include - #include - - #ifndef FRAGMENT_OUTPUT - #define FRAGMENT_OUTPUT vec4(vec3(ao), 1.) - #endif - - vec3 getViewPosition(const in vec2 screenPosition, const in float depth) { - vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0); - vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition; - return viewSpacePosition.xyz / viewSpacePosition.w; - } - - float getDepth(const vec2 uv) { - return textureLod(tDepth, uv.xy, 0.0).DEPTH_SWIZZLING; - } - - float fetchDepth(const ivec2 uv) { - return texelFetch(tDepth, uv.xy, 0).DEPTH_SWIZZLING; - } - - float getViewZ(const in float depth) { - #if PERSPECTIVE_CAMERA == 1 - return perspectiveDepthToViewZ(depth, cameraNear, cameraFar); - #else - return orthographicDepthToViewZ(depth, cameraNear, cameraFar); - #endif - } - - vec3 computeNormalFromDepth(const vec2 uv) { - vec2 size = vec2(textureSize(tDepth, 0)); - ivec2 p = ivec2(uv * size); - float c0 = fetchDepth(p); - float l2 = fetchDepth(p - ivec2(2, 0)); - float l1 = fetchDepth(p - ivec2(1, 0)); - float r1 = fetchDepth(p + ivec2(1, 0)); - float r2 = fetchDepth(p + ivec2(2, 0)); - float b2 = fetchDepth(p - ivec2(0, 2)); - float b1 = fetchDepth(p - ivec2(0, 1)); - float t1 = fetchDepth(p + ivec2(0, 1)); - float t2 = fetchDepth(p + ivec2(0, 2)); - float dl = abs((2.0 * l1 - l2) - c0); - float dr = abs((2.0 * r1 - r2) - c0); - float db = abs((2.0 * b1 - b2) - c0); - float dt = abs((2.0 * t1 - t2) - c0); - vec3 ce = getViewPosition(uv, c0).xyz; - vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz; - vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz; - return normalize(cross(dpdx, dpdy)); - } - - vec3 getViewNormal(const vec2 uv) { - #if NORMAL_VECTOR_TYPE == 2 - return normalize(textureLod(tNormal, uv, 0.).rgb); - #elif NORMAL_VECTOR_TYPE == 1 - return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb); - #else - return computeNormalFromDepth(uv); - #endif - } - - vec3 getSceneUvAndDepth(vec3 sampleViewPos) { - vec4 sampleClipPos = cameraProjectionMatrix * vec4(sampleViewPos, 1.); - vec2 sampleUv = sampleClipPos.xy / sampleClipPos.w * 0.5 + 0.5; - float sampleSceneDepth = getDepth(sampleUv); - return vec3(sampleUv, sampleSceneDepth); - } - - void main() { - float depth = getDepth(vUv.xy); - if (depth >= 1.0) { - discard; - return; - } - vec3 viewPos = getViewPosition(vUv, depth); - vec3 viewNormal = getViewNormal(vUv); - - float radiusToUse = radius; - float distanceFalloffToUse = thickness; - #if SCREEN_SPACE_RADIUS == 1 - float radiusScale = getViewPosition(vec2(0.5 + float(SCREEN_SPACE_RADIUS_SCALE) / resolution.x, 0.0), depth).x; - radiusToUse *= radiusScale; - distanceFalloffToUse *= radiusScale; - #endif - - #if SCENE_CLIP_BOX == 1 - vec3 worldPos = (cameraWorldMatrix * vec4(viewPos, 1.0)).xyz; - float boxDistance = length(max(vec3(0.0), max(sceneBoxMin - worldPos, worldPos - sceneBoxMax))); - if (boxDistance > radiusToUse) { - discard; - return; - } - #endif - - vec2 noiseResolution = vec2(textureSize(tNoise, 0)); - vec2 noiseUv = vUv * resolution / noiseResolution; - vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0); - vec3 randomVec = noiseTexel.xyz * 2.0 - 1.0; - vec3 tangent = normalize(vec3(randomVec.xy, 0.)); - vec3 bitangent = vec3(-tangent.y, tangent.x, 0.); - mat3 kernelMatrix = mat3(tangent, bitangent, vec3(0., 0., 1.)); - - const int DIRECTIONS = SAMPLES < 30 ? 3 : 5; - const int STEPS = (SAMPLES + DIRECTIONS - 1) / DIRECTIONS; - float ao = 0.0; - for (int i = 0; i < DIRECTIONS; ++i) { - - float angle = float(i) / float(DIRECTIONS) * PI; - vec4 sampleDir = vec4(cos(angle), sin(angle), 0., 0.5 + 0.5 * noiseTexel.w); - sampleDir.xyz = normalize(kernelMatrix * sampleDir.xyz); - - vec3 viewDir = normalize(-viewPos.xyz); - vec3 sliceBitangent = normalize(cross(sampleDir.xyz, viewDir)); - vec3 sliceTangent = cross(sliceBitangent, viewDir); - vec3 normalInSlice = normalize(viewNormal - sliceBitangent * dot(viewNormal, sliceBitangent)); - - vec3 tangentToNormalInSlice = cross(normalInSlice, sliceBitangent); - vec2 cosHorizons = vec2(dot(viewDir, tangentToNormalInSlice), dot(viewDir, -tangentToNormalInSlice)); - - for (int j = 0; j < STEPS; ++j) { - vec3 sampleViewOffset = sampleDir.xyz * radiusToUse * sampleDir.w * pow(float(j + 1) / float(STEPS), distanceExponent); - - vec3 sampleSceneUvDepth = getSceneUvAndDepth(viewPos + sampleViewOffset); - vec3 sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z); - vec3 viewDelta = sampleSceneViewPos - viewPos; - if (abs(viewDelta.z) < thickness) { - float sampleCosHorizon = dot(viewDir, normalize(viewDelta)); - cosHorizons.x += max(0., (sampleCosHorizon - cosHorizons.x) * mix(1., 2. / float(j + 2), distanceFallOff)); - } - - sampleSceneUvDepth = getSceneUvAndDepth(viewPos - sampleViewOffset); - sampleSceneViewPos = getViewPosition(sampleSceneUvDepth.xy, sampleSceneUvDepth.z); - viewDelta = sampleSceneViewPos - viewPos; - if (abs(viewDelta.z) < thickness) { - float sampleCosHorizon = dot(viewDir, normalize(viewDelta)); - cosHorizons.y += max(0., (sampleCosHorizon - cosHorizons.y) * mix(1., 2. / float(j + 2), distanceFallOff)); - } - } - - vec2 sinHorizons = sqrt(1. - cosHorizons * cosHorizons); - float nx = dot(normalInSlice, sliceTangent); - float ny = dot(normalInSlice, viewDir); - float nxb = 1. / 2. * (acos(cosHorizons.y) - acos(cosHorizons.x) + sinHorizons.x * cosHorizons.x - sinHorizons.y * cosHorizons.y); - float nyb = 1. / 2. * (2. - cosHorizons.x * cosHorizons.x - cosHorizons.y * cosHorizons.y); - float occlusion = nx * nxb + ny * nyb; - ao += occlusion; - } - - ao = clamp(ao / float(DIRECTIONS), 0., 1.); - #if SCENE_CLIP_BOX == 1 - ao = mix(ao, 1., smoothstep(0., radiusToUse, boxDistance)); - #endif - ao = pow(ao, scale); - - gl_FragColor = FRAGMENT_OUTPUT; - }` - -}; - -const GTAODepthShader = { - - name: 'GTAODepthShader', - - defines: { - PERSPECTIVE_CAMERA: 1 - }, - - uniforms: { - tDepth: { value: null }, - cameraNear: { value: null }, - cameraFar: { value: null }, - }, - - vertexShader: /* glsl */` - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - uniform sampler2D tDepth; - uniform float cameraNear; - uniform float cameraFar; - varying vec2 vUv; - - #include - - float getLinearDepth( const in vec2 screenPosition ) { - #if PERSPECTIVE_CAMERA == 1 - float fragCoordZ = texture2D( tDepth, screenPosition ).x; - float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); - return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); - #else - return texture2D( tDepth, screenPosition ).x; - #endif - } - - void main() { - float depth = getLinearDepth( vUv ); - gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 ); - - }` - -}; - -const GTAOBlendShader = { - - name: 'GTAOBlendShader', - - uniforms: { - tDiffuse: { value: null }, - intensity: { value: 1.0 } - }, - - vertexShader: /* glsl */` - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - uniform float intensity; - uniform sampler2D tDiffuse; - varying vec2 vUv; - - void main() { - vec4 texel = texture2D( tDiffuse, vUv ); - gl_FragColor = vec4(mix(vec3(1.), texel.rgb, intensity), texel.a); - }` - -}; - - -function generateMagicSquareNoise( size = 5 ) { - - const noiseSize = Math.floor( size ) % 2 === 0 ? Math.floor( size ) + 1 : Math.floor( size ); - const magicSquare = generateMagicSquare( noiseSize ); - const noiseSquareSize = magicSquare.length; - const data = new Uint8Array( noiseSquareSize * 4 ); - - for ( let inx = 0; inx < noiseSquareSize; ++ inx ) { - - const iAng = magicSquare[ inx ]; - const angle = ( 2 * Math.PI * iAng ) / noiseSquareSize; - const randomVec = new Vector3( - Math.cos( angle ), - Math.sin( angle ), - 0 - ).normalize(); - data[ inx * 4 ] = ( randomVec.x * 0.5 + 0.5 ) * 255; - data[ inx * 4 + 1 ] = ( randomVec.y * 0.5 + 0.5 ) * 255; - data[ inx * 4 + 2 ] = 127; - data[ inx * 4 + 3 ] = 255; - - } - - const noiseTexture = new DataTexture( data, noiseSize, noiseSize ); - noiseTexture.wrapS = RepeatWrapping; - noiseTexture.wrapT = RepeatWrapping; - noiseTexture.needsUpdate = true; - - return noiseTexture; - -} - -function generateMagicSquare( size ) { - - const noiseSize = Math.floor( size ) % 2 === 0 ? Math.floor( size ) + 1 : Math.floor( size ); - const noiseSquareSize = noiseSize * noiseSize; - const magicSquare = Array( noiseSquareSize ).fill( 0 ); - let i = Math.floor( noiseSize / 2 ); - let j = noiseSize - 1; - - for ( let num = 1; num <= noiseSquareSize; ) { - - if ( i === - 1 && j === noiseSize ) { - - j = noiseSize - 2; - i = 0; - - } else { - - if ( j === noiseSize ) { - - j = 0; - - } - - if ( i < 0 ) { - - i = noiseSize - 1; - - } - - } - - if ( magicSquare[ i * noiseSize + j ] !== 0 ) { - - j -= 2; - i ++; - continue; - - } else { - - magicSquare[ i * noiseSize + j ] = num ++; - - } - - j ++; - i --; - - } - - return magicSquare; - -} - - -export { generateMagicSquareNoise, GTAOShader, GTAODepthShader, GTAOBlendShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GammaCorrectionShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GammaCorrectionShader.js deleted file mode 100644 index 7199604..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GammaCorrectionShader.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Gamma Correction Shader - * http://en.wikipedia.org/wiki/gamma_correction - */ - -const GammaCorrectionShader = { - - name: 'GammaCorrectionShader', - - uniforms: { - - 'tDiffuse': { value: null } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 tex = texture2D( tDiffuse, vUv ); - - gl_FragColor = sRGBTransferOETF( tex ); - - }` - -}; - -export { GammaCorrectionShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryCompressionUtils.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryCompressionUtils.js deleted file mode 100644 index c25e8a9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryCompressionUtils.js +++ /dev/null @@ -1,639 +0,0 @@ -/** - * Octahedron and Quantization encodings based on work by: - * - * @link https://github.com/tsherif/mesh-quantization-example - * - */ - -import { - BufferAttribute, - Matrix3, - Matrix4, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import { PackedPhongMaterial } from './PackedPhongMaterial.js'; - - - -/** - * Make the input mesh.geometry's normal attribute encoded and compressed by 3 different methods. - * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the normal data. - * - * @param {THREE.Mesh} mesh - * @param {String} encodeMethod "DEFAULT" || "OCT1Byte" || "OCT2Byte" || "ANGLES" - * - */ -function compressNormals( mesh, encodeMethod ) { - - if ( ! mesh.geometry ) { - - console.error( 'Mesh must contain geometry. ' ); - - } - - const normal = mesh.geometry.attributes.normal; - - if ( ! normal ) { - - console.error( 'Geometry must contain normal attribute. ' ); - - } - - if ( normal.isPacked ) return; - - if ( normal.itemSize != 3 ) { - - console.error( 'normal.itemSize is not 3, which cannot be encoded. ' ); - - } - - const array = normal.array; - const count = normal.count; - - let result; - if ( encodeMethod == 'DEFAULT' ) { - - // TODO: Add 1 byte to the result, making the encoded length to be 4 bytes. - result = new Uint8Array( count * 3 ); - - for ( let idx = 0; idx < array.length; idx += 3 ) { - - const encoded = defaultEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 ); - - result[ idx + 0 ] = encoded[ 0 ]; - result[ idx + 1 ] = encoded[ 1 ]; - result[ idx + 2 ] = encoded[ 2 ]; - - } - - mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 3, true ) ); - mesh.geometry.attributes.normal.bytes = result.length * 1; - - } else if ( encodeMethod == 'OCT1Byte' ) { - - /** - * It is not recommended to use 1-byte octahedron normals encoding unless you want to extremely reduce the memory usage - * As it makes vertex data not aligned to a 4 byte boundary which may harm some WebGL implementations and sometimes the normal distortion is visible - * Please refer to @zeux 's comments in https://github.com/mrdoob/three.js/pull/18208 - */ - - result = new Int8Array( count * 2 ); - - for ( let idx = 0; idx < array.length; idx += 3 ) { - - const encoded = octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 1 ); - - result[ idx / 3 * 2 + 0 ] = encoded[ 0 ]; - result[ idx / 3 * 2 + 1 ] = encoded[ 1 ]; - - } - - mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 2, true ) ); - mesh.geometry.attributes.normal.bytes = result.length * 1; - - } else if ( encodeMethod == 'OCT2Byte' ) { - - result = new Int16Array( count * 2 ); - - for ( let idx = 0; idx < array.length; idx += 3 ) { - - const encoded = octEncodeBest( array[ idx ], array[ idx + 1 ], array[ idx + 2 ], 2 ); - - result[ idx / 3 * 2 + 0 ] = encoded[ 0 ]; - result[ idx / 3 * 2 + 1 ] = encoded[ 1 ]; - - } - - mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 2, true ) ); - mesh.geometry.attributes.normal.bytes = result.length * 2; - - } else if ( encodeMethod == 'ANGLES' ) { - - result = new Uint16Array( count * 2 ); - - for ( let idx = 0; idx < array.length; idx += 3 ) { - - const encoded = anglesEncode( array[ idx ], array[ idx + 1 ], array[ idx + 2 ] ); - - result[ idx / 3 * 2 + 0 ] = encoded[ 0 ]; - result[ idx / 3 * 2 + 1 ] = encoded[ 1 ]; - - } - - mesh.geometry.setAttribute( 'normal', new BufferAttribute( result, 2, true ) ); - mesh.geometry.attributes.normal.bytes = result.length * 2; - - } else { - - console.error( 'Unrecognized encoding method, should be `DEFAULT` or `ANGLES` or `OCT`. ' ); - - } - - mesh.geometry.attributes.normal.needsUpdate = true; - mesh.geometry.attributes.normal.isPacked = true; - mesh.geometry.attributes.normal.packingMethod = encodeMethod; - - // modify material - if ( ! ( mesh.material instanceof PackedPhongMaterial ) ) { - - mesh.material = new PackedPhongMaterial().copy( mesh.material ); - - } - - if ( encodeMethod == 'ANGLES' ) { - - mesh.material.defines.USE_PACKED_NORMAL = 0; - - } - - if ( encodeMethod == 'OCT1Byte' ) { - - mesh.material.defines.USE_PACKED_NORMAL = 1; - - } - - if ( encodeMethod == 'OCT2Byte' ) { - - mesh.material.defines.USE_PACKED_NORMAL = 1; - - } - - if ( encodeMethod == 'DEFAULT' ) { - - mesh.material.defines.USE_PACKED_NORMAL = 2; - - } - -} - - -/** - * Make the input mesh.geometry's position attribute encoded and compressed. - * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the position data. - * - * @param {THREE.Mesh} mesh - * - */ -function compressPositions( mesh ) { - - if ( ! mesh.geometry ) { - - console.error( 'Mesh must contain geometry. ' ); - - } - - const position = mesh.geometry.attributes.position; - - if ( ! position ) { - - console.error( 'Geometry must contain position attribute. ' ); - - } - - if ( position.isPacked ) return; - - if ( position.itemSize != 3 ) { - - console.error( 'position.itemSize is not 3, which cannot be packed. ' ); - - } - - const array = position.array; - const encodingBytes = 2; - - const result = quantizedEncode( array, encodingBytes ); - - const quantized = result.quantized; - const decodeMat = result.decodeMat; - - // IMPORTANT: calculate original geometry bounding info first, before updating packed positions - if ( mesh.geometry.boundingBox == null ) mesh.geometry.computeBoundingBox(); - if ( mesh.geometry.boundingSphere == null ) mesh.geometry.computeBoundingSphere(); - - mesh.geometry.setAttribute( 'position', new BufferAttribute( quantized, 3 ) ); - mesh.geometry.attributes.position.isPacked = true; - mesh.geometry.attributes.position.needsUpdate = true; - mesh.geometry.attributes.position.bytes = quantized.length * encodingBytes; - - // modify material - if ( ! ( mesh.material instanceof PackedPhongMaterial ) ) { - - mesh.material = new PackedPhongMaterial().copy( mesh.material ); - - } - - mesh.material.defines.USE_PACKED_POSITION = 0; - - mesh.material.uniforms.quantizeMatPos.value = decodeMat; - mesh.material.uniforms.quantizeMatPos.needsUpdate = true; - -} - -/** - * Make the input mesh.geometry's uv attribute encoded and compressed. - * Also will change the mesh.material to `PackedPhongMaterial` which let the vertex shader program decode the uv data. - * - * @param {THREE.Mesh} mesh - * - */ -function compressUvs( mesh ) { - - if ( ! mesh.geometry ) { - - console.error( 'Mesh must contain geometry property. ' ); - - } - - const uvs = mesh.geometry.attributes.uv; - - if ( ! uvs ) { - - console.error( 'Geometry must contain uv attribute. ' ); - - } - - if ( uvs.isPacked ) return; - - const range = { min: Infinity, max: - Infinity }; - - const array = uvs.array; - - for ( let i = 0; i < array.length; i ++ ) { - - range.min = Math.min( range.min, array[ i ] ); - range.max = Math.max( range.max, array[ i ] ); - - } - - let result; - - if ( range.min >= - 1.0 && range.max <= 1.0 ) { - - // use default encoding method - result = new Uint16Array( array.length ); - - for ( let i = 0; i < array.length; i += 2 ) { - - const encoded = defaultEncode( array[ i ], array[ i + 1 ], 0, 2 ); - - result[ i ] = encoded[ 0 ]; - result[ i + 1 ] = encoded[ 1 ]; - - } - - mesh.geometry.setAttribute( 'uv', new BufferAttribute( result, 2, true ) ); - mesh.geometry.attributes.uv.isPacked = true; - mesh.geometry.attributes.uv.needsUpdate = true; - mesh.geometry.attributes.uv.bytes = result.length * 2; - - if ( ! ( mesh.material instanceof PackedPhongMaterial ) ) { - - mesh.material = new PackedPhongMaterial().copy( mesh.material ); - - } - - mesh.material.defines.USE_PACKED_UV = 0; - - } else { - - // use quantized encoding method - result = quantizedEncodeUV( array, 2 ); - - mesh.geometry.setAttribute( 'uv', new BufferAttribute( result.quantized, 2 ) ); - mesh.geometry.attributes.uv.isPacked = true; - mesh.geometry.attributes.uv.needsUpdate = true; - mesh.geometry.attributes.uv.bytes = result.quantized.length * 2; - - if ( ! ( mesh.material instanceof PackedPhongMaterial ) ) { - - mesh.material = new PackedPhongMaterial().copy( mesh.material ); - - } - - mesh.material.defines.USE_PACKED_UV = 1; - - mesh.material.uniforms.quantizeMatUV.value = result.decodeMat; - mesh.material.uniforms.quantizeMatUV.needsUpdate = true; - - } - -} - - -// Encoding functions - -function defaultEncode( x, y, z, bytes ) { - - if ( bytes == 1 ) { - - const tmpx = Math.round( ( x + 1 ) * 0.5 * 255 ); - const tmpy = Math.round( ( y + 1 ) * 0.5 * 255 ); - const tmpz = Math.round( ( z + 1 ) * 0.5 * 255 ); - return new Uint8Array( [ tmpx, tmpy, tmpz ] ); - - } else if ( bytes == 2 ) { - - const tmpx = Math.round( ( x + 1 ) * 0.5 * 65535 ); - const tmpy = Math.round( ( y + 1 ) * 0.5 * 65535 ); - const tmpz = Math.round( ( z + 1 ) * 0.5 * 65535 ); - return new Uint16Array( [ tmpx, tmpy, tmpz ] ); - - } else { - - console.error( 'number of bytes must be 1 or 2' ); - - } - -} - -// for `Angles` encoding -function anglesEncode( x, y, z ) { - - const normal0 = parseInt( 0.5 * ( 1.0 + Math.atan2( y, x ) / Math.PI ) * 65535 ); - const normal1 = parseInt( 0.5 * ( 1.0 + z ) * 65535 ); - return new Uint16Array( [ normal0, normal1 ] ); - -} - -// for `Octahedron` encoding -function octEncodeBest( x, y, z, bytes ) { - - let oct, dec, best, currentCos, bestCos; - - // Test various combinations of ceil and floor - // to minimize rounding errors - best = oct = octEncodeVec3( x, y, z, 'floor', 'floor' ); - dec = octDecodeVec2( oct ); - bestCos = dot( x, y, z, dec ); - - oct = octEncodeVec3( x, y, z, 'ceil', 'floor' ); - dec = octDecodeVec2( oct ); - currentCos = dot( x, y, z, dec ); - - if ( currentCos > bestCos ) { - - best = oct; - bestCos = currentCos; - - } - - oct = octEncodeVec3( x, y, z, 'floor', 'ceil' ); - dec = octDecodeVec2( oct ); - currentCos = dot( x, y, z, dec ); - - if ( currentCos > bestCos ) { - - best = oct; - bestCos = currentCos; - - } - - oct = octEncodeVec3( x, y, z, 'ceil', 'ceil' ); - dec = octDecodeVec2( oct ); - currentCos = dot( x, y, z, dec ); - - if ( currentCos > bestCos ) { - - best = oct; - - } - - return best; - - function octEncodeVec3( x0, y0, z0, xfunc, yfunc ) { - - let x = x0 / ( Math.abs( x0 ) + Math.abs( y0 ) + Math.abs( z0 ) ); - let y = y0 / ( Math.abs( x0 ) + Math.abs( y0 ) + Math.abs( z0 ) ); - - if ( z < 0 ) { - - const tempx = ( 1 - Math.abs( y ) ) * ( x >= 0 ? 1 : - 1 ); - const tempy = ( 1 - Math.abs( x ) ) * ( y >= 0 ? 1 : - 1 ); - - x = tempx; - y = tempy; - - let diff = 1 - Math.abs( x ) - Math.abs( y ); - if ( diff > 0 ) { - - diff += 0.001; - x += x > 0 ? diff / 2 : - diff / 2; - y += y > 0 ? diff / 2 : - diff / 2; - - } - - } - - if ( bytes == 1 ) { - - return new Int8Array( [ - Math[ xfunc ]( x * 127.5 + ( x < 0 ? 1 : 0 ) ), - Math[ yfunc ]( y * 127.5 + ( y < 0 ? 1 : 0 ) ) - ] ); - - } - - if ( bytes == 2 ) { - - return new Int16Array( [ - Math[ xfunc ]( x * 32767.5 + ( x < 0 ? 1 : 0 ) ), - Math[ yfunc ]( y * 32767.5 + ( y < 0 ? 1 : 0 ) ) - ] ); - - } - - - } - - function octDecodeVec2( oct ) { - - let x = oct[ 0 ]; - let y = oct[ 1 ]; - - if ( bytes == 1 ) { - - x /= x < 0 ? 127 : 128; - y /= y < 0 ? 127 : 128; - - } else if ( bytes == 2 ) { - - x /= x < 0 ? 32767 : 32768; - y /= y < 0 ? 32767 : 32768; - - } - - - const z = 1 - Math.abs( x ) - Math.abs( y ); - - if ( z < 0 ) { - - const tmpx = x; - x = ( 1 - Math.abs( y ) ) * ( x >= 0 ? 1 : - 1 ); - y = ( 1 - Math.abs( tmpx ) ) * ( y >= 0 ? 1 : - 1 ); - - } - - const length = Math.sqrt( x * x + y * y + z * z ); - - return [ - x / length, - y / length, - z / length - ]; - - } - - function dot( x, y, z, vec3 ) { - - return x * vec3[ 0 ] + y * vec3[ 1 ] + z * vec3[ 2 ]; - - } - -} - -function quantizedEncode( array, bytes ) { - - let quantized, segments; - - if ( bytes == 1 ) { - - quantized = new Uint8Array( array.length ); - segments = 255; - - } else if ( bytes == 2 ) { - - quantized = new Uint16Array( array.length ); - segments = 65535; - - } else { - - console.error( 'number of bytes error! ' ); - - } - - const decodeMat = new Matrix4(); - - const min = new Float32Array( 3 ); - const max = new Float32Array( 3 ); - - min[ 0 ] = min[ 1 ] = min[ 2 ] = Number.MAX_VALUE; - max[ 0 ] = max[ 1 ] = max[ 2 ] = - Number.MAX_VALUE; - - for ( let i = 0; i < array.length; i += 3 ) { - - min[ 0 ] = Math.min( min[ 0 ], array[ i + 0 ] ); - min[ 1 ] = Math.min( min[ 1 ], array[ i + 1 ] ); - min[ 2 ] = Math.min( min[ 2 ], array[ i + 2 ] ); - max[ 0 ] = Math.max( max[ 0 ], array[ i + 0 ] ); - max[ 1 ] = Math.max( max[ 1 ], array[ i + 1 ] ); - max[ 2 ] = Math.max( max[ 2 ], array[ i + 2 ] ); - - } - - decodeMat.scale( new Vector3( - ( max[ 0 ] - min[ 0 ] ) / segments, - ( max[ 1 ] - min[ 1 ] ) / segments, - ( max[ 2 ] - min[ 2 ] ) / segments - ) ); - - decodeMat.elements[ 12 ] = min[ 0 ]; - decodeMat.elements[ 13 ] = min[ 1 ]; - decodeMat.elements[ 14 ] = min[ 2 ]; - - decodeMat.transpose(); - - - const multiplier = new Float32Array( [ - max[ 0 ] !== min[ 0 ] ? segments / ( max[ 0 ] - min[ 0 ] ) : 0, - max[ 1 ] !== min[ 1 ] ? segments / ( max[ 1 ] - min[ 1 ] ) : 0, - max[ 2 ] !== min[ 2 ] ? segments / ( max[ 2 ] - min[ 2 ] ) : 0 - ] ); - - for ( let i = 0; i < array.length; i += 3 ) { - - quantized[ i + 0 ] = Math.floor( ( array[ i + 0 ] - min[ 0 ] ) * multiplier[ 0 ] ); - quantized[ i + 1 ] = Math.floor( ( array[ i + 1 ] - min[ 1 ] ) * multiplier[ 1 ] ); - quantized[ i + 2 ] = Math.floor( ( array[ i + 2 ] - min[ 2 ] ) * multiplier[ 2 ] ); - - } - - return { - quantized: quantized, - decodeMat: decodeMat - }; - -} - -function quantizedEncodeUV( array, bytes ) { - - let quantized, segments; - - if ( bytes == 1 ) { - - quantized = new Uint8Array( array.length ); - segments = 255; - - } else if ( bytes == 2 ) { - - quantized = new Uint16Array( array.length ); - segments = 65535; - - } else { - - console.error( 'number of bytes error! ' ); - - } - - const decodeMat = new Matrix3(); - - const min = new Float32Array( 2 ); - const max = new Float32Array( 2 ); - - min[ 0 ] = min[ 1 ] = Number.MAX_VALUE; - max[ 0 ] = max[ 1 ] = - Number.MAX_VALUE; - - for ( let i = 0; i < array.length; i += 2 ) { - - min[ 0 ] = Math.min( min[ 0 ], array[ i + 0 ] ); - min[ 1 ] = Math.min( min[ 1 ], array[ i + 1 ] ); - max[ 0 ] = Math.max( max[ 0 ], array[ i + 0 ] ); - max[ 1 ] = Math.max( max[ 1 ], array[ i + 1 ] ); - - } - - decodeMat.scale( - ( max[ 0 ] - min[ 0 ] ) / segments, - ( max[ 1 ] - min[ 1 ] ) / segments - ); - - decodeMat.elements[ 6 ] = min[ 0 ]; - decodeMat.elements[ 7 ] = min[ 1 ]; - - decodeMat.transpose(); - - const multiplier = new Float32Array( [ - max[ 0 ] !== min[ 0 ] ? segments / ( max[ 0 ] - min[ 0 ] ) : 0, - max[ 1 ] !== min[ 1 ] ? segments / ( max[ 1 ] - min[ 1 ] ) : 0 - ] ); - - for ( let i = 0; i < array.length; i += 2 ) { - - quantized[ i + 0 ] = Math.floor( ( array[ i + 0 ] - min[ 0 ] ) * multiplier[ 0 ] ); - quantized[ i + 1 ] = Math.floor( ( array[ i + 1 ] - min[ 1 ] ) * multiplier[ 1 ] ); - - } - - return { - quantized: quantized, - decodeMat: decodeMat - }; - -} - - - -export { - compressNormals, - compressPositions, - compressUvs, -}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryUtils.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryUtils.js deleted file mode 100644 index 79fabbc..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GeometryUtils.js +++ /dev/null @@ -1,221 +0,0 @@ -import { Vector3 } from '/static/javascript/three/build/three.module.js'; - - -/** - * Generates 2D-Coordinates in a very fast way. - * - * Based on work by: - * @link http://www.openprocessing.org/sketch/15493 - * - * @param center Center of Hilbert curve. - * @param size Total width of Hilbert curve. - * @param iterations Number of subdivisions. - * @param v0 Corner index -X, -Z. - * @param v1 Corner index -X, +Z. - * @param v2 Corner index +X, +Z. - * @param v3 Corner index +X, -Z. - */ -function hilbert2D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3 ) { - - const half = size / 2; - - const vec_s = [ - new Vector3( center.x - half, center.y, center.z - half ), - new Vector3( center.x - half, center.y, center.z + half ), - new Vector3( center.x + half, center.y, center.z + half ), - new Vector3( center.x + half, center.y, center.z - half ) - ]; - - const vec = [ - vec_s[ v0 ], - vec_s[ v1 ], - vec_s[ v2 ], - vec_s[ v3 ] - ]; - - // Recurse iterations - if ( 0 <= -- iterations ) { - - return [ - ...hilbert2D( vec[ 0 ], half, iterations, v0, v3, v2, v1 ), - ...hilbert2D( vec[ 1 ], half, iterations, v0, v1, v2, v3 ), - ...hilbert2D( vec[ 2 ], half, iterations, v0, v1, v2, v3 ), - ...hilbert2D( vec[ 3 ], half, iterations, v2, v1, v0, v3 ) - ]; - - } - - // Return complete Hilbert Curve. - return vec; - -} - -/** - * Generates 3D-Coordinates in a very fast way. - * - * Based on work by: - * @link https://openprocessing.org/user/5654 - * - * @param center Center of Hilbert curve. - * @param size Total width of Hilbert curve. - * @param iterations Number of subdivisions. - * @param v0 Corner index -X, +Y, -Z. - * @param v1 Corner index -X, +Y, +Z. - * @param v2 Corner index -X, -Y, +Z. - * @param v3 Corner index -X, -Y, -Z. - * @param v4 Corner index +X, -Y, -Z. - * @param v5 Corner index +X, -Y, +Z. - * @param v6 Corner index +X, +Y, +Z. - * @param v7 Corner index +X, +Y, -Z. - */ -function hilbert3D( center = new Vector3( 0, 0, 0 ), size = 10, iterations = 1, v0 = 0, v1 = 1, v2 = 2, v3 = 3, v4 = 4, v5 = 5, v6 = 6, v7 = 7 ) { - - // Default Vars - const half = size / 2; - - const vec_s = [ - new Vector3( center.x - half, center.y + half, center.z - half ), - new Vector3( center.x - half, center.y + half, center.z + half ), - new Vector3( center.x - half, center.y - half, center.z + half ), - new Vector3( center.x - half, center.y - half, center.z - half ), - new Vector3( center.x + half, center.y - half, center.z - half ), - new Vector3( center.x + half, center.y - half, center.z + half ), - new Vector3( center.x + half, center.y + half, center.z + half ), - new Vector3( center.x + half, center.y + half, center.z - half ) - ]; - - const vec = [ - vec_s[ v0 ], - vec_s[ v1 ], - vec_s[ v2 ], - vec_s[ v3 ], - vec_s[ v4 ], - vec_s[ v5 ], - vec_s[ v6 ], - vec_s[ v7 ] - ]; - - // Recurse iterations - if ( -- iterations >= 0 ) { - - return [ - ...hilbert3D( vec[ 0 ], half, iterations, v0, v3, v4, v7, v6, v5, v2, v1 ), - ...hilbert3D( vec[ 1 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ), - ...hilbert3D( vec[ 2 ], half, iterations, v0, v7, v6, v1, v2, v5, v4, v3 ), - ...hilbert3D( vec[ 3 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ), - ...hilbert3D( vec[ 4 ], half, iterations, v2, v3, v0, v1, v6, v7, v4, v5 ), - ...hilbert3D( vec[ 5 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ), - ...hilbert3D( vec[ 6 ], half, iterations, v4, v3, v2, v5, v6, v1, v0, v7 ), - ...hilbert3D( vec[ 7 ], half, iterations, v6, v5, v2, v1, v0, v3, v4, v7 ) - ]; - - } - - // Return complete Hilbert Curve. - return vec; - -} - -/** - * Generates a Gosper curve (lying in the XY plane) - * - * https://gist.github.com/nitaku/6521802 - * - * @param size The size of a single gosper island. - */ -function gosper( size = 1 ) { - - function fractalize( config ) { - - let output; - let input = config.axiom; - - for ( let i = 0, il = config.steps; 0 <= il ? i < il : i > il; 0 <= il ? i ++ : i -- ) { - - output = ''; - - for ( let j = 0, jl = input.length; j < jl; j ++ ) { - - const char = input[ j ]; - - if ( char in config.rules ) { - - output += config.rules[ char ]; - - } else { - - output += char; - - } - - } - - input = output; - - } - - return output; - - } - - function toPoints( config ) { - - let currX = 0, currY = 0; - let angle = 0; - const path = [ 0, 0, 0 ]; - const fractal = config.fractal; - - for ( let i = 0, l = fractal.length; i < l; i ++ ) { - - const char = fractal[ i ]; - - if ( char === '+' ) { - - angle += config.angle; - - } else if ( char === '-' ) { - - angle -= config.angle; - - } else if ( char === 'F' ) { - - currX += config.size * Math.cos( angle ); - currY += - config.size * Math.sin( angle ); - path.push( currX, currY, 0 ); - - } - - } - - return path; - - } - - // - - const gosper = fractalize( { - axiom: 'A', - steps: 4, - rules: { - A: 'A+BF++BF-FA--FAFA-BF+', - B: '-FA+BFBF++BF+FA--FA-B' - } - } ); - - const points = toPoints( { - fractal: gosper, - size: size, - angle: Math.PI / 3 // 60 degrees - } ); - - return points; - -} - - - -export { - hilbert2D, - hilbert3D, - gosper, -}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GlitchPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GlitchPass.js deleted file mode 100644 index acd5ff9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GlitchPass.js +++ /dev/null @@ -1,125 +0,0 @@ -import { - DataTexture, - FloatType, - MathUtils, - RedFormat, - ShaderMaterial, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { DigitalGlitch } from '../shaders/DigitalGlitch.js'; - -class GlitchPass extends Pass { - - constructor( dt_size = 64 ) { - - super(); - - const shader = DigitalGlitch; - - this.uniforms = UniformsUtils.clone( shader.uniforms ); - - this.heightMap = this.generateHeightmap( dt_size ); - - this.uniforms[ 'tDisp' ].value = this.heightMap; - - this.material = new ShaderMaterial( { - uniforms: this.uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - } ); - - this.fsQuad = new FullScreenQuad( this.material ); - - this.goWild = false; - this.curF = 0; - this.generateTrigger(); - - } - - render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { - - this.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.uniforms[ 'seed' ].value = Math.random();//default seeding - this.uniforms[ 'byp' ].value = 0; - - if ( this.curF % this.randX == 0 || this.goWild == true ) { - - this.uniforms[ 'amount' ].value = Math.random() / 30; - this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI ); - this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 1, 1 ); - this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 1, 1 ); - this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 ); - this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 ); - this.curF = 0; - this.generateTrigger(); - - } else if ( this.curF % this.randX < this.randX / 5 ) { - - this.uniforms[ 'amount' ].value = Math.random() / 90; - this.uniforms[ 'angle' ].value = MathUtils.randFloat( - Math.PI, Math.PI ); - this.uniforms[ 'distortion_x' ].value = MathUtils.randFloat( 0, 1 ); - this.uniforms[ 'distortion_y' ].value = MathUtils.randFloat( 0, 1 ); - this.uniforms[ 'seed_x' ].value = MathUtils.randFloat( - 0.3, 0.3 ); - this.uniforms[ 'seed_y' ].value = MathUtils.randFloat( - 0.3, 0.3 ); - - } else if ( this.goWild == false ) { - - this.uniforms[ 'byp' ].value = 1; - - } - - this.curF ++; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - } - - generateTrigger() { - - this.randX = MathUtils.randInt( 120, 240 ); - - } - - generateHeightmap( dt_size ) { - - const data_arr = new Float32Array( dt_size * dt_size ); - const length = dt_size * dt_size; - - for ( let i = 0; i < length; i ++ ) { - - const val = MathUtils.randFloat( 0, 1 ); - data_arr[ i ] = val; - - } - - const texture = new DataTexture( data_arr, dt_size, dt_size, RedFormat, FloatType ); - texture.needsUpdate = true; - return texture; - - } - - dispose() { - - this.material.dispose(); - - this.heightMap.dispose(); - - this.fsQuad.dispose(); - - } - -} - -export { GlitchPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/GodRaysShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/GodRaysShader.js deleted file mode 100644 index a0c5520..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/GodRaysShader.js +++ /dev/null @@ -1,321 +0,0 @@ -import { - Color, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * God-rays (crepuscular rays) - * - * Similar implementation to the one used by Crytek for CryEngine 2 [Sousa2008]. - * Blurs a mask generated from the depth map along radial lines emanating from the light - * source. The blur repeatedly applies a blur filter of increasing support but constant - * sample count to produce a blur filter with large support. - * - * My implementation performs 3 passes, similar to the implementation from Sousa. I found - * just 6 samples per pass produced acceptible results. The blur is applied three times, - * with decreasing filter support. The result is equivalent to a single pass with - * 6*6*6 = 216 samples. - * - * References: - * - * Sousa2008 - Crysis Next Gen Effects, GDC2008, http://www.crytek.com/sites/default/files/GDC08_SousaT_CrysisEffects.ppt - */ - -const GodRaysDepthMaskShader = { - - name: 'GodRaysDepthMaskShader', - - uniforms: { - - tInput: { - value: null - } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - varying vec2 vUv; - - uniform sampler2D tInput; - - void main() { - - gl_FragColor = vec4( 1.0 ) - texture2D( tInput, vUv ); - - }` - -}; - - -/** - * The god-ray generation shader. - * - * First pass: - * - * The depth map is blurred along radial lines towards the "sun". The - * output is written to a temporary render target (I used a 1/4 sized - * target). - * - * Pass two & three: - * - * The results of the previous pass are re-blurred, each time with a - * decreased distance between samples. - */ - -const GodRaysGenerateShader = { - - name: 'GodRaysGenerateShader', - - uniforms: { - - tInput: { - value: null - }, - fStepSize: { - value: 1.0 - }, - vSunPositionScreenSpace: { - value: new Vector3() - } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #define TAPS_PER_PASS 6.0 - - varying vec2 vUv; - - uniform sampler2D tInput; - - uniform vec3 vSunPositionScreenSpace; - uniform float fStepSize; // filter step size - - void main() { - - // delta from current pixel to "sun" position - - vec2 delta = vSunPositionScreenSpace.xy - vUv; - float dist = length( delta ); - - // Step vector (uv space) - - vec2 stepv = fStepSize * delta / dist; - - // Number of iterations between pixel and sun - - float iters = dist/fStepSize; - - vec2 uv = vUv.xy; - float col = 0.0; - - // This breaks ANGLE in Chrome 22 - // - see http://code.google.com/p/chromium/issues/detail?id=153105 - - /* - // Unrolling didnt do much on my hardware (ATI Mobility Radeon 3450), - // so i've just left the loop - - "for ( float i = 0.0; i < TAPS_PER_PASS; i += 1.0 ) {", - - // Accumulate samples, making sure we dont walk past the light source. - - // The check for uv.y < 1 would not be necessary with "border" UV wrap - // mode, with a black border color. I don't think this is currently - // exposed by three.js. As a result there might be artifacts when the - // sun is to the left, right or bottom of screen as these cases are - // not specifically handled. - - " col += ( i <= iters && uv.y < 1.0 ? texture2D( tInput, uv ).r : 0.0 );", - " uv += stepv;", - - "}", - */ - - // Unrolling loop manually makes it work in ANGLE - - float f = min( 1.0, max( vSunPositionScreenSpace.z / 1000.0, 0.0 ) ); // used to fade out godrays - - if ( 0.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - if ( 1.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - if ( 2.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - if ( 3.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - if ( 4.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - if ( 5.0 <= iters && uv.y < 1.0 ) col += texture2D( tInput, uv ).r * f; - uv += stepv; - - // Should technically be dividing by 'iters but 'TAPS_PER_PASS' smooths out - // objectionable artifacts, in particular near the sun position. The side - // effect is that the result is darker than it should be around the sun, as - // TAPS_PER_PASS is greater than the number of samples actually accumulated. - // When the result is inverted (in the shader 'godrays_combine this produces - // a slight bright spot at the position of the sun, even when it is occluded. - - gl_FragColor = vec4( col/TAPS_PER_PASS ); - gl_FragColor.a = 1.0; - - }` - -}; - -/** - * Additively applies god rays from texture tGodRays to a background (tColors). - * fGodRayIntensity attenuates the god rays. - */ - -const GodRaysCombineShader = { - - name: 'GodRaysCombineShader', - - uniforms: { - - tColors: { - value: null - }, - - tGodRays: { - value: null - }, - - fGodRayIntensity: { - value: 0.69 - } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - varying vec2 vUv; - - uniform sampler2D tColors; - uniform sampler2D tGodRays; - - uniform float fGodRayIntensity; - - void main() { - - // Since THREE.MeshDepthMaterial renders foreground objects white and background - // objects black, the god-rays will be white streaks. Therefore value is inverted - // before being combined with tColors - - gl_FragColor = texture2D( tColors, vUv ) + fGodRayIntensity * vec4( 1.0 - texture2D( tGodRays, vUv ).r ); - gl_FragColor.a = 1.0; - - }` - -}; - - -/** - * A dodgy sun/sky shader. Makes a bright spot at the sun location. Would be - * cheaper/faster/simpler to implement this as a simple sun sprite. - */ - -const GodRaysFakeSunShader = { - - name: 'GodRaysFakeSunShader', - - uniforms: { - - vSunPositionScreenSpace: { - value: new Vector3() - }, - - fAspect: { - value: 1.0 - }, - - sunColor: { - value: new Color( 0xffee00 ) - }, - - bgColor: { - value: new Color( 0x000000 ) - } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - varying vec2 vUv; - - uniform vec3 vSunPositionScreenSpace; - uniform float fAspect; - - uniform vec3 sunColor; - uniform vec3 bgColor; - - void main() { - - vec2 diff = vUv - vSunPositionScreenSpace.xy; - - // Correct for aspect ratio - - diff.x *= fAspect; - - float prop = clamp( length( diff ) / 0.5, 0.0, 1.0 ); - prop = 0.35 * pow( 1.0 - prop, 3.0 ); - - gl_FragColor.xyz = ( vSunPositionScreenSpace.z > 0.0 ) ? mix( sunColor, bgColor, 1.0 - prop ) : bgColor; - gl_FragColor.w = 1.0; - - }` - -}; - -export { GodRaysDepthMaskShader, GodRaysGenerateShader, GodRaysCombineShader, GodRaysFakeSunShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HDRCubeTextureLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HDRCubeTextureLoader.js deleted file mode 100644 index 727e3f1..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HDRCubeTextureLoader.js +++ /dev/null @@ -1,115 +0,0 @@ -import { - CubeTexture, - DataTexture, - FileLoader, - FloatType, - HalfFloatType, - LinearFilter, - LinearSRGBColorSpace, - Loader -} from '/static/javascript/three/build/three.module.js'; -import { RGBELoader } from '../loaders/RGBELoader.js'; - -class HDRCubeTextureLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.hdrLoader = new RGBELoader(); - this.type = HalfFloatType; - - } - - load( urls, onLoad, onProgress, onError ) { - - const texture = new CubeTexture(); - - texture.type = this.type; - - switch ( texture.type ) { - - case FloatType: - - texture.colorSpace = LinearSRGBColorSpace; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - break; - - case HalfFloatType: - - texture.colorSpace = LinearSRGBColorSpace; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - break; - - } - - const scope = this; - - let loaded = 0; - - function loadHDRData( i, onLoad, onProgress, onError ) { - - new FileLoader( scope.manager ) - .setPath( scope.path ) - .setResponseType( 'arraybuffer' ) - .setWithCredentials( scope.withCredentials ) - .load( urls[ i ], function ( buffer ) { - - loaded ++; - - const texData = scope.hdrLoader.parse( buffer ); - - if ( ! texData ) return; - - if ( texData.data !== undefined ) { - - const dataTexture = new DataTexture( texData.data, texData.width, texData.height ); - - dataTexture.type = texture.type; - dataTexture.colorSpace = texture.colorSpace; - dataTexture.format = texture.format; - dataTexture.minFilter = texture.minFilter; - dataTexture.magFilter = texture.magFilter; - dataTexture.generateMipmaps = texture.generateMipmaps; - - texture.images[ i ] = dataTexture; - - } - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - if ( onLoad ) onLoad( texture ); - - } - - }, onProgress, onError ); - - } - - for ( let i = 0; i < urls.length; i ++ ) { - - loadHDRData( i, onLoad, onProgress, onError ); - - } - - return texture; - - } - - setDataType( value ) { - - this.type = value; - this.hdrLoader.setDataType( value ); - - return this; - - } - -} - -export { HDRCubeTextureLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HalftonePass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HalftonePass.js deleted file mode 100644 index dae6a9e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HalftonePass.js +++ /dev/null @@ -1,79 +0,0 @@ -import { - ShaderMaterial, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { HalftoneShader } from '../shaders/HalftoneShader.js'; - -/** - * RGB Halftone pass for three.js effects composer. Requires HalftoneShader. - */ - -class HalftonePass extends Pass { - - constructor( width, height, params ) { - - super(); - - this.uniforms = UniformsUtils.clone( HalftoneShader.uniforms ); - this.material = new ShaderMaterial( { - uniforms: this.uniforms, - fragmentShader: HalftoneShader.fragmentShader, - vertexShader: HalftoneShader.vertexShader - } ); - - // set params - this.uniforms.width.value = width; - this.uniforms.height.value = height; - - for ( const key in params ) { - - if ( params.hasOwnProperty( key ) && this.uniforms.hasOwnProperty( key ) ) { - - this.uniforms[ key ].value = params[ key ]; - - } - - } - - this.fsQuad = new FullScreenQuad( this.material ); - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive*/ ) { - - this.material.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - } - - setSize( width, height ) { - - this.uniforms.width.value = width; - this.uniforms.height.value = height; - - } - - dispose() { - - this.material.dispose(); - - this.fsQuad.dispose(); - - } - -} - -export { HalftonePass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HalftoneShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HalftoneShader.js deleted file mode 100644 index 08fba05..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HalftoneShader.js +++ /dev/null @@ -1,312 +0,0 @@ -/** - * RGB Halftone shader for three.js. - * NOTE: - * Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square) - * Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker) - */ - -const HalftoneShader = { - - name: 'HalftoneShader', - - uniforms: { - 'tDiffuse': { value: null }, - 'shape': { value: 1 }, - 'radius': { value: 4 }, - 'rotateR': { value: Math.PI / 12 * 1 }, - 'rotateG': { value: Math.PI / 12 * 2 }, - 'rotateB': { value: Math.PI / 12 * 3 }, - 'scatter': { value: 0 }, - 'width': { value: 1 }, - 'height': { value: 1 }, - 'blending': { value: 1 }, - 'blendingMode': { value: 1 }, - 'greyscale': { value: false }, - 'disable': { value: false } - }, - - vertexShader: /* glsl */` - - varying vec2 vUV; - - void main() { - - vUV = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - - }`, - - fragmentShader: /* glsl */` - - #define SQRT2_MINUS_ONE 0.41421356 - #define SQRT2_HALF_MINUS_ONE 0.20710678 - #define PI2 6.28318531 - #define SHAPE_DOT 1 - #define SHAPE_ELLIPSE 2 - #define SHAPE_LINE 3 - #define SHAPE_SQUARE 4 - #define BLENDING_LINEAR 1 - #define BLENDING_MULTIPLY 2 - #define BLENDING_ADD 3 - #define BLENDING_LIGHTER 4 - #define BLENDING_DARKER 5 - uniform sampler2D tDiffuse; - uniform float radius; - uniform float rotateR; - uniform float rotateG; - uniform float rotateB; - uniform float scatter; - uniform float width; - uniform float height; - uniform int shape; - uniform bool disable; - uniform float blending; - uniform int blendingMode; - varying vec2 vUV; - uniform bool greyscale; - const int samples = 8; - - float blend( float a, float b, float t ) { - - // linear blend - return a * ( 1.0 - t ) + b * t; - - } - - float hypot( float x, float y ) { - - // vector magnitude - return sqrt( x * x + y * y ); - - } - - float rand( vec2 seed ){ - - // get pseudo-random number - return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 ); - - } - - float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) { - - // apply shape-specific transforms - float dist = hypot( coord.x - p.x, coord.y - p.y ); - float rad = channel; - - if ( shape == SHAPE_DOT ) { - - rad = pow( abs( rad ), 1.125 ) * rad_max; - - } else if ( shape == SHAPE_ELLIPSE ) { - - rad = pow( abs( rad ), 1.125 ) * rad_max; - - if ( dist != 0.0 ) { - float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y ); - dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE; - } - - } else if ( shape == SHAPE_LINE ) { - - rad = pow( abs( rad ), 1.5) * rad_max; - float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y; - dist = hypot( normal.x * dot_p, normal.y * dot_p ); - - } else if ( shape == SHAPE_SQUARE ) { - - float theta = atan( p.y - coord.y, p.x - coord.x ) - angle; - float sin_t = abs( sin( theta ) ); - float cos_t = abs( cos( theta ) ); - rad = pow( abs( rad ), 1.4 ); - rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) ); - - } - - return rad - dist; - - } - - struct Cell { - - // grid sample positions - vec2 normal; - vec2 p1; - vec2 p2; - vec2 p3; - vec2 p4; - float samp2; - float samp1; - float samp3; - float samp4; - - }; - - vec4 getSample( vec2 point ) { - - // multi-sampled point - vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) ); - float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2; - float step = PI2 / float( samples ); - float dist = radius * 0.66; - - for ( int i = 0; i < samples; ++i ) { - - float r = base + step * float( i ); - vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist ); - tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) ); - - } - - tex /= float( samples ) + 1.0; - return tex; - - } - - float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) { - - // get colour for given point - float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res; - - if ( channel == 0 ) { - - c.samp1 = getSample( c.p1 ).r; - c.samp2 = getSample( c.p2 ).r; - c.samp3 = getSample( c.p3 ).r; - c.samp4 = getSample( c.p4 ).r; - - } else if (channel == 1) { - - c.samp1 = getSample( c.p1 ).g; - c.samp2 = getSample( c.p2 ).g; - c.samp3 = getSample( c.p3 ).g; - c.samp4 = getSample( c.p4 ).g; - - } else { - - c.samp1 = getSample( c.p1 ).b; - c.samp3 = getSample( c.p3 ).b; - c.samp2 = getSample( c.p2 ).b; - c.samp4 = getSample( c.p4 ).b; - - } - - dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius ); - dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius ); - dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius ); - dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius ); - res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0; - res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0; - res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0; - res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0; - res = clamp( res, 0.0, 1.0 ); - - return res; - - } - - Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) { - - // get containing cell - Cell c; - - // calc grid - vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) ); - float threshold = step * 0.5; - float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y ); - float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y ); - vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal ); - float offset_normal = mod( hypot( offset.x, offset.y ), step ); - float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0; - float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir; - float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step ); - float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0; - float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir; - - // get closest corner - c.normal = n; - c.p1.x = p.x - n.x * normal_scale + n.y * line_scale; - c.p1.y = p.y - n.y * normal_scale - n.x * line_scale; - - // scatter - if ( scatter != 0.0 ) { - - float off_mag = scatter * threshold * 0.5; - float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2; - c.p1.x += cos( off_angle ) * off_mag; - c.p1.y += sin( off_angle ) * off_mag; - - } - - // find corners - float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step ); - float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step ); - c.p2.x = c.p1.x - n.x * normal_step; - c.p2.y = c.p1.y - n.y * normal_step; - c.p3.x = c.p1.x + n.y * line_step; - c.p3.y = c.p1.y - n.x * line_step; - c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step; - c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step; - - return c; - - } - - float blendColour( float a, float b, float t ) { - - // blend colours - if ( blendingMode == BLENDING_LINEAR ) { - return blend( a, b, 1.0 - t ); - } else if ( blendingMode == BLENDING_ADD ) { - return blend( a, min( 1.0, a + b ), t ); - } else if ( blendingMode == BLENDING_MULTIPLY ) { - return blend( a, max( 0.0, a * b ), t ); - } else if ( blendingMode == BLENDING_LIGHTER ) { - return blend( a, max( a, b ), t ); - } else if ( blendingMode == BLENDING_DARKER ) { - return blend( a, min( a, b ), t ); - } else { - return blend( a, b, 1.0 - t ); - } - - } - - void main() { - - if ( ! disable ) { - - // setup - vec2 p = vec2( vUV.x * width, vUV.y * height ); - vec2 origin = vec2( 0, 0 ); - float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25; - - // get channel samples - Cell cell_r = getReferenceCell( p, origin, rotateR, radius ); - Cell cell_g = getReferenceCell( p, origin, rotateG, radius ); - Cell cell_b = getReferenceCell( p, origin, rotateB, radius ); - float r = getDotColour( cell_r, p, 0, rotateR, aa ); - float g = getDotColour( cell_g, p, 1, rotateG, aa ); - float b = getDotColour( cell_b, p, 2, rotateB, aa ); - - // blend with original - vec4 colour = texture2D( tDiffuse, vUV ); - r = blendColour( r, colour.r, blending ); - g = blendColour( g, colour.g, blending ); - b = blendColour( b, colour.b, blending ); - - if ( greyscale ) { - r = g = b = (r + b + g) / 3.0; - } - - gl_FragColor = vec4( r, g, b, 1.0 ); - - } else { - - gl_FragColor = texture2D( tDiffuse, vUV ); - - } - - }` - -}; - -export { HalftoneShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalBlurShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalBlurShader.js deleted file mode 100644 index 8b479c5..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalBlurShader.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Two pass Gaussian blur filter (horizontal and vertical blur shaders) - * - see http://www.cake23.de/traveling-wavefronts-lit-up.html - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - */ - -const HorizontalBlurShader = { - - name: 'HorizontalBlurShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'h': { value: 1.0 / 512.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float h; - - varying vec2 vUv; - - void main() { - - vec4 sum = vec4( 0.0 ); - - sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051; - sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918; - sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245; - sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531; - sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; - sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531; - sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245; - sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918; - sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051; - - gl_FragColor = sum; - - }` - -}; - -export { HorizontalBlurShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalTiltShiftShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalTiltShiftShader.js deleted file mode 100644 index d7c94aa..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HorizontalTiltShiftShader.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - * - "r" parameter control where "focused" horizontal line lies - */ - -const HorizontalTiltShiftShader = { - - name: 'HorizontalTiltShiftShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'h': { value: 1.0 / 512.0 }, - 'r': { value: 0.35 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float h; - uniform float r; - - varying vec2 vUv; - - void main() { - - vec4 sum = vec4( 0.0 ); - - float hh = h * abs( r - vUv.y ); - - sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051; - sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918; - sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245; - sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531; - sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; - sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531; - sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245; - sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918; - sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051; - - gl_FragColor = sum; - - }` - -}; - -export { HorizontalTiltShiftShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/HueSaturationShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/HueSaturationShader.js deleted file mode 100644 index 2ab1256..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/HueSaturationShader.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Hue and saturation adjustment - * https://github.com/evanw/glfx.js - * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc. - * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) - */ - -const HueSaturationShader = { - - name: 'HueSaturationShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'hue': { value: 0 }, - 'saturation': { value: 0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float hue; - uniform float saturation; - - varying vec2 vUv; - - void main() { - - gl_FragColor = texture2D( tDiffuse, vUv ); - - // hue - float angle = hue * 3.14159265; - float s = sin(angle), c = cos(angle); - vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0; - float len = length(gl_FragColor.rgb); - gl_FragColor.rgb = vec3( - dot(gl_FragColor.rgb, weights.xyz), - dot(gl_FragColor.rgb, weights.zxy), - dot(gl_FragColor.rgb, weights.yzx) - ); - - // saturation - float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0; - if (saturation > 0.0) { - gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation)); - } else { - gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation); - } - - }` - -}; - -export { HueSaturationShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/IESLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/IESLoader.js deleted file mode 100644 index 9007c11..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/IESLoader.js +++ /dev/null @@ -1,337 +0,0 @@ -import { - DataTexture, - FileLoader, - FloatType, - RedFormat, - MathUtils, - Loader, - UnsignedByteType, - LinearFilter, - HalfFloatType, - DataUtils -} from '/static/javascript/three/build/three.module.js'; - -class IESLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.type = HalfFloatType; - - } - - _getIESValues( iesLamp, type ) { - - const width = 360; - const height = 180; - const size = width * height; - - const data = new Array( size ); - - function interpolateCandelaValues( phi, theta ) { - - let phiIndex = 0, thetaIndex = 0; - let startTheta = 0, endTheta = 0, startPhi = 0, endPhi = 0; - - for ( let i = 0; i < iesLamp.numHorAngles - 1; ++ i ) { // numHorAngles = horAngles.length-1 because of extra padding, so this wont cause an out of bounds error - - if ( theta < iesLamp.horAngles[ i + 1 ] || i == iesLamp.numHorAngles - 2 ) { - - thetaIndex = i; - startTheta = iesLamp.horAngles[ i ]; - endTheta = iesLamp.horAngles[ i + 1 ]; - - break; - - } - - } - - for ( let i = 0; i < iesLamp.numVerAngles - 1; ++ i ) { - - if ( phi < iesLamp.verAngles[ i + 1 ] || i == iesLamp.numVerAngles - 2 ) { - - phiIndex = i; - startPhi = iesLamp.verAngles[ i ]; - endPhi = iesLamp.verAngles[ i + 1 ]; - - break; - - } - - } - - const deltaTheta = endTheta - startTheta; - const deltaPhi = endPhi - startPhi; - - if ( deltaPhi === 0 ) // Outside range - return 0; - - const t1 = deltaTheta === 0 ? 0 : ( theta - startTheta ) / deltaTheta; - const t2 = ( phi - startPhi ) / deltaPhi; - - const nextThetaIndex = deltaTheta === 0 ? thetaIndex : thetaIndex + 1; - - const v1 = MathUtils.lerp( iesLamp.candelaValues[ thetaIndex ][ phiIndex ], iesLamp.candelaValues[ nextThetaIndex ][ phiIndex ], t1 ); - const v2 = MathUtils.lerp( iesLamp.candelaValues[ thetaIndex ][ phiIndex + 1 ], iesLamp.candelaValues[ nextThetaIndex ][ phiIndex + 1 ], t1 ); - const v = MathUtils.lerp( v1, v2, t2 ); - - return v; - - } - - const startTheta = iesLamp.horAngles[ 0 ], endTheta = iesLamp.horAngles[ iesLamp.numHorAngles - 1 ]; - - for ( let i = 0; i < size; ++ i ) { - - let theta = i % width; - const phi = Math.floor( i / width ); - - if ( endTheta - startTheta !== 0 && ( theta < startTheta || theta >= endTheta ) ) { // Handle symmetry for hor angles - - theta %= endTheta * 2; - - if ( theta > endTheta ) - theta = endTheta * 2 - theta; - - } - - data[ phi + theta * height ] = interpolateCandelaValues( phi, theta ); - - } - - let result = null; - - if ( type === UnsignedByteType ) result = Uint8Array.from( data.map( v => Math.min( v * 0xFF, 0xFF ) ) ); - else if ( type === HalfFloatType ) result = Uint16Array.from( data.map( v => DataUtils.toHalfFloat( v ) ) ); - else if ( type === FloatType ) result = Float32Array.from( data ); - else console.error( 'IESLoader: Unsupported type:', type ); - - return result; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new FileLoader( this.manager ); - loader.setResponseType( 'text' ); - loader.setCrossOrigin( this.crossOrigin ); - loader.setWithCredentials( this.withCredentials ); - loader.setPath( this.path ); - loader.setRequestHeader( this.requestHeader ); - - loader.load( url, text => { - - onLoad( this.parse( text ) ); - - }, onProgress, onError ); - - } - - parse( text ) { - - const type = this.type; - - const iesLamp = new IESLamp( text ); - const data = this._getIESValues( iesLamp, type ); - - const texture = new DataTexture( data, 180, 1, RedFormat, type ); - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.needsUpdate = true; - - return texture; - - } - -} - - -function IESLamp( text ) { - - const _self = this; - - const textArray = text.split( '\n' ); - - let lineNumber = 0; - let line; - - _self.verAngles = [ ]; - _self.horAngles = [ ]; - - _self.candelaValues = [ ]; - - _self.tiltData = { }; - _self.tiltData.angles = [ ]; - _self.tiltData.mulFactors = [ ]; - - function textToArray( text ) { - - text = text.replace( /^\s+|\s+$/g, '' ); // remove leading or trailing spaces - text = text.replace( /,/g, ' ' ); // replace commas with spaces - text = text.replace( /\s\s+/g, ' ' ); // replace white space/tabs etc by single whitespace - - const array = text.split( ' ' ); - - return array; - - } - - function readArray( count, array ) { - - while ( true ) { - - const line = textArray[ lineNumber ++ ]; - const lineData = textToArray( line ); - - for ( let i = 0; i < lineData.length; ++ i ) { - - array.push( Number( lineData[ i ] ) ); - - } - - if ( array.length === count ) - break; - - } - - } - - function readTilt() { - - let line = textArray[ lineNumber ++ ]; - let lineData = textToArray( line ); - - _self.tiltData.lampToLumGeometry = Number( lineData[ 0 ] ); - - line = textArray[ lineNumber ++ ]; - lineData = textToArray( line ); - - _self.tiltData.numAngles = Number( lineData[ 0 ] ); - - readArray( _self.tiltData.numAngles, _self.tiltData.angles ); - readArray( _self.tiltData.numAngles, _self.tiltData.mulFactors ); - - } - - function readLampValues() { - - const values = [ ]; - readArray( 10, values ); - - _self.count = Number( values[ 0 ] ); - _self.lumens = Number( values[ 1 ] ); - _self.multiplier = Number( values[ 2 ] ); - _self.numVerAngles = Number( values[ 3 ] ); - _self.numHorAngles = Number( values[ 4 ] ); - _self.gonioType = Number( values[ 5 ] ); - _self.units = Number( values[ 6 ] ); - _self.width = Number( values[ 7 ] ); - _self.length = Number( values[ 8 ] ); - _self.height = Number( values[ 9 ] ); - - } - - function readLampFactors() { - - const values = [ ]; - readArray( 3, values ); - - _self.ballFactor = Number( values[ 0 ] ); - _self.blpFactor = Number( values[ 1 ] ); - _self.inputWatts = Number( values[ 2 ] ); - - } - - while ( true ) { - - line = textArray[ lineNumber ++ ]; - - if ( line.includes( 'TILT' ) ) { - - break; - - } - - } - - if ( ! line.includes( 'NONE' ) ) { - - if ( line.includes( 'INCLUDE' ) ) { - - readTilt(); - - } else { - - // TODO:: Read tilt data from a file - - } - - } - - readLampValues(); - - readLampFactors(); - - // Initialize candela value array - for ( let i = 0; i < _self.numHorAngles; ++ i ) { - - _self.candelaValues.push( [ ] ); - - } - - // Parse Angles - readArray( _self.numVerAngles, _self.verAngles ); - readArray( _self.numHorAngles, _self.horAngles ); - - // Parse Candela values - for ( let i = 0; i < _self.numHorAngles; ++ i ) { - - readArray( _self.numVerAngles, _self.candelaValues[ i ] ); - - } - - // Calculate actual candela values, and normalize. - for ( let i = 0; i < _self.numHorAngles; ++ i ) { - - for ( let j = 0; j < _self.numVerAngles; ++ j ) { - - _self.candelaValues[ i ][ j ] *= _self.candelaValues[ i ][ j ] * _self.multiplier - * _self.ballFactor * _self.blpFactor; - - } - - } - - let maxVal = - 1; - for ( let i = 0; i < _self.numHorAngles; ++ i ) { - - for ( let j = 0; j < _self.numVerAngles; ++ j ) { - - const value = _self.candelaValues[ i ][ j ]; - maxVal = maxVal < value ? value : maxVal; - - } - - } - - const bNormalize = true; - if ( bNormalize && maxVal > 0 ) { - - for ( let i = 0; i < _self.numHorAngles; ++ i ) { - - for ( let j = 0; j < _self.numVerAngles; ++ j ) { - - _self.candelaValues[ i ][ j ] /= maxVal; - - } - - } - - } - -} - - -export { IESLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/KMZLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/KMZLoader.js deleted file mode 100644 index f1c0f6a..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/KMZLoader.js +++ /dev/null @@ -1,130 +0,0 @@ -import { - FileLoader, - Group, - Loader, - LoadingManager -} from '/static/javascript/three/build/three.module.js'; -import { ColladaLoader } from '../loaders/ColladaLoader.js'; -import * as fflate from '../libs/fflate.module.js'; - -class KMZLoader 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.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - function findFile( url ) { - - for ( const path in zip ) { - - if ( path.slice( - url.length ) === url ) { - - return zip[ path ]; - - } - - } - - } - - const manager = new LoadingManager(); - manager.setURLModifier( function ( url ) { - - const image = findFile( url ); - - if ( image ) { - - console.log( 'Loading', url ); - - const blob = new Blob( [ image.buffer ], { type: 'application/octet-stream' } ); - return URL.createObjectURL( blob ); - - } - - return url; - - } ); - - // - - const zip = fflate.unzipSync( new Uint8Array( data ) ); - - if ( zip[ 'doc.kml' ] ) { - - const xml = new DOMParser().parseFromString( fflate.strFromU8( zip[ 'doc.kml' ] ), 'application/xml' ); - - const model = xml.querySelector( 'Placemark Model Link href' ); - - if ( model ) { - - const loader = new ColladaLoader( manager ); - return loader.parse( fflate.strFromU8( zip[ model.textContent ] ) ); - - } - - } else { - - console.warn( 'KMZLoader: Missing doc.kml file.' ); - - for ( const path in zip ) { - - const extension = path.split( '.' ).pop().toLowerCase(); - - if ( extension === 'dae' ) { - - const loader = new ColladaLoader( manager ); - return loader.parse( fflate.strFromU8( zip[ path ] ) ); - - } - - } - - } - - console.error( 'KMZLoader: Couldn\'t find .dae file.' ); - return { scene: new Group() }; - - } - -} - -export { KMZLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/KTX2Loader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/KTX2Loader.js deleted file mode 100644 index 101b858..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/KTX2Loader.js +++ /dev/null @@ -1,925 +0,0 @@ -/** - * Loader for KTX 2.0 GPU Texture containers. - * - * KTX 2.0 is a container format for various GPU texture formats. The loader - * supports Basis Universal GPU textures, which can be quickly transcoded to - * a wide variety of GPU texture compression formats, as well as some - * uncompressed DataTexture and Data3DTexture formats. - * - * References: - * - KTX: http://github.khronos.org/KTX-Specification/ - * - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor - */ - -import { - CompressedTexture, - CompressedArrayTexture, - CompressedCubeTexture, - Data3DTexture, - DataTexture, - DisplayP3ColorSpace, - FileLoader, - FloatType, - HalfFloatType, - NoColorSpace, - LinearFilter, - LinearMipmapLinearFilter, - LinearDisplayP3ColorSpace, - LinearSRGBColorSpace, - Loader, - RedFormat, - RGB_ETC1_Format, - RGB_ETC2_Format, - RGB_PVRTC_4BPPV1_Format, - RGBA_ASTC_4x4_Format, - RGBA_ASTC_6x6_Format, - RGBA_BPTC_Format, - RGBA_ETC2_EAC_Format, - RGBA_PVRTC_4BPPV1_Format, - RGBA_S3TC_DXT5_Format, - RGBA_S3TC_DXT1_Format, - RGBAFormat, - RGFormat, - SRGBColorSpace, - UnsignedByteType, -} from '/static/javascript/three/build/three.module.js'; -import { WorkerPool } from'/static/javascript/three/examples/jsm/utils/WorkerPool.js'; -import { - read, - KHR_DF_FLAG_ALPHA_PREMULTIPLIED, - KHR_DF_TRANSFER_SRGB, - KHR_SUPERCOMPRESSION_NONE, - KHR_SUPERCOMPRESSION_ZSTD, - VK_FORMAT_UNDEFINED, - VK_FORMAT_R16_SFLOAT, - VK_FORMAT_R16G16_SFLOAT, - VK_FORMAT_R16G16B16A16_SFLOAT, - VK_FORMAT_R32_SFLOAT, - VK_FORMAT_R32G32_SFLOAT, - VK_FORMAT_R32G32B32A32_SFLOAT, - VK_FORMAT_R8_SRGB, - VK_FORMAT_R8_UNORM, - VK_FORMAT_R8G8_SRGB, - VK_FORMAT_R8G8_UNORM, - VK_FORMAT_R8G8B8A8_SRGB, - VK_FORMAT_R8G8B8A8_UNORM, - VK_FORMAT_ASTC_6x6_SRGB_BLOCK, - VK_FORMAT_ASTC_6x6_UNORM_BLOCK, - KHR_DF_PRIMARIES_UNSPECIFIED, - KHR_DF_PRIMARIES_BT709, - KHR_DF_PRIMARIES_DISPLAYP3 -} from '../libs/ktx-parse.module.js'; -import { ZSTDDecoder } from '../libs/zstddec.module.js'; - -const _taskCache = new WeakMap(); - -let _activeLoaders = 0; - -let _zstd; - -class KTX2Loader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.transcoderPath = ''; - this.transcoderBinary = null; - this.transcoderPending = null; - - this.workerPool = new WorkerPool(); - this.workerSourceURL = ''; - this.workerConfig = null; - - if ( typeof MSC_TRANSCODER !== 'undefined' ) { - - console.warn( - - 'THREE.KTX2Loader: Please update to latest "basis_transcoder".' - + ' "msc_basis_transcoder" is no longer supported in three.js r125+.' - - ); - - } - - } - - setTranscoderPath( path ) { - - this.transcoderPath = path; - - return this; - - } - - setWorkerLimit( num ) { - - this.workerPool.setWorkerLimit( num ); - - return this; - - } - - async detectSupportAsync( renderer ) { - - this.workerConfig = { - astcSupported: await renderer.hasFeatureAsync( 'texture-compression-astc' ), - etc1Supported: await renderer.hasFeatureAsync( 'texture-compression-etc1' ), - etc2Supported: await renderer.hasFeatureAsync( 'texture-compression-etc2' ), - dxtSupported: await renderer.hasFeatureAsync( 'texture-compression-bc' ), - bptcSupported: await renderer.hasFeatureAsync( 'texture-compression-bptc' ), - pvrtcSupported: await renderer.hasFeatureAsync( 'texture-compression-pvrtc' ) - }; - - return this; - - } - - detectSupport( renderer ) { - - if ( renderer.isWebGPURenderer === true ) { - - this.workerConfig = { - astcSupported: renderer.hasFeature( 'texture-compression-astc' ), - etc1Supported: renderer.hasFeature( 'texture-compression-etc1' ), - etc2Supported: renderer.hasFeature( 'texture-compression-etc2' ), - dxtSupported: renderer.hasFeature( 'texture-compression-bc' ), - bptcSupported: renderer.hasFeature( 'texture-compression-bptc' ), - pvrtcSupported: renderer.hasFeature( 'texture-compression-pvrtc' ) - }; - - } else { - - this.workerConfig = { - astcSupported: renderer.extensions.has( 'WEBGL_compressed_texture_astc' ), - etc1Supported: renderer.extensions.has( 'WEBGL_compressed_texture_etc1' ), - etc2Supported: renderer.extensions.has( 'WEBGL_compressed_texture_etc' ), - dxtSupported: renderer.extensions.has( 'WEBGL_compressed_texture_s3tc' ), - bptcSupported: renderer.extensions.has( 'EXT_texture_compression_bptc' ), - pvrtcSupported: renderer.extensions.has( 'WEBGL_compressed_texture_pvrtc' ) - || renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' ) - }; - - } - - return this; - - } - - init() { - - if ( ! this.transcoderPending ) { - - // Load transcoder wrapper. - const jsLoader = new FileLoader( this.manager ); - jsLoader.setPath( this.transcoderPath ); - jsLoader.setWithCredentials( this.withCredentials ); - const jsContent = jsLoader.loadAsync( 'basis_transcoder.js' ); - - // Load transcoder WASM binary. - const binaryLoader = new FileLoader( this.manager ); - binaryLoader.setPath( this.transcoderPath ); - binaryLoader.setResponseType( 'arraybuffer' ); - binaryLoader.setWithCredentials( this.withCredentials ); - const binaryContent = binaryLoader.loadAsync( 'basis_transcoder.wasm' ); - - this.transcoderPending = Promise.all( [ jsContent, binaryContent ] ) - .then( ( [ jsContent, binaryContent ] ) => { - - const fn = KTX2Loader.BasisWorker.toString(); - - const body = [ - '/* constants */', - 'let _EngineFormat = ' + JSON.stringify( KTX2Loader.EngineFormat ), - 'let _TranscoderFormat = ' + JSON.stringify( KTX2Loader.TranscoderFormat ), - 'let _BasisFormat = ' + JSON.stringify( KTX2Loader.BasisFormat ), - '/* basis_transcoder.js */', - jsContent, - '/* worker */', - fn.substring( fn.indexOf( '{' ) + 1, fn.lastIndexOf( '}' ) ) - ].join( '\n' ); - - this.workerSourceURL = URL.createObjectURL( new Blob( [ body ] ) ); - this.transcoderBinary = binaryContent; - - this.workerPool.setWorkerCreator( () => { - - const worker = new Worker( this.workerSourceURL ); - const transcoderBinary = this.transcoderBinary.slice( 0 ); - - worker.postMessage( { type: 'init', config: this.workerConfig, transcoderBinary }, [ transcoderBinary ] ); - - return worker; - - } ); - - } ); - - if ( _activeLoaders > 0 ) { - - // Each instance loads a transcoder and allocates workers, increasing network and memory cost. - - console.warn( - - 'THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues.' - + ' Use a single KTX2Loader instance, or call .dispose() on old instances.' - - ); - - } - - _activeLoaders ++; - - } - - return this.transcoderPending; - - } - - load( url, onLoad, onProgress, onError ) { - - if ( this.workerConfig === null ) { - - throw new Error( 'THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.' ); - - } - - const loader = new FileLoader( this.manager ); - - loader.setResponseType( 'arraybuffer' ); - loader.setWithCredentials( this.withCredentials ); - - loader.load( url, ( buffer ) => { - - // Check for an existing task using this buffer. A transferred buffer cannot be transferred - // again from this thread. - if ( _taskCache.has( buffer ) ) { - - const cachedTask = _taskCache.get( buffer ); - - return cachedTask.promise.then( onLoad ).catch( onError ); - - } - - this._createTexture( buffer ) - .then( ( texture ) => onLoad ? onLoad( texture ) : null ) - .catch( onError ); - - }, onProgress, onError ); - - } - - _createTextureFrom( transcodeResult, container ) { - - const { faces, width, height, format, type, error, dfdFlags } = transcodeResult; - - if ( type === 'error' ) return Promise.reject( error ); - - let texture; - - if ( container.faceCount === 6 ) { - - texture = new CompressedCubeTexture( faces, format, UnsignedByteType ); - - } else { - - const mipmaps = faces[ 0 ].mipmaps; - - texture = container.layerCount > 1 - ? new CompressedArrayTexture( mipmaps, width, height, container.layerCount, format, UnsignedByteType ) - : new CompressedTexture( mipmaps, width, height, format, UnsignedByteType ); - - } - - texture.minFilter = faces[ 0 ].mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - - texture.needsUpdate = true; - texture.colorSpace = parseColorSpace( container ); - texture.premultiplyAlpha = !! ( dfdFlags & KHR_DF_FLAG_ALPHA_PREMULTIPLIED ); - - return texture; - - } - - /** - * @param {ArrayBuffer} buffer - * @param {object?} config - * @return {Promise} - */ - async _createTexture( buffer, config = {} ) { - - const container = read( new Uint8Array( buffer ) ); - - if ( container.vkFormat !== VK_FORMAT_UNDEFINED ) { - - return createRawTexture( container ); - - } - - // - const taskConfig = config; - const texturePending = this.init().then( () => { - - return this.workerPool.postMessage( { type: 'transcode', buffer, taskConfig: taskConfig }, [ buffer ] ); - - } ).then( ( e ) => this._createTextureFrom( e.data, container ) ); - - // Cache the task result. - _taskCache.set( buffer, { promise: texturePending } ); - - return texturePending; - - } - - dispose() { - - this.workerPool.dispose(); - if ( this.workerSourceURL ) URL.revokeObjectURL( this.workerSourceURL ); - - _activeLoaders --; - - return this; - - } - -} - - -/* CONSTANTS */ - -KTX2Loader.BasisFormat = { - ETC1S: 0, - UASTC_4x4: 1, -}; - -KTX2Loader.TranscoderFormat = { - ETC1: 0, - ETC2: 1, - BC1: 2, - BC3: 3, - BC4: 4, - BC5: 5, - BC7_M6_OPAQUE_ONLY: 6, - BC7_M5: 7, - PVRTC1_4_RGB: 8, - PVRTC1_4_RGBA: 9, - ASTC_4x4: 10, - ATC_RGB: 11, - ATC_RGBA_INTERPOLATED_ALPHA: 12, - RGBA32: 13, - RGB565: 14, - BGR565: 15, - RGBA4444: 16, -}; - -KTX2Loader.EngineFormat = { - RGBAFormat: RGBAFormat, - RGBA_ASTC_4x4_Format: RGBA_ASTC_4x4_Format, - RGBA_BPTC_Format: RGBA_BPTC_Format, - RGBA_ETC2_EAC_Format: RGBA_ETC2_EAC_Format, - RGBA_PVRTC_4BPPV1_Format: RGBA_PVRTC_4BPPV1_Format, - RGBA_S3TC_DXT5_Format: RGBA_S3TC_DXT5_Format, - RGB_ETC1_Format: RGB_ETC1_Format, - RGB_ETC2_Format: RGB_ETC2_Format, - RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format, - RGBA_S3TC_DXT1_Format: RGBA_S3TC_DXT1_Format, -}; - - -/* WEB WORKER */ - -KTX2Loader.BasisWorker = function () { - - let config; - let transcoderPending; - let BasisModule; - - const EngineFormat = _EngineFormat; // eslint-disable-line no-undef - const TranscoderFormat = _TranscoderFormat; // eslint-disable-line no-undef - const BasisFormat = _BasisFormat; // eslint-disable-line no-undef - - self.addEventListener( 'message', function ( e ) { - - const message = e.data; - - switch ( message.type ) { - - case 'init': - config = message.config; - init( message.transcoderBinary ); - break; - - case 'transcode': - transcoderPending.then( () => { - - try { - - const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode( message.buffer ); - - self.postMessage( { type: 'transcode', id: message.id, faces, width, height, hasAlpha, format, dfdFlags }, buffers ); - - } catch ( error ) { - - console.error( error ); - - self.postMessage( { type: 'error', id: message.id, error: error.message } ); - - } - - } ); - break; - - } - - } ); - - function init( wasmBinary ) { - - transcoderPending = new Promise( ( resolve ) => { - - BasisModule = { wasmBinary, onRuntimeInitialized: resolve }; - BASIS( BasisModule ); // eslint-disable-line no-undef - - } ).then( () => { - - BasisModule.initializeBasis(); - - if ( BasisModule.KTX2File === undefined ) { - - console.warn( 'THREE.KTX2Loader: Please update Basis Universal transcoder.' ); - - } - - } ); - - } - - function transcode( buffer ) { - - const ktx2File = new BasisModule.KTX2File( new Uint8Array( buffer ) ); - - function cleanup() { - - ktx2File.close(); - ktx2File.delete(); - - } - - if ( ! ktx2File.isValid() ) { - - cleanup(); - throw new Error( 'THREE.KTX2Loader: Invalid or unsupported .ktx2 file' ); - - } - - const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S; - const width = ktx2File.getWidth(); - const height = ktx2File.getHeight(); - const layerCount = ktx2File.getLayers() || 1; - const levelCount = ktx2File.getLevels(); - const faceCount = ktx2File.getFaces(); - const hasAlpha = ktx2File.getHasAlpha(); - const dfdFlags = ktx2File.getDFDFlags(); - - const { transcoderFormat, engineFormat } = getTranscoderFormat( basisFormat, width, height, hasAlpha ); - - if ( ! width || ! height || ! levelCount ) { - - cleanup(); - throw new Error( 'THREE.KTX2Loader: Invalid texture' ); - - } - - if ( ! ktx2File.startTranscoding() ) { - - cleanup(); - throw new Error( 'THREE.KTX2Loader: .startTranscoding failed' ); - - } - - const faces = []; - const buffers = []; - - for ( let face = 0; face < faceCount; face ++ ) { - - const mipmaps = []; - - for ( let mip = 0; mip < levelCount; mip ++ ) { - - const layerMips = []; - - let mipWidth, mipHeight; - - for ( let layer = 0; layer < layerCount; layer ++ ) { - - const levelInfo = ktx2File.getImageLevelInfo( mip, layer, face ); - - if ( face === 0 && mip === 0 && layer === 0 && ( levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0 ) ) { - - console.warn( 'THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.' ); - - } - - if ( levelCount > 1 ) { - - mipWidth = levelInfo.origWidth; - mipHeight = levelInfo.origHeight; - - } else { - - // Handles non-multiple-of-four dimensions in textures without mipmaps. Textures with - // mipmaps must use multiple-of-four dimensions, for some texture formats and APIs. - // See mrdoob/three.js#25908. - mipWidth = levelInfo.width; - mipHeight = levelInfo.height; - - } - - const dst = new Uint8Array( ktx2File.getImageTranscodedSizeInBytes( mip, layer, 0, transcoderFormat ) ); - const status = ktx2File.transcodeImage( dst, mip, layer, face, transcoderFormat, 0, - 1, - 1 ); - - if ( ! status ) { - - cleanup(); - throw new Error( 'THREE.KTX2Loader: .transcodeImage failed.' ); - - } - - layerMips.push( dst ); - - } - - const mipData = concat( layerMips ); - - mipmaps.push( { data: mipData, width: mipWidth, height: mipHeight } ); - buffers.push( mipData.buffer ); - - } - - faces.push( { mipmaps, width, height, format: engineFormat } ); - - } - - cleanup(); - - return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags }; - - } - - // - - // Optimal choice of a transcoder target format depends on the Basis format (ETC1S or UASTC), - // device capabilities, and texture dimensions. The list below ranks the formats separately - // for ETC1S and UASTC. - // - // In some cases, transcoding UASTC to RGBA32 might be preferred for higher quality (at - // significant memory cost) compared to ETC1/2, BC1/3, and PVRTC. The transcoder currently - // chooses RGBA32 only as a last resort and does not expose that option to the caller. - const FORMAT_OPTIONS = [ - { - if: 'astcSupported', - basisFormat: [ BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4 ], - engineFormat: [ EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format ], - priorityETC1S: Infinity, - priorityUASTC: 1, - needsPowerOfTwo: false, - }, - { - if: 'bptcSupported', - basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5 ], - engineFormat: [ EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format ], - priorityETC1S: 3, - priorityUASTC: 2, - needsPowerOfTwo: false, - }, - { - if: 'dxtSupported', - basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.BC1, TranscoderFormat.BC3 ], - engineFormat: [ EngineFormat.RGBA_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format ], - priorityETC1S: 4, - priorityUASTC: 5, - needsPowerOfTwo: false, - }, - { - if: 'etc2Supported', - basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.ETC1, TranscoderFormat.ETC2 ], - engineFormat: [ EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format ], - priorityETC1S: 1, - priorityUASTC: 3, - needsPowerOfTwo: false, - }, - { - if: 'etc1Supported', - basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.ETC1 ], - engineFormat: [ EngineFormat.RGB_ETC1_Format ], - priorityETC1S: 2, - priorityUASTC: 4, - needsPowerOfTwo: false, - }, - { - if: 'pvrtcSupported', - basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ], - transcoderFormat: [ TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA ], - engineFormat: [ EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format ], - priorityETC1S: 5, - priorityUASTC: 6, - needsPowerOfTwo: true, - }, - ]; - - const ETC1S_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) { - - return a.priorityETC1S - b.priorityETC1S; - - } ); - const UASTC_OPTIONS = FORMAT_OPTIONS.sort( function ( a, b ) { - - return a.priorityUASTC - b.priorityUASTC; - - } ); - - function getTranscoderFormat( basisFormat, width, height, hasAlpha ) { - - let transcoderFormat; - let engineFormat; - - const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS; - - for ( let i = 0; i < options.length; i ++ ) { - - const opt = options[ i ]; - - if ( ! config[ opt.if ] ) continue; - if ( ! opt.basisFormat.includes( basisFormat ) ) continue; - if ( hasAlpha && opt.transcoderFormat.length < 2 ) continue; - if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue; - - transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ]; - engineFormat = opt.engineFormat[ hasAlpha ? 1 : 0 ]; - - return { transcoderFormat, engineFormat }; - - } - - console.warn( 'THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.' ); - - transcoderFormat = TranscoderFormat.RGBA32; - engineFormat = EngineFormat.RGBAFormat; - - return { transcoderFormat, engineFormat }; - - } - - function isPowerOfTwo( value ) { - - if ( value <= 2 ) return true; - - return ( value & ( value - 1 ) ) === 0 && value !== 0; - - } - - /** Concatenates N byte arrays. */ - function concat( arrays ) { - - if ( arrays.length === 1 ) return arrays[ 0 ]; - - let totalByteLength = 0; - - for ( let i = 0; i < arrays.length; i ++ ) { - - const array = arrays[ i ]; - totalByteLength += array.byteLength; - - } - - const result = new Uint8Array( totalByteLength ); - - let byteOffset = 0; - - for ( let i = 0; i < arrays.length; i ++ ) { - - const array = arrays[ i ]; - result.set( array, byteOffset ); - - byteOffset += array.byteLength; - - } - - return result; - - } - -}; - -// -// Parsing for non-Basis textures. These textures are may have supercompression -// like Zstd, but they do not require transcoding. - -const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGFormat, RedFormat ] ); - -const FORMAT_MAP = { - - [ VK_FORMAT_R32G32B32A32_SFLOAT ]: RGBAFormat, - [ VK_FORMAT_R16G16B16A16_SFLOAT ]: RGBAFormat, - [ VK_FORMAT_R8G8B8A8_UNORM ]: RGBAFormat, - [ VK_FORMAT_R8G8B8A8_SRGB ]: RGBAFormat, - - [ VK_FORMAT_R32G32_SFLOAT ]: RGFormat, - [ VK_FORMAT_R16G16_SFLOAT ]: RGFormat, - [ VK_FORMAT_R8G8_UNORM ]: RGFormat, - [ VK_FORMAT_R8G8_SRGB ]: RGFormat, - - [ VK_FORMAT_R32_SFLOAT ]: RedFormat, - [ VK_FORMAT_R16_SFLOAT ]: RedFormat, - [ VK_FORMAT_R8_SRGB ]: RedFormat, - [ VK_FORMAT_R8_UNORM ]: RedFormat, - - [ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: RGBA_ASTC_6x6_Format, - [ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: RGBA_ASTC_6x6_Format, - -}; - -const TYPE_MAP = { - - [ VK_FORMAT_R32G32B32A32_SFLOAT ]: FloatType, - [ VK_FORMAT_R16G16B16A16_SFLOAT ]: HalfFloatType, - [ VK_FORMAT_R8G8B8A8_UNORM ]: UnsignedByteType, - [ VK_FORMAT_R8G8B8A8_SRGB ]: UnsignedByteType, - - [ VK_FORMAT_R32G32_SFLOAT ]: FloatType, - [ VK_FORMAT_R16G16_SFLOAT ]: HalfFloatType, - [ VK_FORMAT_R8G8_UNORM ]: UnsignedByteType, - [ VK_FORMAT_R8G8_SRGB ]: UnsignedByteType, - - [ VK_FORMAT_R32_SFLOAT ]: FloatType, - [ VK_FORMAT_R16_SFLOAT ]: HalfFloatType, - [ VK_FORMAT_R8_SRGB ]: UnsignedByteType, - [ VK_FORMAT_R8_UNORM ]: UnsignedByteType, - - [ VK_FORMAT_ASTC_6x6_SRGB_BLOCK ]: UnsignedByteType, - [ VK_FORMAT_ASTC_6x6_UNORM_BLOCK ]: UnsignedByteType, - -}; - -async function createRawTexture( container ) { - - const { vkFormat } = container; - - if ( FORMAT_MAP[ vkFormat ] === undefined ) { - - throw new Error( 'THREE.KTX2Loader: Unsupported vkFormat.' ); - - } - - // - - let zstd; - - if ( container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD ) { - - if ( ! _zstd ) { - - _zstd = new Promise( async ( resolve ) => { - - const zstd = new ZSTDDecoder(); - await zstd.init(); - resolve( zstd ); - - } ); - - } - - zstd = await _zstd; - - } - - // - - const mipmaps = []; - - - for ( let levelIndex = 0; levelIndex < container.levels.length; levelIndex ++ ) { - - const levelWidth = Math.max( 1, container.pixelWidth >> levelIndex ); - const levelHeight = Math.max( 1, container.pixelHeight >> levelIndex ); - const levelDepth = container.pixelDepth ? Math.max( 1, container.pixelDepth >> levelIndex ) : 0; - - const level = container.levels[ levelIndex ]; - - let levelData; - - if ( container.supercompressionScheme === KHR_SUPERCOMPRESSION_NONE ) { - - levelData = level.levelData; - - } else if ( container.supercompressionScheme === KHR_SUPERCOMPRESSION_ZSTD ) { - - levelData = zstd.decode( level.levelData, level.uncompressedByteLength ); - - } else { - - throw new Error( 'THREE.KTX2Loader: Unsupported supercompressionScheme.' ); - - } - - let data; - - if ( TYPE_MAP[ vkFormat ] === FloatType ) { - - data = new Float32Array( - - levelData.buffer, - levelData.byteOffset, - levelData.byteLength / Float32Array.BYTES_PER_ELEMENT - - ); - - } else if ( TYPE_MAP[ vkFormat ] === HalfFloatType ) { - - data = new Uint16Array( - - levelData.buffer, - levelData.byteOffset, - levelData.byteLength / Uint16Array.BYTES_PER_ELEMENT - - ); - - } else { - - data = levelData; - - } - - mipmaps.push( { - - data: data, - width: levelWidth, - height: levelHeight, - depth: levelDepth, - - } ); - - } - - let texture; - - if ( UNCOMPRESSED_FORMATS.has( FORMAT_MAP[ vkFormat ] ) ) { - - texture = container.pixelDepth === 0 - ? new DataTexture( mipmaps[ 0 ].data, container.pixelWidth, container.pixelHeight ) - : new Data3DTexture( mipmaps[ 0 ].data, container.pixelWidth, container.pixelHeight, container.pixelDepth ); - - } else { - - if ( container.pixelDepth > 0 ) throw new Error( 'THREE.KTX2Loader: Unsupported pixelDepth.' ); - - texture = new CompressedTexture( mipmaps, container.pixelWidth, container.pixelHeight ); - - } - - texture.mipmaps = mipmaps; - - texture.type = TYPE_MAP[ vkFormat ]; - texture.format = FORMAT_MAP[ vkFormat ]; - texture.colorSpace = parseColorSpace( container ); - texture.needsUpdate = true; - - // - - return Promise.resolve( texture ); - -} - -function parseColorSpace( container ) { - - const dfd = container.dataFormatDescriptor[ 0 ]; - - if ( dfd.colorPrimaries === KHR_DF_PRIMARIES_BT709 ) { - - return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? SRGBColorSpace : LinearSRGBColorSpace; - - } else if ( dfd.colorPrimaries === KHR_DF_PRIMARIES_DISPLAYP3 ) { - - return dfd.transferFunction === KHR_DF_TRANSFER_SRGB ? DisplayP3ColorSpace : LinearDisplayP3ColorSpace; - - } else if ( dfd.colorPrimaries === KHR_DF_PRIMARIES_UNSPECIFIED ) { - - return NoColorSpace; - - } else { - - console.warn( `THREE.KTX2Loader: Unsupported color primaries, "${ dfd.colorPrimaries }"` ); - return NoColorSpace; - - } - -} - -export { KTX2Loader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/KTXLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/KTXLoader.js deleted file mode 100644 index f87b7fc..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/KTXLoader.js +++ /dev/null @@ -1,176 +0,0 @@ -import { - CompressedTextureLoader -} from '/static/javascript/three/build/three.module.js'; - -/** - * for description see https://www.khronos.org/opengles/sdk/tools/KTX/ - * for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/ - * - * ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts - */ - - -class KTXLoader extends CompressedTextureLoader { - - constructor( manager ) { - - super( manager ); - - } - - parse( buffer, loadMipmaps ) { - - const ktx = new KhronosTextureContainer( buffer, 1 ); - - return { - mipmaps: ktx.mipmaps( loadMipmaps ), - width: ktx.pixelWidth, - height: ktx.pixelHeight, - format: ktx.glInternalFormat, - isCubemap: ktx.numberOfFaces === 6, - mipmapCount: ktx.numberOfMipmapLevels - }; - - } - -} - - -const HEADER_LEN = 12 + ( 13 * 4 ); // identifier + header elements (not including key value meta-data pairs) -// load types -const COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D() -//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D() -//const TEX_2D = 2; // uses a gl.texImage2D() -//const TEX_3D = 3; // uses a gl.texImage3D() - -class KhronosTextureContainer { - - /** - * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file - * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or - * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented - * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented - */ - constructor( arrayBuffer, facesExpected /*, threeDExpected, textureArrayExpected */ ) { - - this.arrayBuffer = arrayBuffer; - - // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is: - // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\r', '\n', '\x1A', '\n' - // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A - const identifier = new Uint8Array( this.arrayBuffer, 0, 12 ); - if ( identifier[ 0 ] !== 0xAB || - identifier[ 1 ] !== 0x4B || - identifier[ 2 ] !== 0x54 || - identifier[ 3 ] !== 0x58 || - identifier[ 4 ] !== 0x20 || - identifier[ 5 ] !== 0x31 || - identifier[ 6 ] !== 0x31 || - identifier[ 7 ] !== 0xBB || - identifier[ 8 ] !== 0x0D || - identifier[ 9 ] !== 0x0A || - identifier[ 10 ] !== 0x1A || - identifier[ 11 ] !== 0x0A ) { - - console.error( 'texture missing KTX identifier' ); - return; - - } - - // load the reset of the header in native 32 bit uint - const dataSize = Uint32Array.BYTES_PER_ELEMENT; - const headerDataView = new DataView( this.arrayBuffer, 12, 13 * dataSize ); - const endianness = headerDataView.getUint32( 0, true ); - const littleEndian = endianness === 0x04030201; - - this.glType = headerDataView.getUint32( 1 * dataSize, littleEndian ); // must be 0 for compressed textures - this.glTypeSize = headerDataView.getUint32( 2 * dataSize, littleEndian ); // must be 1 for compressed textures - this.glFormat = headerDataView.getUint32( 3 * dataSize, littleEndian ); // must be 0 for compressed textures - this.glInternalFormat = headerDataView.getUint32( 4 * dataSize, littleEndian ); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,) - this.glBaseInternalFormat = headerDataView.getUint32( 5 * dataSize, littleEndian ); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only) - this.pixelWidth = headerDataView.getUint32( 6 * dataSize, littleEndian ); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,) - this.pixelHeight = headerDataView.getUint32( 7 * dataSize, littleEndian ); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,) - this.pixelDepth = headerDataView.getUint32( 8 * dataSize, littleEndian ); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,) - this.numberOfArrayElements = headerDataView.getUint32( 9 * dataSize, littleEndian ); // used for texture arrays - this.numberOfFaces = headerDataView.getUint32( 10 * dataSize, littleEndian ); // used for cubemap textures, should either be 1 or 6 - this.numberOfMipmapLevels = headerDataView.getUint32( 11 * dataSize, littleEndian ); // number of levels; disregard possibility of 0 for compressed textures - this.bytesOfKeyValueData = headerDataView.getUint32( 12 * dataSize, littleEndian ); // the amount of space after the header for meta-data - - // Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing. - if ( this.glType !== 0 ) { - - console.warn( 'only compressed formats currently supported' ); - return; - - } else { - - // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard. - this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels ); - - } - - if ( this.pixelHeight === 0 || this.pixelDepth !== 0 ) { - - console.warn( 'only 2D textures currently supported' ); - return; - - } - - if ( this.numberOfArrayElements !== 0 ) { - - console.warn( 'texture arrays not currently supported' ); - return; - - } - - if ( this.numberOfFaces !== facesExpected ) { - - console.warn( 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces ); - return; - - } - - // we now have a completely validated file, so could use existence of loadType as success - // would need to make this more elaborate & adjust checks above to support more than one load type - this.loadType = COMPRESSED_2D; - - } - - mipmaps( loadMipmaps ) { - - const mipmaps = []; - - // initialize width & height for level 1 - let dataOffset = HEADER_LEN + this.bytesOfKeyValueData; - let width = this.pixelWidth; - let height = this.pixelHeight; - const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1; - - for ( let level = 0; level < mipmapCount; level ++ ) { - - const imageSize = new Int32Array( this.arrayBuffer, dataOffset, 1 )[ 0 ]; // size per face, since not supporting array cubemaps - dataOffset += 4; // size of the image + 4 for the imageSize field - - for ( let face = 0; face < this.numberOfFaces; face ++ ) { - - const byteArray = new Uint8Array( this.arrayBuffer, dataOffset, imageSize ); - - mipmaps.push( { 'data': byteArray, 'width': width, 'height': height } ); - - dataOffset += imageSize; - dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image - - } - - width = Math.max( 1.0, width * 0.5 ); - height = Math.max( 1.0, height * 0.5 ); - - } - - return mipmaps; - - } - -} - -export { KTXLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/KaleidoShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/KaleidoShader.js deleted file mode 100644 index 27ed142..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/KaleidoShader.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Kaleidoscope Shader - * Radial reflection around center point - * Ported from: http://pixelshaders.com/editor/ - * by Toby Schachman / http://tobyschachman.com/ - * - * sides: number of reflections - * angle: initial angle in radians - */ - -const KaleidoShader = { - - name: 'KaleidoShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'sides': { value: 6.0 }, - 'angle': { value: 0.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float sides; - uniform float angle; - - varying vec2 vUv; - - void main() { - - vec2 p = vUv - 0.5; - float r = length(p); - float a = atan(p.y, p.x) + angle; - float tau = 2. * 3.1416 ; - a = mod(a, tau/sides); - a = abs(a - tau/sides/2.) ; - p = r * vec2(cos(a), sin(a)); - vec4 color = texture2D(tDiffuse, p + 0.5); - gl_FragColor = color; - - }` - -}; - -export { KaleidoShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawLoader.js deleted file mode 100644 index 507d4cf..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawLoader.js +++ /dev/null @@ -1,2471 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - FileLoader, - Group, - LineBasicMaterial, - LineSegments, - Loader, - Matrix4, - Mesh, - MeshStandardMaterial, - ShaderMaterial, - SRGBColorSpace, - UniformsLib, - UniformsUtils, - Vector3, - Ray -} from '/static/javascript/three/build/three.module.js'; - -// Special surface finish tag types. -// Note: "MATERIAL" tag (e.g. GLITTER, SPECKLE) is not implemented -const FINISH_TYPE_DEFAULT = 0; -const FINISH_TYPE_CHROME = 1; -const FINISH_TYPE_PEARLESCENT = 2; -const FINISH_TYPE_RUBBER = 3; -const FINISH_TYPE_MATTE_METALLIC = 4; -const FINISH_TYPE_METAL = 5; - -// State machine to search a subobject path. -// The LDraw standard establishes these various possible subfolders. -const FILE_LOCATION_TRY_PARTS = 0; -const FILE_LOCATION_TRY_P = 1; -const FILE_LOCATION_TRY_MODELS = 2; -const FILE_LOCATION_AS_IS = 3; -const FILE_LOCATION_TRY_RELATIVE = 4; -const FILE_LOCATION_TRY_ABSOLUTE = 5; -const FILE_LOCATION_NOT_FOUND = 6; - -const MAIN_COLOUR_CODE = '16'; -const MAIN_EDGE_COLOUR_CODE = '24'; - -const COLOR_SPACE_LDRAW = SRGBColorSpace; - -const _tempVec0 = new Vector3(); -const _tempVec1 = new Vector3(); - -class LDrawConditionalLineMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super( { - - uniforms: UniformsUtils.merge( [ - UniformsLib.fog, - { - diffuse: { - value: new Color() - }, - opacity: { - value: 1.0 - } - } - ] ), - - vertexShader: /* glsl */` - attribute vec3 control0; - attribute vec3 control1; - attribute vec3 direction; - varying float discardFlag; - - #include - #include - #include - #include - #include - void main() { - #include - - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix * mvPosition; - - // Transform the line segment ends and control points into camera clip space - vec4 c0 = projectionMatrix * modelViewMatrix * vec4( control0, 1.0 ); - vec4 c1 = projectionMatrix * modelViewMatrix * vec4( control1, 1.0 ); - vec4 p0 = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - vec4 p1 = projectionMatrix * modelViewMatrix * vec4( position + direction, 1.0 ); - - c0.xy /= c0.w; - c1.xy /= c1.w; - p0.xy /= p0.w; - p1.xy /= p1.w; - - // Get the direction of the segment and an orthogonal vector - vec2 dir = p1.xy - p0.xy; - vec2 norm = vec2( -dir.y, dir.x ); - - // Get control point directions from the line - vec2 c0dir = c0.xy - p1.xy; - vec2 c1dir = c1.xy - p1.xy; - - // If the vectors to the controls points are pointed in different directions away - // from the line segment then the line should not be drawn. - float d0 = dot( normalize( norm ), normalize( c0dir ) ); - float d1 = dot( normalize( norm ), normalize( c1dir ) ); - discardFlag = float( sign( d0 ) != sign( d1 ) ); - - #include - #include - #include - } - `, - - fragmentShader: /* glsl */` - uniform vec3 diffuse; - uniform float opacity; - varying float discardFlag; - - #include - #include - #include - #include - #include - void main() { - - if ( discardFlag > 0.5 ) discard; - - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - outgoingLight = diffuseColor.rgb; // simple shader - gl_FragColor = vec4( outgoingLight, diffuseColor.a ); - #include - #include - #include - #include - } - `, - - } ); - - Object.defineProperties( this, { - - opacity: { - get: function () { - - return this.uniforms.opacity.value; - - }, - - set: function ( value ) { - - this.uniforms.opacity.value = value; - - } - }, - - color: { - get: function () { - - return this.uniforms.diffuse.value; - - } - } - - } ); - - this.setValues( parameters ); - this.isLDrawConditionalLineMaterial = true; - - } - -} - -class ConditionalLineSegments extends LineSegments { - - constructor( geometry, material ) { - - super( geometry, material ); - this.isConditionalLine = true; - - } - -} - -function generateFaceNormals( faces ) { - - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const face = faces[ i ]; - const vertices = face.vertices; - const v0 = vertices[ 0 ]; - const v1 = vertices[ 1 ]; - const v2 = vertices[ 2 ]; - - _tempVec0.subVectors( v1, v0 ); - _tempVec1.subVectors( v2, v1 ); - face.faceNormal = new Vector3() - .crossVectors( _tempVec0, _tempVec1 ) - .normalize(); - - } - -} - -const _ray = new Ray(); -function smoothNormals( faces, lineSegments, checkSubSegments = false ) { - - // NOTE: 1e2 is pretty coarse but was chosen to quantize the resulting value because - // it allows edges to be smoothed as expected (see minifig arms). - // -- - // And the vector values are initialize multiplied by 1 + 1e-10 to account for floating - // point errors on vertices along quantization boundaries. Ie after matrix multiplication - // vertices that should be merged might be set to "1.7" and "1.6999..." meaning they won't - // get merged. This added epsilon attempts to push these error values to the same quantized - // value for the sake of hashing. See "AT-ST mini" dishes. See mrdoob/three#23169. - - const hashMultiplier = ( 1 + 1e-10 ) * 1e2; - function hashVertex( v ) { - - const x = ~ ~ ( v.x * hashMultiplier ); - const y = ~ ~ ( v.y * hashMultiplier ); - const z = ~ ~ ( v.z * hashMultiplier ); - - return `${ x },${ y },${ z }`; - - } - - function hashEdge( v0, v1 ) { - - return `${ hashVertex( v0 ) }_${ hashVertex( v1 ) }`; - - } - - // converts the two vertices to a ray with a normalized direction and origin of 0, 0, 0 projected - // onto the original line. - function toNormalizedRay( v0, v1, targetRay ) { - - targetRay.direction.subVectors( v1, v0 ).normalize(); - - const scalar = v0.dot( targetRay.direction ); - targetRay.origin.copy( v0 ).addScaledVector( targetRay.direction, - scalar ); - - return targetRay; - - } - - function hashRay( ray ) { - - return hashEdge( ray.origin, ray.direction ); - - } - - const hardEdges = new Set(); - const hardEdgeRays = new Map(); - const halfEdgeList = {}; - const normals = []; - - // Save the list of hard edges by hash - for ( let i = 0, l = lineSegments.length; i < l; i ++ ) { - - const ls = lineSegments[ i ]; - const vertices = ls.vertices; - const v0 = vertices[ 0 ]; - const v1 = vertices[ 1 ]; - hardEdges.add( hashEdge( v0, v1 ) ); - hardEdges.add( hashEdge( v1, v0 ) ); - - // only generate the hard edge ray map if we're checking subsegments because it's more expensive to check - // and requires more memory. - if ( checkSubSegments ) { - - // add both ray directions to the map - const ray = toNormalizedRay( v0, v1, new Ray() ); - const rh1 = hashRay( ray ); - if ( ! hardEdgeRays.has( rh1 ) ) { - - toNormalizedRay( v1, v0, ray ); - const rh2 = hashRay( ray ); - - const info = { - ray, - distances: [], - }; - - hardEdgeRays.set( rh1, info ); - hardEdgeRays.set( rh2, info ); - - } - - // store both segments ends in min, max order in the distances array to check if a face edge is a - // subsegment later. - const info = hardEdgeRays.get( rh1 ); - let d0 = info.ray.direction.dot( v0 ); - let d1 = info.ray.direction.dot( v1 ); - if ( d0 > d1 ) { - - [ d0, d1 ] = [ d1, d0 ]; - - } - - info.distances.push( d0, d1 ); - - } - - } - - // track the half edges associated with each triangle - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const tri = faces[ i ]; - const vertices = tri.vertices; - const vertCount = vertices.length; - for ( let i2 = 0; i2 < vertCount; i2 ++ ) { - - const index = i2; - const next = ( i2 + 1 ) % vertCount; - const v0 = vertices[ index ]; - const v1 = vertices[ next ]; - const hash = hashEdge( v0, v1 ); - - // don't add the triangle if the edge is supposed to be hard - if ( hardEdges.has( hash ) ) { - - continue; - - } - - // if checking subsegments then check to see if this edge lies on a hard edge ray and whether its within any ray bounds - if ( checkSubSegments ) { - - toNormalizedRay( v0, v1, _ray ); - - const rayHash = hashRay( _ray ); - if ( hardEdgeRays.has( rayHash ) ) { - - const info = hardEdgeRays.get( rayHash ); - const { ray, distances } = info; - let d0 = ray.direction.dot( v0 ); - let d1 = ray.direction.dot( v1 ); - - if ( d0 > d1 ) { - - [ d0, d1 ] = [ d1, d0 ]; - - } - - // return early if the face edge is found to be a subsegment of a line edge meaning the edge will have "hard" normals - let found = false; - for ( let i = 0, l = distances.length; i < l; i += 2 ) { - - if ( d0 >= distances[ i ] && d1 <= distances[ i + 1 ] ) { - - found = true; - break; - - } - - } - - if ( found ) { - - continue; - - } - - } - - } - - const info = { - index: index, - tri: tri - }; - halfEdgeList[ hash ] = info; - - } - - } - - // Iterate until we've tried to connect all faces to share normals - while ( true ) { - - // Stop if there are no more faces left - let halfEdge = null; - for ( const key in halfEdgeList ) { - - halfEdge = halfEdgeList[ key ]; - break; - - } - - if ( halfEdge === null ) { - - break; - - } - - // Exhaustively find all connected faces - const queue = [ halfEdge ]; - while ( queue.length > 0 ) { - - // initialize all vertex normals in this triangle - const tri = queue.pop().tri; - const vertices = tri.vertices; - const vertNormals = tri.normals; - const faceNormal = tri.faceNormal; - - // Check if any edge is connected to another triangle edge - const vertCount = vertices.length; - for ( let i2 = 0; i2 < vertCount; i2 ++ ) { - - const index = i2; - const next = ( i2 + 1 ) % vertCount; - const v0 = vertices[ index ]; - const v1 = vertices[ next ]; - - // delete this triangle from the list so it won't be found again - const hash = hashEdge( v0, v1 ); - delete halfEdgeList[ hash ]; - - const reverseHash = hashEdge( v1, v0 ); - const otherInfo = halfEdgeList[ reverseHash ]; - if ( otherInfo ) { - - const otherTri = otherInfo.tri; - const otherIndex = otherInfo.index; - const otherNormals = otherTri.normals; - const otherVertCount = otherNormals.length; - const otherFaceNormal = otherTri.faceNormal; - - // NOTE: If the angle between faces is > 67.5 degrees then assume it's - // hard edge. There are some cases where the line segments do not line up exactly - // with or span multiple triangle edges (see Lunar Vehicle wheels). - if ( Math.abs( otherTri.faceNormal.dot( tri.faceNormal ) ) < 0.25 ) { - - continue; - - } - - // if this triangle has already been traversed then it won't be in - // the halfEdgeList. If it has not then add it to the queue and delete - // it so it won't be found again. - if ( reverseHash in halfEdgeList ) { - - queue.push( otherInfo ); - delete halfEdgeList[ reverseHash ]; - - } - - // share the first normal - const otherNext = ( otherIndex + 1 ) % otherVertCount; - if ( - vertNormals[ index ] && otherNormals[ otherNext ] && - vertNormals[ index ] !== otherNormals[ otherNext ] - ) { - - otherNormals[ otherNext ].norm.add( vertNormals[ index ].norm ); - vertNormals[ index ].norm = otherNormals[ otherNext ].norm; - - } - - let sharedNormal1 = vertNormals[ index ] || otherNormals[ otherNext ]; - if ( sharedNormal1 === null ) { - - // it's possible to encounter an edge of a triangle that has already been traversed meaning - // both edges already have different normals defined and shared. To work around this we create - // a wrapper object so when those edges are merged the normals can be updated everywhere. - sharedNormal1 = { norm: new Vector3() }; - normals.push( sharedNormal1.norm ); - - } - - if ( vertNormals[ index ] === null ) { - - vertNormals[ index ] = sharedNormal1; - sharedNormal1.norm.add( faceNormal ); - - } - - if ( otherNormals[ otherNext ] === null ) { - - otherNormals[ otherNext ] = sharedNormal1; - sharedNormal1.norm.add( otherFaceNormal ); - - } - - // share the second normal - if ( - vertNormals[ next ] && otherNormals[ otherIndex ] && - vertNormals[ next ] !== otherNormals[ otherIndex ] - ) { - - otherNormals[ otherIndex ].norm.add( vertNormals[ next ].norm ); - vertNormals[ next ].norm = otherNormals[ otherIndex ].norm; - - } - - let sharedNormal2 = vertNormals[ next ] || otherNormals[ otherIndex ]; - if ( sharedNormal2 === null ) { - - sharedNormal2 = { norm: new Vector3() }; - normals.push( sharedNormal2.norm ); - - } - - if ( vertNormals[ next ] === null ) { - - vertNormals[ next ] = sharedNormal2; - sharedNormal2.norm.add( faceNormal ); - - } - - if ( otherNormals[ otherIndex ] === null ) { - - otherNormals[ otherIndex ] = sharedNormal2; - sharedNormal2.norm.add( otherFaceNormal ); - - } - - } - - } - - } - - } - - // The normals of each face have been added up so now we average them by normalizing the vector. - for ( let i = 0, l = normals.length; i < l; i ++ ) { - - normals[ i ].normalize(); - - } - -} - -function isPartType( type ) { - - return type === 'Part' || type === 'Unofficial_Part'; - -} - -function isPrimitiveType( type ) { - - return /primitive/i.test( type ) || type === 'Subpart'; - -} - -class LineParser { - - constructor( line, lineNumber ) { - - this.line = line; - this.lineLength = line.length; - this.currentCharIndex = 0; - this.currentChar = ' '; - this.lineNumber = lineNumber; - - } - - seekNonSpace() { - - while ( this.currentCharIndex < this.lineLength ) { - - this.currentChar = this.line.charAt( this.currentCharIndex ); - - if ( this.currentChar !== ' ' && this.currentChar !== '\t' ) { - - return; - - } - - this.currentCharIndex ++; - - } - - } - - getToken() { - - const pos0 = this.currentCharIndex ++; - - // Seek space - while ( this.currentCharIndex < this.lineLength ) { - - this.currentChar = this.line.charAt( this.currentCharIndex ); - - if ( this.currentChar === ' ' || this.currentChar === '\t' ) { - - break; - - } - - this.currentCharIndex ++; - - } - - const pos1 = this.currentCharIndex; - - this.seekNonSpace(); - - return this.line.substring( pos0, pos1 ); - - } - - getVector() { - - return new Vector3( parseFloat( this.getToken() ), parseFloat( this.getToken() ), parseFloat( this.getToken() ) ); - - } - - getRemainingString() { - - return this.line.substring( this.currentCharIndex, this.lineLength ); - - } - - isAtTheEnd() { - - return this.currentCharIndex >= this.lineLength; - - } - - setToEnd() { - - this.currentCharIndex = this.lineLength; - - } - - getLineNumberString() { - - return this.lineNumber >= 0 ? ' at line ' + this.lineNumber : ''; - - } - -} - -// Fetches and parses an intermediate representation of LDraw parts files. -class LDrawParsedCache { - - constructor( loader ) { - - this.loader = loader; - this._cache = {}; - - } - - cloneResult( original ) { - - const result = {}; - - // vertices are transformed and normals computed before being converted to geometry - // so these pieces must be cloned. - result.faces = original.faces.map( face => { - - return { - colorCode: face.colorCode, - material: face.material, - vertices: face.vertices.map( v => v.clone() ), - normals: face.normals.map( () => null ), - faceNormal: null - }; - - } ); - - result.conditionalSegments = original.conditionalSegments.map( face => { - - return { - colorCode: face.colorCode, - material: face.material, - vertices: face.vertices.map( v => v.clone() ), - controlPoints: face.controlPoints.map( v => v.clone() ) - }; - - } ); - - result.lineSegments = original.lineSegments.map( face => { - - return { - colorCode: face.colorCode, - material: face.material, - vertices: face.vertices.map( v => v.clone() ) - }; - - } ); - - // none if this is subsequently modified - result.type = original.type; - result.category = original.category; - result.keywords = original.keywords; - result.author = original.author; - result.subobjects = original.subobjects; - result.fileName = original.fileName; - result.totalFaces = original.totalFaces; - result.startingBuildingStep = original.startingBuildingStep; - result.materials = original.materials; - result.group = null; - return result; - - } - - async fetchData( fileName ) { - - let triedLowerCase = false; - let locationState = FILE_LOCATION_TRY_PARTS; - while ( locationState !== FILE_LOCATION_NOT_FOUND ) { - - let subobjectURL = fileName; - switch ( locationState ) { - - case FILE_LOCATION_AS_IS: - locationState = locationState + 1; - break; - - case FILE_LOCATION_TRY_PARTS: - subobjectURL = 'parts/' + subobjectURL; - locationState = locationState + 1; - break; - - case FILE_LOCATION_TRY_P: - subobjectURL = 'p/' + subobjectURL; - locationState = locationState + 1; - break; - - case FILE_LOCATION_TRY_MODELS: - subobjectURL = 'models/' + subobjectURL; - locationState = locationState + 1; - break; - - case FILE_LOCATION_TRY_RELATIVE: - subobjectURL = fileName.substring( 0, fileName.lastIndexOf( '/' ) + 1 ) + subobjectURL; - locationState = locationState + 1; - break; - - case FILE_LOCATION_TRY_ABSOLUTE: - - if ( triedLowerCase ) { - - // Try absolute path - locationState = FILE_LOCATION_NOT_FOUND; - - } else { - - // Next attempt is lower case - fileName = fileName.toLowerCase(); - subobjectURL = fileName; - triedLowerCase = true; - locationState = FILE_LOCATION_TRY_PARTS; - - } - - break; - - } - - const loader = this.loader; - const fileLoader = new FileLoader( loader.manager ); - fileLoader.setPath( loader.partsLibraryPath ); - fileLoader.setRequestHeader( loader.requestHeader ); - fileLoader.setWithCredentials( loader.withCredentials ); - - try { - - const text = await fileLoader.loadAsync( subobjectURL ); - return text; - - } catch ( _ ) { - - continue; - - } - - } - - throw new Error( 'LDrawLoader: Subobject "' + fileName + '" could not be loaded.' ); - - } - - parse( text, fileName = null ) { - - const loader = this.loader; - - // final results - const faces = []; - const lineSegments = []; - const conditionalSegments = []; - const subobjects = []; - const materials = {}; - - const getLocalMaterial = colorCode => { - - return materials[ colorCode ] || null; - - }; - - let type = 'Model'; - let category = null; - let keywords = null; - let author = null; - let totalFaces = 0; - - // split into lines - if ( text.indexOf( '\r\n' ) !== - 1 ) { - - // This is faster than String.split with regex that splits on both - text = text.replace( /\r\n/g, '\n' ); - - } - - const lines = text.split( '\n' ); - const numLines = lines.length; - - let parsingEmbeddedFiles = false; - let currentEmbeddedFileName = null; - let currentEmbeddedText = null; - - let bfcCertified = false; - let bfcCCW = true; - let bfcInverted = false; - let bfcCull = true; - - let startingBuildingStep = false; - - // Parse all line commands - for ( let lineIndex = 0; lineIndex < numLines; lineIndex ++ ) { - - const line = lines[ lineIndex ]; - - if ( line.length === 0 ) continue; - - if ( parsingEmbeddedFiles ) { - - if ( line.startsWith( '0 FILE ' ) ) { - - // Save previous embedded file in the cache - this.setData( currentEmbeddedFileName, currentEmbeddedText ); - - // New embedded text file - currentEmbeddedFileName = line.substring( 7 ); - currentEmbeddedText = ''; - - } else { - - currentEmbeddedText += line + '\n'; - - } - - continue; - - } - - const lp = new LineParser( line, lineIndex + 1 ); - lp.seekNonSpace(); - - if ( lp.isAtTheEnd() ) { - - // Empty line - continue; - - } - - // Parse the line type - const lineType = lp.getToken(); - - let material; - let colorCode; - let segment; - let ccw; - let doubleSided; - let v0, v1, v2, v3, c0, c1; - - switch ( lineType ) { - - // Line type 0: Comment or META - case '0': - - // Parse meta directive - const meta = lp.getToken(); - - if ( meta ) { - - switch ( meta ) { - - case '!LDRAW_ORG': - - type = lp.getToken(); - break; - - case '!COLOUR': - - material = loader.parseColorMetaDirective( lp ); - if ( material ) { - - materials[ material.userData.code ] = material; - - } else { - - console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() ); - - } - - break; - - case '!CATEGORY': - - category = lp.getToken(); - break; - - case '!KEYWORDS': - - const newKeywords = lp.getRemainingString().split( ',' ); - if ( newKeywords.length > 0 ) { - - if ( ! keywords ) { - - keywords = []; - - } - - newKeywords.forEach( function ( keyword ) { - - keywords.push( keyword.trim() ); - - } ); - - } - - break; - - case 'FILE': - - if ( lineIndex > 0 ) { - - // Start embedded text files parsing - parsingEmbeddedFiles = true; - currentEmbeddedFileName = lp.getRemainingString(); - currentEmbeddedText = ''; - - bfcCertified = false; - bfcCCW = true; - - } - - break; - - case 'BFC': - - // Changes to the backface culling state - while ( ! lp.isAtTheEnd() ) { - - const token = lp.getToken(); - - switch ( token ) { - - case 'CERTIFY': - case 'NOCERTIFY': - - bfcCertified = token === 'CERTIFY'; - bfcCCW = true; - - break; - - case 'CW': - case 'CCW': - - bfcCCW = token === 'CCW'; - - break; - - case 'INVERTNEXT': - - bfcInverted = true; - - break; - - case 'CLIP': - case 'NOCLIP': - - bfcCull = token === 'CLIP'; - - break; - - default: - - console.warn( 'THREE.LDrawLoader: BFC directive "' + token + '" is unknown.' ); - - break; - - } - - } - - break; - - case 'STEP': - - startingBuildingStep = true; - - break; - - case 'Author:': - - author = lp.getToken(); - - break; - - default: - // Other meta directives are not implemented - break; - - } - - } - - break; - - // Line type 1: Sub-object file - case '1': - - colorCode = lp.getToken(); - material = getLocalMaterial( colorCode ); - - const posX = parseFloat( lp.getToken() ); - const posY = parseFloat( lp.getToken() ); - const posZ = parseFloat( lp.getToken() ); - const m0 = parseFloat( lp.getToken() ); - const m1 = parseFloat( lp.getToken() ); - const m2 = parseFloat( lp.getToken() ); - const m3 = parseFloat( lp.getToken() ); - const m4 = parseFloat( lp.getToken() ); - const m5 = parseFloat( lp.getToken() ); - const m6 = parseFloat( lp.getToken() ); - const m7 = parseFloat( lp.getToken() ); - const m8 = parseFloat( lp.getToken() ); - - const matrix = new Matrix4().set( - m0, m1, m2, posX, - m3, m4, m5, posY, - m6, m7, m8, posZ, - 0, 0, 0, 1 - ); - - let fileName = lp.getRemainingString().trim().replace( /\\/g, '/' ); - - if ( loader.fileMap[ fileName ] ) { - - // Found the subobject path in the preloaded file path map - fileName = loader.fileMap[ fileName ]; - - } else { - - // Standardized subfolders - if ( fileName.startsWith( 's/' ) ) { - - fileName = 'parts/' + fileName; - - } else if ( fileName.startsWith( '48/' ) ) { - - fileName = 'p/' + fileName; - - } - - } - - subobjects.push( { - material: material, - colorCode: colorCode, - matrix: matrix, - fileName: fileName, - inverted: bfcInverted, - startingBuildingStep: startingBuildingStep - } ); - - startingBuildingStep = false; - bfcInverted = false; - - break; - - // Line type 2: Line segment - case '2': - - colorCode = lp.getToken(); - material = getLocalMaterial( colorCode ); - v0 = lp.getVector(); - v1 = lp.getVector(); - - segment = { - material: material, - colorCode: colorCode, - vertices: [ v0, v1 ], - }; - - lineSegments.push( segment ); - - break; - - // Line type 5: Conditional Line segment - case '5': - - colorCode = lp.getToken(); - material = getLocalMaterial( colorCode ); - v0 = lp.getVector(); - v1 = lp.getVector(); - c0 = lp.getVector(); - c1 = lp.getVector(); - - segment = { - material: material, - colorCode: colorCode, - vertices: [ v0, v1 ], - controlPoints: [ c0, c1 ], - }; - - conditionalSegments.push( segment ); - - break; - - // Line type 3: Triangle - case '3': - - colorCode = lp.getToken(); - material = getLocalMaterial( colorCode ); - ccw = bfcCCW; - doubleSided = ! bfcCertified || ! bfcCull; - - if ( ccw === true ) { - - v0 = lp.getVector(); - v1 = lp.getVector(); - v2 = lp.getVector(); - - } else { - - v2 = lp.getVector(); - v1 = lp.getVector(); - v0 = lp.getVector(); - - } - - faces.push( { - material: material, - colorCode: colorCode, - faceNormal: null, - vertices: [ v0, v1, v2 ], - normals: [ null, null, null ], - } ); - totalFaces ++; - - if ( doubleSided === true ) { - - faces.push( { - material: material, - colorCode: colorCode, - faceNormal: null, - vertices: [ v2, v1, v0 ], - normals: [ null, null, null ], - } ); - totalFaces ++; - - } - - break; - - // Line type 4: Quadrilateral - case '4': - - colorCode = lp.getToken(); - material = getLocalMaterial( colorCode ); - ccw = bfcCCW; - doubleSided = ! bfcCertified || ! bfcCull; - - if ( ccw === true ) { - - v0 = lp.getVector(); - v1 = lp.getVector(); - v2 = lp.getVector(); - v3 = lp.getVector(); - - } else { - - v3 = lp.getVector(); - v2 = lp.getVector(); - v1 = lp.getVector(); - v0 = lp.getVector(); - - } - - // specifically place the triangle diagonal in the v0 and v1 slots so we can - // account for the doubling of vertices later when smoothing normals. - faces.push( { - material: material, - colorCode: colorCode, - faceNormal: null, - vertices: [ v0, v1, v2, v3 ], - normals: [ null, null, null, null ], - } ); - totalFaces += 2; - - if ( doubleSided === true ) { - - faces.push( { - material: material, - colorCode: colorCode, - faceNormal: null, - vertices: [ v3, v2, v1, v0 ], - normals: [ null, null, null, null ], - } ); - totalFaces += 2; - - } - - break; - - default: - throw new Error( 'LDrawLoader: Unknown line type "' + lineType + '"' + lp.getLineNumberString() + '.' ); - - } - - } - - if ( parsingEmbeddedFiles ) { - - this.setData( currentEmbeddedFileName, currentEmbeddedText ); - - } - - return { - faces, - conditionalSegments, - lineSegments, - type, - category, - keywords, - author, - subobjects, - totalFaces, - startingBuildingStep, - materials, - fileName, - group: null - }; - - } - - // returns an (optionally cloned) instance of the data - getData( fileName, clone = true ) { - - const key = fileName.toLowerCase(); - const result = this._cache[ key ]; - if ( result === null || result instanceof Promise ) { - - return null; - - } - - if ( clone ) { - - return this.cloneResult( result ); - - } else { - - return result; - - } - - } - - // kicks off a fetch and parse of the requested data if it hasn't already been loaded. Returns when - // the data is ready to use and can be retrieved synchronously with "getData". - async ensureDataLoaded( fileName ) { - - const key = fileName.toLowerCase(); - if ( ! ( key in this._cache ) ) { - - // replace the promise with a copy of the parsed data for immediate processing - this._cache[ key ] = this.fetchData( fileName ).then( text => { - - const info = this.parse( text, fileName ); - this._cache[ key ] = info; - return info; - - } ); - - } - - await this._cache[ key ]; - - } - - // sets the data in the cache from parsed data - setData( fileName, text ) { - - const key = fileName.toLowerCase(); - this._cache[ key ] = this.parse( text, fileName ); - - } - -} - -// returns the material for an associated color code. If the color code is 16 for a face or 24 for -// an edge then the passthroughColorCode is used. -function getMaterialFromCode( colorCode, parentColorCode, materialHierarchy, forEdge ) { - - const isPassthrough = ! forEdge && colorCode === MAIN_COLOUR_CODE || forEdge && colorCode === MAIN_EDGE_COLOUR_CODE; - if ( isPassthrough ) { - - colorCode = parentColorCode; - - } - - return materialHierarchy[ colorCode ] || null; - -} - -// Class used to parse and build LDraw parts as three.js objects and cache them if they're a "Part" type. -class LDrawPartsGeometryCache { - - constructor( loader ) { - - this.loader = loader; - this.parseCache = new LDrawParsedCache( loader ); - this._cache = {}; - - } - - // Convert the given file information into a mesh by processing subobjects. - async processIntoMesh( info ) { - - const loader = this.loader; - const parseCache = this.parseCache; - const faceMaterials = new Set(); - - // Processes the part subobject information to load child parts and merge geometry onto part - // piece object. - const processInfoSubobjects = async ( info, subobject = null ) => { - - const subobjects = info.subobjects; - const promises = []; - - // Trigger load of all subobjects. If a subobject isn't a primitive then load it as a separate - // group which lets instruction steps apply correctly. - for ( let i = 0, l = subobjects.length; i < l; i ++ ) { - - const subobject = subobjects[ i ]; - const promise = parseCache.ensureDataLoaded( subobject.fileName ).then( () => { - - const subobjectInfo = parseCache.getData( subobject.fileName, false ); - if ( ! isPrimitiveType( subobjectInfo.type ) ) { - - return this.loadModel( subobject.fileName ).catch( error => { - - console.warn( error ); - return null; - - } ); - - } - - return processInfoSubobjects( parseCache.getData( subobject.fileName ), subobject ); - - } ); - - promises.push( promise ); - - } - - const group = new Group(); - group.userData.category = info.category; - group.userData.keywords = info.keywords; - group.userData.author = info.author; - group.userData.type = info.type; - group.userData.fileName = info.fileName; - info.group = group; - - const subobjectInfos = await Promise.all( promises ); - for ( let i = 0, l = subobjectInfos.length; i < l; i ++ ) { - - const subobject = info.subobjects[ i ]; - const subobjectInfo = subobjectInfos[ i ]; - - if ( subobjectInfo === null ) { - - // the subobject failed to load - continue; - - } - - // if the subobject was loaded as a separate group then apply the parent scopes materials - if ( subobjectInfo.isGroup ) { - - const subobjectGroup = subobjectInfo; - subobject.matrix.decompose( subobjectGroup.position, subobjectGroup.quaternion, subobjectGroup.scale ); - subobjectGroup.userData.startingBuildingStep = subobject.startingBuildingStep; - subobjectGroup.name = subobject.fileName; - - loader.applyMaterialsToMesh( subobjectGroup, subobject.colorCode, info.materials ); - subobjectGroup.userData.colorCode = subobject.colorCode; - - group.add( subobjectGroup ); - continue; - - } - - // add the subobject group if it has children in case it has both children and primitives - if ( subobjectInfo.group.children.length ) { - - group.add( subobjectInfo.group ); - - } - - // transform the primitives into the local space of the parent piece and append them to - // to the parent primitives list. - const parentLineSegments = info.lineSegments; - const parentConditionalSegments = info.conditionalSegments; - const parentFaces = info.faces; - - const lineSegments = subobjectInfo.lineSegments; - const conditionalSegments = subobjectInfo.conditionalSegments; - - const faces = subobjectInfo.faces; - const matrix = subobject.matrix; - const inverted = subobject.inverted; - const matrixScaleInverted = matrix.determinant() < 0; - const colorCode = subobject.colorCode; - - const lineColorCode = colorCode === MAIN_COLOUR_CODE ? MAIN_EDGE_COLOUR_CODE : colorCode; - for ( let i = 0, l = lineSegments.length; i < l; i ++ ) { - - const ls = lineSegments[ i ]; - const vertices = ls.vertices; - vertices[ 0 ].applyMatrix4( matrix ); - vertices[ 1 ].applyMatrix4( matrix ); - ls.colorCode = ls.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : ls.colorCode; - ls.material = ls.material || getMaterialFromCode( ls.colorCode, ls.colorCode, info.materials, true ); - - parentLineSegments.push( ls ); - - } - - for ( let i = 0, l = conditionalSegments.length; i < l; i ++ ) { - - const os = conditionalSegments[ i ]; - const vertices = os.vertices; - const controlPoints = os.controlPoints; - vertices[ 0 ].applyMatrix4( matrix ); - vertices[ 1 ].applyMatrix4( matrix ); - controlPoints[ 0 ].applyMatrix4( matrix ); - controlPoints[ 1 ].applyMatrix4( matrix ); - os.colorCode = os.colorCode === MAIN_EDGE_COLOUR_CODE ? lineColorCode : os.colorCode; - os.material = os.material || getMaterialFromCode( os.colorCode, os.colorCode, info.materials, true ); - - parentConditionalSegments.push( os ); - - } - - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const tri = faces[ i ]; - const vertices = tri.vertices; - for ( let i = 0, l = vertices.length; i < l; i ++ ) { - - vertices[ i ].applyMatrix4( matrix ); - - } - - tri.colorCode = tri.colorCode === MAIN_COLOUR_CODE ? colorCode : tri.colorCode; - tri.material = tri.material || getMaterialFromCode( tri.colorCode, colorCode, info.materials, false ); - faceMaterials.add( tri.colorCode ); - - // If the scale of the object is negated then the triangle winding order - // needs to be flipped. - if ( matrixScaleInverted !== inverted ) { - - vertices.reverse(); - - } - - parentFaces.push( tri ); - - } - - info.totalFaces += subobjectInfo.totalFaces; - - } - - // Apply the parent subobjects pass through material code to this object. This is done several times due - // to material scoping. - if ( subobject ) { - - loader.applyMaterialsToMesh( group, subobject.colorCode, info.materials ); - group.userData.colorCode = subobject.colorCode; - - } - - return info; - - }; - - // Track material use to see if we need to use the normal smooth slow path for hard edges. - for ( let i = 0, l = info.faces; i < l; i ++ ) { - - faceMaterials.add( info.faces[ i ].colorCode ); - - } - - await processInfoSubobjects( info ); - - if ( loader.smoothNormals ) { - - const checkSubSegments = faceMaterials.size > 1; - generateFaceNormals( info.faces ); - smoothNormals( info.faces, info.lineSegments, checkSubSegments ); - - } - - // Add the primitive objects and metadata. - const group = info.group; - if ( info.faces.length > 0 ) { - - group.add( createObject( this.loader, info.faces, 3, false, info.totalFaces ) ); - - } - - if ( info.lineSegments.length > 0 ) { - - group.add( createObject( this.loader, info.lineSegments, 2 ) ); - - } - - if ( info.conditionalSegments.length > 0 ) { - - group.add( createObject( this.loader, info.conditionalSegments, 2, true ) ); - - } - - return group; - - } - - hasCachedModel( fileName ) { - - return fileName !== null && fileName.toLowerCase() in this._cache; - - } - - async getCachedModel( fileName ) { - - if ( fileName !== null && this.hasCachedModel( fileName ) ) { - - const key = fileName.toLowerCase(); - const group = await this._cache[ key ]; - return group.clone(); - - } else { - - return null; - - } - - } - - // Loads and parses the model with the given file name. Returns a cached copy if available. - async loadModel( fileName ) { - - const parseCache = this.parseCache; - const key = fileName.toLowerCase(); - if ( this.hasCachedModel( fileName ) ) { - - // Return cached model if available. - return this.getCachedModel( fileName ); - - } else { - - // Otherwise parse a new model. - // Ensure the file data is loaded and pre parsed. - await parseCache.ensureDataLoaded( fileName ); - - const info = parseCache.getData( fileName ); - const promise = this.processIntoMesh( info ); - - // Now that the file has loaded it's possible that another part parse has been waiting in parallel - // so check the cache again to see if it's been added since the last async operation so we don't - // do unnecessary work. - if ( this.hasCachedModel( fileName ) ) { - - return this.getCachedModel( fileName ); - - } - - // Cache object if it's a part so it can be reused later. - if ( isPartType( info.type ) ) { - - this._cache[ key ] = promise; - - } - - // return a copy - const group = await promise; - return group.clone(); - - } - - } - - // parses the given model text into a renderable object. Returns cached copy if available. - async parseModel( text ) { - - const parseCache = this.parseCache; - const info = parseCache.parse( text ); - if ( isPartType( info.type ) && this.hasCachedModel( info.fileName ) ) { - - return this.getCachedModel( info.fileName ); - - } - - return this.processIntoMesh( info ); - - } - -} - -function sortByMaterial( a, b ) { - - if ( a.colorCode === b.colorCode ) { - - return 0; - - } - - if ( a.colorCode < b.colorCode ) { - - return - 1; - - } - - return 1; - -} - -function createObject( loader, elements, elementSize, isConditionalSegments = false, totalElements = null ) { - - // Creates a LineSegments (elementSize = 2) or a Mesh (elementSize = 3 ) - // With per face / segment material, implemented with mesh groups and materials array - - // Sort the faces or line segments by color code to make later the mesh groups - elements.sort( sortByMaterial ); - - if ( totalElements === null ) { - - totalElements = elements.length; - - } - - const positions = new Float32Array( elementSize * totalElements * 3 ); - const normals = elementSize === 3 ? new Float32Array( elementSize * totalElements * 3 ) : null; - const materials = []; - - const quadArray = new Array( 6 ); - const bufferGeometry = new BufferGeometry(); - let prevMaterial = null; - let index0 = 0; - let numGroupVerts = 0; - let offset = 0; - - for ( let iElem = 0, nElem = elements.length; iElem < nElem; iElem ++ ) { - - const elem = elements[ iElem ]; - let vertices = elem.vertices; - if ( vertices.length === 4 ) { - - quadArray[ 0 ] = vertices[ 0 ]; - quadArray[ 1 ] = vertices[ 1 ]; - quadArray[ 2 ] = vertices[ 2 ]; - quadArray[ 3 ] = vertices[ 0 ]; - quadArray[ 4 ] = vertices[ 2 ]; - quadArray[ 5 ] = vertices[ 3 ]; - vertices = quadArray; - - } - - for ( let j = 0, l = vertices.length; j < l; j ++ ) { - - const v = vertices[ j ]; - const index = offset + j * 3; - positions[ index + 0 ] = v.x; - positions[ index + 1 ] = v.y; - positions[ index + 2 ] = v.z; - - } - - // create the normals array if this is a set of faces - if ( elementSize === 3 ) { - - if ( ! elem.faceNormal ) { - - const v0 = vertices[ 0 ]; - const v1 = vertices[ 1 ]; - const v2 = vertices[ 2 ]; - _tempVec0.subVectors( v1, v0 ); - _tempVec1.subVectors( v2, v1 ); - elem.faceNormal = new Vector3() - .crossVectors( _tempVec0, _tempVec1 ) - .normalize(); - - } - - let elemNormals = elem.normals; - if ( elemNormals.length === 4 ) { - - quadArray[ 0 ] = elemNormals[ 0 ]; - quadArray[ 1 ] = elemNormals[ 1 ]; - quadArray[ 2 ] = elemNormals[ 2 ]; - quadArray[ 3 ] = elemNormals[ 0 ]; - quadArray[ 4 ] = elemNormals[ 2 ]; - quadArray[ 5 ] = elemNormals[ 3 ]; - elemNormals = quadArray; - - } - - for ( let j = 0, l = elemNormals.length; j < l; j ++ ) { - - // use face normal if a vertex normal is not provided - let n = elem.faceNormal; - if ( elemNormals[ j ] ) { - - n = elemNormals[ j ].norm; - - } - - const index = offset + j * 3; - normals[ index + 0 ] = n.x; - normals[ index + 1 ] = n.y; - normals[ index + 2 ] = n.z; - - } - - } - - if ( prevMaterial !== elem.colorCode ) { - - if ( prevMaterial !== null ) { - - bufferGeometry.addGroup( index0, numGroupVerts, materials.length - 1 ); - - } - - const material = elem.material; - - if ( material !== null ) { - - if ( elementSize === 3 ) { - - materials.push( material ); - - } else if ( elementSize === 2 ) { - - if ( isConditionalSegments ) { - - const edgeMaterial = loader.edgeMaterialCache.get( material ); - - materials.push( loader.conditionalEdgeMaterialCache.get( edgeMaterial ) ); - - } else { - - materials.push( loader.edgeMaterialCache.get( material ) ); - - } - - } - - } else { - - // If a material has not been made available yet then keep the color code string in the material array - // to save the spot for the material once a parent scopes materials are being applied to the object. - materials.push( elem.colorCode ); - - } - - prevMaterial = elem.colorCode; - index0 = offset / 3; - numGroupVerts = vertices.length; - - } else { - - numGroupVerts += vertices.length; - - } - - offset += 3 * vertices.length; - - } - - if ( numGroupVerts > 0 ) { - - bufferGeometry.addGroup( index0, Infinity, materials.length - 1 ); - - } - - bufferGeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) ); - - if ( normals !== null ) { - - bufferGeometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - - } - - let object3d = null; - - if ( elementSize === 2 ) { - - if ( isConditionalSegments ) { - - object3d = new ConditionalLineSegments( bufferGeometry, materials.length === 1 ? materials[ 0 ] : materials ); - - } else { - - object3d = new LineSegments( bufferGeometry, materials.length === 1 ? materials[ 0 ] : materials ); - - } - - } else if ( elementSize === 3 ) { - - object3d = new Mesh( bufferGeometry, materials.length === 1 ? materials[ 0 ] : materials ); - - } - - if ( isConditionalSegments ) { - - object3d.isConditionalLine = true; - - const controlArray0 = new Float32Array( elements.length * 3 * 2 ); - const controlArray1 = new Float32Array( elements.length * 3 * 2 ); - const directionArray = new Float32Array( elements.length * 3 * 2 ); - for ( let i = 0, l = elements.length; i < l; i ++ ) { - - const os = elements[ i ]; - const vertices = os.vertices; - const controlPoints = os.controlPoints; - const c0 = controlPoints[ 0 ]; - const c1 = controlPoints[ 1 ]; - const v0 = vertices[ 0 ]; - const v1 = vertices[ 1 ]; - const index = i * 3 * 2; - controlArray0[ index + 0 ] = c0.x; - controlArray0[ index + 1 ] = c0.y; - controlArray0[ index + 2 ] = c0.z; - controlArray0[ index + 3 ] = c0.x; - controlArray0[ index + 4 ] = c0.y; - controlArray0[ index + 5 ] = c0.z; - - controlArray1[ index + 0 ] = c1.x; - controlArray1[ index + 1 ] = c1.y; - controlArray1[ index + 2 ] = c1.z; - controlArray1[ index + 3 ] = c1.x; - controlArray1[ index + 4 ] = c1.y; - controlArray1[ index + 5 ] = c1.z; - - directionArray[ index + 0 ] = v1.x - v0.x; - directionArray[ index + 1 ] = v1.y - v0.y; - directionArray[ index + 2 ] = v1.z - v0.z; - directionArray[ index + 3 ] = v1.x - v0.x; - directionArray[ index + 4 ] = v1.y - v0.y; - directionArray[ index + 5 ] = v1.z - v0.z; - - } - - bufferGeometry.setAttribute( 'control0', new BufferAttribute( controlArray0, 3, false ) ); - bufferGeometry.setAttribute( 'control1', new BufferAttribute( controlArray1, 3, false ) ); - bufferGeometry.setAttribute( 'direction', new BufferAttribute( directionArray, 3, false ) ); - - } - - return object3d; - -} - -// - -class LDrawLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - // Array of THREE.Material - this.materials = []; - this.materialLibrary = {}; - this.edgeMaterialCache = new WeakMap(); - this.conditionalEdgeMaterialCache = new WeakMap(); - - // This also allows to handle the embedded text files ("0 FILE" lines) - this.partsCache = new LDrawPartsGeometryCache( this ); - - // This object is a map from file names to paths. It agilizes the paths search. If it is not set then files will be searched by trial and error. - this.fileMap = {}; - - // Initializes the materials library with default materials - this.setMaterials( [] ); - - // If this flag is set to true the vertex normals will be smoothed. - this.smoothNormals = true; - - // The path to load parts from the LDraw parts library from. - this.partsLibraryPath = ''; - - // Material assigned to not available colors for meshes and edges - this.missingColorMaterial = new MeshStandardMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF, roughness: 0.3, metalness: 0 } ); - this.missingEdgeColorMaterial = new LineBasicMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, color: 0xFF00FF } ); - this.missingConditionalEdgeColorMaterial = new LDrawConditionalLineMaterial( { name: Loader.DEFAULT_MATERIAL_NAME, fog: true, color: 0xFF00FF } ); - this.edgeMaterialCache.set( this.missingColorMaterial, this.missingEdgeColorMaterial ); - this.conditionalEdgeMaterialCache.set( this.missingEdgeColorMaterial, this.missingConditionalEdgeColorMaterial ); - - } - - setPartsLibraryPath( path ) { - - this.partsLibraryPath = path; - return this; - - } - - async preloadMaterials( url ) { - - const fileLoader = new FileLoader( this.manager ); - fileLoader.setPath( this.path ); - fileLoader.setRequestHeader( this.requestHeader ); - fileLoader.setWithCredentials( this.withCredentials ); - - const text = await fileLoader.loadAsync( url ); - const colorLineRegex = /^0 !COLOUR/; - const lines = text.split( /[\n\r]/g ); - const materials = []; - for ( let i = 0, l = lines.length; i < l; i ++ ) { - - const line = lines[ i ]; - if ( colorLineRegex.test( line ) ) { - - const directive = line.replace( colorLineRegex, '' ); - const material = this.parseColorMetaDirective( new LineParser( directive ) ); - materials.push( material ); - - } - - } - - this.setMaterials( materials ); - - } - - load( url, onLoad, onProgress, onError ) { - - const fileLoader = new FileLoader( this.manager ); - fileLoader.setPath( this.path ); - fileLoader.setRequestHeader( this.requestHeader ); - fileLoader.setWithCredentials( this.withCredentials ); - fileLoader.load( url, text => { - - this.partsCache - .parseModel( text, this.materialLibrary ) - .then( group => { - - this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true ); - this.computeBuildingSteps( group ); - group.userData.fileName = url; - onLoad( group ); - - } ) - .catch( onError ); - - }, onProgress, onError ); - - } - - parse( text, onLoad, onError ) { - - this.partsCache - .parseModel( text, this.materialLibrary ) - .then( group => { - - this.applyMaterialsToMesh( group, MAIN_COLOUR_CODE, this.materialLibrary, true ); - this.computeBuildingSteps( group ); - group.userData.fileName = ''; - onLoad( group ); - - } ) - .catch( onError ); - - } - - setMaterials( materials ) { - - this.materialLibrary = {}; - this.materials = []; - for ( let i = 0, l = materials.length; i < l; i ++ ) { - - this.addMaterial( materials[ i ] ); - - } - - // Add default main triangle and line edge materials (used in pieces that can be colored with a main color) - this.addMaterial( this.parseColorMetaDirective( new LineParser( 'Main_Colour CODE 16 VALUE #FF8080 EDGE #333333' ) ) ); - this.addMaterial( this.parseColorMetaDirective( new LineParser( 'Edge_Colour CODE 24 VALUE #A0A0A0 EDGE #333333' ) ) ); - - return this; - - } - - setFileMap( fileMap ) { - - this.fileMap = fileMap; - - return this; - - } - - addMaterial( material ) { - - // Adds a material to the material library which is on top of the parse scopes stack. And also to the materials array - - const matLib = this.materialLibrary; - if ( ! matLib[ material.userData.code ] ) { - - this.materials.push( material ); - matLib[ material.userData.code ] = material; - - } - - return this; - - } - - getMaterial( colorCode ) { - - if ( colorCode.startsWith( '0x2' ) ) { - - // Special 'direct' material value (RGB color) - const color = colorCode.substring( 3 ); - - return this.parseColorMetaDirective( new LineParser( 'Direct_Color_' + color + ' CODE -1 VALUE #' + color + ' EDGE #' + color + '' ) ); - - } - - return this.materialLibrary[ colorCode ] || null; - - } - - // Applies the appropriate materials to a prebuilt hierarchy of geometry. Assumes that color codes are present - // in the material array if they need to be filled in. - applyMaterialsToMesh( group, parentColorCode, materialHierarchy, finalMaterialPass = false ) { - - // find any missing materials as indicated by a color code string and replace it with a material from the current material lib - const loader = this; - const parentIsPassthrough = parentColorCode === MAIN_COLOUR_CODE; - group.traverse( c => { - - if ( c.isMesh || c.isLineSegments ) { - - if ( Array.isArray( c.material ) ) { - - for ( let i = 0, l = c.material.length; i < l; i ++ ) { - - if ( ! c.material[ i ].isMaterial ) { - - c.material[ i ] = getMaterial( c, c.material[ i ] ); - - } - - } - - } else if ( ! c.material.isMaterial ) { - - c.material = getMaterial( c, c.material ); - - } - - } - - } ); - - - // Returns the appropriate material for the object (line or face) given color code. If the code is "pass through" - // (24 for lines, 16 for edges) then the pass through color code is used. If that is also pass through then it's - // simply returned for the subsequent material application. - function getMaterial( c, colorCode ) { - - // if our parent is a passthrough color code and we don't have the current material color available then - // return early. - if ( parentIsPassthrough && ! ( colorCode in materialHierarchy ) && ! finalMaterialPass ) { - - return colorCode; - - } - - const forEdge = c.isLineSegments || c.isConditionalLine; - const isPassthrough = ! forEdge && colorCode === MAIN_COLOUR_CODE || forEdge && colorCode === MAIN_EDGE_COLOUR_CODE; - if ( isPassthrough ) { - - colorCode = parentColorCode; - - } - - let material = null; - if ( colorCode in materialHierarchy ) { - - material = materialHierarchy[ colorCode ]; - - } else if ( finalMaterialPass ) { - - // see if we can get the final material from from the "getMaterial" function which will attempt to - // parse the "direct" colors - material = loader.getMaterial( colorCode ); - if ( material === null ) { - - // otherwise throw a warning if this is final opportunity to set the material - console.warn( `LDrawLoader: Material properties for code ${ colorCode } not available.` ); - - // And return the 'missing color' material - material = loader.missingColorMaterial; - - } - - - } else { - - return colorCode; - - } - - if ( c.isLineSegments ) { - - material = loader.edgeMaterialCache.get( material ); - - if ( c.isConditionalLine ) { - - material = loader.conditionalEdgeMaterialCache.get( material ); - - } - - } - - return material; - - } - - } - - getMainMaterial() { - - return this.getMaterial( MAIN_COLOUR_CODE ); - - } - - getMainEdgeMaterial() { - - const mat = this.getMaterial( MAIN_EDGE_COLOUR_CODE ); - return mat ? this.edgeMaterialCache.get( mat ) : null; - - } - - parseColorMetaDirective( lineParser ) { - - // Parses a color definition and returns a THREE.Material - - let code = null; - - // Triangle and line colors - let fillColor = '#FF00FF'; - let edgeColor = '#FF00FF'; - - // Transparency - let alpha = 1; - let isTransparent = false; - // Self-illumination: - let luminance = 0; - - let finishType = FINISH_TYPE_DEFAULT; - - let edgeMaterial = null; - - const name = lineParser.getToken(); - if ( ! name ) { - - throw new Error( 'LDrawLoader: Material name was expected after "!COLOUR tag' + lineParser.getLineNumberString() + '.' ); - - } - - // Parse tag tokens and their parameters - let token = null; - while ( true ) { - - token = lineParser.getToken(); - - if ( ! token ) { - - break; - - } - - if ( ! parseLuminance( token ) ) { - - switch ( token.toUpperCase() ) { - - case 'CODE': - - code = lineParser.getToken(); - break; - - case 'VALUE': - - fillColor = lineParser.getToken(); - if ( fillColor.startsWith( '0x' ) ) { - - fillColor = '#' + fillColor.substring( 2 ); - - } else if ( ! fillColor.startsWith( '#' ) ) { - - throw new Error( 'LDrawLoader: Invalid color while parsing material' + lineParser.getLineNumberString() + '.' ); - - } - - break; - - case 'EDGE': - - edgeColor = lineParser.getToken(); - if ( edgeColor.startsWith( '0x' ) ) { - - edgeColor = '#' + edgeColor.substring( 2 ); - - } else if ( ! edgeColor.startsWith( '#' ) ) { - - // Try to see if edge color is a color code - edgeMaterial = this.getMaterial( edgeColor ); - if ( ! edgeMaterial ) { - - throw new Error( 'LDrawLoader: Invalid edge color while parsing material' + lineParser.getLineNumberString() + '.' ); - - } - - // Get the edge material for this triangle material - edgeMaterial = this.edgeMaterialCache.get( edgeMaterial ); - - } - - break; - - case 'ALPHA': - - alpha = parseInt( lineParser.getToken() ); - - if ( isNaN( alpha ) ) { - - throw new Error( 'LDrawLoader: Invalid alpha value in material definition' + lineParser.getLineNumberString() + '.' ); - - } - - alpha = Math.max( 0, Math.min( 1, alpha / 255 ) ); - - if ( alpha < 1 ) { - - isTransparent = true; - - } - - break; - - case 'LUMINANCE': - - if ( ! parseLuminance( lineParser.getToken() ) ) { - - throw new Error( 'LDrawLoader: Invalid luminance value in material definition' + LineParser.getLineNumberString() + '.' ); - - } - - break; - - case 'CHROME': - finishType = FINISH_TYPE_CHROME; - break; - - case 'PEARLESCENT': - finishType = FINISH_TYPE_PEARLESCENT; - break; - - case 'RUBBER': - finishType = FINISH_TYPE_RUBBER; - break; - - case 'MATTE_METALLIC': - finishType = FINISH_TYPE_MATTE_METALLIC; - break; - - case 'METAL': - finishType = FINISH_TYPE_METAL; - break; - - case 'MATERIAL': - // Not implemented - lineParser.setToEnd(); - break; - - default: - throw new Error( 'LDrawLoader: Unknown token "' + token + '" while parsing material' + lineParser.getLineNumberString() + '.' ); - - } - - } - - } - - let material = null; - - switch ( finishType ) { - - case FINISH_TYPE_DEFAULT: - - material = new MeshStandardMaterial( { roughness: 0.3, metalness: 0 } ); - break; - - case FINISH_TYPE_PEARLESCENT: - - // Try to imitate pearlescency by making the surface glossy - material = new MeshStandardMaterial( { roughness: 0.3, metalness: 0.25 } ); - break; - - case FINISH_TYPE_CHROME: - - // Mirror finish surface - material = new MeshStandardMaterial( { roughness: 0, metalness: 1 } ); - break; - - case FINISH_TYPE_RUBBER: - - // Rubber finish - material = new MeshStandardMaterial( { roughness: 0.9, metalness: 0 } ); - break; - - case FINISH_TYPE_MATTE_METALLIC: - - // Brushed metal finish - material = new MeshStandardMaterial( { roughness: 0.8, metalness: 0.4 } ); - break; - - case FINISH_TYPE_METAL: - - // Average metal finish - material = new MeshStandardMaterial( { roughness: 0.2, metalness: 0.85 } ); - break; - - default: - // Should not happen - break; - - } - - material.color.setStyle( fillColor, COLOR_SPACE_LDRAW ); - material.transparent = isTransparent; - material.premultipliedAlpha = true; - material.opacity = alpha; - material.depthWrite = ! isTransparent; - - material.polygonOffset = true; - material.polygonOffsetFactor = 1; - - if ( luminance !== 0 ) { - - material.emissive.setStyle( fillColor, COLOR_SPACE_LDRAW ).multiplyScalar( luminance ); - - } - - if ( ! edgeMaterial ) { - - // This is the material used for edges - edgeMaterial = new LineBasicMaterial( { - color: new Color().setStyle( edgeColor, COLOR_SPACE_LDRAW ), - transparent: isTransparent, - opacity: alpha, - depthWrite: ! isTransparent - } ); - edgeMaterial.color; - edgeMaterial.userData.code = code; - edgeMaterial.name = name + ' - Edge'; - - // This is the material used for conditional edges - const conditionalEdgeMaterial = new LDrawConditionalLineMaterial( { - - fog: true, - transparent: isTransparent, - depthWrite: ! isTransparent, - color: new Color().setStyle( edgeColor, COLOR_SPACE_LDRAW ), - opacity: alpha, - - } ); - conditionalEdgeMaterial.userData.code = code; - conditionalEdgeMaterial.name = name + ' - Conditional Edge'; - - this.conditionalEdgeMaterialCache.set( edgeMaterial, conditionalEdgeMaterial ); - - } - - material.userData.code = code; - material.name = name; - - this.edgeMaterialCache.set( material, edgeMaterial ); - - this.addMaterial( material ); - - return material; - - function parseLuminance( token ) { - - // Returns success - - let lum; - - if ( token.startsWith( 'LUMINANCE' ) ) { - - lum = parseInt( token.substring( 9 ) ); - - } else { - - lum = parseInt( token ); - - } - - if ( isNaN( lum ) ) { - - return false; - - } - - luminance = Math.max( 0, Math.min( 1, lum / 255 ) ); - - return true; - - } - - } - - computeBuildingSteps( model ) { - - // Sets userdata.buildingStep number in Group objects and userData.numBuildingSteps number in the root Group object. - - let stepNumber = 0; - - model.traverse( c => { - - if ( c.isGroup ) { - - if ( c.userData.startingBuildingStep ) { - - stepNumber ++; - - } - - c.userData.buildingStep = stepNumber; - - } - - } ); - - model.userData.numBuildingSteps = stepNumber + 1; - - } - -} - -export { LDrawLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawUtils.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawUtils.js deleted file mode 100644 index d30203c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LDrawUtils.js +++ /dev/null @@ -1,202 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Group, - LineSegments, - Matrix3, - Mesh -} from '/static/javascript/three/build/three.module.js'; - -import { mergeGeometries } from './BufferGeometryUtils.js'; - -class LDrawUtils { - - static mergeObject( object ) { - - // Merges geometries in object by materials and returns new object. Use on not indexed geometries. - // The object buffers reference the old object ones. - // Special treatment is done to the conditional lines generated by LDrawLoader. - - function extractGroup( geometry, group, elementSize, isConditionalLine ) { - - // Extracts a group from a geometry as a new geometry (with attribute buffers referencing original buffers) - - const newGeometry = new BufferGeometry(); - - const originalPositions = geometry.getAttribute( 'position' ).array; - const originalNormals = elementSize === 3 ? geometry.getAttribute( 'normal' ).array : null; - - const numVertsGroup = Math.min( group.count, Math.floor( originalPositions.length / 3 ) - group.start ); - const vertStart = group.start * 3; - const vertEnd = ( group.start + numVertsGroup ) * 3; - - const positions = originalPositions.subarray( vertStart, vertEnd ); - const normals = originalNormals !== null ? originalNormals.subarray( vertStart, vertEnd ) : null; - - newGeometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) ); - if ( normals !== null ) newGeometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - - if ( isConditionalLine ) { - - const controlArray0 = geometry.getAttribute( 'control0' ).array.subarray( vertStart, vertEnd ); - const controlArray1 = geometry.getAttribute( 'control1' ).array.subarray( vertStart, vertEnd ); - const directionArray = geometry.getAttribute( 'direction' ).array.subarray( vertStart, vertEnd ); - - newGeometry.setAttribute( 'control0', new BufferAttribute( controlArray0, 3, false ) ); - newGeometry.setAttribute( 'control1', new BufferAttribute( controlArray1, 3, false ) ); - newGeometry.setAttribute( 'direction', new BufferAttribute( directionArray, 3, false ) ); - - } - - return newGeometry; - - } - - function addGeometry( mat, geometry, geometries ) { - - const geoms = geometries[ mat.uuid ]; - if ( ! geoms ) { - - geometries[ mat.uuid ] = { - mat: mat, - arr: [ geometry ] - }; - - } else { - - geoms.arr.push( geometry ); - - } - - } - - function permuteAttribute( attribute, elemSize ) { - - // Permutes first two vertices of each attribute element - - if ( ! attribute ) return; - - const verts = attribute.array; - const numVerts = Math.floor( verts.length / 3 ); - let offset = 0; - for ( let i = 0; i < numVerts; i ++ ) { - - const x = verts[ offset ]; - const y = verts[ offset + 1 ]; - const z = verts[ offset + 2 ]; - - verts[ offset ] = verts[ offset + 3 ]; - verts[ offset + 1 ] = verts[ offset + 4 ]; - verts[ offset + 2 ] = verts[ offset + 5 ]; - - verts[ offset + 3 ] = x; - verts[ offset + 4 ] = y; - verts[ offset + 5 ] = z; - - offset += elemSize * 3; - - } - - } - - // Traverse the object hierarchy collecting geometries and transforming them to world space - - const meshGeometries = {}; - const linesGeometries = {}; - const condLinesGeometries = {}; - - object.updateMatrixWorld( true ); - const normalMatrix = new Matrix3(); - - object.traverse( c => { - - if ( c.isMesh | c.isLineSegments ) { - - const elemSize = c.isMesh ? 3 : 2; - - const geometry = c.geometry.clone(); - const matrixIsInverted = c.matrixWorld.determinant() < 0; - if ( matrixIsInverted ) { - - permuteAttribute( geometry.attributes.position, elemSize ); - permuteAttribute( geometry.attributes.normal, elemSize ); - - } - - geometry.applyMatrix4( c.matrixWorld ); - - if ( c.isConditionalLine ) { - - geometry.attributes.control0.applyMatrix4( c.matrixWorld ); - geometry.attributes.control1.applyMatrix4( c.matrixWorld ); - normalMatrix.getNormalMatrix( c.matrixWorld ); - geometry.attributes.direction.applyNormalMatrix( normalMatrix ); - - } - - const geometries = c.isMesh ? meshGeometries : ( c.isConditionalLine ? condLinesGeometries : linesGeometries ); - - if ( Array.isArray( c.material ) ) { - - for ( const groupIndex in geometry.groups ) { - - const group = geometry.groups[ groupIndex ]; - const mat = c.material[ group.materialIndex ]; - const newGeometry = extractGroup( geometry, group, elemSize, c.isConditionalLine ); - addGeometry( mat, newGeometry, geometries ); - - } - - } else { - - addGeometry( c.material, geometry, geometries ); - - } - - } - - } ); - - // Create object with merged geometries - - const mergedObject = new Group(); - - const meshMaterialsIds = Object.keys( meshGeometries ); - for ( const meshMaterialsId of meshMaterialsIds ) { - - const meshGeometry = meshGeometries[ meshMaterialsId ]; - const mergedGeometry = mergeGeometries( meshGeometry.arr ); - mergedObject.add( new Mesh( mergedGeometry, meshGeometry.mat ) ); - - } - - const linesMaterialsIds = Object.keys( linesGeometries ); - for ( const linesMaterialsId of linesMaterialsIds ) { - - const lineGeometry = linesGeometries[ linesMaterialsId ]; - const mergedGeometry = mergeGeometries( lineGeometry.arr ); - mergedObject.add( new LineSegments( mergedGeometry, lineGeometry.mat ) ); - - } - - const condLinesMaterialsIds = Object.keys( condLinesGeometries ); - for ( const condLinesMaterialsId of condLinesMaterialsIds ) { - - const condLineGeometry = condLinesGeometries[ condLinesMaterialsId ]; - const mergedGeometry = mergeGeometries( condLineGeometry.arr ); - const condLines = new LineSegments( mergedGeometry, condLineGeometry.mat ); - condLines.isConditionalLine = true; - mergedObject.add( condLines ); - - } - - mergedObject.userData.constructionStep = 0; - mergedObject.userData.numConstructionSteps = 1; - - return mergedObject; - - } - -} - -export { LDrawUtils }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LUT3dlLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LUT3dlLoader.js deleted file mode 100644 index 5b83fa4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LUT3dlLoader.js +++ /dev/null @@ -1,168 +0,0 @@ -// http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492 -// https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258 - -import { - ClampToEdgeWrapping, - Data3DTexture, - FileLoader, - FloatType, - LinearFilter, - Loader, - RGBAFormat, - UnsignedByteType, -} from '/static/javascript/three/build/three.module.js'; - -export class LUT3dlLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.type = UnsignedByteType; - - } - - setType( type ) { - - if ( type !== UnsignedByteType && type !== FloatType ) { - - throw new Error( 'LUT3dlLoader: Unsupported type' ); - - } - - this.type = type; - - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'text' ); - loader.load( url, text => { - - try { - - onLoad( this.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - this.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( input ) { - - const regExpGridInfo = /^[\d ]+$/m; - const regExpDataPoints = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm; - - // The first line describes the positions of values on the LUT grid. - let result = regExpGridInfo.exec( input ); - - if ( result === null ) { - - throw new Error( 'LUT3dlLoader: Missing grid information' ); - - } - - const gridLines = result[ 0 ].trim().split( /\s+/g ).map( Number ); - const gridStep = gridLines[ 1 ] - gridLines[ 0 ]; - const size = gridLines.length; - const sizeSq = size ** 2; - - for ( let i = 1, l = gridLines.length; i < l; ++ i ) { - - if ( gridStep !== ( gridLines[ i ] - gridLines[ i - 1 ] ) ) { - - throw new Error( 'LUT3dlLoader: Inconsistent grid size' ); - - } - - } - - const dataFloat = new Float32Array( size ** 3 * 4 ); - let maxValue = 0.0; - let index = 0; - - while ( ( result = regExpDataPoints.exec( input ) ) !== null ) { - - const r = Number( result[ 1 ] ); - const g = Number( result[ 2 ] ); - const b = Number( result[ 3 ] ); - - maxValue = Math.max( maxValue, r, g, b ); - - const bLayer = index % size; - const gLayer = Math.floor( index / size ) % size; - const rLayer = Math.floor( index / ( sizeSq ) ) % size; - - // b grows first, then g, then r. - const d4 = ( bLayer * sizeSq + gLayer * size + rLayer ) * 4; - dataFloat[ d4 + 0 ] = r; - dataFloat[ d4 + 1 ] = g; - dataFloat[ d4 + 2 ] = b; - - ++ index; - - } - - // Determine the bit depth to scale the values to [0.0, 1.0]. - const bits = Math.ceil( Math.log2( maxValue ) ); - const maxBitValue = Math.pow( 2, bits ); - - const data = this.type === UnsignedByteType ? new Uint8Array( dataFloat.length ) : dataFloat; - const scale = this.type === UnsignedByteType ? 255 : 1; - - for ( let i = 0, l = data.length; i < l; i += 4 ) { - - const i1 = i + 1; - const i2 = i + 2; - const i3 = i + 3; - - // Note: data is dataFloat when type is FloatType. - data[ i ] = dataFloat[ i ] / maxBitValue * scale; - data[ i1 ] = dataFloat[ i1 ] / maxBitValue * scale; - data[ i2 ] = dataFloat[ i2 ] / maxBitValue * scale; - data[ i3 ] = scale; - - } - - const texture3D = new Data3DTexture(); - texture3D.image.data = data; - texture3D.image.width = size; - texture3D.image.height = size; - texture3D.image.depth = size; - texture3D.format = RGBAFormat; - texture3D.type = this.type; - texture3D.magFilter = LinearFilter; - texture3D.minFilter = LinearFilter; - texture3D.wrapS = ClampToEdgeWrapping; - texture3D.wrapT = ClampToEdgeWrapping; - texture3D.wrapR = ClampToEdgeWrapping; - texture3D.generateMipmaps = false; - texture3D.needsUpdate = true; - - return { - size, - texture3D, - }; - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTCubeLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LUTCubeLoader.js deleted file mode 100644 index bca0504..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTCubeLoader.js +++ /dev/null @@ -1,153 +0,0 @@ -// https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf - -import { - ClampToEdgeWrapping, - Data3DTexture, - FileLoader, - FloatType, - LinearFilter, - Loader, - UnsignedByteType, - Vector3, -} from '/static/javascript/three/build/three.module.js'; - -export class LUTCubeLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.type = UnsignedByteType; - - } - - setType( type ) { - - if ( type !== UnsignedByteType && type !== FloatType ) { - - throw new Error( 'LUTCubeLoader: Unsupported type' ); - - } - - this.type = type; - - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'text' ); - loader.load( url, text => { - - try { - - onLoad( this.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - this.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( input ) { - - const regExpTitle = /TITLE +"([^"]*)"/; - const regExpSize = /LUT_3D_SIZE +(\d+)/; - const regExpDomainMin = /DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/; - const regExpDomainMax = /DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/; - const regExpDataPoints = /^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm; - - let result = regExpTitle.exec( input ); - const title = ( result !== null ) ? result[ 1 ] : null; - - result = regExpSize.exec( input ); - - if ( result === null ) { - - throw new Error( 'LUTCubeLoader: Missing LUT_3D_SIZE information' ); - - } - - const size = Number( result[ 1 ] ); - const length = size ** 3 * 4; - const data = this.type === UnsignedByteType ? new Uint8Array( length ) : new Float32Array( length ); - - const domainMin = new Vector3( 0, 0, 0 ); - const domainMax = new Vector3( 1, 1, 1 ); - - result = regExpDomainMin.exec( input ); - - if ( result !== null ) { - - domainMin.set( Number( result[ 1 ] ), Number( result[ 2 ] ), Number( result[ 3 ] ) ); - - } - - result = regExpDomainMax.exec( input ); - - if ( result !== null ) { - - domainMax.set( Number( result[ 1 ] ), Number( result[ 2 ] ), Number( result[ 3 ] ) ); - - } - - if ( domainMin.x > domainMax.x || domainMin.y > domainMax.y || domainMin.z > domainMax.z ) { - - throw new Error( 'LUTCubeLoader: Invalid input domain' ); - - } - - const scale = this.type === UnsignedByteType ? 255 : 1; - let i = 0; - - while ( ( result = regExpDataPoints.exec( input ) ) !== null ) { - - data[ i ++ ] = Number( result[ 1 ] ) * scale; - data[ i ++ ] = Number( result[ 2 ] ) * scale; - data[ i ++ ] = Number( result[ 3 ] ) * scale; - data[ i ++ ] = scale; - - } - - const texture3D = new Data3DTexture(); - texture3D.image.data = data; - texture3D.image.width = size; - texture3D.image.height = size; - texture3D.image.depth = size; - texture3D.type = this.type; - texture3D.magFilter = LinearFilter; - texture3D.minFilter = LinearFilter; - texture3D.wrapS = ClampToEdgeWrapping; - texture3D.wrapT = ClampToEdgeWrapping; - texture3D.wrapR = ClampToEdgeWrapping; - texture3D.generateMipmaps = false; - texture3D.needsUpdate = true; - - return { - title, - size, - domainMin, - domainMax, - texture3D, - }; - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTImageLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LUTImageLoader.js deleted file mode 100644 index ec33f0e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTImageLoader.js +++ /dev/null @@ -1,149 +0,0 @@ -import { - Loader, - TextureLoader, - Data3DTexture, - RGBAFormat, - UnsignedByteType, - ClampToEdgeWrapping, - LinearFilter, -} from '/static/javascript/three/build/three.module.js'; - -export class LUTImageLoader extends Loader { - - constructor( flipVertical = false ) { - - //The NeutralLUT.png has green at the bottom for Unreal ang green at the top for Unity URP Color Lookup - //post-processing. If you're using lut image strips from a Unity pipeline then pass true to the constructor - - super(); - - this.flip = flipVertical; - - } - - load( url, onLoad, onProgress, onError ) { - - const loader = new TextureLoader( this.manager ); - - loader.setCrossOrigin( this.crossOrigin ); - - loader.setPath( this.path ); - loader.load( url, texture => { - - try { - - let imageData; - - if ( texture.image.width < texture.image.height ) { - - imageData = this.getImageData( texture ); - - } else { - - imageData = this.horz2Vert( texture ); - - } - - onLoad( this.parse( imageData.data, Math.min( texture.image.width, texture.image.height ) ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - this.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - getImageData( texture ) { - - const width = texture.image.width; - const height = texture.image.height; - - const canvas = document.createElement( 'canvas' ); - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext( '2d' ); - - if ( this.flip === true ) { - - context.scale( 1, - 1 ); - context.translate( 0, - height ); - - } - - context.drawImage( texture.image, 0, 0 ); - - return context.getImageData( 0, 0, width, height ); - - } - - horz2Vert( texture ) { - - const width = texture.image.height; - const height = texture.image.width; - - const canvas = document.createElement( 'canvas' ); - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext( '2d' ); - - if ( this.flip === true ) { - - context.scale( 1, - 1 ); - context.translate( 0, - height ); - - } - - for ( let i = 0; i < width; i ++ ) { - - const sy = i * width; - const dy = ( this.flip ) ? height - i * width : i * width; - context.drawImage( texture.image, sy, 0, width, width, 0, dy, width, width ); - - } - - return context.getImageData( 0, 0, width, height ); - - } - - parse( dataArray, size ) { - - const data = new Uint8Array( dataArray ); - - const texture3D = new Data3DTexture(); - texture3D.image.data = data; - texture3D.image.width = size; - texture3D.image.height = size; - texture3D.image.depth = size; - texture3D.format = RGBAFormat; - texture3D.type = UnsignedByteType; - texture3D.magFilter = LinearFilter; - texture3D.minFilter = LinearFilter; - texture3D.wrapS = ClampToEdgeWrapping; - texture3D.wrapT = ClampToEdgeWrapping; - texture3D.wrapR = ClampToEdgeWrapping; - texture3D.generateMipmaps = false; - texture3D.needsUpdate = true; - - return { - size, - texture3D, - }; - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LUTPass.js deleted file mode 100644 index d3372fd..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LUTPass.js +++ /dev/null @@ -1,108 +0,0 @@ -import { ShaderPass } from './ShaderPass.js'; - -const LUTShader = { - - name: 'LUTShader', - - uniforms: { - - lut: { value: null }, - lutSize: { value: 0 }, - - tDiffuse: { value: null }, - intensity: { value: 1.0 }, - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - - `, - - fragmentShader: /* glsl */` - - uniform float lutSize; - uniform sampler3D lut; - - varying vec2 vUv; - uniform float intensity; - uniform sampler2D tDiffuse; - void main() { - - vec4 val = texture2D( tDiffuse, vUv ); - vec4 lutVal; - - // pull the sample in by half a pixel so the sample begins - // at the center of the edge pixels. - float pixelWidth = 1.0 / lutSize; - float halfPixelWidth = 0.5 / lutSize; - vec3 uvw = vec3( halfPixelWidth ) + val.rgb * ( 1.0 - pixelWidth ); - - - lutVal = vec4( texture( lut, uvw ).rgb, val.a ); - - gl_FragColor = vec4( mix( val, lutVal, intensity ) ); - - } - - `, - -}; - -class LUTPass extends ShaderPass { - - set lut( v ) { - - const material = this.material; - - if ( v !== this.lut ) { - - material.uniforms.lut.value = null; - - if ( v ) { - - material.uniforms.lutSize.value = v.image.width; - material.uniforms.lut.value = v; - - } - - } - - } - - get lut() { - - return this.material.uniforms.lut.value; - - } - - set intensity( v ) { - - this.material.uniforms.intensity.value = v; - - } - - get intensity() { - - return this.material.uniforms.intensity.value; - - } - - constructor( options = {} ) { - - super( LUTShader ); - this.lut = options.lut || null; - this.intensity = 'intensity' in options ? options.intensity : 1; - - } - -} - -export { LUTPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LWOLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LWOLoader.js deleted file mode 100644 index e4583f3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LWOLoader.js +++ /dev/null @@ -1,1052 +0,0 @@ -/** - * @version 1.1.1 - * - * @desc Load files in LWO3 and LWO2 format on Three.js - * - * LWO3 format specification: - * https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html - * - * LWO2 format specification: - * https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html - * - **/ - -import { - AddOperation, - BackSide, - BufferGeometry, - ClampToEdgeWrapping, - Color, - DoubleSide, - EquirectangularReflectionMapping, - EquirectangularRefractionMapping, - FileLoader, - Float32BufferAttribute, - FrontSide, - LineBasicMaterial, - LineSegments, - Loader, - Mesh, - MeshPhongMaterial, - MeshPhysicalMaterial, - MeshStandardMaterial, - MirroredRepeatWrapping, - Points, - PointsMaterial, - RepeatWrapping, - SRGBColorSpace, - TextureLoader, - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -import { IFFParser } from './lwo/IFFParser.js'; - -let _lwoTree; - -class LWOLoader extends Loader { - - constructor( manager, parameters = {} ) { - - super( manager ); - - this.resourcePath = ( parameters.resourcePath !== undefined ) ? parameters.resourcePath : ''; - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const path = ( scope.path === '' ) ? extractParentUrl( url, 'Objects' ) : scope.path; - - // give the mesh a default name based on the filename - const modelName = url.split( path ).pop().split( '.' )[ 0 ]; - - const loader = new FileLoader( this.manager ); - loader.setPath( scope.path ); - loader.setResponseType( 'arraybuffer' ); - - loader.load( url, function ( buffer ) { - - // console.time( 'Total parsing: ' ); - - try { - - onLoad( scope.parse( buffer, path, modelName ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - // console.timeEnd( 'Total parsing: ' ); - - }, onProgress, onError ); - - } - - parse( iffBuffer, path, modelName ) { - - _lwoTree = new IFFParser().parse( iffBuffer ); - - // console.log( 'lwoTree', lwoTree ); - - const textureLoader = new TextureLoader( this.manager ).setPath( this.resourcePath || path ).setCrossOrigin( this.crossOrigin ); - - return new LWOTreeParser( textureLoader ).parse( modelName ); - - } - -} - -// Parse the lwoTree object -class LWOTreeParser { - - constructor( textureLoader ) { - - this.textureLoader = textureLoader; - - } - - parse( modelName ) { - - this.materials = new MaterialParser( this.textureLoader ).parse(); - this.defaultLayerName = modelName; - - this.meshes = this.parseLayers(); - - return { - materials: this.materials, - meshes: this.meshes, - }; - - } - - parseLayers() { - - // array of all meshes for building hierarchy - const meshes = []; - - // final array containing meshes with scene graph hierarchy set up - const finalMeshes = []; - - const geometryParser = new GeometryParser(); - - const scope = this; - _lwoTree.layers.forEach( function ( layer ) { - - const geometry = geometryParser.parse( layer.geometry, layer ); - - const mesh = scope.parseMesh( geometry, layer ); - - meshes[ layer.number ] = mesh; - - if ( layer.parent === - 1 ) finalMeshes.push( mesh ); - else meshes[ layer.parent ].add( mesh ); - - - } ); - - this.applyPivots( finalMeshes ); - - return finalMeshes; - - } - - parseMesh( geometry, layer ) { - - let mesh; - - const materials = this.getMaterials( geometry.userData.matNames, layer.geometry.type ); - - if ( layer.geometry.type === 'points' ) mesh = new Points( geometry, materials ); - else if ( layer.geometry.type === 'lines' ) mesh = new LineSegments( geometry, materials ); - else mesh = new Mesh( geometry, materials ); - - if ( layer.name ) mesh.name = layer.name; - else mesh.name = this.defaultLayerName + '_layer_' + layer.number; - - mesh.userData.pivot = layer.pivot; - - return mesh; - - } - - // TODO: may need to be reversed in z to convert LWO to three.js coordinates - applyPivots( meshes ) { - - meshes.forEach( function ( mesh ) { - - mesh.traverse( function ( child ) { - - const pivot = child.userData.pivot; - - child.position.x += pivot[ 0 ]; - child.position.y += pivot[ 1 ]; - child.position.z += pivot[ 2 ]; - - if ( child.parent ) { - - const parentPivot = child.parent.userData.pivot; - - child.position.x -= parentPivot[ 0 ]; - child.position.y -= parentPivot[ 1 ]; - child.position.z -= parentPivot[ 2 ]; - - } - - } ); - - } ); - - } - - getMaterials( namesArray, type ) { - - const materials = []; - - const scope = this; - - namesArray.forEach( function ( name, i ) { - - materials[ i ] = scope.getMaterialByName( name ); - - } ); - - // convert materials to line or point mats if required - if ( type === 'points' || type === 'lines' ) { - - materials.forEach( function ( mat, i ) { - - const spec = { - color: mat.color, - }; - - if ( type === 'points' ) { - - spec.size = 0.1; - spec.map = mat.map; - materials[ i ] = new PointsMaterial( spec ); - - } else if ( type === 'lines' ) { - - materials[ i ] = new LineBasicMaterial( spec ); - - } - - } ); - - } - - // if there is only one material, return that directly instead of array - const filtered = materials.filter( Boolean ); - if ( filtered.length === 1 ) return filtered[ 0 ]; - - return materials; - - } - - getMaterialByName( name ) { - - return this.materials.filter( function ( m ) { - - return m.name === name; - - } )[ 0 ]; - - } - -} - -class MaterialParser { - - constructor( textureLoader ) { - - this.textureLoader = textureLoader; - - } - - parse() { - - const materials = []; - this.textures = {}; - - for ( const name in _lwoTree.materials ) { - - if ( _lwoTree.format === 'LWO3' ) { - - materials.push( this.parseMaterial( _lwoTree.materials[ name ], name, _lwoTree.textures ) ); - - } else if ( _lwoTree.format === 'LWO2' ) { - - materials.push( this.parseMaterialLwo2( _lwoTree.materials[ name ], name, _lwoTree.textures ) ); - - } - - } - - return materials; - - } - - parseMaterial( materialData, name, textures ) { - - let params = { - name: name, - side: this.getSide( materialData.attributes ), - flatShading: this.getSmooth( materialData.attributes ), - }; - - const connections = this.parseConnections( materialData.connections, materialData.nodes ); - - const maps = this.parseTextureNodes( connections.maps ); - - this.parseAttributeImageMaps( connections.attributes, textures, maps, materialData.maps ); - - const attributes = this.parseAttributes( connections.attributes, maps ); - - this.parseEnvMap( connections, maps, attributes ); - - params = Object.assign( maps, params ); - params = Object.assign( params, attributes ); - - const materialType = this.getMaterialType( connections.attributes ); - - if ( materialType !== MeshPhongMaterial ) delete params.refractionRatio; // PBR materials do not support "refractionRatio" - - return new materialType( params ); - - } - - parseMaterialLwo2( materialData, name/*, textures*/ ) { - - let params = { - name: name, - side: this.getSide( materialData.attributes ), - flatShading: this.getSmooth( materialData.attributes ), - }; - - const attributes = this.parseAttributes( materialData.attributes, {} ); - params = Object.assign( params, attributes ); - return new MeshPhongMaterial( params ); - - } - - // Note: converting from left to right handed coords by switching x -> -x in vertices, and - // then switching mat FrontSide -> BackSide - // NB: this means that FrontSide and BackSide have been switched! - getSide( attributes ) { - - if ( ! attributes.side ) return BackSide; - - switch ( attributes.side ) { - - case 0: - case 1: - return BackSide; - case 2: return FrontSide; - case 3: return DoubleSide; - - } - - } - - getSmooth( attributes ) { - - if ( ! attributes.smooth ) return true; - return ! attributes.smooth; - - } - - parseConnections( connections, nodes ) { - - const materialConnections = { - maps: {} - }; - - const inputName = connections.inputName; - const inputNodeName = connections.inputNodeName; - const nodeName = connections.nodeName; - - const scope = this; - inputName.forEach( function ( name, index ) { - - if ( name === 'Material' ) { - - const matNode = scope.getNodeByRefName( inputNodeName[ index ], nodes ); - materialConnections.attributes = matNode.attributes; - materialConnections.envMap = matNode.fileName; - materialConnections.name = inputNodeName[ index ]; - - } - - } ); - - nodeName.forEach( function ( name, index ) { - - if ( name === materialConnections.name ) { - - materialConnections.maps[ inputName[ index ] ] = scope.getNodeByRefName( inputNodeName[ index ], nodes ); - - } - - } ); - - return materialConnections; - - } - - getNodeByRefName( refName, nodes ) { - - for ( const name in nodes ) { - - if ( nodes[ name ].refName === refName ) return nodes[ name ]; - - } - - } - - parseTextureNodes( textureNodes ) { - - const maps = {}; - - for ( const name in textureNodes ) { - - const node = textureNodes[ name ]; - const path = node.fileName; - - if ( ! path ) return; - - const texture = this.loadTexture( path ); - - if ( node.widthWrappingMode !== undefined ) texture.wrapS = this.getWrappingType( node.widthWrappingMode ); - if ( node.heightWrappingMode !== undefined ) texture.wrapT = this.getWrappingType( node.heightWrappingMode ); - - switch ( name ) { - - case 'Color': - maps.map = texture; - maps.map.colorSpace = SRGBColorSpace; - break; - case 'Roughness': - maps.roughnessMap = texture; - maps.roughness = 1; - break; - case 'Specular': - maps.specularMap = texture; - maps.specularMap.colorSpace = SRGBColorSpace; - maps.specular = 0xffffff; - break; - case 'Luminous': - maps.emissiveMap = texture; - maps.emissiveMap.colorSpace = SRGBColorSpace; - maps.emissive = 0x808080; - break; - case 'Luminous Color': - maps.emissive = 0x808080; - break; - case 'Metallic': - maps.metalnessMap = texture; - maps.metalness = 1; - break; - case 'Transparency': - case 'Alpha': - maps.alphaMap = texture; - maps.transparent = true; - break; - case 'Normal': - maps.normalMap = texture; - if ( node.amplitude !== undefined ) maps.normalScale = new Vector2( node.amplitude, node.amplitude ); - break; - case 'Bump': - maps.bumpMap = texture; - break; - - } - - } - - // LWO BSDF materials can have both spec and rough, but this is not valid in three - if ( maps.roughnessMap && maps.specularMap ) delete maps.specularMap; - - return maps; - - } - - // maps can also be defined on individual material attributes, parse those here - // This occurs on Standard (Phong) surfaces - parseAttributeImageMaps( attributes, textures, maps ) { - - for ( const name in attributes ) { - - const attribute = attributes[ name ]; - - if ( attribute.maps ) { - - const mapData = attribute.maps[ 0 ]; - - const path = this.getTexturePathByIndex( mapData.imageIndex, textures ); - if ( ! path ) return; - - const texture = this.loadTexture( path ); - - if ( mapData.wrap !== undefined ) texture.wrapS = this.getWrappingType( mapData.wrap.w ); - if ( mapData.wrap !== undefined ) texture.wrapT = this.getWrappingType( mapData.wrap.h ); - - switch ( name ) { - - case 'Color': - maps.map = texture; - maps.map.colorSpace = SRGBColorSpace; - break; - case 'Diffuse': - maps.aoMap = texture; - break; - case 'Roughness': - maps.roughnessMap = texture; - maps.roughness = 1; - break; - case 'Specular': - maps.specularMap = texture; - maps.specularMap.colorSpace = SRGBColorSpace; - maps.specular = 0xffffff; - break; - case 'Luminosity': - maps.emissiveMap = texture; - maps.emissiveMap.colorSpace = SRGBColorSpace; - maps.emissive = 0x808080; - break; - case 'Metallic': - maps.metalnessMap = texture; - maps.metalness = 1; - break; - case 'Transparency': - case 'Alpha': - maps.alphaMap = texture; - maps.transparent = true; - break; - case 'Normal': - maps.normalMap = texture; - break; - case 'Bump': - maps.bumpMap = texture; - break; - - } - - } - - } - - } - - parseAttributes( attributes, maps ) { - - const params = {}; - - // don't use color data if color map is present - if ( attributes.Color && ! maps.map ) { - - params.color = new Color().fromArray( attributes.Color.value ); - - } else { - - params.color = new Color(); - - } - - - if ( attributes.Transparency && attributes.Transparency.value !== 0 ) { - - params.opacity = 1 - attributes.Transparency.value; - params.transparent = true; - - } - - if ( attributes[ 'Bump Height' ] ) params.bumpScale = attributes[ 'Bump Height' ].value * 0.1; - - this.parsePhysicalAttributes( params, attributes, maps ); - this.parseStandardAttributes( params, attributes, maps ); - this.parsePhongAttributes( params, attributes, maps ); - - return params; - - } - - parsePhysicalAttributes( params, attributes/*, maps*/ ) { - - if ( attributes.Clearcoat && attributes.Clearcoat.value > 0 ) { - - params.clearcoat = attributes.Clearcoat.value; - - if ( attributes[ 'Clearcoat Gloss' ] ) { - - params.clearcoatRoughness = 0.5 * ( 1 - attributes[ 'Clearcoat Gloss' ].value ); - - } - - } - - } - - parseStandardAttributes( params, attributes, maps ) { - - - if ( attributes.Luminous ) { - - params.emissiveIntensity = attributes.Luminous.value; - - if ( attributes[ 'Luminous Color' ] && ! maps.emissive ) { - - params.emissive = new Color().fromArray( attributes[ 'Luminous Color' ].value ); - - } else { - - params.emissive = new Color( 0x808080 ); - - } - - } - - if ( attributes.Roughness && ! maps.roughnessMap ) params.roughness = attributes.Roughness.value; - if ( attributes.Metallic && ! maps.metalnessMap ) params.metalness = attributes.Metallic.value; - - } - - parsePhongAttributes( params, attributes, maps ) { - - if ( attributes[ 'Refraction Index' ] ) params.refractionRatio = 0.98 / attributes[ 'Refraction Index' ].value; - - if ( attributes.Diffuse ) params.color.multiplyScalar( attributes.Diffuse.value ); - - if ( attributes.Reflection ) { - - params.reflectivity = attributes.Reflection.value; - params.combine = AddOperation; - - } - - if ( attributes.Luminosity ) { - - params.emissiveIntensity = attributes.Luminosity.value; - - if ( ! maps.emissiveMap && ! maps.map ) { - - params.emissive = params.color; - - } else { - - params.emissive = new Color( 0x808080 ); - - } - - } - - // parse specular if there is no roughness - we will interpret the material as 'Phong' in this case - if ( ! attributes.Roughness && attributes.Specular && ! maps.specularMap ) { - - if ( attributes[ 'Color Highlight' ] ) { - - params.specular = new Color().setScalar( attributes.Specular.value ).lerp( params.color.clone().multiplyScalar( attributes.Specular.value ), attributes[ 'Color Highlight' ].value ); - - } else { - - params.specular = new Color().setScalar( attributes.Specular.value ); - - } - - } - - if ( params.specular && attributes.Glossiness ) params.shininess = 7 + Math.pow( 2, attributes.Glossiness.value * 12 + 2 ); - - } - - parseEnvMap( connections, maps, attributes ) { - - if ( connections.envMap ) { - - const envMap = this.loadTexture( connections.envMap ); - - if ( attributes.transparent && attributes.opacity < 0.999 ) { - - envMap.mapping = EquirectangularRefractionMapping; - - // Reflectivity and refraction mapping don't work well together in Phong materials - if ( attributes.reflectivity !== undefined ) { - - delete attributes.reflectivity; - delete attributes.combine; - - } - - if ( attributes.metalness !== undefined ) { - - attributes.metalness = 1; // For most transparent materials metalness should be set to 1 if not otherwise defined. If set to 0 no refraction will be visible - - } - - attributes.opacity = 1; // transparency fades out refraction, forcing opacity to 1 ensures a closer visual match to the material in Lightwave. - - } else envMap.mapping = EquirectangularReflectionMapping; - - maps.envMap = envMap; - - } - - } - - // get texture defined at top level by its index - getTexturePathByIndex( index ) { - - let fileName = ''; - - if ( ! _lwoTree.textures ) return fileName; - - _lwoTree.textures.forEach( function ( texture ) { - - if ( texture.index === index ) fileName = texture.fileName; - - } ); - - return fileName; - - } - - loadTexture( path ) { - - if ( ! path ) return null; - - const texture = this.textureLoader.load( - path, - undefined, - undefined, - function () { - - console.warn( 'LWOLoader: non-standard resource hierarchy. Use \`resourcePath\` parameter to specify root content directory.' ); - - } - ); - - return texture; - - } - - // 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge - getWrappingType( num ) { - - switch ( num ) { - - case 0: - console.warn( 'LWOLoader: "Reset" texture wrapping type is not supported in three.js' ); - return ClampToEdgeWrapping; - case 1: return RepeatWrapping; - case 2: return MirroredRepeatWrapping; - case 3: return ClampToEdgeWrapping; - - } - - } - - getMaterialType( nodeData ) { - - if ( nodeData.Clearcoat && nodeData.Clearcoat.value > 0 ) return MeshPhysicalMaterial; - if ( nodeData.Roughness ) return MeshStandardMaterial; - return MeshPhongMaterial; - - } - -} - -class GeometryParser { - - parse( geoData, layer ) { - - const geometry = new BufferGeometry(); - - geometry.setAttribute( 'position', new Float32BufferAttribute( geoData.points, 3 ) ); - - const indices = this.splitIndices( geoData.vertexIndices, geoData.polygonDimensions ); - geometry.setIndex( indices ); - - this.parseGroups( geometry, geoData ); - - geometry.computeVertexNormals(); - - this.parseUVs( geometry, layer, indices ); - this.parseMorphTargets( geometry, layer, indices ); - - // TODO: z may need to be reversed to account for coordinate system change - geometry.translate( - layer.pivot[ 0 ], - layer.pivot[ 1 ], - layer.pivot[ 2 ] ); - - // let userData = geometry.userData; - // geometry = geometry.toNonIndexed() - // geometry.userData = userData; - - return geometry; - - } - - // split quads into tris - splitIndices( indices, polygonDimensions ) { - - const remappedIndices = []; - - let i = 0; - polygonDimensions.forEach( function ( dim ) { - - if ( dim < 4 ) { - - for ( let k = 0; k < dim; k ++ ) remappedIndices.push( indices[ i + k ] ); - - } else if ( dim === 4 ) { - - remappedIndices.push( - indices[ i ], - indices[ i + 1 ], - indices[ i + 2 ], - - indices[ i ], - indices[ i + 2 ], - indices[ i + 3 ] - - ); - - } else if ( dim > 4 ) { - - for ( let k = 1; k < dim - 1; k ++ ) { - - remappedIndices.push( indices[ i ], indices[ i + k ], indices[ i + k + 1 ] ); - - } - - console.warn( 'LWOLoader: polygons with greater than 4 sides are not supported' ); - - } - - i += dim; - - } ); - - return remappedIndices; - - } - - // NOTE: currently ignoring poly indices and assuming that they are intelligently ordered - parseGroups( geometry, geoData ) { - - const tags = _lwoTree.tags; - const matNames = []; - - let elemSize = 3; - if ( geoData.type === 'lines' ) elemSize = 2; - if ( geoData.type === 'points' ) elemSize = 1; - - const remappedIndices = this.splitMaterialIndices( geoData.polygonDimensions, geoData.materialIndices ); - - let indexNum = 0; // create new indices in numerical order - const indexPairs = {}; // original indices mapped to numerical indices - - let prevMaterialIndex; - let materialIndex; - - let prevStart = 0; - let currentCount = 0; - - for ( let i = 0; i < remappedIndices.length; i += 2 ) { - - materialIndex = remappedIndices[ i + 1 ]; - - if ( i === 0 ) matNames[ indexNum ] = tags[ materialIndex ]; - - if ( prevMaterialIndex === undefined ) prevMaterialIndex = materialIndex; - - if ( materialIndex !== prevMaterialIndex ) { - - let currentIndex; - if ( indexPairs[ tags[ prevMaterialIndex ] ] ) { - - currentIndex = indexPairs[ tags[ prevMaterialIndex ] ]; - - } else { - - currentIndex = indexNum; - indexPairs[ tags[ prevMaterialIndex ] ] = indexNum; - matNames[ indexNum ] = tags[ prevMaterialIndex ]; - indexNum ++; - - } - - geometry.addGroup( prevStart, currentCount, currentIndex ); - - prevStart += currentCount; - - prevMaterialIndex = materialIndex; - currentCount = 0; - - } - - currentCount += elemSize; - - } - - // the loop above doesn't add the last group, do that here. - if ( geometry.groups.length > 0 ) { - - let currentIndex; - if ( indexPairs[ tags[ materialIndex ] ] ) { - - currentIndex = indexPairs[ tags[ materialIndex ] ]; - - } else { - - currentIndex = indexNum; - indexPairs[ tags[ materialIndex ] ] = indexNum; - matNames[ indexNum ] = tags[ materialIndex ]; - - } - - geometry.addGroup( prevStart, currentCount, currentIndex ); - - } - - // Mat names from TAGS chunk, used to build up an array of materials for this geometry - geometry.userData.matNames = matNames; - - } - - splitMaterialIndices( polygonDimensions, indices ) { - - const remappedIndices = []; - - polygonDimensions.forEach( function ( dim, i ) { - - if ( dim <= 3 ) { - - remappedIndices.push( indices[ i * 2 ], indices[ i * 2 + 1 ] ); - - } else if ( dim === 4 ) { - - remappedIndices.push( indices[ i * 2 ], indices[ i * 2 + 1 ], indices[ i * 2 ], indices[ i * 2 + 1 ] ); - - } else { - - // ignore > 4 for now - for ( let k = 0; k < dim - 2; k ++ ) { - - remappedIndices.push( indices[ i * 2 ], indices[ i * 2 + 1 ] ); - - } - - } - - } ); - - return remappedIndices; - - } - - // UV maps: - // 1: are defined via index into an array of points, not into a geometry - // - the geometry is also defined by an index into this array, but the indexes may not match - // 2: there can be any number of UV maps for a single geometry. Here these are combined, - // with preference given to the first map encountered - // 3: UV maps can be partial - that is, defined for only a part of the geometry - // 4: UV maps can be VMAP or VMAD (discontinuous, to allow for seams). In practice, most - // UV maps are defined as partially VMAP and partially VMAD - // VMADs are currently not supported - parseUVs( geometry, layer ) { - - // start by creating a UV map set to zero for the whole geometry - const remappedUVs = Array.from( Array( geometry.attributes.position.count * 2 ), function () { - - return 0; - - } ); - - for ( const name in layer.uvs ) { - - const uvs = layer.uvs[ name ].uvs; - const uvIndices = layer.uvs[ name ].uvIndices; - - uvIndices.forEach( function ( i, j ) { - - remappedUVs[ i * 2 ] = uvs[ j * 2 ]; - remappedUVs[ i * 2 + 1 ] = uvs[ j * 2 + 1 ]; - - } ); - - } - - geometry.setAttribute( 'uv', new Float32BufferAttribute( remappedUVs, 2 ) ); - - } - - parseMorphTargets( geometry, layer ) { - - let num = 0; - for ( const name in layer.morphTargets ) { - - const remappedPoints = geometry.attributes.position.array.slice(); - - if ( ! geometry.morphAttributes.position ) geometry.morphAttributes.position = []; - - const morphPoints = layer.morphTargets[ name ].points; - const morphIndices = layer.morphTargets[ name ].indices; - const type = layer.morphTargets[ name ].type; - - morphIndices.forEach( function ( i, j ) { - - if ( type === 'relative' ) { - - remappedPoints[ i * 3 ] += morphPoints[ j * 3 ]; - remappedPoints[ i * 3 + 1 ] += morphPoints[ j * 3 + 1 ]; - remappedPoints[ i * 3 + 2 ] += morphPoints[ j * 3 + 2 ]; - - } else { - - remappedPoints[ i * 3 ] = morphPoints[ j * 3 ]; - remappedPoints[ i * 3 + 1 ] = morphPoints[ j * 3 + 1 ]; - remappedPoints[ i * 3 + 2 ] = morphPoints[ j * 3 + 2 ]; - - } - - } ); - - geometry.morphAttributes.position[ num ] = new Float32BufferAttribute( remappedPoints, 3 ); - geometry.morphAttributes.position[ num ].name = name; - - num ++; - - } - - geometry.morphTargetsRelative = false; - - } - -} - - -// ************** UTILITY FUNCTIONS ************** - -function extractParentUrl( url, dir ) { - - const index = url.indexOf( dir ); - - if ( index === - 1 ) return './'; - - return url.slice( 0, index ); - -} - -export { LWOLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LogLuvLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LogLuvLoader.js deleted file mode 100644 index e6036e4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LogLuvLoader.js +++ /dev/null @@ -1,606 +0,0 @@ -import { - DataUtils, - DataTextureLoader, - FloatType, - HalfFloatType, - RGBAFormat -} from '/static/javascript/three/build/three.module.js'; - -class LogLuvLoader extends DataTextureLoader { - - constructor( manager ) { - - super( manager ); - - this.type = HalfFloatType; - - } - - parse( buffer ) { - - const ifds = UTIF.decode( buffer ); - UTIF.decodeImage( buffer, ifds[ 0 ] ); - const rgba = UTIF.toRGBA( ifds[ 0 ], this.type ); - - return { - width: ifds[ 0 ].width, - height: ifds[ 0 ].height, - data: rgba, - format: RGBAFormat, - type: this.type, - flipY: true - }; - - } - - setDataType( value ) { - - this.type = value; - return this; - - } - -} - -// from https://github.com/photopea/UTIF.js (MIT License) - -const UTIF = {}; - -UTIF.decode = function ( buff, prm ) { - - if ( prm == null ) prm = { parseMN: true, debug: false }; // read MakerNote, debug - var data = new Uint8Array( buff ), offset = 0; - - var id = UTIF._binBE.readASCII( data, offset, 2 ); offset += 2; - var bin = id == 'II' ? UTIF._binLE : UTIF._binBE; - bin.readUshort( data, offset ); offset += 2; - - var ifdo = bin.readUint( data, offset ); - var ifds = []; - while ( true ) { - - var cnt = bin.readUshort( data, ifdo ), typ = bin.readUshort( data, ifdo + 4 ); if ( cnt != 0 ) if ( typ < 1 || 13 < typ ) { - - console.log( 'error in TIFF' ); break; - - } - - - UTIF._readIFD( bin, data, ifdo, ifds, 0, prm ); - - ifdo = bin.readUint( data, ifdo + 2 + cnt * 12 ); - if ( ifdo == 0 ) break; - - } - - return ifds; - -}; - -UTIF.decodeImage = function ( buff, img, ifds ) { - - if ( img.data ) return; - var data = new Uint8Array( buff ); - var id = UTIF._binBE.readASCII( data, 0, 2 ); - - if ( img[ 't256' ] == null ) return; // No width => probably not an image - img.isLE = id == 'II'; - img.width = img[ 't256' ][ 0 ]; //delete img["t256"]; - img.height = img[ 't257' ][ 0 ]; //delete img["t257"]; - - var cmpr = img[ 't259' ] ? img[ 't259' ][ 0 ] : 1; //delete img["t259"]; - var fo = img[ 't266' ] ? img[ 't266' ][ 0 ] : 1; //delete img["t266"]; - if ( img[ 't284' ] && img[ 't284' ][ 0 ] == 2 ) console.log( 'PlanarConfiguration 2 should not be used!' ); - if ( cmpr == 7 && img[ 't258' ] && img[ 't258' ].length > 3 ) img[ 't258' ] = img[ 't258' ].slice( 0, 3 ); - - var bipp; // bits per pixel - if ( img[ 't258' ] ) bipp = Math.min( 32, img[ 't258' ][ 0 ] ) * img[ 't258' ].length; - else bipp = ( img[ 't277' ] ? img[ 't277' ][ 0 ] : 1 ); - // Some .NEF files have t258==14, even though they use 16 bits per pixel - if ( cmpr == 1 && img[ 't279' ] != null && img[ 't278' ] && img[ 't262' ][ 0 ] == 32803 ) { - - bipp = Math.round( ( img[ 't279' ][ 0 ] * 8 ) / ( img.width * img[ 't278' ][ 0 ] ) ); - - } - - var bipl = Math.ceil( img.width * bipp / 8 ) * 8; - var soff = img[ 't273' ]; if ( soff == null ) soff = img[ 't324' ]; - var bcnt = img[ 't279' ]; if ( cmpr == 1 && soff.length == 1 ) bcnt = [ img.height * ( bipl >>> 3 ) ]; if ( bcnt == null ) bcnt = img[ 't325' ]; - //bcnt[0] = Math.min(bcnt[0], data.length); // Hasselblad, "RAW_HASSELBLAD_H3D39II.3FR" - var bytes = new Uint8Array( img.height * ( bipl >>> 3 ) ), bilen = 0; - - if ( img[ 't322' ] != null ) { - - var tw = img[ 't322' ][ 0 ], th = img[ 't323' ][ 0 ]; - var tx = Math.floor( ( img.width + tw - 1 ) / tw ); - var ty = Math.floor( ( img.height + th - 1 ) / th ); - var tbuff = new Uint8Array( Math.ceil( tw * th * bipp / 8 ) | 0 ); - for ( var y = 0; y < ty; y ++ ) - for ( var x = 0; x < tx; x ++ ) { - - var i = y * tx + x; for ( var j = 0; j < tbuff.length; j ++ ) tbuff[ j ] = 0; - UTIF.decode._decompress( img, ifds, data, soff[ i ], bcnt[ i ], cmpr, tbuff, 0, fo ); - // Might be required for 7 too. Need to check - if ( cmpr == 6 ) bytes = tbuff; - else UTIF._copyTile( tbuff, Math.ceil( tw * bipp / 8 ) | 0, th, bytes, Math.ceil( img.width * bipp / 8 ) | 0, img.height, Math.ceil( x * tw * bipp / 8 ) | 0, y * th ); - - } - - bilen = bytes.length * 8; - - } else { - - var rps = img[ 't278' ] ? img[ 't278' ][ 0 ] : img.height; rps = Math.min( rps, img.height ); - for ( var i = 0; i < soff.length; i ++ ) { - - UTIF.decode._decompress( img, ifds, data, soff[ i ], bcnt[ i ], cmpr, bytes, Math.ceil( bilen / 8 ) | 0, fo ); - bilen += bipl * rps; - - } - - bilen = Math.min( bilen, bytes.length * 8 ); - - } - - img.data = new Uint8Array( bytes.buffer, 0, Math.ceil( bilen / 8 ) | 0 ); - -}; - -UTIF.decode._decompress = function ( img, ifds, data, off, len, cmpr, tgt, toff ) { - - //console.log("compression", cmpr); - //var time = Date.now(); - if ( cmpr == 34676 ) UTIF.decode._decodeLogLuv32( img, data, off, len, tgt, toff ); - else console.log( 'Unsupported compression', cmpr ); - - //console.log(Date.now()-time); - - var bps = ( img[ 't258' ] ? Math.min( 32, img[ 't258' ][ 0 ] ) : 1 ); - var noc = ( img[ 't277' ] ? img[ 't277' ][ 0 ] : 1 ), bpp = ( bps * noc ) >>> 3, h = ( img[ 't278' ] ? img[ 't278' ][ 0 ] : img.height ), bpl = Math.ceil( bps * noc * img.width / 8 ); - - // convert to Little Endian /* - if ( bps == 16 && ! img.isLE && img[ 't33422' ] == null ) // not DNG - for ( var y = 0; y < h; y ++ ) { - - //console.log("fixing endianity"); - var roff = toff + y * bpl; - for ( var x = 1; x < bpl; x += 2 ) { - - var t = tgt[ roff + x ]; tgt[ roff + x ] = tgt[ roff + x - 1 ]; tgt[ roff + x - 1 ] = t; - - } - - } //*/ - - if ( img[ 't317' ] && img[ 't317' ][ 0 ] == 2 ) { - - for ( var y = 0; y < h; y ++ ) { - - var ntoff = toff + y * bpl; - if ( bps == 16 ) for ( var j = bpp; j < bpl; j += 2 ) { - - var nv = ( ( tgt[ ntoff + j + 1 ] << 8 ) | tgt[ ntoff + j ] ) + ( ( tgt[ ntoff + j - bpp + 1 ] << 8 ) | tgt[ ntoff + j - bpp ] ); - tgt[ ntoff + j ] = nv & 255; tgt[ ntoff + j + 1 ] = ( nv >>> 8 ) & 255; - - } - else if ( noc == 3 ) for ( var j = 3; j < bpl; j += 3 ) { - - tgt[ ntoff + j ] = ( tgt[ ntoff + j ] + tgt[ ntoff + j - 3 ] ) & 255; - tgt[ ntoff + j + 1 ] = ( tgt[ ntoff + j + 1 ] + tgt[ ntoff + j - 2 ] ) & 255; - tgt[ ntoff + j + 2 ] = ( tgt[ ntoff + j + 2 ] + tgt[ ntoff + j - 1 ] ) & 255; - - } - else for ( var j = bpp; j < bpl; j ++ ) tgt[ ntoff + j ] = ( tgt[ ntoff + j ] + tgt[ ntoff + j - bpp ] ) & 255; - - } - - } - -}; - -UTIF.decode._decodeLogLuv32 = function ( img, data, off, len, tgt, toff ) { - - var w = img.width, qw = w * 4; - var io = 0, out = new Uint8Array( qw ); - - while ( io < len ) { - - var oo = 0; - while ( oo < qw ) { - - var c = data[ off + io ]; io ++; - if ( c < 128 ) { - - for ( var j = 0; j < c; j ++ ) out[ oo + j ] = data[ off + io + j ]; oo += c; io += c; - - } else { - - c = c - 126; for ( var j = 0; j < c; j ++ ) out[ oo + j ] = data[ off + io ]; oo += c; io ++; - - } - - } - - for ( var x = 0; x < w; x ++ ) { - - tgt[ toff + 0 ] = out[ x ]; - tgt[ toff + 1 ] = out[ x + w ]; - tgt[ toff + 2 ] = out[ x + w * 2 ]; - tgt[ toff + 4 ] = out[ x + w * 3 ]; - toff += 6; - - } - - } - -}; - -UTIF.tags = {}; -//UTIF.ttypes = { 256:3,257:3,258:3, 259:3, 262:3, 273:4, 274:3, 277:3,278:4,279:4, 282:5, 283:5, 284:3, 286:5,287:5, 296:3, 305:2, 306:2, 338:3, 513:4, 514:4, 34665:4 }; -// start at tag 250 -UTIF._types = function () { - - var main = new Array( 250 ); main.fill( 0 ); - main = main.concat( [ 0, 0, 0, 0, 4, 3, 3, 3, 3, 3, 0, 0, 3, 0, 0, 0, 3, 0, 0, 2, 2, 2, 2, 4, 3, 0, 0, 3, 4, 4, 3, 3, 5, 5, 3, 2, 5, 5, 0, 0, 0, 0, 4, 4, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 3, 5, 5, 3, 0, 3, 3, 4, 4, 4, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] ); - var rest = { 33432: 2, 33434: 5, 33437: 5, 34665: 4, 34850: 3, 34853: 4, 34855: 3, 34864: 3, 34866: 4, 36864: 7, 36867: 2, 36868: 2, 37121: 7, 37377: 10, 37378: 5, 37380: 10, 37381: 5, 37383: 3, 37384: 3, 37385: 3, 37386: 5, 37510: 7, 37520: 2, 37521: 2, 37522: 2, 40960: 7, 40961: 3, 40962: 4, 40963: 4, 40965: 4, 41486: 5, 41487: 5, 41488: 3, 41985: 3, 41986: 3, 41987: 3, 41988: 5, 41989: 3, 41990: 3, 41993: 3, 41994: 3, 41995: 7, 41996: 3, 42032: 2, 42033: 2, 42034: 5, 42036: 2, 42037: 2, 59932: 7 }; - return { - basic: { - main: main, - rest: rest - }, - gps: { - main: [ 1, 2, 5, 2, 5, 1, 5, 5, 0, 9 ], - rest: { 18: 2, 29: 2 } - } - }; - -}(); - -UTIF._readIFD = function ( bin, data, offset, ifds, depth, prm ) { - - var cnt = bin.readUshort( data, offset ); offset += 2; - var ifd = {}; - - if ( prm.debug ) console.log( ' '.repeat( depth ), ifds.length - 1, '>>>----------------' ); - for ( var i = 0; i < cnt; i ++ ) { - - var tag = bin.readUshort( data, offset ); offset += 2; - var type = bin.readUshort( data, offset ); offset += 2; - var num = bin.readUint( data, offset ); offset += 4; - var voff = bin.readUint( data, offset ); offset += 4; - - var arr = []; - //ifd["t"+tag+"-"+UTIF.tags[tag]] = arr; - if ( type == 1 || type == 7 ) { - - arr = new Uint8Array( data.buffer, ( num < 5 ? offset - 4 : voff ), num ); - - } - - if ( type == 2 ) { - - var o0 = ( num < 5 ? offset - 4 : voff ), c = data[ o0 ], len = Math.max( 0, Math.min( num - 1, data.length - o0 ) ); - if ( c < 128 || len == 0 ) arr.push( bin.readASCII( data, o0, len ) ); - else arr = new Uint8Array( data.buffer, o0, len ); - - } - - if ( type == 3 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readUshort( data, ( num < 3 ? offset - 4 : voff ) + 2 * j ) ); - - } - - if ( type == 4 - || type == 13 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readUint( data, ( num < 2 ? offset - 4 : voff ) + 4 * j ) ); - - } - - if ( type == 5 || type == 10 ) { - - var ri = type == 5 ? bin.readUint : bin.readInt; - for ( var j = 0; j < num; j ++ ) arr.push( [ ri( data, voff + j * 8 ), ri( data, voff + j * 8 + 4 ) ] ); - - } - - if ( type == 8 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readShort( data, ( num < 3 ? offset - 4 : voff ) + 2 * j ) ); - - } - - if ( type == 9 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readInt( data, ( num < 2 ? offset - 4 : voff ) + 4 * j ) ); - - } - - if ( type == 11 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readFloat( data, voff + j * 4 ) ); - - } - - if ( type == 12 ) { - - for ( var j = 0; j < num; j ++ ) arr.push( bin.readDouble( data, voff + j * 8 ) ); - - } - - if ( num != 0 && arr.length == 0 ) { - - console.log( tag, 'unknown TIFF tag type: ', type, 'num:', num ); if ( i == 0 ) return; continue; - - } - - if ( prm.debug ) console.log( ' '.repeat( depth ), tag, type, UTIF.tags[ tag ], arr ); - - ifd[ 't' + tag ] = arr; - - if ( tag == 330 || tag == 34665 || tag == 34853 || ( tag == 50740 && bin.readUshort( data, bin.readUint( arr, 0 ) ) < 300 ) || tag == 61440 ) { - - var oarr = tag == 50740 ? [ bin.readUint( arr, 0 ) ] : arr; - var subfd = []; - for ( var j = 0; j < oarr.length; j ++ ) UTIF._readIFD( bin, data, oarr[ j ], subfd, depth + 1, prm ); - if ( tag == 330 ) ifd.subIFD = subfd; - if ( tag == 34665 ) ifd.exifIFD = subfd[ 0 ]; - if ( tag == 34853 ) ifd.gpsiIFD = subfd[ 0 ]; //console.log("gps", subfd[0]); } - if ( tag == 50740 ) ifd.dngPrvt = subfd[ 0 ]; - if ( tag == 61440 ) ifd.fujiIFD = subfd[ 0 ]; - - } - - if ( tag == 37500 && prm.parseMN ) { - - var mn = arr; - //console.log(bin.readASCII(mn,0,mn.length), mn); - if ( bin.readASCII( mn, 0, 5 ) == 'Nikon' ) ifd.makerNote = UTIF[ 'decode' ]( mn.slice( 10 ).buffer )[ 0 ]; - else if ( bin.readUshort( data, voff ) < 300 && bin.readUshort( data, voff + 4 ) <= 12 ) { - - var subsub = []; UTIF._readIFD( bin, data, voff, subsub, depth + 1, prm ); - ifd.makerNote = subsub[ 0 ]; - - } - - } - - } - - ifds.push( ifd ); - if ( prm.debug ) console.log( ' '.repeat( depth ), '<<<---------------' ); - return offset; - -}; - -UTIF.toRGBA = function ( out, type ) { - - const w = out.width, h = out.height, area = w * h, data = out.data; - - let img; - - switch ( type ) { - - case HalfFloatType: - - img = new Uint16Array( area * 4 ); - break; - - case FloatType: - - img = new Float32Array( area * 4 ); - break; - - default: - throw new Error( 'THREE.LogLuvLoader: Unsupported texture data type: ' + type ); - - } - - let intp = out[ 't262' ] ? out[ 't262' ][ 0 ] : 2; - const bps = out[ 't258' ] ? Math.min( 32, out[ 't258' ][ 0 ] ) : 1; - - if ( out[ 't262' ] == null && bps == 1 ) intp = 0; - - if ( intp == 32845 ) { - - for ( let y = 0; y < h; y ++ ) { - - for ( let x = 0; x < w; x ++ ) { - - const si = ( y * w + x ) * 6, qi = ( y * w + x ) * 4; - let L = ( data[ si + 1 ] << 8 ) | data[ si ]; - - L = Math.pow( 2, ( L + 0.5 ) / 256 - 64 ); - const u = ( data[ si + 3 ] + 0.5 ) / 410; - const v = ( data[ si + 5 ] + 0.5 ) / 410; - - // Luv to xyY - const sX = ( 9 * u ) / ( 6 * u - 16 * v + 12 ); - const sY = ( 4 * v ) / ( 6 * u - 16 * v + 12 ); - const bY = L; - - // xyY to XYZ - const X = ( sX * bY ) / sY, Y = bY, Z = ( 1 - sX - sY ) * bY / sY; - - // XYZ to linear RGB - const r = 2.690 * X - 1.276 * Y - 0.414 * Z; - const g = - 1.022 * X + 1.978 * Y + 0.044 * Z; - const b = 0.061 * X - 0.224 * Y + 1.163 * Z; - - if ( type === HalfFloatType ) { - - img[ qi ] = DataUtils.toHalfFloat( Math.min( r, 65504 ) ); - img[ qi + 1 ] = DataUtils.toHalfFloat( Math.min( g, 65504 ) ); - img[ qi + 2 ] = DataUtils.toHalfFloat( Math.min( b, 65504 ) ); - img[ qi + 3 ] = DataUtils.toHalfFloat( 1 ); - - - } else { - - img[ qi ] = r; - img[ qi + 1 ] = g; - img[ qi + 2 ] = b; - img[ qi + 3 ] = 1; - - } - - } - - } - - } else { - - throw new Error( 'THREE.LogLuvLoader: Unsupported Photometric interpretation: ' + intp ); - - } - - return img; - -}; - -UTIF._binBE = -{ - nextZero: function ( data, o ) { - - while ( data[ o ] != 0 ) o ++; return o; - - }, - readUshort: function ( buff, p ) { - - return ( buff[ p ] << 8 ) | buff[ p + 1 ]; - - }, - readShort: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 1 ]; a[ 1 ] = buff[ p + 0 ]; return UTIF._binBE.i16[ 0 ]; - - }, - readInt: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 3 ]; a[ 1 ] = buff[ p + 2 ]; a[ 2 ] = buff[ p + 1 ]; a[ 3 ] = buff[ p + 0 ]; return UTIF._binBE.i32[ 0 ]; - - }, - readUint: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 3 ]; a[ 1 ] = buff[ p + 2 ]; a[ 2 ] = buff[ p + 1 ]; a[ 3 ] = buff[ p + 0 ]; return UTIF._binBE.ui32[ 0 ]; - - }, - readASCII: function ( buff, p, l ) { - - var s = ''; for ( var i = 0; i < l; i ++ ) s += String.fromCharCode( buff[ p + i ] ); return s; - - }, - readFloat: function ( buff, p ) { - - var a = UTIF._binBE.ui8; for ( var i = 0; i < 4; i ++ ) a[ i ] = buff[ p + 3 - i ]; return UTIF._binBE.fl32[ 0 ]; - - }, - readDouble: function ( buff, p ) { - - var a = UTIF._binBE.ui8; for ( var i = 0; i < 8; i ++ ) a[ i ] = buff[ p + 7 - i ]; return UTIF._binBE.fl64[ 0 ]; - - }, - - writeUshort: function ( buff, p, n ) { - - buff[ p ] = ( n >> 8 ) & 255; buff[ p + 1 ] = n & 255; - - }, - writeInt: function ( buff, p, n ) { - - var a = UTIF._binBE.ui8; UTIF._binBE.i32[ 0 ] = n; buff[ p + 3 ] = a[ 0 ]; buff[ p + 2 ] = a[ 1 ]; buff[ p + 1 ] = a[ 2 ]; buff[ p + 0 ] = a[ 3 ]; - - }, - writeUint: function ( buff, p, n ) { - - buff[ p ] = ( n >> 24 ) & 255; buff[ p + 1 ] = ( n >> 16 ) & 255; buff[ p + 2 ] = ( n >> 8 ) & 255; buff[ p + 3 ] = ( n >> 0 ) & 255; - - }, - writeASCII: function ( buff, p, s ) { - - for ( var i = 0; i < s.length; i ++ ) buff[ p + i ] = s.charCodeAt( i ); - - }, - writeDouble: function ( buff, p, n ) { - - UTIF._binBE.fl64[ 0 ] = n; - for ( var i = 0; i < 8; i ++ ) buff[ p + i ] = UTIF._binBE.ui8[ 7 - i ]; - - } -}; -UTIF._binBE.ui8 = new Uint8Array( 8 ); -UTIF._binBE.i16 = new Int16Array( UTIF._binBE.ui8.buffer ); -UTIF._binBE.i32 = new Int32Array( UTIF._binBE.ui8.buffer ); -UTIF._binBE.ui32 = new Uint32Array( UTIF._binBE.ui8.buffer ); -UTIF._binBE.fl32 = new Float32Array( UTIF._binBE.ui8.buffer ); -UTIF._binBE.fl64 = new Float64Array( UTIF._binBE.ui8.buffer ); - -UTIF._binLE = -{ - nextZero: UTIF._binBE.nextZero, - readUshort: function ( buff, p ) { - - return ( buff[ p + 1 ] << 8 ) | buff[ p ]; - - }, - readShort: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 0 ]; a[ 1 ] = buff[ p + 1 ]; return UTIF._binBE.i16[ 0 ]; - - }, - readInt: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 0 ]; a[ 1 ] = buff[ p + 1 ]; a[ 2 ] = buff[ p + 2 ]; a[ 3 ] = buff[ p + 3 ]; return UTIF._binBE.i32[ 0 ]; - - }, - readUint: function ( buff, p ) { - - var a = UTIF._binBE.ui8; a[ 0 ] = buff[ p + 0 ]; a[ 1 ] = buff[ p + 1 ]; a[ 2 ] = buff[ p + 2 ]; a[ 3 ] = buff[ p + 3 ]; return UTIF._binBE.ui32[ 0 ]; - - }, - readASCII: UTIF._binBE.readASCII, - readFloat: function ( buff, p ) { - - var a = UTIF._binBE.ui8; for ( var i = 0; i < 4; i ++ ) a[ i ] = buff[ p + i ]; return UTIF._binBE.fl32[ 0 ]; - - }, - readDouble: function ( buff, p ) { - - var a = UTIF._binBE.ui8; for ( var i = 0; i < 8; i ++ ) a[ i ] = buff[ p + i ]; return UTIF._binBE.fl64[ 0 ]; - - }, - - writeUshort: function ( buff, p, n ) { - - buff[ p ] = ( n ) & 255; buff[ p + 1 ] = ( n >> 8 ) & 255; - - }, - writeInt: function ( buff, p, n ) { - - var a = UTIF._binBE.ui8; UTIF._binBE.i32[ 0 ] = n; buff[ p + 0 ] = a[ 0 ]; buff[ p + 1 ] = a[ 1 ]; buff[ p + 2 ] = a[ 2 ]; buff[ p + 3 ] = a[ 3 ]; - - }, - writeUint: function ( buff, p, n ) { - - buff[ p ] = ( n >>> 0 ) & 255; buff[ p + 1 ] = ( n >>> 8 ) & 255; buff[ p + 2 ] = ( n >>> 16 ) & 255; buff[ p + 3 ] = ( n >>> 24 ) & 255; - - }, - writeASCII: UTIF._binBE.writeASCII -}; -UTIF._copyTile = function ( tb, tw, th, b, w, h, xoff, yoff ) { - - //log("copyTile", tw, th, w, h, xoff, yoff); - var xlim = Math.min( tw, w - xoff ); - var ylim = Math.min( th, h - yoff ); - for ( var y = 0; y < ylim; y ++ ) { - - var tof = ( yoff + y ) * w + xoff; - var sof = y * tw; - for ( var x = 0; x < xlim; x ++ ) b[ tof + x ] = tb[ sof + x ]; - - } - -}; - -export { LogLuvLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LottieLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LottieLoader.js deleted file mode 100644 index bd05fb1..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LottieLoader.js +++ /dev/null @@ -1,77 +0,0 @@ -import { - FileLoader, - Loader, - CanvasTexture, - NearestFilter, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; - -import lottie from '../libs/lottie_canvas.module.js'; - -class LottieLoader extends Loader { - - setQuality( value ) { - - this._quality = value; - - } - - load( url, onLoad, onProgress, onError ) { - - const quality = this._quality || 1; - - const texture = new CanvasTexture(); - texture.minFilter = NearestFilter; - texture.colorSpace = SRGBColorSpace; - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setWithCredentials( this.withCredentials ); - - loader.load( url, function ( text ) { - - const data = JSON.parse( text ); - - // lottie uses container.offetWidth and offsetHeight - // to define width/height - - const container = document.createElement( 'div' ); - container.style.width = data.w + 'px'; - container.style.height = data.h + 'px'; - document.body.appendChild( container ); - - const animation = lottie.loadAnimation( { - container: container, - animType: 'canvas', - loop: true, - autoplay: true, - animationData: data, - rendererSettings: { dpr: quality } - } ); - - texture.animation = animation; - texture.image = animation.container; - - animation.addEventListener( 'enterFrame', function () { - - texture.needsUpdate = true; - - } ); - - container.style.display = 'none'; - - if ( onLoad !== undefined ) { - - onLoad( texture ); - - } - - }, onProgress, onError ); - - return texture; - - } - -} - -export { LottieLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityHighPassShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityHighPassShader.js deleted file mode 100644 index 5d462ce..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityHighPassShader.js +++ /dev/null @@ -1,64 +0,0 @@ -import { - Color -} from '/static/javascript/three/build/three.module.js'; - -/** - * Luminosity - * http://en.wikipedia.org/wiki/Luminosity - */ - -const LuminosityHighPassShader = { - - name: 'LuminosityHighPassShader', - - shaderID: 'luminosityHighPass', - - uniforms: { - - 'tDiffuse': { value: null }, - 'luminosityThreshold': { value: 1.0 }, - 'smoothWidth': { value: 1.0 }, - 'defaultColor': { value: new Color( 0x000000 ) }, - 'defaultOpacity': { value: 0.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform vec3 defaultColor; - uniform float defaultOpacity; - uniform float luminosityThreshold; - uniform float smoothWidth; - - varying vec2 vUv; - - void main() { - - vec4 texel = texture2D( tDiffuse, vUv ); - - float v = luminance( texel.xyz ); - - vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity ); - - float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v ); - - gl_FragColor = mix( outputColor, texel, alpha ); - - }` - -}; - -export { LuminosityHighPassShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityShader.js deleted file mode 100644 index 4472980..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/LuminosityShader.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Luminosity - * http://en.wikipedia.org/wiki/Luminosity - */ - -const LuminosityShader = { - - name: 'LuminosityShader', - - uniforms: { - - 'tDiffuse': { value: null } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #include - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - - void main() { - - vec4 texel = texture2D( tDiffuse, vUv ); - - float l = luminance( texel.rgb ); - - gl_FragColor = vec4( l, l, l, texel.w ); - - }` - -}; - -export { LuminosityShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MD2Loader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MD2Loader.js deleted file mode 100644 index e962274..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MD2Loader.js +++ /dev/null @@ -1,399 +0,0 @@ -import { - AnimationClip, - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Loader, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _normalData = [ - [ - 0.525731, 0.000000, 0.850651 ], [ - 0.442863, 0.238856, 0.864188 ], - [ - 0.295242, 0.000000, 0.955423 ], [ - 0.309017, 0.500000, 0.809017 ], - [ - 0.162460, 0.262866, 0.951056 ], [ 0.000000, 0.000000, 1.000000 ], - [ 0.000000, 0.850651, 0.525731 ], [ - 0.147621, 0.716567, 0.681718 ], - [ 0.147621, 0.716567, 0.681718 ], [ 0.000000, 0.525731, 0.850651 ], - [ 0.309017, 0.500000, 0.809017 ], [ 0.525731, 0.000000, 0.850651 ], - [ 0.295242, 0.000000, 0.955423 ], [ 0.442863, 0.238856, 0.864188 ], - [ 0.162460, 0.262866, 0.951056 ], [ - 0.681718, 0.147621, 0.716567 ], - [ - 0.809017, 0.309017, 0.500000 ], [ - 0.587785, 0.425325, 0.688191 ], - [ - 0.850651, 0.525731, 0.000000 ], [ - 0.864188, 0.442863, 0.238856 ], - [ - 0.716567, 0.681718, 0.147621 ], [ - 0.688191, 0.587785, 0.425325 ], - [ - 0.500000, 0.809017, 0.309017 ], [ - 0.238856, 0.864188, 0.442863 ], - [ - 0.425325, 0.688191, 0.587785 ], [ - 0.716567, 0.681718, - 0.147621 ], - [ - 0.500000, 0.809017, - 0.309017 ], [ - 0.525731, 0.850651, 0.000000 ], - [ 0.000000, 0.850651, - 0.525731 ], [ - 0.238856, 0.864188, - 0.442863 ], - [ 0.000000, 0.955423, - 0.295242 ], [ - 0.262866, 0.951056, - 0.162460 ], - [ 0.000000, 1.000000, 0.000000 ], [ 0.000000, 0.955423, 0.295242 ], - [ - 0.262866, 0.951056, 0.162460 ], [ 0.238856, 0.864188, 0.442863 ], - [ 0.262866, 0.951056, 0.162460 ], [ 0.500000, 0.809017, 0.309017 ], - [ 0.238856, 0.864188, - 0.442863 ], [ 0.262866, 0.951056, - 0.162460 ], - [ 0.500000, 0.809017, - 0.309017 ], [ 0.850651, 0.525731, 0.000000 ], - [ 0.716567, 0.681718, 0.147621 ], [ 0.716567, 0.681718, - 0.147621 ], - [ 0.525731, 0.850651, 0.000000 ], [ 0.425325, 0.688191, 0.587785 ], - [ 0.864188, 0.442863, 0.238856 ], [ 0.688191, 0.587785, 0.425325 ], - [ 0.809017, 0.309017, 0.500000 ], [ 0.681718, 0.147621, 0.716567 ], - [ 0.587785, 0.425325, 0.688191 ], [ 0.955423, 0.295242, 0.000000 ], - [ 1.000000, 0.000000, 0.000000 ], [ 0.951056, 0.162460, 0.262866 ], - [ 0.850651, - 0.525731, 0.000000 ], [ 0.955423, - 0.295242, 0.000000 ], - [ 0.864188, - 0.442863, 0.238856 ], [ 0.951056, - 0.162460, 0.262866 ], - [ 0.809017, - 0.309017, 0.500000 ], [ 0.681718, - 0.147621, 0.716567 ], - [ 0.850651, 0.000000, 0.525731 ], [ 0.864188, 0.442863, - 0.238856 ], - [ 0.809017, 0.309017, - 0.500000 ], [ 0.951056, 0.162460, - 0.262866 ], - [ 0.525731, 0.000000, - 0.850651 ], [ 0.681718, 0.147621, - 0.716567 ], - [ 0.681718, - 0.147621, - 0.716567 ], [ 0.850651, 0.000000, - 0.525731 ], - [ 0.809017, - 0.309017, - 0.500000 ], [ 0.864188, - 0.442863, - 0.238856 ], - [ 0.951056, - 0.162460, - 0.262866 ], [ 0.147621, 0.716567, - 0.681718 ], - [ 0.309017, 0.500000, - 0.809017 ], [ 0.425325, 0.688191, - 0.587785 ], - [ 0.442863, 0.238856, - 0.864188 ], [ 0.587785, 0.425325, - 0.688191 ], - [ 0.688191, 0.587785, - 0.425325 ], [ - 0.147621, 0.716567, - 0.681718 ], - [ - 0.309017, 0.500000, - 0.809017 ], [ 0.000000, 0.525731, - 0.850651 ], - [ - 0.525731, 0.000000, - 0.850651 ], [ - 0.442863, 0.238856, - 0.864188 ], - [ - 0.295242, 0.000000, - 0.955423 ], [ - 0.162460, 0.262866, - 0.951056 ], - [ 0.000000, 0.000000, - 1.000000 ], [ 0.295242, 0.000000, - 0.955423 ], - [ 0.162460, 0.262866, - 0.951056 ], [ - 0.442863, - 0.238856, - 0.864188 ], - [ - 0.309017, - 0.500000, - 0.809017 ], [ - 0.162460, - 0.262866, - 0.951056 ], - [ 0.000000, - 0.850651, - 0.525731 ], [ - 0.147621, - 0.716567, - 0.681718 ], - [ 0.147621, - 0.716567, - 0.681718 ], [ 0.000000, - 0.525731, - 0.850651 ], - [ 0.309017, - 0.500000, - 0.809017 ], [ 0.442863, - 0.238856, - 0.864188 ], - [ 0.162460, - 0.262866, - 0.951056 ], [ 0.238856, - 0.864188, - 0.442863 ], - [ 0.500000, - 0.809017, - 0.309017 ], [ 0.425325, - 0.688191, - 0.587785 ], - [ 0.716567, - 0.681718, - 0.147621 ], [ 0.688191, - 0.587785, - 0.425325 ], - [ 0.587785, - 0.425325, - 0.688191 ], [ 0.000000, - 0.955423, - 0.295242 ], - [ 0.000000, - 1.000000, 0.000000 ], [ 0.262866, - 0.951056, - 0.162460 ], - [ 0.000000, - 0.850651, 0.525731 ], [ 0.000000, - 0.955423, 0.295242 ], - [ 0.238856, - 0.864188, 0.442863 ], [ 0.262866, - 0.951056, 0.162460 ], - [ 0.500000, - 0.809017, 0.309017 ], [ 0.716567, - 0.681718, 0.147621 ], - [ 0.525731, - 0.850651, 0.000000 ], [ - 0.238856, - 0.864188, - 0.442863 ], - [ - 0.500000, - 0.809017, - 0.309017 ], [ - 0.262866, - 0.951056, - 0.162460 ], - [ - 0.850651, - 0.525731, 0.000000 ], [ - 0.716567, - 0.681718, - 0.147621 ], - [ - 0.716567, - 0.681718, 0.147621 ], [ - 0.525731, - 0.850651, 0.000000 ], - [ - 0.500000, - 0.809017, 0.309017 ], [ - 0.238856, - 0.864188, 0.442863 ], - [ - 0.262866, - 0.951056, 0.162460 ], [ - 0.864188, - 0.442863, 0.238856 ], - [ - 0.809017, - 0.309017, 0.500000 ], [ - 0.688191, - 0.587785, 0.425325 ], - [ - 0.681718, - 0.147621, 0.716567 ], [ - 0.442863, - 0.238856, 0.864188 ], - [ - 0.587785, - 0.425325, 0.688191 ], [ - 0.309017, - 0.500000, 0.809017 ], - [ - 0.147621, - 0.716567, 0.681718 ], [ - 0.425325, - 0.688191, 0.587785 ], - [ - 0.162460, - 0.262866, 0.951056 ], [ 0.442863, - 0.238856, 0.864188 ], - [ 0.162460, - 0.262866, 0.951056 ], [ 0.309017, - 0.500000, 0.809017 ], - [ 0.147621, - 0.716567, 0.681718 ], [ 0.000000, - 0.525731, 0.850651 ], - [ 0.425325, - 0.688191, 0.587785 ], [ 0.587785, - 0.425325, 0.688191 ], - [ 0.688191, - 0.587785, 0.425325 ], [ - 0.955423, 0.295242, 0.000000 ], - [ - 0.951056, 0.162460, 0.262866 ], [ - 1.000000, 0.000000, 0.000000 ], - [ - 0.850651, 0.000000, 0.525731 ], [ - 0.955423, - 0.295242, 0.000000 ], - [ - 0.951056, - 0.162460, 0.262866 ], [ - 0.864188, 0.442863, - 0.238856 ], - [ - 0.951056, 0.162460, - 0.262866 ], [ - 0.809017, 0.309017, - 0.500000 ], - [ - 0.864188, - 0.442863, - 0.238856 ], [ - 0.951056, - 0.162460, - 0.262866 ], - [ - 0.809017, - 0.309017, - 0.500000 ], [ - 0.681718, 0.147621, - 0.716567 ], - [ - 0.681718, - 0.147621, - 0.716567 ], [ - 0.850651, 0.000000, - 0.525731 ], - [ - 0.688191, 0.587785, - 0.425325 ], [ - 0.587785, 0.425325, - 0.688191 ], - [ - 0.425325, 0.688191, - 0.587785 ], [ - 0.425325, - 0.688191, - 0.587785 ], - [ - 0.587785, - 0.425325, - 0.688191 ], [ - 0.688191, - 0.587785, - 0.425325 ] -]; - -class MD2Loader 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.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( buffer ) { - - try { - - onLoad( scope.parse( buffer ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( buffer ) { - - const data = new DataView( buffer ); - - // http://tfc.duke.free.fr/coding/md2-specs-en.html - - const header = {}; - const headerNames = [ - 'ident', 'version', - 'skinwidth', 'skinheight', - 'framesize', - 'num_skins', 'num_vertices', 'num_st', 'num_tris', 'num_glcmds', 'num_frames', - 'offset_skins', 'offset_st', 'offset_tris', 'offset_frames', 'offset_glcmds', 'offset_end' - ]; - - for ( let i = 0; i < headerNames.length; i ++ ) { - - header[ headerNames[ i ] ] = data.getInt32( i * 4, true ); - - } - - if ( header.ident !== 844121161 || header.version !== 8 ) { - - console.error( 'Not a valid MD2 file' ); - return; - - } - - if ( header.offset_end !== data.byteLength ) { - - console.error( 'Corrupted MD2 file' ); - return; - - } - - // - - const geometry = new BufferGeometry(); - - // uvs - - const uvsTemp = []; - let offset = header.offset_st; - - for ( let i = 0, l = header.num_st; i < l; i ++ ) { - - const u = data.getInt16( offset + 0, true ); - const v = data.getInt16( offset + 2, true ); - - uvsTemp.push( u / header.skinwidth, 1 - ( v / header.skinheight ) ); - - offset += 4; - - } - - // triangles - - offset = header.offset_tris; - - const vertexIndices = []; - const uvIndices = []; - - for ( let i = 0, l = header.num_tris; i < l; i ++ ) { - - vertexIndices.push( - data.getUint16( offset + 0, true ), - data.getUint16( offset + 2, true ), - data.getUint16( offset + 4, true ) - ); - - uvIndices.push( - data.getUint16( offset + 6, true ), - data.getUint16( offset + 8, true ), - data.getUint16( offset + 10, true ) - ); - - offset += 12; - - } - - // frames - - const translation = new Vector3(); - const scale = new Vector3(); - - const frames = []; - - offset = header.offset_frames; - - for ( let i = 0, l = header.num_frames; i < l; i ++ ) { - - scale.set( - data.getFloat32( offset + 0, true ), - data.getFloat32( offset + 4, true ), - data.getFloat32( offset + 8, true ) - ); - - translation.set( - data.getFloat32( offset + 12, true ), - data.getFloat32( offset + 16, true ), - data.getFloat32( offset + 20, true ) - ); - - offset += 24; - - const string = []; - - for ( let j = 0; j < 16; j ++ ) { - - const character = data.getUint8( offset + j ); - if ( character === 0 ) break; - - string[ j ] = character; - - } - - const frame = { - name: String.fromCharCode.apply( null, string ), - vertices: [], - normals: [] - }; - - offset += 16; - - for ( let j = 0; j < header.num_vertices; j ++ ) { - - let x = data.getUint8( offset ++ ); - let y = data.getUint8( offset ++ ); - let z = data.getUint8( offset ++ ); - const n = _normalData[ data.getUint8( offset ++ ) ]; - - x = x * scale.x + translation.x; - y = y * scale.y + translation.y; - z = z * scale.z + translation.z; - - frame.vertices.push( x, z, y ); // convert to Y-up - frame.normals.push( n[ 0 ], n[ 2 ], n[ 1 ] ); // convert to Y-up - - } - - frames.push( frame ); - - } - - // static - - const positions = []; - const normals = []; - const uvs = []; - - const verticesTemp = frames[ 0 ].vertices; - const normalsTemp = frames[ 0 ].normals; - - for ( let i = 0, l = vertexIndices.length; i < l; i ++ ) { - - const vertexIndex = vertexIndices[ i ]; - let stride = vertexIndex * 3; - - // - - const x = verticesTemp[ stride ]; - const y = verticesTemp[ stride + 1 ]; - const z = verticesTemp[ stride + 2 ]; - - positions.push( x, y, z ); - - // - - const nx = normalsTemp[ stride ]; - const ny = normalsTemp[ stride + 1 ]; - const nz = normalsTemp[ stride + 2 ]; - - normals.push( nx, ny, nz ); - - // - - const uvIndex = uvIndices[ i ]; - stride = uvIndex * 2; - - const u = uvsTemp[ stride ]; - const v = uvsTemp[ stride + 1 ]; - - uvs.push( u, v ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - // animation - - const morphPositions = []; - const morphNormals = []; - - for ( let i = 0, l = frames.length; i < l; i ++ ) { - - const frame = frames[ i ]; - const attributeName = frame.name; - - if ( frame.vertices.length > 0 ) { - - const positions = []; - - for ( let j = 0, jl = vertexIndices.length; j < jl; j ++ ) { - - const vertexIndex = vertexIndices[ j ]; - const stride = vertexIndex * 3; - - const x = frame.vertices[ stride ]; - const y = frame.vertices[ stride + 1 ]; - const z = frame.vertices[ stride + 2 ]; - - positions.push( x, y, z ); - - } - - const positionAttribute = new Float32BufferAttribute( positions, 3 ); - positionAttribute.name = attributeName; - - morphPositions.push( positionAttribute ); - - } - - if ( frame.normals.length > 0 ) { - - const normals = []; - - for ( let j = 0, jl = vertexIndices.length; j < jl; j ++ ) { - - const vertexIndex = vertexIndices[ j ]; - const stride = vertexIndex * 3; - - const nx = frame.normals[ stride ]; - const ny = frame.normals[ stride + 1 ]; - const nz = frame.normals[ stride + 2 ]; - - normals.push( nx, ny, nz ); - - } - - const normalAttribute = new Float32BufferAttribute( normals, 3 ); - normalAttribute.name = attributeName; - - morphNormals.push( normalAttribute ); - - } - - } - - geometry.morphAttributes.position = morphPositions; - geometry.morphAttributes.normal = morphNormals; - geometry.morphTargetsRelative = false; - - geometry.animations = AnimationClip.CreateClipsFromMorphTargetSequences( frames, 10 ); - - return geometry; - - } - -} - -export { MD2Loader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MDDLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MDDLoader.js deleted file mode 100644 index 1595ee9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MDDLoader.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * MDD is a special format that stores a position for every vertex in a model for every frame in an animation. - * Similar to BVH, it can be used to transfer animation data between different 3D applications or engines. - * - * MDD stores its data in binary format (big endian) in the following way: - * - * number of frames (a single uint32) - * number of vertices (a single uint32) - * time values for each frame (sequence of float32) - * vertex data for each frame (sequence of float32) - */ - -import { - AnimationClip, - BufferAttribute, - FileLoader, - Loader, - NumberKeyframeTrack -} from '/static/javascript/three/build/three.module.js'; - -class MDDLoader 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.setResponseType( 'arraybuffer' ); - loader.load( url, function ( data ) { - - onLoad( scope.parse( data ) ); - - }, onProgress, onError ); - - } - - parse( data ) { - - const view = new DataView( data ); - - const totalFrames = view.getUint32( 0 ); - const totalPoints = view.getUint32( 4 ); - - let offset = 8; - - // animation clip - - const times = new Float32Array( totalFrames ); - const values = new Float32Array( totalFrames * totalFrames ).fill( 0 ); - - for ( let i = 0; i < totalFrames; i ++ ) { - - times[ i ] = view.getFloat32( offset ); offset += 4; - values[ ( totalFrames * i ) + i ] = 1; - - } - - const track = new NumberKeyframeTrack( '.morphTargetInfluences', times, values ); - const clip = new AnimationClip( 'default', times[ times.length - 1 ], [ track ] ); - - // morph targets - - const morphTargets = []; - - for ( let i = 0; i < totalFrames; i ++ ) { - - const morphTarget = new Float32Array( totalPoints * 3 ); - - for ( let j = 0; j < totalPoints; j ++ ) { - - const stride = ( j * 3 ); - - morphTarget[ stride + 0 ] = view.getFloat32( offset ); offset += 4; // x - morphTarget[ stride + 1 ] = view.getFloat32( offset ); offset += 4; // y - morphTarget[ stride + 2 ] = view.getFloat32( offset ); offset += 4; // z - - } - - const attribute = new BufferAttribute( morphTarget, 3 ); - attribute.name = 'morph_' + i; - - morphTargets.push( attribute ); - - } - - return { - morphTargets: morphTargets, - clip: clip - }; - - } - -} - -export { MDDLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MMDLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MMDLoader.js deleted file mode 100644 index 26141f9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MMDLoader.js +++ /dev/null @@ -1,2295 +0,0 @@ -import { - AddOperation, - AnimationClip, - Bone, - BufferGeometry, - Color, - CustomBlending, - TangentSpaceNormalMap, - DoubleSide, - DstAlphaFactor, - Euler, - FileLoader, - Float32BufferAttribute, - FrontSide, - Interpolant, - Loader, - LoaderUtils, - UniformsUtils, - ShaderMaterial, - MultiplyOperation, - NearestFilter, - NumberKeyframeTrack, - OneMinusSrcAlphaFactor, - Quaternion, - QuaternionKeyframeTrack, - RepeatWrapping, - Skeleton, - SkinnedMesh, - SrcAlphaFactor, - SRGBColorSpace, - TextureLoader, - Uint16BufferAttribute, - Vector3, - VectorKeyframeTrack, - RGB_S3TC_DXT1_Format, - RGB_PVRTC_4BPPV1_Format, - RGB_PVRTC_2BPPV1_Format, - RGB_ETC1_Format, - RGB_ETC2_Format -} from '/static/javascript/three/build/three.module.js'; -import { MMDToonShader } from'/static/javascript/three/examples/jsm/shaders/MMDToonShader.js'; -import { TGALoader } from '../loaders/TGALoader.js'; -import { MMDParser } from '../libs/mmdparser.module.js'; - -/** - * Dependencies - * - mmd-parser https://github.com/takahirox/mmd-parser - * - TGALoader - * - OutlineEffect - * - * MMDLoader creates Three.js Objects from MMD resources as - * PMD, PMX, VMD, and VPD files. - * - * PMD/PMX is a model data format, VMD is a motion data format - * VPD is a posing data format used in MMD(Miku Miku Dance). - * - * MMD official site - * - https://sites.google.com/view/evpvp/ - * - * PMD, VMD format (in Japanese) - * - http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4 - * - * PMX format - * - https://gist.github.com/felixjones/f8a06bd48f9da9a4539f - * - * TODO - * - light motion in vmd support. - * - SDEF support. - * - uv/material/bone morphing support. - * - more precise grant skinning support. - * - shadow support. - */ - -/** - * @param {THREE.LoadingManager} manager - */ -class MMDLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.loader = new FileLoader( this.manager ); - - this.parser = null; // lazy generation - this.meshBuilder = new MeshBuilder( this.manager ); - this.animationBuilder = new AnimationBuilder(); - - } - - /** - * @param {string} animationPath - * @return {MMDLoader} - */ - setAnimationPath( animationPath ) { - - this.animationPath = animationPath; - return this; - - } - - // Load MMD assets as Three.js Object - - /** - * Loads Model file (.pmd or .pmx) as a SkinnedMesh. - * - * @param {string} url - url to Model(.pmd or .pmx) file - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - load( url, onLoad, onProgress, onError ) { - - const builder = this.meshBuilder.setCrossOrigin( this.crossOrigin ); - - // resource path - - let resourcePath; - - if ( this.resourcePath !== '' ) { - - resourcePath = this.resourcePath; - - } else if ( this.path !== '' ) { - - resourcePath = this.path; - - } else { - - resourcePath = LoaderUtils.extractUrlBase( url ); - - } - - const parser = this._getParser(); - const extractModelExtension = this._extractModelExtension; - - this.loader - .setMimeType( undefined ) - .setPath( this.path ) - .setResponseType( 'arraybuffer' ) - .setRequestHeader( this.requestHeader ) - .setWithCredentials( this.withCredentials ) - .load( url, function ( buffer ) { - - try { - - const modelExtension = extractModelExtension( buffer ); - - if ( modelExtension !== 'pmd' && modelExtension !== 'pmx' ) { - - if ( onError ) onError( new Error( 'THREE.MMDLoader: Unknown model file extension .' + modelExtension + '.' ) ); - - return; - - } - - const data = modelExtension === 'pmd' ? parser.parsePmd( buffer, true ) : parser.parsePmx( buffer, true ); - - onLoad( builder.build( data, resourcePath, onProgress, onError ) ); - - } catch ( e ) { - - if ( onError ) onError( e ); - - } - - }, onProgress, onError ); - - } - - /** - * Loads Motion file(s) (.vmd) as a AnimationClip. - * If two or more files are specified, they'll be merged. - * - * @param {string|Array} url - url(s) to animation(.vmd) file(s) - * @param {SkinnedMesh|THREE.Camera} object - tracks will be fitting to this object - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadAnimation( url, object, onLoad, onProgress, onError ) { - - const builder = this.animationBuilder; - - this.loadVMD( url, function ( vmd ) { - - onLoad( object.isCamera - ? builder.buildCameraAnimation( vmd ) - : builder.build( vmd, object ) ); - - }, onProgress, onError ); - - } - - /** - * Loads mode file and motion file(s) as an object containing - * a SkinnedMesh and a AnimationClip. - * Tracks of AnimationClip are fitting to the model. - * - * @param {string} modelUrl - url to Model(.pmd or .pmx) file - * @param {string|Array{string}} vmdUrl - url(s) to animation(.vmd) file - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadWithAnimation( modelUrl, vmdUrl, onLoad, onProgress, onError ) { - - const scope = this; - - this.load( modelUrl, function ( mesh ) { - - scope.loadAnimation( vmdUrl, mesh, function ( animation ) { - - onLoad( { - mesh: mesh, - animation: animation - } ); - - }, onProgress, onError ); - - }, onProgress, onError ); - - } - - // Load MMD assets as Object data parsed by MMDParser - - /** - * Loads .pmd file as an Object. - * - * @param {string} url - url to .pmd file - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadPMD( url, onLoad, onProgress, onError ) { - - const parser = this._getParser(); - - this.loader - .setMimeType( undefined ) - .setPath( this.path ) - .setResponseType( 'arraybuffer' ) - .setRequestHeader( this.requestHeader ) - .setWithCredentials( this.withCredentials ) - .load( url, function ( buffer ) { - - try { - - onLoad( parser.parsePmd( buffer, true ) ); - - } catch ( e ) { - - if ( onError ) onError( e ); - - } - - }, onProgress, onError ); - - } - - /** - * Loads .pmx file as an Object. - * - * @param {string} url - url to .pmx file - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadPMX( url, onLoad, onProgress, onError ) { - - const parser = this._getParser(); - - this.loader - .setMimeType( undefined ) - .setPath( this.path ) - .setResponseType( 'arraybuffer' ) - .setRequestHeader( this.requestHeader ) - .setWithCredentials( this.withCredentials ) - .load( url, function ( buffer ) { - - try { - - onLoad( parser.parsePmx( buffer, true ) ); - - } catch ( e ) { - - if ( onError ) onError( e ); - - } - - }, onProgress, onError ); - - } - - /** - * Loads .vmd file as an Object. If two or more files are specified - * they'll be merged. - * - * @param {string|Array} url - url(s) to .vmd file(s) - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadVMD( url, onLoad, onProgress, onError ) { - - const urls = Array.isArray( url ) ? url : [ url ]; - - const vmds = []; - const vmdNum = urls.length; - - const parser = this._getParser(); - - this.loader - .setMimeType( undefined ) - .setPath( this.animationPath ) - .setResponseType( 'arraybuffer' ) - .setRequestHeader( this.requestHeader ) - .setWithCredentials( this.withCredentials ); - - for ( let i = 0, il = urls.length; i < il; i ++ ) { - - this.loader.load( urls[ i ], function ( buffer ) { - - try { - - vmds.push( parser.parseVmd( buffer, true ) ); - - if ( vmds.length === vmdNum ) onLoad( parser.mergeVmds( vmds ) ); - - } catch ( e ) { - - if ( onError ) onError( e ); - - } - - }, onProgress, onError ); - - } - - } - - /** - * Loads .vpd file as an Object. - * - * @param {string} url - url to .vpd file - * @param {boolean} isUnicode - * @param {function} onLoad - * @param {function} onProgress - * @param {function} onError - */ - loadVPD( url, isUnicode, onLoad, onProgress, onError ) { - - const parser = this._getParser(); - - this.loader - .setMimeType( isUnicode ? undefined : 'text/plain; charset=shift_jis' ) - .setPath( this.animationPath ) - .setResponseType( 'text' ) - .setRequestHeader( this.requestHeader ) - .setWithCredentials( this.withCredentials ) - .load( url, function ( text ) { - - try { - - onLoad( parser.parseVpd( text, true ) ); - - } catch ( e ) { - - if ( onError ) onError( e ); - - } - - }, onProgress, onError ); - - } - - // private methods - - _extractModelExtension( buffer ) { - - const decoder = new TextDecoder( 'utf-8' ); - const bytes = new Uint8Array( buffer, 0, 3 ); - return decoder.decode( bytes ).toLowerCase(); - - } - - _getParser() { - - if ( this.parser === null ) { - - this.parser = new MMDParser.Parser(); - - } - - return this.parser; - - } - -} - -// Utilities - -/* - * base64 encoded defalut toon textures toon00.bmp - toon10.bmp. - * We don't need to request external toon image files. - */ -const DEFAULT_TOON_TEXTURES = [ - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAN0lEQVRYR+3WQREAMBACsZ5/bWiiMvgEBTt5cW37hjsBBAgQIECAwFwgyfYPCCBAgAABAgTWAh8aBHZBl14e8wAAAABJRU5ErkJggg==', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAOUlEQVRYR+3WMREAMAwDsYY/yoDI7MLwIiP40+RJklfcCCBAgAABAgTqArfb/QMCCBAgQIAAgbbAB3z/e0F3js2cAAAAAElFTkSuQmCC', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAN0lEQVRYR+3WQREAMBACsZ5/B5ilMvgEBTt5cW37hjsBBAgQIECAwFwgyfYPCCBAgAABAgTWAh81dWyx0gFwKAAAAABJRU5ErkJggg==', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABz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Uzj+RLR1V5EqjD66NPRBVpLcQwjHoHYJOhsQv6U4mnzmrIXJCFr4LDwm/xBUoboG9XX4cc9VKdYoSA2yk5NQLJaKDUjTBoveG3Z2TElTxwjNK4M3LEZgUdDdruvcXzKBpStgp2NPiWi3ks9ZXxIoFVi+AvHLdc9TqtjL3/aYjpPlrzOcEnK62Szhimdd7xX232zFDTgtxezOu3WNMRLjiKgjtOhHVMd1loynVHvOgjuIIJMaELEqhJAV/RCSLbWTcfPFakFgFlALTRRvx+ok6Hlp/Q+v3fmx90bMyUzaEAhmM3KvHlXTL5DxnbGf/1M8RNNACLL5MNtPxP/mypJAqcDSFfgFhpYqWUzhTEAAAAAASUVORK5CYII=', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=', - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=' -]; - -const NON_ALPHA_CHANNEL_FORMATS = [ - RGB_S3TC_DXT1_Format, - RGB_PVRTC_4BPPV1_Format, - RGB_PVRTC_2BPPV1_Format, - RGB_ETC1_Format, - RGB_ETC2_Format -]; - -// Builders. They build Three.js object from Object data parsed by MMDParser. - -/** - * @param {THREE.LoadingManager} manager - */ -class MeshBuilder { - - constructor( manager ) { - - this.crossOrigin = 'anonymous'; - this.geometryBuilder = new GeometryBuilder(); - this.materialBuilder = new MaterialBuilder( manager ); - - } - - /** - * @param {string} crossOrigin - * @return {MeshBuilder} - */ - setCrossOrigin( crossOrigin ) { - - this.crossOrigin = crossOrigin; - return this; - - } - - /** - * @param {Object} data - parsed PMD/PMX data - * @param {string} resourcePath - * @param {function} onProgress - * @param {function} onError - * @return {SkinnedMesh} - */ - build( data, resourcePath, onProgress, onError ) { - - const geometry = this.geometryBuilder.build( data ); - const material = this.materialBuilder - .setCrossOrigin( this.crossOrigin ) - .setResourcePath( resourcePath ) - .build( data, geometry, onProgress, onError ); - - const mesh = new SkinnedMesh( geometry, material ); - - const skeleton = new Skeleton( initBones( mesh ) ); - mesh.bind( skeleton ); - - // console.log( mesh ); // for console debug - - return mesh; - - } - -} - -// TODO: Try to remove this function - -function initBones( mesh ) { - - const geometry = mesh.geometry; - - const bones = []; - - if ( geometry && geometry.bones !== undefined ) { - - // first, create array of 'Bone' objects from geometry data - - for ( let i = 0, il = geometry.bones.length; i < il; i ++ ) { - - const gbone = geometry.bones[ i ]; - - // create new 'Bone' object - - const bone = new Bone(); - bones.push( bone ); - - // apply values - - bone.name = gbone.name; - bone.position.fromArray( gbone.pos ); - bone.quaternion.fromArray( gbone.rotq ); - if ( gbone.scl !== undefined ) bone.scale.fromArray( gbone.scl ); - - } - - // second, create bone hierarchy - - for ( let i = 0, il = geometry.bones.length; i < il; i ++ ) { - - const gbone = geometry.bones[ i ]; - - if ( ( gbone.parent !== - 1 ) && ( gbone.parent !== null ) && ( bones[ gbone.parent ] !== undefined ) ) { - - // subsequent bones in the hierarchy - - bones[ gbone.parent ].add( bones[ i ] ); - - } else { - - // topmost bone, immediate child of the skinned mesh - - mesh.add( bones[ i ] ); - - } - - } - - } - - // now the bones are part of the scene graph and children of the skinned mesh. - // let's update the corresponding matrices - - mesh.updateMatrixWorld( true ); - - return bones; - -} - -// - -class GeometryBuilder { - - /** - * @param {Object} data - parsed PMD/PMX data - * @return {BufferGeometry} - */ - build( data ) { - - // for geometry - const positions = []; - const uvs = []; - const normals = []; - - const indices = []; - - const groups = []; - - const bones = []; - const skinIndices = []; - const skinWeights = []; - - const morphTargets = []; - const morphPositions = []; - - const iks = []; - const grants = []; - - const rigidBodies = []; - const constraints = []; - - // for work - let offset = 0; - const boneTypeTable = {}; - - // positions, normals, uvs, skinIndices, skinWeights - - for ( let i = 0; i < data.metadata.vertexCount; i ++ ) { - - const v = data.vertices[ i ]; - - for ( let j = 0, jl = v.position.length; j < jl; j ++ ) { - - positions.push( v.position[ j ] ); - - } - - for ( let j = 0, jl = v.normal.length; j < jl; j ++ ) { - - normals.push( v.normal[ j ] ); - - } - - for ( let j = 0, jl = v.uv.length; j < jl; j ++ ) { - - uvs.push( v.uv[ j ] ); - - } - - for ( let j = 0; j < 4; j ++ ) { - - skinIndices.push( v.skinIndices.length - 1 >= j ? v.skinIndices[ j ] : 0.0 ); - - } - - for ( let j = 0; j < 4; j ++ ) { - - skinWeights.push( v.skinWeights.length - 1 >= j ? v.skinWeights[ j ] : 0.0 ); - - } - - } - - // indices - - for ( let i = 0; i < data.metadata.faceCount; i ++ ) { - - const face = data.faces[ i ]; - - for ( let j = 0, jl = face.indices.length; j < jl; j ++ ) { - - indices.push( face.indices[ j ] ); - - } - - } - - // groups - - for ( let i = 0; i < data.metadata.materialCount; i ++ ) { - - const material = data.materials[ i ]; - - groups.push( { - offset: offset * 3, - count: material.faceCount * 3 - } ); - - offset += material.faceCount; - - } - - // bones - - for ( let i = 0; i < data.metadata.rigidBodyCount; i ++ ) { - - const body = data.rigidBodies[ i ]; - let value = boneTypeTable[ body.boneIndex ]; - - // keeps greater number if already value is set without any special reasons - value = value === undefined ? body.type : Math.max( body.type, value ); - - boneTypeTable[ body.boneIndex ] = value; - - } - - for ( let i = 0; i < data.metadata.boneCount; i ++ ) { - - const boneData = data.bones[ i ]; - - const bone = { - index: i, - transformationClass: boneData.transformationClass, - parent: boneData.parentIndex, - name: boneData.name, - pos: boneData.position.slice( 0, 3 ), - rotq: [ 0, 0, 0, 1 ], - scl: [ 1, 1, 1 ], - rigidBodyType: boneTypeTable[ i ] !== undefined ? boneTypeTable[ i ] : - 1 - }; - - if ( bone.parent !== - 1 ) { - - bone.pos[ 0 ] -= data.bones[ bone.parent ].position[ 0 ]; - bone.pos[ 1 ] -= data.bones[ bone.parent ].position[ 1 ]; - bone.pos[ 2 ] -= data.bones[ bone.parent ].position[ 2 ]; - - } - - bones.push( bone ); - - } - - // iks - - // TODO: remove duplicated codes between PMD and PMX - if ( data.metadata.format === 'pmd' ) { - - for ( let i = 0; i < data.metadata.ikCount; i ++ ) { - - const ik = data.iks[ i ]; - - const param = { - target: ik.target, - effector: ik.effector, - iteration: ik.iteration, - maxAngle: ik.maxAngle * 4, - links: [] - }; - - for ( let j = 0, jl = ik.links.length; j < jl; j ++ ) { - - const link = {}; - link.index = ik.links[ j ].index; - link.enabled = true; - - if ( data.bones[ link.index ].name.indexOf( 'ひざ' ) >= 0 ) { - - link.limitation = new Vector3( 1.0, 0.0, 0.0 ); - - } - - param.links.push( link ); - - } - - iks.push( param ); - - } - - } else { - - for ( let i = 0; i < data.metadata.boneCount; i ++ ) { - - const ik = data.bones[ i ].ik; - - if ( ik === undefined ) continue; - - const param = { - target: i, - effector: ik.effector, - iteration: ik.iteration, - maxAngle: ik.maxAngle, - links: [] - }; - - for ( let j = 0, jl = ik.links.length; j < jl; j ++ ) { - - const link = {}; - link.index = ik.links[ j ].index; - link.enabled = true; - - if ( ik.links[ j ].angleLimitation === 1 ) { - - // Revert if rotationMin/Max doesn't work well - // link.limitation = new Vector3( 1.0, 0.0, 0.0 ); - - const rotationMin = ik.links[ j ].lowerLimitationAngle; - const rotationMax = ik.links[ j ].upperLimitationAngle; - - // Convert Left to Right coordinate by myself because - // MMDParser doesn't convert. It's a MMDParser's bug - - const tmp1 = - rotationMax[ 0 ]; - const tmp2 = - rotationMax[ 1 ]; - rotationMax[ 0 ] = - rotationMin[ 0 ]; - rotationMax[ 1 ] = - rotationMin[ 1 ]; - rotationMin[ 0 ] = tmp1; - rotationMin[ 1 ] = tmp2; - - link.rotationMin = new Vector3().fromArray( rotationMin ); - link.rotationMax = new Vector3().fromArray( rotationMax ); - - } - - param.links.push( link ); - - } - - iks.push( param ); - - // Save the reference even from bone data for efficiently - // simulating PMX animation system - bones[ i ].ik = param; - - } - - } - - // grants - - if ( data.metadata.format === 'pmx' ) { - - // bone index -> grant entry map - const grantEntryMap = {}; - - for ( let i = 0; i < data.metadata.boneCount; i ++ ) { - - const boneData = data.bones[ i ]; - const grant = boneData.grant; - - if ( grant === undefined ) continue; - - const param = { - index: i, - parentIndex: grant.parentIndex, - ratio: grant.ratio, - isLocal: grant.isLocal, - affectRotation: grant.affectRotation, - affectPosition: grant.affectPosition, - transformationClass: boneData.transformationClass - }; - - grantEntryMap[ i ] = { parent: null, children: [], param: param, visited: false }; - - } - - const rootEntry = { parent: null, children: [], param: null, visited: false }; - - // Build a tree representing grant hierarchy - - for ( const boneIndex in grantEntryMap ) { - - const grantEntry = grantEntryMap[ boneIndex ]; - const parentGrantEntry = grantEntryMap[ grantEntry.parentIndex ] || rootEntry; - - grantEntry.parent = parentGrantEntry; - parentGrantEntry.children.push( grantEntry ); - - } - - // Sort grant parameters from parents to children because - // grant uses parent's transform that parent's grant is already applied - // so grant should be applied in order from parents to children - - function traverse( entry ) { - - if ( entry.param ) { - - grants.push( entry.param ); - - // Save the reference even from bone data for efficiently - // simulating PMX animation system - bones[ entry.param.index ].grant = entry.param; - - } - - entry.visited = true; - - for ( let i = 0, il = entry.children.length; i < il; i ++ ) { - - const child = entry.children[ i ]; - - // Cut off a loop if exists. (Is a grant loop invalid?) - if ( ! child.visited ) traverse( child ); - - } - - } - - traverse( rootEntry ); - - } - - // morph - - function updateAttributes( attribute, morph, ratio ) { - - for ( let i = 0; i < morph.elementCount; i ++ ) { - - const element = morph.elements[ i ]; - - let index; - - if ( data.metadata.format === 'pmd' ) { - - index = data.morphs[ 0 ].elements[ element.index ].index; - - } else { - - index = element.index; - - } - - attribute.array[ index * 3 + 0 ] += element.position[ 0 ] * ratio; - attribute.array[ index * 3 + 1 ] += element.position[ 1 ] * ratio; - attribute.array[ index * 3 + 2 ] += element.position[ 2 ] * ratio; - - } - - } - - for ( let i = 0; i < data.metadata.morphCount; i ++ ) { - - const morph = data.morphs[ i ]; - const params = { name: morph.name }; - - const attribute = new Float32BufferAttribute( data.metadata.vertexCount * 3, 3 ); - attribute.name = morph.name; - - for ( let j = 0; j < data.metadata.vertexCount * 3; j ++ ) { - - attribute.array[ j ] = positions[ j ]; - - } - - if ( data.metadata.format === 'pmd' ) { - - if ( i !== 0 ) { - - updateAttributes( attribute, morph, 1.0 ); - - } - - } else { - - if ( morph.type === 0 ) { // group - - for ( let j = 0; j < morph.elementCount; j ++ ) { - - const morph2 = data.morphs[ morph.elements[ j ].index ]; - const ratio = morph.elements[ j ].ratio; - - if ( morph2.type === 1 ) { - - updateAttributes( attribute, morph2, ratio ); - - } else { - - // TODO: implement - - } - - } - - } else if ( morph.type === 1 ) { // vertex - - updateAttributes( attribute, morph, 1.0 ); - - } else if ( morph.type === 2 ) { // bone - - // TODO: implement - - } else if ( morph.type === 3 ) { // uv - - // TODO: implement - - } else if ( morph.type === 4 ) { // additional uv1 - - // TODO: implement - - } else if ( morph.type === 5 ) { // additional uv2 - - // TODO: implement - - } else if ( morph.type === 6 ) { // additional uv3 - - // TODO: implement - - } else if ( morph.type === 7 ) { // additional uv4 - - // TODO: implement - - } else if ( morph.type === 8 ) { // material - - // TODO: implement - - } - - } - - morphTargets.push( params ); - morphPositions.push( attribute ); - - } - - // rigid bodies from rigidBodies field. - - for ( let i = 0; i < data.metadata.rigidBodyCount; i ++ ) { - - const rigidBody = data.rigidBodies[ i ]; - const params = {}; - - for ( const key in rigidBody ) { - - params[ key ] = rigidBody[ key ]; - - } - - /* - * RigidBody position parameter in PMX seems global position - * while the one in PMD seems offset from corresponding bone. - * So unify being offset. - */ - if ( data.metadata.format === 'pmx' ) { - - if ( params.boneIndex !== - 1 ) { - - const bone = data.bones[ params.boneIndex ]; - params.position[ 0 ] -= bone.position[ 0 ]; - params.position[ 1 ] -= bone.position[ 1 ]; - params.position[ 2 ] -= bone.position[ 2 ]; - - } - - } - - rigidBodies.push( params ); - - } - - // constraints from constraints field. - - for ( let i = 0; i < data.metadata.constraintCount; i ++ ) { - - const constraint = data.constraints[ i ]; - const params = {}; - - for ( const key in constraint ) { - - params[ key ] = constraint[ key ]; - - } - - const bodyA = rigidBodies[ params.rigidBodyIndex1 ]; - const bodyB = rigidBodies[ params.rigidBodyIndex2 ]; - - // Refer to http://www20.atpages.jp/katwat/wp/?p=4135 - if ( bodyA.type !== 0 && bodyB.type === 2 ) { - - if ( bodyA.boneIndex !== - 1 && bodyB.boneIndex !== - 1 && - data.bones[ bodyB.boneIndex ].parentIndex === bodyA.boneIndex ) { - - bodyB.type = 1; - - } - - } - - constraints.push( params ); - - } - - // build BufferGeometry. - - const geometry = new BufferGeometry(); - - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - geometry.setAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) ); - geometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) ); - geometry.setIndex( indices ); - - for ( let i = 0, il = groups.length; i < il; i ++ ) { - - geometry.addGroup( groups[ i ].offset, groups[ i ].count, i ); - - } - - geometry.bones = bones; - - geometry.morphTargets = morphTargets; - geometry.morphAttributes.position = morphPositions; - geometry.morphTargetsRelative = false; - - geometry.userData.MMD = { - bones: bones, - iks: iks, - grants: grants, - rigidBodies: rigidBodies, - constraints: constraints, - format: data.metadata.format - }; - - geometry.computeBoundingSphere(); - - return geometry; - - } - -} - -// - -/** - * @param {THREE.LoadingManager} manager - */ -class MaterialBuilder { - - constructor( manager ) { - - this.manager = manager; - - this.textureLoader = new TextureLoader( this.manager ); - this.tgaLoader = null; // lazy generation - - this.crossOrigin = 'anonymous'; - this.resourcePath = undefined; - - } - - /** - * @param {string} crossOrigin - * @return {MaterialBuilder} - */ - setCrossOrigin( crossOrigin ) { - - this.crossOrigin = crossOrigin; - return this; - - } - - /** - * @param {string} resourcePath - * @return {MaterialBuilder} - */ - setResourcePath( resourcePath ) { - - this.resourcePath = resourcePath; - return this; - - } - - /** - * @param {Object} data - parsed PMD/PMX data - * @param {BufferGeometry} geometry - some properties are dependend on geometry - * @param {function} onProgress - * @param {function} onError - * @return {Array} - */ - build( data, geometry /*, onProgress, onError */ ) { - - const materials = []; - - const textures = {}; - - this.textureLoader.setCrossOrigin( this.crossOrigin ); - - // materials - - for ( let i = 0; i < data.metadata.materialCount; i ++ ) { - - const material = data.materials[ i ]; - - const params = { userData: { MMD: {} } }; - - if ( material.name !== undefined ) params.name = material.name; - - /* - * Color - * - * MMD MMDToonMaterial - * ambient - emissive * a - * (a = 1.0 without map texture or 0.2 with map texture) - * - * MMDToonMaterial doesn't have ambient. Set it to emissive instead. - * It'll be too bright if material has map texture so using coef 0.2. - */ - params.diffuse = new Color().setRGB( - material.diffuse[ 0 ], - material.diffuse[ 1 ], - material.diffuse[ 2 ], - SRGBColorSpace - ); - params.opacity = material.diffuse[ 3 ]; - params.specular = new Color().setRGB( ...material.specular, SRGBColorSpace ); - params.shininess = material.shininess; - params.emissive = new Color().setRGB( ...material.ambient, SRGBColorSpace ); - params.transparent = params.opacity !== 1.0; - - // - - params.fog = true; - - // blend - - params.blending = CustomBlending; - params.blendSrc = SrcAlphaFactor; - params.blendDst = OneMinusSrcAlphaFactor; - params.blendSrcAlpha = SrcAlphaFactor; - params.blendDstAlpha = DstAlphaFactor; - - // side - - if ( data.metadata.format === 'pmx' && ( material.flag & 0x1 ) === 1 ) { - - params.side = DoubleSide; - - } else { - - params.side = params.opacity === 1.0 ? FrontSide : DoubleSide; - - } - - if ( data.metadata.format === 'pmd' ) { - - // map, matcap - - if ( material.fileName ) { - - const fileName = material.fileName; - const fileNames = fileName.split( '*' ); - - // fileNames[ 0 ]: mapFileName - // fileNames[ 1 ]: matcapFileName( optional ) - - params.map = this._loadTexture( fileNames[ 0 ], textures ); - - if ( fileNames.length > 1 ) { - - const extension = fileNames[ 1 ].slice( - 4 ).toLowerCase(); - - params.matcap = this._loadTexture( - fileNames[ 1 ], - textures - ); - - params.matcapCombine = extension === '.sph' - ? MultiplyOperation - : AddOperation; - - } - - } - - // gradientMap - - const toonFileName = ( material.toonIndex === - 1 ) - ? 'toon00.bmp' - : data.toonTextures[ material.toonIndex ].fileName; - - params.gradientMap = this._loadTexture( - toonFileName, - textures, - { - isToonTexture: true, - isDefaultToonTexture: this._isDefaultToonTexture( toonFileName ) - } - ); - - // parameters for OutlineEffect - - params.userData.outlineParameters = { - thickness: material.edgeFlag === 1 ? 0.003 : 0.0, - color: [ 0, 0, 0 ], - alpha: 1.0, - visible: material.edgeFlag === 1 - }; - - } else { - - // map - - if ( material.textureIndex !== - 1 ) { - - params.map = this._loadTexture( data.textures[ material.textureIndex ], textures ); - - // Since PMX spec don't have standard to list map files except color map and env map, - // we need to save file name for further mapping, like matching normal map file names after model loaded. - // ref: https://gist.github.com/felixjones/f8a06bd48f9da9a4539f#texture - params.userData.MMD.mapFileName = data.textures[ material.textureIndex ]; - - } - - // matcap TODO: support m.envFlag === 3 - - if ( material.envTextureIndex !== - 1 && ( material.envFlag === 1 || material.envFlag == 2 ) ) { - - params.matcap = this._loadTexture( - data.textures[ material.envTextureIndex ], - textures - ); - - // Same as color map above, keep file name in userData for further usage. - params.userData.MMD.matcapFileName = data.textures[ material.envTextureIndex ]; - - params.matcapCombine = material.envFlag === 1 - ? MultiplyOperation - : AddOperation; - - } - - // gradientMap - - let toonFileName, isDefaultToon; - - if ( material.toonIndex === - 1 || material.toonFlag !== 0 ) { - - toonFileName = 'toon' + ( '0' + ( material.toonIndex + 1 ) ).slice( - 2 ) + '.bmp'; - isDefaultToon = true; - - } else { - - toonFileName = data.textures[ material.toonIndex ]; - isDefaultToon = false; - - } - - params.gradientMap = this._loadTexture( - toonFileName, - textures, - { - isToonTexture: true, - isDefaultToonTexture: isDefaultToon - } - ); - - // parameters for OutlineEffect - params.userData.outlineParameters = { - thickness: material.edgeSize / 300, // TODO: better calculation? - color: material.edgeColor.slice( 0, 3 ), - alpha: material.edgeColor[ 3 ], - visible: ( material.flag & 0x10 ) !== 0 && material.edgeSize > 0.0 - }; - - } - - if ( params.map !== undefined ) { - - if ( ! params.transparent ) { - - this._checkImageTransparency( params.map, geometry, i ); - - } - - params.emissive.multiplyScalar( 0.2 ); - - } - - materials.push( new MMDToonMaterial( params ) ); - - } - - if ( data.metadata.format === 'pmx' ) { - - // set transparent true if alpha morph is defined. - - function checkAlphaMorph( elements, materials ) { - - for ( let i = 0, il = elements.length; i < il; i ++ ) { - - const element = elements[ i ]; - - if ( element.index === - 1 ) continue; - - const material = materials[ element.index ]; - - if ( material.opacity !== element.diffuse[ 3 ] ) { - - material.transparent = true; - - } - - } - - } - - for ( let i = 0, il = data.morphs.length; i < il; i ++ ) { - - const morph = data.morphs[ i ]; - const elements = morph.elements; - - if ( morph.type === 0 ) { - - for ( let j = 0, jl = elements.length; j < jl; j ++ ) { - - const morph2 = data.morphs[ elements[ j ].index ]; - - if ( morph2.type !== 8 ) continue; - - checkAlphaMorph( morph2.elements, materials ); - - } - - } else if ( morph.type === 8 ) { - - checkAlphaMorph( elements, materials ); - - } - - } - - } - - return materials; - - } - - // private methods - - _getTGALoader() { - - if ( this.tgaLoader === null ) { - - if ( TGALoader === undefined ) { - - throw new Error( 'THREE.MMDLoader: Import TGALoader' ); - - } - - this.tgaLoader = new TGALoader( this.manager ); - - } - - return this.tgaLoader; - - } - - _isDefaultToonTexture( name ) { - - if ( name.length !== 10 ) return false; - - return /toon(10|0[0-9])\.bmp/.test( name ); - - } - - _loadTexture( filePath, textures, params, onProgress, onError ) { - - params = params || {}; - - const scope = this; - - let fullPath; - - if ( params.isDefaultToonTexture === true ) { - - let index; - - try { - - index = parseInt( filePath.match( /toon([0-9]{2})\.bmp$/ )[ 1 ] ); - - } catch ( e ) { - - console.warn( 'THREE.MMDLoader: ' + filePath + ' seems like a ' - + 'not right default texture path. Using toon00.bmp instead.' ); - - index = 0; - - } - - fullPath = DEFAULT_TOON_TEXTURES[ index ]; - - } else { - - fullPath = this.resourcePath + filePath; - - } - - if ( textures[ fullPath ] !== undefined ) return textures[ fullPath ]; - - let loader = this.manager.getHandler( fullPath ); - - if ( loader === null ) { - - loader = ( filePath.slice( - 4 ).toLowerCase() === '.tga' ) - ? this._getTGALoader() - : this.textureLoader; - - } - - const texture = loader.load( fullPath, function ( t ) { - - // MMD toon texture is Axis-Y oriented - // but Three.js gradient map is Axis-X oriented. - // So here replaces the toon texture image with the rotated one. - if ( params.isToonTexture === true ) { - - t.image = scope._getRotatedImage( t.image ); - - t.magFilter = NearestFilter; - t.minFilter = NearestFilter; - - } - - t.flipY = false; - t.wrapS = RepeatWrapping; - t.wrapT = RepeatWrapping; - t.colorSpace = SRGBColorSpace; - - for ( let i = 0; i < texture.readyCallbacks.length; i ++ ) { - - texture.readyCallbacks[ i ]( texture ); - - } - - delete texture.readyCallbacks; - - }, onProgress, onError ); - - texture.readyCallbacks = []; - - textures[ fullPath ] = texture; - - return texture; - - } - - _getRotatedImage( image ) { - - const canvas = document.createElement( 'canvas' ); - const context = canvas.getContext( '2d' ); - - const width = image.width; - const height = image.height; - - canvas.width = width; - canvas.height = height; - - context.clearRect( 0, 0, width, height ); - context.translate( width / 2.0, height / 2.0 ); - context.rotate( 0.5 * Math.PI ); // 90.0 * Math.PI / 180.0 - context.translate( - width / 2.0, - height / 2.0 ); - context.drawImage( image, 0, 0 ); - - return context.getImageData( 0, 0, width, height ); - - } - - // Check if the partial image area used by the texture is transparent. - _checkImageTransparency( map, geometry, groupIndex ) { - - map.readyCallbacks.push( function ( texture ) { - - // Is there any efficient ways? - function createImageData( image ) { - - const canvas = document.createElement( 'canvas' ); - canvas.width = image.width; - canvas.height = image.height; - - const context = canvas.getContext( '2d' ); - context.drawImage( image, 0, 0 ); - - return context.getImageData( 0, 0, canvas.width, canvas.height ); - - } - - function detectImageTransparency( image, uvs, indices ) { - - const width = image.width; - const height = image.height; - const data = image.data; - const threshold = 253; - - if ( data.length / ( width * height ) !== 4 ) return false; - - for ( let i = 0; i < indices.length; i += 3 ) { - - const centerUV = { x: 0.0, y: 0.0 }; - - for ( let j = 0; j < 3; j ++ ) { - - const index = indices[ i * 3 + j ]; - const uv = { x: uvs[ index * 2 + 0 ], y: uvs[ index * 2 + 1 ] }; - - if ( getAlphaByUv( image, uv ) < threshold ) return true; - - centerUV.x += uv.x; - centerUV.y += uv.y; - - } - - centerUV.x /= 3; - centerUV.y /= 3; - - if ( getAlphaByUv( image, centerUV ) < threshold ) return true; - - } - - return false; - - } - - /* - * This method expects - * texture.flipY = false - * texture.wrapS = RepeatWrapping - * texture.wrapT = RepeatWrapping - * TODO: more precise - */ - function getAlphaByUv( image, uv ) { - - const width = image.width; - const height = image.height; - - let x = Math.round( uv.x * width ) % width; - let y = Math.round( uv.y * height ) % height; - - if ( x < 0 ) x += width; - if ( y < 0 ) y += height; - - const index = y * width + x; - - return image.data[ index * 4 + 3 ]; - - } - - if ( texture.isCompressedTexture === true ) { - - if ( NON_ALPHA_CHANNEL_FORMATS.includes( texture.format ) ) { - - map.transparent = false; - - } else { - - // any other way to check transparency of CompressedTexture? - map.transparent = true; - - } - - return; - - } - - const imageData = texture.image.data !== undefined - ? texture.image - : createImageData( texture.image ); - - const group = geometry.groups[ groupIndex ]; - - if ( detectImageTransparency( - imageData, - geometry.attributes.uv.array, - geometry.index.array.slice( group.start, group.start + group.count ) ) ) { - - map.transparent = true; - - } - - } ); - - } - -} - -// - -class AnimationBuilder { - - /** - * @param {Object} vmd - parsed VMD data - * @param {SkinnedMesh} mesh - tracks will be fitting to mesh - * @return {AnimationClip} - */ - build( vmd, mesh ) { - - // combine skeletal and morph animations - - const tracks = this.buildSkeletalAnimation( vmd, mesh ).tracks; - const tracks2 = this.buildMorphAnimation( vmd, mesh ).tracks; - - for ( let i = 0, il = tracks2.length; i < il; i ++ ) { - - tracks.push( tracks2[ i ] ); - - } - - return new AnimationClip( '', - 1, tracks ); - - } - - /** - * @param {Object} vmd - parsed VMD data - * @param {SkinnedMesh} mesh - tracks will be fitting to mesh - * @return {AnimationClip} - */ - buildSkeletalAnimation( vmd, mesh ) { - - function pushInterpolation( array, interpolation, index ) { - - array.push( interpolation[ index + 0 ] / 127 ); // x1 - array.push( interpolation[ index + 8 ] / 127 ); // x2 - array.push( interpolation[ index + 4 ] / 127 ); // y1 - array.push( interpolation[ index + 12 ] / 127 ); // y2 - - } - - const tracks = []; - - const motions = {}; - const bones = mesh.skeleton.bones; - const boneNameDictionary = {}; - - for ( let i = 0, il = bones.length; i < il; i ++ ) { - - boneNameDictionary[ bones[ i ].name ] = true; - - } - - for ( let i = 0; i < vmd.metadata.motionCount; i ++ ) { - - const motion = vmd.motions[ i ]; - const boneName = motion.boneName; - - if ( boneNameDictionary[ boneName ] === undefined ) continue; - - motions[ boneName ] = motions[ boneName ] || []; - motions[ boneName ].push( motion ); - - } - - for ( const key in motions ) { - - const array = motions[ key ]; - - array.sort( function ( a, b ) { - - return a.frameNum - b.frameNum; - - } ); - - const times = []; - const positions = []; - const rotations = []; - const pInterpolations = []; - const rInterpolations = []; - - const basePosition = mesh.skeleton.getBoneByName( key ).position.toArray(); - - for ( let i = 0, il = array.length; i < il; i ++ ) { - - const time = array[ i ].frameNum / 30; - const position = array[ i ].position; - const rotation = array[ i ].rotation; - const interpolation = array[ i ].interpolation; - - times.push( time ); - - for ( let j = 0; j < 3; j ++ ) positions.push( basePosition[ j ] + position[ j ] ); - for ( let j = 0; j < 4; j ++ ) rotations.push( rotation[ j ] ); - for ( let j = 0; j < 3; j ++ ) pushInterpolation( pInterpolations, interpolation, j ); - - pushInterpolation( rInterpolations, interpolation, 3 ); - - } - - const targetName = '.bones[' + key + ']'; - - tracks.push( this._createTrack( targetName + '.position', VectorKeyframeTrack, times, positions, pInterpolations ) ); - tracks.push( this._createTrack( targetName + '.quaternion', QuaternionKeyframeTrack, times, rotations, rInterpolations ) ); - - } - - return new AnimationClip( '', - 1, tracks ); - - } - - /** - * @param {Object} vmd - parsed VMD data - * @param {SkinnedMesh} mesh - tracks will be fitting to mesh - * @return {AnimationClip} - */ - buildMorphAnimation( vmd, mesh ) { - - const tracks = []; - - const morphs = {}; - const morphTargetDictionary = mesh.morphTargetDictionary; - - for ( let i = 0; i < vmd.metadata.morphCount; i ++ ) { - - const morph = vmd.morphs[ i ]; - const morphName = morph.morphName; - - if ( morphTargetDictionary[ morphName ] === undefined ) continue; - - morphs[ morphName ] = morphs[ morphName ] || []; - morphs[ morphName ].push( morph ); - - } - - for ( const key in morphs ) { - - const array = morphs[ key ]; - - array.sort( function ( a, b ) { - - return a.frameNum - b.frameNum; - - } ); - - const times = []; - const values = []; - - for ( let i = 0, il = array.length; i < il; i ++ ) { - - times.push( array[ i ].frameNum / 30 ); - values.push( array[ i ].weight ); - - } - - tracks.push( new NumberKeyframeTrack( '.morphTargetInfluences[' + morphTargetDictionary[ key ] + ']', times, values ) ); - - } - - return new AnimationClip( '', - 1, tracks ); - - } - - /** - * @param {Object} vmd - parsed VMD data - * @return {AnimationClip} - */ - buildCameraAnimation( vmd ) { - - function pushVector3( array, vec ) { - - array.push( vec.x ); - array.push( vec.y ); - array.push( vec.z ); - - } - - function pushQuaternion( array, q ) { - - array.push( q.x ); - array.push( q.y ); - array.push( q.z ); - array.push( q.w ); - - } - - function pushInterpolation( array, interpolation, index ) { - - array.push( interpolation[ index * 4 + 0 ] / 127 ); // x1 - array.push( interpolation[ index * 4 + 1 ] / 127 ); // x2 - array.push( interpolation[ index * 4 + 2 ] / 127 ); // y1 - array.push( interpolation[ index * 4 + 3 ] / 127 ); // y2 - - } - - const cameras = vmd.cameras === undefined ? [] : vmd.cameras.slice(); - - cameras.sort( function ( a, b ) { - - return a.frameNum - b.frameNum; - - } ); - - const times = []; - const centers = []; - const quaternions = []; - const positions = []; - const fovs = []; - - const cInterpolations = []; - const qInterpolations = []; - const pInterpolations = []; - const fInterpolations = []; - - const quaternion = new Quaternion(); - const euler = new Euler(); - const position = new Vector3(); - const center = new Vector3(); - - for ( let i = 0, il = cameras.length; i < il; i ++ ) { - - const motion = cameras[ i ]; - - const time = motion.frameNum / 30; - const pos = motion.position; - const rot = motion.rotation; - const distance = motion.distance; - const fov = motion.fov; - const interpolation = motion.interpolation; - - times.push( time ); - - position.set( 0, 0, - distance ); - center.set( pos[ 0 ], pos[ 1 ], pos[ 2 ] ); - - euler.set( - rot[ 0 ], - rot[ 1 ], - rot[ 2 ] ); - quaternion.setFromEuler( euler ); - - position.add( center ); - position.applyQuaternion( quaternion ); - - pushVector3( centers, center ); - pushQuaternion( quaternions, quaternion ); - pushVector3( positions, position ); - - fovs.push( fov ); - - for ( let j = 0; j < 3; j ++ ) { - - pushInterpolation( cInterpolations, interpolation, j ); - - } - - pushInterpolation( qInterpolations, interpolation, 3 ); - - // use the same parameter for x, y, z axis. - for ( let j = 0; j < 3; j ++ ) { - - pushInterpolation( pInterpolations, interpolation, 4 ); - - } - - pushInterpolation( fInterpolations, interpolation, 5 ); - - } - - const tracks = []; - - // I expect an object whose name 'target' exists under THREE.Camera - tracks.push( this._createTrack( 'target.position', VectorKeyframeTrack, times, centers, cInterpolations ) ); - - tracks.push( this._createTrack( '.quaternion', QuaternionKeyframeTrack, times, quaternions, qInterpolations ) ); - tracks.push( this._createTrack( '.position', VectorKeyframeTrack, times, positions, pInterpolations ) ); - tracks.push( this._createTrack( '.fov', NumberKeyframeTrack, times, fovs, fInterpolations ) ); - - return new AnimationClip( '', - 1, tracks ); - - } - - // private method - - _createTrack( node, typedKeyframeTrack, times, values, interpolations ) { - - /* - * optimizes here not to let KeyframeTrackPrototype optimize - * because KeyframeTrackPrototype optimizes times and values but - * doesn't optimize interpolations. - */ - if ( times.length > 2 ) { - - times = times.slice(); - values = values.slice(); - interpolations = interpolations.slice(); - - const stride = values.length / times.length; - const interpolateStride = interpolations.length / times.length; - - let index = 1; - - for ( let aheadIndex = 2, endIndex = times.length; aheadIndex < endIndex; aheadIndex ++ ) { - - for ( let i = 0; i < stride; i ++ ) { - - if ( values[ index * stride + i ] !== values[ ( index - 1 ) * stride + i ] || - values[ index * stride + i ] !== values[ aheadIndex * stride + i ] ) { - - index ++; - break; - - } - - } - - if ( aheadIndex > index ) { - - times[ index ] = times[ aheadIndex ]; - - for ( let i = 0; i < stride; i ++ ) { - - values[ index * stride + i ] = values[ aheadIndex * stride + i ]; - - } - - for ( let i = 0; i < interpolateStride; i ++ ) { - - interpolations[ index * interpolateStride + i ] = interpolations[ aheadIndex * interpolateStride + i ]; - - } - - } - - } - - times.length = index + 1; - values.length = ( index + 1 ) * stride; - interpolations.length = ( index + 1 ) * interpolateStride; - - } - - const track = new typedKeyframeTrack( node, times, values ); - - track.createInterpolant = function InterpolantFactoryMethodCubicBezier( result ) { - - return new CubicBezierInterpolation( this.times, this.values, this.getValueSize(), result, new Float32Array( interpolations ) ); - - }; - - return track; - - } - -} - -// interpolation - -class CubicBezierInterpolation extends Interpolant { - - constructor( parameterPositions, sampleValues, sampleSize, resultBuffer, params ) { - - super( parameterPositions, sampleValues, sampleSize, resultBuffer ); - - this.interpolationParams = params; - - } - - interpolate_( i1, t0, t, t1 ) { - - const result = this.resultBuffer; - const values = this.sampleValues; - const stride = this.valueSize; - const params = this.interpolationParams; - - const offset1 = i1 * stride; - const offset0 = offset1 - stride; - - // No interpolation if next key frame is in one frame in 30fps. - // This is from MMD animation spec. - // '1.5' is for precision loss. times are Float32 in Three.js Animation system. - const weight1 = ( ( t1 - t0 ) < 1 / 30 * 1.5 ) ? 0.0 : ( t - t0 ) / ( t1 - t0 ); - - if ( stride === 4 ) { // Quaternion - - const x1 = params[ i1 * 4 + 0 ]; - const x2 = params[ i1 * 4 + 1 ]; - const y1 = params[ i1 * 4 + 2 ]; - const y2 = params[ i1 * 4 + 3 ]; - - const ratio = this._calculate( x1, x2, y1, y2, weight1 ); - - Quaternion.slerpFlat( result, 0, values, offset0, values, offset1, ratio ); - - } else if ( stride === 3 ) { // Vector3 - - for ( let i = 0; i !== stride; ++ i ) { - - const x1 = params[ i1 * 12 + i * 4 + 0 ]; - const x2 = params[ i1 * 12 + i * 4 + 1 ]; - const y1 = params[ i1 * 12 + i * 4 + 2 ]; - const y2 = params[ i1 * 12 + i * 4 + 3 ]; - - const ratio = this._calculate( x1, x2, y1, y2, weight1 ); - - result[ i ] = values[ offset0 + i ] * ( 1 - ratio ) + values[ offset1 + i ] * ratio; - - } - - } else { // Number - - const x1 = params[ i1 * 4 + 0 ]; - const x2 = params[ i1 * 4 + 1 ]; - const y1 = params[ i1 * 4 + 2 ]; - const y2 = params[ i1 * 4 + 3 ]; - - const ratio = this._calculate( x1, x2, y1, y2, weight1 ); - - result[ 0 ] = values[ offset0 ] * ( 1 - ratio ) + values[ offset1 ] * ratio; - - } - - return result; - - } - - _calculate( x1, x2, y1, y2, x ) { - - /* - * Cubic Bezier curves - * https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves - * - * B(t) = ( 1 - t ) ^ 3 * P0 - * + 3 * ( 1 - t ) ^ 2 * t * P1 - * + 3 * ( 1 - t ) * t^2 * P2 - * + t ^ 3 * P3 - * ( 0 <= t <= 1 ) - * - * MMD uses Cubic Bezier curves for bone and camera animation interpolation. - * http://d.hatena.ne.jp/edvakf/20111016/1318716097 - * - * x = ( 1 - t ) ^ 3 * x0 - * + 3 * ( 1 - t ) ^ 2 * t * x1 - * + 3 * ( 1 - t ) * t^2 * x2 - * + t ^ 3 * x3 - * y = ( 1 - t ) ^ 3 * y0 - * + 3 * ( 1 - t ) ^ 2 * t * y1 - * + 3 * ( 1 - t ) * t^2 * y2 - * + t ^ 3 * y3 - * ( x0 = 0, y0 = 0 ) - * ( x3 = 1, y3 = 1 ) - * ( 0 <= t, x1, x2, y1, y2 <= 1 ) - * - * Here solves this equation with Bisection method, - * https://en.wikipedia.org/wiki/Bisection_method - * gets t, and then calculate y. - * - * f(t) = 3 * ( 1 - t ) ^ 2 * t * x1 - * + 3 * ( 1 - t ) * t^2 * x2 - * + t ^ 3 - x = 0 - * - * (Another option: Newton's method - * https://en.wikipedia.org/wiki/Newton%27s_method) - */ - - let c = 0.5; - let t = c; - let s = 1.0 - t; - const loop = 15; - const eps = 1e-5; - const math = Math; - - let sst3, stt3, ttt; - - for ( let i = 0; i < loop; i ++ ) { - - sst3 = 3.0 * s * s * t; - stt3 = 3.0 * s * t * t; - ttt = t * t * t; - - const ft = ( sst3 * x1 ) + ( stt3 * x2 ) + ( ttt ) - x; - - if ( math.abs( ft ) < eps ) break; - - c /= 2.0; - - t += ( ft < 0 ) ? c : - c; - s = 1.0 - t; - - } - - return ( sst3 * y1 ) + ( stt3 * y2 ) + ttt; - - } - -} - -class MMDToonMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super(); - - this.isMMDToonMaterial = true; - - this.type = 'MMDToonMaterial'; - - this._matcapCombine = AddOperation; - this.emissiveIntensity = 1.0; - this.normalMapType = TangentSpaceNormalMap; - - this.combine = MultiplyOperation; - - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.flatShading = false; - - this.lights = true; - - this.vertexShader = MMDToonShader.vertexShader; - this.fragmentShader = MMDToonShader.fragmentShader; - - this.defines = Object.assign( {}, MMDToonShader.defines ); - Object.defineProperty( this, 'matcapCombine', { - - get: function () { - - return this._matcapCombine; - - }, - - set: function ( value ) { - - this._matcapCombine = value; - - switch ( value ) { - - case MultiplyOperation: - this.defines.MATCAP_BLENDING_MULTIPLY = true; - delete this.defines.MATCAP_BLENDING_ADD; - break; - - default: - case AddOperation: - this.defines.MATCAP_BLENDING_ADD = true; - delete this.defines.MATCAP_BLENDING_MULTIPLY; - break; - - } - - }, - - } ); - - this.uniforms = UniformsUtils.clone( MMDToonShader.uniforms ); - - // merged from MeshToon/Phong/MatcapMaterial - const exposePropertyNames = [ - 'specular', - 'opacity', - 'diffuse', - - 'map', - 'matcap', - 'gradientMap', - - 'lightMap', - 'lightMapIntensity', - - 'aoMap', - 'aoMapIntensity', - - 'emissive', - 'emissiveMap', - - 'bumpMap', - 'bumpScale', - - 'normalMap', - 'normalScale', - - 'displacemantBias', - 'displacemantMap', - 'displacemantScale', - - 'specularMap', - - 'alphaMap', - - 'reflectivity', - 'refractionRatio', - ]; - for ( const propertyName of exposePropertyNames ) { - - Object.defineProperty( this, propertyName, { - - get: function () { - - return this.uniforms[ propertyName ].value; - - }, - - set: function ( value ) { - - this.uniforms[ propertyName ].value = value; - - }, - - } ); - - } - - // Special path for shininess to handle zero shininess properly - this._shininess = 30; - Object.defineProperty( this, 'shininess', { - - get: function () { - - return this._shininess; - - }, - - set: function ( value ) { - - this._shininess = value; - this.uniforms.shininess.value = Math.max( this._shininess, 1e-4 ); // To prevent pow( 0.0, 0.0 ) - - }, - - } ); - - Object.defineProperty( - this, - 'color', - Object.getOwnPropertyDescriptor( this, 'diffuse' ) - ); - - this.setValues( parameters ); - - } - - copy( source ) { - - super.copy( source ); - - this.matcapCombine = source.matcapCombine; - this.emissiveIntensity = source.emissiveIntensity; - this.normalMapType = source.normalMapType; - - this.combine = source.combine; - - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.flatShading = source.flatShading; - - return this; - - } - -} - -export { MMDLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MMDToonShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MMDToonShader.js deleted file mode 100644 index 72f1fcb..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MMDToonShader.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * MMD Toon Shader - * - * This shader is extended from MeshPhongMaterial, and merged algorithms with - * MeshToonMaterial and MeshMetcapMaterial. - * Ideas came from https://github.com/mrdoob/three.js/issues/19609 - * - * Combining steps: - * * Declare matcap uniform. - * * Add gradientmap_pars_fragment. - * * Use gradient irradiances instead of dotNL irradiance from MeshPhongMaterial. - * (Replace lights_phong_pars_fragment with lights_mmd_toon_pars_fragment) - * * Add mmd_toon_matcap_fragment. - */ - -import { UniformsUtils, ShaderLib } from '/static/javascript/three/build/three.module.js'; - -const lights_mmd_toon_pars_fragment = /* glsl */` -varying vec3 vViewPosition; - -struct BlinnPhongMaterial { - - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; - -}; - -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; - -} - -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - -} - -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong -`; - -const mmd_toon_matcap_fragment = /* glsl */` -#ifdef USE_MATCAP - - 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; // 0.495 to remove artifacts caused by undersized matcap disks - vec4 matcapColor = texture2D( matcap, uv ); - - #ifdef MATCAP_BLENDING_MULTIPLY - - outgoingLight *= matcapColor.rgb; - - #elif defined( MATCAP_BLENDING_ADD ) - - outgoingLight += matcapColor.rgb; - - #endif - -#endif -`; - -const MMDToonShader = { - - name: 'MMDToonShader', - - defines: { - TOON: true, - MATCAP: true, - MATCAP_BLENDING_ADD: true, - }, - - uniforms: UniformsUtils.merge( [ - ShaderLib.toon.uniforms, - ShaderLib.phong.uniforms, - ShaderLib.matcap.uniforms, - ] ), - - vertexShader: - ShaderLib.phong.vertexShader - .replace( - '#include ', - '' - ) - .replace( - '#include ', - '' - ), - - fragmentShader: - ShaderLib.phong.fragmentShader - .replace( - '#include ', - ` - #ifdef USE_MATCAP - uniform sampler2D matcap; - #endif - - #include - ` - ) - .replace( - '#include ', - ` - #include - ` - ) - .replace( - '#include ', - '' - ) - .replace( - '#include ', - lights_mmd_toon_pars_fragment - ) - .replace( - '#include ', - ` - ${mmd_toon_matcap_fragment} - ` - ) - -}; - -export { MMDToonShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MTLLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MTLLoader.js deleted file mode 100644 index 62c2d86..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MTLLoader.js +++ /dev/null @@ -1,567 +0,0 @@ -import { - Color, - DefaultLoadingManager, - FileLoader, - FrontSide, - Loader, - LoaderUtils, - MeshPhongMaterial, - RepeatWrapping, - TextureLoader, - Vector2, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; - -/** - * Loads a Wavefront .mtl file specifying materials - */ - -class MTLLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - /** - * Loads and parses a MTL asset from a URL. - * - * @param {String} url - URL to the MTL file. - * @param {Function} [onLoad] - Callback invoked with the loaded object. - * @param {Function} [onProgress] - Callback for download progress. - * @param {Function} [onError] - Callback for download errors. - * - * @see setPath setResourcePath - * - * @note In order for relative texture references to resolve correctly - * you must call setResourcePath() explicitly prior to load. - */ - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const path = ( this.path === '' ) ? LoaderUtils.extractUrlBase( url ) : this.path; - - 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( text, path ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - setMaterialOptions( value ) { - - this.materialOptions = value; - return this; - - } - - /** - * Parses a MTL file. - * - * @param {String} text - Content of MTL file - * @return {MaterialCreator} - * - * @see setPath setResourcePath - * - * @note In order for relative texture references to resolve correctly - * you must call setResourcePath() explicitly prior to parse. - */ - parse( text, path ) { - - const lines = text.split( '\n' ); - let info = {}; - const delimiter_pattern = /\s+/; - const materialsInfo = {}; - - for ( let i = 0; i < lines.length; i ++ ) { - - let line = lines[ i ]; - line = line.trim(); - - if ( line.length === 0 || line.charAt( 0 ) === '#' ) { - - // Blank line or comment ignore - continue; - - } - - const pos = line.indexOf( ' ' ); - - let key = ( pos >= 0 ) ? line.substring( 0, pos ) : line; - key = key.toLowerCase(); - - let value = ( pos >= 0 ) ? line.substring( pos + 1 ) : ''; - value = value.trim(); - - if ( key === 'newmtl' ) { - - // New material - - info = { name: value }; - materialsInfo[ value ] = info; - - } else { - - if ( key === 'ka' || key === 'kd' || key === 'ks' || key === 'ke' ) { - - const ss = value.split( delimiter_pattern, 3 ); - info[ key ] = [ parseFloat( ss[ 0 ] ), parseFloat( ss[ 1 ] ), parseFloat( ss[ 2 ] ) ]; - - } else { - - info[ key ] = value; - - } - - } - - } - - const materialCreator = new MaterialCreator( this.resourcePath || path, this.materialOptions ); - materialCreator.setCrossOrigin( this.crossOrigin ); - materialCreator.setManager( this.manager ); - materialCreator.setMaterials( materialsInfo ); - return materialCreator; - - } - -} - -/** - * Create a new MTLLoader.MaterialCreator - * @param baseUrl - Url relative to which textures are loaded - * @param options - Set of options on how to construct the materials - * side: Which side to apply the material - * FrontSide (default), THREE.BackSide, THREE.DoubleSide - * wrap: What type of wrapping to apply for textures - * RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping - * normalizeRGB: RGBs need to be normalized to 0-1 from 0-255 - * Default: false, assumed to be already normalized - * ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's - * Default: false - * @constructor - */ - -class MaterialCreator { - - constructor( baseUrl = '', options = {} ) { - - this.baseUrl = baseUrl; - this.options = options; - this.materialsInfo = {}; - this.materials = {}; - this.materialsArray = []; - this.nameLookup = {}; - - this.crossOrigin = 'anonymous'; - - this.side = ( this.options.side !== undefined ) ? this.options.side : FrontSide; - this.wrap = ( this.options.wrap !== undefined ) ? this.options.wrap : RepeatWrapping; - - } - - setCrossOrigin( value ) { - - this.crossOrigin = value; - return this; - - } - - setManager( value ) { - - this.manager = value; - - } - - setMaterials( materialsInfo ) { - - this.materialsInfo = this.convert( materialsInfo ); - this.materials = {}; - this.materialsArray = []; - this.nameLookup = {}; - - } - - convert( materialsInfo ) { - - if ( ! this.options ) return materialsInfo; - - const converted = {}; - - for ( const mn in materialsInfo ) { - - // Convert materials info into normalized form based on options - - const mat = materialsInfo[ mn ]; - - const covmat = {}; - - converted[ mn ] = covmat; - - for ( const prop in mat ) { - - let save = true; - let value = mat[ prop ]; - const lprop = prop.toLowerCase(); - - switch ( lprop ) { - - case 'kd': - case 'ka': - case 'ks': - - // Diffuse color (color under white light) using RGB values - - if ( this.options && this.options.normalizeRGB ) { - - value = [ value[ 0 ] / 255, value[ 1 ] / 255, value[ 2 ] / 255 ]; - - } - - if ( this.options && this.options.ignoreZeroRGBs ) { - - if ( value[ 0 ] === 0 && value[ 1 ] === 0 && value[ 2 ] === 0 ) { - - // ignore - - save = false; - - } - - } - - break; - - default: - - break; - - } - - if ( save ) { - - covmat[ lprop ] = value; - - } - - } - - } - - return converted; - - } - - preload() { - - for ( const mn in this.materialsInfo ) { - - this.create( mn ); - - } - - } - - getIndex( materialName ) { - - return this.nameLookup[ materialName ]; - - } - - getAsArray() { - - let index = 0; - - for ( const mn in this.materialsInfo ) { - - this.materialsArray[ index ] = this.create( mn ); - this.nameLookup[ mn ] = index; - index ++; - - } - - return this.materialsArray; - - } - - create( materialName ) { - - if ( this.materials[ materialName ] === undefined ) { - - this.createMaterial_( materialName ); - - } - - return this.materials[ materialName ]; - - } - - createMaterial_( materialName ) { - - // Create material - - const scope = this; - const mat = this.materialsInfo[ materialName ]; - const params = { - - name: materialName, - side: this.side - - }; - - function resolveURL( baseUrl, url ) { - - if ( typeof url !== 'string' || url === '' ) - return ''; - - // Absolute URL - if ( /^https?:\/\//i.test( url ) ) return url; - - return baseUrl + url; - - } - - function setMapForType( mapType, value ) { - - if ( params[ mapType ] ) return; // Keep the first encountered texture - - const texParams = scope.getTextureParams( value, params ); - const map = scope.loadTexture( resolveURL( scope.baseUrl, texParams.url ) ); - - map.repeat.copy( texParams.scale ); - map.offset.copy( texParams.offset ); - - map.wrapS = scope.wrap; - map.wrapT = scope.wrap; - - if ( mapType === 'map' || mapType === 'emissiveMap' ) { - - map.colorSpace = SRGBColorSpace; - - } - - params[ mapType ] = map; - - } - - for ( const prop in mat ) { - - const value = mat[ prop ]; - let n; - - if ( value === '' ) continue; - - switch ( prop.toLowerCase() ) { - - // Ns is material specular exponent - - case 'kd': - - // Diffuse color (color under white light) using RGB values - - params.color = new Color().fromArray( value ).convertSRGBToLinear(); - - break; - - case 'ks': - - // Specular color (color when light is reflected from shiny surface) using RGB values - params.specular = new Color().fromArray( value ).convertSRGBToLinear(); - - break; - - case 'ke': - - // Emissive using RGB values - params.emissive = new Color().fromArray( value ).convertSRGBToLinear(); - - break; - - case 'map_kd': - - // Diffuse texture map - - setMapForType( 'map', value ); - - break; - - case 'map_ks': - - // Specular map - - setMapForType( 'specularMap', value ); - - break; - - case 'map_ke': - - // Emissive map - - setMapForType( 'emissiveMap', value ); - - break; - - case 'norm': - - setMapForType( 'normalMap', value ); - - break; - - case 'map_bump': - case 'bump': - - // Bump texture map - - setMapForType( 'bumpMap', value ); - - break; - - case 'map_d': - - // Alpha map - - setMapForType( 'alphaMap', value ); - params.transparent = true; - - break; - - case 'ns': - - // The specular exponent (defines the focus of the specular highlight) - // A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000. - - params.shininess = parseFloat( value ); - - break; - - case 'd': - n = parseFloat( value ); - - if ( n < 1 ) { - - params.opacity = n; - params.transparent = true; - - } - - break; - - case 'tr': - n = parseFloat( value ); - - if ( this.options && this.options.invertTrProperty ) n = 1 - n; - - if ( n > 0 ) { - - params.opacity = 1 - n; - params.transparent = true; - - } - - break; - - default: - break; - - } - - } - - this.materials[ materialName ] = new MeshPhongMaterial( params ); - return this.materials[ materialName ]; - - } - - getTextureParams( value, matParams ) { - - const texParams = { - - scale: new Vector2( 1, 1 ), - offset: new Vector2( 0, 0 ) - - }; - - const items = value.split( /\s+/ ); - let pos; - - pos = items.indexOf( '-bm' ); - - if ( pos >= 0 ) { - - matParams.bumpScale = parseFloat( items[ pos + 1 ] ); - items.splice( pos, 2 ); - - } - - pos = items.indexOf( '-s' ); - - if ( pos >= 0 ) { - - texParams.scale.set( parseFloat( items[ pos + 1 ] ), parseFloat( items[ pos + 2 ] ) ); - items.splice( pos, 4 ); // we expect 3 parameters here! - - } - - pos = items.indexOf( '-o' ); - - if ( pos >= 0 ) { - - texParams.offset.set( parseFloat( items[ pos + 1 ] ), parseFloat( items[ pos + 2 ] ) ); - items.splice( pos, 4 ); // we expect 3 parameters here! - - } - - texParams.url = items.join( ' ' ).trim(); - return texParams; - - } - - loadTexture( url, mapping, onLoad, onProgress, onError ) { - - const manager = ( this.manager !== undefined ) ? this.manager : DefaultLoadingManager; - let loader = manager.getHandler( url ); - - if ( loader === null ) { - - loader = new TextureLoader( manager ); - - } - - if ( loader.setCrossOrigin ) loader.setCrossOrigin( this.crossOrigin ); - - const texture = loader.load( url, onLoad, onProgress, onError ); - - if ( mapping !== undefined ) texture.mapping = mapping; - - return texture; - - } - -} - -export { MTLLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MaterialXLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MaterialXLoader.js deleted file mode 100644 index 966ec6f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MaterialXLoader.js +++ /dev/null @@ -1,845 +0,0 @@ -import { - FileLoader, Loader, TextureLoader, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial, RepeatWrapping, - float, bool, int, vec2, vec3, vec4, color, texture, - positionLocal, positionWorld, uv, vertexColor, - normalLocal, normalWorld, tangentLocal, tangentWorld, - add, sub, mul, div, mod, abs, sign, floor, ceil, round, pow, sin, cos, tan, - asin, acos, atan2, sqrt, exp, clamp, min, max, normalize, length, dot, cross, normalMap, - remap, smoothstep, luminance, mx_rgbtohsv, mx_hsvtorgb, - mix, - mx_ramplr, mx_ramptb, mx_splitlr, mx_splittb, - mx_fractal_noise_float, mx_noise_float, mx_cell_noise_float, mx_worley_noise_float, - mx_transform_uv, - mx_safepower, mx_contrast, - mx_srgb_texture_to_lin_rec709, - saturation -} from '/static/javascript/three/build/three.module.js'; - -const colorSpaceLib = { - mx_srgb_texture_to_lin_rec709 -}; - -class MXElement { - - constructor( name, nodeFunc, params = null ) { - - this.name = name; - this.nodeFunc = nodeFunc; - this.params = params; - - } - -} - -// Ref: https://github.com/mrdoob/three.js/issues/24674 - -const mx_add = ( in1, in2 = float( 0 ) ) => add( in1, in2 ); -const mx_subtract = ( in1, in2 = float( 0 ) ) => sub( in1, in2 ); -const mx_multiply = ( in1, in2 = float( 1 ) ) => mul( in1, in2 ); -const mx_divide = ( in1, in2 = float( 1 ) ) => div( in1, in2 ); -const mx_modulo = ( in1, in2 = float( 1 ) ) => mod( in1, in2 ); -const mx_power = ( in1, in2 = float( 1 ) ) => pow( in1, in2 ); -const mx_atan2 = ( in1 = float( 0 ), in2 = float( 1 ) ) => atan2( in1, in2 ); - -const MXElements = [ - - // << Math >> - new MXElement( 'add', mx_add, [ 'in1', 'in2' ] ), - new MXElement( 'subtract', mx_subtract, [ 'in1', 'in2' ] ), - new MXElement( 'multiply', mx_multiply, [ 'in1', 'in2' ] ), - new MXElement( 'divide', mx_divide, [ 'in1', 'in2' ] ), - new MXElement( 'modulo', mx_modulo, [ 'in1', 'in2' ] ), - new MXElement( 'absval', abs, [ 'in1', 'in2' ] ), - new MXElement( 'sign', sign, [ 'in1', 'in2' ] ), - new MXElement( 'floor', floor, [ 'in1', 'in2' ] ), - new MXElement( 'ceil', ceil, [ 'in1', 'in2' ] ), - new MXElement( 'round', round, [ 'in1', 'in2' ] ), - new MXElement( 'power', mx_power, [ 'in1', 'in2' ] ), - new MXElement( 'sin', sin, [ 'in' ] ), - new MXElement( 'cos', cos, [ 'in' ] ), - new MXElement( 'tan', tan, [ 'in' ] ), - new MXElement( 'asin', asin, [ 'in' ] ), - new MXElement( 'acos', acos, [ 'in' ] ), - new MXElement( 'atan2', mx_atan2, [ 'in1', 'in2' ] ), - new MXElement( 'sqrt', sqrt, [ 'in' ] ), - //new MtlXElement( 'ln', ... ), - new MXElement( 'exp', exp, [ 'in' ] ), - new MXElement( 'clamp', clamp, [ 'in', 'low', 'high' ] ), - new MXElement( 'min', min, [ 'in1', 'in2' ] ), - new MXElement( 'max', max, [ 'in1', 'in2' ] ), - new MXElement( 'normalize', normalize, [ 'in' ] ), - new MXElement( 'magnitude', length, [ 'in1', 'in2' ] ), - new MXElement( 'dotproduct', dot, [ 'in1', 'in2' ] ), - new MXElement( 'crossproduct', cross, [ 'in' ] ), - //new MtlXElement( 'transformpoint', ... ), - //new MtlXElement( 'transformvector', ... ), - //new MtlXElement( 'transformnormal', ... ), - //new MtlXElement( 'transformmatrix', ... ), - new MXElement( 'normalmap', normalMap, [ 'in', 'scale' ] ), - //new MtlXElement( 'transpose', ... ), - //new MtlXElement( 'determinant', ... ), - //new MtlXElement( 'invertmatrix', ... ), - //new MtlXElement( 'rotate2d', rotateUV, [ 'in', radians( 'amount' )** ] ), - //new MtlXElement( 'rotate3d', ... ), - //new MtlXElement( 'arrayappend', ... ), - //new MtlXElement( 'dot', ... ), - - // << Adjustment >> - new MXElement( 'remap', remap, [ 'in', 'inlow', 'inhigh', 'outlow', 'outhigh' ] ), - new MXElement( 'smoothstep', smoothstep, [ 'in', 'low', 'high' ] ), - //new MtlXElement( 'curveadjust', ... ), - //new MtlXElement( 'curvelookup', ... ), - new MXElement( 'luminance', luminance, [ 'in', 'lumacoeffs' ] ), - new MXElement( 'rgbtohsv', mx_rgbtohsv, [ 'in' ] ), - new MXElement( 'hsvtorgb', mx_hsvtorgb, [ 'in' ] ), - - // << Mix >> - new MXElement( 'mix', mix, [ 'bg', 'fg', 'mix' ] ), - - // << Channel >> - new MXElement( 'combine2', vec2, [ 'in1', 'in2' ] ), - new MXElement( 'combine3', vec3, [ 'in1', 'in2', 'in3' ] ), - new MXElement( 'combine4', vec4, [ 'in1', 'in2', 'in3', 'in4' ] ), - - // << Procedural >> - new MXElement( 'ramplr', mx_ramplr, [ 'valuel', 'valuer', 'texcoord' ] ), - new MXElement( 'ramptb', mx_ramptb, [ 'valuet', 'valueb', 'texcoord' ] ), - new MXElement( 'splitlr', mx_splitlr, [ 'valuel', 'valuer', 'texcoord' ] ), - new MXElement( 'splittb', mx_splittb, [ 'valuet', 'valueb', 'texcoord' ] ), - new MXElement( 'noise2d', mx_noise_float, [ 'texcoord', 'amplitude', 'pivot' ] ), - new MXElement( 'noise3d', mx_noise_float, [ 'texcoord', 'amplitude', 'pivot' ] ), - new MXElement( 'fractal3d', mx_fractal_noise_float, [ 'position', 'octaves', 'lacunarity', 'diminish', 'amplitude' ] ), - new MXElement( 'cellnoise2d', mx_cell_noise_float, [ 'texcoord' ] ), - new MXElement( 'cellnoise3d', mx_cell_noise_float, [ 'texcoord' ] ), - new MXElement( 'worleynoise2d', mx_worley_noise_float, [ 'texcoord', 'jitter' ] ), - new MXElement( 'worleynoise3d', mx_worley_noise_float, [ 'texcoord', 'jitter' ] ), - - // << Supplemental >> - //new MtlXElement( 'tiledimage', ... ), - //new MtlXElement( 'triplanarprojection', triplanarTextures, [ 'filex', 'filey', 'filez' ] ), - //new MtlXElement( 'ramp4', ... ), - //new MtlXElement( 'place2d', mx_place2d, [ 'texcoord', 'pivot', 'scale', 'rotate', 'offset' ] ), - new MXElement( 'safepower', mx_safepower, [ 'in1', 'in2' ] ), - new MXElement( 'contrast', mx_contrast, [ 'in', 'amount', 'pivot' ] ), - //new MtlXElement( 'hsvadjust', ... ), - new MXElement( 'saturate', saturation, [ 'in', 'amount' ] ), - //new MtlXElement( 'extract', ... ), - //new MtlXElement( 'separate2', ... ), - //new MtlXElement( 'separate3', ... ), - //new MtlXElement( 'separate4', ... ) - -]; - -const MtlXLibrary = {}; -MXElements.forEach( element => MtlXLibrary[ element.name ] = element ); - -class MaterialXLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - } - - load( url, onLoad, onProgress, onError ) { - - const _onError = function ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - }; - - new FileLoader( this.manager ) - .setPath( this.path ) - .load( url, async ( text ) => { - - try { - - onLoad( this.parse( text ) ); - - } catch ( e ) { - - _onError( e ); - - } - - }, onProgress, _onError ); - - return this; - - } - - parse( text ) { - - return new MaterialX( this.manager, this.path ).parse( text ); - - } - -} - -class MaterialXNode { - - constructor( materialX, nodeXML, nodePath = '' ) { - - this.materialX = materialX; - this.nodeXML = nodeXML; - this.nodePath = nodePath ? nodePath + '/' + this.name : this.name; - - this.parent = null; - - this.node = null; - - this.children = []; - - } - - get element() { - - return this.nodeXML.nodeName; - - } - - get nodeGraph() { - - return this.getAttribute( 'nodegraph' ); - - } - - get nodeName() { - - return this.getAttribute( 'nodename' ); - - } - - get interfaceName() { - - return this.getAttribute( 'interfacename' ); - - } - - get output() { - - return this.getAttribute( 'output' ); - - } - - get name() { - - return this.getAttribute( 'name' ); - - } - - get type() { - - return this.getAttribute( 'type' ); - - } - - get value() { - - return this.getAttribute( 'value' ); - - } - - getNodeGraph() { - - let nodeX = this; - - while ( nodeX !== null ) { - - if ( nodeX.element === 'nodegraph' ) { - - break; - - } - - nodeX = nodeX.parent; - - } - - return nodeX; - - } - - getRoot() { - - let nodeX = this; - - while ( nodeX.parent !== null ) { - - nodeX = nodeX.parent; - - } - - return nodeX; - - } - - get referencePath() { - - let referencePath = null; - - if ( this.nodeGraph !== null && this.output !== null ) { - - referencePath = this.nodeGraph + '/' + this.output; - - } else if ( this.nodeName !== null || this.interfaceName !== null ) { - - referencePath = this.getNodeGraph().nodePath + '/' + ( this.nodeName || this.interfaceName ); - - } - - return referencePath; - - } - - get hasReference() { - - return this.referencePath !== null; - - } - - get isConst() { - - return this.element === 'input' && this.value !== null && this.type !== 'filename'; - - } - - getColorSpaceNode() { - - const csSource = this.getAttribute( 'colorspace' ); - const csTarget = this.getRoot().getAttribute( 'colorspace' ); - - const nodeName = `mx_${ csSource }_to_${ csTarget }`; - - return colorSpaceLib[ nodeName ]; - - } - - getTexture() { - - const filePrefix = this.getRecursiveAttribute( 'fileprefix' ) || ''; - - let loader = this.materialX.textureLoader; - const uri = filePrefix + this.value; - - if ( uri ) { - - const handler = this.materialX.manager.getHandler( uri ); - if ( handler !== null ) loader = handler; - - } - - const texture = loader.load( uri ); - texture.wrapS = texture.wrapT = RepeatWrapping; - texture.flipY = false; - - return texture; - - } - - getClassFromType( type ) { - - let nodeClass = null; - - if ( type === 'integer' ) nodeClass = int; - else if ( type === 'float' ) nodeClass = float; - else if ( type === 'vector2' ) nodeClass = vec2; - else if ( type === 'vector3' ) nodeClass = vec3; - else if ( type === 'vector4' || type === 'color4' ) nodeClass = vec4; - else if ( type === 'color3' ) nodeClass = color; - else if ( type === 'boolean' ) nodeClass = bool; - - return nodeClass; - - } - - getNode() { - - let node = this.node; - - if ( node !== null ) { - - return node; - - } - - // - - const type = this.type; - - if ( this.isConst ) { - - const nodeClass = this.getClassFromType( type ); - - node = nodeClass( ...this.getVector() ); - - } else if ( this.hasReference ) { - - node = this.materialX.getMaterialXNode( this.referencePath ).getNode(); - - } else { - - const element = this.element; - - if ( element === 'convert' ) { - - const nodeClass = this.getClassFromType( type ); - - node = nodeClass( this.getNodeByName( 'in' ) ); - - } else if ( element === 'constant' ) { - - node = this.getNodeByName( 'value' ); - - } else if ( element === 'position' ) { - - const space = this.getAttribute( 'space' ); - node = space === 'world' ? positionWorld : positionLocal; - - } else if ( element === 'normal' ) { - - const space = this.getAttribute( 'space' ); - node = space === 'world' ? normalWorld : normalLocal; - - } else if ( element === 'tangent' ) { - - const space = this.getAttribute( 'space' ); - node = space === 'world' ? tangentWorld : tangentLocal; - - } else if ( element === 'texcoord' ) { - - const indexNode = this.getChildByName( 'index' ); - const index = indexNode ? parseInt( indexNode.value ) : 0; - - node = uv( index ); - - } else if ( element === 'geomcolor' ) { - - const indexNode = this.getChildByName( 'index' ); - const index = indexNode ? parseInt( indexNode.value ) : 0; - - node = vertexColor( index ); - - } else if ( element === 'tiledimage' ) { - - const file = this.getChildByName( 'file' ); - - const textureFile = file.getTexture(); - const uvTiling = mx_transform_uv( ...this.getNodesByNames( [ 'uvtiling', 'uvoffset' ] ) ); - - node = texture( textureFile, uvTiling ); - - const colorSpaceNode = file.getColorSpaceNode(); - - if ( colorSpaceNode ) { - - node = colorSpaceNode( node ); - - } - - } else if ( element === 'image' ) { - - const file = this.getChildByName( 'file' ); - const uvNode = this.getNodeByName( 'texcoord' ); - - const textureFile = file.getTexture(); - - node = texture( textureFile, uvNode ); - - const colorSpaceNode = file.getColorSpaceNode(); - - if ( colorSpaceNode ) { - - node = colorSpaceNode( node ); - - } - - } else if ( MtlXLibrary[ element ] !== undefined ) { - - const nodeElement = MtlXLibrary[ element ]; - - node = nodeElement.nodeFunc( ...this.getNodesByNames( ...nodeElement.params ) ); - - } - - } - - // - - if ( node === null ) { - - console.warn( `THREE.MaterialXLoader: Unexpected node ${ new XMLSerializer().serializeToString( this.nodeXML ) }.` ); - - node = float( 0 ); - - } - - // - - const nodeToTypeClass = this.getClassFromType( type ); - - if ( nodeToTypeClass !== null ) { - - node = nodeToTypeClass( node ); - - } - - node.name = this.name; - - this.node = node; - - return node; - - } - - getChildByName( name ) { - - for ( const input of this.children ) { - - if ( input.name === name ) { - - return input; - - } - - } - - } - - getNodes() { - - const nodes = {}; - - for ( const input of this.children ) { - - const node = input.getNode(); - - nodes[ node.name ] = node; - - } - - return nodes; - - } - - getNodeByName( name ) { - - const child = this.getChildByName( name ); - - return child ? child.getNode() : undefined; - - } - - getNodesByNames( ...names ) { - - const nodes = []; - - for ( const name of names ) { - - const node = this.getNodeByName( name ); - - if ( node ) nodes.push( node ); - - } - - return nodes; - - } - - getValue() { - - return this.value.trim(); - - } - - getVector() { - - const vector = []; - - for ( const val of this.getValue().split( /[,|\s]/ ) ) { - - if ( val !== '' ) { - - vector.push( Number( val.trim() ) ); - - } - - } - - return vector; - - } - - getAttribute( name ) { - - return this.nodeXML.getAttribute( name ); - - } - - getRecursiveAttribute( name ) { - - let attribute = this.nodeXML.getAttribute( name ); - - if ( attribute === null && this.parent !== null ) { - - attribute = this.parent.getRecursiveAttribute( name ); - - } - - return attribute; - - } - - setStandardSurfaceToGltfPBR( material ) { - - const inputs = this.getNodes(); - - // - - let colorNode = null; - - if ( inputs.base && inputs.base_color ) colorNode = mul( inputs.base, inputs.base_color ); - else if ( inputs.base ) colorNode = inputs.base; - else if ( inputs.base_color ) colorNode = inputs.base_color; - - // - - let roughnessNode = null; - - if ( inputs.specular_roughness ) roughnessNode = inputs.specular_roughness; - - // - - let metalnessNode = null; - - if ( inputs.metalness ) metalnessNode = inputs.metalness; - - // - - let clearcoatNode = null; - let clearcoatRoughnessNode = null; - - if ( inputs.coat ) clearcoatNode = inputs.coat; - if ( inputs.coat_roughness ) clearcoatRoughnessNode = inputs.coat_roughness; - - if ( inputs.coat_color ) { - - colorNode = colorNode ? mul( colorNode, inputs.coat_color ) : colorNode; - - } - - // - - let normalNode = null; - - if ( inputs.normal ) normalNode = inputs.normal; - - // - - let emissiveNode = null; - - if ( inputs.emission ) emissiveNode = inputs.emission; - if ( inputs.emissionColor ) { - - emissiveNode = emissiveNode ? mul( emissiveNode, inputs.emissionColor ) : emissiveNode; - - } - - // - - material.colorNode = colorNode || color( 0.8, 0.8, 0.8 ); - material.roughnessNode = roughnessNode || float( 0.2 ); - material.metalnessNode = metalnessNode || float( 0 ); - material.clearcoatNode = clearcoatNode || float( 0 ); - material.clearcoatRoughnessNode = clearcoatRoughnessNode || float( 0 ); - if ( normalNode ) material.normalNode = normalNode; - if ( emissiveNode ) material.emissiveNode = emissiveNode; - - } - - /*setGltfPBR( material ) { - - const inputs = this.getNodes(); - - console.log( inputs ); - - }*/ - - setMaterial( material ) { - - const element = this.element; - - if ( element === 'gltf_pbr' ) { - - //this.setGltfPBR( material ); - - } else if ( element === 'standard_surface' ) { - - this.setStandardSurfaceToGltfPBR( material ); - - } - - } - - toBasicMaterial() { - - const material = new MeshBasicNodeMaterial(); - material.name = this.name; - - for ( const nodeX of this.children.toReversed() ) { - - if ( nodeX.name === 'out' ) { - - material.colorNode = nodeX.getNode(); - - break; - - } - - } - - return material; - - } - - toPhysicalMaterial() { - - const material = new MeshPhysicalNodeMaterial(); - material.name = this.name; - - for ( const nodeX of this.children ) { - - const shaderProperties = this.materialX.getMaterialXNode( nodeX.nodeName ); - shaderProperties.setMaterial( material ); - - } - - return material; - - } - - toMaterials() { - - const materials = {}; - - let isUnlit = true; - - for ( const nodeX of this.children ) { - - if ( nodeX.element === 'surfacematerial' ) { - - const material = nodeX.toPhysicalMaterial(); - - materials[ material.name ] = material; - - isUnlit = false; - - } - - } - - if ( isUnlit ) { - - for ( const nodeX of this.children ) { - - if ( nodeX.element === 'nodegraph' ) { - - const material = nodeX.toBasicMaterial(); - - materials[ material.name ] = material; - - } - - } - - } - - return materials; - - } - - add( materialXNode ) { - - materialXNode.parent = this; - - this.children.push( materialXNode ); - - } - -} - -class MaterialX { - - constructor( manager, path ) { - - this.manager = manager; - this.path = path; - this.resourcePath = ''; - - this.nodesXLib = new Map(); - //this.nodesXRefLib = new WeakMap(); - - this.textureLoader = new TextureLoader( manager ); - - } - - addMaterialXNode( materialXNode ) { - - this.nodesXLib.set( materialXNode.nodePath, materialXNode ); - - } - - /*getMaterialXNodeFromXML( xmlNode ) { - - return this.nodesXRefLib.get( xmlNode ); - - }*/ - - getMaterialXNode( ...names ) { - - return this.nodesXLib.get( names.join( '/' ) ); - - } - - parseNode( nodeXML, nodePath = '' ) { - - const materialXNode = new MaterialXNode( this, nodeXML, nodePath ); - if ( materialXNode.nodePath ) this.addMaterialXNode( materialXNode ); - - for ( const childNodeXML of nodeXML.children ) { - - const childMXNode = this.parseNode( childNodeXML, materialXNode.nodePath ); - materialXNode.add( childMXNode ); - - } - - return materialXNode; - - } - - parse( text ) { - - const rootXML = new DOMParser().parseFromString( text, 'application/xml' ).documentElement; - - this.textureLoader.setPath( this.path ); - - // - - const materials = this.parseNode( rootXML ).toMaterials(); - - return { materials }; - - } - -} - -export { MaterialXLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/MirrorShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/MirrorShader.js deleted file mode 100644 index c5c4a3e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/MirrorShader.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Mirror Shader - * Copies half the input to the other half - * - * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom) - */ - -const MirrorShader = { - - name: 'MirrorShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'side': { value: 1 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform int side; - - varying vec2 vUv; - - void main() { - - vec2 p = vUv; - if (side == 0){ - if (p.x > 0.5) p.x = 1.0 - p.x; - }else if (side == 1){ - if (p.x < 0.5) p.x = 1.0 - p.x; - }else if (side == 2){ - if (p.y < 0.5) p.y = 1.0 - p.y; - }else if (side == 3){ - if (p.y > 0.5) p.y = 1.0 - p.y; - } - vec4 color = texture2D(tDiffuse, p); - gl_FragColor = color; - - }` - -}; - -export { MirrorShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/NRRDLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/NRRDLoader.js deleted file mode 100644 index 67bb12b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/NRRDLoader.js +++ /dev/null @@ -1,686 +0,0 @@ -import { - FileLoader, - Loader, - Matrix4, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; -import { Volume } from '../misc/Volume.js'; - -class NRRDLoader 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.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( data ) { - - try { - - onLoad( scope.parse( data ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - /** - * - * @param {boolean} segmentation is a option for user to choose - */ - setSegmentation( segmentation ) { - - this.segmentation = segmentation; - - } - - parse( data ) { - - // this parser is largely inspired from the XTK NRRD parser : https://github.com/xtk/X - - let _data = data; - - let _dataPointer = 0; - - const _nativeLittleEndian = new Int8Array( new Int16Array( [ 1 ] ).buffer )[ 0 ] > 0; - - const _littleEndian = true; - - const headerObject = {}; - - function scan( type, chunks ) { - - let _chunkSize = 1; - let _array_type = Uint8Array; - - switch ( type ) { - - // 1 byte data types - case 'uchar': - break; - case 'schar': - _array_type = Int8Array; - break; - // 2 byte data types - case 'ushort': - _array_type = Uint16Array; - _chunkSize = 2; - break; - case 'sshort': - _array_type = Int16Array; - _chunkSize = 2; - break; - // 4 byte data types - case 'uint': - _array_type = Uint32Array; - _chunkSize = 4; - break; - case 'sint': - _array_type = Int32Array; - _chunkSize = 4; - break; - case 'float': - _array_type = Float32Array; - _chunkSize = 4; - break; - case 'complex': - _array_type = Float64Array; - _chunkSize = 8; - break; - case 'double': - _array_type = Float64Array; - _chunkSize = 8; - break; - - } - - // increase the data pointer in-place - let _bytes = new _array_type( _data.slice( _dataPointer, - _dataPointer += chunks * _chunkSize ) ); - - // if required, flip the endianness of the bytes - if ( _nativeLittleEndian != _littleEndian ) { - - // we need to flip here since the format doesn't match the native endianness - _bytes = flipEndianness( _bytes, _chunkSize ); - - } - - // return the byte array - return _bytes; - - } - - //Flips typed array endianness in-place. Based on https://github.com/kig/DataStream.js/blob/master/DataStream.js. - - function flipEndianness( array, chunkSize ) { - - const u8 = new Uint8Array( array.buffer, array.byteOffset, array.byteLength ); - for ( let i = 0; i < array.byteLength; i += chunkSize ) { - - for ( let j = i + chunkSize - 1, k = i; j > k; j --, k ++ ) { - - const tmp = u8[ k ]; - u8[ k ] = u8[ j ]; - u8[ j ] = tmp; - - } - - } - - return array; - - } - - //parse the header - function parseHeader( header ) { - - let data, field, fn, i, l, m, _i, _len; - const lines = header.split( /\r?\n/ ); - for ( _i = 0, _len = lines.length; _i < _len; _i ++ ) { - - l = lines[ _i ]; - if ( l.match( /NRRD\d+/ ) ) { - - headerObject.isNrrd = true; - - } else if ( ! l.match( /^#/ ) && ( m = l.match( /(.*):(.*)/ ) ) ) { - - field = m[ 1 ].trim(); - data = m[ 2 ].trim(); - fn = _fieldFunctions[ field ]; - if ( fn ) { - - fn.call( headerObject, data ); - - } else { - - headerObject[ field ] = data; - - } - - } - - } - - if ( ! headerObject.isNrrd ) { - - throw new Error( 'Not an NRRD file' ); - - } - - if ( headerObject.encoding === 'bz2' || headerObject.encoding === 'bzip2' ) { - - throw new Error( 'Bzip is not supported' ); - - } - - if ( ! headerObject.vectors ) { - - //if no space direction is set, let's use the identity - headerObject.vectors = [ ]; - headerObject.vectors.push( [ 1, 0, 0 ] ); - headerObject.vectors.push( [ 0, 1, 0 ] ); - headerObject.vectors.push( [ 0, 0, 1 ] ); - - //apply spacing if defined - if ( headerObject.spacings ) { - - for ( i = 0; i <= 2; i ++ ) { - - if ( ! isNaN( headerObject.spacings[ i ] ) ) { - - for ( let j = 0; j <= 2; j ++ ) { - - headerObject.vectors[ i ][ j ] *= headerObject.spacings[ i ]; - - } - - } - - } - - } - - } - - } - - //parse the data when registred as one of this type : 'text', 'ascii', 'txt' - function parseDataAsText( data, start, end ) { - - let number = ''; - start = start || 0; - end = end || data.length; - let value; - //length of the result is the product of the sizes - const lengthOfTheResult = headerObject.sizes.reduce( function ( previous, current ) { - - return previous * current; - - }, 1 ); - - let base = 10; - if ( headerObject.encoding === 'hex' ) { - - base = 16; - - } - - const result = new headerObject.__array( lengthOfTheResult ); - let resultIndex = 0; - let parsingFunction = parseInt; - if ( headerObject.__array === Float32Array || headerObject.__array === Float64Array ) { - - parsingFunction = parseFloat; - - } - - for ( let i = start; i < end; i ++ ) { - - value = data[ i ]; - //if value is not a space - if ( ( value < 9 || value > 13 ) && value !== 32 ) { - - number += String.fromCharCode( value ); - - } else { - - if ( number !== '' ) { - - result[ resultIndex ] = parsingFunction( number, base ); - resultIndex ++; - - } - - number = ''; - - } - - } - - if ( number !== '' ) { - - result[ resultIndex ] = parsingFunction( number, base ); - resultIndex ++; - - } - - return result; - - } - - const _bytes = scan( 'uchar', data.byteLength ); - const _length = _bytes.length; - let _header = null; - let _data_start = 0; - let i; - for ( i = 1; i < _length; i ++ ) { - - if ( _bytes[ i - 1 ] == 10 && _bytes[ i ] == 10 ) { - - // we found two line breaks in a row - // now we know what the header is - _header = this.parseChars( _bytes, 0, i - 2 ); - // this is were the data starts - _data_start = i + 1; - break; - - } - - } - - // parse the header - parseHeader( _header ); - - _data = _bytes.subarray( _data_start ); // the data without header - if ( headerObject.encoding.substring( 0, 2 ) === 'gz' ) { - - // we need to decompress the datastream - // here we start the unzipping and get a typed Uint8Array back - _data = fflate.gunzipSync( new Uint8Array( _data ) ); - - } else if ( headerObject.encoding === 'ascii' || headerObject.encoding === 'text' || headerObject.encoding === 'txt' || headerObject.encoding === 'hex' ) { - - _data = parseDataAsText( _data ); - - } else if ( headerObject.encoding === 'raw' ) { - - //we need to copy the array to create a new array buffer, else we retrieve the original arraybuffer with the header - const _copy = new Uint8Array( _data.length ); - - for ( let i = 0; i < _data.length; i ++ ) { - - _copy[ i ] = _data[ i ]; - - } - - _data = _copy; - - } - - // .. let's use the underlying array buffer - _data = _data.buffer; - - const volume = new Volume(); - volume.header = headerObject; - volume.segmentation = this.segmentation; - // - // parse the (unzipped) data to a datastream of the correct type - // - volume.data = new headerObject.__array( _data ); - // get the min and max intensities - const min_max = volume.computeMinMax(); - const min = min_max[ 0 ]; - const max = min_max[ 1 ]; - // attach the scalar range to the volume - volume.windowLow = min; - volume.windowHigh = max; - - // get the image dimensions - volume.dimensions = [ headerObject.sizes[ 0 ], headerObject.sizes[ 1 ], headerObject.sizes[ 2 ] ]; - volume.xLength = volume.dimensions[ 0 ]; - volume.yLength = volume.dimensions[ 1 ]; - volume.zLength = volume.dimensions[ 2 ]; - - // Identify axis order in the space-directions matrix from the header if possible. - if ( headerObject.vectors ) { - - const xIndex = headerObject.vectors.findIndex( vector => vector[ 0 ] !== 0 ); - const yIndex = headerObject.vectors.findIndex( vector => vector[ 1 ] !== 0 ); - const zIndex = headerObject.vectors.findIndex( vector => vector[ 2 ] !== 0 ); - - const axisOrder = []; - - if ( xIndex !== yIndex && xIndex !== zIndex && yIndex !== zIndex ) { - - axisOrder[ xIndex ] = 'x'; - axisOrder[ yIndex ] = 'y'; - axisOrder[ zIndex ] = 'z'; - - } else { - - axisOrder[ 0 ] = 'x'; - axisOrder[ 1 ] = 'y'; - axisOrder[ 2 ] = 'z'; - - } - - volume.axisOrder = axisOrder; - - } else { - - volume.axisOrder = [ 'x', 'y', 'z' ]; - - } - - // spacing - const spacingX = new Vector3().fromArray( headerObject.vectors[ 0 ] ).length(); - const spacingY = new Vector3().fromArray( headerObject.vectors[ 1 ] ).length(); - const spacingZ = new Vector3().fromArray( headerObject.vectors[ 2 ] ).length(); - volume.spacing = [ spacingX, spacingY, spacingZ ]; - - - // Create IJKtoRAS matrix - volume.matrix = new Matrix4(); - - const transitionMatrix = new Matrix4(); - - if ( headerObject.space === 'left-posterior-superior' ) { - - transitionMatrix.set( - - 1, 0, 0, 0, - 0, - 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ); - - } else if ( headerObject.space === 'left-anterior-superior' ) { - - transitionMatrix.set( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, - 1, 0, - 0, 0, 0, 1 - ); - - } - - - if ( ! headerObject.vectors ) { - - volume.matrix.set( - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 ); - - } else { - - const v = headerObject.vectors; - - const ijk_to_transition = new Matrix4().set( - v[ 0 ][ 0 ], v[ 1 ][ 0 ], v[ 2 ][ 0 ], 0, - v[ 0 ][ 1 ], v[ 1 ][ 1 ], v[ 2 ][ 1 ], 0, - v[ 0 ][ 2 ], v[ 1 ][ 2 ], v[ 2 ][ 2 ], 0, - 0, 0, 0, 1 - ); - - const transition_to_ras = new Matrix4().multiplyMatrices( ijk_to_transition, transitionMatrix ); - - volume.matrix = transition_to_ras; - - } - - volume.inverseMatrix = new Matrix4(); - volume.inverseMatrix.copy( volume.matrix ).invert(); - - volume.RASDimensions = [ - Math.floor( volume.xLength * spacingX ), - Math.floor( volume.yLength * spacingY ), - Math.floor( volume.zLength * spacingZ ) - ]; - - // .. and set the default threshold - // only if the threshold was not already set - if ( volume.lowerThreshold === - Infinity ) { - - volume.lowerThreshold = min; - - } - - if ( volume.upperThreshold === Infinity ) { - - volume.upperThreshold = max; - - } - - return volume; - - } - - parseChars( array, start, end ) { - - // without borders, use the whole array - if ( start === undefined ) { - - start = 0; - - } - - if ( end === undefined ) { - - end = array.length; - - } - - let output = ''; - // create and append the chars - let i = 0; - for ( i = start; i < end; ++ i ) { - - output += String.fromCharCode( array[ i ] ); - - } - - return output; - - } - -} - -const _fieldFunctions = { - - type: function ( data ) { - - switch ( data ) { - - case 'uchar': - case 'unsigned char': - case 'uint8': - case 'uint8_t': - this.__array = Uint8Array; - break; - case 'signed char': - case 'int8': - case 'int8_t': - this.__array = Int8Array; - break; - case 'short': - case 'short int': - case 'signed short': - case 'signed short int': - case 'int16': - case 'int16_t': - this.__array = Int16Array; - break; - case 'ushort': - case 'unsigned short': - case 'unsigned short int': - case 'uint16': - case 'uint16_t': - this.__array = Uint16Array; - break; - case 'int': - case 'signed int': - case 'int32': - case 'int32_t': - this.__array = Int32Array; - break; - case 'uint': - case 'unsigned int': - case 'uint32': - case 'uint32_t': - this.__array = Uint32Array; - break; - case 'float': - this.__array = Float32Array; - break; - case 'double': - this.__array = Float64Array; - break; - default: - throw new Error( 'Unsupported NRRD data type: ' + data ); - - } - - return this.type = data; - - }, - - endian: function ( data ) { - - return this.endian = data; - - }, - - encoding: function ( data ) { - - return this.encoding = data; - - }, - - dimension: function ( data ) { - - return this.dim = parseInt( data, 10 ); - - }, - - sizes: function ( data ) { - - let i; - return this.sizes = ( function () { - - const _ref = data.split( /\s+/ ); - const _results = []; - - for ( let _i = 0, _len = _ref.length; _i < _len; _i ++ ) { - - i = _ref[ _i ]; - _results.push( parseInt( i, 10 ) ); - - } - - return _results; - - } )(); - - }, - - space: function ( data ) { - - return this.space = data; - - }, - - 'space origin': function ( data ) { - - return this.space_origin = data.split( '(' )[ 1 ].split( ')' )[ 0 ].split( ',' ); - - }, - - 'space directions': function ( data ) { - - let f, v; - const parts = data.match( /\(.*?\)/g ); - return this.vectors = ( function () { - - const _results = []; - - for ( let _i = 0, _len = parts.length; _i < _len; _i ++ ) { - - v = parts[ _i ]; - _results.push( ( function () { - - const _ref = v.slice( 1, - 1 ).split( /,/ ); - const _results2 = []; - - for ( let _j = 0, _len2 = _ref.length; _j < _len2; _j ++ ) { - - f = _ref[ _j ]; - _results2.push( parseFloat( f ) ); - - } - - return _results2; - - } )() ); - - } - - return _results; - - } )(); - - }, - - spacings: function ( data ) { - - let f; - const parts = data.split( /\s+/ ); - return this.spacings = ( function () { - - const _results = []; - - for ( let _i = 0, _len = parts.length; _i < _len; _i ++ ) { - - f = parts[ _i ]; - _results.push( parseFloat( f ) ); - - } - - return _results; - - } )(); - - } - -}; - -export { NRRDLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/NormalMapShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/NormalMapShader.js deleted file mode 100644 index c709e85..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/NormalMapShader.js +++ /dev/null @@ -1,55 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Normal map shader - * - compute normals from heightmap - */ - -const NormalMapShader = { - - name: 'NormalMapShader', - - uniforms: { - - 'heightMap': { value: null }, - 'resolution': { value: new Vector2( 512, 512 ) }, - 'scale': { value: new Vector2( 1, 1 ) }, - 'height': { value: 0.05 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform float height; - uniform vec2 resolution; - uniform sampler2D heightMap; - - varying vec2 vUv; - - void main() { - - float val = texture2D( heightMap, vUv ).x; - - float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x; - float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x; - - gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 ); - - }` - -}; - -export { NormalMapShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OBJLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OBJLoader.js deleted file mode 100644 index e35e612..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OBJLoader.js +++ /dev/null @@ -1,905 +0,0 @@ -import { - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Group, - LineBasicMaterial, - LineSegments, - Loader, - Material, - Mesh, - MeshPhongMaterial, - Points, - PointsMaterial, - Vector3, - Color -} from '/static/javascript/three/build/three.module.js'; - -// o object_name | g group_name -const _object_pattern = /^[og]\s*(.+)?/; -// mtllib file_reference -const _material_library_pattern = /^mtllib /; -// usemtl material_name -const _material_use_pattern = /^usemtl /; -// usemap map_name -const _map_use_pattern = /^usemap /; -const _face_vertex_data_separator_pattern = /\s+/; - -const _vA = new Vector3(); -const _vB = new Vector3(); -const _vC = new Vector3(); - -const _ab = new Vector3(); -const _cb = new Vector3(); - -const _color = new Color(); - -function ParserState() { - - const state = { - objects: [], - object: {}, - - vertices: [], - normals: [], - colors: [], - uvs: [], - - materials: {}, - materialLibraries: [], - - startObject: function ( name, fromDeclaration ) { - - // If the current object (initial from reset) is not from a g/o declaration in the parsed - // file. We need to use it for the first parsed g/o to keep things in sync. - if ( this.object && this.object.fromDeclaration === false ) { - - this.object.name = name; - this.object.fromDeclaration = ( fromDeclaration !== false ); - return; - - } - - const previousMaterial = ( this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined ); - - if ( this.object && typeof this.object._finalize === 'function' ) { - - this.object._finalize( true ); - - } - - this.object = { - name: name || '', - fromDeclaration: ( fromDeclaration !== false ), - - geometry: { - vertices: [], - normals: [], - colors: [], - uvs: [], - hasUVIndices: false - }, - materials: [], - smooth: true, - - startMaterial: function ( name, libraries ) { - - const previous = this._finalize( false ); - - // New usemtl declaration overwrites an inherited material, except if faces were declared - // after the material, then it must be preserved for proper MultiMaterial continuation. - if ( previous && ( previous.inherited || previous.groupCount <= 0 ) ) { - - this.materials.splice( previous.index, 1 ); - - } - - const material = { - index: this.materials.length, - name: name || '', - mtllib: ( Array.isArray( libraries ) && libraries.length > 0 ? libraries[ libraries.length - 1 ] : '' ), - smooth: ( previous !== undefined ? previous.smooth : this.smooth ), - groupStart: ( previous !== undefined ? previous.groupEnd : 0 ), - groupEnd: - 1, - groupCount: - 1, - inherited: false, - - clone: function ( index ) { - - const cloned = { - index: ( typeof index === 'number' ? index : this.index ), - name: this.name, - mtllib: this.mtllib, - smooth: this.smooth, - groupStart: 0, - groupEnd: - 1, - groupCount: - 1, - inherited: false - }; - cloned.clone = this.clone.bind( cloned ); - return cloned; - - } - }; - - this.materials.push( material ); - - return material; - - }, - - currentMaterial: function () { - - if ( this.materials.length > 0 ) { - - return this.materials[ this.materials.length - 1 ]; - - } - - return undefined; - - }, - - _finalize: function ( end ) { - - const lastMultiMaterial = this.currentMaterial(); - if ( lastMultiMaterial && lastMultiMaterial.groupEnd === - 1 ) { - - lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3; - lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart; - lastMultiMaterial.inherited = false; - - } - - // Ignore objects tail materials if no face declarations followed them before a new o/g started. - if ( end && this.materials.length > 1 ) { - - for ( let mi = this.materials.length - 1; mi >= 0; mi -- ) { - - if ( this.materials[ mi ].groupCount <= 0 ) { - - this.materials.splice( mi, 1 ); - - } - - } - - } - - // Guarantee at least one empty material, this makes the creation later more straight forward. - if ( end && this.materials.length === 0 ) { - - this.materials.push( { - name: '', - smooth: this.smooth - } ); - - } - - return lastMultiMaterial; - - } - }; - - // Inherit previous objects material. - // Spec tells us that a declared material must be set to all objects until a new material is declared. - // If a usemtl declaration is encountered while this new object is being parsed, it will - // overwrite the inherited material. Exception being that there was already face declarations - // to the inherited material, then it will be preserved for proper MultiMaterial continuation. - - if ( previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function' ) { - - const declared = previousMaterial.clone( 0 ); - declared.inherited = true; - this.object.materials.push( declared ); - - } - - this.objects.push( this.object ); - - }, - - finalize: function () { - - if ( this.object && typeof this.object._finalize === 'function' ) { - - this.object._finalize( true ); - - } - - }, - - parseVertexIndex: function ( value, len ) { - - const index = parseInt( value, 10 ); - return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; - - }, - - parseNormalIndex: function ( value, len ) { - - const index = parseInt( value, 10 ); - return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; - - }, - - parseUVIndex: function ( value, len ) { - - const index = parseInt( value, 10 ); - return ( index >= 0 ? index - 1 : index + len / 2 ) * 2; - - }, - - addVertex: function ( a, b, c ) { - - const src = this.vertices; - const dst = this.object.geometry.vertices; - - dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); - dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); - dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); - - }, - - addVertexPoint: function ( a ) { - - const src = this.vertices; - const dst = this.object.geometry.vertices; - - dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); - - }, - - addVertexLine: function ( a ) { - - const src = this.vertices; - const dst = this.object.geometry.vertices; - - dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); - - }, - - addNormal: function ( a, b, c ) { - - const src = this.normals; - const dst = this.object.geometry.normals; - - dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); - dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); - dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); - - }, - - addFaceNormal: function ( a, b, c ) { - - const src = this.vertices; - const dst = this.object.geometry.normals; - - _vA.fromArray( src, a ); - _vB.fromArray( src, b ); - _vC.fromArray( src, c ); - - _cb.subVectors( _vC, _vB ); - _ab.subVectors( _vA, _vB ); - _cb.cross( _ab ); - - _cb.normalize(); - - dst.push( _cb.x, _cb.y, _cb.z ); - dst.push( _cb.x, _cb.y, _cb.z ); - dst.push( _cb.x, _cb.y, _cb.z ); - - }, - - addColor: function ( a, b, c ) { - - const src = this.colors; - const dst = this.object.geometry.colors; - - if ( src[ a ] !== undefined ) dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] ); - if ( src[ b ] !== undefined ) dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] ); - if ( src[ c ] !== undefined ) dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] ); - - }, - - addUV: function ( a, b, c ) { - - const src = this.uvs; - const dst = this.object.geometry.uvs; - - dst.push( src[ a + 0 ], src[ a + 1 ] ); - dst.push( src[ b + 0 ], src[ b + 1 ] ); - dst.push( src[ c + 0 ], src[ c + 1 ] ); - - }, - - addDefaultUV: function () { - - const dst = this.object.geometry.uvs; - - dst.push( 0, 0 ); - dst.push( 0, 0 ); - dst.push( 0, 0 ); - - }, - - addUVLine: function ( a ) { - - const src = this.uvs; - const dst = this.object.geometry.uvs; - - dst.push( src[ a + 0 ], src[ a + 1 ] ); - - }, - - addFace: function ( a, b, c, ua, ub, uc, na, nb, nc ) { - - const vLen = this.vertices.length; - - let ia = this.parseVertexIndex( a, vLen ); - let ib = this.parseVertexIndex( b, vLen ); - let ic = this.parseVertexIndex( c, vLen ); - - this.addVertex( ia, ib, ic ); - this.addColor( ia, ib, ic ); - - // normals - - if ( na !== undefined && na !== '' ) { - - const nLen = this.normals.length; - - ia = this.parseNormalIndex( na, nLen ); - ib = this.parseNormalIndex( nb, nLen ); - ic = this.parseNormalIndex( nc, nLen ); - - this.addNormal( ia, ib, ic ); - - } else { - - this.addFaceNormal( ia, ib, ic ); - - } - - // uvs - - if ( ua !== undefined && ua !== '' ) { - - const uvLen = this.uvs.length; - - ia = this.parseUVIndex( ua, uvLen ); - ib = this.parseUVIndex( ub, uvLen ); - ic = this.parseUVIndex( uc, uvLen ); - - this.addUV( ia, ib, ic ); - - this.object.geometry.hasUVIndices = true; - - } else { - - // add placeholder values (for inconsistent face definitions) - - this.addDefaultUV(); - - } - - }, - - addPointGeometry: function ( vertices ) { - - this.object.geometry.type = 'Points'; - - const vLen = this.vertices.length; - - for ( let vi = 0, l = vertices.length; vi < l; vi ++ ) { - - const index = this.parseVertexIndex( vertices[ vi ], vLen ); - - this.addVertexPoint( index ); - this.addColor( index ); - - } - - }, - - addLineGeometry: function ( vertices, uvs ) { - - this.object.geometry.type = 'Line'; - - const vLen = this.vertices.length; - const uvLen = this.uvs.length; - - for ( let vi = 0, l = vertices.length; vi < l; vi ++ ) { - - this.addVertexLine( this.parseVertexIndex( vertices[ vi ], vLen ) ); - - } - - for ( let uvi = 0, l = uvs.length; uvi < l; uvi ++ ) { - - this.addUVLine( this.parseUVIndex( uvs[ uvi ], uvLen ) ); - - } - - } - - }; - - state.startObject( '', false ); - - return state; - -} - -// - -class OBJLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.materials = null; - - } - - 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( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - setMaterials( materials ) { - - this.materials = materials; - - return this; - - } - - parse( text ) { - - const state = new ParserState(); - - if ( text.indexOf( '\r\n' ) !== - 1 ) { - - // This is faster than String.split with regex that splits on both - text = text.replace( /\r\n/g, '\n' ); - - } - - if ( text.indexOf( '\\\n' ) !== - 1 ) { - - // join lines separated by a line continuation character (\) - text = text.replace( /\\\n/g, '' ); - - } - - const lines = text.split( '\n' ); - let result = []; - - for ( let i = 0, l = lines.length; i < l; i ++ ) { - - const line = lines[ i ].trimStart(); - - if ( line.length === 0 ) continue; - - const lineFirstChar = line.charAt( 0 ); - - // @todo invoke passed in handler if any - if ( lineFirstChar === '#' ) continue; // skip comments - - if ( lineFirstChar === 'v' ) { - - const data = line.split( _face_vertex_data_separator_pattern ); - - switch ( data[ 0 ] ) { - - case 'v': - state.vertices.push( - parseFloat( data[ 1 ] ), - parseFloat( data[ 2 ] ), - parseFloat( data[ 3 ] ) - ); - if ( data.length >= 7 ) { - - _color.setRGB( - parseFloat( data[ 4 ] ), - parseFloat( data[ 5 ] ), - parseFloat( data[ 6 ] ) - ).convertSRGBToLinear(); - - state.colors.push( _color.r, _color.g, _color.b ); - - } else { - - // if no colors are defined, add placeholders so color and vertex indices match - - state.colors.push( undefined, undefined, undefined ); - - } - - break; - case 'vn': - state.normals.push( - parseFloat( data[ 1 ] ), - parseFloat( data[ 2 ] ), - parseFloat( data[ 3 ] ) - ); - break; - case 'vt': - state.uvs.push( - parseFloat( data[ 1 ] ), - parseFloat( data[ 2 ] ) - ); - break; - - } - - } else if ( lineFirstChar === 'f' ) { - - const lineData = line.slice( 1 ).trim(); - const vertexData = lineData.split( _face_vertex_data_separator_pattern ); - const faceVertices = []; - - // Parse the face vertex data into an easy to work with format - - for ( let j = 0, jl = vertexData.length; j < jl; j ++ ) { - - const vertex = vertexData[ j ]; - - if ( vertex.length > 0 ) { - - const vertexParts = vertex.split( '/' ); - faceVertices.push( vertexParts ); - - } - - } - - // Draw an edge between the first vertex and all subsequent vertices to form an n-gon - - const v1 = faceVertices[ 0 ]; - - for ( let j = 1, jl = faceVertices.length - 1; j < jl; j ++ ) { - - const v2 = faceVertices[ j ]; - const v3 = faceVertices[ j + 1 ]; - - state.addFace( - v1[ 0 ], v2[ 0 ], v3[ 0 ], - v1[ 1 ], v2[ 1 ], v3[ 1 ], - v1[ 2 ], v2[ 2 ], v3[ 2 ] - ); - - } - - } else if ( lineFirstChar === 'l' ) { - - const lineParts = line.substring( 1 ).trim().split( ' ' ); - let lineVertices = []; - const lineUVs = []; - - if ( line.indexOf( '/' ) === - 1 ) { - - lineVertices = lineParts; - - } else { - - for ( let li = 0, llen = lineParts.length; li < llen; li ++ ) { - - const parts = lineParts[ li ].split( '/' ); - - if ( parts[ 0 ] !== '' ) lineVertices.push( parts[ 0 ] ); - if ( parts[ 1 ] !== '' ) lineUVs.push( parts[ 1 ] ); - - } - - } - - state.addLineGeometry( lineVertices, lineUVs ); - - } else if ( lineFirstChar === 'p' ) { - - const lineData = line.slice( 1 ).trim(); - const pointData = lineData.split( ' ' ); - - state.addPointGeometry( pointData ); - - } else if ( ( result = _object_pattern.exec( line ) ) !== null ) { - - // o object_name - // or - // g group_name - - // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869 - // let name = result[ 0 ].slice( 1 ).trim(); - const name = ( ' ' + result[ 0 ].slice( 1 ).trim() ).slice( 1 ); - - state.startObject( name ); - - } else if ( _material_use_pattern.test( line ) ) { - - // material - - state.object.startMaterial( line.substring( 7 ).trim(), state.materialLibraries ); - - } else if ( _material_library_pattern.test( line ) ) { - - // mtl file - - state.materialLibraries.push( line.substring( 7 ).trim() ); - - } else if ( _map_use_pattern.test( line ) ) { - - // the line is parsed but ignored since the loader assumes textures are defined MTL files - // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method) - - console.warn( 'THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.' ); - - } else if ( lineFirstChar === 's' ) { - - result = line.split( ' ' ); - - // smooth shading - - // @todo Handle files that have varying smooth values for a set of faces inside one geometry, - // but does not define a usemtl for each face set. - // This should be detected and a dummy material created (later MultiMaterial and geometry groups). - // This requires some care to not create extra material on each smooth value for "normal" obj files. - // where explicit usemtl defines geometry groups. - // Example asset: examples/models/obj/cerberus/Cerberus.obj - - /* - * http://paulbourke.net/dataformats/obj/ - * - * From chapter "Grouping" Syntax explanation "s group_number": - * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off. - * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form - * surfaces, smoothing groups are either turned on or off; there is no difference between values greater - * than 0." - */ - if ( result.length > 1 ) { - - const value = result[ 1 ].trim().toLowerCase(); - state.object.smooth = ( value !== '0' && value !== 'off' ); - - } else { - - // ZBrush can produce "s" lines #11707 - state.object.smooth = true; - - } - - const material = state.object.currentMaterial(); - if ( material ) material.smooth = state.object.smooth; - - } else { - - // Handle null terminated files without exception - if ( line === '\0' ) continue; - - console.warn( 'THREE.OBJLoader: Unexpected line: "' + line + '"' ); - - } - - } - - state.finalize(); - - const container = new Group(); - container.materialLibraries = [].concat( state.materialLibraries ); - - const hasPrimitives = ! ( state.objects.length === 1 && state.objects[ 0 ].geometry.vertices.length === 0 ); - - if ( hasPrimitives === true ) { - - for ( let i = 0, l = state.objects.length; i < l; i ++ ) { - - const object = state.objects[ i ]; - const geometry = object.geometry; - const materials = object.materials; - const isLine = ( geometry.type === 'Line' ); - const isPoints = ( geometry.type === 'Points' ); - let hasVertexColors = false; - - // Skip o/g line declarations that did not follow with any faces - if ( geometry.vertices.length === 0 ) continue; - - const buffergeometry = new BufferGeometry(); - - buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) ); - - if ( geometry.normals.length > 0 ) { - - buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) ); - - } - - if ( geometry.colors.length > 0 ) { - - hasVertexColors = true; - buffergeometry.setAttribute( 'color', new Float32BufferAttribute( geometry.colors, 3 ) ); - - } - - if ( geometry.hasUVIndices === true ) { - - buffergeometry.setAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) ); - - } - - // Create materials - - const createdMaterials = []; - - for ( let mi = 0, miLen = materials.length; mi < miLen; mi ++ ) { - - const sourceMaterial = materials[ mi ]; - const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors; - let material = state.materials[ materialHash ]; - - if ( this.materials !== null ) { - - material = this.materials.create( sourceMaterial.name ); - - // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material. - if ( isLine && material && ! ( material instanceof LineBasicMaterial ) ) { - - const materialLine = new LineBasicMaterial(); - Material.prototype.copy.call( materialLine, material ); - materialLine.color.copy( material.color ); - material = materialLine; - - } else if ( isPoints && material && ! ( material instanceof PointsMaterial ) ) { - - const materialPoints = new PointsMaterial( { size: 10, sizeAttenuation: false } ); - Material.prototype.copy.call( materialPoints, material ); - materialPoints.color.copy( material.color ); - materialPoints.map = material.map; - material = materialPoints; - - } - - } - - if ( material === undefined ) { - - if ( isLine ) { - - material = new LineBasicMaterial(); - - } else if ( isPoints ) { - - material = new PointsMaterial( { size: 1, sizeAttenuation: false } ); - - } else { - - material = new MeshPhongMaterial(); - - } - - material.name = sourceMaterial.name; - material.flatShading = sourceMaterial.smooth ? false : true; - material.vertexColors = hasVertexColors; - - state.materials[ materialHash ] = material; - - } - - createdMaterials.push( material ); - - } - - // Create mesh - - let mesh; - - if ( createdMaterials.length > 1 ) { - - for ( let mi = 0, miLen = materials.length; mi < miLen; mi ++ ) { - - const sourceMaterial = materials[ mi ]; - buffergeometry.addGroup( sourceMaterial.groupStart, sourceMaterial.groupCount, mi ); - - } - - if ( isLine ) { - - mesh = new LineSegments( buffergeometry, createdMaterials ); - - } else if ( isPoints ) { - - mesh = new Points( buffergeometry, createdMaterials ); - - } else { - - mesh = new Mesh( buffergeometry, createdMaterials ); - - } - - } else { - - if ( isLine ) { - - mesh = new LineSegments( buffergeometry, createdMaterials[ 0 ] ); - - } else if ( isPoints ) { - - mesh = new Points( buffergeometry, createdMaterials[ 0 ] ); - - } else { - - mesh = new Mesh( buffergeometry, createdMaterials[ 0 ] ); - - } - - } - - mesh.name = object.name; - - container.add( mesh ); - - } - - } else { - - // if there is only the default parser state object with no geometry data, interpret data as point cloud - - if ( state.vertices.length > 0 ) { - - const material = new PointsMaterial( { size: 1, sizeAttenuation: false } ); - - const buffergeometry = new BufferGeometry(); - - buffergeometry.setAttribute( 'position', new Float32BufferAttribute( state.vertices, 3 ) ); - - if ( state.colors.length > 0 && state.colors[ 0 ] !== undefined ) { - - buffergeometry.setAttribute( 'color', new Float32BufferAttribute( state.colors, 3 ) ); - material.vertexColors = true; - - } - - const points = new Points( buffergeometry, material ); - container.add( points ); - - } - - } - - return container; - - } - -} - -export { OBJLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandModel.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandModel.js deleted file mode 100644 index 829d44f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandModel.js +++ /dev/null @@ -1,110 +0,0 @@ -import { Object3D, Sphere, Box3 } from '/static/javascript/three/build/three.module.js'; -import { XRHandMeshModel } from './XRHandMeshModel.js'; - -const TOUCH_RADIUS = 0.01; -const POINTING_JOINT = 'index-finger-tip'; - -class OculusHandModel extends Object3D { - - constructor( controller, loader = null, onLoad = null ) { - - super(); - - this.controller = controller; - this.motionController = null; - this.envMap = null; - this.loader = loader; - this.onLoad = onLoad; - - this.mesh = null; - - controller.addEventListener( 'connected', ( event ) => { - - const xrInputSource = event.data; - - if ( xrInputSource.hand && ! this.motionController ) { - - this.xrInputSource = xrInputSource; - - this.motionController = new XRHandMeshModel( this, controller, this.path, xrInputSource.handedness, this.loader, this.onLoad ); - - } - - } ); - - controller.addEventListener( 'disconnected', () => { - - this.clear(); - this.motionController = null; - - } ); - - } - - updateMatrixWorld( force ) { - - super.updateMatrixWorld( force ); - - if ( this.motionController ) { - - this.motionController.updateMesh(); - - } - - } - - getPointerPosition() { - - const indexFingerTip = this.controller.joints[ POINTING_JOINT ]; - if ( indexFingerTip ) { - - return indexFingerTip.position; - - } else { - - return null; - - } - - } - - intersectBoxObject( boxObject ) { - - const pointerPosition = this.getPointerPosition(); - if ( pointerPosition ) { - - const indexSphere = new Sphere( pointerPosition, TOUCH_RADIUS ); - const box = new Box3().setFromObject( boxObject ); - return indexSphere.intersectsBox( box ); - - } else { - - return false; - - } - - } - - checkButton( button ) { - - if ( this.intersectBoxObject( button ) ) { - - button.onPress(); - - } else { - - button.onClear(); - - } - - if ( button.isPressed() ) { - - button.whilePressed(); - - } - - } - -} - -export { OculusHandModel }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandPointerModel.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandPointerModel.js deleted file mode 100644 index 6ea4af1..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OculusHandPointerModel.js +++ /dev/null @@ -1,413 +0,0 @@ -import * as THREE from '/static/javascript/three/build/three.module.js'; - -const PINCH_MAX = 0.05; -const PINCH_THRESHOLD = 0.02; -const PINCH_MIN = 0.01; -const POINTER_ADVANCE_MAX = 0.02; -const POINTER_OPACITY_MAX = 1; -const POINTER_OPACITY_MIN = 0.4; -const POINTER_FRONT_RADIUS = 0.002; -const POINTER_REAR_RADIUS = 0.01; -const POINTER_REAR_RADIUS_MIN = 0.003; -const POINTER_LENGTH = 0.035; -const POINTER_SEGMENTS = 16; -const POINTER_RINGS = 12; -const POINTER_HEMISPHERE_ANGLE = 110; -const YAXIS = /* @__PURE__ */ new THREE.Vector3( 0, 1, 0 ); -const ZAXIS = /* @__PURE__ */ new THREE.Vector3( 0, 0, 1 ); - -const CURSOR_RADIUS = 0.02; -const CURSOR_MAX_DISTANCE = 1.5; - -class OculusHandPointerModel extends THREE.Object3D { - - constructor( hand, controller ) { - - super(); - - this.hand = hand; - this.controller = controller; - - // Unused - this.motionController = null; - this.envMap = null; - this.mesh = null; - - this.pointerGeometry = null; - this.pointerMesh = null; - this.pointerObject = null; - - this.pinched = false; - this.attached = false; - - this.cursorObject = null; - - this.raycaster = null; - - this._onConnected = this._onConnected.bind( this ); - this._onDisconnected = this._onDisconnected.bind( this ); - this.hand.addEventListener( 'connected', this._onConnected ); - this.hand.addEventListener( 'disconnected', this._onDisconnected ); - - } - - _onConnected( event ) { - - const xrInputSource = event.data; - if ( xrInputSource.hand ) { - - this.visible = true; - this.xrInputSource = xrInputSource; - - this.createPointer(); - - } - - } - - _onDisconnected() { - - this.visible = false; - this.xrInputSource = null; - - if ( this.pointerGeometry ) this.pointerGeometry.dispose(); - if ( this.pointerMesh && this.pointerMesh.material ) this.pointerMesh.material.dispose(); - - this.clear(); - - } - - _drawVerticesRing( vertices, baseVector, ringIndex ) { - - const segmentVector = baseVector.clone(); - for ( let i = 0; i < POINTER_SEGMENTS; i ++ ) { - - segmentVector.applyAxisAngle( ZAXIS, ( Math.PI * 2 ) / POINTER_SEGMENTS ); - const vid = ringIndex * POINTER_SEGMENTS + i; - vertices[ 3 * vid ] = segmentVector.x; - vertices[ 3 * vid + 1 ] = segmentVector.y; - vertices[ 3 * vid + 2 ] = segmentVector.z; - - } - - } - - _updatePointerVertices( rearRadius ) { - - const vertices = this.pointerGeometry.attributes.position.array; - // first ring for front face - const frontFaceBase = new THREE.Vector3( - POINTER_FRONT_RADIUS, - 0, - - 1 * ( POINTER_LENGTH - rearRadius ) - ); - this._drawVerticesRing( vertices, frontFaceBase, 0 ); - - // rings for rear hemisphere - const rearBase = new THREE.Vector3( - Math.sin( ( Math.PI * POINTER_HEMISPHERE_ANGLE ) / 180 ) * rearRadius, - Math.cos( ( Math.PI * POINTER_HEMISPHERE_ANGLE ) / 180 ) * rearRadius, - 0 - ); - for ( let i = 0; i < POINTER_RINGS; i ++ ) { - - this._drawVerticesRing( vertices, rearBase, i + 1 ); - rearBase.applyAxisAngle( - YAXIS, - ( Math.PI * POINTER_HEMISPHERE_ANGLE ) / 180 / ( POINTER_RINGS * - 2 ) - ); - - } - - // front and rear face center vertices - const frontCenterIndex = POINTER_SEGMENTS * ( 1 + POINTER_RINGS ); - const rearCenterIndex = POINTER_SEGMENTS * ( 1 + POINTER_RINGS ) + 1; - const frontCenter = new THREE.Vector3( - 0, - 0, - - 1 * ( POINTER_LENGTH - rearRadius ) - ); - vertices[ frontCenterIndex * 3 ] = frontCenter.x; - vertices[ frontCenterIndex * 3 + 1 ] = frontCenter.y; - vertices[ frontCenterIndex * 3 + 2 ] = frontCenter.z; - const rearCenter = new THREE.Vector3( 0, 0, rearRadius ); - vertices[ rearCenterIndex * 3 ] = rearCenter.x; - vertices[ rearCenterIndex * 3 + 1 ] = rearCenter.y; - vertices[ rearCenterIndex * 3 + 2 ] = rearCenter.z; - - this.pointerGeometry.setAttribute( - 'position', - new THREE.Float32BufferAttribute( vertices, 3 ) - ); - // verticesNeedUpdate = true; - - } - - createPointer() { - - let i, j; - const vertices = new Array( - ( ( POINTER_RINGS + 1 ) * POINTER_SEGMENTS + 2 ) * 3 - ).fill( 0 ); - // const vertices = []; - const indices = []; - this.pointerGeometry = new THREE.BufferGeometry(); - - this.pointerGeometry.setAttribute( - 'position', - new THREE.Float32BufferAttribute( vertices, 3 ) - ); - - this._updatePointerVertices( POINTER_REAR_RADIUS ); - - // construct faces to connect rings - for ( i = 0; i < POINTER_RINGS; i ++ ) { - - for ( j = 0; j < POINTER_SEGMENTS - 1; j ++ ) { - - indices.push( - i * POINTER_SEGMENTS + j, - i * POINTER_SEGMENTS + j + 1, - ( i + 1 ) * POINTER_SEGMENTS + j - ); - indices.push( - i * POINTER_SEGMENTS + j + 1, - ( i + 1 ) * POINTER_SEGMENTS + j + 1, - ( i + 1 ) * POINTER_SEGMENTS + j - ); - - } - - indices.push( - ( i + 1 ) * POINTER_SEGMENTS - 1, - i * POINTER_SEGMENTS, - ( i + 2 ) * POINTER_SEGMENTS - 1 - ); - indices.push( - i * POINTER_SEGMENTS, - ( i + 1 ) * POINTER_SEGMENTS, - ( i + 2 ) * POINTER_SEGMENTS - 1 - ); - - } - - // construct front and rear face - const frontCenterIndex = POINTER_SEGMENTS * ( 1 + POINTER_RINGS ); - const rearCenterIndex = POINTER_SEGMENTS * ( 1 + POINTER_RINGS ) + 1; - - for ( i = 0; i < POINTER_SEGMENTS - 1; i ++ ) { - - indices.push( frontCenterIndex, i + 1, i ); - indices.push( - rearCenterIndex, - i + POINTER_SEGMENTS * POINTER_RINGS, - i + POINTER_SEGMENTS * POINTER_RINGS + 1 - ); - - } - - indices.push( frontCenterIndex, 0, POINTER_SEGMENTS - 1 ); - indices.push( - rearCenterIndex, - POINTER_SEGMENTS * ( POINTER_RINGS + 1 ) - 1, - POINTER_SEGMENTS * POINTER_RINGS - ); - - const material = new THREE.MeshBasicMaterial(); - material.transparent = true; - material.opacity = POINTER_OPACITY_MIN; - - this.pointerGeometry.setIndex( indices ); - - this.pointerMesh = new THREE.Mesh( this.pointerGeometry, material ); - - this.pointerMesh.position.set( 0, 0, - 1 * POINTER_REAR_RADIUS ); - this.pointerObject = new THREE.Object3D(); - this.pointerObject.add( this.pointerMesh ); - - this.raycaster = new THREE.Raycaster(); - - // create cursor - const cursorGeometry = new THREE.SphereGeometry( CURSOR_RADIUS, 10, 10 ); - const cursorMaterial = new THREE.MeshBasicMaterial(); - cursorMaterial.transparent = true; - cursorMaterial.opacity = POINTER_OPACITY_MIN; - - this.cursorObject = new THREE.Mesh( cursorGeometry, cursorMaterial ); - this.pointerObject.add( this.cursorObject ); - - this.add( this.pointerObject ); - - } - - _updateRaycaster() { - - if ( this.raycaster ) { - - const pointerMatrix = this.pointerObject.matrixWorld; - const tempMatrix = new THREE.Matrix4(); - tempMatrix.identity().extractRotation( pointerMatrix ); - this.raycaster.ray.origin.setFromMatrixPosition( pointerMatrix ); - this.raycaster.ray.direction.set( 0, 0, - 1 ).applyMatrix4( tempMatrix ); - - } - - } - - _updatePointer() { - - this.pointerObject.visible = this.controller.visible; - const indexTip = this.hand.joints[ 'index-finger-tip' ]; - const thumbTip = this.hand.joints[ 'thumb-tip' ]; - const distance = indexTip.position.distanceTo( thumbTip.position ); - const position = indexTip.position - .clone() - .add( thumbTip.position ) - .multiplyScalar( 0.5 ); - this.pointerObject.position.copy( position ); - this.pointerObject.quaternion.copy( this.controller.quaternion ); - - this.pinched = distance <= PINCH_THRESHOLD; - - const pinchScale = ( distance - PINCH_MIN ) / ( PINCH_MAX - PINCH_MIN ); - const focusScale = ( distance - PINCH_MIN ) / ( PINCH_THRESHOLD - PINCH_MIN ); - if ( pinchScale > 1 ) { - - this._updatePointerVertices( POINTER_REAR_RADIUS ); - this.pointerMesh.position.set( 0, 0, - 1 * POINTER_REAR_RADIUS ); - this.pointerMesh.material.opacity = POINTER_OPACITY_MIN; - - } else if ( pinchScale > 0 ) { - - const rearRadius = - ( POINTER_REAR_RADIUS - POINTER_REAR_RADIUS_MIN ) * pinchScale + - POINTER_REAR_RADIUS_MIN; - this._updatePointerVertices( rearRadius ); - if ( focusScale < 1 ) { - - this.pointerMesh.position.set( - 0, - 0, - - 1 * rearRadius - ( 1 - focusScale ) * POINTER_ADVANCE_MAX - ); - this.pointerMesh.material.opacity = - POINTER_OPACITY_MIN + - ( 1 - focusScale ) * ( POINTER_OPACITY_MAX - POINTER_OPACITY_MIN ); - - } else { - - this.pointerMesh.position.set( 0, 0, - 1 * rearRadius ); - this.pointerMesh.material.opacity = POINTER_OPACITY_MIN; - - } - - } else { - - this._updatePointerVertices( POINTER_REAR_RADIUS_MIN ); - this.pointerMesh.position.set( - 0, - 0, - - 1 * POINTER_REAR_RADIUS_MIN - POINTER_ADVANCE_MAX - ); - this.pointerMesh.material.opacity = POINTER_OPACITY_MAX; - - } - - this.cursorObject.material.opacity = this.pointerMesh.material.opacity; - - } - - updateMatrixWorld( force ) { - - super.updateMatrixWorld( force ); - if ( this.pointerGeometry ) { - - this._updatePointer(); - this._updateRaycaster(); - - } - - } - - isPinched() { - - return this.pinched; - - } - - setAttached( attached ) { - - this.attached = attached; - - } - - isAttached() { - - return this.attached; - - } - - intersectObject( object, recursive = true ) { - - if ( this.raycaster ) { - - return this.raycaster.intersectObject( object, recursive ); - - } - - } - - intersectObjects( objects, recursive = true ) { - - if ( this.raycaster ) { - - return this.raycaster.intersectObjects( objects, recursive ); - - } - - } - - checkIntersections( objects, recursive = false ) { - - if ( this.raycaster && ! this.attached ) { - - const intersections = this.raycaster.intersectObjects( objects, recursive ); - const direction = new THREE.Vector3( 0, 0, - 1 ); - if ( intersections.length > 0 ) { - - const intersection = intersections[ 0 ]; - const distance = intersection.distance; - this.cursorObject.position.copy( direction.multiplyScalar( distance ) ); - - } else { - - this.cursorObject.position.copy( direction.multiplyScalar( CURSOR_MAX_DISTANCE ) ); - - } - - } - - } - - setCursor( distance ) { - - const direction = new THREE.Vector3( 0, 0, - 1 ); - if ( this.raycaster && ! this.attached ) { - - this.cursorObject.position.copy( direction.multiplyScalar( distance ) ); - - } - - } - - dispose() { - - this._onDisconnected(); - this.hand.removeEventListener( 'connected', this._onConnected ); - this.hand.removeEventListener( 'disconnected', this._onDisconnected ); - - } - -} - -export { OculusHandPointerModel }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OutlinePass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OutlinePass.js deleted file mode 100644 index 7a52f4b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OutlinePass.js +++ /dev/null @@ -1,654 +0,0 @@ -import { - AdditiveBlending, - Color, - DoubleSide, - HalfFloatType, - Matrix4, - MeshDepthMaterial, - NoBlending, - RGBADepthPacking, - ShaderMaterial, - UniformsUtils, - Vector2, - Vector3, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { CopyShader } from '../shaders/CopyShader.js'; - -class OutlinePass extends Pass { - - constructor( resolution, scene, camera, selectedObjects ) { - - super(); - - this.renderScene = scene; - this.renderCamera = camera; - this.selectedObjects = selectedObjects !== undefined ? selectedObjects : []; - this.visibleEdgeColor = new Color( 1, 1, 1 ); - this.hiddenEdgeColor = new Color( 0.1, 0.04, 0.02 ); - this.edgeGlow = 0.0; - this.usePatternTexture = false; - this.edgeThickness = 1.0; - this.edgeStrength = 3.0; - this.downSampleRatio = 2; - this.pulsePeriod = 0; - - this._visibilityCache = new Map(); - - - this.resolution = ( resolution !== undefined ) ? new Vector2( resolution.x, resolution.y ) : new Vector2( 256, 256 ); - - const resx = Math.round( this.resolution.x / this.downSampleRatio ); - const resy = Math.round( this.resolution.y / this.downSampleRatio ); - - this.renderTargetMaskBuffer = new WebGLRenderTarget( this.resolution.x, this.resolution.y ); - this.renderTargetMaskBuffer.texture.name = 'OutlinePass.mask'; - this.renderTargetMaskBuffer.texture.generateMipmaps = false; - - this.depthMaterial = new MeshDepthMaterial(); - this.depthMaterial.side = DoubleSide; - this.depthMaterial.depthPacking = RGBADepthPacking; - this.depthMaterial.blending = NoBlending; - - this.prepareMaskMaterial = this.getPrepareMaskMaterial(); - this.prepareMaskMaterial.side = DoubleSide; - this.prepareMaskMaterial.fragmentShader = replaceDepthToViewZ( this.prepareMaskMaterial.fragmentShader, this.renderCamera ); - - this.renderTargetDepthBuffer = new WebGLRenderTarget( this.resolution.x, this.resolution.y, { type: HalfFloatType } ); - this.renderTargetDepthBuffer.texture.name = 'OutlinePass.depth'; - this.renderTargetDepthBuffer.texture.generateMipmaps = false; - - this.renderTargetMaskDownSampleBuffer = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } ); - this.renderTargetMaskDownSampleBuffer.texture.name = 'OutlinePass.depthDownSample'; - this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false; - - this.renderTargetBlurBuffer1 = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } ); - this.renderTargetBlurBuffer1.texture.name = 'OutlinePass.blur1'; - this.renderTargetBlurBuffer1.texture.generateMipmaps = false; - this.renderTargetBlurBuffer2 = new WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), { type: HalfFloatType } ); - this.renderTargetBlurBuffer2.texture.name = 'OutlinePass.blur2'; - this.renderTargetBlurBuffer2.texture.generateMipmaps = false; - - this.edgeDetectionMaterial = this.getEdgeDetectionMaterial(); - this.renderTargetEdgeBuffer1 = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } ); - this.renderTargetEdgeBuffer1.texture.name = 'OutlinePass.edge1'; - this.renderTargetEdgeBuffer1.texture.generateMipmaps = false; - this.renderTargetEdgeBuffer2 = new WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), { type: HalfFloatType } ); - this.renderTargetEdgeBuffer2.texture.name = 'OutlinePass.edge2'; - this.renderTargetEdgeBuffer2.texture.generateMipmaps = false; - - const MAX_EDGE_THICKNESS = 4; - const MAX_EDGE_GLOW = 4; - - this.separableBlurMaterial1 = this.getSeperableBlurMaterial( MAX_EDGE_THICKNESS ); - this.separableBlurMaterial1.uniforms[ 'texSize' ].value.set( resx, resy ); - this.separableBlurMaterial1.uniforms[ 'kernelRadius' ].value = 1; - this.separableBlurMaterial2 = this.getSeperableBlurMaterial( MAX_EDGE_GLOW ); - this.separableBlurMaterial2.uniforms[ 'texSize' ].value.set( Math.round( resx / 2 ), Math.round( resy / 2 ) ); - this.separableBlurMaterial2.uniforms[ 'kernelRadius' ].value = MAX_EDGE_GLOW; - - // Overlay material - this.overlayMaterial = this.getOverlayMaterial(); - - // copy material - - const copyShader = CopyShader; - - this.copyUniforms = UniformsUtils.clone( copyShader.uniforms ); - - this.materialCopy = new ShaderMaterial( { - uniforms: this.copyUniforms, - vertexShader: copyShader.vertexShader, - fragmentShader: copyShader.fragmentShader, - blending: NoBlending, - depthTest: false, - depthWrite: false - } ); - - this.enabled = true; - this.needsSwap = false; - - this._oldClearColor = new Color(); - this.oldClearAlpha = 1; - - this.fsQuad = new FullScreenQuad( null ); - - this.tempPulseColor1 = new Color(); - this.tempPulseColor2 = new Color(); - this.textureMatrix = new Matrix4(); - - function replaceDepthToViewZ( string, camera ) { - - const type = camera.isPerspectiveCamera ? 'perspective' : 'orthographic'; - - return string.replace( /DEPTH_TO_VIEW_Z/g, type + 'DepthToViewZ' ); - - } - - } - - dispose() { - - this.renderTargetMaskBuffer.dispose(); - this.renderTargetDepthBuffer.dispose(); - this.renderTargetMaskDownSampleBuffer.dispose(); - this.renderTargetBlurBuffer1.dispose(); - this.renderTargetBlurBuffer2.dispose(); - this.renderTargetEdgeBuffer1.dispose(); - this.renderTargetEdgeBuffer2.dispose(); - - this.depthMaterial.dispose(); - this.prepareMaskMaterial.dispose(); - this.edgeDetectionMaterial.dispose(); - this.separableBlurMaterial1.dispose(); - this.separableBlurMaterial2.dispose(); - this.overlayMaterial.dispose(); - this.materialCopy.dispose(); - - this.fsQuad.dispose(); - - } - - setSize( width, height ) { - - this.renderTargetMaskBuffer.setSize( width, height ); - this.renderTargetDepthBuffer.setSize( width, height ); - - let resx = Math.round( width / this.downSampleRatio ); - let resy = Math.round( height / this.downSampleRatio ); - this.renderTargetMaskDownSampleBuffer.setSize( resx, resy ); - this.renderTargetBlurBuffer1.setSize( resx, resy ); - this.renderTargetEdgeBuffer1.setSize( resx, resy ); - this.separableBlurMaterial1.uniforms[ 'texSize' ].value.set( resx, resy ); - - resx = Math.round( resx / 2 ); - resy = Math.round( resy / 2 ); - - this.renderTargetBlurBuffer2.setSize( resx, resy ); - this.renderTargetEdgeBuffer2.setSize( resx, resy ); - - this.separableBlurMaterial2.uniforms[ 'texSize' ].value.set( resx, resy ); - - } - - changeVisibilityOfSelectedObjects( bVisible ) { - - const cache = this._visibilityCache; - - function gatherSelectedMeshesCallBack( object ) { - - if ( object.isMesh ) { - - if ( bVisible === true ) { - - object.visible = cache.get( object ); - - } else { - - cache.set( object, object.visible ); - object.visible = bVisible; - - } - - } - - } - - for ( let i = 0; i < this.selectedObjects.length; i ++ ) { - - const selectedObject = this.selectedObjects[ i ]; - selectedObject.traverse( gatherSelectedMeshesCallBack ); - - } - - } - - changeVisibilityOfNonSelectedObjects( bVisible ) { - - const cache = this._visibilityCache; - const selectedMeshes = []; - - function gatherSelectedMeshesCallBack( object ) { - - if ( object.isMesh ) selectedMeshes.push( object ); - - } - - for ( let i = 0; i < this.selectedObjects.length; i ++ ) { - - const selectedObject = this.selectedObjects[ i ]; - selectedObject.traverse( gatherSelectedMeshesCallBack ); - - } - - function VisibilityChangeCallBack( object ) { - - if ( object.isMesh || object.isSprite ) { - - // only meshes and sprites are supported by OutlinePass - - let bFound = false; - - for ( let i = 0; i < selectedMeshes.length; i ++ ) { - - const selectedObjectId = selectedMeshes[ i ].id; - - if ( selectedObjectId === object.id ) { - - bFound = true; - break; - - } - - } - - if ( bFound === false ) { - - const visibility = object.visible; - - if ( bVisible === false || cache.get( object ) === true ) { - - object.visible = bVisible; - - } - - cache.set( object, visibility ); - - } - - } else if ( object.isPoints || object.isLine ) { - - // the visibilty of points and lines is always set to false in order to - // not affect the outline computation - - if ( bVisible === true ) { - - object.visible = cache.get( object ); // restore - - } else { - - cache.set( object, object.visible ); - object.visible = bVisible; - - } - - } - - } - - this.renderScene.traverse( VisibilityChangeCallBack ); - - } - - updateTextureMatrix() { - - this.textureMatrix.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 ); - this.textureMatrix.multiply( this.renderCamera.projectionMatrix ); - this.textureMatrix.multiply( this.renderCamera.matrixWorldInverse ); - - } - - render( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) { - - if ( this.selectedObjects.length > 0 ) { - - renderer.getClearColor( this._oldClearColor ); - this.oldClearAlpha = renderer.getClearAlpha(); - const oldAutoClear = renderer.autoClear; - - renderer.autoClear = false; - - if ( maskActive ) renderer.state.buffers.stencil.setTest( false ); - - renderer.setClearColor( 0xffffff, 1 ); - - // Make selected objects invisible - this.changeVisibilityOfSelectedObjects( false ); - - const currentBackground = this.renderScene.background; - this.renderScene.background = null; - - // 1. Draw Non Selected objects in the depth buffer - this.renderScene.overrideMaterial = this.depthMaterial; - renderer.setRenderTarget( this.renderTargetDepthBuffer ); - renderer.clear(); - renderer.render( this.renderScene, this.renderCamera ); - - // Make selected objects visible - this.changeVisibilityOfSelectedObjects( true ); - this._visibilityCache.clear(); - - // Update Texture Matrix for Depth compare - this.updateTextureMatrix(); - - // Make non selected objects invisible, and draw only the selected objects, by comparing the depth buffer of non selected objects - this.changeVisibilityOfNonSelectedObjects( false ); - this.renderScene.overrideMaterial = this.prepareMaskMaterial; - this.prepareMaskMaterial.uniforms[ 'cameraNearFar' ].value.set( this.renderCamera.near, this.renderCamera.far ); - this.prepareMaskMaterial.uniforms[ 'depthTexture' ].value = this.renderTargetDepthBuffer.texture; - this.prepareMaskMaterial.uniforms[ 'textureMatrix' ].value = this.textureMatrix; - renderer.setRenderTarget( this.renderTargetMaskBuffer ); - renderer.clear(); - renderer.render( this.renderScene, this.renderCamera ); - this.renderScene.overrideMaterial = null; - this.changeVisibilityOfNonSelectedObjects( true ); - this._visibilityCache.clear(); - - this.renderScene.background = currentBackground; - - // 2. Downsample to Half resolution - this.fsQuad.material = this.materialCopy; - this.copyUniforms[ 'tDiffuse' ].value = this.renderTargetMaskBuffer.texture; - renderer.setRenderTarget( this.renderTargetMaskDownSampleBuffer ); - renderer.clear(); - this.fsQuad.render( renderer ); - - this.tempPulseColor1.copy( this.visibleEdgeColor ); - this.tempPulseColor2.copy( this.hiddenEdgeColor ); - - if ( this.pulsePeriod > 0 ) { - - const scalar = ( 1 + 0.25 ) / 2 + Math.cos( performance.now() * 0.01 / this.pulsePeriod ) * ( 1.0 - 0.25 ) / 2; - this.tempPulseColor1.multiplyScalar( scalar ); - this.tempPulseColor2.multiplyScalar( scalar ); - - } - - // 3. Apply Edge Detection Pass - this.fsQuad.material = this.edgeDetectionMaterial; - this.edgeDetectionMaterial.uniforms[ 'maskTexture' ].value = this.renderTargetMaskDownSampleBuffer.texture; - this.edgeDetectionMaterial.uniforms[ 'texSize' ].value.set( this.renderTargetMaskDownSampleBuffer.width, this.renderTargetMaskDownSampleBuffer.height ); - this.edgeDetectionMaterial.uniforms[ 'visibleEdgeColor' ].value = this.tempPulseColor1; - this.edgeDetectionMaterial.uniforms[ 'hiddenEdgeColor' ].value = this.tempPulseColor2; - renderer.setRenderTarget( this.renderTargetEdgeBuffer1 ); - renderer.clear(); - this.fsQuad.render( renderer ); - - // 4. Apply Blur on Half res - this.fsQuad.material = this.separableBlurMaterial1; - this.separableBlurMaterial1.uniforms[ 'colorTexture' ].value = this.renderTargetEdgeBuffer1.texture; - this.separableBlurMaterial1.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionX; - this.separableBlurMaterial1.uniforms[ 'kernelRadius' ].value = this.edgeThickness; - renderer.setRenderTarget( this.renderTargetBlurBuffer1 ); - renderer.clear(); - this.fsQuad.render( renderer ); - this.separableBlurMaterial1.uniforms[ 'colorTexture' ].value = this.renderTargetBlurBuffer1.texture; - this.separableBlurMaterial1.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionY; - renderer.setRenderTarget( this.renderTargetEdgeBuffer1 ); - renderer.clear(); - this.fsQuad.render( renderer ); - - // Apply Blur on quarter res - this.fsQuad.material = this.separableBlurMaterial2; - this.separableBlurMaterial2.uniforms[ 'colorTexture' ].value = this.renderTargetEdgeBuffer1.texture; - this.separableBlurMaterial2.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionX; - renderer.setRenderTarget( this.renderTargetBlurBuffer2 ); - renderer.clear(); - this.fsQuad.render( renderer ); - this.separableBlurMaterial2.uniforms[ 'colorTexture' ].value = this.renderTargetBlurBuffer2.texture; - this.separableBlurMaterial2.uniforms[ 'direction' ].value = OutlinePass.BlurDirectionY; - renderer.setRenderTarget( this.renderTargetEdgeBuffer2 ); - renderer.clear(); - this.fsQuad.render( renderer ); - - // Blend it additively over the input texture - this.fsQuad.material = this.overlayMaterial; - this.overlayMaterial.uniforms[ 'maskTexture' ].value = this.renderTargetMaskBuffer.texture; - this.overlayMaterial.uniforms[ 'edgeTexture1' ].value = this.renderTargetEdgeBuffer1.texture; - this.overlayMaterial.uniforms[ 'edgeTexture2' ].value = this.renderTargetEdgeBuffer2.texture; - this.overlayMaterial.uniforms[ 'patternTexture' ].value = this.patternTexture; - this.overlayMaterial.uniforms[ 'edgeStrength' ].value = this.edgeStrength; - this.overlayMaterial.uniforms[ 'edgeGlow' ].value = this.edgeGlow; - this.overlayMaterial.uniforms[ 'usePatternTexture' ].value = this.usePatternTexture; - - - if ( maskActive ) renderer.state.buffers.stencil.setTest( true ); - - renderer.setRenderTarget( readBuffer ); - this.fsQuad.render( renderer ); - - renderer.setClearColor( this._oldClearColor, this.oldClearAlpha ); - renderer.autoClear = oldAutoClear; - - } - - if ( this.renderToScreen ) { - - this.fsQuad.material = this.materialCopy; - this.copyUniforms[ 'tDiffuse' ].value = readBuffer.texture; - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } - - } - - getPrepareMaskMaterial() { - - return new ShaderMaterial( { - - uniforms: { - 'depthTexture': { value: null }, - 'cameraNearFar': { value: new Vector2( 0.5, 0.5 ) }, - 'textureMatrix': { value: null } - }, - - vertexShader: - `#include - #include - - varying vec4 projTexCoord; - varying vec4 vPosition; - uniform mat4 textureMatrix; - - void main() { - - #include - #include - #include - #include - #include - - vPosition = mvPosition; - - vec4 worldPosition = vec4( transformed, 1.0 ); - - #ifdef USE_INSTANCING - - worldPosition = instanceMatrix * worldPosition; - - #endif - - worldPosition = modelMatrix * worldPosition; - - projTexCoord = textureMatrix * worldPosition; - - }`, - - fragmentShader: - `#include - varying vec4 vPosition; - varying vec4 projTexCoord; - uniform sampler2D depthTexture; - uniform vec2 cameraNearFar; - - void main() { - - float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord )); - float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y ); - float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0; - gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0); - - }` - - } ); - - } - - getEdgeDetectionMaterial() { - - return new ShaderMaterial( { - - uniforms: { - 'maskTexture': { value: null }, - 'texSize': { value: new Vector2( 0.5, 0.5 ) }, - 'visibleEdgeColor': { value: new Vector3( 1.0, 1.0, 1.0 ) }, - 'hiddenEdgeColor': { value: new Vector3( 1.0, 1.0, 1.0 ) }, - }, - - vertexShader: - `varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: - `varying vec2 vUv; - - uniform sampler2D maskTexture; - uniform vec2 texSize; - uniform vec3 visibleEdgeColor; - uniform vec3 hiddenEdgeColor; - - void main() { - vec2 invSize = 1.0 / texSize; - vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize); - vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy); - vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy); - vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw); - vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw); - float diff1 = (c1.r - c2.r)*0.5; - float diff2 = (c3.r - c4.r)*0.5; - float d = length( vec2(diff1, diff2) ); - float a1 = min(c1.g, c2.g); - float a2 = min(c3.g, c4.g); - float visibilityFactor = min(a1, a2); - vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor; - gl_FragColor = vec4(edgeColor, 1.0) * vec4(d); - }` - } ); - - } - - getSeperableBlurMaterial( maxRadius ) { - - return new ShaderMaterial( { - - defines: { - 'MAX_RADIUS': maxRadius, - }, - - uniforms: { - 'colorTexture': { value: null }, - 'texSize': { value: new Vector2( 0.5, 0.5 ) }, - 'direction': { value: new Vector2( 0.5, 0.5 ) }, - 'kernelRadius': { value: 1.0 } - }, - - vertexShader: - `varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: - `#include - varying vec2 vUv; - uniform sampler2D colorTexture; - uniform vec2 texSize; - uniform vec2 direction; - uniform float kernelRadius; - - float gaussianPdf(in float x, in float sigma) { - return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma; - } - - void main() { - vec2 invSize = 1.0 / texSize; - float sigma = kernelRadius/2.0; - float weightSum = gaussianPdf(0.0, sigma); - vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum; - vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS); - vec2 uvOffset = delta; - for( int i = 1; i <= MAX_RADIUS; i ++ ) { - float x = kernelRadius * float(i) / float(MAX_RADIUS); - float w = gaussianPdf(x, sigma); - vec4 sample1 = texture2D( colorTexture, vUv + uvOffset); - vec4 sample2 = texture2D( colorTexture, vUv - uvOffset); - diffuseSum += ((sample1 + sample2) * w); - weightSum += (2.0 * w); - uvOffset += delta; - } - gl_FragColor = diffuseSum/weightSum; - }` - } ); - - } - - getOverlayMaterial() { - - return new ShaderMaterial( { - - uniforms: { - 'maskTexture': { value: null }, - 'edgeTexture1': { value: null }, - 'edgeTexture2': { value: null }, - 'patternTexture': { value: null }, - 'edgeStrength': { value: 1.0 }, - 'edgeGlow': { value: 1.0 }, - 'usePatternTexture': { value: 0.0 } - }, - - vertexShader: - `varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: - `varying vec2 vUv; - - uniform sampler2D maskTexture; - uniform sampler2D edgeTexture1; - uniform sampler2D edgeTexture2; - uniform sampler2D patternTexture; - uniform float edgeStrength; - uniform float edgeGlow; - uniform bool usePatternTexture; - - void main() { - vec4 edgeValue1 = texture2D(edgeTexture1, vUv); - vec4 edgeValue2 = texture2D(edgeTexture2, vUv); - vec4 maskColor = texture2D(maskTexture, vUv); - vec4 patternColor = texture2D(patternTexture, 6.0 * vUv); - float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5; - vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow; - vec4 finalColor = edgeStrength * maskColor.r * edgeValue; - if(usePatternTexture) - finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r); - gl_FragColor = finalColor; - }`, - blending: AdditiveBlending, - depthTest: false, - depthWrite: false, - transparent: true - } ); - - } - -} - -OutlinePass.BlurDirectionX = new Vector2( 1.0, 0.0 ); -OutlinePass.BlurDirectionY = new Vector2( 0.0, 1.0 ); - -export { OutlinePass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OutputPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OutputPass.js deleted file mode 100644 index a3a8178..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OutputPass.js +++ /dev/null @@ -1,97 +0,0 @@ -import { - ColorManagement, - RawShaderMaterial, - UniformsUtils, - LinearToneMapping, - ReinhardToneMapping, - CineonToneMapping, - AgXToneMapping, - ACESFilmicToneMapping, - NeutralToneMapping, - SRGBTransfer -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from './Pass.js'; -import { OutputShader } from '../shaders/OutputShader.js'; - -class OutputPass extends Pass { - - constructor() { - - super(); - - // - - const shader = OutputShader; - - this.uniforms = UniformsUtils.clone( shader.uniforms ); - - this.material = new RawShaderMaterial( { - name: shader.name, - uniforms: this.uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader - } ); - - this.fsQuad = new FullScreenQuad( this.material ); - - // internal cache - - this._outputColorSpace = null; - this._toneMapping = null; - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive */ ) { - - this.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.uniforms[ 'toneMappingExposure' ].value = renderer.toneMappingExposure; - - // rebuild defines if required - - if ( this._outputColorSpace !== renderer.outputColorSpace || this._toneMapping !== renderer.toneMapping ) { - - this._outputColorSpace = renderer.outputColorSpace; - this._toneMapping = renderer.toneMapping; - - this.material.defines = {}; - - if ( ColorManagement.getTransfer( this._outputColorSpace ) === SRGBTransfer ) this.material.defines.SRGB_TRANSFER = ''; - - if ( this._toneMapping === LinearToneMapping ) this.material.defines.LINEAR_TONE_MAPPING = ''; - else if ( this._toneMapping === ReinhardToneMapping ) this.material.defines.REINHARD_TONE_MAPPING = ''; - else if ( this._toneMapping === CineonToneMapping ) this.material.defines.CINEON_TONE_MAPPING = ''; - else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = ''; - else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = ''; - else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = ''; - - this.material.needsUpdate = true; - - } - - // - - if ( this.renderToScreen === true ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil ); - this.fsQuad.render( renderer ); - - } - - } - - dispose() { - - this.material.dispose(); - this.fsQuad.dispose(); - - } - -} - -export { OutputPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/OutputShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/OutputShader.js deleted file mode 100644 index ca1085d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/OutputShader.js +++ /dev/null @@ -1,85 +0,0 @@ -const OutputShader = { - - name: 'OutputShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'toneMappingExposure': { value: 1 } - - }, - - vertexShader: /* glsl */` - precision highp float; - - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - - attribute vec3 position; - attribute vec2 uv; - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - precision highp float; - - uniform sampler2D tDiffuse; - - #include - #include - - varying vec2 vUv; - - void main() { - - gl_FragColor = texture2D( tDiffuse, vUv ); - - // tone mapping - - #ifdef LINEAR_TONE_MAPPING - - gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); - - #elif defined( REINHARD_TONE_MAPPING ) - - gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); - - #elif defined( CINEON_TONE_MAPPING ) - - gl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb ); - - #elif defined( ACES_FILMIC_TONE_MAPPING ) - - gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); - - #elif defined( AGX_TONE_MAPPING ) - - gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); - - #elif defined( NEUTRAL_TONE_MAPPING ) - - gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); - - #endif - - // color space - - #ifdef SRGB_TRANSFER - - gl_FragColor = sRGBTransferOETF( gl_FragColor ); - - #endif - - }` - -}; - -export { OutputShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PCDLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PCDLoader.js deleted file mode 100644 index 18f5e6e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PCDLoader.js +++ /dev/null @@ -1,467 +0,0 @@ -import { - BufferGeometry, - Color, - FileLoader, - Float32BufferAttribute, - Int32BufferAttribute, - Loader, - Points, - PointsMaterial -} from '/static/javascript/three/build/three.module.js'; - -class PCDLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.littleEndian = true; - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( scope.manager ); - loader.setPath( scope.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( scope.requestHeader ); - loader.setWithCredentials( scope.withCredentials ); - loader.load( url, function ( data ) { - - try { - - onLoad( scope.parse( data ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - // from https://gitlab.com/taketwo/three-pcd-loader/blob/master/decompress-lzf.js - - function decompressLZF( inData, outLength ) { - - const inLength = inData.length; - const outData = new Uint8Array( outLength ); - let inPtr = 0; - let outPtr = 0; - let ctrl; - let len; - let ref; - do { - - ctrl = inData[ inPtr ++ ]; - if ( ctrl < ( 1 << 5 ) ) { - - ctrl ++; - if ( outPtr + ctrl > outLength ) throw new Error( 'Output buffer is not large enough' ); - if ( inPtr + ctrl > inLength ) throw new Error( 'Invalid compressed data' ); - do { - - outData[ outPtr ++ ] = inData[ inPtr ++ ]; - - } while ( -- ctrl ); - - } else { - - len = ctrl >> 5; - ref = outPtr - ( ( ctrl & 0x1f ) << 8 ) - 1; - if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' ); - if ( len === 7 ) { - - len += inData[ inPtr ++ ]; - if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' ); - - } - - ref -= inData[ inPtr ++ ]; - if ( outPtr + len + 2 > outLength ) throw new Error( 'Output buffer is not large enough' ); - if ( ref < 0 ) throw new Error( 'Invalid compressed data' ); - if ( ref >= outPtr ) throw new Error( 'Invalid compressed data' ); - do { - - outData[ outPtr ++ ] = outData[ ref ++ ]; - - } while ( -- len + 2 ); - - } - - } while ( inPtr < inLength ); - - return outData; - - } - - function parseHeader( data ) { - - const PCDheader = {}; - const result1 = data.search( /[\r\n]DATA\s(\S*)\s/i ); - const result2 = /[\r\n]DATA\s(\S*)\s/i.exec( data.slice( result1 - 1 ) ); - - PCDheader.data = result2[ 1 ]; - PCDheader.headerLen = result2[ 0 ].length + result1; - PCDheader.str = data.slice( 0, PCDheader.headerLen ); - - // remove comments - - PCDheader.str = PCDheader.str.replace( /#.*/gi, '' ); - - // parse - - PCDheader.version = /VERSION (.*)/i.exec( PCDheader.str ); - PCDheader.fields = /FIELDS (.*)/i.exec( PCDheader.str ); - PCDheader.size = /SIZE (.*)/i.exec( PCDheader.str ); - PCDheader.type = /TYPE (.*)/i.exec( PCDheader.str ); - PCDheader.count = /COUNT (.*)/i.exec( PCDheader.str ); - PCDheader.width = /WIDTH (.*)/i.exec( PCDheader.str ); - PCDheader.height = /HEIGHT (.*)/i.exec( PCDheader.str ); - PCDheader.viewpoint = /VIEWPOINT (.*)/i.exec( PCDheader.str ); - PCDheader.points = /POINTS (.*)/i.exec( PCDheader.str ); - - // evaluate - - if ( PCDheader.version !== null ) - PCDheader.version = parseFloat( PCDheader.version[ 1 ] ); - - PCDheader.fields = ( PCDheader.fields !== null ) ? PCDheader.fields[ 1 ].split( ' ' ) : []; - - if ( PCDheader.type !== null ) - PCDheader.type = PCDheader.type[ 1 ].split( ' ' ); - - if ( PCDheader.width !== null ) - PCDheader.width = parseInt( PCDheader.width[ 1 ] ); - - if ( PCDheader.height !== null ) - PCDheader.height = parseInt( PCDheader.height[ 1 ] ); - - if ( PCDheader.viewpoint !== null ) - PCDheader.viewpoint = PCDheader.viewpoint[ 1 ]; - - if ( PCDheader.points !== null ) - PCDheader.points = parseInt( PCDheader.points[ 1 ], 10 ); - - if ( PCDheader.points === null ) - PCDheader.points = PCDheader.width * PCDheader.height; - - if ( PCDheader.size !== null ) { - - PCDheader.size = PCDheader.size[ 1 ].split( ' ' ).map( function ( x ) { - - return parseInt( x, 10 ); - - } ); - - } - - if ( PCDheader.count !== null ) { - - PCDheader.count = PCDheader.count[ 1 ].split( ' ' ).map( function ( x ) { - - return parseInt( x, 10 ); - - } ); - - } else { - - PCDheader.count = []; - - for ( let i = 0, l = PCDheader.fields.length; i < l; i ++ ) { - - PCDheader.count.push( 1 ); - - } - - } - - PCDheader.offset = {}; - - let sizeSum = 0; - - for ( let i = 0, l = PCDheader.fields.length; i < l; i ++ ) { - - if ( PCDheader.data === 'ascii' ) { - - PCDheader.offset[ PCDheader.fields[ i ] ] = i; - - } else { - - PCDheader.offset[ PCDheader.fields[ i ] ] = sizeSum; - sizeSum += PCDheader.size[ i ] * PCDheader.count[ i ]; - - } - - } - - // for binary only - - PCDheader.rowSize = sizeSum; - - return PCDheader; - - } - - const textData = new TextDecoder().decode( data ); - - // parse header (always ascii format) - - const PCDheader = parseHeader( textData ); - - // parse data - - const position = []; - const normal = []; - const color = []; - const intensity = []; - const label = []; - - const c = new Color(); - - // ascii - - if ( PCDheader.data === 'ascii' ) { - - const offset = PCDheader.offset; - const pcdData = textData.slice( PCDheader.headerLen ); - const lines = pcdData.split( '\n' ); - - for ( let i = 0, l = lines.length; i < l; i ++ ) { - - if ( lines[ i ] === '' ) continue; - - const line = lines[ i ].split( ' ' ); - - if ( offset.x !== undefined ) { - - position.push( parseFloat( line[ offset.x ] ) ); - position.push( parseFloat( line[ offset.y ] ) ); - position.push( parseFloat( line[ offset.z ] ) ); - - } - - if ( offset.rgb !== undefined ) { - - const rgb_field_index = PCDheader.fields.findIndex( ( field ) => field === 'rgb' ); - const rgb_type = PCDheader.type[ rgb_field_index ]; - - const float = parseFloat( line[ offset.rgb ] ); - let rgb = float; - - if ( rgb_type === 'F' ) { - - // treat float values as int - // https://github.com/daavoo/pyntcloud/pull/204/commits/7b4205e64d5ed09abe708b2e91b615690c24d518 - const farr = new Float32Array( 1 ); - farr[ 0 ] = float; - rgb = new Int32Array( farr.buffer )[ 0 ]; - - } - - const r = ( ( rgb >> 16 ) & 0x0000ff ) / 255; - const g = ( ( rgb >> 8 ) & 0x0000ff ) / 255; - const b = ( ( rgb >> 0 ) & 0x0000ff ) / 255; - - c.set( r, g, b ).convertSRGBToLinear(); - - color.push( c.r, c.g, c.b ); - - } - - if ( offset.normal_x !== undefined ) { - - normal.push( parseFloat( line[ offset.normal_x ] ) ); - normal.push( parseFloat( line[ offset.normal_y ] ) ); - normal.push( parseFloat( line[ offset.normal_z ] ) ); - - } - - if ( offset.intensity !== undefined ) { - - intensity.push( parseFloat( line[ offset.intensity ] ) ); - - } - - if ( offset.label !== undefined ) { - - label.push( parseInt( line[ offset.label ] ) ); - - } - - } - - } - - // binary-compressed - - // normally data in PCD files are organized as array of structures: XYZRGBXYZRGB - // binary compressed PCD files organize their data as structure of arrays: XXYYZZRGBRGB - // that requires a totally different parsing approach compared to non-compressed data - - if ( PCDheader.data === 'binary_compressed' ) { - - const sizes = new Uint32Array( data.slice( PCDheader.headerLen, PCDheader.headerLen + 8 ) ); - const compressedSize = sizes[ 0 ]; - const decompressedSize = sizes[ 1 ]; - const decompressed = decompressLZF( new Uint8Array( data, PCDheader.headerLen + 8, compressedSize ), decompressedSize ); - const dataview = new DataView( decompressed.buffer ); - - const offset = PCDheader.offset; - - for ( let i = 0; i < PCDheader.points; i ++ ) { - - if ( offset.x !== undefined ) { - - const xIndex = PCDheader.fields.indexOf( 'x' ); - const yIndex = PCDheader.fields.indexOf( 'y' ); - const zIndex = PCDheader.fields.indexOf( 'z' ); - position.push( dataview.getFloat32( ( PCDheader.points * offset.x ) + PCDheader.size[ xIndex ] * i, this.littleEndian ) ); - position.push( dataview.getFloat32( ( PCDheader.points * offset.y ) + PCDheader.size[ yIndex ] * i, this.littleEndian ) ); - position.push( dataview.getFloat32( ( PCDheader.points * offset.z ) + PCDheader.size[ zIndex ] * i, this.littleEndian ) ); - - } - - if ( offset.rgb !== undefined ) { - - const rgbIndex = PCDheader.fields.indexOf( 'rgb' ); - - const r = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 2 ) / 255.0; - const g = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 1 ) / 255.0; - const b = dataview.getUint8( ( PCDheader.points * offset.rgb ) + PCDheader.size[ rgbIndex ] * i + 0 ) / 255.0; - - c.set( r, g, b ).convertSRGBToLinear(); - - color.push( c.r, c.g, c.b ); - - } - - if ( offset.normal_x !== undefined ) { - - const xIndex = PCDheader.fields.indexOf( 'normal_x' ); - const yIndex = PCDheader.fields.indexOf( 'normal_y' ); - const zIndex = PCDheader.fields.indexOf( 'normal_z' ); - normal.push( dataview.getFloat32( ( PCDheader.points * offset.normal_x ) + PCDheader.size[ xIndex ] * i, this.littleEndian ) ); - normal.push( dataview.getFloat32( ( PCDheader.points * offset.normal_y ) + PCDheader.size[ yIndex ] * i, this.littleEndian ) ); - normal.push( dataview.getFloat32( ( PCDheader.points * offset.normal_z ) + PCDheader.size[ zIndex ] * i, this.littleEndian ) ); - - } - - if ( offset.intensity !== undefined ) { - - const intensityIndex = PCDheader.fields.indexOf( 'intensity' ); - intensity.push( dataview.getFloat32( ( PCDheader.points * offset.intensity ) + PCDheader.size[ intensityIndex ] * i, this.littleEndian ) ); - - } - - if ( offset.label !== undefined ) { - - const labelIndex = PCDheader.fields.indexOf( 'label' ); - label.push( dataview.getInt32( ( PCDheader.points * offset.label ) + PCDheader.size[ labelIndex ] * i, this.littleEndian ) ); - - } - - } - - } - - // binary - - if ( PCDheader.data === 'binary' ) { - - const dataview = new DataView( data, PCDheader.headerLen ); - const offset = PCDheader.offset; - - for ( let i = 0, row = 0; i < PCDheader.points; i ++, row += PCDheader.rowSize ) { - - if ( offset.x !== undefined ) { - - position.push( dataview.getFloat32( row + offset.x, this.littleEndian ) ); - position.push( dataview.getFloat32( row + offset.y, this.littleEndian ) ); - position.push( dataview.getFloat32( row + offset.z, this.littleEndian ) ); - - } - - if ( offset.rgb !== undefined ) { - - const r = dataview.getUint8( row + offset.rgb + 2 ) / 255.0; - const g = dataview.getUint8( row + offset.rgb + 1 ) / 255.0; - const b = dataview.getUint8( row + offset.rgb + 0 ) / 255.0; - - c.set( r, g, b ).convertSRGBToLinear(); - - color.push( c.r, c.g, c.b ); - - } - - if ( offset.normal_x !== undefined ) { - - normal.push( dataview.getFloat32( row + offset.normal_x, this.littleEndian ) ); - normal.push( dataview.getFloat32( row + offset.normal_y, this.littleEndian ) ); - normal.push( dataview.getFloat32( row + offset.normal_z, this.littleEndian ) ); - - } - - if ( offset.intensity !== undefined ) { - - intensity.push( dataview.getFloat32( row + offset.intensity, this.littleEndian ) ); - - } - - if ( offset.label !== undefined ) { - - label.push( dataview.getInt32( row + offset.label, this.littleEndian ) ); - - } - - } - - } - - // build geometry - - const geometry = new BufferGeometry(); - - if ( position.length > 0 ) geometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) ); - if ( normal.length > 0 ) geometry.setAttribute( 'normal', new Float32BufferAttribute( normal, 3 ) ); - if ( color.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( color, 3 ) ); - if ( intensity.length > 0 ) geometry.setAttribute( 'intensity', new Float32BufferAttribute( intensity, 1 ) ); - if ( label.length > 0 ) geometry.setAttribute( 'label', new Int32BufferAttribute( label, 1 ) ); - - geometry.computeBoundingSphere(); - - // build material - - const material = new PointsMaterial( { size: 0.005 } ); - - if ( color.length > 0 ) { - - material.vertexColors = true; - - } - - // build point cloud - - return new Points( geometry, material ); - - } - -} - -export { PCDLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PDBLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PDBLoader.js deleted file mode 100644 index d7badc2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PDBLoader.js +++ /dev/null @@ -1,232 +0,0 @@ -import { - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Loader, - Color -} from '/static/javascript/three/build/three.module.js'; - -class PDBLoader 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( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - // Based on CanvasMol PDB parser - - parse( text ) { - - function trim( text ) { - - return text.replace( /^\s\s*/, '' ).replace( /\s\s*$/, '' ); - - } - - function capitalize( text ) { - - return text.charAt( 0 ).toUpperCase() + text.slice( 1 ).toLowerCase(); - - } - - function hash( s, e ) { - - return 's' + Math.min( s, e ) + 'e' + Math.max( s, e ); - - } - - function parseBond( start, length, satom, i ) { - - const eatom = parseInt( lines[ i ].slice( start, start + length ) ); - - if ( eatom ) { - - const h = hash( satom, eatom ); - - if ( _bhash[ h ] === undefined ) { - - _bonds.push( [ satom - 1, eatom - 1, 1 ] ); - _bhash[ h ] = _bonds.length - 1; - - } else { - - // doesn't really work as almost all PDBs - // have just normal bonds appearing multiple - // times instead of being double/triple bonds - // bonds[bhash[h]][2] += 1; - - } - - } - - } - - function buildGeometry() { - - const build = { - geometryAtoms: new BufferGeometry(), - geometryBonds: new BufferGeometry(), - json: { - atoms: atoms - } - }; - - const geometryAtoms = build.geometryAtoms; - const geometryBonds = build.geometryBonds; - - const verticesAtoms = []; - const colorsAtoms = []; - const verticesBonds = []; - - // atoms - - const c = new Color(); - - for ( let i = 0, l = atoms.length; i < l; i ++ ) { - - const atom = atoms[ i ]; - - const x = atom[ 0 ]; - const y = atom[ 1 ]; - const z = atom[ 2 ]; - - verticesAtoms.push( x, y, z ); - - const r = atom[ 3 ][ 0 ] / 255; - const g = atom[ 3 ][ 1 ] / 255; - const b = atom[ 3 ][ 2 ] / 255; - - c.set( r, g, b ).convertSRGBToLinear(); - - colorsAtoms.push( c.r, c.g, c.b ); - - } - - // bonds - - for ( let i = 0, l = _bonds.length; i < l; i ++ ) { - - const bond = _bonds[ i ]; - - const start = bond[ 0 ]; - const end = bond[ 1 ]; - - const startAtom = _atomMap[ start ]; - const endAtom = _atomMap[ end ]; - - let x = startAtom[ 0 ]; - let y = startAtom[ 1 ]; - let z = startAtom[ 2 ]; - - verticesBonds.push( x, y, z ); - - x = endAtom[ 0 ]; - y = endAtom[ 1 ]; - z = endAtom[ 2 ]; - - verticesBonds.push( x, y, z ); - - } - - // build geometry - - geometryAtoms.setAttribute( 'position', new Float32BufferAttribute( verticesAtoms, 3 ) ); - geometryAtoms.setAttribute( 'color', new Float32BufferAttribute( colorsAtoms, 3 ) ); - - geometryBonds.setAttribute( 'position', new Float32BufferAttribute( verticesBonds, 3 ) ); - - return build; - - } - - const CPK = { h: [ 255, 255, 255 ], he: [ 217, 255, 255 ], li: [ 204, 128, 255 ], be: [ 194, 255, 0 ], b: [ 255, 181, 181 ], c: [ 144, 144, 144 ], n: [ 48, 80, 248 ], o: [ 255, 13, 13 ], f: [ 144, 224, 80 ], ne: [ 179, 227, 245 ], na: [ 171, 92, 242 ], mg: [ 138, 255, 0 ], al: [ 191, 166, 166 ], si: [ 240, 200, 160 ], p: [ 255, 128, 0 ], s: [ 255, 255, 48 ], cl: [ 31, 240, 31 ], ar: [ 128, 209, 227 ], k: [ 143, 64, 212 ], ca: [ 61, 255, 0 ], sc: [ 230, 230, 230 ], ti: [ 191, 194, 199 ], v: [ 166, 166, 171 ], cr: [ 138, 153, 199 ], mn: [ 156, 122, 199 ], fe: [ 224, 102, 51 ], co: [ 240, 144, 160 ], ni: [ 80, 208, 80 ], cu: [ 200, 128, 51 ], zn: [ 125, 128, 176 ], ga: [ 194, 143, 143 ], ge: [ 102, 143, 143 ], as: [ 189, 128, 227 ], se: [ 255, 161, 0 ], br: [ 166, 41, 41 ], kr: [ 92, 184, 209 ], rb: [ 112, 46, 176 ], sr: [ 0, 255, 0 ], y: [ 148, 255, 255 ], zr: [ 148, 224, 224 ], nb: [ 115, 194, 201 ], mo: [ 84, 181, 181 ], tc: [ 59, 158, 158 ], ru: [ 36, 143, 143 ], rh: [ 10, 125, 140 ], pd: [ 0, 105, 133 ], ag: [ 192, 192, 192 ], cd: [ 255, 217, 143 ], in: [ 166, 117, 115 ], sn: [ 102, 128, 128 ], sb: [ 158, 99, 181 ], te: [ 212, 122, 0 ], i: [ 148, 0, 148 ], xe: [ 66, 158, 176 ], cs: [ 87, 23, 143 ], ba: [ 0, 201, 0 ], la: [ 112, 212, 255 ], ce: [ 255, 255, 199 ], pr: [ 217, 255, 199 ], nd: [ 199, 255, 199 ], pm: [ 163, 255, 199 ], sm: [ 143, 255, 199 ], eu: [ 97, 255, 199 ], gd: [ 69, 255, 199 ], tb: [ 48, 255, 199 ], dy: [ 31, 255, 199 ], ho: [ 0, 255, 156 ], er: [ 0, 230, 117 ], tm: [ 0, 212, 82 ], yb: [ 0, 191, 56 ], lu: [ 0, 171, 36 ], hf: [ 77, 194, 255 ], ta: [ 77, 166, 255 ], w: [ 33, 148, 214 ], re: [ 38, 125, 171 ], os: [ 38, 102, 150 ], ir: [ 23, 84, 135 ], pt: [ 208, 208, 224 ], au: [ 255, 209, 35 ], hg: [ 184, 184, 208 ], tl: [ 166, 84, 77 ], pb: [ 87, 89, 97 ], bi: [ 158, 79, 181 ], po: [ 171, 92, 0 ], at: [ 117, 79, 69 ], rn: [ 66, 130, 150 ], fr: [ 66, 0, 102 ], ra: [ 0, 125, 0 ], ac: [ 112, 171, 250 ], th: [ 0, 186, 255 ], pa: [ 0, 161, 255 ], u: [ 0, 143, 255 ], np: [ 0, 128, 255 ], pu: [ 0, 107, 255 ], am: [ 84, 92, 242 ], cm: [ 120, 92, 227 ], bk: [ 138, 79, 227 ], cf: [ 161, 54, 212 ], es: [ 179, 31, 212 ], fm: [ 179, 31, 186 ], md: [ 179, 13, 166 ], no: [ 189, 13, 135 ], lr: [ 199, 0, 102 ], rf: [ 204, 0, 89 ], db: [ 209, 0, 79 ], sg: [ 217, 0, 69 ], bh: [ 224, 0, 56 ], hs: [ 230, 0, 46 ], mt: [ 235, 0, 38 ], ds: [ 235, 0, 38 ], rg: [ 235, 0, 38 ], cn: [ 235, 0, 38 ], uut: [ 235, 0, 38 ], uuq: [ 235, 0, 38 ], uup: [ 235, 0, 38 ], uuh: [ 235, 0, 38 ], uus: [ 235, 0, 38 ], uuo: [ 235, 0, 38 ] }; - - const atoms = []; - - const _bonds = []; - const _bhash = {}; - const _atomMap = {}; - - // parse - - const lines = text.split( '\n' ); - - for ( let i = 0, l = lines.length; i < l; i ++ ) { - - if ( lines[ i ].slice( 0, 4 ) === 'ATOM' || lines[ i ].slice( 0, 6 ) === 'HETATM' ) { - - const x = parseFloat( lines[ i ].slice( 30, 37 ) ); - const y = parseFloat( lines[ i ].slice( 38, 45 ) ); - const z = parseFloat( lines[ i ].slice( 46, 53 ) ); - const index = parseInt( lines[ i ].slice( 6, 11 ) ) - 1; - - let e = trim( lines[ i ].slice( 76, 78 ) ).toLowerCase(); - - if ( e === '' ) { - - e = trim( lines[ i ].slice( 12, 14 ) ).toLowerCase(); - - } - - const atomData = [ x, y, z, CPK[ e ], capitalize( e ) ]; - - atoms.push( atomData ); - _atomMap[ index ] = atomData; - - } else if ( lines[ i ].slice( 0, 6 ) === 'CONECT' ) { - - const satom = parseInt( lines[ i ].slice( 6, 11 ) ); - - parseBond( 11, 5, satom, i ); - parseBond( 16, 5, satom, i ); - parseBond( 21, 5, satom, i ); - parseBond( 26, 5, satom, i ); - - } - - } - - // build and return geometry - - return buildGeometry(); - - } - -} - -export { PDBLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PLYLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PLYLoader.js deleted file mode 100644 index fa14d0d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PLYLoader.js +++ /dev/null @@ -1,771 +0,0 @@ -import { - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Loader, - Color -} from '/static/javascript/three/build/three.module.js'; - -/** - * Description: A THREE loader for PLY ASCII files (known as the Polygon - * File Format or the Stanford Triangle Format). - * - * Limitations: ASCII decoding assumes file is UTF-8. - * - * Usage: - * const loader = new PLYLoader(); - * loader.load('./models/ply/ascii/dolphins.ply', function (geometry) { - * - * scene.add( new THREE.Mesh( geometry ) ); - * - * } ); - * - * If the PLY file uses non standard property names, they can be mapped while - * loading. For example, the following maps the properties - * “diffuse_(red|green|blue)” in the file to standard color names. - * - * loader.setPropertyNameMapping( { - * diffuse_red: 'red', - * diffuse_green: 'green', - * diffuse_blue: 'blue' - * } ); - * - * Custom properties outside of the defaults for position, uv, normal - * and color attributes can be added using the setCustomPropertyNameMapping method. - * For example, the following maps the element properties “custom_property_a” - * and “custom_property_b” to an attribute “customAttribute” with an item size of 2. - * Attribute item sizes are set from the number of element properties in the property array. - * - * loader.setCustomPropertyNameMapping( { - * customAttribute: ['custom_property_a', 'custom_property_b'], - * } ); - * - */ - -const _color = new Color(); - -class PLYLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - this.propertyNameMapping = {}; - this.customPropertyMapping = {}; - - } - - load( url, onLoad, onProgress, onError ) { - - const scope = this; - - const loader = new FileLoader( this.manager ); - loader.setPath( this.path ); - loader.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - setPropertyNameMapping( mapping ) { - - this.propertyNameMapping = mapping; - - } - - setCustomPropertyNameMapping( mapping ) { - - this.customPropertyMapping = mapping; - - } - - parse( data ) { - - function parseHeader( data, headerLength = 0 ) { - - const patternHeader = /^ply([\s\S]*)end_header(\r\n|\r|\n)/; - let headerText = ''; - const result = patternHeader.exec( data ); - - if ( result !== null ) { - - headerText = result[ 1 ]; - - } - - const header = { - comments: [], - elements: [], - headerLength: headerLength, - objInfo: '' - }; - - const lines = headerText.split( /\r\n|\r|\n/ ); - let currentElement; - - function make_ply_element_property( propertValues, propertyNameMapping ) { - - const property = { type: propertValues[ 0 ] }; - - if ( property.type === 'list' ) { - - property.name = propertValues[ 3 ]; - property.countType = propertValues[ 1 ]; - property.itemType = propertValues[ 2 ]; - - } else { - - property.name = propertValues[ 1 ]; - - } - - if ( property.name in propertyNameMapping ) { - - property.name = propertyNameMapping[ property.name ]; - - } - - return property; - - } - - for ( let i = 0; i < lines.length; i ++ ) { - - let line = lines[ i ]; - line = line.trim(); - - if ( line === '' ) continue; - - const lineValues = line.split( /\s+/ ); - const lineType = lineValues.shift(); - line = lineValues.join( ' ' ); - - switch ( lineType ) { - - case 'format': - - header.format = lineValues[ 0 ]; - header.version = lineValues[ 1 ]; - - break; - - case 'comment': - - header.comments.push( line ); - - break; - - case 'element': - - if ( currentElement !== undefined ) { - - header.elements.push( currentElement ); - - } - - currentElement = {}; - currentElement.name = lineValues[ 0 ]; - currentElement.count = parseInt( lineValues[ 1 ] ); - currentElement.properties = []; - - break; - - case 'property': - - currentElement.properties.push( make_ply_element_property( lineValues, scope.propertyNameMapping ) ); - - break; - - case 'obj_info': - - header.objInfo = line; - - break; - - - default: - - console.log( 'unhandled', lineType, lineValues ); - - } - - } - - if ( currentElement !== undefined ) { - - header.elements.push( currentElement ); - - } - - return header; - - } - - function parseASCIINumber( n, type ) { - - switch ( type ) { - - case 'char': case 'uchar': case 'short': case 'ushort': case 'int': case 'uint': - case 'int8': case 'uint8': case 'int16': case 'uint16': case 'int32': case 'uint32': - - return parseInt( n ); - - case 'float': case 'double': case 'float32': case 'float64': - - return parseFloat( n ); - - } - - } - - function parseASCIIElement( properties, tokens ) { - - const element = {}; - - for ( let i = 0; i < properties.length; i ++ ) { - - if ( tokens.empty() ) return null; - - if ( properties[ i ].type === 'list' ) { - - const list = []; - const n = parseASCIINumber( tokens.next(), properties[ i ].countType ); - - for ( let j = 0; j < n; j ++ ) { - - if ( tokens.empty() ) return null; - - list.push( parseASCIINumber( tokens.next(), properties[ i ].itemType ) ); - - } - - element[ properties[ i ].name ] = list; - - } else { - - element[ properties[ i ].name ] = parseASCIINumber( tokens.next(), properties[ i ].type ); - - } - - } - - return element; - - } - - function createBuffer() { - - const buffer = { - indices: [], - vertices: [], - normals: [], - uvs: [], - faceVertexUvs: [], - colors: [], - faceVertexColors: [] - }; - - for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) { - - buffer[ customProperty ] = []; - - } - - return buffer; - - } - - function mapElementAttributes( properties ) { - - const elementNames = properties.map( property => { - - return property.name; - - } ); - - function findAttrName( names ) { - - for ( let i = 0, l = names.length; i < l; i ++ ) { - - const name = names[ i ]; - - if ( elementNames.includes( name ) ) return name; - - } - - return null; - - } - - return { - attrX: findAttrName( [ 'x', 'px', 'posx' ] ) || 'x', - attrY: findAttrName( [ 'y', 'py', 'posy' ] ) || 'y', - attrZ: findAttrName( [ 'z', 'pz', 'posz' ] ) || 'z', - attrNX: findAttrName( [ 'nx', 'normalx' ] ), - attrNY: findAttrName( [ 'ny', 'normaly' ] ), - attrNZ: findAttrName( [ 'nz', 'normalz' ] ), - attrS: findAttrName( [ 's', 'u', 'texture_u', 'tx' ] ), - attrT: findAttrName( [ 't', 'v', 'texture_v', 'ty' ] ), - attrR: findAttrName( [ 'red', 'diffuse_red', 'r', 'diffuse_r' ] ), - attrG: findAttrName( [ 'green', 'diffuse_green', 'g', 'diffuse_g' ] ), - attrB: findAttrName( [ 'blue', 'diffuse_blue', 'b', 'diffuse_b' ] ), - }; - - } - - function parseASCII( data, header ) { - - // PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format) - - const buffer = createBuffer(); - - const patternBody = /end_header\s+(\S[\s\S]*\S|\S)\s*$/; - let body, matches; - - if ( ( matches = patternBody.exec( data ) ) !== null ) { - - body = matches[ 1 ].split( /\s+/ ); - - } else { - - body = [ ]; - - } - - const tokens = new ArrayStream( body ); - - loop: for ( let i = 0; i < header.elements.length; i ++ ) { - - const elementDesc = header.elements[ i ]; - const attributeMap = mapElementAttributes( elementDesc.properties ); - - for ( let j = 0; j < elementDesc.count; j ++ ) { - - const element = parseASCIIElement( elementDesc.properties, tokens ); - - if ( ! element ) break loop; - - handleElement( buffer, elementDesc.name, element, attributeMap ); - - } - - } - - return postProcess( buffer ); - - } - - function postProcess( buffer ) { - - let geometry = new BufferGeometry(); - - // mandatory buffer data - - if ( buffer.indices.length > 0 ) { - - geometry.setIndex( buffer.indices ); - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( buffer.vertices, 3 ) ); - - // optional buffer data - - if ( buffer.normals.length > 0 ) { - - geometry.setAttribute( 'normal', new Float32BufferAttribute( buffer.normals, 3 ) ); - - } - - if ( buffer.uvs.length > 0 ) { - - geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.uvs, 2 ) ); - - } - - if ( buffer.colors.length > 0 ) { - - geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.colors, 3 ) ); - - } - - if ( buffer.faceVertexUvs.length > 0 || buffer.faceVertexColors.length > 0 ) { - - geometry = geometry.toNonIndexed(); - - if ( buffer.faceVertexUvs.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) ); - if ( buffer.faceVertexColors.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.faceVertexColors, 3 ) ); - - } - - // custom buffer data - - for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) { - - if ( buffer[ customProperty ].length > 0 ) { - - geometry.setAttribute( - customProperty, - new Float32BufferAttribute( - buffer[ customProperty ], - scope.customPropertyMapping[ customProperty ].length - ) - ); - - } - - } - - geometry.computeBoundingSphere(); - - return geometry; - - } - - function handleElement( buffer, elementName, element, cacheEntry ) { - - if ( elementName === 'vertex' ) { - - buffer.vertices.push( element[ cacheEntry.attrX ], element[ cacheEntry.attrY ], element[ cacheEntry.attrZ ] ); - - if ( cacheEntry.attrNX !== null && cacheEntry.attrNY !== null && cacheEntry.attrNZ !== null ) { - - buffer.normals.push( element[ cacheEntry.attrNX ], element[ cacheEntry.attrNY ], element[ cacheEntry.attrNZ ] ); - - } - - if ( cacheEntry.attrS !== null && cacheEntry.attrT !== null ) { - - buffer.uvs.push( element[ cacheEntry.attrS ], element[ cacheEntry.attrT ] ); - - } - - if ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) { - - _color.setRGB( - element[ cacheEntry.attrR ] / 255.0, - element[ cacheEntry.attrG ] / 255.0, - element[ cacheEntry.attrB ] / 255.0 - ).convertSRGBToLinear(); - - buffer.colors.push( _color.r, _color.g, _color.b ); - - } - - for ( const customProperty of Object.keys( scope.customPropertyMapping ) ) { - - for ( const elementProperty of scope.customPropertyMapping[ customProperty ] ) { - - buffer[ customProperty ].push( element[ elementProperty ] ); - - } - - } - - } else if ( elementName === 'face' ) { - - const vertex_indices = element.vertex_indices || element.vertex_index; // issue #9338 - const texcoord = element.texcoord; - - if ( vertex_indices.length === 3 ) { - - buffer.indices.push( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] ); - - if ( texcoord && texcoord.length === 6 ) { - - buffer.faceVertexUvs.push( texcoord[ 0 ], texcoord[ 1 ] ); - buffer.faceVertexUvs.push( texcoord[ 2 ], texcoord[ 3 ] ); - buffer.faceVertexUvs.push( texcoord[ 4 ], texcoord[ 5 ] ); - - } - - } else if ( vertex_indices.length === 4 ) { - - buffer.indices.push( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] ); - buffer.indices.push( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] ); - - } - - // face colors - - if ( cacheEntry.attrR !== null && cacheEntry.attrG !== null && cacheEntry.attrB !== null ) { - - _color.setRGB( - element[ cacheEntry.attrR ] / 255.0, - element[ cacheEntry.attrG ] / 255.0, - element[ cacheEntry.attrB ] / 255.0 - ).convertSRGBToLinear(); - buffer.faceVertexColors.push( _color.r, _color.g, _color.b ); - buffer.faceVertexColors.push( _color.r, _color.g, _color.b ); - buffer.faceVertexColors.push( _color.r, _color.g, _color.b ); - - } - - } - - } - - function binaryReadElement( at, properties ) { - - const element = {}; - let read = 0; - - for ( let i = 0; i < properties.length; i ++ ) { - - const property = properties[ i ]; - const valueReader = property.valueReader; - - if ( property.type === 'list' ) { - - const list = []; - - const n = property.countReader.read( at + read ); - read += property.countReader.size; - - for ( let j = 0; j < n; j ++ ) { - - list.push( valueReader.read( at + read ) ); - read += valueReader.size; - - } - - element[ property.name ] = list; - - } else { - - element[ property.name ] = valueReader.read( at + read ); - read += valueReader.size; - - } - - } - - return [ element, read ]; - - } - - function setPropertyBinaryReaders( properties, body, little_endian ) { - - function getBinaryReader( dataview, type, little_endian ) { - - switch ( type ) { - - // corespondences for non-specific length types here match rply: - case 'int8': case 'char': return { read: ( at ) => { - - return dataview.getInt8( at ); - - }, size: 1 }; - case 'uint8': case 'uchar': return { read: ( at ) => { - - return dataview.getUint8( at ); - - }, size: 1 }; - case 'int16': case 'short': return { read: ( at ) => { - - return dataview.getInt16( at, little_endian ); - - }, size: 2 }; - case 'uint16': case 'ushort': return { read: ( at ) => { - - return dataview.getUint16( at, little_endian ); - - }, size: 2 }; - case 'int32': case 'int': return { read: ( at ) => { - - return dataview.getInt32( at, little_endian ); - - }, size: 4 }; - case 'uint32': case 'uint': return { read: ( at ) => { - - return dataview.getUint32( at, little_endian ); - - }, size: 4 }; - case 'float32': case 'float': return { read: ( at ) => { - - return dataview.getFloat32( at, little_endian ); - - }, size: 4 }; - case 'float64': case 'double': return { read: ( at ) => { - - return dataview.getFloat64( at, little_endian ); - - }, size: 8 }; - - } - - } - - for ( let i = 0, l = properties.length; i < l; i ++ ) { - - const property = properties[ i ]; - - if ( property.type === 'list' ) { - - property.countReader = getBinaryReader( body, property.countType, little_endian ); - property.valueReader = getBinaryReader( body, property.itemType, little_endian ); - - } else { - - property.valueReader = getBinaryReader( body, property.type, little_endian ); - - } - - } - - } - - function parseBinary( data, header ) { - - const buffer = createBuffer(); - - const little_endian = ( header.format === 'binary_little_endian' ); - const body = new DataView( data, header.headerLength ); - let result, loc = 0; - - for ( let currentElement = 0; currentElement < header.elements.length; currentElement ++ ) { - - const elementDesc = header.elements[ currentElement ]; - const properties = elementDesc.properties; - const attributeMap = mapElementAttributes( properties ); - - setPropertyBinaryReaders( properties, body, little_endian ); - - for ( let currentElementCount = 0; currentElementCount < elementDesc.count; currentElementCount ++ ) { - - result = binaryReadElement( loc, properties ); - loc += result[ 1 ]; - const element = result[ 0 ]; - - handleElement( buffer, elementDesc.name, element, attributeMap ); - - } - - } - - return postProcess( buffer ); - - } - - function extractHeaderText( bytes ) { - - let i = 0; - let cont = true; - - let line = ''; - const lines = []; - - const startLine = new TextDecoder().decode( bytes.subarray( 0, 5 ) ); - const hasCRNL = /^ply\r\n/.test( startLine ); - - do { - - const c = String.fromCharCode( bytes[ i ++ ] ); - - if ( c !== '\n' && c !== '\r' ) { - - line += c; - - } else { - - if ( line === 'end_header' ) cont = false; - if ( line !== '' ) { - - lines.push( line ); - line = ''; - - } - - } - - } while ( cont && i < bytes.length ); - - // ascii section using \r\n as line endings - if ( hasCRNL === true ) i ++; - - return { headerText: lines.join( '\r' ) + '\r', headerLength: i }; - - } - - // - - let geometry; - const scope = this; - - if ( data instanceof ArrayBuffer ) { - - const bytes = new Uint8Array( data ); - const { headerText, headerLength } = extractHeaderText( bytes ); - const header = parseHeader( headerText, headerLength ); - - if ( header.format === 'ascii' ) { - - const text = new TextDecoder().decode( bytes ); - - geometry = parseASCII( text, header ); - - } else { - - geometry = parseBinary( data, header ); - - } - - } else { - - geometry = parseASCII( data, parseHeader( data ) ); - - } - - return geometry; - - } - -} - -class ArrayStream { - - constructor( arr ) { - - this.arr = arr; - this.i = 0; - - } - - empty() { - - return this.i >= this.arr.length; - - } - - next() { - - return this.arr[ this.i ++ ]; - - } - -} - -export { PLYLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PVRLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PVRLoader.js deleted file mode 100644 index 71cc9c0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PVRLoader.js +++ /dev/null @@ -1,251 +0,0 @@ -import { - CompressedTextureLoader, - RGBA_PVRTC_2BPPV1_Format, - RGBA_PVRTC_4BPPV1_Format, - RGB_PVRTC_2BPPV1_Format, - RGB_PVRTC_4BPPV1_Format -} from '/static/javascript/three/build/three.module.js'; - -/* - * PVR v2 (legacy) parser - * TODO : Add Support for PVR v3 format - * TODO : implement loadMipmaps option - */ - -class PVRLoader extends CompressedTextureLoader { - - constructor( manager ) { - - super( manager ); - - } - - parse( buffer, loadMipmaps ) { - - const headerLengthInt = 13; - const header = new Uint32Array( buffer, 0, headerLengthInt ); - - const pvrDatas = { - buffer: buffer, - header: header, - loadMipmaps: loadMipmaps - }; - - if ( header[ 0 ] === 0x03525650 ) { - - // PVR v3 - - return _parseV3( pvrDatas ); - - } else if ( header[ 11 ] === 0x21525650 ) { - - // PVR v2 - - return _parseV2( pvrDatas ); - - } else { - - console.error( 'THREE.PVRLoader: Unknown PVR format.' ); - - } - - } - -} - -function _parseV3( pvrDatas ) { - - const header = pvrDatas.header; - let bpp, format; - - - const metaLen = header[ 12 ], - pixelFormat = header[ 2 ], - height = header[ 6 ], - width = header[ 7 ], - // numSurfs = header[ 9 ], - numFaces = header[ 10 ], - numMipmaps = header[ 11 ]; - - switch ( pixelFormat ) { - - case 0 : // PVRTC 2bpp RGB - bpp = 2; - format = RGB_PVRTC_2BPPV1_Format; - break; - - case 1 : // PVRTC 2bpp RGBA - bpp = 2; - format = RGBA_PVRTC_2BPPV1_Format; - break; - - case 2 : // PVRTC 4bpp RGB - bpp = 4; - format = RGB_PVRTC_4BPPV1_Format; - break; - - case 3 : // PVRTC 4bpp RGBA - bpp = 4; - format = RGBA_PVRTC_4BPPV1_Format; - break; - - default : - console.error( 'THREE.PVRLoader: Unsupported PVR format:', pixelFormat ); - - } - - pvrDatas.dataPtr = 52 + metaLen; - pvrDatas.bpp = bpp; - pvrDatas.format = format; - pvrDatas.width = width; - pvrDatas.height = height; - pvrDatas.numSurfaces = numFaces; - pvrDatas.numMipmaps = numMipmaps; - pvrDatas.isCubemap = ( numFaces === 6 ); - - return _extract( pvrDatas ); - -} - -function _parseV2( pvrDatas ) { - - const header = pvrDatas.header; - - const headerLength = header[ 0 ], - height = header[ 1 ], - width = header[ 2 ], - numMipmaps = header[ 3 ], - flags = header[ 4 ], - // dataLength = header[ 5 ], - // bpp = header[ 6 ], - // bitmaskRed = header[ 7 ], - // bitmaskGreen = header[ 8 ], - // bitmaskBlue = header[ 9 ], - bitmaskAlpha = header[ 10 ], - // pvrTag = header[ 11 ], - numSurfs = header[ 12 ]; - - - const TYPE_MASK = 0xff; - const PVRTC_2 = 24, - PVRTC_4 = 25; - - const formatFlags = flags & TYPE_MASK; - - let bpp, format; - const _hasAlpha = bitmaskAlpha > 0; - - if ( formatFlags === PVRTC_4 ) { - - format = _hasAlpha ? RGBA_PVRTC_4BPPV1_Format : RGB_PVRTC_4BPPV1_Format; - bpp = 4; - - } else if ( formatFlags === PVRTC_2 ) { - - format = _hasAlpha ? RGBA_PVRTC_2BPPV1_Format : RGB_PVRTC_2BPPV1_Format; - bpp = 2; - - } else { - - console.error( 'THREE.PVRLoader: Unknown PVR format:', formatFlags ); - - } - - pvrDatas.dataPtr = headerLength; - pvrDatas.bpp = bpp; - pvrDatas.format = format; - pvrDatas.width = width; - pvrDatas.height = height; - pvrDatas.numSurfaces = numSurfs; - pvrDatas.numMipmaps = numMipmaps + 1; - - // guess cubemap type seems tricky in v2 - // it juste a pvr containing 6 surface (no explicit cubemap type) - pvrDatas.isCubemap = ( numSurfs === 6 ); - - return _extract( pvrDatas ); - -} - - -function _extract( pvrDatas ) { - - const pvr = { - mipmaps: [], - width: pvrDatas.width, - height: pvrDatas.height, - format: pvrDatas.format, - mipmapCount: pvrDatas.numMipmaps, - isCubemap: pvrDatas.isCubemap - }; - - const buffer = pvrDatas.buffer; - - let dataOffset = pvrDatas.dataPtr, - dataSize = 0, - blockSize = 0, - blockWidth = 0, - blockHeight = 0, - widthBlocks = 0, - heightBlocks = 0; - - const bpp = pvrDatas.bpp, - numSurfs = pvrDatas.numSurfaces; - - if ( bpp === 2 ) { - - blockWidth = 8; - blockHeight = 4; - - } else { - - blockWidth = 4; - blockHeight = 4; - - } - - blockSize = ( blockWidth * blockHeight ) * bpp / 8; - - pvr.mipmaps.length = pvrDatas.numMipmaps * numSurfs; - - let mipLevel = 0; - - while ( mipLevel < pvrDatas.numMipmaps ) { - - const sWidth = pvrDatas.width >> mipLevel, - sHeight = pvrDatas.height >> mipLevel; - - widthBlocks = sWidth / blockWidth; - heightBlocks = sHeight / blockHeight; - - // Clamp to minimum number of blocks - if ( widthBlocks < 2 ) widthBlocks = 2; - if ( heightBlocks < 2 ) heightBlocks = 2; - - dataSize = widthBlocks * heightBlocks * blockSize; - - for ( let surfIndex = 0; surfIndex < numSurfs; surfIndex ++ ) { - - const byteArray = new Uint8Array( buffer, dataOffset, dataSize ); - - const mipmap = { - data: byteArray, - width: sWidth, - height: sHeight - }; - - pvr.mipmaps[ surfIndex * pvrDatas.numMipmaps + mipLevel ] = mipmap; - - dataOffset += dataSize; - - } - - mipLevel ++; - - } - - return pvr; - -} - -export { PVRLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PackedPhongMaterial.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PackedPhongMaterial.js deleted file mode 100644 index b3bba9a..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PackedPhongMaterial.js +++ /dev/null @@ -1,178 +0,0 @@ - -/** - * `PackedPhongMaterial` inherited from THREE.MeshPhongMaterial - * - * @param {Object} parameters - */ -import { - MeshPhongMaterial, - ShaderChunk, - ShaderLib, - UniformsUtils, -} from '/static/javascript/three/build/three.module.js'; - -class PackedPhongMaterial extends MeshPhongMaterial { - - constructor( parameters ) { - - super(); - - this.defines = {}; - this.type = 'PackedPhongMaterial'; - this.uniforms = UniformsUtils.merge( [ - - ShaderLib.phong.uniforms, - - { - quantizeMatPos: { value: null }, - quantizeMatUV: { value: null } - } - - ] ); - - this.vertexShader = [ - '#define PHONG', - - 'varying vec3 vViewPosition;', - - ShaderChunk.common, - ShaderChunk.uv_pars_vertex, - ShaderChunk.displacementmap_pars_vertex, - ShaderChunk.envmap_pars_vertex, - ShaderChunk.color_pars_vertex, - ShaderChunk.fog_pars_vertex, - ShaderChunk.normal_pars_vertex, - ShaderChunk.morphtarget_pars_vertex, - ShaderChunk.skinning_pars_vertex, - ShaderChunk.shadowmap_pars_vertex, - ShaderChunk.logdepthbuf_pars_vertex, - ShaderChunk.clipping_planes_pars_vertex, - - `#ifdef USE_PACKED_NORMAL - #if USE_PACKED_NORMAL == 0 - vec3 decodeNormal(vec3 packedNormal) - { - float x = packedNormal.x * 2.0 - 1.0; - float y = packedNormal.y * 2.0 - 1.0; - vec2 scth = vec2(sin(x * PI), cos(x * PI)); - vec2 scphi = vec2(sqrt(1.0 - y * y), y); - return normalize( vec3(scth.y * scphi.x, scth.x * scphi.x, scphi.y) ); - } - #endif - - #if USE_PACKED_NORMAL == 1 - vec3 decodeNormal(vec3 packedNormal) - { - vec3 v = vec3(packedNormal.xy, 1.0 - abs(packedNormal.x) - abs(packedNormal.y)); - if (v.z < 0.0) - { - v.xy = (1.0 - abs(v.yx)) * vec2((v.x >= 0.0) ? +1.0 : -1.0, (v.y >= 0.0) ? +1.0 : -1.0); - } - return normalize(v); - } - #endif - - #if USE_PACKED_NORMAL == 2 - vec3 decodeNormal(vec3 packedNormal) - { - vec3 v = (packedNormal * 2.0) - 1.0; - return normalize(v); - } - #endif - #endif`, - - `#ifdef USE_PACKED_POSITION - #if USE_PACKED_POSITION == 0 - uniform mat4 quantizeMatPos; - #endif - #endif`, - - `#ifdef USE_PACKED_UV - #if USE_PACKED_UV == 1 - uniform mat3 quantizeMatUV; - #endif - #endif`, - - `#ifdef USE_PACKED_UV - #if USE_PACKED_UV == 0 - vec2 decodeUV(vec2 packedUV) - { - vec2 uv = (packedUV * 2.0) - 1.0; - return uv; - } - #endif - - #if USE_PACKED_UV == 1 - vec2 decodeUV(vec2 packedUV) - { - vec2 uv = ( vec3(packedUV, 1.0) * quantizeMatUV ).xy; - return uv; - } - #endif - #endif`, - - 'void main() {', - - ShaderChunk.uv_vertex, - - `#ifdef USE_MAP - #ifdef USE_PACKED_UV - vMapUv = decodeUV(vMapUv); - #endif - #endif`, - - ShaderChunk.color_vertex, - ShaderChunk.morphcolor_vertex, - - ShaderChunk.beginnormal_vertex, - - `#ifdef USE_PACKED_NORMAL - objectNormal = decodeNormal(objectNormal); - #endif - - #ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); - #endif - `, - - ShaderChunk.morphnormal_vertex, - ShaderChunk.skinbase_vertex, - ShaderChunk.skinnormal_vertex, - ShaderChunk.defaultnormal_vertex, - ShaderChunk.normal_vertex, - - ShaderChunk.begin_vertex, - - `#ifdef USE_PACKED_POSITION - #if USE_PACKED_POSITION == 0 - transformed = ( vec4(transformed, 1.0) * quantizeMatPos ).xyz; - #endif - #endif`, - - ShaderChunk.morphtarget_vertex, - ShaderChunk.skinning_vertex, - ShaderChunk.displacementmap_vertex, - ShaderChunk.project_vertex, - ShaderChunk.logdepthbuf_vertex, - ShaderChunk.clipping_planes_vertex, - - 'vViewPosition = - mvPosition.xyz;', - - ShaderChunk.worldpos_vertex, - ShaderChunk.envmap_vertex, - ShaderChunk.shadowmap_vertex, - ShaderChunk.fog_vertex, - - '}', - ].join( '\n' ); - - // Use the original MeshPhongMaterial's fragmentShader. - this.fragmentShader = ShaderLib.phong.fragmentShader; - - this.setValues( parameters ); - - } - -} - -export { PackedPhongMaterial }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/PoissonDenoiseShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/PoissonDenoiseShader.js deleted file mode 100644 index 2ee1582..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/PoissonDenoiseShader.js +++ /dev/null @@ -1,226 +0,0 @@ -import { - Matrix4, - Vector2, - Vector3, -} from '/static/javascript/three/build/three.module.js'; - -/** - * References: - * https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf - * https://arxiv.org/pdf/2206.01856.pdf - */ - -const PoissonDenoiseShader = { - - name: 'PoissonDenoiseShader', - - defines: { - 'SAMPLES': 16, - 'SAMPLE_VECTORS': generatePdSamplePointInitializer( 16, 2, 1 ), - 'NORMAL_VECTOR_TYPE': 1, - 'DEPTH_VALUE_SOURCE': 0, - }, - - uniforms: { - 'tDiffuse': { value: null }, - 'tNormal': { value: null }, - 'tDepth': { value: null }, - 'tNoise': { value: null }, - 'resolution': { value: new Vector2() }, - 'cameraProjectionMatrixInverse': { value: new Matrix4() }, - 'lumaPhi': { value: 5. }, - 'depthPhi': { value: 5. }, - 'normalPhi': { value: 5. }, - 'radius': { value: 4. }, - 'index': { value: 0 } - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - - varying vec2 vUv; - - uniform sampler2D tDiffuse; - uniform sampler2D tNormal; - uniform sampler2D tDepth; - uniform sampler2D tNoise; - uniform vec2 resolution; - uniform mat4 cameraProjectionMatrixInverse; - uniform float lumaPhi; - uniform float depthPhi; - uniform float normalPhi; - uniform float radius; - uniform int index; - - #include - #include - - #ifndef SAMPLE_LUMINANCE - #define SAMPLE_LUMINANCE dot(vec3(0.2125, 0.7154, 0.0721), a) - #endif - - #ifndef FRAGMENT_OUTPUT - #define FRAGMENT_OUTPUT vec4(denoised, 1.) - #endif - - float getLuminance(const in vec3 a) { - return SAMPLE_LUMINANCE; - } - - const vec3 poissonDisk[SAMPLES] = SAMPLE_VECTORS; - - vec3 getViewPosition(const in vec2 screenPosition, const in float depth) { - vec4 clipSpacePosition = vec4(vec3(screenPosition, depth) * 2.0 - 1.0, 1.0); - vec4 viewSpacePosition = cameraProjectionMatrixInverse * clipSpacePosition; - return viewSpacePosition.xyz / viewSpacePosition.w; - } - - float getDepth(const vec2 uv) { - #if DEPTH_VALUE_SOURCE == 1 - return textureLod(tDepth, uv.xy, 0.0).a; - #else - return textureLod(tDepth, uv.xy, 0.0).r; - #endif - } - - float fetchDepth(const ivec2 uv) { - #if DEPTH_VALUE_SOURCE == 1 - return texelFetch(tDepth, uv.xy, 0).a; - #else - return texelFetch(tDepth, uv.xy, 0).r; - #endif - } - - vec3 computeNormalFromDepth(const vec2 uv) { - vec2 size = vec2(textureSize(tDepth, 0)); - ivec2 p = ivec2(uv * size); - float c0 = fetchDepth(p); - float l2 = fetchDepth(p - ivec2(2, 0)); - float l1 = fetchDepth(p - ivec2(1, 0)); - float r1 = fetchDepth(p + ivec2(1, 0)); - float r2 = fetchDepth(p + ivec2(2, 0)); - float b2 = fetchDepth(p - ivec2(0, 2)); - float b1 = fetchDepth(p - ivec2(0, 1)); - float t1 = fetchDepth(p + ivec2(0, 1)); - float t2 = fetchDepth(p + ivec2(0, 2)); - float dl = abs((2.0 * l1 - l2) - c0); - float dr = abs((2.0 * r1 - r2) - c0); - float db = abs((2.0 * b1 - b2) - c0); - float dt = abs((2.0 * t1 - t2) - c0); - vec3 ce = getViewPosition(uv, c0).xyz; - vec3 dpdx = (dl < dr) ? ce - getViewPosition((uv - vec2(1.0 / size.x, 0.0)), l1).xyz - : -ce + getViewPosition((uv + vec2(1.0 / size.x, 0.0)), r1).xyz; - vec3 dpdy = (db < dt) ? ce - getViewPosition((uv - vec2(0.0, 1.0 / size.y)), b1).xyz - : -ce + getViewPosition((uv + vec2(0.0, 1.0 / size.y)), t1).xyz; - return normalize(cross(dpdx, dpdy)); - } - - vec3 getViewNormal(const vec2 uv) { - #if NORMAL_VECTOR_TYPE == 2 - return normalize(textureLod(tNormal, uv, 0.).rgb); - #elif NORMAL_VECTOR_TYPE == 1 - return unpackRGBToNormal(textureLod(tNormal, uv, 0.).rgb); - #else - return computeNormalFromDepth(uv); - #endif - } - - void denoiseSample(in vec3 center, in vec3 viewNormal, in vec3 viewPos, in vec2 sampleUv, inout vec3 denoised, inout float totalWeight) { - vec4 sampleTexel = textureLod(tDiffuse, sampleUv, 0.0); - float sampleDepth = getDepth(sampleUv); - vec3 sampleNormal = getViewNormal(sampleUv); - vec3 neighborColor = sampleTexel.rgb; - vec3 viewPosSample = getViewPosition(sampleUv, sampleDepth); - - float normalDiff = dot(viewNormal, sampleNormal); - float normalSimilarity = pow(max(normalDiff, 0.), normalPhi); - float lumaDiff = abs(getLuminance(neighborColor) - getLuminance(center)); - float lumaSimilarity = max(1.0 - lumaDiff / lumaPhi, 0.0); - float depthDiff = abs(dot(viewPos - viewPosSample, viewNormal)); - float depthSimilarity = max(1. - depthDiff / depthPhi, 0.); - float w = lumaSimilarity * depthSimilarity * normalSimilarity; - - denoised += w * neighborColor; - totalWeight += w; - } - - void main() { - float depth = getDepth(vUv.xy); - vec3 viewNormal = getViewNormal(vUv); - if (depth == 1. || dot(viewNormal, viewNormal) == 0.) { - discard; - return; - } - vec4 texel = textureLod(tDiffuse, vUv, 0.0); - vec3 center = texel.rgb; - vec3 viewPos = getViewPosition(vUv, depth); - - vec2 noiseResolution = vec2(textureSize(tNoise, 0)); - vec2 noiseUv = vUv * resolution / noiseResolution; - vec4 noiseTexel = textureLod(tNoise, noiseUv, 0.0); - vec2 noiseVec = vec2(sin(noiseTexel[index % 4] * 2. * PI), cos(noiseTexel[index % 4] * 2. * PI)); - mat2 rotationMatrix = mat2(noiseVec.x, -noiseVec.y, noiseVec.x, noiseVec.y); - - float totalWeight = 1.0; - vec3 denoised = texel.rgb; - for (int i = 0; i < SAMPLES; i++) { - vec3 sampleDir = poissonDisk[i]; - vec2 offset = rotationMatrix * (sampleDir.xy * (1. + sampleDir.z * (radius - 1.)) / resolution); - vec2 sampleUv = vUv + offset; - denoiseSample(center, viewNormal, viewPos, sampleUv, denoised, totalWeight); - } - - if (totalWeight > 0.) { - denoised /= totalWeight; - } - gl_FragColor = FRAGMENT_OUTPUT; - }` - -}; - -function generatePdSamplePointInitializer( samples, rings, radiusExponent ) { - - const poissonDisk = generateDenoiseSamples( - samples, - rings, - radiusExponent, - ); - - let glslCode = 'vec3[SAMPLES]('; - - for ( let i = 0; i < samples; i ++ ) { - - const sample = poissonDisk[ i ]; - glslCode += `vec3(${sample.x}, ${sample.y}, ${sample.z})${( i < samples - 1 ) ? ',' : ')'}`; - - } - - return glslCode; - -} - -function generateDenoiseSamples( numSamples, numRings, radiusExponent ) { - - const samples = []; - - for ( let i = 0; i < numSamples; i ++ ) { - - const angle = 2 * Math.PI * numRings * i / numSamples; - const radius = Math.pow( i / ( numSamples - 1 ), radiusExponent ); - samples.push( new Vector3( Math.cos( angle ), Math.sin( angle ), radius ) ); - - } - - return samples; - -} - -export { generatePdSamplePointInitializer, PoissonDenoiseShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBELoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/RGBELoader.js deleted file mode 100644 index 3e3df26..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBELoader.js +++ /dev/null @@ -1,450 +0,0 @@ -import { - DataTextureLoader, - DataUtils, - FloatType, - HalfFloatType, - LinearFilter, - LinearSRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; - -// https://github.com/mrdoob/three.js/issues/5552 -// http://en.wikipedia.org/wiki/RGBE_image_format - -class RGBELoader extends DataTextureLoader { - - constructor( manager ) { - - super( manager ); - - this.type = HalfFloatType; - - } - - // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html - - parse( buffer ) { - - const - /* default error routine. change this to change error handling */ - rgbe_read_error = 1, - rgbe_write_error = 2, - rgbe_format_error = 3, - rgbe_memory_error = 4, - rgbe_error = function ( rgbe_error_code, msg ) { - - switch ( rgbe_error_code ) { - - case rgbe_read_error: throw new Error( 'THREE.RGBELoader: Read Error: ' + ( msg || '' ) ); - case rgbe_write_error: throw new Error( 'THREE.RGBELoader: Write Error: ' + ( msg || '' ) ); - case rgbe_format_error: throw new Error( 'THREE.RGBELoader: Bad File Format: ' + ( msg || '' ) ); - default: - case rgbe_memory_error: throw new Error( 'THREE.RGBELoader: Memory Error: ' + ( msg || '' ) ); - - } - - }, - - /* offsets to red, green, and blue components in a data (float) pixel */ - //RGBE_DATA_RED = 0, - //RGBE_DATA_GREEN = 1, - //RGBE_DATA_BLUE = 2, - - /* number of floats per pixel, use 4 since stored in rgba image format */ - //RGBE_DATA_SIZE = 4, - - /* flags indicating which fields in an rgbe_header_info are valid */ - RGBE_VALID_PROGRAMTYPE = 1, - RGBE_VALID_FORMAT = 2, - RGBE_VALID_DIMENSIONS = 4, - - NEWLINE = '\n', - - fgets = function ( buffer, lineLimit, consume ) { - - const chunkSize = 128; - - lineLimit = ! lineLimit ? 1024 : lineLimit; - let p = buffer.pos, - i = - 1, len = 0, s = '', - chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); - - while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) { - - s += chunk; len += chunk.length; - p += chunkSize; - chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) ); - - } - - if ( - 1 < i ) { - - /*for (i=l-1; i>=0; i--) { - byteCode = m.charCodeAt(i); - if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++; - else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2; - if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate - }*/ - if ( false !== consume ) buffer.pos += len + i + 1; - return s + chunk.slice( 0, i ); - - } - - return false; - - }, - - /* minimal header reading. modify if you want to parse more information */ - RGBE_ReadHeader = function ( buffer ) { - - - // regexes to parse header info fields - const magic_token_re = /^#\?(\S+)/, - gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/, - exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/, - format_re = /^\s*FORMAT=(\S+)\s*$/, - dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/, - - // RGBE format header struct - header = { - - valid: 0, /* indicate which fields are valid */ - - string: '', /* the actual header string */ - - comments: '', /* comments found in header */ - - programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */ - - format: '', /* RGBE format, default 32-bit_rle_rgbe */ - - gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */ - - exposure: 1.0, /* a value of 1.0 in an image corresponds to watts/steradian/m^2. defaults to 1.0 */ - - width: 0, height: 0 /* image dimensions, width/height */ - - }; - - let line, match; - - if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) { - - rgbe_error( rgbe_read_error, 'no header found' ); - - } - - /* if you want to require the magic token then uncomment the next line */ - if ( ! ( match = line.match( magic_token_re ) ) ) { - - rgbe_error( rgbe_format_error, 'bad initial token' ); - - } - - header.valid |= RGBE_VALID_PROGRAMTYPE; - header.programtype = match[ 1 ]; - header.string += line + '\n'; - - while ( true ) { - - line = fgets( buffer ); - if ( false === line ) break; - header.string += line + '\n'; - - if ( '#' === line.charAt( 0 ) ) { - - header.comments += line + '\n'; - continue; // comment line - - } - - if ( match = line.match( gamma_re ) ) { - - header.gamma = parseFloat( match[ 1 ] ); - - } - - if ( match = line.match( exposure_re ) ) { - - header.exposure = parseFloat( match[ 1 ] ); - - } - - if ( match = line.match( format_re ) ) { - - header.valid |= RGBE_VALID_FORMAT; - header.format = match[ 1 ];//'32-bit_rle_rgbe'; - - } - - if ( match = line.match( dimensions_re ) ) { - - header.valid |= RGBE_VALID_DIMENSIONS; - header.height = parseInt( match[ 1 ], 10 ); - header.width = parseInt( match[ 2 ], 10 ); - - } - - if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break; - - } - - if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) { - - rgbe_error( rgbe_format_error, 'missing format specifier' ); - - } - - if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) { - - rgbe_error( rgbe_format_error, 'missing image size specifier' ); - - } - - return header; - - }, - - RGBE_ReadPixels_RLE = function ( buffer, w, h ) { - - const scanline_width = w; - - if ( - // run length encoding is not allowed so read flat - ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) || - // this file is not run length encoded - ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) ) - ) { - - // return the flat buffer - return new Uint8Array( buffer ); - - } - - if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) { - - rgbe_error( rgbe_format_error, 'wrong scanline width' ); - - } - - const data_rgba = new Uint8Array( 4 * w * h ); - - if ( ! data_rgba.length ) { - - rgbe_error( rgbe_memory_error, 'unable to allocate buffer space' ); - - } - - let offset = 0, pos = 0; - - const ptr_end = 4 * scanline_width; - const rgbeStart = new Uint8Array( 4 ); - const scanline_buffer = new Uint8Array( ptr_end ); - let num_scanlines = h; - - // read in each successive scanline - while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) { - - if ( pos + 4 > buffer.byteLength ) { - - rgbe_error( rgbe_read_error ); - - } - - rgbeStart[ 0 ] = buffer[ pos ++ ]; - rgbeStart[ 1 ] = buffer[ pos ++ ]; - rgbeStart[ 2 ] = buffer[ pos ++ ]; - rgbeStart[ 3 ] = buffer[ pos ++ ]; - - if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) { - - rgbe_error( rgbe_format_error, 'bad rgbe scanline format' ); - - } - - // read each of the four channels for the scanline into the buffer - // first red, then green, then blue, then exponent - let ptr = 0, count; - - while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) { - - count = buffer[ pos ++ ]; - const isEncodedRun = count > 128; - if ( isEncodedRun ) count -= 128; - - if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) { - - rgbe_error( rgbe_format_error, 'bad scanline data' ); - - } - - if ( isEncodedRun ) { - - // a (encoded) run of the same value - const byteValue = buffer[ pos ++ ]; - for ( let i = 0; i < count; i ++ ) { - - scanline_buffer[ ptr ++ ] = byteValue; - - } - //ptr += count; - - } else { - - // a literal-run - scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr ); - ptr += count; pos += count; - - } - - } - - - // now convert data from buffer into rgba - // first red, then green, then blue, then exponent (alpha) - const l = scanline_width; //scanline_buffer.byteLength; - for ( let i = 0; i < l; i ++ ) { - - let off = 0; - data_rgba[ offset ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 1 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 2 ] = scanline_buffer[ i + off ]; - off += scanline_width; //1; - data_rgba[ offset + 3 ] = scanline_buffer[ i + off ]; - offset += 4; - - } - - num_scanlines --; - - } - - return data_rgba; - - }; - - const RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) { - - const e = sourceArray[ sourceOffset + 3 ]; - const scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - - destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale; - destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale; - destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale; - destArray[ destOffset + 3 ] = 1; - - }; - - const RGBEByteToRGBHalf = function ( sourceArray, sourceOffset, destArray, destOffset ) { - - const e = sourceArray[ sourceOffset + 3 ]; - const scale = Math.pow( 2.0, e - 128.0 ) / 255.0; - - // clamping to 65504, the maximum representable value in float16 - destArray[ destOffset + 0 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 0 ] * scale, 65504 ) ); - destArray[ destOffset + 1 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 1 ] * scale, 65504 ) ); - destArray[ destOffset + 2 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 2 ] * scale, 65504 ) ); - destArray[ destOffset + 3 ] = DataUtils.toHalfFloat( 1 ); - - }; - - const byteArray = new Uint8Array( buffer ); - byteArray.pos = 0; - const rgbe_header_info = RGBE_ReadHeader( byteArray ); - - const w = rgbe_header_info.width, - h = rgbe_header_info.height, - image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h ); - - - let data, type; - let numElements; - - switch ( this.type ) { - - case FloatType: - - numElements = image_rgba_data.length / 4; - const floatArray = new Float32Array( numElements * 4 ); - - for ( let j = 0; j < numElements; j ++ ) { - - RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 4 ); - - } - - data = floatArray; - type = FloatType; - break; - - case HalfFloatType: - - numElements = image_rgba_data.length / 4; - const halfArray = new Uint16Array( numElements * 4 ); - - for ( let j = 0; j < numElements; j ++ ) { - - RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 4 ); - - } - - data = halfArray; - type = HalfFloatType; - break; - - default: - - throw new Error( 'THREE.RGBELoader: Unsupported type: ' + this.type ); - break; - - } - - return { - width: w, height: h, - data: data, - header: rgbe_header_info.string, - gamma: rgbe_header_info.gamma, - exposure: rgbe_header_info.exposure, - type: type - }; - - } - - setDataType( value ) { - - this.type = value; - return this; - - } - - load( url, onLoad, onProgress, onError ) { - - function onLoadCallback( texture, texData ) { - - switch ( texture.type ) { - - case FloatType: - case HalfFloatType: - - texture.colorSpace = LinearSRGBColorSpace; - texture.minFilter = LinearFilter; - texture.magFilter = LinearFilter; - texture.generateMipmaps = false; - texture.flipY = true; - - break; - - } - - if ( onLoad ) onLoad( texture, texData ); - - } - - return super.load( url, onLoadCallback, onProgress, onError ); - - } - -} - -export { RGBELoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBMLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/RGBMLoader.js deleted file mode 100644 index b4891e0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBMLoader.js +++ /dev/null @@ -1,1081 +0,0 @@ -import { - DataTextureLoader, - RGBAFormat, - LinearFilter, - CubeTexture, - HalfFloatType, - DataUtils -} from '/static/javascript/three/build/three.module.js'; - -class RGBMLoader extends DataTextureLoader { - - constructor( manager ) { - - super( manager ); - - this.type = HalfFloatType; - this.maxRange = 7; // more information about this property at https://iwasbeingirony.blogspot.com/2010/06/difference-between-rgbm-and-rgbd.html - - } - - setDataType( value ) { - - this.type = value; - return this; - - } - - setMaxRange( value ) { - - this.maxRange = value; - return this; - - } - - loadCubemap( urls, onLoad, onProgress, onError ) { - - const texture = new CubeTexture(); - - for ( let i = 0; i < 6; i ++ ) { - - texture.images[ i ] = undefined; - - } - - let loaded = 0; - - const scope = this; - - function loadTexture( i ) { - - scope.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 ); - - } - - texture.type = this.type; - texture.format = RGBAFormat; - texture.minFilter = LinearFilter; - texture.generateMipmaps = false; - - return texture; - - } - - loadCubemapAsync( urls, onProgress ) { - - return new Promise( ( resolve, reject ) => { - - this.loadCubemap( urls, resolve, onProgress, reject ); - - } ); - - } - - parse( buffer ) { - - const img = UPNG.decode( buffer ); - const rgba = UPNG.toRGBA8( img )[ 0 ]; - - const data = new Uint8Array( rgba ); - const size = img.width * img.height * 4; - - const output = ( this.type === HalfFloatType ) ? new Uint16Array( size ) : new Float32Array( size ); - - // decode RGBM - - for ( let i = 0; i < data.length; i += 4 ) { - - const r = data[ i + 0 ] / 255; - const g = data[ i + 1 ] / 255; - const b = data[ i + 2 ] / 255; - const a = data[ i + 3 ] / 255; - - if ( this.type === HalfFloatType ) { - - output[ i + 0 ] = DataUtils.toHalfFloat( Math.min( r * a * this.maxRange, 65504 ) ); - output[ i + 1 ] = DataUtils.toHalfFloat( Math.min( g * a * this.maxRange, 65504 ) ); - output[ i + 2 ] = DataUtils.toHalfFloat( Math.min( b * a * this.maxRange, 65504 ) ); - output[ i + 3 ] = DataUtils.toHalfFloat( 1 ); - - } else { - - output[ i + 0 ] = r * a * this.maxRange; - output[ i + 1 ] = g * a * this.maxRange; - output[ i + 2 ] = b * a * this.maxRange; - output[ i + 3 ] = 1; - - } - - } - - return { - width: img.width, - height: img.height, - data: output, - format: RGBAFormat, - type: this.type, - flipY: true - }; - - } - -} - -// from https://github.com/photopea/UPNG.js (MIT License) - -var UPNG = {}; - -UPNG.toRGBA8 = function ( out ) { - - var w = out.width, h = out.height; - if ( out.tabs.acTL == null ) return [ UPNG.toRGBA8.decodeImage( out.data, w, h, out ).buffer ]; - - var frms = []; - if ( out.frames[ 0 ].data == null ) out.frames[ 0 ].data = out.data; - - var len = w * h * 4, img = new Uint8Array( len ), empty = new Uint8Array( len ), prev = new Uint8Array( len ); - for ( var i = 0; i < out.frames.length; i ++ ) { - - var frm = out.frames[ i ]; - var fx = frm.rect.x, fy = frm.rect.y, fw = frm.rect.width, fh = frm.rect.height; - var fdata = UPNG.toRGBA8.decodeImage( frm.data, fw, fh, out ); - - if ( i != 0 ) for ( var j = 0; j < len; j ++ ) prev[ j ] = img[ j ]; - - if ( frm.blend == 0 ) UPNG._copyTile( fdata, fw, fh, img, w, h, fx, fy, 0 ); - else if ( frm.blend == 1 ) UPNG._copyTile( fdata, fw, fh, img, w, h, fx, fy, 1 ); - - frms.push( img.buffer.slice( 0 ) ); - - if ( frm.dispose == 1 ) UPNG._copyTile( empty, fw, fh, img, w, h, fx, fy, 0 ); - else if ( frm.dispose == 2 ) for ( var j = 0; j < len; j ++ ) img[ j ] = prev[ j ]; - - } - - return frms; - -}; - -UPNG.toRGBA8.decodeImage = function ( data, w, h, out ) { - - var area = w * h, bpp = UPNG.decode._getBPP( out ); - var bpl = Math.ceil( w * bpp / 8 ); // bytes per line - - var bf = new Uint8Array( area * 4 ), bf32 = new Uint32Array( bf.buffer ); - var ctype = out.ctype, depth = out.depth; - var rs = UPNG._bin.readUshort; - - if ( ctype == 6 ) { // RGB + alpha - - var qarea = area << 2; - if ( depth == 8 ) for ( var i = 0; i < qarea; i += 4 ) { - - bf[ i ] = data[ i ]; bf[ i + 1 ] = data[ i + 1 ]; bf[ i + 2 ] = data[ i + 2 ]; bf[ i + 3 ] = data[ i + 3 ]; - - } - - if ( depth == 16 ) for ( var i = 0; i < qarea; i ++ ) { - - bf[ i ] = data[ i << 1 ]; - - } - - } else if ( ctype == 2 ) { // RGB - - var ts = out.tabs[ 'tRNS' ]; - if ( ts == null ) { - - if ( depth == 8 ) for ( var i = 0; i < area; i ++ ) { - - var ti = i * 3; bf32[ i ] = ( 255 << 24 ) | ( data[ ti + 2 ] << 16 ) | ( data[ ti + 1 ] << 8 ) | data[ ti ]; - - } - - if ( depth == 16 ) for ( var i = 0; i < area; i ++ ) { - - var ti = i * 6; bf32[ i ] = ( 255 << 24 ) | ( data[ ti + 4 ] << 16 ) | ( data[ ti + 2 ] << 8 ) | data[ ti ]; - - } - - } else { - - var tr = ts[ 0 ], tg = ts[ 1 ], tb = ts[ 2 ]; - if ( depth == 8 ) for ( var i = 0; i < area; i ++ ) { - - var qi = i << 2, ti = i * 3; bf32[ i ] = ( 255 << 24 ) | ( data[ ti + 2 ] << 16 ) | ( data[ ti + 1 ] << 8 ) | data[ ti ]; - if ( data[ ti ] == tr && data[ ti + 1 ] == tg && data[ ti + 2 ] == tb ) bf[ qi + 3 ] = 0; - - } - - if ( depth == 16 ) for ( var i = 0; i < area; i ++ ) { - - var qi = i << 2, ti = i * 6; bf32[ i ] = ( 255 << 24 ) | ( data[ ti + 4 ] << 16 ) | ( data[ ti + 2 ] << 8 ) | data[ ti ]; - if ( rs( data, ti ) == tr && rs( data, ti + 2 ) == tg && rs( data, ti + 4 ) == tb ) bf[ qi + 3 ] = 0; - - } - - } - - } else if ( ctype == 3 ) { // palette - - var p = out.tabs[ 'PLTE' ], ap = out.tabs[ 'tRNS' ], tl = ap ? ap.length : 0; - //console.log(p, ap); - if ( depth == 1 ) for ( var y = 0; y < h; y ++ ) { - - var s0 = y * bpl, t0 = y * w; - for ( var i = 0; i < w; i ++ ) { - - var qi = ( t0 + i ) << 2, j = ( ( data[ s0 + ( i >> 3 ) ] >> ( 7 - ( ( i & 7 ) << 0 ) ) ) & 1 ), cj = 3 * j; bf[ qi ] = p[ cj ]; bf[ qi + 1 ] = p[ cj + 1 ]; bf[ qi + 2 ] = p[ cj + 2 ]; bf[ qi + 3 ] = ( j < tl ) ? ap[ j ] : 255; - - } - - } - - if ( depth == 2 ) for ( var y = 0; y < h; y ++ ) { - - var s0 = y * bpl, t0 = y * w; - for ( var i = 0; i < w; i ++ ) { - - var qi = ( t0 + i ) << 2, j = ( ( data[ s0 + ( i >> 2 ) ] >> ( 6 - ( ( i & 3 ) << 1 ) ) ) & 3 ), cj = 3 * j; bf[ qi ] = p[ cj ]; bf[ qi + 1 ] = p[ cj + 1 ]; bf[ qi + 2 ] = p[ cj + 2 ]; bf[ qi + 3 ] = ( j < tl ) ? ap[ j ] : 255; - - } - - } - - if ( depth == 4 ) for ( var y = 0; y < h; y ++ ) { - - var s0 = y * bpl, t0 = y * w; - for ( var i = 0; i < w; i ++ ) { - - var qi = ( t0 + i ) << 2, j = ( ( data[ s0 + ( i >> 1 ) ] >> ( 4 - ( ( i & 1 ) << 2 ) ) ) & 15 ), cj = 3 * j; bf[ qi ] = p[ cj ]; bf[ qi + 1 ] = p[ cj + 1 ]; bf[ qi + 2 ] = p[ cj + 2 ]; bf[ qi + 3 ] = ( j < tl ) ? ap[ j ] : 255; - - } - - } - - if ( depth == 8 ) for ( var i = 0; i < area; i ++ ) { - - var qi = i << 2, j = data[ i ], cj = 3 * j; bf[ qi ] = p[ cj ]; bf[ qi + 1 ] = p[ cj + 1 ]; bf[ qi + 2 ] = p[ cj + 2 ]; bf[ qi + 3 ] = ( j < tl ) ? ap[ j ] : 255; - - } - - } else if ( ctype == 4 ) { // gray + alpha - - if ( depth == 8 ) for ( var i = 0; i < area; i ++ ) { - - var qi = i << 2, di = i << 1, gr = data[ di ]; bf[ qi ] = gr; bf[ qi + 1 ] = gr; bf[ qi + 2 ] = gr; bf[ qi + 3 ] = data[ di + 1 ]; - - } - - if ( depth == 16 ) for ( var i = 0; i < area; i ++ ) { - - var qi = i << 2, di = i << 2, gr = data[ di ]; bf[ qi ] = gr; bf[ qi + 1 ] = gr; bf[ qi + 2 ] = gr; bf[ qi + 3 ] = data[ di + 2 ]; - - } - - } else if ( ctype == 0 ) { // gray - - var tr = out.tabs[ 'tRNS' ] ? out.tabs[ 'tRNS' ] : - 1; - for ( var y = 0; y < h; y ++ ) { - - var off = y * bpl, to = y * w; - if ( depth == 1 ) for ( var x = 0; x < w; x ++ ) { - - var gr = 255 * ( ( data[ off + ( x >>> 3 ) ] >>> ( 7 - ( x & 7 ) ) ) & 1 ), al = ( gr == tr * 255 ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr; - - } - else if ( depth == 2 ) for ( var x = 0; x < w; x ++ ) { - - var gr = 85 * ( ( data[ off + ( x >>> 2 ) ] >>> ( 6 - ( ( x & 3 ) << 1 ) ) ) & 3 ), al = ( gr == tr * 85 ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr; - - } - else if ( depth == 4 ) for ( var x = 0; x < w; x ++ ) { - - var gr = 17 * ( ( data[ off + ( x >>> 1 ) ] >>> ( 4 - ( ( x & 1 ) << 2 ) ) ) & 15 ), al = ( gr == tr * 17 ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr; - - } - else if ( depth == 8 ) for ( var x = 0; x < w; x ++ ) { - - var gr = data[ off + x ], al = ( gr == tr ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr; - - } - else if ( depth == 16 ) for ( var x = 0; x < w; x ++ ) { - - var gr = data[ off + ( x << 1 ) ], al = ( rs( data, off + ( x << 1 ) ) == tr ) ? 0 : 255; bf32[ to + x ] = ( al << 24 ) | ( gr << 16 ) | ( gr << 8 ) | gr; - - } - - } - - } - - //console.log(Date.now()-time); - return bf; - -}; - - - -UPNG.decode = function ( buff ) { - - var data = new Uint8Array( buff ), offset = 8, bin = UPNG._bin, rUs = bin.readUshort, rUi = bin.readUint; - var out = { tabs: {}, frames: [] }; - var dd = new Uint8Array( data.length ), doff = 0; // put all IDAT data into it - var fd, foff = 0; // frames - var text, keyw, bfr; - - var mgck = [ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a ]; - for ( var i = 0; i < 8; i ++ ) if ( data[ i ] != mgck[ i ] ) throw new Error( 'The input is not a PNG file!' ); - - while ( offset < data.length ) { - - var len = bin.readUint( data, offset ); offset += 4; - var type = bin.readASCII( data, offset, 4 ); offset += 4; - //console.log(type,len); - - if ( type == 'IHDR' ) { - - UPNG.decode._IHDR( data, offset, out ); - - } else if ( type == 'CgBI' ) { - - out.tabs[ type ] = data.slice( offset, offset + 4 ); - - } else if ( type == 'IDAT' ) { - - for ( var i = 0; i < len; i ++ ) dd[ doff + i ] = data[ offset + i ]; - doff += len; - - } else if ( type == 'acTL' ) { - - out.tabs[ type ] = { num_frames: rUi( data, offset ), num_plays: rUi( data, offset + 4 ) }; - fd = new Uint8Array( data.length ); - - } else if ( type == 'fcTL' ) { - - if ( foff != 0 ) { - - var fr = out.frames[ out.frames.length - 1 ]; - fr.data = UPNG.decode._decompress( out, fd.slice( 0, foff ), fr.rect.width, fr.rect.height ); foff = 0; - - } - - var rct = { x: rUi( data, offset + 12 ), y: rUi( data, offset + 16 ), width: rUi( data, offset + 4 ), height: rUi( data, offset + 8 ) }; - var del = rUs( data, offset + 22 ); del = rUs( data, offset + 20 ) / ( del == 0 ? 100 : del ); - var frm = { rect: rct, delay: Math.round( del * 1000 ), dispose: data[ offset + 24 ], blend: data[ offset + 25 ] }; - //console.log(frm); - out.frames.push( frm ); - - } else if ( type == 'fdAT' ) { - - for ( var i = 0; i < len - 4; i ++ ) fd[ foff + i ] = data[ offset + i + 4 ]; - foff += len - 4; - - } else if ( type == 'pHYs' ) { - - out.tabs[ type ] = [ bin.readUint( data, offset ), bin.readUint( data, offset + 4 ), data[ offset + 8 ] ]; - - } else if ( type == 'cHRM' ) { - - out.tabs[ type ] = []; - for ( var i = 0; i < 8; i ++ ) out.tabs[ type ].push( bin.readUint( data, offset + i * 4 ) ); - - } else if ( type == 'tEXt' || type == 'zTXt' ) { - - if ( out.tabs[ type ] == null ) out.tabs[ type ] = {}; - var nz = bin.nextZero( data, offset ); - keyw = bin.readASCII( data, offset, nz - offset ); - var tl = offset + len - nz - 1; - if ( type == 'tEXt' ) text = bin.readASCII( data, nz + 1, tl ); - else { - - bfr = UPNG.decode._inflate( data.slice( nz + 2, nz + 2 + tl ) ); - text = bin.readUTF8( bfr, 0, bfr.length ); - - } - - out.tabs[ type ][ keyw ] = text; - - } else if ( type == 'iTXt' ) { - - if ( out.tabs[ type ] == null ) out.tabs[ type ] = {}; - var nz = 0, off = offset; - nz = bin.nextZero( data, off ); - keyw = bin.readASCII( data, off, nz - off ); off = nz + 1; - var cflag = data[ off ]; off += 2; - nz = bin.nextZero( data, off ); - bin.readASCII( data, off, nz - off ); off = nz + 1; - nz = bin.nextZero( data, off ); - bin.readUTF8( data, off, nz - off ); off = nz + 1; - var tl = len - ( off - offset ); - if ( cflag == 0 ) text = bin.readUTF8( data, off, tl ); - else { - - bfr = UPNG.decode._inflate( data.slice( off, off + tl ) ); - text = bin.readUTF8( bfr, 0, bfr.length ); - - } - - out.tabs[ type ][ keyw ] = text; - - } else if ( type == 'PLTE' ) { - - out.tabs[ type ] = bin.readBytes( data, offset, len ); - - } else if ( type == 'hIST' ) { - - var pl = out.tabs[ 'PLTE' ].length / 3; - out.tabs[ type ] = []; for ( var i = 0; i < pl; i ++ ) out.tabs[ type ].push( rUs( data, offset + i * 2 ) ); - - } else if ( type == 'tRNS' ) { - - if ( out.ctype == 3 ) out.tabs[ type ] = bin.readBytes( data, offset, len ); - else if ( out.ctype == 0 ) out.tabs[ type ] = rUs( data, offset ); - else if ( out.ctype == 2 ) out.tabs[ type ] = [ rUs( data, offset ), rUs( data, offset + 2 ), rUs( data, offset + 4 ) ]; - //else console.log("tRNS for unsupported color type",out.ctype, len); - - } else if ( type == 'gAMA' ) out.tabs[ type ] = bin.readUint( data, offset ) / 100000; - else if ( type == 'sRGB' ) out.tabs[ type ] = data[ offset ]; - else if ( type == 'bKGD' ) { - - if ( out.ctype == 0 || out.ctype == 4 ) out.tabs[ type ] = [ rUs( data, offset ) ]; - else if ( out.ctype == 2 || out.ctype == 6 ) out.tabs[ type ] = [ rUs( data, offset ), rUs( data, offset + 2 ), rUs( data, offset + 4 ) ]; - else if ( out.ctype == 3 ) out.tabs[ type ] = data[ offset ]; - - } else if ( type == 'IEND' ) { - - break; - - } - - //else { console.log("unknown chunk type", type, len); out.tabs[type]=data.slice(offset,offset+len); } - offset += len; - bin.readUint( data, offset ); offset += 4; - - } - - if ( foff != 0 ) { - - var fr = out.frames[ out.frames.length - 1 ]; - fr.data = UPNG.decode._decompress( out, fd.slice( 0, foff ), fr.rect.width, fr.rect.height ); - - } - - out.data = UPNG.decode._decompress( out, dd, out.width, out.height ); - - delete out.compress; delete out.interlace; delete out.filter; - return out; - -}; - -UPNG.decode._decompress = function ( out, dd, w, h ) { - - var bpp = UPNG.decode._getBPP( out ), bpl = Math.ceil( w * bpp / 8 ), buff = new Uint8Array( ( bpl + 1 + out.interlace ) * h ); - if ( out.tabs[ 'CgBI' ] ) dd = UPNG.inflateRaw( dd, buff ); - else dd = UPNG.decode._inflate( dd, buff ); - - if ( out.interlace == 0 ) dd = UPNG.decode._filterZero( dd, out, 0, w, h ); - else if ( out.interlace == 1 ) dd = UPNG.decode._readInterlace( dd, out ); - - return dd; - -}; - -UPNG.decode._inflate = function ( data, buff ) { - - var out = UPNG[ 'inflateRaw' ]( new Uint8Array( data.buffer, 2, data.length - 6 ), buff ); return out; - -}; - -UPNG.inflateRaw = function () { - - var H = {}; H.H = {}; H.H.N = function ( N, W ) { - - var R = Uint8Array, i = 0, m = 0, J = 0, h = 0, Q = 0, X = 0, u = 0, w = 0, d = 0, v, C; - if ( N[ 0 ] == 3 && N[ 1 ] == 0 ) return W ? W : new R( 0 ); var V = H.H, n = V.b, A = V.e, l = V.R, M = V.n, I = V.A, e = V.Z, b = V.m, Z = W == null; - if ( Z )W = new R( N.length >>> 2 << 5 ); while ( i == 0 ) { - - i = n( N, d, 1 ); m = n( N, d + 1, 2 ); d += 3; if ( m == 0 ) { - - if ( ( d & 7 ) != 0 )d += 8 - ( d & 7 ); - var D = ( d >>> 3 ) + 4, q = N[ D - 4 ] | N[ D - 3 ] << 8; if ( Z )W = H.H.W( W, w + q ); W.set( new R( N.buffer, N.byteOffset + D, q ), w ); d = D + q << 3; - w += q; continue - ; - - } - - if ( Z )W = H.H.W( W, w + ( 1 << 17 ) ); if ( m == 1 ) { - - v = b.J; C = b.h; X = ( 1 << 9 ) - 1; u = ( 1 << 5 ) - 1; - - } - - if ( m == 2 ) { - - J = A( N, d, 5 ) + 257; - h = A( N, d + 5, 5 ) + 1; Q = A( N, d + 10, 4 ) + 4; d += 14; var j = 1; for ( var c = 0; c < 38; c += 2 ) { - - b.Q[ c ] = 0; b.Q[ c + 1 ] = 0; - - } - - for ( var c = 0; - c < Q; c ++ ) { - - var K = A( N, d + c * 3, 3 ); b.Q[ ( b.X[ c ] << 1 ) + 1 ] = K; if ( K > j )j = K - ; - - } - - d += 3 * Q; M( b.Q, j ); I( b.Q, j, b.u ); v = b.w; C = b.d; - d = l( b.u, ( 1 << j ) - 1, J + h, N, d, b.v ); var r = V.V( b.v, 0, J, b.C ); X = ( 1 << r ) - 1; var S = V.V( b.v, J, h, b.D ); u = ( 1 << S ) - 1; M( b.C, r ); - I( b.C, r, v ); M( b.D, S ); I( b.D, S, C ) - ; - - } - - while ( ! 0 ) { - - var T = v[ e( N, d ) & X ]; d += T & 15; var p = T >>> 4; if ( p >>> 8 == 0 ) { - - W[ w ++ ] = p; - - } else if ( p == 256 ) { - - break; - - } else { - - var z = w + p - 254; - if ( p > 264 ) { - - var _ = b.q[ p - 257 ]; z = w + ( _ >>> 3 ) + A( N, d, _ & 7 ); d += _ & 7; - - } - - var $ = C[ e( N, d ) & u ]; d += $ & 15; var s = $ >>> 4, Y = b.c[ s ], a = ( Y >>> 4 ) + n( N, d, Y & 15 ); - d += Y & 15; while ( w < z ) { - - W[ w ] = W[ w ++ - a ]; W[ w ] = W[ w ++ - a ]; W[ w ] = W[ w ++ - a ]; W[ w ] = W[ w ++ - a ]; - - } - - w = z - ; - - } - - } - - } - - return W.length == w ? W : W.slice( 0, w ) - ; - - }; - - H.H.W = function ( N, W ) { - - var R = N.length; if ( W <= R ) return N; var V = new Uint8Array( R << 1 ); V.set( N, 0 ); return V; - - }; - - H.H.R = function ( N, W, R, V, n, A ) { - - var l = H.H.e, M = H.H.Z, I = 0; while ( I < R ) { - - var e = N[ M( V, n ) & W ]; n += e & 15; var b = e >>> 4; - if ( b <= 15 ) { - - A[ I ] = b; I ++; - - } else { - - var Z = 0, m = 0; if ( b == 16 ) { - - m = 3 + l( V, n, 2 ); n += 2; Z = A[ I - 1 ]; - - } else if ( b == 17 ) { - - m = 3 + l( V, n, 3 ); - n += 3 - ; - - } else if ( b == 18 ) { - - m = 11 + l( V, n, 7 ); n += 7; - - } - - var J = I + m; while ( I < J ) { - - A[ I ] = Z; I ++; - - } - - } - - } - - return n - ; - - }; - - H.H.V = function ( N, W, R, V ) { - - var n = 0, A = 0, l = V.length >>> 1; - while ( A < R ) { - - var M = N[ A + W ]; V[ A << 1 ] = 0; V[ ( A << 1 ) + 1 ] = M; if ( M > n )n = M; A ++; - - } - - while ( A < l ) { - - V[ A << 1 ] = 0; V[ ( A << 1 ) + 1 ] = 0; A ++; - - } - - return n - ; - - }; - - H.H.n = function ( N, W ) { - - var R = H.H.m, V = N.length, n, A, l, M, I, e = R.j; for ( var M = 0; M <= W; M ++ )e[ M ] = 0; for ( M = 1; M < V; M += 2 )e[ N[ M ] ] ++; - var b = R.K; n = 0; e[ 0 ] = 0; for ( A = 1; A <= W; A ++ ) { - - n = n + e[ A - 1 ] << 1; b[ A ] = n; - - } - - for ( l = 0; l < V; l += 2 ) { - - I = N[ l + 1 ]; if ( I != 0 ) { - - N[ l ] = b[ I ]; - b[ I ] ++ - ; - - } - - } - - }; - - H.H.A = function ( N, W, R ) { - - var V = N.length, n = H.H.m, A = n.r; for ( var l = 0; l < V; l += 2 ) if ( N[ l + 1 ] != 0 ) { - - var M = l >> 1, I = N[ l + 1 ], e = M << 4 | I, b = W - I, Z = N[ l ] << b, m = Z + ( 1 << b ); - while ( Z != m ) { - - var J = A[ Z ] >>> 15 - W; R[ J ] = e; Z ++; - - } - - } - - }; - - H.H.l = function ( N, W ) { - - var R = H.H.m.r, V = 15 - W; for ( var n = 0; n < N.length; - n += 2 ) { - - var A = N[ n ] << W - N[ n + 1 ]; N[ n ] = R[ A ] >>> V; - - } - - }; - - H.H.M = function ( N, W, R ) { - - R = R << ( W & 7 ); var V = W >>> 3; N[ V ] |= R; N[ V + 1 ] |= R >>> 8; - - }; - - H.H.I = function ( N, W, R ) { - - R = R << ( W & 7 ); var V = W >>> 3; N[ V ] |= R; N[ V + 1 ] |= R >>> 8; N[ V + 2 ] |= R >>> 16; - - }; - - H.H.e = function ( N, W, R ) { - - return ( N[ W >>> 3 ] | N[ ( W >>> 3 ) + 1 ] << 8 ) >>> ( W & 7 ) & ( 1 << R ) - 1; - - }; - - H.H.b = function ( N, W, R ) { - - return ( N[ W >>> 3 ] | N[ ( W >>> 3 ) + 1 ] << 8 | N[ ( W >>> 3 ) + 2 ] << 16 ) >>> ( W & 7 ) & ( 1 << R ) - 1; - - }; - - H.H.Z = function ( N, W ) { - - return ( N[ W >>> 3 ] | N[ ( W >>> 3 ) + 1 ] << 8 | N[ ( W >>> 3 ) + 2 ] << 16 ) >>> ( W & 7 ); - - }; - - H.H.i = function ( N, W ) { - - return ( N[ W >>> 3 ] | N[ ( W >>> 3 ) + 1 ] << 8 | N[ ( W >>> 3 ) + 2 ] << 16 | N[ ( W >>> 3 ) + 3 ] << 24 ) >>> ( W & 7 ); - - }; - - H.H.m = function () { - - var N = Uint16Array, W = Uint32Array; - return { K: new N( 16 ), j: new N( 16 ), X: [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], S: [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 999, 999, 999 ], T: [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0 ], q: new N( 32 ), p: [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 65535, 65535 ], z: [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0 ], c: new W( 32 ), J: new N( 512 ), _: [], h: new N( 32 ), $: [], w: new N( 32768 ), C: [], v: [], d: new N( 32768 ), D: [], u: new N( 512 ), Q: [], r: new N( 1 << 15 ), s: new W( 286 ), Y: new W( 30 ), a: new W( 19 ), t: new W( 15e3 ), k: new N( 1 << 16 ), g: new N( 1 << 15 ) } - ; - - }(); - ( function () { - - var N = H.H.m, W = 1 << 15; for ( var R = 0; R < W; R ++ ) { - - var V = R; V = ( V & 2863311530 ) >>> 1 | ( V & 1431655765 ) << 1; - V = ( V & 3435973836 ) >>> 2 | ( V & 858993459 ) << 2; V = ( V & 4042322160 ) >>> 4 | ( V & 252645135 ) << 4; V = ( V & 4278255360 ) >>> 8 | ( V & 16711935 ) << 8; - N.r[ R ] = ( V >>> 16 | V << 16 ) >>> 17 - ; - - } - - function n( A, l, M ) { - - while ( l -- != 0 )A.push( 0, M ) - ; - - } - - for ( var R = 0; R < 32; R ++ ) { - - N.q[ R ] = N.S[ R ] << 3 | N.T[ R ]; - N.c[ R ] = N.p[ R ] << 4 | N.z[ R ] - ; - - } - - n( N._, 144, 8 ); n( N._, 255 - 143, 9 ); n( N._, 279 - 255, 7 ); n( N._, 287 - 279, 8 ); H.H.n( N._, 9 ); - H.H.A( N._, 9, N.J ); H.H.l( N._, 9 ); n( N.$, 32, 5 ); H.H.n( N.$, 5 ); H.H.A( N.$, 5, N.h ); H.H.l( N.$, 5 ); n( N.Q, 19, 0 ); n( N.C, 286, 0 ); - n( N.D, 30, 0 ); n( N.v, 320, 0 ) - ; - - }() ); - - return H.H.N - ; - -}(); - - -UPNG.decode._readInterlace = function ( data, out ) { - - var w = out.width, h = out.height; - var bpp = UPNG.decode._getBPP( out ), cbpp = bpp >> 3, bpl = Math.ceil( w * bpp / 8 ); - var img = new Uint8Array( h * bpl ); - var di = 0; - - var starting_row = [ 0, 0, 4, 0, 2, 0, 1 ]; - var starting_col = [ 0, 4, 0, 2, 0, 1, 0 ]; - var row_increment = [ 8, 8, 8, 4, 4, 2, 2 ]; - var col_increment = [ 8, 8, 4, 4, 2, 2, 1 ]; - - var pass = 0; - while ( pass < 7 ) { - - var ri = row_increment[ pass ], ci = col_increment[ pass ]; - var sw = 0, sh = 0; - var cr = starting_row[ pass ]; while ( cr < h ) { - - cr += ri; sh ++; - - } - - var cc = starting_col[ pass ]; while ( cc < w ) { - - cc += ci; sw ++; - - } - - var bpll = Math.ceil( sw * bpp / 8 ); - UPNG.decode._filterZero( data, out, di, sw, sh ); - - var y = 0, row = starting_row[ pass ]; - var val; - - while ( row < h ) { - - var col = starting_col[ pass ]; - var cdi = ( di + y * bpll ) << 3; - - while ( col < w ) { - - if ( bpp == 1 ) { - - val = data[ cdi >> 3 ]; val = ( val >> ( 7 - ( cdi & 7 ) ) ) & 1; - img[ row * bpl + ( col >> 3 ) ] |= ( val << ( 7 - ( ( col & 7 ) << 0 ) ) ); - - } - - if ( bpp == 2 ) { - - val = data[ cdi >> 3 ]; val = ( val >> ( 6 - ( cdi & 7 ) ) ) & 3; - img[ row * bpl + ( col >> 2 ) ] |= ( val << ( 6 - ( ( col & 3 ) << 1 ) ) ); - - } - - if ( bpp == 4 ) { - - val = data[ cdi >> 3 ]; val = ( val >> ( 4 - ( cdi & 7 ) ) ) & 15; - img[ row * bpl + ( col >> 1 ) ] |= ( val << ( 4 - ( ( col & 1 ) << 2 ) ) ); - - } - - if ( bpp >= 8 ) { - - var ii = row * bpl + col * cbpp; - for ( var j = 0; j < cbpp; j ++ ) img[ ii + j ] = data[ ( cdi >> 3 ) + j ]; - - } - - cdi += bpp; col += ci; - - } - - y ++; row += ri; - - } - - if ( sw * sh != 0 ) di += sh * ( 1 + bpll ); - pass = pass + 1; - - } - - return img; - -}; - -UPNG.decode._getBPP = function ( out ) { - - var noc = [ 1, null, 3, 1, 2, null, 4 ][ out.ctype ]; - return noc * out.depth; - -}; - -UPNG.decode._filterZero = function ( data, out, off, w, h ) { - - var bpp = UPNG.decode._getBPP( out ), bpl = Math.ceil( w * bpp / 8 ), paeth = UPNG.decode._paeth; - bpp = Math.ceil( bpp / 8 ); - - var i, di, type = data[ off ], x = 0; - - if ( type > 1 ) data[ off ] = [ 0, 0, 1 ][ type - 2 ]; - if ( type == 3 ) for ( x = bpp; x < bpl; x ++ ) data[ x + 1 ] = ( data[ x + 1 ] + ( data[ x + 1 - bpp ] >>> 1 ) ) & 255; - - for ( var y = 0; y < h; y ++ ) { - - i = off + y * bpl; di = i + y + 1; - type = data[ di - 1 ]; x = 0; - - if ( type == 0 ) for ( ; x < bpl; x ++ ) data[ i + x ] = data[ di + x ]; - else if ( type == 1 ) { - - for ( ; x < bpp; x ++ ) data[ i + x ] = data[ di + x ]; - for ( ; x < bpl; x ++ ) data[ i + x ] = ( data[ di + x ] + data[ i + x - bpp ] ); - - } else if ( type == 2 ) { - - for ( ; x < bpl; x ++ ) data[ i + x ] = ( data[ di + x ] + data[ i + x - bpl ] ); - - } else if ( type == 3 ) { - - for ( ; x < bpp; x ++ ) data[ i + x ] = ( data[ di + x ] + ( data[ i + x - bpl ] >>> 1 ) ); - for ( ; x < bpl; x ++ ) data[ i + x ] = ( data[ di + x ] + ( ( data[ i + x - bpl ] + data[ i + x - bpp ] ) >>> 1 ) ); - - } else { - - for ( ; x < bpp; x ++ ) data[ i + x ] = ( data[ di + x ] + paeth( 0, data[ i + x - bpl ], 0 ) ); - for ( ; x < bpl; x ++ ) data[ i + x ] = ( data[ di + x ] + paeth( data[ i + x - bpp ], data[ i + x - bpl ], data[ i + x - bpp - bpl ] ) ); - - } - - } - - return data; - -}; - -UPNG.decode._paeth = function ( a, b, c ) { - - var p = a + b - c, pa = ( p - a ), pb = ( p - b ), pc = ( p - c ); - if ( pa * pa <= pb * pb && pa * pa <= pc * pc ) return a; - else if ( pb * pb <= pc * pc ) return b; - return c; - -}; - -UPNG.decode._IHDR = function ( data, offset, out ) { - - var bin = UPNG._bin; - out.width = bin.readUint( data, offset ); offset += 4; - out.height = bin.readUint( data, offset ); offset += 4; - out.depth = data[ offset ]; offset ++; - out.ctype = data[ offset ]; offset ++; - out.compress = data[ offset ]; offset ++; - out.filter = data[ offset ]; offset ++; - out.interlace = data[ offset ]; offset ++; - -}; - -UPNG._bin = { - nextZero: function ( data, p ) { - - while ( data[ p ] != 0 ) p ++; return p; - - }, - readUshort: function ( buff, p ) { - - return ( buff[ p ] << 8 ) | buff[ p + 1 ]; - - }, - writeUshort: function ( buff, p, n ) { - - buff[ p ] = ( n >> 8 ) & 255; buff[ p + 1 ] = n & 255; - - }, - readUint: function ( buff, p ) { - - return ( buff[ p ] * ( 256 * 256 * 256 ) ) + ( ( buff[ p + 1 ] << 16 ) | ( buff[ p + 2 ] << 8 ) | buff[ p + 3 ] ); - - }, - writeUint: function ( buff, p, n ) { - - buff[ p ] = ( n >> 24 ) & 255; buff[ p + 1 ] = ( n >> 16 ) & 255; buff[ p + 2 ] = ( n >> 8 ) & 255; buff[ p + 3 ] = n & 255; - - }, - readASCII: function ( buff, p, l ) { - - var s = ''; for ( var i = 0; i < l; i ++ ) s += String.fromCharCode( buff[ p + i ] ); return s; - - }, - writeASCII: function ( data, p, s ) { - - for ( var i = 0; i < s.length; i ++ ) data[ p + i ] = s.charCodeAt( i ); - - }, - readBytes: function ( buff, p, l ) { - - var arr = []; for ( var i = 0; i < l; i ++ ) arr.push( buff[ p + i ] ); return arr; - - }, - pad: function ( n ) { - - return n.length < 2 ? '0' + n : n; - - }, - readUTF8: function ( buff, p, l ) { - - var s = '', ns; - for ( var i = 0; i < l; i ++ ) s += '%' + UPNG._bin.pad( buff[ p + i ].toString( 16 ) ); - try { - - ns = decodeURIComponent( s ); - - } catch ( e ) { - - return UPNG._bin.readASCII( buff, p, l ); - - } - - return ns; - - } -}; -UPNG._copyTile = function ( sb, sw, sh, tb, tw, th, xoff, yoff, mode ) { - - var w = Math.min( sw, tw ), h = Math.min( sh, th ); - var si = 0, ti = 0; - for ( var y = 0; y < h; y ++ ) - for ( var x = 0; x < w; x ++ ) { - - if ( xoff >= 0 && yoff >= 0 ) { - - si = ( y * sw + x ) << 2; ti = ( ( yoff + y ) * tw + xoff + x ) << 2; - - } else { - - si = ( ( - yoff + y ) * sw - xoff + x ) << 2; ti = ( y * tw + x ) << 2; - - } - - if ( mode == 0 ) { - - tb[ ti ] = sb[ si ]; tb[ ti + 1 ] = sb[ si + 1 ]; tb[ ti + 2 ] = sb[ si + 2 ]; tb[ ti + 3 ] = sb[ si + 3 ]; - - } else if ( mode == 1 ) { - - var fa = sb[ si + 3 ] * ( 1 / 255 ), fr = sb[ si ] * fa, fg = sb[ si + 1 ] * fa, fb = sb[ si + 2 ] * fa; - var ba = tb[ ti + 3 ] * ( 1 / 255 ), br = tb[ ti ] * ba, bg = tb[ ti + 1 ] * ba, bb = tb[ ti + 2 ] * ba; - - var ifa = 1 - fa, oa = fa + ba * ifa, ioa = ( oa == 0 ? 0 : 1 / oa ); - tb[ ti + 3 ] = 255 * oa; - tb[ ti + 0 ] = ( fr + br * ifa ) * ioa; - tb[ ti + 1 ] = ( fg + bg * ifa ) * ioa; - tb[ ti + 2 ] = ( fb + bb * ifa ) * ioa; - - } else if ( mode == 2 ) { // copy only differences, otherwise zero - - var fa = sb[ si + 3 ], fr = sb[ si ], fg = sb[ si + 1 ], fb = sb[ si + 2 ]; - var ba = tb[ ti + 3 ], br = tb[ ti ], bg = tb[ ti + 1 ], bb = tb[ ti + 2 ]; - if ( fa == ba && fr == br && fg == bg && fb == bb ) { - - tb[ ti ] = 0; tb[ ti + 1 ] = 0; tb[ ti + 2 ] = 0; tb[ ti + 3 ] = 0; - - } else { - - tb[ ti ] = fr; tb[ ti + 1 ] = fg; tb[ ti + 2 ] = fb; tb[ ti + 3 ] = fa; - - } - - } else if ( mode == 3 ) { // check if can be blended - - var fa = sb[ si + 3 ], fr = sb[ si ], fg = sb[ si + 1 ], fb = sb[ si + 2 ]; - var ba = tb[ ti + 3 ], br = tb[ ti ], bg = tb[ ti + 1 ], bb = tb[ ti + 2 ]; - if ( fa == ba && fr == br && fg == bg && fb == bb ) continue; - //if(fa!=255 && ba!=0) return false; - if ( fa < 220 && ba > 20 ) return false; - - } - - } - - return true; - -}; - -export { RGBMLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBShiftShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/RGBShiftShader.js deleted file mode 100644 index 699f441..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/RGBShiftShader.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * RGB Shift Shader - * Shifts red and blue channels from center in opposite directions - * Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/ - * by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/ - * - * amount: shift distance (1 is width of input) - * angle: shift angle in radians - */ - -const RGBShiftShader = { - - name: 'RGBShiftShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'amount': { value: 0.005 }, - 'angle': { value: 0.0 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform float amount; - uniform float angle; - - varying vec2 vUv; - - void main() { - - vec2 offset = amount * vec2( cos(angle), sin(angle)); - vec4 cr = texture2D(tDiffuse, vUv + offset); - vec4 cga = texture2D(tDiffuse, vUv); - vec4 cb = texture2D(tDiffuse, vUv - offset); - gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a); - - }` - -}; - -export { RGBShiftShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/RenderPixelatedPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/RenderPixelatedPass.js deleted file mode 100644 index 07395c4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/RenderPixelatedPass.js +++ /dev/null @@ -1,235 +0,0 @@ -import { - WebGLRenderTarget, - MeshNormalMaterial, - ShaderMaterial, - Vector2, - Vector4, - DepthTexture, - NearestFilter, - HalfFloatType -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; - -class RenderPixelatedPass extends Pass { - - constructor( pixelSize, scene, camera, options = {} ) { - - super(); - - this.pixelSize = pixelSize; - this.resolution = new Vector2(); - this.renderResolution = new Vector2(); - - this.pixelatedMaterial = this.createPixelatedMaterial(); - this.normalMaterial = new MeshNormalMaterial(); - - this.fsQuad = new FullScreenQuad( this.pixelatedMaterial ); - this.scene = scene; - this.camera = camera; - - this.normalEdgeStrength = options.normalEdgeStrength || 0.3; - this.depthEdgeStrength = options.depthEdgeStrength || 0.4; - - this.beautyRenderTarget = new WebGLRenderTarget(); - this.beautyRenderTarget.texture.minFilter = NearestFilter; - this.beautyRenderTarget.texture.magFilter = NearestFilter; - this.beautyRenderTarget.texture.type = HalfFloatType; - this.beautyRenderTarget.depthTexture = new DepthTexture(); - - this.normalRenderTarget = new WebGLRenderTarget(); - this.normalRenderTarget.texture.minFilter = NearestFilter; - this.normalRenderTarget.texture.magFilter = NearestFilter; - this.normalRenderTarget.texture.type = HalfFloatType; - - } - - dispose() { - - this.beautyRenderTarget.dispose(); - this.normalRenderTarget.dispose(); - - this.pixelatedMaterial.dispose(); - this.normalMaterial.dispose(); - - this.fsQuad.dispose(); - - } - - setSize( width, height ) { - - this.resolution.set( width, height ); - this.renderResolution.set( ( width / this.pixelSize ) | 0, ( height / this.pixelSize ) | 0 ); - const { x, y } = this.renderResolution; - this.beautyRenderTarget.setSize( x, y ); - this.normalRenderTarget.setSize( x, y ); - this.fsQuad.material.uniforms.resolution.value.set( x, y, 1 / x, 1 / y ); - - } - - setPixelSize( pixelSize ) { - - this.pixelSize = pixelSize; - this.setSize( this.resolution.x, this.resolution.y ); - - } - - render( renderer, writeBuffer ) { - - const uniforms = this.fsQuad.material.uniforms; - uniforms.normalEdgeStrength.value = this.normalEdgeStrength; - uniforms.depthEdgeStrength.value = this.depthEdgeStrength; - - renderer.setRenderTarget( this.beautyRenderTarget ); - renderer.render( this.scene, this.camera ); - - const overrideMaterial_old = this.scene.overrideMaterial; - renderer.setRenderTarget( this.normalRenderTarget ); - this.scene.overrideMaterial = this.normalMaterial; - renderer.render( this.scene, this.camera ); - this.scene.overrideMaterial = overrideMaterial_old; - - uniforms.tDiffuse.value = this.beautyRenderTarget.texture; - uniforms.tDepth.value = this.beautyRenderTarget.depthTexture; - uniforms.tNormal.value = this.normalRenderTarget.texture; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - - if ( this.clear ) renderer.clear(); - - } - - this.fsQuad.render( renderer ); - - } - - createPixelatedMaterial() { - - return new ShaderMaterial( { - uniforms: { - tDiffuse: { value: null }, - tDepth: { value: null }, - tNormal: { value: null }, - resolution: { - value: new Vector4( - this.renderResolution.x, - this.renderResolution.y, - 1 / this.renderResolution.x, - 1 / this.renderResolution.y, - ) - }, - normalEdgeStrength: { value: 0 }, - depthEdgeStrength: { value: 0 } - }, - vertexShader: /* glsl */` - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - `, - fragmentShader: /* glsl */` - uniform sampler2D tDiffuse; - uniform sampler2D tDepth; - uniform sampler2D tNormal; - uniform vec4 resolution; - uniform float normalEdgeStrength; - uniform float depthEdgeStrength; - varying vec2 vUv; - - float getDepth(int x, int y) { - - return texture2D( tDepth, vUv + vec2(x, y) * resolution.zw ).r; - - } - - vec3 getNormal(int x, int y) { - - return texture2D( tNormal, vUv + vec2(x, y) * resolution.zw ).rgb * 2.0 - 1.0; - - } - - float depthEdgeIndicator(float depth, vec3 normal) { - - float diff = 0.0; - diff += clamp(getDepth(1, 0) - depth, 0.0, 1.0); - diff += clamp(getDepth(-1, 0) - depth, 0.0, 1.0); - diff += clamp(getDepth(0, 1) - depth, 0.0, 1.0); - diff += clamp(getDepth(0, -1) - depth, 0.0, 1.0); - return floor(smoothstep(0.01, 0.02, diff) * 2.) / 2.; - - } - - float neighborNormalEdgeIndicator(int x, int y, float depth, vec3 normal) { - - float depthDiff = getDepth(x, y) - depth; - vec3 neighborNormal = getNormal(x, y); - - // Edge pixels should yield to faces who's normals are closer to the bias normal. - vec3 normalEdgeBias = vec3(1., 1., 1.); // This should probably be a parameter. - float normalDiff = dot(normal - neighborNormal, normalEdgeBias); - float normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0); - - // Only the shallower pixel should detect the normal edge. - float depthIndicator = clamp(sign(depthDiff * .25 + .0025), 0.0, 1.0); - - return (1.0 - dot(normal, neighborNormal)) * depthIndicator * normalIndicator; - - } - - float normalEdgeIndicator(float depth, vec3 normal) { - - float indicator = 0.0; - - indicator += neighborNormalEdgeIndicator(0, -1, depth, normal); - indicator += neighborNormalEdgeIndicator(0, 1, depth, normal); - indicator += neighborNormalEdgeIndicator(-1, 0, depth, normal); - indicator += neighborNormalEdgeIndicator(1, 0, depth, normal); - - return step(0.1, indicator); - - } - - void main() { - - vec4 texel = texture2D( tDiffuse, vUv ); - - float depth = 0.0; - vec3 normal = vec3(0.0); - - if (depthEdgeStrength > 0.0 || normalEdgeStrength > 0.0) { - - depth = getDepth(0, 0); - normal = getNormal(0, 0); - - } - - float dei = 0.0; - if (depthEdgeStrength > 0.0) - dei = depthEdgeIndicator(depth, normal); - - float nei = 0.0; - if (normalEdgeStrength > 0.0) - nei = normalEdgeIndicator(depth, normal); - - float Strength = dei > 0.0 ? (1.0 - depthEdgeStrength * dei) : (1.0 + normalEdgeStrength * nei); - - gl_FragColor = texel * Strength; - - } - ` - } ); - - } - -} - -export { RenderPixelatedPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/RenderTransitionPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/RenderTransitionPass.js deleted file mode 100644 index f21cacd..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/RenderTransitionPass.js +++ /dev/null @@ -1,168 +0,0 @@ -import { - HalfFloatType, - ShaderMaterial, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { FullScreenQuad, Pass } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; - -class RenderTransitionPass extends Pass { - - constructor( sceneA, cameraA, sceneB, cameraB ) { - - super(); - - this.material = this.createMaterial(); - this.fsQuad = new FullScreenQuad( this.material ); - - this.sceneA = sceneA; - this.cameraA = cameraA; - this.sceneB = sceneB; - this.cameraB = cameraB; - - this.renderTargetA = new WebGLRenderTarget(); - this.renderTargetA.texture.type = HalfFloatType; - this.renderTargetB = new WebGLRenderTarget(); - this.renderTargetB.texture.type = HalfFloatType; - - } - - setTransition( value ) { - - this.material.uniforms.mixRatio.value = value; - - } - - useTexture( value ) { - - this.material.uniforms.useTexture.value = value ? 1 : 0; - - } - - setTexture( value ) { - - this.material.uniforms.tMixTexture.value = value; - - } - - setTextureThreshold( value ) { - - this.material.uniforms.threshold.value = value; - - } - - setSize( width, height ) { - - this.renderTargetA.setSize( width, height ); - this.renderTargetB.setSize( width, height ); - - } - - render( renderer, writeBuffer ) { - - renderer.setRenderTarget( this.renderTargetA ); - renderer.render( this.sceneA, this.cameraA ); - renderer.setRenderTarget( this.renderTargetB ); - renderer.render( this.sceneB, this.cameraB ); - - const uniforms = this.fsQuad.material.uniforms; - uniforms.tDiffuse1.value = this.renderTargetA.texture; - uniforms.tDiffuse2.value = this.renderTargetB.texture; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - renderer.clear(); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - - } - - this.fsQuad.render( renderer ); - - } - - dispose() { - - this.renderTargetA.dispose(); - this.renderTargetB.dispose(); - this.material.dispose(); - this.fsQuad.dispose(); - - } - - createMaterial() { - - return new ShaderMaterial( { - uniforms: { - tDiffuse1: { - value: null - }, - tDiffuse2: { - value: null - }, - mixRatio: { - value: 0.0 - }, - threshold: { - value: 0.1 - }, - useTexture: { - value: 1 - }, - tMixTexture: { - value: null - } - }, - vertexShader: /* glsl */` - varying vec2 vUv; - - void main() { - - vUv = vec2( uv.x, uv.y ); - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - `, - fragmentShader: /* glsl */` - uniform float mixRatio; - - uniform sampler2D tDiffuse1; - uniform sampler2D tDiffuse2; - uniform sampler2D tMixTexture; - - uniform int useTexture; - uniform float threshold; - - varying vec2 vUv; - - void main() { - - vec4 texel1 = texture2D( tDiffuse1, vUv ); - vec4 texel2 = texture2D( tDiffuse2, vUv ); - - if (useTexture == 1) { - - vec4 transitionTexel = texture2D( tMixTexture, vUv ); - float r = mixRatio * ( 1.0 + threshold * 2.0 ) - threshold; - float mixf = clamp( ( transitionTexel.r - r ) * ( 1.0 / threshold ), 0.0, 1.0 ); - - gl_FragColor = mix( texel1, texel2, mixf ); - - } else { - - gl_FragColor = mix( texel2, texel1, mixRatio ); - - } - - } - ` - } ); - - } - -} - -export { RenderTransitionPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SAOPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SAOPass.js deleted file mode 100644 index 6839ea3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SAOPass.js +++ /dev/null @@ -1,334 +0,0 @@ -import { - AddEquation, - Color, - CustomBlending, - DepthTexture, - DstAlphaFactor, - DstColorFactor, - HalfFloatType, - MeshNormalMaterial, - NearestFilter, - NoBlending, - ShaderMaterial, - UniformsUtils, - DepthStencilFormat, - UnsignedInt248Type, - Vector2, - WebGLRenderTarget, - ZeroFactor -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { SAOShader } from'/static/javascript/three/examples/jsm/shaders/SAOShader.js'; -import { DepthLimitedBlurShader } from'/static/javascript/three/examples/jsm/shaders/DepthLimitedBlurShader.js'; -import { BlurShaderUtils } from'/static/javascript/three/examples/jsm/shaders/DepthLimitedBlurShader.js'; -import { CopyShader } from'/static/javascript/three/examples/jsm/shaders/CopyShader.js'; - -/** - * SAO implementation inspired from bhouston previous SAO work - */ - -class SAOPass extends Pass { - - constructor( scene, camera, resolution = new Vector2( 256, 256 ) ) { - - super(); - - this.scene = scene; - this.camera = camera; - - this.clear = true; - this.needsSwap = false; - - this.originalClearColor = new Color(); - this._oldClearColor = new Color(); - this.oldClearAlpha = 1; - - this.params = { - output: 0, - saoBias: 0.5, - saoIntensity: 0.18, - saoScale: 1, - saoKernelRadius: 100, - saoMinResolution: 0, - saoBlur: true, - saoBlurRadius: 8, - saoBlurStdDev: 4, - saoBlurDepthCutoff: 0.01 - }; - - this.resolution = new Vector2( resolution.x, resolution.y ); - - this.saoRenderTarget = new WebGLRenderTarget( this.resolution.x, this.resolution.y, { type: HalfFloatType } ); - this.blurIntermediateRenderTarget = this.saoRenderTarget.clone(); - - const depthTexture = new DepthTexture(); - depthTexture.format = DepthStencilFormat; - depthTexture.type = UnsignedInt248Type; - - this.normalRenderTarget = new WebGLRenderTarget( this.resolution.x, this.resolution.y, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - depthTexture: depthTexture - } ); - - this.normalMaterial = new MeshNormalMaterial(); - this.normalMaterial.blending = NoBlending; - - this.saoMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SAOShader.defines ), - fragmentShader: SAOShader.fragmentShader, - vertexShader: SAOShader.vertexShader, - uniforms: UniformsUtils.clone( SAOShader.uniforms ) - } ); - this.saoMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0; - this.saoMaterial.uniforms[ 'tDepth' ].value = depthTexture; - this.saoMaterial.uniforms[ 'tNormal' ].value = this.normalRenderTarget.texture; - this.saoMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y ); - this.saoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - this.saoMaterial.uniforms[ 'cameraProjectionMatrix' ].value = this.camera.projectionMatrix; - this.saoMaterial.blending = NoBlending; - - this.vBlurMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( DepthLimitedBlurShader.uniforms ), - defines: Object.assign( {}, DepthLimitedBlurShader.defines ), - vertexShader: DepthLimitedBlurShader.vertexShader, - fragmentShader: DepthLimitedBlurShader.fragmentShader - } ); - this.vBlurMaterial.defines[ 'DEPTH_PACKING' ] = 0; - this.vBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0; - this.vBlurMaterial.uniforms[ 'tDiffuse' ].value = this.saoRenderTarget.texture; - this.vBlurMaterial.uniforms[ 'tDepth' ].value = depthTexture; - this.vBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y ); - this.vBlurMaterial.blending = NoBlending; - - this.hBlurMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( DepthLimitedBlurShader.uniforms ), - defines: Object.assign( {}, DepthLimitedBlurShader.defines ), - vertexShader: DepthLimitedBlurShader.vertexShader, - fragmentShader: DepthLimitedBlurShader.fragmentShader - } ); - this.hBlurMaterial.defines[ 'DEPTH_PACKING' ] = 0; - this.hBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0; - this.hBlurMaterial.uniforms[ 'tDiffuse' ].value = this.blurIntermediateRenderTarget.texture; - this.hBlurMaterial.uniforms[ 'tDepth' ].value = depthTexture; - this.hBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y ); - this.hBlurMaterial.blending = NoBlending; - - this.materialCopy = new ShaderMaterial( { - uniforms: UniformsUtils.clone( CopyShader.uniforms ), - vertexShader: CopyShader.vertexShader, - fragmentShader: CopyShader.fragmentShader, - blending: NoBlending - } ); - this.materialCopy.transparent = true; - this.materialCopy.depthTest = false; - this.materialCopy.depthWrite = false; - this.materialCopy.blending = CustomBlending; - this.materialCopy.blendSrc = DstColorFactor; - this.materialCopy.blendDst = ZeroFactor; - this.materialCopy.blendEquation = AddEquation; - this.materialCopy.blendSrcAlpha = DstAlphaFactor; - this.materialCopy.blendDstAlpha = ZeroFactor; - this.materialCopy.blendEquationAlpha = AddEquation; - - this.fsQuad = new FullScreenQuad( null ); - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive*/ ) { - - // Rendering readBuffer first when rendering to screen - if ( this.renderToScreen ) { - - this.materialCopy.blending = NoBlending; - this.materialCopy.uniforms[ 'tDiffuse' ].value = readBuffer.texture; - this.materialCopy.needsUpdate = true; - this.renderPass( renderer, this.materialCopy, null ); - - } - - renderer.getClearColor( this._oldClearColor ); - this.oldClearAlpha = renderer.getClearAlpha(); - const oldAutoClear = renderer.autoClear; - renderer.autoClear = false; - - this.saoMaterial.uniforms[ 'bias' ].value = this.params.saoBias; - this.saoMaterial.uniforms[ 'intensity' ].value = this.params.saoIntensity; - this.saoMaterial.uniforms[ 'scale' ].value = this.params.saoScale; - this.saoMaterial.uniforms[ 'kernelRadius' ].value = this.params.saoKernelRadius; - this.saoMaterial.uniforms[ 'minResolution' ].value = this.params.saoMinResolution; - this.saoMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.saoMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - // this.saoMaterial.uniforms['randomSeed'].value = Math.random(); - - const depthCutoff = this.params.saoBlurDepthCutoff * ( this.camera.far - this.camera.near ); - this.vBlurMaterial.uniforms[ 'depthCutoff' ].value = depthCutoff; - this.hBlurMaterial.uniforms[ 'depthCutoff' ].value = depthCutoff; - - this.vBlurMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.vBlurMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - this.hBlurMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.hBlurMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - - this.params.saoBlurRadius = Math.floor( this.params.saoBlurRadius ); - if ( ( this.prevStdDev !== this.params.saoBlurStdDev ) || ( this.prevNumSamples !== this.params.saoBlurRadius ) ) { - - BlurShaderUtils.configure( this.vBlurMaterial, this.params.saoBlurRadius, this.params.saoBlurStdDev, new Vector2( 0, 1 ) ); - BlurShaderUtils.configure( this.hBlurMaterial, this.params.saoBlurRadius, this.params.saoBlurStdDev, new Vector2( 1, 0 ) ); - this.prevStdDev = this.params.saoBlurStdDev; - this.prevNumSamples = this.params.saoBlurRadius; - - } - - // render normal and depth - this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 ); - - // Rendering SAO texture - this.renderPass( renderer, this.saoMaterial, this.saoRenderTarget, 0xffffff, 1.0 ); - - // Blurring SAO texture - if ( this.params.saoBlur ) { - - this.renderPass( renderer, this.vBlurMaterial, this.blurIntermediateRenderTarget, 0xffffff, 1.0 ); - this.renderPass( renderer, this.hBlurMaterial, this.saoRenderTarget, 0xffffff, 1.0 ); - - } - - const outputMaterial = this.materialCopy; - - // Setting up SAO rendering - if ( this.params.output === SAOPass.OUTPUT.Normal ) { - - this.materialCopy.uniforms[ 'tDiffuse' ].value = this.normalRenderTarget.texture; - this.materialCopy.needsUpdate = true; - - } else { - - this.materialCopy.uniforms[ 'tDiffuse' ].value = this.saoRenderTarget.texture; - this.materialCopy.needsUpdate = true; - - } - - // Blending depends on output - if ( this.params.output === SAOPass.OUTPUT.Default ) { - - outputMaterial.blending = CustomBlending; - - } else { - - outputMaterial.blending = NoBlending; - - } - - // Rendering SAOPass result on top of previous pass - this.renderPass( renderer, outputMaterial, this.renderToScreen ? null : readBuffer ); - - renderer.setClearColor( this._oldClearColor, this.oldClearAlpha ); - renderer.autoClear = oldAutoClear; - - } - - renderPass( renderer, passMaterial, renderTarget, clearColor, clearAlpha ) { - - // save original state - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - - // setup pass state - renderer.autoClear = false; - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.fsQuad.material = passMaterial; - this.fsQuad.render( renderer ); - - // restore original state - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - renderOverride( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) { - - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - renderer.autoClear = false; - - clearColor = overrideMaterial.clearColor || clearColor; - clearAlpha = overrideMaterial.clearAlpha || clearAlpha; - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.scene.overrideMaterial = overrideMaterial; - renderer.render( this.scene, this.camera ); - this.scene.overrideMaterial = null; - - // restore original state - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - setSize( width, height ) { - - this.saoRenderTarget.setSize( width, height ); - this.blurIntermediateRenderTarget.setSize( width, height ); - this.normalRenderTarget.setSize( width, height ); - - this.saoMaterial.uniforms[ 'size' ].value.set( width, height ); - this.saoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - this.saoMaterial.uniforms[ 'cameraProjectionMatrix' ].value = this.camera.projectionMatrix; - this.saoMaterial.needsUpdate = true; - - this.vBlurMaterial.uniforms[ 'size' ].value.set( width, height ); - this.vBlurMaterial.needsUpdate = true; - - this.hBlurMaterial.uniforms[ 'size' ].value.set( width, height ); - this.hBlurMaterial.needsUpdate = true; - - } - - dispose() { - - this.saoRenderTarget.dispose(); - this.blurIntermediateRenderTarget.dispose(); - this.normalRenderTarget.dispose(); - - this.normalMaterial.dispose(); - this.saoMaterial.dispose(); - this.vBlurMaterial.dispose(); - this.hBlurMaterial.dispose(); - this.materialCopy.dispose(); - - this.fsQuad.dispose(); - - } - -} - -SAOPass.OUTPUT = { - 'Default': 0, - 'SAO': 1, - 'Normal': 2 -}; - -export { SAOPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SAOShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SAOShader.js deleted file mode 100644 index 450291c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SAOShader.js +++ /dev/null @@ -1,179 +0,0 @@ -import { - Matrix4, - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * TODO - */ - -const SAOShader = { - - name: 'SAOShader', - - defines: { - 'NUM_SAMPLES': 7, - 'NUM_RINGS': 4, - 'DIFFUSE_TEXTURE': 0, - 'PERSPECTIVE_CAMERA': 1 - }, - - uniforms: { - - 'tDepth': { value: null }, - 'tDiffuse': { value: null }, - 'tNormal': { value: null }, - 'size': { value: new Vector2( 512, 512 ) }, - - 'cameraNear': { value: 1 }, - 'cameraFar': { value: 100 }, - 'cameraProjectionMatrix': { value: new Matrix4() }, - 'cameraInverseProjectionMatrix': { value: new Matrix4() }, - - 'scale': { value: 1.0 }, - 'intensity': { value: 0.1 }, - 'bias': { value: 0.5 }, - - 'minResolution': { value: 0.0 }, - 'kernelRadius': { value: 100.0 }, - 'randomSeed': { value: 0.0 } - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - }`, - - fragmentShader: /* glsl */` - #include - - varying vec2 vUv; - - #if DIFFUSE_TEXTURE == 1 - uniform sampler2D tDiffuse; - #endif - - uniform highp sampler2D tDepth; - uniform highp sampler2D tNormal; - - uniform float cameraNear; - uniform float cameraFar; - uniform mat4 cameraProjectionMatrix; - uniform mat4 cameraInverseProjectionMatrix; - - uniform float scale; - uniform float intensity; - uniform float bias; - uniform float kernelRadius; - uniform float minResolution; - uniform vec2 size; - uniform float randomSeed; - - // RGBA depth - - #include - - vec4 getDefaultColor( const in vec2 screenPosition ) { - #if DIFFUSE_TEXTURE == 1 - return texture2D( tDiffuse, vUv ); - #else - return vec4( 1.0 ); - #endif - } - - float getDepth( const in vec2 screenPosition ) { - return texture2D( tDepth, screenPosition ).x; - } - - float getViewZ( const in float depth ) { - #if PERSPECTIVE_CAMERA == 1 - return perspectiveDepthToViewZ( depth, cameraNear, cameraFar ); - #else - return orthographicDepthToViewZ( depth, cameraNear, cameraFar ); - #endif - } - - vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) { - float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3]; - vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 ); - clipPosition *= clipW; // unprojection. - - return ( cameraInverseProjectionMatrix * clipPosition ).xyz; - } - - vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) { - return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz ); - } - - float scaleDividedByCameraFar; - float minResolutionMultipliedByCameraFar; - - float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) { - vec3 viewDelta = sampleViewPosition - centerViewPosition; - float viewDistance = length( viewDelta ); - float scaledScreenDistance = scaleDividedByCameraFar * viewDistance; - - return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) ); - } - - // moving costly divides into consts - const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES ); - const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES ); - - float getAmbientOcclusion( const in vec3 centerViewPosition ) { - // precompute some variables require in getOcclusion. - scaleDividedByCameraFar = scale / cameraFar; - minResolutionMultipliedByCameraFar = minResolution * cameraFar; - vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv ); - - // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/ - float angle = rand( vUv + randomSeed ) * PI2; - vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size; - vec2 radiusStep = radius; - - float occlusionSum = 0.0; - float weightSum = 0.0; - - for( int i = 0; i < NUM_SAMPLES; i ++ ) { - vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius; - radius += radiusStep; - angle += ANGLE_STEP; - - float sampleDepth = getDepth( sampleUv ); - if( sampleDepth >= ( 1.0 - EPSILON ) ) { - continue; - } - - float sampleViewZ = getViewZ( sampleDepth ); - vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ ); - occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition ); - weightSum += 1.0; - } - - if( weightSum == 0.0 ) discard; - - return occlusionSum * ( intensity / weightSum ); - } - - void main() { - float centerDepth = getDepth( vUv ); - if( centerDepth >= ( 1.0 - EPSILON ) ) { - discard; - } - - float centerViewZ = getViewZ( centerDepth ); - vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ ); - - float ambientOcclusion = getAmbientOcclusion( viewPosition ); - - gl_FragColor = getDefaultColor( vUv ); - gl_FragColor.xyz *= 1.0 - ambientOcclusion; - }` - -}; - -export { SAOShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAPass.js deleted file mode 100644 index 26ac5f6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAPass.js +++ /dev/null @@ -1,199 +0,0 @@ -import { - HalfFloatType, - LinearFilter, - NearestFilter, - ShaderMaterial, - Texture, - UniformsUtils, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { SMAAEdgesShader } from'/static/javascript/three/examples/jsm/shaders/SMAAShader.js'; -import { SMAAWeightsShader } from'/static/javascript/three/examples/jsm/shaders/SMAAShader.js'; -import { SMAABlendShader } from'/static/javascript/three/examples/jsm/shaders/SMAAShader.js'; - -class SMAAPass extends Pass { - - constructor( width, height ) { - - super(); - - // render targets - - this.edgesRT = new WebGLRenderTarget( width, height, { - depthBuffer: false, - type: HalfFloatType - } ); - this.edgesRT.texture.name = 'SMAAPass.edges'; - - this.weightsRT = new WebGLRenderTarget( width, height, { - depthBuffer: false, - type: HalfFloatType - } ); - this.weightsRT.texture.name = 'SMAAPass.weights'; - - // textures - const scope = this; - - const areaTextureImage = new Image(); - areaTextureImage.src = this.getAreaTexture(); - areaTextureImage.onload = function () { - - // assigning data to HTMLImageElement.src is asynchronous (see #15162) - scope.areaTexture.needsUpdate = true; - - }; - - this.areaTexture = new Texture(); - this.areaTexture.name = 'SMAAPass.area'; - this.areaTexture.image = areaTextureImage; - this.areaTexture.minFilter = LinearFilter; - this.areaTexture.generateMipmaps = false; - this.areaTexture.flipY = false; - - const searchTextureImage = new Image(); - searchTextureImage.src = this.getSearchTexture(); - searchTextureImage.onload = function () { - - // assigning data to HTMLImageElement.src is asynchronous (see #15162) - scope.searchTexture.needsUpdate = true; - - }; - - this.searchTexture = new Texture(); - this.searchTexture.name = 'SMAAPass.search'; - this.searchTexture.image = searchTextureImage; - this.searchTexture.magFilter = NearestFilter; - this.searchTexture.minFilter = NearestFilter; - this.searchTexture.generateMipmaps = false; - this.searchTexture.flipY = false; - - // materials - pass 1 - - this.uniformsEdges = UniformsUtils.clone( SMAAEdgesShader.uniforms ); - - this.uniformsEdges[ 'resolution' ].value.set( 1 / width, 1 / height ); - - this.materialEdges = new ShaderMaterial( { - defines: Object.assign( {}, SMAAEdgesShader.defines ), - uniforms: this.uniformsEdges, - vertexShader: SMAAEdgesShader.vertexShader, - fragmentShader: SMAAEdgesShader.fragmentShader - } ); - - // materials - pass 2 - - this.uniformsWeights = UniformsUtils.clone( SMAAWeightsShader.uniforms ); - - this.uniformsWeights[ 'resolution' ].value.set( 1 / width, 1 / height ); - this.uniformsWeights[ 'tDiffuse' ].value = this.edgesRT.texture; - this.uniformsWeights[ 'tArea' ].value = this.areaTexture; - this.uniformsWeights[ 'tSearch' ].value = this.searchTexture; - - this.materialWeights = new ShaderMaterial( { - defines: Object.assign( {}, SMAAWeightsShader.defines ), - uniforms: this.uniformsWeights, - vertexShader: SMAAWeightsShader.vertexShader, - fragmentShader: SMAAWeightsShader.fragmentShader - } ); - - // materials - pass 3 - - this.uniformsBlend = UniformsUtils.clone( SMAABlendShader.uniforms ); - - this.uniformsBlend[ 'resolution' ].value.set( 1 / width, 1 / height ); - this.uniformsBlend[ 'tDiffuse' ].value = this.weightsRT.texture; - - this.materialBlend = new ShaderMaterial( { - uniforms: this.uniformsBlend, - vertexShader: SMAABlendShader.vertexShader, - fragmentShader: SMAABlendShader.fragmentShader - } ); - - this.fsQuad = new FullScreenQuad( null ); - - } - - render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive*/ ) { - - // pass 1 - - this.uniformsEdges[ 'tDiffuse' ].value = readBuffer.texture; - - this.fsQuad.material = this.materialEdges; - - renderer.setRenderTarget( this.edgesRT ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - // pass 2 - - this.fsQuad.material = this.materialWeights; - - renderer.setRenderTarget( this.weightsRT ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - // pass 3 - - this.uniformsBlend[ 'tColor' ].value = readBuffer.texture; - - this.fsQuad.material = this.materialBlend; - - if ( this.renderToScreen ) { - - renderer.setRenderTarget( null ); - this.fsQuad.render( renderer ); - - } else { - - renderer.setRenderTarget( writeBuffer ); - if ( this.clear ) renderer.clear(); - this.fsQuad.render( renderer ); - - } - - } - - setSize( width, height ) { - - this.edgesRT.setSize( width, height ); - this.weightsRT.setSize( width, height ); - - this.materialEdges.uniforms[ 'resolution' ].value.set( 1 / width, 1 / height ); - this.materialWeights.uniforms[ 'resolution' ].value.set( 1 / width, 1 / height ); - this.materialBlend.uniforms[ 'resolution' ].value.set( 1 / width, 1 / height ); - - } - - getAreaTexture() { - - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouh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E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII='; - - } - - getSearchTexture() { - - return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII='; - - } - - dispose() { - - this.edgesRT.dispose(); - this.weightsRT.dispose(); - - this.areaTexture.dispose(); - this.searchTexture.dispose(); - - this.materialEdges.dispose(); - this.materialWeights.dispose(); - this.materialBlend.dispose(); - - this.fsQuad.dispose(); - - } - -} - -export { SMAAPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAShader.js deleted file mode 100644 index b9a6f25..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SMAAShader.js +++ /dev/null @@ -1,466 +0,0 @@ -import { - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8 - * Preset: SMAA 1x Medium (with color edge detection) - * https://github.com/iryoku/smaa/releases/tag/v2.8 - */ - -const SMAAEdgesShader = { - - name: 'SMAAEdgesShader', - - defines: { - - 'SMAA_THRESHOLD': '0.1' - - }, - - uniforms: { - - 'tDiffuse': { value: null }, - 'resolution': { value: new Vector2( 1 / 1024, 1 / 512 ) } - - }, - - vertexShader: /* glsl */` - - uniform vec2 resolution; - - varying vec2 vUv; - varying vec4 vOffset[ 3 ]; - - void SMAAEdgeDetectionVS( vec2 texcoord ) { - vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component - vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component - vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 ); // WebGL port note: Changed sign in W component - } - - void main() { - - vUv = uv; - - SMAAEdgeDetectionVS( vUv ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - - varying vec2 vUv; - varying vec4 vOffset[ 3 ]; - - vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) { - vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD ); - - // Calculate color deltas: - vec4 delta; - vec3 C = texture2D( colorTex, texcoord ).rgb; - - vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb; - vec3 t = abs( C - Cleft ); - delta.x = max( max( t.r, t.g ), t.b ); - - vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb; - t = abs( C - Ctop ); - delta.y = max( max( t.r, t.g ), t.b ); - - // We do the usual threshold: - vec2 edges = step( threshold, delta.xy ); - - // Then discard if there is no edge: - if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 ) - discard; - - // Calculate right and bottom deltas: - vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb; - t = abs( C - Cright ); - delta.z = max( max( t.r, t.g ), t.b ); - - vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb; - t = abs( C - Cbottom ); - delta.w = max( max( t.r, t.g ), t.b ); - - // Calculate the maximum delta in the direct neighborhood: - float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w ); - - // Calculate left-left and top-top deltas: - vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb; - t = abs( C - Cleftleft ); - delta.z = max( max( t.r, t.g ), t.b ); - - vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb; - t = abs( C - Ctoptop ); - delta.w = max( max( t.r, t.g ), t.b ); - - // Calculate the final maximum delta: - maxDelta = max( max( maxDelta, delta.z ), delta.w ); - - // Local contrast adaptation in action: - edges.xy *= step( 0.5 * maxDelta, delta.xy ); - - return vec4( edges, 0.0, 0.0 ); - } - - void main() { - - gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse ); - - }` - -}; - -const SMAAWeightsShader = { - - name: 'SMAAWeightsShader', - - defines: { - - 'SMAA_MAX_SEARCH_STEPS': '8', - 'SMAA_AREATEX_MAX_DISTANCE': '16', - 'SMAA_AREATEX_PIXEL_SIZE': '( 1.0 / vec2( 160.0, 560.0 ) )', - 'SMAA_AREATEX_SUBTEX_SIZE': '( 1.0 / 7.0 )' - - }, - - uniforms: { - - 'tDiffuse': { value: null }, - 'tArea': { value: null }, - 'tSearch': { value: null }, - 'resolution': { value: new Vector2( 1 / 1024, 1 / 512 ) } - - }, - - vertexShader: /* glsl */` - - uniform vec2 resolution; - - varying vec2 vUv; - varying vec4 vOffset[ 3 ]; - varying vec2 vPixcoord; - - void SMAABlendingWeightCalculationVS( vec2 texcoord ) { - vPixcoord = texcoord / resolution; - - // We will use these offsets for the searches later on (see @PSEUDO_GATHER4): - vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 ); // WebGL port note: Changed sign in Y and W components - vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 ); // WebGL port note: Changed sign in Y and W components - - // And these for the searches, they indicate the ends of the loops: - vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS ); - - } - - void main() { - - vUv = uv; - - SMAABlendingWeightCalculationVS( vUv ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - #define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 ) - - uniform sampler2D tDiffuse; - uniform sampler2D tArea; - uniform sampler2D tSearch; - uniform vec2 resolution; - - varying vec2 vUv; - varying vec4 vOffset[3]; - varying vec2 vPixcoord; - - #if __VERSION__ == 100 - vec2 round( vec2 x ) { - return sign( x ) * floor( abs( x ) + 0.5 ); - } - #endif - - float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) { - // Not required if searchTex accesses are set to point: - // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0); - // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + - // e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE; - e.r = bias + e.r * scale; - return 255.0 * texture2D( searchTex, e, 0.0 ).r; - } - - float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) { - /** - * @PSEUDO_GATHER4 - * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to - * sample between edge, thus fetching four edges in a row. - * Sampling with different offsets in each direction allows to disambiguate - * which edges are active from the four fetched ones. - */ - vec2 e = vec2( 0.0, 1.0 ); - - for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for - e = texture2D( edgesTex, texcoord, 0.0 ).rg; - texcoord -= vec2( 2.0, 0.0 ) * resolution; - if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break; - } - - // We correct the previous (-0.25, -0.125) offset we applied: - texcoord.x += 0.25 * resolution.x; - - // The searches are bias by 1, so adjust the coords accordingly: - texcoord.x += resolution.x; - - // Disambiguate the length added by the last step: - texcoord.x += 2.0 * resolution.x; // Undo last step - texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5); - - return texcoord.x; - } - - float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) { - vec2 e = vec2( 0.0, 1.0 ); - - for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for - e = texture2D( edgesTex, texcoord, 0.0 ).rg; - texcoord += vec2( 2.0, 0.0 ) * resolution; - if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break; - } - - texcoord.x -= 0.25 * resolution.x; - texcoord.x -= resolution.x; - texcoord.x -= 2.0 * resolution.x; - texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 ); - - return texcoord.x; - } - - float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) { - vec2 e = vec2( 1.0, 0.0 ); - - for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for - e = texture2D( edgesTex, texcoord, 0.0 ).rg; - texcoord += vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign - if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break; - } - - texcoord.y -= 0.25 * resolution.y; // WebGL port note: Changed sign - texcoord.y -= resolution.y; // WebGL port note: Changed sign - texcoord.y -= 2.0 * resolution.y; // WebGL port note: Changed sign - texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 ); // WebGL port note: Changed sign - - return texcoord.y; - } - - float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) { - vec2 e = vec2( 1.0, 0.0 ); - - for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for - e = texture2D( edgesTex, texcoord, 0.0 ).rg; - texcoord -= vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign - if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break; - } - - texcoord.y += 0.25 * resolution.y; // WebGL port note: Changed sign - texcoord.y += resolution.y; // WebGL port note: Changed sign - texcoord.y += 2.0 * resolution.y; // WebGL port note: Changed sign - texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 ); // WebGL port note: Changed sign - - return texcoord.y; - } - - vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) { - // Rounding prevents precision errors of bilinear filtering: - vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist; - - // We do a scale and bias for mapping to texel space: - texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE ); - - // Move to proper place, according to the subpixel offset: - texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset; - - return texture2D( areaTex, texcoord, 0.0 ).rg; - } - - vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) { - vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 ); - - vec2 e = texture2D( edgesTex, texcoord ).rg; - - if ( e.g > 0.0 ) { // Edge at north - vec2 d; - - // Find the distance to the left: - vec2 coords; - coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x ); - coords.y = offset[ 1 ].y; // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET) - d.x = coords.x; - - // Now fetch the left crossing edges, two at a time using bilinear - // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to - // discern what value each edge has: - float e1 = texture2D( edgesTex, coords, 0.0 ).r; - - // Find the distance to the right: - coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y ); - d.y = coords.x; - - // We want the distances to be in pixel units (doing this here allow to - // better interleave arithmetic and memory accesses): - d = d / resolution.x - pixcoord.x; - - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - vec2 sqrt_d = sqrt( abs( d ) ); - - // Fetch the right crossing edges: - coords.y -= 1.0 * resolution.y; // WebGL port note: Added - float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r; - - // Ok, we know how this pattern looks like, now it is time for getting - // the actual area: - weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) ); - } - - if ( e.r > 0.0 ) { // Edge at west - vec2 d; - - // Find the distance to the top: - vec2 coords; - - coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z ); - coords.x = offset[ 0 ].x; // offset[1].x = texcoord.x - 0.25 * resolution.x; - d.x = coords.y; - - // Fetch the top crossing edges: - float e1 = texture2D( edgesTex, coords, 0.0 ).g; - - // Find the distance to the bottom: - coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w ); - d.y = coords.y; - - // We want the distances to be in pixel units: - d = d / resolution.y - pixcoord.y; - - // SMAAArea below needs a sqrt, as the areas texture is compressed - // quadratically: - vec2 sqrt_d = sqrt( abs( d ) ); - - // Fetch the bottom crossing edges: - coords.y -= 1.0 * resolution.y; // WebGL port note: Added - float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g; - - // Get the area for this direction: - weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) ); - } - - return weights; - } - - void main() { - - gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) ); - - }` - -}; - -const SMAABlendShader = { - - name: 'SMAABlendShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'tColor': { value: null }, - 'resolution': { value: new Vector2( 1 / 1024, 1 / 512 ) } - - }, - - vertexShader: /* glsl */` - - uniform vec2 resolution; - - varying vec2 vUv; - varying vec4 vOffset[ 2 ]; - - void SMAANeighborhoodBlendingVS( vec2 texcoord ) { - vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component - vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component - } - - void main() { - - vUv = uv; - - SMAANeighborhoodBlendingVS( vUv ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform sampler2D tColor; - uniform vec2 resolution; - - varying vec2 vUv; - varying vec4 vOffset[ 2 ]; - - vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) { - // Fetch the blending weights for current pixel: - vec4 a; - a.xz = texture2D( blendTex, texcoord ).xz; - a.y = texture2D( blendTex, offset[ 1 ].zw ).g; - a.w = texture2D( blendTex, offset[ 1 ].xy ).a; - - // Is there any blending weight with a value greater than 0.0? - if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) { - return texture2D( colorTex, texcoord, 0.0 ); - } else { - // Up to 4 lines can be crossing a pixel (one through each edge). We - // favor blending by choosing the line with the maximum weight for each - // direction: - vec2 offset; - offset.x = a.a > a.b ? a.a : -a.b; // left vs. right - offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs - - // Then we go in the direction that has the maximum weight: - if ( abs( offset.x ) > abs( offset.y )) { // horizontal vs. vertical - offset.y = 0.0; - } else { - offset.x = 0.0; - } - - // Fetch the opposite color and lerp by hand: - vec4 C = texture2D( colorTex, texcoord, 0.0 ); - texcoord += sign( offset ) * resolution; - vec4 Cop = texture2D( colorTex, texcoord, 0.0 ); - float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y ); - - // WebGL port note: Added gamma correction - C.xyz = pow(C.xyz, vec3(2.2)); - Cop.xyz = pow(Cop.xyz, vec3(2.2)); - vec4 mixed = mix(C, Cop, s); - mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2)); - - return mixed; - } - } - - void main() { - - gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse ); - - }` - -}; - -export { SMAAEdgesShader, SMAAWeightsShader, SMAABlendShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAARenderPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SSAARenderPass.js deleted file mode 100644 index 880573e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAARenderPass.js +++ /dev/null @@ -1,228 +0,0 @@ -import { - AdditiveBlending, - Color, - HalfFloatType, - ShaderMaterial, - UniformsUtils, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { CopyShader } from'/static/javascript/three/examples/jsm/shaders/CopyShader.js'; - -/** -* -* Supersample Anti-Aliasing Render Pass -* -* This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results. -* -* References: https://en.wikipedia.org/wiki/Supersampling -* -*/ - -class SSAARenderPass extends Pass { - - constructor( scene, camera, clearColor, clearAlpha ) { - - super(); - - this.scene = scene; - this.camera = camera; - - this.sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. - this.unbiased = true; - - // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black. - this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; - this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; - this._oldClearColor = new Color(); - - const copyShader = CopyShader; - this.copyUniforms = UniformsUtils.clone( copyShader.uniforms ); - - this.copyMaterial = new ShaderMaterial( { - uniforms: this.copyUniforms, - vertexShader: copyShader.vertexShader, - fragmentShader: copyShader.fragmentShader, - transparent: true, - depthTest: false, - depthWrite: false, - premultipliedAlpha: true, - blending: AdditiveBlending - } ); - - this.fsQuad = new FullScreenQuad( this.copyMaterial ); - - } - - dispose() { - - if ( this.sampleRenderTarget ) { - - this.sampleRenderTarget.dispose(); - this.sampleRenderTarget = null; - - } - - this.copyMaterial.dispose(); - - this.fsQuad.dispose(); - - } - - setSize( width, height ) { - - if ( this.sampleRenderTarget ) this.sampleRenderTarget.setSize( width, height ); - - } - - render( renderer, writeBuffer, readBuffer ) { - - if ( ! this.sampleRenderTarget ) { - - this.sampleRenderTarget = new WebGLRenderTarget( readBuffer.width, readBuffer.height, { type: HalfFloatType } ); - this.sampleRenderTarget.texture.name = 'SSAARenderPass.sample'; - - } - - const jitterOffsets = _JitterVectors[ Math.max( 0, Math.min( this.sampleLevel, 5 ) ) ]; - - const autoClear = renderer.autoClear; - renderer.autoClear = false; - - renderer.getClearColor( this._oldClearColor ); - const oldClearAlpha = renderer.getClearAlpha(); - - const baseSampleWeight = 1.0 / jitterOffsets.length; - const roundingRange = 1 / 32; - this.copyUniforms[ 'tDiffuse' ].value = this.sampleRenderTarget.texture; - - const viewOffset = { - - fullWidth: readBuffer.width, - fullHeight: readBuffer.height, - offsetX: 0, - offsetY: 0, - width: readBuffer.width, - height: readBuffer.height - - }; - - const originalViewOffset = Object.assign( {}, this.camera.view ); - - if ( originalViewOffset.enabled ) Object.assign( viewOffset, originalViewOffset ); - - // render the scene multiple times, each slightly jitter offset from the last and accumulate the results. - for ( let i = 0; i < jitterOffsets.length; i ++ ) { - - const jitterOffset = jitterOffsets[ i ]; - - if ( this.camera.setViewOffset ) { - - this.camera.setViewOffset( - - viewOffset.fullWidth, viewOffset.fullHeight, - - viewOffset.offsetX + jitterOffset[ 0 ] * 0.0625, viewOffset.offsetY + jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16 - - viewOffset.width, viewOffset.height - - ); - - } - - let sampleWeight = baseSampleWeight; - - if ( this.unbiased ) { - - // the theory is that equal weights for each sample lead to an accumulation of rounding errors. - // The following equation varies the sampleWeight per sample so that it is uniformly distributed - // across a range of values whose rounding errors cancel each other out. - - const uniformCenteredDistribution = ( - 0.5 + ( i + 0.5 ) / jitterOffsets.length ); - sampleWeight += roundingRange * uniformCenteredDistribution; - - } - - this.copyUniforms[ 'opacity' ].value = sampleWeight; - renderer.setClearColor( this.clearColor, this.clearAlpha ); - renderer.setRenderTarget( this.sampleRenderTarget ); - renderer.clear(); - renderer.render( this.scene, this.camera ); - - renderer.setRenderTarget( this.renderToScreen ? null : writeBuffer ); - - if ( i === 0 ) { - - renderer.setClearColor( 0x000000, 0.0 ); - renderer.clear(); - - } - - this.fsQuad.render( renderer ); - - } - - if ( this.camera.setViewOffset && originalViewOffset.enabled ) { - - this.camera.setViewOffset( - - originalViewOffset.fullWidth, originalViewOffset.fullHeight, - - originalViewOffset.offsetX, originalViewOffset.offsetY, - - originalViewOffset.width, originalViewOffset.height - - ); - - } else if ( this.camera.clearViewOffset ) { - - this.camera.clearViewOffset(); - - } - - renderer.autoClear = autoClear; - renderer.setClearColor( this._oldClearColor, oldClearAlpha ); - - } - -} - - -// These jitter vectors are specified in integers because it is easier. -// I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5) -// before being used, thus these integers need to be scaled by 1/16. -// -// Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 -const _JitterVectors = [ - [ - [ 0, 0 ] - ], - [ - [ 4, 4 ], [ - 4, - 4 ] - ], - [ - [ - 2, - 6 ], [ 6, - 2 ], [ - 6, 2 ], [ 2, 6 ] - ], - [ - [ 1, - 3 ], [ - 1, 3 ], [ 5, 1 ], [ - 3, - 5 ], - [ - 5, 5 ], [ - 7, - 1 ], [ 3, 7 ], [ 7, - 7 ] - ], - [ - [ 1, 1 ], [ - 1, - 3 ], [ - 3, 2 ], [ 4, - 1 ], - [ - 5, - 2 ], [ 2, 5 ], [ 5, 3 ], [ 3, - 5 ], - [ - 2, 6 ], [ 0, - 7 ], [ - 4, - 6 ], [ - 6, 4 ], - [ - 8, 0 ], [ 7, - 4 ], [ 6, 7 ], [ - 7, - 8 ] - ], - [ - [ - 4, - 7 ], [ - 7, - 5 ], [ - 3, - 5 ], [ - 5, - 4 ], - [ - 1, - 4 ], [ - 2, - 2 ], [ - 6, - 1 ], [ - 4, 0 ], - [ - 7, 1 ], [ - 1, 2 ], [ - 6, 3 ], [ - 3, 3 ], - [ - 7, 6 ], [ - 3, 6 ], [ - 5, 7 ], [ - 1, 7 ], - [ 5, - 7 ], [ 1, - 6 ], [ 6, - 5 ], [ 4, - 4 ], - [ 2, - 3 ], [ 7, - 2 ], [ 1, - 1 ], [ 4, - 1 ], - [ 2, 1 ], [ 6, 2 ], [ 0, 4 ], [ 4, 4 ], - [ 2, 5 ], [ 7, 5 ], [ 5, 6 ], [ 3, 7 ] - ] -]; - -export { SSAARenderPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOPass.js deleted file mode 100644 index ce6244d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOPass.js +++ /dev/null @@ -1,414 +0,0 @@ -import { - AddEquation, - Color, - CustomBlending, - DataTexture, - DepthTexture, - DstAlphaFactor, - DstColorFactor, - FloatType, - HalfFloatType, - MathUtils, - MeshNormalMaterial, - NearestFilter, - NoBlending, - RedFormat, - DepthStencilFormat, - UnsignedInt248Type, - RepeatWrapping, - ShaderMaterial, - UniformsUtils, - Vector3, - WebGLRenderTarget, - ZeroFactor -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { SimplexNoise } from '../math/SimplexNoise.js'; -import { SSAOShader } from'/static/javascript/three/examples/jsm/shaders/SSAOShader.js'; -import { SSAOBlurShader } from'/static/javascript/three/examples/jsm/shaders/SSAOShader.js'; -import { SSAODepthShader } from'/static/javascript/three/examples/jsm/shaders/SSAOShader.js'; -import { CopyShader } from'/static/javascript/three/examples/jsm/shaders/CopyShader.js'; - -class SSAOPass extends Pass { - - constructor( scene, camera, width, height, kernelSize = 32 ) { - - super(); - - this.width = ( width !== undefined ) ? width : 512; - this.height = ( height !== undefined ) ? height : 512; - - this.clear = true; - this.needsSwap = false; - - this.camera = camera; - this.scene = scene; - - this.kernelRadius = 8; - this.kernel = []; - this.noiseTexture = null; - this.output = 0; - - this.minDistance = 0.005; - this.maxDistance = 0.1; - - this._visibilityCache = new Map(); - - // - - this.generateSampleKernel( kernelSize ); - this.generateRandomKernelRotations(); - - // depth texture - - const depthTexture = new DepthTexture(); - depthTexture.format = DepthStencilFormat; - depthTexture.type = UnsignedInt248Type; - - // normal render target with depth buffer - - this.normalRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - depthTexture: depthTexture - } ); - - // ssao render target - - this.ssaoRenderTarget = new WebGLRenderTarget( this.width, this.height, { type: HalfFloatType } ); - - this.blurRenderTarget = this.ssaoRenderTarget.clone(); - - // ssao material - - this.ssaoMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSAOShader.defines ), - uniforms: UniformsUtils.clone( SSAOShader.uniforms ), - vertexShader: SSAOShader.vertexShader, - fragmentShader: SSAOShader.fragmentShader, - blending: NoBlending - } ); - - this.ssaoMaterial.defines[ 'KERNEL_SIZE' ] = kernelSize; - - this.ssaoMaterial.uniforms[ 'tNormal' ].value = this.normalRenderTarget.texture; - this.ssaoMaterial.uniforms[ 'tDepth' ].value = this.normalRenderTarget.depthTexture; - this.ssaoMaterial.uniforms[ 'tNoise' ].value = this.noiseTexture; - this.ssaoMaterial.uniforms[ 'kernel' ].value = this.kernel; - this.ssaoMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.ssaoMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - this.ssaoMaterial.uniforms[ 'resolution' ].value.set( this.width, this.height ); - this.ssaoMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix ); - this.ssaoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - - // normal material - - this.normalMaterial = new MeshNormalMaterial(); - this.normalMaterial.blending = NoBlending; - - // blur material - - this.blurMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSAOBlurShader.defines ), - uniforms: UniformsUtils.clone( SSAOBlurShader.uniforms ), - vertexShader: SSAOBlurShader.vertexShader, - fragmentShader: SSAOBlurShader.fragmentShader - } ); - this.blurMaterial.uniforms[ 'tDiffuse' ].value = this.ssaoRenderTarget.texture; - this.blurMaterial.uniforms[ 'resolution' ].value.set( this.width, this.height ); - - // material for rendering the depth - - this.depthRenderMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSAODepthShader.defines ), - uniforms: UniformsUtils.clone( SSAODepthShader.uniforms ), - vertexShader: SSAODepthShader.vertexShader, - fragmentShader: SSAODepthShader.fragmentShader, - blending: NoBlending - } ); - this.depthRenderMaterial.uniforms[ 'tDepth' ].value = this.normalRenderTarget.depthTexture; - this.depthRenderMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.depthRenderMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - - // material for rendering the content of a render target - - this.copyMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( CopyShader.uniforms ), - vertexShader: CopyShader.vertexShader, - fragmentShader: CopyShader.fragmentShader, - transparent: true, - depthTest: false, - depthWrite: false, - blendSrc: DstColorFactor, - blendDst: ZeroFactor, - blendEquation: AddEquation, - blendSrcAlpha: DstAlphaFactor, - blendDstAlpha: ZeroFactor, - blendEquationAlpha: AddEquation - } ); - - this.fsQuad = new FullScreenQuad( null ); - - this.originalClearColor = new Color(); - - } - - dispose() { - - // dispose render targets - - this.normalRenderTarget.dispose(); - this.ssaoRenderTarget.dispose(); - this.blurRenderTarget.dispose(); - - // dispose materials - - this.normalMaterial.dispose(); - this.blurMaterial.dispose(); - this.copyMaterial.dispose(); - this.depthRenderMaterial.dispose(); - - // dipsose full screen quad - - this.fsQuad.dispose(); - - } - - render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { - - // render normals and depth (honor only meshes, points and lines do not contribute to SSAO) - - this.overrideVisibility(); - this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 ); - this.restoreVisibility(); - - // render SSAO - - this.ssaoMaterial.uniforms[ 'kernelRadius' ].value = this.kernelRadius; - this.ssaoMaterial.uniforms[ 'minDistance' ].value = this.minDistance; - this.ssaoMaterial.uniforms[ 'maxDistance' ].value = this.maxDistance; - this.renderPass( renderer, this.ssaoMaterial, this.ssaoRenderTarget ); - - // render blur - - this.renderPass( renderer, this.blurMaterial, this.blurRenderTarget ); - - // output result to screen - - switch ( this.output ) { - - case SSAOPass.OUTPUT.SSAO: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssaoRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer ); - - break; - - case SSAOPass.OUTPUT.Blur: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer ); - - break; - - case SSAOPass.OUTPUT.Depth: - - this.renderPass( renderer, this.depthRenderMaterial, this.renderToScreen ? null : readBuffer ); - - break; - - case SSAOPass.OUTPUT.Normal: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.normalRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer ); - - break; - - case SSAOPass.OUTPUT.Default: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget.texture; - this.copyMaterial.blending = CustomBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : readBuffer ); - - break; - - default: - console.warn( 'THREE.SSAOPass: Unknown output type.' ); - - } - - } - - renderPass( renderer, passMaterial, renderTarget, clearColor, clearAlpha ) { - - // save original state - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - - // setup pass state - renderer.autoClear = false; - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.fsQuad.material = passMaterial; - this.fsQuad.render( renderer ); - - // restore original state - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - renderOverride( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) { - - renderer.getClearColor( this.originalClearColor ); - const originalClearAlpha = renderer.getClearAlpha(); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - renderer.autoClear = false; - - clearColor = overrideMaterial.clearColor || clearColor; - clearAlpha = overrideMaterial.clearAlpha || clearAlpha; - - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.scene.overrideMaterial = overrideMaterial; - renderer.render( this.scene, this.camera ); - this.scene.overrideMaterial = null; - - // restore original state - - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - setSize( width, height ) { - - this.width = width; - this.height = height; - - this.ssaoRenderTarget.setSize( width, height ); - this.normalRenderTarget.setSize( width, height ); - this.blurRenderTarget.setSize( width, height ); - - this.ssaoMaterial.uniforms[ 'resolution' ].value.set( width, height ); - this.ssaoMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix ); - this.ssaoMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - - this.blurMaterial.uniforms[ 'resolution' ].value.set( width, height ); - - } - - generateSampleKernel( kernelSize ) { - - const kernel = this.kernel; - - for ( let i = 0; i < kernelSize; i ++ ) { - - const sample = new Vector3(); - sample.x = ( Math.random() * 2 ) - 1; - sample.y = ( Math.random() * 2 ) - 1; - sample.z = Math.random(); - - sample.normalize(); - - let scale = i / kernelSize; - scale = MathUtils.lerp( 0.1, 1, scale * scale ); - sample.multiplyScalar( scale ); - - kernel.push( sample ); - - } - - } - - generateRandomKernelRotations() { - - const width = 4, height = 4; - - const simplex = new SimplexNoise(); - - const size = width * height; - const data = new Float32Array( size ); - - for ( let i = 0; i < size; i ++ ) { - - const x = ( Math.random() * 2 ) - 1; - const y = ( Math.random() * 2 ) - 1; - const z = 0; - - data[ i ] = simplex.noise3d( x, y, z ); - - } - - this.noiseTexture = new DataTexture( data, width, height, RedFormat, FloatType ); - this.noiseTexture.wrapS = RepeatWrapping; - this.noiseTexture.wrapT = RepeatWrapping; - this.noiseTexture.needsUpdate = true; - - } - - overrideVisibility() { - - const scene = this.scene; - const cache = this._visibilityCache; - - scene.traverse( function ( object ) { - - cache.set( object, object.visible ); - - if ( object.isPoints || object.isLine ) object.visible = false; - - } ); - - } - - restoreVisibility() { - - const scene = this.scene; - const cache = this._visibilityCache; - - scene.traverse( function ( object ) { - - const visible = cache.get( object ); - object.visible = visible; - - } ); - - cache.clear(); - - } - -} - -SSAOPass.OUTPUT = { - 'Default': 0, - 'SSAO': 1, - 'Blur': 2, - 'Depth': 3, - 'Normal': 4 -}; - -export { SSAOPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOShader.js deleted file mode 100644 index ac32c66..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SSAOShader.js +++ /dev/null @@ -1,300 +0,0 @@ -import { - Matrix4, - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -/** - * References: - * http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html - * https://learnopengl.com/Advanced-Lighting/SSAO - * https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl - */ - -const SSAOShader = { - - name: 'SSAOShader', - - defines: { - 'PERSPECTIVE_CAMERA': 1, - 'KERNEL_SIZE': 32 - }, - - uniforms: { - - 'tNormal': { value: null }, - 'tDepth': { value: null }, - 'tNoise': { value: null }, - 'kernel': { value: null }, - 'cameraNear': { value: null }, - 'cameraFar': { value: null }, - 'resolution': { value: new Vector2() }, - 'cameraProjectionMatrix': { value: new Matrix4() }, - 'cameraInverseProjectionMatrix': { value: new Matrix4() }, - 'kernelRadius': { value: 8 }, - 'minDistance': { value: 0.005 }, - 'maxDistance': { value: 0.05 }, - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - uniform highp sampler2D tNormal; - uniform highp sampler2D tDepth; - uniform sampler2D tNoise; - - uniform vec3 kernel[ KERNEL_SIZE ]; - - uniform vec2 resolution; - - uniform float cameraNear; - uniform float cameraFar; - uniform mat4 cameraProjectionMatrix; - uniform mat4 cameraInverseProjectionMatrix; - - uniform float kernelRadius; - uniform float minDistance; // avoid artifacts caused by neighbour fragments with minimal depth difference - uniform float maxDistance; // avoid the influence of fragments which are too far away - - varying vec2 vUv; - - #include - - float getDepth( const in vec2 screenPosition ) { - - return texture2D( tDepth, screenPosition ).x; - - } - - float getLinearDepth( const in vec2 screenPosition ) { - - #if PERSPECTIVE_CAMERA == 1 - - float fragCoordZ = texture2D( tDepth, screenPosition ).x; - float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); - return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); - - #else - - return texture2D( tDepth, screenPosition ).x; - - #endif - - } - - float getViewZ( const in float depth ) { - - #if PERSPECTIVE_CAMERA == 1 - - return perspectiveDepthToViewZ( depth, cameraNear, cameraFar ); - - #else - - return orthographicDepthToViewZ( depth, cameraNear, cameraFar ); - - #endif - - } - - vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) { - - float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3]; - - vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 ); - - clipPosition *= clipW; // unprojection. - - return ( cameraInverseProjectionMatrix * clipPosition ).xyz; - - } - - vec3 getViewNormal( const in vec2 screenPosition ) { - - return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz ); - - } - - void main() { - - float depth = getDepth( vUv ); - - if ( depth == 1.0 ) { - - gl_FragColor = vec4( 1.0 ); // don't influence background - - } else { - - float viewZ = getViewZ( depth ); - - vec3 viewPosition = getViewPosition( vUv, depth, viewZ ); - vec3 viewNormal = getViewNormal( vUv ); - - vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 ); - vec3 random = vec3( texture2D( tNoise, vUv * noiseScale ).r ); - - // compute matrix used to reorient a kernel vector - - vec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) ); - vec3 bitangent = cross( viewNormal, tangent ); - mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal ); - - float occlusion = 0.0; - - for ( int i = 0; i < KERNEL_SIZE; i ++ ) { - - vec3 sampleVector = kernelMatrix * kernel[ i ]; // reorient sample vector in view space - vec3 samplePoint = viewPosition + ( sampleVector * kernelRadius ); // calculate sample point - - vec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 ); // project point and calculate NDC - samplePointNDC /= samplePointNDC.w; - - vec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5; // compute uv coordinates - - float realDepth = getLinearDepth( samplePointUv ); // get linear depth from depth texture - float sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar ); // compute linear depth of the sample view Z value - float delta = sampleDepth - realDepth; - - if ( delta > minDistance && delta < maxDistance ) { // if fragment is before sample point, increase occlusion - - occlusion += 1.0; - - } - - } - - occlusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 ); - - gl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 ); - - } - - }` - -}; - -const SSAODepthShader = { - - name: 'SSAODepthShader', - - defines: { - 'PERSPECTIVE_CAMERA': 1 - }, - - uniforms: { - - 'tDepth': { value: null }, - 'cameraNear': { value: null }, - 'cameraFar': { value: null }, - - }, - - vertexShader: - - `varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: - - `uniform sampler2D tDepth; - - uniform float cameraNear; - uniform float cameraFar; - - varying vec2 vUv; - - #include - - float getLinearDepth( const in vec2 screenPosition ) { - - #if PERSPECTIVE_CAMERA == 1 - - float fragCoordZ = texture2D( tDepth, screenPosition ).x; - float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); - return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); - - #else - - return texture2D( tDepth, screenPosition ).x; - - #endif - - } - - void main() { - - float depth = getLinearDepth( vUv ); - gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 ); - - }` - -}; - -const SSAOBlurShader = { - - name: 'SSAOBlurShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'resolution': { value: new Vector2() } - - }, - - vertexShader: - - `varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: - - `uniform sampler2D tDiffuse; - - uniform vec2 resolution; - - varying vec2 vUv; - - void main() { - - vec2 texelSize = ( 1.0 / resolution ); - float result = 0.0; - - for ( int i = - 2; i <= 2; i ++ ) { - - for ( int j = - 2; j <= 2; j ++ ) { - - vec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize; - result += texture2D( tDiffuse, vUv + offset ).r; - - } - - } - - gl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 ); - - }` - -}; - -export { SSAOShader, SSAODepthShader, SSAOBlurShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SSRPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SSRPass.js deleted file mode 100644 index 12dc3a7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SSRPass.js +++ /dev/null @@ -1,641 +0,0 @@ -import { - AddEquation, - Color, - NormalBlending, - DepthTexture, - SrcAlphaFactor, - OneMinusSrcAlphaFactor, - MeshNormalMaterial, - MeshBasicMaterial, - NearestFilter, - NoBlending, - ShaderMaterial, - UniformsUtils, - UnsignedShortType, - WebGLRenderTarget, - HalfFloatType, -} from '/static/javascript/three/build/three.module.js'; -import { Pass, FullScreenQuad } from'/static/javascript/three/examples/jsm/postprocessing/Pass.js'; -import { SSRShader } from'/static/javascript/three/examples/jsm/shaders/SSRShader.js'; -import { SSRBlurShader } from'/static/javascript/three/examples/jsm/shaders/SSRShader.js'; -import { SSRDepthShader } from'/static/javascript/three/examples/jsm/shaders/SSRShader.js'; -import { CopyShader } from'/static/javascript/three/examples/jsm/shaders/CopyShader.js'; - -class SSRPass extends Pass { - - constructor( { renderer, scene, camera, width, height, selects, bouncing = false, groundReflector } ) { - - super(); - - this.width = ( width !== undefined ) ? width : 512; - this.height = ( height !== undefined ) ? height : 512; - - this.clear = true; - - this.renderer = renderer; - this.scene = scene; - this.camera = camera; - this.groundReflector = groundReflector; - - this.opacity = SSRShader.uniforms.opacity.value; - this.output = 0; - - this.maxDistance = SSRShader.uniforms.maxDistance.value; - this.thickness = SSRShader.uniforms.thickness.value; - - this.tempColor = new Color(); - - this._selects = selects; - this.selective = Array.isArray( this._selects ); - Object.defineProperty( this, 'selects', { - get() { - - return this._selects; - - }, - set( val ) { - - if ( this._selects === val ) return; - this._selects = val; - if ( Array.isArray( val ) ) { - - this.selective = true; - this.ssrMaterial.defines.SELECTIVE = true; - this.ssrMaterial.needsUpdate = true; - - } else { - - this.selective = false; - this.ssrMaterial.defines.SELECTIVE = false; - this.ssrMaterial.needsUpdate = true; - - } - - } - } ); - - this._bouncing = bouncing; - Object.defineProperty( this, 'bouncing', { - get() { - - return this._bouncing; - - }, - set( val ) { - - if ( this._bouncing === val ) return; - this._bouncing = val; - if ( val ) { - - this.ssrMaterial.uniforms[ 'tDiffuse' ].value = this.prevRenderTarget.texture; - - } else { - - this.ssrMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - - } - - } - } ); - - this.blur = true; - - this._distanceAttenuation = SSRShader.defines.DISTANCE_ATTENUATION; - Object.defineProperty( this, 'distanceAttenuation', { - get() { - - return this._distanceAttenuation; - - }, - set( val ) { - - if ( this._distanceAttenuation === val ) return; - this._distanceAttenuation = val; - this.ssrMaterial.defines.DISTANCE_ATTENUATION = val; - this.ssrMaterial.needsUpdate = true; - - } - } ); - - - this._fresnel = SSRShader.defines.FRESNEL; - Object.defineProperty( this, 'fresnel', { - get() { - - return this._fresnel; - - }, - set( val ) { - - if ( this._fresnel === val ) return; - this._fresnel = val; - this.ssrMaterial.defines.FRESNEL = val; - this.ssrMaterial.needsUpdate = true; - - } - } ); - - this._infiniteThick = SSRShader.defines.INFINITE_THICK; - Object.defineProperty( this, 'infiniteThick', { - get() { - - return this._infiniteThick; - - }, - set( val ) { - - if ( this._infiniteThick === val ) return; - this._infiniteThick = val; - this.ssrMaterial.defines.INFINITE_THICK = val; - this.ssrMaterial.needsUpdate = true; - - } - } ); - - // beauty render target with depth buffer - - const depthTexture = new DepthTexture(); - depthTexture.type = UnsignedShortType; - depthTexture.minFilter = NearestFilter; - depthTexture.magFilter = NearestFilter; - - this.beautyRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - depthTexture: depthTexture, - depthBuffer: true - } ); - - //for bouncing - this.prevRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter - } ); - - // normal render target - - this.normalRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - } ); - - // metalness render target - - this.metalnessRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter, - type: HalfFloatType, - } ); - - - - // ssr render target - - this.ssrRenderTarget = new WebGLRenderTarget( this.width, this.height, { - minFilter: NearestFilter, - magFilter: NearestFilter - } ); - - this.blurRenderTarget = this.ssrRenderTarget.clone(); - this.blurRenderTarget2 = this.ssrRenderTarget.clone(); - // this.blurRenderTarget3 = this.ssrRenderTarget.clone(); - - // ssr material - - this.ssrMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSRShader.defines, { - MAX_STEP: Math.sqrt( this.width * this.width + this.height * this.height ) - } ), - uniforms: UniformsUtils.clone( SSRShader.uniforms ), - vertexShader: SSRShader.vertexShader, - fragmentShader: SSRShader.fragmentShader, - blending: NoBlending - } ); - - this.ssrMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - this.ssrMaterial.uniforms[ 'tNormal' ].value = this.normalRenderTarget.texture; - this.ssrMaterial.defines.SELECTIVE = this.selective; - this.ssrMaterial.needsUpdate = true; - this.ssrMaterial.uniforms[ 'tMetalness' ].value = this.metalnessRenderTarget.texture; - this.ssrMaterial.uniforms[ 'tDepth' ].value = this.beautyRenderTarget.depthTexture; - this.ssrMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.ssrMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - this.ssrMaterial.uniforms[ 'thickness' ].value = this.thickness; - this.ssrMaterial.uniforms[ 'resolution' ].value.set( this.width, this.height ); - this.ssrMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix ); - this.ssrMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - - // normal material - - this.normalMaterial = new MeshNormalMaterial(); - this.normalMaterial.blending = NoBlending; - - // metalnessOn material - - this.metalnessOnMaterial = new MeshBasicMaterial( { - color: 'white' - } ); - - // metalnessOff material - - this.metalnessOffMaterial = new MeshBasicMaterial( { - color: 'black' - } ); - - // blur material - - this.blurMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSRBlurShader.defines ), - uniforms: UniformsUtils.clone( SSRBlurShader.uniforms ), - vertexShader: SSRBlurShader.vertexShader, - fragmentShader: SSRBlurShader.fragmentShader - } ); - this.blurMaterial.uniforms[ 'tDiffuse' ].value = this.ssrRenderTarget.texture; - this.blurMaterial.uniforms[ 'resolution' ].value.set( this.width, this.height ); - - // blur material 2 - - this.blurMaterial2 = new ShaderMaterial( { - defines: Object.assign( {}, SSRBlurShader.defines ), - uniforms: UniformsUtils.clone( SSRBlurShader.uniforms ), - vertexShader: SSRBlurShader.vertexShader, - fragmentShader: SSRBlurShader.fragmentShader - } ); - this.blurMaterial2.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget.texture; - this.blurMaterial2.uniforms[ 'resolution' ].value.set( this.width, this.height ); - - // // blur material 3 - - // this.blurMaterial3 = new ShaderMaterial({ - // defines: Object.assign({}, SSRBlurShader.defines), - // uniforms: UniformsUtils.clone(SSRBlurShader.uniforms), - // vertexShader: SSRBlurShader.vertexShader, - // fragmentShader: SSRBlurShader.fragmentShader - // }); - // this.blurMaterial3.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture; - // this.blurMaterial3.uniforms['resolution'].value.set(this.width, this.height); - - // material for rendering the depth - - this.depthRenderMaterial = new ShaderMaterial( { - defines: Object.assign( {}, SSRDepthShader.defines ), - uniforms: UniformsUtils.clone( SSRDepthShader.uniforms ), - vertexShader: SSRDepthShader.vertexShader, - fragmentShader: SSRDepthShader.fragmentShader, - blending: NoBlending - } ); - this.depthRenderMaterial.uniforms[ 'tDepth' ].value = this.beautyRenderTarget.depthTexture; - this.depthRenderMaterial.uniforms[ 'cameraNear' ].value = this.camera.near; - this.depthRenderMaterial.uniforms[ 'cameraFar' ].value = this.camera.far; - - // material for rendering the content of a render target - - this.copyMaterial = new ShaderMaterial( { - uniforms: UniformsUtils.clone( CopyShader.uniforms ), - vertexShader: CopyShader.vertexShader, - fragmentShader: CopyShader.fragmentShader, - transparent: true, - depthTest: false, - depthWrite: false, - blendSrc: SrcAlphaFactor, - blendDst: OneMinusSrcAlphaFactor, - blendEquation: AddEquation, - blendSrcAlpha: SrcAlphaFactor, - blendDstAlpha: OneMinusSrcAlphaFactor, - blendEquationAlpha: AddEquation, - // premultipliedAlpha:true, - } ); - - this.fsQuad = new FullScreenQuad( null ); - - this.originalClearColor = new Color(); - - } - - dispose() { - - // dispose render targets - - this.beautyRenderTarget.dispose(); - this.prevRenderTarget.dispose(); - this.normalRenderTarget.dispose(); - this.metalnessRenderTarget.dispose(); - this.ssrRenderTarget.dispose(); - this.blurRenderTarget.dispose(); - this.blurRenderTarget2.dispose(); - // this.blurRenderTarget3.dispose(); - - // dispose materials - - this.normalMaterial.dispose(); - this.metalnessOnMaterial.dispose(); - this.metalnessOffMaterial.dispose(); - this.blurMaterial.dispose(); - this.blurMaterial2.dispose(); - this.copyMaterial.dispose(); - this.depthRenderMaterial.dispose(); - - // dipsose full screen quad - - this.fsQuad.dispose(); - - } - - render( renderer, writeBuffer /*, readBuffer, deltaTime, maskActive */ ) { - - // render beauty and depth - - renderer.setRenderTarget( this.beautyRenderTarget ); - renderer.clear(); - if ( this.groundReflector ) { - - this.groundReflector.visible = false; - this.groundReflector.doRender( this.renderer, this.scene, this.camera ); - this.groundReflector.visible = true; - - } - - renderer.render( this.scene, this.camera ); - if ( this.groundReflector ) this.groundReflector.visible = false; - - // render normals - - this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0, 0 ); - - // render metalnesses - - if ( this.selective ) { - - this.renderMetalness( renderer, this.metalnessOnMaterial, this.metalnessRenderTarget, 0, 0 ); - - } - - // render SSR - - this.ssrMaterial.uniforms[ 'opacity' ].value = this.opacity; - this.ssrMaterial.uniforms[ 'maxDistance' ].value = this.maxDistance; - this.ssrMaterial.uniforms[ 'thickness' ].value = this.thickness; - this.renderPass( renderer, this.ssrMaterial, this.ssrRenderTarget ); - - - // render blur - - if ( this.blur ) { - - this.renderPass( renderer, this.blurMaterial, this.blurRenderTarget ); - this.renderPass( renderer, this.blurMaterial2, this.blurRenderTarget2 ); - // this.renderPass(renderer, this.blurMaterial3, this.blurRenderTarget3); - - } - - // output result to screen - - switch ( this.output ) { - - case SSRPass.OUTPUT.Default: - - if ( this.bouncing ) { - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.prevRenderTarget ); - - if ( this.blur ) - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget2.texture; - else - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrRenderTarget.texture; - this.copyMaterial.blending = NormalBlending; - this.renderPass( renderer, this.copyMaterial, this.prevRenderTarget ); - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.prevRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - } else { - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - if ( this.blur ) - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget2.texture; - else - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrRenderTarget.texture; - this.copyMaterial.blending = NormalBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - } - - break; - case SSRPass.OUTPUT.SSR: - - if ( this.blur ) - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget2.texture; - else - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - if ( this.bouncing ) { - - if ( this.blur ) - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget2.texture; - else - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.prevRenderTarget ); - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.ssrRenderTarget.texture; - this.copyMaterial.blending = NormalBlending; - this.renderPass( renderer, this.copyMaterial, this.prevRenderTarget ); - - } - - break; - - case SSRPass.OUTPUT.Beauty: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.beautyRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case SSRPass.OUTPUT.Depth: - - this.renderPass( renderer, this.depthRenderMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case SSRPass.OUTPUT.Normal: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.normalRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - case SSRPass.OUTPUT.Metalness: - - this.copyMaterial.uniforms[ 'tDiffuse' ].value = this.metalnessRenderTarget.texture; - this.copyMaterial.blending = NoBlending; - this.renderPass( renderer, this.copyMaterial, this.renderToScreen ? null : writeBuffer ); - - break; - - default: - console.warn( 'THREE.SSRPass: Unknown output type.' ); - - } - - } - - renderPass( renderer, passMaterial, renderTarget, clearColor, clearAlpha ) { - - // save original state - this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) ); - const originalClearAlpha = renderer.getClearAlpha( this.tempColor ); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - - // setup pass state - renderer.autoClear = false; - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.fsQuad.material = passMaterial; - this.fsQuad.render( renderer ); - - // restore original state - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - renderOverride( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) { - - this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) ); - const originalClearAlpha = renderer.getClearAlpha( this.tempColor ); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - renderer.autoClear = false; - - clearColor = overrideMaterial.clearColor || clearColor; - clearAlpha = overrideMaterial.clearAlpha || clearAlpha; - - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.scene.overrideMaterial = overrideMaterial; - renderer.render( this.scene, this.camera ); - this.scene.overrideMaterial = null; - - // restore original state - - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - renderMetalness( renderer, overrideMaterial, renderTarget, clearColor, clearAlpha ) { - - this.originalClearColor.copy( renderer.getClearColor( this.tempColor ) ); - const originalClearAlpha = renderer.getClearAlpha( this.tempColor ); - const originalAutoClear = renderer.autoClear; - - renderer.setRenderTarget( renderTarget ); - renderer.autoClear = false; - - clearColor = overrideMaterial.clearColor || clearColor; - clearAlpha = overrideMaterial.clearAlpha || clearAlpha; - - if ( ( clearColor !== undefined ) && ( clearColor !== null ) ) { - - renderer.setClearColor( clearColor ); - renderer.setClearAlpha( clearAlpha || 0.0 ); - renderer.clear(); - - } - - this.scene.traverseVisible( child => { - - child._SSRPassBackupMaterial = child.material; - if ( this._selects.includes( child ) ) { - - child.material = this.metalnessOnMaterial; - - } else { - - child.material = this.metalnessOffMaterial; - - } - - } ); - renderer.render( this.scene, this.camera ); - this.scene.traverseVisible( child => { - - child.material = child._SSRPassBackupMaterial; - - } ); - - // restore original state - - renderer.autoClear = originalAutoClear; - renderer.setClearColor( this.originalClearColor ); - renderer.setClearAlpha( originalClearAlpha ); - - } - - setSize( width, height ) { - - this.width = width; - this.height = height; - - this.ssrMaterial.defines.MAX_STEP = Math.sqrt( width * width + height * height ); - this.ssrMaterial.needsUpdate = true; - this.beautyRenderTarget.setSize( width, height ); - this.prevRenderTarget.setSize( width, height ); - this.ssrRenderTarget.setSize( width, height ); - this.normalRenderTarget.setSize( width, height ); - this.metalnessRenderTarget.setSize( width, height ); - this.blurRenderTarget.setSize( width, height ); - this.blurRenderTarget2.setSize( width, height ); - // this.blurRenderTarget3.setSize(width, height); - - this.ssrMaterial.uniforms[ 'resolution' ].value.set( width, height ); - this.ssrMaterial.uniforms[ 'cameraProjectionMatrix' ].value.copy( this.camera.projectionMatrix ); - this.ssrMaterial.uniforms[ 'cameraInverseProjectionMatrix' ].value.copy( this.camera.projectionMatrixInverse ); - - this.blurMaterial.uniforms[ 'resolution' ].value.set( width, height ); - this.blurMaterial2.uniforms[ 'resolution' ].value.set( width, height ); - - } - -} - -SSRPass.OUTPUT = { - 'Default': 0, - 'SSR': 1, - 'Beauty': 3, - 'Depth': 4, - 'Normal': 5, - 'Metalness': 7, -}; - -export { SSRPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SSRShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SSRShader.js deleted file mode 100644 index 8c68967..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SSRShader.js +++ /dev/null @@ -1,370 +0,0 @@ -import { - Matrix4, - Vector2 -} from '/static/javascript/three/build/three.module.js'; -/** - * References: - * https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html - */ - -const SSRShader = { - - name: 'SSRShader', - - defines: { - MAX_STEP: 0, - PERSPECTIVE_CAMERA: true, - DISTANCE_ATTENUATION: true, - FRESNEL: true, - INFINITE_THICK: false, - SELECTIVE: false, - }, - - uniforms: { - - 'tDiffuse': { value: null }, - 'tNormal': { value: null }, - 'tMetalness': { value: null }, - 'tDepth': { value: null }, - 'cameraNear': { value: null }, - 'cameraFar': { value: null }, - 'resolution': { value: new Vector2() }, - 'cameraProjectionMatrix': { value: new Matrix4() }, - 'cameraInverseProjectionMatrix': { value: new Matrix4() }, - 'opacity': { value: .5 }, - 'maxDistance': { value: 180 }, - 'cameraRange': { value: 0 }, - 'thickness': { value: .018 } - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - - `, - - fragmentShader: /* glsl */` - // precision highp float; - precision highp sampler2D; - varying vec2 vUv; - uniform sampler2D tDepth; - uniform sampler2D tNormal; - uniform sampler2D tMetalness; - uniform sampler2D tDiffuse; - uniform float cameraRange; - uniform vec2 resolution; - uniform float opacity; - uniform float cameraNear; - uniform float cameraFar; - uniform float maxDistance; - uniform float thickness; - uniform mat4 cameraProjectionMatrix; - uniform mat4 cameraInverseProjectionMatrix; - #include - float pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) { - //x0: point, x1: linePointA, x2: linePointB - //https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html - return length(cross(x0-x1,x0-x2))/length(x2-x1); - } - float pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){ - // https://mathworld.wolfram.com/Point-PlaneDistance.html - //// https://en.wikipedia.org/wiki/Plane_(geometry) - //// http://paulbourke.net/geometry/pointlineplane/ - float a=planeNormal.x,b=planeNormal.y,c=planeNormal.z; - float x0=point.x,y0=point.y,z0=point.z; - float x=planePoint.x,y=planePoint.y,z=planePoint.z; - float d=-(a*x+b*y+c*z); - float distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c); - return distance; - } - float getDepth( const in vec2 uv ) { - return texture2D( tDepth, uv ).x; - } - float getViewZ( const in float depth ) { - #ifdef PERSPECTIVE_CAMERA - return perspectiveDepthToViewZ( depth, cameraNear, cameraFar ); - #else - return orthographicDepthToViewZ( depth, cameraNear, cameraFar ); - #endif - } - vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) { - vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc - clipPosition *= clipW; //clip - return ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view - } - vec3 getViewNormal( const in vec2 uv ) { - return unpackRGBToNormal( texture2D( tNormal, uv ).xyz ); - } - vec2 viewPositionToXY(vec3 viewPosition){ - vec2 xy; - vec4 clip=cameraProjectionMatrix*vec4(viewPosition,1); - xy=clip.xy;//clip - float clipW=clip.w; - xy/=clipW;//NDC - xy=(xy+1.)/2.;//uv - xy*=resolution;//screen - return xy; - } - void main(){ - #ifdef SELECTIVE - float metalness=texture2D(tMetalness,vUv).r; - if(metalness==0.) return; - #endif - - float depth = getDepth( vUv ); - float viewZ = getViewZ( depth ); - if(-viewZ>=cameraFar) return; - - float clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3]; - vec3 viewPosition=getViewPosition( vUv, depth, clipW ); - - vec2 d0=gl_FragCoord.xy; - vec2 d1; - - vec3 viewNormal=getViewNormal( vUv ); - - #ifdef PERSPECTIVE_CAMERA - vec3 viewIncidentDir=normalize(viewPosition); - vec3 viewReflectDir=reflect(viewIncidentDir,viewNormal); - #else - vec3 viewIncidentDir=vec3(0,0,-1); - vec3 viewReflectDir=reflect(viewIncidentDir,viewNormal); - #endif - - float maxReflectRayLen=maxDistance/dot(-viewIncidentDir,viewNormal); - // dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html - // if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta) - // maxDistance/maxReflectRayLen=cos(theta) - // maxDistance/maxReflectRayLen==dot(a,b) - // maxReflectRayLen==maxDistance/dot(a,b) - - vec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen; - #ifdef PERSPECTIVE_CAMERA - if(d1viewPosition.z>-cameraNear){ - //https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx - float t=(-cameraNear-viewPosition.z)/viewReflectDir.z; - d1viewPosition=viewPosition+viewReflectDir*t; - } - #endif - d1=viewPositionToXY(d1viewPosition); - - float totalLen=length(d1-d0); - float xLen=d1.x-d0.x; - float yLen=d1.y-d0.y; - float totalStep=max(abs(xLen),abs(yLen)); - float xSpan=xLen/totalStep; - float ySpan=yLen/totalStep; - for(float i=0.;i=totalStep) break; - vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan); - if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break; - float s=length(xy-d0)/totalLen; - vec2 uv=xy/resolution; - - float d = getDepth(uv); - float vZ = getViewZ( d ); - if(-vZ>=cameraFar) continue; - float cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3]; - vec3 vP=getViewPosition( uv, d, cW ); - - #ifdef PERSPECTIVE_CAMERA - // https://comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf - float recipVPZ=1./viewPosition.z; - float viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ)); - #else - float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z); - #endif - - // if(viewReflectRayZ>vZ) continue; // will cause "npm run make-screenshot webgl_postprocessing_ssr" high probability hang. - // https://github.com/mrdoob/three.js/pull/21539#issuecomment-821061164 - if(viewReflectRayZ<=vZ){ - - bool hit; - #ifdef INFINITE_THICK - hit=true; - #else - float away=pointToLineDistance(vP,viewPosition,d1viewPosition); - - float minThickness; - vec2 xyNeighbor=xy; - xyNeighbor.x+=1.; - vec2 uvNeighbor=xyNeighbor/resolution; - vec3 vPNeighbor=getViewPosition(uvNeighbor,d,cW); - minThickness=vPNeighbor.x-vP.x; - minThickness*=3.; - float tk=max(minThickness,thickness); - - hit=away<=tk; - #endif - - if(hit){ - vec3 vN=getViewNormal( uv ); - if(dot(viewReflectDir,vN)>=0.) continue; - float distance=pointPlaneDistance(vP,viewPosition,viewNormal); - if(distance>maxDistance) break; - float op=opacity; - #ifdef DISTANCE_ATTENUATION - float ratio=1.-(distance/maxDistance); - float attenuation=ratio*ratio; - op=opacity*attenuation; - #endif - #ifdef FRESNEL - float fresnelCoe=(dot(viewIncidentDir,viewReflectDir)+1.)/2.; - op*=fresnelCoe; - #endif - vec4 reflectColor=texture2D(tDiffuse,uv); - gl_FragColor.xyz=reflectColor.xyz; - gl_FragColor.a=op; - break; - } - } - } - } - ` - -}; - -const SSRDepthShader = { - - name: 'SSRDepthShader', - - defines: { - 'PERSPECTIVE_CAMERA': 1 - }, - - uniforms: { - - 'tDepth': { value: null }, - 'cameraNear': { value: null }, - 'cameraFar': { value: null }, - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - - `, - - fragmentShader: /* glsl */` - - uniform sampler2D tDepth; - - uniform float cameraNear; - uniform float cameraFar; - - varying vec2 vUv; - - #include - - float getLinearDepth( const in vec2 uv ) { - - #if PERSPECTIVE_CAMERA == 1 - - float fragCoordZ = texture2D( tDepth, uv ).x; - float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); - return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); - - #else - - return texture2D( tDepth, uv ).x; - - #endif - - } - - void main() { - - float depth = getLinearDepth( vUv ); - float d = 1.0 - depth; - // d=(d-.999)*1000.; - gl_FragColor = vec4( vec3( d ), 1.0 ); - - } - - ` - -}; - -const SSRBlurShader = { - - name: 'SSRBlurShader', - - uniforms: { - - 'tDiffuse': { value: null }, - 'resolution': { value: new Vector2() }, - 'opacity': { value: .5 }, - - }, - - vertexShader: /* glsl */` - - varying vec2 vUv; - - void main() { - - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - - `, - - fragmentShader: /* glsl */` - - uniform sampler2D tDiffuse; - uniform vec2 resolution; - varying vec2 vUv; - void main() { - //reverse engineering from PhotoShop blur filter, then change coefficient - - vec2 texelSize = ( 1.0 / resolution ); - - vec4 c=texture2D(tDiffuse,vUv); - - vec2 offset; - - offset=(vec2(-1,0))*texelSize; - vec4 cl=texture2D(tDiffuse,vUv+offset); - - offset=(vec2(1,0))*texelSize; - vec4 cr=texture2D(tDiffuse,vUv+offset); - - offset=(vec2(0,-1))*texelSize; - vec4 cb=texture2D(tDiffuse,vUv+offset); - - offset=(vec2(0,1))*texelSize; - vec4 ct=texture2D(tDiffuse,vUv+offset); - - // float coeCenter=.5; - // float coeSide=.125; - float coeCenter=.2; - float coeSide=.2; - float a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide; - vec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a; - gl_FragColor=vec4(rgb,a); - - } - ` - - -}; - -export { SSRShader, SSRDepthShader, SSRBlurShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/STLLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/STLLoader.js deleted file mode 100644 index c7f5cae..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/STLLoader.js +++ /dev/null @@ -1,410 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - FileLoader, - Float32BufferAttribute, - Loader, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Description: A THREE loader for STL ASCII files, as created by Solidworks and other CAD programs. - * - * Supports both binary and ASCII encoded files, with automatic detection of type. - * - * The loader returns a non-indexed buffer geometry. - * - * Limitations: - * Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL). - * There is perhaps some question as to how valid it is to always assume little-endian-ness. - * ASCII decoding assumes file is UTF-8. - * - * Usage: - * const loader = new STLLoader(); - * loader.load( './models/stl/slotted_disk.stl', function ( geometry ) { - * scene.add( new THREE.Mesh( geometry ) ); - * }); - * - * For binary STLs geometry might contain colors for vertices. To use it: - * // use the same code to load STL as above - * if (geometry.hasColors) { - * material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true }); - * } else { .... } - * const mesh = new THREE.Mesh( geometry, material ); - * - * For ASCII STLs containing multiple solids, each solid is assigned to a different group. - * Groups can be used to assign a different color by defining an array of materials with the same length of - * geometry.groups and passing it to the Mesh constructor: - * - * const mesh = new THREE.Mesh( geometry, material ); - * - * For example: - * - * const materials = []; - * const nGeometryGroups = geometry.groups.length; - * - * const colorMap = ...; // Some logic to index colors. - * - * for (let i = 0; i < nGeometryGroups; i++) { - * - * const material = new THREE.MeshPhongMaterial({ - * color: colorMap[i], - * wireframe: false - * }); - * - * } - * - * materials.push(material); - * const mesh = new THREE.Mesh(geometry, materials); - */ - - -class STLLoader 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.setResponseType( 'arraybuffer' ); - loader.setRequestHeader( this.requestHeader ); - loader.setWithCredentials( this.withCredentials ); - - loader.load( url, function ( text ) { - - try { - - onLoad( scope.parse( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( data ) { - - function isBinary( data ) { - - const reader = new DataView( data ); - const face_size = ( 32 / 8 * 3 ) + ( ( 32 / 8 * 3 ) * 3 ) + ( 16 / 8 ); - const n_faces = reader.getUint32( 80, true ); - const expect = 80 + ( 32 / 8 ) + ( n_faces * face_size ); - - if ( expect === reader.byteLength ) { - - return true; - - } - - // An ASCII STL data must begin with 'solid ' as the first six bytes. - // However, ASCII STLs lacking the SPACE after the 'd' are known to be - // plentiful. So, check the first 5 bytes for 'solid'. - - // Several encodings, such as UTF-8, precede the text with up to 5 bytes: - // https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding - // Search for "solid" to start anywhere after those prefixes. - - // US-ASCII ordinal values for 's', 'o', 'l', 'i', 'd' - - const solid = [ 115, 111, 108, 105, 100 ]; - - for ( let off = 0; off < 5; off ++ ) { - - // If "solid" text is matched to the current offset, declare it to be an ASCII STL. - - if ( matchDataViewAt( solid, reader, off ) ) return false; - - } - - // Couldn't find "solid" text at the beginning; it is binary STL. - - return true; - - } - - function matchDataViewAt( query, reader, offset ) { - - // Check if each byte in query matches the corresponding byte from the current offset - - for ( let i = 0, il = query.length; i < il; i ++ ) { - - if ( query[ i ] !== reader.getUint8( offset + i ) ) return false; - - } - - return true; - - } - - function parseBinary( data ) { - - const reader = new DataView( data ); - const faces = reader.getUint32( 80, true ); - - let r, g, b, hasColors = false, colors; - let defaultR, defaultG, defaultB, alpha; - - // process STL header - // check for default color in header ("COLOR=rgba" sequence). - - for ( let index = 0; index < 80 - 10; index ++ ) { - - if ( ( reader.getUint32( index, false ) == 0x434F4C4F /*COLO*/ ) && - ( reader.getUint8( index + 4 ) == 0x52 /*'R'*/ ) && - ( reader.getUint8( index + 5 ) == 0x3D /*'='*/ ) ) { - - hasColors = true; - colors = new Float32Array( faces * 3 * 3 ); - - defaultR = reader.getUint8( index + 6 ) / 255; - defaultG = reader.getUint8( index + 7 ) / 255; - defaultB = reader.getUint8( index + 8 ) / 255; - alpha = reader.getUint8( index + 9 ) / 255; - - } - - } - - const dataOffset = 84; - const faceLength = 12 * 4 + 2; - - const geometry = new BufferGeometry(); - - const vertices = new Float32Array( faces * 3 * 3 ); - const normals = new Float32Array( faces * 3 * 3 ); - - const color = new Color(); - - for ( let face = 0; face < faces; face ++ ) { - - const start = dataOffset + face * faceLength; - const normalX = reader.getFloat32( start, true ); - const normalY = reader.getFloat32( start + 4, true ); - const normalZ = reader.getFloat32( start + 8, true ); - - if ( hasColors ) { - - const packedColor = reader.getUint16( start + 48, true ); - - if ( ( packedColor & 0x8000 ) === 0 ) { - - // facet has its own unique color - - r = ( packedColor & 0x1F ) / 31; - g = ( ( packedColor >> 5 ) & 0x1F ) / 31; - b = ( ( packedColor >> 10 ) & 0x1F ) / 31; - - } else { - - r = defaultR; - g = defaultG; - b = defaultB; - - } - - } - - for ( let i = 1; i <= 3; i ++ ) { - - const vertexstart = start + i * 12; - const componentIdx = ( face * 3 * 3 ) + ( ( i - 1 ) * 3 ); - - vertices[ componentIdx ] = reader.getFloat32( vertexstart, true ); - vertices[ componentIdx + 1 ] = reader.getFloat32( vertexstart + 4, true ); - vertices[ componentIdx + 2 ] = reader.getFloat32( vertexstart + 8, true ); - - normals[ componentIdx ] = normalX; - normals[ componentIdx + 1 ] = normalY; - normals[ componentIdx + 2 ] = normalZ; - - if ( hasColors ) { - - color.set( r, g, b ).convertSRGBToLinear(); - - colors[ componentIdx ] = color.r; - colors[ componentIdx + 1 ] = color.g; - colors[ componentIdx + 2 ] = color.b; - - } - - } - - } - - geometry.setAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - - if ( hasColors ) { - - geometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) ); - geometry.hasColors = true; - geometry.alpha = alpha; - - } - - return geometry; - - } - - function parseASCII( data ) { - - const geometry = new BufferGeometry(); - const patternSolid = /solid([\s\S]*?)endsolid/g; - const patternFace = /facet([\s\S]*?)endfacet/g; - const patternName = /solid\s(.+)/; - let faceCounter = 0; - - const patternFloat = /[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source; - const patternVertex = new RegExp( 'vertex' + patternFloat + patternFloat + patternFloat, 'g' ); - const patternNormal = new RegExp( 'normal' + patternFloat + patternFloat + patternFloat, 'g' ); - - const vertices = []; - const normals = []; - const groupNames = []; - - const normal = new Vector3(); - - let result; - - let groupCount = 0; - let startVertex = 0; - let endVertex = 0; - - while ( ( result = patternSolid.exec( data ) ) !== null ) { - - startVertex = endVertex; - - const solid = result[ 0 ]; - - const name = ( result = patternName.exec( solid ) ) !== null ? result[ 1 ] : ''; - groupNames.push( name ); - - while ( ( result = patternFace.exec( solid ) ) !== null ) { - - let vertexCountPerFace = 0; - let normalCountPerFace = 0; - - const text = result[ 0 ]; - - while ( ( result = patternNormal.exec( text ) ) !== null ) { - - normal.x = parseFloat( result[ 1 ] ); - normal.y = parseFloat( result[ 2 ] ); - normal.z = parseFloat( result[ 3 ] ); - normalCountPerFace ++; - - } - - while ( ( result = patternVertex.exec( text ) ) !== null ) { - - vertices.push( parseFloat( result[ 1 ] ), parseFloat( result[ 2 ] ), parseFloat( result[ 3 ] ) ); - normals.push( normal.x, normal.y, normal.z ); - vertexCountPerFace ++; - endVertex ++; - - } - - // every face have to own ONE valid normal - - if ( normalCountPerFace !== 1 ) { - - console.error( 'THREE.STLLoader: Something isn\'t right with the normal of face number ' + faceCounter ); - - } - - // each face have to own THREE valid vertices - - if ( vertexCountPerFace !== 3 ) { - - console.error( 'THREE.STLLoader: Something isn\'t right with the vertices of face number ' + faceCounter ); - - } - - faceCounter ++; - - } - - const start = startVertex; - const count = endVertex - startVertex; - - geometry.userData.groupNames = groupNames; - - geometry.addGroup( start, count, groupCount ); - groupCount ++; - - } - - geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - - return geometry; - - } - - function ensureString( buffer ) { - - if ( typeof buffer !== 'string' ) { - - return new TextDecoder().decode( buffer ); - - } - - return buffer; - - } - - function ensureBinary( buffer ) { - - if ( typeof buffer === 'string' ) { - - const array_buffer = new Uint8Array( buffer.length ); - for ( let i = 0; i < buffer.length; i ++ ) { - - array_buffer[ i ] = buffer.charCodeAt( i ) & 0xff; // implicitly assumes little-endian - - } - - return array_buffer.buffer || array_buffer; - - } else { - - return buffer; - - } - - } - - // start - - const binData = ensureBinary( data ); - - return isBinary( binData ) ? parseBinary( binData ) : parseASCII( ensureString( data ) ); - - } - -} - -export { STLLoader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/SVGLoader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/SVGLoader.js deleted file mode 100644 index e610fbe..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/SVGLoader.js +++ /dev/null @@ -1,3173 +0,0 @@ -import { - Box2, - BufferGeometry, - FileLoader, - Float32BufferAttribute, - Loader, - Matrix3, - Path, - Shape, - ShapePath, - ShapeUtils, - SRGBColorSpace, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const COLOR_SPACE_SVG = SRGBColorSpace; - -class SVGLoader extends Loader { - - constructor( manager ) { - - super( manager ); - - // Default dots per inch - this.defaultDPI = 90; - - // Accepted units: 'mm', 'cm', 'in', 'pt', 'pc', 'px' - this.defaultUnit = 'px'; - - } - - 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( text ) ); - - } catch ( e ) { - - if ( onError ) { - - onError( e ); - - } else { - - console.error( e ); - - } - - scope.manager.itemError( url ); - - } - - }, onProgress, onError ); - - } - - parse( text ) { - - const scope = this; - - function parseNode( node, style ) { - - if ( node.nodeType !== 1 ) return; - - const transform = getNodeTransform( node ); - - let isDefsNode = false; - - let path = null; - - switch ( node.nodeName ) { - - case 'svg': - style = parseStyle( node, style ); - break; - - case 'style': - parseCSSStylesheet( node ); - break; - - case 'g': - style = parseStyle( node, style ); - break; - - case 'path': - style = parseStyle( node, style ); - if ( node.hasAttribute( 'd' ) ) path = parsePathNode( node ); - break; - - case 'rect': - style = parseStyle( node, style ); - path = parseRectNode( node ); - break; - - case 'polygon': - style = parseStyle( node, style ); - path = parsePolygonNode( node ); - break; - - case 'polyline': - style = parseStyle( node, style ); - path = parsePolylineNode( node ); - break; - - case 'circle': - style = parseStyle( node, style ); - path = parseCircleNode( node ); - break; - - case 'ellipse': - style = parseStyle( node, style ); - path = parseEllipseNode( node ); - break; - - case 'line': - style = parseStyle( node, style ); - path = parseLineNode( node ); - break; - - case 'defs': - isDefsNode = true; - break; - - case 'use': - style = parseStyle( node, style ); - - const href = node.getAttributeNS( 'http://www.w3.org/1999/xlink', 'href' ) || ''; - const usedNodeId = href.substring( 1 ); - const usedNode = node.viewportElement.getElementById( usedNodeId ); - if ( usedNode ) { - - parseNode( usedNode, style ); - - } else { - - console.warn( 'SVGLoader: \'use node\' references non-existent node id: ' + usedNodeId ); - - } - - break; - - default: - // console.log( node ); - - } - - if ( path ) { - - if ( style.fill !== undefined && style.fill !== 'none' ) { - - path.color.setStyle( style.fill, COLOR_SPACE_SVG ); - - } - - transformPath( path, currentTransform ); - - paths.push( path ); - - path.userData = { node: node, style: style }; - - } - - const childNodes = node.childNodes; - - for ( let i = 0; i < childNodes.length; i ++ ) { - - const node = childNodes[ i ]; - - if ( isDefsNode && node.nodeName !== 'style' && node.nodeName !== 'defs' ) { - - // Ignore everything in defs except CSS style definitions - // and nested defs, because it is OK by the standard to have - // - -`,c=` - -`,f=` - - - - -`,p=` -
-`,l=` - -`,m=` - -`;return s+c+f+p+l+m}cr.createSyntaxDiagramsCode=Iu});var Fa=R(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.Parser=E.createSyntaxDiagramsCode=E.clearCache=E.GAstVisitor=E.serializeProduction=E.serializeGrammar=E.Terminal=E.Rule=E.RepetitionWithSeparator=E.RepetitionMandatoryWithSeparator=E.RepetitionMandatory=E.Repetition=E.Option=E.NonTerminal=E.Alternative=E.Alternation=E.defaultLexerErrorProvider=E.NoViableAltException=E.NotAllInputParsedException=E.MismatchedTokenException=E.isRecognitionException=E.EarlyExitException=E.defaultParserErrorProvider=E.tokenName=E.tokenMatcher=E.tokenLabel=E.EOF=E.createTokenInstance=E.createToken=E.LexerDefinitionErrorType=E.Lexer=E.EMPTY_ALT=E.ParserDefinitionErrorType=E.EmbeddedActionsParser=E.CstParser=E.VERSION=void 0;var ku=Er();Object.defineProperty(E,"VERSION",{enumerable:!0,get:function(){return ku.VERSION}});var lr=ce();Object.defineProperty(E,"CstParser",{enumerable:!0,get:function(){return lr.CstParser}});Object.defineProperty(E,"EmbeddedActionsParser",{enumerable:!0,get:function(){return lr.EmbeddedActionsParser}});Object.defineProperty(E,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return lr.ParserDefinitionErrorType}});Object.defineProperty(E,"EMPTY_ALT",{enumerable:!0,get:function(){return lr.EMPTY_ALT}});var Ma=ft();Object.defineProperty(E,"Lexer",{enumerable:!0,get:function(){return Ma.Lexer}});Object.defineProperty(E,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return Ma.LexerDefinitionErrorType}});var nt=Ue();Object.defineProperty(E,"createToken",{enumerable:!0,get:function(){return nt.createToken}});Object.defineProperty(E,"createTokenInstance",{enumerable:!0,get:function(){return nt.createTokenInstance}});Object.defineProperty(E,"EOF",{enumerable:!0,get:function(){return nt.EOF}});Object.defineProperty(E,"tokenLabel",{enumerable:!0,get:function(){return nt.tokenLabel}});Object.defineProperty(E,"tokenMatcher",{enumerable:!0,get:function(){return nt.tokenMatcher}});Object.defineProperty(E,"tokenName",{enumerable:!0,get:function(){return nt.tokenName}});var Pu=mt();Object.defineProperty(E,"defaultParserErrorProvider",{enumerable:!0,get:function(){return Pu.defaultParserErrorProvider}});var Nt=et();Object.defineProperty(E,"EarlyExitException",{enumerable:!0,get:function(){return Nt.EarlyExitException}});Object.defineProperty(E,"isRecognitionException",{enumerable:!0,get:function(){return Nt.isRecognitionException}});Object.defineProperty(E,"MismatchedTokenException",{enumerable:!0,get:function(){return Nt.MismatchedTokenException}});Object.defineProperty(E,"NotAllInputParsedException",{enumerable:!0,get:function(){return Nt.NotAllInputParsedException}});Object.defineProperty(E,"NoViableAltException",{enumerable:!0,get:function(){return Nt.NoViableAltException}});var Su=kr();Object.defineProperty(E,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return Su.defaultLexerErrorProvider}});var Se=ne();Object.defineProperty(E,"Alternation",{enumerable:!0,get:function(){return Se.Alternation}});Object.defineProperty(E,"Alternative",{enumerable:!0,get:function(){return Se.Alternative}});Object.defineProperty(E,"NonTerminal",{enumerable:!0,get:function(){return Se.NonTerminal}});Object.defineProperty(E,"Option",{enumerable:!0,get:function(){return Se.Option}});Object.defineProperty(E,"Repetition",{enumerable:!0,get:function(){return Se.Repetition}});Object.defineProperty(E,"RepetitionMandatory",{enumerable:!0,get:function(){return Se.RepetitionMandatory}});Object.defineProperty(E,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return Se.RepetitionMandatoryWithSeparator}});Object.defineProperty(E,"RepetitionWithSeparator",{enumerable:!0,get:function(){return Se.RepetitionWithSeparator}});Object.defineProperty(E,"Rule",{enumerable:!0,get:function(){return Se.Rule}});Object.defineProperty(E,"Terminal",{enumerable:!0,get:function(){return Se.Terminal}});var ba=ne();Object.defineProperty(E,"serializeGrammar",{enumerable:!0,get:function(){return ba.serializeGrammar}});Object.defineProperty(E,"serializeProduction",{enumerable:!0,get:function(){return ba.serializeProduction}});var xu=$e();Object.defineProperty(E,"GAstVisitor",{enumerable:!0,get:function(){return xu.GAstVisitor}});function Cu(){console.warn(`The clearCache function was 'soft' removed from the Chevrotain API. - It performs no action other than printing this message. - Please avoid using it as it will be completely removed in the future`)}E.clearCache=Cu;var Lu=La();Object.defineProperty(E,"createSyntaxDiagramsCode",{enumerable:!0,get:function(){return Lu.createSyntaxDiagramsCode}});var Mu=function(){function t(){throw new Error(`The Parser class has been deprecated, use CstParser or EmbeddedActionsParser instead. -See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_7-0-0`)}return t}();E.Parser=Mu});export default Fa(); diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/ArcballControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/ArcballControls.js deleted file mode 100644 index 82cb8b2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/ArcballControls.js +++ /dev/null @@ -1,3224 +0,0 @@ -import { - GridHelper, - EllipseCurve, - BufferGeometry, - Line, - LineBasicMaterial, - Raycaster, - Group, - Box3, - Sphere, - Quaternion, - Vector2, - Vector3, - Matrix4, - MathUtils, - EventDispatcher -} from '/static/javascript/three/build/three.module.js'; - -//trackball state -const STATE = { - - IDLE: Symbol(), - ROTATE: Symbol(), - PAN: Symbol(), - SCALE: Symbol(), - FOV: Symbol(), - FOCUS: Symbol(), - ZROTATE: Symbol(), - TOUCH_MULTI: Symbol(), - ANIMATION_FOCUS: Symbol(), - ANIMATION_ROTATE: Symbol() - -}; - -const INPUT = { - - NONE: Symbol(), - ONE_FINGER: Symbol(), - ONE_FINGER_SWITCHED: Symbol(), - TWO_FINGER: Symbol(), - MULT_FINGER: Symbol(), - CURSOR: Symbol() - -}; - -//cursor center coordinates -const _center = { - - x: 0, - y: 0 - -}; - -//transformation matrices for gizmos and camera -const _transformation = { - - camera: new Matrix4(), - gizmos: new Matrix4() - -}; - -//events -const _changeEvent = { type: 'change' }; -const _startEvent = { type: 'start' }; -const _endEvent = { type: 'end' }; - -const _raycaster = new Raycaster(); -const _offset = new Vector3(); - -const _gizmoMatrixStateTemp = new Matrix4(); -const _cameraMatrixStateTemp = new Matrix4(); -const _scalePointTemp = new Vector3(); -/** - * - * @param {Camera} camera Virtual camera used in the scene - * @param {HTMLElement} domElement Renderer's dom element - * @param {Scene} scene The scene to be rendered - */ -class ArcballControls extends EventDispatcher { - - constructor( camera, domElement, scene = null ) { - - super(); - this.camera = null; - this.domElement = domElement; - this.scene = scene; - this.target = new Vector3(); - this._currentTarget = new Vector3(); - this.radiusFactor = 0.67; - - this.mouseActions = []; - this._mouseOp = null; - - - //global vectors and matrices that are used in some operations to avoid creating new objects every time (e.g. every time cursor moves) - this._v2_1 = new Vector2(); - this._v3_1 = new Vector3(); - this._v3_2 = new Vector3(); - - this._m4_1 = new Matrix4(); - this._m4_2 = new Matrix4(); - - this._quat = new Quaternion(); - - //transformation matrices - this._translationMatrix = new Matrix4(); //matrix for translation operation - this._rotationMatrix = new Matrix4(); //matrix for rotation operation - this._scaleMatrix = new Matrix4(); //matrix for scaling operation - - this._rotationAxis = new Vector3(); //axis for rotate operation - - - //camera state - this._cameraMatrixState = new Matrix4(); - this._cameraProjectionState = new Matrix4(); - - this._fovState = 1; - this._upState = new Vector3(); - this._zoomState = 1; - this._nearPos = 0; - this._farPos = 0; - - this._gizmoMatrixState = new Matrix4(); - - //initial values - this._up0 = new Vector3(); - this._zoom0 = 1; - this._fov0 = 0; - this._initialNear = 0; - this._nearPos0 = 0; - this._initialFar = 0; - this._farPos0 = 0; - this._cameraMatrixState0 = new Matrix4(); - this._gizmoMatrixState0 = new Matrix4(); - - //pointers array - this._button = - 1; - this._touchStart = []; - this._touchCurrent = []; - this._input = INPUT.NONE; - - //two fingers touch interaction - this._switchSensibility = 32; //minimum movement to be performed to fire single pan start after the second finger has been released - this._startFingerDistance = 0; //distance between two fingers - this._currentFingerDistance = 0; - this._startFingerRotation = 0; //amount of rotation performed with two fingers - this._currentFingerRotation = 0; - - //double tap - this._devPxRatio = 0; - this._downValid = true; - this._nclicks = 0; - this._downEvents = []; - this._downStart = 0; //pointerDown time - this._clickStart = 0; //first click time - this._maxDownTime = 250; - this._maxInterval = 300; - this._posThreshold = 24; - this._movementThreshold = 24; - - //cursor positions - this._currentCursorPosition = new Vector3(); - this._startCursorPosition = new Vector3(); - - //grid - this._grid = null; //grid to be visualized during pan operation - this._gridPosition = new Vector3(); - - //gizmos - this._gizmos = new Group(); - this._curvePts = 128; - - - //animations - this._timeStart = - 1; //initial time - this._animationId = - 1; - - //focus animation - this.focusAnimationTime = 500; //duration of focus animation in ms - - //rotate animation - this._timePrev = 0; //time at which previous rotate operation has been detected - this._timeCurrent = 0; //time at which current rotate operation has been detected - this._anglePrev = 0; //angle of previous rotation - this._angleCurrent = 0; //angle of current rotation - this._cursorPosPrev = new Vector3(); //cursor position when previous rotate operation has been detected - this._cursorPosCurr = new Vector3();//cursor position when current rotate operation has been detected - this._wPrev = 0; //angular velocity of the previous rotate operation - this._wCurr = 0; //angular velocity of the current rotate operation - - - //parameters - this.adjustNearFar = false; - this.scaleFactor = 1.1; //zoom/distance multiplier - this.dampingFactor = 25; - this.wMax = 20; //maximum angular velocity allowed - this.enableAnimations = true; //if animations should be performed - this.enableGrid = false; //if grid should be showed during pan operation - this.cursorZoom = false; //if wheel zoom should be cursor centered - this.minFov = 5; - this.maxFov = 90; - this.rotateSpeed = 1; - - this.enabled = true; - this.enablePan = true; - this.enableRotate = true; - this.enableZoom = true; - this.enableGizmos = true; - - this.minDistance = 0; - this.maxDistance = Infinity; - this.minZoom = 0; - this.maxZoom = Infinity; - - //trackball parameters - this._tbRadius = 1; - - //FSA - this._state = STATE.IDLE; - - this.setCamera( camera ); - - if ( this.scene != null ) { - - this.scene.add( this._gizmos ); - - } - - this.domElement.style.touchAction = 'none'; - this._devPxRatio = window.devicePixelRatio; - - this.initializeMouseActions(); - - this._onContextMenu = onContextMenu.bind( this ); - this._onWheel = onWheel.bind( this ); - this._onPointerUp = onPointerUp.bind( this ); - this._onPointerMove = onPointerMove.bind( this ); - this._onPointerDown = onPointerDown.bind( this ); - this._onPointerCancel = onPointerCancel.bind( this ); - this._onWindowResize = onWindowResize.bind( this ); - - this.domElement.addEventListener( 'contextmenu', this._onContextMenu ); - this.domElement.addEventListener( 'wheel', this._onWheel ); - this.domElement.addEventListener( 'pointerdown', this._onPointerDown ); - this.domElement.addEventListener( 'pointercancel', this._onPointerCancel ); - - window.addEventListener( 'resize', this._onWindowResize ); - - } - - onSinglePanStart( event, operation ) { - - if ( this.enabled ) { - - this.dispatchEvent( _startEvent ); - - this.setCenter( event.clientX, event.clientY ); - - switch ( operation ) { - - case 'PAN': - - if ( ! this.enablePan ) { - - return; - - } - - if ( this._animationId != - 1 ) { - - cancelAnimationFrame( this._animationId ); - this._animationId = - 1; - this._timeStart = - 1; - - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - this.updateTbState( STATE.PAN, true ); - this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) ); - if ( this.enableGrid ) { - - this.drawGrid(); - this.dispatchEvent( _changeEvent ); - - } - - break; - - case 'ROTATE': - - if ( ! this.enableRotate ) { - - return; - - } - - if ( this._animationId != - 1 ) { - - cancelAnimationFrame( this._animationId ); - this._animationId = - 1; - this._timeStart = - 1; - - } - - this.updateTbState( STATE.ROTATE, true ); - this._startCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) ); - this.activateGizmos( true ); - if ( this.enableAnimations ) { - - this._timePrev = this._timeCurrent = performance.now(); - this._angleCurrent = this._anglePrev = 0; - this._cursorPosPrev.copy( this._startCursorPosition ); - this._cursorPosCurr.copy( this._cursorPosPrev ); - this._wCurr = 0; - this._wPrev = this._wCurr; - - } - - this.dispatchEvent( _changeEvent ); - break; - - case 'FOV': - - if ( ! this.camera.isPerspectiveCamera || ! this.enableZoom ) { - - return; - - } - - if ( this._animationId != - 1 ) { - - cancelAnimationFrame( this._animationId ); - this._animationId = - 1; - this._timeStart = - 1; - - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - this.updateTbState( STATE.FOV, true ); - this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - this._currentCursorPosition.copy( this._startCursorPosition ); - break; - - case 'ZOOM': - - if ( ! this.enableZoom ) { - - return; - - } - - if ( this._animationId != - 1 ) { - - cancelAnimationFrame( this._animationId ); - this._animationId = - 1; - this._timeStart = - 1; - - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - this.updateTbState( STATE.SCALE, true ); - this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - this._currentCursorPosition.copy( this._startCursorPosition ); - break; - - } - - } - - } - - onSinglePanMove( event, opState ) { - - if ( this.enabled ) { - - const restart = opState != this._state; - this.setCenter( event.clientX, event.clientY ); - - switch ( opState ) { - - case STATE.PAN: - - if ( this.enablePan ) { - - if ( restart ) { - - //switch to pan operation - - this.dispatchEvent( _endEvent ); - this.dispatchEvent( _startEvent ); - - this.updateTbState( opState, true ); - this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) ); - if ( this.enableGrid ) { - - this.drawGrid(); - - } - - this.activateGizmos( false ); - - } else { - - //continue with pan operation - this._currentCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) ); - this.applyTransformMatrix( this.pan( this._startCursorPosition, this._currentCursorPosition ) ); - - } - - } - - break; - - case STATE.ROTATE: - - if ( this.enableRotate ) { - - if ( restart ) { - - //switch to rotate operation - - this.dispatchEvent( _endEvent ); - this.dispatchEvent( _startEvent ); - - this.updateTbState( opState, true ); - this._startCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) ); - - if ( this.enableGrid ) { - - this.disposeGrid(); - - } - - this.activateGizmos( true ); - - } else { - - //continue with rotate operation - this._currentCursorPosition.copy( this.unprojectOnTbSurface( this.camera, _center.x, _center.y, this.domElement, this._tbRadius ) ); - - const distance = this._startCursorPosition.distanceTo( this._currentCursorPosition ); - const angle = this._startCursorPosition.angleTo( this._currentCursorPosition ); - const amount = Math.max( distance / this._tbRadius, angle ) * this.rotateSpeed; //effective rotation angle - - this.applyTransformMatrix( this.rotate( this.calculateRotationAxis( this._startCursorPosition, this._currentCursorPosition ), amount ) ); - - if ( this.enableAnimations ) { - - this._timePrev = this._timeCurrent; - this._timeCurrent = performance.now(); - this._anglePrev = this._angleCurrent; - this._angleCurrent = amount; - this._cursorPosPrev.copy( this._cursorPosCurr ); - this._cursorPosCurr.copy( this._currentCursorPosition ); - this._wPrev = this._wCurr; - this._wCurr = this.calculateAngularSpeed( this._anglePrev, this._angleCurrent, this._timePrev, this._timeCurrent ); - - } - - } - - } - - break; - - case STATE.SCALE: - - if ( this.enableZoom ) { - - if ( restart ) { - - //switch to zoom operation - - this.dispatchEvent( _endEvent ); - this.dispatchEvent( _startEvent ); - - this.updateTbState( opState, true ); - this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - this._currentCursorPosition.copy( this._startCursorPosition ); - - if ( this.enableGrid ) { - - this.disposeGrid(); - - } - - this.activateGizmos( false ); - - } else { - - //continue with zoom operation - const screenNotches = 8; //how many wheel notches corresponds to a full screen pan - this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - - const movement = this._currentCursorPosition.y - this._startCursorPosition.y; - - let size = 1; - - if ( movement < 0 ) { - - size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) ); - - } else if ( movement > 0 ) { - - size = Math.pow( this.scaleFactor, movement * screenNotches ); - - } - - this._v3_1.setFromMatrixPosition( this._gizmoMatrixState ); - - this.applyTransformMatrix( this.scale( size, this._v3_1 ) ); - - } - - } - - break; - - case STATE.FOV: - - if ( this.enableZoom && this.camera.isPerspectiveCamera ) { - - if ( restart ) { - - //switch to fov operation - - this.dispatchEvent( _endEvent ); - this.dispatchEvent( _startEvent ); - - this.updateTbState( opState, true ); - this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - this._currentCursorPosition.copy( this._startCursorPosition ); - - if ( this.enableGrid ) { - - this.disposeGrid(); - - } - - this.activateGizmos( false ); - - } else { - - //continue with fov operation - const screenNotches = 8; //how many wheel notches corresponds to a full screen pan - this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - - const movement = this._currentCursorPosition.y - this._startCursorPosition.y; - - let size = 1; - - if ( movement < 0 ) { - - size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) ); - - } else if ( movement > 0 ) { - - size = Math.pow( this.scaleFactor, movement * screenNotches ); - - } - - this._v3_1.setFromMatrixPosition( this._cameraMatrixState ); - const x = this._v3_1.distanceTo( this._gizmos.position ); - let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed - - //check min and max distance - xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance ); - - const y = x * Math.tan( MathUtils.DEG2RAD * this._fovState * 0.5 ); - - //calculate new fov - let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 ); - - //check min and max fov - newFov = MathUtils.clamp( newFov, this.minFov, this.maxFov ); - - const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) ); - size = x / newDistance; - this._v3_2.setFromMatrixPosition( this._gizmoMatrixState ); - - this.setFov( newFov ); - this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); - - //adjusting distance - _offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x ); - this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z ); - - } - - } - - break; - - } - - this.dispatchEvent( _changeEvent ); - - } - - } - - onSinglePanEnd() { - - if ( this._state == STATE.ROTATE ) { - - - if ( ! this.enableRotate ) { - - return; - - } - - if ( this.enableAnimations ) { - - //perform rotation animation - const deltaTime = ( performance.now() - this._timeCurrent ); - if ( deltaTime < 120 ) { - - const w = Math.abs( ( this._wPrev + this._wCurr ) / 2 ); - - const self = this; - this._animationId = window.requestAnimationFrame( function ( t ) { - - self.updateTbState( STATE.ANIMATION_ROTATE, true ); - const rotationAxis = self.calculateRotationAxis( self._cursorPosPrev, self._cursorPosCurr ); - - self.onRotationAnim( t, rotationAxis, Math.min( w, self.wMax ) ); - - } ); - - } else { - - //cursor has been standing still for over 120 ms since last movement - this.updateTbState( STATE.IDLE, false ); - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - } else { - - this.updateTbState( STATE.IDLE, false ); - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - } else if ( this._state == STATE.PAN || this._state == STATE.IDLE ) { - - this.updateTbState( STATE.IDLE, false ); - - if ( this.enableGrid ) { - - this.disposeGrid(); - - } - - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - - } - - this.dispatchEvent( _endEvent ); - - } - - onDoubleTap( event ) { - - if ( this.enabled && this.enablePan && this.scene != null ) { - - this.dispatchEvent( _startEvent ); - - this.setCenter( event.clientX, event.clientY ); - const hitP = this.unprojectOnObj( this.getCursorNDC( _center.x, _center.y, this.domElement ), this.camera ); - - if ( hitP != null && this.enableAnimations ) { - - const self = this; - if ( this._animationId != - 1 ) { - - window.cancelAnimationFrame( this._animationId ); - - } - - this._timeStart = - 1; - this._animationId = window.requestAnimationFrame( function ( t ) { - - self.updateTbState( STATE.ANIMATION_FOCUS, true ); - self.onFocusAnim( t, hitP, self._cameraMatrixState, self._gizmoMatrixState ); - - } ); - - } else if ( hitP != null && ! this.enableAnimations ) { - - this.updateTbState( STATE.FOCUS, true ); - this.focus( hitP, this.scaleFactor ); - this.updateTbState( STATE.IDLE, false ); - this.dispatchEvent( _changeEvent ); - - } - - } - - this.dispatchEvent( _endEvent ); - - } - - onDoublePanStart() { - - if ( this.enabled && this.enablePan ) { - - this.dispatchEvent( _startEvent ); - - this.updateTbState( STATE.PAN, true ); - - this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 ); - this._startCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement, true ) ); - this._currentCursorPosition.copy( this._startCursorPosition ); - - this.activateGizmos( false ); - - } - - } - - onDoublePanMove() { - - if ( this.enabled && this.enablePan ) { - - this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 ); - - if ( this._state != STATE.PAN ) { - - this.updateTbState( STATE.PAN, true ); - this._startCursorPosition.copy( this._currentCursorPosition ); - - } - - this._currentCursorPosition.copy( this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement, true ) ); - this.applyTransformMatrix( this.pan( this._startCursorPosition, this._currentCursorPosition, true ) ); - this.dispatchEvent( _changeEvent ); - - } - - } - - onDoublePanEnd() { - - this.updateTbState( STATE.IDLE, false ); - this.dispatchEvent( _endEvent ); - - } - - onRotateStart() { - - if ( this.enabled && this.enableRotate ) { - - this.dispatchEvent( _startEvent ); - - this.updateTbState( STATE.ZROTATE, true ); - - //this._startFingerRotation = event.rotation; - - this._startFingerRotation = this.getAngle( this._touchCurrent[ 1 ], this._touchCurrent[ 0 ] ) + this.getAngle( this._touchStart[ 1 ], this._touchStart[ 0 ] ); - this._currentFingerRotation = this._startFingerRotation; - - this.camera.getWorldDirection( this._rotationAxis ); //rotation axis - - if ( ! this.enablePan && ! this.enableZoom ) { - - this.activateGizmos( true ); - - } - - } - - } - - onRotateMove() { - - if ( this.enabled && this.enableRotate ) { - - this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 ); - let rotationPoint; - - if ( this._state != STATE.ZROTATE ) { - - this.updateTbState( STATE.ZROTATE, true ); - this._startFingerRotation = this._currentFingerRotation; - - } - - //this._currentFingerRotation = event.rotation; - this._currentFingerRotation = this.getAngle( this._touchCurrent[ 1 ], this._touchCurrent[ 0 ] ) + this.getAngle( this._touchStart[ 1 ], this._touchStart[ 0 ] ); - - if ( ! this.enablePan ) { - - rotationPoint = new Vector3().setFromMatrixPosition( this._gizmoMatrixState ); - - } else { - - this._v3_2.setFromMatrixPosition( this._gizmoMatrixState ); - rotationPoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ).applyQuaternion( this.camera.quaternion ).multiplyScalar( 1 / this.camera.zoom ).add( this._v3_2 ); - - } - - const amount = MathUtils.DEG2RAD * ( this._startFingerRotation - this._currentFingerRotation ); - - this.applyTransformMatrix( this.zRotate( rotationPoint, amount ) ); - this.dispatchEvent( _changeEvent ); - - } - - } - - onRotateEnd() { - - this.updateTbState( STATE.IDLE, false ); - this.activateGizmos( false ); - this.dispatchEvent( _endEvent ); - - } - - onPinchStart() { - - if ( this.enabled && this.enableZoom ) { - - this.dispatchEvent( _startEvent ); - this.updateTbState( STATE.SCALE, true ); - - this._startFingerDistance = this.calculatePointersDistance( this._touchCurrent[ 0 ], this._touchCurrent[ 1 ] ); - this._currentFingerDistance = this._startFingerDistance; - - this.activateGizmos( false ); - - } - - } - - onPinchMove() { - - if ( this.enabled && this.enableZoom ) { - - this.setCenter( ( this._touchCurrent[ 0 ].clientX + this._touchCurrent[ 1 ].clientX ) / 2, ( this._touchCurrent[ 0 ].clientY + this._touchCurrent[ 1 ].clientY ) / 2 ); - const minDistance = 12; //minimum distance between fingers (in css pixels) - - if ( this._state != STATE.SCALE ) { - - this._startFingerDistance = this._currentFingerDistance; - this.updateTbState( STATE.SCALE, true ); - - } - - this._currentFingerDistance = Math.max( this.calculatePointersDistance( this._touchCurrent[ 0 ], this._touchCurrent[ 1 ] ), minDistance * this._devPxRatio ); - const amount = this._currentFingerDistance / this._startFingerDistance; - - let scalePoint; - - if ( ! this.enablePan ) { - - scalePoint = this._gizmos.position; - - } else { - - if ( this.camera.isOrthographicCamera ) { - - scalePoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) - .applyQuaternion( this.camera.quaternion ) - .multiplyScalar( 1 / this.camera.zoom ) - .add( this._gizmos.position ); - - } else if ( this.camera.isPerspectiveCamera ) { - - scalePoint = this.unprojectOnTbPlane( this.camera, _center.x, _center.y, this.domElement ) - .applyQuaternion( this.camera.quaternion ) - .add( this._gizmos.position ); - - } - - } - - this.applyTransformMatrix( this.scale( amount, scalePoint ) ); - this.dispatchEvent( _changeEvent ); - - } - - } - - onPinchEnd() { - - this.updateTbState( STATE.IDLE, false ); - this.dispatchEvent( _endEvent ); - - } - - onTriplePanStart() { - - if ( this.enabled && this.enableZoom ) { - - this.dispatchEvent( _startEvent ); - - this.updateTbState( STATE.SCALE, true ); - - //const center = event.center; - let clientX = 0; - let clientY = 0; - const nFingers = this._touchCurrent.length; - - for ( let i = 0; i < nFingers; i ++ ) { - - clientX += this._touchCurrent[ i ].clientX; - clientY += this._touchCurrent[ i ].clientY; - - } - - this.setCenter( clientX / nFingers, clientY / nFingers ); - - this._startCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - this._currentCursorPosition.copy( this._startCursorPosition ); - - } - - } - - onTriplePanMove() { - - if ( this.enabled && this.enableZoom ) { - - // fov / 2 - // |\ - // | \ - // | \ - // x | \ - // | \ - // | \ - // | _ _ _\ - // y - - //const center = event.center; - let clientX = 0; - let clientY = 0; - const nFingers = this._touchCurrent.length; - - for ( let i = 0; i < nFingers; i ++ ) { - - clientX += this._touchCurrent[ i ].clientX; - clientY += this._touchCurrent[ i ].clientY; - - } - - this.setCenter( clientX / nFingers, clientY / nFingers ); - - const screenNotches = 8; //how many wheel notches corresponds to a full screen pan - this._currentCursorPosition.setY( this.getCursorNDC( _center.x, _center.y, this.domElement ).y * 0.5 ); - - const movement = this._currentCursorPosition.y - this._startCursorPosition.y; - - let size = 1; - - if ( movement < 0 ) { - - size = 1 / ( Math.pow( this.scaleFactor, - movement * screenNotches ) ); - - } else if ( movement > 0 ) { - - size = Math.pow( this.scaleFactor, movement * screenNotches ); - - } - - this._v3_1.setFromMatrixPosition( this._cameraMatrixState ); - const x = this._v3_1.distanceTo( this._gizmos.position ); - let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed - - //check min and max distance - xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance ); - - const y = x * Math.tan( MathUtils.DEG2RAD * this._fovState * 0.5 ); - - //calculate new fov - let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 ); - - //check min and max fov - newFov = MathUtils.clamp( newFov, this.minFov, this.maxFov ); - - const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) ); - size = x / newDistance; - this._v3_2.setFromMatrixPosition( this._gizmoMatrixState ); - - this.setFov( newFov ); - this.applyTransformMatrix( this.scale( size, this._v3_2, false ) ); - - //adjusting distance - _offset.copy( this._gizmos.position ).sub( this.camera.position ).normalize().multiplyScalar( newDistance / x ); - this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z ); - - this.dispatchEvent( _changeEvent ); - - } - - } - - onTriplePanEnd() { - - this.updateTbState( STATE.IDLE, false ); - this.dispatchEvent( _endEvent ); - //this.dispatchEvent( _changeEvent ); - - } - - /** - * Set _center's x/y coordinates - * @param {Number} clientX - * @param {Number} clientY - */ - setCenter( clientX, clientY ) { - - _center.x = clientX; - _center.y = clientY; - - } - - /** - * Set default mouse actions - */ - initializeMouseActions() { - - this.setMouseAction( 'PAN', 0, 'CTRL' ); - this.setMouseAction( 'PAN', 2 ); - - this.setMouseAction( 'ROTATE', 0 ); - - this.setMouseAction( 'ZOOM', 'WHEEL' ); - this.setMouseAction( 'ZOOM', 1 ); - - this.setMouseAction( 'FOV', 'WHEEL', 'SHIFT' ); - this.setMouseAction( 'FOV', 1, 'SHIFT' ); - - - } - - /** - * Compare two mouse actions - * @param {Object} action1 - * @param {Object} action2 - * @returns {Boolean} True if action1 and action 2 are the same mouse action, false otherwise - */ - compareMouseAction( action1, action2 ) { - - if ( action1.operation == action2.operation ) { - - if ( action1.mouse == action2.mouse && action1.key == action2.key ) { - - return true; - - } else { - - return false; - - } - - } else { - - return false; - - } - - } - - /** - * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one - * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV) - * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches - * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed - * @returns {Boolean} True if the mouse action has been successfully added, false otherwise - */ - setMouseAction( operation, mouse, key = null ) { - - const operationInput = [ 'PAN', 'ROTATE', 'ZOOM', 'FOV' ]; - const mouseInput = [ 0, 1, 2, 'WHEEL' ]; - const keyInput = [ 'CTRL', 'SHIFT', null ]; - let state; - - if ( ! operationInput.includes( operation ) || ! mouseInput.includes( mouse ) || ! keyInput.includes( key ) ) { - - //invalid parameters - return false; - - } - - if ( mouse == 'WHEEL' ) { - - if ( operation != 'ZOOM' && operation != 'FOV' ) { - - //cannot associate 2D operation to 1D input - return false; - - } - - } - - switch ( operation ) { - - case 'PAN': - - state = STATE.PAN; - break; - - case 'ROTATE': - - state = STATE.ROTATE; - break; - - case 'ZOOM': - - state = STATE.SCALE; - break; - - case 'FOV': - - state = STATE.FOV; - break; - - } - - const action = { - - operation: operation, - mouse: mouse, - key: key, - state: state - - }; - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - if ( this.mouseActions[ i ].mouse == action.mouse && this.mouseActions[ i ].key == action.key ) { - - this.mouseActions.splice( i, 1, action ); - return true; - - } - - } - - this.mouseActions.push( action ); - return true; - - } - - /** - * Remove a mouse action by specifying its mouse/key combination - * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches - * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed - * @returns {Boolean} True if the operation has been succesfully removed, false otherwise - */ - unsetMouseAction( mouse, key = null ) { - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - if ( this.mouseActions[ i ].mouse == mouse && this.mouseActions[ i ].key == key ) { - - this.mouseActions.splice( i, 1 ); - return true; - - } - - } - - return false; - - } - - /** - * Return the operation associated to a mouse/keyboard combination - * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches - * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed - * @returns The operation if it has been found, null otherwise - */ - getOpFromAction( mouse, key ) { - - let action; - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - action = this.mouseActions[ i ]; - if ( action.mouse == mouse && action.key == key ) { - - return action.operation; - - } - - } - - if ( key != null ) { - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - action = this.mouseActions[ i ]; - if ( action.mouse == mouse && action.key == null ) { - - return action.operation; - - } - - } - - } - - return null; - - } - - /** - * Get the operation associated to mouse and key combination and returns the corresponding FSA state - * @param {Number} mouse Mouse button - * @param {String} key Keyboard modifier - * @returns The FSA state obtained from the operation associated to mouse/keyboard combination - */ - getOpStateFromAction( mouse, key ) { - - let action; - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - action = this.mouseActions[ i ]; - if ( action.mouse == mouse && action.key == key ) { - - return action.state; - - } - - } - - if ( key != null ) { - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - action = this.mouseActions[ i ]; - if ( action.mouse == mouse && action.key == null ) { - - return action.state; - - } - - } - - } - - return null; - - } - - /** - * Calculate the angle between two pointers - * @param {PointerEvent} p1 - * @param {PointerEvent} p2 - * @returns {Number} The angle between two pointers in degrees - */ - getAngle( p1, p2 ) { - - return Math.atan2( p2.clientY - p1.clientY, p2.clientX - p1.clientX ) * 180 / Math.PI; - - } - - /** - * Update a PointerEvent inside current pointerevents array - * @param {PointerEvent} event - */ - updateTouchEvent( event ) { - - for ( let i = 0; i < this._touchCurrent.length; i ++ ) { - - if ( this._touchCurrent[ i ].pointerId == event.pointerId ) { - - this._touchCurrent.splice( i, 1, event ); - break; - - } - - } - - } - - /** - * Apply a transformation matrix, to the camera and gizmos - * @param {Object} transformation Object containing matrices to apply to camera and gizmos - */ - applyTransformMatrix( transformation ) { - - if ( transformation.camera != null ) { - - this._m4_1.copy( this._cameraMatrixState ).premultiply( transformation.camera ); - this._m4_1.decompose( this.camera.position, this.camera.quaternion, this.camera.scale ); - this.camera.updateMatrix(); - - //update camera up vector - if ( this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE ) { - - this.camera.up.copy( this._upState ).applyQuaternion( this.camera.quaternion ); - - } - - } - - if ( transformation.gizmos != null ) { - - this._m4_1.copy( this._gizmoMatrixState ).premultiply( transformation.gizmos ); - this._m4_1.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - this._gizmos.updateMatrix(); - - } - - if ( this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS ) { - - this._tbRadius = this.calculateTbRadius( this.camera ); - - if ( this.adjustNearFar ) { - - const cameraDistance = this.camera.position.distanceTo( this._gizmos.position ); - - const bb = new Box3(); - bb.setFromObject( this._gizmos ); - const sphere = new Sphere(); - bb.getBoundingSphere( sphere ); - - const adjustedNearPosition = Math.max( this._nearPos0, sphere.radius + sphere.center.length() ); - const regularNearPosition = cameraDistance - this._initialNear; - - const minNearPos = Math.min( adjustedNearPosition, regularNearPosition ); - this.camera.near = cameraDistance - minNearPos; - - - const adjustedFarPosition = Math.min( this._farPos0, - sphere.radius + sphere.center.length() ); - const regularFarPosition = cameraDistance - this._initialFar; - - const minFarPos = Math.min( adjustedFarPosition, regularFarPosition ); - this.camera.far = cameraDistance - minFarPos; - - this.camera.updateProjectionMatrix(); - - } else { - - let update = false; - - if ( this.camera.near != this._initialNear ) { - - this.camera.near = this._initialNear; - update = true; - - } - - if ( this.camera.far != this._initialFar ) { - - this.camera.far = this._initialFar; - update = true; - - } - - if ( update ) { - - this.camera.updateProjectionMatrix(); - - } - - } - - } - - } - - /** - * Calculate the angular speed - * @param {Number} p0 Position at t0 - * @param {Number} p1 Position at t1 - * @param {Number} t0 Initial time in milliseconds - * @param {Number} t1 Ending time in milliseconds - */ - calculateAngularSpeed( p0, p1, t0, t1 ) { - - const s = p1 - p0; - const t = ( t1 - t0 ) / 1000; - if ( t == 0 ) { - - return 0; - - } - - return s / t; - - } - - /** - * Calculate the distance between two pointers - * @param {PointerEvent} p0 The first pointer - * @param {PointerEvent} p1 The second pointer - * @returns {number} The distance between the two pointers - */ - calculatePointersDistance( p0, p1 ) { - - return Math.sqrt( Math.pow( p1.clientX - p0.clientX, 2 ) + Math.pow( p1.clientY - p0.clientY, 2 ) ); - - } - - /** - * Calculate the rotation axis as the vector perpendicular between two vectors - * @param {Vector3} vec1 The first vector - * @param {Vector3} vec2 The second vector - * @returns {Vector3} The normalized rotation axis - */ - calculateRotationAxis( vec1, vec2 ) { - - this._rotationMatrix.extractRotation( this._cameraMatrixState ); - this._quat.setFromRotationMatrix( this._rotationMatrix ); - - this._rotationAxis.crossVectors( vec1, vec2 ).applyQuaternion( this._quat ); - return this._rotationAxis.normalize().clone(); - - } - - /** - * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum - * @param {Camera} camera - * @returns {Number} The trackball radius - */ - calculateTbRadius( camera ) { - - const distance = camera.position.distanceTo( this._gizmos.position ); - - if ( camera.type == 'PerspectiveCamera' ) { - - const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5; //vertical fov/2 in radians - const halfFovH = Math.atan( ( camera.aspect ) * Math.tan( halfFovV ) ); //horizontal fov/2 in radians - return Math.tan( Math.min( halfFovV, halfFovH ) ) * distance * this.radiusFactor; - - } else if ( camera.type == 'OrthographicCamera' ) { - - return Math.min( camera.top, camera.right ) * this.radiusFactor; - - } - - } - - /** - * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in - * @param {Vector3} point The point of interest - * @param {Number} size Scale factor - * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation) - */ - focus( point, size, amount = 1 ) { - - //move center of camera (along with gizmos) towards point of interest - _offset.copy( point ).sub( this._gizmos.position ).multiplyScalar( amount ); - this._translationMatrix.makeTranslation( _offset.x, _offset.y, _offset.z ); - - _gizmoMatrixStateTemp.copy( this._gizmoMatrixState ); - this._gizmoMatrixState.premultiply( this._translationMatrix ); - this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - - _cameraMatrixStateTemp.copy( this._cameraMatrixState ); - this._cameraMatrixState.premultiply( this._translationMatrix ); - this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale ); - - //apply zoom - if ( this.enableZoom ) { - - this.applyTransformMatrix( this.scale( size, this._gizmos.position ) ); - - } - - this._gizmoMatrixState.copy( _gizmoMatrixStateTemp ); - this._cameraMatrixState.copy( _cameraMatrixStateTemp ); - - } - - /** - * Draw a grid and add it to the scene - */ - drawGrid() { - - if ( this.scene != null ) { - - const color = 0x888888; - const multiplier = 3; - let size, divisions, maxLength, tick; - - if ( this.camera.isOrthographicCamera ) { - - const width = this.camera.right - this.camera.left; - const height = this.camera.bottom - this.camera.top; - - maxLength = Math.max( width, height ); - tick = maxLength / 20; - - size = maxLength / this.camera.zoom * multiplier; - divisions = size / tick * this.camera.zoom; - - } else if ( this.camera.isPerspectiveCamera ) { - - const distance = this.camera.position.distanceTo( this._gizmos.position ); - const halfFovV = MathUtils.DEG2RAD * this.camera.fov * 0.5; - const halfFovH = Math.atan( ( this.camera.aspect ) * Math.tan( halfFovV ) ); - - maxLength = Math.tan( Math.max( halfFovV, halfFovH ) ) * distance * 2; - tick = maxLength / 20; - - size = maxLength * multiplier; - divisions = size / tick; - - } - - if ( this._grid == null ) { - - this._grid = new GridHelper( size, divisions, color, color ); - this._grid.position.copy( this._gizmos.position ); - this._gridPosition.copy( this._grid.position ); - this._grid.quaternion.copy( this.camera.quaternion ); - this._grid.rotateX( Math.PI * 0.5 ); - - this.scene.add( this._grid ); - - } - - } - - } - - /** - * Remove all listeners, stop animations and clean scene - */ - dispose() { - - if ( this._animationId != - 1 ) { - - window.cancelAnimationFrame( this._animationId ); - - } - - this.domElement.removeEventListener( 'pointerdown', this._onPointerDown ); - this.domElement.removeEventListener( 'pointercancel', this._onPointerCancel ); - this.domElement.removeEventListener( 'wheel', this._onWheel ); - this.domElement.removeEventListener( 'contextmenu', this._onContextMenu ); - - window.removeEventListener( 'pointermove', this._onPointerMove ); - window.removeEventListener( 'pointerup', this._onPointerUp ); - - window.removeEventListener( 'resize', this._onWindowResize ); - - if ( this.scene !== null ) this.scene.remove( this._gizmos ); - this.disposeGrid(); - - } - - /** - * remove the grid from the scene - */ - disposeGrid() { - - if ( this._grid != null && this.scene != null ) { - - this.scene.remove( this._grid ); - this._grid = null; - - } - - } - - /** - * Compute the easing out cubic function for ease out effect in animation - * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation) - * @returns {Number} Result of easing out cubic at time t - */ - easeOutCubic( t ) { - - return 1 - Math.pow( 1 - t, 3 ); - - } - - /** - * Make rotation gizmos more or less visible - * @param {Boolean} isActive If true, make gizmos more visible - */ - activateGizmos( isActive ) { - - const gizmoX = this._gizmos.children[ 0 ]; - const gizmoY = this._gizmos.children[ 1 ]; - const gizmoZ = this._gizmos.children[ 2 ]; - - if ( isActive ) { - - gizmoX.material.setValues( { opacity: 1 } ); - gizmoY.material.setValues( { opacity: 1 } ); - gizmoZ.material.setValues( { opacity: 1 } ); - - } else { - - gizmoX.material.setValues( { opacity: 0.6 } ); - gizmoY.material.setValues( { opacity: 0.6 } ); - gizmoZ.material.setValues( { opacity: 0.6 } ); - - } - - } - - /** - * Calculate the cursor position in NDC - * @param {number} x Cursor horizontal coordinate within the canvas - * @param {number} y Cursor vertical coordinate within the canvas - * @param {HTMLElement} canvas The canvas where the renderer draws its output - * @returns {Vector2} Cursor normalized position inside the canvas - */ - getCursorNDC( cursorX, cursorY, canvas ) { - - const canvasRect = canvas.getBoundingClientRect(); - this._v2_1.setX( ( ( cursorX - canvasRect.left ) / canvasRect.width ) * 2 - 1 ); - this._v2_1.setY( ( ( canvasRect.bottom - cursorY ) / canvasRect.height ) * 2 - 1 ); - return this._v2_1.clone(); - - } - - /** - * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas - * @param {Number} x Cursor horizontal coordinate within the canvas - * @param {Number} y Cursor vertical coordinate within the canvas - * @param {HTMLElement} canvas The canvas where the renderer draws its output - * @returns {Vector2} Cursor position inside the canvas - */ - getCursorPosition( cursorX, cursorY, canvas ) { - - this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) ); - this._v2_1.x *= ( this.camera.right - this.camera.left ) * 0.5; - this._v2_1.y *= ( this.camera.top - this.camera.bottom ) * 0.5; - return this._v2_1.clone(); - - } - - /** - * Set the camera to be controlled - * @param {Camera} camera The virtual camera to be controlled - */ - setCamera( camera ) { - - camera.lookAt( this.target ); - camera.updateMatrix(); - - //setting state - if ( camera.type == 'PerspectiveCamera' ) { - - this._fov0 = camera.fov; - this._fovState = camera.fov; - - } - - this._cameraMatrixState0.copy( camera.matrix ); - this._cameraMatrixState.copy( this._cameraMatrixState0 ); - this._cameraProjectionState.copy( camera.projectionMatrix ); - this._zoom0 = camera.zoom; - this._zoomState = this._zoom0; - - this._initialNear = camera.near; - this._nearPos0 = camera.position.distanceTo( this.target ) - camera.near; - this._nearPos = this._initialNear; - - this._initialFar = camera.far; - this._farPos0 = camera.position.distanceTo( this.target ) - camera.far; - this._farPos = this._initialFar; - - this._up0.copy( camera.up ); - this._upState.copy( camera.up ); - - this.camera = camera; - this.camera.updateProjectionMatrix(); - - //making gizmos - this._tbRadius = this.calculateTbRadius( camera ); - this.makeGizmos( this.target, this._tbRadius ); - - } - - /** - * Set gizmos visibility - * @param {Boolean} value Value of gizmos visibility - */ - setGizmosVisible( value ) { - - this._gizmos.visible = value; - this.dispatchEvent( _changeEvent ); - - } - - /** - * Set gizmos radius factor and redraws gizmos - * @param {Float} value Value of radius factor - */ - setTbRadius( value ) { - - this.radiusFactor = value; - this._tbRadius = this.calculateTbRadius( this.camera ); - - const curve = new EllipseCurve( 0, 0, this._tbRadius, this._tbRadius ); - const points = curve.getPoints( this._curvePts ); - const curveGeometry = new BufferGeometry().setFromPoints( points ); - - - for ( const gizmo in this._gizmos.children ) { - - this._gizmos.children[ gizmo ].geometry = curveGeometry; - - } - - this.dispatchEvent( _changeEvent ); - - } - - /** - * Creates the rotation gizmos matching trackball center and radius - * @param {Vector3} tbCenter The trackball center - * @param {number} tbRadius The trackball radius - */ - makeGizmos( tbCenter, tbRadius ) { - - const curve = new EllipseCurve( 0, 0, tbRadius, tbRadius ); - const points = curve.getPoints( this._curvePts ); - - //geometry - const curveGeometry = new BufferGeometry().setFromPoints( points ); - - //material - const curveMaterialX = new LineBasicMaterial( { color: 0xff8080, fog: false, transparent: true, opacity: 0.6 } ); - const curveMaterialY = new LineBasicMaterial( { color: 0x80ff80, fog: false, transparent: true, opacity: 0.6 } ); - const curveMaterialZ = new LineBasicMaterial( { color: 0x8080ff, fog: false, transparent: true, opacity: 0.6 } ); - - //line - const gizmoX = new Line( curveGeometry, curveMaterialX ); - const gizmoY = new Line( curveGeometry, curveMaterialY ); - const gizmoZ = new Line( curveGeometry, curveMaterialZ ); - - const rotation = Math.PI * 0.5; - gizmoX.rotation.x = rotation; - gizmoY.rotation.y = rotation; - - - //setting state - this._gizmoMatrixState0.identity().setPosition( tbCenter ); - this._gizmoMatrixState.copy( this._gizmoMatrixState0 ); - - if ( this.camera.zoom !== 1 ) { - - //adapt gizmos size to camera zoom - const size = 1 / this.camera.zoom; - this._scaleMatrix.makeScale( size, size, size ); - this._translationMatrix.makeTranslation( - tbCenter.x, - tbCenter.y, - tbCenter.z ); - - this._gizmoMatrixState.premultiply( this._translationMatrix ).premultiply( this._scaleMatrix ); - this._translationMatrix.makeTranslation( tbCenter.x, tbCenter.y, tbCenter.z ); - this._gizmoMatrixState.premultiply( this._translationMatrix ); - - } - - this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - - // - - this._gizmos.traverse( function ( object ) { - - if ( object.isLine ) { - - object.geometry.dispose(); - object.material.dispose(); - - } - - } ); - - this._gizmos.clear(); - - // - - this._gizmos.add( gizmoX ); - this._gizmos.add( gizmoY ); - this._gizmos.add( gizmoZ ); - - } - - /** - * Perform animation for focus operation - * @param {Number} time Instant in which this function is called as performance.now() - * @param {Vector3} point Point of interest for focus operation - * @param {Matrix4} cameraMatrix Camera matrix - * @param {Matrix4} gizmoMatrix Gizmos matrix - */ - onFocusAnim( time, point, cameraMatrix, gizmoMatrix ) { - - if ( this._timeStart == - 1 ) { - - //animation start - this._timeStart = time; - - } - - if ( this._state == STATE.ANIMATION_FOCUS ) { - - const deltaTime = time - this._timeStart; - const animTime = deltaTime / this.focusAnimationTime; - - this._gizmoMatrixState.copy( gizmoMatrix ); - - if ( animTime >= 1 ) { - - //animation end - - this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - - this.focus( point, this.scaleFactor ); - - this._timeStart = - 1; - this.updateTbState( STATE.IDLE, false ); - this.activateGizmos( false ); - - this.dispatchEvent( _changeEvent ); - - } else { - - const amount = this.easeOutCubic( animTime ); - const size = ( ( 1 - amount ) + ( this.scaleFactor * amount ) ); - - this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - this.focus( point, size, amount ); - - this.dispatchEvent( _changeEvent ); - const self = this; - this._animationId = window.requestAnimationFrame( function ( t ) { - - self.onFocusAnim( t, point, cameraMatrix, gizmoMatrix.clone() ); - - } ); - - } - - } else { - - //interrupt animation - - this._animationId = - 1; - this._timeStart = - 1; - - } - - } - - /** - * Perform animation for rotation operation - * @param {Number} time Instant in which this function is called as performance.now() - * @param {Vector3} rotationAxis Rotation axis - * @param {number} w0 Initial angular velocity - */ - onRotationAnim( time, rotationAxis, w0 ) { - - if ( this._timeStart == - 1 ) { - - //animation start - this._anglePrev = 0; - this._angleCurrent = 0; - this._timeStart = time; - - } - - if ( this._state == STATE.ANIMATION_ROTATE ) { - - //w = w0 + alpha * t - const deltaTime = ( time - this._timeStart ) / 1000; - const w = w0 + ( ( - this.dampingFactor ) * deltaTime ); - - if ( w > 0 ) { - - //tetha = 0.5 * alpha * t^2 + w0 * t + tetha0 - this._angleCurrent = 0.5 * ( - this.dampingFactor ) * Math.pow( deltaTime, 2 ) + w0 * deltaTime + 0; - this.applyTransformMatrix( this.rotate( rotationAxis, this._angleCurrent ) ); - this.dispatchEvent( _changeEvent ); - const self = this; - this._animationId = window.requestAnimationFrame( function ( t ) { - - self.onRotationAnim( t, rotationAxis, w0 ); - - } ); - - } else { - - this._animationId = - 1; - this._timeStart = - 1; - - this.updateTbState( STATE.IDLE, false ); - this.activateGizmos( false ); - - this.dispatchEvent( _changeEvent ); - - } - - } else { - - //interrupt animation - - this._animationId = - 1; - this._timeStart = - 1; - - if ( this._state != STATE.ROTATE ) { - - this.activateGizmos( false ); - this.dispatchEvent( _changeEvent ); - - } - - } - - } - - - /** - * Perform pan operation moving camera between two points - * @param {Vector3} p0 Initial point - * @param {Vector3} p1 Ending point - * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only) - */ - pan( p0, p1, adjust = false ) { - - const movement = p0.clone().sub( p1 ); - - if ( this.camera.isOrthographicCamera ) { - - //adjust movement amount - movement.multiplyScalar( 1 / this.camera.zoom ); - - } else if ( this.camera.isPerspectiveCamera && adjust ) { - - //adjust movement amount - this._v3_1.setFromMatrixPosition( this._cameraMatrixState0 ); //camera's initial position - this._v3_2.setFromMatrixPosition( this._gizmoMatrixState0 ); //gizmo's initial position - const distanceFactor = this._v3_1.distanceTo( this._v3_2 ) / this.camera.position.distanceTo( this._gizmos.position ); - movement.multiplyScalar( 1 / distanceFactor ); - - } - - this._v3_1.set( movement.x, movement.y, 0 ).applyQuaternion( this.camera.quaternion ); - - this._m4_1.makeTranslation( this._v3_1.x, this._v3_1.y, this._v3_1.z ); - - this.setTransformationMatrices( this._m4_1, this._m4_1 ); - return _transformation; - - } - - /** - * Reset trackball - */ - reset() { - - this.camera.zoom = this._zoom0; - - if ( this.camera.isPerspectiveCamera ) { - - this.camera.fov = this._fov0; - - } - - this.camera.near = this._nearPos; - this.camera.far = this._farPos; - this._cameraMatrixState.copy( this._cameraMatrixState0 ); - this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale ); - this.camera.up.copy( this._up0 ); - - this.camera.updateMatrix(); - this.camera.updateProjectionMatrix(); - - this._gizmoMatrixState.copy( this._gizmoMatrixState0 ); - this._gizmoMatrixState0.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - this._gizmos.updateMatrix(); - - this._tbRadius = this.calculateTbRadius( this.camera ); - this.makeGizmos( this._gizmos.position, this._tbRadius ); - - this.camera.lookAt( this._gizmos.position ); - - this.updateTbState( STATE.IDLE, false ); - - this.dispatchEvent( _changeEvent ); - - } - - /** - * Rotate the camera around an axis passing by trackball's center - * @param {Vector3} axis Rotation axis - * @param {number} angle Angle in radians - * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera - */ - rotate( axis, angle ) { - - const point = this._gizmos.position; //rotation center - this._translationMatrix.makeTranslation( - point.x, - point.y, - point.z ); - this._rotationMatrix.makeRotationAxis( axis, - angle ); - - //rotate camera - this._m4_1.makeTranslation( point.x, point.y, point.z ); - this._m4_1.multiply( this._rotationMatrix ); - this._m4_1.multiply( this._translationMatrix ); - - this.setTransformationMatrices( this._m4_1 ); - - return _transformation; - - } - - copyState() { - - let state; - if ( this.camera.isOrthographicCamera ) { - - state = JSON.stringify( { arcballState: { - - cameraFar: this.camera.far, - cameraMatrix: this.camera.matrix, - cameraNear: this.camera.near, - cameraUp: this.camera.up, - cameraZoom: this.camera.zoom, - gizmoMatrix: this._gizmos.matrix - - } } ); - - } else if ( this.camera.isPerspectiveCamera ) { - - state = JSON.stringify( { arcballState: { - cameraFar: this.camera.far, - cameraFov: this.camera.fov, - cameraMatrix: this.camera.matrix, - cameraNear: this.camera.near, - cameraUp: this.camera.up, - cameraZoom: this.camera.zoom, - gizmoMatrix: this._gizmos.matrix - - } } ); - - } - - navigator.clipboard.writeText( state ); - - } - - pasteState() { - - const self = this; - navigator.clipboard.readText().then( function resolved( value ) { - - self.setStateFromJSON( value ); - - } ); - - } - - /** - * Save the current state of the control. This can later be recover with .reset - */ - saveState() { - - this._cameraMatrixState0.copy( this.camera.matrix ); - this._gizmoMatrixState0.copy( this._gizmos.matrix ); - this._nearPos = this.camera.near; - this._farPos = this.camera.far; - this._zoom0 = this.camera.zoom; - this._up0.copy( this.camera.up ); - - if ( this.camera.isPerspectiveCamera ) { - - this._fov0 = this.camera.fov; - - } - - } - - /** - * Perform uniform scale operation around a given point - * @param {Number} size Scale factor - * @param {Vector3} point Point around which scale - * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only) - * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos - */ - scale( size, point, scaleGizmos = true ) { - - _scalePointTemp.copy( point ); - let sizeInverse = 1 / size; - - if ( this.camera.isOrthographicCamera ) { - - //camera zoom - this.camera.zoom = this._zoomState; - this.camera.zoom *= size; - - //check min and max zoom - if ( this.camera.zoom > this.maxZoom ) { - - this.camera.zoom = this.maxZoom; - sizeInverse = this._zoomState / this.maxZoom; - - } else if ( this.camera.zoom < this.minZoom ) { - - this.camera.zoom = this.minZoom; - sizeInverse = this._zoomState / this.minZoom; - - } - - this.camera.updateProjectionMatrix(); - - this._v3_1.setFromMatrixPosition( this._gizmoMatrixState ); //gizmos position - - //scale gizmos so they appear in the same spot having the same dimension - this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse ); - this._translationMatrix.makeTranslation( - this._v3_1.x, - this._v3_1.y, - this._v3_1.z ); - - this._m4_2.makeTranslation( this._v3_1.x, this._v3_1.y, this._v3_1.z ).multiply( this._scaleMatrix ); - this._m4_2.multiply( this._translationMatrix ); - - - //move camera and gizmos to obtain pinch effect - _scalePointTemp.sub( this._v3_1 ); - - const amount = _scalePointTemp.clone().multiplyScalar( sizeInverse ); - _scalePointTemp.sub( amount ); - - this._m4_1.makeTranslation( _scalePointTemp.x, _scalePointTemp.y, _scalePointTemp.z ); - this._m4_2.premultiply( this._m4_1 ); - - this.setTransformationMatrices( this._m4_1, this._m4_2 ); - return _transformation; - - } else if ( this.camera.isPerspectiveCamera ) { - - this._v3_1.setFromMatrixPosition( this._cameraMatrixState ); - this._v3_2.setFromMatrixPosition( this._gizmoMatrixState ); - - //move camera - let distance = this._v3_1.distanceTo( _scalePointTemp ); - let amount = distance - ( distance * sizeInverse ); - - //check min and max distance - const newDistance = distance - amount; - if ( newDistance < this.minDistance ) { - - sizeInverse = this.minDistance / distance; - amount = distance - ( distance * sizeInverse ); - - } else if ( newDistance > this.maxDistance ) { - - sizeInverse = this.maxDistance / distance; - amount = distance - ( distance * sizeInverse ); - - } - - _offset.copy( _scalePointTemp ).sub( this._v3_1 ).normalize().multiplyScalar( amount ); - - this._m4_1.makeTranslation( _offset.x, _offset.y, _offset.z ); - - - if ( scaleGizmos ) { - - //scale gizmos so they appear in the same spot having the same dimension - const pos = this._v3_2; - - distance = pos.distanceTo( _scalePointTemp ); - amount = distance - ( distance * sizeInverse ); - _offset.copy( _scalePointTemp ).sub( this._v3_2 ).normalize().multiplyScalar( amount ); - - this._translationMatrix.makeTranslation( pos.x, pos.y, pos.z ); - this._scaleMatrix.makeScale( sizeInverse, sizeInverse, sizeInverse ); - - this._m4_2.makeTranslation( _offset.x, _offset.y, _offset.z ).multiply( this._translationMatrix ); - this._m4_2.multiply( this._scaleMatrix ); - - this._translationMatrix.makeTranslation( - pos.x, - pos.y, - pos.z ); - - this._m4_2.multiply( this._translationMatrix ); - this.setTransformationMatrices( this._m4_1, this._m4_2 ); - - - } else { - - this.setTransformationMatrices( this._m4_1 ); - - } - - return _transformation; - - } - - } - - /** - * Set camera fov - * @param {Number} value fov to be setted - */ - setFov( value ) { - - if ( this.camera.isPerspectiveCamera ) { - - this.camera.fov = MathUtils.clamp( value, this.minFov, this.maxFov ); - this.camera.updateProjectionMatrix(); - - } - - } - - /** - * Set values in transformation object - * @param {Matrix4} camera Transformation to be applied to the camera - * @param {Matrix4} gizmos Transformation to be applied to gizmos - */ - setTransformationMatrices( camera = null, gizmos = null ) { - - if ( camera != null ) { - - if ( _transformation.camera != null ) { - - _transformation.camera.copy( camera ); - - } else { - - _transformation.camera = camera.clone(); - - } - - } else { - - _transformation.camera = null; - - } - - if ( gizmos != null ) { - - if ( _transformation.gizmos != null ) { - - _transformation.gizmos.copy( gizmos ); - - } else { - - _transformation.gizmos = gizmos.clone(); - - } - - } else { - - _transformation.gizmos = null; - - } - - } - - /** - * Rotate camera around its direction axis passing by a given point by a given angle - * @param {Vector3} point The point where the rotation axis is passing trough - * @param {Number} angle Angle in radians - * @returns The computed transormation matix - */ - zRotate( point, angle ) { - - this._rotationMatrix.makeRotationAxis( this._rotationAxis, angle ); - this._translationMatrix.makeTranslation( - point.x, - point.y, - point.z ); - - this._m4_1.makeTranslation( point.x, point.y, point.z ); - this._m4_1.multiply( this._rotationMatrix ); - this._m4_1.multiply( this._translationMatrix ); - - this._v3_1.setFromMatrixPosition( this._gizmoMatrixState ).sub( point ); //vector from rotation center to gizmos position - this._v3_2.copy( this._v3_1 ).applyAxisAngle( this._rotationAxis, angle ); //apply rotation - this._v3_2.sub( this._v3_1 ); - - this._m4_2.makeTranslation( this._v3_2.x, this._v3_2.y, this._v3_2.z ); - - this.setTransformationMatrices( this._m4_1, this._m4_2 ); - return _transformation; - - } - - - getRaycaster() { - - return _raycaster; - - } - - - /** - * Unproject the cursor on the 3D object surface - * @param {Vector2} cursor Cursor coordinates in NDC - * @param {Camera} camera Virtual camera - * @returns {Vector3} The point of intersection with the model, if exist, null otherwise - */ - unprojectOnObj( cursor, camera ) { - - const raycaster = this.getRaycaster(); - raycaster.near = camera.near; - raycaster.far = camera.far; - raycaster.setFromCamera( cursor, camera ); - - const intersect = raycaster.intersectObjects( this.scene.children, true ); - - for ( let i = 0; i < intersect.length; i ++ ) { - - if ( intersect[ i ].object.uuid != this._gizmos.uuid && intersect[ i ].face != null ) { - - return intersect[ i ].point.clone(); - - } - - } - - return null; - - } - - /** - * Unproject the cursor on the trackball surface - * @param {Camera} camera The virtual camera - * @param {Number} cursorX Cursor horizontal coordinate on screen - * @param {Number} cursorY Cursor vertical coordinate on screen - * @param {HTMLElement} canvas The canvas where the renderer draws its output - * @param {number} tbRadius The trackball radius - * @returns {Vector3} The unprojected point on the trackball surface - */ - unprojectOnTbSurface( camera, cursorX, cursorY, canvas, tbRadius ) { - - if ( camera.type == 'OrthographicCamera' ) { - - this._v2_1.copy( this.getCursorPosition( cursorX, cursorY, canvas ) ); - this._v3_1.set( this._v2_1.x, this._v2_1.y, 0 ); - - const x2 = Math.pow( this._v2_1.x, 2 ); - const y2 = Math.pow( this._v2_1.y, 2 ); - const r2 = Math.pow( this._tbRadius, 2 ); - - if ( x2 + y2 <= r2 * 0.5 ) { - - //intersection with sphere - this._v3_1.setZ( Math.sqrt( r2 - ( x2 + y2 ) ) ); - - } else { - - //intersection with hyperboloid - this._v3_1.setZ( ( r2 * 0.5 ) / ( Math.sqrt( x2 + y2 ) ) ); - - } - - return this._v3_1; - - } else if ( camera.type == 'PerspectiveCamera' ) { - - //unproject cursor on the near plane - this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) ); - - this._v3_1.set( this._v2_1.x, this._v2_1.y, - 1 ); - this._v3_1.applyMatrix4( camera.projectionMatrixInverse ); - - const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction - const cameraGizmoDistance = camera.position.distanceTo( this._gizmos.position ); - const radius2 = Math.pow( tbRadius, 2 ); - - // camera - // |\ - // | \ - // | \ - // h | \ - // | \ - // | \ - // _ _ | _ _ _\ _ _ near plane - // l - - const h = this._v3_1.z; - const l = Math.sqrt( Math.pow( this._v3_1.x, 2 ) + Math.pow( this._v3_1.y, 2 ) ); - - if ( l == 0 ) { - - //ray aligned with camera - rayDir.set( this._v3_1.x, this._v3_1.y, tbRadius ); - return rayDir; - - } - - const m = h / l; - const q = cameraGizmoDistance; - - /* - * calculate intersection point between unprojected ray and trackball surface - *|y = m * x + q - *|x^2 + y^2 = r^2 - * - * (m^2 + 1) * x^2 + (2 * m * q) * x + q^2 - r^2 = 0 - */ - let a = Math.pow( m, 2 ) + 1; - let b = 2 * m * q; - let c = Math.pow( q, 2 ) - radius2; - let delta = Math.pow( b, 2 ) - ( 4 * a * c ); - - if ( delta >= 0 ) { - - //intersection with sphere - this._v2_1.setX( ( - b - Math.sqrt( delta ) ) / ( 2 * a ) ); - this._v2_1.setY( m * this._v2_1.x + q ); - - const angle = MathUtils.RAD2DEG * this._v2_1.angle(); - - if ( angle >= 45 ) { - - //if angle between intersection point and X' axis is >= 45°, return that point - //otherwise, calculate intersection point with hyperboloid - - const rayLength = Math.sqrt( Math.pow( this._v2_1.x, 2 ) + Math.pow( ( cameraGizmoDistance - this._v2_1.y ), 2 ) ); - rayDir.multiplyScalar( rayLength ); - rayDir.z += cameraGizmoDistance; - return rayDir; - - } - - } - - //intersection with hyperboloid - /* - *|y = m * x + q - *|y = (1 / x) * (r^2 / 2) - * - * m * x^2 + q * x - r^2 / 2 = 0 - */ - - a = m; - b = q; - c = - radius2 * 0.5; - delta = Math.pow( b, 2 ) - ( 4 * a * c ); - this._v2_1.setX( ( - b - Math.sqrt( delta ) ) / ( 2 * a ) ); - this._v2_1.setY( m * this._v2_1.x + q ); - - const rayLength = Math.sqrt( Math.pow( this._v2_1.x, 2 ) + Math.pow( ( cameraGizmoDistance - this._v2_1.y ), 2 ) ); - - rayDir.multiplyScalar( rayLength ); - rayDir.z += cameraGizmoDistance; - return rayDir; - - } - - } - - - /** - * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera - * @param {Camera} camera The virtual camera - * @param {Number} cursorX Cursor horizontal coordinate on screen - * @param {Number} cursorY Cursor vertical coordinate on screen - * @param {HTMLElement} canvas The canvas where the renderer draws its output - * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only) - * @returns {Vector3} The unprojected point on the trackball plane - */ - unprojectOnTbPlane( camera, cursorX, cursorY, canvas, initialDistance = false ) { - - if ( camera.type == 'OrthographicCamera' ) { - - this._v2_1.copy( this.getCursorPosition( cursorX, cursorY, canvas ) ); - this._v3_1.set( this._v2_1.x, this._v2_1.y, 0 ); - - return this._v3_1.clone(); - - } else if ( camera.type == 'PerspectiveCamera' ) { - - this._v2_1.copy( this.getCursorNDC( cursorX, cursorY, canvas ) ); - - //unproject cursor on the near plane - this._v3_1.set( this._v2_1.x, this._v2_1.y, - 1 ); - this._v3_1.applyMatrix4( camera.projectionMatrixInverse ); - - const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction - - // camera - // |\ - // | \ - // | \ - // h | \ - // | \ - // | \ - // _ _ | _ _ _\ _ _ near plane - // l - - const h = this._v3_1.z; - const l = Math.sqrt( Math.pow( this._v3_1.x, 2 ) + Math.pow( this._v3_1.y, 2 ) ); - let cameraGizmoDistance; - - if ( initialDistance ) { - - cameraGizmoDistance = this._v3_1.setFromMatrixPosition( this._cameraMatrixState0 ).distanceTo( this._v3_2.setFromMatrixPosition( this._gizmoMatrixState0 ) ); - - } else { - - cameraGizmoDistance = camera.position.distanceTo( this._gizmos.position ); - - } - - /* - * calculate intersection point between unprojected ray and the plane - *|y = mx + q - *|y = 0 - * - * x = -q/m - */ - if ( l == 0 ) { - - //ray aligned with camera - rayDir.set( 0, 0, 0 ); - return rayDir; - - } - - const m = h / l; - const q = cameraGizmoDistance; - const x = - q / m; - - const rayLength = Math.sqrt( Math.pow( q, 2 ) + Math.pow( x, 2 ) ); - rayDir.multiplyScalar( rayLength ); - rayDir.z = 0; - return rayDir; - - } - - } - - /** - * Update camera and gizmos state - */ - updateMatrixState() { - - //update camera and gizmos state - this._cameraMatrixState.copy( this.camera.matrix ); - this._gizmoMatrixState.copy( this._gizmos.matrix ); - - if ( this.camera.isOrthographicCamera ) { - - this._cameraProjectionState.copy( this.camera.projectionMatrix ); - this.camera.updateProjectionMatrix(); - this._zoomState = this.camera.zoom; - - } else if ( this.camera.isPerspectiveCamera ) { - - this._fovState = this.camera.fov; - - } - - } - - /** - * Update the trackball FSA - * @param {STATE} newState New state of the FSA - * @param {Boolean} updateMatrices If matriices state should be updated - */ - updateTbState( newState, updateMatrices ) { - - this._state = newState; - if ( updateMatrices ) { - - this.updateMatrixState(); - - } - - } - - update() { - - const EPS = 0.000001; - - if ( this.target.equals( this._currentTarget ) === false ) { - - this._gizmos.position.copy( this.target ); //for correct radius calculation - this._tbRadius = this.calculateTbRadius( this.camera ); - this.makeGizmos( this.target, this._tbRadius ); - this._currentTarget.copy( this.target ); - - } - - //check min/max parameters - if ( this.camera.isOrthographicCamera ) { - - //check zoom - if ( this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom ) { - - const newZoom = MathUtils.clamp( this.camera.zoom, this.minZoom, this.maxZoom ); - this.applyTransformMatrix( this.scale( newZoom / this.camera.zoom, this._gizmos.position, true ) ); - - } - - } else if ( this.camera.isPerspectiveCamera ) { - - //check distance - const distance = this.camera.position.distanceTo( this._gizmos.position ); - - if ( distance > this.maxDistance + EPS || distance < this.minDistance - EPS ) { - - const newDistance = MathUtils.clamp( distance, this.minDistance, this.maxDistance ); - this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) ); - this.updateMatrixState(); - - } - - //check fov - if ( this.camera.fov < this.minFov || this.camera.fov > this.maxFov ) { - - this.camera.fov = MathUtils.clamp( this.camera.fov, this.minFov, this.maxFov ); - this.camera.updateProjectionMatrix(); - - } - - const oldRadius = this._tbRadius; - this._tbRadius = this.calculateTbRadius( this.camera ); - - if ( oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS ) { - - const scale = ( this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z ) / 3; - const newRadius = this._tbRadius / scale; - const curve = new EllipseCurve( 0, 0, newRadius, newRadius ); - const points = curve.getPoints( this._curvePts ); - const curveGeometry = new BufferGeometry().setFromPoints( points ); - - for ( const gizmo in this._gizmos.children ) { - - this._gizmos.children[ gizmo ].geometry = curveGeometry; - - } - - } - - } - - this.camera.lookAt( this._gizmos.position ); - - } - - setStateFromJSON( json ) { - - const state = JSON.parse( json ); - - if ( state.arcballState != undefined ) { - - this._cameraMatrixState.fromArray( state.arcballState.cameraMatrix.elements ); - this._cameraMatrixState.decompose( this.camera.position, this.camera.quaternion, this.camera.scale ); - - this.camera.up.copy( state.arcballState.cameraUp ); - this.camera.near = state.arcballState.cameraNear; - this.camera.far = state.arcballState.cameraFar; - - this.camera.zoom = state.arcballState.cameraZoom; - - if ( this.camera.isPerspectiveCamera ) { - - this.camera.fov = state.arcballState.cameraFov; - - } - - this._gizmoMatrixState.fromArray( state.arcballState.gizmoMatrix.elements ); - this._gizmoMatrixState.decompose( this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale ); - - this.camera.updateMatrix(); - this.camera.updateProjectionMatrix(); - - this._gizmos.updateMatrix(); - - this._tbRadius = this.calculateTbRadius( this.camera ); - const gizmoTmp = new Matrix4().copy( this._gizmoMatrixState0 ); - this.makeGizmos( this._gizmos.position, this._tbRadius ); - this._gizmoMatrixState0.copy( gizmoTmp ); - - this.camera.lookAt( this._gizmos.position ); - this.updateTbState( STATE.IDLE, false ); - - this.dispatchEvent( _changeEvent ); - - } - - } - -} - -//listeners - -function onWindowResize() { - - const scale = ( this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z ) / 3; - this._tbRadius = this.calculateTbRadius( this.camera ); - - const newRadius = this._tbRadius / scale; - const curve = new EllipseCurve( 0, 0, newRadius, newRadius ); - const points = curve.getPoints( this._curvePts ); - const curveGeometry = new BufferGeometry().setFromPoints( points ); - - - for ( const gizmo in this._gizmos.children ) { - - this._gizmos.children[ gizmo ].geometry = curveGeometry; - - } - - this.dispatchEvent( _changeEvent ); - -} - -function onContextMenu( event ) { - - if ( ! this.enabled ) { - - return; - - } - - for ( let i = 0; i < this.mouseActions.length; i ++ ) { - - if ( this.mouseActions[ i ].mouse == 2 ) { - - //prevent only if button 2 is actually used - event.preventDefault(); - break; - - } - - } - -} - -function onPointerCancel() { - - this._touchStart.splice( 0, this._touchStart.length ); - this._touchCurrent.splice( 0, this._touchCurrent.length ); - this._input = INPUT.NONE; - -} - -function onPointerDown( event ) { - - if ( event.button == 0 && event.isPrimary ) { - - this._downValid = true; - this._downEvents.push( event ); - this._downStart = performance.now(); - - } else { - - this._downValid = false; - - } - - if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) { - - this._touchStart.push( event ); - this._touchCurrent.push( event ); - - switch ( this._input ) { - - case INPUT.NONE: - - //singleStart - this._input = INPUT.ONE_FINGER; - this.onSinglePanStart( event, 'ROTATE' ); - - window.addEventListener( 'pointermove', this._onPointerMove ); - window.addEventListener( 'pointerup', this._onPointerUp ); - - break; - - case INPUT.ONE_FINGER: - case INPUT.ONE_FINGER_SWITCHED: - - //doubleStart - this._input = INPUT.TWO_FINGER; - - this.onRotateStart(); - this.onPinchStart(); - this.onDoublePanStart(); - - break; - - case INPUT.TWO_FINGER: - - //multipleStart - this._input = INPUT.MULT_FINGER; - this.onTriplePanStart( event ); - break; - - } - - } else if ( event.pointerType != 'touch' && this._input == INPUT.NONE ) { - - let modifier = null; - - if ( event.ctrlKey || event.metaKey ) { - - modifier = 'CTRL'; - - } else if ( event.shiftKey ) { - - modifier = 'SHIFT'; - - } - - this._mouseOp = this.getOpFromAction( event.button, modifier ); - if ( this._mouseOp != null ) { - - window.addEventListener( 'pointermove', this._onPointerMove ); - window.addEventListener( 'pointerup', this._onPointerUp ); - - //singleStart - this._input = INPUT.CURSOR; - this._button = event.button; - this.onSinglePanStart( event, this._mouseOp ); - - } - - } - -} - -function onPointerMove( event ) { - - if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) { - - switch ( this._input ) { - - case INPUT.ONE_FINGER: - - //singleMove - this.updateTouchEvent( event ); - - this.onSinglePanMove( event, STATE.ROTATE ); - break; - - case INPUT.ONE_FINGER_SWITCHED: - - const movement = this.calculatePointersDistance( this._touchCurrent[ 0 ], event ) * this._devPxRatio; - - if ( movement >= this._switchSensibility ) { - - //singleMove - this._input = INPUT.ONE_FINGER; - this.updateTouchEvent( event ); - - this.onSinglePanStart( event, 'ROTATE' ); - break; - - } - - break; - - case INPUT.TWO_FINGER: - - //rotate/pan/pinchMove - this.updateTouchEvent( event ); - - this.onRotateMove(); - this.onPinchMove(); - this.onDoublePanMove(); - - break; - - case INPUT.MULT_FINGER: - - //multMove - this.updateTouchEvent( event ); - - this.onTriplePanMove( event ); - break; - - } - - } else if ( event.pointerType != 'touch' && this._input == INPUT.CURSOR ) { - - let modifier = null; - - if ( event.ctrlKey || event.metaKey ) { - - modifier = 'CTRL'; - - } else if ( event.shiftKey ) { - - modifier = 'SHIFT'; - - } - - const mouseOpState = this.getOpStateFromAction( this._button, modifier ); - - if ( mouseOpState != null ) { - - this.onSinglePanMove( event, mouseOpState ); - - } - - } - - //checkDistance - if ( this._downValid ) { - - const movement = this.calculatePointersDistance( this._downEvents[ this._downEvents.length - 1 ], event ) * this._devPxRatio; - if ( movement > this._movementThreshold ) { - - this._downValid = false; - - } - - } - -} - -function onPointerUp( event ) { - - if ( event.pointerType == 'touch' && this._input != INPUT.CURSOR ) { - - const nTouch = this._touchCurrent.length; - - for ( let i = 0; i < nTouch; i ++ ) { - - if ( this._touchCurrent[ i ].pointerId == event.pointerId ) { - - this._touchCurrent.splice( i, 1 ); - this._touchStart.splice( i, 1 ); - break; - - } - - } - - switch ( this._input ) { - - case INPUT.ONE_FINGER: - case INPUT.ONE_FINGER_SWITCHED: - - //singleEnd - window.removeEventListener( 'pointermove', this._onPointerMove ); - window.removeEventListener( 'pointerup', this._onPointerUp ); - - this._input = INPUT.NONE; - this.onSinglePanEnd(); - - break; - - case INPUT.TWO_FINGER: - - //doubleEnd - this.onDoublePanEnd( event ); - this.onPinchEnd( event ); - this.onRotateEnd( event ); - - //switching to singleStart - this._input = INPUT.ONE_FINGER_SWITCHED; - - break; - - case INPUT.MULT_FINGER: - - if ( this._touchCurrent.length == 0 ) { - - window.removeEventListener( 'pointermove', this._onPointerMove ); - window.removeEventListener( 'pointerup', this._onPointerUp ); - - //multCancel - this._input = INPUT.NONE; - this.onTriplePanEnd(); - - } - - break; - - } - - } else if ( event.pointerType != 'touch' && this._input == INPUT.CURSOR ) { - - window.removeEventListener( 'pointermove', this._onPointerMove ); - window.removeEventListener( 'pointerup', this._onPointerUp ); - - this._input = INPUT.NONE; - this.onSinglePanEnd(); - this._button = - 1; - - } - - if ( event.isPrimary ) { - - if ( this._downValid ) { - - const downTime = event.timeStamp - this._downEvents[ this._downEvents.length - 1 ].timeStamp; - - if ( downTime <= this._maxDownTime ) { - - if ( this._nclicks == 0 ) { - - //first valid click detected - this._nclicks = 1; - this._clickStart = performance.now(); - - } else { - - const clickInterval = event.timeStamp - this._clickStart; - const movement = this.calculatePointersDistance( this._downEvents[ 1 ], this._downEvents[ 0 ] ) * this._devPxRatio; - - if ( clickInterval <= this._maxInterval && movement <= this._posThreshold ) { - - //second valid click detected - //fire double tap and reset values - this._nclicks = 0; - this._downEvents.splice( 0, this._downEvents.length ); - this.onDoubleTap( event ); - - } else { - - //new 'first click' - this._nclicks = 1; - this._downEvents.shift(); - this._clickStart = performance.now(); - - } - - } - - } else { - - this._downValid = false; - this._nclicks = 0; - this._downEvents.splice( 0, this._downEvents.length ); - - } - - } else { - - this._nclicks = 0; - this._downEvents.splice( 0, this._downEvents.length ); - - } - - } - -} - -function onWheel( event ) { - - if ( this.enabled && this.enableZoom ) { - - let modifier = null; - - if ( event.ctrlKey || event.metaKey ) { - - modifier = 'CTRL'; - - } else if ( event.shiftKey ) { - - modifier = 'SHIFT'; - - } - - const mouseOp = this.getOpFromAction( 'WHEEL', modifier ); - - if ( mouseOp != null ) { - - event.preventDefault(); - this.dispatchEvent( _startEvent ); - - const notchDeltaY = 125; //distance of one notch of mouse wheel - let sgn = event.deltaY / notchDeltaY; - - let size = 1; - - if ( sgn > 0 ) { - - size = 1 / this.scaleFactor; - - } else if ( sgn < 0 ) { - - size = this.scaleFactor; - - } - - switch ( mouseOp ) { - - case 'ZOOM': - - this.updateTbState( STATE.SCALE, true ); - - if ( sgn > 0 ) { - - size = 1 / ( Math.pow( this.scaleFactor, sgn ) ); - - } else if ( sgn < 0 ) { - - size = Math.pow( this.scaleFactor, - sgn ); - - } - - if ( this.cursorZoom && this.enablePan ) { - - let scalePoint; - - if ( this.camera.isOrthographicCamera ) { - - scalePoint = this.unprojectOnTbPlane( this.camera, event.clientX, event.clientY, this.domElement ).applyQuaternion( this.camera.quaternion ).multiplyScalar( 1 / this.camera.zoom ).add( this._gizmos.position ); - - } else if ( this.camera.isPerspectiveCamera ) { - - scalePoint = this.unprojectOnTbPlane( this.camera, event.clientX, event.clientY, this.domElement ).applyQuaternion( this.camera.quaternion ).add( this._gizmos.position ); - - } - - this.applyTransformMatrix( this.scale( size, scalePoint ) ); - - } else { - - this.applyTransformMatrix( this.scale( size, this._gizmos.position ) ); - - } - - if ( this._grid != null ) { - - this.disposeGrid(); - this.drawGrid(); - - } - - this.updateTbState( STATE.IDLE, false ); - - this.dispatchEvent( _changeEvent ); - this.dispatchEvent( _endEvent ); - - break; - - case 'FOV': - - if ( this.camera.isPerspectiveCamera ) { - - this.updateTbState( STATE.FOV, true ); - - - //Vertigo effect - - // fov / 2 - // |\ - // | \ - // | \ - // x | \ - // | \ - // | \ - // | _ _ _\ - // y - - //check for iOs shift shortcut - if ( event.deltaX != 0 ) { - - sgn = event.deltaX / notchDeltaY; - - size = 1; - - if ( sgn > 0 ) { - - size = 1 / ( Math.pow( this.scaleFactor, sgn ) ); - - } else if ( sgn < 0 ) { - - size = Math.pow( this.scaleFactor, - sgn ); - - } - - } - - this._v3_1.setFromMatrixPosition( this._cameraMatrixState ); - const x = this._v3_1.distanceTo( this._gizmos.position ); - let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed - - //check min and max distance - xNew = MathUtils.clamp( xNew, this.minDistance, this.maxDistance ); - - const y = x * Math.tan( MathUtils.DEG2RAD * this.camera.fov * 0.5 ); - - //calculate new fov - let newFov = MathUtils.RAD2DEG * ( Math.atan( y / xNew ) * 2 ); - - //check min and max fov - if ( newFov > this.maxFov ) { - - newFov = this.maxFov; - - } else if ( newFov < this.minFov ) { - - newFov = this.minFov; - - } - - const newDistance = y / Math.tan( MathUtils.DEG2RAD * ( newFov / 2 ) ); - size = x / newDistance; - - this.setFov( newFov ); - this.applyTransformMatrix( this.scale( size, this._gizmos.position, false ) ); - - } - - if ( this._grid != null ) { - - this.disposeGrid(); - this.drawGrid(); - - } - - this.updateTbState( STATE.IDLE, false ); - - this.dispatchEvent( _changeEvent ); - this.dispatchEvent( _endEvent ); - - break; - - } - - } - - } - -} - -export { ArcballControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/DragControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/DragControls.js deleted file mode 100644 index c7d3054..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/DragControls.js +++ /dev/null @@ -1,282 +0,0 @@ -import { - EventDispatcher, - Matrix4, - Plane, - Raycaster, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _plane = new Plane(); -const _raycaster = new Raycaster(); - -const _pointer = new Vector2(); -const _offset = new Vector3(); -const _diff = new Vector2(); -const _previousPointer = new Vector2(); -const _intersection = new Vector3(); -const _worldPosition = new Vector3(); -const _inverseMatrix = new Matrix4(); - -const _up = new Vector3(); -const _right = new Vector3(); - -class DragControls extends EventDispatcher { - - constructor( _objects, _camera, _domElement ) { - - super(); - - _domElement.style.touchAction = 'none'; // disable touch scroll - - let _selected = null, _hovered = null; - - const _intersections = []; - - this.mode = 'translate'; - - this.rotateSpeed = 1; - - // - - const scope = this; - - function activate() { - - _domElement.addEventListener( 'pointermove', onPointerMove ); - _domElement.addEventListener( 'pointerdown', onPointerDown ); - _domElement.addEventListener( 'pointerup', onPointerCancel ); - _domElement.addEventListener( 'pointerleave', onPointerCancel ); - - } - - function deactivate() { - - _domElement.removeEventListener( 'pointermove', onPointerMove ); - _domElement.removeEventListener( 'pointerdown', onPointerDown ); - _domElement.removeEventListener( 'pointerup', onPointerCancel ); - _domElement.removeEventListener( 'pointerleave', onPointerCancel ); - - _domElement.style.cursor = ''; - - } - - function dispose() { - - deactivate(); - - } - - function getObjects() { - - return _objects; - - } - - function setObjects( objects ) { - - _objects = objects; - - } - - function getRaycaster() { - - return _raycaster; - - } - - function onPointerMove( event ) { - - if ( scope.enabled === false ) return; - - updatePointer( event ); - - _raycaster.setFromCamera( _pointer, _camera ); - - if ( _selected ) { - - if ( scope.mode === 'translate' ) { - - if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { - - _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) ); - - } - - } else if ( scope.mode === 'rotate' ) { - - _diff.subVectors( _pointer, _previousPointer ).multiplyScalar( scope.rotateSpeed ); - _selected.rotateOnWorldAxis( _up, _diff.x ); - _selected.rotateOnWorldAxis( _right.normalize(), - _diff.y ); - - } - - scope.dispatchEvent( { type: 'drag', object: _selected } ); - - _previousPointer.copy( _pointer ); - - } else { - - // hover support - - if ( event.pointerType === 'mouse' || event.pointerType === 'pen' ) { - - _intersections.length = 0; - - _raycaster.setFromCamera( _pointer, _camera ); - _raycaster.intersectObjects( _objects, scope.recursive, _intersections ); - - if ( _intersections.length > 0 ) { - - const object = _intersections[ 0 ].object; - - _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) ); - - if ( _hovered !== object && _hovered !== null ) { - - scope.dispatchEvent( { type: 'hoveroff', object: _hovered } ); - - _domElement.style.cursor = 'auto'; - _hovered = null; - - } - - if ( _hovered !== object ) { - - scope.dispatchEvent( { type: 'hoveron', object: object } ); - - _domElement.style.cursor = 'pointer'; - _hovered = object; - - } - - } else { - - if ( _hovered !== null ) { - - scope.dispatchEvent( { type: 'hoveroff', object: _hovered } ); - - _domElement.style.cursor = 'auto'; - _hovered = null; - - } - - } - - } - - } - - _previousPointer.copy( _pointer ); - - } - - function onPointerDown( event ) { - - if ( scope.enabled === false ) return; - - updatePointer( event ); - - _intersections.length = 0; - - _raycaster.setFromCamera( _pointer, _camera ); - _raycaster.intersectObjects( _objects, scope.recursive, _intersections ); - - if ( _intersections.length > 0 ) { - - if ( scope.transformGroup === true ) { - - // look for the outermost group in the object's upper hierarchy - - _selected = findGroup( _intersections[ 0 ].object ); - - } else { - - _selected = _intersections[ 0 ].object; - - } - - _plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); - - if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) { - - if ( scope.mode === 'translate' ) { - - _inverseMatrix.copy( _selected.parent.matrixWorld ).invert(); - _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) ); - - } else if ( scope.mode === 'rotate' ) { - - // the controls only support Y+ up - _up.set( 0, 1, 0 ).applyQuaternion( _camera.quaternion ).normalize(); - _right.set( 1, 0, 0 ).applyQuaternion( _camera.quaternion ).normalize(); - - } - - } - - _domElement.style.cursor = 'move'; - - scope.dispatchEvent( { type: 'dragstart', object: _selected } ); - - } - - _previousPointer.copy( _pointer ); - - } - - function onPointerCancel() { - - if ( scope.enabled === false ) return; - - if ( _selected ) { - - scope.dispatchEvent( { type: 'dragend', object: _selected } ); - - _selected = null; - - } - - _domElement.style.cursor = _hovered ? 'pointer' : 'auto'; - - } - - function updatePointer( event ) { - - const rect = _domElement.getBoundingClientRect(); - - _pointer.x = ( event.clientX - rect.left ) / rect.width * 2 - 1; - _pointer.y = - ( event.clientY - rect.top ) / rect.height * 2 + 1; - - } - - function findGroup( obj, group = null ) { - - if ( obj.isGroup ) group = obj; - - if ( obj.parent === null ) return group; - - return findGroup( obj.parent, group ); - - } - - activate(); - - // API - - this.enabled = true; - this.recursive = true; - this.transformGroup = false; - - this.activate = activate; - this.deactivate = deactivate; - this.dispose = dispose; - this.getObjects = getObjects; - this.getRaycaster = getRaycaster; - this.setObjects = setObjects; - - } - -} - -export { DragControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FirstPersonControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FirstPersonControls.js deleted file mode 100644 index f567d02..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FirstPersonControls.js +++ /dev/null @@ -1,325 +0,0 @@ -import { - MathUtils, - Spherical, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _lookDirection = new Vector3(); -const _spherical = new Spherical(); -const _target = new Vector3(); - -class FirstPersonControls { - - constructor( object, domElement ) { - - this.object = object; - this.domElement = domElement; - - // API - - this.enabled = true; - - this.movementSpeed = 1.0; - this.lookSpeed = 0.005; - - this.lookVertical = true; - this.autoForward = false; - - this.activeLook = true; - - this.heightSpeed = false; - this.heightCoef = 1.0; - this.heightMin = 0.0; - this.heightMax = 1.0; - - this.constrainVertical = false; - this.verticalMin = 0; - this.verticalMax = Math.PI; - - this.mouseDragOn = false; - - // internals - - this.autoSpeedFactor = 0.0; - - this.pointerX = 0; - this.pointerY = 0; - - this.moveForward = false; - this.moveBackward = false; - this.moveLeft = false; - this.moveRight = false; - - this.viewHalfX = 0; - this.viewHalfY = 0; - - // private variables - - let lat = 0; - let lon = 0; - - // - - this.handleResize = function () { - - if ( this.domElement === document ) { - - this.viewHalfX = window.innerWidth / 2; - this.viewHalfY = window.innerHeight / 2; - - } else { - - this.viewHalfX = this.domElement.offsetWidth / 2; - this.viewHalfY = this.domElement.offsetHeight / 2; - - } - - }; - - this.onPointerDown = function ( event ) { - - if ( this.domElement !== document ) { - - this.domElement.focus(); - - } - - if ( this.activeLook ) { - - switch ( event.button ) { - - case 0: this.moveForward = true; break; - case 2: this.moveBackward = true; break; - - } - - } - - this.mouseDragOn = true; - - }; - - this.onPointerUp = function ( event ) { - - if ( this.activeLook ) { - - switch ( event.button ) { - - case 0: this.moveForward = false; break; - case 2: this.moveBackward = false; break; - - } - - } - - this.mouseDragOn = false; - - }; - - this.onPointerMove = function ( event ) { - - if ( this.domElement === document ) { - - this.pointerX = event.pageX - this.viewHalfX; - this.pointerY = event.pageY - this.viewHalfY; - - } else { - - this.pointerX = event.pageX - this.domElement.offsetLeft - this.viewHalfX; - this.pointerY = event.pageY - this.domElement.offsetTop - this.viewHalfY; - - } - - }; - - this.onKeyDown = function ( event ) { - - switch ( event.code ) { - - case 'ArrowUp': - case 'KeyW': this.moveForward = true; break; - - case 'ArrowLeft': - case 'KeyA': this.moveLeft = true; break; - - case 'ArrowDown': - case 'KeyS': this.moveBackward = true; break; - - case 'ArrowRight': - case 'KeyD': this.moveRight = true; break; - - case 'KeyR': this.moveUp = true; break; - case 'KeyF': this.moveDown = true; break; - - } - - }; - - this.onKeyUp = function ( event ) { - - switch ( event.code ) { - - case 'ArrowUp': - case 'KeyW': this.moveForward = false; break; - - case 'ArrowLeft': - case 'KeyA': this.moveLeft = false; break; - - case 'ArrowDown': - case 'KeyS': this.moveBackward = false; break; - - case 'ArrowRight': - case 'KeyD': this.moveRight = false; break; - - case 'KeyR': this.moveUp = false; break; - case 'KeyF': this.moveDown = false; break; - - } - - }; - - this.lookAt = function ( x, y, z ) { - - if ( x.isVector3 ) { - - _target.copy( x ); - - } else { - - _target.set( x, y, z ); - - } - - this.object.lookAt( _target ); - - setOrientation( this ); - - return this; - - }; - - this.update = function () { - - const targetPosition = new Vector3(); - - return function update( delta ) { - - if ( this.enabled === false ) return; - - if ( this.heightSpeed ) { - - const y = MathUtils.clamp( this.object.position.y, this.heightMin, this.heightMax ); - const heightDelta = y - this.heightMin; - - this.autoSpeedFactor = delta * ( heightDelta * this.heightCoef ); - - } else { - - this.autoSpeedFactor = 0.0; - - } - - const actualMoveSpeed = delta * this.movementSpeed; - - if ( this.moveForward || ( this.autoForward && ! this.moveBackward ) ) this.object.translateZ( - ( actualMoveSpeed + this.autoSpeedFactor ) ); - if ( this.moveBackward ) this.object.translateZ( actualMoveSpeed ); - - if ( this.moveLeft ) this.object.translateX( - actualMoveSpeed ); - if ( this.moveRight ) this.object.translateX( actualMoveSpeed ); - - if ( this.moveUp ) this.object.translateY( actualMoveSpeed ); - if ( this.moveDown ) this.object.translateY( - actualMoveSpeed ); - - let actualLookSpeed = delta * this.lookSpeed; - - if ( ! this.activeLook ) { - - actualLookSpeed = 0; - - } - - let verticalLookRatio = 1; - - if ( this.constrainVertical ) { - - verticalLookRatio = Math.PI / ( this.verticalMax - this.verticalMin ); - - } - - lon -= this.pointerX * actualLookSpeed; - if ( this.lookVertical ) lat -= this.pointerY * actualLookSpeed * verticalLookRatio; - - lat = Math.max( - 85, Math.min( 85, lat ) ); - - let phi = MathUtils.degToRad( 90 - lat ); - const theta = MathUtils.degToRad( lon ); - - if ( this.constrainVertical ) { - - phi = MathUtils.mapLinear( phi, 0, Math.PI, this.verticalMin, this.verticalMax ); - - } - - const position = this.object.position; - - targetPosition.setFromSphericalCoords( 1, phi, theta ).add( position ); - - this.object.lookAt( targetPosition ); - - }; - - }(); - - this.dispose = function () { - - this.domElement.removeEventListener( 'contextmenu', contextmenu ); - this.domElement.removeEventListener( 'pointerdown', _onPointerDown ); - this.domElement.removeEventListener( 'pointermove', _onPointerMove ); - this.domElement.removeEventListener( 'pointerup', _onPointerUp ); - - window.removeEventListener( 'keydown', _onKeyDown ); - window.removeEventListener( 'keyup', _onKeyUp ); - - }; - - const _onPointerMove = this.onPointerMove.bind( this ); - const _onPointerDown = this.onPointerDown.bind( this ); - const _onPointerUp = this.onPointerUp.bind( this ); - const _onKeyDown = this.onKeyDown.bind( this ); - const _onKeyUp = this.onKeyUp.bind( this ); - - this.domElement.addEventListener( 'contextmenu', contextmenu ); - this.domElement.addEventListener( 'pointerdown', _onPointerDown ); - this.domElement.addEventListener( 'pointermove', _onPointerMove ); - this.domElement.addEventListener( 'pointerup', _onPointerUp ); - - window.addEventListener( 'keydown', _onKeyDown ); - window.addEventListener( 'keyup', _onKeyUp ); - - function setOrientation( controls ) { - - const quaternion = controls.object.quaternion; - - _lookDirection.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - _spherical.setFromVector3( _lookDirection ); - - lat = 90 - MathUtils.radToDeg( _spherical.phi ); - lon = MathUtils.radToDeg( _spherical.theta ); - - } - - this.handleResize(); - - setOrientation( this ); - - } - -} - -function contextmenu( event ) { - - event.preventDefault(); - -} - -export { FirstPersonControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FlyControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FlyControls.js deleted file mode 100644 index a80f511..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/FlyControls.js +++ /dev/null @@ -1,326 +0,0 @@ -import { - EventDispatcher, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _changeEvent = { type: 'change' }; - -class FlyControls extends EventDispatcher { - - constructor( object, domElement ) { - - super(); - - this.object = object; - this.domElement = domElement; - - // API - - // Set to false to disable this control - this.enabled = true; - - this.movementSpeed = 1.0; - this.rollSpeed = 0.005; - - this.dragToLook = false; - this.autoForward = false; - - // disable default target object behavior - - // internals - - const scope = this; - - const EPS = 0.000001; - - const lastQuaternion = new Quaternion(); - const lastPosition = new Vector3(); - - this.tmpQuaternion = new Quaternion(); - - this.status = 0; - - this.moveState = { up: 0, down: 0, left: 0, right: 0, forward: 0, back: 0, pitchUp: 0, pitchDown: 0, yawLeft: 0, yawRight: 0, rollLeft: 0, rollRight: 0 }; - this.moveVector = new Vector3( 0, 0, 0 ); - this.rotationVector = new Vector3( 0, 0, 0 ); - - this.keydown = function ( event ) { - - if ( event.altKey || this.enabled === false ) { - - return; - - } - - switch ( event.code ) { - - case 'ShiftLeft': - case 'ShiftRight': this.movementSpeedMultiplier = .1; break; - - case 'KeyW': this.moveState.forward = 1; break; - case 'KeyS': this.moveState.back = 1; break; - - case 'KeyA': this.moveState.left = 1; break; - case 'KeyD': this.moveState.right = 1; break; - - case 'KeyR': this.moveState.up = 1; break; - case 'KeyF': this.moveState.down = 1; break; - - case 'ArrowUp': this.moveState.pitchUp = 1; break; - case 'ArrowDown': this.moveState.pitchDown = 1; break; - - case 'ArrowLeft': this.moveState.yawLeft = 1; break; - case 'ArrowRight': this.moveState.yawRight = 1; break; - - case 'KeyQ': this.moveState.rollLeft = 1; break; - case 'KeyE': this.moveState.rollRight = 1; break; - - } - - this.updateMovementVector(); - this.updateRotationVector(); - - }; - - this.keyup = function ( event ) { - - if ( this.enabled === false ) return; - - switch ( event.code ) { - - case 'ShiftLeft': - case 'ShiftRight': this.movementSpeedMultiplier = 1; break; - - case 'KeyW': this.moveState.forward = 0; break; - case 'KeyS': this.moveState.back = 0; break; - - case 'KeyA': this.moveState.left = 0; break; - case 'KeyD': this.moveState.right = 0; break; - - case 'KeyR': this.moveState.up = 0; break; - case 'KeyF': this.moveState.down = 0; break; - - case 'ArrowUp': this.moveState.pitchUp = 0; break; - case 'ArrowDown': this.moveState.pitchDown = 0; break; - - case 'ArrowLeft': this.moveState.yawLeft = 0; break; - case 'ArrowRight': this.moveState.yawRight = 0; break; - - case 'KeyQ': this.moveState.rollLeft = 0; break; - case 'KeyE': this.moveState.rollRight = 0; break; - - } - - this.updateMovementVector(); - this.updateRotationVector(); - - }; - - this.pointerdown = function ( event ) { - - if ( this.enabled === false ) return; - - if ( this.dragToLook ) { - - this.status ++; - - } else { - - switch ( event.button ) { - - case 0: this.moveState.forward = 1; break; - case 2: this.moveState.back = 1; break; - - } - - this.updateMovementVector(); - - } - - }; - - this.pointermove = function ( event ) { - - if ( this.enabled === false ) return; - - if ( ! this.dragToLook || this.status > 0 ) { - - const container = this.getContainerDimensions(); - const halfWidth = container.size[ 0 ] / 2; - const halfHeight = container.size[ 1 ] / 2; - - this.moveState.yawLeft = - ( ( event.pageX - container.offset[ 0 ] ) - halfWidth ) / halfWidth; - this.moveState.pitchDown = ( ( event.pageY - container.offset[ 1 ] ) - halfHeight ) / halfHeight; - - this.updateRotationVector(); - - } - - }; - - this.pointerup = function ( event ) { - - if ( this.enabled === false ) return; - - if ( this.dragToLook ) { - - this.status --; - - this.moveState.yawLeft = this.moveState.pitchDown = 0; - - } else { - - switch ( event.button ) { - - case 0: this.moveState.forward = 0; break; - case 2: this.moveState.back = 0; break; - - } - - this.updateMovementVector(); - - } - - this.updateRotationVector(); - - }; - - this.pointercancel = function () { - - if ( this.enabled === false ) return; - - if ( this.dragToLook ) { - - this.status = 0; - - this.moveState.yawLeft = this.moveState.pitchDown = 0; - - } else { - - this.moveState.forward = 0; - this.moveState.back = 0; - - this.updateMovementVector(); - - } - - this.updateRotationVector(); - - }; - - this.contextMenu = function ( event ) { - - if ( this.enabled === false ) return; - - event.preventDefault(); - - }; - - this.update = function ( delta ) { - - if ( this.enabled === false ) return; - - const moveMult = delta * scope.movementSpeed; - const rotMult = delta * scope.rollSpeed; - - scope.object.translateX( scope.moveVector.x * moveMult ); - scope.object.translateY( scope.moveVector.y * moveMult ); - scope.object.translateZ( scope.moveVector.z * moveMult ); - - scope.tmpQuaternion.set( scope.rotationVector.x * rotMult, scope.rotationVector.y * rotMult, scope.rotationVector.z * rotMult, 1 ).normalize(); - scope.object.quaternion.multiply( scope.tmpQuaternion ); - - if ( - lastPosition.distanceToSquared( scope.object.position ) > EPS || - 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS - ) { - - scope.dispatchEvent( _changeEvent ); - lastQuaternion.copy( scope.object.quaternion ); - lastPosition.copy( scope.object.position ); - - } - - }; - - this.updateMovementVector = function () { - - const forward = ( this.moveState.forward || ( this.autoForward && ! this.moveState.back ) ) ? 1 : 0; - - this.moveVector.x = ( - this.moveState.left + this.moveState.right ); - this.moveVector.y = ( - this.moveState.down + this.moveState.up ); - this.moveVector.z = ( - forward + this.moveState.back ); - - //console.log( 'move:', [ this.moveVector.x, this.moveVector.y, this.moveVector.z ] ); - - }; - - this.updateRotationVector = function () { - - this.rotationVector.x = ( - this.moveState.pitchDown + this.moveState.pitchUp ); - this.rotationVector.y = ( - this.moveState.yawRight + this.moveState.yawLeft ); - this.rotationVector.z = ( - this.moveState.rollRight + this.moveState.rollLeft ); - - //console.log( 'rotate:', [ this.rotationVector.x, this.rotationVector.y, this.rotationVector.z ] ); - - }; - - this.getContainerDimensions = function () { - - if ( this.domElement != document ) { - - return { - size: [ this.domElement.offsetWidth, this.domElement.offsetHeight ], - offset: [ this.domElement.offsetLeft, this.domElement.offsetTop ] - }; - - } else { - - return { - size: [ window.innerWidth, window.innerHeight ], - offset: [ 0, 0 ] - }; - - } - - }; - - this.dispose = function () { - - this.domElement.removeEventListener( 'contextmenu', _contextmenu ); - this.domElement.removeEventListener( 'pointerdown', _pointerdown ); - this.domElement.removeEventListener( 'pointermove', _pointermove ); - this.domElement.removeEventListener( 'pointerup', _pointerup ); - this.domElement.removeEventListener( 'pointercancel', _pointercancel ); - - window.removeEventListener( 'keydown', _keydown ); - window.removeEventListener( 'keyup', _keyup ); - - }; - - const _contextmenu = this.contextMenu.bind( this ); - const _pointermove = this.pointermove.bind( this ); - const _pointerdown = this.pointerdown.bind( this ); - const _pointerup = this.pointerup.bind( this ); - const _pointercancel = this.pointercancel.bind( this ); - const _keydown = this.keydown.bind( this ); - const _keyup = this.keyup.bind( this ); - - this.domElement.addEventListener( 'contextmenu', _contextmenu ); - this.domElement.addEventListener( 'pointerdown', _pointerdown ); - this.domElement.addEventListener( 'pointermove', _pointermove ); - this.domElement.addEventListener( 'pointerup', _pointerup ); - this.domElement.addEventListener( 'pointercancel', _pointercancel ); - - window.addEventListener( 'keydown', _keydown ); - window.addEventListener( 'keyup', _keyup ); - - this.updateMovementVector(); - this.updateRotationVector(); - - } - -} - -export { FlyControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/MapControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/MapControls.js deleted file mode 100644 index 034d0cc..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/MapControls.js +++ /dev/null @@ -1,28 +0,0 @@ -import { MOUSE, TOUCH } from '/static/javascript/three/build/three.module.js'; - -import { OrbitControls } from './OrbitControls.js'; - -// MapControls performs orbiting, dollying (zooming), and panning. -// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). -// -// Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate -// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish -// Pan - left mouse, or arrow keys / touch: one-finger move - -class MapControls extends OrbitControls { - - constructor( object, domElement ) { - - super( object, domElement ); - - this.screenSpacePanning = false; // pan orthogonal to world-space direction camera.up - - this.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.ROTATE }; - - this.touches = { ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE }; - - } - -} - -export { MapControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/OrbitControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/OrbitControls.js deleted file mode 100644 index 03e7ea0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/OrbitControls.js +++ /dev/null @@ -1,1532 +0,0 @@ -import { - EventDispatcher, - MOUSE, - Quaternion, - Spherical, - TOUCH, - Vector2, - Vector3, - Plane, - Ray, - MathUtils -} from '/static/javascript/three/build/three.module.js'; - -// OrbitControls performs orbiting, dollying (zooming), and panning. -// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default). -// -// Orbit - left mouse / touch: one-finger move -// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish -// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move - -const _changeEvent = { type: 'change' }; -const _startEvent = { type: 'start' }; -const _endEvent = { type: 'end' }; -const _ray = new Ray(); -const _plane = new Plane(); -const TILT_LIMIT = Math.cos( 70 * MathUtils.DEG2RAD ); - -class OrbitControls extends EventDispatcher { - - constructor( object, domElement ) { - - super(); - - this.object = object; - this.domElement = domElement; - this.domElement.style.touchAction = 'none'; // disable touch scroll - - // Set to false to disable this control - this.enabled = true; - - // "target" sets the location of focus, where the object orbits around - this.target = new Vector3(); - - // Sets the 3D cursor (similar to Blender), from which the maxTargetRadius takes effect - this.cursor = new Vector3(); - - // How far you can dolly in and out ( PerspectiveCamera only ) - this.minDistance = 0; - this.maxDistance = Infinity; - - // How far you can zoom in and out ( OrthographicCamera only ) - this.minZoom = 0; - this.maxZoom = Infinity; - - // Limit camera target within a spherical area around the cursor - this.minTargetRadius = 0; - this.maxTargetRadius = Infinity; - - // How far you can orbit vertically, upper and lower limits. - // Range is 0 to Math.PI radians. - this.minPolarAngle = 0; // radians - this.maxPolarAngle = Math.PI; // radians - - // How far you can orbit horizontally, upper and lower limits. - // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ) - this.minAzimuthAngle = - Infinity; // radians - this.maxAzimuthAngle = Infinity; // radians - - // Set to true to enable damping (inertia) - // If damping is enabled, you must call controls.update() in your animation loop - this.enableDamping = false; - this.dampingFactor = 0.05; - - // This option actually enables dollying in and out; left as "zoom" for backwards compatibility. - // Set to false to disable zooming - this.enableZoom = true; - this.zoomSpeed = 1.0; - - // Set to false to disable rotating - this.enableRotate = true; - this.rotateSpeed = 1.0; - - // Set to false to disable panning - this.enablePan = true; - this.panSpeed = 1.0; - this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up - this.keyPanSpeed = 7.0; // pixels moved per arrow key push - this.zoomToCursor = false; - - // Set to true to automatically rotate around the target - // If auto-rotate is enabled, you must call controls.update() in your animation loop - this.autoRotate = false; - this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60 - - // The four arrow keys - this.keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }; - - // Mouse buttons - this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; - - // Touch fingers - this.touches = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }; - - // for reset - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.zoom0 = this.object.zoom; - - // the target DOM element for key events - this._domElementKeyEvents = null; - - // - // public methods - // - - this.getPolarAngle = function () { - - return spherical.phi; - - }; - - this.getAzimuthalAngle = function () { - - return spherical.theta; - - }; - - this.getDistance = function () { - - return this.object.position.distanceTo( this.target ); - - }; - - this.listenToKeyEvents = function ( domElement ) { - - domElement.addEventListener( 'keydown', onKeyDown ); - this._domElementKeyEvents = domElement; - - }; - - this.stopListenToKeyEvents = function () { - - this._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown ); - this._domElementKeyEvents = null; - - }; - - this.saveState = function () { - - scope.target0.copy( scope.target ); - scope.position0.copy( scope.object.position ); - scope.zoom0 = scope.object.zoom; - - }; - - this.reset = function () { - - scope.target.copy( scope.target0 ); - scope.object.position.copy( scope.position0 ); - scope.object.zoom = scope.zoom0; - - scope.object.updateProjectionMatrix(); - scope.dispatchEvent( _changeEvent ); - - scope.update(); - - state = STATE.NONE; - - }; - - // this method is exposed, but perhaps it would be better if we can make it private... - this.update = function () { - - const offset = new Vector3(); - - // so camera.up is the orbit axis - const quat = new Quaternion().setFromUnitVectors( object.up, new Vector3( 0, 1, 0 ) ); - const quatInverse = quat.clone().invert(); - - const lastPosition = new Vector3(); - const lastQuaternion = new Quaternion(); - const lastTargetPosition = new Vector3(); - - const twoPI = 2 * Math.PI; - - return function update( deltaTime = null ) { - - const position = scope.object.position; - - offset.copy( position ).sub( scope.target ); - - // rotate offset to "y-axis-is-up" space - offset.applyQuaternion( quat ); - - // angle from z-axis around y-axis - spherical.setFromVector3( offset ); - - if ( scope.autoRotate && state === STATE.NONE ) { - - rotateLeft( getAutoRotationAngle( deltaTime ) ); - - } - - if ( scope.enableDamping ) { - - spherical.theta += sphericalDelta.theta * scope.dampingFactor; - spherical.phi += sphericalDelta.phi * scope.dampingFactor; - - } else { - - spherical.theta += sphericalDelta.theta; - spherical.phi += sphericalDelta.phi; - - } - - // restrict theta to be between desired limits - - let min = scope.minAzimuthAngle; - let max = scope.maxAzimuthAngle; - - if ( isFinite( min ) && isFinite( max ) ) { - - if ( min < - Math.PI ) min += twoPI; else if ( min > Math.PI ) min -= twoPI; - - if ( max < - Math.PI ) max += twoPI; else if ( max > Math.PI ) max -= twoPI; - - if ( min <= max ) { - - spherical.theta = Math.max( min, Math.min( max, spherical.theta ) ); - - } else { - - spherical.theta = ( spherical.theta > ( min + max ) / 2 ) ? - Math.max( min, spherical.theta ) : - Math.min( max, spherical.theta ); - - } - - } - - // restrict phi to be between desired limits - spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) ); - - spherical.makeSafe(); - - - // move target to panned location - - if ( scope.enableDamping === true ) { - - scope.target.addScaledVector( panOffset, scope.dampingFactor ); - - } else { - - scope.target.add( panOffset ); - - } - - // Limit the target distance from the cursor to create a sphere around the center of interest - scope.target.sub( scope.cursor ); - scope.target.clampLength( scope.minTargetRadius, scope.maxTargetRadius ); - scope.target.add( scope.cursor ); - - let zoomChanged = false; - // adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera - // we adjust zoom later in these cases - if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) { - - spherical.radius = clampDistance( spherical.radius ); - - } else { - - const prevRadius = spherical.radius; - spherical.radius = clampDistance( spherical.radius * scale ); - zoomChanged = prevRadius != spherical.radius; - - } - - offset.setFromSpherical( spherical ); - - // rotate offset back to "camera-up-vector-is-up" space - offset.applyQuaternion( quatInverse ); - - position.copy( scope.target ).add( offset ); - - scope.object.lookAt( scope.target ); - - if ( scope.enableDamping === true ) { - - sphericalDelta.theta *= ( 1 - scope.dampingFactor ); - sphericalDelta.phi *= ( 1 - scope.dampingFactor ); - - panOffset.multiplyScalar( 1 - scope.dampingFactor ); - - } else { - - sphericalDelta.set( 0, 0, 0 ); - - panOffset.set( 0, 0, 0 ); - - } - - // adjust camera position - if ( scope.zoomToCursor && performCursorZoom ) { - - let newRadius = null; - if ( scope.object.isPerspectiveCamera ) { - - // move the camera down the pointer ray - // this method avoids floating point error - const prevRadius = offset.length(); - newRadius = clampDistance( prevRadius * scale ); - - const radiusDelta = prevRadius - newRadius; - scope.object.position.addScaledVector( dollyDirection, radiusDelta ); - scope.object.updateMatrixWorld(); - - zoomChanged = !! radiusDelta; - - } else if ( scope.object.isOrthographicCamera ) { - - // adjust the ortho camera position based on zoom changes - const mouseBefore = new Vector3( mouse.x, mouse.y, 0 ); - mouseBefore.unproject( scope.object ); - - const prevZoom = scope.object.zoom; - scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) ); - scope.object.updateProjectionMatrix(); - - zoomChanged = prevZoom !== scope.object.zoom; - - const mouseAfter = new Vector3( mouse.x, mouse.y, 0 ); - mouseAfter.unproject( scope.object ); - - scope.object.position.sub( mouseAfter ).add( mouseBefore ); - scope.object.updateMatrixWorld(); - - newRadius = offset.length(); - - } else { - - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.' ); - scope.zoomToCursor = false; - - } - - // handle the placement of the target - if ( newRadius !== null ) { - - if ( this.screenSpacePanning ) { - - // position the orbit target in front of the new camera position - scope.target.set( 0, 0, - 1 ) - .transformDirection( scope.object.matrix ) - .multiplyScalar( newRadius ) - .add( scope.object.position ); - - } else { - - // get the ray and translation plane to compute target - _ray.origin.copy( scope.object.position ); - _ray.direction.set( 0, 0, - 1 ).transformDirection( scope.object.matrix ); - - // if the camera is 20 degrees above the horizon then don't adjust the focus target to avoid - // extremely large values - if ( Math.abs( scope.object.up.dot( _ray.direction ) ) < TILT_LIMIT ) { - - object.lookAt( scope.target ); - - } else { - - _plane.setFromNormalAndCoplanarPoint( scope.object.up, scope.target ); - _ray.intersectPlane( _plane, scope.target ); - - } - - } - - } - - } else if ( scope.object.isOrthographicCamera ) { - - const prevZoom = scope.object.zoom; - scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / scale ) ); - - if ( prevZoom !== scope.object.zoom ) { - - scope.object.updateProjectionMatrix(); - zoomChanged = true; - - } - - } - - scale = 1; - performCursorZoom = false; - - // update condition is: - // min(camera displacement, camera rotation in radians)^2 > EPS - // using small-angle approximation cos(x/2) = 1 - x^2 / 8 - - if ( zoomChanged || - lastPosition.distanceToSquared( scope.object.position ) > EPS || - 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS || - lastTargetPosition.distanceToSquared( scope.target ) > EPS ) { - - scope.dispatchEvent( _changeEvent ); - - lastPosition.copy( scope.object.position ); - lastQuaternion.copy( scope.object.quaternion ); - lastTargetPosition.copy( scope.target ); - - return true; - - } - - return false; - - }; - - }(); - - this.dispose = function () { - - scope.domElement.removeEventListener( 'contextmenu', onContextMenu ); - - scope.domElement.removeEventListener( 'pointerdown', onPointerDown ); - scope.domElement.removeEventListener( 'pointercancel', onPointerUp ); - scope.domElement.removeEventListener( 'wheel', onMouseWheel ); - - scope.domElement.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.removeEventListener( 'pointerup', onPointerUp ); - - const document = scope.domElement.getRootNode(); // offscreen canvas compatibility - - document.removeEventListener( 'keydown', interceptControlDown, { capture: true } ); - - if ( scope._domElementKeyEvents !== null ) { - - scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown ); - scope._domElementKeyEvents = null; - - } - - //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here? - - }; - - // - // internals - // - - const scope = this; - - const STATE = { - NONE: - 1, - ROTATE: 0, - DOLLY: 1, - PAN: 2, - TOUCH_ROTATE: 3, - TOUCH_PAN: 4, - TOUCH_DOLLY_PAN: 5, - TOUCH_DOLLY_ROTATE: 6 - }; - - let state = STATE.NONE; - - const EPS = 0.000001; - - // current position in spherical coordinates - const spherical = new Spherical(); - const sphericalDelta = new Spherical(); - - let scale = 1; - const panOffset = new Vector3(); - - const rotateStart = new Vector2(); - const rotateEnd = new Vector2(); - const rotateDelta = new Vector2(); - - const panStart = new Vector2(); - const panEnd = new Vector2(); - const panDelta = new Vector2(); - - const dollyStart = new Vector2(); - const dollyEnd = new Vector2(); - const dollyDelta = new Vector2(); - - const dollyDirection = new Vector3(); - const mouse = new Vector2(); - let performCursorZoom = false; - - const pointers = []; - const pointerPositions = {}; - - let controlActive = false; - - function getAutoRotationAngle( deltaTime ) { - - if ( deltaTime !== null ) { - - return ( 2 * Math.PI / 60 * scope.autoRotateSpeed ) * deltaTime; - - } else { - - return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed; - - } - - } - - function getZoomScale( delta ) { - - const normalizedDelta = Math.abs( delta * 0.01 ); - return Math.pow( 0.95, scope.zoomSpeed * normalizedDelta ); - - } - - function rotateLeft( angle ) { - - sphericalDelta.theta -= angle; - - } - - function rotateUp( angle ) { - - sphericalDelta.phi -= angle; - - } - - const panLeft = function () { - - const v = new Vector3(); - - return function panLeft( distance, objectMatrix ) { - - v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix - v.multiplyScalar( - distance ); - - panOffset.add( v ); - - }; - - }(); - - const panUp = function () { - - const v = new Vector3(); - - return function panUp( distance, objectMatrix ) { - - if ( scope.screenSpacePanning === true ) { - - v.setFromMatrixColumn( objectMatrix, 1 ); - - } else { - - v.setFromMatrixColumn( objectMatrix, 0 ); - v.crossVectors( scope.object.up, v ); - - } - - v.multiplyScalar( distance ); - - panOffset.add( v ); - - }; - - }(); - - // deltaX and deltaY are in pixels; right and down are positive - const pan = function () { - - const offset = new Vector3(); - - return function pan( deltaX, deltaY ) { - - const element = scope.domElement; - - if ( scope.object.isPerspectiveCamera ) { - - // perspective - const position = scope.object.position; - offset.copy( position ).sub( scope.target ); - let targetDistance = offset.length(); - - // half of the fov is center to top of screen - targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 ); - - // we use only clientHeight here so aspect ratio does not distort speed - panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix ); - panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix ); - - } else if ( scope.object.isOrthographicCamera ) { - - // orthographic - panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix ); - panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix ); - - } else { - - // camera neither orthographic nor perspective - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' ); - scope.enablePan = false; - - } - - }; - - }(); - - function dollyOut( dollyScale ) { - - if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) { - - scale /= dollyScale; - - } else { - - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); - scope.enableZoom = false; - - } - - } - - function dollyIn( dollyScale ) { - - if ( scope.object.isPerspectiveCamera || scope.object.isOrthographicCamera ) { - - scale *= dollyScale; - - } else { - - console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' ); - scope.enableZoom = false; - - } - - } - - function updateZoomParameters( x, y ) { - - if ( ! scope.zoomToCursor ) { - - return; - - } - - performCursorZoom = true; - - const rect = scope.domElement.getBoundingClientRect(); - const dx = x - rect.left; - const dy = y - rect.top; - const w = rect.width; - const h = rect.height; - - mouse.x = ( dx / w ) * 2 - 1; - mouse.y = - ( dy / h ) * 2 + 1; - - dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize(); - - } - - function clampDistance( dist ) { - - return Math.max( scope.minDistance, Math.min( scope.maxDistance, dist ) ); - - } - - // - // event callbacks - update the object state - // - - function handleMouseDownRotate( event ) { - - rotateStart.set( event.clientX, event.clientY ); - - } - - function handleMouseDownDolly( event ) { - - updateZoomParameters( event.clientX, event.clientX ); - dollyStart.set( event.clientX, event.clientY ); - - } - - function handleMouseDownPan( event ) { - - panStart.set( event.clientX, event.clientY ); - - } - - function handleMouseMoveRotate( event ) { - - rotateEnd.set( event.clientX, event.clientY ); - - rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); - - const element = scope.domElement; - - rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height - - rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); - - rotateStart.copy( rotateEnd ); - - scope.update(); - - } - - function handleMouseMoveDolly( event ) { - - dollyEnd.set( event.clientX, event.clientY ); - - dollyDelta.subVectors( dollyEnd, dollyStart ); - - if ( dollyDelta.y > 0 ) { - - dollyOut( getZoomScale( dollyDelta.y ) ); - - } else if ( dollyDelta.y < 0 ) { - - dollyIn( getZoomScale( dollyDelta.y ) ); - - } - - dollyStart.copy( dollyEnd ); - - scope.update(); - - } - - function handleMouseMovePan( event ) { - - panEnd.set( event.clientX, event.clientY ); - - panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); - - pan( panDelta.x, panDelta.y ); - - panStart.copy( panEnd ); - - scope.update(); - - } - - function handleMouseWheel( event ) { - - updateZoomParameters( event.clientX, event.clientY ); - - if ( event.deltaY < 0 ) { - - dollyIn( getZoomScale( event.deltaY ) ); - - } else if ( event.deltaY > 0 ) { - - dollyOut( getZoomScale( event.deltaY ) ); - - } - - scope.update(); - - } - - function handleKeyDown( event ) { - - let needsUpdate = false; - - switch ( event.code ) { - - case scope.keys.UP: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - rotateUp( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight ); - - } else { - - pan( 0, scope.keyPanSpeed ); - - } - - needsUpdate = true; - break; - - case scope.keys.BOTTOM: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - rotateUp( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight ); - - } else { - - pan( 0, - scope.keyPanSpeed ); - - } - - needsUpdate = true; - break; - - case scope.keys.LEFT: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - rotateLeft( 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight ); - - } else { - - pan( scope.keyPanSpeed, 0 ); - - } - - needsUpdate = true; - break; - - case scope.keys.RIGHT: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - rotateLeft( - 2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight ); - - } else { - - pan( - scope.keyPanSpeed, 0 ); - - } - - needsUpdate = true; - break; - - } - - if ( needsUpdate ) { - - // prevent the browser from scrolling on cursor keys - event.preventDefault(); - - scope.update(); - - } - - - } - - function handleTouchStartRotate( event ) { - - if ( pointers.length === 1 ) { - - rotateStart.set( event.pageX, event.pageY ); - - } else { - - const position = getSecondPointerPosition( event ); - - const x = 0.5 * ( event.pageX + position.x ); - const y = 0.5 * ( event.pageY + position.y ); - - rotateStart.set( x, y ); - - } - - } - - function handleTouchStartPan( event ) { - - if ( pointers.length === 1 ) { - - panStart.set( event.pageX, event.pageY ); - - } else { - - const position = getSecondPointerPosition( event ); - - const x = 0.5 * ( event.pageX + position.x ); - const y = 0.5 * ( event.pageY + position.y ); - - panStart.set( x, y ); - - } - - } - - function handleTouchStartDolly( event ) { - - const position = getSecondPointerPosition( event ); - - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - - const distance = Math.sqrt( dx * dx + dy * dy ); - - dollyStart.set( 0, distance ); - - } - - function handleTouchStartDollyPan( event ) { - - if ( scope.enableZoom ) handleTouchStartDolly( event ); - - if ( scope.enablePan ) handleTouchStartPan( event ); - - } - - function handleTouchStartDollyRotate( event ) { - - if ( scope.enableZoom ) handleTouchStartDolly( event ); - - if ( scope.enableRotate ) handleTouchStartRotate( event ); - - } - - function handleTouchMoveRotate( event ) { - - if ( pointers.length == 1 ) { - - rotateEnd.set( event.pageX, event.pageY ); - - } else { - - const position = getSecondPointerPosition( event ); - - const x = 0.5 * ( event.pageX + position.x ); - const y = 0.5 * ( event.pageY + position.y ); - - rotateEnd.set( x, y ); - - } - - rotateDelta.subVectors( rotateEnd, rotateStart ).multiplyScalar( scope.rotateSpeed ); - - const element = scope.domElement; - - rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientHeight ); // yes, height - - rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight ); - - rotateStart.copy( rotateEnd ); - - } - - function handleTouchMovePan( event ) { - - if ( pointers.length === 1 ) { - - panEnd.set( event.pageX, event.pageY ); - - } else { - - const position = getSecondPointerPosition( event ); - - const x = 0.5 * ( event.pageX + position.x ); - const y = 0.5 * ( event.pageY + position.y ); - - panEnd.set( x, y ); - - } - - panDelta.subVectors( panEnd, panStart ).multiplyScalar( scope.panSpeed ); - - pan( panDelta.x, panDelta.y ); - - panStart.copy( panEnd ); - - } - - function handleTouchMoveDolly( event ) { - - const position = getSecondPointerPosition( event ); - - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - - const distance = Math.sqrt( dx * dx + dy * dy ); - - dollyEnd.set( 0, distance ); - - dollyDelta.set( 0, Math.pow( dollyEnd.y / dollyStart.y, scope.zoomSpeed ) ); - - dollyOut( dollyDelta.y ); - - dollyStart.copy( dollyEnd ); - - const centerX = ( event.pageX + position.x ) * 0.5; - const centerY = ( event.pageY + position.y ) * 0.5; - - updateZoomParameters( centerX, centerY ); - - } - - function handleTouchMoveDollyPan( event ) { - - if ( scope.enableZoom ) handleTouchMoveDolly( event ); - - if ( scope.enablePan ) handleTouchMovePan( event ); - - } - - function handleTouchMoveDollyRotate( event ) { - - if ( scope.enableZoom ) handleTouchMoveDolly( event ); - - if ( scope.enableRotate ) handleTouchMoveRotate( event ); - - } - - // - // event handlers - FSM: listen for events and reset state - // - - function onPointerDown( event ) { - - if ( scope.enabled === false ) return; - - if ( pointers.length === 0 ) { - - scope.domElement.setPointerCapture( event.pointerId ); - - scope.domElement.addEventListener( 'pointermove', onPointerMove ); - scope.domElement.addEventListener( 'pointerup', onPointerUp ); - - } - - // - - if ( isTrackingPointer( event ) ) return; - - // - - addPointer( event ); - - if ( event.pointerType === 'touch' ) { - - onTouchStart( event ); - - } else { - - onMouseDown( event ); - - } - - } - - function onPointerMove( event ) { - - if ( scope.enabled === false ) return; - - if ( event.pointerType === 'touch' ) { - - onTouchMove( event ); - - } else { - - onMouseMove( event ); - - } - - } - - function onPointerUp( event ) { - - removePointer( event ); - - switch ( pointers.length ) { - - case 0: - - scope.domElement.releasePointerCapture( event.pointerId ); - - scope.domElement.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.removeEventListener( 'pointerup', onPointerUp ); - - scope.dispatchEvent( _endEvent ); - - state = STATE.NONE; - - break; - - case 1: - - const pointerId = pointers[ 0 ]; - const position = pointerPositions[ pointerId ]; - - // minimal placeholder event - allows state correction on pointer-up - onTouchStart( { pointerId: pointerId, pageX: position.x, pageY: position.y } ); - - break; - - } - - } - - function onMouseDown( event ) { - - let mouseAction; - - switch ( event.button ) { - - case 0: - - mouseAction = scope.mouseButtons.LEFT; - break; - - case 1: - - mouseAction = scope.mouseButtons.MIDDLE; - break; - - case 2: - - mouseAction = scope.mouseButtons.RIGHT; - break; - - default: - - mouseAction = - 1; - - } - - switch ( mouseAction ) { - - case MOUSE.DOLLY: - - if ( scope.enableZoom === false ) return; - - handleMouseDownDolly( event ); - - state = STATE.DOLLY; - - break; - - case MOUSE.ROTATE: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - if ( scope.enablePan === false ) return; - - handleMouseDownPan( event ); - - state = STATE.PAN; - - } else { - - if ( scope.enableRotate === false ) return; - - handleMouseDownRotate( event ); - - state = STATE.ROTATE; - - } - - break; - - case MOUSE.PAN: - - if ( event.ctrlKey || event.metaKey || event.shiftKey ) { - - if ( scope.enableRotate === false ) return; - - handleMouseDownRotate( event ); - - state = STATE.ROTATE; - - } else { - - if ( scope.enablePan === false ) return; - - handleMouseDownPan( event ); - - state = STATE.PAN; - - } - - break; - - default: - - state = STATE.NONE; - - } - - if ( state !== STATE.NONE ) { - - scope.dispatchEvent( _startEvent ); - - } - - } - - function onMouseMove( event ) { - - switch ( state ) { - - case STATE.ROTATE: - - if ( scope.enableRotate === false ) return; - - handleMouseMoveRotate( event ); - - break; - - case STATE.DOLLY: - - if ( scope.enableZoom === false ) return; - - handleMouseMoveDolly( event ); - - break; - - case STATE.PAN: - - if ( scope.enablePan === false ) return; - - handleMouseMovePan( event ); - - break; - - } - - } - - function onMouseWheel( event ) { - - if ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return; - - event.preventDefault(); - - scope.dispatchEvent( _startEvent ); - - handleMouseWheel( customWheelEvent( event ) ); - - scope.dispatchEvent( _endEvent ); - - } - - function customWheelEvent( event ) { - - const mode = event.deltaMode; - - // minimal wheel event altered to meet delta-zoom demand - const newEvent = { - clientX: event.clientX, - clientY: event.clientY, - deltaY: event.deltaY, - }; - - switch ( mode ) { - - case 1: // LINE_MODE - newEvent.deltaY *= 16; - break; - - case 2: // PAGE_MODE - newEvent.deltaY *= 100; - break; - - } - - // detect if event was triggered by pinching - if ( event.ctrlKey && ! controlActive ) { - - newEvent.deltaY *= 10; - - } - - return newEvent; - - } - - function interceptControlDown( event ) { - - if ( event.key === 'Control' ) { - - controlActive = true; - - - const document = scope.domElement.getRootNode(); // offscreen canvas compatibility - - document.addEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } ); - - } - - } - - function interceptControlUp( event ) { - - if ( event.key === 'Control' ) { - - controlActive = false; - - - const document = scope.domElement.getRootNode(); // offscreen canvas compatibility - - document.removeEventListener( 'keyup', interceptControlUp, { passive: true, capture: true } ); - - } - - } - - function onKeyDown( event ) { - - if ( scope.enabled === false || scope.enablePan === false ) return; - - handleKeyDown( event ); - - } - - function onTouchStart( event ) { - - trackPointer( event ); - - switch ( pointers.length ) { - - case 1: - - switch ( scope.touches.ONE ) { - - case TOUCH.ROTATE: - - if ( scope.enableRotate === false ) return; - - handleTouchStartRotate( event ); - - state = STATE.TOUCH_ROTATE; - - break; - - case TOUCH.PAN: - - if ( scope.enablePan === false ) return; - - handleTouchStartPan( event ); - - state = STATE.TOUCH_PAN; - - break; - - default: - - state = STATE.NONE; - - } - - break; - - case 2: - - switch ( scope.touches.TWO ) { - - case TOUCH.DOLLY_PAN: - - if ( scope.enableZoom === false && scope.enablePan === false ) return; - - handleTouchStartDollyPan( event ); - - state = STATE.TOUCH_DOLLY_PAN; - - break; - - case TOUCH.DOLLY_ROTATE: - - if ( scope.enableZoom === false && scope.enableRotate === false ) return; - - handleTouchStartDollyRotate( event ); - - state = STATE.TOUCH_DOLLY_ROTATE; - - break; - - default: - - state = STATE.NONE; - - } - - break; - - default: - - state = STATE.NONE; - - } - - if ( state !== STATE.NONE ) { - - scope.dispatchEvent( _startEvent ); - - } - - } - - function onTouchMove( event ) { - - trackPointer( event ); - - switch ( state ) { - - case STATE.TOUCH_ROTATE: - - if ( scope.enableRotate === false ) return; - - handleTouchMoveRotate( event ); - - scope.update(); - - break; - - case STATE.TOUCH_PAN: - - if ( scope.enablePan === false ) return; - - handleTouchMovePan( event ); - - scope.update(); - - break; - - case STATE.TOUCH_DOLLY_PAN: - - if ( scope.enableZoom === false && scope.enablePan === false ) return; - - handleTouchMoveDollyPan( event ); - - scope.update(); - - break; - - case STATE.TOUCH_DOLLY_ROTATE: - - if ( scope.enableZoom === false && scope.enableRotate === false ) return; - - handleTouchMoveDollyRotate( event ); - - scope.update(); - - break; - - default: - - state = STATE.NONE; - - } - - } - - function onContextMenu( event ) { - - if ( scope.enabled === false ) return; - - event.preventDefault(); - - } - - function addPointer( event ) { - - pointers.push( event.pointerId ); - - } - - function removePointer( event ) { - - delete pointerPositions[ event.pointerId ]; - - for ( let i = 0; i < pointers.length; i ++ ) { - - if ( pointers[ i ] == event.pointerId ) { - - pointers.splice( i, 1 ); - return; - - } - - } - - } - - function isTrackingPointer( event ) { - - for ( let i = 0; i < pointers.length; i ++ ) { - - if ( pointers[ i ] == event.pointerId ) return true; - - } - - return false; - - } - - function trackPointer( event ) { - - let position = pointerPositions[ event.pointerId ]; - - if ( position === undefined ) { - - position = new Vector2(); - pointerPositions[ event.pointerId ] = position; - - } - - position.set( event.pageX, event.pageY ); - - } - - function getSecondPointerPosition( event ) { - - const pointerId = ( event.pointerId === pointers[ 0 ] ) ? pointers[ 1 ] : pointers[ 0 ]; - - return pointerPositions[ pointerId ]; - - } - - // - - scope.domElement.addEventListener( 'contextmenu', onContextMenu ); - - scope.domElement.addEventListener( 'pointerdown', onPointerDown ); - scope.domElement.addEventListener( 'pointercancel', onPointerUp ); - scope.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } ); - - const document = scope.domElement.getRootNode(); // offscreen canvas compatibility - - document.addEventListener( 'keydown', interceptControlDown, { passive: true, capture: true } ); - - // force an update at start - - this.update(); - - } - -} - -export { OrbitControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/PointerLockControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/PointerLockControls.js deleted file mode 100644 index 431f7f9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/PointerLockControls.js +++ /dev/null @@ -1,162 +0,0 @@ -import { - Euler, - EventDispatcher, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _euler = new Euler( 0, 0, 0, 'YXZ' ); -const _vector = new Vector3(); - -const _changeEvent = { type: 'change' }; -const _lockEvent = { type: 'lock' }; -const _unlockEvent = { type: 'unlock' }; - -const _PI_2 = Math.PI / 2; - -class PointerLockControls extends EventDispatcher { - - constructor( camera, domElement ) { - - super(); - - this.camera = camera; - this.domElement = domElement; - - this.isLocked = false; - - // Set to constrain the pitch of the camera - // Range is 0 to Math.PI radians - this.minPolarAngle = 0; // radians - this.maxPolarAngle = Math.PI; // radians - - this.pointerSpeed = 1.0; - - this._onMouseMove = onMouseMove.bind( this ); - this._onPointerlockChange = onPointerlockChange.bind( this ); - this._onPointerlockError = onPointerlockError.bind( this ); - - this.connect(); - - } - - connect() { - - this.domElement.ownerDocument.addEventListener( 'mousemove', this._onMouseMove ); - this.domElement.ownerDocument.addEventListener( 'pointerlockchange', this._onPointerlockChange ); - this.domElement.ownerDocument.addEventListener( 'pointerlockerror', this._onPointerlockError ); - - } - - disconnect() { - - this.domElement.ownerDocument.removeEventListener( 'mousemove', this._onMouseMove ); - this.domElement.ownerDocument.removeEventListener( 'pointerlockchange', this._onPointerlockChange ); - this.domElement.ownerDocument.removeEventListener( 'pointerlockerror', this._onPointerlockError ); - - } - - dispose() { - - this.disconnect(); - - } - - getObject() { // retaining this method for backward compatibility - - return this.camera; - - } - - getDirection( v ) { - - return v.set( 0, 0, - 1 ).applyQuaternion( this.camera.quaternion ); - - } - - moveForward( distance ) { - - // move forward parallel to the xz-plane - // assumes camera.up is y-up - - const camera = this.camera; - - _vector.setFromMatrixColumn( camera.matrix, 0 ); - - _vector.crossVectors( camera.up, _vector ); - - camera.position.addScaledVector( _vector, distance ); - - } - - moveRight( distance ) { - - const camera = this.camera; - - _vector.setFromMatrixColumn( camera.matrix, 0 ); - - camera.position.addScaledVector( _vector, distance ); - - } - - lock() { - - this.domElement.requestPointerLock(); - - } - - unlock() { - - this.domElement.ownerDocument.exitPointerLock(); - - } - -} - -// event listeners - -function onMouseMove( event ) { - - if ( this.isLocked === false ) return; - - const movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; - const movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; - - const camera = this.camera; - _euler.setFromQuaternion( camera.quaternion ); - - _euler.y -= movementX * 0.002 * this.pointerSpeed; - _euler.x -= movementY * 0.002 * this.pointerSpeed; - - _euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) ); - - camera.quaternion.setFromEuler( _euler ); - - this.dispatchEvent( _changeEvent ); - -} - -function onPointerlockChange() { - - if ( this.domElement.ownerDocument.pointerLockElement === this.domElement ) { - - this.dispatchEvent( _lockEvent ); - - this.isLocked = true; - - } else { - - this.dispatchEvent( _unlockEvent ); - - this.isLocked = false; - - } - -} - -function onPointerlockError() { - - console.error( 'THREE.PointerLockControls: Unable to use Pointer Lock API' ); - -} - -export { PointerLockControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TrackballControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TrackballControls.js deleted file mode 100644 index eb463f3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TrackballControls.js +++ /dev/null @@ -1,828 +0,0 @@ -import { - EventDispatcher, - MathUtils, - MOUSE, - Quaternion, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _changeEvent = { type: 'change' }; -const _startEvent = { type: 'start' }; -const _endEvent = { type: 'end' }; - -class TrackballControls extends EventDispatcher { - - constructor( object, domElement ) { - - super(); - - const scope = this; - const STATE = { NONE: - 1, ROTATE: 0, ZOOM: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_ZOOM_PAN: 4 }; - - this.object = object; - this.domElement = domElement; - this.domElement.style.touchAction = 'none'; // disable touch scroll - - // API - - this.enabled = true; - - this.screen = { left: 0, top: 0, width: 0, height: 0 }; - - this.rotateSpeed = 1.0; - this.zoomSpeed = 1.2; - this.panSpeed = 0.3; - - this.noRotate = false; - this.noZoom = false; - this.noPan = false; - - this.staticMoving = false; - this.dynamicDampingFactor = 0.2; - - this.minDistance = 0; - this.maxDistance = Infinity; - - this.minZoom = 0; - this.maxZoom = Infinity; - - this.keys = [ 'KeyA' /*A*/, 'KeyS' /*S*/, 'KeyD' /*D*/ ]; - - this.mouseButtons = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.DOLLY, RIGHT: MOUSE.PAN }; - - // internals - - this.target = new Vector3(); - - const EPS = 0.000001; - - const lastPosition = new Vector3(); - let lastZoom = 1; - - let _state = STATE.NONE, - _keyState = STATE.NONE, - - _touchZoomDistanceStart = 0, - _touchZoomDistanceEnd = 0, - - _lastAngle = 0; - - const _eye = new Vector3(), - - _movePrev = new Vector2(), - _moveCurr = new Vector2(), - - _lastAxis = new Vector3(), - - _zoomStart = new Vector2(), - _zoomEnd = new Vector2(), - - _panStart = new Vector2(), - _panEnd = new Vector2(), - - _pointers = [], - _pointerPositions = {}; - - // for reset - - this.target0 = this.target.clone(); - this.position0 = this.object.position.clone(); - this.up0 = this.object.up.clone(); - this.zoom0 = this.object.zoom; - - // methods - - this.handleResize = function () { - - const box = scope.domElement.getBoundingClientRect(); - // adjustments come from similar code in the jquery offset() function - const d = scope.domElement.ownerDocument.documentElement; - scope.screen.left = box.left + window.pageXOffset - d.clientLeft; - scope.screen.top = box.top + window.pageYOffset - d.clientTop; - scope.screen.width = box.width; - scope.screen.height = box.height; - - }; - - const getMouseOnScreen = ( function () { - - const vector = new Vector2(); - - return function getMouseOnScreen( pageX, pageY ) { - - vector.set( - ( pageX - scope.screen.left ) / scope.screen.width, - ( pageY - scope.screen.top ) / scope.screen.height - ); - - return vector; - - }; - - }() ); - - const getMouseOnCircle = ( function () { - - const vector = new Vector2(); - - return function getMouseOnCircle( pageX, pageY ) { - - vector.set( - ( ( pageX - scope.screen.width * 0.5 - scope.screen.left ) / ( scope.screen.width * 0.5 ) ), - ( ( scope.screen.height + 2 * ( scope.screen.top - pageY ) ) / scope.screen.width ) // screen.width intentional - ); - - return vector; - - }; - - }() ); - - this.rotateCamera = ( function () { - - const axis = new Vector3(), - quaternion = new Quaternion(), - eyeDirection = new Vector3(), - objectUpDirection = new Vector3(), - objectSidewaysDirection = new Vector3(), - moveDirection = new Vector3(); - - return function rotateCamera() { - - moveDirection.set( _moveCurr.x - _movePrev.x, _moveCurr.y - _movePrev.y, 0 ); - let angle = moveDirection.length(); - - if ( angle ) { - - _eye.copy( scope.object.position ).sub( scope.target ); - - eyeDirection.copy( _eye ).normalize(); - objectUpDirection.copy( scope.object.up ).normalize(); - objectSidewaysDirection.crossVectors( objectUpDirection, eyeDirection ).normalize(); - - objectUpDirection.setLength( _moveCurr.y - _movePrev.y ); - objectSidewaysDirection.setLength( _moveCurr.x - _movePrev.x ); - - moveDirection.copy( objectUpDirection.add( objectSidewaysDirection ) ); - - axis.crossVectors( moveDirection, _eye ).normalize(); - - angle *= scope.rotateSpeed; - quaternion.setFromAxisAngle( axis, angle ); - - _eye.applyQuaternion( quaternion ); - scope.object.up.applyQuaternion( quaternion ); - - _lastAxis.copy( axis ); - _lastAngle = angle; - - } else if ( ! scope.staticMoving && _lastAngle ) { - - _lastAngle *= Math.sqrt( 1.0 - scope.dynamicDampingFactor ); - _eye.copy( scope.object.position ).sub( scope.target ); - quaternion.setFromAxisAngle( _lastAxis, _lastAngle ); - _eye.applyQuaternion( quaternion ); - scope.object.up.applyQuaternion( quaternion ); - - } - - _movePrev.copy( _moveCurr ); - - }; - - }() ); - - - this.zoomCamera = function () { - - let factor; - - if ( _state === STATE.TOUCH_ZOOM_PAN ) { - - factor = _touchZoomDistanceStart / _touchZoomDistanceEnd; - _touchZoomDistanceStart = _touchZoomDistanceEnd; - - if ( scope.object.isPerspectiveCamera ) { - - _eye.multiplyScalar( factor ); - - } else if ( scope.object.isOrthographicCamera ) { - - scope.object.zoom = MathUtils.clamp( scope.object.zoom / factor, scope.minZoom, scope.maxZoom ); - - if ( lastZoom !== scope.object.zoom ) { - - scope.object.updateProjectionMatrix(); - - } - - } else { - - console.warn( 'THREE.TrackballControls: Unsupported camera type' ); - - } - - } else { - - factor = 1.0 + ( _zoomEnd.y - _zoomStart.y ) * scope.zoomSpeed; - - if ( factor !== 1.0 && factor > 0.0 ) { - - if ( scope.object.isPerspectiveCamera ) { - - _eye.multiplyScalar( factor ); - - } else if ( scope.object.isOrthographicCamera ) { - - scope.object.zoom = MathUtils.clamp( scope.object.zoom / factor, scope.minZoom, scope.maxZoom ); - - if ( lastZoom !== scope.object.zoom ) { - - scope.object.updateProjectionMatrix(); - - } - - } else { - - console.warn( 'THREE.TrackballControls: Unsupported camera type' ); - - } - - } - - if ( scope.staticMoving ) { - - _zoomStart.copy( _zoomEnd ); - - } else { - - _zoomStart.y += ( _zoomEnd.y - _zoomStart.y ) * this.dynamicDampingFactor; - - } - - } - - }; - - this.panCamera = ( function () { - - const mouseChange = new Vector2(), - objectUp = new Vector3(), - pan = new Vector3(); - - return function panCamera() { - - mouseChange.copy( _panEnd ).sub( _panStart ); - - if ( mouseChange.lengthSq() ) { - - if ( scope.object.isOrthographicCamera ) { - - const scale_x = ( scope.object.right - scope.object.left ) / scope.object.zoom / scope.domElement.clientWidth; - const scale_y = ( scope.object.top - scope.object.bottom ) / scope.object.zoom / scope.domElement.clientWidth; - - mouseChange.x *= scale_x; - mouseChange.y *= scale_y; - - } - - mouseChange.multiplyScalar( _eye.length() * scope.panSpeed ); - - pan.copy( _eye ).cross( scope.object.up ).setLength( mouseChange.x ); - pan.add( objectUp.copy( scope.object.up ).setLength( mouseChange.y ) ); - - scope.object.position.add( pan ); - scope.target.add( pan ); - - if ( scope.staticMoving ) { - - _panStart.copy( _panEnd ); - - } else { - - _panStart.add( mouseChange.subVectors( _panEnd, _panStart ).multiplyScalar( scope.dynamicDampingFactor ) ); - - } - - } - - }; - - }() ); - - this.checkDistances = function () { - - if ( ! scope.noZoom || ! scope.noPan ) { - - if ( _eye.lengthSq() > scope.maxDistance * scope.maxDistance ) { - - scope.object.position.addVectors( scope.target, _eye.setLength( scope.maxDistance ) ); - _zoomStart.copy( _zoomEnd ); - - } - - if ( _eye.lengthSq() < scope.minDistance * scope.minDistance ) { - - scope.object.position.addVectors( scope.target, _eye.setLength( scope.minDistance ) ); - _zoomStart.copy( _zoomEnd ); - - } - - } - - }; - - this.update = function () { - - _eye.subVectors( scope.object.position, scope.target ); - - if ( ! scope.noRotate ) { - - scope.rotateCamera(); - - } - - if ( ! scope.noZoom ) { - - scope.zoomCamera(); - - } - - if ( ! scope.noPan ) { - - scope.panCamera(); - - } - - scope.object.position.addVectors( scope.target, _eye ); - - if ( scope.object.isPerspectiveCamera ) { - - scope.checkDistances(); - - scope.object.lookAt( scope.target ); - - if ( lastPosition.distanceToSquared( scope.object.position ) > EPS ) { - - scope.dispatchEvent( _changeEvent ); - - lastPosition.copy( scope.object.position ); - - } - - } else if ( scope.object.isOrthographicCamera ) { - - scope.object.lookAt( scope.target ); - - if ( lastPosition.distanceToSquared( scope.object.position ) > EPS || lastZoom !== scope.object.zoom ) { - - scope.dispatchEvent( _changeEvent ); - - lastPosition.copy( scope.object.position ); - lastZoom = scope.object.zoom; - - } - - } else { - - console.warn( 'THREE.TrackballControls: Unsupported camera type' ); - - } - - }; - - this.reset = function () { - - _state = STATE.NONE; - _keyState = STATE.NONE; - - scope.target.copy( scope.target0 ); - scope.object.position.copy( scope.position0 ); - scope.object.up.copy( scope.up0 ); - scope.object.zoom = scope.zoom0; - - scope.object.updateProjectionMatrix(); - - _eye.subVectors( scope.object.position, scope.target ); - - scope.object.lookAt( scope.target ); - - scope.dispatchEvent( _changeEvent ); - - lastPosition.copy( scope.object.position ); - lastZoom = scope.object.zoom; - - }; - - // listeners - - function onPointerDown( event ) { - - if ( scope.enabled === false ) return; - - if ( _pointers.length === 0 ) { - - scope.domElement.setPointerCapture( event.pointerId ); - - scope.domElement.addEventListener( 'pointermove', onPointerMove ); - scope.domElement.addEventListener( 'pointerup', onPointerUp ); - - } - - // - - addPointer( event ); - - if ( event.pointerType === 'touch' ) { - - onTouchStart( event ); - - } else { - - onMouseDown( event ); - - } - - } - - function onPointerMove( event ) { - - if ( scope.enabled === false ) return; - - if ( event.pointerType === 'touch' ) { - - onTouchMove( event ); - - } else { - - onMouseMove( event ); - - } - - } - - function onPointerUp( event ) { - - if ( scope.enabled === false ) return; - - if ( event.pointerType === 'touch' ) { - - onTouchEnd( event ); - - } else { - - onMouseUp(); - - } - - // - - removePointer( event ); - - if ( _pointers.length === 0 ) { - - scope.domElement.releasePointerCapture( event.pointerId ); - - scope.domElement.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.removeEventListener( 'pointerup', onPointerUp ); - - } - - - } - - function onPointerCancel( event ) { - - removePointer( event ); - - } - - function keydown( event ) { - - if ( scope.enabled === false ) return; - - window.removeEventListener( 'keydown', keydown ); - - if ( _keyState !== STATE.NONE ) { - - return; - - } else if ( event.code === scope.keys[ STATE.ROTATE ] && ! scope.noRotate ) { - - _keyState = STATE.ROTATE; - - } else if ( event.code === scope.keys[ STATE.ZOOM ] && ! scope.noZoom ) { - - _keyState = STATE.ZOOM; - - } else if ( event.code === scope.keys[ STATE.PAN ] && ! scope.noPan ) { - - _keyState = STATE.PAN; - - } - - } - - function keyup() { - - if ( scope.enabled === false ) return; - - _keyState = STATE.NONE; - - window.addEventListener( 'keydown', keydown ); - - } - - function onMouseDown( event ) { - - if ( _state === STATE.NONE ) { - - switch ( event.button ) { - - case scope.mouseButtons.LEFT: - _state = STATE.ROTATE; - break; - - case scope.mouseButtons.MIDDLE: - _state = STATE.ZOOM; - break; - - case scope.mouseButtons.RIGHT: - _state = STATE.PAN; - break; - - } - - } - - const state = ( _keyState !== STATE.NONE ) ? _keyState : _state; - - if ( state === STATE.ROTATE && ! scope.noRotate ) { - - _moveCurr.copy( getMouseOnCircle( event.pageX, event.pageY ) ); - _movePrev.copy( _moveCurr ); - - } else if ( state === STATE.ZOOM && ! scope.noZoom ) { - - _zoomStart.copy( getMouseOnScreen( event.pageX, event.pageY ) ); - _zoomEnd.copy( _zoomStart ); - - } else if ( state === STATE.PAN && ! scope.noPan ) { - - _panStart.copy( getMouseOnScreen( event.pageX, event.pageY ) ); - _panEnd.copy( _panStart ); - - } - - scope.dispatchEvent( _startEvent ); - - } - - function onMouseMove( event ) { - - const state = ( _keyState !== STATE.NONE ) ? _keyState : _state; - - if ( state === STATE.ROTATE && ! scope.noRotate ) { - - _movePrev.copy( _moveCurr ); - _moveCurr.copy( getMouseOnCircle( event.pageX, event.pageY ) ); - - } else if ( state === STATE.ZOOM && ! scope.noZoom ) { - - _zoomEnd.copy( getMouseOnScreen( event.pageX, event.pageY ) ); - - } else if ( state === STATE.PAN && ! scope.noPan ) { - - _panEnd.copy( getMouseOnScreen( event.pageX, event.pageY ) ); - - } - - } - - function onMouseUp() { - - _state = STATE.NONE; - - scope.dispatchEvent( _endEvent ); - - } - - function onMouseWheel( event ) { - - if ( scope.enabled === false ) return; - - if ( scope.noZoom === true ) return; - - event.preventDefault(); - - switch ( event.deltaMode ) { - - case 2: - // Zoom in pages - _zoomStart.y -= event.deltaY * 0.025; - break; - - case 1: - // Zoom in lines - _zoomStart.y -= event.deltaY * 0.01; - break; - - default: - // undefined, 0, assume pixels - _zoomStart.y -= event.deltaY * 0.00025; - break; - - } - - scope.dispatchEvent( _startEvent ); - scope.dispatchEvent( _endEvent ); - - } - - function onTouchStart( event ) { - - trackPointer( event ); - - switch ( _pointers.length ) { - - case 1: - _state = STATE.TOUCH_ROTATE; - _moveCurr.copy( getMouseOnCircle( _pointers[ 0 ].pageX, _pointers[ 0 ].pageY ) ); - _movePrev.copy( _moveCurr ); - break; - - default: // 2 or more - _state = STATE.TOUCH_ZOOM_PAN; - const dx = _pointers[ 0 ].pageX - _pointers[ 1 ].pageX; - const dy = _pointers[ 0 ].pageY - _pointers[ 1 ].pageY; - _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt( dx * dx + dy * dy ); - - const x = ( _pointers[ 0 ].pageX + _pointers[ 1 ].pageX ) / 2; - const y = ( _pointers[ 0 ].pageY + _pointers[ 1 ].pageY ) / 2; - _panStart.copy( getMouseOnScreen( x, y ) ); - _panEnd.copy( _panStart ); - break; - - } - - scope.dispatchEvent( _startEvent ); - - } - - function onTouchMove( event ) { - - trackPointer( event ); - - switch ( _pointers.length ) { - - case 1: - _movePrev.copy( _moveCurr ); - _moveCurr.copy( getMouseOnCircle( event.pageX, event.pageY ) ); - break; - - default: // 2 or more - - const position = getSecondPointerPosition( event ); - - const dx = event.pageX - position.x; - const dy = event.pageY - position.y; - _touchZoomDistanceEnd = Math.sqrt( dx * dx + dy * dy ); - - const x = ( event.pageX + position.x ) / 2; - const y = ( event.pageY + position.y ) / 2; - _panEnd.copy( getMouseOnScreen( x, y ) ); - break; - - } - - } - - function onTouchEnd( event ) { - - switch ( _pointers.length ) { - - case 0: - _state = STATE.NONE; - break; - - case 1: - _state = STATE.TOUCH_ROTATE; - _moveCurr.copy( getMouseOnCircle( event.pageX, event.pageY ) ); - _movePrev.copy( _moveCurr ); - break; - - case 2: - _state = STATE.TOUCH_ZOOM_PAN; - - for ( let i = 0; i < _pointers.length; i ++ ) { - - if ( _pointers[ i ].pointerId !== event.pointerId ) { - - const position = _pointerPositions[ _pointers[ i ].pointerId ]; - _moveCurr.copy( getMouseOnCircle( position.x, position.y ) ); - _movePrev.copy( _moveCurr ); - break; - - } - - } - - break; - - } - - scope.dispatchEvent( _endEvent ); - - } - - function contextmenu( event ) { - - if ( scope.enabled === false ) return; - - event.preventDefault(); - - } - - function addPointer( event ) { - - _pointers.push( event ); - - } - - function removePointer( event ) { - - delete _pointerPositions[ event.pointerId ]; - - for ( let i = 0; i < _pointers.length; i ++ ) { - - if ( _pointers[ i ].pointerId == event.pointerId ) { - - _pointers.splice( i, 1 ); - return; - - } - - } - - } - - function trackPointer( event ) { - - let position = _pointerPositions[ event.pointerId ]; - - if ( position === undefined ) { - - position = new Vector2(); - _pointerPositions[ event.pointerId ] = position; - - } - - position.set( event.pageX, event.pageY ); - - } - - function getSecondPointerPosition( event ) { - - const pointer = ( event.pointerId === _pointers[ 0 ].pointerId ) ? _pointers[ 1 ] : _pointers[ 0 ]; - - return _pointerPositions[ pointer.pointerId ]; - - } - - this.dispose = function () { - - scope.domElement.removeEventListener( 'contextmenu', contextmenu ); - - scope.domElement.removeEventListener( 'pointerdown', onPointerDown ); - scope.domElement.removeEventListener( 'pointercancel', onPointerCancel ); - scope.domElement.removeEventListener( 'wheel', onMouseWheel ); - - scope.domElement.removeEventListener( 'pointermove', onPointerMove ); - scope.domElement.removeEventListener( 'pointerup', onPointerUp ); - - window.removeEventListener( 'keydown', keydown ); - window.removeEventListener( 'keyup', keyup ); - - }; - - this.domElement.addEventListener( 'contextmenu', contextmenu ); - - this.domElement.addEventListener( 'pointerdown', onPointerDown ); - this.domElement.addEventListener( 'pointercancel', onPointerCancel ); - this.domElement.addEventListener( 'wheel', onMouseWheel, { passive: false } ); - - - window.addEventListener( 'keydown', keydown ); - window.addEventListener( 'keyup', keyup ); - - this.handleResize(); - - // force an update at start - this.update(); - - } - -} - -export { TrackballControls }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TransformControls.js b/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TransformControls.js deleted file mode 100644 index b67b71c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/controls/TransformControls.js +++ /dev/null @@ -1,1573 +0,0 @@ -import { - BoxGeometry, - BufferGeometry, - CylinderGeometry, - DoubleSide, - Euler, - Float32BufferAttribute, - Line, - LineBasicMaterial, - Matrix4, - Mesh, - MeshBasicMaterial, - Object3D, - OctahedronGeometry, - PlaneGeometry, - Quaternion, - Raycaster, - SphereGeometry, - TorusGeometry, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _raycaster = new Raycaster(); - -const _tempVector = new Vector3(); -const _tempVector2 = new Vector3(); -const _tempQuaternion = new Quaternion(); -const _unit = { - X: new Vector3( 1, 0, 0 ), - Y: new Vector3( 0, 1, 0 ), - Z: new Vector3( 0, 0, 1 ) -}; - -const _changeEvent = { type: 'change' }; -const _mouseDownEvent = { type: 'mouseDown', mode: null }; -const _mouseUpEvent = { type: 'mouseUp', mode: null }; -const _objectChangeEvent = { type: 'objectChange' }; - -class TransformControls extends Object3D { - - constructor( camera, domElement ) { - - super(); - - if ( domElement === undefined ) { - - console.warn( 'THREE.TransformControls: The second parameter "domElement" is now mandatory.' ); - domElement = document; - - } - - this.isTransformControls = true; - - this.visible = false; - this.domElement = domElement; - this.domElement.style.touchAction = 'none'; // disable touch scroll - - const _gizmo = new TransformControlsGizmo(); - this._gizmo = _gizmo; - this.add( _gizmo ); - - const _plane = new TransformControlsPlane(); - this._plane = _plane; - this.add( _plane ); - - const scope = this; - - // Defined getter, setter and store for a property - function defineProperty( propName, defaultValue ) { - - let propValue = defaultValue; - - Object.defineProperty( scope, propName, { - - get: function () { - - return propValue !== undefined ? propValue : defaultValue; - - }, - - set: function ( value ) { - - if ( propValue !== value ) { - - propValue = value; - _plane[ propName ] = value; - _gizmo[ propName ] = value; - - scope.dispatchEvent( { type: propName + '-changed', value: value } ); - scope.dispatchEvent( _changeEvent ); - - } - - } - - } ); - - scope[ propName ] = defaultValue; - _plane[ propName ] = defaultValue; - _gizmo[ propName ] = defaultValue; - - } - - // Define properties with getters/setter - // Setting the defined property will automatically trigger change event - // Defined properties are passed down to gizmo and plane - - defineProperty( 'camera', camera ); - defineProperty( 'object', undefined ); - defineProperty( 'enabled', true ); - defineProperty( 'axis', null ); - defineProperty( 'mode', 'translate' ); - defineProperty( 'translationSnap', null ); - defineProperty( 'rotationSnap', null ); - defineProperty( 'scaleSnap', null ); - defineProperty( 'space', 'world' ); - defineProperty( 'size', 1 ); - defineProperty( 'dragging', false ); - defineProperty( 'showX', true ); - defineProperty( 'showY', true ); - defineProperty( 'showZ', true ); - - // Reusable utility variables - - const worldPosition = new Vector3(); - const worldPositionStart = new Vector3(); - const worldQuaternion = new Quaternion(); - const worldQuaternionStart = new Quaternion(); - const cameraPosition = new Vector3(); - const cameraQuaternion = new Quaternion(); - const pointStart = new Vector3(); - const pointEnd = new Vector3(); - const rotationAxis = new Vector3(); - const rotationAngle = 0; - const eye = new Vector3(); - - // TODO: remove properties unused in plane and gizmo - - defineProperty( 'worldPosition', worldPosition ); - defineProperty( 'worldPositionStart', worldPositionStart ); - defineProperty( 'worldQuaternion', worldQuaternion ); - defineProperty( 'worldQuaternionStart', worldQuaternionStart ); - defineProperty( 'cameraPosition', cameraPosition ); - defineProperty( 'cameraQuaternion', cameraQuaternion ); - defineProperty( 'pointStart', pointStart ); - defineProperty( 'pointEnd', pointEnd ); - defineProperty( 'rotationAxis', rotationAxis ); - defineProperty( 'rotationAngle', rotationAngle ); - defineProperty( 'eye', eye ); - - this._offset = new Vector3(); - this._startNorm = new Vector3(); - this._endNorm = new Vector3(); - this._cameraScale = new Vector3(); - - this._parentPosition = new Vector3(); - this._parentQuaternion = new Quaternion(); - this._parentQuaternionInv = new Quaternion(); - this._parentScale = new Vector3(); - - this._worldScaleStart = new Vector3(); - this._worldQuaternionInv = new Quaternion(); - this._worldScale = new Vector3(); - - this._positionStart = new Vector3(); - this._quaternionStart = new Quaternion(); - this._scaleStart = new Vector3(); - - this._getPointer = getPointer.bind( this ); - this._onPointerDown = onPointerDown.bind( this ); - this._onPointerHover = onPointerHover.bind( this ); - this._onPointerMove = onPointerMove.bind( this ); - this._onPointerUp = onPointerUp.bind( this ); - - this.domElement.addEventListener( 'pointerdown', this._onPointerDown ); - this.domElement.addEventListener( 'pointermove', this._onPointerHover ); - this.domElement.addEventListener( 'pointerup', this._onPointerUp ); - - } - - // updateMatrixWorld updates key transformation variables - updateMatrixWorld( force ) { - - if ( this.object !== undefined ) { - - this.object.updateMatrixWorld(); - - if ( this.object.parent === null ) { - - console.error( 'TransformControls: The attached 3D object must be a part of the scene graph.' ); - - } else { - - this.object.parent.matrixWorld.decompose( this._parentPosition, this._parentQuaternion, this._parentScale ); - - } - - this.object.matrixWorld.decompose( this.worldPosition, this.worldQuaternion, this._worldScale ); - - this._parentQuaternionInv.copy( this._parentQuaternion ).invert(); - this._worldQuaternionInv.copy( this.worldQuaternion ).invert(); - - } - - this.camera.updateMatrixWorld(); - this.camera.matrixWorld.decompose( this.cameraPosition, this.cameraQuaternion, this._cameraScale ); - - if ( this.camera.isOrthographicCamera ) { - - this.camera.getWorldDirection( this.eye ).negate(); - - } else { - - this.eye.copy( this.cameraPosition ).sub( this.worldPosition ).normalize(); - - } - - super.updateMatrixWorld( force ); - - } - - pointerHover( pointer ) { - - if ( this.object === undefined || this.dragging === true ) return; - - if ( pointer !== null ) _raycaster.setFromCamera( pointer, this.camera ); - - const intersect = intersectObjectWithRay( this._gizmo.picker[ this.mode ], _raycaster ); - - if ( intersect ) { - - this.axis = intersect.object.name; - - } else { - - this.axis = null; - - } - - } - - pointerDown( pointer ) { - - if ( this.object === undefined || this.dragging === true || ( pointer != null && pointer.button !== 0 ) ) return; - - if ( this.axis !== null ) { - - if ( pointer !== null ) _raycaster.setFromCamera( pointer, this.camera ); - - const planeIntersect = intersectObjectWithRay( this._plane, _raycaster, true ); - - if ( planeIntersect ) { - - this.object.updateMatrixWorld(); - this.object.parent.updateMatrixWorld(); - - this._positionStart.copy( this.object.position ); - this._quaternionStart.copy( this.object.quaternion ); - this._scaleStart.copy( this.object.scale ); - - this.object.matrixWorld.decompose( this.worldPositionStart, this.worldQuaternionStart, this._worldScaleStart ); - - this.pointStart.copy( planeIntersect.point ).sub( this.worldPositionStart ); - - } - - this.dragging = true; - _mouseDownEvent.mode = this.mode; - this.dispatchEvent( _mouseDownEvent ); - - } - - } - - pointerMove( pointer ) { - - const axis = this.axis; - const mode = this.mode; - const object = this.object; - let space = this.space; - - if ( mode === 'scale' ) { - - space = 'local'; - - } else if ( axis === 'E' || axis === 'XYZE' || axis === 'XYZ' ) { - - space = 'world'; - - } - - if ( object === undefined || axis === null || this.dragging === false || ( pointer !== null && pointer.button !== - 1 ) ) return; - - if ( pointer !== null ) _raycaster.setFromCamera( pointer, this.camera ); - - const planeIntersect = intersectObjectWithRay( this._plane, _raycaster, true ); - - if ( ! planeIntersect ) return; - - this.pointEnd.copy( planeIntersect.point ).sub( this.worldPositionStart ); - - if ( mode === 'translate' ) { - - // Apply translate - - this._offset.copy( this.pointEnd ).sub( this.pointStart ); - - if ( space === 'local' && axis !== 'XYZ' ) { - - this._offset.applyQuaternion( this._worldQuaternionInv ); - - } - - if ( axis.indexOf( 'X' ) === - 1 ) this._offset.x = 0; - if ( axis.indexOf( 'Y' ) === - 1 ) this._offset.y = 0; - if ( axis.indexOf( 'Z' ) === - 1 ) this._offset.z = 0; - - if ( space === 'local' && axis !== 'XYZ' ) { - - this._offset.applyQuaternion( this._quaternionStart ).divide( this._parentScale ); - - } else { - - this._offset.applyQuaternion( this._parentQuaternionInv ).divide( this._parentScale ); - - } - - object.position.copy( this._offset ).add( this._positionStart ); - - // Apply translation snap - - if ( this.translationSnap ) { - - if ( space === 'local' ) { - - object.position.applyQuaternion( _tempQuaternion.copy( this._quaternionStart ).invert() ); - - if ( axis.search( 'X' ) !== - 1 ) { - - object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap; - - } - - if ( axis.search( 'Y' ) !== - 1 ) { - - object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap; - - } - - if ( axis.search( 'Z' ) !== - 1 ) { - - object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap; - - } - - object.position.applyQuaternion( this._quaternionStart ); - - } - - if ( space === 'world' ) { - - if ( object.parent ) { - - object.position.add( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) ); - - } - - if ( axis.search( 'X' ) !== - 1 ) { - - object.position.x = Math.round( object.position.x / this.translationSnap ) * this.translationSnap; - - } - - if ( axis.search( 'Y' ) !== - 1 ) { - - object.position.y = Math.round( object.position.y / this.translationSnap ) * this.translationSnap; - - } - - if ( axis.search( 'Z' ) !== - 1 ) { - - object.position.z = Math.round( object.position.z / this.translationSnap ) * this.translationSnap; - - } - - if ( object.parent ) { - - object.position.sub( _tempVector.setFromMatrixPosition( object.parent.matrixWorld ) ); - - } - - } - - } - - } else if ( mode === 'scale' ) { - - if ( axis.search( 'XYZ' ) !== - 1 ) { - - let d = this.pointEnd.length() / this.pointStart.length(); - - if ( this.pointEnd.dot( this.pointStart ) < 0 ) d *= - 1; - - _tempVector2.set( d, d, d ); - - } else { - - _tempVector.copy( this.pointStart ); - _tempVector2.copy( this.pointEnd ); - - _tempVector.applyQuaternion( this._worldQuaternionInv ); - _tempVector2.applyQuaternion( this._worldQuaternionInv ); - - _tempVector2.divide( _tempVector ); - - if ( axis.search( 'X' ) === - 1 ) { - - _tempVector2.x = 1; - - } - - if ( axis.search( 'Y' ) === - 1 ) { - - _tempVector2.y = 1; - - } - - if ( axis.search( 'Z' ) === - 1 ) { - - _tempVector2.z = 1; - - } - - } - - // Apply scale - - object.scale.copy( this._scaleStart ).multiply( _tempVector2 ); - - if ( this.scaleSnap ) { - - if ( axis.search( 'X' ) !== - 1 ) { - - object.scale.x = Math.round( object.scale.x / this.scaleSnap ) * this.scaleSnap || this.scaleSnap; - - } - - if ( axis.search( 'Y' ) !== - 1 ) { - - object.scale.y = Math.round( object.scale.y / this.scaleSnap ) * this.scaleSnap || this.scaleSnap; - - } - - if ( axis.search( 'Z' ) !== - 1 ) { - - object.scale.z = Math.round( object.scale.z / this.scaleSnap ) * this.scaleSnap || this.scaleSnap; - - } - - } - - } else if ( mode === 'rotate' ) { - - this._offset.copy( this.pointEnd ).sub( this.pointStart ); - - const ROTATION_SPEED = 20 / this.worldPosition.distanceTo( _tempVector.setFromMatrixPosition( this.camera.matrixWorld ) ); - - let _inPlaneRotation = false; - - if ( axis === 'XYZE' ) { - - this.rotationAxis.copy( this._offset ).cross( this.eye ).normalize(); - this.rotationAngle = this._offset.dot( _tempVector.copy( this.rotationAxis ).cross( this.eye ) ) * ROTATION_SPEED; - - } else if ( axis === 'X' || axis === 'Y' || axis === 'Z' ) { - - this.rotationAxis.copy( _unit[ axis ] ); - - _tempVector.copy( _unit[ axis ] ); - - if ( space === 'local' ) { - - _tempVector.applyQuaternion( this.worldQuaternion ); - - } - - _tempVector.cross( this.eye ); - - // When _tempVector is 0 after cross with this.eye the vectors are parallel and should use in-plane rotation logic. - if ( _tempVector.length() === 0 ) { - - _inPlaneRotation = true; - - } else { - - this.rotationAngle = this._offset.dot( _tempVector.normalize() ) * ROTATION_SPEED; - - } - - - } - - if ( axis === 'E' || _inPlaneRotation ) { - - this.rotationAxis.copy( this.eye ); - this.rotationAngle = this.pointEnd.angleTo( this.pointStart ); - - this._startNorm.copy( this.pointStart ).normalize(); - this._endNorm.copy( this.pointEnd ).normalize(); - - this.rotationAngle *= ( this._endNorm.cross( this._startNorm ).dot( this.eye ) < 0 ? 1 : - 1 ); - - } - - // Apply rotation snap - - if ( this.rotationSnap ) this.rotationAngle = Math.round( this.rotationAngle / this.rotationSnap ) * this.rotationSnap; - - // Apply rotate - if ( space === 'local' && axis !== 'E' && axis !== 'XYZE' ) { - - object.quaternion.copy( this._quaternionStart ); - object.quaternion.multiply( _tempQuaternion.setFromAxisAngle( this.rotationAxis, this.rotationAngle ) ).normalize(); - - } else { - - this.rotationAxis.applyQuaternion( this._parentQuaternionInv ); - object.quaternion.copy( _tempQuaternion.setFromAxisAngle( this.rotationAxis, this.rotationAngle ) ); - object.quaternion.multiply( this._quaternionStart ).normalize(); - - } - - } - - this.dispatchEvent( _changeEvent ); - this.dispatchEvent( _objectChangeEvent ); - - } - - pointerUp( pointer ) { - - if ( pointer !== null && pointer.button !== 0 ) return; - - if ( this.dragging && ( this.axis !== null ) ) { - - _mouseUpEvent.mode = this.mode; - this.dispatchEvent( _mouseUpEvent ); - - } - - this.dragging = false; - this.axis = null; - - } - - dispose() { - - this.domElement.removeEventListener( 'pointerdown', this._onPointerDown ); - this.domElement.removeEventListener( 'pointermove', this._onPointerHover ); - this.domElement.removeEventListener( 'pointermove', this._onPointerMove ); - this.domElement.removeEventListener( 'pointerup', this._onPointerUp ); - - this.traverse( function ( child ) { - - if ( child.geometry ) child.geometry.dispose(); - if ( child.material ) child.material.dispose(); - - } ); - - } - - // Set current object - attach( object ) { - - this.object = object; - this.visible = true; - - return this; - - } - - // Detach from object - detach() { - - this.object = undefined; - this.visible = false; - this.axis = null; - - return this; - - } - - reset() { - - if ( ! this.enabled ) return; - - if ( this.dragging ) { - - this.object.position.copy( this._positionStart ); - this.object.quaternion.copy( this._quaternionStart ); - this.object.scale.copy( this._scaleStart ); - - this.dispatchEvent( _changeEvent ); - this.dispatchEvent( _objectChangeEvent ); - - this.pointStart.copy( this.pointEnd ); - - } - - } - - getRaycaster() { - - return _raycaster; - - } - - // TODO: deprecate - - getMode() { - - return this.mode; - - } - - setMode( mode ) { - - this.mode = mode; - - } - - setTranslationSnap( translationSnap ) { - - this.translationSnap = translationSnap; - - } - - setRotationSnap( rotationSnap ) { - - this.rotationSnap = rotationSnap; - - } - - setScaleSnap( scaleSnap ) { - - this.scaleSnap = scaleSnap; - - } - - setSize( size ) { - - this.size = size; - - } - - setSpace( space ) { - - this.space = space; - - } - -} - -// mouse / touch event handlers - -function getPointer( event ) { - - if ( this.domElement.ownerDocument.pointerLockElement ) { - - return { - x: 0, - y: 0, - button: event.button - }; - - } else { - - const rect = this.domElement.getBoundingClientRect(); - - return { - x: ( event.clientX - rect.left ) / rect.width * 2 - 1, - y: - ( event.clientY - rect.top ) / rect.height * 2 + 1, - button: event.button - }; - - } - -} - -function onPointerHover( event ) { - - if ( ! this.enabled ) return; - - switch ( event.pointerType ) { - - case 'mouse': - case 'pen': - this.pointerHover( this._getPointer( event ) ); - break; - - } - -} - -function onPointerDown( event ) { - - if ( ! this.enabled ) return; - - if ( ! document.pointerLockElement ) { - - this.domElement.setPointerCapture( event.pointerId ); - - } - - this.domElement.addEventListener( 'pointermove', this._onPointerMove ); - - this.pointerHover( this._getPointer( event ) ); - this.pointerDown( this._getPointer( event ) ); - -} - -function onPointerMove( event ) { - - if ( ! this.enabled ) return; - - this.pointerMove( this._getPointer( event ) ); - -} - -function onPointerUp( event ) { - - if ( ! this.enabled ) return; - - this.domElement.releasePointerCapture( event.pointerId ); - - this.domElement.removeEventListener( 'pointermove', this._onPointerMove ); - - this.pointerUp( this._getPointer( event ) ); - -} - -function intersectObjectWithRay( object, raycaster, includeInvisible ) { - - const allIntersections = raycaster.intersectObject( object, true ); - - for ( let i = 0; i < allIntersections.length; i ++ ) { - - if ( allIntersections[ i ].object.visible || includeInvisible ) { - - return allIntersections[ i ]; - - } - - } - - return false; - -} - -// - -// Reusable utility variables - -const _tempEuler = new Euler(); -const _alignVector = new Vector3( 0, 1, 0 ); -const _zeroVector = new Vector3( 0, 0, 0 ); -const _lookAtMatrix = new Matrix4(); -const _tempQuaternion2 = new Quaternion(); -const _identityQuaternion = new Quaternion(); -const _dirVector = new Vector3(); -const _tempMatrix = new Matrix4(); - -const _unitX = new Vector3( 1, 0, 0 ); -const _unitY = new Vector3( 0, 1, 0 ); -const _unitZ = new Vector3( 0, 0, 1 ); - -const _v1 = new Vector3(); -const _v2 = new Vector3(); -const _v3 = new Vector3(); - -class TransformControlsGizmo extends Object3D { - - constructor() { - - super(); - - this.isTransformControlsGizmo = true; - - this.type = 'TransformControlsGizmo'; - - // shared materials - - const gizmoMaterial = new MeshBasicMaterial( { - depthTest: false, - depthWrite: false, - fog: false, - toneMapped: false, - transparent: true - } ); - - const gizmoLineMaterial = new LineBasicMaterial( { - depthTest: false, - depthWrite: false, - fog: false, - toneMapped: false, - transparent: true - } ); - - // Make unique material for each axis/color - - const matInvisible = gizmoMaterial.clone(); - matInvisible.opacity = 0.15; - - const matHelper = gizmoLineMaterial.clone(); - matHelper.opacity = 0.5; - - const matRed = gizmoMaterial.clone(); - matRed.color.setHex( 0xff0000 ); - - const matGreen = gizmoMaterial.clone(); - matGreen.color.setHex( 0x00ff00 ); - - const matBlue = gizmoMaterial.clone(); - matBlue.color.setHex( 0x0000ff ); - - const matRedTransparent = gizmoMaterial.clone(); - matRedTransparent.color.setHex( 0xff0000 ); - matRedTransparent.opacity = 0.5; - - const matGreenTransparent = gizmoMaterial.clone(); - matGreenTransparent.color.setHex( 0x00ff00 ); - matGreenTransparent.opacity = 0.5; - - const matBlueTransparent = gizmoMaterial.clone(); - matBlueTransparent.color.setHex( 0x0000ff ); - matBlueTransparent.opacity = 0.5; - - const matWhiteTransparent = gizmoMaterial.clone(); - matWhiteTransparent.opacity = 0.25; - - const matYellowTransparent = gizmoMaterial.clone(); - matYellowTransparent.color.setHex( 0xffff00 ); - matYellowTransparent.opacity = 0.25; - - const matYellow = gizmoMaterial.clone(); - matYellow.color.setHex( 0xffff00 ); - - const matGray = gizmoMaterial.clone(); - matGray.color.setHex( 0x787878 ); - - // reusable geometry - - const arrowGeometry = new CylinderGeometry( 0, 0.04, 0.1, 12 ); - arrowGeometry.translate( 0, 0.05, 0 ); - - const scaleHandleGeometry = new BoxGeometry( 0.08, 0.08, 0.08 ); - scaleHandleGeometry.translate( 0, 0.04, 0 ); - - const lineGeometry = new BufferGeometry(); - lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 1, 0, 0 ], 3 ) ); - - const lineGeometry2 = new CylinderGeometry( 0.0075, 0.0075, 0.5, 3 ); - lineGeometry2.translate( 0, 0.25, 0 ); - - function CircleGeometry( radius, arc ) { - - const geometry = new TorusGeometry( radius, 0.0075, 3, 64, arc * Math.PI * 2 ); - geometry.rotateY( Math.PI / 2 ); - geometry.rotateX( Math.PI / 2 ); - return geometry; - - } - - // Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position - - function TranslateHelperGeometry() { - - const geometry = new BufferGeometry(); - - geometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) ); - - return geometry; - - } - - // Gizmo definitions - custom hierarchy definitions for setupGizmo() function - - const gizmoTranslate = { - X: [ - [ new Mesh( arrowGeometry, matRed ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - [ new Mesh( arrowGeometry, matRed ), [ - 0.5, 0, 0 ], [ 0, 0, Math.PI / 2 ]], - [ new Mesh( lineGeometry2, matRed ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]] - ], - Y: [ - [ new Mesh( arrowGeometry, matGreen ), [ 0, 0.5, 0 ]], - [ new Mesh( arrowGeometry, matGreen ), [ 0, - 0.5, 0 ], [ Math.PI, 0, 0 ]], - [ new Mesh( lineGeometry2, matGreen ) ] - ], - Z: [ - [ new Mesh( arrowGeometry, matBlue ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]], - [ new Mesh( arrowGeometry, matBlue ), [ 0, 0, - 0.5 ], [ - Math.PI / 2, 0, 0 ]], - [ new Mesh( lineGeometry2, matBlue ), null, [ Math.PI / 2, 0, 0 ]] - ], - XYZ: [ - [ new Mesh( new OctahedronGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ]] - ], - XY: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matBlueTransparent.clone() ), [ 0.15, 0.15, 0 ]] - ], - YZ: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matRedTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]] - ], - XZ: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matGreenTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]] - ] - }; - - const pickerTranslate = { - X: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0.3, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ - 0.3, 0, 0 ], [ 0, 0, Math.PI / 2 ]] - ], - Y: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0.3, 0 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, - 0.3, 0 ], [ 0, 0, Math.PI ]] - ], - Z: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, 0.3 ], [ Math.PI / 2, 0, 0 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, - 0.3 ], [ - Math.PI / 2, 0, 0 ]] - ], - XYZ: [ - [ new Mesh( new OctahedronGeometry( 0.2, 0 ), matInvisible ) ] - ], - XY: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0.15, 0 ]] - ], - YZ: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]] - ], - XZ: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]] - ] - }; - - const helperTranslate = { - START: [ - [ new Mesh( new OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ] - ], - END: [ - [ new Mesh( new OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ] - ], - DELTA: [ - [ new Line( TranslateHelperGeometry(), matHelper ), null, null, null, 'helper' ] - ], - X: [ - [ new Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ] - ], - Y: [ - [ new Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ] - ], - Z: [ - [ new Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ] - ] - }; - - const gizmoRotate = { - XYZE: [ - [ new Mesh( CircleGeometry( 0.5, 1 ), matGray ), null, [ 0, Math.PI / 2, 0 ]] - ], - X: [ - [ new Mesh( CircleGeometry( 0.5, 0.5 ), matRed ) ] - ], - Y: [ - [ new Mesh( CircleGeometry( 0.5, 0.5 ), matGreen ), null, [ 0, 0, - Math.PI / 2 ]] - ], - Z: [ - [ new Mesh( CircleGeometry( 0.5, 0.5 ), matBlue ), null, [ 0, Math.PI / 2, 0 ]] - ], - E: [ - [ new Mesh( CircleGeometry( 0.75, 1 ), matYellowTransparent ), null, [ 0, Math.PI / 2, 0 ]] - ] - }; - - const helperRotate = { - AXIS: [ - [ new Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ] - ] - }; - - const pickerRotate = { - XYZE: [ - [ new Mesh( new SphereGeometry( 0.25, 10, 8 ), matInvisible ) ] - ], - X: [ - [ new Mesh( new TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]], - ], - Y: [ - [ new Mesh( new TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]], - ], - Z: [ - [ new Mesh( new TorusGeometry( 0.5, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - ], - E: [ - [ new Mesh( new TorusGeometry( 0.75, 0.1, 2, 24 ), matInvisible ) ] - ] - }; - - const gizmoScale = { - X: [ - [ new Mesh( scaleHandleGeometry, matRed ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - [ new Mesh( lineGeometry2, matRed ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - [ new Mesh( scaleHandleGeometry, matRed ), [ - 0.5, 0, 0 ], [ 0, 0, Math.PI / 2 ]], - ], - Y: [ - [ new Mesh( scaleHandleGeometry, matGreen ), [ 0, 0.5, 0 ]], - [ new Mesh( lineGeometry2, matGreen ) ], - [ new Mesh( scaleHandleGeometry, matGreen ), [ 0, - 0.5, 0 ], [ 0, 0, Math.PI ]], - ], - Z: [ - [ new Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]], - [ new Mesh( lineGeometry2, matBlue ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]], - [ new Mesh( scaleHandleGeometry, matBlue ), [ 0, 0, - 0.5 ], [ - Math.PI / 2, 0, 0 ]] - ], - XY: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matBlueTransparent ), [ 0.15, 0.15, 0 ]] - ], - YZ: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matRedTransparent ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]] - ], - XZ: [ - [ new Mesh( new BoxGeometry( 0.15, 0.15, 0.01 ), matGreenTransparent ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]] - ], - XYZ: [ - [ new Mesh( new BoxGeometry( 0.1, 0.1, 0.1 ), matWhiteTransparent.clone() ) ], - ] - }; - - const pickerScale = { - X: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0.3, 0, 0 ], [ 0, 0, - Math.PI / 2 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ - 0.3, 0, 0 ], [ 0, 0, Math.PI / 2 ]] - ], - Y: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0.3, 0 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, - 0.3, 0 ], [ 0, 0, Math.PI ]] - ], - Z: [ - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, 0.3 ], [ Math.PI / 2, 0, 0 ]], - [ new Mesh( new CylinderGeometry( 0.2, 0, 0.6, 4 ), matInvisible ), [ 0, 0, - 0.3 ], [ - Math.PI / 2, 0, 0 ]] - ], - XY: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0.15, 0 ]], - ], - YZ: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]], - ], - XZ: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.01 ), matInvisible ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]], - ], - XYZ: [ - [ new Mesh( new BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 0 ]], - ] - }; - - const helperScale = { - X: [ - [ new Line( lineGeometry, matHelper.clone() ), [ - 1e3, 0, 0 ], null, [ 1e6, 1, 1 ], 'helper' ] - ], - Y: [ - [ new Line( lineGeometry, matHelper.clone() ), [ 0, - 1e3, 0 ], [ 0, 0, Math.PI / 2 ], [ 1e6, 1, 1 ], 'helper' ] - ], - Z: [ - [ new Line( lineGeometry, matHelper.clone() ), [ 0, 0, - 1e3 ], [ 0, - Math.PI / 2, 0 ], [ 1e6, 1, 1 ], 'helper' ] - ] - }; - - // Creates an Object3D with gizmos described in custom hierarchy definition. - - function setupGizmo( gizmoMap ) { - - const gizmo = new Object3D(); - - for ( const name in gizmoMap ) { - - for ( let i = gizmoMap[ name ].length; i --; ) { - - const object = gizmoMap[ name ][ i ][ 0 ].clone(); - const position = gizmoMap[ name ][ i ][ 1 ]; - const rotation = gizmoMap[ name ][ i ][ 2 ]; - const scale = gizmoMap[ name ][ i ][ 3 ]; - const tag = gizmoMap[ name ][ i ][ 4 ]; - - // name and tag properties are essential for picking and updating logic. - object.name = name; - object.tag = tag; - - if ( position ) { - - object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] ); - - } - - if ( rotation ) { - - object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] ); - - } - - if ( scale ) { - - object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] ); - - } - - object.updateMatrix(); - - const tempGeometry = object.geometry.clone(); - tempGeometry.applyMatrix4( object.matrix ); - object.geometry = tempGeometry; - object.renderOrder = Infinity; - - object.position.set( 0, 0, 0 ); - object.rotation.set( 0, 0, 0 ); - object.scale.set( 1, 1, 1 ); - - gizmo.add( object ); - - } - - } - - return gizmo; - - } - - // Gizmo creation - - this.gizmo = {}; - this.picker = {}; - this.helper = {}; - - this.add( this.gizmo[ 'translate' ] = setupGizmo( gizmoTranslate ) ); - this.add( this.gizmo[ 'rotate' ] = setupGizmo( gizmoRotate ) ); - this.add( this.gizmo[ 'scale' ] = setupGizmo( gizmoScale ) ); - this.add( this.picker[ 'translate' ] = setupGizmo( pickerTranslate ) ); - this.add( this.picker[ 'rotate' ] = setupGizmo( pickerRotate ) ); - this.add( this.picker[ 'scale' ] = setupGizmo( pickerScale ) ); - this.add( this.helper[ 'translate' ] = setupGizmo( helperTranslate ) ); - this.add( this.helper[ 'rotate' ] = setupGizmo( helperRotate ) ); - this.add( this.helper[ 'scale' ] = setupGizmo( helperScale ) ); - - // Pickers should be hidden always - - this.picker[ 'translate' ].visible = false; - this.picker[ 'rotate' ].visible = false; - this.picker[ 'scale' ].visible = false; - - } - - // updateMatrixWorld will update transformations and appearance of individual handles - - updateMatrixWorld( force ) { - - const space = ( this.mode === 'scale' ) ? 'local' : this.space; // scale always oriented to local rotation - - const quaternion = ( space === 'local' ) ? this.worldQuaternion : _identityQuaternion; - - // Show only gizmos for current transform mode - - this.gizmo[ 'translate' ].visible = this.mode === 'translate'; - this.gizmo[ 'rotate' ].visible = this.mode === 'rotate'; - this.gizmo[ 'scale' ].visible = this.mode === 'scale'; - - this.helper[ 'translate' ].visible = this.mode === 'translate'; - this.helper[ 'rotate' ].visible = this.mode === 'rotate'; - this.helper[ 'scale' ].visible = this.mode === 'scale'; - - - let handles = []; - handles = handles.concat( this.picker[ this.mode ].children ); - handles = handles.concat( this.gizmo[ this.mode ].children ); - handles = handles.concat( this.helper[ this.mode ].children ); - - for ( let i = 0; i < handles.length; i ++ ) { - - const handle = handles[ i ]; - - // hide aligned to camera - - handle.visible = true; - handle.rotation.set( 0, 0, 0 ); - handle.position.copy( this.worldPosition ); - - let factor; - - if ( this.camera.isOrthographicCamera ) { - - factor = ( this.camera.top - this.camera.bottom ) / this.camera.zoom; - - } else { - - factor = this.worldPosition.distanceTo( this.cameraPosition ) * Math.min( 1.9 * Math.tan( Math.PI * this.camera.fov / 360 ) / this.camera.zoom, 7 ); - - } - - handle.scale.set( 1, 1, 1 ).multiplyScalar( factor * this.size / 4 ); - - // TODO: simplify helpers and consider decoupling from gizmo - - if ( handle.tag === 'helper' ) { - - handle.visible = false; - - if ( handle.name === 'AXIS' ) { - - handle.visible = !! this.axis; - - if ( this.axis === 'X' ) { - - _tempQuaternion.setFromEuler( _tempEuler.set( 0, 0, 0 ) ); - handle.quaternion.copy( quaternion ).multiply( _tempQuaternion ); - - if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) { - - handle.visible = false; - - } - - } - - if ( this.axis === 'Y' ) { - - _tempQuaternion.setFromEuler( _tempEuler.set( 0, 0, Math.PI / 2 ) ); - handle.quaternion.copy( quaternion ).multiply( _tempQuaternion ); - - if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) { - - handle.visible = false; - - } - - } - - if ( this.axis === 'Z' ) { - - _tempQuaternion.setFromEuler( _tempEuler.set( 0, Math.PI / 2, 0 ) ); - handle.quaternion.copy( quaternion ).multiply( _tempQuaternion ); - - if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > 0.9 ) { - - handle.visible = false; - - } - - } - - if ( this.axis === 'XYZE' ) { - - _tempQuaternion.setFromEuler( _tempEuler.set( 0, Math.PI / 2, 0 ) ); - _alignVector.copy( this.rotationAxis ); - handle.quaternion.setFromRotationMatrix( _lookAtMatrix.lookAt( _zeroVector, _alignVector, _unitY ) ); - handle.quaternion.multiply( _tempQuaternion ); - handle.visible = this.dragging; - - } - - if ( this.axis === 'E' ) { - - handle.visible = false; - - } - - - } else if ( handle.name === 'START' ) { - - handle.position.copy( this.worldPositionStart ); - handle.visible = this.dragging; - - } else if ( handle.name === 'END' ) { - - handle.position.copy( this.worldPosition ); - handle.visible = this.dragging; - - } else if ( handle.name === 'DELTA' ) { - - handle.position.copy( this.worldPositionStart ); - handle.quaternion.copy( this.worldQuaternionStart ); - _tempVector.set( 1e-10, 1e-10, 1e-10 ).add( this.worldPositionStart ).sub( this.worldPosition ).multiplyScalar( - 1 ); - _tempVector.applyQuaternion( this.worldQuaternionStart.clone().invert() ); - handle.scale.copy( _tempVector ); - handle.visible = this.dragging; - - } else { - - handle.quaternion.copy( quaternion ); - - if ( this.dragging ) { - - handle.position.copy( this.worldPositionStart ); - - } else { - - handle.position.copy( this.worldPosition ); - - } - - if ( this.axis ) { - - handle.visible = this.axis.search( handle.name ) !== - 1; - - } - - } - - // If updating helper, skip rest of the loop - continue; - - } - - // Align handles to current local or world rotation - - handle.quaternion.copy( quaternion ); - - if ( this.mode === 'translate' || this.mode === 'scale' ) { - - // Hide translate and scale axis facing the camera - - const AXIS_HIDE_THRESHOLD = 0.99; - const PLANE_HIDE_THRESHOLD = 0.2; - - if ( handle.name === 'X' ) { - - if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - if ( handle.name === 'Y' ) { - - if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - if ( handle.name === 'Z' ) { - - if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - if ( handle.name === 'XY' ) { - - if ( Math.abs( _alignVector.copy( _unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - if ( handle.name === 'YZ' ) { - - if ( Math.abs( _alignVector.copy( _unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - if ( handle.name === 'XZ' ) { - - if ( Math.abs( _alignVector.copy( _unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_THRESHOLD ) { - - handle.scale.set( 1e-10, 1e-10, 1e-10 ); - handle.visible = false; - - } - - } - - } else if ( this.mode === 'rotate' ) { - - // Align handles to current local or world rotation - - _tempQuaternion2.copy( quaternion ); - _alignVector.copy( this.eye ).applyQuaternion( _tempQuaternion.copy( quaternion ).invert() ); - - if ( handle.name.search( 'E' ) !== - 1 ) { - - handle.quaternion.setFromRotationMatrix( _lookAtMatrix.lookAt( this.eye, _zeroVector, _unitY ) ); - - } - - if ( handle.name === 'X' ) { - - _tempQuaternion.setFromAxisAngle( _unitX, Math.atan2( - _alignVector.y, _alignVector.z ) ); - _tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion ); - handle.quaternion.copy( _tempQuaternion ); - - } - - if ( handle.name === 'Y' ) { - - _tempQuaternion.setFromAxisAngle( _unitY, Math.atan2( _alignVector.x, _alignVector.z ) ); - _tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion ); - handle.quaternion.copy( _tempQuaternion ); - - } - - if ( handle.name === 'Z' ) { - - _tempQuaternion.setFromAxisAngle( _unitZ, Math.atan2( _alignVector.y, _alignVector.x ) ); - _tempQuaternion.multiplyQuaternions( _tempQuaternion2, _tempQuaternion ); - handle.quaternion.copy( _tempQuaternion ); - - } - - } - - // Hide disabled axes - handle.visible = handle.visible && ( handle.name.indexOf( 'X' ) === - 1 || this.showX ); - handle.visible = handle.visible && ( handle.name.indexOf( 'Y' ) === - 1 || this.showY ); - handle.visible = handle.visible && ( handle.name.indexOf( 'Z' ) === - 1 || this.showZ ); - handle.visible = handle.visible && ( handle.name.indexOf( 'E' ) === - 1 || ( this.showX && this.showY && this.showZ ) ); - - // highlight selected axis - - handle.material._color = handle.material._color || handle.material.color.clone(); - handle.material._opacity = handle.material._opacity || handle.material.opacity; - - handle.material.color.copy( handle.material._color ); - handle.material.opacity = handle.material._opacity; - - if ( this.enabled && this.axis ) { - - if ( handle.name === this.axis ) { - - handle.material.color.setHex( 0xffff00 ); - handle.material.opacity = 1.0; - - } else if ( this.axis.split( '' ).some( function ( a ) { - - return handle.name === a; - - } ) ) { - - handle.material.color.setHex( 0xffff00 ); - handle.material.opacity = 1.0; - - } - - } - - } - - super.updateMatrixWorld( force ); - - } - -} - -// - -class TransformControlsPlane extends Mesh { - - constructor() { - - super( - new PlaneGeometry( 100000, 100000, 2, 2 ), - new MeshBasicMaterial( { visible: false, wireframe: true, side: DoubleSide, transparent: true, opacity: 0.1, toneMapped: false } ) - ); - - this.isTransformControlsPlane = true; - - this.type = 'TransformControlsPlane'; - - } - - updateMatrixWorld( force ) { - - let space = this.space; - - this.position.copy( this.worldPosition ); - - if ( this.mode === 'scale' ) space = 'local'; // scale always oriented to local rotation - - _v1.copy( _unitX ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion ); - _v2.copy( _unitY ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion ); - _v3.copy( _unitZ ).applyQuaternion( space === 'local' ? this.worldQuaternion : _identityQuaternion ); - - // Align the plane for current transform mode, axis and space. - - _alignVector.copy( _v2 ); - - switch ( this.mode ) { - - case 'translate': - case 'scale': - switch ( this.axis ) { - - case 'X': - _alignVector.copy( this.eye ).cross( _v1 ); - _dirVector.copy( _v1 ).cross( _alignVector ); - break; - case 'Y': - _alignVector.copy( this.eye ).cross( _v2 ); - _dirVector.copy( _v2 ).cross( _alignVector ); - break; - case 'Z': - _alignVector.copy( this.eye ).cross( _v3 ); - _dirVector.copy( _v3 ).cross( _alignVector ); - break; - case 'XY': - _dirVector.copy( _v3 ); - break; - case 'YZ': - _dirVector.copy( _v1 ); - break; - case 'XZ': - _alignVector.copy( _v3 ); - _dirVector.copy( _v2 ); - break; - case 'XYZ': - case 'E': - _dirVector.set( 0, 0, 0 ); - break; - - } - - break; - case 'rotate': - default: - // special case for rotate - _dirVector.set( 0, 0, 0 ); - - } - - if ( _dirVector.length() === 0 ) { - - // If in rotate mode, make the plane parallel to camera - this.quaternion.copy( this.cameraQuaternion ); - - } else { - - _tempMatrix.lookAt( _tempVector.set( 0, 0, 0 ), _dirVector, _alignVector ); - - this.quaternion.setFromRotationMatrix( _tempMatrix ); - - } - - super.updateMatrixWorld( force ); - - } - -} - -export { TransformControls, TransformControlsGizmo, TransformControlsPlane }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSM.js b/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSM.js deleted file mode 100644 index 99e34ca..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSM.js +++ /dev/null @@ -1,384 +0,0 @@ -import { - Vector2, - Vector3, - DirectionalLight, - MathUtils, - ShaderChunk, - Matrix4, - Box3 -} from '/static/javascript/three/build/three.module.js'; -import { CSMFrustum } from './CSMFrustum.js'; -import { CSMShader } from './CSMShader.js'; - -const _cameraToLightMatrix = new Matrix4(); -const _lightSpaceFrustum = new CSMFrustum(); -const _center = new Vector3(); -const _bbox = new Box3(); -const _uniformArray = []; -const _logArray = []; -const _lightOrientationMatrix = new Matrix4(); -const _lightOrientationMatrixInverse = new Matrix4(); -const _up = new Vector3( 0, 1, 0 ); - -export class CSM { - - constructor( data ) { - - this.camera = data.camera; - this.parent = data.parent; - this.cascades = data.cascades || 3; - this.maxFar = data.maxFar || 100000; - this.mode = data.mode || 'practical'; - this.shadowMapSize = data.shadowMapSize || 2048; - this.shadowBias = data.shadowBias || 0.000001; - this.lightDirection = data.lightDirection || new Vector3( 1, - 1, 1 ).normalize(); - this.lightIntensity = data.lightIntensity || 3; - this.lightNear = data.lightNear || 1; - this.lightFar = data.lightFar || 2000; - this.lightMargin = data.lightMargin || 200; - this.customSplitsCallback = data.customSplitsCallback; - this.fade = false; - this.mainFrustum = new CSMFrustum(); - this.frustums = []; - this.breaks = []; - - this.lights = []; - this.shaders = new Map(); - - this.createLights(); - this.updateFrustums(); - this.injectInclude(); - - } - - createLights() { - - for ( let i = 0; i < this.cascades; i ++ ) { - - const light = new DirectionalLight( 0xffffff, this.lightIntensity ); - light.castShadow = true; - light.shadow.mapSize.width = this.shadowMapSize; - light.shadow.mapSize.height = this.shadowMapSize; - - light.shadow.camera.near = this.lightNear; - light.shadow.camera.far = this.lightFar; - light.shadow.bias = this.shadowBias; - - this.parent.add( light ); - this.parent.add( light.target ); - this.lights.push( light ); - - } - - } - - initCascades() { - - const camera = this.camera; - camera.updateProjectionMatrix(); - this.mainFrustum.setFromProjectionMatrix( camera.projectionMatrix, this.maxFar ); - this.mainFrustum.split( this.breaks, this.frustums ); - - } - - updateShadowBounds() { - - const frustums = this.frustums; - for ( let i = 0; i < frustums.length; i ++ ) { - - const light = this.lights[ i ]; - const shadowCam = light.shadow.camera; - const frustum = this.frustums[ i ]; - - // Get the two points that represent that furthest points on the frustum assuming - // that's either the diagonal across the far plane or the diagonal across the whole - // frustum itself. - const nearVerts = frustum.vertices.near; - const farVerts = frustum.vertices.far; - const point1 = farVerts[ 0 ]; - let point2; - if ( point1.distanceTo( farVerts[ 2 ] ) > point1.distanceTo( nearVerts[ 2 ] ) ) { - - point2 = farVerts[ 2 ]; - - } else { - - point2 = nearVerts[ 2 ]; - - } - - let squaredBBWidth = point1.distanceTo( point2 ); - if ( this.fade ) { - - // expand the shadow extents by the fade margin if fade is enabled. - const camera = this.camera; - const far = Math.max( camera.far, this.maxFar ); - const linearDepth = frustum.vertices.far[ 0 ].z / ( far - camera.near ); - const margin = 0.25 * Math.pow( linearDepth, 2.0 ) * ( far - camera.near ); - - squaredBBWidth += margin; - - } - - shadowCam.left = - squaredBBWidth / 2; - shadowCam.right = squaredBBWidth / 2; - shadowCam.top = squaredBBWidth / 2; - shadowCam.bottom = - squaredBBWidth / 2; - shadowCam.updateProjectionMatrix(); - - } - - } - - getBreaks() { - - const camera = this.camera; - const far = Math.min( camera.far, this.maxFar ); - this.breaks.length = 0; - - switch ( this.mode ) { - - case 'uniform': - uniformSplit( this.cascades, camera.near, far, this.breaks ); - break; - case 'logarithmic': - logarithmicSplit( this.cascades, camera.near, far, this.breaks ); - break; - case 'practical': - practicalSplit( this.cascades, camera.near, far, 0.5, this.breaks ); - break; - case 'custom': - if ( this.customSplitsCallback === undefined ) console.error( 'CSM: Custom split scheme callback not defined.' ); - this.customSplitsCallback( this.cascades, camera.near, far, this.breaks ); - break; - - } - - function uniformSplit( amount, near, far, target ) { - - for ( let i = 1; i < amount; i ++ ) { - - target.push( ( near + ( far - near ) * i / amount ) / far ); - - } - - target.push( 1 ); - - } - - function logarithmicSplit( amount, near, far, target ) { - - for ( let i = 1; i < amount; i ++ ) { - - target.push( ( near * ( far / near ) ** ( i / amount ) ) / far ); - - } - - target.push( 1 ); - - } - - function practicalSplit( amount, near, far, lambda, target ) { - - _uniformArray.length = 0; - _logArray.length = 0; - logarithmicSplit( amount, near, far, _logArray ); - uniformSplit( amount, near, far, _uniformArray ); - - for ( let i = 1; i < amount; i ++ ) { - - target.push( MathUtils.lerp( _uniformArray[ i - 1 ], _logArray[ i - 1 ], lambda ) ); - - } - - target.push( 1 ); - - } - - } - - update() { - - const camera = this.camera; - const frustums = this.frustums; - - // for each frustum we need to find its min-max box aligned with the light orientation - // the position in _lightOrientationMatrix does not matter, as we transform there and back - _lightOrientationMatrix.lookAt( new Vector3(), this.lightDirection, _up ); - _lightOrientationMatrixInverse.copy( _lightOrientationMatrix ).invert(); - - for ( let i = 0; i < frustums.length; i ++ ) { - - const light = this.lights[ i ]; - const shadowCam = light.shadow.camera; - const texelWidth = ( shadowCam.right - shadowCam.left ) / this.shadowMapSize; - const texelHeight = ( shadowCam.top - shadowCam.bottom ) / this.shadowMapSize; - _cameraToLightMatrix.multiplyMatrices( _lightOrientationMatrixInverse, camera.matrixWorld ); - frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum ); - - const nearVerts = _lightSpaceFrustum.vertices.near; - const farVerts = _lightSpaceFrustum.vertices.far; - _bbox.makeEmpty(); - for ( let j = 0; j < 4; j ++ ) { - - _bbox.expandByPoint( nearVerts[ j ] ); - _bbox.expandByPoint( farVerts[ j ] ); - - } - - _bbox.getCenter( _center ); - _center.z = _bbox.max.z + this.lightMargin; - _center.x = Math.floor( _center.x / texelWidth ) * texelWidth; - _center.y = Math.floor( _center.y / texelHeight ) * texelHeight; - _center.applyMatrix4( _lightOrientationMatrix ); - - light.position.copy( _center ); - light.target.position.copy( _center ); - - light.target.position.x += this.lightDirection.x; - light.target.position.y += this.lightDirection.y; - light.target.position.z += this.lightDirection.z; - - } - - } - - injectInclude() { - - ShaderChunk.lights_fragment_begin = CSMShader.lights_fragment_begin; - ShaderChunk.lights_pars_begin = CSMShader.lights_pars_begin; - - } - - setupMaterial( material ) { - - material.defines = material.defines || {}; - material.defines.USE_CSM = 1; - material.defines.CSM_CASCADES = this.cascades; - - if ( this.fade ) { - - material.defines.CSM_FADE = ''; - - } - - const breaksVec2 = []; - const scope = this; - const shaders = this.shaders; - - material.onBeforeCompile = function ( shader ) { - - const far = Math.min( scope.camera.far, scope.maxFar ); - scope.getExtendedBreaks( breaksVec2 ); - - shader.uniforms.CSM_cascades = { value: breaksVec2 }; - shader.uniforms.cameraNear = { value: scope.camera.near }; - shader.uniforms.shadowFar = { value: far }; - - shaders.set( material, shader ); - - }; - - shaders.set( material, null ); - - } - - updateUniforms() { - - const far = Math.min( this.camera.far, this.maxFar ); - const shaders = this.shaders; - - shaders.forEach( function ( shader, material ) { - - if ( shader !== null ) { - - const uniforms = shader.uniforms; - this.getExtendedBreaks( uniforms.CSM_cascades.value ); - uniforms.cameraNear.value = this.camera.near; - uniforms.shadowFar.value = far; - - } - - if ( ! this.fade && 'CSM_FADE' in material.defines ) { - - delete material.defines.CSM_FADE; - material.needsUpdate = true; - - } else if ( this.fade && ! ( 'CSM_FADE' in material.defines ) ) { - - material.defines.CSM_FADE = ''; - material.needsUpdate = true; - - } - - }, this ); - - } - - getExtendedBreaks( target ) { - - while ( target.length < this.breaks.length ) { - - target.push( new Vector2() ); - - } - - target.length = this.breaks.length; - - for ( let i = 0; i < this.cascades; i ++ ) { - - const amount = this.breaks[ i ]; - const prev = this.breaks[ i - 1 ] || 0; - target[ i ].x = prev; - target[ i ].y = amount; - - } - - } - - updateFrustums() { - - this.getBreaks(); - this.initCascades(); - this.updateShadowBounds(); - this.updateUniforms(); - - } - - remove() { - - for ( let i = 0; i < this.lights.length; i ++ ) { - - this.parent.remove( this.lights[ i ].target ); - this.parent.remove( this.lights[ i ] ); - - } - - } - - dispose() { - - const shaders = this.shaders; - shaders.forEach( function ( shader, material ) { - - delete material.onBeforeCompile; - delete material.defines.USE_CSM; - delete material.defines.CSM_CASCADES; - delete material.defines.CSM_FADE; - - if ( shader !== null ) { - - delete shader.uniforms.CSM_cascades; - delete shader.uniforms.cameraNear; - delete shader.uniforms.shadowFar; - - } - - material.needsUpdate = true; - - } ); - shaders.clear(); - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMFrustum.js b/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMFrustum.js deleted file mode 100644 index 38d44c3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMFrustum.js +++ /dev/null @@ -1,152 +0,0 @@ -import { Vector3, Matrix4 } from '/static/javascript/three/build/three.module.js'; - -const inverseProjectionMatrix = new Matrix4(); - -class CSMFrustum { - - constructor( data ) { - - data = data || {}; - - this.vertices = { - near: [ - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3() - ], - far: [ - new Vector3(), - new Vector3(), - new Vector3(), - new Vector3() - ] - }; - - if ( data.projectionMatrix !== undefined ) { - - this.setFromProjectionMatrix( data.projectionMatrix, data.maxFar || 10000 ); - - } - - } - - setFromProjectionMatrix( projectionMatrix, maxFar ) { - - const isOrthographic = projectionMatrix.elements[ 2 * 4 + 3 ] === 0; - - inverseProjectionMatrix.copy( projectionMatrix ).invert(); - - // 3 --- 0 vertices.near/far order - // | | - // 2 --- 1 - // clip space spans from [-1, 1] - - this.vertices.near[ 0 ].set( 1, 1, - 1 ); - this.vertices.near[ 1 ].set( 1, - 1, - 1 ); - this.vertices.near[ 2 ].set( - 1, - 1, - 1 ); - this.vertices.near[ 3 ].set( - 1, 1, - 1 ); - this.vertices.near.forEach( function ( v ) { - - v.applyMatrix4( inverseProjectionMatrix ); - - } ); - - this.vertices.far[ 0 ].set( 1, 1, 1 ); - this.vertices.far[ 1 ].set( 1, - 1, 1 ); - this.vertices.far[ 2 ].set( - 1, - 1, 1 ); - this.vertices.far[ 3 ].set( - 1, 1, 1 ); - this.vertices.far.forEach( function ( v ) { - - v.applyMatrix4( inverseProjectionMatrix ); - - const absZ = Math.abs( v.z ); - if ( isOrthographic ) { - - v.z *= Math.min( maxFar / absZ, 1.0 ); - - } else { - - v.multiplyScalar( Math.min( maxFar / absZ, 1.0 ) ); - - } - - } ); - - return this.vertices; - - } - - split( breaks, target ) { - - while ( breaks.length > target.length ) { - - target.push( new CSMFrustum() ); - - } - - target.length = breaks.length; - - for ( let i = 0; i < breaks.length; i ++ ) { - - const cascade = target[ i ]; - - if ( i === 0 ) { - - for ( let j = 0; j < 4; j ++ ) { - - cascade.vertices.near[ j ].copy( this.vertices.near[ j ] ); - - } - - } else { - - for ( let j = 0; j < 4; j ++ ) { - - cascade.vertices.near[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] ); - - } - - } - - if ( i === breaks.length - 1 ) { - - for ( let j = 0; j < 4; j ++ ) { - - cascade.vertices.far[ j ].copy( this.vertices.far[ j ] ); - - } - - } else { - - for ( let j = 0; j < 4; j ++ ) { - - cascade.vertices.far[ j ].lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] ); - - } - - } - - } - - } - - toSpace( cameraMatrix, target ) { - - for ( let i = 0; i < 4; i ++ ) { - - target.vertices.near[ i ] - .copy( this.vertices.near[ i ] ) - .applyMatrix4( cameraMatrix ); - - target.vertices.far[ i ] - .copy( this.vertices.far[ i ] ) - .applyMatrix4( cameraMatrix ); - - } - - } - -} - -export { CSMFrustum }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMHelper.js deleted file mode 100644 index cbd0d35..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMHelper.js +++ /dev/null @@ -1,193 +0,0 @@ -import { - Group, - Mesh, - LineSegments, - BufferGeometry, - LineBasicMaterial, - Box3Helper, - Box3, - PlaneGeometry, - MeshBasicMaterial, - BufferAttribute, - DoubleSide -} from '/static/javascript/three/build/three.module.js'; - -class CSMHelper extends Group { - - constructor( csm ) { - - super(); - this.csm = csm; - this.displayFrustum = true; - this.displayPlanes = true; - this.displayShadowBounds = true; - - 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( 24 ); - const frustumGeometry = new BufferGeometry(); - frustumGeometry.setIndex( new BufferAttribute( indices, 1 ) ); - frustumGeometry.setAttribute( 'position', new BufferAttribute( positions, 3, false ) ); - const frustumLines = new LineSegments( frustumGeometry, new LineBasicMaterial() ); - this.add( frustumLines ); - - this.frustumLines = frustumLines; - this.cascadeLines = []; - this.cascadePlanes = []; - this.shadowLines = []; - - } - - updateVisibility() { - - const displayFrustum = this.displayFrustum; - const displayPlanes = this.displayPlanes; - const displayShadowBounds = this.displayShadowBounds; - - const frustumLines = this.frustumLines; - const cascadeLines = this.cascadeLines; - const cascadePlanes = this.cascadePlanes; - const shadowLines = this.shadowLines; - for ( let i = 0, l = cascadeLines.length; i < l; i ++ ) { - - const cascadeLine = cascadeLines[ i ]; - const cascadePlane = cascadePlanes[ i ]; - const shadowLineGroup = shadowLines[ i ]; - - cascadeLine.visible = displayFrustum; - cascadePlane.visible = displayFrustum && displayPlanes; - shadowLineGroup.visible = displayShadowBounds; - - } - - frustumLines.visible = displayFrustum; - - } - - update() { - - const csm = this.csm; - const camera = csm.camera; - const cascades = csm.cascades; - const mainFrustum = csm.mainFrustum; - const frustums = csm.frustums; - const lights = csm.lights; - - const frustumLines = this.frustumLines; - const frustumLinePositions = frustumLines.geometry.getAttribute( 'position' ); - const cascadeLines = this.cascadeLines; - const cascadePlanes = this.cascadePlanes; - const shadowLines = this.shadowLines; - - this.position.copy( camera.position ); - this.quaternion.copy( camera.quaternion ); - this.scale.copy( camera.scale ); - this.updateMatrixWorld( true ); - - while ( cascadeLines.length > cascades ) { - - this.remove( cascadeLines.pop() ); - this.remove( cascadePlanes.pop() ); - this.remove( shadowLines.pop() ); - - } - - while ( cascadeLines.length < cascades ) { - - const cascadeLine = new Box3Helper( new Box3(), 0xffffff ); - const planeMat = new MeshBasicMaterial( { transparent: true, opacity: 0.1, depthWrite: false, side: DoubleSide } ); - const cascadePlane = new Mesh( new PlaneGeometry(), planeMat ); - const shadowLineGroup = new Group(); - const shadowLine = new Box3Helper( new Box3(), 0xffff00 ); - shadowLineGroup.add( shadowLine ); - - this.add( cascadeLine ); - this.add( cascadePlane ); - this.add( shadowLineGroup ); - - cascadeLines.push( cascadeLine ); - cascadePlanes.push( cascadePlane ); - shadowLines.push( shadowLineGroup ); - - } - - for ( let i = 0; i < cascades; i ++ ) { - - const frustum = frustums[ i ]; - const light = lights[ i ]; - const shadowCam = light.shadow.camera; - const farVerts = frustum.vertices.far; - - const cascadeLine = cascadeLines[ i ]; - const cascadePlane = cascadePlanes[ i ]; - const shadowLineGroup = shadowLines[ i ]; - const shadowLine = shadowLineGroup.children[ 0 ]; - - cascadeLine.box.min.copy( farVerts[ 2 ] ); - cascadeLine.box.max.copy( farVerts[ 0 ] ); - cascadeLine.box.max.z += 1e-4; - - cascadePlane.position.addVectors( farVerts[ 0 ], farVerts[ 2 ] ); - cascadePlane.position.multiplyScalar( 0.5 ); - cascadePlane.scale.subVectors( farVerts[ 0 ], farVerts[ 2 ] ); - cascadePlane.scale.z = 1e-4; - - this.remove( shadowLineGroup ); - shadowLineGroup.position.copy( shadowCam.position ); - shadowLineGroup.quaternion.copy( shadowCam.quaternion ); - shadowLineGroup.scale.copy( shadowCam.scale ); - shadowLineGroup.updateMatrixWorld( true ); - this.attach( shadowLineGroup ); - - shadowLine.box.min.set( shadowCam.bottom, shadowCam.left, - shadowCam.far ); - shadowLine.box.max.set( shadowCam.top, shadowCam.right, - shadowCam.near ); - - } - - const nearVerts = mainFrustum.vertices.near; - const farVerts = mainFrustum.vertices.far; - frustumLinePositions.setXYZ( 0, farVerts[ 0 ].x, farVerts[ 0 ].y, farVerts[ 0 ].z ); - frustumLinePositions.setXYZ( 1, farVerts[ 3 ].x, farVerts[ 3 ].y, farVerts[ 3 ].z ); - frustumLinePositions.setXYZ( 2, farVerts[ 2 ].x, farVerts[ 2 ].y, farVerts[ 2 ].z ); - frustumLinePositions.setXYZ( 3, farVerts[ 1 ].x, farVerts[ 1 ].y, farVerts[ 1 ].z ); - - frustumLinePositions.setXYZ( 4, nearVerts[ 0 ].x, nearVerts[ 0 ].y, nearVerts[ 0 ].z ); - frustumLinePositions.setXYZ( 5, nearVerts[ 3 ].x, nearVerts[ 3 ].y, nearVerts[ 3 ].z ); - frustumLinePositions.setXYZ( 6, nearVerts[ 2 ].x, nearVerts[ 2 ].y, nearVerts[ 2 ].z ); - frustumLinePositions.setXYZ( 7, nearVerts[ 1 ].x, nearVerts[ 1 ].y, nearVerts[ 1 ].z ); - frustumLinePositions.needsUpdate = true; - - } - - dispose() { - - const frustumLines = this.frustumLines; - const cascadeLines = this.cascadeLines; - const cascadePlanes = this.cascadePlanes; - const shadowLines = this.shadowLines; - - frustumLines.geometry.dispose(); - frustumLines.material.dispose(); - - const cascades = this.csm.cascades; - - for ( let i = 0; i < cascades; i ++ ) { - - const cascadeLine = cascadeLines[ i ]; - const cascadePlane = cascadePlanes[ i ]; - const shadowLineGroup = shadowLines[ i ]; - const shadowLine = shadowLineGroup.children[ 0 ]; - - cascadeLine.dispose(); // Box3Helper - - cascadePlane.geometry.dispose(); - cascadePlane.material.dispose(); - - shadowLine.dispose(); // Box3Helper - - } - - } - -} - -export { CSMHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMShader.js b/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMShader.js deleted file mode 100644 index 70cf2a3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/csm/CSMShader.js +++ /dev/null @@ -1,295 +0,0 @@ -import { ShaderChunk } from '/static/javascript/three/build/three.module.js'; - -const CSMShader = { - lights_fragment_begin: /* glsl */` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); - -vec3 geometryClearcoatNormal = vec3( 0.0 ); - -#ifdef USE_CLEARCOAT - - geometryClearcoatNormal = clearcoatNormal; - -#endif - -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - // Iridescence F0 approximation - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#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 ]; - - getPointLightInfo( pointLight, geometryPosition, directLight ); - - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - } - #pragma unroll_loop_end - -#endif - -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - - #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 ]; - - getSpotLightInfo( spotLight, geometryPosition, directLight ); - - // spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none] - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - - #endif - - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - } - #pragma unroll_loop_end - -#endif - -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES ) - - DirectionalLight directionalLight; - float linearDepth = (vViewPosition.z) / (shadowFar - cameraNear); - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - - #if defined( USE_SHADOWMAP ) && defined( CSM_FADE ) - vec2 cascade; - float cascadeCenter; - float closestEdge; - float margin; - float csmx; - float csmy; - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - - #if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - // NOTE: Depth gets larger away from the camera. - // cascade.x is closer, cascade.y is further - cascade = CSM_cascades[ i ]; - cascadeCenter = ( cascade.x + cascade.y ) / 2.0; - closestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y; - margin = 0.25 * pow( closestEdge, 2.0 ); - csmx = cascade.x - margin / 2.0; - csmy = cascade.y + margin / 2.0; - if( linearDepth >= csmx && ( linearDepth < csmy || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 ) ) { - - float dist = min( linearDepth - csmx, csmy - linearDepth ); - float ratio = clamp( dist / margin, 0.0, 1.0 ); - - vec3 prevColor = directLight.color; - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - - bool shouldFadeLastCascade = UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth > cascadeCenter; - directLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 ); - - ReflectedLight prevLight = reflectedLight; - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - bool shouldBlend = UNROLLED_LOOP_INDEX != CSM_CASCADES - 1 || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1 && linearDepth < cascadeCenter; - float blendRatio = shouldBlend ? ratio : 1.0; - - reflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio ); - reflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio ); - reflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio ); - reflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio ); - - } - #endif - - } - #pragma unroll_loop_end - #elif defined (USE_SHADOWMAP) - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - - #if ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - - directionalLightShadow = directionalLightShadows[ i ]; - if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - - if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - #endif - - } - #pragma unroll_loop_end - - #elif ( NUM_DIR_LIGHT_SHADOWS > 0 ) - // note: no loop here - all CSM lights are in fact one light only - getDirectionalLightInfo( directionalLights[0], directLight ); - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - #endif - - #if ( NUM_DIR_LIGHTS > NUM_DIR_LIGHT_SHADOWS) - // compute the lights not casting shadows (if any) - - #pragma unroll_loop_start - for ( int i = NUM_DIR_LIGHT_SHADOWS; i < NUM_DIR_LIGHTS; i ++ ) { - - directionalLight = directionalLights[ i ]; - - getDirectionalLightInfo( directionalLight, directLight ); - - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - } - #pragma unroll_loop_end - - #endif - -#endif - - -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES ) - - 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 ]; - - getDirectionalLightInfo( directionalLight, directLight ); - - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - - } - #pragma unroll_loop_end - -#endif - -#if defined( RE_IndirectDiffuse ) - - vec3 iblIrradiance = vec3( 0.0 ); - - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - - #if defined( USE_LIGHT_PROBES ) - - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - - #endif - - #if ( NUM_HEMI_LIGHTS > 0 ) - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - - } - #pragma unroll_loop_end - - #endif - -#endif - -#if defined( RE_IndirectSpecular ) - - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); - -#endif -`, - lights_pars_begin: /* glsl */` -#if defined( USE_CSM ) && defined( CSM_CASCADES ) -uniform vec2 CSM_cascades[CSM_CASCADES]; -uniform float cameraNear; -uniform float shadowFar; -#endif - ` + ShaderChunk.lights_pars_begin -}; - -export { CSMShader }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/CurveExtras.js b/docker-compose/requirements/nginx/static/javascript/taaaa/curves/CurveExtras.js deleted file mode 100644 index f8023f8..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/CurveExtras.js +++ /dev/null @@ -1,422 +0,0 @@ -import { - Curve, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * A bunch of parametric curves - * - * Formulas collected from various sources - * http://mathworld.wolfram.com/HeartCurve.html - * http://en.wikipedia.org/wiki/Viviani%27s_curve - * http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf - * https://prideout.net/blog/old/blog/index.html@p=44.html - */ - -// GrannyKnot - -class GrannyKnot extends Curve { - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t = 2 * Math.PI * t; - - const x = - 0.22 * Math.cos( t ) - 1.28 * Math.sin( t ) - 0.44 * Math.cos( 3 * t ) - 0.78 * Math.sin( 3 * t ); - const y = - 0.1 * Math.cos( 2 * t ) - 0.27 * Math.sin( 2 * t ) + 0.38 * Math.cos( 4 * t ) + 0.46 * Math.sin( 4 * t ); - const z = 0.7 * Math.cos( 3 * t ) - 0.4 * Math.sin( 3 * t ); - - return point.set( x, y, z ).multiplyScalar( 20 ); - - } - -} - -// HeartCurve - -class HeartCurve extends Curve { - - constructor( scale = 5 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t *= 2 * Math.PI; - - const x = 16 * Math.pow( Math.sin( t ), 3 ); - const y = 13 * Math.cos( t ) - 5 * Math.cos( 2 * t ) - 2 * Math.cos( 3 * t ) - Math.cos( 4 * t ); - const z = 0; - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// Viviani's Curve - -class VivianiCurve extends Curve { - - constructor( scale = 70 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t = t * 4 * Math.PI; // normalized to 0..1 - const a = this.scale / 2; - - const x = a * ( 1 + Math.cos( t ) ); - const y = a * Math.sin( t ); - const z = 2 * a * Math.sin( t / 2 ); - - return point.set( x, y, z ); - - } - -} - -// KnotCurve - -class KnotCurve extends Curve { - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t *= 2 * Math.PI; - - const R = 10; - const s = 50; - - const x = s * Math.sin( t ); - const y = Math.cos( t ) * ( R + s * Math.cos( t ) ); - const z = Math.sin( t ) * ( R + s * Math.cos( t ) ); - - return point.set( x, y, z ); - - } - -} - - -// HelixCurve - -class HelixCurve extends Curve { - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const a = 30; // radius - const b = 150; // height - - const t2 = 2 * Math.PI * t * b / 30; - - const x = Math.cos( t2 ) * a; - const y = Math.sin( t2 ) * a; - const z = b * t; - - return point.set( x, y, z ); - - } - -} - -// TrefoilKnot - -class TrefoilKnot extends Curve { - - constructor( scale = 10 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t *= Math.PI * 2; - - const x = ( 2 + Math.cos( 3 * t ) ) * Math.cos( 2 * t ); - const y = ( 2 + Math.cos( 3 * t ) ) * Math.sin( 2 * t ); - const z = Math.sin( 3 * t ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// TorusKnot - -class TorusKnot extends Curve { - - constructor( scale = 10 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const p = 3; - const q = 4; - - t *= Math.PI * 2; - - const x = ( 2 + Math.cos( q * t ) ) * Math.cos( p * t ); - const y = ( 2 + Math.cos( q * t ) ) * Math.sin( p * t ); - const z = Math.sin( q * t ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// CinquefoilKnot - -class CinquefoilKnot extends Curve { - - constructor( scale = 10 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const p = 2; - const q = 5; - - t *= Math.PI * 2; - - const x = ( 2 + Math.cos( q * t ) ) * Math.cos( p * t ); - const y = ( 2 + Math.cos( q * t ) ) * Math.sin( p * t ); - const z = Math.sin( q * t ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - - -// TrefoilPolynomialKnot - -class TrefoilPolynomialKnot extends Curve { - - constructor( scale = 10 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t = t * 4 - 2; - - const x = Math.pow( t, 3 ) - 3 * t; - const y = Math.pow( t, 4 ) - 4 * t * t; - const z = 1 / 5 * Math.pow( t, 5 ) - 2 * t; - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -function scaleTo( x, y, t ) { - - const r = y - x; - return t * r + x; - -} - -// FigureEightPolynomialKnot - -class FigureEightPolynomialKnot extends Curve { - - constructor( scale = 1 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t = scaleTo( - 4, 4, t ); - - const x = 2 / 5 * t * ( t * t - 7 ) * ( t * t - 10 ); - const y = Math.pow( t, 4 ) - 13 * t * t; - const z = 1 / 10 * t * ( t * t - 4 ) * ( t * t - 9 ) * ( t * t - 12 ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// DecoratedTorusKnot4a - -class DecoratedTorusKnot4a extends Curve { - - constructor( scale = 40 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t *= Math.PI * 2; - - const x = Math.cos( 2 * t ) * ( 1 + 0.6 * ( Math.cos( 5 * t ) + 0.75 * Math.cos( 10 * t ) ) ); - const y = Math.sin( 2 * t ) * ( 1 + 0.6 * ( Math.cos( 5 * t ) + 0.75 * Math.cos( 10 * t ) ) ); - const z = 0.35 * Math.sin( 5 * t ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// DecoratedTorusKnot4b - -class DecoratedTorusKnot4b extends Curve { - - constructor( scale = 40 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const fi = t * Math.PI * 2; - - const x = Math.cos( 2 * fi ) * ( 1 + 0.45 * Math.cos( 3 * fi ) + 0.4 * Math.cos( 9 * fi ) ); - const y = Math.sin( 2 * fi ) * ( 1 + 0.45 * Math.cos( 3 * fi ) + 0.4 * Math.cos( 9 * fi ) ); - const z = 0.2 * Math.sin( 9 * fi ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - - -// DecoratedTorusKnot5a - -class DecoratedTorusKnot5a extends Curve { - - constructor( scale = 40 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const fi = t * Math.PI * 2; - - const x = Math.cos( 3 * fi ) * ( 1 + 0.3 * Math.cos( 5 * fi ) + 0.5 * Math.cos( 10 * fi ) ); - const y = Math.sin( 3 * fi ) * ( 1 + 0.3 * Math.cos( 5 * fi ) + 0.5 * Math.cos( 10 * fi ) ); - const z = 0.2 * Math.sin( 20 * fi ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -// DecoratedTorusKnot5c - -class DecoratedTorusKnot5c extends Curve { - - constructor( scale = 40 ) { - - super(); - - this.scale = scale; - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const fi = t * Math.PI * 2; - - const x = Math.cos( 4 * fi ) * ( 1 + 0.5 * ( Math.cos( 5 * fi ) + 0.4 * Math.cos( 20 * fi ) ) ); - const y = Math.sin( 4 * fi ) * ( 1 + 0.5 * ( Math.cos( 5 * fi ) + 0.4 * Math.cos( 20 * fi ) ) ); - const z = 0.35 * Math.sin( 15 * fi ); - - return point.set( x, y, z ).multiplyScalar( this.scale ); - - } - -} - -export { - GrannyKnot, - HeartCurve, - VivianiCurve, - KnotCurve, - HelixCurve, - TrefoilKnot, - TorusKnot, - CinquefoilKnot, - TrefoilPolynomialKnot, - FigureEightPolynomialKnot, - DecoratedTorusKnot4a, - DecoratedTorusKnot4b, - DecoratedTorusKnot5a, - DecoratedTorusKnot5c -}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSCurve.js b/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSCurve.js deleted file mode 100644 index 942fb27..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSCurve.js +++ /dev/null @@ -1,80 +0,0 @@ -import { - Curve, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import * as NURBSUtils from '../curves/NURBSUtils.js'; - -/** - * NURBS curve object - * - * Derives from Curve, overriding getPoint and getTangent. - * - * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight. - * - **/ - -class NURBSCurve extends Curve { - - constructor( - degree, - knots /* array of reals */, - controlPoints /* array of Vector(2|3|4) */, - startKnot /* index in knots */, - endKnot /* index in knots */ - ) { - - super(); - - this.degree = degree; - this.knots = knots; - this.controlPoints = []; - // Used by periodic NURBS to remove hidden spans - this.startKnot = startKnot || 0; - this.endKnot = endKnot || ( this.knots.length - 1 ); - - for ( let i = 0; i < controlPoints.length; ++ i ) { - - // ensure Vector4 for control points - const point = controlPoints[ i ]; - this.controlPoints[ i ] = new Vector4( point.x, point.y, point.z, point.w ); - - } - - } - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - const u = this.knots[ this.startKnot ] + t * ( this.knots[ this.endKnot ] - this.knots[ this.startKnot ] ); // linear mapping t->u - - // following results in (wx, wy, wz, w) homogeneous point - const hpoint = NURBSUtils.calcBSplinePoint( this.degree, this.knots, this.controlPoints, u ); - - if ( hpoint.w !== 1.0 ) { - - // project to 3D space: (wx, wy, wz, w) -> (x, y, z, 1) - hpoint.divideScalar( hpoint.w ); - - } - - return point.set( hpoint.x, hpoint.y, hpoint.z ); - - } - - getTangent( t, optionalTarget = new Vector3() ) { - - const tangent = optionalTarget; - - const u = this.knots[ 0 ] + t * ( this.knots[ this.knots.length - 1 ] - this.knots[ 0 ] ); - const ders = NURBSUtils.calcNURBSDerivatives( this.degree, this.knots, this.controlPoints, u, 1 ); - tangent.copy( ders[ 1 ] ).normalize(); - - return tangent; - - } - -} - -export { NURBSCurve }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSSurface.js b/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSSurface.js deleted file mode 100644 index a674c2b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSSurface.js +++ /dev/null @@ -1,52 +0,0 @@ -import { - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import * as NURBSUtils from '../curves/NURBSUtils.js'; - -/** - * NURBS surface object - * - * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight. - **/ - -class NURBSSurface { - - constructor( degree1, degree2, knots1, knots2 /* arrays of reals */, controlPoints /* array^2 of Vector(2|3|4) */ ) { - - this.degree1 = degree1; - this.degree2 = degree2; - this.knots1 = knots1; - this.knots2 = knots2; - this.controlPoints = []; - - const len1 = knots1.length - degree1 - 1; - const len2 = knots2.length - degree2 - 1; - - // ensure Vector4 for control points - for ( let i = 0; i < len1; ++ i ) { - - this.controlPoints[ i ] = []; - - for ( let j = 0; j < len2; ++ j ) { - - const point = controlPoints[ i ][ j ]; - this.controlPoints[ i ][ j ] = new Vector4( point.x, point.y, point.z, point.w ); - - } - - } - - } - - getPoint( t1, t2, target ) { - - const u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u - const v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->u - - NURBSUtils.calcSurfacePoint( this.degree1, this.degree2, this.knots1, this.knots2, this.controlPoints, u, v, target ); - - } - -} - -export { NURBSSurface }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSUtils.js b/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSUtils.js deleted file mode 100644 index 9bf5224..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSUtils.js +++ /dev/null @@ -1,542 +0,0 @@ -import { - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; - -/** - * NURBS utils - * - * See NURBSCurve and NURBSSurface. - **/ - - -/************************************************************** - * NURBS Utils - **************************************************************/ - -/* -Finds knot vector span. - -p : degree -u : parametric value -U : knot vector - -returns the span -*/ -function findSpan( p, u, U ) { - - const n = U.length - p - 1; - - if ( u >= U[ n ] ) { - - return n - 1; - - } - - if ( u <= U[ p ] ) { - - return p; - - } - - let low = p; - let high = n; - let mid = Math.floor( ( low + high ) / 2 ); - - while ( u < U[ mid ] || u >= U[ mid + 1 ] ) { - - if ( u < U[ mid ] ) { - - high = mid; - - } else { - - low = mid; - - } - - mid = Math.floor( ( low + high ) / 2 ); - - } - - return mid; - -} - - -/* -Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2 - -span : span in which u lies -u : parametric point -p : degree -U : knot vector - -returns array[p+1] with basis functions values. -*/ -function calcBasisFunctions( span, u, p, U ) { - - const N = []; - const left = []; - const right = []; - N[ 0 ] = 1.0; - - for ( let j = 1; j <= p; ++ j ) { - - left[ j ] = u - U[ span + 1 - j ]; - right[ j ] = U[ span + j ] - u; - - let saved = 0.0; - - for ( let r = 0; r < j; ++ r ) { - - const rv = right[ r + 1 ]; - const lv = left[ j - r ]; - const temp = N[ r ] / ( rv + lv ); - N[ r ] = saved + rv * temp; - saved = lv * temp; - - } - - N[ j ] = saved; - - } - - return N; - -} - - -/* -Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1. - -p : degree of B-Spline -U : knot vector -P : control points (x, y, z, w) -u : parametric point - -returns point for given u -*/ -function calcBSplinePoint( p, U, P, u ) { - - const span = findSpan( p, u, U ); - const N = calcBasisFunctions( span, u, p, U ); - const C = new Vector4( 0, 0, 0, 0 ); - - for ( let j = 0; j <= p; ++ j ) { - - const point = P[ span - p + j ]; - const Nj = N[ j ]; - const wNj = point.w * Nj; - C.x += point.x * wNj; - C.y += point.y * wNj; - C.z += point.z * wNj; - C.w += point.w * Nj; - - } - - return C; - -} - - -/* -Calculate basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3. - -span : span in which u lies -u : parametric point -p : degree -n : number of derivatives to calculate -U : knot vector - -returns array[n+1][p+1] with basis functions derivatives -*/ -function calcBasisFunctionDerivatives( span, u, p, n, U ) { - - const zeroArr = []; - for ( let i = 0; i <= p; ++ i ) - zeroArr[ i ] = 0.0; - - const ders = []; - - for ( let i = 0; i <= n; ++ i ) - ders[ i ] = zeroArr.slice( 0 ); - - const ndu = []; - - for ( let i = 0; i <= p; ++ i ) - ndu[ i ] = zeroArr.slice( 0 ); - - ndu[ 0 ][ 0 ] = 1.0; - - const left = zeroArr.slice( 0 ); - const right = zeroArr.slice( 0 ); - - for ( let j = 1; j <= p; ++ j ) { - - left[ j ] = u - U[ span + 1 - j ]; - right[ j ] = U[ span + j ] - u; - - let saved = 0.0; - - for ( let r = 0; r < j; ++ r ) { - - const rv = right[ r + 1 ]; - const lv = left[ j - r ]; - ndu[ j ][ r ] = rv + lv; - - const temp = ndu[ r ][ j - 1 ] / ndu[ j ][ r ]; - ndu[ r ][ j ] = saved + rv * temp; - saved = lv * temp; - - } - - ndu[ j ][ j ] = saved; - - } - - for ( let j = 0; j <= p; ++ j ) { - - ders[ 0 ][ j ] = ndu[ j ][ p ]; - - } - - for ( let r = 0; r <= p; ++ r ) { - - let s1 = 0; - let s2 = 1; - - const a = []; - for ( let i = 0; i <= p; ++ i ) { - - a[ i ] = zeroArr.slice( 0 ); - - } - - a[ 0 ][ 0 ] = 1.0; - - for ( let k = 1; k <= n; ++ k ) { - - let d = 0.0; - const rk = r - k; - const pk = p - k; - - if ( r >= k ) { - - a[ s2 ][ 0 ] = a[ s1 ][ 0 ] / ndu[ pk + 1 ][ rk ]; - d = a[ s2 ][ 0 ] * ndu[ rk ][ pk ]; - - } - - const j1 = ( rk >= - 1 ) ? 1 : - rk; - const j2 = ( r - 1 <= pk ) ? k - 1 : p - r; - - for ( let j = j1; j <= j2; ++ j ) { - - a[ s2 ][ j ] = ( a[ s1 ][ j ] - a[ s1 ][ j - 1 ] ) / ndu[ pk + 1 ][ rk + j ]; - d += a[ s2 ][ j ] * ndu[ rk + j ][ pk ]; - - } - - if ( r <= pk ) { - - a[ s2 ][ k ] = - a[ s1 ][ k - 1 ] / ndu[ pk + 1 ][ r ]; - d += a[ s2 ][ k ] * ndu[ r ][ pk ]; - - } - - ders[ k ][ r ] = d; - - const j = s1; - s1 = s2; - s2 = j; - - } - - } - - let r = p; - - for ( let k = 1; k <= n; ++ k ) { - - for ( let j = 0; j <= p; ++ j ) { - - ders[ k ][ j ] *= r; - - } - - r *= p - k; - - } - - return ders; - -} - - -/* - Calculate derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2. - - p : degree - U : knot vector - P : control points - u : Parametric points - nd : number of derivatives - - returns array[d+1] with derivatives - */ -function calcBSplineDerivatives( p, U, P, u, nd ) { - - const du = nd < p ? nd : p; - const CK = []; - const span = findSpan( p, u, U ); - const nders = calcBasisFunctionDerivatives( span, u, p, du, U ); - const Pw = []; - - for ( let i = 0; i < P.length; ++ i ) { - - const point = P[ i ].clone(); - const w = point.w; - - point.x *= w; - point.y *= w; - point.z *= w; - - Pw[ i ] = point; - - } - - for ( let k = 0; k <= du; ++ k ) { - - const point = Pw[ span - p ].clone().multiplyScalar( nders[ k ][ 0 ] ); - - for ( let j = 1; j <= p; ++ j ) { - - point.add( Pw[ span - p + j ].clone().multiplyScalar( nders[ k ][ j ] ) ); - - } - - CK[ k ] = point; - - } - - for ( let k = du + 1; k <= nd + 1; ++ k ) { - - CK[ k ] = new Vector4( 0, 0, 0 ); - - } - - return CK; - -} - - -/* -Calculate "K over I" - -returns k!/(i!(k-i)!) -*/ -function calcKoverI( k, i ) { - - let nom = 1; - - for ( let j = 2; j <= k; ++ j ) { - - nom *= j; - - } - - let denom = 1; - - for ( let j = 2; j <= i; ++ j ) { - - denom *= j; - - } - - for ( let j = 2; j <= k - i; ++ j ) { - - denom *= j; - - } - - return nom / denom; - -} - - -/* -Calculate derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2. - -Pders : result of function calcBSplineDerivatives - -returns array with derivatives for rational curve. -*/ -function calcRationalCurveDerivatives( Pders ) { - - const nd = Pders.length; - const Aders = []; - const wders = []; - - for ( let i = 0; i < nd; ++ i ) { - - const point = Pders[ i ]; - Aders[ i ] = new Vector3( point.x, point.y, point.z ); - wders[ i ] = point.w; - - } - - const CK = []; - - for ( let k = 0; k < nd; ++ k ) { - - const v = Aders[ k ].clone(); - - for ( let i = 1; i <= k; ++ i ) { - - v.sub( CK[ k - i ].clone().multiplyScalar( calcKoverI( k, i ) * wders[ i ] ) ); - - } - - CK[ k ] = v.divideScalar( wders[ 0 ] ); - - } - - return CK; - -} - - -/* -Calculate NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2. - -p : degree -U : knot vector -P : control points in homogeneous space -u : parametric points -nd : number of derivatives - -returns array with derivatives. -*/ -function calcNURBSDerivatives( p, U, P, u, nd ) { - - const Pders = calcBSplineDerivatives( p, U, P, u, nd ); - return calcRationalCurveDerivatives( Pders ); - -} - - -/* -Calculate rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3. - -p, q : degrees of B-Spline surface -U, V : knot vectors -P : control points (x, y, z, w) -u, v : parametric values - -returns point for given (u, v) -*/ -function calcSurfacePoint( p, q, U, V, P, u, v, target ) { - - const uspan = findSpan( p, u, U ); - const vspan = findSpan( q, v, V ); - const Nu = calcBasisFunctions( uspan, u, p, U ); - const Nv = calcBasisFunctions( vspan, v, q, V ); - const temp = []; - - for ( let l = 0; l <= q; ++ l ) { - - temp[ l ] = new Vector4( 0, 0, 0, 0 ); - for ( let k = 0; k <= p; ++ k ) { - - const point = P[ uspan - p + k ][ vspan - q + l ].clone(); - const w = point.w; - point.x *= w; - point.y *= w; - point.z *= w; - temp[ l ].add( point.multiplyScalar( Nu[ k ] ) ); - - } - - } - - const Sw = new Vector4( 0, 0, 0, 0 ); - for ( let l = 0; l <= q; ++ l ) { - - Sw.add( temp[ l ].multiplyScalar( Nv[ l ] ) ); - - } - - Sw.divideScalar( Sw.w ); - target.set( Sw.x, Sw.y, Sw.z ); - -} - -/* -Calculate rational B-Spline volume point. See The NURBS Book, page 134, algorithm A4.3. - -p, q, r : degrees of B-Splinevolume -U, V, W : knot vectors -P : control points (x, y, z, w) -u, v, w : parametric values - -returns point for given (u, v, w) -*/ -function calcVolumePoint( p, q, r, U, V, W, P, u, v, w, target ) { - - const uspan = findSpan( p, u, U ); - const vspan = findSpan( q, v, V ); - const wspan = findSpan( r, w, W ); - const Nu = calcBasisFunctions( uspan, u, p, U ); - const Nv = calcBasisFunctions( vspan, v, q, V ); - const Nw = calcBasisFunctions( wspan, w, r, W ); - const temp = []; - - for ( let m = 0; m <= r; ++ m ) { - - temp[ m ] = []; - - for ( let l = 0; l <= q; ++ l ) { - - temp[ m ][ l ] = new Vector4( 0, 0, 0, 0 ); - for ( let k = 0; k <= p; ++ k ) { - - const point = P[ uspan - p + k ][ vspan - q + l ][ wspan - r + m ].clone(); - const w = point.w; - point.x *= w; - point.y *= w; - point.z *= w; - temp[ m ][ l ].add( point.multiplyScalar( Nu[ k ] ) ); - - } - - } - - } - const Sw = new Vector4( 0, 0, 0, 0 ); - for ( let m = 0; m <= r; ++ m ) { - for ( let l = 0; l <= q; ++ l ) { - - Sw.add( temp[ m ][ l ].multiplyScalar( Nw[ m ] ).multiplyScalar( Nv[ l ] ) ); - - } - } - - Sw.divideScalar( Sw.w ); - target.set( Sw.x, Sw.y, Sw.z ); - -} - - -export { - findSpan, - calcBasisFunctions, - calcBSplinePoint, - calcBasisFunctionDerivatives, - calcBSplineDerivatives, - calcKoverI, - calcRationalCurveDerivatives, - calcNURBSDerivatives, - calcSurfacePoint, - calcVolumePoint, -}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSVolume.js b/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSVolume.js deleted file mode 100644 index 20f0f4e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/curves/NURBSVolume.js +++ /dev/null @@ -1,62 +0,0 @@ -import { - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import * as NURBSUtils from './NURBSUtils.js'; - -/** - * NURBS volume object - * - * Implementation is based on (x, y, z [, w=1]]) control points with w=weight. - **/ - -class NURBSVolume { - - constructor( degree1, degree2, degree3, knots1, knots2, knots3 /* arrays of reals */, controlPoints /* array^3 of Vector(2|3|4) */ ) { - - this.degree1 = degree1; - this.degree2 = degree2; - this.degree3 = degree3; - this.knots1 = knots1; - this.knots2 = knots2; - this.knots3 = knots3; - this.controlPoints = []; - - const len1 = knots1.length - degree1 - 1; - const len2 = knots2.length - degree2 - 1; - const len3 = knots3.length - degree3 - 1; - - // ensure Vector4 for control points - for ( let i = 0; i < len1; ++ i ) { - - this.controlPoints[ i ] = []; - - for ( let j = 0; j < len2; ++ j ) { - - this.controlPoints[ i ][ j ] = []; - - for ( let k = 0; k < len3; ++ k ) { - - const point = controlPoints[ i ][ j ][ k ]; - this.controlPoints[ i ][ j ][ k ] = new Vector4( point.x, point.y, point.z, point.w ); - - } - - } - - } - - } - - getPoint( t1, t2, t3, target ) { - - const u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u - const v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->v - const w = this.knots3[ 0 ] + t3 * ( this.knots3[ this.knots3.length - 1 ] - this.knots3[ 0 ] ); // linear mapping t3->w - - NURBSUtils.calcVolumePoint( this.degree1, this.degree2, this.degree3, this.knots1, this.knots2, this.knots3, this.controlPoints, u, v, w, target ); - - } - -} - -export { NURBSVolume }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/README.md b/docker-compose/requirements/nginx/static/javascript/taaaa/draco/README.md deleted file mode 100644 index 4d89164..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Draco 3D Data Compression - -Draco is an open-source library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics. - -[Website](https://google.github.io/draco/) | [GitHub](https://github.com/google/draco) - -## Contents - -This folder contains three utilities: - -* `draco_decoder.js` — Emscripten-compiled decoder, compatible with any modern browser. -* `draco_decoder.wasm` — WebAssembly decoder, compatible with newer browsers and devices. -* `draco_wasm_wrapper.js` — JavaScript wrapper for the WASM decoder. - -Each file is provided in two variations: - -* **Default:** Latest stable builds, tracking the project's [master branch](https://github.com/google/draco). -* **glTF:** Builds targeted by the [glTF mesh compression extension](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression), tracking the [corresponding Draco branch](https://github.com/google/draco/tree/gltf_2.0_draco_extension). - -Either variation may be used with `DRACOLoader`: - -```js -var dracoLoader = new DRACOLoader(); -dracoLoader.setDecoderPath('path/to/decoders/'); -dracoLoader.setDecoderConfig({type: 'js'}); // (Optional) Override detection of WASM support. -``` - -Further [documentation on GitHub](https://github.com/google/draco/tree/master/javascript/example#static-loading-javascript-decoder). - -## License - -[Apache License 2.0](https://github.com/google/draco/blob/master/LICENSE) diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_decoder.js b/docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_decoder.js deleted file mode 100644 index 6629469..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/draco_decoder.js +++ /dev/null @@ -1,34 +0,0 @@ - -var DracoDecoderModule = (() => { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; - return ( -function(DracoDecoderModule = {}) { - -var Module=typeof DracoDecoderModule!="undefined"?DracoDecoderModule:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var isRuntimeInitialized=false;var isModuleParsed=false;Module["onRuntimeInitialized"]=function(){isRuntimeInitialized=true;if(isModuleParsed){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};Module["onModuleParsed"]=function(){isModuleParsed=true;if(isRuntimeInitialized){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};function isVersionSupported(versionString){if(typeof versionString!=="string")return false;const version=versionString.split(".");if(version.length<2||version.length>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=5)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{var ret=tryParseAsDataURI(filename);if(ret){return binary?ret:ret.toString()}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{var ret=tryParseAsDataURI(filename);if(ret){onload(ret)}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}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.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);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;var WebAssembly={Memory:function(opts){this.buffer=new ArrayBuffer(opts["initial"]*65536)},Module:function(binary){},Instance:function(module,info){this.exports=( -// EMSCRIPTEN_START_ASM -function instantiate(na){function c(d){d.set=function(a,b){this[a]=b};d.get=function(a){return this[a]};return d}var e;var f=new Uint8Array(123);for(var a=25;a>=0;--a){f[48+a]=52+a;f[65+a]=a;f[97+a]=26+a}f[43]=62;f[47]=63;function l(m,n,o){var g,h,a=0,i=n,j=o.length,k=n+(j*3>>2)-(o[j-2]=="=")-(o[j-1]=="=");for(;a>4;if(i>2;if(i>2];s=H[b+12>>2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B>>2]=e;Qd(1713,B);break c}H[B+664>>2]=c;d:{if(!x){break d}e:{k=H[c>>2];if(x>>>0<=(H[c+8>>2]-k|0)/12>>>0){break e}if(x>>>0<357913942){l=H[c+4>>2];d=N(x,12);e=pa(d);g=d+e|0;e=e+N((l-k|0)/12|0,12)|0;d=e;if((k|0)!=(l|0)){while(1){d=d-12|0;l=l-12|0;H[d>>2]=H[l>>2];H[d+4>>2]=H[l+4>>2];H[d+8>>2]=H[l+8>>2];if((k|0)!=(l|0)){continue}break}}H[c+8>>2]=g;H[c+4>>2]=e;H[c>>2]=d;if(!k){break e}oa(k);break e}break b}f:{switch(H[a+16>>2]){case 0:i=wb(B+8|0,3);z=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;g:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break g}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break g}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break g}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break g}H[i+8>>2]=0;if(!ua(i+16|0,b)){break g}if(!ua(i+36|0,b)){break g}if(!ua(i+56|0,b)){break g}if(!ua(i+76|0,b)){break g}A=H[i+4>>2];d=0;g=0;f=ca-32|0;ca=f;m=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(m){if(m>>>0>=1073741824){break b}b=m<<2;g=pa(b);H[f+8>>2]=g;d=b+g|0;H[f+16>>2]=d;ra(g,0,b);H[f+12>>2]=d}e=H[i+120>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);m=H[i+12>>2];g=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=g;H[e+8>>2]=H[f+16>>2];g=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;h:{if(m){if(m>>>0>=1073741824){break b}b=m<<2;w=pa(b);H[f+8>>2]=w;g=b+w|0;H[f+16>>2]=g;ra(w,0,b);H[f+12>>2]=g}d=H[i+132>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);w=H[f+8>>2];g=H[f+12>>2]}H[d+4>>2]=g;H[d>>2]=w;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=A;m=H[f+28>>2]+1|0;H[f+28>>2]=m;i:{if(!m){break i}y=i+96|0;while(1){n=H[f+12>>2];g=H[f+24>>2];e=m-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[n+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;o=H[b+8>>2];k=H[b+4>>2];t=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(g+m|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}b=0;if(t>>>0>A>>>0){break i}d=H[i+12>>2];m=(k|0)!=(d-1|0)?k+1|0:0;if(m>>>0>=d>>>0){break i}q=N(o,12);p=q+H[i+132>>2]|0;l=q+H[i+120>>2]|0;g=H[i>>2];r=m<<2;e=H[r+H[p>>2]>>2];j:{k:{if((g|0)==(e|0)){if(!t){break k}while(1){d=H[l>>2];x=H[d+8>>2];s=H[d+4>>2];n=H[d>>2];q=H[z>>2];m=H[q+4>>2];d=H[q+8>>2];l:{if(m>>>0>>0){H[m+8>>2]=x;H[m+4>>2]=s;H[m>>2]=n;H[q+4>>2]=m+12;break l}r=H[q>>2];g=(m-r|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(d-r|0)/12|0;d=e<<1;k=e>>>0>=178956970?357913941:d>>>0>k>>>0?d:k;if(k){if(k>>>0>=357913942){break a}d=pa(N(k,12))}else{d=0}w=d+N(g,12)|0;H[w+8>>2]=x;H[w+4>>2]=s;H[w>>2]=n;e=w+12|0;if((m|0)!=(r|0)){while(1){w=w-12|0;m=m-12|0;H[w>>2]=H[m>>2];H[w+4>>2]=H[m+4>>2];H[w+8>>2]=H[m+8>>2];if((m|0)!=(r|0)){continue}break}}H[q+8>>2]=d+N(k,12);H[q+4>>2]=e;H[q>>2]=w;if(!r){break l}oa(r)}H[i+8>>2]=H[i+8>>2]+1;b=b+1|0;if((t|0)!=(b|0)){continue}break}break k}m:{n:{o:{p:{if(t>>>0<=2){d=H[i+108>>2];H[d>>2]=m;w=1;g=H[i+12>>2];if(g>>>0>1){break p}break m}if(K[i+8>>2]>K[i+4>>2]){break i}b=H[i+120>>2];s=o+1|0;x=N(s,12);d=b+x|0;if((d|0)!=(l|0)){Aa(d,H[l>>2],H[l+4>>2]);b=H[i+120>>2]}b=r+H[b+x>>2]|0;H[b>>2]=H[b>>2]+(1<>2];e=32-k|0;q:{if((n|0)<=(e|0)){e=H[i+28>>2];if((e|0)==H[i+20>>2]){break o}d=H[e>>2];b=k+n|0;H[i+32>>2]=b;w=d<>>32-n|0;if((b|0)!=32){break q}H[i+32>>2]=0;H[i+28>>2]=e+4;break q}g=H[i+28>>2];b=g+4|0;if((b|0)==H[i+20>>2]){break o}d=H[g>>2];H[i+28>>2]=b;b=n-e|0;H[i+32>>2]=b;w=H[g+4>>2]>>>32-b|d<>>32-n}d=t>>>1|0;if(w>>>0>d>>>0){break i}break n}while(1){m=(g-1|0)!=(m|0)?m+1|0:0;H[d+(w<<2)>>2]=m;g=H[i+12>>2];w=w+1|0;if(g>>>0>w>>>0){continue}break}break m}d=t>>>1|0;w=0}r:{s:{e=d-w|0;b=t-e|0;t:{if((b|0)==(e|0)){b=e;break t}n=H[i+88>>2];if((n|0)==H[i+80>>2]){break s}k=H[n>>2];g=H[i+92>>2];d=g+1|0;H[i+92>>2]=d;g=k&-2147483648>>>g;u:{if((d|0)==32){H[i+92>>2]=0;H[i+88>>2]=n+4;if(g){break u}break s}if(!g){break s}}}d=b;b=e;break r}d=e}n=H[i+132>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+x|0,g,H[k+4>>2]);if(b){g=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];w=H[f+12>>2];if((g|0)==(((e|0)!=(w|0)?N(e-w>>2,341)-1|0:0)|0)){xa(f+8|0);w=H[f+12>>2];g=H[f+24>>2]+H[f+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+w>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=m;H[e>>2]=b;H[f+28>>2]=H[f+28>>2]+1}if(!d){break k}g=H[f+28>>2]+H[f+24>>2]|0;b=H[f+16>>2];w=H[f+12>>2];if((g|0)==(((b|0)!=(w|0)?N(b-w>>2,341)-1|0:0)|0)){xa(f+8|0);w=H[f+12>>2];g=H[f+24>>2]+H[f+28>>2]|0}b=(g>>>0)/341|0;b=H[(b<<2)+w>>2]+N(g-N(b,341)|0,12)|0;H[b+8>>2]=s;H[b+4>>2]=m;H[b>>2]=d;m=H[f+28>>2]+1|0;H[f+28>>2]=m;break j}if(!t){break k}while(1){if(H[i+12>>2]){o=H[i+40>>2];n=H[p>>2];w=H[i+96>>2];k=H[i+108>>2];m=0;while(1){q=k+(m<<2)|0;H[w+(H[q>>2]<<2)>>2]=0;g=H[i>>2];e=H[q>>2]<<2;d=H[e+n>>2];v:{if((g|0)==(d|0)){break v}r=e+w|0;u=g-d|0;x=H[i+52>>2];g=32-x|0;if((u|0)<=(g|0)){e=H[i+48>>2];if((e|0)==(o|0)){break i}H[r>>2]=H[e>>2]<>>32-u;d=u+H[i+52>>2]|0;H[i+52>>2]=d;if((d|0)!=32){break v}H[i+52>>2]=0;H[i+48>>2]=e+4;break v}s=H[i+48>>2];d=s+4|0;if((d|0)==(o|0)){break i}e=H[s>>2];H[i+48>>2]=d;d=u-g|0;H[i+52>>2]=d;H[r>>2]=H[s+4>>2]>>>32-d|e<>>32-u}e=H[q>>2]<<2;d=e+w|0;H[d>>2]=H[d>>2]|H[e+H[l>>2]>>2];m=m+1|0;if(m>>>0>2]){continue}break}}jb(z,y);H[i+8>>2]=H[i+8>>2]+1;b=b+1|0;if((t|0)!=(b|0)){continue}break}}m=H[f+28>>2]}if(m){continue}break}}H[f+28>>2]=0;w=H[f+16>>2];m=H[f+12>>2];g=w-m|0;if(g>>>0>=9){while(1){oa(H[m>>2]);m=H[f+12>>2]+4|0;H[f+12>>2]=m;w=H[f+16>>2];g=w-m|0;if(g>>>0>8){continue}break}}b=170;w:{switch((g>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break w}}x:{if((m|0)==(w|0)){break x}while(1){oa(H[m>>2]);m=m+4|0;if((w|0)!=(m|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break x}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break h}}xb(i);break d;case 1:i=wb(B+8|0,3);A=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;y:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break y}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break y}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break y}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break y}H[i+8>>2]=0;if(!ua(i+16|0,b)){break y}if(!ua(i+36|0,b)){break y}if(!ua(i+56|0,b)){break y}if(!ua(i+76|0,b)){break y}p=H[i+4>>2];d=0;f=ca-32|0;ca=f;m=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(m){if(m>>>0>=1073741824){break b}b=m<<2;t=pa(b);H[f+8>>2]=t;d=b+t|0;H[f+16>>2]=d;ra(t,0,b);H[f+12>>2]=d}e=H[i+120>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);m=H[i+12>>2];t=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=t;H[e+8>>2]=H[f+16>>2];t=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;z:{if(m){if(m>>>0>=1073741824){break b}b=m<<2;o=pa(b);H[f+8>>2]=o;t=b+o|0;H[f+16>>2]=t;ra(o,0,b);H[f+12>>2]=t}d=H[i+132>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);t=H[f+12>>2];o=H[f+8>>2]}H[d+4>>2]=t;H[d>>2]=o;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=p;m=H[f+28>>2]+1|0;H[f+28>>2]=m;A:{if(!m){break A}s=i+96|0;while(1){k=H[f+12>>2];g=H[f+24>>2];e=m-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;q=H[b+8>>2];d=H[b+4>>2];l=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(g+m|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}if(l>>>0>p>>>0){break A}b=H[i+12>>2];m=(d|0)!=(b-1|0)?d+1|0:0;if(m>>>0>=b>>>0){break A}b=H[i+120>>2];r=N(q,12);u=b+r|0;e=H[i>>2];x=m<<2;n=r+H[i+132>>2]|0;d=H[x+H[n>>2]>>2];B:{C:{if((e|0)==(d|0)){x=0;if(!l){break C}while(1){b=H[u>>2];y=H[b+8>>2];n=H[b+4>>2];k=H[b>>2];q=H[A>>2];m=H[q+4>>2];b=H[q+8>>2];D:{if(m>>>0>>0){H[m+8>>2]=y;H[m+4>>2]=n;H[m>>2]=k;H[q+4>>2]=m+12;break D}r=H[q>>2];e=(m-r|0)/12|0;g=e+1|0;if(g>>>0>=357913942){break b}d=(b-r|0)/12|0;b=d<<1;g=d>>>0>=178956970?357913941:b>>>0>g>>>0?b:g;if(g){if(g>>>0>=357913942){break a}b=pa(N(g,12))}else{b=0}o=b+N(e,12)|0;H[o+8>>2]=y;H[o+4>>2]=n;H[o>>2]=k;d=o+12|0;if((m|0)!=(r|0)){while(1){o=o-12|0;m=m-12|0;H[o>>2]=H[m>>2];H[o+4>>2]=H[m+4>>2];H[o+8>>2]=H[m+8>>2];if((m|0)!=(r|0)){continue}break}}H[q+8>>2]=b+N(g,12);H[q+4>>2]=d;H[q>>2]=o;if(!r){break D}oa(r)}H[i+8>>2]=H[i+8>>2]+1;x=x+1|0;if((l|0)!=(x|0)){continue}break}break C}E:{F:{G:{H:{if(l>>>0<=2){b=H[i+108>>2];H[b>>2]=m;o=1;t=H[i+12>>2];if(t>>>0>1){break H}break E}if(K[i+8>>2]>K[i+4>>2]){break A}k=b;b=r+12|0;Aa(k+b|0,H[u>>2],H[u+4>>2]);b=x+H[b+H[i+120>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2];e=32-k|0;I:{if((n|0)<=(e|0)){e=H[i+28>>2];if((e|0)==H[i+20>>2]){break G}d=H[e>>2];b=k+n|0;H[i+32>>2]=b;d=d<>>32-n|0;if((b|0)!=32){break I}H[i+32>>2]=0;H[i+28>>2]=e+4;break I}g=H[i+28>>2];b=g+4|0;if((b|0)==H[i+20>>2]){break G}d=H[g>>2];H[i+28>>2]=b;b=n-e|0;H[i+32>>2]=b;d=H[g+4>>2]>>>32-b|d<>>32-n}o=l>>>1|0;if(o>>>0>>0){break A}break F}while(1){m=(t-1|0)!=(m|0)?m+1|0:0;H[b+(o<<2)>>2]=m;o=o+1|0;t=H[i+12>>2];if(o>>>0>>0){continue}break}break E}o=l>>>1|0;d=0}y=q+1|0;J:{K:{e=o-d|0;d=l-e|0;L:{if((d|0)==(e|0)){b=e;break L}n=H[i+88>>2];if((n|0)==H[i+80>>2]){break K}k=H[n>>2];g=H[i+92>>2];b=g+1|0;H[i+92>>2]=b;g=k&-2147483648>>>g;M:{if((b|0)==32){H[i+92>>2]=0;H[i+88>>2]=n+4;if(g){break M}break K}if(!g){break K}}b=d}d=e;break J}b=e}n=H[i+132>>2];k=n+r|0;g=H[k>>2];e=g+x|0;H[e>>2]=H[e>>2]+1;Aa(n+N(y,12)|0,g,H[k+4>>2]);if(d){t=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];o=H[f+12>>2];if((t|0)==(((e|0)!=(o|0)?N(e-o>>2,341)-1|0:0)|0)){xa(f+8|0);t=H[f+24>>2]+H[f+28>>2]|0;o=H[f+12>>2]}e=(t>>>0)/341|0;e=H[o+(e<<2)>>2]+N(t-N(e,341)|0,12)|0;H[e+8>>2]=q;H[e+4>>2]=m;H[e>>2]=d;H[f+28>>2]=H[f+28>>2]+1}if(!b){break C}t=H[f+28>>2]+H[f+24>>2]|0;d=H[f+16>>2];o=H[f+12>>2];if((t|0)==(((d|0)!=(o|0)?N(d-o>>2,341)-1|0:0)|0)){xa(f+8|0);t=H[f+24>>2]+H[f+28>>2]|0;o=H[f+12>>2]}d=(t>>>0)/341|0;d=H[o+(d<<2)>>2]+N(t-N(d,341)|0,12)|0;H[d+8>>2]=y;H[d+4>>2]=m;H[d>>2]=b;m=H[f+28>>2]+1|0;H[f+28>>2]=m;break B}t=0;if(!l){break C}while(1){if(H[i+12>>2]){o=H[i+40>>2];k=H[n>>2];z=H[i+96>>2];g=H[i+108>>2];m=0;while(1){q=g+(m<<2)|0;H[z+(H[q>>2]<<2)>>2]=0;e=H[i>>2];d=H[q>>2]<<2;b=H[d+k>>2];N:{if((e|0)==(b|0)){break N}r=d+z|0;w=e-b|0;x=H[i+52>>2];e=32-x|0;if((w|0)<=(e|0)){d=H[i+48>>2];if((d|0)==(o|0)){break A}H[r>>2]=H[d>>2]<>>32-w;b=w+H[i+52>>2]|0;H[i+52>>2]=b;if((b|0)!=32){break N}H[i+52>>2]=0;H[i+48>>2]=d+4;break N}y=H[i+48>>2];b=y+4|0;if((b|0)==(o|0)){break A}d=H[y>>2];H[i+48>>2]=b;b=w-e|0;H[i+52>>2]=b;H[r>>2]=H[y+4>>2]>>>32-b|d<>>32-w}d=H[q>>2]<<2;b=d+z|0;H[b>>2]=H[b>>2]|H[d+H[u>>2]>>2];m=m+1|0;if(m>>>0>2]){continue}break}}jb(A,s);H[i+8>>2]=H[i+8>>2]+1;t=t+1|0;if((l|0)!=(t|0)){continue}break}}m=H[f+28>>2]}if(m){continue}break}}H[f+28>>2]=0;o=H[f+16>>2];m=H[f+12>>2];t=o-m|0;if(t>>>0>=9){while(1){oa(H[m>>2]);m=H[f+12>>2]+4|0;H[f+12>>2]=m;o=H[f+16>>2];t=o-m|0;if(t>>>0>8){continue}break}}b=170;O:{switch((t>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break O}}P:{if((m|0)==(o|0)){break P}while(1){oa(H[m>>2]);m=m+4|0;if((o|0)!=(m|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break P}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break z}}xb(i);break d;case 2:f=ub(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Q:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Q}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Q}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Q}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Q}H[f+8>>2]=0;if(!ta(f+16|0,b)){break Q}if(!ua(f+32|0,b)){break Q}if(!ua(f+52|0,b)){break Q}if(!ua(f+72|0,b)){break Q}z=H[f+4>>2];g=0;b=0;h=ca-32|0;ca=h;j=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(j){if(j>>>0>=1073741824){break b}d=j<<2;g=pa(d);H[h+8>>2]=g;b=d+g|0;H[h+16>>2]=b;ra(g,0,d);H[h+12>>2]=b}e=H[f+116>>2];d=H[e>>2];if(d){H[e+4>>2]=d;oa(d);j=H[f+12>>2];g=H[h+8>>2];b=H[h+12>>2]}H[e+4>>2]=b;H[e>>2]=g;H[e+8>>2]=H[h+16>>2];g=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;R:{if(j){if(j>>>0>=1073741824){break b}b=j<<2;u=pa(b);H[h+8>>2]=u;g=b+u|0;H[h+16>>2]=g;ra(u,0,b);H[h+12>>2]=g}d=H[f+128>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);u=H[h+8>>2];g=H[h+12>>2]}H[d+4>>2]=g;H[d>>2]=u;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;j=H[h+28>>2]+1|0;H[h+28>>2]=j;S:{if(!j){break S}x=f+92|0;y=f+16|0;while(1){n=H[h+12>>2];g=H[h+24>>2];e=j-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[n+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;p=H[b+8>>2];k=H[b+4>>2];i=H[b>>2];H[h+28>>2]=e;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(g+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}d=0;if(i>>>0>z>>>0){break S}b=H[f+12>>2];j=(k|0)!=(b-1|0)?k+1|0:0;if(j>>>0>=b>>>0){break S}o=N(p,12);A=o+H[f+128>>2]|0;t=o+H[f+116>>2]|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];T:{if((g|0)==(e|0)){if(!i){break T}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];o=H[w>>2];j=H[o+4>>2];b=H[o+8>>2];U:{if(j>>>0>>0){H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;H[o+4>>2]=j+12;break U}q=H[o>>2];g=(j-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}u=b+N(g,12)|0;H[u+8>>2]=r;H[u+4>>2]=s;H[u>>2]=n;e=u+12|0;if((j|0)!=(q|0)){while(1){u=u-12|0;j=j-12|0;H[u>>2]=H[j>>2];H[u+4>>2]=H[j+4>>2];H[u+8>>2]=H[j+8>>2];if((j|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(k,12);H[o+4>>2]=e;H[o>>2]=u;if(!q){break U}oa(q)}H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((i|0)!=(d|0)){continue}break}break T}V:{W:{X:{Y:{if(i>>>0<=2){b=H[f+104>>2];H[b>>2]=j;u=1;g=H[f+12>>2];if(g>>>0>1){break Y}break V}if(K[f+8>>2]>K[f+4>>2]){break S}b=H[f+116>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+116>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(y,Q(i)^31,h+4|0);d=i>>>1|0;b=H[h+4>>2];if(d>>>0>>0){break S}e=d-b|0;d=i-e|0;Z:{if((d|0)==(e|0)){b=e;break Z}n=H[f+84>>2];if((n|0)==H[f+76>>2]){break X}k=H[n>>2];g=H[f+88>>2];b=g+1|0;H[f+88>>2]=b;g=k&-2147483648>>>g;_:{if((b|0)==32){H[f+88>>2]=0;H[f+84>>2]=n+4;if(g){break _}break X}if(!g){break X}}b=d}d=e;break W}while(1){j=(g-1|0)!=(j|0)?j+1|0:0;H[b+(u<<2)>>2]=j;g=H[f+12>>2];u=u+1|0;if(g>>>0>u>>>0){continue}break}break V}b=e}n=H[f+128>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];u=H[h+12>>2];if((g|0)==(((e|0)!=(u|0)?N(e-u>>2,341)-1|0:0)|0)){xa(h+8|0);u=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+u>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break T}g=H[h+28>>2]+H[h+24>>2]|0;d=H[h+16>>2];u=H[h+12>>2];if((g|0)==(((d|0)!=(u|0)?N(d-u>>2,341)-1|0:0)|0)){xa(h+8|0);u=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}d=(g>>>0)/341|0;d=H[(d<<2)+u>>2]+N(g-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;H[h+28>>2]=H[h+28>>2]+1;break T}if(!i){break T}while(1){if(H[f+12>>2]){p=H[f+36>>2];n=H[A>>2];u=H[f+92>>2];k=H[f+104>>2];j=0;while(1){o=k+(j<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];$:{if((g|0)==(b|0)){break $}q=e+u|0;l=g-b|0;r=H[f+48>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+44>>2];if((e|0)==(p|0)){break S}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+48>>2]|0;H[f+48>>2]=b;if((b|0)!=32){break $}H[f+48>>2]=0;H[f+44>>2]=e+4;break $}s=H[f+44>>2];b=s+4|0;if((b|0)==(p|0)){break S}e=H[s>>2];H[f+44>>2]=b;b=l-g|0;H[f+48>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];j=j+1|0;if(j>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((i|0)!=(d|0)){continue}break}}j=H[h+28>>2];if(j){continue}break}}H[h+28>>2]=0;u=H[h+16>>2];j=H[h+12>>2];g=u-j|0;if(g>>>0>=9){while(1){oa(H[j>>2]);j=H[h+12>>2]+4|0;H[h+12>>2]=j;u=H[h+16>>2];g=u-j|0;if(g>>>0>8){continue}break}}b=170;aa:{switch((g>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break aa}}ba:{if((j|0)==(u|0)){break ba}while(1){oa(H[j>>2]);j=j+4|0;if((u|0)!=(j|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break ba}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break R}}vb(f);break d;case 3:i=ub(B+8|0,3);z=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;ca:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break ca}d=e+H[b>>2]|0;H[i>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[i>>2]>32){break ca}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break ca}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break ca}H[i+8>>2]=0;if(!ta(i+16|0,b)){break ca}if(!ua(i+32|0,b)){break ca}if(!ua(i+52|0,b)){break ca}if(!ua(i+72|0,b)){break ca}A=H[i+4>>2];d=0;f=ca-32|0;ca=f;j=H[i+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;if(j){if(j>>>0>=1073741824){break b}b=j<<2;m=pa(b);H[f+8>>2]=m;d=b+m|0;H[f+16>>2]=d;ra(m,0,b);H[f+12>>2]=d}e=H[i+116>>2];b=H[e>>2];if(b){H[e+4>>2]=b;oa(b);j=H[i+12>>2];m=H[f+8>>2];d=H[f+12>>2]}H[e+4>>2]=d;H[e>>2]=m;H[e+8>>2]=H[f+16>>2];m=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;da:{if(j){if(j>>>0>=1073741824){break b}b=j<<2;p=pa(b);H[f+8>>2]=p;m=b+p|0;H[f+16>>2]=m;ra(p,0,b);H[f+12>>2]=m}d=H[i+128>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);m=H[f+12>>2];p=H[f+8>>2]}H[d+4>>2]=m;H[d>>2]=p;H[d+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);d=H[f+24>>2]+H[f+28>>2]|0;b=(d>>>0)/341|0;b=H[H[f+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=A;j=H[f+28>>2]+1|0;H[f+28>>2]=j;ea:{if(!j){break ea}y=i+92|0;s=i+16|0;while(1){k=H[f+12>>2];g=H[f+24>>2];e=j-1|0;d=g+e|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;o=H[b+8>>2];d=H[b+4>>2];t=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(g+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}if(t>>>0>A>>>0){break ea}b=H[i+12>>2];j=(d|0)!=(b-1|0)?d+1|0:0;if(j>>>0>=b>>>0){break ea}b=H[i+116>>2];q=N(o,12);l=b+q|0;e=H[i>>2];r=j<<2;n=q+H[i+128>>2]|0;d=H[r+H[n>>2]>>2];fa:{if((e|0)==(d|0)){r=0;if(!t){break fa}while(1){b=H[l>>2];x=H[b+8>>2];n=H[b+4>>2];k=H[b>>2];o=H[z>>2];j=H[o+4>>2];b=H[o+8>>2];ga:{if(j>>>0>>0){H[j+8>>2]=x;H[j+4>>2]=n;H[j>>2]=k;H[o+4>>2]=j+12;break ga}q=H[o>>2];e=(j-q|0)/12|0;g=e+1|0;if(g>>>0>=357913942){break b}d=(b-q|0)/12|0;b=d<<1;g=d>>>0>=178956970?357913941:b>>>0>g>>>0?b:g;if(g){if(g>>>0>=357913942){break a}b=pa(N(g,12))}else{b=0}p=b+N(e,12)|0;H[p+8>>2]=x;H[p+4>>2]=n;H[p>>2]=k;d=p+12|0;if((j|0)!=(q|0)){while(1){p=p-12|0;j=j-12|0;H[p>>2]=H[j>>2];H[p+4>>2]=H[j+4>>2];H[p+8>>2]=H[j+8>>2];if((j|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(g,12);H[o+4>>2]=d;H[o>>2]=p;if(!q){break ga}oa(q)}H[i+8>>2]=H[i+8>>2]+1;r=r+1|0;if((t|0)!=(r|0)){continue}break}break fa}ha:{ia:{ja:{ka:{if(t>>>0<=2){b=H[i+104>>2];H[b>>2]=j;p=1;m=H[i+12>>2];if(m>>>0>1){break ka}break ha}if(K[i+8>>2]>K[i+4>>2]){break ea}k=b;b=q+12|0;Aa(k+b|0,H[l>>2],H[l+4>>2]);b=r+H[b+H[i+116>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(s,Q(t)^31,f+4|0);d=t>>>1|0;b=H[f+4>>2];if(d>>>0>>0){break ea}x=o+1|0;e=d-b|0;d=t-e|0;la:{if((d|0)==(e|0)){b=e;break la}n=H[i+84>>2];if((n|0)==H[i+76>>2]){break ja}k=H[n>>2];g=H[i+88>>2];b=g+1|0;H[i+88>>2]=b;g=k&-2147483648>>>g;ma:{if((b|0)==32){H[i+88>>2]=0;H[i+84>>2]=n+4;if(g){break ma}break ja}if(!g){break ja}}b=d}d=e;break ia}while(1){j=(m-1|0)!=(j|0)?j+1|0:0;H[b+(p<<2)>>2]=j;m=H[i+12>>2];p=p+1|0;if(m>>>0>p>>>0){continue}break}break ha}b=e}n=H[i+128>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+N(x,12)|0,g,H[k+4>>2]);if(d){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];p=H[f+12>>2];if((m|0)==(((e|0)!=(p|0)?N(e-p>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;p=H[f+12>>2]}e=(m>>>0)/341|0;e=H[p+(e<<2)>>2]+N(m-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=j;H[e>>2]=d;H[f+28>>2]=H[f+28>>2]+1}if(!b){break fa}m=H[f+28>>2]+H[f+24>>2]|0;d=H[f+16>>2];p=H[f+12>>2];if((m|0)==(((d|0)!=(p|0)?N(d-p>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;p=H[f+12>>2]}d=(m>>>0)/341|0;d=H[p+(d<<2)>>2]+N(m-N(d,341)|0,12)|0;H[d+8>>2]=x;H[d+4>>2]=j;H[d>>2]=b;H[f+28>>2]=H[f+28>>2]+1;break fa}m=0;if(!t){break fa}while(1){if(H[i+12>>2]){p=H[i+36>>2];k=H[n>>2];w=H[i+92>>2];g=H[i+104>>2];j=0;while(1){o=g+(j<<2)|0;H[w+(H[o>>2]<<2)>>2]=0;e=H[i>>2];d=H[o>>2]<<2;b=H[d+k>>2];na:{if((e|0)==(b|0)){break na}q=d+w|0;u=e-b|0;r=H[i+48>>2];e=32-r|0;if((u|0)<=(e|0)){d=H[i+44>>2];if((d|0)==(p|0)){break ea}H[q>>2]=H[d>>2]<>>32-u;b=u+H[i+48>>2]|0;H[i+48>>2]=b;if((b|0)!=32){break na}H[i+48>>2]=0;H[i+44>>2]=d+4;break na}x=H[i+44>>2];b=x+4|0;if((b|0)==(p|0)){break ea}d=H[x>>2];H[i+44>>2]=b;b=u-e|0;H[i+48>>2]=b;H[q>>2]=H[x+4>>2]>>>32-b|d<>>32-u}d=H[o>>2]<<2;b=d+w|0;H[b>>2]=H[b>>2]|H[d+H[l>>2]>>2];j=j+1|0;if(j>>>0>2]){continue}break}}jb(z,y);H[i+8>>2]=H[i+8>>2]+1;m=m+1|0;if((t|0)!=(m|0)){continue}break}}j=H[f+28>>2];if(j){continue}break}}H[f+28>>2]=0;p=H[f+16>>2];j=H[f+12>>2];m=p-j|0;if(m>>>0>=9){while(1){oa(H[j>>2]);j=H[f+12>>2]+4|0;H[f+12>>2]=j;p=H[f+16>>2];m=p-j|0;if(m>>>0>8){continue}break}}b=170;oa:{switch((m>>>2|0)-1|0){case 1:b=341;case 0:H[f+24>>2]=b;break;default:break oa}}pa:{if((j|0)==(p|0)){break pa}while(1){oa(H[j>>2]);j=j+4|0;if((p|0)!=(j|0)){continue}break}d=H[f+16>>2];b=H[f+12>>2];if((d|0)==(b|0)){break pa}H[f+16>>2]=d+((b-d|0)+3&-4)}b=H[f+8>>2];if(b){oa(b)}ca=f+32|0;break da}}vb(i);break d;case 4:f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;qa:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break qa}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break qa}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break qa}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break qa}H[f+8>>2]=0;if(!sb(f+16|0,b)){break qa}if(!ua(f+544|0,b)){break qa}if(!ua(f+564|0,b)){break qa}if(!ua(f+584|0,b)){break qa}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;ra:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;j=pa(b);H[h+8>>2]=j;l=b+j|0;H[h+16>>2]=l;ra(j,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);j=H[h+8>>2];l=H[h+12>>2]}H[d+4>>2]=l;H[d>>2]=j;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;sa:{if(!d){break sa}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;p=H[b+8>>2];e=H[b+4>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break sa}b=H[f+12>>2];j=(e|0)!=(b-1|0)?e+1|0:0;if(j>>>0>=b>>>0){break sa}o=N(p,12);A=o+H[f+640>>2]|0;t=o+H[f+628>>2]|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];ta:{ua:{if((g|0)==(e|0)){o=0;if(!i){break ua}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];p=H[w>>2];d=H[p+4>>2];b=H[p+8>>2];va:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[p+4>>2]=d+12;break va}q=H[p>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}j=b+N(g,12)|0;H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;e=j+12|0;if((d|0)!=(q|0)){while(1){j=j-12|0;d=d-12|0;H[j>>2]=H[d>>2];H[j+4>>2]=H[d+4>>2];H[j+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[p+8>>2]=b+N(k,12);H[p+4>>2]=e;H[p>>2]=j;if(!q){break va}oa(q)}H[f+8>>2]=H[f+8>>2]+1;o=o+1|0;if((i|0)!=(o|0)){continue}break}break ua}wa:{xa:{ya:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=j;d=1;l=H[f+12>>2];if(l>>>0>1){break ya}break wa}if(K[f+8>>2]>K[f+4>>2]){break sa}b=H[f+628>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+628>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break xa}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break xa}break sa}while(1){j=(l-1|0)!=(j|0)?j+1|0:0;H[b+(d<<2)>>2]=j;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break wa}za:{Aa:{e=d-l|0;d=i-e|0;Ba:{if((d|0)==(e|0)){b=e;break Ba}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break Aa}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;Ca:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break Ca}break Aa}if(!g){break Aa}}b=d}d=e;break za}b=e}n=H[f+640>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((g|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+l>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break ua}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break ta}j=0;if(!i){break ua}while(1){if(H[f+12>>2]){p=H[f+548>>2];n=H[A>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){o=k+(d<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];Da:{if((g|0)==(b|0)){break Da}q=e+u|0;l=g-b|0;r=H[f+560>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(p|0)){break sa}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break Da}H[f+560>>2]=0;H[f+556>>2]=e+4;break Da}s=H[f+556>>2];b=s+4|0;if((b|0)==(p|0)){break sa}e=H[s>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;j=j+1|0;if((i|0)!=(j|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;j=H[h+16>>2];d=H[h+12>>2];l=j-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;j=H[h+16>>2];l=j-d|0;if(l>>>0>8){continue}break}}b=170;Ea:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break Ea}}Fa:{if((d|0)==(j|0)){break Fa}while(1){oa(H[d>>2]);d=d+4|0;if((j|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break Fa}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break ra}}ab(f);break d;case 5:f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Ga:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Ga}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Ga}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Ga}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Ga}H[f+8>>2]=0;if(!sb(f+16|0,b)){break Ga}if(!ua(f+544|0,b)){break Ga}if(!ua(f+564|0,b)){break Ga}if(!ua(f+584|0,b)){break Ga}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;Ha:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;p=pa(b);H[h+8>>2]=p;l=b+p|0;H[h+16>>2]=l;ra(p,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);l=H[h+12>>2];p=H[h+8>>2]}H[d+4>>2]=l;H[d>>2]=p;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;Ia:{if(!d){break Ia}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;o=H[b+8>>2];e=H[b+4>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break Ia}m=0;b=H[f+12>>2];p=(e|0)!=(b-1|0)?e+1|0:0;if(p>>>0>=b>>>0){break Ia}b=H[f+628>>2];q=N(o,12);t=b+q|0;e=H[f>>2];r=p<<2;s=q+H[f+640>>2]|0;d=H[r+H[s>>2]>>2];Ja:{Ka:{if((e|0)==(d|0)){if(!i){break Ka}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];o=H[w>>2];d=H[o+4>>2];b=H[o+8>>2];La:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[o+4>>2]=d+12;break La}q=H[o>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}p=b+N(g,12)|0;H[p+8>>2]=r;H[p+4>>2]=s;H[p>>2]=n;e=p+12|0;if((d|0)!=(q|0)){while(1){p=p-12|0;d=d-12|0;H[p>>2]=H[d>>2];H[p+4>>2]=H[d+4>>2];H[p+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[o+8>>2]=b+N(k,12);H[o+4>>2]=e;H[o>>2]=p;if(!q){break La}oa(q)}H[f+8>>2]=H[f+8>>2]+1;m=m+1|0;if((i|0)!=(m|0)){continue}break}break Ka}Ma:{Na:{Oa:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=p;d=1;l=H[f+12>>2];if(l>>>0>1){break Oa}break Ma}if(K[f+8>>2]>K[f+4>>2]){break Ia}k=b;b=q+12|0;Aa(k+b|0,H[t>>2],H[t+4>>2]);b=r+H[b+H[f+628>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break Na}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break Na}break Ia}while(1){p=(l-1|0)!=(p|0)?p+1|0:0;H[b+(d<<2)>>2]=p;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break Ma}s=o+1|0;Pa:{Qa:{e=d-l|0;d=i-e|0;Ra:{if((d|0)==(e|0)){b=e;break Ra}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break Qa}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;Sa:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break Sa}break Qa}if(!g){break Qa}}b=d}d=e;break Pa}b=e}n=H[f+640>>2];k=n+q|0;g=H[k>>2];e=g+r|0;H[e>>2]=H[e>>2]+1;Aa(n+N(s,12)|0,g,H[k+4>>2]);if(d){m=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((m|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);m=H[h+24>>2]+H[h+28>>2]|0;l=H[h+12>>2]}e=(m>>>0)/341|0;e=H[l+(e<<2)>>2]+N(m-N(e,341)|0,12)|0;H[e+8>>2]=o;H[e+4>>2]=p;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break Ka}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=p;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break Ja}if(!i){break Ka}while(1){if(H[f+12>>2]){A=H[f+548>>2];n=H[s>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){p=k+(d<<2)|0;H[u+(H[p>>2]<<2)>>2]=0;g=H[f>>2];e=H[p>>2]<<2;b=H[e+n>>2];Ta:{if((g|0)==(b|0)){break Ta}o=e+u|0;l=g-b|0;q=H[f+560>>2];g=32-q|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(A|0)){break Ia}H[o>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break Ta}H[f+560>>2]=0;H[f+556>>2]=e+4;break Ta}r=H[f+556>>2];b=r+4|0;if((b|0)==(A|0)){break Ia}e=H[r>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[o>>2]=H[r+4>>2]>>>32-b|e<>>32-l}e=H[p>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;m=m+1|0;if((i|0)!=(m|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;p=H[h+16>>2];d=H[h+12>>2];l=p-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;p=H[h+16>>2];l=p-d|0;if(l>>>0>8){continue}break}}b=170;Ua:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break Ua}}Va:{if((d|0)==(p|0)){break Va}while(1){oa(H[d>>2]);d=d+4|0;if((p|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break Va}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break Ha}}ab(f);break d;case 6:break f;default:break c}}f=$a(B+8|0,3);w=B+664|0;k=H[b+8>>2];n=H[b+12>>2];d=H[b+20>>2];e=H[b+16>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;Wa:{if(g>>>0>k>>>0&(d|0)>=(n|0)|(d|0)>(n|0)){break Wa}d=e+H[b>>2]|0;H[f>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[b+20>>2];k=d;g=H[b+16>>2];e=g+4|0;d=e>>>0<4?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;if(K[f>>2]>32){break Wa}n=H[b+8>>2];s=H[b+12>>2];d=k;g=g+8|0;d=g>>>0<8?d+1|0:d;if(g>>>0>n>>>0&(d|0)>=(s|0)|(d|0)>(s|0)){break Wa}d=e+H[b>>2]|0;e=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[f+4>>2]=e;g=H[b+20>>2];d=H[b+16>>2]+4|0;g=d>>>0<4?g+1|0:g;H[b+16>>2]=d;H[b+20>>2]=g;if(!e){break Wa}H[f+8>>2]=0;if(!sb(f+16|0,b)){break Wa}if(!ua(f+544|0,b)){break Wa}if(!ua(f+564|0,b)){break Wa}if(!ua(f+584|0,b)){break Wa}z=H[f+4>>2];l=0;b=0;h=ca-32|0;ca=h;d=H[f+12>>2];H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;if(d){if(d>>>0>=1073741824){break b}e=d<<2;l=pa(e);H[h+8>>2]=l;b=e+l|0;H[h+16>>2]=b;ra(l,0,e);H[h+12>>2]=b}g=H[f+628>>2];e=H[g>>2];if(e){H[g+4>>2]=e;oa(e);d=H[f+12>>2];l=H[h+8>>2];b=H[h+12>>2]}H[g+4>>2]=b;H[g>>2]=l;H[g+8>>2]=H[h+16>>2];l=0;H[h+16>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;Xa:{if(d){if(d>>>0>=1073741824){break b}b=d<<2;j=pa(b);H[h+8>>2]=j;l=b+j|0;H[h+16>>2]=l;ra(j,0,b);H[h+12>>2]=l}d=H[f+640>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b);j=H[h+8>>2];l=H[h+12>>2]}H[d+4>>2]=l;H[d>>2]=j;H[d+8>>2]=H[h+16>>2];H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h+8>>2]=0;H[h+12>>2]=0;xa(h+8|0);d=H[h+24>>2]+H[h+28>>2]|0;b=(d>>>0)/341|0;b=H[H[h+12>>2]+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;H[b+4>>2]=0;H[b+8>>2]=0;H[b>>2]=z;d=H[h+28>>2]+1|0;H[h+28>>2]=d;Ya:{if(!d){break Ya}x=f+604|0;y=f+16|0;while(1){n=H[h+12>>2];k=H[h+24>>2];g=d-1|0;e=k+g|0;b=(e>>>0)/341|0;b=H[n+(b<<2)>>2]+N(e-N(b,341)|0,12)|0;p=H[b+8>>2];i=H[b>>2];H[h+28>>2]=g;b=H[h+16>>2];if((((b|0)!=(n|0)?N(b-n>>2,341)-1|0:0)-(d+k|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[h+16>>2]=H[h+16>>2]-4}if(i>>>0>z>>>0){break Ya}b=H[f+628>>2];o=N(p,12);A=o+H[f+640>>2]|0;j=Vd(f,i,A);if(j>>>0>=K[f+12>>2]){break Ya}t=b+o|0;g=H[f>>2];q=j<<2;e=H[q+H[A>>2]>>2];Za:{_a:{if((g|0)==(e|0)){o=0;if(!i){break _a}while(1){b=H[t>>2];r=H[b+8>>2];s=H[b+4>>2];n=H[b>>2];p=H[w>>2];d=H[p+4>>2];b=H[p+8>>2];$a:{if(d>>>0>>0){H[d+8>>2]=r;H[d+4>>2]=s;H[d>>2]=n;H[p+4>>2]=d+12;break $a}q=H[p>>2];g=(d-q|0)/12|0;k=g+1|0;if(k>>>0>=357913942){break b}e=(b-q|0)/12|0;b=e<<1;k=e>>>0>=178956970?357913941:b>>>0>k>>>0?b:k;if(k){if(k>>>0>=357913942){break a}b=pa(N(k,12))}else{b=0}j=b+N(g,12)|0;H[j+8>>2]=r;H[j+4>>2]=s;H[j>>2]=n;e=j+12|0;if((d|0)!=(q|0)){while(1){j=j-12|0;d=d-12|0;H[j>>2]=H[d>>2];H[j+4>>2]=H[d+4>>2];H[j+8>>2]=H[d+8>>2];if((d|0)!=(q|0)){continue}break}}H[p+8>>2]=b+N(k,12);H[p+4>>2]=e;H[p>>2]=j;if(!q){break $a}oa(q)}H[f+8>>2]=H[f+8>>2]+1;o=o+1|0;if((i|0)!=(o|0)){continue}break}break _a}ab:{bb:{cb:{if(i>>>0<=2){b=H[f+616>>2];H[b>>2]=j;d=1;l=H[f+12>>2];if(l>>>0>1){break cb}break ab}if(K[f+8>>2]>K[f+4>>2]){break Ya}b=H[f+628>>2];s=p+1|0;r=N(s,12);d=b+r|0;if((d|0)!=(t|0)){Aa(d,H[t>>2],H[t+4>>2]);b=H[f+628>>2]}b=q+H[b+r>>2]|0;H[b>>2]=H[b>>2]+(1<>>1|0;break bb}while(1){l=Ba(y+(d<<4)|0)|l<<1;d=d+1|0;if((b|0)!=(d|0)){continue}break}d=i>>>1|0;if(l>>>0<=d>>>0){break bb}break Ya}while(1){j=(l-1|0)!=(j|0)?j+1|0:0;H[b+(d<<2)>>2]=j;d=d+1|0;l=H[f+12>>2];if(d>>>0>>0){continue}break}break ab}db:{eb:{e=d-l|0;d=i-e|0;fb:{if((d|0)==(e|0)){b=e;break fb}n=H[f+596>>2];if((n|0)==H[f+588>>2]){break eb}k=H[n>>2];g=H[f+600>>2];b=g+1|0;H[f+600>>2]=b;g=k&-2147483648>>>g;gb:{if((b|0)==32){H[f+600>>2]=0;H[f+596>>2]=n+4;if(g){break gb}break eb}if(!g){break eb}}b=d}d=e;break db}b=e}n=H[f+640>>2];k=n+o|0;g=H[k>>2];e=g+q|0;H[e>>2]=H[e>>2]+1;Aa(n+r|0,g,H[k+4>>2]);if(d){g=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];l=H[h+12>>2];if((g|0)==(((e|0)!=(l|0)?N(e-l>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+12>>2];g=H[h+24>>2]+H[h+28>>2]|0}e=(g>>>0)/341|0;e=H[(e<<2)+l>>2]+N(g-N(e,341)|0,12)|0;H[e+8>>2]=p;H[e+4>>2]=j;H[e>>2]=d;H[h+28>>2]=H[h+28>>2]+1}if(!b){break _a}l=H[h+28>>2]+H[h+24>>2]|0;e=H[h+16>>2];d=H[h+12>>2];if((l|0)==(((d|0)!=(e|0)?N(e-d>>2,341)-1|0:0)|0)){xa(h+8|0);l=H[h+24>>2]+H[h+28>>2]|0;e=H[h+12>>2]}else{e=d}d=(l>>>0)/341|0;d=H[e+(d<<2)>>2]+N(l-N(d,341)|0,12)|0;H[d+8>>2]=s;H[d+4>>2]=j;H[d>>2]=b;d=H[h+28>>2]+1|0;H[h+28>>2]=d;break Za}j=0;if(!i){break _a}while(1){if(H[f+12>>2]){p=H[f+548>>2];n=H[A>>2];u=H[f+604>>2];k=H[f+616>>2];d=0;while(1){o=k+(d<<2)|0;H[u+(H[o>>2]<<2)>>2]=0;g=H[f>>2];e=H[o>>2]<<2;b=H[e+n>>2];hb:{if((g|0)==(b|0)){break hb}q=e+u|0;l=g-b|0;r=H[f+560>>2];g=32-r|0;if((l|0)<=(g|0)){e=H[f+556>>2];if((e|0)==(p|0)){break Ya}H[q>>2]=H[e>>2]<>>32-l;b=l+H[f+560>>2]|0;H[f+560>>2]=b;if((b|0)!=32){break hb}H[f+560>>2]=0;H[f+556>>2]=e+4;break hb}s=H[f+556>>2];b=s+4|0;if((b|0)==(p|0)){break Ya}e=H[s>>2];H[f+556>>2]=b;b=l-g|0;H[f+560>>2]=b;H[q>>2]=H[s+4>>2]>>>32-b|e<>>32-l}e=H[o>>2]<<2;b=e+u|0;H[b>>2]=H[b>>2]|H[e+H[t>>2]>>2];d=d+1|0;if(d>>>0>2]){continue}break}}jb(w,x);H[f+8>>2]=H[f+8>>2]+1;j=j+1|0;if((i|0)!=(j|0)){continue}break}}d=H[h+28>>2]}if(d){continue}break}}H[h+28>>2]=0;j=H[h+16>>2];d=H[h+12>>2];l=j-d|0;if(l>>>0>=9){while(1){oa(H[d>>2]);d=H[h+12>>2]+4|0;H[h+12>>2]=d;j=H[h+16>>2];l=j-d|0;if(l>>>0>8){continue}break}}b=170;ib:{switch((l>>>2|0)-1|0){case 1:b=341;case 0:H[h+24>>2]=b;break;default:break ib}}jb:{if((d|0)==(j|0)){break jb}while(1){oa(H[d>>2]);d=d+4|0;if((j|0)!=(d|0)){continue}break}d=H[h+16>>2];b=H[h+12>>2];if((d|0)==(b|0)){break jb}H[h+16>>2]=d+((b-d|0)+3&-4)}b=H[h+8>>2];if(b){oa(b)}ca=h+32|0;break Xa}}ab(f)}n=H[a+12>>2]==((H[c+4>>2]-H[c>>2]|0)/12|0)}ca=B+672|0;return n}sa();v()}wa();v()}function kd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;if(!a){return 1}e=H[c+20>>2];g=H[c+12>>2];i=H[c+16>>2];a:{if((e|0)>=(g|0)&i>>>0>=K[c+8>>2]|(e|0)>(g|0)){break a}g=I[i+H[c>>2]|0];i=i+1|0;e=i?e:e+1|0;H[c+16>>2]=i;H[c+20>>2]=e;b:{switch(g|0){case 0:e=a;f=b;i=d;a=0;d=0;m=ca+-64|0;ca=m;H[m+56>>2]=0;H[m+48>>2]=0;H[m+52>>2]=0;H[m+40>>2]=0;H[m+44>>2]=0;H[m+32>>2]=0;H[m+36>>2]=0;H[m+24>>2]=0;H[m+28>>2]=0;H[m+16>>2]=0;H[m+20>>2]=0;H[m+8>>2]=0;H[m+12>>2]=0;c:{if(!Ne(m+8|0,c)){break c}if(!Me(m+8|0,c)|(H[m+20>>2]?0:e)){break c}Db(c,0,0);if(e){s=f<<2;t=H[m+36>>2];w=H[m+48>>2];x=H[m+24>>2];l=H[m+56>>2];j=H[m+52>>2];while(1){d:{if(l>>>0>16383){break d}while(1){if((j|0)<=0){break d}j=j-1|0;H[m+52>>2]=j;l=I[j+w|0]|l<<8;H[m+56>>2]=l;if(l>>>0<16384){continue}break}}a=l&4095;r=H[(a<<2)+x>>2];b=(r<<3)+t|0;l=(N(H[b>>2],l>>>12|0)+a|0)-H[b+4>>2]|0;H[m+56>>2]=l;if((f|0)>0){a=0;if(!I[c+36|0]|r>>>0>32){break c}g=d+f|0;e:{if(!r){ra(i+(d<<2)|0,0,s);break e}y=r&-2;z=r&1;b=H[c+32>>2];h=H[c+28>>2];n=H[c+24>>2];while(1){k=0;a=b;o=0;q=0;if((r|0)!=1){while(1){p=n+(a>>>3|0)|0;f:{if(p>>>0>=h>>>0){p=0;break f}p=I[p|0];b=a+1|0;H[c+32>>2]=b;p=p>>>(a&7)&1;a=b}p=p<>>3|0)|0;if(u>>>0>>0){o=I[u|0];b=a+1|0;H[c+32>>2]=b;o=o>>>(a&7)&1;a=b}u=k|1;k=k+2|0;o=p|o<>>3|0)|0;if(p>>>0>>0){p=I[p|0];b=a+1|0;H[c+32>>2]=b;a=p>>>(a&7)&1}else{a=0}o=a<>2]=o;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=g}v=f+v|0;if(e>>>0>v>>>0){continue}break}}F[c+36|0]=0;b=H[c+20>>2];e=0;d=H[c+32>>2]+7|0;e=d>>>0<7?1:e;d=(e&7)<<29|d>>>3;a=d+H[c+16>>2]|0;e=(e>>>3|0)+b|0;H[c+16>>2]=a;H[c+20>>2]=a>>>0>>0?e+1|0:e;a=1}b=H[m+36>>2];if(b){H[m+40>>2]=b;oa(b)}b=H[m+24>>2];if(b){H[m+28>>2]=b;oa(b)}b=H[m+8>>2];if(b){H[m+12>>2]=b;oa(b)}ca=m- -64|0;return a;case 1:break b;default:break a}}b=0;e=H[c+20>>2];g=H[c+12>>2];i=H[c+16>>2];g:{if((e|0)>=(g|0)&i>>>0>=K[c+8>>2]|(e|0)>(g|0)){break g}g=I[i+H[c>>2]|0];i=i+1|0;e=i?e:e+1|0;H[c+16>>2]=i;H[c+20>>2]=e;h:{switch(g-1|0){case 8:g=a;r=d;i=ca+-64|0;ca=i;H[i+56>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+32>>2]=0;H[i+36>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;H[i+16>>2]=0;H[i+20>>2]=0;H[i+8>>2]=0;H[i+12>>2]=0;j=i+8|0;a=J[c+38>>1];i:{j:{if(!a){break j}k:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break j}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break k}if(!hb(1,j+12|0,c)){break j}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break j}b=H[j>>2];a=H[j+4>>2]-b>>2;l:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break l}if(a>>>0<=h>>>0){break l}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break i}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];m=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=m>>>0|(e|0)>(n|0)){break i}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;m:{n:{o:{p:{t=p&3;switch(t|0){case 0:break n;case 3:break p;default:break o}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break i}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break m}while(1){if((f|0)==(m|0)&(e|0)==(n|0)){break j}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;q:{if(b>>>0<=32767){ya(a,8192-(b>>>2|0)|0);break q}if((b|0)==32768){break q}H[j+20>>2]=d+32768}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;r:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break r}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break j}}m=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>8192){break j}s:{if(a>>>0>=d>>>0){break s}l=0;j=e&7;if(j){while(1){H[m+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break s}while(1){e=m+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==8192}d=k}t:{if(!d|(H[i+20>>2]?0:g)){break t}d=0;m=ca-16|0;ca=m;u:{v:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break u}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break v}if(!gb(1,m+8|0,c)){break u}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[m+8>>2];k=H[m+12>>2]}j=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>j>>>0|b>>>0>>0){break u}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break u}b=H[c>>2]+f|0;H[i+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];w:{if(e>>>0<=63){H[i+52>>2]=c;a=I[f|0]&63;break w}x:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break u}a=a-2|0;H[i+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break w;case 1:if(a>>>0<3){break u}a=a-3|0;H[i+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break w;default:break x}}a=a-4|0;H[i+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[i+56>>2]=a+32768;d=a>>>0<8355840}ca=m+16|0;if(!d){break t}if(!g){o=1;break t}b=H[i+52>>2];a=H[i+56>>2];c=H[i+36>>2];d=H[i+48>>2];f=H[i+24>>2];while(1){y:{if(a>>>0>32767){break y}while(1){if((b|0)<=0){break y}b=b-1|0;H[i+52>>2]=b;a=I[b+d|0]|a<<8;H[i+56>>2]=a;if(a>>>0<32768){continue}break}}e=a&8191;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>13|0)+e|0)-H[k+4>>2]|0;H[i+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((g|0)!=(q|0)){continue}break}}a=H[i+36>>2];if(a){H[i+40>>2]=a;oa(a)}a=H[i+24>>2];if(a){H[i+28>>2]=a;oa(a)}a=H[i+8>>2];if(a){H[i+12>>2]=a;oa(a)}ca=i- -64|0;b=o;break g;case 9:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];z:{A:{if(!a){break A}B:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break A}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break B}if(!hb(1,j+12|0,c)){break A}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break A}b=H[j>>2];a=H[j+4>>2]-b>>2;C:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break C}if(a>>>0<=h>>>0){break C}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break z}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break z}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;D:{E:{F:{G:{t=p&3;switch(t|0){case 0:break E;case 3:break G;default:break F}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break z}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break D}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break A}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;H:{if(b>>>0<=131071){ya(a,32768-(b>>>2|0)|0);break H}if((b|0)==131072){break H}H[j+20>>2]=d+131072}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;I:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break I}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break A}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>32768){break A}J:{if(a>>>0>=d>>>0){break J}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break J}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==32768}d=k}K:{if(!d|(H[g+20>>2]?0:m)){break K}d=0;j=ca-16|0;ca=j;L:{M:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break L}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break M}if(!gb(1,j+8|0,c)){break L}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[j+8>>2];k=H[j+12>>2]}i=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>i>>>0|b>>>0>>0){break L}i=e+k|0;b=a+f|0;i=b>>>0>>0?i+1|0:i;H[c+16>>2]=b;H[c+20>>2]=i;if((a|0)<=0){break L}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];N:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break N}O:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break L}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break N;case 1:if(a>>>0<3){break L}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break N;default:break O}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+131072;d=a>>>0<33423360}ca=j+16|0;if(!d){break K}if(!m){o=1;break K}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){P:{if(a>>>0>131071){break P}while(1){if((b|0)<=0){break P}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<131072){continue}break}}e=a&32767;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>15|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 10:m=a;j=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;n=g+8|0;a=J[c+38>>1];Q:{R:{if(!a){break R}S:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break R}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[n+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break S}if(!hb(1,n+12|0,c)){break R}f=H[c+16>>2];e=H[c+20>>2];h=H[n+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break R}b=H[n>>2];a=H[n+4>>2]-b>>2;T:{if(a>>>0>>0){ya(n,h-a|0);h=H[n+12>>2];break T}if(a>>>0<=h>>>0){break T}H[n+4>>2]=b+(h<<2)}d=1;if(!h){break Q}f=H[c+16>>2];e=H[c+20>>2];t=H[n>>2];r=H[c+8>>2];p=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(p|0)&f>>>0>=r>>>0|(e|0)>(p|0)){break Q}d=H[c>>2];s=I[d+f|0];f=f+1|0;i=f?e:e+1|0;H[c+16>>2]=f;e=i;H[c+20>>2]=e;a=s>>>2|0;l=0;U:{V:{W:{X:{i=s&3;switch(i|0){case 0:break V;case 3:break X;default:break W}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break Q}ra(t+(b<<2)|0,0,(s&252)+4|0);b=a;break U}while(1){if((f|0)==(r|0)&(e|0)==(p|0)){break R}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((i|0)!=(l|0)){continue}break}}H[t+(b<<2)>>2]=a}b=b+1|0;h=H[n+12>>2];if(b>>>0>>0){continue}break}a=n+16|0;r=H[n>>2];d=H[n+16>>2];b=H[n+20>>2]-d|0;Y:{if(b>>>0<=262143){ya(a,65536-(b>>>2|0)|0);break Y}if((b|0)==262144){break Y}H[n+20>>2]=d+262144}d=n+28|0;b=H[d>>2];f=H[n+32>>2]-b>>3;Z:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break Z}if(f>>>0>h>>>0){H[n+32>>2]=(h<<3)+b}if(!h){break R}}i=H[a>>2];f=0;d=0;while(1){e=r+(f<<2)|0;l=H[e>>2];n=(f<<3)+b|0;a=d;H[n+4>>2]=a;H[n>>2]=l;e=H[e>>2];d=e+a|0;if(d>>>0>65536){break R}_:{if(a>>>0>=d>>>0){break _}l=0;n=e&7;if(n){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((n|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break _}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==65536}d=k}$:{if(!d|(H[g+20>>2]?0:m)){break $}d=0;i=ca-16|0;ca=i;aa:{ba:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break aa}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break ba}if(!gb(1,i+8|0,c)){break aa}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[i+8>>2];k=H[i+12>>2]}r=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>r>>>0|b>>>0>>0){break aa}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break aa}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];ca:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break ca}da:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break aa}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break ca;case 1:if(a>>>0<3){break aa}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break ca;default:break da}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+262144;d=a>>>0<66846720}ca=i+16|0;if(!d){break $}if(!m){o=1;break $}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){ea:{if(a>>>0>262143){break ea}while(1){if((b|0)<=0){break ea}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<262144){continue}break}}e=a&65535;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>16|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[j+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 11:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];fa:{ga:{if(!a){break ga}ha:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];e=H[c+20>>2];a=H[c+16>>2];f=a+4|0;e=f>>>0<4?e+1|0:e;if(d>>>0>>0&(b|0)<=(e|0)|(b|0)<(e|0)){break ga}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;i=H[c+20>>2];f=H[c+16>>2]+4|0;i=f>>>0<4?i+1|0:i;H[c+16>>2]=f;e=i;H[c+20>>2]=e;break ha}if(!hb(1,j+12|0,c)){break ga}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break ga}b=H[j>>2];a=H[j+4>>2]-b>>2;ia:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break ia}if(a>>>0<=h>>>0){break ia}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break fa}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break fa}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;ja:{ka:{la:{ma:{t=p&3;switch(t|0){case 0:break ka;case 3:break ma;default:break la}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break fa}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break ja}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break ga}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;na:{if(b>>>0<=1048575){ya(a,262144-(b>>>2|0)|0);break na}if((b|0)==1048576){break na}H[j+20>>2]=d- -1048576}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;oa:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break oa}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break ga}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>262144){break ga}pa:{if(a>>>0>=d>>>0){break pa}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break pa}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==262144}d=k}qa:{if(!d|(H[g+20>>2]?0:m)){break qa}d=0;j=ca-16|0;ca=j;ra:{sa:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;i=H[c+20>>2];k=H[c+16>>2];f=k+8|0;i=f>>>0<8?i+1|0:i;e=i;if(b>>>0>>0&(e|0)>=(a|0)|(a|0)<(e|0)){break ra}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break sa}if(!gb(1,j+8|0,c)){break ra}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[j+8>>2];k=H[j+12>>2]}i=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>i>>>0|b>>>0>>0){break ra}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break ra}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];ta:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break ta}ua:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break ra}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break ta;case 1:if(a>>>0<3){break ra}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break ta;default:break ua}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a- -1048576;d=a>>>0<267386880}ca=j+16|0;if(!d){break qa}if(!m){o=1;break qa}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){va:{if(a>>>0>1048575){break va}while(1){if((b|0)<=0){break va}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<1048576){continue}break}}e=a&262143;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>18|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 12:m=a;r=d;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;a=J[c+38>>1];wa:{xa:{if(!a){break xa}ya:{if(a>>>0<=511){d=H[c+8>>2];b=H[c+12>>2];i=H[c+20>>2];a=H[c+16>>2];f=a+4|0;i=f>>>0<4?i+1|0:i;if(d>>>0>>0&(b|0)<=(i|0)|(b|0)<(i|0)){break xa}a=a+H[c>>2]|0;h=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);H[j+12>>2]=h;e=H[c+20>>2];f=H[c+16>>2]+4|0;e=f>>>0<4?e+1|0:e;H[c+16>>2]=f;H[c+20>>2]=e;break ya}if(!hb(1,j+12|0,c)){break xa}f=H[c+16>>2];e=H[c+20>>2];h=H[j+12>>2]}a=H[c+8>>2];d=a-f|0;a=H[c+12>>2]-((a>>>0>>0)+e|0)|0;if(d>>>0>>6>>>0&(a|0)<=0|(a|0)<0){break xa}b=H[j>>2];a=H[j+4>>2]-b>>2;za:{if(a>>>0>>0){ya(j,h-a|0);h=H[j+12>>2];break za}if(a>>>0<=h>>>0){break za}H[j+4>>2]=b+(h<<2)}d=1;if(!h){break wa}f=H[c+16>>2];e=H[c+20>>2];s=H[j>>2];i=H[c+8>>2];n=H[c+12>>2];b=0;while(1){d=0;if((e|0)>=(n|0)&f>>>0>=i>>>0|(e|0)>(n|0)){break wa}d=H[c>>2];p=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=p>>>2|0;l=0;Aa:{Ba:{Ca:{Da:{t=p&3;switch(t|0){case 0:break Ba;case 3:break Da;default:break Ca}}a=a+b|0;d=0;if(a>>>0>=h>>>0){break wa}ra(s+(b<<2)|0,0,(p&252)+4|0);b=a;break Aa}while(1){if((f|0)==(i|0)&(e|0)==(n|0)){break xa}h=I[d+f|0];f=f+1|0;e=f?e:e+1|0;H[c+16>>2]=f;H[c+20>>2]=e;a=h<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}H[s+(b<<2)>>2]=a}b=b+1|0;h=H[j+12>>2];if(b>>>0>>0){continue}break}a=j+16|0;n=H[j>>2];d=H[j+16>>2];b=H[j+20>>2]-d|0;Ea:{if(b>>>0<=2097151){ya(a,524288-(b>>>2|0)|0);break Ea}if((b|0)==2097152){break Ea}H[j+20>>2]=d+2097152}d=j+28|0;b=H[d>>2];f=H[j+32>>2]-b>>3;Fa:{if(f>>>0>>0){ob(d,h-f|0);b=H[d>>2];break Fa}if(f>>>0>h>>>0){H[j+32>>2]=(h<<3)+b}if(!h){break xa}}i=H[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;j=H[e>>2];l=(f<<3)+b|0;a=d;H[l+4>>2]=a;H[l>>2]=j;e=H[e>>2];d=e+a|0;if(d>>>0>524288){break xa}Ga:{if(a>>>0>=d>>>0){break Ga}l=0;j=e&7;if(j){while(1){H[i+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((j|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break Ga}while(1){e=i+(a<<2)|0;H[e>>2]=f;H[e+28>>2]=f;H[e+24>>2]=f;H[e+20>>2]=f;H[e+16>>2]=f;H[e+12>>2]=f;H[e+8>>2]=f;H[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((h|0)!=(f|0)){continue}break}k=(d|0)==524288}d=k}Ha:{if(!d|(H[g+20>>2]?0:m)){break Ha}d=0;i=ca-16|0;ca=i;Ia:{Ja:{if(J[c+38>>1]<=511){b=H[c+8>>2];a=H[c+12>>2];h=a;e=H[c+20>>2];k=H[c+16>>2];f=k+8|0;e=f>>>0<8?e+1|0:e;if(b>>>0>>0&(a|0)<=(e|0)|(a|0)<(e|0)){break Ia}k=k+H[c>>2]|0;a=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[c+16>>2]=f;H[c+20>>2]=e;break Ja}if(!gb(1,i+8|0,c)){break Ia}f=H[c+16>>2];e=H[c+20>>2];b=H[c+8>>2];h=H[c+12>>2];a=H[i+8>>2];k=H[i+12>>2]}j=b-f|0;b=h-((b>>>0>>0)+e|0)|0;if((b|0)==(k|0)&a>>>0>j>>>0|b>>>0>>0){break Ia}e=e+k|0;b=a+f|0;e=b>>>0>>0?e+1|0:e;H[c+16>>2]=b;H[c+20>>2]=e;if((a|0)<=0){break Ia}b=H[c>>2]+f|0;H[g+48>>2]=b;c=a-1|0;f=c+b|0;e=I[f|0];Ka:{if(e>>>0<=63){H[g+52>>2]=c;a=I[f|0]&63;break Ka}La:{switch((e>>>6|0)-1|0){case 0:if(a>>>0<2){break Ia}a=a-2|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8&16128|I[a|0];break Ka;case 1:if(a>>>0<3){break Ia}a=a-3|0;H[g+52>>2]=a;a=a+b|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];break Ka;default:break La}}a=a-4|0;H[g+52>>2]=a;a=a+b|0;a=(I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24))&1073741823}H[g+56>>2]=a+2097152;d=a>>>0<534773760}ca=i+16|0;if(!d){break Ha}if(!m){o=1;break Ha}b=H[g+52>>2];a=H[g+56>>2];c=H[g+36>>2];d=H[g+48>>2];f=H[g+24>>2];while(1){Ma:{if(a>>>0>2097151){break Ma}while(1){if((b|0)<=0){break Ma}b=b-1|0;H[g+52>>2]=b;a=I[b+d|0]|a<<8;H[g+56>>2]=a;if(a>>>0<2097152){continue}break}}e=a&524287;o=H[f+(e<<2)>>2];k=c+(o<<3)|0;a=(N(H[k>>2],a>>>19|0)+e|0)-H[k+4>>2]|0;H[g+56>>2]=a;H[r+(q<<2)>>2]=o;o=1;q=q+1|0;if((m|0)!=(q|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;b=o;break g;case 17:b=Le(a,c,d);break g;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b=ca+-64|0;ca=b;H[b+56>>2]=0;H[b+48>>2]=0;H[b+52>>2]=0;H[b+40>>2]=0;H[b+44>>2]=0;H[b+32>>2]=0;H[b+36>>2]=0;H[b+24>>2]=0;H[b+28>>2]=0;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=0;H[b+12>>2]=0;Na:{if(!Ne(b+8|0,c)|(H[b+20>>2]?0:a)){break Na}if(!Me(b+8|0,c)){break Na}if(!a){f=1;break Na}e=H[b+52>>2];c=H[b+56>>2];k=H[b+36>>2];i=H[b+48>>2];g=H[b+24>>2];while(1){Oa:{if(c>>>0>16383){break Oa}while(1){if((e|0)<=0){break Oa}e=e-1|0;H[b+52>>2]=e;c=I[e+i|0]|c<<8;H[b+56>>2]=c;if(c>>>0<16384){continue}break}}f=c&4095;m=H[g+(f<<2)>>2];r=k+(m<<3)|0;c=(N(H[r>>2],c>>>12|0)+f|0)-H[r+4>>2]|0;H[b+56>>2]=c;H[(o<<2)+d>>2]=m;f=1;o=o+1|0;if((o|0)!=(a|0)){continue}break}}a=H[b+36>>2];if(a){H[b+40>>2]=a;oa(a)}a=H[b+24>>2];if(a){H[b+28>>2]=a;oa(a)}a=H[b+8>>2];if(a){H[b+12>>2]=a;oa(a)}ca=b- -64|0;b=f;break g;case 13:case 14:case 15:case 16:break h;default:break g}}b=Le(a,c,d)}f=b}return f}function gi(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0,R=0;s=ca+-64|0;ca=s;H[a+132>>2]=0;if(H[a+148>>2]){c=H[a+144>>2];if(c){while(1){d=H[c>>2];oa(c);c=d;if(c){continue}break}}c=0;H[a+144>>2]=0;d=H[a+140>>2];a:{if(!d){break a}if(d>>>0>=4){g=d&-4;while(1){e=c<<2;H[e+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(e|4)>>2]=0;H[H[a+136>>2]+(e|8)>>2]=0;H[H[a+136>>2]+(e|12)>>2]=0;c=c+4|0;b=b+4|0;if((g|0)!=(b|0)){continue}break}}b=d&3;if(!b){break a}while(1){H[H[a+136>>2]+(c<<2)>>2]=0;c=c+1|0;u=u+1|0;if((b|0)!=(u|0)){continue}break}}H[a+148>>2]=0}b:{c:{d:{c=H[a+4>>2];u=I[c+36|0];b=u<<8|I[c+37|0];if(b>>>0<=513){i=H[c+32>>2];e:{if(b>>>0<=511){b=H[i+20>>2];e=H[i+16>>2];d=e+4|0;b=d>>>0<4?b+1|0:b;g=b;h=H[i+12>>2];if(K[i+8>>2]>>0&(b|0)>=(h|0)|(b|0)>(h|0)){break d}b=e+H[i>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[i+16>>2]=d;H[i+20>>2]=g;break e}if(!Ea(1,s,i)){break d}c=H[a+4>>2];u=I[c+36|0];b=H[s>>2]}H[a+132>>2]=b}g=H[c+32>>2];f:{g:{h:{if((u&255)>>>0<=1){u=0;d=H[g+20>>2];e=H[g+16>>2];b=e+4|0;d=b>>>0<4?d+1|0:d;i=H[g+12>>2];if(K[g+8>>2]>>0&(i|0)<=(d|0)|(d|0)>(i|0)){break c}e=e+H[g>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[s+60>>2]=e;H[g+16>>2]=b;H[g+20>>2]=d;H[a+156>>2]=e;n=a+156|0;break h}u=0;if(!Ea(1,s+60|0,g)){break c}c=H[a+4>>2];b=I[c+36|0];H[a+156>>2]=H[s+60>>2];n=a+156|0;if(b>>>0>1){break g}}g=H[c+32>>2];h=H[g+8>>2];i=H[g+12>>2];c=H[g+20>>2];d=H[g+16>>2];b=d+4|0;c=b>>>0<4?c+1|0:c;e=b;if(b>>>0>h>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){break c}b=d+H[g>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[s+56>>2]=b;H[g+16>>2]=e;H[g+20>>2]=c;break f}if(!Ea(1,s+56|0,H[c+32>>2])){break c}b=H[s+56>>2]}if(b>>>0>1431655765|K[n>>2]>N(b,3)>>>0){break c}f=H[a+4>>2];g=H[f+32>>2];c=g;e=H[c+8>>2];i=H[c+16>>2];j=H[c+12>>2];d=H[c+20>>2];c=d;if((j|0)<=(c|0)&e>>>0<=i>>>0|(c|0)>(j|0)){break c}n=H[g>>2];o=I[n+i|0];h=i+1|0;c=h?c:c+1|0;H[g+16>>2]=h;H[g+20>>2]=c;i:{if(I[f+36|0]<=1){f=e;c=j;e=i+5|0;d=e>>>0<5?d+1|0:d;if((c|0)<=(d|0)&e>>>0>f>>>0|(c|0)<(d|0)){break c}c=h+n|0;n=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[s+52>>2]=n;H[g+16>>2]=e;H[g+20>>2]=d;break i}if(!Ea(1,s+52|0,g)){break c}n=H[s+52>>2]}if(b>>>0>>0|((n>>>0)/3|0)+n>>>0>>0){break c}c=H[a+4>>2];i=H[c+32>>2];j:{if(I[c+36|0]<=1){c=H[i+20>>2];e=H[i+16>>2];d=e+4|0;c=d>>>0<4?c+1|0:c;g=d;f=K[i+8>>2]>>0;d=H[i+12>>2];if(f&(d|0)<=(c|0)|(c|0)>(d|0)){break c}d=e+H[i>>2]|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[s+48>>2]=d;H[i+16>>2]=g;H[i+20>>2]=c;break j}if(!Ea(1,s+48|0,i)){break c}d=H[s+48>>2]}if(d>>>0>n>>>0){break c}H[a+28>>2]=H[a+24>>2];e=$b(pa(88));c=H[a+8>>2];H[a+8>>2]=e;if(c){cb(c);if(!H[a+8>>2]){break c}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,b);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,b);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];B=a+216|0;ed(B);dd(B,o);if(!Lc(H[a+8>>2],b,H[a+156>>2]+d|0)){break c}c=H[a+156>>2];F[s|0]=1;Oa(a+120|0,c+d|0,s);c=H[a+4>>2];b=J[c+36>>1];b=(b<<8|b>>>8)&65535;k:{if(b>>>0<=513){i=H[c+32>>2];l:{if(b>>>0<=511){b=H[i+20>>2];e=H[i+16>>2];c=e+4|0;b=c>>>0<4?b+1|0:b;g=b;h=H[i+12>>2];if(K[i+8>>2]>>0&(b|0)>=(h|0)|(b|0)>(h|0)){break c}b=e+H[i>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[i+16>>2]=c;H[i+20>>2]=g;break l}if(!Ea(1,s+44|0,i)){break c}b=H[s+44>>2]}if(!b){break c}c=H[H[a+4>>2]+32>>2];e=H[c+8>>2];g=H[c+16>>2];i=e-g|0;c=H[c+12>>2]-(H[c+20>>2]+(e>>>0>>0)|0)|0;if((c|0)<=0&b>>>0>i>>>0|(c|0)<0){break c}c=Ha(s);e=H[H[a+4>>2]+32>>2];g=H[e+16>>2];i=(g+H[e>>2]|0)+b|0;g=H[e+8>>2]-g|0;G[c+38>>1]=J[e+38>>1];H[c>>2]=i;H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=g-b;H[c+12>>2]=0;C=Ib(a,c);if((C|0)==-1){break c}M=C>>31;break k}C=-1;M=-1;if((Ib(a,H[c+32>>2])|0)==-1){break c}}e=a+232|0;Ee(e,a);H[a+372>>2]=o;H[a+384>>2]=H[a+156>>2]+d;O=Ha(s);g=O;b=0;j=ca-16|0;ca=j;m:{n:{c=H[e+144>>2];c=J[(ea[H[H[c>>2]+32>>2]](c)|0)+36>>1];if(((c<<8|c>>>8)&65535)>>>0<=513){c=H[e+4>>2];H[e+40>>2]=H[e>>2];H[e+44>>2]=c;c=H[e+36>>2];H[e+72>>2]=H[e+32>>2];H[e+76>>2]=c;d=H[e+28>>2];c=e- -64|0;H[c>>2]=H[e+24>>2];H[c+4>>2]=d;c=H[e+20>>2];H[e+56>>2]=H[e+16>>2];H[e+60>>2]=c;c=H[e+12>>2];H[e+48>>2]=H[e+8>>2];H[e+52>>2]=c;if(!Db(e+40|0,1,j+8|0)){break n}c=H[e+44>>2];H[e>>2]=H[e+40>>2];H[e+4>>2]=c;c=H[e+76>>2];H[e+32>>2]=H[e+72>>2];H[e+36>>2]=c;c=H[e+68>>2];H[e+24>>2]=H[e+64>>2];H[e+28>>2]=c;c=H[e+60>>2];h=c;d=H[e+56>>2];H[e+16>>2]=d;H[e+20>>2]=c;i=H[e+52>>2];f=i;c=H[e+48>>2];H[e+8>>2]=c;H[e+12>>2]=f;o=c-d|0;k=H[j+12>>2];c=f-((c>>>0>>0)+h|0)|0;i=H[j+8>>2];if((k|0)==(c|0)&o>>>0>>0|c>>>0>>0){break n}c=h+k|0;f=d;d=d+i|0;c=f>>>0>d>>>0?c+1|0:c;H[e+16>>2]=d;H[e+20>>2]=c}o:{if(J[e+38>>1]<=513){c=H[e+4>>2];H[e+96>>2]=H[e>>2];H[e+100>>2]=c;c=H[e+36>>2];H[e+128>>2]=H[e+32>>2];H[e+132>>2]=c;c=H[e+28>>2];H[e+120>>2]=H[e+24>>2];H[e+124>>2]=c;c=H[e+20>>2];H[e+112>>2]=H[e+16>>2];H[e+116>>2]=c;c=H[e+12>>2];H[e+104>>2]=H[e+8>>2];H[e+108>>2]=c;if(!Db(e+96|0,1,j+8|0)){break n}c=H[e+100>>2];H[e>>2]=H[e+96>>2];H[e+4>>2]=c;c=H[e+132>>2];H[e+32>>2]=H[e+128>>2];H[e+36>>2]=c;c=H[e+124>>2];H[e+24>>2]=H[e+120>>2];H[e+28>>2]=c;d=H[e+116>>2];h=d;c=H[e+112>>2];H[e+16>>2]=c;H[e+20>>2]=d;i=H[e+108>>2];f=i;d=H[e+104>>2];H[e+8>>2]=d;H[e+12>>2]=f;o=d-c|0;k=H[j+12>>2];d=f-((c>>>0>d>>>0)+h|0)|0;i=H[j+8>>2];if((k|0)==(d|0)&o>>>0>>0|d>>>0>>0){break n}d=h+k|0;f=c;c=c+i|0;d=f>>>0>c>>>0?d+1|0:d;H[e+16>>2]=c;H[e+20>>2]=d;break o}if(!ta(e+80|0,e)){break m}}if(!Fe(e)){break m}c=H[e+4>>2];H[g>>2]=H[e>>2];H[g+4>>2]=c;c=H[e+36>>2];H[g+32>>2]=H[e+32>>2];H[g+36>>2]=c;c=H[e+28>>2];H[g+24>>2]=H[e+24>>2];H[g+28>>2]=c;c=H[e+20>>2];H[g+16>>2]=H[e+16>>2];H[g+20>>2]=c;c=H[e+12>>2];H[g+8>>2]=H[e+8>>2];H[g+12>>2]=c;c=H[e+144>>2];c=J[(ea[H[H[c>>2]+32>>2]](c)|0)+36>>1];p:{if(((c<<8|c>>>8)&65535)>>>0<=513){c=H[e+144>>2];q:{if(I[(ea[H[H[c>>2]+32>>2]](c)|0)+36|0]<=1){c=H[g+20>>2];i=H[g+16>>2];d=i+4|0;c=d>>>0<4?c+1|0:c;h=d;f=K[g+8>>2]>>0;d=H[g+12>>2];if(f&(d|0)<=(c|0)|(c|0)>(d|0)){break m}d=i+H[g>>2]|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[g+16>>2]=h;H[g+20>>2]=c;break q}if(!Ea(1,j+8|0,g)){break m}d=H[j+8>>2]}c=H[e+152>>2];if(d>>>0>=c>>>0){break m}d=H[g+20>>2];h=H[g+12>>2];i=H[g+16>>2];if((d|0)>=(h|0)&i>>>0>=K[g+8>>2]|(d|0)>(h|0)){break m}h=I[i+H[g>>2]|0];i=i+1|0;d=i?d:d+1|0;H[g+16>>2]=i;H[g+20>>2]=d;if(h){break m}H[e+176>>2]=2;H[e+180>>2]=7;break p}H[e+176>>2]=2;H[e+180>>2]=7;c=H[e+152>>2]}if((c|0)<0){break m}H[j+8>>2]=0;b=2;h=H[e+156>>2];i=H[e+160>>2]-h>>2;r:{if(i>>>0>>0){Pa(e+156|0,c-i|0,j+8|0);b=H[e+176>>2];d=H[e+180>>2];break r}d=7;if(c>>>0>=i>>>0){break r}H[e+160>>2]=h+(c<<2)}i=e+184|0;b=(d-b|0)+1|0;c=H[e+188>>2];h=H[e+184>>2];d=(c-h|0)/12|0;s:{if(b>>>0>d>>>0){o=0;d=b-d|0;f=H[i+8>>2];c=H[i+4>>2];t:{if(d>>>0<=(f-c|0)/12>>>0){if(d){b=c;c=N(d,12)-12|0;c=(c-((c>>>0)%12|0)|0)+12|0;c=ra(b,0,c)+c|0}H[i+4>>2]=c;break t}u:{v:{w:{h=H[i>>2];k=(c-h|0)/12|0;b=k+d|0;if(b>>>0<357913942){f=(f-h|0)/12|0;l=f<<1;f=f>>>0>=178956970?357913941:b>>>0>>0?l:b;if(f){if(f>>>0>=357913942){break w}o=pa(N(f,12))}b=N(k,12)+o|0;d=N(d,12)-12|0;k=(d-((d>>>0)%12|0)|0)+12|0;d=ra(b,0,k);k=d+k|0;f=N(f,12)+o|0;if((c|0)==(h|0)){break v}while(1){b=b-12|0;c=c-12|0;H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;if((c|0)!=(h|0)){continue}break}H[i+8>>2]=f;d=H[i+4>>2];H[i+4>>2]=k;c=H[i>>2];H[i>>2]=b;if((c|0)==(d|0)){break u}while(1){b=d-12|0;h=H[b>>2];if(h){H[d-8>>2]=h;oa(h)}d=b;if((b|0)!=(c|0)){continue}break}break u}break b}wa();v()}H[i+8>>2]=f;H[i+4>>2]=k;H[i>>2]=d}if(c){oa(c)}}d=H[e+188>>2];break s}if(b>>>0>=d>>>0){d=c;break s}d=h+N(b,12)|0;if((d|0)!=(c|0)){while(1){b=c-12|0;h=H[b>>2];if(h){H[c-8>>2]=h;oa(h)}c=b;if((d|0)!=(b|0)){continue}break}}H[e+188>>2]=d}f=e+196|0;b=H[e+184>>2];c=(d-b|0)/12|0;o=H[e+196>>2];h=H[e+200>>2]-o>>2;x:{if(c>>>0>h>>>0){ya(f,c-h|0);b=H[e+184>>2];d=H[e+188>>2];break x}if(c>>>0>=h>>>0){break x}H[e+200>>2]=o+(c<<2)}if((b|0)==(d|0)){b=1;break m}c=0;while(1){if(!Ea(1,j+8|0,g)){break n}b=H[e+148>>2];d=(H[b+4>>2]-H[b>>2]>>2>>>0)/3|0;b=H[j+8>>2];if(d>>>0>>0){break n}if(b){k=N(c,12);h=k+H[i>>2]|0;d=H[h>>2];o=H[h+4>>2]-d>>2;y:{if(o>>>0>>0){ya(h,b-o|0);d=H[k+H[i>>2]>>2];break y}if(b>>>0>=o>>>0){break y}H[h+4>>2]=(b<<2)+d}kd(b,1,g,d);H[H[f>>2]+(c<<2)>>2]=b}b=1;c=c+1|0;if(c>>>0<(H[e+188>>2]-H[e+184>>2]|0)/12>>>0){continue}break}break m}b=0}ca=j+16|0;z:{if(!b){break z}d=0;c=0;g=0;i=0;o=0;l=ca-96|0;ca=l;H[l+72>>2]=0;H[l+64>>2]=0;H[l+68>>2]=0;H[l+48>>2]=0;H[l+52>>2]=0;H[l+40>>2]=0;H[l+44>>2]=0;H[l+56>>2]=1065353216;H[l+32>>2]=0;H[l+24>>2]=0;H[l+28>>2]=0;j=a;L=H[a+124>>2];A:{B:{C:{D:{E:{if((n|0)<=0){break E}r=j+232|0;P=H[j+216>>2]!=H[j+220>>2];D=1;while(1){h=i;i=h+1|0;a=H[r+172>>2];F:{G:{if((a|0)!=-1){b=H[r+196>>2]+(a<<2)|0;f=H[b>>2];a=f-1|0;H[b>>2]=a;b=9;if((f|0)<=0){break F}a=H[H[H[r+184>>2]+N(H[r+172>>2],12)>>2]+(a<<2)>>2];if(a>>>0>4){break F}b=H[(a<<2)+12144>>2];break G}b=7;a=H[r+144>>2];a=J[(ea[H[H[a>>2]+32>>2]](a)|0)+36>>1];if(((a<<8|a>>>8)&65535)>>>0>513|!I[r+76|0]){break G}b=0;m=H[r- -64>>2];k=H[r+72>>2];a=m+(k>>>3|0)|0;p=H[r+68>>2];if(a>>>0>=p>>>0){break G}f=I[a|0];a=k+1|0;H[r+72>>2]=a;f=f>>>(k&7)&1;if(!f){break G}q=a>>>3|0;b=m+q|0;H:{if(b>>>0>=p>>>0){b=a;a=0;break H}t=I[b|0];b=k+2|0;H[r+72>>2]=b;q=b>>>3|0;a=t>>>(a&7)&1}k=m+q|0;if(k>>>0

>>0){k=I[k|0];H[r+72>>2]=b+1;b=k>>>(b&7)<<1&2}else{b=0}b=(a|b)<<1|f}H[r+168>>2]=b}a=b;I:{J:{if(!a){if((c|0)==(g|0)){b=-1;break D}d=-1;m=H[j+8>>2];t=H[m+24>>2];D=c-4|0;f=H[D>>2];a=-1;K:{if((f|0)==-1){break K}k=f+1|0;k=(k>>>0)%3|0?k:f-2|0;a=-1;if((k|0)==-1){break K}a=H[H[m>>2]+(k<<2)>>2]}b=H[t+(a<<2)>>2];if((b|0)!=-1){d=b+1|0;d=(d>>>0)%3|0?d:b-2|0}if((d|0)==(f|0)){b=-1;break D}if((f|0)!=-1){b=-1;if(H[H[m+12>>2]+(f<<2)>>2]!=-1){break D}}k=H[m+12>>2];if((d|0)!=-1){b=-1;if(H[k+(d<<2)>>2]!=-1){break D}}p=N(h,3);b=p+1|0;H[k+(f<<2)>>2]=b;w=b<<2;H[w+k>>2]=f;q=p+2|0;H[k+(d<<2)>>2]=q;y=q<<2;H[y+k>>2]=d;k=-1;h=-1;L:{if((f|0)==-1){break L}M:{if((f>>>0)%3|0){b=f-1|0;break M}b=f+2|0;h=-1;if((b|0)==-1){break L}}h=H[H[m>>2]+(b<<2)>>2]}N:{if((d|0)==-1){break N}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;if((b|0)==-1){break N}k=H[H[m>>2]+(b<<2)>>2]}b=-1;if((a|0)==(h|0)|(a|0)==(k|0)){break D}b=H[m>>2];H[b+(p<<2)>>2]=a;H[b+w>>2]=k;H[b+y>>2]=h;if((h|0)!=-1){H[t+(h<<2)>>2]=q}b=H[j+120>>2]+(a>>>3&536870908)|0;d=H[b>>2];Q=b,R=Vj(a)&d,H[Q>>2]=R;H[D>>2]=p;k=H[c-4>>2];break J}b=-1;O:{P:{Q:{R:{S:{T:{U:{V:{W:{switch(a-1|0){case 2:case 4:if((c|0)==(g|0)){break D}t=c-4|0;d=H[t>>2];f=H[j+8>>2];m=H[f+12>>2];if((d|0)!=-1&H[m+(d<<2)>>2]!=-1){break D}k=N(h,3);p=(a|0)==5;q=k+(p?2:1)|0;w=q<<2;H[w+m>>2]=d;H[m+(d<<2)>>2]=q;Ka(f+24|0,11424);a=H[j+8>>2];m=H[a+24>>2];if(H[a+28>>2]-m>>2>(L|0)){break D}a=H[a>>2];y=a+w|0;b=H[f+28>>2];f=H[f+24>>2];w=(b-f>>2)-1|0;H[y>>2]=w;if((b|0)!=(f|0)){H[m+(w<<2)>>2]=q}b=p?k:k+2|0;q=a+(k+p<<2)|0;X:{if((d|0)==-1){H[a+(b<<2)>>2]=-1;b=-1;break X}Y:{Z:{_:{if((d>>>0)%3|0){f=d-1|0;break _}f=d+2|0;if((f|0)==-1){break Z}}f=H[a+(f<<2)>>2];H[a+(b<<2)>>2]=f;if((f|0)==-1){break Y}H[m+(f<<2)>>2]=b;break Y}H[a+(b<<2)>>2]=-1}f=d+1|0;d=(f>>>0)%3|0?f:d-2|0;b=-1;if((d|0)==-1){break X}b=H[a+(d<<2)>>2]}H[q>>2]=b;H[t>>2]=k;break V;case 0:if((c|0)==(d|0)){break D}a=c-4|0;m=H[a>>2];H[l+68>>2]=a;p=H[l+44>>2];$:{if(!p){c=a;break $}f=H[l+40>>2];q=Uj(p)>>>0>1;b=h&p+2147483647;aa:{if(!q){break aa}b=h;if(b>>>0

>>0){break aa}b=(h>>>0)%(p>>>0)|0}k=b;b=H[f+(k<<2)>>2];if(!b){c=a;break $}b=H[b>>2];if(!b){c=a;break $}ba:{if(!q){f=p-1|0;while(1){p=H[b+4>>2];ca:{if((p|0)!=(h|0)){if((k|0)==(f&p)){break ca}c=a;break $}if((h|0)==H[b+8>>2]){break ba}}b=H[b>>2];if(b){continue}break}c=a;break $}while(1){f=H[b+4>>2];da:{if((f|0)!=(h|0)){if(f>>>0>=p>>>0){f=(f>>>0)%(p>>>0)|0}if((f|0)==(k|0)){break da}c=a;break $}if((h|0)==H[b+8>>2]){break ba}}b=H[b>>2];if(b){continue}break}c=a;break $}if((a|0)!=(x|0)){H[a>>2]=H[b+12>>2];H[l+68>>2]=c;break $}a=x-d|0;g=a>>2;c=g+1|0;if(c>>>0>=1073741824){break b}f=a>>>1|0;f=a>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break B}a=pa(f<<2)}else{a=0}g=a+(g<<2)|0;H[g>>2]=H[b+12>>2];c=g+4|0;if((d|0)!=(x|0)){while(1){g=g-4|0;x=x-4|0;H[g>>2]=H[x>>2];if((d|0)!=(x|0)){continue}break}}x=a+(f<<2)|0;H[l+72>>2]=x;H[l+68>>2]=c;H[l+64>>2]=g;if(d){oa(d)}}if((c|0)==(g|0)){break P}w=c-4|0;a=H[w>>2];if((a|0)==(m|0)){break P}b=(a|0)==-1;p=H[j+8>>2];if(!b&H[H[p+12>>2]+(a<<2)>>2]!=-1){break P}q=H[p+12>>2];if((m|0)!=-1&H[q+(m<<2)>>2]!=-1){break P}k=N(h,3);t=k+2|0;H[q+(a<<2)>>2]=t;h=t<<2;H[h+q>>2]=a;d=k+1|0;H[q+(m<<2)>>2]=d;y=d<<2;H[y+q>>2]=m;if(b){break T}if((a>>>0)%3|0){f=a-1|0;break S}f=a+2|0;if((f|0)!=-1){break S}d=H[p>>2];f=-1;break R;case 6:break W;default:break D}}k=H[j+8>>2];Ka(k+24|0,11424);f=H[j+8>>2];a=N(h,3);m=H[k+28>>2];p=H[k+24>>2];q=m-p|0;k=q>>2;t=k-1|0;H[H[f>>2]+(a<<2)>>2]=t;Ka(f+24|0,11424);w=a+1|0;H[H[f>>2]+(w<<2)>>2]=(H[f+28>>2]-H[f+24>>2]>>2)-1;f=H[j+8>>2];Ka(f+24|0,11424);y=a+2|0;H[H[f>>2]+(y<<2)>>2]=(H[f+28>>2]-H[f+24>>2]>>2)-1;E=H[j+8>>2];f=H[E+24>>2];if(H[E+28>>2]-f>>2>(L|0)){break D}ea:{fa:{if((m|0)!=(p|0)){H[f+(t<<2)>>2]=a;b=0;if((q|0)==-4){break fa}}H[f+(k<<2)>>2]=w;b=k+1|0;if((b|0)==-1){break ea}}H[f+(b<<2)>>2]=y}if((c|0)!=(x|0)){H[c>>2]=a;c=c+4|0;H[l+68>>2]=c;break U}b=c-d|0;k=b>>2;g=k+1|0;if(g>>>0>=1073741824){break b}f=b>>>1|0;b=b>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(b){if(b>>>0>=1073741824){break B}f=pa(b<<2)}else{f=0}g=f+(k<<2)|0;H[g>>2]=a;x=f+(b<<2)|0;a=g+4|0;if((c|0)!=(d|0)){while(1){g=g-4|0;c=c-4|0;H[g>>2]=H[c>>2];if((c|0)!=(d|0)){continue}break}}H[l+72>>2]=x;H[l+68>>2]=a;H[l+64>>2]=g;if(d){oa(d)}c=a}d=g}Ce(r,H[c-4>>2]);a=H[j+40>>2];if((a|0)==H[j+36>>2]){break I}b=a-12|0;f=H[b+4>>2];h=(h^-1)+n|0;if(f>>>0>h>>>0){break P}if((f|0)!=(h|0)){break I}k=I[a-4|0];f=H[b>>2];H[j+40>>2]=b;if((f|0)<0){break P}m=c-4|0;a=H[m>>2];H[l+20>>2]=(f^-1)+n;b=l+20|0;H[l+88>>2]=b;Gb(l,l+40|0,b,l+88|0);f=H[l>>2];ga:{if(k&1){b=-1;if((a|0)==-1){break ga}b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;break ga}b=-1;if((a|0)==-1){break ga}b=a-1|0;if((a>>>0)%3|0){break ga}b=a+2|0}H[f+12>>2]=b;b=H[j+40>>2];if((b|0)==H[j+36>>2]){break I}while(1){a=b-12|0;f=H[a+4>>2];if(f>>>0>h>>>0){break P}if((f|0)!=(h|0)){break I}f=I[b-4|0];b=H[a>>2];H[j+40>>2]=a;if((b|0)<0){break P}a=H[m>>2];H[l+20>>2]=(b^-1)+n;b=l+20|0;H[l+88>>2]=b;Gb(l,l+40|0,b,l+88|0);k=H[l>>2];ha:{if(f&1){b=-1;if((a|0)==-1){break ha}b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;break ha}b=-1;if((a|0)==-1){break ha}b=a-1|0;if((a>>>0)%3|0){break ha}b=a+2|0}H[k+12>>2]=b;b=H[j+40>>2];if((b|0)!=H[j+36>>2]){continue}break}break I}f=-1;d=H[p>>2];H[d+(k<<2)>>2]=-1;b=-1;break Q}d=H[p>>2];f=H[d+(f<<2)>>2]}H[(k<<2)+d>>2]=f;E=a+1|0;a=(E>>>0)%3|0?E:a-2|0;b=-1;if((a|0)==-1){break Q}b=H[(a<<2)+d>>2]}H[d+y>>2]=b;ia:{if((m|0)==-1){H[d+h>>2]=-1;t=-1;a=-1;break ia}ja:{ka:{la:{if((m>>>0)%3|0){b=m-1|0;break la}b=m+2|0;if((b|0)==-1){break ka}}a=H[(b<<2)+d>>2];H[d+h>>2]=a;if((a|0)==-1){break ja}H[H[p+24>>2]+(a<<2)>>2]=t;break ja}H[d+h>>2]=-1}t=-1;b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;a=-1;if((b|0)==-1){break ia}t=H[(b<<2)+d>>2];a=b}b=H[j+388>>2];h=f<<2;m=b+h|0;y=b;b=t<<2;H[m>>2]=H[m>>2]+H[y+b>>2];m=b;b=H[p+24>>2];m=m+b|0;if((f|0)!=-1){H[b+h>>2]=H[m>>2]}b=a;while(1){if((b|0)==-1){break O}H[(b<<2)+d>>2]=f;p=b+1|0;b=(p>>>0)%3|0?p:b-2|0;h=-1;ma:{if((b|0)==-1){break ma}b=H[q+(b<<2)>>2];h=-1;if((b|0)==-1){break ma}h=b+1|0;h=(h>>>0)%3|0?h:b-2|0}b=h;if((a|0)!=(b|0)){continue}break}}b=-1;if(!D){break E}break D}H[m>>2]=-1;na:{if(P){break na}if((z|0)!=(A|0)){H[A>>2]=t;A=A+4|0;H[l+28>>2]=A;break na}a=z-o|0;h=a>>2;b=h+1|0;if(b>>>0>=1073741824){break b}d=a>>>1|0;d=a>>>0>=2147483644?1073741823:b>>>0>>0?d:b;if(d){if(d>>>0>=1073741824){break B}a=pa(d<<2)}else{a=0}b=a+(h<<2)|0;H[b>>2]=t;A=b+4|0;if((o|0)!=(z|0)){while(1){b=b-4|0;z=z-4|0;H[b>>2]=H[z>>2];if((o|0)!=(z|0)){continue}break}}z=a+(d<<2)|0;H[l+32>>2]=z;H[l+28>>2]=A;H[l+24>>2]=b;if(o){oa(o)}o=b}H[w>>2]=k}Ce(r,k);d=g}D=(i|0)<(n|0);if((i|0)!=(n|0)){continue}break}i=n}b=-1;d=H[j+8>>2];if(H[d+28>>2]-H[d+24>>2]>>2>(L|0)){break D}if((c|0)!=(g|0)){x=j+72|0;h=j+60|0;p=j+312|0;while(1){c=c-4|0;o=H[c>>2];H[l+68>>2]=c;oa:{pa:{qa:{if(J[j+270>>1]<=513){if(!I[j+364|0]){break pa}a=H[j+360>>2];b=H[j+352>>2]+(a>>>3|0)|0;if(b>>>0>=K[j+356>>2]){break qa}b=I[b|0];H[j+360>>2]=a+1;if(!(b>>>(a&7)&1)){break qa}break pa}if(Ba(p)){break pa}}b=H[j+64>>2];a=H[j+68>>2];if((b|0)==a<<5){if((b+1|0)<0){break b}if(b>>>0<=1073741822){a=a<<6;b=(b&-32)+32|0;a=a>>>0>b>>>0?a:b}else{a=2147483647}pb(h,a);b=H[j+64>>2]}H[j+64>>2]=b+1;a=H[j+60>>2]+(b>>>3&536870908)|0;d=H[a>>2];Q=a,R=Vj(b)&d,H[Q>>2]=R;b=H[j+76>>2];if((b|0)!=H[j+80>>2]){H[b>>2]=o;H[j+76>>2]=b+4;break oa}d=H[x>>2];a=b-d|0;k=a>>2;f=k+1|0;if(f>>>0<1073741824){n=a>>>1|0;n=a>>>0>=2147483644?1073741823:f>>>0>>0?n:f;if(n){if(n>>>0>=1073741824){break B}a=pa(n<<2)}else{a=0}f=a+(k<<2)|0;H[f>>2]=o;o=f+4|0;if((b|0)!=(d|0)){while(1){f=f-4|0;b=b-4|0;H[f>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[j+80>>2]=a+(n<<2);H[j+76>>2]=o;H[j+72>>2]=f;if(!d){break oa}oa(d);break oa}break b}m=H[j+8>>2];r=H[m>>2];if(((H[m+4>>2]-r>>2>>>0)/3|0)<=(i|0)){b=-1;break D}d=-1;q=H[m+24>>2];n=-1;ra:{if((o|0)==-1){break ra}g=o+1|0;g=(g>>>0)%3|0?g:o-2|0;n=-1;if((g|0)==-1){break ra}n=H[r+(g<<2)>>2]}a=H[q+(n<<2)>>2];sa:{if((a|0)==-1){k=1;f=-1;break sa}k=1;f=-1;b=a+1|0;a=(b>>>0)%3|0?b:a-2|0;if((a|0)==-1){break sa}k=0;d=a;b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;if((b|0)!=-1){f=H[r+(b<<2)>>2]}}b=-1;g=-1;a=H[q+(f<<2)>>2];if((a|0)!=-1){g=a+1|0;g=(g>>>0)%3|0?g:a-2|0}if((d|0)==(o|0)|(g|0)==(o|0)|((o|0)!=-1&H[H[m+12>>2]+(o<<2)>>2]!=-1|(d|0)==(g|0))){break D}if(!k&H[H[m+12>>2]+(d<<2)>>2]!=-1){break D}k=-1;a=H[m+12>>2];m=-1;ta:{if((g|0)==-1){break ta}if(H[a+(g<<2)>>2]!=-1){break D}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;m=-1;if((b|0)==-1){break ta}m=H[r+(b<<2)>>2]}b=N(i,3);H[l>>2]=b;H[a+(b<<2)>>2]=o;H[a+(o<<2)>>2]=b;b=H[l>>2]+1|0;H[a+(b<<2)>>2]=d;H[a+(d<<2)>>2]=b;b=H[l>>2]+2|0;H[a+(b<<2)>>2]=g;H[a+(g<<2)>>2]=b;a=H[l>>2];H[r+(a<<2)>>2]=f;b=a+1|0;d=r+(b<<2)|0;H[d>>2]=m;g=a+2|0;o=r+(g<<2)|0;H[o>>2]=n;a=H[j+120>>2];f=b?f:-1;n=a+(f>>>3&536870908)|0;r=H[n>>2];Q=n,R=Vj(f)&r,H[Q>>2]=R;k=(b|0)!=-1?H[d>>2]:k;b=a+(k>>>3&536870908)|0;d=H[b>>2];Q=b,R=Vj(k)&d,H[Q>>2]=R;b=-1;b=(g|0)!=-1?H[o>>2]:b;a=a+(b>>>3&536870908)|0;d=H[a>>2];Q=a,R=Vj(b)&d,H[Q>>2]=R;F[l+88|0]=1;_c(h,l+88|0);Ka(x,l);i=i+1|0;g=H[l+64>>2]}if((c|0)!=(g|0)){continue}break}d=H[j+8>>2]}b=-1;if(((H[d+4>>2]-H[d>>2]>>2>>>0)/3|0)!=(i|0)){break D}b=H[d+28>>2]-H[d+24>>2]>>2;i=H[l+24>>2];f=H[l+28>>2];if((i|0)==(f|0)){break C}while(1){a=H[i>>2];h=H[d+24>>2];c=b-1|0;g=h+(c<<2)|0;if(H[g>>2]==-1){while(1){c=b-2|0;b=b-1|0;g=h+(c<<2)|0;if(H[g>>2]==-1){continue}break}}if(a>>>0<=c>>>0){H[l>>2]=d;g=H[g>>2];F[l+12|0]=1;H[l+8>>2]=g;H[l+4>>2]=g;if((g|0)!=-1){while(1){d=H[H[j+8>>2]>>2]+(g<<2)|0;if(H[d>>2]!=(c|0)){b=-1;break D}H[d>>2]=a;uc(l);g=H[l+8>>2];if((g|0)!=-1){continue}break}d=H[j+8>>2]}h=H[d+24>>2];g=h+(c<<2)|0;if((a|0)!=-1){H[h+(a<<2)>>2]=H[g>>2]}H[g>>2]=-1;g=1<>2];a=h+(a>>>3&536870908)|0;h=h+(c>>>3&536870908)|0;c=1<>2]&c){g=g|H[a>>2]}else{g=H[a>>2]&(g^-1)}H[a>>2]=g;H[h>>2]=H[h>>2]&(c^-1);b=b-1|0}i=i+4|0;if((f|0)!=(i|0)){continue}break}}i=H[l+24>>2]}if(i){oa(i)}a=H[l+48>>2];if(a){while(1){c=H[a>>2];oa(a);a=c;if(a){continue}break}}a=H[l+40>>2];H[l+40>>2]=0;if(a){oa(a)}a=H[l+64>>2];if(a){H[l+68>>2]=a;oa(a)}ca=l+96|0;break A}wa();v()}if((b|0)==-1){break z}a=O;c=H[a+16>>2];d=c+H[a>>2]|0;c=H[a+8>>2]-c|0;a=H[H[j+4>>2]+32>>2];G[a+38>>1]=J[a+38>>1];H[a>>2]=d;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=c;H[a+12>>2]=0;a=H[j+4>>2];c=J[a+36>>1];g=c<<8|c>>>8;if((g&65535)>>>0<=513){a=H[a+32>>2];c=H[a+16>>2];d=M+H[a+20>>2]|0;c=c+C|0;d=c>>>0>>0?d+1|0:d;H[a+16>>2]=c;H[a+20>>2]=d}ua:{if(H[j+216>>2]==H[j+220>>2]){break ua}c=H[j+8>>2];a=H[c>>2];c=H[c+4>>2];va:{if((g&65535)>>>0>=513){if((a|0)==(c|0)){break ua}c=0;break va}if((a|0)==(c|0)){break ua}c=0;while(1){if(cd(j,c)){c=c+3|0;a=H[j+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break ua}break}break z}while(1){if(bd(j,c)){c=c+3|0;a=H[j+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break ua}break}break z}ad(e);c=H[j+216>>2];if((c|0)!=H[j+220>>2]){n=0;while(1){d=N(n,144);Jc((d+c|0)+4|0,H[j+8>>2]);a=H[B>>2];e=a+d|0;c=H[e+132>>2];e=H[e+136>>2];if((c|0)!=(e|0)){while(1){Hc((d+H[B>>2]|0)+4|0,H[c>>2]);c=c+4|0;if((e|0)!=(c|0)){continue}break}a=H[B>>2]}if(!Ic((a+d|0)+4|0)){break z}n=n+1|0;c=H[j+216>>2];if(n>>>0<(H[j+220>>2]-c|0)/144>>>0){continue}break}}a=H[j+8>>2];Hb(j+184|0,H[a+28>>2]-H[a+24>>2]>>2);u=H[j+216>>2];if((u|0)!=H[j+220>>2]){c=0;while(1){a=N(c,144)+u|0;d=H[a+60>>2]-H[a+56>>2]>>2;f=a+104|0;a=H[j+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(f,(a|0)<(d|0)?d:a);c=c+1|0;u=H[j+216>>2];if(c>>>0<(H[j+220>>2]-u|0)/144>>>0){continue}break}}u=$c(j,b)}break c}u=0}ca=s- -64|0;return u|0}sa();v()}function ii(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0,R=0,S=0;u=ca+-64|0;ca=u;H[a+132>>2]=0;if(H[a+148>>2]){c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}c=0;H[a+144>>2]=0;l=H[a+140>>2];a:{if(!l){break a}if(l>>>0>=4){b=l&-4;while(1){e=c<<2;H[e+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(e|4)>>2]=0;H[H[a+136>>2]+(e|8)>>2]=0;H[H[a+136>>2]+(e|12)>>2]=0;c=c+4|0;f=f+4|0;if((b|0)!=(f|0)){continue}break}}b=l&3;if(!b){break a}while(1){H[H[a+136>>2]+(c<<2)>>2]=0;c=c+1|0;w=w+1|0;if((b|0)!=(w|0)){continue}break}}H[a+148>>2]=0}b:{c:{c=H[a+4>>2];w=I[c+36|0];b=w<<8|I[c+37|0];if(b>>>0<=513){g=H[c+32>>2];d:{if(b>>>0<=511){f=H[g+20>>2];l=H[g+16>>2];e=l+4|0;f=e>>>0<4?f+1|0:f;b=f;d=H[g+12>>2];if(K[g+8>>2]>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}f=l+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=e;H[g+20>>2]=b;break d}if(!Ea(1,u,g)){break c}c=H[a+4>>2];w=I[c+36|0];f=H[u>>2]}H[a+132>>2]=f}d=H[c+32>>2];e:{f:{g:{if((w&255)>>>0<=1){w=0;b=H[d+20>>2];e=H[d+16>>2];f=e+4|0;b=f>>>0<4?b+1|0:b;l=H[d+12>>2];if(K[d+8>>2]>>0&(l|0)<=(b|0)|(b|0)>(l|0)){break b}e=e+H[d>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[u+60>>2]=e;H[d+16>>2]=f;H[d+20>>2]=b;H[a+156>>2]=e;t=a+156|0;break g}w=0;if(!Ea(1,u+60|0,d)){break b}c=H[a+4>>2];b=I[c+36|0];H[a+156>>2]=H[u+60>>2];t=a+156|0;if(b>>>0>1){break f}}d=H[c+32>>2];e=H[d+8>>2];l=H[d+12>>2];c=H[d+20>>2];f=H[d+16>>2];b=f+4|0;c=b>>>0<4?c+1|0:c;if(b>>>0>e>>>0&(c|0)>=(l|0)|(c|0)>(l|0)){break b}f=f+H[d>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[u+56>>2]=f;H[d+16>>2]=b;H[d+20>>2]=c;break e}if(!Ea(1,u+56|0,H[c+32>>2])){break b}f=H[u+56>>2]}if(f>>>0>1431655765|K[t>>2]>N(f,3)>>>0){break b}E=H[a+4>>2];x=H[E+32>>2];c=H[x+8>>2];d=H[x+12>>2];b=H[x+20>>2];h=H[x+16>>2];if((d|0)<=(b|0)&h>>>0>=c>>>0|(b|0)>(d|0)){break b}j=H[x>>2];k=I[j+h|0];e=x;l=h+1|0;g=l?b:b+1|0;H[e+16>>2]=l;H[e+20>>2]=g;h:{if(I[E+36|0]<=1){e=c;c=h+5|0;b=c>>>0<5?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break b}e=j+l|0;t=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[u+52>>2]=t;H[x+16>>2]=c;H[x+20>>2]=b;break h}if(!Ea(1,u+52|0,x)){break b}t=H[u+52>>2]}if(f>>>0>>0|((t>>>0)/3|0)+t>>>0>>0){break b}c=H[a+4>>2];d=H[c+32>>2];i:{if(I[c+36|0]<=1){c=H[d+20>>2];b=H[d+16>>2];e=b+4|0;c=e>>>0<4?c+1|0:c;l=H[d+12>>2];if(K[d+8>>2]>>0&(l|0)<=(c|0)|(c|0)>(l|0)){break b}b=b+H[d>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[u+48>>2]=b;H[d+16>>2]=e;H[d+20>>2]=c;break i}if(!Ea(1,u+48|0,d)){break b}b=H[u+48>>2]}if(b>>>0>t>>>0){break b}H[a+28>>2]=H[a+24>>2];c=$b(pa(88));e=H[a+8>>2];H[a+8>>2]=c;if(e){cb(e);if(!H[a+8>>2]){break b}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,f);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,f);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];M=a+216|0;ed(M);dd(M,k);if(!Lc(H[a+8>>2],f,H[a+156>>2]+b|0)){break b}c=H[a+156>>2];F[u|0]=1;Oa(a+120|0,b+c|0,u);f=H[a+4>>2];c=J[f+36>>1];c=(c<<8|c>>>8)&65535;j:{if(c>>>0<=513){g=H[f+32>>2];k:{if(c>>>0<=511){f=H[g+20>>2];l=H[g+16>>2];e=l+4|0;f=e>>>0<4?f+1|0:f;c=f;d=H[g+12>>2];if(K[g+8>>2]>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break b}f=l+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=e;H[g+20>>2]=c;break k}if(!Ea(1,u+44|0,g)){break b}f=H[u+44>>2]}if(!f){break b}d=H[H[a+4>>2]+32>>2];l=H[d+8>>2];c=H[d+16>>2];e=l-c|0;c=H[d+12>>2]-(H[d+20>>2]+(c>>>0>l>>>0)|0)|0;if((c|0)<=0&f>>>0>e>>>0|(c|0)<0){break b}g=Ha(u);d=H[H[a+4>>2]+32>>2];l=H[d+16>>2];e=(l+H[d>>2]|0)+f|0;c=H[d+8>>2]-l|0;G[g+38>>1]=J[d+38>>1];H[g>>2]=e;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=c-f;H[g+12>>2]=0;c=Ib(a,g);if((c|0)==-1){break b}E=c;P=c>>31;break j}E=-1;P=-1;if((Ib(a,H[f+32>>2])|0)==-1){break b}}B=a+232|0;Ee(B,a);H[a+372>>2]=k;H[a+384>>2]=H[a+156>>2]+b;x=Ha(u);g=x;d=0;l=ca-16|0;ca=l;l:{if(!Ge(B,g)){break l}b=H[g+20>>2];f=H[g+16>>2];c=f+4|0;b=c>>>0<4?b+1|0:b;e=H[g+12>>2];if(K[g+8>>2]>>0&(e|0)<=(b|0)|(b|0)>(e|0)){break l}f=f+H[g>>2]|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[g+16>>2]=c;H[g+20>>2]=b;if((f|0)<0){break l}b=f;f=H[B+152>>2];if((b|0)>=(f|0)){break l}H[l+12>>2]=0;c=H[B+156>>2];b=H[B+160>>2]-c>>2;m:{if(b>>>0>>0){Pa(B+156|0,f-b|0,l+12|0);break m}if(b>>>0<=f>>>0){break m}H[B+160>>2]=c+(f<<2)}d=ta(B+168|0,g)}ca=l+16|0;n:{if(!d){break n}d=0;c=0;f=0;l=0;i=ca-96|0;ca=i;H[i+72>>2]=0;H[i+64>>2]=0;H[i+68>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+56>>2]=1065353216;H[i+32>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;g=a;O=H[a+124>>2];o:{p:{q:{r:{s:{t:{if((t|0)<=0){break t}z=g+400|0;Q=g+232|0;C=H[g+216>>2]!=H[g+220>>2];y=1;while(1){e=l;l=e+1|0;u:{v:{w:{x:{y:{if(H[g+420>>2]!=-1){if(Ba(z)){break y}}if(!I[g+308|0]){break x}z:{o=H[g+296>>2];r=H[g+304>>2];a=o+(r>>>3|0)|0;k=H[g+300>>2];if(a>>>0>=k>>>0){break z}b=I[a|0];a=r+1|0;H[g+304>>2]=a;h=b>>>(r&7)&1;if(!h){break z}n=a>>>3|0;b=o+n|0;A:{if(b>>>0>=k>>>0){b=a;a=0;break A}j=I[b|0];b=r+2|0;H[g+304>>2]=b;n=b>>>3|0;a=j>>>(a&7)&1}j=n+o|0;if(j>>>0>>0){j=I[j|0];H[g+304>>2]=b+1;b=j>>>(b&7)<<1&2}else{b=0}p=(a|b)<<1|h;H[g+416>>2]=p;break w}H[g+416>>2]=0;break x}p=H[g+420>>2];H[g+416>>2]=p;if(p){break w}}if((c|0)==(f|0)){b=-1;break s}p=-1;n=H[g+8>>2];o=H[n+24>>2];j=c-4|0;m=H[j>>2];d=-1;B:{if((m|0)==-1){break B}b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;d=-1;if((b|0)==-1){break B}d=H[H[n>>2]+(b<<2)>>2]}b=H[o+(d<<2)>>2];if((b|0)!=-1){a=b+1|0;p=(a>>>0)%3|0?a:b-2|0}if((m|0)==(p|0)){b=-1;break s}if((m|0)!=-1){b=-1;if(H[H[n+12>>2]+(m<<2)>>2]!=-1){break s}}k=H[n+12>>2];if((p|0)!=-1){b=-1;if(H[k+(p<<2)>>2]!=-1){break s}}q=N(e,3);a=q+1|0;H[k+(m<<2)>>2]=a;h=a<<2;H[h+k>>2]=m;r=q+2|0;H[k+(p<<2)>>2]=r;e=r<<2;H[e+k>>2]=p;k=-1;a=-1;C:{if((m|0)==-1){break C}D:{if((m>>>0)%3|0){b=m-1|0;break D}b=m+2|0;a=-1;if((b|0)==-1){break C}}a=H[H[n>>2]+(b<<2)>>2]}E:{if((p|0)==-1){break E}b=p+1|0;b=(b>>>0)%3|0?b:p-2|0;if((b|0)==-1){break E}k=H[H[n>>2]+(b<<2)>>2]}b=-1;if((a|0)==(d|0)|(d|0)==(k|0)){break s}b=H[n>>2];H[b+(q<<2)>>2]=d;H[b+h>>2]=k;H[b+e>>2]=a;if((a|0)!=-1){H[o+(a<<2)>>2]=r}b=H[g+120>>2]+(d>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(d)&a,H[R>>2]=S;H[j>>2]=q;p=H[c-4>>2];break v}b=-1;F:{G:{H:{I:{J:{K:{L:{M:{N:{O:{P:{switch(p-1|0){case 2:case 4:if((c|0)==(f|0)){break s}h=c-4|0;m=H[h>>2];r=H[g+8>>2];d=H[r+12>>2];if((m|0)!=-1&H[d+(m<<2)>>2]!=-1){break s}q=N(e,3);k=(p|0)==5;j=q+(k?2:1)|0;a=j<<2;H[a+d>>2]=m;H[d+(m<<2)>>2]=j;Ka(r+24|0,11424);d=H[g+8>>2];o=H[d+24>>2];if(H[d+28>>2]-o>>2>(O|0)){break s}n=H[d>>2];p=n+a|0;d=H[r+28>>2];b=H[r+24>>2];a=(d-b>>2)-1|0;H[p>>2]=a;if((b|0)!=(d|0)){H[o+(a<<2)>>2]=j}d=k?q:q+2|0;j=n+(k+q<<2)|0;Q:{if((m|0)==-1){H[n+(d<<2)>>2]=-1;b=-1;break Q}R:{S:{T:{if((m>>>0)%3|0){a=m-1|0;break T}a=m+2|0;if((a|0)==-1){break S}}a=H[n+(a<<2)>>2];H[n+(d<<2)>>2]=a;if((a|0)==-1){break R}H[o+(a<<2)>>2]=d;break R}H[n+(d<<2)>>2]=-1}a=m+1|0;a=(a>>>0)%3|0?a:m-2|0;b=-1;if((a|0)==-1){break Q}b=H[n+(a<<2)>>2]}H[j>>2]=b;H[h>>2]=q;break O;case 0:if((c|0)==(d|0)){break s}a=c-4|0;m=H[a>>2];H[i+68>>2]=a;k=H[i+44>>2];U:{if(!k){c=a;break U}o=H[i+40>>2];h=Uj(k)>>>0>1;b=e&k+2147483647;V:{if(!h){break V}b=e;if(b>>>0>>0){break V}b=(e>>>0)%(k>>>0)|0}j=b;b=H[o+(j<<2)>>2];if(!b){c=a;break U}b=H[b>>2];if(!b){c=a;break U}W:{if(!h){k=k-1|0;while(1){h=H[b+4>>2];X:{if((h|0)!=(e|0)){if((j|0)==(h&k)){break X}c=a;break U}if((e|0)==H[b+8>>2]){break W}}b=H[b>>2];if(b){continue}break}c=a;break U}while(1){h=H[b+4>>2];Y:{if((h|0)!=(e|0)){if(h>>>0>=k>>>0){h=(h>>>0)%(k>>>0)|0}if((h|0)==(j|0)){break Y}c=a;break U}if((e|0)==H[b+8>>2]){break W}}b=H[b>>2];if(b){continue}break}c=a;break U}if((a|0)!=(A|0)){H[a>>2]=H[b+12>>2];H[i+68>>2]=c;break U}h=A-d|0;c=h>>2;f=c+1|0;if(f>>>0>=1073741824){break M}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}f=a+(c<<2)|0;H[f>>2]=H[b+12>>2];c=f+4|0;if((d|0)!=(A|0)){while(1){f=f-4|0;A=A-4|0;H[f>>2]=H[A>>2];if((d|0)!=(A|0)){continue}break}}A=a+(h<<2)|0;H[i+72>>2]=A;H[i+68>>2]=c;H[i+64>>2]=f;if(d){oa(d)}}if((c|0)==(f|0)){break G}j=c-4|0;n=H[j>>2];if((n|0)==(m|0)){break G}d=(n|0)==-1;q=H[g+8>>2];if(!d&H[H[q+12>>2]+(n<<2)>>2]!=-1){break G}r=H[q+12>>2];if((m|0)!=-1&H[r+(m<<2)>>2]!=-1){break G}p=N(e,3);e=p+2|0;H[r+(n<<2)>>2]=e;o=e<<2;H[o+r>>2]=n;a=p+1|0;H[r+(m<<2)>>2]=a;b=a<<2;H[b+r>>2]=m;if(d){break L}if((n>>>0)%3|0){k=n-1|0;break J}k=n+2|0;if((k|0)!=-1){break J}d=H[q>>2];a=-1;break I;case 6:break P;default:break s}}a=H[g+8>>2];Ka(a+24|0,11424);h=H[g+8>>2];p=N(e,3);q=H[a+28>>2];r=H[a+24>>2];o=q-r|0;n=o>>2;k=n-1|0;H[H[h>>2]+(p<<2)>>2]=k;Ka(h+24|0,11424);j=p+1|0;H[H[h>>2]+(j<<2)>>2]=(H[h+28>>2]-H[h+24>>2]>>2)-1;a=H[g+8>>2];Ka(a+24|0,11424);h=p+2|0;H[H[a>>2]+(h<<2)>>2]=(H[a+28>>2]-H[a+24>>2]>>2)-1;a=H[g+8>>2];m=H[a+24>>2];if(H[a+28>>2]-m>>2>(O|0)){break s}Z:{_:{if((q|0)!=(r|0)){H[m+(k<<2)>>2]=p;b=0;if((o|0)==-4){break _}}H[m+(n<<2)>>2]=j;b=n+1|0;if((b|0)==-1){break Z}}H[m+(b<<2)>>2]=h}if((c|0)!=(A|0)){H[c>>2]=p;c=c+4|0;H[i+68>>2]=c;break N}h=c-d|0;b=h>>2;f=b+1|0;if(f>>>0>=1073741824){break K}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}f=a+(b<<2)|0;H[f>>2]=p;A=a+(h<<2)|0;a=f+4|0;if((c|0)!=(d|0)){while(1){f=f-4|0;c=c-4|0;H[f>>2]=H[c>>2];if((c|0)!=(d|0)){continue}break}}H[i+72>>2]=A;H[i+68>>2]=a;H[i+64>>2]=f;if(d){oa(d)}c=a}d=f}De(Q,H[c-4>>2]);h=H[g+40>>2];if((h|0)==H[g+36>>2]){break u}b=h-12|0;a=H[b+4>>2];k=(e^-1)+t|0;if(a>>>0>k>>>0){break G}if((a|0)!=(k|0)){break u}e=I[h-4|0];a=H[b>>2];H[g+40>>2]=b;if((a|0)<0){break G}h=c-4|0;j=H[h>>2];H[i+20>>2]=(a^-1)+t;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);b=H[i>>2];$:{if(e&1){a=-1;if((j|0)==-1){break $}a=j+1|0;a=(a>>>0)%3|0?a:j-2|0;break $}a=-1;if((j|0)==-1){break $}a=j-1|0;if((j>>>0)%3|0){break $}a=j+2|0}H[b+12>>2]=a;b=H[g+40>>2];if((b|0)==H[g+36>>2]){break u}while(1){j=b-12|0;a=H[j+4>>2];if(a>>>0>k>>>0){break G}if((a|0)!=(k|0)){break u}e=I[b-4|0];a=H[j>>2];H[g+40>>2]=j;if((a|0)<0){break G}j=H[h>>2];H[i+20>>2]=(a^-1)+t;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);b=H[i>>2];aa:{if(e&1){a=-1;if((j|0)==-1){break aa}a=j+1|0;a=(a>>>0)%3|0?a:j-2|0;break aa}a=-1;if((j|0)==-1){break aa}a=j-1|0;if((j>>>0)%3|0){break aa}a=j+2|0}H[b+12>>2]=a;b=H[g+40>>2];if((b|0)!=H[g+36>>2]){continue}break}break u}sa();v()}k=-1;d=H[q>>2];H[d+(p<<2)>>2]=-1;h=-1;break H}sa();v()}d=H[q>>2];a=H[d+(k<<2)>>2]}k=a;H[(p<<2)+d>>2]=a;a=n+1|0;a=(a>>>0)%3|0?a:n-2|0;h=-1;if((a|0)==-1){break H}h=H[(a<<2)+d>>2]}H[b+d>>2]=h;ba:{if((m|0)==-1){H[d+o>>2]=-1;n=-1;a=-1;break ba}ca:{da:{ea:{if((m>>>0)%3|0){b=m-1|0;break ea}b=m+2|0;if((b|0)==-1){break da}}a=H[(b<<2)+d>>2];H[d+o>>2]=a;if((a|0)==-1){break ca}H[H[q+24>>2]+(a<<2)>>2]=e;break ca}H[d+o>>2]=-1}n=-1;b=m+1|0;b=(b>>>0)%3|0?b:m-2|0;a=-1;if((b|0)==-1){break ba}n=H[(b<<2)+d>>2];a=b}h=H[g+388>>2];e=k<<2;b=h+e|0;o=b;m=H[b>>2];b=n<<2;H[o>>2]=m+H[b+h>>2];h=b;b=H[q+24>>2];o=h+b|0;if((k|0)!=-1){H[b+e>>2]=H[o>>2]}b=a;while(1){if((b|0)==-1){break F}H[(b<<2)+d>>2]=k;h=b+1|0;b=(h>>>0)%3|0?h:b-2|0;e=-1;fa:{if((b|0)==-1){break fa}h=H[r+(b<<2)>>2];e=-1;if((h|0)==-1){break fa}b=h+1|0;e=(b>>>0)%3|0?b:h-2|0}b=e;if((a|0)!=(b|0)){continue}break}}b=-1;if(!(y&1)){break t}break s}H[o>>2]=-1;ga:{if(C){break ga}if((D|0)!=(L|0)){H[L>>2]=n;L=L+4|0;H[i+28>>2]=L;break ga}d=D-s|0;b=d>>2;e=b+1|0;if(e>>>0>=1073741824){break q}a=d>>>1|0;e=d>>>0>=2147483644?1073741823:a>>>0>e>>>0?a:e;if(e){if(e>>>0>=1073741824){break p}a=pa(e<<2)}else{a=0}b=a+(b<<2)|0;H[b>>2]=n;L=b+4|0;if((s|0)!=(D|0)){while(1){b=b-4|0;D=D-4|0;H[b>>2]=H[D>>2];if((s|0)!=(D|0)){continue}break}}D=a+(e<<2)|0;H[i+32>>2]=D;H[i+28>>2]=L;H[i+24>>2]=b;if(s){oa(s)}s=b}H[j>>2]=p}De(Q,p);d=f}y=(l|0)<(t|0);if((l|0)!=(t|0)){continue}break}l=t}b=-1;y=H[g+8>>2];if(H[y+28>>2]-H[y+24>>2]>>2>(O|0)){break s}if((c|0)!=(f|0)){r=g+72|0;j=g+60|0;t=g+312|0;while(1){c=c-4|0;z=H[c>>2];H[i+68>>2]=c;ha:{ia:{ja:{if(J[g+270>>1]<=513){if(!I[g+364|0]){break ia}b=H[g+360>>2];a=H[g+352>>2]+(b>>>3|0)|0;if(a>>>0>=K[g+356>>2]){break ja}a=I[a|0];H[g+360>>2]=b+1;if(!(a>>>(b&7)&1)){break ja}break ia}if(Ba(t)){break ia}}ka:{la:{b=H[g+64>>2];e=H[g+68>>2];if((b|0)==e<<5){if((b+1|0)<0){break la}if(b>>>0<=1073741822){e=e<<6;b=(b&-32)+32|0;a=b>>>0>>0?e:b}else{a=2147483647}pb(j,a);b=H[g+64>>2]}H[g+64>>2]=b+1;e=H[g+60>>2]+(b>>>3&536870908)|0;a=H[e>>2];R=e,S=Vj(b)&a,H[R>>2]=S;b=H[g+76>>2];if((b|0)!=H[g+80>>2]){H[b>>2]=z;H[g+76>>2]=b+4;break ha}s=H[r>>2];h=b-s|0;e=h>>2;d=e+1|0;if(d>>>0>=1073741824){break ka}a=h>>>1|0;h=h>>>0>=2147483644?1073741823:a>>>0>d>>>0?a:d;if(h){if(h>>>0>=1073741824){break p}a=pa(h<<2)}else{a=0}d=a+(e<<2)|0;H[d>>2]=z;e=d+4|0;if((b|0)!=(s|0)){while(1){d=d-4|0;b=b-4|0;H[d>>2]=H[b>>2];if((b|0)!=(s|0)){continue}break}}H[g+80>>2]=a+(h<<2);H[g+76>>2]=e;H[g+72>>2]=d;if(!s){break ha}oa(s);break ha}sa();v()}sa();v()}q=H[g+8>>2];C=H[q>>2];if(((H[q+4>>2]-C>>2>>>0)/3|0)<=(l|0)){b=-1;break s}f=-1;b=-1;d=-1;s=H[q+24>>2];e=-1;ma:{if((z|0)==-1){break ma}a=z+1|0;a=(a>>>0)%3|0?a:z-2|0;e=-1;if((a|0)==-1){break ma}e=H[C+(a<<2)>>2]}o=H[s+(e<<2)>>2];na:{if((o|0)==-1){k=1;a=-1;break na}k=1;h=o+1|0;h=(h>>>0)%3|0?h:o-2|0;a=-1;if((h|0)==-1){break na}k=0;a=h+1|0;f=h;a=(a>>>0)%3|0?a:f-2|0;if((a|0)!=-1){a=H[C+(a<<2)>>2]}else{a=-1}}h=H[(a<<2)+s>>2];if((h|0)!=-1){d=h+1|0;d=(d>>>0)%3|0?d:h-2|0}if((f|0)==(z|0)|(d|0)==(z|0)|((z|0)!=-1&H[H[q+12>>2]+(z<<2)>>2]!=-1|(d|0)==(f|0))){break s}if(!k&H[H[q+12>>2]+(f<<2)>>2]!=-1){break s}k=-1;s=H[q+12>>2];h=-1;oa:{if((d|0)==-1){break oa}if(H[s+(d<<2)>>2]!=-1){break s}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;h=-1;if((b|0)==-1){break oa}h=H[C+(b<<2)>>2]}b=N(l,3);H[i>>2]=b;H[s+(b<<2)>>2]=z;H[s+(z<<2)>>2]=b;b=H[i>>2]+1|0;H[s+(b<<2)>>2]=f;H[s+(f<<2)>>2]=b;b=H[i>>2]+2|0;H[s+(b<<2)>>2]=d;H[s+(d<<2)>>2]=b;b=H[i>>2];H[C+(b<<2)>>2]=a;o=b+1|0;s=C+(o<<2)|0;H[s>>2]=h;h=b+2|0;d=C+(h<<2)|0;H[d>>2]=e;e=H[g+120>>2];f=o?a:-1;b=e+(f>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(f)&a,H[R>>2]=S;k=(o|0)!=-1?H[s>>2]:k;b=e+(k>>>3&536870908)|0;a=H[b>>2];R=b,S=Vj(k)&a,H[R>>2]=S;b=-1;b=(h|0)!=-1?H[d>>2]:b;f=e+(b>>>3&536870908)|0;a=H[f>>2];R=f,S=Vj(b)&a,H[R>>2]=S;F[i+88|0]=1;_c(j,i+88|0);Ka(r,i);l=l+1|0;f=H[i+64>>2]}if((c|0)!=(f|0)){continue}break}y=H[g+8>>2]}b=-1;if(((H[y+4>>2]-H[y>>2]>>2>>>0)/3|0)!=(l|0)){break s}b=H[y+28>>2]-H[y+24>>2]>>2;l=H[i+24>>2];e=H[i+28>>2];if((l|0)==(e|0)){break r}while(1){j=H[l>>2];a=H[y+24>>2];c=b-1|0;d=a+(c<<2)|0;if(H[d>>2]==-1){while(1){c=b-2|0;b=b-1|0;d=a+(c<<2)|0;if(H[d>>2]==-1){continue}break}}if(c>>>0>=j>>>0){H[i>>2]=y;d=H[d>>2];F[i+12|0]=1;H[i+8>>2]=d;H[i+4>>2]=d;if((d|0)!=-1){while(1){a=H[H[g+8>>2]>>2]+(d<<2)|0;if(H[a>>2]!=(c|0)){b=-1;break s}H[a>>2]=j;uc(i);d=H[i+8>>2];if((d|0)!=-1){continue}break}y=H[g+8>>2]}a=H[y+24>>2];f=a+(c<<2)|0;if((j|0)!=-1){H[a+(j<<2)>>2]=H[f>>2]}H[f>>2]=-1;h=1<>2];f=a+(j>>>3&536870908)|0;d=a+(c>>>3&536870908)|0;a=1<>2]&a){c=h|H[f>>2]}else{c=H[f>>2]&(h^-1)}H[f>>2]=c;H[d>>2]=H[d>>2]&(a^-1);b=b-1|0}l=l+4|0;if((e|0)!=(l|0)){continue}break}}l=H[i+24>>2]}if(l){oa(l)}a=H[i+48>>2];if(a){while(1){c=H[a>>2];oa(a);a=c;if(a){continue}break}}a=H[i+40>>2];H[i+40>>2]=0;if(a){oa(a)}a=H[i+64>>2];if(a){H[i+68>>2]=a;oa(a)}ca=i+96|0;break o}sa();v()}wa();v()}f=b;if((b|0)==-1){break n}b=H[x+16>>2];c=b+H[x>>2]|0;a=H[x+8>>2]-b|0;b=H[H[g+4>>2]+32>>2];G[b+38>>1]=J[b+38>>1];H[b>>2]=c;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=a;H[b+12>>2]=0;b=H[g+4>>2];a=J[b+36>>1];c=a<<8|a>>>8;if((c&65535)>>>0<=513){b=H[b+32>>2];e=b;a=H[b+16>>2];b=P+H[b+20>>2]|0;a=a+E|0;b=a>>>0>>0?b+1|0:b;H[e+16>>2]=a;H[e+20>>2]=b}pa:{if(H[g+216>>2]==H[g+220>>2]){break pa}a=H[g+8>>2];b=H[a>>2];a=H[a+4>>2];qa:{if((c&65535)>>>0>=513){if((a|0)==(b|0)){break pa}c=0;break qa}if((a|0)==(b|0)){break pa}c=0;while(1){if(cd(g,c)){c=c+3|0;a=H[g+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break pa}break}break n}while(1){if(bd(g,c)){c=c+3|0;a=H[g+8>>2];if(c>>>0>2]-H[a>>2]>>2>>>0){continue}break pa}break}break n}ad(B);c=H[g+216>>2];if((c|0)!=H[g+220>>2]){t=0;while(1){e=N(t,144);Jc((e+c|0)+4|0,H[g+8>>2]);a=H[M>>2];b=a+e|0;c=H[b+132>>2];b=H[b+136>>2];if((c|0)!=(b|0)){while(1){Hc((e+H[M>>2]|0)+4|0,H[c>>2]);c=c+4|0;if((b|0)!=(c|0)){continue}break}a=H[M>>2]}if(!Ic((a+e|0)+4|0)){break n}t=t+1|0;c=H[g+216>>2];if(t>>>0<(H[g+220>>2]-c|0)/144>>>0){continue}break}}a=H[g+8>>2];Hb(g+184|0,H[a+28>>2]-H[a+24>>2]>>2);w=H[g+216>>2];if((w|0)!=H[g+220>>2]){c=0;while(1){a=N(c,144)+w|0;b=H[a+60>>2]-H[a+56>>2]>>2;e=a+104|0;a=H[g+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(e,(a|0)<(b|0)?b:a);c=c+1|0;w=H[g+216>>2];if(c>>>0<(H[g+220>>2]-w|0)/144>>>0){continue}break}}w=$c(g,f)}break b}w=0}ca=u- -64|0;return w|0}function ki(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,L=0,M=0,O=0,P=0,Q=0;t=ca+-64|0;ca=t;H[a+132>>2]=0;if(H[a+148>>2]){d=H[a+144>>2];if(d){while(1){b=H[d>>2];oa(d);d=b;if(b){continue}break}}d=0;H[a+144>>2]=0;k=H[a+140>>2];a:{if(!k){break a}if(k>>>0>=4){b=k&-4;while(1){c=d<<2;H[c+H[a+136>>2]>>2]=0;H[H[a+136>>2]+(c|4)>>2]=0;H[H[a+136>>2]+(c|8)>>2]=0;H[H[a+136>>2]+(c|12)>>2]=0;d=d+4|0;e=e+4|0;if((b|0)!=(e|0)){continue}break}}b=k&3;if(!b){break a}while(1){H[H[a+136>>2]+(d<<2)>>2]=0;d=d+1|0;x=x+1|0;if((b|0)!=(x|0)){continue}break}}H[a+148>>2]=0}b:{c:{d=H[a+4>>2];x=I[d+36|0];b=x<<8|I[d+37|0];if(b>>>0<=513){f=H[d+32>>2];d:{if(b>>>0<=511){b=H[f+20>>2];e=H[f+16>>2];c=e+4|0;b=c>>>0<4?b+1|0:b;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(b|0)|(b|0)>(k|0)){break c}e=e+H[f>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[f+16>>2]=c;H[f+20>>2]=b;break d}if(!Ea(1,t,f)){break c}d=H[a+4>>2];x=I[d+36|0];e=H[t>>2]}H[a+132>>2]=e}f=H[d+32>>2];e:{f:{g:{if((x&255)>>>0<=1){x=0;b=H[f+20>>2];c=H[f+16>>2];e=c+4|0;b=e>>>0<4?b+1|0:b;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(b|0)|(b|0)>(k|0)){break b}c=c+H[f>>2]|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[t+60>>2]=c;H[f+16>>2]=e;H[f+20>>2]=b;H[a+156>>2]=c;l=a+156|0;break g}x=0;if(!Ea(1,t+60|0,f)){break b}d=H[a+4>>2];b=I[d+36|0];H[a+156>>2]=H[t+60>>2];l=a+156|0;if(b>>>0>1){break f}}f=H[d+32>>2];c=H[f+8>>2];k=H[f+12>>2];d=H[f+20>>2];e=H[f+16>>2];b=e+4|0;d=b>>>0<4?d+1|0:d;if(b>>>0>c>>>0&(d|0)>=(k|0)|(d|0)>(k|0)){break b}e=e+H[f>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[t+56>>2]=e;H[f+16>>2]=b;H[f+20>>2]=d;break e}if(!Ea(1,t+56|0,H[d+32>>2])){break b}e=H[t+56>>2]}if(e>>>0>1431655765|K[l>>2]>N(e,3)>>>0){break b}j=H[a+4>>2];y=H[j+32>>2];d=H[y+8>>2];f=H[y+12>>2];b=H[y+20>>2];m=H[y+16>>2];if((f|0)<=(b|0)&m>>>0>=d>>>0|(b|0)>(f|0)){break b}l=H[y>>2];g=I[l+m|0];c=y;k=m+1|0;C=k?b:b+1|0;H[c+16>>2]=k;H[c+20>>2]=C;h:{if(I[j+36|0]<=1){c=d;d=m+5|0;b=d>>>0<5?b+1|0:b;if(c>>>0>>0&(b|0)>=(f|0)|(b|0)>(f|0)){break b}c=k+l|0;l=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[t+52>>2]=l;H[y+16>>2]=d;H[y+20>>2]=b;break h}if(!Ea(1,t+52|0,y)){break b}l=H[t+52>>2]}if(e>>>0>>0|((l>>>0)/3|0)+l>>>0>>0){break b}d=H[a+4>>2];f=H[d+32>>2];i:{if(I[d+36|0]<=1){d=H[f+20>>2];b=H[f+16>>2];c=b+4|0;d=c>>>0<4?d+1|0:d;k=H[f+12>>2];if(K[f+8>>2]>>0&(k|0)<=(d|0)|(d|0)>(k|0)){break b}b=b+H[f>>2]|0;b=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[t+48>>2]=b;H[f+16>>2]=c;H[f+20>>2]=d;break i}if(!Ea(1,t+48|0,f)){break b}b=H[t+48>>2]}if(b>>>0>l>>>0){break b}H[a+28>>2]=H[a+24>>2];d=$b(pa(88));c=H[a+8>>2];H[a+8>>2]=d;if(c){cb(c);if(!H[a+8>>2]){break b}}H[a+164>>2]=H[a+160>>2];Jb(a+160|0,e);H[a+176>>2]=H[a+172>>2];Jb(a+172|0,e);H[a- -64>>2]=0;H[a+92>>2]=-1;H[a+84>>2]=-1;H[a+88>>2]=-1;H[a+40>>2]=H[a+36>>2];H[a+52>>2]=H[a+48>>2];H[a+76>>2]=H[a+72>>2];E=a+216|0;ed(E);dd(E,g);if(!Lc(H[a+8>>2],e,H[a+156>>2]+b|0)){break b}d=H[a+156>>2];F[t|0]=1;Oa(a+120|0,b+d|0,t);b=H[a+4>>2];d=J[b+36>>1];d=(d<<8|d>>>8)&65535;j:{if(d>>>0<=513){k=H[b+32>>2];k:{if(d>>>0<=511){b=H[k+20>>2];e=H[k+16>>2];d=e+4|0;b=d>>>0<4?b+1|0:b;c=H[k+12>>2];if(K[k+8>>2]>>0&(c|0)<=(b|0)|(b|0)>(c|0)){break b}e=e+H[k>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[k+16>>2]=d;H[k+20>>2]=b;break k}if(!Ea(1,t+44|0,k)){break b}e=H[t+44>>2]}if(!e){break b}k=H[H[a+4>>2]+32>>2];c=H[k+8>>2];d=H[k+16>>2];b=c-d|0;d=H[k+12>>2]-(H[k+20>>2]+(c>>>0>>0)|0)|0;if(b>>>0>>0&(d|0)<=0|(d|0)<0){break b}f=Ha(t);k=H[H[a+4>>2]+32>>2];c=H[k+16>>2];b=(c+H[k>>2]|0)+e|0;d=H[k+8>>2]-c|0;G[f+38>>1]=J[k+38>>1];H[f>>2]=b;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=d-e;H[f+12>>2]=0;d=Ib(a,f);if((d|0)==-1){break b}y=d;M=d>>31;break j}y=-1;M=-1;if((Ib(a,H[b+32>>2])|0)==-1){break b}}O=a+232|0;e=O;H[e+144>>2]=a;d=H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2];b=H[d>>2]+H[d+16>>2]|0;d=H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2];d=H[d+8>>2]-H[d+16>>2]|0;P=e,Q=J[H[(ea[H[H[a>>2]+32>>2]](a)|0)+32>>2]+38>>1],G[P+38>>1]=Q;H[e>>2]=b;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=d;H[e+12>>2]=0;H[a+372>>2]=g;C=Ha(t);l:{if(!Ge(e,C)){break l}b=0;d=0;e=0;k=0;i=ca-96|0;ca=i;H[i+72>>2]=0;H[i+64>>2]=0;H[i+68>>2]=0;H[i+48>>2]=0;H[i+52>>2]=0;H[i+40>>2]=0;H[i+44>>2]=0;H[i+56>>2]=1065353216;H[i+32>>2]=0;H[i+24>>2]=0;H[i+28>>2]=0;h=a;L=H[a+124>>2];m:{n:{o:{p:{q:{r:{if((l|0)<=0){break r}A=H[h+216>>2]!=H[h+220>>2];s=1;while(1){f=k;k=f+1|0;s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{if(!I[h+308|0]){break G}u=H[h+296>>2];g=H[h+304>>2];a=u+(g>>>3|0)|0;p=H[h+300>>2];if(a>>>0>=p>>>0){break G}c=I[a|0];a=g+1|0;H[h+304>>2]=a;m=c>>>(g&7)&1;if(!m){break G}n=0;j=a>>>3|0;c=u+j|0;H:{if(c>>>0>=p>>>0){g=a;a=0;break H}c=I[c|0];g=g+2|0;H[h+304>>2]=g;j=g>>>3|0;a=c>>>(a&7)&1}c=j+u|0;if(c>>>0

>>0){c=I[c|0];H[h+304>>2]=g+1;n=c>>>(g&7)<<1&2}j=-1;a=m|(a|n)<<1;switch(a-1|0){case 6:break D;case 0:break E;case 2:case 4:break F;default:break q}}if((d|0)==(e|0)){j=-1;break q}g=-1;q=H[h+8>>2];u=H[q+24>>2];p=d-4|0;s=H[p>>2];c=-1;I:{if((s|0)==-1){break I}b=s+1|0;b=(b>>>0)%3|0?b:s-2|0;c=-1;if((b|0)==-1){break I}c=H[H[q>>2]+(b<<2)>>2]}b=H[u+(c<<2)>>2];if((b|0)!=-1){a=b+1|0;g=(a>>>0)%3|0?a:b-2|0}if((g|0)==(s|0)){j=-1;break q}if((s|0)!=-1){j=-1;if(H[H[q+12>>2]+(s<<2)>>2]!=-1){break q}}b=H[q+12>>2];if((g|0)!=-1){j=-1;if(H[b+(g<<2)>>2]!=-1){break q}}n=N(f,3);a=n+1|0;H[b+(s<<2)>>2]=a;m=a<<2;H[m+b>>2]=s;r=n+2|0;H[b+(g<<2)>>2]=r;f=r<<2;H[f+b>>2]=g;o=-1;a=-1;J:{if((s|0)==-1){break J}K:{if((s>>>0)%3|0){b=s-1|0;break K}b=s+2|0;a=-1;if((b|0)==-1){break J}}a=H[H[q>>2]+(b<<2)>>2]}L:{if((g|0)==-1){break L}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;if((b|0)==-1){break L}o=H[H[q>>2]+(b<<2)>>2]}j=-1;if((a|0)==(c|0)|(c|0)==(o|0)){break q}b=H[q>>2];H[b+(n<<2)>>2]=c;H[b+m>>2]=o;H[b+f>>2]=a;if((a|0)!=-1){H[u+(a<<2)>>2]=r}b=H[h+120>>2]+(c>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(c)&a,H[P>>2]=Q;H[p>>2]=n;b=e;break s}if((d|0)==(e|0)){break q}m=d-4|0;n=H[m>>2];r=H[h+8>>2];b=H[r+12>>2];if((n|0)!=-1&H[b+(n<<2)>>2]!=-1){break q}o=N(f,3);p=(a|0)==5;g=o+(p?2:1)|0;a=g<<2;H[a+b>>2]=n;H[b+(n<<2)>>2]=g;Ka(r+24|0,11424);b=H[h+8>>2];u=H[b+24>>2];if(H[b+28>>2]-u>>2>(L|0)){break q}j=H[b>>2];q=j+a|0;c=H[r+28>>2];b=H[r+24>>2];a=(c-b>>2)-1|0;H[q>>2]=a;if((b|0)!=(c|0)){H[u+(a<<2)>>2]=g}c=p?o:o+2|0;g=j+(o+p<<2)|0;M:{if((n|0)==-1){H[j+(c<<2)>>2]=-1;b=-1;break M}N:{O:{P:{if((n>>>0)%3|0){a=n-1|0;break P}a=n+2|0;if((a|0)==-1){break O}}a=H[j+(a<<2)>>2];H[j+(c<<2)>>2]=a;if((a|0)==-1){break N}H[u+(a<<2)>>2]=c;break N}H[j+(c<<2)>>2]=-1}a=n+1|0;a=(a>>>0)%3|0?a:n-2|0;b=-1;if((a|0)==-1){break M}b=H[j+(a<<2)>>2]}H[g>>2]=b;H[m>>2]=o;b=e;break y}if((b|0)==(d|0)){break q}a=d-4|0;q=H[a>>2];H[i+68>>2]=a;p=H[i+44>>2];Q:{if(!p){d=a;break Q}g=H[i+40>>2];j=Uj(p)>>>0>1;c=f&p+2147483647;R:{if(!j){break R}c=f;if(c>>>0

>>0){break R}c=(f>>>0)%(p>>>0)|0}m=c;c=H[g+(m<<2)>>2];if(!c){d=a;break Q}g=H[c>>2];if(!g){d=a;break Q}S:{if(!j){j=p-1|0;while(1){c=H[g+4>>2];T:{if((c|0)!=(f|0)){if((m|0)==(c&j)){break T}d=a;break Q}if((f|0)==H[g+8>>2]){break S}}g=H[g>>2];if(g){continue}break}d=a;break Q}while(1){c=H[g+4>>2];U:{if((c|0)!=(f|0)){if(c>>>0>=p>>>0){c=(c>>>0)%(p>>>0)|0}if((c|0)==(m|0)){break U}d=a;break Q}if((f|0)==H[g+8>>2]){break S}}g=H[g>>2];if(g){continue}break}d=a;break Q}if((a|0)!=(z|0)){H[a>>2]=H[g+12>>2];H[i+68>>2]=d;break Q}c=z-b|0;d=c>>2;e=d+1|0;if(e>>>0>=1073741824){break C}a=c>>>1|0;c=c>>>0>=2147483644?1073741823:a>>>0>e>>>0?a:e;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}e=a+(d<<2)|0;H[e>>2]=H[g+12>>2];d=e+4|0;if((b|0)!=(z|0)){while(1){e=e-4|0;z=z-4|0;H[e>>2]=H[z>>2];if((b|0)!=(z|0)){continue}break}}z=a+(c<<2)|0;H[i+72>>2]=z;H[i+68>>2]=d;H[i+64>>2]=e;if(b){oa(b)}}if((d|0)==(e|0)){break u}g=d-4|0;n=H[g>>2];if((n|0)==(q|0)){break u}b=(n|0)==-1;o=H[h+8>>2];if(!b&H[H[o+12>>2]+(n<<2)>>2]!=-1){break u}r=H[o+12>>2];if((q|0)!=-1&H[r+(q<<2)>>2]!=-1){break u}u=N(f,3);f=u+2|0;H[r+(n<<2)>>2]=f;p=f<<2;H[p+r>>2]=n;a=u+1|0;H[r+(q<<2)>>2]=a;c=a<<2;H[c+r>>2]=q;if(b){break B}if((n>>>0)%3|0){m=n-1|0;break x}m=n+2|0;if((m|0)!=-1){break x}a=H[o>>2];b=-1;break w}a=H[h+8>>2];Ka(a+24|0,11424);c=H[h+8>>2];q=N(f,3);r=H[a+28>>2];u=H[a+24>>2];p=r-u|0;o=p>>2;g=o-1|0;H[H[c>>2]+(q<<2)>>2]=g;Ka(c+24|0,11424);m=q+1|0;H[H[c>>2]+(m<<2)>>2]=(H[c+28>>2]-H[c+24>>2]>>2)-1;a=H[h+8>>2];Ka(a+24|0,11424);c=q+2|0;H[H[a>>2]+(c<<2)>>2]=(H[a+28>>2]-H[a+24>>2]>>2)-1;a=H[h+8>>2];n=H[a+24>>2];if(H[a+28>>2]-n>>2>(L|0)){break q}V:{W:{if((r|0)!=(u|0)){H[n+(g<<2)>>2]=q;j=0;if((p|0)==-4){break W}}H[n+(o<<2)>>2]=m;j=o+1|0;if((j|0)==-1){break V}}H[n+(j<<2)>>2]=c}if((d|0)!=(z|0)){H[d>>2]=q;d=d+4|0;H[i+68>>2]=d;break y}m=d-b|0;e=m>>2;c=e+1|0;if(c>>>0>=1073741824){break A}a=m>>>1|0;c=m>>>0>=2147483644?1073741823:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}e=a+(e<<2)|0;H[e>>2]=q;z=a+(c<<2)|0;a=e+4|0;if((b|0)!=(d|0)){while(1){e=e-4|0;d=d-4|0;H[e>>2]=H[d>>2];if((b|0)!=(d|0)){continue}break}}H[i+72>>2]=z;H[i+68>>2]=a;H[i+64>>2]=e;if(!b){break z}oa(b);break z}sa();v()}m=-1;a=H[o>>2];H[a+(u<<2)>>2]=-1;j=-1;break v}sa();v()}d=a;b=e}m=H[h+40>>2];if((m|0)==H[h+36>>2]){break s}c=m-12|0;a=H[c+4>>2];j=(f^-1)+l|0;if(a>>>0>j>>>0){break u}if((a|0)!=(j|0)){break s}f=I[m-4|0];a=H[c>>2];H[h+40>>2]=c;if((a|0)<0){break u}m=d-4|0;g=H[m>>2];H[i+20>>2]=(a^-1)+l;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);c=H[i>>2];X:{if(f&1){a=-1;if((g|0)==-1){break X}a=g+1|0;a=(a>>>0)%3|0?a:g-2|0;break X}a=-1;if((g|0)==-1){break X}a=g-1|0;if((g>>>0)%3|0){break X}a=g+2|0}H[c+12>>2]=a;g=H[h+40>>2];if((g|0)==H[h+36>>2]){break s}while(1){c=g-12|0;a=H[c+4>>2];if(a>>>0>j>>>0){break u}if((a|0)!=(j|0)){break s}f=I[g-4|0];a=H[c>>2];H[h+40>>2]=c;if((a|0)<0){break u}g=H[m>>2];H[i+20>>2]=(a^-1)+l;a=i+20|0;H[i+88>>2]=a;Gb(i,i+40|0,a,i+88|0);c=H[i>>2];Y:{if(f&1){a=-1;if((g|0)==-1){break Y}a=g+1|0;a=(a>>>0)%3|0?a:g-2|0;break Y}a=-1;if((g|0)==-1){break Y}a=g-1|0;if((g>>>0)%3|0){break Y}a=g+2|0}H[c+12>>2]=a;g=H[h+40>>2];if((g|0)!=H[h+36>>2]){continue}break}break s}a=H[o>>2];b=H[a+(m<<2)>>2]}m=b;H[(u<<2)+a>>2]=b;b=n+1|0;b=(b>>>0)%3|0?b:n-2|0;j=-1;if((b|0)==-1){break v}j=H[(b<<2)+a>>2]}H[a+c>>2]=j;Z:{if((q|0)==-1){H[a+p>>2]=-1;n=-1;c=-1;break Z}_:{$:{aa:{if((q>>>0)%3|0){b=q-1|0;break aa}b=q+2|0;if((b|0)==-1){break $}}b=H[(b<<2)+a>>2];H[a+p>>2]=b;if((b|0)==-1){break _}H[H[o+24>>2]+(b<<2)>>2]=f;break _}H[a+p>>2]=-1}n=-1;b=q+1|0;b=(b>>>0)%3|0?b:q-2|0;c=-1;if((b|0)==-1){break Z}n=H[(b<<2)+a>>2];c=b}b=H[o+24>>2];p=b+(n<<2)|0;if((m|0)!=-1){H[b+(m<<2)>>2]=H[p>>2]}b=c;while(1){if((b|0)==-1){break t}H[(b<<2)+a>>2]=m;j=b+1|0;b=(j>>>0)%3|0?j:b-2|0;f=-1;ba:{if((b|0)==-1){break ba}j=H[r+(b<<2)>>2];f=-1;if((j|0)==-1){break ba}b=j+1|0;f=(b>>>0)%3|0?b:j-2|0}b=f;if((c|0)!=(b|0)){continue}break}}j=-1;if(!(s&1)){break r}break q}H[p>>2]=-1;ca:{if(A){break ca}if((B|0)!=(D|0)){H[D>>2]=n;D=D+4|0;H[i+28>>2]=D;break ca}f=B-w|0;b=f>>2;c=b+1|0;if(c>>>0>=1073741824){break o}a=f>>>1|0;c=f>>>0>=2147483644?1073741823:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=1073741824){break n}a=pa(c<<2)}else{a=0}b=a+(b<<2)|0;H[b>>2]=n;D=b+4|0;if((w|0)!=(B|0)){while(1){b=b-4|0;B=B-4|0;H[b>>2]=H[B>>2];if((w|0)!=(B|0)){continue}break}}B=a+(c<<2)|0;H[i+32>>2]=B;H[i+28>>2]=D;H[i+24>>2]=b;if(w){oa(w)}w=b}H[g>>2]=u;b=e}s=(k|0)<(l|0);if((k|0)!=(l|0)){continue}break}k=l}j=-1;a=H[h+8>>2];if(H[a+28>>2]-H[a+24>>2]>>2>(L|0)){break q}if((d|0)!=(e|0)){u=h+72|0;m=h+60|0;p=h+312|0;while(1){d=d-4|0;o=H[d>>2];H[i+68>>2]=d;da:{ea:{fa:{if(J[h+270>>1]<=513){if(!I[h+364|0]){break ea}b=H[h+360>>2];a=H[h+352>>2]+(b>>>3|0)|0;if(a>>>0>=K[h+356>>2]){break fa}a=I[a|0];H[h+360>>2]=b+1;if(!(a>>>(b&7)&1)){break fa}break ea}if(Ba(p)){break ea}}ga:{ha:{b=H[h+64>>2];c=H[h+68>>2];if((b|0)==c<<5){if((b+1|0)<0){break ha}if(b>>>0<=1073741822){c=c<<6;b=(b&-32)+32|0;a=b>>>0>>0?c:b}else{a=2147483647}pb(m,a);b=H[h+64>>2]}H[h+64>>2]=b+1;c=H[h+60>>2]+(b>>>3&536870908)|0;a=H[c>>2];P=c,Q=Vj(b)&a,H[P>>2]=Q;b=H[h+76>>2];if((b|0)!=H[h+80>>2]){H[b>>2]=o;H[h+76>>2]=b+4;break da}l=H[u>>2];w=b-l|0;c=w>>2;f=c+1|0;if(f>>>0>=1073741824){break ga}a=w>>>1|0;f=w>>>0>=2147483644?1073741823:a>>>0>f>>>0?a:f;if(f){if(f>>>0>=1073741824){break n}a=pa(f<<2)}else{a=0}g=a+(c<<2)|0;H[g>>2]=o;c=g+4|0;if((b|0)!=(l|0)){while(1){g=g-4|0;b=b-4|0;H[g>>2]=H[b>>2];if((b|0)!=(l|0)){continue}break}}H[h+80>>2]=a+(f<<2);H[h+76>>2]=c;H[h+72>>2]=g;if(!l){break da}oa(l);break da}sa();v()}sa();v()}r=H[h+8>>2];A=H[r>>2];if(((H[r+4>>2]-A>>2>>>0)/3|0)<=(k|0)){j=-1;break q}a=-1;j=-1;b=-1;w=H[r+24>>2];f=-1;ia:{if((o|0)==-1){break ia}e=o+1|0;e=(e>>>0)%3|0?e:o-2|0;f=-1;if((e|0)==-1){break ia}f=H[A+(e<<2)>>2]}l=H[w+(f<<2)>>2];ja:{if((l|0)==-1){g=1;e=-1;break ja}g=1;c=l+1|0;c=(c>>>0)%3|0?c:l-2|0;e=-1;if((c|0)==-1){break ja}g=0;a=c;e=a+1|0;e=(e>>>0)%3|0?e:a-2|0;if((e|0)!=-1){e=H[A+(e<<2)>>2]}else{e=-1}}c=H[(e<<2)+w>>2];if((c|0)!=-1){b=c+1|0;b=(b>>>0)%3|0?b:c-2|0}if((a|0)==(o|0)|(b|0)==(o|0)|((o|0)!=-1&H[H[r+12>>2]+(o<<2)>>2]!=-1|(a|0)==(b|0))){break q}if(!g&H[H[r+12>>2]+(a<<2)>>2]!=-1){break q}g=-1;l=H[r+12>>2];w=-1;ka:{if((b|0)==-1){break ka}if(H[l+(b<<2)>>2]!=-1){break q}c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;w=-1;if((c|0)==-1){break ka}w=H[A+(c<<2)>>2]}c=N(k,3);H[i>>2]=c;H[l+(c<<2)>>2]=o;H[l+(o<<2)>>2]=c;c=H[i>>2]+1|0;H[l+(c<<2)>>2]=a;H[l+(a<<2)>>2]=c;a=H[i>>2]+2|0;H[l+(a<<2)>>2]=b;H[l+(b<<2)>>2]=a;a=H[i>>2];H[A+(a<<2)>>2]=e;j=a+1|0;l=A+(j<<2)|0;H[l>>2]=w;w=a+2|0;c=A+(w<<2)|0;H[c>>2]=f;f=H[h+120>>2];e=j?e:-1;b=f+(e>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(e)&a,H[P>>2]=Q;g=(j|0)!=-1?H[l>>2]:g;b=f+(g>>>3&536870908)|0;a=H[b>>2];P=b,Q=Vj(g)&a,H[P>>2]=Q;b=-1;b=(w|0)!=-1?H[c>>2]:b;e=f+(b>>>3&536870908)|0;a=H[e>>2];P=e,Q=Vj(b)&a,H[P>>2]=Q;F[i+88|0]=1;_c(m,i+88|0);Ka(u,i);k=k+1|0;e=H[i+64>>2]}if((d|0)!=(e|0)){continue}break}a=H[h+8>>2]}j=-1;if(((H[a+4>>2]-H[a>>2]>>2>>>0)/3|0)!=(k|0)){break q}j=H[a+28>>2]-H[a+24>>2]>>2;s=H[i+24>>2];c=H[i+28>>2];if((s|0)==(c|0)){break p}while(1){k=H[s>>2];d=H[a+24>>2];b=j-1|0;g=d+(b<<2)|0;if(H[g>>2]==-1){while(1){b=j-2|0;j=j-1|0;g=d+(b<<2)|0;if(H[g>>2]==-1){continue}break}}if(b>>>0>=k>>>0){H[i>>2]=a;g=H[g>>2];F[i+12|0]=1;H[i+8>>2]=g;H[i+4>>2]=g;if((g|0)!=-1){while(1){a=H[H[h+8>>2]>>2]+(g<<2)|0;if(H[a>>2]!=(b|0)){j=-1;break q}H[a>>2]=k;uc(i);g=H[i+8>>2];if((g|0)!=-1){continue}break}a=H[h+8>>2]}d=H[a+24>>2];e=d+(b<<2)|0;if((k|0)!=-1){H[d+(k<<2)>>2]=H[e>>2]}H[e>>2]=-1;f=1<>2];e=d+(k>>>3&536870908)|0;k=d+(b>>>3&536870908)|0;d=1<>2]&d){b=f|H[e>>2]}else{b=H[e>>2]&(f^-1)}H[e>>2]=b;H[k>>2]=H[k>>2]&(d^-1);j=j-1|0}s=s+4|0;if((c|0)!=(s|0)){continue}break}}s=H[i+24>>2]}if(s){oa(s)}a=H[i+48>>2];if(a){while(1){d=H[a>>2];oa(a);a=d;if(a){continue}break}}a=H[i+40>>2];H[i+40>>2]=0;if(a){oa(a)}a=H[i+64>>2];if(a){H[i+68>>2]=a;oa(a)}ca=i+96|0;a=j;break m}sa();v()}wa();v()}e=a;if((a|0)==-1){break l}b=H[C+16>>2];d=b+H[C>>2]|0;a=H[C+8>>2]-b|0;b=H[H[h+4>>2]+32>>2];G[b+38>>1]=J[b+38>>1];H[b>>2]=d;H[b+16>>2]=0;H[b+20>>2]=0;H[b+8>>2]=a;H[b+12>>2]=0;b=H[h+4>>2];a=J[b+36>>1];d=a<<8|a>>>8;if((d&65535)>>>0<=513){b=H[b+32>>2];c=b;a=H[b+16>>2];b=M+H[b+20>>2]|0;a=a+y|0;b=a>>>0>>0?b+1|0:b;H[c+16>>2]=a;H[c+20>>2]=b}la:{if(H[h+216>>2]==H[h+220>>2]){break la}a=H[h+8>>2];b=H[a>>2];a=H[a+4>>2];ma:{if((d&65535)>>>0>=513){if((a|0)==(b|0)){break la}d=0;break ma}if((a|0)==(b|0)){break la}d=0;while(1){if(cd(h,d)){d=d+3|0;a=H[h+8>>2];if(d>>>0>2]-H[a>>2]>>2>>>0){continue}break la}break}break l}while(1){if(bd(h,d)){d=d+3|0;a=H[h+8>>2];if(d>>>0>2]-H[a>>2]>>2>>>0){continue}break la}break}break l}ad(O);d=H[h+216>>2];if((d|0)!=H[h+220>>2]){l=0;while(1){c=N(l,144);Jc((c+d|0)+4|0,H[h+8>>2]);a=H[E>>2];b=a+c|0;d=H[b+132>>2];b=H[b+136>>2];if((d|0)!=(b|0)){while(1){Hc((c+H[E>>2]|0)+4|0,H[d>>2]);d=d+4|0;if((b|0)!=(d|0)){continue}break}a=H[E>>2]}if(!Ic((a+c|0)+4|0)){break l}l=l+1|0;d=H[h+216>>2];if(l>>>0<(H[h+220>>2]-d|0)/144>>>0){continue}break}}a=H[h+8>>2];Hb(h+184|0,H[a+28>>2]-H[a+24>>2]>>2);x=H[h+216>>2];if((x|0)!=H[h+220>>2]){d=0;while(1){a=N(d,144)+x|0;b=H[a+60>>2]-H[a+56>>2]>>2;c=a+104|0;a=H[h+8>>2];a=H[a+28>>2]-H[a+24>>2]>>2;Hb(c,(a|0)<(b|0)?b:a);d=d+1|0;x=H[h+216>>2];if(d>>>0<(H[h+220>>2]-x|0)/144>>>0){continue}break}}x=$c(h,e)}break b}x=0}ca=t- -64|0;return x|0}function Bg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,O=0;B=c;c=0;m=ca-96|0;ca=m;l=m+16|0;ra(l,0,76);H[m+92>>2]=-1;H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;r=ca-16|0;ca=r;H[l+68>>2]=0;H[l+72>>2]=0;H[l>>2]=b;s=ca-16|0;ca=s;u=b;a=H[b+20>>2];a:{if((H[b+24>>2]-a|0)<=0){break a}a=H[a>>2];if((a|0)==-1){break a}c=H[H[u+8>>2]+(a<<2)>>2]}b:{c:{d:{if(!c){a=0;break d}a=H[u+100>>2];e=H[u+96>>2];H[s+8>>2]=0;H[s>>2]=0;H[s+4>>2]=0;f=a-e|0;b=(f|0)/12|0;e:{if((a|0)==(e|0)){break e}if(b>>>0>=357913942){break c}d=pa(f);H[s>>2]=d;H[s+8>>2]=d+N(b,12);a=0;n=d;f=f-12|0;d=(f-((f>>>0)%12|0)|0)+12|0;f=ra(n,0,d);H[s+4>>2]=d+f;if(I[c+84|0]){c=b>>>0<=1?1:b;h=c&1;if(b>>>0>=2){g=c&-2;c=0;while(1){d=N(a,12);b=d+e|0;i=H[b+4>>2];j=H[b>>2];d=d+f|0;H[d+8>>2]=H[b+8>>2];H[d>>2]=j;H[d+4>>2]=i;d=N(a|1,12);b=d+e|0;i=H[b+4>>2];j=H[b>>2];d=d+f|0;H[d+8>>2]=H[b+8>>2];H[d>>2]=j;H[d+4>>2]=i;a=a+2|0;c=c+2|0;if((g|0)!=(c|0)){continue}break}}if(!h){break e}b=N(a,12);a=b+e|0;c=H[a+4>>2];e=H[a>>2];b=b+f|0;H[b+8>>2]=H[a+8>>2];H[b>>2]=e;H[b+4>>2]=c;break e}h=b>>>0<=1?1:b;a=H[c+68>>2];c=0;while(1){d=N(c,12);b=d+e|0;g=H[a+(H[b>>2]<<2)>>2];i=H[a+(H[b+4>>2]<<2)>>2];d=d+f|0;H[d+8>>2]=H[a+(H[b+8>>2]<<2)>>2];H[d+4>>2]=i;H[d>>2]=g;c=c+1|0;if((h|0)!=(c|0)){continue}break}}d=0;E=ca-16|0;ca=E;h=pa(88);$b(h);C=ca-16|0;ca=C;H[h+80>>2]=0;H[h+84>>2]=0;a=H[h+76>>2];H[h+76>>2]=0;if(a){oa(a)}H[h+68>>2]=0;H[h+72>>2]=0;b=h- -64|0;a=H[b>>2];H[b>>2]=0;if(a){oa(a)}g=H[s+4>>2];b=H[s>>2];c=(g-b|0)/12|0;a=N(c,3);f=H[h>>2];e=H[h+4>>2]-f>>2;f:{if(a>>>0>e>>>0){ue(h,a-e|0);g=H[s+4>>2];b=H[s>>2];c=(g-b|0)/12|0;break f}if(a>>>0>=e>>>0){break f}H[h+4>>2]=f+(a<<2)}g:{if((b|0)==(g|0)){break g}e=c>>>0<=1?1:c;g=e&1;a=H[h>>2];if(c>>>0>=2){i=e&-2;c=0;while(1){e=N(d,12);j=e+a|0;f=b+e|0;H[j>>2]=H[f>>2];H[a+(e|4)>>2]=H[f+4>>2];H[j+8>>2]=H[f+8>>2];f=N(d|1,12);e=f+a|0;f=b+f|0;H[e>>2]=H[f>>2];H[e+4>>2]=H[f+4>>2];H[e+8>>2]=H[f+8>>2];d=d+2|0;c=c+2|0;if((i|0)!=(c|0)){continue}break}}if(!g){break g}c=N(d,12);a=c+a|0;b=b+c|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2]}H[C+12>>2]=-1;a=0;e=0;g=0;f=ca-32|0;ca=f;h:{i:{w=C+12|0;j:{if(!w){break j}c=H[h+4>>2];j=H[h>>2];d=c-j|0;i=d>>2;n=H[h+12>>2];b=H[h+16>>2]-n>>2;k:{if(i>>>0>b>>>0){qb(h+12|0,i-b|0,13652);c=H[h+4>>2];j=H[h>>2];d=c-j|0;i=d>>2;break k}if(b>>>0<=i>>>0){break k}H[h+16>>2]=n+(i<<2)}H[f+24>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;b=(c|0)==(j|0);if(!b){if((d|0)<0){break i}e=pa(d);H[f+20>>2]=e;H[f+16>>2]=e;H[f+24>>2]=(i<<2)+e}l:{m:{n:{o:{p:{if(d){while(1){i=H[(a<<2)+j>>2];b=H[f+20>>2]-e>>2;q:{if(i>>>0>>0){break q}H[f>>2]=0;d=i+1|0;if(d>>>0>b>>>0){Pa(f+16|0,d-b|0,f);j=H[h>>2];c=H[h+4>>2];e=H[f+16>>2];break q}if(b>>>0<=d>>>0){break q}H[f+20>>2]=(d<<2)+e}b=(i<<2)+e|0;H[b>>2]=H[b>>2]+1;a=a+1|0;d=c-j|0;i=d>>2;if(a>>>0>>0){continue}break}break p}d=0;if(!b){break o}break n}if((c|0)==(j|0)){d=0;break n}if(d>>>0>=2147483645){break m}}d=pa(d<<1);ra(d,255,i<<3)}H[f+8>>2]=0;H[f>>2]=0;H[f+4>>2]=0;b=H[f+20>>2];a=b-e|0;t=a>>2;r:{s:{if((b|0)==(e|0)){break s}if((a|0)<0){break r}q=pa(a);H[f>>2]=q;H[f+8>>2]=(t<<2)+q;b=ra(q,0,a);H[f+4>>2]=b+a;c=t>>>0<=1?1:t;n=c&3;a=0;if(c-1>>>0>=3){o=c&-4;while(1){c=g<<2;H[c+b>>2]=a;x=c|4;a=H[c+e>>2]+a|0;H[x+b>>2]=a;y=c|8;a=a+H[e+x>>2]|0;H[y+b>>2]=a;c=c|12;a=a+H[e+y>>2]|0;H[c+b>>2]=a;a=a+H[c+e>>2]|0;g=g+4|0;p=p+4|0;if((o|0)!=(p|0)){continue}break}}if(!n){break s}while(1){c=g<<2;H[c+b>>2]=a;g=g+1|0;a=H[c+e>>2]+a|0;k=k+1|0;if((n|0)!=(k|0)){continue}break}}if(!i){break l}x=H[h+40>>2];y=H[h+12>>2];n=0;while(1){G=n<<2;a=G+j|0;k=-1;c=n+1|0;b=(c>>>0)%3|0?c:n-2|0;if((b|0)!=-1){k=H[(b<<2)+j>>2]}b=H[a>>2];t:{u:{if(!((n>>>0)%3|0)){p=-1;a=n+2|0;if((a|0)!=-1){p=H[(a<<2)+j>>2]}if(!((b|0)==(k|0)|(b|0)==(p|0))&(k|0)!=(p|0)){break u}x=x+1|0;H[h+40>>2]=x;c=n+3|0;break t}p=H[a-4>>2]}a=p<<2;A=H[a+e>>2];v:{w:{if((A|0)<=0){break w}a=H[a+q>>2];g=0;while(1){o=(a<<3)+d|0;z=H[o>>2];if((z|0)==-1){break w}x:{if((k|0)!=(z|0)){break x}o=H[o+4>>2];if((o|0)!=-1){z=H[(o<<2)+j>>2]}else{z=-1}if((z|0)==(b|0)){break x}while(1){y:{b=a;g=g+1|0;if((A|0)<=(g|0)){break y}a=b+1|0;J=(a<<3)+d|0;z=H[J>>2];K=(b<<3)+d|0;H[K+4>>2]=H[J+4>>2];H[K>>2]=z;if((z|0)!=-1){continue}}break}H[(b<<3)+d>>2]=-1;if((o|0)==-1){break w}H[y+G>>2]=o;H[y+(o<<2)>>2]=n;break v}a=a+1|0;g=g+1|0;if((A|0)!=(g|0)){continue}break}}a=k<<2;k=H[a+e>>2];if((k|0)<=0){break v}a=H[a+q>>2];g=0;while(1){b=(a<<3)+d|0;if(H[b>>2]==-1){H[b>>2]=p;H[b+4>>2]=n;break v}a=a+1|0;g=g+1|0;if((k|0)!=(g|0)){continue}break}}}n=c;if(n>>>0>>0){continue}break}break l}break i}sa();v()}H[w>>2]=t;if(q){oa(q)}if(d){oa(d)}a=H[f+16>>2];if(!a){break j}H[f+20>>2]=a;oa(a)}ca=f+32|0;x=(w|0)!=0;if(x){k=ca-32|0;ca=k;a=H[h>>2];g=H[h+4>>2];H[k+24>>2]=0;H[k+16>>2]=0;H[k+20>>2]=0;if((a|0)==(g|0)){c=g}else{a=g-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=pa(b<<2);H[k+24>>2]=b;H[k+20>>2]=0;H[k+16>>2]=c;Mc(k+16|0,a);g=H[h>>2];c=H[h+4>>2]}H[k+8>>2]=0;H[k>>2]=0;while(1){z:{o=0;i=0;if((c|0)==(g|0)){break z}while(1){b=H[k+16>>2];A:{if(H[b+(i>>>3&536870908)>>2]>>>i&1){break A}c=H[k>>2];H[k+4>>2]=c;e=H[h+12>>2];a=i;while(1){B:{f=a+1|0;d=a;a=(f>>>0)%3|0?f:a-2|0;if((a|0)==-1){break B}a=H[e+(a<<2)>>2];if((a|0)==-1){break B}f=a+1|0;a=(f>>>0)%3|0?f:a-2|0;if((i|0)==(a|0)|(a|0)==-1){break B}if(!(H[b+(a>>>3&536870908)>>2]>>>a&1)){continue}}break}j=d;C:{D:{E:{while(1){a=H[k+16>>2]+(j>>>3&536870908)|0;H[a>>2]=H[a>>2]|1<>>0)%3|0?a:j-2|0;g=H[h>>2];y=(j>>>0)%3|0;b=(y?-1:2)+j|0;n=H[k>>2];A=(n|0)==(c|0);F:{if(A){break F}w=H[(f<<2)+g>>2];q=H[h+12>>2];a=n;if((b|0)!=-1){e=q+(b<<2)|0;while(1){G:{if((w|0)!=H[a>>2]){break G}p=H[a+4>>2];t=H[e>>2];if((p|0)==(t|0)){break G}e=b;c=-1;a=-1;if((p|0)==-1){break C}break D}a=a+8|0;if((c|0)!=(a|0)){continue}break}break F}while(1){if((w|0)==H[a>>2]){t=-1;e=-1;p=H[a+4>>2];if((p|0)!=-1){break D}}a=a+8|0;if((c|0)!=(a|0)){continue}break}}b=H[(b<<2)+g>>2];H:{if(H[k+8>>2]!=(c|0)){H[c>>2]=b;H[c+4>>2]=f;c=c+8|0;H[k+4>>2]=c;break H}a=c-n|0;p=a>>3;e=p+1|0;if(e>>>0>=536870912){break i}g=a>>>2|0;g=a>>>0>=2147483640?536870911:e>>>0>>0?g:e;if(g){if(g>>>0>=536870912){break E}e=pa(g<<3)}else{e=0}a=e+(p<<3)|0;H[a>>2]=b;H[a+4>>2]=f;b=a+8|0;if(!A){while(1){c=c-8|0;f=H[c+4>>2];a=a-8|0;H[a>>2]=H[c>>2];H[a+4>>2]=f;if((c|0)!=(n|0)){continue}break}c=H[k>>2]}H[k+8>>2]=e+(g<<3);H[k+4>>2]=b;H[k>>2]=a;if(c){oa(c)}c=b}I:{J:{if(y){a=j-1|0;break J}a=j+2|0;if((a|0)==-1){break I}}a=H[H[h+12>>2]+(a<<2)>>2];if((a|0)==-1){break I}j=a+((a>>>0)%3|0?-1:2)|0;if((d|0)==(j|0)){break I}if((j|0)!=-1){continue}}break}g=H[h>>2];break A}wa();v()}c=H[q+(p<<2)>>2];b=e;a=p}if((t|0)!=-1){H[q+(t<<2)>>2]=-1}if((c|0)!=-1){H[q+(c<<2)>>2]=-1}H[q+(b<<2)>>2]=-1;H[q+(a<<2)>>2]=-1;o=1}i=i+1|0;c=H[h+4>>2];if(i>>>0>2>>>0){continue}break}if(o){continue}}break}a=H[k>>2];if(a){oa(a)}a=H[k+16>>2];if(a){oa(a)}ca=k+32|0;n=0;g=ca-32|0;ca=g;e=H[C+12>>2];H[h+36>>2]=e;p=h+24|0;b=H[h+24>>2];a=H[h+28>>2]-b>>2;K:{L:{if(a>>>0>>0){qb(p,e-a|0,13652);H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;break L}if(a>>>0>e>>>0){H[h+28>>2]=b+(e<<2)}H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;if(!e){break K}}if((e|0)<0){break i}a=(e-1>>>5|0)+1|0;b=pa(a<<2);H[g+24>>2]=a;H[g+20>>2]=0;H[g+16>>2]=b;Mc(g+16|0,e)}a=H[h>>2];b=H[h+4>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;M:{if((a|0)==(b|0)){a=b}else{a=b-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=pa(b<<2);H[g+8>>2]=b;H[g+4>>2]=0;H[g>>2]=c;Mc(g,a);b=H[h>>2];a=H[h+4>>2]}if(a-b>>>0<12){break M}N:{while(1){q=N(n,3);d=(q<<2)+b|0;f=H[d>>2];c=-1;i=q+1|0;if((i|0)!=-1){c=H[(i<<2)+b>>2]}O:{if((c|0)==(f|0)){break O}i=f;f=H[d+8>>2];if((i|0)==(f|0)|(c|0)==(f|0)){break O}k=0;i=H[g>>2];while(1){f=k+q|0;if(!(H[(f>>>3&536870908)+i>>2]>>>f&1)){a=H[(f<<2)+b>>2];c=1<>2];b=a>>>5|0;i=H[d+(b<<2)>>2];t=c&i;if(t){c=H[h+28>>2];P:{if((c|0)!=H[h+32>>2]){H[c>>2]=-1;H[h+28>>2]=c+4;break P}i=H[p>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=pa(j<<2)}else{b=0}d=b+(o<<2)|0;H[d>>2]=-1;o=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[h+32>>2]=b+(j<<2);H[h+28>>2]=o;H[h+24>>2]=d;if(!i){break P}oa(i)}c=H[h+52>>2];Q:{if((c|0)!=H[h+56>>2]){H[c>>2]=a;H[h+52>>2]=c+4;break Q}i=H[h+48>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=pa(j<<2)}else{b=0}d=b+(o<<2)|0;H[d>>2]=a;a=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[h+56>>2]=b+(j<<2);H[h+52>>2]=a;H[h+48>>2]=d;if(!i){break Q}oa(i)}c=H[g+20>>2];a=H[g+24>>2];if((c|0)==a<<5){if((c+1|0)<0){break i}b=g+16|0;if(c>>>0<=1073741822){a=a<<6;c=(c&-32)+32|0;a=a>>>0>c>>>0?a:c}else{a=2147483647}pb(b,a);c=H[g+20>>2]}H[g+20>>2]=c+1;d=H[g+16>>2];a=d+(c>>>3&536870908)|0;b=H[a>>2];M=a,O=Vj(c)&b,H[M>>2]=O;c=1<>>5|0;i=H[(b<<2)+d>>2];a=e;e=a+1|0}H[(b<<2)+d>>2]=c|i;o=H[h+24>>2]+(a<<2)|0;j=H[h+12>>2];b=H[h>>2];i=H[g>>2];c=f;R:{S:{T:{while(1){if((c|0)==-1){break T}d=(c>>>3&536870908)+i|0;H[d>>2]=H[d>>2]|1<>2]=c;if(t){H[(c<<2)+b>>2]=a}w=c+1|0;c=(w>>>0)%3|0?w:c-2|0;d=-1;U:{if((c|0)==-1){break U}c=H[j+(c<<2)>>2];d=-1;if((c|0)==-1){break U}d=c+1|0;d=(d>>>0)%3|0?d:c-2|0}c=d;if((f|0)!=(c|0)){continue}break}if((f|0)!=-1){break R}c=1;break S}if((f>>>0)%3|0){c=f-1|0;break S}c=f+2|0;if((c|0)==-1){break R}}c=H[j+(c<<2)>>2];if((c|0)==-1){break R}V:{if((c>>>0)%3|0){c=c-1|0;break V}c=c+2|0;if((c|0)==-1){break R}}f=H[h+12>>2];b=H[h>>2];while(1){d=(c>>>3&536870908)+i|0;H[d>>2]=H[d>>2]|1<>2]=a}W:{if((c>>>0)%3|0){c=c-1|0;break W}c=c+2|0;if((c|0)==-1){break R}}c=H[f+(c<<2)>>2];if((c|0)==-1){break R}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)!=-1){continue}break}}}k=k+1|0;if((k|0)!=3){continue}break}b=H[h>>2];a=H[h+4>>2]}n=n+1|0;if(n>>>0<(a-b>>2>>>0)/3>>>0){continue}break}break M}wa();v()}c=0;H[h+44>>2]=0;a=H[g+16>>2];b=H[g+20>>2];if(b){e=b&31;b=(b>>>3&536870908)+a|0;d=a;i=0;while(1){if(!(H[d>>2]>>>c&1)){i=i+1|0;H[h+44>>2]=i}f=(c|0)==31;c=f?0:c+1|0;d=(f<<2)+d|0;if((b|0)!=(d|0)|(c|0)!=(e|0)){continue}break}}b=H[g>>2];if(b){oa(b);a=H[g+16>>2]}if(a){oa(a)}ca=g+32|0}ca=C+16|0;if(!x){H[E+8>>2]=0;cb(h);h=0}ca=E+16|0;a=h;break h}sa();v()}b=H[s>>2];if(!b){break d}H[s+4>>2]=b;oa(b)}ca=s+16|0;break b}sa();v()}c=H[l+4>>2];b=a;H[l+4>>2]=a;if(c){cb(c);b=H[l+4>>2]}X:{if(!b){break X}a=H[u+100>>2];c=H[u+96>>2];F[r+12|0]=0;Oa(l+56|0,(a-c|0)/12|0,r+12|0);a=H[u+100>>2];c=H[u+96>>2];if((a|0)==(c|0)){break X}while(1){if(!(H[H[l+56>>2]+(D>>>3&536870908)>>2]>>>D&1)){a=N(D,3);Gc(l,0,a);c=H[l+8>>2];e=H[l+12>>2];Gc(l,1,a+1|0);f=H[l+20>>2];d=H[l+24>>2];Gc(l,2,a+2|0);n=(c|0)==(e|0)?-1:0;a=d-f>>2;c=e-c>>2;e=a>>>0>c>>>0;c=H[l+36>>2]-H[l+32>>2]>>2>>>0>(e?a:c)>>>0?2:e?1:n;Y:{if(H[l+68>>2]<=0){break Y}H[r+12>>2]=H[l+76>>2];H[r+8>>2]=m;bb(r+8|0,r+12|0);a=H[((c<<2)+l|0)+44>>2];if((a|0)<0){a=-1}else{e=(a>>>0)/3|0;a=H[(H[H[l>>2]+96>>2]+N(e,12)|0)+(a-N(e,3)<<2)>>2]}H[r+12>>2]=a;H[r+8>>2]=m;bb(r+8|0,r+12|0);e=H[l+72>>2];H[l+72>>2]=e+2;if(!(e&1)){break Y}H[r+12>>2]=a;H[r+8>>2]=m;bb(r+8|0,r+12|0);H[l+72>>2]=H[l+72>>2]+1}d=0;e=ca-16|0;ca=e;H[l+68>>2]=H[l+68>>2]+1;a=N(c,12)+l|0;a=H[a+12>>2]-H[a+8>>2]|0;if((a|0)>0){a=a>>>2|0;h=a>>>0<=1?1:a;c=H[((c<<2)+l|0)+44>>2];while(1){a=c;f=(a>>>0)/3|0;c=(a|0)==-1;g=c?-1:f;i=H[l+56>>2]+(g>>>3&536870908)|0;H[i>>2]=H[i>>2]|1<>2]=H[l+72>>2]+1;Z:{_:{$:{aa:{ba:{if(!d){ca:{if((a|0)>=0){H[e+12>>2]=H[(H[H[l>>2]+96>>2]+N(f,12)|0)+((a>>>0)%3<<2)>>2];H[e+8>>2]=m;bb(e+8|0,e+12|0);break ca}H[e+12>>2]=-1;H[e+8>>2]=m;bb(e+8|0,e+12|0);if(c){break ba}}c=-1;f=a+1|0;f=(f>>>0)%3|0?f:a-2|0;if((f|0)>=0){g=(f>>>0)/3|0;f=H[(H[H[l>>2]+96>>2]+N(g,12)|0)+(f-N(g,3)<<2)>>2]}else{f=-1}H[e+12>>2]=f;H[e+8>>2]=m;bb(e+8|0,e+12|0);f=((a>>>0)%3|0?-1:2)+a|0;if((f|0)<0){break aa}c=(f>>>0)/3|0;c=H[(H[H[l>>2]+96>>2]+N(c,12)|0)+(f-N(c,3)<<2)>>2];break aa}c=(a|0)<0?-1:H[(H[H[l>>2]+96>>2]+N(f,12)|0)+((a>>>0)%3<<2)>>2];H[l+76>>2]=c;H[e+12>>2]=c;H[e+8>>2]=m;bb(e+8|0,e+12|0);if(d&1){c=-1;if((a|0)==-1){break Z}if((N(f,3)|0)!=(a|0)){a=a-1|0;break _}a=a+2|0;break $}c=-1;if((a|0)==-1){break Z}c=a+1|0;a=(c>>>0)%3|0?c:a-2|0;break $}c=-1;H[e+12>>2]=-1;H[e+8>>2]=m;bb(e+8|0,e+12|0)}H[l+76>>2]=c;H[e+12>>2]=c;H[e+8>>2]=m;bb(e+8|0,e+12|0)}c=-1;if((a|0)==-1){break Z}}c=H[H[H[l+4>>2]+12>>2]+(a<<2)>>2]}d=d+1|0;if((h|0)!=(d|0)){continue}break}}ca=e+16|0;c=H[u+96>>2];a=H[u+100>>2]}D=D+1|0;if(D>>>0<(a-c|0)/12>>>0){continue}break}}ca=r+16|0;da:{if(b){a=H[B>>2];if(a){H[B+4>>2]=a;oa(a)}H[B>>2]=H[m>>2];H[B+4>>2]=H[m+4>>2];H[B+8>>2]=H[m+8>>2];L=H[m+84>>2];break da}a=H[m>>2];if(!a){break da}H[m+4>>2]=a;oa(a)}a=H[m+72>>2];if(a){oa(a)}a=H[m+48>>2];if(a){H[m+52>>2]=a;oa(a)}a=H[m+36>>2];if(a){H[m+40>>2]=a;oa(a)}a=H[m+24>>2];if(a){H[m+28>>2]=a;oa(a)}a=H[m+20>>2];H[m+20>>2]=0;if(a){cb(a)}ca=m+96|0;return L|0}function qg(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=b;a=0;b=0;a:{b:{switch(d-1|0){case 0:j=H[i+80>>2];h=I[c+24|0];c:{if((N(j,h)|0)!=(e|0)){break c}d=H[c+28>>2]!=1;b=I[c+84|0];if(!(d|!b)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break c}if(h){a=pa(h);ra(a,0,h)}d:{if(!j){b=1;break d}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=H[H[c>>2]>>2];m=H[c+48>>2];g=H[c+40>>2];b=Rj(g,H[c+44>>2],I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;qa(i,qa(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break d}if(b){b=1;h=H[c>>2];e=H[c+48>>2];f=H[c+40>>2];i=H[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=H[h>>2];m=Rj(f,i,c,0)+e|0;k=qa(a,k+m|0,f);m=H[h>>2];n=Rj(f,i,c|1,0)+e|0;qa(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break d}c=H[h>>2];d=Rj(g,0,f,i)+e|0;qa(a,c+d|0,f);break d}b=1;h=H[c>>2];e=H[c+48>>2];g=H[c+68>>2];f=H[c+40>>2];i=H[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=H[h>>2];n=c<<2;l=Rj(f,i,H[n+g>>2],0)+e|0;m=qa(a,m+l|0,f);l=H[h>>2];n=Rj(f,i,H[g+(n|4)>>2],0)+e|0;qa(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break d}d=H[h>>2];c=Rj(f,i,H[g+(c<<2)>>2],0)+e|0;qa(a,c+d|0,f);break d}b=0;if(!h){d=0;while(1){if(!ic(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break d}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break d}d=0;e=0;while(1){if(!ic(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break d}qa(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break c}oa(a)}break a;case 2:n=I[c+24|0];l=n<<1;j=H[i+80>>2];e:{if((N(l,j)|0)!=(e|0)){break e}i=H[c+28>>2]!=3;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);a=1;break e}f:{if(!n){e=0;break f}e=pa(l);ra(e,0,l)}g:{if(!j){a=1;break g}if(!i){o=H[c+68>>2];k=H[c>>2];b=H[c+48>>2];i=H[c+40>>2];m=H[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=H[k>>2];p=Rj(i,m,H[o+(d<<2)>>2],0)+b|0;qa((c<<1)+f|0,qa(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break g}c=0;while(1){a=1;o=H[k>>2];p=Rj(g,h,i,m)+b|0;qa((c<<1)+f|0,qa(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break g}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[k>>2];g=c<<2;n=Rj(i,m,H[g+o>>2],0)+b|0;h=qa(e,h+n|0,i);n=H[k>>2];g=Rj(i,m,H[o+(g|4)>>2],0)+b|0;qa(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break g}d=H[k>>2];b=Rj(i,m,H[o+(c<<2)>>2],0)+b|0;qa(e,b+d|0,i);break g}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=H[k>>2];l=Rj(g,h,i,m)+b|0;d=qa(e,d+l|0,i);l=H[k>>2];o=Rj(i,m,g|1,h)+b|0;qa(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break g}c=H[k>>2];b=Rj(g,h,i,m)+b|0;qa(e,b+c|0,i);break g}if(!n){d=0;while(1){if(!gc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break g}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break g}d=0;while(1){if(!gc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break g}qa((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break e}oa(e)}b=a;break a;case 4:l=I[c+24|0];o=l<<2;j=H[i+80>>2];h:{if((N(o,j)|0)!=(e|0)){break h}i=H[c+28>>2]!=5;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break h}i:{if(!l){e=0;break i}e=pa(o);ra(e,0,o)}b=1;j:{if(!j){break j}if(!i){a=H[c+68>>2];m=H[c>>2];i=H[c+48>>2];k=H[c+40>>2];n=H[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=H[m>>2];p=Rj(k,n,H[a+(d<<2)>>2],0)+i|0;qa((c<<2)+f|0,qa(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break j}c=0;while(1){d=H[m>>2];p=Rj(g,h,k,n)+i|0;qa((c<<2)+f|0,qa(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break j}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[m>>2];g=c<<2;l=Rj(k,n,H[g+a>>2],0)+i|0;h=qa(e,h+l|0,k);l=H[m>>2];g=Rj(k,n,H[a+(g|4)>>2],0)+i|0;qa(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break j}d=H[m>>2];a=Rj(k,n,H[a+(c<<2)>>2],0)+i|0;qa(e,a+d|0,k);break j}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=H[m>>2];d=Rj(g,h,k,n)+i|0;a=qa(e,a+d|0,k);d=H[m>>2];o=Rj(k,n,g|1,h)+i|0;qa(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break j}a=H[m>>2];c=Rj(g,h,k,n)+i|0;qa(e,a+c|0,k);break j}b=0;if(!l){d=0;while(1){if(!ec(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break j}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break j}d=0;while(1){if(!ec(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break j}qa((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break h}oa(e)}break a;case 1:j=H[i+80>>2];h=I[c+24|0];k:{if((N(j,h)|0)!=(e|0)){break k}d=H[c+28>>2]!=2;b=I[c+84|0];if(!(d|!b)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break k}if(h){a=pa(h);ra(a,0,h)}l:{if(!j){b=1;break l}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=H[H[c>>2]>>2];m=H[c+48>>2];g=H[c+40>>2];b=Rj(g,H[c+44>>2],I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;qa(i,qa(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break l}if(b){b=1;h=H[c>>2];e=H[c+48>>2];f=H[c+40>>2];i=H[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=H[h>>2];m=Rj(f,i,c,0)+e|0;k=qa(a,k+m|0,f);m=H[h>>2];n=Rj(f,i,c|1,0)+e|0;qa(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break l}c=H[h>>2];d=Rj(g,0,f,i)+e|0;qa(a,c+d|0,f);break l}b=1;h=H[c>>2];e=H[c+48>>2];g=H[c+68>>2];f=H[c+40>>2];i=H[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=H[h>>2];n=c<<2;l=Rj(f,i,H[n+g>>2],0)+e|0;m=qa(a,m+l|0,f);l=H[h>>2];n=Rj(f,i,H[g+(n|4)>>2],0)+e|0;qa(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break l}d=H[h>>2];c=Rj(f,i,H[g+(c<<2)>>2],0)+e|0;qa(a,c+d|0,f);break l}b=0;if(!h){d=0;while(1){if(!hc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break l}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break l}d=0;e=0;while(1){if(!hc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break l}qa(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break k}oa(a)}break a;case 3:n=I[c+24|0];l=n<<1;j=H[i+80>>2];m:{if((N(l,j)|0)!=(e|0)){break m}i=H[c+28>>2]!=4;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);a=1;break m}n:{if(!n){e=0;break n}e=pa(l);ra(e,0,l)}o:{if(!j){a=1;break o}if(!i){o=H[c+68>>2];k=H[c>>2];b=H[c+48>>2];i=H[c+40>>2];m=H[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=H[k>>2];p=Rj(i,m,H[o+(d<<2)>>2],0)+b|0;qa((c<<1)+f|0,qa(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break o}c=0;while(1){a=1;o=H[k>>2];p=Rj(g,h,i,m)+b|0;qa((c<<1)+f|0,qa(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break o}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[k>>2];g=c<<2;n=Rj(i,m,H[g+o>>2],0)+b|0;h=qa(e,h+n|0,i);n=H[k>>2];g=Rj(i,m,H[o+(g|4)>>2],0)+b|0;qa(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break o}d=H[k>>2];b=Rj(i,m,H[o+(c<<2)>>2],0)+b|0;qa(e,b+d|0,i);break o}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=H[k>>2];l=Rj(g,h,i,m)+b|0;d=qa(e,d+l|0,i);l=H[k>>2];o=Rj(i,m,g|1,h)+b|0;qa(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break o}c=H[k>>2];b=Rj(g,h,i,m)+b|0;qa(e,b+c|0,i);break o}if(!n){d=0;while(1){if(!fc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break o}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break o}d=0;while(1){if(!fc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break o}qa((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break m}oa(e)}b=a;break a;case 5:l=I[c+24|0];o=l<<2;j=H[i+80>>2];p:{if((N(o,j)|0)!=(e|0)){break p}i=H[c+28>>2]!=6;d=I[c+84|0];if(!(i|!d)){qa(f,H[H[c>>2]>>2]+H[c+48>>2]|0,e);b=1;break p}q:{if(!l){e=0;break q}e=pa(o);ra(e,0,o)}b=1;r:{if(!j){break r}if(!i){a=H[c+68>>2];m=H[c>>2];i=H[c+48>>2];k=H[c+40>>2];n=H[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=H[m>>2];p=Rj(k,n,H[a+(d<<2)>>2],0)+i|0;qa((c<<2)+f|0,qa(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break r}c=0;while(1){d=H[m>>2];p=Rj(g,h,k,n)+i|0;qa((c<<2)+f|0,qa(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break r}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=H[m>>2];g=c<<2;l=Rj(k,n,H[g+a>>2],0)+i|0;h=qa(e,h+l|0,k);l=H[m>>2];g=Rj(k,n,H[a+(g|4)>>2],0)+i|0;qa(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break r}d=H[m>>2];a=Rj(k,n,H[a+(c<<2)>>2],0)+i|0;qa(e,a+d|0,k);break r}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=H[m>>2];d=Rj(g,h,k,n)+i|0;a=qa(e,a+d|0,k);d=H[m>>2];o=Rj(k,n,g|1,h)+i|0;qa(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break r}a=H[m>>2];c=Rj(g,h,k,n)+i|0;qa(e,a+c|0,k);break r}b=0;if(!l){d=0;while(1){if(!dc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break r}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break r}d=0;while(1){if(!dc(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],e)){break r}qa((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break p}oa(e)}break a;case 8:p=I[c+24|0];q=p<<2;k=H[i+80>>2];s:{if((N(q,k)|0)!=(e|0)){break s}i=H[c+28>>2];t:{if(!p){break t}a=pa(q);d=a;m=q-4|0;l=(m>>>2|0)+1&7;if(l){e=0;while(1){H[d>>2]=-1073741824;d=d+4|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}if(m>>>0<28){break t}e=(p<<2)+a|0;while(1){H[d+24>>2]=-1073741824;H[d+28>>2]=-1073741824;H[d+16>>2]=-1073741824;H[d+20>>2]=-1073741824;H[d+8>>2]=-1073741824;H[d+12>>2]=-1073741824;H[d>>2]=-1073741824;H[d+4>>2]=-1073741824;d=d+32|0;if((e|0)!=(d|0)){continue}break}}u:{if(!k){b=1;break u}if((i|0)==9){r=H[c+68>>2];l=H[c>>2];i=H[c+48>>2];s=I[c+84|0];m=H[c+44>>2];c=H[c+40>>2];o=c;if(p){e=0;d=0;while(1){h=(e<<2)+f|0;g=H[l>>2];b=Rj(c,m,s?d:H[r+(d<<2)>>2],0)+i|0;qa(h,qa(a,b+g|0,o),q);e=e+p|0;b=1;d=d+1|0;if((k|0)!=(d|0)){continue}break}break u}if(!s){b=1;d=0;if((k|0)!=1){f=k&-2;e=0;while(1){h=H[l>>2];g=d<<2;j=Rj(c,m,H[g+r>>2],0)+i|0;h=qa(a,h+j|0,o);j=H[l>>2];g=Rj(c,m,H[r+(g|4)>>2],0)+i|0;qa(h,j+g|0,o);d=d+2|0;e=e+2|0;if((f|0)!=(e|0)){continue}break}}if(!(k&1)){break u}e=H[l>>2];c=Rj(c,m,H[r+(d<<2)>>2],0)+i|0;qa(a,c+e|0,o);break u}f=k&1;b=1;if((k|0)!=1){k=k&-2;while(1){d=H[l>>2];e=Rj(g,h,c,m)+i|0;d=qa(a,d+e|0,o);e=H[l>>2];p=Rj(c,m,g|1,h)+i|0;qa(d,e+p|0,o);g=g+2|0;h=g>>>0<2?h+1|0:h;d=j;e=n+2|0;d=e>>>0<2?d+1|0:d;n=e;j=d;if((e|0)!=(k|0)|d){continue}break}}if(!f){break u}d=H[l>>2];c=Rj(g,h,c,m)+i|0;qa(a,c+d|0,o);break u}if(!p){d=0;while(1){if(!Va(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break u}d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}break u}e=0;d=0;while(1){if(!Va(c,I[c+84|0]?d:H[H[c+68>>2]+(d<<2)>>2],F[c+24|0],a)){break u}qa((e<<2)+f|0,a,q);e=e+p|0;d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}}if(!a){break s}oa(a)}a=b;break;default:break b}}b=a}return b|0}function ef(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;i=ca-48|0;ca=i;a:{b:{if((c|0)!=1){break b}c=H[a+4>>2];g=H[a+12>>2];H[i+40>>2]=0;a=i;H[a+32>>2]=0;H[a+36>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;e=a+8|0;c:{if((b|0)==-2){break c}l=H[H[H[c+4>>2]+8>>2]+(g<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){a=J[c+36>>1];j=(a<<8|a>>>8)&65535;a=0;h=ca-32|0;ca=h;d=H[H[H[c+4>>2]+8>>2]+(g<<2)>>2];d:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break d}k=ea[H[H[c>>2]+36>>2]](c)|0;f=ea[H[H[c>>2]+44>>2]](c,g)|0;if(!k|!f){break d}a=ea[H[H[c>>2]+40>>2]](c,g)|0;if(a){c=H[c+44>>2];H[h+12>>2]=a;H[h+8>>2]=c;H[h+20>>2]=f;H[h+16>>2]=f+12;c=h+8|0;a=0;e:{f:{switch(b-1|0){case 0:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=2564;break e;case 1:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=3328;break e;case 3:a=pa(112);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=3564;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;break e;case 2:a=pa(92);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=3812;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=j;break e;case 4:a=pa(104);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=4040;b=H[c+4>>2];H[a+88>>2]=H[c>>2];H[a+92>>2]=b;b=H[c+12>>2];H[a+96>>2]=H[c+8>>2];H[a+100>>2]=b;break e;case 5:break f;default:break e}}a=pa(128);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;g:{b=H[e+28>>2];d=H[e+24>>2];if((b|0)!=(d|0)){d=b-d|0;if((d|0)<0){break a}b=pa(d);H[a+36>>2]=b;H[a+32>>2]=b;H[a+40>>2]=(d&-4)+b;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}}H[a+36>>2]=b}H[a>>2]=3216;b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+60>>2]=4904;H[a>>2]=4276;b=H[c+4>>2];H[a+72>>2]=H[c>>2];H[a+76>>2]=b;b=H[c+12>>2];H[a+80>>2]=H[c+8>>2];H[a+84>>2]=b;H[a+104>>2]=1065353216;H[a+108>>2]=-1;H[a+96>>2]=-1;H[a+100>>2]=-1;H[a+88>>2]=1;H[a+92>>2]=-1;H[a+60>>2]=4512;H[a+112>>2]=0;H[a+116>>2]=0;F[a+117|0]=0;F[a+118|0]=0;F[a+119|0]=0;F[a+120|0]=0;F[a+121|0]=0;F[a+122|0]=0;F[a+123|0]=0;F[a+124|0]=0;break g}}break d}a=H[c+44>>2];H[h+12>>2]=k;H[h+8>>2]=a;H[h+20>>2]=f;H[h+16>>2]=f+12;c=h+8|0;a=0;h:{i:{switch(b-1|0){case 0:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=4932;break h;case 1:a=pa(60);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a>>2]=5356;break h;case 3:a=pa(112);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=5580;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;break h;case 2:a=pa(92);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=5816;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=j;break h;case 4:a=pa(104);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){g=f-d|0;if((g|0)<0){break a}b=pa(g);H[a+32>>2]=b;H[a+40>>2]=(g&-4)+b;while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}H[a+36>>2]=b}b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a>>2]=6032;b=H[c+4>>2];H[a+88>>2]=H[c>>2];H[a+92>>2]=b;b=H[c+12>>2];H[a+96>>2]=H[c+8>>2];H[a+100>>2]=b;break h;case 5:break i;default:break h}}a=pa(128);H[a+4>>2]=d;H[a>>2]=3272;b=H[e+4>>2];H[a+8>>2]=H[e>>2];H[a+12>>2]=b;b=H[e+12>>2];H[a+16>>2]=H[e+8>>2];H[a+20>>2]=b;b=H[e+20>>2];H[a+24>>2]=H[e+16>>2];H[a+28>>2]=b;H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;j:{b=H[e+28>>2];d=H[e+24>>2];if((b|0)!=(d|0)){d=b-d|0;if((d|0)<0){break a}b=pa(d);H[a+36>>2]=b;H[a+32>>2]=b;H[a+40>>2]=(d&-4)+b;d=H[e+24>>2];f=H[e+28>>2];if((d|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((f|0)!=(d|0)){continue}break}}H[a+36>>2]=b}H[a>>2]=5300;b=H[c+4>>2];H[a+44>>2]=H[c>>2];H[a+48>>2]=b;b=H[c+12>>2];H[a+52>>2]=H[c+8>>2];H[a+56>>2]=b;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+60>>2]=6840;H[a>>2]=6256;b=H[c+4>>2];H[a+72>>2]=H[c>>2];H[a+76>>2]=b;b=H[c+12>>2];H[a+80>>2]=H[c+8>>2];H[a+84>>2]=b;H[a+104>>2]=1065353216;H[a+108>>2]=-1;H[a+96>>2]=-1;H[a+100>>2]=-1;H[a+88>>2]=1;H[a+92>>2]=-1;H[a+60>>2]=6476;H[a+112>>2]=0;H[a+116>>2]=0;F[a+117|0]=0;F[a+118|0]=0;F[a+119|0]=0;F[a+120|0]=0;F[a+121|0]=0;F[a+122|0]=0;F[a+123|0]=0;F[a+124|0]=0;break j}}}ca=h+32|0;d=a;if(a){break c}}d=pa(44);H[d+4>>2]=l;H[d>>2]=3272;a=H[e+4>>2];H[d+8>>2]=H[e>>2];H[d+12>>2]=a;a=H[e+12>>2];H[d+16>>2]=H[e+8>>2];H[d+20>>2]=a;a=H[e+20>>2];H[d+24>>2]=H[e+16>>2];H[d+28>>2]=a;H[d+40>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;c=H[e+24>>2];a=H[e+28>>2];if((c|0)!=(a|0)){b=a-c|0;if((b|0)<0){break a}e=pa(b);H[d+32>>2]=e;H[d+40>>2]=(b&-4)+e;while(1){H[e>>2]=H[c>>2];e=e+4|0;c=c+4|0;if((a|0)!=(c|0)){continue}break}H[d+36>>2]=e}H[d>>2]=6868;break c}e=d;a=H[i+32>>2];if(!a){break b}H[i+36>>2]=a;oa(a)}ca=i+48|0;return e|0}sa();v()}function Ec(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=ca-16|0;ca=l;a:{b:{c:{d:{e:{f:{g:{h:{i:{if(a>>>0<=244){g=H[4298];h=a>>>0<11?16:a+11&-8;c=h>>>3|0;b=g>>>c|0;if(b&3){c=c+((b^-1)&1)|0;a=c<<3;b=a+17232|0;d=H[a+17240>>2];a=H[d+8>>2];j:{if((b|0)==(a|0)){m=17192,n=Vj(c)&g,H[m>>2]=n;break j}H[a+12>>2]=b;H[b+8>>2]=a}a=d+8|0;b=c<<3;H[d+4>>2]=b|3;b=b+d|0;H[b+4>>2]=H[b+4>>2]|1;break a}k=H[4300];if(k>>>0>=h>>>0){break i}if(b){a=2<>2];a=H[e+8>>2];k:{if((b|0)==(a|0)){g=Vj(d)&g;H[4298]=g;break k}H[a+12>>2]=b;H[b+8>>2]=a}H[e+4>>2]=h|3;c=e+h|0;a=d<<3;d=a-h|0;H[c+4>>2]=d|1;H[a+e>>2]=d;if(k){b=(k&-8)+17232|0;f=H[4303];a=1<<(k>>>3);l:{if(!(a&g)){H[4298]=a|g;a=b;break l}a=H[b+8>>2]}H[b+8>>2]=f;H[a+12>>2]=f;H[f+12>>2]=b;H[f+8>>2]=a}a=e+8|0;H[4303]=c;H[4300]=d;break a}j=H[4299];if(!j){break i}c=H[(Qj(0-j&j)<<2)+17496>>2];f=(H[c+4>>2]&-8)-h|0;b=c;while(1){m:{a=H[b+16>>2];if(!a){a=H[b+20>>2];if(!a){break m}}b=(H[a+4>>2]&-8)-h|0;d=b>>>0>>0;f=d?b:f;c=d?a:c;b=a;continue}break}i=H[c+24>>2];d=H[c+12>>2];if((d|0)!=(c|0)){a=H[c+8>>2];H[a+12>>2]=d;H[d+8>>2]=a;break b}b=c+20|0;a=H[b>>2];if(!a){a=H[c+16>>2];if(!a){break h}b=c+16|0}while(1){e=b;d=a;b=a+20|0;a=H[b>>2];if(a){continue}b=d+16|0;a=H[d+16>>2];if(a){continue}break}H[e>>2]=0;break b}h=-1;if(a>>>0>4294967231){break i}a=a+11|0;h=a&-8;j=H[4299];if(!j){break i}f=0-h|0;g=0;n:{if(h>>>0<256){break n}g=31;if(h>>>0>16777215){break n}a=Q(a>>>8|0);g=((h>>>38-a&1)-(a<<1)|0)+62|0}b=H[(g<<2)+17496>>2];o:{p:{q:{if(!b){a=0;break q}a=0;c=h<<((g|0)!=31?25-(g>>>1|0)|0:0);while(1){r:{e=(H[b+4>>2]&-8)-h|0;if(e>>>0>=f>>>0){break r}d=b;f=e;if(e){break r}f=0;a=b;break p}e=H[b+20>>2];b=H[((c>>>29&4)+b|0)+16>>2];a=e?(e|0)==(b|0)?a:e:a;c=c<<1;if(b){continue}break}}if(!(a|d)){d=0;a=2<>2]}if(!a){break o}}while(1){b=(H[a+4>>2]&-8)-h|0;c=b>>>0>>0;f=c?b:f;d=c?a:d;b=H[a+16>>2];if(b){a=b}else{a=H[a+20>>2]}if(a){continue}break}}if(!d|H[4300]-h>>>0<=f>>>0){break i}g=H[d+24>>2];c=H[d+12>>2];if((d|0)!=(c|0)){a=H[d+8>>2];H[a+12>>2]=c;H[c+8>>2]=a;break c}b=d+20|0;a=H[b>>2];if(!a){a=H[d+16>>2];if(!a){break g}b=d+16|0}while(1){e=b;c=a;b=a+20|0;a=H[b>>2];if(a){continue}b=c+16|0;a=H[c+16>>2];if(a){continue}break}H[e>>2]=0;break c}a=H[4300];if(a>>>0>=h>>>0){d=H[4303];b=a-h|0;s:{if(b>>>0>=16){c=d+h|0;H[c+4>>2]=b|1;H[a+d>>2]=b;H[d+4>>2]=h|3;break s}H[d+4>>2]=a|3;a=a+d|0;H[a+4>>2]=H[a+4>>2]|1;c=0;b=0}H[4300]=b;H[4303]=c;a=d+8|0;break a}i=H[4301];if(i>>>0>h>>>0){b=i-h|0;H[4301]=b;c=H[4304];a=c+h|0;H[4304]=a;H[a+4>>2]=b|1;H[c+4>>2]=h|3;a=c+8|0;break a}a=0;j=h+47|0;if(H[4416]){c=H[4418]}else{H[4419]=-1;H[4420]=-1;H[4417]=4096;H[4418]=4096;H[4416]=l+12&-16^1431655768;H[4421]=0;H[4409]=0;c=4096}e=j+c|0;f=0-c|0;b=e&f;if(b>>>0<=h>>>0){break a}d=H[4408];if(d){c=H[4406];g=c+b|0;if(d>>>0>>0|c>>>0>=g>>>0){break a}}t:{if(!(I[17636]&4)){u:{v:{w:{x:{d=H[4304];if(d){a=17640;while(1){c=H[a>>2];if(c>>>0<=d>>>0&d>>>0>2]>>>0){break x}a=H[a+8>>2];if(a){continue}break}}c=zb(0);if((c|0)==-1){break u}g=b;d=H[4417];a=d-1|0;if(a&c){g=(b-c|0)+(a+c&0-d)|0}if(g>>>0<=h>>>0){break u}d=H[4408];if(d){a=H[4406];f=a+g|0;if(d>>>0>>0|a>>>0>=f>>>0){break u}}a=zb(g);if((c|0)!=(a|0)){break w}break t}g=f&e-i;c=zb(g);if((c|0)==(H[a>>2]+H[a+4>>2]|0)){break v}a=c}if((a|0)==-1){break u}if(h+48>>>0<=g>>>0){c=a;break t}c=H[4418];c=c+(j-g|0)&0-c;if((zb(c)|0)==-1){break u}g=c+g|0;c=a;break t}if((c|0)!=-1){break t}}H[4409]=H[4409]|4}c=zb(b);a=zb(0);if((c|0)==-1|(a|0)==-1|a>>>0<=c>>>0){break d}g=a-c|0;if(g>>>0<=h+40>>>0){break d}}a=H[4406]+g|0;H[4406]=a;if(a>>>0>K[4407]){H[4407]=a}y:{e=H[4304];if(e){a=17640;while(1){d=H[a>>2];b=H[a+4>>2];if((d+b|0)==(c|0)){break y}a=H[a+8>>2];if(a){continue}break}break f}a=H[4302];if(!(a>>>0<=c>>>0?a:0)){H[4302]=c}a=0;H[4411]=g;H[4410]=c;H[4306]=-1;H[4307]=H[4416];H[4413]=0;while(1){d=a<<3;b=d+17232|0;H[d+17240>>2]=b;H[d+17244>>2]=b;a=a+1|0;if((a|0)!=32){continue}break}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;H[4301]=b;a=a+c|0;H[4304]=a;H[a+4>>2]=b|1;H[(c+d|0)+4>>2]=40;H[4305]=H[4420];break e}if(I[a+12|0]&8|d>>>0>e>>>0|c>>>0<=e>>>0){break f}H[a+4>>2]=b+g;a=e+8&7?-8-e&7:0;c=a+e|0;H[4304]=c;b=H[4301]+g|0;a=b-a|0;H[4301]=a;H[c+4>>2]=a|1;H[(b+e|0)+4>>2]=40;H[4305]=H[4420];break e}d=0;break b}c=0;break c}if(K[4302]>c>>>0){H[4302]=c}b=c+g|0;a=17640;z:{A:{B:{C:{D:{E:{while(1){if((b|0)!=H[a>>2]){a=H[a+8>>2];if(a){continue}break E}break}if(!(I[a+12|0]&8)){break D}}a=17640;while(1){b=H[a>>2];if(b>>>0<=e>>>0){f=b+H[a+4>>2]|0;if(f>>>0>e>>>0){break C}}a=H[a+8>>2];continue}}H[a>>2]=c;H[a+4>>2]=H[a+4>>2]+g;j=(c+8&7?-8-c&7:0)+c|0;H[j+4>>2]=h|3;g=b+(b+8&7?-8-b&7:0)|0;i=h+j|0;a=g-i|0;if((e|0)==(g|0)){H[4304]=i;a=H[4301]+a|0;H[4301]=a;H[i+4>>2]=a|1;break A}if(H[4303]==(g|0)){H[4303]=i;a=H[4300]+a|0;H[4300]=a;H[i+4>>2]=a|1;H[a+i>>2]=a;break A}f=H[g+4>>2];if((f&3)==1){e=f&-8;F:{if(f>>>0<=255){d=H[g+8>>2];b=f>>>3|0;c=H[g+12>>2];if((c|0)==(d|0)){m=17192,n=H[4298]&Vj(b),H[m>>2]=n;break F}H[d+12>>2]=c;H[c+8>>2]=d;break F}h=H[g+24>>2];c=H[g+12>>2];G:{if((g|0)!=(c|0)){b=H[g+8>>2];H[b+12>>2]=c;H[c+8>>2]=b;break G}H:{f=g+20|0;b=H[f>>2];if(b){break H}f=g+16|0;b=H[f>>2];if(b){break H}c=0;break G}while(1){d=f;c=b;f=c+20|0;b=H[f>>2];if(b){continue}f=c+16|0;b=H[c+16>>2];if(b){continue}break}H[d>>2]=0}if(!h){break F}d=H[g+28>>2];b=(d<<2)+17496|0;I:{if(H[b>>2]==(g|0)){H[b>>2]=c;if(c){break I}m=17196,n=H[4299]&Vj(d),H[m>>2]=n;break F}H[h+(H[h+16>>2]==(g|0)?16:20)>>2]=c;if(!c){break F}}H[c+24>>2]=h;b=H[g+16>>2];if(b){H[c+16>>2]=b;H[b+24>>2]=c}b=H[g+20>>2];if(!b){break F}H[c+20>>2]=b;H[b+24>>2]=c}g=e+g|0;f=H[g+4>>2];a=a+e|0}H[g+4>>2]=f&-2;H[i+4>>2]=a|1;H[a+i>>2]=a;if(a>>>0<=255){b=(a&-8)+17232|0;c=H[4298];a=1<<(a>>>3);J:{if(!(c&a)){H[4298]=a|c;a=b;break J}a=H[b+8>>2]}H[b+8>>2]=i;H[a+12>>2]=i;H[i+12>>2]=b;H[i+8>>2]=a;break A}f=31;if(a>>>0<=16777215){b=Q(a>>>8|0);f=((a>>>38-b&1)-(b<<1)|0)+62|0}H[i+28>>2]=f;H[i+16>>2]=0;H[i+20>>2]=0;b=(f<<2)+17496|0;d=H[4299];c=1<>2]=i;break K}f=a<<((f|0)!=31?25-(f>>>1|0)|0:0);c=H[b>>2];while(1){b=c;if((H[c+4>>2]&-8)==(a|0)){break B}c=f>>>29|0;f=f<<1;d=(c&4)+b|0;c=H[d+16>>2];if(c){continue}break}H[d+16>>2]=i}H[i+24>>2]=b;H[i+12>>2]=i;H[i+8>>2]=i;break A}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;H[4301]=b;a=a+c|0;H[4304]=a;H[a+4>>2]=b|1;H[(c+d|0)+4>>2]=40;H[4305]=H[4420];a=(f+(f-39&7?39-f&7:0)|0)-47|0;d=a>>>0>>0?e:a;H[d+4>>2]=27;a=H[4413];H[d+16>>2]=H[4412];H[d+20>>2]=a;a=H[4411];H[d+8>>2]=H[4410];H[d+12>>2]=a;H[4412]=d+8;H[4411]=g;H[4410]=c;H[4413]=0;a=d+24|0;while(1){H[a+4>>2]=7;b=a+8|0;a=a+4|0;if(b>>>0>>0){continue}break}if((d|0)==(e|0)){break e}H[d+4>>2]=H[d+4>>2]&-2;f=d-e|0;H[e+4>>2]=f|1;H[d>>2]=f;if(f>>>0<=255){b=(f&-8)+17232|0;c=H[4298];a=1<<(f>>>3);L:{if(!(c&a)){H[4298]=a|c;a=b;break L}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a;break e}a=31;if(f>>>0<=16777215){a=Q(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}H[e+28>>2]=a;H[e+16>>2]=0;H[e+20>>2]=0;b=(a<<2)+17496|0;d=H[4299];c=1<>2]=e;break M}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);d=H[b>>2];while(1){b=d;if((f|0)==(H[b+4>>2]&-8)){break z}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;d=H[c+16>>2];if(d){continue}break}H[c+16>>2]=e}H[e+24>>2]=b;H[e+12>>2]=e;H[e+8>>2]=e;break e}a=H[b+8>>2];H[a+12>>2]=i;H[b+8>>2]=i;H[i+24>>2]=0;H[i+12>>2]=b;H[i+8>>2]=a}a=j+8|0;break a}a=H[b+8>>2];H[a+12>>2]=e;H[b+8>>2]=e;H[e+24>>2]=0;H[e+12>>2]=b;H[e+8>>2]=a}a=H[4301];if(a>>>0<=h>>>0){break d}b=a-h|0;H[4301]=b;c=H[4304];a=c+h|0;H[4304]=a;H[a+4>>2]=b|1;H[c+4>>2]=h|3;a=c+8|0;break a}H[3992]=48;a=0;break a}N:{if(!g){break N}b=H[d+28>>2];a=(b<<2)+17496|0;O:{if(H[a>>2]==(d|0)){H[a>>2]=c;if(c){break O}j=Vj(b)&j;H[4299]=j;break N}H[g+(H[g+16>>2]==(d|0)?16:20)>>2]=c;if(!c){break N}}H[c+24>>2]=g;a=H[d+16>>2];if(a){H[c+16>>2]=a;H[a+24>>2]=c}a=H[d+20>>2];if(!a){break N}H[c+20>>2]=a;H[a+24>>2]=c}P:{if(f>>>0<=15){a=f+h|0;H[d+4>>2]=a|3;a=a+d|0;H[a+4>>2]=H[a+4>>2]|1;break P}H[d+4>>2]=h|3;e=d+h|0;H[e+4>>2]=f|1;H[e+f>>2]=f;if(f>>>0<=255){b=(f&-8)+17232|0;c=H[4298];a=1<<(f>>>3);Q:{if(!(c&a)){H[4298]=a|c;a=b;break Q}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a;break P}a=31;if(f>>>0<=16777215){a=Q(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}H[e+28>>2]=a;H[e+16>>2]=0;H[e+20>>2]=0;b=(a<<2)+17496|0;R:{c=1<>2]=e;break S}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);h=H[b>>2];while(1){b=h;if((H[b+4>>2]&-8)==(f|0)){break R}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;h=H[c+16>>2];if(h){continue}break}H[c+16>>2]=e}H[e+24>>2]=b;H[e+12>>2]=e;H[e+8>>2]=e;break P}a=H[b+8>>2];H[a+12>>2]=e;H[b+8>>2]=e;H[e+24>>2]=0;H[e+12>>2]=b;H[e+8>>2]=a}a=d+8|0;break a}T:{if(!i){break T}b=H[c+28>>2];a=(b<<2)+17496|0;U:{if(H[a>>2]==(c|0)){H[a>>2]=d;if(d){break U}m=17196,n=Vj(b)&j,H[m>>2]=n;break T}H[i+(H[i+16>>2]==(c|0)?16:20)>>2]=d;if(!d){break T}}H[d+24>>2]=i;a=H[c+16>>2];if(a){H[d+16>>2]=a;H[a+24>>2]=d}a=H[c+20>>2];if(!a){break T}H[d+20>>2]=a;H[a+24>>2]=d}V:{if(f>>>0<=15){a=f+h|0;H[c+4>>2]=a|3;a=a+c|0;H[a+4>>2]=H[a+4>>2]|1;break V}H[c+4>>2]=h|3;d=c+h|0;H[d+4>>2]=f|1;H[d+f>>2]=f;if(k){b=(k&-8)+17232|0;e=H[4303];a=1<<(k>>>3);W:{if(!(a&g)){H[4298]=a|g;a=b;break W}a=H[b+8>>2]}H[b+8>>2]=e;H[a+12>>2]=e;H[e+12>>2]=b;H[e+8>>2]=a}H[4303]=d;H[4300]=f}a=c+8|0}ca=l+16|0;return a|0}function ce(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=ca-32|0;ca=m;o=pa(12);H[o+8>>2]=0;H[o+4>>2]=b;H[o>>2]=0;s=o+12|0;b=s;a:{b:{c:{while(1){b=b-12|0;w=H[b+8>>2];j=H[b+4>>2];t=H[b>>2];if(t){if((w|0)>1e3){break a}H[m+24>>2]=0;H[m+16>>2]=0;H[m+20>>2]=0;d=1;c=H[a>>2];e=H[c+8>>2];h=H[c+12>>2];g=H[c+20>>2];f=H[c+16>>2];d:{if((h|0)<=(g|0)&f>>>0>=e>>>0|(g|0)>(h|0)){break d}e=I[f+H[c>>2]|0];h=c;c=g;f=f+1|0;c=f?c:c+1|0;H[h+16>>2]=f;H[h+20>>2]=c;Cc(m+16|0,e);if(e){c=H[a>>2];n=Dc(m+16|0);p=H[c+8>>2];g=H[c+12>>2];h=H[c+20>>2];f=H[c+16>>2];k=f+e|0;h=k>>>0>>0?h+1|0:h;if((g|0)<=(h|0)&k>>>0>p>>>0|(g|0)<(h|0)){break d}qa(n,f+H[c>>2]|0,e);d=H[c+20>>2];f=e;e=e+H[c+16>>2]|0;d=f>>>0>e>>>0?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d}j=pa(24);c=j;H[c+4>>2]=0;H[c+8>>2]=0;c=c+16|0;H[c>>2]=0;H[c+4>>2]=0;H[j>>2]=j+4;H[j+12>>2]=c;e=ca-32|0;ca=e;h=t+12|0;c=m+16|0;u=nb(h,c);i=t+16|0;e:{if((u|0)==(i|0)){H[e+16>>2]=c;f:{g:{d=H[h+4>>2];h:{if(!d){f=h+4|0;c=f;break h}f=I[c+11|0];g=f<<24>>24<0;n=g?H[c>>2]:c;g=g?H[c+4>>2]:f;while(1){c=d;d=I[c+27|0];f=d<<24>>24<0;d=f?H[c+20>>2]:d;p=d>>>0>>0;i:{j:{k:{l:{k=p?d:g;m:{if(k){f=f?H[c+16>>2]:c+16|0;q=Fa(n,f,k);if(!q){if(d>>>0>g>>>0){break m}break l}if((q|0)>=0){break l}break m}if(d>>>0<=g>>>0){break k}}f=c;d=H[c>>2];if(d){continue}break h}d=Fa(f,n,k);if(d){break j}}if(p){break i}break g}if((d|0)>=0){break g}}d=H[c+4>>2];if(d){continue}break}f=c+4|0}d=pa(32);n=d+16|0;g=H[e+16>>2];n:{if(F[g+11|0]>=0){p=H[g+4>>2];H[n>>2]=H[g>>2];H[n+4>>2]=p;H[n+8>>2]=H[g+8>>2];break n}za(n,H[g>>2],H[g+4>>2])}H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[d+28>>2]=0;H[f>>2]=d;c=d;g=H[H[h>>2]>>2];if(g){H[h>>2]=g;c=H[f>>2]}Sb(H[h+4>>2],c);H[h+8>>2]=H[h+8>>2]+1;c=1;break f}d=c;c=0}F[e+28|0]=c;H[e+24>>2]=d;d=H[e+24>>2];c=H[d+28>>2];H[d+28>>2]=j;if(!c){break e}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c);break e}if(!j){break e}Ra(j+12|0,H[j+16>>2]);Qa(j,H[j+4>>2]);oa(j)}ca=e+32|0;d=(i|0)!=(u|0)}if(F[m+27|0]<0){oa(H[m+16>>2])}if(d){break a}}if(!j){break a}H[m+16>>2]=0;if(!Bb(1,m+16|0,H[a>>2])){break a}q=0;x=H[m+16>>2];if(x){while(1){d=0;i=ca-32|0;ca=i;H[i+24>>2]=0;H[i+16>>2]=0;H[i+20>>2]=0;c=H[a>>2];f=H[c+8>>2];o:{p:{h=H[c+12>>2];g=H[c+20>>2];e=H[c+16>>2];q:{if((h|0)<=(g|0)&e>>>0>=f>>>0|(g|0)>(h|0)){break q}f=I[e+H[c>>2]|0];h=c;c=g;e=e+1|0;c=e?c:c+1|0;H[h+16>>2]=e;H[h+20>>2]=c;Cc(i+16|0,f);if(f){e=H[a>>2];n=Dc(i+16|0);p=H[e+8>>2];g=H[e+12>>2];c=H[e+20>>2];h=H[e+16>>2];k=h+f|0;c=k>>>0>>0?c+1|0:c;if(k>>>0>p>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break q}qa(n,h+H[e>>2]|0,f);c=H[e+20>>2];g=f;f=f+H[e+16>>2]|0;c=g>>>0>f>>>0?c+1|0:c;H[e+16>>2]=f;H[e+20>>2]=c}H[i+12>>2]=0;if(!Bb(1,i+12|0,H[a>>2])){break q}f=H[i+12>>2];if(!f){break q}e=H[a>>2];c=H[e+8>>2];h=H[e+16>>2];g=c-h|0;c=H[e+12>>2]-(H[e+20>>2]+(c>>>0>>0)|0)|0;if((c|0)<=0&f>>>0>g>>>0|(c|0)<0){break q}H[i+8>>2]=0;H[i>>2]=0;H[i+4>>2]=0;if((f|0)<0){break p}d=pa(f);H[i>>2]=d;c=d+f|0;H[i+8>>2]=c;l=ra(d,0,f);H[i+4>>2]=c;h=H[e+12>>2];y=h;p=H[e+8>>2];c=H[e+20>>2];k=H[e+16>>2];g=f+k|0;c=g>>>0>>0?c+1|0:c;u=g;n=c;r:{if((c|0)<=(h|0)&g>>>0<=p>>>0|(c|0)<(h|0)){qa(l,H[e>>2]+k|0,f);d=H[e+20>>2];c=f+H[e+16>>2]|0;d=c>>>0>>0?d+1|0:d;H[e+16>>2]=c;H[e+20>>2]=d;h=ca-48|0;ca=h;e=nb(j,i+16|0);if((e|0)!=(j+4|0)){c=H[e+4>>2];s:{if(!c){c=e;while(1){d=H[c+8>>2];f=H[d>>2]!=(c|0);c=d;if(f){continue}break}break s}while(1){d=c;c=H[c>>2];if(c){continue}break}}if((e|0)==H[j>>2]){H[j>>2]=d}H[j+8>>2]=H[j+8>>2]-1;f=H[j+4>>2];t:{u:{g=e;d=e;e=H[d>>2];if(e){c=H[g+4>>2];if(!c){break u}while(1){d=c;c=H[c>>2];if(c){continue}break}}e=H[d+4>>2];if(e){break u}e=0;k=1;break t}H[e+8>>2]=H[d+8>>2];k=0}l=H[d+8>>2];c=H[l>>2];v:{if((d|0)==(c|0)){H[l>>2]=e;if((d|0)==(f|0)){c=0;f=e;break v}c=H[l+4>>2];break v}H[l+4>>2]=e}r=!I[d+12|0];if((d|0)!=(g|0)){l=H[g+8>>2];H[d+8>>2]=l;H[l+(((g|0)!=H[H[g+8>>2]>>2])<<2)>>2]=d;l=H[g>>2];H[d>>2]=l;H[l+8>>2]=d;l=H[g+4>>2];H[d+4>>2]=l;if(l){H[l+8>>2]=d}F[d+12|0]=I[g+12|0];f=(f|0)==(g|0)?d:f}w:{if(r|!f){break w}if(k){while(1){e=I[c+12|0];x:{d=H[c+8>>2];if(H[d>>2]!=(c|0)){if(!e){F[c+12|0]=1;F[d+12|0]=0;e=H[d+4>>2];k=H[e>>2];H[d+4>>2]=k;if(k){H[k+8>>2]=d}H[e+8>>2]=H[d+8>>2];k=H[d+8>>2];H[(((d|0)!=H[k>>2])<<2)+k>>2]=e;H[e>>2]=d;H[d+8>>2]=e;d=c;c=H[c>>2];f=(c|0)==(f|0)?d:f;c=H[c+4>>2]}y:{z:{d=H[c>>2];A:{if(!(I[d+12|0]?0:d)){e=H[c+4>>2];if(I[e+12|0]?0:e){break A}F[c+12|0]=0;c=H[c+8>>2];B:{if((f|0)==(c|0)){c=f;break B}if(I[c+12|0]){break x}}F[c+12|0]=1;break w}e=H[c+4>>2];if(!e){break z}}if(I[e+12|0]){break z}d=c;break y}F[d+12|0]=1;F[c+12|0]=0;e=H[d+4>>2];H[c>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[((H[e>>2]!=(c|0))<<2)+e>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;e=c}c=H[d+8>>2];F[d+12|0]=I[c+12|0];F[c+12|0]=1;F[e+12|0]=1;d=H[c+4>>2];e=H[d>>2];H[c+4>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[(((c|0)!=H[e>>2])<<2)+e>>2]=d;H[d>>2]=c;H[c+8>>2]=d;break w}if(!e){F[c+12|0]=1;F[d+12|0]=0;e=H[c+4>>2];H[d>>2]=e;if(e){H[e+8>>2]=d}H[c+8>>2]=H[d+8>>2];e=H[d+8>>2];H[(((d|0)!=H[e>>2])<<2)+e>>2]=c;H[c+4>>2]=d;H[d+8>>2]=c;f=(d|0)==(f|0)?c:f;c=H[d>>2]}e=H[c>>2];C:{if(!(!e|I[e+12|0])){d=c;break C}d=H[c+4>>2];if(!(I[d+12|0]?0:d)){F[c+12|0]=0;c=H[c+8>>2];if((c|0)!=(f|0)?I[c+12|0]:0){break x}F[c+12|0]=1;break w}if(e){if(!I[e+12|0]){d=c;break C}d=H[c+4>>2]}F[d+12|0]=1;F[c+12|0]=0;e=H[d>>2];H[c+4>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[((H[e>>2]!=(c|0))<<2)+e>>2]=d;H[d>>2]=c;H[c+8>>2]=d;e=c}c=H[d+8>>2];F[d+12|0]=I[c+12|0];F[c+12|0]=1;F[e+12|0]=1;d=H[c>>2];e=H[d+4>>2];H[c>>2]=e;if(e){H[e+8>>2]=c}H[d+8>>2]=H[c+8>>2];e=H[c+8>>2];H[(((c|0)!=H[e>>2])<<2)+e>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;break w}d=c;c=H[c+8>>2];c=H[(((d|0)==H[c>>2])<<2)+c>>2];continue}}F[e+12|0]=1}c=H[g+28>>2];if(c){H[g+32>>2]=c;oa(c)}if(F[g+27|0]<0){oa(H[g+16>>2])}oa(g)}H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;c=H[i+4>>2];d=H[i>>2];f=c-d|0;e=0;D:{E:{if((c|0)!=(d|0)){if((f|0)<0){break E}e=pa(f);c=ra(e,0,f);g=c+f|0;H[h+8>>2]=g;H[h+4>>2]=g;H[h>>2]=c;c=d}qa(e,c,f);F:{if(F[i+27|0]>=0){H[h+24>>2]=H[i+24>>2];c=H[i+20>>2];H[h+16>>2]=H[i+16>>2];H[h+20>>2]=c;break F}za(h+16|0,H[i+16>>2],H[i+20>>2])}ae(h+28|0,h);f=h+16|0;c=f;G:{H:{d=H[j+4>>2];I:{if(!d){e=j+4|0;c=e;break I}e=I[c+11|0];g=e<<24>>24<0;k=g?H[c>>2]:c;g=g?H[c+4>>2]:e;while(1){c=d;d=I[c+27|0];e=d<<24>>24<0;d=e?H[c+20>>2]:d;l=d>>>0>>0;J:{K:{L:{M:{r=l?d:g;N:{if(r){e=e?H[c+16>>2]:c+16|0;z=Fa(k,e,r);if(!z){if(d>>>0>g>>>0){break N}break M}if((z|0)>=0){break M}break N}if(d>>>0<=g>>>0){break L}}e=c;d=H[c>>2];if(d){continue}break I}d=Fa(e,k,r);if(d){break K}}if(l){break J}break H}if((d|0)>=0){break H}}d=H[c+4>>2];if(d){continue}break}e=c+4|0}d=pa(40);H[d+24>>2]=H[f+8>>2];g=H[f+4>>2];H[d+16>>2]=H[f>>2];H[d+20>>2]=g;H[f>>2]=0;H[f+4>>2]=0;H[f+8>>2]=0;ae(d+28|0,f+12|0);H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[e>>2]=d;c=d;f=H[H[j>>2]>>2];if(f){H[j>>2]=f;c=H[e>>2]}Sb(H[j+4>>2],c);H[j+8>>2]=H[j+8>>2]+1;c=1;break G}d=c;c=0}F[h+44|0]=c;H[h+40>>2]=d;c=H[h+28>>2];if(c){H[h+32>>2]=c;oa(c)}if(F[h+27|0]<0){oa(H[h+16>>2])}c=H[h>>2];if(c){H[h+4>>2]=c;oa(c)}ca=h+48|0;break D}sa();v()}d=H[i>>2];if(!d){break r}}H[i+4>>2]=d;oa(d)}d=(n|0)<=(y|0)&p>>>0>=u>>>0|(n|0)<(y|0)}if(F[i+27|0]<0){oa(H[i+16>>2])}ca=i+32|0;break o}sa();v()}if(!d){break a}q=q+1|0;if((x|0)!=(q|0)){continue}break}}H[m+12>>2]=0;if(!Bb(1,m+12|0,H[a>>2])){break a}c=H[a>>2];e=H[c+8>>2];f=H[c+16>>2];h=e-f|0;d=H[m+12>>2];c=H[c+12>>2]-(H[c+20>>2]+(e>>>0>>0)|0)|0;if(h>>>0>>0&(c|0)<=0|(c|0)<0){break a}if(d){q=0;h=((t|0)!=0)+w|0;while(1){O:{if(b>>>0>>0){H[b+8>>2]=h;H[b+4>>2]=0;H[b>>2]=j;b=b+12|0;d=H[m+12>>2];break O}c=b-o|0;g=(c|0)/12|0;b=g+1|0;if(b>>>0>=357913942){break c}e=(s-o|0)/12|0;f=e<<1;e=e>>>0>=178956970?357913941:b>>>0>>0?f:b;if(e){if(e>>>0>=357913942){break b}f=pa(N(e,12))}else{f=0}b=f+N(g,12)|0;H[b+8>>2]=h;H[b+4>>2]=0;H[b>>2]=j;c=va(b+N((c|0)/-12|0,12)|0,o,c);s=f+N(e,12)|0;b=b+12|0;if(o){oa(o)}o=c}q=q+1|0;if(q>>>0>>0){continue}break}}if((b|0)!=(o|0)){continue}break}A=1;break a}sa();v()}wa();v()}if(o){oa(o)}ca=m+32|0;return A}function Af(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=O(0),q=0,r=0;e=ca-720|0;ca=e;a:{b:{c:{d:{e:{f:{g:{h:{i:{if(J[b+38>>1]>=515){H[e+680>>2]=0;H[e+672>>2]=0;H[e+676>>2]=0;if((ea[H[H[a>>2]+24>>2]](a)|0)<=0){break d}while(1){c=ea[H[H[a>>2]+20>>2]](a,n)|0;d=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];if(H[d+28>>2]==9){f=H[e+672>>2];c=H[e+676>>2]-f>>2;k=I[d+24|0];j:{if(c>>>0>>0){ya(e+672|0,k-c|0);break j}if(c>>>0<=k>>>0){break j}H[e+676>>2]=f+(k<<2)}j=0;i=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];d=k<<2;f=H[b+16>>2];l=f+d|0;c=d>>>0>l>>>0?c+1|0:c;if(i>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break b}qa(H[e+672>>2],f+H[b>>2]|0,d);c=H[b+20>>2];f=d;d=d+H[b+16>>2]|0;c=f>>>0>d>>>0?c+1|0:c;i=d;H[b+16>>2]=d;H[b+20>>2]=c;l=H[b+12>>2];g=H[b+8>>2];h=d+4|0;f=h>>>0<4?c+1|0:c;d=f;if(g>>>0>>0&(d|0)>=(l|0)|(d|0)>(l|0)){break b}o=H[b>>2];f=o+i|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=h;H[b+20>>2]=d;if(g>>>0<=h>>>0&(d|0)>=(l|0)|(d|0)>(l|0)){break b}d=I[h+o|0];h=i+5|0;c=h>>>0<5?c+1|0:c;H[b+16>>2]=h;H[b+20>>2]=c;if(d>>>0>31){break b}p=(A(2,f),B());H[e+20>>2]=-1;H[e+16>>2]=1832;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;c=H[e+672>>2];o=d-1|0;if(o>>>0<=29){H[e+20>>2]=d;k:{h=c+(k<<2)|0;l=h-c|0;f=l>>2;i=H[e+32>>2];d=H[e+24>>2];if(f>>>0<=i-d>>2>>>0){i=H[e+28>>2]-d|0;l=i>>2;i=f>>>0>l>>>0?c+i|0:h;g=i-c|0;if((c|0)!=(i|0)){va(d,c,g)}if(f>>>0>l>>>0){c=h-i|0;d=H[e+28>>2];if((h|0)!=(i|0)){va(d,i,c)}H[e+28>>2]=c+d;break k}H[e+28>>2]=d+g;break k}if(d){H[e+28>>2]=d;oa(d);H[e+32>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;i=0}l:{if((l|0)<0){break l}d=i>>>1|0;d=i>>>0>=2147483644?1073741823:d>>>0>f>>>0?d:f;if(d>>>0>=1073741824){break l}i=d<<2;d=pa(i);H[e+28>>2]=d;H[e+24>>2]=d;H[e+32>>2]=d+i;if((c|0)!=(h|0)){qa(d,c,l)}H[e+28>>2]=d+(f<<2);break k}sa();v()}L[e+36>>2]=p}m:{if(o>>>0>=30){break m}if(!Xc(e+16|0,H[H[a+60>>2]+((H[a+40>>2]-H[a+36>>2]|0)/24<<2)>>2])){break m}c=H[a+40>>2];n:{if((c|0)!=H[a+44>>2]){H[c>>2]=1832;d=H[e+20>>2];H[c+16>>2]=0;H[c+8>>2]=0;H[c+12>>2]=0;H[c+4>>2]=d;d=H[e+28>>2];f=H[e+24>>2];if((d|0)!=(f|0)){d=d-f|0;if((d|0)<0){break i}g=pa(d);H[c+12>>2]=g;H[c+8>>2]=g;H[c+16>>2]=(d&-4)+g;k=H[e+24>>2];d=H[e+28>>2];if((k|0)!=(d|0)){while(1){L[g>>2]=L[k>>2];g=g+4|0;k=k+4|0;if((d|0)!=(k|0)){continue}break}}H[c+12>>2]=g}L[c+20>>2]=L[e+36>>2];H[a+40>>2]=c+24;break n}d=0;o:{p:{q:{r:{j=H[a+40>>2];f=H[a+36>>2];i=(j-f|0)/24|0;c=i+1|0;if(c>>>0<178956971){h=(H[a+44>>2]-f|0)/24|0;l=h<<1;h=h>>>0>=89478485?178956970:c>>>0>>0?l:c;if(h){if(h>>>0>=178956971){break r}d=pa(N(h,24))}g=N(i,24)+d|0;H[g>>2]=1832;c=H[e+20>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;H[g+4>>2]=c;c=H[e+24>>2];i=H[e+28>>2];if((c|0)!=(i|0)){l=i-c|0;if((l|0)<0){break q}k=pa(l);H[g+8>>2]=k;H[g+16>>2]=(l&-4)+k;while(1){L[k>>2]=L[c>>2];k=k+4|0;c=c+4|0;if((i|0)!=(c|0)){continue}break}H[g+12>>2]=k}c=N(h,24)+d|0;L[g+20>>2]=L[e+36>>2];d=g+24|0;if((f|0)==(j|0)){break p}while(1){g=g-24|0;H[g>>2]=1832;j=j-24|0;H[g+4>>2]=H[j+4>>2];H[g+8>>2]=H[j+8>>2];H[g+12>>2]=H[j+12>>2];H[g+16>>2]=H[j+16>>2];H[j+16>>2]=0;H[j+8>>2]=0;H[j+12>>2]=0;L[g+20>>2]=L[j+20>>2];if((f|0)!=(j|0)){continue}break}H[a+44>>2]=c;k=H[a+40>>2];H[a+40>>2]=d;j=H[a+36>>2];H[a+36>>2]=g;if((j|0)==(k|0)){break o}while(1){k=k-24|0;ea[H[H[k>>2]>>2]](k)|0;if((j|0)!=(k|0)){continue}break}break o}sa();v()}wa();v()}sa();v()}H[a+44>>2]=c;H[a+40>>2]=d;H[a+36>>2]=g}if(j){oa(j)}}j=1}H[e+16>>2]=1832;c=H[e+24>>2];if(c){H[e+28>>2]=c;oa(c)}if(!j){break c}}n=n+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(n|0)){continue}break}break d}k=ea[H[H[a>>2]+24>>2]](a)|0;H[e+712>>2]=0;H[e+704>>2]=0;H[e+708>>2]=0;if(k){if(k>>>0>=214748365){break h}c=N(k,20);d=pa(c);H[e+704>>2]=d;H[e+712>>2]=c+d;c=c-20|0;c=(c-((c>>>0)%20|0)|0)+20|0;q=e,r=ra(d,0,c)+c|0,H[q+708>>2]=r;while(1){c=ea[H[H[a>>2]+20>>2]](a,m)|0;d=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];f=H[d+28>>2];c=f-1|0;if(c>>>0<=10){c=H[(c<<2)+13584>>2]}else{c=-1}h=(c|0)>0?c:0;if(h>>>0>4){break f}c=H[e+704>>2]+N(m,20)|0;i=I[d+24|0];H[c+16>>2]=i;H[c+12>>2]=h;H[c+8>>2]=f;H[c+4>>2]=g;H[c>>2]=d;g=g+i|0;m=m+1|0;if((k|0)!=(m|0)){continue}break}}c=ea[H[H[a>>2]+20>>2]](a,0)|0;m=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];F[m+84|0]=1;H[m+72>>2]=H[m+68>>2];h=H[b+12>>2];c=h;d=H[b+20>>2];f=H[b+8>>2];i=H[b+16>>2];if((c|0)<=(d|0)&f>>>0<=i>>>0|(c|0)<(d|0)){break f}n=H[b>>2];o=I[n+i|0];c=d;l=i+1|0;c=l?c:c+1|0;H[b+16>>2]=l;H[b+20>>2]=c;s:{switch(o|0){case 0:a=H[e+704>>2];if((H[e+708>>2]-a|0)!=20){break e}if(H[a+16>>2]!=3){break f}t:{if(f>>>0<=l>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break t}c=d;a=i+2|0;c=a>>>0<2?c+1|0:c;l=a;H[b+16>>2]=a;H[b+20>>2]=c;c=d;a=i+6|0;c=a>>>0<6?c+1|0:c;if(a>>>0>f>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break t}d=l+n|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=a;H[b+20>>2]=c;mb(m,d);j=e+672|0;H[j+20>>2]=0;H[j+12>>2]=0;H[j+16>>2]=0;H[j>>2]=0;H[j+4>>2]=0;H[j+20>>2]=d;d=Ac(e+16|0,e+704|0);k=0;g=ca-32|0;ca=g;H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;f=H[b+12>>2];m=f;i=H[b+8>>2];c=H[b+20>>2];l=c;h=H[b+16>>2];a=h+4|0;c=a>>>0<4?c+1|0:c;u:{if(a>>>0>i>>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break u}n=H[b>>2];f=n+h|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=a;H[b+20>>2]=c;v:{w:{switch(f-2|0){case 1:if((c|0)>=(m|0)&a>>>0>=i>>>0|(c|0)>(m|0)){break u}a=F[a+n|0];c=l;f=h+5|0;c=f>>>0<5?c+1|0:c;H[b+16>>2]=f;H[b+20>>2]=c;H[j+8>>2]=a;if((a|0)==1){if(Ud(j,b,g+16|0)){break v}break u}Rd(1799,23,H[3443]);break u;default:Rd(1774,24,H[3443]);break u;case 0:break w}}if(!Ud(j,b,g+16|0)){break u}}H[g+8>>2]=H[g+16>>2];H[g>>2]=H[g+20>>2];c=ca-32|0;ca=c;a=H[j>>2];p=L[j+4>>2];H[c+24>>2]=1065353216;h=-1<0){L[c+24>>2]=p/O(a|0)}m=H[g+8>>2];n=H[g>>2];if((m|0)!=(n|0)){a=H[d+28>>2];while(1){b=H[m>>2];f=H[m+4>>2];p=L[c+24>>2];L[c+16>>2]=p*O(H[m+8>>2]-h|0);L[c+12>>2]=p*O(f-h|0);L[c+8>>2]=p*O(b-h|0);b=a;i=H[d+16>>2];f=H[i>>2];if(!I[f+84|0]){b=H[H[f+68>>2]+(a<<2)>>2]}if(K[f+80>>2]>b>>>0){a=H[f+40>>2];qa(H[H[f>>2]>>2]+N(a,b)|0,(c+8|0)+(H[i+4>>2]<<2)|0,a);n=H[g>>2];a=H[d+28>>2]}a=a+1|0;H[d+28>>2]=a;m=m+12|0;if((n|0)!=(m|0)){continue}break}}ca=c+32|0;k=1}a=H[g+16>>2];if(a){H[g+20>>2]=a;oa(a)}ca=g+32|0;yc(d);j=1;if(k){break f}}j=0;break f;case 1:break s;default:break f}}if(f>>>0<=l>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break f}o=I[l+n|0];c=d;l=i+2|0;c=l>>>0<2?c+1|0:c;H[b+16>>2]=l;H[b+20>>2]=c;if(o>>>0>=7){H[e>>2]=o;Qd(1651,e);break f}c=d;d=i+6|0;c=d>>>0<6?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break f}f=l+n|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;if(k){m=0;while(1){c=ea[H[H[a>>2]+20>>2]](a,m)|0;c=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];mb(c,f);F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];m=m+1|0;if((k|0)!=(m|0)){continue}break}}a=Ac(e+672|0,e+704|0);x:{y:{switch(o|0){case 1:c=wb(e+16|0,g);b=zd(c,b,a,-1);xb(c);if(!b){break g}break x;case 2:c=ub(e+16|0,g);b=yd(c,b,a,-1);vb(c);if(!b){break g}break x;case 3:c=ub(e+16|0,g);b=xd(c,b,a,-1);vb(c);if(!b){break g}break x;case 4:c=$a(e+16|0,g);b=wd(c,b,a,-1);ab(c);if(!b){break g}break x;case 5:c=$a(e+16|0,g);b=vd(c,b,a,-1);ab(c);if(!b){break g}break x;case 6:c=$a(e+16|0,g);b=ud(c,b,a,-1);ab(c);if(b){break x}break g;case 0:break y;default:break g}}c=wb(e+16|0,g);b=Bd(c,b,a,-1);xb(c);if(!b){break g}}yc(a);j=1;break f}sa();v()}sa();v()}yc(a)}a=H[e+704>>2]}if(!a){break a}H[e+708>>2]=a;oa(a);break a}j=1;if(H[a+52>>2]==H[a+48>>2]){break b}while(1){if(!td(1,e+16|0,b)){break c}c=H[a+48>>2];d=H[e+16>>2];H[c+(m<<2)>>2]=d>>>1^0-(d&1);m=m+1|0;if(m>>>0>2]-c>>2>>>0){continue}break}break b}j=0}a=H[e+672>>2];if(!a){break a}H[e+676>>2]=a;oa(a)}ca=e+720|0;return j|0}function te(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;h=ca-32|0;ca=h;H[b+32>>2]=d;H[b+40>>2]=c;H[b+4>>2]=e;nc(a,d,h+16|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}d=I[h+23|0];if((ea[H[H[b>>2]+8>>2]](b)|0)!=(d|0)){b=pa(64);F[b+50|0]=0;c=I[1314]|I[1315]<<8;F[b+48|0]=c;F[b+49|0]=c>>>8;c=I[1310]|I[1311]<<8|(I[1312]<<16|I[1313]<<24);d=I[1306]|I[1307]<<8|(I[1308]<<16|I[1309]<<24);F[b+40|0]=d;F[b+41|0]=d>>>8;F[b+42|0]=d>>>16;F[b+43|0]=d>>>24;F[b+44|0]=c;F[b+45|0]=c>>>8;F[b+46|0]=c>>>16;F[b+47|0]=c>>>24;c=I[1302]|I[1303]<<8|(I[1304]<<16|I[1305]<<24);d=I[1298]|I[1299]<<8|(I[1300]<<16|I[1301]<<24);F[b+32|0]=d;F[b+33|0]=d>>>8;F[b+34|0]=d>>>16;F[b+35|0]=d>>>24;F[b+36|0]=c;F[b+37|0]=c>>>8;F[b+38|0]=c>>>16;F[b+39|0]=c>>>24;c=I[1294]|I[1295]<<8|(I[1296]<<16|I[1297]<<24);d=I[1290]|I[1291]<<8|(I[1292]<<16|I[1293]<<24);F[b+24|0]=d;F[b+25|0]=d>>>8;F[b+26|0]=d>>>16;F[b+27|0]=d>>>24;F[b+28|0]=c;F[b+29|0]=c>>>8;F[b+30|0]=c>>>16;F[b+31|0]=c>>>24;c=I[1286]|I[1287]<<8|(I[1288]<<16|I[1289]<<24);d=I[1282]|I[1283]<<8|(I[1284]<<16|I[1285]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1278]|I[1279]<<8|(I[1280]<<16|I[1281]<<24);d=I[1274]|I[1275]<<8|(I[1276]<<16|I[1277]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1270]|I[1271]<<8|(I[1272]<<16|I[1273]<<24);d=I[1266]|I[1267]<<8|(I[1268]<<16|I[1269]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,50);oa(b);break a}c=I[h+21|0];F[b+36|0]=c;e=I[h+22|0];F[b+37|0]=e;if((c-3&255)>>>0<=253){b=pa(32);F[b+22|0]=0;c=I[1427]|I[1428]<<8|(I[1429]<<16|I[1430]<<24);d=I[1423]|I[1424]<<8|(I[1425]<<16|I[1426]<<24);F[b+14|0]=d;F[b+15|0]=d>>>8;F[b+16|0]=d>>>16;F[b+17|0]=d>>>24;F[b+18|0]=c;F[b+19|0]=c>>>8;F[b+20|0]=c>>>16;F[b+21|0]=c>>>24;c=I[1421]|I[1422]<<8|(I[1423]<<16|I[1424]<<24);d=I[1417]|I[1418]<<8|(I[1419]<<16|I[1420]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1413]|I[1414]<<8|(I[1415]<<16|I[1416]<<24);d=I[1409]|I[1410]<<8|(I[1411]<<16|I[1412]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-5;za(a+4|0,b,22);oa(b);break a}if(!((c|0)!=2|e>>>0<=(d?2:3)>>>0)){b=pa(32);F[b+22|0]=0;c=I[1404]|I[1405]<<8|(I[1406]<<16|I[1407]<<24);d=I[1400]|I[1401]<<8|(I[1402]<<16|I[1403]<<24);F[b+14|0]=d;F[b+15|0]=d>>>8;F[b+16|0]=d>>>16;F[b+17|0]=d>>>24;F[b+18|0]=c;F[b+19|0]=c>>>8;F[b+20|0]=c>>>16;F[b+21|0]=c>>>24;c=I[1398]|I[1399]<<8|(I[1400]<<16|I[1401]<<24);d=I[1394]|I[1395]<<8|(I[1396]<<16|I[1397]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1390]|I[1391]<<8|(I[1392]<<16|I[1393]<<24);d=I[1386]|I[1387]<<8|(I[1388]<<16|I[1389]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-5;za(a+4|0,b,22);oa(b);break a}c=e|c<<8;G[H[b+32>>2]+38>>1]=c;b:{if((c&65535)>>>0<259|G[h+26>>1]>=0){break b}i=ca-16|0;ca=i;e=pa(36);c=e;H[c+4>>2]=0;H[c+8>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;c=c+16|0;H[c>>2]=0;H[c+4>>2]=0;H[e>>2]=e+4;H[e+32>>2]=0;H[e+12>>2]=c;H[i>>2]=0;d=H[b+32>>2];j=ca-16|0;ca=j;c=0;c:{if(!e){break c}H[i>>2]=d;H[j+12>>2]=0;c=0;if(!Bb(1,j+12|0,d)){break c}m=H[j+12>>2];if(m){while(1){d:{if(Bb(1,j+8|0,H[i>>2])){c=pa(28);H[c+4>>2]=0;H[c+8>>2]=0;d=c+16|0;H[d>>2]=0;H[d+4>>2]=0;H[c>>2]=c+4;H[c+12>>2]=d;H[c+24>>2]=H[j+8>>2];if(ce(i,c)){break d}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}c=0;break c}f=ca-16|0;ca=f;H[f+8>>2]=c;e:{if(!c){break e}d=H[e+28>>2];f:{if(d>>>0>2]){H[f+8>>2]=0;H[d>>2]=c;H[e+28>>2]=d+4;break f}d=0;g:{h:{i:{g=H[e+24>>2];l=H[e+28>>2]-g>>2;c=l+1|0;if(c>>>0<1073741824){g=H[e+32>>2]-g|0;k=g>>>1|0;g=g>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(g){if(g>>>0>=1073741824){break i}d=pa(g<<2)}k=H[f+8>>2];H[f+8>>2]=0;c=(l<<2)+d|0;H[c>>2]=k;g=(g<<2)+d|0;l=c+4|0;d=H[e+28>>2];k=H[e+24>>2];if((d|0)==(k|0)){break h}while(1){d=d-4|0;o=H[d>>2];H[d>>2]=0;c=c-4|0;H[c>>2]=o;if((d|0)!=(k|0)){continue}break}H[e+32>>2]=g;g=H[e+28>>2];H[e+28>>2]=l;d=H[e+24>>2];H[e+24>>2]=c;if((d|0)==(g|0)){break g}while(1){g=g-4|0;c=H[g>>2];H[g>>2]=0;if(c){Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}if((d|0)!=(g|0)){continue}break}break g}sa();v()}wa();v()}H[e+32>>2]=g;H[e+28>>2]=l;H[e+24>>2]=c}if(d){oa(d)}}c=H[f+8>>2];H[f+8>>2]=0;if(!c){break e}Ra(c+12|0,H[c+16>>2]);Qa(c,H[c+4>>2]);oa(c)}ca=f+16|0;n=n+1|0;if((m|0)!=(n|0)){continue}break}}c=ce(i,e)}ca=j+16|0;j:{if(c){d=H[b+4>>2];c=H[d+4>>2];H[d+4>>2]=e;if(c){Uc(c)}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;break j}c=pa(32);F[c+26|0]=0;d=I[1579]|I[1580]<<8;F[c+24|0]=d;F[c+25|0]=d>>>8;d=I[1575]|I[1576]<<8|(I[1577]<<16|I[1578]<<24);f=I[1571]|I[1572]<<8|(I[1573]<<16|I[1574]<<24);F[c+16|0]=f;F[c+17|0]=f>>>8;F[c+18|0]=f>>>16;F[c+19|0]=f>>>24;F[c+20|0]=d;F[c+21|0]=d>>>8;F[c+22|0]=d>>>16;F[c+23|0]=d>>>24;d=I[1567]|I[1568]<<8|(I[1569]<<16|I[1570]<<24);f=I[1563]|I[1564]<<8|(I[1565]<<16|I[1566]<<24);F[c+8|0]=f;F[c+9|0]=f>>>8;F[c+10|0]=f>>>16;F[c+11|0]=f>>>24;F[c+12|0]=d;F[c+13|0]=d>>>8;F[c+14|0]=d>>>16;F[c+15|0]=d>>>24;d=I[1559]|I[1560]<<8|(I[1561]<<16|I[1562]<<24);f=I[1555]|I[1556]<<8|(I[1557]<<16|I[1558]<<24);F[c|0]=f;F[c+1|0]=f>>>8;F[c+2|0]=f>>>16;F[c+3|0]=f>>>24;F[c+4|0]=d;F[c+5|0]=d>>>8;F[c+6|0]=d>>>16;F[c+7|0]=d>>>24;H[a>>2]=-1;za(a+4|0,c,26);oa(c);H[i+8>>2]=0;Uc(e)}ca=i+16|0;if(H[a>>2]){break a}if(F[a+15|0]>=0){break b}oa(H[a+4>>2])}if(!(ea[H[H[b>>2]+12>>2]](b)|0)){b=pa(48);F[b+33|0]=0;F[b+32|0]=I[1384];c=I[1380]|I[1381]<<8|(I[1382]<<16|I[1383]<<24);d=I[1376]|I[1377]<<8|(I[1378]<<16|I[1379]<<24);F[b+24|0]=d;F[b+25|0]=d>>>8;F[b+26|0]=d>>>16;F[b+27|0]=d>>>24;F[b+28|0]=c;F[b+29|0]=c>>>8;F[b+30|0]=c>>>16;F[b+31|0]=c>>>24;c=I[1372]|I[1373]<<8|(I[1374]<<16|I[1375]<<24);d=I[1368]|I[1369]<<8|(I[1370]<<16|I[1371]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1364]|I[1365]<<8|(I[1366]<<16|I[1367]<<24);d=I[1360]|I[1361]<<8|(I[1362]<<16|I[1363]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1356]|I[1357]<<8|(I[1358]<<16|I[1359]<<24);d=I[1352]|I[1353]<<8|(I[1354]<<16|I[1355]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,33);oa(b);break a}if(!(ea[H[H[b>>2]+20>>2]](b)|0)){b=mc(h,1582);H[a>>2]=-1;a=a+4|0;if(F[b+11|0]>=0){c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break a}za(a,H[b>>2],H[b+4>>2]);if(F[b+11|0]>=0){break a}oa(H[b>>2]);break a}if(!(ea[H[H[b>>2]+24>>2]](b)|0)){b=mc(h,1317);H[a>>2]=-1;a=a+4|0;if(F[b+11|0]>=0){c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break a}za(a,H[b>>2],H[b+4>>2]);if(F[b+11|0]>=0){break a}oa(H[b>>2]);break a}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ca=h+32|0}function pg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=ca-16|0;ca=m;H[m+12>>2]=b;b=pa(32);H[m>>2]=b;H[m+4>>2]=24;H[m+8>>2]=-2147483616;c=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);d=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);d=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);d=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;F[b+24|0]=0;l=ca-48|0;ca=l;f=H[m+12>>2];d=a;a=a+16|0;b=H[a>>2];a:{b:{if(!b){break b}c=a;while(1){e=(f|0)>H[b+16>>2];c=e?c:b;b=H[(e?b+4|0:b)>>2];if(b){continue}break}if((a|0)==(c|0)){break b}if((f|0)>=H[c+16>>2]){break a}}H[l+28>>2]=0;H[l+32>>2]=0;y=l+24|0;H[l+24>>2]=y|4;a=l+16|0;H[a>>2]=0;H[a+4>>2]=0;H[l+8>>2]=f;H[l+12>>2]=a;t=l+8|0;a=t;x=ca-16|0;ca=x;u=d+12|0;c=H[u+4>>2];c:{d:{if(!c){o=u+4|0;d=o;break d}a=H[a>>2];while(1){d=c;b=H[c+16>>2];if((b|0)>(a|0)){o=d;c=H[d>>2];if(c){continue}break d}if((a|0)<=(b|0)){g=d;a=0;break c}c=H[d+4>>2];if(c){continue}break}o=d+4|0}g=pa(32);b=H[t>>2];q=g+24|0;a=q;H[a>>2]=0;H[a+4>>2]=0;H[g+16>>2]=b;r=g+20|0;H[r>>2]=a;c=H[t+4>>2];z=t+8|0;if((c|0)!=(z|0)){while(1){p=ca-16|0;ca=p;a=p+8|0;k=c+16|0;e:{f:{g:{h:{i:{j:{k:{f=q;e=r+4|0;l:{if((f|0)==(e|0)){break l}b=I[f+27|0];h=b<<24>>24<0;i=I[k+11|0];n=i<<24>>24;j=(n|0)<0;i=j?H[k+4>>2]:i;b=h?H[f+20>>2]:b;s=i>>>0>b>>>0;w=s?b:i;if(w){j=j?H[k>>2]:k;h=h?H[f+16>>2]:f+16|0;A=Fa(j,h,w);if(!A){if(b>>>0>i>>>0){break l}break k}if((A|0)>=0){break k}break l}if(b>>>0<=i>>>0){break j}}h=H[f>>2];m:{a=f;n:{if((a|0)==H[r>>2]){break n}o:{if(!h){b=f;while(1){a=H[b+8>>2];i=H[a>>2]==(b|0);b=a;if(i){continue}break}break o}b=h;while(1){a=b;b=H[b+4>>2];if(b){continue}break}}i=I[k+11|0];s=i<<24>>24;b=(s|0)<0;j=I[a+27|0];n=j<<24>>24<0;p:{i=b?H[k+4>>2]:i;j=n?H[a+20>>2]:j;w=i>>>0>>0?i:j;if(w){b=Fa(n?H[a+16>>2]:a+16|0,b?H[k>>2]:k,w);if(b){break p}}if(i>>>0>j>>>0){break n}break m}if((b|0)>=0){break m}}if(!h){H[p+12>>2]=f;a=f;break e}H[p+12>>2]=a;a=a+4|0;break e}b=H[e>>2];if(!b){H[p+12>>2]=e;a=e;break e}h=(s|0)<0?H[k>>2]:k;f=e;while(1){a=b;b=I[b+27|0];e=b<<24>>24<0;b=e?H[a+20>>2]:b;k=b>>>0>>0;q:{r:{s:{t:{n=k?b:i;u:{if(n){e=e?H[a+16>>2]:a+16|0;j=Fa(h,e,n);if(!j){if(b>>>0>i>>>0){break u}break t}if((j|0)>=0){break t}break u}if(b>>>0<=i>>>0){break s}}f=a;b=H[a>>2];if(b){continue}break g}b=Fa(e,h,n);if(b){break r}}if(k){break q}break g}if((b|0)>=0){break g}}f=a+4|0;b=H[a+4>>2];if(b){continue}break}break g}b=Fa(h,j,w);if(b){break i}}if(s){break h}break f}if((b|0)>=0){break f}}h=H[f+4>>2];v:{if(!h){b=f;while(1){a=H[b+8>>2];j=H[a>>2]!=(b|0);b=a;if(j){continue}break}break v}b=h;while(1){a=b;b=H[b>>2];if(b){continue}break}}w:{x:{if((a|0)==(e|0)){break x}j=I[a+27|0];b=j<<24>>24<0;y:{j=b?H[a+20>>2]:j;s=i>>>0>j>>>0?j:i;if(s){b=Fa((n|0)<0?H[k>>2]:k,b?H[a+16>>2]:a+16|0,s);if(b){break y}}if(i>>>0>>0){break x}break w}if((b|0)>=0){break w}}if(!h){H[p+12>>2]=f;a=f+4|0;break e}H[p+12>>2]=a;break e}b=H[e>>2];if(!b){H[p+12>>2]=e;a=e;break e}h=(n|0)<0?H[k>>2]:k;f=e;while(1){a=b;b=I[b+27|0];e=b<<24>>24<0;b=e?H[a+20>>2]:b;k=b>>>0>>0;z:{A:{B:{C:{n=k?b:i;D:{if(n){e=e?H[a+16>>2]:a+16|0;j=Fa(h,e,n);if(!j){if(b>>>0>i>>>0){break D}break C}if((j|0)>=0){break C}break D}if(b>>>0<=i>>>0){break B}}f=a;b=H[a>>2];if(b){continue}break g}b=Fa(e,h,n);if(b){break A}}if(k){break z}break g}if((b|0)>=0){break g}}f=a+4|0;b=H[a+4>>2];if(b){continue}break}}H[p+12>>2]=a;a=f;break e}H[p+12>>2]=f;H[a>>2]=f}f=a;a=H[a>>2];if(a){b=0}else{a=pa(40);b=a+16|0;E:{if(F[c+27|0]>=0){e=H[c+20>>2];H[b>>2]=H[c+16>>2];H[b+4>>2]=e;H[b+8>>2]=H[c+24>>2];break E}za(b,H[c+16>>2],H[c+20>>2])}b=a+28|0;F:{if(F[c+39|0]>=0){e=H[c+32>>2];H[b>>2]=H[c+28>>2];H[b+4>>2]=e;H[b+8>>2]=H[c+36>>2];break F}za(b,H[c+28>>2],H[c+32>>2])}H[a+8>>2]=H[p+12>>2];H[a>>2]=0;H[a+4>>2]=0;H[f>>2]=a;b=a;e=H[H[r>>2]>>2];if(e){H[r>>2]=e;b=H[f>>2]}Sb(H[r+4>>2],b);H[r+8>>2]=H[r+8>>2]+1;b=1}F[x+12|0]=b;H[x+8>>2]=a;ca=p+16|0;b=H[c+4>>2];G:{if(b){while(1){c=b;b=H[b>>2];if(b){continue}break G}}while(1){a=c;c=H[c+8>>2];if((a|0)!=H[c>>2]){continue}break}}if((c|0)!=(z|0)){continue}break}}H[g+8>>2]=d;H[g>>2]=0;H[g+4>>2]=0;H[o>>2]=g;c=g;a=H[H[u>>2]>>2];if(a){H[u>>2]=a;c=H[o>>2]}Sb(H[u+4>>2],c);H[u+8>>2]=H[u+8>>2]+1;a=1}F[l+44|0]=a;H[l+40>>2]=g;ca=x+16|0;c=H[l+40>>2];Kb(t|4,H[l+16>>2]);Kb(y,H[l+28>>2])}f=ca-48|0;ca=f;d=f+8|0;g=ca-32|0;ca=g;o=g+32|0;b=o;a=g+21|0;H:{if((b|0)==(a|0)){break H}}e=b-a|0;I:{if((e|0)<=9){h=61;if((e|0)<(K[3660]<=1|0)){break I}}F[a|0]=49;b=a+1|0;h=0}H[g+12>>2]=h;H[g+8>>2]=b;h=ca-16|0;ca=h;e=ca-16|0;ca=e;J:{q=H[g+8>>2];g=q-a|0;if(g>>>0<=2147483631){K:{if(g>>>0<11){F[d+11|0]=g|I[d+11|0]&128;F[d+11|0]=I[d+11|0]&127;b=d;break K}t=e+8|0;if(g>>>0>=11){k=g+16&-16;b=k-1|0;b=(b|0)==11?k:b}else{b=10}Zb(t,b+1|0);b=H[e+8>>2];H[d>>2]=b;H[d+8>>2]=H[d+8>>2]&-2147483648|H[e+12>>2]&2147483647;H[d+8>>2]=H[d+8>>2]|-2147483648;H[d+4>>2]=g}while(1){if((a|0)!=(q|0)){F[b|0]=I[a|0];b=b+1|0;a=a+1|0;continue}break}F[e+7|0]=0;F[b|0]=I[e+7|0];ca=e+16|0;break J}Na();v()}ca=h+16|0;ca=o;H[f+32>>2]=m;L:{M:{a=c+20|0;d=H[a+4>>2];N:{if(!d){g=a+4|0;c=g;break N}b=I[m+11|0];c=b<<24>>24<0;e=c?H[m>>2]:m;b=c?H[m+4>>2]:b;while(1){c=d;d=I[c+27|0];g=d<<24>>24<0;d=g?H[c+20>>2]:d;o=d>>>0>>0;O:{P:{Q:{R:{h=o?d:b;S:{if(h){g=g?H[c+16>>2]:c+16|0;q=Fa(e,g,h);if(!q){if(b>>>0>>0){break S}break R}if((q|0)>=0){break R}break S}if(b>>>0>=d>>>0){break Q}}g=c;d=H[c>>2];if(d){continue}break N}d=Fa(g,e,h);if(d){break P}}if(o){break O}break M}if((d|0)>=0){break M}}d=H[c+4>>2];if(d){continue}break}g=c+4|0}d=pa(40);e=d+16|0;b=H[f+32>>2];T:{if(F[b+11|0]>=0){o=H[b+4>>2];H[e>>2]=H[b>>2];H[e+4>>2]=o;H[e+8>>2]=H[b+8>>2];break T}za(e,H[b>>2],H[b+4>>2])}H[d+8>>2]=c;H[d>>2]=0;H[d+4>>2]=0;H[d+36>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[g>>2]=d;c=d;b=H[H[a>>2]>>2];if(b){H[a>>2]=b;c=H[g>>2]}Sb(H[a+4>>2],c);H[a+8>>2]=H[a+8>>2]+1;a=1;break L}d=c;a=0}F[f+44|0]=a;H[f+40>>2]=d;a=H[f+40>>2];if(F[a+39|0]<0){oa(H[a+28>>2])}b=H[f+12>>2];H[a+28>>2]=H[f+8>>2];H[a+32>>2]=b;H[a+36>>2]=H[f+16>>2];ca=f+48|0;ca=l+48|0;if(F[m+11|0]<0){oa(H[m>>2])}ca=m+16|0}function Bd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=H[b+8>>2];e=H[b+12>>2];g=H[b+20>>2];h=H[b+16>>2];k=h+4|0;g=k>>>0<4?g+1|0:g;a:{if(j>>>0>>0&(e|0)<=(g|0)|(e|0)<(g|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];e=h;j=H[b+16>>2];g=j+4|0;h=g>>>0<4?e+1|0:e;H[b+16>>2]=g;H[b+20>>2]=h;if(K[a>>2]>32){break a}l=H[b+8>>2];k=H[b+12>>2];h=e;e=j+8|0;h=e>>>0<8?h+1|0:h;if(e>>>0>l>>>0&(h|0)>=(k|0)|(h|0)>(k|0)){break a}h=H[b>>2]+g|0;g=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=g;h=H[b+20>>2];e=H[b+16>>2]+4|0;h=e>>>0<4?h+1|0:h;H[b+16>>2]=e;H[b+20>>2]=h;if(!g){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ua(a+16|0,b)){break a}if(!ua(a+36|0,b)){break a}if(!ua(a+56|0,b)){break a}if(!ua(a+76|0,b)){break a}s=H[a+4>>2];h=c;b=0;g=0;e=ca-32|0;ca=e;d=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}c=a<<2;b=pa(c);H[e+8>>2]=b;g=b+c|0;H[e+16>>2]=g;ra(b,0,c);H[e+12>>2]=g}c=H[d+120>>2];i=H[c>>2];if(i){H[c+4>>2]=i;oa(i);g=H[e+12>>2];b=H[e+8>>2];a=H[d+12>>2]}H[c+4>>2]=g;H[c>>2]=b;H[c+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;f=pa(a);H[e+8>>2]=f;b=a+f|0;H[e+16>>2]=b;ra(f,0,a);H[e+12>>2]=b}a=H[d+132>>2];c=H[a>>2];if(c){H[a+4>>2]=c;oa(c);f=H[e+8>>2];b=H[e+12>>2]}H[a+4>>2]=b;H[a>>2]=f;H[a+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);a=H[e+24>>2]+H[e+28>>2]|0;b=(a>>>0)/341|0;a=H[H[e+12>>2]+(b<<2)>>2]+N(a-N(b,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=s;c=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}while(1){b=H[e+12>>2];f=H[e+24>>2];k=a-1|0;c=f+k|0;i=(c>>>0)/341|0;c=H[b+(i<<2)>>2]+N(c-N(i,341)|0,12)|0;g=H[c+8>>2];i=H[c+4>>2];j=H[c>>2];H[e+28>>2]=k;c=H[e+16>>2];if((((b|0)!=(c|0)?N(c-b>>2,341)-1|0:0)-(a+f|0)|0)+1>>>0>=682){oa(H[c-4>>2]);H[e+16>>2]=H[e+16>>2]-4}c=0;if(j>>>0>s>>>0){break e}b=H[d+12>>2];a=(b-1|0)!=(i|0)?i+1|0:0;if(a>>>0>=b>>>0){break e}f=N(g,12);o=f+H[d+132>>2]|0;k=f+H[d+120>>2]|0;i=H[d>>2];l=a<<2;m=H[l+H[o>>2]>>2];f:{g:{if((i|0)==(m|0)){if(!j){break g}o=0;b=H[h+20>>2];g=H[h+16>>2];if((b|0)==(g|0)){a=H[d+8>>2];H[h+28>>2]=j+H[h+28>>2];H[d+8>>2]=a+j;break g}while(1){c=(b|0)==(g|0);a=b;i=0;b=g;h:{if(c){break h}while(1){f=H[h+28>>2];b=a;c=N(i,20)+g|0;l=H[c>>2];if(!I[l+84|0]){f=H[H[l+68>>2]+(f<<2)>>2]}if(K[l+80>>2]<=f>>>0){break h}m=H[k>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=m;i:{if(g>>>0>3){break i}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break i}while(1){b=qa(b,m+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+20>>2];b=a;g=H[h+16>>2];if(i>>>0<(b-g|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;o=o+1|0;if((j|0)!=(o|0)){continue}break}break g}j:{k:{l:{m:{if(j>>>0<=2){c=H[d+108>>2];H[c>>2]=a;f=1;b=H[d+12>>2];if(b>>>0>1){break m}break j}if(K[d+8>>2]>K[d+4>>2]){break e}b=H[d+120>>2];n=g+1|0;o=N(n,12);p=b+o|0;if((p|0)!=(k|0)){Aa(p,H[k>>2],H[k+4>>2]);b=H[d+120>>2]}b=l+H[b+o>>2]|0;H[b>>2]=H[b>>2]+(1<>2];m=32-i|0;n:{if((b|0)<=(m|0)){k=H[d+28>>2];if((k|0)==H[d+20>>2]){break l}m=H[k>>2];p=b+i|0;H[d+32>>2]=p;b=m<>>32-b|0;if((p|0)!=32){break n}H[d+32>>2]=0;H[d+28>>2]=k+4;break n}k=H[d+28>>2];p=k+4|0;if((p|0)==H[d+20>>2]){break l}r=H[k>>2];H[d+28>>2]=p;m=b-m|0;H[d+32>>2]=m;b=H[k+4>>2]>>>32-m|r<>>32-b}i=j>>>1|0;if(i>>>0>>0){break e}break k}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(f<<2)>>2]=a;b=H[d+12>>2];f=f+1|0;if(b>>>0>f>>>0){continue}break}break j}i=j>>>1|0;b=0}o:{p:{b=i-b|0;c=j-b|0;q:{if((c|0)==(b|0)){c=b;break q}i=H[d+88>>2];if((i|0)==H[d+80>>2]){break p}j=H[i>>2];k=H[d+92>>2];m=k+1|0;H[d+92>>2]=m;j=j&-2147483648>>>k;r:{if((m|0)==32){H[d+92>>2]=0;H[d+88>>2]=i+4;if(j){break r}break p}if(!j){break p}}}i=c;c=b;break o}i=b}b=H[d+132>>2];j=b+f|0;f=H[j>>2];k=f+l|0;H[k>>2]=H[k>>2]+1;Aa(b+o|0,f,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;j=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((f|0)!=(j|0)?N(j-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}j=(b>>>0)/341|0;b=H[(j<<2)+f>>2]+N(b-N(j,341)|0,12)|0;H[b+8>>2]=g;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!i){break g}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((c|0)!=(f|0)?N(c-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+f>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=n;H[b+4>>2]=a;H[b>>2]=i;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}m=0;if(!j){break g}while(1){if(H[d+12>>2]){i=H[d+40>>2];p=H[o>>2];c=H[d+96>>2];r=H[d+108>>2];a=0;while(1){g=r+(a<<2)|0;H[c+(H[g>>2]<<2)>>2]=0;b=H[d>>2];f=H[g>>2]<<2;l=H[f+p>>2];s:{if((b|0)==(l|0)){break s}f=c+f|0;b=b-l|0;l=H[d+52>>2];q=32-l|0;if((b|0)<=(q|0)){n=H[d+48>>2];if((n|0)==(i|0)){c=0;break e}H[f>>2]=H[n>>2]<>>32-b;b=b+H[d+52>>2]|0;H[d+52>>2]=b;if((b|0)!=32){break s}H[d+52>>2]=0;H[d+48>>2]=n+4;break s}n=H[d+48>>2];t=n+4|0;if((i|0)==(t|0)){c=0;break e}u=H[n>>2];H[d+48>>2]=t;q=b-q|0;H[d+52>>2]=q;H[f>>2]=H[n+4>>2]>>>32-q|u<>>32-b}b=H[g>>2]<<2;g=b+c|0;H[g>>2]=H[g>>2]|H[b+H[k>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}i=0;a=H[h+16>>2];t:{if((a|0)==H[h+20>>2]){break t}while(1){f=H[h+28>>2];c=N(i,20)+a|0;l=H[c>>2];if(!I[l+84|0]){f=H[H[l+68>>2]+(f<<2)>>2]}if(K[l+80>>2]<=f>>>0){break t}n=H[d+96>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=n;u:{if(g>>>0>3){break u}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break u}while(1){b=qa(b,n+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+16>>2];if(i>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;m=m+1|0;if((j|0)!=(m|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}c=1}H[e+28>>2]=0;f=H[e+16>>2];a=H[e+12>>2];b=f-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;f=H[e+16>>2];b=f-a|0;if(b>>>0>8){continue}break}}g=170;v:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break v}}w:{if((a|0)==(f|0)){break w}while(1){oa(H[a>>2]);a=a+4|0;if((f|0)!=(a|0)){continue}break}a=H[e+16>>2];b=H[e+12>>2];if((a|0)==(b|0)){break w}H[e+16>>2]=a+((b-a|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}i=c}return i}function zd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;j=H[b+8>>2];l=H[b+12>>2];k=H[b+20>>2];i=H[b+16>>2];f=i+4|0;k=f>>>0<4?k+1|0:k;a:{if(f>>>0>j>>>0&(k|0)>=(l|0)|(k|0)>(l|0)){break a}i=i+H[b>>2]|0;H[a>>2]=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);i=H[b+20>>2];j=i;f=H[b+16>>2];i=f+4|0;l=i>>>0<4?j+1|0:j;H[b+16>>2]=i;H[b+20>>2]=l;if(K[a>>2]>32){break a}l=H[b+8>>2];k=H[b+12>>2];f=f+8|0;j=f>>>0<8?j+1|0:j;if((k|0)<=(j|0)&f>>>0>l>>>0|(k|0)<(j|0)){break a}i=H[b>>2]+i|0;f=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);H[a+4>>2]=f;j=H[b+20>>2];i=H[b+16>>2]+4|0;j=i>>>0<4?j+1|0:j;H[b+16>>2]=i;H[b+20>>2]=j;if(!f){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ua(a+16|0,b)){break a}if(!ua(a+36|0,b)){break a}if(!ua(a+56|0,b)){break a}if(!ua(a+76|0,b)){break a}t=H[a+4>>2];i=c;b=0;c=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;c=b+d|0;H[e+16>>2]=c;ra(b,0,d);H[e+12>>2]=c}g=H[f+120>>2];d=H[g>>2];if(d){H[g+4>>2]=d;oa(d);c=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[g+4>>2]=c;H[g>>2]=b;H[g+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;h=pa(a);H[e+8>>2]=h;b=a+h|0;H[e+16>>2]=b;ra(h,0,a);H[e+12>>2]=b}c=H[f+132>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);h=H[e+8>>2];b=H[e+12>>2]}H[c+4>>2]=b;H[c>>2]=h;H[c+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=t;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}while(1){j=H[e+12>>2];g=H[e+24>>2];d=a-1|0;c=g+d|0;b=(c>>>0)/341|0;b=H[j+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;n=H[b+8>>2];c=H[b+4>>2];m=H[b>>2];H[e+28>>2]=d;b=H[e+16>>2];if((((b|0)!=(j|0)?N(b-j>>2,341)-1|0:0)-(a+g|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(m>>>0>t>>>0){d=0;break e}d=0;b=H[f+12>>2];a=(c|0)!=(b-1|0)?c+1|0:0;if(a>>>0>=b>>>0){break e}b=H[f+120>>2];o=N(n,12);q=b+o|0;g=H[f>>2];h=a<<2;l=o+H[f+132>>2]|0;c=H[h+H[l>>2]>>2];f:{g:{if((g|0)==(c|0)){if(!m){break g}h=0;b=H[i+20>>2];c=H[i+16>>2];if((b|0)==(c|0)){a=H[f+8>>2];H[i+28>>2]=m+H[i+28>>2];H[f+8>>2]=a+m;break g}while(1){d=(b|0)==(c|0);a=b;g=0;b=c;h:{if(d){break h}while(1){d=H[i+28>>2];b=a;k=N(g,20)+c|0;l=H[k>>2];if(!I[l+84|0]){d=H[H[l+68>>2]+(d<<2)>>2]}if(K[l+80>>2]<=d>>>0){break h}j=H[q>>2]+(H[k+4>>2]<<2)|0;c=H[k+12>>2];b=j;i:{if(c>>>0>3){break i}a=0;b=H[i+12>>2];if(!H[k+16>>2]){break i}while(1){b=qa(b,j+(a<<2)|0,c);c=H[k+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[i+12>>2]}a=H[l+40>>2];qa(H[H[l>>2]>>2]+N(a,d)|0,b,a);g=g+1|0;a=H[i+20>>2];b=a;c=H[i+16>>2];if(g>>>0<(b-c|0)/20>>>0){continue}break}}H[i+28>>2]=H[i+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;h=h+1|0;if((m|0)!=(h|0)){continue}break}break g}j:{k:{l:{m:{if(m>>>0<=2){c=H[f+108>>2];H[c>>2]=a;h=1;b=H[f+12>>2];if(b>>>0>1){break m}break j}if(K[f+8>>2]>K[f+4>>2]){break e}j=b;b=o+12|0;Aa(j+b|0,H[q>>2],H[q+4>>2]);b=h+H[b+H[f+120>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2];g=32-l|0;n:{if((k|0)<=(g|0)){g=H[f+28>>2];if((g|0)==H[f+20>>2]){break l}c=H[g>>2];b=k+l|0;H[f+32>>2]=b;c=c<>>32-k|0;if((b|0)!=32){break n}H[f+32>>2]=0;H[f+28>>2]=g+4;break n}j=H[f+28>>2];b=j+4|0;if((b|0)==H[f+20>>2]){break l}c=H[j>>2];H[f+28>>2]=b;b=k-g|0;H[f+32>>2]=b;c=H[j+4>>2]>>>32-b|c<>>32-k}g=m>>>1|0;if(g>>>0>>0){break e}break k}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(h<<2)>>2]=a;b=H[f+12>>2];h=h+1|0;if(b>>>0>h>>>0){continue}break}break j}g=m>>>1|0;c=0}k=n+1|0;o:{p:{b=g-c|0;c=m-b|0;q:{if((c|0)==(b|0)){c=b;break q}l=H[f+88>>2];if((l|0)==H[f+80>>2]){break p}j=H[l>>2];g=H[f+92>>2];d=g+1|0;H[f+92>>2]=d;g=j&-2147483648>>>g;r:{if((d|0)==32){H[f+92>>2]=0;H[f+88>>2]=l+4;if(g){break r}break p}if(!g){break p}}}g=c;c=b;break o}g=b}l=H[f+132>>2];j=l+o|0;d=H[j>>2];b=d+h|0;H[b>>2]=H[b>>2]+1;Aa(l+N(k,12)|0,d,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;d=H[e+16>>2];h=H[e+12>>2];if((b|0)==(((d|0)!=(h|0)?N(d-h>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}d=(b>>>0)/341|0;b=H[(d<<2)+h>>2]+N(b-N(d,341)|0,12)|0;H[b+8>>2]=n;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!g){break g}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];h=H[e+12>>2];if((b|0)==(((c|0)!=(h|0)?N(c-h>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+h>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=k;H[b+4>>2]=a;H[b>>2]=g;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}r=0;if(!m){break g}while(1){if(H[f+12>>2]){u=H[f+40>>2];j=H[l>>2];s=H[f+96>>2];g=H[f+108>>2];a=0;while(1){n=(a<<2)+g|0;H[s+(H[n>>2]<<2)>>2]=0;d=H[f>>2];c=H[n>>2]<<2;b=H[c+j>>2];s:{if((d|0)==(b|0)){break s}o=c+s|0;p=d-b|0;h=H[f+52>>2];d=32-h|0;if((p|0)<=(d|0)){c=H[f+48>>2];if((c|0)==(u|0)){d=0;break e}H[o>>2]=H[c>>2]<>>32-p;b=p+H[f+52>>2]|0;H[f+52>>2]=b;if((b|0)!=32){break s}H[f+52>>2]=0;H[f+48>>2]=c+4;break s}k=H[f+48>>2];b=k+4|0;if((u|0)==(b|0)){d=0;break e}c=H[k>>2];H[f+48>>2]=b;b=p-d|0;H[f+52>>2]=b;H[o>>2]=H[k+4>>2]>>>32-b|c<>>32-p}c=H[n>>2]<<2;b=c+s|0;H[b>>2]=H[b>>2]|H[c+H[q>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}g=0;a=H[i+16>>2];t:{if((a|0)==H[i+20>>2]){break t}while(1){d=H[i+28>>2];h=N(g,20)+a|0;k=H[h>>2];if(!I[k+84|0]){d=H[H[k+68>>2]+(d<<2)>>2]}if(K[k+80>>2]<=d>>>0){break t}j=H[f+96>>2]+(H[h+4>>2]<<2)|0;c=H[h+12>>2];b=j;u:{if(c>>>0>3){break u}a=0;b=H[i+12>>2];if(!H[h+16>>2]){break u}while(1){b=qa(b,j+(a<<2)|0,c);c=H[h+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[i+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,d)|0,b,a);g=g+1|0;a=H[i+16>>2];if(g>>>0<(H[i+20>>2]-a|0)/20>>>0){continue}break}}H[i+28>>2]=H[i+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;r=r+1|0;if((m|0)!=(r|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}d=1}H[e+28>>2]=0;h=H[e+16>>2];a=H[e+12>>2];b=h-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;h=H[e+16>>2];b=h-a|0;if(b>>>0>8){continue}break}}c=170;v:{switch((b>>>2|0)-1|0){case 1:c=341;case 0:H[e+24>>2]=c;break;default:break v}}w:{if((a|0)==(h|0)){break w}while(1){oa(H[a>>2]);a=a+4|0;if((h|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break w}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;g=d;break b}sa();v()}sa();v()}}return g}function wd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];j=H[b+12>>2];n=H[b+20>>2];e=H[b+16>>2];h=e+4|0;n=h>>>0<4?n+1|0:n;a:{if(i>>>0>>0&(j|0)<=(n|0)|(j|0)<(n|0)){break a}e=e+H[b>>2]|0;H[a>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);e=H[b+20>>2];i=e;h=H[b+16>>2];e=h+4|0;j=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=j;if(K[a>>2]>32){break a}j=H[b+8>>2];n=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>j>>>0&(i|0)>=(n|0)|(i|0)>(n|0)){break a}e=H[b>>2]+e|0;h=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];e=H[b+16>>2]+4|0;i=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}u=H[a+4>>2];d=c;b=0;c=0;f=ca-32|0;ca=f;g=a;a=H[a+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}e=a<<2;b=pa(e);H[f+8>>2]=b;c=b+e|0;H[f+16>>2]=c;ra(b,0,e);H[f+12>>2]=c}h=H[g+628>>2];e=H[h>>2];if(e){H[h+4>>2]=e;oa(e);c=H[f+12>>2];b=H[f+8>>2];a=H[g+12>>2]}H[h+4>>2]=c;H[h>>2]=b;H[h+8>>2]=H[f+16>>2];b=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;k=pa(a);H[f+8>>2]=k;b=a+k|0;H[f+16>>2]=b;ra(k,0,a);H[f+12>>2]=b}c=H[g+640>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);k=H[f+8>>2];b=H[f+12>>2]}H[c+4>>2]=b;H[c>>2]=k;H[c+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;a=(b>>>0)/341|0;a=H[H[f+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;c=1;a=H[f+28>>2]+1|0;H[f+28>>2]=a;e:{if(!a){break e}n=g+16|0;while(1){j=H[f+12>>2];h=H[f+24>>2];e=a-1|0;c=h+e|0;b=(c>>>0)/341|0;b=H[j+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;q=H[b+8>>2];i=H[b+4>>2];o=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(j|0)?N(b-j>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}c=0;if(o>>>0>u>>>0){break e}a=H[g+12>>2];k=(i|0)!=(a-1|0)?i+1|0:0;if(k>>>0>=a>>>0){break e}p=N(q,12);w=p+H[g+640>>2]|0;r=p+H[g+628>>2]|0;h=H[g>>2];l=k<<2;e=H[l+H[w>>2]>>2];f:{g:{if((h|0)==(e|0)){if(!o){break g}c=H[d+16>>2];b=H[d+20>>2];m=0;while(1){e=(b|0)==(c|0);a=b;j=0;b=c;h:{if(e){break h}while(1){l=H[d+28>>2];b=a;i=N(j,20)+c|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break h}e=H[r>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;i:{if(c>>>0>3){break i}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break i}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);a=H[d+20>>2];b=a;j=j+1|0;c=H[d+16>>2];if(j>>>0<(a-c|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;m=m+1|0;if((o|0)!=(m|0)){continue}break}break g}j:{k:{l:{if(o>>>0<=2){c=H[g+616>>2];H[c>>2]=k;a=1;b=H[g+12>>2];if(b>>>0>1){break l}break j}if(K[g+8>>2]>K[g+4>>2]){break e}a=H[g+628>>2];j=q+1|0;m=N(j,12);b=a+m|0;if((b|0)!=(r|0)){Aa(b,H[r>>2],H[r+4>>2]);a=H[g+628>>2]}a=l+H[a+m>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+n|0)|b<<1;a=a+1|0;if((c|0)!=(a|0)){continue}break}a=o>>>1|0;if(b>>>0<=a>>>0){break k}c=0;break e}while(1){k=(b-1|0)!=(k|0)?k+1|0:0;H[c+(a<<2)>>2]=k;a=a+1|0;b=H[g+12>>2];if(a>>>0>>0){continue}break}break j}m:{n:{b=a-b|0;a=o-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[g+596>>2];if((i|0)==H[g+588>>2]){break n}h=H[i>>2];e=H[g+600>>2];c=e+1|0;H[g+600>>2]=c;e=h&-2147483648>>>e;p:{if((c|0)==32){H[g+600>>2]=0;H[g+596>>2]=i+4;if(e){break p}break n}if(!e){break n}}}c=a;a=b;break m}c=b}i=H[g+640>>2];h=i+p|0;e=H[h>>2];b=e+l|0;H[b>>2]=H[b>>2]+1;Aa(i+m|0,e,H[h+4>>2]);if(a){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];b=H[f+12>>2];if((m|0)==(((b|0)!=(e|0)?N(e-b>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=b}b=(m>>>0)/341|0;b=H[e+(b<<2)>>2]+N(m-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=k;H[b>>2]=a;H[f+28>>2]=H[f+28>>2]+1}if(!c){break g}b=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];a=H[f+12>>2];if((b|0)==(((a|0)!=(e|0)?N(e-a>>2,341)-1|0:0)|0)){xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=a}a=(b>>>0)/341|0;a=H[e+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=j;H[a+4>>2]=k;H[a>>2]=c;a=H[f+28>>2]+1|0;H[f+28>>2]=a;break f}k=0;if(!o){break g}while(1){if(H[g+12>>2]){q=H[g+548>>2];i=H[w>>2];t=H[g+604>>2];h=H[g+616>>2];a=0;while(1){p=(a<<2)+h|0;H[t+(H[p>>2]<<2)>>2]=0;e=H[g>>2];c=H[p>>2]<<2;b=H[c+i>>2];q:{if((e|0)==(b|0)){break q}l=c+t|0;s=e-b|0;m=H[g+560>>2];e=32-m|0;if((s|0)<=(e|0)){c=H[g+556>>2];if((c|0)==(q|0)){c=0;break e}H[l>>2]=H[c>>2]<>>32-s;b=s+H[g+560>>2]|0;H[g+560>>2]=b;if((b|0)!=32){break q}H[g+560>>2]=0;H[g+556>>2]=c+4;break q}j=H[g+556>>2];b=j+4|0;if((q|0)==(b|0)){c=0;break e}c=H[j>>2];H[g+556>>2]=b;b=s-e|0;H[g+560>>2]=b;H[l>>2]=H[j+4>>2]>>>32-b|c<>>32-s}c=H[p>>2]<<2;b=c+t|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[d+16>>2];r:{if((a|0)==H[d+20>>2]){break r}while(1){l=H[d+28>>2];i=N(j,20)+a|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break r}e=H[g+604>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;s:{if(c>>>0>3){break s}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break s}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);j=j+1|0;a=H[d+16>>2];if(j>>>0<(H[d+20>>2]-a|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;k=k+1|0;if((o|0)!=(k|0)){continue}break}}a=H[f+28>>2]}if(a){continue}break}c=1}H[f+28>>2]=0;k=H[f+16>>2];a=H[f+12>>2];b=k-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[f+12>>2]+4|0;H[f+12>>2]=a;k=H[f+16>>2];b=k-a|0;if(b>>>0>8){continue}break}}d=170;t:{switch((b>>>2|0)-1|0){case 1:d=341;case 0:H[f+24>>2]=d;break;default:break t}}u:{if((a|0)==(k|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((k|0)!=(a|0)){continue}break}b=H[f+16>>2];a=H[f+12>>2];if((b|0)==(a|0)){break u}H[f+16>>2]=b+((a-b|0)+3&-4)}a=H[f+8>>2];if(a){oa(a)}ca=f+32|0;break b}sa();v()}sa();v()}g=c}return g}function ud(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];o=H[b+20>>2];e=H[b+16>>2];h=e+4|0;o=h>>>0<4?o+1|0:o;a:{if(i>>>0>>0&(k|0)<=(o|0)|(k|0)<(o|0)){break a}e=e+H[b>>2]|0;H[a>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);e=H[b+20>>2];i=e;h=H[b+16>>2];e=h+4|0;k=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];o=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>k>>>0&(i|0)>=(o|0)|(i|0)>(o|0)){break a}e=H[b>>2]+e|0;h=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];e=H[b+16>>2]+4|0;i=e>>>0<4?i+1|0:i;H[b+16>>2]=e;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}w=H[a+4>>2];d=c;b=0;c=0;f=ca-32|0;ca=f;g=a;a=H[a+12>>2];H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}e=a<<2;b=pa(e);H[f+8>>2]=b;c=b+e|0;H[f+16>>2]=c;ra(b,0,e);H[f+12>>2]=c}h=H[g+628>>2];e=H[h>>2];if(e){H[h+4>>2]=e;oa(e);c=H[f+12>>2];b=H[f+8>>2];a=H[g+12>>2]}H[h+4>>2]=c;H[h>>2]=b;H[h+8>>2]=H[f+16>>2];b=0;H[f+16>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;j=pa(a);H[f+8>>2]=j;b=a+j|0;H[f+16>>2]=b;ra(j,0,a);H[f+12>>2]=b}c=H[g+640>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);j=H[f+8>>2];b=H[f+12>>2]}H[c+4>>2]=b;H[c>>2]=j;H[c+8>>2]=H[f+16>>2];H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;a=(b>>>0)/341|0;a=H[H[f+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=w;c=1;a=H[f+28>>2]+1|0;H[f+28>>2]=a;e:{if(!a){break e}o=g+16|0;while(1){i=H[f+12>>2];h=H[f+24>>2];e=a-1|0;c=h+e|0;b=(c>>>0)/341|0;b=H[i+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;q=H[b+8>>2];n=H[b>>2];H[f+28>>2]=e;b=H[f+16>>2];if((((b|0)!=(i|0)?N(b-i>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[f+16>>2]=H[f+16>>2]-4}c=0;if(n>>>0>w>>>0){break e}a=H[g+628>>2];p=N(q,12);t=p+H[g+640>>2]|0;j=Vd(g,n,t);if(j>>>0>=K[g+12>>2]){break e}r=a+p|0;h=H[g>>2];l=j<<2;e=H[l+H[t>>2]>>2];f:{g:{if((h|0)==(e|0)){if(!n){break g}c=H[d+16>>2];b=H[d+20>>2];m=0;while(1){e=(b|0)==(c|0);a=b;k=0;b=c;h:{if(e){break h}while(1){l=H[d+28>>2];b=a;i=N(k,20)+c|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break h}e=H[r>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;i:{if(c>>>0>3){break i}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break i}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);a=H[d+20>>2];b=a;k=k+1|0;c=H[d+16>>2];if(k>>>0<(a-c|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;m=m+1|0;if((n|0)!=(m|0)){continue}break}break g}j:{k:{l:{if(n>>>0<=2){c=H[g+616>>2];H[c>>2]=j;a=1;b=H[g+12>>2];if(b>>>0>1){break l}break j}if(K[g+8>>2]>K[g+4>>2]){break e}a=H[g+628>>2];k=q+1|0;m=N(k,12);b=a+m|0;if((b|0)!=(r|0)){Aa(b,H[r>>2],H[r+4>>2]);a=H[g+628>>2]}a=l+H[a+m>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+o|0)|b<<1;a=a+1|0;if((c|0)!=(a|0)){continue}break}a=n>>>1|0;if(b>>>0<=a>>>0){break k}c=0;break e}while(1){j=(b-1|0)!=(j|0)?j+1|0:0;H[c+(a<<2)>>2]=j;a=a+1|0;b=H[g+12>>2];if(a>>>0>>0){continue}break}break j}m:{n:{b=a-b|0;a=n-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[g+596>>2];if((i|0)==H[g+588>>2]){break n}h=H[i>>2];e=H[g+600>>2];c=e+1|0;H[g+600>>2]=c;e=h&-2147483648>>>e;p:{if((c|0)==32){H[g+600>>2]=0;H[g+596>>2]=i+4;if(e){break p}break n}if(!e){break n}}}c=a;a=b;break m}c=b}i=H[g+640>>2];h=i+p|0;e=H[h>>2];b=e+l|0;H[b>>2]=H[b>>2]+1;Aa(i+m|0,e,H[h+4>>2]);if(a){m=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];b=H[f+12>>2];if((m|0)==(((b|0)!=(e|0)?N(e-b>>2,341)-1|0:0)|0)){xa(f+8|0);m=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=b}b=(m>>>0)/341|0;b=H[e+(b<<2)>>2]+N(m-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=j;H[b>>2]=a;H[f+28>>2]=H[f+28>>2]+1}if(!c){break g}b=H[f+28>>2]+H[f+24>>2]|0;e=H[f+16>>2];a=H[f+12>>2];if((b|0)==(((a|0)!=(e|0)?N(e-a>>2,341)-1|0:0)|0)){xa(f+8|0);b=H[f+24>>2]+H[f+28>>2]|0;e=H[f+12>>2]}else{e=a}a=(b>>>0)/341|0;a=H[e+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=k;H[a+4>>2]=j;H[a>>2]=c;a=H[f+28>>2]+1|0;H[f+28>>2]=a;break f}j=0;if(!n){break g}while(1){if(H[g+12>>2]){q=H[g+548>>2];i=H[t>>2];u=H[g+604>>2];h=H[g+616>>2];a=0;while(1){p=(a<<2)+h|0;H[u+(H[p>>2]<<2)>>2]=0;e=H[g>>2];c=H[p>>2]<<2;b=H[c+i>>2];q:{if((e|0)==(b|0)){break q}l=c+u|0;s=e-b|0;m=H[g+560>>2];e=32-m|0;if((s|0)<=(e|0)){c=H[g+556>>2];if((c|0)==(q|0)){c=0;break e}H[l>>2]=H[c>>2]<>>32-s;b=s+H[g+560>>2]|0;H[g+560>>2]=b;if((b|0)!=32){break q}H[g+560>>2]=0;H[g+556>>2]=c+4;break q}k=H[g+556>>2];b=k+4|0;if((q|0)==(b|0)){c=0;break e}c=H[k>>2];H[g+556>>2]=b;b=s-e|0;H[g+560>>2]=b;H[l>>2]=H[k+4>>2]>>>32-b|c<>>32-s}c=H[p>>2]<<2;b=c+u|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}k=0;a=H[d+16>>2];r:{if((a|0)==H[d+20>>2]){break r}while(1){l=H[d+28>>2];i=N(k,20)+a|0;h=H[i>>2];if(!I[h+84|0]){l=H[H[h+68>>2]+(l<<2)>>2]}if(K[h+80>>2]<=l>>>0){break r}e=H[g+604>>2]+(H[i+4>>2]<<2)|0;c=H[i+12>>2];b=e;s:{if(c>>>0>3){break s}a=0;b=H[d+12>>2];if(!H[i+16>>2]){break s}while(1){b=qa(b,e+(a<<2)|0,c);c=H[i+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[d+12>>2]}a=H[h+40>>2];qa(H[H[h>>2]>>2]+N(a,l)|0,b,a);k=k+1|0;a=H[d+16>>2];if(k>>>0<(H[d+20>>2]-a|0)/20>>>0){continue}break}}H[d+28>>2]=H[d+28>>2]+1;H[g+8>>2]=H[g+8>>2]+1;j=j+1|0;if((n|0)!=(j|0)){continue}break}}a=H[f+28>>2]}if(a){continue}break}c=1}H[f+28>>2]=0;j=H[f+16>>2];a=H[f+12>>2];b=j-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[f+12>>2]+4|0;H[f+12>>2]=a;j=H[f+16>>2];b=j-a|0;if(b>>>0>8){continue}break}}d=170;t:{switch((b>>>2|0)-1|0){case 1:d=341;case 0:H[f+24>>2]=d;break;default:break t}}u:{if((a|0)==(j|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((j|0)!=(a|0)){continue}break}b=H[f+16>>2];a=H[f+12>>2];if((b|0)==(a|0)){break u}H[f+16>>2]=b+((a-b|0)+3&-4)}a=H[f+8>>2];if(a){oa(a)}ca=f+32|0;break b}sa();v()}sa();v()}g=c}return g}function vd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];m=H[b+20>>2];f=H[b+16>>2];h=f+4|0;m=h>>>0<4?m+1|0:m;a:{if(i>>>0>>0&(k|0)<=(m|0)|(k|0)<(m|0)){break a}f=f+H[b>>2]|0;H[a>>2]=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);f=H[b+20>>2];i=f;h=H[b+16>>2];f=h+4|0;k=f>>>0<4?i+1|0:i;H[b+16>>2]=f;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];m=H[b+12>>2];h=h+8|0;i=h>>>0<8?i+1|0:i;if(h>>>0>k>>>0&(i|0)>=(m|0)|(i|0)>(m|0)){break a}f=f+H[b>>2]|0;h=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[a+4>>2]=h;i=H[b+20>>2];f=H[b+16>>2]+4|0;i=f>>>0<4?i+1|0:i;H[b+16>>2]=f;H[b+20>>2]=i;if(!h){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!sb(a+16|0,b)){break a}if(!ua(a+544|0,b)){break a}if(!ua(a+564|0,b)){break a}if(!ua(a+584|0,b)){break a}u=H[a+4>>2];b=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;g=b+d|0;H[e+16>>2]=g;ra(b,0,d);H[e+12>>2]=g}h=H[f+628>>2];d=H[h>>2];if(d){H[h+4>>2]=d;oa(d);g=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[h+4>>2]=g;H[h>>2]=b;H[h+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;j=pa(a);H[e+8>>2]=j;b=a+j|0;H[e+16>>2]=b;ra(j,0,a);H[e+12>>2]=b}d=H[f+640>>2];a=H[d>>2];if(a){H[d+4>>2]=a;oa(a);j=H[e+8>>2];b=H[e+12>>2]}H[d+4>>2]=b;H[d>>2]=j;H[d+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}m=f+16|0;while(1){k=H[e+12>>2];h=H[e+24>>2];g=a-1|0;d=h+g|0;b=(d>>>0)/341|0;b=H[k+(b<<2)>>2]+N(d-N(b,341)|0,12)|0;q=H[b+8>>2];i=H[b+4>>2];n=H[b>>2];H[e+28>>2]=g;b=H[e+16>>2];if((((b|0)!=(k|0)?N(b-k>>2,341)-1|0:0)-(a+h|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(n>>>0>u>>>0){d=0;break e}d=0;a=H[f+12>>2];j=(i|0)!=(a-1|0)?i+1|0:0;if(j>>>0>=a>>>0){break e}a=H[f+628>>2];o=N(q,12);s=a+o|0;g=H[f>>2];l=j<<2;k=o+H[f+640>>2]|0;b=H[l+H[k>>2]>>2];f:{g:{if((g|0)==(b|0)){if(!n){break g}g=H[c+16>>2];b=H[c+20>>2];p=0;while(1){d=(b|0)==(g|0);a=b;j=0;b=g;h:{if(d){break h}while(1){d=H[c+28>>2];b=a;k=N(j,20)+g|0;i=H[k>>2];if(!I[i+84|0]){d=H[H[i+68>>2]+(d<<2)>>2]}if(K[i+80>>2]<=d>>>0){break h}h=H[s>>2]+(H[k+4>>2]<<2)|0;g=H[k+12>>2];b=h;i:{if(g>>>0>3){break i}a=0;b=H[c+12>>2];if(!H[k+16>>2]){break i}while(1){b=qa(b,h+(a<<2)|0,g);g=H[k+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[c+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,d)|0,b,a);a=H[c+20>>2];b=a;j=j+1|0;g=H[c+16>>2];if(j>>>0<(a-g|0)/20>>>0){continue}break}}H[c+28>>2]=H[c+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;p=p+1|0;if((p|0)!=(n|0)){continue}break}break g}j:{k:{l:{if(n>>>0<=2){d=H[f+616>>2];H[d>>2]=j;a=1;b=H[f+12>>2];if(b>>>0>1){break l}break j}if(K[f+8>>2]>K[f+4>>2]){break e}d=a;a=o+12|0;Aa(d+a|0,H[s>>2],H[s+4>>2]);a=l+H[a+H[f+628>>2]>>2]|0;H[a>>2]=H[a>>2]+(1<>>1|0;break k}while(1){b=Ba((a<<4)+m|0)|b<<1;a=a+1|0;if((d|0)!=(a|0)){continue}break}a=n>>>1|0;if(b>>>0<=a>>>0){break k}d=0;break e}while(1){j=(b-1|0)!=(j|0)?j+1|0:0;H[d+(a<<2)>>2]=j;a=a+1|0;b=H[f+12>>2];if(a>>>0>>0){continue}break}break j}k=q+1|0;m:{n:{b=a-b|0;a=n-b|0;o:{if((a|0)==(b|0)){a=b;break o}i=H[f+596>>2];if((i|0)==H[f+588>>2]){break n}h=H[i>>2];g=H[f+600>>2];d=g+1|0;H[f+600>>2]=d;g=h&-2147483648>>>g;p:{if((d|0)==32){H[f+600>>2]=0;H[f+596>>2]=i+4;if(g){break p}break n}if(!g){break n}}}d=a;a=b;break m}d=b}i=H[f+640>>2];h=i+o|0;g=H[h>>2];b=g+l|0;H[b>>2]=H[b>>2]+1;Aa(i+N(k,12)|0,g,H[h+4>>2]);if(a){h=H[e+28>>2]+H[e+24>>2]|0;g=H[e+16>>2];b=H[e+12>>2];if((h|0)==(((b|0)!=(g|0)?N(g-b>>2,341)-1|0:0)|0)){xa(e+8|0);h=H[e+24>>2]+H[e+28>>2]|0;g=H[e+12>>2]}else{g=b}b=(h>>>0)/341|0;b=H[g+(b<<2)>>2]+N(h-N(b,341)|0,12)|0;H[b+8>>2]=q;H[b+4>>2]=j;H[b>>2]=a;H[e+28>>2]=H[e+28>>2]+1}if(!d){break g}b=H[e+28>>2]+H[e+24>>2]|0;g=H[e+16>>2];a=H[e+12>>2];if((b|0)==(((a|0)!=(g|0)?N(g-a>>2,341)-1|0:0)|0)){xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;g=H[e+12>>2]}else{g=a}a=(b>>>0)/341|0;a=H[g+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+8>>2]=k;H[a+4>>2]=j;H[a>>2]=d;a=H[e+28>>2]+1|0;H[e+28>>2]=a;break f}p=0;if(!n){break g}while(1){if(H[f+12>>2]){w=H[f+548>>2];i=H[k>>2];t=H[f+604>>2];h=H[f+616>>2];a=0;while(1){j=h+(a<<2)|0;H[(H[j>>2]<<2)+t>>2]=0;g=H[f>>2];d=H[j>>2]<<2;b=H[d+i>>2];q:{if((g|0)==(b|0)){break q}q=d+t|0;r=g-b|0;o=H[f+560>>2];g=32-o|0;if((r|0)<=(g|0)){d=H[f+556>>2];if((d|0)==(w|0)){d=0;break e}H[q>>2]=H[d>>2]<>>32-r;b=H[f+560>>2]+r|0;H[f+560>>2]=b;if((b|0)!=32){break q}H[f+560>>2]=0;H[f+556>>2]=d+4;break q}l=H[f+556>>2];b=l+4|0;if((b|0)==(w|0)){d=0;break e}d=H[l>>2];H[f+556>>2]=b;b=r-g|0;H[f+560>>2]=b;H[q>>2]=H[l+4>>2]>>>32-b|d<>>32-r}d=H[j>>2]<<2;b=d+t|0;H[b>>2]=H[b>>2]|H[d+H[s>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[c+16>>2];r:{if((a|0)==H[c+20>>2]){break r}while(1){d=H[c+28>>2];l=N(j,20)+a|0;i=H[l>>2];if(!I[i+84|0]){d=H[H[i+68>>2]+(d<<2)>>2]}if(K[i+80>>2]<=d>>>0){break r}h=H[f+604>>2]+(H[l+4>>2]<<2)|0;g=H[l+12>>2];b=h;s:{if(g>>>0>3){break s}a=0;b=H[c+12>>2];if(!H[l+16>>2]){break s}while(1){b=qa(b,h+(a<<2)|0,g);g=H[l+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[c+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,d)|0,b,a);j=j+1|0;a=H[c+16>>2];if(j>>>0<(H[c+20>>2]-a|0)/20>>>0){continue}break}}H[c+28>>2]=H[c+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;p=p+1|0;if((p|0)!=(n|0)){continue}break}}a=H[e+28>>2]}if(a){continue}break}d=1}H[e+28>>2]=0;j=H[e+16>>2];a=H[e+12>>2];b=j-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;j=H[e+16>>2];b=j-a|0;if(b>>>0>8){continue}break}}g=170;t:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break t}}u:{if((a|0)==(j|0)){break u}while(1){oa(H[a>>2]);a=a+4|0;if((j|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break u}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}g=d}return g}function yd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;j=H[b+8>>2];e=H[b+12>>2];g=H[b+20>>2];h=H[b+16>>2];l=h+4|0;g=l>>>0<4?g+1|0:g;a:{if(j>>>0>>0&(e|0)<=(g|0)|(e|0)<(g|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];e=h;j=H[b+16>>2];g=j+4|0;h=g>>>0<4?e+1|0:e;H[b+16>>2]=g;H[b+20>>2]=h;if(K[a>>2]>32){break a}k=H[b+8>>2];l=H[b+12>>2];h=e;e=j+8|0;h=e>>>0<8?h+1|0:h;if(e>>>0>k>>>0&(h|0)>=(l|0)|(h|0)>(l|0)){break a}h=H[b>>2]+g|0;g=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=g;h=H[b+20>>2];e=H[b+16>>2]+4|0;h=e>>>0<4?h+1|0:h;H[b+16>>2]=e;H[b+20>>2]=h;if(!g){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ta(a+16|0,b)){break a}if(!ua(a+32|0,b)){break a}if(!ua(a+52|0,b)){break a}if(!ua(a+72|0,b)){break a}r=H[a+4>>2];h=c;b=0;g=0;e=ca-32|0;ca=e;d=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}c=a<<2;b=pa(c);H[e+8>>2]=b;g=b+c|0;H[e+16>>2]=g;ra(b,0,c);H[e+12>>2]=g}c=H[d+116>>2];i=H[c>>2];if(i){H[c+4>>2]=i;oa(i);g=H[e+12>>2];b=H[e+8>>2];a=H[d+12>>2]}H[c+4>>2]=g;H[c>>2]=b;H[c+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;f=pa(a);H[e+8>>2]=f;b=a+f|0;H[e+16>>2]=b;ra(f,0,a);H[e+12>>2]=b}a=H[d+128>>2];c=H[a>>2];if(c){H[a+4>>2]=c;oa(c);f=H[e+8>>2];b=H[e+12>>2]}H[a+4>>2]=b;H[a>>2]=f;H[a+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);a=H[e+24>>2]+H[e+28>>2]|0;b=(a>>>0)/341|0;a=H[H[e+12>>2]+(b<<2)>>2]+N(a-N(b,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=r;c=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}t=d+16|0;while(1){b=H[e+12>>2];f=H[e+24>>2];l=a-1|0;c=f+l|0;i=(c>>>0)/341|0;c=H[b+(i<<2)>>2]+N(c-N(i,341)|0,12)|0;g=H[c+8>>2];i=H[c+4>>2];j=H[c>>2];H[e+28>>2]=l;c=H[e+16>>2];if((((b|0)!=(c|0)?N(c-b>>2,341)-1|0:0)-(a+f|0)|0)+1>>>0>=682){oa(H[c-4>>2]);H[e+16>>2]=H[e+16>>2]-4}c=0;if(j>>>0>r>>>0){break e}b=H[d+12>>2];a=(b-1|0)!=(i|0)?i+1|0:0;if(a>>>0>=b>>>0){break e}f=N(g,12);o=f+H[d+128>>2]|0;l=f+H[d+116>>2]|0;i=H[d>>2];k=a<<2;n=H[k+H[o>>2]>>2];f:{if((i|0)==(n|0)){if(!j){break f}o=0;b=H[h+20>>2];g=H[h+16>>2];if((b|0)==(g|0)){a=H[d+8>>2];H[h+28>>2]=j+H[h+28>>2];H[d+8>>2]=a+j;break f}while(1){c=(b|0)==(g|0);a=b;i=0;b=g;g:{if(c){break g}while(1){f=H[h+28>>2];b=a;c=N(i,20)+g|0;k=H[c>>2];if(!I[k+84|0]){f=H[H[k+68>>2]+(f<<2)>>2]}if(K[k+80>>2]<=f>>>0){break g}n=H[l>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=n;h:{if(g>>>0>3){break h}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break h}while(1){b=qa(b,n+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+20>>2];b=a;g=H[h+16>>2];if(i>>>0<(b-g|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;o=o+1|0;if((j|0)!=(o|0)){continue}break}break f}i:{j:{k:{l:{if(j>>>0<=2){c=H[d+104>>2];H[c>>2]=a;f=1;b=H[d+12>>2];if(b>>>0>1){break l}break i}if(K[d+8>>2]>K[d+4>>2]){break e}b=H[d+116>>2];m=g+1|0;o=N(m,12);q=b+o|0;if((q|0)!=(l|0)){Aa(q,H[l>>2],H[l+4>>2]);b=H[d+116>>2]}b=k+H[b+o>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(t,Q(j)^31,e+4|0);b=j>>>1|0;i=H[e+4>>2];if(b>>>0>>0){break e}b=b-i|0;c=j-b|0;m:{if((c|0)==(b|0)){c=b;break m}i=H[d+84>>2];if((i|0)==H[d+76>>2]){break k}j=H[i>>2];l=H[d+88>>2];n=l+1|0;H[d+88>>2]=n;j=j&-2147483648>>>l;n:{if((n|0)==32){H[d+88>>2]=0;H[d+84>>2]=i+4;if(j){break n}break k}if(!j){break k}}}i=c;c=b;break j}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(f<<2)>>2]=a;b=H[d+12>>2];f=f+1|0;if(b>>>0>f>>>0){continue}break}break i}i=b}b=H[d+128>>2];j=b+f|0;f=H[j>>2];l=f+k|0;H[l>>2]=H[l>>2]+1;Aa(b+o|0,f,H[j+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;j=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((f|0)!=(j|0)?N(j-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}j=(b>>>0)/341|0;b=H[(j<<2)+f>>2]+N(b-N(j,341)|0,12)|0;H[b+8>>2]=g;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!i){break f}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];f=H[e+12>>2];if((b|0)==(((c|0)!=(f|0)?N(c-f>>2,341)-1|0:0)|0)){xa(e+8|0);f=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+f>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=m;H[b+4>>2]=a;H[b>>2]=i;H[e+28>>2]=H[e+28>>2]+1;break f}n=0;if(!j){break f}while(1){if(H[d+12>>2]){i=H[d+36>>2];q=H[o>>2];c=H[d+92>>2];u=H[d+104>>2];a=0;while(1){g=(a<<2)+u|0;H[c+(H[g>>2]<<2)>>2]=0;b=H[d>>2];f=H[g>>2]<<2;k=H[f+q>>2];o:{if((b|0)==(k|0)){break o}f=c+f|0;b=b-k|0;k=H[d+48>>2];p=32-k|0;if((b|0)<=(p|0)){m=H[d+44>>2];if((m|0)==(i|0)){c=0;break e}H[f>>2]=H[m>>2]<>>32-b;b=b+H[d+48>>2]|0;H[d+48>>2]=b;if((b|0)!=32){break o}H[d+48>>2]=0;H[d+44>>2]=m+4;break o}m=H[d+44>>2];s=m+4|0;if((i|0)==(s|0)){c=0;break e}w=H[m>>2];H[d+44>>2]=s;p=b-p|0;H[d+48>>2]=p;H[f>>2]=H[m+4>>2]>>>32-p|w<>>32-b}b=H[g>>2]<<2;g=b+c|0;H[g>>2]=H[g>>2]|H[b+H[l>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}i=0;a=H[h+16>>2];p:{if((a|0)==H[h+20>>2]){break p}while(1){f=H[h+28>>2];c=N(i,20)+a|0;k=H[c>>2];if(!I[k+84|0]){f=H[H[k+68>>2]+(f<<2)>>2]}if(K[k+80>>2]<=f>>>0){break p}m=H[d+92>>2]+(H[c+4>>2]<<2)|0;g=H[c+12>>2];b=m;q:{if(g>>>0>3){break q}a=0;b=H[h+12>>2];if(!H[c+16>>2]){break q}while(1){b=qa(b,m+(a<<2)|0,g);g=H[c+12>>2];b=b+g|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,f)|0,b,a);i=i+1|0;a=H[h+16>>2];if(i>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[d+8>>2]=H[d+8>>2]+1;n=n+1|0;if((j|0)!=(n|0)){continue}break}}a=H[e+28>>2];if(a){continue}break}c=1}H[e+28>>2]=0;f=H[e+16>>2];a=H[e+12>>2];b=f-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;f=H[e+16>>2];b=f-a|0;if(b>>>0>8){continue}break}}g=170;r:{switch((b>>>2|0)-1|0){case 1:g=341;case 0:H[e+24>>2]=g;break;default:break r}}s:{if((a|0)==(f|0)){break s}while(1){oa(H[a>>2]);a=a+4|0;if((f|0)!=(a|0)){continue}break}a=H[e+16>>2];b=H[e+12>>2];if((a|0)==(b|0)){break s}H[e+16>>2]=a+((b-a|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;break b}sa();v()}sa();v()}i=c}return i}function xd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;i=H[b+8>>2];k=H[b+12>>2];n=H[b+20>>2];h=H[b+16>>2];f=h+4|0;n=f>>>0<4?n+1|0:n;a:{if((k|0)<=(n|0)&f>>>0>i>>>0|(k|0)<(n|0)){break a}h=h+H[b>>2]|0;H[a>>2]=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);h=H[b+20>>2];i=h;f=H[b+16>>2];h=f+4|0;k=h>>>0<4?i+1|0:i;H[b+16>>2]=h;H[b+20>>2]=k;if(K[a>>2]>32){break a}k=H[b+8>>2];n=H[b+12>>2];f=f+8|0;i=f>>>0<8?i+1|0:i;if(f>>>0>k>>>0&(i|0)>=(n|0)|(i|0)>(n|0)){break a}h=H[b>>2]+h|0;f=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[a+4>>2]=f;i=H[b+20>>2];h=H[b+16>>2]+4|0;i=h>>>0<4?i+1|0:i;H[b+16>>2]=h;H[b+20>>2]=i;if(!f){return 1}if(d>>>0>>0){break a}H[a+8>>2]=0;if(!ta(a+16|0,b)){break a}if(!ua(a+32|0,b)){break a}if(!ua(a+52|0,b)){break a}if(!ua(a+72|0,b)){break a}u=H[a+4>>2];h=c;b=0;c=0;e=ca-32|0;ca=e;f=a;a=H[a+12>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;b:{c:{if(a){if(a>>>0>=1073741824){break c}d=a<<2;b=pa(d);H[e+8>>2]=b;c=b+d|0;H[e+16>>2]=c;ra(b,0,d);H[e+12>>2]=c}j=H[f+116>>2];d=H[j>>2];if(d){H[j+4>>2]=d;oa(d);c=H[e+12>>2];b=H[e+8>>2];a=H[f+12>>2]}H[j+4>>2]=c;H[j>>2]=b;H[j+8>>2]=H[e+16>>2];b=0;H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;d:{if(a){if(a>>>0>=1073741824){break d}a=a<<2;g=pa(a);H[e+8>>2]=g;b=a+g|0;H[e+16>>2]=b;ra(g,0,a);H[e+12>>2]=b}c=H[f+128>>2];a=H[c>>2];if(a){H[c+4>>2]=a;oa(a);g=H[e+8>>2];b=H[e+12>>2]}H[c+4>>2]=b;H[c>>2]=g;H[c+8>>2]=H[e+16>>2];H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;xa(e+8|0);b=H[e+24>>2]+H[e+28>>2]|0;a=(b>>>0)/341|0;a=H[H[e+12>>2]+(a<<2)>>2]+N(b-N(a,341)|0,12)|0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=u;d=1;a=H[e+28>>2]+1|0;H[e+28>>2]=a;e:{if(!a){break e}n=f+16|0;while(1){i=H[e+12>>2];j=H[e+24>>2];d=a-1|0;c=j+d|0;b=(c>>>0)/341|0;b=H[i+(b<<2)>>2]+N(c-N(b,341)|0,12)|0;o=H[b+8>>2];c=H[b+4>>2];m=H[b>>2];H[e+28>>2]=d;b=H[e+16>>2];if((((b|0)!=(i|0)?N(b-i>>2,341)-1|0:0)-(a+j|0)|0)+1>>>0>=682){oa(H[b-4>>2]);H[e+16>>2]=H[e+16>>2]-4}if(m>>>0>u>>>0){d=0;break e}d=0;b=H[f+12>>2];a=(c|0)!=(b-1|0)?c+1|0:0;if(a>>>0>=b>>>0){break e}b=H[f+116>>2];p=N(o,12);r=b+p|0;j=H[f>>2];g=a<<2;k=p+H[f+128>>2]|0;c=H[g+H[k>>2]>>2];f:{if((j|0)==(c|0)){if(!m){break f}b=H[h+20>>2];c=H[h+16>>2];if((b|0)==(c|0)){a=H[f+8>>2];H[h+28>>2]=m+H[h+28>>2];H[f+8>>2]=a+m;break f}while(1){i=(b|0)==(c|0);a=b;j=0;b=c;g:{if(i){break g}while(1){g=H[h+28>>2];b=a;l=N(j,20)+c|0;k=H[l>>2];if(!I[k+84|0]){g=H[H[k+68>>2]+(g<<2)>>2]}if(K[k+80>>2]<=g>>>0){break g}i=H[r>>2]+(H[l+4>>2]<<2)|0;c=H[l+12>>2];b=i;h:{if(c>>>0>3){break h}a=0;b=H[h+12>>2];if(!H[l+16>>2]){break h}while(1){b=qa(b,i+(a<<2)|0,c);c=H[l+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[k+40>>2];qa(H[H[k>>2]>>2]+N(a,g)|0,b,a);j=j+1|0;a=H[h+20>>2];b=a;c=H[h+16>>2];if(j>>>0<(b-c|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;d=d+1|0;if((m|0)!=(d|0)){continue}break}break f}i:{j:{k:{l:{if(m>>>0<=2){c=H[f+104>>2];H[c>>2]=a;g=1;b=H[f+12>>2];if(b>>>0>1){break l}break i}if(K[f+8>>2]>K[f+4>>2]){break e}i=b;b=p+12|0;Aa(i+b|0,H[r>>2],H[r+4>>2]);b=g+H[b+H[f+116>>2]>>2]|0;H[b>>2]=H[b>>2]+(1<>2]=0;pc(n,Q(m)^31,e+4|0);c=m>>>1|0;b=H[e+4>>2];if(c>>>0>>0){break e}l=o+1|0;b=c-b|0;c=m-b|0;m:{if((c|0)==(b|0)){c=b;break m}k=H[f+84>>2];if((k|0)==H[f+76>>2]){break k}i=H[k>>2];j=H[f+88>>2];d=j+1|0;H[f+88>>2]=d;j=i&-2147483648>>>j;n:{if((d|0)==32){H[f+88>>2]=0;H[f+84>>2]=k+4;if(j){break n}break k}if(!j){break k}}}j=c;c=b;break j}while(1){a=(b-1|0)!=(a|0)?a+1|0:0;H[c+(g<<2)>>2]=a;b=H[f+12>>2];g=g+1|0;if(b>>>0>g>>>0){continue}break}break i}j=b}k=H[f+128>>2];i=k+p|0;d=H[i>>2];b=d+g|0;H[b>>2]=H[b>>2]+1;Aa(k+N(l,12)|0,d,H[i+4>>2]);if(c){b=H[e+28>>2]+H[e+24>>2]|0;d=H[e+16>>2];g=H[e+12>>2];if((b|0)==(((d|0)!=(g|0)?N(d-g>>2,341)-1|0:0)|0)){xa(e+8|0);g=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}d=(b>>>0)/341|0;b=H[(d<<2)+g>>2]+N(b-N(d,341)|0,12)|0;H[b+8>>2]=o;H[b+4>>2]=a;H[b>>2]=c;H[e+28>>2]=H[e+28>>2]+1}if(!j){break f}b=H[e+28>>2]+H[e+24>>2]|0;c=H[e+16>>2];g=H[e+12>>2];if((b|0)==(((c|0)!=(g|0)?N(c-g>>2,341)-1|0:0)|0)){xa(e+8|0);g=H[e+12>>2];b=H[e+24>>2]+H[e+28>>2]|0}c=(b>>>0)/341|0;b=H[(c<<2)+g>>2]+N(b-N(c,341)|0,12)|0;H[b+8>>2]=l;H[b+4>>2]=a;H[b>>2]=j;H[e+28>>2]=H[e+28>>2]+1;break f}s=0;if(!m){break f}while(1){if(H[f+12>>2]){w=H[f+36>>2];i=H[k>>2];t=H[f+92>>2];j=H[f+104>>2];a=0;while(1){o=(a<<2)+j|0;H[t+(H[o>>2]<<2)>>2]=0;d=H[f>>2];c=H[o>>2]<<2;b=H[c+i>>2];o:{if((d|0)==(b|0)){break o}p=c+t|0;q=d-b|0;g=H[f+48>>2];d=32-g|0;if((q|0)<=(d|0)){c=H[f+44>>2];if((c|0)==(w|0)){d=0;break e}H[p>>2]=H[c>>2]<>>32-q;b=q+H[f+48>>2]|0;H[f+48>>2]=b;if((b|0)!=32){break o}H[f+48>>2]=0;H[f+44>>2]=c+4;break o}l=H[f+44>>2];b=l+4|0;if((w|0)==(b|0)){d=0;break e}c=H[l>>2];H[f+44>>2]=b;b=q-d|0;H[f+48>>2]=b;H[p>>2]=H[l+4>>2]>>>32-b|c<>>32-q}c=H[o>>2]<<2;b=c+t|0;H[b>>2]=H[b>>2]|H[c+H[r>>2]>>2];a=a+1|0;if(a>>>0>2]){continue}break}}j=0;a=H[h+16>>2];p:{if((a|0)==H[h+20>>2]){break p}while(1){g=H[h+28>>2];l=N(j,20)+a|0;i=H[l>>2];if(!I[i+84|0]){g=H[H[i+68>>2]+(g<<2)>>2]}if(K[i+80>>2]<=g>>>0){break p}d=H[f+92>>2]+(H[l+4>>2]<<2)|0;c=H[l+12>>2];b=d;q:{if(c>>>0>3){break q}a=0;b=H[h+12>>2];if(!H[l+16>>2]){break q}while(1){b=qa(b,d+(a<<2)|0,c);c=H[l+12>>2];b=b+c|0;a=a+1|0;if(a>>>0>2]){continue}break}b=H[h+12>>2]}a=H[i+40>>2];qa(H[H[i>>2]>>2]+N(a,g)|0,b,a);j=j+1|0;a=H[h+16>>2];if(j>>>0<(H[h+20>>2]-a|0)/20>>>0){continue}break}}H[h+28>>2]=H[h+28>>2]+1;H[f+8>>2]=H[f+8>>2]+1;s=s+1|0;if((m|0)!=(s|0)){continue}break}}a=H[e+28>>2];if(a){continue}break}d=1}H[e+28>>2]=0;g=H[e+16>>2];a=H[e+12>>2];b=g-a|0;if(b>>>0>=9){while(1){oa(H[a>>2]);a=H[e+12>>2]+4|0;H[e+12>>2]=a;g=H[e+16>>2];b=g-a|0;if(b>>>0>8){continue}break}}c=170;r:{switch((b>>>2|0)-1|0){case 1:c=341;case 0:H[e+24>>2]=c;break;default:break r}}s:{if((a|0)==(g|0)){break s}while(1){oa(H[a>>2]);a=a+4|0;if((g|0)!=(a|0)){continue}break}b=H[e+16>>2];a=H[e+12>>2];if((b|0)==(a|0)){break s}H[e+16>>2]=b+((a-b|0)+3&-4)}a=H[e+8>>2];if(a){oa(a)}ca=e+32|0;j=d;break b}sa();v()}sa();v()}}return j}function $c(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;h=ca-32|0;ca=h;g=H[H[a+4>>2]+44>>2];c=H[a+8>>2];d=H[c>>2];c=H[c+4>>2];H[h+24>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;d=(c-d>>2>>>0)/3|0;c=H[g+96>>2];f=(H[g+100>>2]-c|0)/12|0;a:{if(d>>>0>f>>>0){e=d-f|0;i=H[g+104>>2];c=H[g+100>>2];if(e>>>0<=(i-c|0)/12>>>0){b:{if(!e){break b}d=c;f=N(e,12)-12|0;i=((f>>>0)/12|0)+1&3;if(i){while(1){l=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=l;H[d+8>>2]=H[h+24>>2];d=d+12|0;j=j+1|0;if((i|0)!=(j|0)){continue}break}}c=N(e,12)+c|0;if(f>>>0<36){break b}while(1){f=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=f;H[d+8>>2]=H[h+24>>2];H[d+20>>2]=H[h+24>>2];f=H[h+20>>2];H[d+12>>2]=H[h+16>>2];H[d+16>>2]=f;H[d+32>>2]=H[h+24>>2];f=H[h+20>>2];H[d+24>>2]=H[h+16>>2];H[d+28>>2]=f;f=H[h+20>>2];H[d+36>>2]=H[h+16>>2];H[d+40>>2]=f;H[d+44>>2]=H[h+24>>2];d=d+48|0;if((d|0)!=(c|0)){continue}break}}H[g+100>>2]=c;break a}c:{f=H[g+96>>2];n=(c-f|0)/12|0;d=n+e|0;if(d>>>0<357913942){f=(i-f|0)/12|0;i=f<<1;i=f>>>0>=178956970?357913941:d>>>0>>0?i:d;if(i){if(i>>>0>=357913942){break c}l=pa(N(i,12))}f=N(n,12)+l|0;d=f;e=N(e,12);n=e-12|0;q=((n>>>0)/12|0)+1&3;if(q){while(1){r=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=r;H[d+8>>2]=H[h+24>>2];d=d+12|0;j=j+1|0;if((q|0)!=(j|0)){continue}break}}e=e+f|0;if(n>>>0>=36){while(1){j=H[h+20>>2];H[d>>2]=H[h+16>>2];H[d+4>>2]=j;H[d+8>>2]=H[h+24>>2];H[d+20>>2]=H[h+24>>2];j=H[h+20>>2];H[d+12>>2]=H[h+16>>2];H[d+16>>2]=j;H[d+32>>2]=H[h+24>>2];j=H[h+20>>2];H[d+24>>2]=H[h+16>>2];H[d+28>>2]=j;j=H[h+20>>2];H[d+36>>2]=H[h+16>>2];H[d+40>>2]=j;H[d+44>>2]=H[h+24>>2];d=d+48|0;if((e|0)!=(d|0)){continue}break}}j=H[g+96>>2];if((j|0)!=(c|0)){while(1){c=c-12|0;n=H[c+4>>2];f=f-12|0;d=f;H[d>>2]=H[c>>2];H[d+4>>2]=n;H[d+8>>2]=H[c+8>>2];if((c|0)!=(j|0)){continue}break}c=H[g+96>>2]}H[g+104>>2]=N(i,12)+l;H[g+100>>2]=e;H[g+96>>2]=f;if(c){oa(c)}break a}sa();v()}wa();v()}if(d>>>0>=f>>>0){break a}H[g+100>>2]=c+N(d,12)}d:{if(H[a+216>>2]==H[a+220>>2]){j=H[a+4>>2];c=H[j+44>>2];d=H[c+100>>2];f=H[c+96>>2];if((d|0)!=(f|0)){c=(d-f|0)/12|0;o=c>>>0<=1?1:c;c=0;while(1){d=H[a+8>>2];i=f+N(c,12)|0;g=N(c,3);e:{f:{if((g|0)==-1){e=H[(H[d>>2]+(g<<2)|0)+4>>2];k=-1;g=1;break f}e=-1;k=H[H[d>>2]+(g<<2)>>2];l=g+1|0;if((l|0)==-1){g=0;break f}e=H[H[d>>2]+(l<<2)>>2];g=g+2|0;m=-1;if((g|0)==-1){break e}}m=H[H[d>>2]+(g<<2)>>2]}H[i+8>>2]=m;H[i+4>>2]=e;H[i>>2]=k;c=c+1|0;if((o|0)!=(c|0)){continue}break}}H[H[j+4>>2]+80>>2]=b;c=1;break d}d=0;H[h+24>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;l=H[a+8>>2];c=H[l>>2];g=H[l+4>>2];H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;b=0;g:{h:{i:{j:{k:{l:{if((c|0)!=(g|0)){c=g-c|0;if((c|0)<0){break l}b=pa(c);H[h>>2]=b;H[h+8>>2]=(c&-4)+b;u=h,w=ra(b,0,c)+c|0,H[u+4>>2]=w}c=H[l+24>>2];if((H[l+28>>2]-c|0)<4){break h}f=0;while(1){g=H[(p<<2)+c>>2];m:{if((g|0)==-1){break m}n:{if(H[H[a+120>>2]+(p>>>3&536870908)>>2]>>>p&1){break n}n=H[a+216>>2];c=H[a+220>>2];if((n|0)==(c|0)){break n}e=g+2|0;i=(g>>>0)%3|0;q=i?g-1|0:e;c=(c-n|0)/144|0;r=c>>>0<=1?1:c;j=0;t=(i|0)!=0|(e|0)!=-1;while(1){s=g<<2;i=N(j,144)+n|0;c=H[s+H[H[i+68>>2]>>2]>>2];o:{if(!(H[H[i+16>>2]+(c>>>3&536870908)>>2]>>>c&1)){break o}c=-1;p:{if(!t){break p}e=H[H[l+12>>2]+(q<<2)>>2];c=-1;if((e|0)==-1){break p}c=e-1|0;if((e>>>0)%3|0){break p}c=e+2|0}if((g|0)==(c|0)){break o}e=s;s=H[i+32>>2];i=H[e+s>>2];while(1){e=0;if((c|0)==-1){break g}if((i|0)!=H[s+(c<<2)>>2]){g=c;break n}q:{r:{if((c>>>0)%3|0){e=c-1|0;break r}e=c+2|0;m=-1;if((e|0)==-1){break q}}c=H[H[l+12>>2]+(e<<2)>>2];m=-1;if((c|0)==-1){break q}m=c-1|0;if((c>>>0)%3|0){break q}m=c+2|0}c=m;if((g|0)!=(c|0)){continue}break}}j=j+1|0;if((r|0)!=(j|0)){continue}break}}i=k-f|0;e=i>>2;H[(g<<2)+b>>2]=e;s:{if(k>>>0>>0){H[k>>2]=g;k=k+4|0;H[h+20>>2]=k;break s}c=e+1|0;if(c>>>0>=1073741824){break k}d=o-f|0;k=d>>>1|0;c=d>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}d=pa(c<<2)}else{d=0}e=d+(e<<2)|0;H[e>>2]=g;m=c<<2;c=va(d,f,i);o=m+c|0;H[h+24>>2]=o;k=e+4|0;H[h+20>>2]=k;H[h+16>>2]=c;if(f){oa(f);l=H[a+8>>2]}f=c}if((g|0)==-1){break m}t:{if((g>>>0)%3|0){c=g-1|0;break t}c=g+2|0;if((c|0)==-1){break m}}c=H[H[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=g;if((c|0)==(g|0)){break m}while(1){i=c;u:{v:{c=H[a+220>>2];j=H[a+216>>2];if((c|0)==(j|0)){break v}c=(c-j|0)/144|0;n=c>>>0<=1?1:c;c=0;while(1){q=H[(j+N(c,144)|0)+32>>2];r=i<<2;if(H[q+r>>2]==H[q+(e<<2)>>2]){c=c+1|0;if((n|0)!=(c|0)){continue}break v}break}j=k-d|0;e=j>>2;H[b+r>>2]=e;if(k>>>0>>0){H[k>>2]=i;k=k+4|0;H[h+20>>2]=k;f=d;break u}c=e+1|0;if(c>>>0>=1073741824){break i}f=o-d|0;k=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}f=pa(c<<2)}else{f=0}e=f+(e<<2)|0;H[e>>2]=i;m=c<<2;c=va(f,d,j);o=m+c|0;H[h+24>>2]=o;k=e+4|0;H[h+20>>2]=k;H[h+16>>2]=c;if(!d){d=c;break u}oa(d);l=H[a+8>>2];d=c;break u}H[(i<<2)+b>>2]=H[(e<<2)+b>>2]}if((i|0)==-1){break m}w:{if((i>>>0)%3|0){c=i-1|0;break w}c=i+2|0;if((c|0)==-1){break m}}c=H[H[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=i;if((c|0)!=(g|0)){continue}break}}p=p+1|0;c=H[l+24>>2];if((p|0)>2]-c>>2){continue}break}break h}sa();v()}sa();v()}wa();v()}sa();v()}i=H[a+4>>2];a=H[i+44>>2];c=H[a+100>>2];a=H[a+96>>2];x:{if((c|0)==(a|0)){break x}g=(c-a|0)/12|0;f=g>>>0<=1?1:g;l=f&1;c=0;if(g>>>0>=2){j=f&-2;g=0;while(1){e=N(c,12);f=e+b|0;o=H[f>>2];p=H[f+4>>2];e=a+e|0;H[e+8>>2]=H[f+8>>2];H[e>>2]=o;H[e+4>>2]=p;e=N(c|1,12);f=e+b|0;o=H[f>>2];p=H[f+4>>2];e=a+e|0;H[e+8>>2]=H[f+8>>2];H[e>>2]=o;H[e+4>>2]=p;c=c+2|0;g=g+2|0;if((j|0)!=(g|0)){continue}break}}if(!l){break x}g=N(c,12);c=g+b|0;f=H[c>>2];e=H[c+4>>2];a=a+g|0;H[a+8>>2]=H[c+8>>2];H[a>>2]=f;H[a+4>>2]=e}H[H[i+4>>2]+80>>2]=k-d>>2;e=1}c=e;if(b){oa(b)}if(!d){break d}H[h+20>>2]=d;oa(d)}ca=h+32|0;return c}function Fj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,I=0,J=0,K=0,L=0,M=0,O=0,P=0;g=ca+-64|0;ca=g;H[a+8>>2]=e;y=a+32|0;f=H[y>>2];d=H[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){ya(y,e-d|0);H[g+56>>2]=0;H[g+60>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g>>2]=0;break b}if(d>>>0>e>>>0){H[a+36>>2]=f+(e<<2)}H[g+56>>2]=0;H[g+60>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g>>2]=0;d=0;if(!e){break a}}Pa(g+16|0,e,g);h=H[g+28>>2];d=H[g+32>>2]}H[g>>2]=0;d=d-h>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}H[g+32>>2]=(e<<2)+h;break c}Pa(g+16|12,e-d|0,g)}H[g>>2]=0;f=H[g+40>>2];d=H[g+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}H[g+44>>2]=f+(e<<2);break d}Pa(g+40|0,e-d|0,g)}H[g>>2]=0;f=H[g+52>>2];d=H[g+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}H[g+56>>2]=f+(e<<2);break e}Pa(g+52|0,e-d|0,g)}f:{if(H[a+8>>2]<=0){break f}i=H[g+16>>2];j=H[a+32>>2];h=0;while(1){d=h<<2;f=H[d+i>>2];m=H[a+16>>2];g:{if((f|0)>(m|0)){H[d+j>>2]=m;break g}d=d+j|0;m=H[a+12>>2];if((m|0)>(f|0)){H[d>>2]=m;break g}H[d>>2]=f}h=h+1|0;d=H[a+8>>2];if((h|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){i=d<<2;f=i+c|0;i=H[b+i>>2]+H[j+i>>2]|0;H[f>>2]=i;h:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break h}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}G=H[a+52>>2];t=H[a+48>>2];z=pa(16);d=z;H[d>>2]=0;H[d+4>>2]=0;H[d+8>>2]=0;H[d+12>>2]=0;H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;r=pa(d);H[g>>2]=r;H[g+8>>2]=d+r;ra(r,0,d)}A=1;d=H[a+56>>2];B=H[d>>2];d=H[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;F=e-1|0;L=e<<2;M=e>>>0<4;A=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=H[(m<<2)+B>>2];if((f|0)==-1){break p}k=1;d=f+2|0;j=(f>>>0)%3|0;x=j?f-1|0:d;s=1<>2];O=n+(x>>>3&536870908)|0;i=0;P=(j|0)!=0|(d|0)!=-1;d=f;q:{while(1){r:{if(H[n+(d>>>3&536870908)>>2]>>>d&1){break r}j=H[H[H[t+64>>2]+12>>2]+(d<<2)>>2];if((j|0)==-1){break r}l=H[G>>2];h=H[t+28>>2];p=H[l+(H[h+(j<<2)>>2]<<2)>>2];if((p|0)>=(m|0)){break r}q=j+1|0;q=H[l+(H[h+(((q>>>0)%3|0?q:j-2|0)<<2)>>2]<<2)>>2];if((q|0)>=(m|0)){break r}h=H[l+(H[h+(j+((j>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((h|0)>=(m|0)){break r}s:{if(!e){break s}j=H[(g+16|0)+N(i,12)>>2];l=N(e,h);q=N(e,q);p=N(e,p);h=0;o=0;if(F){while(1){H[j+(h<<2)>>2]=(H[(h+l<<2)+c>>2]+H[(h+q<<2)+c>>2]|0)-H[(h+p<<2)+c>>2];u=h|1;H[j+(u<<2)>>2]=(H[(l+u<<2)+c>>2]+H[(q+u<<2)+c>>2]|0)-H[(p+u<<2)+c>>2];h=h+2|0;o=o+2|0;if((C|0)!=(o|0)){continue}break}}if(!D){break s}H[j+(h<<2)>>2]=(H[(h+l<<2)+c>>2]+H[(h+q<<2)+c>>2]|0)-H[(h+p<<2)+c>>2]}j=4;i=i+1|0;if((i|0)==4){break q}}t:{if(k&1){h=d-2|0;j=d+1|0;d=-1;j=(j>>>0)%3|0?j:h;if((j|0)==-1|H[n+(j>>>3&536870908)>>2]>>>j&1){break t}j=H[H[H[t+64>>2]+12>>2]+(j<<2)>>2];if((j|0)==-1){break t}d=j+1|0;d=(d>>>0)%3|0?d:j-2|0;break t}u:{if((d>>>0)%3|0){h=d-1|0;break u}h=d+2|0;d=-1;if((h|0)==-1){break t}}d=-1;if(H[n+(h>>>3&536870908)>>2]>>>h&1){break t}j=H[H[H[t+64>>2]+12>>2]+(h<<2)>>2];if((j|0)==-1){break t}if((j>>>0)%3|0){d=j-1|0;break t}d=j+2|0}v:{if((d|0)==(f|0)){break v}if((d|0)==-1&k){if(!P|s&H[O>>2]){break v}d=H[H[H[t+64>>2]+12>>2]+(x<<2)>>2];if((d|0)==-1){break v}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}j=i;if((j|0)<=0){break p}}if(e){ra(r,0,L)}d=j-1|0;q=(d<<2)+z|0;d=N(d,12)+a|0;u=d;x=H[d- -64>>2];k=0;d=H[g>>2];f=0;while(1){i=H[q>>2];H[q>>2]=i+1;if(i>>>0>=x>>>0){break j}w:{if(H[H[u+60>>2]+(i>>>3&536870908)>>2]>>>i&1){break w}f=f+1|0;if(!e){break w}n=H[(g+16|0)+N(k,12)>>2];i=0;h=0;p=0;if(!M){while(1){l=h<<2;o=l+d|0;H[o>>2]=H[l+n>>2]+H[o>>2];o=l|4;s=o+d|0;H[s>>2]=H[n+o>>2]+H[s>>2];o=l|8;s=o+d|0;H[s>>2]=H[n+o>>2]+H[s>>2];l=l|12;o=l+d|0;H[o>>2]=H[l+n>>2]+H[o>>2];h=h+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break w}while(1){l=h<<2;p=l+d|0;H[p>>2]=H[l+n>>2]+H[p>>2];h=h+1|0;i=i+1|0;if((E|0)!=(i|0)){continue}break}}k=k+1|0;if((k|0)!=(j|0)){continue}break}i=N(e,m);if(!f){break o}if(!e){break l}h=0;d=0;if(F){break n}break m}i=N(e,m)}if(H[a+8>>2]<=0){break k}k=(N(m-1|0,e)<<2)+c|0;j=H[y>>2];h=0;while(1){d=h<<2;f=H[d+k>>2];n=H[a+16>>2];x:{if((f|0)>(n|0)){H[d+j>>2]=n;break x}d=d+j|0;n=H[a+12>>2];if((n|0)>(f|0)){H[d>>2]=n;break x}H[d>>2]=f}h=h+1|0;f=H[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=H[i+k>>2]+H[j+i>>2]|0;H[f>>2]=i;y:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break y}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}break k}Ca();v()}while(1){j=h<<2;k=j+r|0;H[k>>2]=H[k>>2]/(f|0);j=(j|4)+r|0;H[j>>2]=H[j>>2]/(f|0);h=h+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(h<<2)+r|0;H[d>>2]=H[d>>2]/(f|0)}if(H[a+8>>2]<=0){break k}j=H[y>>2];h=0;while(1){d=h<<2;f=H[d+r>>2];k=H[a+16>>2];z:{if((f|0)>(k|0)){H[d+j>>2]=k;break z}d=d+j|0;k=H[a+12>>2];if((k|0)>(f|0)){H[d>>2]=k;break z}H[d>>2]=f}h=h+1|0;f=H[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=H[i+k>>2]+H[j+i>>2]|0;H[f>>2]=i;A:{if((i|0)>H[a+16>>2]){i=i-H[a+20>>2]|0}else{if((i|0)>=H[a+12>>2]){break A}i=i+H[a+20>>2]|0}H[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;A=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=H[g>>2];if(a){oa(a)}oa(z);a=H[g+52>>2];if(a){H[g+56>>2]=a;oa(a)}a=H[g+40>>2];if(a){H[g+44>>2]=a;oa(a)}a=H[g+28>>2];if(a){H[g+32>>2]=a;oa(a)}a=H[g+16>>2];if(a){H[g+20>>2]=a;oa(a)}ca=g- -64|0;return A|0}sa();v()}function oj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,I=0,J=0,K=0,L=0,M=0;h=ca+-64|0;ca=h;H[a+8>>2]=e;x=a+32|0;f=H[x>>2];d=H[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){ya(x,e-d|0);H[h+56>>2]=0;H[h+60>>2]=0;H[h+48>>2]=0;H[h+52>>2]=0;H[h+40>>2]=0;H[h+44>>2]=0;H[h+32>>2]=0;H[h+36>>2]=0;H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h>>2]=0;break b}if(d>>>0>e>>>0){H[a+36>>2]=f+(e<<2)}H[h+56>>2]=0;H[h+60>>2]=0;H[h+48>>2]=0;H[h+52>>2]=0;H[h+40>>2]=0;H[h+44>>2]=0;H[h+32>>2]=0;H[h+36>>2]=0;H[h+24>>2]=0;H[h+28>>2]=0;H[h+16>>2]=0;H[h+20>>2]=0;H[h>>2]=0;d=0;if(!e){break a}}Pa(h+16|0,e,h);i=H[h+28>>2];d=H[h+32>>2]}H[h>>2]=0;d=d-i>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}H[h+32>>2]=(e<<2)+i;break c}Pa(h+16|12,e-d|0,h)}H[h>>2]=0;f=H[h+40>>2];d=H[h+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}H[h+44>>2]=f+(e<<2);break d}Pa(h+40|0,e-d|0,h)}H[h>>2]=0;f=H[h+52>>2];d=H[h+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}H[h+56>>2]=f+(e<<2);break e}Pa(h+52|0,e-d|0,h)}f:{if(H[a+8>>2]<=0){break f}g=H[h+16>>2];j=H[a+32>>2];i=0;while(1){d=i<<2;f=H[d+g>>2];m=H[a+16>>2];g:{if((f|0)>(m|0)){H[d+j>>2]=m;break g}d=d+j|0;m=H[a+12>>2];if((m|0)>(f|0)){H[d>>2]=m;break g}H[d>>2]=f}i=i+1|0;d=H[a+8>>2];if((i|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){g=d<<2;f=g+c|0;g=H[b+g>>2]+H[g+j>>2]|0;H[f>>2]=g;h:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break h}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}G=H[a+52>>2];A=H[a+48>>2];y=pa(16);d=y;H[d>>2]=0;H[d+4>>2]=0;H[d+8>>2]=0;H[d+12>>2]=0;H[h+8>>2]=0;H[h>>2]=0;H[h+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;t=pa(d);H[h>>2]=t;H[h+8>>2]=d+t;ra(t,0,d)}z=1;d=H[a+56>>2];B=H[d>>2];d=H[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;F=e-1|0;L=e<<2;M=e>>>0<4;z=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=H[(m<<2)+B>>2];if((f|0)==-1){break p}n=H[A+12>>2];d=f+2|0;g=(f>>>0)%3|0;q=n+((g?f-1|0:d)<<2)|0;j=0;u=(g|0)!=0|(d|0)!=-1;k=1;d=f;q:{while(1){g=H[n+(d<<2)>>2];r:{if((g|0)==-1){break r}l=-1;p=H[G>>2];r=H[A>>2];i=p+(H[r+(g<<2)>>2]<<2)|0;o=g+1|0;o=(o>>>0)%3|0?o:g-2|0;if((o|0)!=-1){l=H[r+(o<<2)>>2]}o=H[i>>2];s:{t:{if((g>>>0)%3|0){i=g-1|0;break t}i=g+2|0;s=-1;if((i|0)==-1){break s}}s=H[r+(i<<2)>>2]}if((m|0)<=(o|0)){break r}i=H[p+(l<<2)>>2];if((i|0)>=(m|0)){break r}l=H[p+(s<<2)>>2];if((l|0)>=(m|0)){break r}g=H[(h+16|0)+N(j,12)>>2];u:{if(!e){break u}l=N(e,l);r=N(e,i);p=N(e,o);i=0;s=0;if(F){while(1){H[g+(i<<2)>>2]=(H[(i+l<<2)+c>>2]+H[(i+r<<2)+c>>2]|0)-H[(i+p<<2)+c>>2];o=i|1;H[g+(o<<2)>>2]=(H[(l+o<<2)+c>>2]+H[(o+r<<2)+c>>2]|0)-H[(o+p<<2)+c>>2];i=i+2|0;s=s+2|0;if((C|0)!=(s|0)){continue}break}}if(!D){break u}H[g+(i<<2)>>2]=(H[(i+l<<2)+c>>2]+H[(i+r<<2)+c>>2]|0)-H[(i+p<<2)+c>>2]}g=4;j=j+1|0;if((j|0)==4){break q}}v:{if(k&1){i=d+1|0;d=(i>>>0)%3|0?i:d-2|0;g=-1;if((d|0)==-1){break v}d=H[n+(d<<2)>>2];g=-1;if((d|0)==-1){break v}g=d+1|0;g=(g>>>0)%3|0?g:d-2|0;break v}w:{if((d>>>0)%3|0){i=d-1|0;break w}i=d+2|0;g=-1;if((i|0)==-1){break v}}d=H[n+(i<<2)>>2];g=-1;if((d|0)==-1){break v}g=d-1|0;if((d>>>0)%3|0){break v}g=d+2|0}d=g;x:{if((f|0)==(d|0)){break x}if((d|0)==-1&k){if(!u){break x}d=H[q>>2];if((d|0)==-1){break x}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}g=j;if((g|0)<=0){break p}}if(e){ra(t,0,L)}d=g-1|0;r=(d<<2)+y|0;d=N(d,12)+a|0;o=d;s=H[d- -64>>2];k=0;d=H[h>>2];f=0;while(1){j=H[r>>2];H[r>>2]=j+1;if(j>>>0>=s>>>0){break j}y:{if(H[H[o+60>>2]+(j>>>3&536870908)>>2]>>>j&1){break y}f=f+1|0;if(!e){break y}j=H[(h+16|0)+N(k,12)>>2];l=0;i=0;p=0;if(!M){while(1){n=i<<2;q=n+d|0;H[q>>2]=H[j+n>>2]+H[q>>2];q=n|4;u=q+d|0;H[u>>2]=H[j+q>>2]+H[u>>2];q=n|8;u=q+d|0;H[u>>2]=H[j+q>>2]+H[u>>2];n=n|12;q=n+d|0;H[q>>2]=H[j+n>>2]+H[q>>2];i=i+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break y}while(1){n=i<<2;p=n+d|0;H[p>>2]=H[j+n>>2]+H[p>>2];i=i+1|0;l=l+1|0;if((E|0)!=(l|0)){continue}break}}k=k+1|0;if((k|0)!=(g|0)){continue}break}g=N(e,m);if(!f){break o}if(!e){break l}i=0;d=0;if(F){break n}break m}g=N(e,m)}if(H[a+8>>2]<=0){break k}k=(N(m-1|0,e)<<2)+c|0;j=H[x>>2];i=0;while(1){d=i<<2;f=H[d+k>>2];l=H[a+16>>2];z:{if((f|0)>(l|0)){H[d+j>>2]=l;break z}d=d+j|0;l=H[a+12>>2];if((l|0)>(f|0)){H[d>>2]=l;break z}H[d>>2]=f}i=i+1|0;f=H[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=H[g+k>>2]+H[g+j>>2]|0;H[f>>2]=g;A:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break A}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}break k}Ca();v()}while(1){j=i<<2;k=j+t|0;H[k>>2]=H[k>>2]/(f|0);j=(j|4)+t|0;H[j>>2]=H[j>>2]/(f|0);i=i+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(i<<2)+t|0;H[d>>2]=H[d>>2]/(f|0)}if(H[a+8>>2]<=0){break k}j=H[x>>2];i=0;while(1){d=i<<2;f=H[d+t>>2];k=H[a+16>>2];B:{if((f|0)>(k|0)){H[d+j>>2]=k;break B}d=d+j|0;k=H[a+12>>2];if((k|0)>(f|0)){H[d>>2]=k;break B}H[d>>2]=f}i=i+1|0;f=H[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=H[g+k>>2]+H[g+j>>2]|0;H[f>>2]=g;C:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break C}g=g+H[a+20>>2]|0}H[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;z=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=H[h>>2];if(a){oa(a)}oa(y);a=H[h+52>>2];if(a){H[h+56>>2]=a;oa(a)}a=H[h+40>>2];if(a){H[h+44>>2]=a;oa(a)}a=H[h+28>>2];if(a){H[h+32>>2]=a;oa(a)}a=H[h+16>>2];if(a){H[h+20>>2]=a;oa(a)}ca=h- -64|0;return z|0}sa();v()}function Od(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0;i=ca-80|0;ca=i;H[i+76>>2]=b;y=i+55|0;r=i+56|0;a:{b:{c:{d:{e:while(1){h=b;if((o^2147483647)<(f|0)){break d}o=f+o|0;f:{g:{h:{f=h;g=I[f|0];if(g){while(1){i:{b=g&255;j:{if(!b){b=f;break j}if((b|0)!=37){break i}g=f;while(1){if(I[g+1|0]!=37){b=g;break j}f=f+1|0;j=I[g+2|0];b=g+2|0;g=b;if((j|0)==37){continue}break}}f=f-h|0;x=o^2147483647;if((f|0)>(x|0)){break d}if(a){Ab(a,h,f)}if(f){continue e}H[i+76>>2]=b;f=b+1|0;p=-1;if(!(I[b+2|0]!=36|F[b+1|0]-48>>>0>=10)){p=F[b+1|0]-48|0;s=1;f=b+3|0}H[i+76>>2]=f;n=0;g=F[f|0];b=g-32|0;k:{if(b>>>0>31){k=f;break k}k=f;b=1<>2]=k;n=b|n;g=F[f+1|0];b=g-32|0;if(b>>>0>=32){break k}f=k;b=1<>>0>=10)){H[((F[k+1|0]<<2)+e|0)-192>>2]=10;g=k+3|0;s=1;b=H[((F[k+1|0]<<3)+d|0)-384>>2];break m}if(s){break h}g=k+1|0;if(!a){H[i+76>>2]=g;s=0;q=0;break l}b=H[c>>2];H[c>>2]=b+4;s=0;b=H[b>>2]}H[i+76>>2]=g;q=b;if((b|0)>=0){break l}q=0-q|0;n=n|8192;break l}q=Nd(i+76|0);if((q|0)<0){break d}g=H[i+76>>2]}f=0;m=-1;n:{if(I[g|0]!=46){b=g;u=0;break n}if(I[g+1|0]==42){o:{if(!(I[g+3|0]!=36|F[g+2|0]-48>>>0>=10)){H[((F[g+2|0]<<2)+e|0)-192>>2]=10;b=g+4|0;m=H[((F[g+2|0]<<3)+d|0)-384>>2];break o}if(s){break h}b=g+2|0;m=0;if(!a){break o}j=H[c>>2];H[c>>2]=j+4;m=H[j>>2]}H[i+76>>2]=b;u=(m^-1)>>>31|0;break n}H[i+76>>2]=g+1;m=Nd(i+76|0);b=H[i+76>>2];u=1}while(1){g=f;k=28;l=b;f=F[b|0];if(f-123>>>0<4294967238){break c}b=l+1|0;f=I[(f+N(g,58)|0)+13711|0];if(f-1>>>0<8){continue}break}H[i+76>>2]=b;p:{q:{if((f|0)!=27){if(!f){break c}if((p|0)>=0){H[(p<<2)+e>>2]=f;j=(p<<3)+d|0;f=H[j+4>>2];H[i+64>>2]=H[j>>2];H[i+68>>2]=f;break q}if(!a){break f}Md(i- -64|0,f,c);break p}if((p|0)>=0){break c}}f=0;if(!a){continue e}}j=n&-65537;n=n&8192?j:n;p=0;t=1132;k=r;r:{s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{f=F[l|0];f=g?(f&15)==3?f&-33:f:f;switch(f-88|0){case 11:break r;case 9:case 13:case 14:case 15:break s;case 27:break x;case 12:case 17:break A;case 23:break B;case 0:case 32:break C;case 24:break D;case 22:break E;case 29:break F;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break g;default:break G}}H:{switch(f-65|0){case 0:case 4:case 5:case 6:break s;case 2:break v;case 1:case 3:break g;default:break H}}if((f|0)==83){break w}break g}l=H[i+64>>2];j=H[i+68>>2];t=1132;break z}f=0;I:{switch(g&255){case 0:H[H[i+64>>2]>>2]=o;continue e;case 1:H[H[i+64>>2]>>2]=o;continue e;case 2:h=H[i+64>>2];H[h>>2]=o;H[h+4>>2]=o>>31;continue e;case 3:G[H[i+64>>2]>>1]=o;continue e;case 4:F[H[i+64>>2]]=o;continue e;case 6:H[H[i+64>>2]>>2]=o;continue e;case 7:break I;default:continue e}}h=H[i+64>>2];H[h>>2]=o;H[h+4>>2]=o>>31;continue e}m=m>>>0<=8?8:m;n=n|8;f=120}h=r;l=H[i+64>>2];j=H[i+68>>2];if(l|j){z=f&32;while(1){h=h-1|0;F[h|0]=z|I[(l&15)+14240|0];w=!j&l>>>0>15|(j|0)!=0;g=j;j=g>>>4|0;l=(g&15)<<28|l>>>4;if(w){continue}break}}if(!(H[i+64>>2]|H[i+68>>2])|!(n&8)){break y}t=(f>>>4|0)+1132|0;p=2;break y}f=r;h=H[i+68>>2];j=h;l=H[i+64>>2];if(h|l){while(1){f=f-1|0;F[f|0]=l&7|48;g=!j&l>>>0>7|(j|0)!=0;h=j;j=h>>>3|0;l=(h&7)<<29|l>>>3;if(g){continue}break}}h=f;if(!(n&8)){break y}f=r-h|0;m=(f|0)<(m|0)?m:f+1|0;break y}l=H[i+64>>2];h=H[i+68>>2];j=h;if((h|0)<0){f=0-(((l|0)!=0)+j|0)|0;j=f;l=0-l|0;H[i+64>>2]=l;H[i+68>>2]=f;p=1;t=1132;break z}if(n&2048){p=1;t=1133;break z}p=n&1;t=p?1134:1132}g=r;if(j){while(1){g=g-1|0;f=j;w=Tj(l,f,10,0);h=da;A=g,B=l-Rj(w,h,10,0)|48,F[A|0]=B;l=w;j=h;if(f>>>0>9){continue}break}}h=l;if(h){while(1){g=g-1|0;f=(h>>>0)/10|0;F[g|0]=h-N(f,10)|48;j=h>>>0>9;h=f;if(j){continue}break}}h=g}if((m|0)<0?u:0){break d}n=u?n&-65537:n;f=H[i+64>>2];j=H[i+68>>2];if(!(m|(f|j)!=0)){h=r;m=0;break g}f=!(f|j)+(r-h|0)|0;m=(f|0)<(m|0)?m:f;break g}g=m>>>0>=2147483647?2147483647:m;k=g;n=(g|0)!=0;h=H[i+64>>2];h=h?h:1614;f=h;J:{K:{L:{M:{if(!(f&3)|!g){break M}while(1){if(!I[f|0]){break L}k=k-1|0;n=(k|0)!=0;f=f+1|0;if(!(f&3)){break M}if(k){continue}break}}if(!n){break K}if(!(!I[f|0]|k>>>0<4)){while(1){l=H[f>>2];if((l^-1)&l-16843009&-2139062144){break L}f=f+4|0;k=k-4|0;if(k>>>0>3){continue}break}}if(!k){break K}}while(1){if(!I[f|0]){break J}f=f+1|0;k=k-1|0;if(k){continue}break}}f=0}f=f?f-h|0:g;k=f+h|0;if((m|0)>=0){n=j;m=f;break g}n=j;m=f;if(I[k|0]){break d}break g}if(m){g=H[i+64>>2];break u}f=0;ib(a,32,q,0,n);break t}H[i+12>>2]=0;H[i+8>>2]=H[i+64>>2];g=i+8|0;H[i+64>>2]=g;m=-1}f=0;N:{while(1){h=H[g>>2];if(!h){break N}j=Ld(i+4|0,h);h=(j|0)<0;if(!(h|j>>>0>m-f>>>0)){g=g+4|0;f=f+j|0;if(m>>>0>f>>>0){continue}break N}break}if(h){break b}}k=61;if((f|0)<0){break c}ib(a,32,q,f,n);if(!f){f=0;break t}k=0;g=H[i+64>>2];while(1){h=H[g>>2];if(!h){break t}h=Ld(i+4|0,h);k=h+k|0;if(k>>>0>f>>>0){break t}Ab(a,i+4|0,h);g=g+4|0;if(f>>>0>k>>>0){continue}break}}ib(a,32,q,f,n^8192);f=(f|0)<(q|0)?q:f;continue e}if((m|0)<0?u:0){break d}v()}F[i+55|0]=H[i+64>>2];m=1;h=y;n=j;break g}g=I[f+1|0];f=f+1|0;continue}}if(a){break a}if(!s){break f}f=1;while(1){a=H[(f<<2)+e>>2];if(a){Md((f<<3)+d|0,a,c);o=1;f=f+1|0;if((f|0)!=10){continue}break a}break}o=1;if(f>>>0>=10){break a}while(1){if(H[(f<<2)+e>>2]){break h}f=f+1|0;if((f|0)!=10){continue}break}break a}k=28;break c}l=k-h|0;j=(m|0)>(l|0)?m:l;if((j|0)>(p^2147483647)){break d}k=61;g=j+p|0;f=(g|0)<(q|0)?q:g;if((x|0)<(f|0)){break c}ib(a,32,f,g,n);Ab(a,t,p);ib(a,48,f,g,n^65536);ib(a,48,j,l,0);Ab(a,h,l);ib(a,32,f,g,n^8192);continue}break}o=0;break a}k=61}H[3992]=k}o=-1}ca=i+80|0;return o}function hj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;a:{b:{if((e|0)!=2){break b}H[a+8>>2]=2;H[a- -64>>2]=f;M=a+32|0;e=H[M>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}i=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){f=H[a+56>>2];e=H[f>>2];if(H[f+4>>2]-e>>2>>>0<=d>>>0){break a}k=ca-80|0;ca=k;f=-1;d:{e:{e=H[e+(d<<2)>>2];if((e|0)==-1){break e}i=H[o+32>>2];g=e+1|0;g=(g>>>0)%3|0?g:e-2|0;if((g|0)!=-1){f=H[H[i>>2]+(g<<2)>>2]}p=-1;e=e+((e>>>0)%3|0?-1:2)|0;if((e|0)!=-1){p=H[H[i>>2]+(e<<2)>>2]}i=H[o+36>>2];e=H[i>>2];i=H[i+4>>2]-e>>2;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0){continue}break}}f=H[o+20>>2];if(!f){break f}g=f-1|0;h=H[H[o+16>>2]+(g>>>3&536870908)>>2];H[o+20>>2]=g;p=1;f=Rj(j,q,y,w);i=da;n=Rj(r,s,K,S);m=n+f|0;f=da+i|0;f=m>>>0>>0?f+1|0:f;i=Rj(l,e,D,W);g=h>>>g&1;h=g?0-i|0:i;m=h+m|0;n=f;f=da;i=n+(g?0-(f+((i|0)!=0)|0)|0:f)|0;Z=o,_=Sj(m,h>>>0>m>>>0?i+1|0:i,r,s),H[Z+12>>2]=_;f=Rj(j,q,D,W);i=da;j=Rj(r,s,Q,R);f=j+f|0;h=da+i|0;e=Rj(l,e,y,w);i=0-e|0;l=da;h=(f>>>0>>0?h+1|0:h)+(g?l:0-(((e|0)!=0)+l|0)|0)|0;i=g?e:i;f=i+f|0;Z=o,_=Sj(f,f>>>0>>0?h+1|0:h,r,s),H[Z+8>>2]=_}ca=k+80|0;e=p;break d}Ca();v()}i=e;if(!e){return 0}l:{if(H[a+8>>2]<=0){break l}l=H[M>>2];e=0;while(1){f=e<<2;g=H[f+Y>>2];j=H[a+16>>2];m:{if((g|0)>(j|0)){H[f+l>>2]=j;break m}f=f+l|0;j=H[a+12>>2];if((j|0)>(g|0)){H[f>>2]=j;break m}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break l}e=d<<3;j=e+c|0;q=b+e|0;while(1){g=f<<2;e=g+j|0;g=H[g+q>>2]+H[g+l>>2]|0;H[e>>2]=g;n:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break n}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return i|0}Ca();v()}function xj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0;a:{b:{if((e|0)!=2){break b}H[a+8>>2]=2;H[a- -64>>2]=f;M=a+32|0;e=H[M>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}p=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){e=H[a+56>>2];h=H[e>>2];if(H[e+4>>2]-h>>2>>>0<=d>>>0){break a}k=ca-80|0;ca=k;f=-1;h=H[h+(d<<2)>>2];e=-1;d:{if((h|0)==-1){break d}e=h+1|0;f=(e>>>0)%3|0?e:h-2|0;e=h-1|0;if((h>>>0)%3|0){break d}e=h+2|0}g=H[o+36>>2];h=H[g>>2];e:{f:{g:{h:{i:{g=H[g+4>>2]-h>>2;i=f<<2;f=H[H[o+32>>2]+28>>2];j=H[i+f>>2];if(g>>>0<=j>>>0){break i}e=H[f+(e<<2)>>2];if(e>>>0>=g>>>0){break i}j:{k:{l=H[h+(e<<2)>>2];f=H[h+(j<<2)>>2];if((l|0)>=(d|0)|(f|0)>=(d|0)){break k}h=(l<<3)+c|0;w=H[h+4>>2];g=(f<<3)+c|0;e=H[g+4>>2];j=H[h>>2];h=H[g>>2];if(!((j|0)!=(h|0)|(e|0)!=(w|0))){H[o+8>>2]=h;H[o+12>>2]=e;break j}p=H[H[o+4>>2]+(d<<2)>>2];H[k+72>>2]=0;H[k+76>>2]=0;g=k- -64|0;H[g>>2]=0;H[g+4>>2]=0;H[k+56>>2]=0;H[k+60>>2]=0;g=H[o>>2];if(!I[g+84|0]){p=H[H[g+68>>2]+(p<<2)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+1|0:g;i=f-h|0;f=U-((f>>>0>>0)+g|0)|0;g=Rj(i,f,i,f);h=g+n|0;f=da+x|0;f=h>>>0>>0?f+1|0:f;n=h;g=Sj(Rj(l,q,C,J),da,r,s);h=g+B|0;i=da+P|0;i=h>>>0>>0?i+1|0:i;g=m-h|0;h=V-((h>>>0>m>>>0)+i|0)|0;m=Rj(g,h,g,h);h=m+n|0;g=da+f|0;f=Rj(h,h>>>0>>0?g+1|0:g,r,s);h=da;m=h;if(!h&f>>>0<=1){break h}i=f;while(1){g=e<<1|j>>>31;j=j<<1;e=g;n=!h&i>>>0>7|(h|0)!=0;i=(h&3)<<30|i>>>2;h=h>>>2|0;if(n){continue}break}break g}if((d|0)>(f|0)){e=f<<1}else{if((d|0)<=0){H[o+8>>2]=0;H[o+12>>2]=0;break j}e=(d<<1)-2|0}e=(e<<2)+c|0;H[o+8>>2]=H[e>>2];H[o+12>>2]=H[e+4>>2]}p=1;break e}Ca();v()}e=m;j=f;if(f-1|0){break f}}while(1){h=Tj(f,m,j,e);i=e+da|0;e=h+j|0;i=e>>>0>>0?i+1|0:i;j=(i&1)<<31|e>>>1;e=i>>>1|0;h=Rj(j,e,j,e);g=da;if((m|0)==(g|0)&f>>>0>>0|g>>>0>m>>>0){continue}break}}f=H[o+20>>2];if(!f){break e}g=f-1|0;i=H[H[o+16>>2]+(g>>>3&536870908)>>2];H[o+20>>2]=g;p=1;f=Rj(l,q,y,w);h=da;n=Rj(r,s,K,S);m=n+f|0;f=da+h|0;f=m>>>0>>0?f+1|0:f;h=Rj(j,e,D,W);g=i>>>g&1;i=g?0-h|0:h;m=i+m|0;n=f;f=da;h=n+(g?0-(f+((h|0)!=0)|0)|0:f)|0;Z=o,_=Sj(m,i>>>0>m>>>0?h+1|0:h,r,s),H[Z+12>>2]=_;f=Rj(l,q,D,W);h=da;l=Rj(r,s,Q,R);f=l+f|0;i=da+h|0;e=Rj(j,e,y,w);h=0-e|0;j=da;i=(f>>>0>>0?i+1|0:i)+(g?j:0-(((e|0)!=0)+j|0)|0)|0;h=g?e:h;f=h+f|0;Z=o,_=Sj(f,f>>>0>>0?i+1|0:i,r,s),H[Z+8>>2]=_}ca=k+80|0;if(!p){return 0}l:{if(H[a+8>>2]<=0){break l}g=H[M>>2];e=0;while(1){f=e<<2;h=H[f+Y>>2];j=H[a+16>>2];m:{if((h|0)>(j|0)){H[f+g>>2]=j;break m}f=f+g|0;j=H[a+12>>2];if((j|0)>(h|0)){H[f>>2]=j;break m}H[f>>2]=h}e=e+1|0;h=H[a+8>>2];if((e|0)<(h|0)){continue}break}f=0;if((h|0)<=0){break l}e=d<<3;j=e+c|0;l=b+e|0;while(1){h=f<<2;e=h+j|0;h=H[h+l>>2]+H[h+g>>2]|0;H[e>>2]=h;n:{if((h|0)>H[a+16>>2]){i=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break n}i=h+H[a+20>>2]|0}H[e>>2]=i}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return p|0}Ca();v()}function $a(a,b){var c=0,d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=a+16|0;H[d>>2]=0;H[d+4>>2]=0;F[d+5|0]=0;F[d+6|0]=0;F[d+7|0]=0;F[d+8|0]=0;F[d+9|0]=0;F[d+10|0]=0;F[d+11|0]=0;F[d+12|0]=0;c=d+16|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+32|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+48|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;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+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c=d+480|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;d=d+496|0;H[d>>2]=0;H[d+4>>2]=0;F[d+5|0]=0;F[d+6|0]=0;F[d+7|0]=0;F[d+8|0]=0;F[d+9|0]=0;F[d+10|0]=0;F[d+11|0]=0;F[d+12|0]=0;H[a+528>>2]=0;H[a+532>>2]=0;F[a+533|0]=0;F[a+534|0]=0;F[a+535|0]=0;F[a+536|0]=0;F[a+537|0]=0;F[a+538|0]=0;F[a+539|0]=0;F[a+540|0]=0;H[a+544>>2]=0;H[a+548>>2]=0;H[a+560>>2]=0;H[a+552>>2]=0;H[a+556>>2]=0;H[a+564>>2]=0;H[a+568>>2]=0;H[a+580>>2]=0;H[a+572>>2]=0;H[a+576>>2]=0;H[a+584>>2]=0;H[a+588>>2]=0;H[a+600>>2]=0;H[a+592>>2]=0;H[a+596>>2]=0;H[a+612>>2]=0;H[a+604>>2]=0;H[a+608>>2]=0;g=a+628|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+616>>2]=0;H[a+620>>2]=0;H[a+624>>2]=0;H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;d=1;break a}d=b<<2;c=pa(d);H[a+604>>2]=c;f=c+d|0;H[a+612>>2]=f;ra(c,0,d);H[a+624>>2]=0;H[a+616>>2]=0;H[a+620>>2]=0;H[a+608>>2]=f;c=pa(d);H[a+616>>2]=c;f=c+d|0;H[a+624>>2]=f;ra(c,0,d);H[a+620>>2]=f;c=pa(d);H[e>>2]=c;f=c+d|0;H[e+8>>2]=f;ra(c,0,d);H[e+4>>2]=f;d=b<<5|1}tb(g,d,e);c=H[e>>2];if(c){H[e+4>>2]=c;oa(c)}H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;if(b){b=b<<2;c=pa(b);H[e>>2]=c;f=b+c|0;H[e+8>>2]=f;ra(c,0,b);H[e+4>>2]=f}tb(a+640|0,d,e);b=H[e>>2];if(b){H[e+4>>2]=b;oa(b)}ca=e+16|0;return a}function gc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0),n=O(0),o=0;a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=G[b>>1];if((e|0)<0){break b}G[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e+32768>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>32767){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=H[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=H[b+4>>2];e=H[b>>2];i=e+32768|0;h=i>>>0<32768?h+1|0:h;if(!h&i>>>0>65535|h){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>32767|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(32767)|m>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(32767)|mO(1)){break d}e=(b<<1)+d|0;l=T(+m*32767+.5);f:{if(P(l)<2147483648){i=~~l;break f}i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ra((e<<1)+d|0,0,c-e<<1)}return j;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=32767|l<-32768|l!=l){break g}o=P(l);if(o==Infinity){break g}e=(b<<1)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=32767|l<-32768|(P(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<1)+d|0;l=T(l*32767+.5);i:{if(P(l)<2147483648){i=~~l;break i}i=-2147483648}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ra((e<<1)+d|0,0,c-e<<1)}return j;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ra((e<<1)+d|0,0,(c&255)-e<<1)}return j}ra((e<<1)+d|0,0,(c&255)-e<<1);return 1}function ec(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0),n=O(0),o=0;a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=G[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=H[b>>2];if((e|0)<0){break b}H[(g<<2)+d>>2]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=H[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=H[b+4>>2];e=H[b>>2];if(e- -2147483648>>>0<2147483648?h+1|0:h){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>2147483647|k){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(2147483648)|m>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(2147483648)|mO(1)){break d}e=(b<<2)+d|0;l=T(+m*2147483647+.5);f:{if(P(l)<2147483648){i=~~l;break f}i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ra((e<<2)+d|0,0,c-e<<2)}return j;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];j=H[e>>2];g=j;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-j|0;if(!I[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=2147483647|l<-2147483648|l!=l){break g}o=P(l);if(o==Infinity){break g}e=(b<<2)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=M[g>>3];if(l>=2147483647|l<-2147483648|(P(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<2)+d|0;l=T(l*2147483647+.5);i:{if(P(l)<2147483648){i=~~l;break i}i=-2147483648}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ra((e<<2)+d|0,0,c-e<<2)}return j;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ra((e<<2)+d|0,0,(c&255)-e<<2)}return j}ra((e<<2)+d|0,0,(c&255)-e<<2);return 1}function fc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=F[b|0];if((e|0)<0){break b}G[(g<<1)+d>>1]=e&255;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=G[b>>1];if((e|0)<0){break b}G[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(e>>>0>65535){break b}G[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>65535|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=H[b+4>>2];e=H[b>>2];if(!k&e>>>0>65535|k){break b}G[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];l=H[e>>2];g=l;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-l|0;if(!I[a+32|0]){l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(65535)|m=O(0)){i=~~m>>>0}else{i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(65535)|mO(1)){break d}e=(b<<1)+d|0;j=T(+m*65535+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=1;if(c>>>0<=e>>>0){break d}ra((e<<1)+d|0,0,c-e<<1)}return l;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];l=H[e>>2];g=l;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-l|0;if(!I[a+32|0]){l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=65535|j<0|(P(j)==Infinity|j!=j)){break g}e=(b<<1)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=65535|j<0|(P(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<1)+d|0;j=T(j*65535+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}G[e>>1]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=1;if(c>>>0<=e>>>0){break g}ra((e<<1)+d|0,0,c-e<<1)}return l;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];k=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}G[(g<<1)+d>>1]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}ra((e<<1)+d|0,0,(c&255)-e<<1)}return l}ra((e<<1)+d|0,0,(c&255)-e<<1);return 1}function Sa(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=O(0),l=0,m=0,n=O(0),o=0;a:{if(!d){break a}b:{c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=F[b|0];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=I[b|0];H[e+4>>2]=0;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=G[b>>1];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=J[b>>1];H[e+4>>2]=0;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=H[b>>2];H[e>>2]=i;H[e+4>>2]=i>>31;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=H[b>>2];H[e+4>>2]=0;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}i=H[b+4>>2];e=(g<<3)+d|0;H[e>>2]=H[b>>2];H[e+4>>2]=i;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=H[b>>2];i=H[b+4>>2];if((i|0)<0){break a}j=(g<<3)+d|0;H[j>>2]=e;H[j+4>>2]=i;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 8:d:{e=I[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break d}if(I[a+32|0]){break a}e=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+e|0;e=H[a>>2];i=H[e+4>>2];e=H[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){k=L[g>>2];if(k>=O(0x8000000000000000)|k=O(1)?~~(k>O(0)?O(R(O(T(O(k*O(2.3283064365386963e-10)))),O(4294967296))):O(U(O(O(k-O(~~k>>>0>>>0))*O(2.3283064365386963e-10)))))>>>0:0;m=~~k>>>0;break e}j=-2147483648;m=0}H[e>>2]=m;H[e+4>>2]=j;b=b+1|0;e=I[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break d}g=g+4|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 9:f:{e=I[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break f}if(I[a+32|0]){break a}e=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+e|0;e=H[a>>2];i=H[e+4>>2];e=H[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){l=M[g>>3];if(l>=0x8000000000000000|l<-0x8000000000000000|l!=l){break a}o=P(l);if(o==Infinity){break a}e=(b<<3)+d|0;g:{if(o<0x8000000000000000){j=P(l)>=1?~~(l>0?R(T(l*2.3283064365386963e-10),4294967295):U((l-+(~~l>>>0>>>0))*2.3283064365386963e-10))>>>0:0;m=~~l>>>0;break g}j=-2147483648;m=0}H[e>>2]=m;H[e+4>>2]=j;b=b+1|0;e=I[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break f}g=g+8|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;H[e>>2]=I[b|0];H[e+4>>2]=0;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0}ra(d,0,a<<3)}}function Oj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=a;a:{b:{c:{d:{e:{f:{g:{h:{a=H[a+8>>2];switch(H[a+28>>2]-1|0){case 4:break c;case 5:break d;case 2:break e;case 3:break f;case 0:break g;case 1:break h;default:break a}}f=I[a+24|0];c=pa(f);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;F[a+c|0]=H[k>>2];F[(a|1)+c|0]=H[k+4>>2];F[(a|2)+c|0]=H[k+8>>2];F[(a|3)+c|0]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[a+c|0]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}f=I[a+24|0];c=pa(f);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;F[a+c|0]=H[k>>2];F[(a|1)+c|0]=H[k+4>>2];F[(a|2)+c|0]=H[k+8>>2];F[(a|3)+c|0]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[a+c|0]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}h=I[a+24|0];i=h<<1;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;G[f+c>>1]=H[k>>2];G[(f|2)+c>>1]=H[k+4>>2];G[(f|4)+c>>1]=H[k+8>>2];G[(f|6)+c>>1]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){G[(a<<1)+c>>1]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<1;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;G[f+c>>1]=H[k>>2];G[(f|2)+c>>1]=H[k+4>>2];G[(f|4)+c>>1]=H[k+8>>2];G[(f|6)+c>>1]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){G[(a<<1)+c>>1]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<2;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;H[f+c>>2]=H[k>>2];H[(f|4)+c>>2]=H[k+4>>2];H[(f|8)+c>>2]=H[k+8>>2];H[(f|12)+c>>2]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){H[(a<<2)+c>>2]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=I[a+24|0];i=h<<2;c=pa(i);a=H[j+16>>2];if(H[a+80>>2]){g=H[H[a>>2]>>2]+H[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;H[f+c>>2]=H[k>>2];H[(f|4)+c>>2]=H[k+4>>2];H[(f|8)+c>>2]=H[k+8>>2];H[(f|12)+c>>2]=H[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){H[(a<<2)+c>>2]=H[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[H[H[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;qa(a+H[H[H[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}qa(H[H[H[j+8>>2]+64>>2]>>2]+a|0,c,i)}oa(c);c=1}return c|0}function dc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=F[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=G[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=J[b>>1];b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=H[b>>2];b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(H[b+4>>2]){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=H[b>>2];if(H[b+4>>2]){break b}H[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=H[a>>2];k=H[e>>2];g=k;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-k|0;if(!I[a+32|0]){k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(4294967296)|m=O(0)){i=~~m>>>0}else{i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=L[g>>2];if(m>=O(4294967296)|mO(1)){break d}e=(b<<2)+d|0;j=T(+m*4294967295+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=1;if(c>>>0<=e>>>0){break d}ra((e<<2)+d|0,0,c-e<<2)}return k;case 9:g:{h:{e=I[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=H[a>>2];k=H[e>>2];g=k;f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=H[e+4>>2];e=f-k|0;if(!I[a+32|0]){k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=4294967295|j<0|(P(j)==Infinity|j!=j)){break g}e=(b<<2)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=M[g>>3];if(j>=4294967295|j<0|(P(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<2)+d|0;j=T(j*4294967295+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}H[e>>2]=i;b=b+1|0;e=I[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=1;if(c>>>0<=e>>>0){break g}ra((e<<2)+d|0,0,c-e<<2)}return k;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];h=H[e>>2];l=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=H[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}H[(g<<2)+d>>2]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra((e<<2)+d|0,0,(c&255)-e<<2)}return k}ra((e<<2)+d|0,0,(c&255)-e<<2);return 1}function ye(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{b:{c:{d:{e:{if(H[a+92>>2]==H[a+88>>2]){break e}c=H[a+52>>2];f:{if((c|0)!=H[a+56>>2]){H[c>>2]=b;H[a+52>>2]=c+4;break f}h=H[a+48>>2];g=c-h|0;d=g>>2;f=d+1|0;if(f>>>0>=1073741824){break a}e=g>>>1|0;g=g>>>0>=2147483644?1073741823:f>>>0>>0?e:f;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}f=e+(d<<2)|0;H[f>>2]=b;d=f+4|0;if((c|0)!=(h|0)){while(1){f=f-4|0;c=c-4|0;H[f>>2]=H[c>>2];if((c|0)!=(h|0)){continue}break}}H[a+56>>2]=e+(g<<2);H[a+52>>2]=d;H[a+48>>2]=f;if(!h){break f}oa(h)}H[a+84>>2]=0;c=-1;e=-1;g:{if((b|0)==-1){break g}d=H[a+4>>2];e=b+1|0;e=(e>>>0)%3|0?e:b-2|0;if((e|0)!=-1){c=H[H[d>>2]+(e<<2)>>2]}h:{if((b>>>0)%3|0){l=b-1|0;break h}l=b+2|0;e=-1;if((l|0)==-1){break g}}e=H[H[d>>2]+(l<<2)>>2]}i=e>>>3&536870908;d=H[a+36>>2];h=d+(c>>>3&536870908)|0;g=H[h>>2];f=1<>2]=f|g;f=a+8|0;if((b|0)!=-1){d=b+1|0;d=(d>>>0)%3|0?d:b-2|0}else{d=-1}Ua(f,c,d);d=H[a+36>>2]}f=d+i|0;d=H[f>>2];c=1<>2]=c|d;d=a+8|0;c=-1;i:{if((b|0)==-1){break i}c=b-1|0;if((b>>>0)%3|0){break i}c=b+2|0}Ua(d,e,c)}c=-1;c=(b|0)!=-1?H[H[H[a+4>>2]>>2]+(b<<2)>>2]:c;f=H[a+36>>2]+(c>>>3&536870908)|0;d=H[f>>2];e=1<>2]=d|e;Ua(a+8|0,c,b)}d=H[a+84>>2];if((d|0)>2){break e}while(1){e=N(d,12)+a|0;b=H[e+52>>2];if((b|0)==H[e+48>>2]){d=d+1|0;if((d|0)!=3){continue}break e}b=b-4|0;c=H[b>>2];H[e+52>>2]=b;H[a+84>>2]=d;if((c|0)==-1){break e}f=H[a+24>>2];b=(c>>>0)/3|0;j:{if(H[f+(b>>>3&268435452)>>2]>>>b&1){break j}k:{while(1){k=(c>>>0)/3|0;b=(k>>>3&268435452)+f|0;H[b>>2]=H[b>>2]|1<>2]>>2]+(c<<2)>>2]:d;f=H[a+36>>2]+(d>>>3&536870908)|0;e=H[f>>2];b=1<>2]=b|e;i=H[(H[H[a+16>>2]+96>>2]+N(k,12)|0)+((c>>>0)%3<<2)>>2];l=H[H[a+20>>2]+4>>2];f=H[l+4>>2];t:{if((f|0)!=H[l+8>>2]){H[f>>2]=i;H[l+4>>2]=f+4;break t}j=H[l>>2];h=f-j|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break s}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=pa(h<<2)}else{e=0}b=e+(g<<2)|0;H[b>>2]=i;g=b+4|0;if((f|0)!=(j|0)){while(1){b=b-4|0;f=f-4|0;H[b>>2]=H[f>>2];if((f|0)!=(j|0)){continue}break}}H[l+8>>2]=e+(h<<2);H[l+4>>2]=g;H[l>>2]=b;if(!j){break t}oa(j)}j=H[a+12>>2];f=H[j+4>>2];u:{if((f|0)!=H[j+8>>2]){H[f>>2]=c;H[j+4>>2]=f+4;break u}i=H[j>>2];h=f-i|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break r}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=pa(h<<2)}else{e=0}b=e+(g<<2)|0;H[b>>2]=c;g=b+4|0;if((f|0)!=(i|0)){while(1){b=b-4|0;f=f-4|0;H[b>>2]=H[f>>2];if((f|0)!=(i|0)){continue}break}}H[j+8>>2]=e+(h<<2);H[j+4>>2]=g;H[j>>2]=b;if(!i){break u}oa(i)}b=H[a+12>>2];H[H[b+12>>2]+(d<<2)>>2]=H[b+24>>2];H[b+24>>2]=H[b+24>>2]+1}if((c|0)==-1){break k}g=H[a+4>>2];f=-1;b=c+1|0;b=(b>>>0)%3|0?b:c-2|0;if((b|0)!=-1){f=H[H[g+12>>2]+(b<<2)>>2]}v:{w:{if((N(k,3)|0)!=(c|0)){d=c-1|0;break w}d=c+2|0;c=-1;if((d|0)==-1){break v}}c=H[H[g+12>>2]+(d<<2)>>2]}d=(c|0)==-1;e=(c>>>0)/3|0;if((f|0)!=-1){b=(f>>>0)/3|0;b=H[H[a+24>>2]+(b>>>3&268435452)>>2]&1<>2]+(b>>>3&536870908)>>2]>>>b&1){break x}k=0;b=H[H[g>>2]+(c<<2)>>2];if(!(H[H[a+36>>2]+(b>>>3&536870908)>>2]>>>b&1)){b=H[a+88>>2]+(b<<2)|0;e=H[b>>2];H[b>>2]=e+1;k=(e|0)<=0?2:1}if(H[a+84>>2]>=(k|0)&l){break m}j=N(k,12)+a|0;b=H[j+52>>2];y:{if((b|0)!=H[j+56>>2]){H[b>>2]=c;H[j+52>>2]=b+4;break y}i=H[j+48>>2];h=b-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break c}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}d=e+(d<<2)|0;H[d>>2]=c;c=d+4|0;if((b|0)!=(i|0)){while(1){d=d-4|0;b=b-4|0;H[d>>2]=H[b>>2];if((b|0)!=(i|0)){continue}break}}H[j+48>>2]=d;H[j+52>>2]=c;H[j+56>>2]=e+(g<<2);if(!i){break y}oa(i)}if(H[a+84>>2]<=(k|0)){break x}H[a+84>>2]=k}if(l){break k}c=-1;if((f|0)==-1){break n}}c=H[H[H[a+4>>2]>>2]+(f<<2)>>2]}b=0;if(!(H[H[a+36>>2]+(c>>>3&536870908)>>2]>>>c&1)){b=H[a+88>>2]+(c<<2)|0;c=H[b>>2];H[b>>2]=c+1;b=(c|0)<=0?2:1}if(H[a+84>>2]<(b|0)){break l}c=f}f=H[a+24>>2];continue}break}k=N(b,12)+a|0;c=H[k+52>>2];z:{if((c|0)!=H[k+56>>2]){H[c>>2]=f;H[k+52>>2]=c+4;break z}i=H[k+48>>2];h=c-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break b}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=pa(g<<2)}else{e=0}d=e+(d<<2)|0;H[d>>2]=f;f=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;H[d>>2]=H[c>>2];if((c|0)!=(i|0)){continue}break}}H[k+48>>2]=d;H[k+52>>2]=f;H[k+56>>2]=e+(g<<2);if(!i){break z}oa(i)}d=H[a+84>>2];if((d|0)<=(b|0)){break j}H[a+84>>2]=b;d=b;break j}d=H[a+84>>2]}if((d|0)<3){continue}break}}return 1}wa();v()}sa();v()}sa();v()}sa();v()}function gd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;n=ca-96|0;ca=n;o=H[a+4>>2];d=H[o+32>>2];i=H[d+8>>2];j=H[d+12>>2];e=j;c=H[d+20>>2];f=H[d+16>>2];a:{if((e|0)<=(c|0)&f>>>0>=i>>>0|(c|0)>(e|0)){break a}p=H[d>>2];g=I[p+f|0];h=f+1|0;e=h?c:c+1|0;H[d+16>>2]=h;H[d+20>>2]=e;if((e|0)>=(j|0)&h>>>0>=i>>>0|(e|0)>(j|0)){break a}m=I[h+p|0];h=f+2|0;e=h>>>0<2?c+1|0:c;H[d+16>>2]=h;H[d+20>>2]=e;l=g<<24>>24;b:{if((l|0)>=0){k=H[a+216>>2];if(g>>>0>=(H[a+220>>2]-k|0)/144>>>0){break a}k=k+N(g,144)|0;if(H[k>>2]<0){break b}break a}if(H[a+212>>2]>=0){break a}k=a+212|0}H[k>>2]=b;c:{d:{e:{f:{g:{h:{k=J[o+36>>1];i:{if(((k<<8|k>>>8)&65535)>>>0>=258){if((e|0)>=(j|0)&h>>>0>=i>>>0|(e|0)>(j|0)){break a}e=I[h+p|0];f=f+3|0;c=f>>>0<3?c+1|0:c;H[d+16>>2]=f;H[d+20>>2]=c;if(e>>>0>1){break a}d=e>>>0<2?e:0;if(!m){break i}if(!d){break h}break a}if(m){break g}d=0}if((l|0)<0){e=a+184|0}else{c=H[a+216>>2]+N(g,144)|0;F[c+100|0]=0;e=c+104|0}if((d|0)!=1){break e}c=ca-112|0;ca=c;h=H[H[a+4>>2]+44>>2];d=pa(120);H[d>>2]=12172;H[d+4>>2]=0;H[d+116>>2]=0;H[d+112>>2]=e;H[d+108>>2]=h;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;H[d+56>>2]=0;H[d+60>>2]=0;H[d+8>>2]=12384;f=d- -64|0;H[f>>2]=0;H[f+4>>2]=0;H[d+72>>2]=0;H[d+76>>2]=0;H[d+80>>2]=0;H[d+84>>2]=0;H[d+88>>2]=0;H[d+104>>2]=0;H[d+96>>2]=0;H[d+100>>2]=0;f=H[a+8>>2];H[c+48>>2]=0;H[c+52>>2]=0;H[c+40>>2]=0;H[c+44>>2]=0;i=c+32|0;H[i>>2]=0;H[i+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;g=c- -64|0;H[g>>2]=0;H[g+4>>2]=0;H[c+72>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+84>>2]=0;H[c+88>>2]=0;H[c+104>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+8>>2]=12384;H[c+96>>2]=0;H[c+100>>2]=0;H[c+12>>2]=f;g=H[f>>2];j=H[f+4>>2];F[c+111|0]=0;m=i;i=c+111|0;Oa(m,(j-g>>2>>>0)/3|0,i);g=H[c+12>>2];j=H[g+28>>2];g=H[g+24>>2];F[c+111|0]=0;Oa(c+44|0,j-g>>2,i);H[c+28>>2]=d;H[c+24>>2]=h;H[c+20>>2]=e;H[c+16>>2]=f;f=d+8|0;e=c+8|0;fd(f,e);j:{if((e|0)==(f|0)){H[d+92>>2]=H[e+84>>2];break j}Cb(d+56|0,H[e+48>>2],H[e+52>>2]);Cb(d+68|0,H[e+60>>2],H[e- -64>>2]);Cb(d+80|0,H[e+72>>2],H[e+76>>2]);H[d+92>>2]=H[e+84>>2];Aa(d+96|0,H[e+88>>2],H[e+92>>2])}H[c+8>>2]=12384;e=H[c+96>>2];if(e){H[c+100>>2]=e;oa(e)}e=H[c+80>>2];if(e){H[c+84>>2]=e;oa(e)}e=H[c+68>>2];if(e){H[c+72>>2]=e;oa(e)}e=H[c+56>>2];if(e){H[c+60>>2]=e;oa(e)}H[c+8>>2]=12620;e=H[c+44>>2];if(e){oa(e)}e=H[c+32>>2];if(e){oa(e)}ca=c+112|0;break d}if((l|0)>=0){break f}break a}if((l|0)<0){break a}}e=H[a+216>>2];c=H[o+44>>2];d=pa(80);H[d>>2]=12932;H[d+4>>2]=0;H[d+76>>2]=0;H[d+68>>2]=c;H[d+8>>2]=11872;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;e=e+N(g,144)|0;f=e+104|0;H[d+72>>2]=f;H[d- -64>>2]=0;H[d+56>>2]=0;H[d+60>>2]=0;H[n+24>>2]=c;c=n;H[c+68>>2]=0;H[c+72>>2]=0;H[c+60>>2]=0;H[c+64>>2]=0;H[c+52>>2]=0;H[c+56>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+84>>2]=0;H[c+88>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+28>>2]=d;h=H[c+28>>2];H[c+8>>2]=H[c+24>>2];H[c+12>>2]=h;H[c+20>>2]=f;f=e+4|0;H[c+16>>2]=f;H[c+36>>2]=0;H[c+40>>2]=0;H[c+32>>2]=11872;e=H[c+20>>2];H[c>>2]=H[c+16>>2];H[c+4>>2]=e;e=c+32|0;Ie(e,f,c);c=d+8|0;fd(c,e);if((c|0)!=(e|0)){Cb(d+56|0,H[e+48>>2],H[e+52>>2])}He(e);break c}c=ca+-64|0;ca=c;h=H[H[a+4>>2]+44>>2];d=pa(80);H[d>>2]=12640;H[d+4>>2]=0;H[d+76>>2]=0;H[d+72>>2]=e;H[d+68>>2]=h;H[d+8>>2]=12804;H[d+12>>2]=0;H[d+16>>2]=0;H[d+20>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;H[d+32>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0;H[d+44>>2]=0;H[d+48>>2]=0;H[d+52>>2]=0;H[d- -64>>2]=0;i=d+56|0;f=i;H[f>>2]=0;H[f+4>>2]=0;f=H[a+8>>2];H[c+40>>2]=0;H[c+44>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;g=c+24|0;H[g>>2]=0;H[g+4>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+56>>2]=0;H[c+8>>2]=0;H[c+12>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;H[c>>2]=12804;H[c+4>>2]=f;j=H[f>>2];l=H[f+4>>2];F[c+63|0]=0;m=g;g=c+63|0;Oa(m,(l-j>>2>>>0)/3|0,g);j=H[c+4>>2];l=H[j+28>>2];j=H[j+24>>2];F[c+63|0]=0;Oa(c+36|0,l-j>>2,g);H[c+20>>2]=d;H[c+16>>2]=h;H[c+12>>2]=e;H[c+8>>2]=f;fd(d+8|0,c);Cb(i,H[c+48>>2],H[c+52>>2]);H[c>>2]=12804;e=H[c+48>>2];if(e){H[c+52>>2]=e;oa(e)}H[c>>2]=12620;e=H[c+36>>2];if(e){oa(e)}e=H[c+24>>2];if(e){oa(e)}ca=c- -64|0}if(!d){break a}}d=od(pa(64),d);c=H[a+4>>2];a=d;d=b;k:{l:{if((d|0)>=0){h=c+8|0;b=H[c+12>>2];i=H[c+8>>2];e=b-i>>2;m:{if((e|0)>(d|0)){break m}f=d+1|0;if(d>>>0>=e>>>0){Vb(h,f-e|0);break m}if(e>>>0<=f>>>0){break m}f=i+(f<<2)|0;if((f|0)!=(b|0)){while(1){b=b-4|0;e=H[b>>2];H[b>>2]=0;if(e){ea[H[H[e>>2]+4>>2]](e)}if((b|0)!=(f|0)){continue}break}}H[c+12>>2]=f}c=H[h>>2]+(d<<2)|0;b=H[c>>2];H[c>>2]=a;if(b){break l}break k}b=a;if(!a){break k}}ea[H[H[b>>2]+4>>2]](b)}q=(d^-1)>>>31|0}ca=n+96|0;return q|0}function Kd(a){var b=0,c=0,d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;H[e+12>>2]=a;a:{if(a>>>0<=211){d=H[Jd(14256,14448,e+12|0)>>2];break a}if(a>>>0>=4294967292){X();v()}f=(a>>>0)/210|0;d=N(f,210);H[e+8>>2]=a-d;g=Jd(14448,14640,e+8|0)-14448>>2;while(1){d=H[(g<<2)+14448>>2]+d|0;a=5;while(1){b:{if((a|0)==47){a=211;while(1){b=(d>>>0)/(a>>>0)|0;if(b>>>0>>0){break a}if((N(a,b)|0)==(d|0)){break b}b=a+10|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+12|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+16|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+18|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+22|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+28|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+30|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+36|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+40|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+42|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+46|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+52|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+58|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+60|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+66|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+70|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+72|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+78|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+82|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+88|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+96|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+100|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+102|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+106|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+108|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+112|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+120|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+126|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+130|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+136|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+138|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+142|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+148|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+150|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+156|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+162|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+166|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+168|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+172|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+178|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+180|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+186|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+190|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+192|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+196|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+198|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((N(b,c)|0)==(d|0)){break b}b=a+208|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+210|0;if((N(b,c)|0)!=(d|0)){continue}break}break b}b=H[(a<<2)+14256>>2];c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+1|0;if((N(b,c)|0)!=(d|0)){continue}}break}d=g+1|0;a=(d|0)==48;g=a?0:d;f=a+f|0;d=N(f,210);continue}}ca=e+16|0;return d}function Ib(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=ca-16|0;ca=j;a:{b:{c:{d:{if(I[H[a+4>>2]+36|0]<=1){k=-1;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){break c}d=d+H[b>>2]|0;l=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[j+12>>2]=l;H[b+16>>2]=e;H[b+20>>2]=c;break d}k=-1;if(!Ea(1,j+12|0,b)){break c}l=H[j+12>>2]}e:{f:{g:{h:{i:{if(!l){break i}c=H[a+8>>2];if((H[c+4>>2]-H[c>>2]>>2>>>0)/3>>>0>>0){break c}c=J[H[a+4>>2]+36>>1];if(((c<<8|c>>>8)&65535)>>>0>=258){j:{while(1){if(!Ea(1,j+8|0,b)){break c}c=H[j+8>>2];if(!Ea(1,j+8|0,b)){break c}f=c+f|0;c=H[j+8>>2];if(f>>>0>>0){break c}g=f-c|0;c=H[a+40>>2];k:{if((c|0)!=H[a+44>>2]){H[c+4>>2]=f;H[c>>2]=g;H[a+40>>2]=c+12;l=H[j+12>>2];break k}m=H[a+36>>2];d=c-m|0;o=(d|0)/12|0;e=o+1|0;if(e>>>0>=357913942){break j}c=o<<1;h=o>>>0>=178956970?357913941:c>>>0>e>>>0?c:e;if(h){if(h>>>0>=357913942){break b}i=pa(N(h,12))}else{i=0}e=i+N(o,12)|0;H[e+4>>2]=f;H[e>>2]=g;c=va(e+N((d|0)/-12|0,12)|0,m,d);H[a+44>>2]=i+N(h,12);H[a+40>>2]=e+12;H[a+36>>2]=c;if(!m){break k}oa(m)}p=p+1|0;if(l>>>0>p>>>0){continue}break}k=0;Db(b,0,0);if(l){while(1){e=I[b+36|0];c=J[H[a+4>>2]+36>>1];l:{m:{if(((c<<8|c>>>8)&65535)>>>0<=513){if(!e){break l}p=0;c=H[b+32>>2];n=c>>>3|0;g=H[b+24>>2];e=n+g|0;d=H[b+28>>2];n:{if(e>>>0>=d>>>0){f=c;break n}e=I[e|0];f=c+1|0;H[b+32>>2]=f;n=f>>>3|0;p=e>>>(c&7)&1}if(d>>>0>g+n>>>0){break m}break l}if(!e){break l}p=0;f=H[b+32>>2];c=H[b+24>>2]+(f>>>3|0)|0;if(c>>>0>=K[b+28>>2]){break l}p=I[c|0]>>>(f&7)&1}H[b+32>>2]=f+1}c=H[a+36>>2]+N(k,12)|0;F[c+8|0]=I[c+8|0]&254|p&1;k=k+1|0;if((k|0)!=(l|0)){continue}break}}F[b+36|0]=0;f=H[b+20>>2];e=0;d=H[b+32>>2]+7|0;e=d>>>0<7?1:e;c=e>>>3|0;e=(e&7)<<29|d>>>3;d=e+H[b+16>>2]|0;c=c+f|0;H[b+16>>2]=d;H[b+20>>2]=d>>>0>>0?c+1|0:c;break i}sa();v()}while(1){d=H[b+8>>2];c=H[b+12>>2];g=c;c=H[b+20>>2];e=c;h=H[b+16>>2];f=h+4|0;c=f>>>0<4?c+1|0:c;i=f;if(f>>>0>d>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}m=H[b>>2];f=m+h|0;o=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=c;c=e;f=h+8|0;c=f>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}i=i+m|0;i=I[i|0]|I[i+1|0]<<8|(I[i+2|0]<<16|I[i+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if(d>>>0<=f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=I[f+m|0];c=h+9|0;e=c>>>0<9?e+1|0:e;H[b+16>>2]=c;H[b+20>>2]=e;f=d&1;c=H[a+40>>2];o:{if((c|0)!=H[a+44>>2]){F[c+8|0]=f;H[c+4>>2]=i;H[c>>2]=o;H[a+40>>2]=c+12;l=H[j+12>>2];break o}m=H[a+36>>2];d=c-m|0;h=(d|0)/12|0;e=h+1|0;if(e>>>0>=357913942){break h}c=h<<1;g=h>>>0>=178956970?357913941:c>>>0>e>>>0?c:e;if(g){if(g>>>0>=357913942){break b}e=pa(N(g,12))}else{e=0}h=e+N(h,12)|0;F[h+8|0]=f;H[h+4>>2]=i;H[h>>2]=o;c=va(h+N((d|0)/-12|0,12)|0,m,d);H[a+44>>2]=e+N(g,12);H[a+40>>2]=h+12;H[a+36>>2]=c;if(!m){break o}oa(m)}n=n+1|0;if(l>>>0>n>>>0){continue}break}}H[j+8>>2]=0;c=J[H[a+4>>2]+36>>1];c=(c<<8|c>>>8)&65535;p:{if(c>>>0<=511){k=-1;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;f=H[b+12>>2];if(K[b+8>>2]>>0&(f|0)<=(c|0)|(c|0)>(f|0)){break c}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break p}if((c|0)!=512){break e}k=-1;if(!Ea(1,j+8|0,b)){break c}f=H[j+8>>2]}if(!f){break e}c=J[H[a+4>>2]+36>>1];if(((c<<8|c>>>8)&65535)>>>0<258){break f}n=0;l=0;while(1){if(!Ea(1,j+4|0,b)){break c}l=H[j+4>>2]+l|0;c=H[a+52>>2];q:{if((c|0)!=H[a+56>>2]){H[c>>2]=l;H[a+52>>2]=c+4;break q}i=H[a+48>>2];g=c-i|0;e=g>>2;d=e+1|0;if(d>>>0>=1073741824){break g}c=g>>>1|0;d=g>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(d){if(d>>>0>=1073741824){break b}c=pa(d<<2)}else{c=0}e=c+(e<<2)|0;H[e>>2]=l;c=va(c,i,g);H[a+56>>2]=c+(d<<2);H[a+52>>2]=e+4;H[a+48>>2]=c;if(!i){break q}oa(i)}n=n+1|0;if((n|0)!=(f|0)){continue}break}break e}sa();v()}sa();v()}k=0;while(1){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){k=-1;break c}d=d+H[b>>2]|0;g=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;c=H[a+52>>2];r:{if((c|0)!=H[a+56>>2]){H[c>>2]=g;H[a+52>>2]=c+4;break r}h=H[a+48>>2];i=c-h|0;e=i>>2;d=e+1|0;if(d>>>0>=1073741824){break a}c=i>>>1|0;d=i>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(d){if(d>>>0>=1073741824){break b}c=pa(d<<2)}else{c=0}e=c+(e<<2)|0;H[e>>2]=g;c=va(c,h,i);H[a+56>>2]=c+(d<<2);H[a+52>>2]=e+4;H[a+48>>2]=c;if(!h){break r}oa(h)}k=k+1|0;if((k|0)!=(f|0)){continue}break}}k=H[b+16>>2]}ca=j+16|0;return k}wa();v()}sa();v()}function Va(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=O(0),k=0,l=0;a:{if(!d){break a}b:{c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(F[b|0]);L[(h<<2)+d>>2]=i?O(j/O(127)):j;b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(I[b|0]);L[(h<<2)+d>>2]=i?O(j/O(255)):j;b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(G[b>>1]);L[(h<<2)+d>>2]=i?O(j/O(32767)):j;b=b+2|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(J[b>>1]);L[(h<<2)+d>>2]=i?O(j/O(65535)):j;b=b+2|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(H[b>>2]);L[(h<<2)+d>>2]=i?O(j*O(4.656612873077393e-10)):j;b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(K[b>>2]);L[(h<<2)+d>>2]=i?O(j*O(2.3283064365386963e-10)):j;b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(+K[b>>2]+ +H[b+4>>2]*4294967296);L[(h<<2)+d>>2]=i?O(j*O(10842021724855044e-35)):j;b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];i=I[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=O(+K[b>>2]+ +K[b+4>>2]*4294967296);L[(h<<2)+d>>2]=i?O(j*O(5.421010862427522e-20)):j;b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 8:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=L[b>>2];b=b+4|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=M[b>>3];b=b+8|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[a>>2];g=H[e>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=H[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}L[(h<<2)+d>>2]=I[b|0]?O(1):O(0);b=b+1|0;h=h+1|0;e=I[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0}ra(d,0,a<<2)}return l}function ic(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=O(0),m=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){return 0}e=F[b|0];if((e|0)<0){break b}F[d+g|0]=e;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if((e+128&65535)>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>127){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e+128>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>127){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];h=e+128|0;i=h>>>0<128?i+1|0:i;if(!i&h>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>127|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=I[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=H[H[a>>2]>>2];f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break d}l=L[b>>2];if(l>=O(127)|lO(1)){break d}j=T(+l*127+.5);if(!(P(j)<2147483648)){break f}h=~~j;break e}if(!(m>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ra(d+e|0,0,c-e|0)}return k;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}j=M[b>>3];if(j>=127|j<-128|(P(j)==Infinity|j!=j)){break b}e=d+g|0;if(I[a+32|0]){if(j<0|j>1){break b}j=T(j*127+.5)}g:{if(P(j)<2147483648){h=~~j;break g}h=-2147483648}F[e|0]=h;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra(d+e|0,0,(c&255)-e|0)}return k}ra(d+e|0,0,(c&255)-e|0);return 1}function hc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=O(0);a:{b:{if(!d){break b}c:{switch(H[a+28>>2]-1|0){case 0:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){return 0}e=F[b|0];if((e|0)<0){break b}F[d+g|0]=e;b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=J[b>>1];if(e>>>0>255){break b}F[d+g|0]=e;b=b+2|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>2];if(e>>>0>255){break b}F[d+g|0]=e;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}i=H[b+4>>2];e=H[b>>2];if(!i&e>>>0>255|i){break b}F[d+g|0]=e;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=I[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=H[H[a>>2]>>2];f=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break d}l=L[b>>2];if(l>=O(255)|lO(1)){break d}j=T(+l*255+.5);if(!(j<4294967296&j>=0)){break f}h=~~j>>>0;break e}if(!(l=O(0))){break f}h=~~l>>>0;break e}h=0}F[e|0]=h;b=b+4|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ra(d+e|0,0,c-e|0)}return k;case 9:e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}j=M[b>>3];if(j>=255|j<0|(P(j)==Infinity|j!=j)){break b}e=d+g|0;if(I[a+32|0]){if(j>1){break b}j=T(j*255+.5)}g:{if(j<4294967296&j>=0){h=~~j>>>0;break g}h=0}F[e|0]=h;b=b+8|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=I[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=H[H[a>>2]>>2];i=H[a+48>>2];b=Rj(H[a+40>>2],H[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(K[H[a>>2]+4>>2]<=b>>>0){break b}F[d+g|0]=I[b|0];b=b+1|0;g=g+1|0;e=I[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ra(d+e|0,0,(c&255)-e|0)}return k}ra(d+e|0,0,(c&255)-e|0);return 1}function Hh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;i=H[a+32>>2];b=J[a+36>>1];a:{b:{if(((b<<8|b>>>8)&65535)>>>0<=513){b=H[i+8>>2];d=H[i+12>>2];c=b;b=H[i+20>>2];e=b;j=H[i+16>>2];f=j+4|0;b=f>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break a}n=H[i>>2];k=n+j|0;k=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[i+16>>2]=f;H[i+20>>2]=b;h=c;c=d;b=e;d=j+8|0;b=d>>>0<8?b+1|0:b;if(d>>>0>h>>>0&(b|0)>=(c|0)|(b|0)>(c|0)){break a}c=f+n|0;n=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[i+16>>2]=d;H[i+20>>2]=b;break b}if(!Fb(1,g+28|0,i)){break a}if(!Fb(1,g+24|0,H[a+32>>2])){break a}k=H[g+28>>2];n=H[g+24>>2]}if(k>>>0>1431655765){break a}d=H[a+32>>2];b=d;j=H[b+8>>2];c=H[b+16>>2];f=H[b+12>>2];b=H[b+20>>2];e=Sj(j-c|0,f-(b+(c>>>0>j>>>0)|0)|0,3,0);if(!da&e>>>0>>0){break a}e=Rj(k,0,3,0);if(!da&e>>>0>>0|((b|0)>=(f|0)&c>>>0>=j>>>0|(b|0)>(f|0))){break a}j=I[c+H[d>>2]|0];c=c+1|0;b=c?b:b+1|0;H[d+16>>2]=c;H[d+20>>2]=b;c:{d:{if(!j){d=0;c=ca-32|0;ca=c;H[c+24>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;e:{f:{b=N(k,3);if(b){if(b>>>0>=1073741824){break f}j=N(k,12);d=pa(j);ra(d,0,j)}b=kd(b,1,H[a+32>>2],d);g:{h:{if(!(!k|!b)){j=0;while(1){i:{b=(j<<2)+d|0;f=H[b>>2];e=f>>>1|0;f=(f&1?0-e|0:e)+l|0;if((f|0)<0){break i}H[c>>2]=f;e=H[b+4>>2];h=e>>>1|0;f=f+(e&1?0-h|0:h)|0;if((f|0)<0){break i}H[c+4>>2]=f;b=H[b+8>>2];e=b>>>1|0;l=f+(b&1?0-e|0:e)|0;if((l|0)<0){break i}H[c+8>>2]=l;Rb(H[a+44>>2]+96|0,c);j=j+3|0;b=1;o=o+1|0;if((o|0)!=(k|0)){continue}break h}break}b=0;break h}if(!d){break g}}oa(d)}ca=c+32|0;break e}sa();v()}if(b){break d}break a}if(n>>>0<=255){if(!k){break d}while(1){j:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;d=H[a+32>>2];b=d;j=H[b+16>>2];e=H[b+8>>2];c=H[b+20>>2];h=H[b+12>>2];b=h;if(e>>>0<=j>>>0&(c|0)>=(b|0)|(b|0)<(c|0)){break j}i=H[d>>2];l=I[i+j|0];b=c;f=j+1|0;b=f?b:b+1|0;H[d+16>>2]=f;H[d+20>>2]=b;H[g+8>>2]=l;l=e>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0);e=l?j:e;h=l?c:h;if((e|0)==(f|0)&(h|0)==(b|0)){break j}l=I[f+i|0];b=c;f=j+2|0;b=f>>>0<2?b+1|0:b;H[d+16>>2]=f;H[d+20>>2]=b;H[g+12>>2]=l;if((e|0)==(f|0)&(b|0)==(h|0)){break j}f=I[f+i|0];b=c;c=j+3|0;b=c>>>0<3?b+1|0:b;H[d+16>>2]=c;H[d+20>>2]=b;H[g+16>>2]=f;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}if(n>>>0<=65535){if(!k){break d}while(1){k:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;i=H[a+32>>2];b=i;c=H[b+8>>2];d=H[b+12>>2];f=H[b+16>>2];b=H[b+20>>2];j=b;e=f+2|0;b=e>>>0<2?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}l=H[i>>2];h=l+f|0;h=I[h|0]|I[h+1|0]<<8;H[i+16>>2]=e;H[i+20>>2]=b;H[g+8>>2]=h;b=j;h=f+4|0;b=h>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}e=e+l|0;e=I[e|0]|I[e+1|0]<<8;H[i+16>>2]=h;H[i+20>>2]=b;H[g+12>>2]=e;e=c;b=j;c=f+6|0;b=c>>>0<6?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break k}d=h+l|0;d=I[d|0]|I[d+1|0]<<8;H[i+16>>2]=c;H[i+20>>2]=b;H[g+16>>2]=d;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}l:{if(n>>>0>2097151){break l}b=J[a+36>>1];if(((b<<8|b>>>8)&65535)>>>0<514){break l}if(!k){break d}while(1){m:{H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+8>>2]=H[g+4>>2];if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+12>>2]=H[g+4>>2];if(!Fb(1,g+4|0,H[a+32>>2])){break m}H[g+16>>2]=H[g+4>>2];Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break d}break}m=0;break a}if(!k){break d}while(1){H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;i=H[a+32>>2];b=i;c=H[b+8>>2];d=H[b+12>>2];f=H[b+16>>2];b=H[b+20>>2];j=b;e=f+4|0;b=e>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}l=H[i>>2];h=l+f|0;h=I[h|0]|I[h+1|0]<<8|(I[h+2|0]<<16|I[h+3|0]<<24);H[i+16>>2]=e;H[i+20>>2]=b;H[g+8>>2]=h;b=j;h=f+8|0;b=h>>>0<8?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}e=e+l|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[i+16>>2]=h;H[i+20>>2]=b;H[g+12>>2]=e;e=c;b=j;c=f+12|0;b=c>>>0<12?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break c}d=h+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[i+16>>2]=c;H[i+20>>2]=b;H[g+16>>2]=d;Rb(H[a+44>>2]+96|0,g+8|0);m=m+1|0;if((m|0)!=(k|0)){continue}break}}H[H[a+4>>2]+80>>2]=n;m=1;break a}m=0}ca=g+32|0;return m|0}function zf(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=O(0),w=0;p=ca-16|0;ca=p;a:{if(!(H[a+60>>2]!=H[a- -64>>2]|H[a+48>>2]!=H[a+52>>2])){j=1;break a}j=1;if((ea[H[H[a>>2]+24>>2]](a)|0)<=0){break a}while(1){b:{b=ea[H[H[a>>2]+20>>2]](a,w)|0;c:{d:{e:{f=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(b<<2)>>2];switch(H[f+28>>2]-1|0){case 8:break d;case 0:case 2:case 4:break e;default:break c}}b=I[f+24|0];f:{if(!b){n=0;j=0;break f}j=0;b=b<<2;n=pa(b);ra(n,0,b);b=I[f+24|0];if(!b){break f}b=b<<2;j=pa(b);ra(j,0,b)}g:{h:{i:{switch(H[f+28>>2]-1|0){case 4:i=0;h=0;d=0;b=0;k=0;e=I[f+24|0];j:{if(!e){g=0;break j}e=e<<2;h=pa(e);ra(h,0,e);g=pa(e);ra(g,0,e)}k:{if(H[f+80>>2]){while(1){o=H[f>>2];c=H[o>>2];m=H[f+48>>2];e=H[f+40>>2];l=Rj(e,H[f+44>>2],d,b);m=m+l|0;s=c+m|0;c=e;m=qa(h,s,c);l=I[f+24|0];if(l){t=H[a+48>>2];e=0;while(1){r=e<<2;s=H[r+m>>2];if((s|0)<0){break k}H[g+r>>2]=s+H[t+(e+u<<2)>>2];e=e+1|0;if((l|0)!=(e|0)){continue}break}}qa(H[o>>2]+N(d,c)|0,g,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}k=1}if(g){oa(g)}if(h){oa(h)}if(k){break h}break g;case 2:g=0;e=0;d=0;b=0;c=I[f+24|0];if(c){c=c<<1;e=pa(c);ra(e,0,c);g=pa(c);ra(g,0,c)}if(H[f+80>>2]){while(1){l=H[f>>2];h=H[l>>2];i=H[f+48>>2];c=H[f+40>>2];k=Rj(c,H[f+44>>2],d,b);i=i+k|0;k=qa(e,h+i|0,c);o=I[f+24|0];l:{if(!o){break l}m=H[a+48>>2];h=0;if((o|0)!=1){t=o&254;i=0;while(1){r=h<<1;G[r+g>>1]=J[k+r>>1]+J[m+(h+u<<2)>>1];r=h|1;s=r<<1;G[s+g>>1]=J[k+s>>1]+J[m+(r+u<<2)>>1];h=h+2|0;i=i+2|0;if((t|0)!=(i|0)){continue}break}}if(!(o&1)){break l}i=h<<1;G[i+g>>1]=J[i+k>>1]+J[m+(h+u<<2)>>1]}qa(H[l>>2]+N(d,c)|0,g,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}if(g){oa(g)}if(e){oa(e)}break h;case 0:break i;default:break h}}h=0;e=0;d=0;b=0;c=I[f+24|0];if(c){e=pa(c);ra(e,0,c);h=pa(c);ra(h,0,c)}if(H[f+80>>2]){while(1){t=H[f>>2];g=H[t>>2];i=H[f+48>>2];c=H[f+40>>2];k=Rj(c,H[f+44>>2],d,b);i=i+k|0;k=qa(e,g+i|0,c);o=I[f+24|0];m:{if(!o){break m}m=H[a+48>>2];g=0;if((o|0)!=1){r=o&254;i=0;while(1){F[g+h|0]=I[g+k|0]+I[m+(g+u<<2)|0];l=g|1;F[l+h|0]=I[k+l|0]+I[m+(l+u<<2)|0];g=g+2|0;i=i+2|0;if((r|0)!=(i|0)){continue}break}}if(!(o&1)){break m}F[g+h|0]=I[g+k|0]+I[m+(g+u<<2)|0]}qa(H[t>>2]+N(d,c)|0,h,c);d=d+1|0;b=d?b:b+1|0;if(!b&K[f+80>>2]>d>>>0){continue}break}}if(h){oa(h)}if(e){oa(e)}}u=I[f+24|0]+u|0;i=1}if(j){oa(j)}if(n){oa(n)}if(i){break c}j=0;break a}e=H[H[a+60>>2]+(q<<2)>>2];h=H[a+36>>2];g=H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2];H[p+12>>2]=H[f+56>>2];b=pa(32);H[p>>2]=b;H[p+4>>2]=24;H[p+8>>2]=-2147483616;d=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);c=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=c;F[b+17|0]=c>>>8;F[b+18|0]=c>>>16;F[b+19|0]=c>>>24;F[b+20|0]=d;F[b+21|0]=d>>>8;F[b+22|0]=d>>>16;F[b+23|0]=d>>>24;d=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);c=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=c;F[b+9|0]=c>>>8;F[b+10|0]=c>>>16;F[b+11|0]=c>>>24;F[b+12|0]=d;F[b+13|0]=d>>>8;F[b+14|0]=d>>>16;F[b+15|0]=d>>>24;d=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);c=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=c;F[b+1|0]=c>>>8;F[b+2|0]=c>>>16;F[b+3|0]=c>>>24;F[b+4|0]=d;F[b+5|0]=d>>>8;F[b+6|0]=d>>>16;F[b+7|0]=d>>>24;F[b+24|0]=0;d=sd(g,p+12|0,p);if(F[p+11|0]<0){oa(H[p>>2])}b=q+1|0;n:{if(d){oe(f,e);break n}g=h+N(q,24)|0;q=H[g+4>>2];c=I[f+24|0];h=c<<2;d=pa(h);H[p>>2]=1065353216;v=L[g+20>>2];q=-1<0){L[p>>2]=v/O(q|0)}if((q|0)<=0){break b}o:{if(!H[e+80>>2]){break o}if(!c){n=0;j=0;while(1){qa(H[H[f+64>>2]>>2]+j|0,d,h);j=h+j|0;n=n+1|0;if(n>>>0>2]){continue}break}break o}o=H[H[e>>2]>>2]+H[e+48>>2]|0;t=c&254;r=c&1;i=0;k=0;j=0;while(1){q=H[g+8>>2];v=L[p>>2];n=0;m=0;if((c|0)!=1){while(1){l=n<<2;s=o+(j<<2)|0;L[l+d>>2]=O(v*O(H[s>>2]))+L[l+q>>2];l=l|4;L[l+d>>2]=O(v*O(H[s+4>>2]))+L[l+q>>2];n=n+2|0;j=j+2|0;m=m+2|0;if((t|0)!=(m|0)){continue}break}}if(r){n=n<<2;L[n+d>>2]=O(v*O(H[o+(j<<2)>>2]))+L[n+q>>2];j=j+1|0}qa(H[H[f+64>>2]>>2]+k|0,d,h);k=h+k|0;i=i+1|0;if(i>>>0>2]){continue}break}}oa(d)}q=b}j=1;w=w+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(w|0)){continue}break a}break}oa(d);j=0}ca=p+16|0;return j|0}function Le(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=ca+-64|0;ca=g;H[g+56>>2]=0;H[g+48>>2]=0;H[g+52>>2]=0;H[g+40>>2]=0;H[g+44>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;H[g+24>>2]=0;H[g+28>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;j=g+8|0;d=J[b+38>>1];a:{b:{if(!d){break b}c:{if(d>>>0<=511){h=H[b+8>>2];f=H[b+12>>2];e=H[b+20>>2];d=H[b+16>>2];i=d+4|0;e=i>>>0<4?e+1|0:e;if(h>>>0>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break b}d=d+H[b>>2]|0;l=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[j+12>>2]=l;e=H[b+20>>2];d=H[b+16>>2]+4|0;e=d>>>0<4?e+1|0:e;H[b+16>>2]=d;H[b+20>>2]=e;break c}if(!hb(1,j+12|0,b)){break b}d=H[b+16>>2];e=H[b+20>>2];l=H[j+12>>2]}f=H[b+8>>2];i=f-d|0;d=H[b+12>>2]-((d>>>0>f>>>0)+e|0)|0;if(i>>>0>>6>>>0&(d|0)<=0|(d|0)<0){break b}e=H[j>>2];d=H[j+4>>2]-e>>2;d:{if(d>>>0>>0){ya(j,l-d|0);l=H[j+12>>2];break d}if(d>>>0<=l>>>0){break d}H[j+4>>2]=e+(l<<2)}i=1;if(!l){break a}d=H[b+16>>2];e=H[b+20>>2];r=H[j>>2];k=H[b+8>>2];o=H[b+12>>2];h=0;while(1){i=0;if((e|0)>=(o|0)&d>>>0>=k>>>0|(e|0)>(o|0)){break a}i=H[b>>2];p=I[i+d|0];d=d+1|0;e=d?e:e+1|0;H[b+16>>2]=d;H[b+20>>2]=e;f=p>>>2|0;m=0;e:{f:{g:{h:{s=p&3;switch(s|0){case 0:break f;case 3:break h;default:break g}}f=f+h|0;i=0;if(f>>>0>=l>>>0){break a}ra(r+(h<<2)|0,0,(p&252)+4|0);h=f;break e}while(1){if((d|0)==(k|0)&(e|0)==(o|0)){break b}l=I[d+i|0];d=d+1|0;e=d?e:e+1|0;H[b+16>>2]=d;H[b+20>>2]=e;f=l<<(m<<3|6)|f;m=m+1|0;if((s|0)!=(m|0)){continue}break}}H[r+(h<<2)>>2]=f}l=H[j+12>>2];h=h+1|0;if(l>>>0>h>>>0){continue}break}d=j+16|0;o=H[j>>2];f=H[j+16>>2];e=H[j+20>>2]-f|0;i:{if(e>>>0<=4194303){ya(d,1048576-(e>>>2|0)|0);break i}if((e|0)==4194304){break i}H[j+20>>2]=f+4194304}e=j+28|0;h=H[e>>2];f=H[j+32>>2]-h>>3;j:{if(f>>>0>>0){ob(e,l-f|0);h=H[e>>2];break j}if(f>>>0>l>>>0){H[j+32>>2]=(l<<3)+h}if(!l){break b}}k=H[d>>2];d=0;i=0;while(1){e=o+(d<<2)|0;j=H[e>>2];m=(d<<3)+h|0;f=i;H[m+4>>2]=f;H[m>>2]=j;e=H[e>>2];i=e+f|0;if(i>>>0>1048576){break b}k:{if(f>>>0>=i>>>0){break k}m=0;j=e&7;if(j){while(1){H[k+(f<<2)>>2]=d;f=f+1|0;m=m+1|0;if((j|0)!=(m|0)){continue}break}}if(e-1>>>0<=6){break k}while(1){e=k+(f<<2)|0;H[e>>2]=d;H[e+28>>2]=d;H[e+24>>2]=d;H[e+20>>2]=d;H[e+16>>2]=d;H[e+12>>2]=d;H[e+8>>2]=d;H[e+4>>2]=d;f=f+8|0;if((i|0)!=(f|0)){continue}break}}d=d+1|0;if((l|0)!=(d|0)){continue}break}n=(i|0)==1048576}i=n}l:{if(!i|(H[g+20>>2]?0:a)){break l}i=0;n=ca-16|0;ca=n;m:{n:{if(J[b+38>>1]<=511){h=H[b+8>>2];f=H[b+12>>2];j=f;e=H[b+20>>2];k=H[b+16>>2];d=k+8|0;e=d>>>0<8?e+1|0:e;if(d>>>0>h>>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break m}k=k+H[b>>2]|0;f=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);k=I[k+4|0]|I[k+5|0]<<8|(I[k+6|0]<<16|I[k+7|0]<<24);H[b+16>>2]=d;H[b+20>>2]=e;break n}if(!gb(1,n+8|0,b)){break m}d=H[b+16>>2];e=H[b+20>>2];h=H[b+8>>2];j=H[b+12>>2];f=H[n+8>>2];k=H[n+12>>2]}l=h-d|0;h=j-((d>>>0>h>>>0)+e|0)|0;if((h|0)==(k|0)&f>>>0>l>>>0|h>>>0>>0){break m}e=e+k|0;h=d+f|0;e=h>>>0>>0?e+1|0:e;H[b+16>>2]=h;H[b+20>>2]=e;if((f|0)<=0){break m}b=H[b>>2]+d|0;H[g+48>>2]=b;d=f-1|0;e=d+b|0;h=I[e|0];o:{if(h>>>0<=63){H[g+52>>2]=d;b=I[e|0]&63;break o}p:{switch((h>>>6|0)-1|0){case 0:if(f>>>0<2){break m}d=f-2|0;H[g+52>>2]=d;b=b+d|0;b=I[b+1|0]<<8&16128|I[b|0];break o;case 1:if(f>>>0<3){break m}d=f-3|0;H[g+52>>2]=d;b=b+d|0;b=I[b+1|0]<<8|I[b+2|0]<<16&4128768|I[b|0];break o;default:break p}}d=f-4|0;H[g+52>>2]=d;b=b+d|0;b=(I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24))&1073741823}H[g+56>>2]=b+4194304;i=b>>>0<1069547520}ca=n+16|0;if(!i){break l}if(!a){t=1;break l}b=H[g+52>>2];f=H[g+56>>2];d=H[g+36>>2];e=H[g+48>>2];h=H[g+24>>2];while(1){q:{if(f>>>0>4194303){break q}while(1){if((b|0)<=0){break q}b=b-1|0;H[g+52>>2]=b;f=I[b+e|0]|f<<8;H[g+56>>2]=f;if(f>>>0<4194304){continue}break}}i=f&1048575;k=H[h+(i<<2)>>2];n=d+(k<<3)|0;f=(N(H[n>>2],f>>>20|0)+i|0)-H[n+4>>2]|0;H[g+56>>2]=f;H[(q<<2)+c>>2]=k;t=1;q=q+1|0;if((q|0)!=(a|0)){continue}break}}a=H[g+36>>2];if(a){H[g+40>>2]=a;oa(a)}a=H[g+24>>2];if(a){H[g+28>>2]=a;oa(a)}a=H[g+8>>2];if(a){H[g+12>>2]=a;oa(a)}ca=g- -64|0;return t}function nc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;e=ca-48|0;ca=e;f=J[6677]|J[6678]<<16;d=J[6675]|J[6676]<<16;G[e+38>>1]=d;G[e+40>>1]=d>>>16;G[e+42>>1]=f;G[e+44>>1]=f>>>16;d=H[3337];H[e+32>>2]=H[3336];H[e+36>>2]=d;d=H[3335];H[e+24>>2]=H[3334];H[e+28>>2]=d;d=H[3333];H[e+16>>2]=H[3332];H[e+20>>2]=d;g=H[b+8>>2];i=H[b+12>>2];h=H[b+20>>2];d=H[b+16>>2];f=d+5|0;h=f>>>0<5?h+1|0:h;a:{b:{if(g>>>0>>0&(h|0)>=(i|0)|(h|0)>(i|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}c:{d:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break d}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break c}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}f=d+H[b>>2]|0;d=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;F[c+4|0]=I[f+4|0];d=H[b+20>>2];f=H[b+16>>2]+5|0;d=f>>>0<5?d+1|0:d;H[b+16>>2]=f;H[b+20>>2]=d;if(Fa(c,1260,5)){d=pa(32);F[d+17|0]=0;F[d+16|0]=I[1496];c=I[1492]|I[1493]<<8|(I[1494]<<16|I[1495]<<24);b=I[1488]|I[1489]<<8|(I[1490]<<16|I[1491]<<24);F[d+8|0]=b;F[d+9|0]=b>>>8;F[d+10|0]=b>>>16;F[d+11|0]=b>>>24;F[d+12|0]=c;F[d+13|0]=c>>>8;F[d+14|0]=c>>>16;F[d+15|0]=c>>>24;c=I[1484]|I[1485]<<8|(I[1486]<<16|I[1487]<<24);b=I[1480]|I[1481]<<8|(I[1482]<<16|I[1483]<<24);F[d|0]=b;F[d+1|0]=b>>>8;F[d+2|0]=b>>>16;F[d+3|0]=b>>>24;F[d+4|0]=c;F[d+5|0]=c>>>8;F[d+6|0]=c>>>16;F[d+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,d,17);oa(d);break b}g=H[b+12>>2];if((g|0)<=(d|0)&K[b+8>>2]<=f>>>0|(d|0)>(g|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}e:{f:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break f}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break e}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+5|0]=I[f+H[b>>2]|0];g=H[b+20>>2];d=H[b+16>>2]+1|0;g=d?g:g+1|0;H[b+16>>2]=d;H[b+20>>2]=g;f=H[b+12>>2];if((f|0)<=(g|0)&K[b+8>>2]<=d>>>0|(g|0)>(f|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}g:{h:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break h}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break g}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+6|0]=I[d+H[b>>2]|0];h=H[b+20>>2];d=H[b+16>>2]+1|0;h=d?h:h+1|0;H[b+16>>2]=d;H[b+20>>2]=h;f=H[b+12>>2];if((f|0)<=(h|0)&K[b+8>>2]<=d>>>0|(f|0)<(h|0)){d=Ma(e+16|0);if(d>>>0>=2147483632){break a}i:{j:{if(d>>>0>=11){b=(d|15)+1|0;c=pa(b);H[e+8>>2]=b|-2147483648;H[e>>2]=c;H[e+4>>2]=d;b=c+d|0;break j}F[e+11|0]=d;b=d+e|0;c=e;if(!d){break i}}qa(c,e+16|0,d)}F[b|0]=0;H[a>>2]=-2;b=a+4|0;if(F[e+11|0]>=0){a=H[e+4>>2];H[b>>2]=H[e>>2];H[b+4>>2]=a;H[b+8>>2]=H[e+8>>2];break b}za(b,H[e>>2],H[e+4>>2]);if(F[e+11|0]>=0){break b}oa(H[e>>2]);break b}F[c+7|0]=I[d+H[b>>2]|0];g=H[b+20>>2];d=H[b+16>>2]+1|0;g=d?g:g+1|0;H[b+16>>2]=d;H[b+20>>2]=g;f=H[b+12>>2];if((f|0)<=(g|0)&K[b+8>>2]<=d>>>0|(g|0)>(f|0)){c=mc(e,e+16|0);H[a>>2]=-2;b=a+4|0;if(F[c+11|0]>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break b}za(b,H[c>>2],H[c+4>>2]);if(F[c+11|0]>=0){break b}oa(H[c>>2]);break b}F[c+8|0]=I[d+H[b>>2]|0];d=H[b+20>>2];g=H[b+16>>2];f=g+1|0;i=f?d:d+1|0;H[b+16>>2]=f;H[b+20>>2]=i;i=H[b+8>>2];h=H[b+12>>2];g=g+3|0;d=g>>>0<3?d+1|0:d;if(g>>>0>i>>>0&(d|0)>=(h|0)|(d|0)>(h|0)){c=mc(e,e+16|0);H[a>>2]=-2;b=a+4|0;if(F[c+11|0]>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break b}za(b,H[c>>2],H[c+4>>2]);if(F[c+11|0]>=0){break b}oa(H[c>>2]);break b}d=c;c=H[b>>2]+f|0;G[d+10>>1]=I[c|0]|I[c+1|0]<<8;g=H[b+20>>2];c=H[b+16>>2]+2|0;g=c>>>0<2?g+1|0:g;H[b+16>>2]=c;H[b+20>>2]=g;H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+4>>2]=0}ca=e+48|0;return}Na();v()}function Nb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;e=ca-96|0;ca=e;f=H[a+16>>2];F[e+92|0]=1;H[e+88>>2]=b;H[e+84>>2]=b;H[e+80>>2]=f;j=H[a+20>>2];d=H[j>>2];a:{b:{f=H[H[f+28>>2]+(b<<2)>>2];if(f>>>0>2]-d>>2>>>0){d=H[H[a+8>>2]+(H[d+(f<<2)>>2]<<2)>>2];f=H[a+4>>2];if(!I[f+84|0]){d=H[H[f+68>>2]+(d<<2)>>2]}H[e+72>>2]=0;H[e+76>>2]=0;j=e- -64|0;H[j>>2]=0;H[j+4>>2]=0;H[e+56>>2]=0;H[e+60>>2]=0;Sa(f,d,F[f+24|0],e+56|0);if((b|0)!=-1){f=b+1|0;j=(f>>>0)%3|0?f:b-2|0;m=((b>>>0)%3|0?-1:2)+b|0;while(1){d=j;f=m;c:{if(!H[a+28>>2]){break c}f=b+1|0;d=(f>>>0)%3|0?f:b-2|0;f=b-1|0;if((b>>>0)%3|0){break c}f=b+2|0}n=H[a+20>>2];b=H[n>>2];d=H[H[H[a+16>>2]+28>>2]+(d<<2)>>2];if(d>>>0>=H[n+4>>2]-b>>2>>>0){break b}d=H[H[a+8>>2]+(H[b+(d<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[e+48>>2]=0;H[e+52>>2]=0;H[e+40>>2]=0;H[e+44>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;Sa(b,d,F[b+24|0],e+32|0);d=H[a+20>>2];b=H[d>>2];f=H[H[H[a+16>>2]+28>>2]+(f<<2)>>2];if(f>>>0>=H[d+4>>2]-b>>2>>>0){break a}d=H[H[a+8>>2]+(H[b+(f<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;Sa(b,d,F[b+24|0],e+8|0);g=H[e+8>>2];b=H[e+56>>2];d=g-b|0;p=H[e+60>>2];t=H[e+12>>2]-(p+(b>>>0>g>>>0)|0)|0;h=H[e+40>>2];f=H[e+64>>2];n=h-f|0;u=H[e+68>>2];y=H[e+44>>2]-(u+(f>>>0>h>>>0)|0)|0;g=Rj(d,t,n,y);w=o-g|0;x=i-(da+(g>>>0>o>>>0)|0)|0;i=w;h=H[e+16>>2];g=h-f|0;u=H[e+20>>2]-((f>>>0>h>>>0)+u|0)|0;k=H[e+32>>2];h=k-b|0;w=H[e+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=Rj(g,u,h,w);o=i+b|0;i=da+x|0;i=b>>>0>o>>>0?i+1|0:i;b=l;l=d;p=t;k=H[e+48>>2];f=H[e+72>>2];d=k-f|0;t=H[e+76>>2];x=H[e+52>>2]-(t+(f>>>0>k>>>0)|0)|0;l=Rj(l,p,d,x);k=b+l|0;b=da+q|0;b=k>>>0>>0?b+1|0:b;l=H[e+24>>2];p=l-f|0;f=H[e+28>>2]-((f>>>0>l>>>0)+t|0)|0;q=Rj(p,f,h,w);l=k-q|0;q=b-(da+(k>>>0>>0)|0)|0;b=Rj(g,u,d,x);d=r-b|0;b=s-(da+(b>>>0>r>>>0)|0)|0;s=Rj(p,f,n,y);r=s+d|0;b=da+b|0;s=r>>>0>>0?b+1|0:b;b=H[e+88>>2];f=H[e+80>>2];d:{if(I[e+92|0]){e:{f:{g:{h:{if((b|0)==-1){break h}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;if((b|0)==-1|H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break h}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];if((b|0)!=-1){break g}}H[e+88>>2]=-1;break f}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;H[e+88>>2]=b;if((b|0)!=-1){break e}}b=H[e+84>>2];d=-1;i:{if((b|0)==-1){break i}j:{if((b>>>0)%3|0){b=b-1|0;break j}b=b+2|0;d=-1;if((b|0)==-1){break i}}d=-1;if(H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break i}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break i}d=b-1|0;if((b>>>0)%3|0){break i}d=b+2|0}F[e+92|0]=0;H[e+88>>2]=d;break d}if((b|0)!=H[e+84>>2]){break d}H[e+88>>2]=-1;break d}d=-1;k:{if((b|0)==-1){break k}l:{if((b>>>0)%3|0){b=b-1|0;break l}b=b+2|0;d=-1;if((b|0)==-1){break k}}d=-1;if(H[H[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break k}b=H[H[H[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break k}d=b-1|0;if((b>>>0)%3|0){break k}d=b+2|0}H[e+88>>2]=d}b=H[e+88>>2];if((b|0)!=-1){continue}break}}b=s>>31;f=b^r;d=f-b|0;b=(b^s)-((b>>>0>f>>>0)+b|0)|0;m=-1;f=2147483647;g=q>>31;h=g^l;j=h-g|0;n=(g^q)-((h>>>0>>0)+g|0)|0;h=n;k=j^-1;g=h^2147483647;n=i;m:{n:{if(!H[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break m}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;f=a;g=i;a=g>>31;d=a;m=d^o;a=m-d|0;i=a;d=(d^g)-((d>>>0>m>>>0)+d|0)|0;a=a+f|0;d=d^2147483647;i=(d|0)==(b|0)&(i^-1)>>>0>>0|b>>>0>d>>>0;a=i?-1:a;if(!(i&0)&(a|0)<=536870912|(a|0)<536870912){break m}b=0;a=a>>>29|0;break n}o:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break o}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=i;d=i>>31;h=d^o;i=h-d|0;j=(d^k)-((d>>>0>h>>>0)+d|0)|0;g=j^2147483647;d=a;a=i;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break o}b=b+j|0;m=a+d|0;b=m>>>0>>0?b+1|0:b;f=b;if(!b&m>>>0<536870913){break m}}b=f>>>29|0;a=(f&536870911)<<3|m>>>29}o=Sj(o,n,a,b);l=Sj(l,q,a,b);r=Sj(r,s,a,b)}H[c+8>>2]=o;H[c+4>>2]=l;H[c>>2]=r;ca=e+96|0;return}Ca();v()}Ca();v()}Ca();v()}function Jj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;H[a+8>>2]=e;r=a+32|0;g=H[r>>2];f=H[a+36>>2]-g>>2;a:{if(f>>>0>>0){ya(r,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=g+(e<<2);d=e}w=e<<2;f=e>>>0>1073741823?-1:w;m=ra(pa(f),0,f);p=ra(pa(f),0,f);b:{if((d|0)<=0){break b}i=H[a+32>>2];while(1){d=h<<2;f=H[d+m>>2];g=H[a+16>>2];c:{if((f|0)>(g|0)){H[d+i>>2]=g;break c}d=d+i|0;g=H[a+12>>2];if((g|0)>(f|0)){H[d>>2]=g;break c}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){g=f<<2;d=g+c|0;g=H[b+g>>2]+H[g+i>>2]|0;H[d>>2]=g;d:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break d}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];x=H[f>>2];f=H[f+4>>2]-x|0;if((f|0)>=5){D=H[a+52>>2];s=H[a+48>>2];u=f>>>2|0;E=u>>>0<=2?2:u;y=e&-2;z=e&1;F=e&-4;A=e&3;B=e-1|0;n=1;while(1){e:{f:{g:{h:{if((n|0)!=(u|0)){g=H[(n<<2)+x>>2];t=(e|0)<=0;if(!t){ra(m,0,w)}if((g|0)==-1){i=N(e,n);break f}C=H[s>>2];l=0;f=g;while(1){i:{if(H[(f>>>3&536870908)+C>>2]>>>f&1){break i}i=H[H[H[s+64>>2]+12>>2]+(f<<2)>>2];if((i|0)==-1){break i}j=H[D>>2];h=H[s+28>>2];o=H[j+(H[h+(i<<2)>>2]<<2)>>2];if((o|0)>=(n|0)){break i}k=i+1|0;k=H[j+(H[h+(((k>>>0)%3|0?k:i-2|0)<<2)>>2]<<2)>>2];if((k|0)>=(n|0)){break i}i=H[j+(H[h+(i+((i>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((i|0)>=(n|0)){break i}j:{if(t){break j}i=N(e,i);j=N(e,k);o=N(e,o);h=0;q=0;if(B){while(1){H[(h<<2)+p>>2]=(H[(h+i<<2)+c>>2]+H[(h+j<<2)+c>>2]|0)-H[(h+o<<2)+c>>2];k=h|1;H[(k<<2)+p>>2]=(H[(i+k<<2)+c>>2]+H[(j+k<<2)+c>>2]|0)-H[(k+o<<2)+c>>2];h=h+2|0;q=q+2|0;if((y|0)!=(q|0)){continue}break}}if(z){H[(h<<2)+p>>2]=(H[(h+i<<2)+c>>2]+H[(h+j<<2)+c>>2]|0)-H[(h+o<<2)+c>>2]}if(t){break j}o=0;h=0;i=0;if(e>>>0>3){while(1){j=h<<2;k=j+m|0;H[k>>2]=H[j+p>>2]+H[k>>2];k=j|4;q=k+m|0;H[q>>2]=H[k+p>>2]+H[q>>2];k=j|8;q=k+m|0;H[q>>2]=H[k+p>>2]+H[q>>2];j=j|12;k=j+m|0;H[k>>2]=H[j+p>>2]+H[k>>2];h=h+4|0;i=i+4|0;if((F|0)!=(i|0)){continue}break}}if(!A){break j}while(1){i=h<<2;j=i+m|0;H[j>>2]=H[i+p>>2]+H[j>>2];h=h+1|0;o=o+1|0;if((A|0)!=(o|0)){continue}break}}l=l+1|0}k:{l:{if((f>>>0)%3|0){h=f-1|0;break l}h=f+2|0;i=-1;if((h|0)==-1){break k}}i=-1;if(H[(h>>>3&536870908)+C>>2]>>>h&1){break k}f=H[H[H[s+64>>2]+12>>2]+(h<<2)>>2];i=-1;if((f|0)==-1){break k}i=f-1|0;if((f>>>0)%3|0){break k}i=f+2|0}f=i;if((g|0)!=(f|0)&(f|0)!=-1){continue}break}i=N(e,n);if(!l){break f}if(t){break g}h=0;f=0;if(!B){break h}while(1){g=h<<2;j=g+m|0;H[j>>2]=H[j>>2]/(l|0);g=(g|4)+m|0;H[g>>2]=H[g>>2]/(l|0);h=h+2|0;f=f+2|0;if((y|0)!=(f|0)){continue}break}break h}Ca();v()}if(!z){break g}f=(h<<2)+m|0;H[f>>2]=H[f>>2]/(l|0)}if((d|0)<=0){break e}l=H[r>>2];h=0;while(1){d=h<<2;f=H[d+m>>2];g=H[a+16>>2];m:{if((f|0)>(g|0)){H[d+l>>2]=g;break m}d=d+l|0;g=H[a+12>>2];if((g|0)>(f|0)){H[d>>2]=g;break m}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=i<<2;i=d+c|0;h=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[h+g>>2]+H[g+l>>2]|0;H[d>>2]=g;n:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break n}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}if((d|0)<=0){break e}g=(N(n-1|0,e)<<2)+c|0;l=H[r>>2];h=0;while(1){d=h<<2;f=H[d+g>>2];j=H[a+16>>2];o:{if((f|0)>(j|0)){H[d+l>>2]=j;break o}d=d+l|0;j=H[a+12>>2];if((j|0)>(f|0)){H[d>>2]=j;break o}H[d>>2]=f}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=i<<2;i=d+c|0;h=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[h+g>>2]+H[g+l>>2]|0;H[d>>2]=g;p:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break p}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}n=n+1|0;if((E|0)!=(n|0)){continue}break}}oa(p);oa(m);return 1}function sj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;H[a+8>>2]=e;r=a+32|0;f=H[r>>2];j=H[a+36>>2]-f>>2;a:{if(j>>>0>>0){ya(r,e-j|0);d=H[a+8>>2];break a}d=e;if(e>>>0>=j>>>0){break a}H[a+36>>2]=f+(e<<2);d=e}u=e<<2;f=e>>>0>1073741823?-1:u;m=ra(pa(f),0,f);p=ra(pa(f),0,f);b:{if((d|0)<=0){break b}i=H[a+32>>2];while(1){f=h<<2;j=H[f+m>>2];d=H[a+16>>2];c:{if((j|0)>(d|0)){H[f+i>>2]=d;break c}f=f+i|0;d=H[a+12>>2];if((d|0)>(j|0)){H[f>>2]=d;break c}H[f>>2]=j}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){j=f<<2;d=j+c|0;j=H[b+j>>2]+H[j+i>>2]|0;H[d>>2]=j;d:{if((j|0)>H[a+16>>2]){j=j-H[a+20>>2]|0}else{if((j|0)>=H[a+12>>2]){break d}j=j+H[a+20>>2]|0}H[d>>2]=j}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];w=H[f>>2];f=H[f+4>>2]-w|0;if((f|0)>=5){D=H[a+52>>2];x=H[a+48>>2];t=f>>>2|0;E=t>>>0<=2?2:t;y=e&-2;z=e&1;F=e&-4;A=e&3;B=e-1|0;n=1;while(1){e:{f:{g:{h:{if((n|0)!=(t|0)){j=H[(n<<2)+w>>2];s=(e|0)<=0;if(!s){ra(m,0,u)}if((j|0)==-1){g=N(e,n);break f}C=H[x+12>>2];q=0;f=j;while(1){h=H[(f<<2)+C>>2];i:{if((h|0)==-1){break i}o=H[D>>2];l=H[x>>2];k=H[o+(H[l+(h<<2)>>2]<<2)>>2];i=h+1|0;i=(i>>>0)%3|0?i:h-2|0;if((i|0)!=-1){g=H[l+(i<<2)>>2]}else{g=-1}j:{k:{if((h>>>0)%3|0){h=h-1|0;break k}h=h+2|0;i=-1;if((h|0)==-1){break j}}i=H[l+(h<<2)>>2]}if((k|0)>=(n|0)){break i}g=H[(g<<2)+o>>2];if((g|0)>=(n|0)){break i}i=H[o+(i<<2)>>2];if((i|0)>=(n|0)){break i}l:{if(s){break l}l=N(e,i);o=N(e,g);k=N(e,k);h=0;i=0;if(B){while(1){H[(h<<2)+p>>2]=(H[(h+l<<2)+c>>2]+H[(h+o<<2)+c>>2]|0)-H[(h+k<<2)+c>>2];g=h|1;H[(g<<2)+p>>2]=(H[(g+l<<2)+c>>2]+H[(g+o<<2)+c>>2]|0)-H[(g+k<<2)+c>>2];h=h+2|0;i=i+2|0;if((y|0)!=(i|0)){continue}break}}if(z){H[(h<<2)+p>>2]=(H[(h+l<<2)+c>>2]+H[(h+o<<2)+c>>2]|0)-H[(h+k<<2)+c>>2]}if(s){break l}o=0;h=0;k=0;if(e>>>0>3){while(1){l=h<<2;i=l+m|0;H[i>>2]=H[l+p>>2]+H[i>>2];g=l|4;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];g=l|8;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];g=l|12;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];h=h+4|0;k=k+4|0;if((F|0)!=(k|0)){continue}break}}if(!A){break l}while(1){g=h<<2;i=g+m|0;H[i>>2]=H[g+p>>2]+H[i>>2];h=h+1|0;o=o+1|0;if((A|0)!=(o|0)){continue}break}}q=q+1|0}m:{n:{if((f>>>0)%3|0){h=f-1|0;break n}h=f+2|0;g=-1;if((h|0)==-1){break m}}f=H[(h<<2)+C>>2];g=-1;if((f|0)==-1){break m}g=f-1|0;if((f>>>0)%3|0){break m}g=f+2|0}f=g;if((j|0)!=(f|0)&(f|0)!=-1){continue}break}g=N(e,n);if(!q){break f}if(s){break g}h=0;f=0;if(!B){break h}while(1){i=h<<2;j=i+m|0;H[j>>2]=H[j>>2]/(q|0);j=(i|4)+m|0;H[j>>2]=H[j>>2]/(q|0);h=h+2|0;f=f+2|0;if((y|0)!=(f|0)){continue}break}break h}Ca();v()}if(!z){break g}f=(h<<2)+m|0;H[f>>2]=H[f>>2]/(q|0)}if((d|0)<=0){break e}k=H[r>>2];h=0;while(1){f=h<<2;j=H[f+m>>2];d=H[a+16>>2];o:{if((j|0)>(d|0)){H[f+k>>2]=d;break o}f=f+k|0;d=H[a+12>>2];if((d|0)>(j|0)){H[f>>2]=d;break o}H[f>>2]=j}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=g<<2;i=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[g+j>>2]+H[g+k>>2]|0;H[d>>2]=g;p:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break p}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}if((d|0)<=0){break e}f=(N(n-1|0,e)<<2)+c|0;k=H[r>>2];h=0;while(1){j=h<<2;i=H[j+f>>2];d=H[a+16>>2];q:{if((i|0)>(d|0)){H[j+k>>2]=d;break q}j=j+k|0;d=H[a+12>>2];if((d|0)>(i|0)){H[j>>2]=d;break q}H[j>>2]=i}d=H[a+8>>2];h=h+1|0;if((d|0)>(h|0)){continue}break}f=0;if((d|0)<=0){break e}d=g<<2;i=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+i|0;g=H[g+j>>2]+H[g+k>>2]|0;H[d>>2]=g;r:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break r}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}n=n+1|0;if((E|0)!=(n|0)){continue}break}}oa(p);oa(m);return 1}function xa(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;f=ca-32|0;ca=f;a:{b=H[a+16>>2];b:{if(b>>>0>=341){H[a+16>>2]=b-341;b=H[a+4>>2];j=H[b>>2];c=b+4|0;H[a+4>>2]=c;b=H[a+8>>2];c:{if((b|0)!=H[a+12>>2]){d=b;break c}k=H[a>>2];if(k>>>0>>0){e=((c-k>>2)+1|0)/-2<<2;b=b-c|0;d=va(e+c|0,c,b)+b|0;H[a+8>>2]=d;H[a+4>>2]=e+H[a+4>>2];break c}d=(b|0)==(k|0)?1:b-k>>1;if(d>>>0>=1073741824){break a}e=d<<2;h=pa(e);l=e+h|0;e=h+(d&-4)|0;d=e;d:{if((b|0)==(c|0)){break d}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;e:{if(!g){b=e;break e}d=0;b=e;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=e+m|0;if(i>>>0<28){break d}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((d|0)!=(b|0)){continue}break}}H[a+12>>2]=l;H[a+8>>2]=d;H[a+4>>2]=e;H[a>>2]=h;if(!k){break c}oa(k);d=H[a+8>>2]}H[d>>2]=j;H[a+8>>2]=H[a+8>>2]+4;break b}c=H[a+8>>2];b=H[a+4>>2];l=c-b|0;h=l>>2;g=H[a+12>>2];d=H[a>>2];e=g-d|0;if(h>>>0>2>>>0){if((c|0)!=(g|0)){n=f,o=pa(4092),H[n+8>>2]=o;d=a;f:{g:{b=H[a+8>>2];h:{if((b|0)!=H[a+12>>2]){e=b;break h}c=H[d+4>>2];h=H[d>>2];if(c>>>0>h>>>0){g=((c-h>>2)+1|0)/-2<<2;a=b-c|0;e=va(g+c|0,c,a)+a|0;H[d+8>>2]=e;H[d+4>>2]=g+H[d+4>>2];break h}e=(b|0)==(h|0)?1:b-h>>1;if(e>>>0>=1073741824){break g}a=e<<2;j=pa(a);l=a+j|0;a=j+(e&-4)|0;e=a;i:{if((b|0)==(c|0)){break i}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;j:{if(!g){b=a;break j}e=0;b=a;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;e=e+1|0;if((g|0)!=(e|0)){continue}break}}e=a+m|0;if(i>>>0<28){break i}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((e|0)!=(b|0)){continue}break}}H[d+12>>2]=l;H[d+8>>2]=e;H[d+4>>2]=a;H[d>>2]=j;if(!h){break h}oa(h);e=H[d+8>>2]}H[e>>2]=H[f+8>>2];H[d+8>>2]=H[d+8>>2]+4;break f}wa();v()}break b}n=f,o=pa(4092),H[n+8>>2]=o;qd(a,f+8|0);b=H[a+4>>2];j=H[b>>2];c=b+4|0;H[a+4>>2]=c;b=H[a+8>>2];k:{if((b|0)!=H[a+12>>2]){d=b;break k}k=H[a>>2];if(k>>>0>>0){e=((c-k>>2)+1|0)/-2<<2;b=b-c|0;d=va(e+c|0,c,b)+b|0;H[a+8>>2]=d;H[a+4>>2]=e+H[a+4>>2];break k}d=(b|0)==(k|0)?1:b-k>>1;if(d>>>0>=1073741824){break a}e=d<<2;h=pa(e);l=e+h|0;e=h+(d&-4)|0;d=e;l:{if((b|0)==(c|0)){break l}b=b-c|0;m=b&-4;i=b-4|0;g=(i>>>2|0)+1&7;m:{if(!g){b=e;break m}d=0;b=e;while(1){H[b>>2]=H[c>>2];c=c+4|0;b=b+4|0;d=d+1|0;if((g|0)!=(d|0)){continue}break}}d=e+m|0;if(i>>>0<28){break l}while(1){H[b>>2]=H[c>>2];H[b+4>>2]=H[c+4>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=H[c+12>>2];H[b+16>>2]=H[c+16>>2];H[b+20>>2]=H[c+20>>2];H[b+24>>2]=H[c+24>>2];H[b+28>>2]=H[c+28>>2];c=c+32|0;b=b+32|0;if((d|0)!=(b|0)){continue}break}}H[a+12>>2]=l;H[a+8>>2]=d;H[a+4>>2]=e;H[a>>2]=h;if(!k){break k}oa(k);d=H[a+8>>2]}H[d>>2]=j;H[a+8>>2]=H[a+8>>2]+4;break b}H[f+24>>2]=a+12;m=(d|0)==(g|0)?1:e>>1;if(m>>>0>=1073741824){break a}e=m<<2;g=pa(e);H[f+8>>2]=g;j=e+g|0;H[f+20>>2]=j;d=(h<<2)+g|0;H[f+12>>2]=d;i=pa(4092);n:{if((h|0)!=(m|0)){break n}if((l|0)>0){d=((h+1|0)/-2<<2)+d|0;H[f+12>>2]=d;break n}d=(b|0)==(c|0)?1:l>>1;if(d>>>0>=1073741824){break a}b=d<<2;e=pa(b);H[f+8>>2]=e;j=b+e|0;H[f+20>>2]=j;d=e+(d&-4)|0;H[f+12>>2]=d;oa(g);b=H[a+4>>2];c=H[a+8>>2];g=e}H[d>>2]=i;i=d+4|0;H[f+16>>2]=i;e=b;if((b|0)!=(c|0)){while(1){c=c-4|0;qd(f+8|0,c);if(H[a+4>>2]!=(c|0)){continue}break}j=H[f+20>>2];i=H[f+16>>2];d=H[f+12>>2];g=H[f+8>>2];e=c;b=H[a+8>>2]}c=H[a>>2];H[a>>2]=g;H[f+8>>2]=c;H[a+4>>2]=d;H[f+12>>2]=e;H[a+8>>2]=i;H[f+16>>2]=b;d=H[a+12>>2];H[a+12>>2]=j;H[f+20>>2]=d;if((b|0)!=(e|0)){H[f+16>>2]=((e-b|0)+3&-4)+b}if(!c){break b}oa(c)}ca=f+32|0;return}wa();v()}function Aj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=O(0),j=0,k=0,l=0,m=O(0),n=O(0),o=O(0),p=O(0),q=O(0),r=0,s=O(0),t=O(0),u=O(0),w=O(0),x=0,y=O(0),z=O(0),A=O(0),B=0;a:{b:{if((e|0)!=2){break b}H[a+64>>2]=f;H[a+72>>2]=2;e=pa(8);d=H[a+68>>2];H[a+68>>2]=e;if(d){oa(d)}H[a+8>>2]=2;x=a+32|0;e=H[x>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(x,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}h=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}d=d>>>2|0;B=d>>>0<=1?1:d;d=0;while(1){e=H[a+56>>2];h=H[e>>2];if(H[e+4>>2]-h>>2>>>0<=d>>>0){break a}q=O(0);g=ca-48|0;ca=g;e=-1;h=H[h+(d<<2)>>2];f=-1;d:{if((h|0)==-1){break d}e=h+1|0;e=(e>>>0)%3|0?e:h-2|0;f=h-1|0;if((h>>>0)%3|0){break d}f=h+2|0}j=H[a+52>>2];h=H[j>>2];e:{f:{j=H[j+4>>2]-h>>2;l=e<<2;e=H[H[a+48>>2]+28>>2];r=H[l+e>>2];if(j>>>0<=r>>>0){break f}e=H[e+(f<<2)>>2];if(e>>>0>=j>>>0){break f}j=H[h+(e<<2)>>2];f=H[h+(r<<2)>>2];g:{if(!((j|0)>=(d|0)|(f|0)>=(d|0))){e=H[a+72>>2];h=(N(e,j)<<2)+c|0;m=O(H[h+4>>2]);e=(N(e,f)<<2)+c|0;p=O(H[e+4>>2]);y=O(H[e>>2]);n=O(H[h>>2]);if(!(y!=n|m!=p)){h=+m>2147483647;e=H[a+68>>2];if(O(P(m))>2]=m2147483647;if(O(P(n))>2]=n>2]+(d<<2)>>2];H[g+40>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;h=H[a+60>>2];if(!I[h+84|0]){e=H[H[h+68>>2]+(e<<2)>>2]}Va(h,e,F[h+24|0],g+32|0);f=H[H[a+64>>2]+(f<<2)>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g+16|0);f=H[H[a+64>>2]+(j<<2)>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g);o=L[g+24>>2];s=O(L[g+8>>2]-o);t=L[g+20>>2];u=O(L[g+4>>2]-t);A=L[g+16>>2];w=O(L[g>>2]-A);z=O(O(s*s)+O(O(u*u)+O(O(w*w)+O(0))));h:{if(H[a+88>>2]>=258){i=O(0);if(!(z>O(0))){break h}}i=O(L[g+40>>2]-o);o=O(L[g+36>>2]-t);t=O(L[g+32>>2]-A);q=O(O(O(s*i)+O(O(u*o)+O(O(w*t)+O(0))))/z);i=O(i-O(s*q));s=O(i*i);i=O(o-O(u*q));o=O(i*i);i=O(t-O(w*q));i=O(W(O(O(s+O(o+O(O(i*i)+O(0))))/z)))}f=H[a+80>>2];if(f){e=f-1|0;h=H[H[a+76>>2]+(e>>>3&536870908)>>2];H[a+80>>2]=e;m=O(m-p);o=O(O(m*q)+p);n=O(n-y);p=O(n*i);e=h>>>e&1;p=O(o+(e?p:O(-p)));i=O(i*m);k=T(+O(O(O(n*q)+y)+(e?O(-i):i))+.5);i:{if(k<-2147483648|k!=k|k>2147483647){e=H[a+68>>2];H[e>>2]=-2147483648;break i}e=H[a+68>>2];if(P(k)<2147483648){h=~~k}else{h=-2147483648}H[e>>2]=h}k=T(+p+.5);j=k>2147483647;if(P(k)<2147483648){h=~~k}else{h=-2147483648}H[e+4>>2]=k<-2147483648?-2147483648:k!=k?-2147483648:j?-2147483648:h}f=(f|0)!=0;break g}j:{if((d|0)>(f|0)){e=H[a+72>>2];h=N(f,e);break j}if((d|0)<=0){f=1;if(H[a+72>>2]<=0){break g}h=H[a+68>>2];e=0;while(1){H[h+(e<<2)>>2]=0;e=e+1|0;if((e|0)>2]){continue}break}break g}e=H[a+72>>2];h=N(e,d-1|0)}f=1;if((e|0)<=0){break g}j=H[a+68>>2];e=0;while(1){H[j+(e<<2)>>2]=H[(e+h<<2)+c>>2];e=e+1|0;if((e|0)>2]){continue}break}}ca=g+48|0;break e}Ca();v()}h=f;if(!h){return 0}k:{if(H[a+8>>2]<=0){break k}r=H[a+68>>2];j=H[x>>2];e=0;while(1){f=e<<2;g=H[f+r>>2];l=H[a+16>>2];l:{if((g|0)>(l|0)){H[f+j>>2]=l;break l}f=f+j|0;l=H[a+12>>2];if((l|0)>(g|0)){H[f>>2]=l;break l}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break k}e=d<<3;r=e+c|0;l=b+e|0;while(1){g=f<<2;e=g+r|0;g=H[g+l>>2]+H[g+j>>2]|0;H[e>>2]=g;m:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break m}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((B|0)!=(d|0)){continue}break}}return h|0}Ca();v()}function kj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=O(0),j=0,k=0,l=O(0),m=O(0),n=O(0),o=O(0),p=0,q=O(0),r=O(0),s=O(0),t=O(0),u=O(0),w=0,x=O(0),y=O(0),z=0,A=O(0),B=0;a:{b:{if((e|0)!=2){break b}H[a+64>>2]=f;H[a+72>>2]=2;e=pa(8);d=H[a+68>>2];H[a+68>>2]=e;if(d){oa(d)}H[a+8>>2]=2;w=a+32|0;e=H[w>>2];d=H[a+36>>2]-e|0;c:{if(d>>>0<=7){ya(w,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}H[a+36>>2]=e+8}h=1;d=H[a+56>>2];d=H[d+4>>2]-H[d>>2]|0;if((d|0)<=0){break b}d=d>>>2|0;B=d>>>0<=1?1:d;d=0;while(1){f=H[a+56>>2];e=H[f>>2];if(H[f+4>>2]-e>>2>>>0<=d>>>0){break a}q=O(0);g=ca-48|0;ca=g;h=-1;d:{e:{e=H[e+(d<<2)>>2];if((e|0)==-1){break e}j=H[a+48>>2];f=e+1|0;f=(f>>>0)%3|0?f:e-2|0;if((f|0)!=-1){h=H[H[j>>2]+(f<<2)>>2]}f=-1;e=e+((e>>>0)%3|0?-1:2)|0;if((e|0)!=-1){f=H[H[j>>2]+(e<<2)>>2]}e=H[a+52>>2];j=H[e>>2];e=H[e+4>>2]-j>>2;if(e>>>0<=h>>>0|e>>>0<=f>>>0){break e}e=H[j+(h<<2)>>2];j=H[j+(f<<2)>>2];f:{if(!((d|0)<=(e|0)|(j|0)>=(d|0))){f=H[a+72>>2];h=(N(f,j)<<2)+c|0;l=O(H[h+4>>2]);f=(N(e,f)<<2)+c|0;o=O(H[f+4>>2]);x=O(H[f>>2]);m=O(H[h>>2]);if(!(x!=m|l!=o)){h=+l>2147483647;e=H[a+68>>2];if(O(P(l))>2]=l2147483647;if(O(P(m))>2]=m>2]+(d<<2)>>2];H[g+40>>2]=0;H[g+32>>2]=0;H[g+36>>2]=0;h=H[a+60>>2];if(!I[h+84|0]){f=H[H[h+68>>2]+(f<<2)>>2]}Va(h,f,F[h+24|0],g+32|0);f=H[H[a+64>>2]+(e<<2)>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){f=H[H[e+68>>2]+(f<<2)>>2]}Va(e,f,F[e+24|0],g+16|0);h=H[H[a+64>>2]+(j<<2)>>2];H[g+8>>2]=0;H[g>>2]=0;H[g+4>>2]=0;e=H[a+60>>2];if(!I[e+84|0]){h=H[H[e+68>>2]+(h<<2)>>2]}Va(e,h,F[e+24|0],g);n=L[g+24>>2];r=O(L[g+8>>2]-n);s=L[g+20>>2];t=O(L[g+4>>2]-s);A=L[g+16>>2];u=O(L[g>>2]-A);y=O(O(r*r)+O(O(t*t)+O(O(u*u)+O(0))));g:{if(H[a+88>>2]>=258){i=O(0);if(!(y>O(0))){break g}}i=O(L[g+40>>2]-n);n=O(L[g+36>>2]-s);s=O(L[g+32>>2]-A);q=O(O(O(r*i)+O(O(t*n)+O(O(u*s)+O(0))))/y);i=O(i-O(r*q));r=O(i*i);i=O(n-O(t*q));n=O(i*i);i=O(s-O(u*q));i=O(W(O(O(r+O(n+O(O(i*i)+O(0))))/y)))}e=H[a+80>>2];if(e){f=e-1|0;h=H[H[a+76>>2]+(f>>>3&536870908)>>2];H[a+80>>2]=f;l=O(l-o);n=O(O(l*q)+o);m=O(m-x);o=O(m*i);f=h>>>f&1;o=O(n+(f?o:O(-o)));i=O(i*l);k=T(+O(O(O(m*q)+x)+(f?O(-i):i))+.5);h:{if(k<-2147483648|k!=k|k>2147483647){h=H[a+68>>2];H[h>>2]=-2147483648;break h}h=H[a+68>>2];if(P(k)<2147483648){f=~~k}else{f=-2147483648}H[h>>2]=f}k=T(+o+.5);j=k>2147483647;if(P(k)<2147483648){f=~~k}else{f=-2147483648}H[h+4>>2]=k<-2147483648?-2147483648:k!=k?-2147483648:j?-2147483648:f}h=(e|0)!=0;break f}i:{if((d|0)>(e|0)){f=H[a+72>>2];e=N(e,f);break i}if((d|0)<=0){h=1;if(H[a+72>>2]<=0){break f}e=H[a+68>>2];f=0;while(1){H[e+(f<<2)>>2]=0;f=f+1|0;if((f|0)>2]){continue}break}break f}f=H[a+72>>2];e=N(f,d-1|0)}h=1;if((f|0)<=0){break f}j=H[a+68>>2];f=0;while(1){H[j+(f<<2)>>2]=H[(e+f<<2)+c>>2];f=f+1|0;if((f|0)>2]){continue}break}}ca=g+48|0;break d}Ca();v()}if(!h){return 0}j:{if(H[a+8>>2]<=0){break j}z=H[a+68>>2];j=H[w>>2];e=0;while(1){f=e<<2;g=H[f+z>>2];p=H[a+16>>2];k:{if((g|0)>(p|0)){H[f+j>>2]=p;break k}f=f+j|0;p=H[a+12>>2];if((p|0)>(g|0)){H[f>>2]=p;break k}H[f>>2]=g}e=e+1|0;g=H[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break j}e=d<<3;z=e+c|0;p=b+e|0;while(1){g=f<<2;e=g+z|0;g=H[g+p>>2]+H[g+j>>2]|0;H[e>>2]=g;l:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break l}g=g+H[a+20>>2]|0}H[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((B|0)!=(d|0)){continue}break}}return h|0}Ca();v()}function Of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;f=ca-704|0;ca=f;n=1;a:{b:{c:{d:{if(J[b+38>>1]<515){break d}n=0;c=H[b+20>>2];d=H[b+12>>2];g=H[b+16>>2];if((c|0)>=(d|0)&g>>>0>=K[b+8>>2]|(c|0)>(d|0)){break d}p=I[H[b>>2]+g|0];g=g+1|0;c=g?c:c+1|0;H[b+16>>2]=g;H[b+20>>2]=c;g=H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+80>>2];c=ea[H[H[a>>2]+24>>2]](a)|0;H[f+40>>2]=0;H[f+32>>2]=0;H[f+36>>2]=0;if(c){if(c>>>0>=214748365){break c}c=N(c,20);d=pa(c);H[f+32>>2]=d;H[f+40>>2]=c+d;c=c-20|0;c=(c-((c>>>0)%20|0)|0)+20|0;q=f,r=ra(d,0,c)+c|0,H[q+36>>2]=r}e:{if((ea[H[H[a>>2]+24>>2]](a)|0)>0){while(1){c=ea[H[H[a>>2]+20>>2]](a,l)|0;c=H[H[H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2]+8>>2]+(c<<2)>>2];mb(c,g);F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];d=H[c+28>>2];if(d>>>0>9){break e}f:{g:{h:{e=1<>2],d,6,0,i,i>>31);c=jc(pa(96),e);H[f>>2]=c;F[c+84|0]=1;H[c+72>>2]=H[c+68>>2];mb(c,g);c=H[a+64>>2];if(c>>>0>=K[a+68>>2]){break h}d=H[f>>2];H[f>>2]=0;H[c>>2]=d;c=c+4|0;H[a+64>>2]=c;break g}j=0;if(!I[c+24|0]){break f}while(1){d=H[a+52>>2];i=H[a+56>>2];i:{if(d>>>0>>0){H[d>>2]=0;H[a+52>>2]=d+4;break i}e=d;d=H[a+48>>2];m=e-d|0;k=m>>2;e=k+1|0;if(e>>>0>=1073741824){break b}o=k<<2;i=i-d|0;k=i>>>1|0;e=i>>>0>=2147483644?1073741823:e>>>0>>0?k:e;if(e){if(e>>>0>=1073741824){break a}i=pa(e<<2)}else{i=0}k=o+i|0;H[k>>2]=0;o=e<<2;e=va(i,d,m);H[a+56>>2]=o+e;H[a+52>>2]=k+4;H[a+48>>2]=e;if(!d){break i}oa(d)}j=j+1|0;if(j>>>0>2];i=H[a+64>>2]-e>>2;d=i+1|0;if(d>>>0<1073741824){e=H[a+68>>2]-e|0;j=e>>>1|0;e=e>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(e){if(e>>>0>=1073741824){break l}c=pa(e<<2)}j=H[f>>2];H[f>>2]=0;d=(i<<2)+c|0;H[d>>2]=j;e=(e<<2)+c|0;i=d+4|0;c=H[a+64>>2];j=H[a+60>>2];if((c|0)==(j|0)){break k}while(1){c=c-4|0;m=H[c>>2];H[c>>2]=0;d=d-4|0;H[d>>2]=m;if((c|0)!=(j|0)){continue}break}H[a+68>>2]=e;e=H[a+64>>2];H[a+64>>2]=i;c=H[a+60>>2];H[a+60>>2]=d;if((c|0)==(e|0)){break j}while(1){e=e-4|0;d=H[e>>2];H[e>>2]=0;if(d){Ga(d)}if((c|0)!=(e|0)){continue}break}break j}sa();v()}wa();v()}H[a+68>>2]=e;H[a+64>>2]=i;H[a+60>>2]=d}if(c){oa(c)}c=H[a+64>>2]}c=H[c-4>>2];d=H[f>>2];H[f>>2]=0;if(!d){break f}Ga(d)}i=H[c+28>>2];d=i-1|0;if(d>>>0<=10){e=H[(d<<2)+13584>>2]}else{e=-1}d=H[f+32>>2]+N(l,20)|0;j=I[c+24|0];H[d+16>>2]=j;H[d+12>>2]=(e|0)>0?e:0;H[d+8>>2]=i;H[d+4>>2]=h;H[d>>2]=c;h=h+j|0;l=l+1|0;if((ea[H[H[a>>2]+24>>2]](a)|0)>(l|0)){continue}break}}a=Ac(f,f+32|0);m:{n:{o:{switch(p|0){case 0:c=wb(f+48|0,h);b=Bd(c,b,a,g);h=H[c+8>>2];xb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 1:c=wb(f+48|0,h);b=zd(c,b,a,g);h=H[c+8>>2];xb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 2:c=ub(f+48|0,h);b=yd(c,b,a,g);h=H[c+8>>2];vb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 3:c=ub(f+48|0,h);b=xd(c,b,a,g);h=H[c+8>>2];vb(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 4:c=$a(f+48|0,h);b=wd(c,b,a,g);h=H[c+8>>2];ab(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 5:c=$a(f+48|0,h);b=vd(c,b,a,g);h=H[c+8>>2];ab(c);if(!b){break m}if((h|0)==(g|0)){break n}break m;case 6:break o;default:break m}}c=$a(f+48|0,h);b=ud(c,b,a,g);h=H[c+8>>2];ab(c);if(!b|(h|0)!=(g|0)){break m}}n=1}b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a>>2];if(!b){break e}H[a+4>>2]=b;oa(b)}a=H[f+32>>2];if(!a){break d}H[f+36>>2]=a;oa(a)}ca=f+704|0;return n|0}sa();v()}sa();v()}wa();v()}function Zi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=ca-32|0;ca=e;a:{b:{switch(c-2|0){case 0:c=H[a+4>>2];f=H[a+12>>2];H[e+24>>2]=-1;H[e+16>>2]=-1;H[e+20>>2]=1065353216;H[e+8>>2]=-1;H[e+12>>2]=-1;if((b|0)==-2){break a}i=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){h=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];c:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break c}g=ea[H[H[c>>2]+36>>2]](c)|0;a=ea[H[H[c>>2]+44>>2]](c,f)|0;if(!g|!a){break c}f=ea[H[H[c>>2]+40>>2]](c,f)|0;d:{if(f){if((b|0)!=6){break c}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=f;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=f;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=7144;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=7668;a=d+96|0;break d}if((b|0)!=6){break c}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=g;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=g;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=8080;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=8472;a=d+96|0}H[a>>2]=0;H[a+4>>2]=0;F[a+5|0]=0;F[a+6|0]=0;F[a+7|0]=0;F[a+8|0]=0;F[a+9|0]=0;F[a+10|0]=0;F[a+11|0]=0;F[a+12|0]=0}if(d){break a}}d=pa(28);H[d+4>>2]=i;a=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=a;a=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=a;H[d+24>>2]=H[e+24>>2];H[d>>2]=8860;break a;case 1:break b;default:break a}}c=H[a+4>>2];f=H[a+12>>2];H[e+24>>2]=-1;H[e+16>>2]=-1;H[e+20>>2]=1065353216;H[e+8>>2]=-1;H[e+12>>2]=-1;if((b|0)==-2){break a}i=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];if((ea[H[H[c>>2]+8>>2]](c)|0)==1){h=H[H[H[c+4>>2]+8>>2]+(f<<2)>>2];e:{if((ea[H[H[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break e}g=ea[H[H[c>>2]+36>>2]](c)|0;a=ea[H[H[c>>2]+44>>2]](c,f)|0;if(!g|!a){break e}f=ea[H[H[c>>2]+40>>2]](c,f)|0;f:{if(f){if((b|0)!=6){break e}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=f;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=f;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=9028;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=9592;a=d+96|0;break f}if((b|0)!=6){break e}b=H[c+44>>2];d=pa(112);H[d+4>>2]=h;c=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=c;c=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=c;H[d+24>>2]=H[e+24>>2];H[d+40>>2]=a;c=a+12|0;H[d+36>>2]=c;H[d+32>>2]=g;H[d+28>>2]=b;H[d+68>>2]=a;H[d- -64>>2]=c;H[d+60>>2]=g;H[d+56>>2]=b;H[d+48>>2]=0;H[d+52>>2]=0;H[d>>2]=10032;H[d+88>>2]=1065353216;H[d+92>>2]=-1;H[d+80>>2]=-1;H[d+84>>2]=-1;H[d+72>>2]=1;H[d+76>>2]=-1;H[d+44>>2]=10452;a=d+96|0}H[a>>2]=0;H[a+4>>2]=0;F[a+5|0]=0;F[a+6|0]=0;F[a+7|0]=0;F[a+8|0]=0;F[a+9|0]=0;F[a+10|0]=0;F[a+11|0]=0;F[a+12|0]=0}if(d){break a}}d=pa(28);H[d+4>>2]=i;a=H[e+12>>2];H[d+8>>2]=H[e+8>>2];H[d+12>>2]=a;a=H[e+20>>2];H[d+16>>2]=H[e+16>>2];H[d+20>>2]=a;H[d+24>>2]=H[e+24>>2];H[d>>2]=10864}ca=e+32|0;return d|0}function Ki(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=O(0),f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=O(0),p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;if(H[c>>2]==H[c+4>>2]){m=H[d+80>>2];u=ca-16|0;ca=u;g=H[a+4>>2];k=I[b+24|0];h=H[d+48>>2];n=H[H[d>>2]>>2];c=u+8|0;H[c>>2]=1065353216;d=c;L[c>>2]=O(-1<>2];c=pa(k<<2);a:{if(!m|!k){break a}p=h+n|0;o=L[d>>2];n=H[a+8>>2];v=H[b>>2];d=H[b+48>>2];g=H[b+40>>2];w=H[b+44>>2];if(!I[b+84|0]){f=H[b+68>>2];s=k&254;t=k&1;a=0;while(1){b=H[v>>2];l=Rj(g,w,H[f+(i<<2)>>2],0)+d|0;h=qa(c,b+l|0,g);b=0;q=0;if((k|0)!=1){while(1){l=p+(a<<2)|0;j=b<<2;e=O(T(O(O(o*O(L[j+h>>2]-L[n+j>>2]))+O(.5))));b:{if(O(P(e))>2]=r;j=j|4;e=O(T(O(O(o*O(L[j+h>>2]-L[n+j>>2]))+O(.5))));c:{if(O(P(e))>2]=j;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){l=p+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+h>>2]-L[b+n>>2]))+O(.5))));d:{if(O(P(e))>2]=b;a=a+1|0}i=i+1|0;if((m|0)!=(i|0)){continue}break}break a}s=k&254;t=k&1;a=0;while(1){b=H[v>>2];h=Rj(g,w,i,l)+d|0;j=qa(c,b+h|0,g);b=0;q=0;if((k|0)!=1){while(1){h=p+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+j>>2]-L[f+n>>2]))+O(.5))));e:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+j>>2]-L[f+n>>2]))+O(.5))));f:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){h=p+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+j>>2]-L[b+n>>2]))+O(.5))));g:{if(O(P(e))>2]=b;a=a+1|0}b=l;i=i+1|0;b=i?b:b+1|0;l=b;if((i|0)!=(m|0)|b){continue}break}}oa(c);ca=u+16|0;return 1}j=ca-16|0;ca=j;m=H[a+4>>2];i=I[b+24|0];g=H[d+48>>2];h=H[H[d>>2]>>2];d=j+8|0;H[d>>2]=1065353216;l=d;L[d>>2]=O(-1<>2];d=pa(i<<2);m=H[c+4>>2];q=H[c>>2];h:{if(!i|(m|0)==(q|0)){break h}n=h+g|0;c=m-q>>2;u=c>>>0<=1?1:c;o=L[l>>2];h=H[a+8>>2];v=H[b>>2];l=H[b+48>>2];m=H[b+40>>2];w=H[b+44>>2];if(I[b+84|0]){s=i&254;t=i&1;a=0;c=0;while(1){b=H[v>>2];g=Rj(m,w,H[q+(c<<2)>>2],0)+l|0;p=qa(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));i:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));j:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((s|0)!=(k|0)){continue}break}}if(t){g=n+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+p>>2]-L[b+h>>2]))+O(.5))));k:{if(O(P(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}break h}s=H[b+68>>2];t=i&254;x=i&1;a=0;c=0;while(1){b=H[v>>2];g=Rj(m,w,H[s+(H[q+(c<<2)>>2]<<2)>>2],0)+l|0;p=qa(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));l:{if(O(P(e))>2]=r;f=f|4;e=O(T(O(O(o*O(L[f+p>>2]-L[h+f>>2]))+O(.5))));m:{if(O(P(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((t|0)!=(k|0)){continue}break}}if(x){g=n+(a<<2)|0;b=b<<2;e=O(T(O(O(o*O(L[b+p>>2]-L[b+h>>2]))+O(.5))));n:{if(O(P(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}}oa(d);ca=j+16|0;return 1}function dd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=H[a+4>>2];e=H[a>>2];f=(c-e|0)/144|0;if(f>>>0>>0){e=a;b=b-f|0;h=H[a+8>>2];c=H[a+4>>2];a:{if(b>>>0<=(h-c|0)/144>>>0){b:{if(!b){break b}a=c;f=b&7;if(f){while(1){Ia(a);a=a+144|0;d=d+1|0;if((f|0)!=(d|0)){continue}break}}c=N(b,144)+c|0;if((b-1&268435455)>>>0<7){break b}while(1){Ia(a);Ia(a+144|0);Ia(a+288|0);Ia(a+432|0);Ia(a+576|0);Ia(a+720|0);Ia(a+864|0);Ia(a+1008|0);a=a+1152|0;if((c|0)!=(a|0)){continue}break}}H[e+4>>2]=c;break a}c:{d:{e:{a=c;c=H[e>>2];i=(a-c|0)/144|0;a=i+b|0;if(a>>>0<29826162){c=(h-c|0)/144|0;f=c<<1;f=c>>>0>=14913080?29826161:a>>>0>>0?f:a;if(f){if(f>>>0>=29826162){break e}g=pa(N(f,144))}c=N(i,144)+g|0;a=c;h=b&7;if(h){while(1){Ia(a);a=a+144|0;d=d+1|0;if((h|0)!=(d|0)){continue}break}}h=N(b,144)+c|0;if((b-1&268435455)>>>0>=7){while(1){Ia(a);Ia(a+144|0);Ia(a+288|0);Ia(a+432|0);Ia(a+576|0);Ia(a+720|0);Ia(a+864|0);Ia(a+1008|0);a=a+1152|0;if((h|0)!=(a|0)){continue}break}}b=N(f,144)+g|0;d=H[e+4>>2];f=H[e>>2];if((d|0)==(f|0)){break d}while(1){c=c-144|0;d=d-144|0;a=d;H[c>>2]=H[a>>2];H[c+4>>2]=H[a+4>>2];H[c+8>>2]=H[a+8>>2];H[c+12>>2]=H[a+12>>2];H[a+12>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[c+16>>2]=H[a+16>>2];H[c+20>>2]=H[a+20>>2];H[c+24>>2]=H[a+24>>2];H[a+24>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;g=I[a+28|0];H[c+40>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;F[c+28|0]=g;H[c+32>>2]=H[a+32>>2];H[c+36>>2]=H[a+36>>2];H[c+40>>2]=H[a+40>>2];H[a+40>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[c+52>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+44>>2]=H[a+44>>2];H[c+48>>2]=H[a+48>>2];H[c+52>>2]=H[a+52>>2];H[a+52>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;g=c- -64|0;H[g>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+56>>2]=H[a+56>>2];H[c+60>>2]=H[a+60>>2];i=g;g=a- -64|0;H[i>>2]=H[g>>2];H[g>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[c+68>>2]=H[a+68>>2];g=H[a+72>>2];H[c+84>>2]=0;H[c+76>>2]=0;H[c+80>>2]=0;H[c+72>>2]=g;H[c+76>>2]=H[a+76>>2];H[c+80>>2]=H[a+80>>2];H[c+84>>2]=H[a+84>>2];H[a+84>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[c+96>>2]=0;H[c+88>>2]=0;H[c+92>>2]=0;H[c+88>>2]=H[a+88>>2];H[c+92>>2]=H[a+92>>2];H[c+96>>2]=H[a+96>>2];H[a+96>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;g=I[a+100|0];H[c+112>>2]=0;H[c+104>>2]=0;H[c+108>>2]=0;F[c+100|0]=g;H[c+104>>2]=H[a+104>>2];H[c+108>>2]=H[a+108>>2];H[c+112>>2]=H[a+112>>2];H[a+112>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;H[c+124>>2]=0;H[c+116>>2]=0;H[c+120>>2]=0;H[c+116>>2]=H[a+116>>2];H[c+120>>2]=H[a+120>>2];H[c+124>>2]=H[a+124>>2];H[a+124>>2]=0;H[a+116>>2]=0;H[a+120>>2]=0;g=H[a+128>>2];H[c+140>>2]=0;H[c+132>>2]=0;H[c+136>>2]=0;H[c+128>>2]=g;H[c+132>>2]=H[a+132>>2];H[c+136>>2]=H[a+136>>2];H[c+140>>2]=H[a+140>>2];H[a+140>>2]=0;H[a+132>>2]=0;H[a+136>>2]=0;if((a|0)!=(f|0)){continue}break}H[e+8>>2]=b;a=H[e+4>>2];H[e+4>>2]=h;d=H[e>>2];H[e>>2]=c;if((a|0)==(d|0)){break c}while(1){b=a-144|0;c=H[b+132>>2];if(c){H[a-8>>2]=c;oa(c)}c=H[a-28>>2];if(c){H[a-24>>2]=c;oa(c)}c=H[a-40>>2];if(c){H[a-36>>2]=c;oa(c)}oc(a-140|0);a=b;if((d|0)!=(a|0)){continue}break}break c}sa();v()}wa();v()}H[e+8>>2]=b;H[e+4>>2]=h;H[e>>2]=c}if(d){oa(d)}}return}if(b>>>0>>0){e=e+N(b,144)|0;if((e|0)!=(c|0)){while(1){b=c-144|0;d=H[b+132>>2];if(d){H[c-8>>2]=d;oa(d)}d=H[c-28>>2];if(d){H[c-24>>2]=d;oa(d)}d=H[c-40>>2];if(d){H[c-36>>2]=d;oa(d)}oc(c-140|0);c=b;if((e|0)!=(c|0)){continue}break}}H[a+4>>2]=e}}function Pe(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;f=ca-80|0;ca=f;e=H[c+36>>2];H[f+72>>2]=H[c+32>>2];H[f+76>>2]=e;g=H[c+28>>2];e=f- -64|0;H[e>>2]=H[c+24>>2];H[e+4>>2]=g;e=H[c+20>>2];H[f+56>>2]=H[c+16>>2];H[f+60>>2]=e;e=H[c+12>>2];H[f+48>>2]=H[c+8>>2];H[f+52>>2]=e;e=H[c+4>>2];H[f+40>>2]=H[c>>2];H[f+44>>2]=e;nc(a,f+40|0,f+24|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}if(I[f+31|0]){b=pa(32);F[b+27|0]=0;c=I[1521]|I[1522]<<8|(I[1523]<<16|I[1524]<<24);F[b+23|0]=c;F[b+24|0]=c>>>8;F[b+25|0]=c>>>16;F[b+26|0]=c>>>24;c=I[1518]|I[1519]<<8|(I[1520]<<16|I[1521]<<24);d=I[1514]|I[1515]<<8|(I[1516]<<16|I[1517]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1510]|I[1511]<<8|(I[1512]<<16|I[1513]<<24);d=I[1506]|I[1507]<<8|(I[1508]<<16|I[1509]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1502]|I[1503]<<8|(I[1504]<<16|I[1505]<<24);d=I[1498]|I[1499]<<8|(I[1500]<<16|I[1501]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,27);oa(b);break a}i=ca-16|0;ca=i;b:{c:{switch(F[f+32|0]){case 0:e=pa(44);H[e>>2]=0;H[e+4>>2]=0;H[e+40>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;e=Vc(e);H[e>>2]=13496;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;case 1:e=pa(44);H[e>>2]=0;H[e+4>>2]=0;H[e+40>>2]=0;H[e+32>>2]=0;H[e+36>>2]=0;H[e+24>>2]=0;H[e+28>>2]=0;H[e+16>>2]=0;H[e+20>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;e=Vc(e);H[e>>2]=13404;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;default:break c}}g=pa(32);F[g+28|0]=0;e=I[1550]|I[1551]<<8|(I[1552]<<16|I[1553]<<24);F[g+24|0]=e;F[g+25|0]=e>>>8;F[g+26|0]=e>>>16;F[g+27|0]=e>>>24;e=I[1546]|I[1547]<<8|(I[1548]<<16|I[1549]<<24);h=I[1542]|I[1543]<<8|(I[1544]<<16|I[1545]<<24);F[g+16|0]=h;F[g+17|0]=h>>>8;F[g+18|0]=h>>>16;F[g+19|0]=h>>>24;F[g+20|0]=e;F[g+21|0]=e>>>8;F[g+22|0]=e>>>16;F[g+23|0]=e>>>24;e=I[1538]|I[1539]<<8|(I[1540]<<16|I[1541]<<24);h=I[1534]|I[1535]<<8|(I[1536]<<16|I[1537]<<24);F[g+8|0]=h;F[g+9|0]=h>>>8;F[g+10|0]=h>>>16;F[g+11|0]=h>>>24;F[g+12|0]=e;F[g+13|0]=e>>>8;F[g+14|0]=e>>>16;F[g+15|0]=e>>>24;e=I[1530]|I[1531]<<8|(I[1532]<<16|I[1533]<<24);h=I[1526]|I[1527]<<8|(I[1528]<<16|I[1529]<<24);F[g|0]=h;F[g+1|0]=h>>>8;F[g+2|0]=h>>>16;F[g+3|0]=h>>>24;F[g+4|0]=e;F[g+5|0]=e>>>8;F[g+6|0]=e>>>16;F[g+7|0]=e>>>24;H[i>>2]=-1;e=i|4;za(e,g,28);j=F[i+15|0];H[f>>2]=H[i>>2];h=f+4|0;d:{if((j|0)>=0){j=H[e+4>>2];H[h>>2]=H[e>>2];H[h+4>>2]=j;H[h+8>>2]=H[e+8>>2];H[f+16>>2]=0;break d}za(h,H[i+4>>2],H[i+8>>2]);e=F[i+15|0];H[f+16>>2]=0;if((e|0)>=0){break d}oa(H[i+4>>2])}oa(g)}ca=i+16|0;e=H[f>>2];e:{if(e){H[a>>2]=e;a=a+4|0;if(F[f+15|0]>=0){b=f|4;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break e}za(a,H[f+4>>2],H[f+8>>2]);break e}e=H[f+16>>2];H[f+16>>2]=0;te(a,e,b,c,d);if(!H[a>>2]){if(F[a+15|0]<0){oa(H[a+4>>2])}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ea[H[H[e>>2]+4>>2]](e)}a=H[f+16>>2];H[f+16>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if(F[f+15|0]>=0){break a}oa(H[f+4>>2])}ca=f+80|0}function Ic(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;H[a+56>>2]=H[a+52>>2];H[a+44>>2]=H[a+40>>2];b=H[a+64>>2];c=H[b+24>>2];if((c|0)==H[b+28>>2]){return 1}a:{b:{c:{while(1){g=i;i=H[(k<<2)+c>>2];d:{if((i|0)==-1){i=g;break d}b=H[a+56>>2];e:{if((b|0)!=H[a+60>>2]){H[b>>2]=g;H[a+56>>2]=b+4;break e}d=H[a+52>>2];e=b-d|0;h=e>>2;c=h+1|0;if(c>>>0>=1073741824){break c}f=e>>>1|0;f=e>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}e=pa(f<<2)}else{e=0}c=e+(h<<2)|0;H[c>>2]=g;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+60>>2]=e+(f<<2);H[a+56>>2]=h;H[a+52>>2]=c;if(!d){break e}oa(d)}f:{g:{if(!(H[H[a+12>>2]+(k>>>3&536870908)>>2]>>>k&1)){break g}e=i+1|0;e=(e>>>0)%3|0?e:i-2|0;if((e|0)==-1|H[H[a>>2]+(e>>>3&536870908)>>2]>>>e&1){break g}e=H[H[H[a+64>>2]+12>>2]+(e<<2)>>2];if((e|0)==-1){break g}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)==-1){break g}c=H[a+64>>2];f=H[a>>2];while(1){e=b;b=-1;d=e+1|0;d=(d>>>0)%3|0?d:e-2|0;h:{if((d|0)==-1|H[f+(d>>>3&536870908)>>2]>>>d&1){break h}d=H[H[c+12>>2]+(d<<2)>>2];if((d|0)==-1){break h}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0}if((b|0)!=(i|0)){if((b|0)==-1){break f}continue}break}return 0}e=i}H[H[a+28>>2]+(e<<2)>>2]=g;b=H[a+44>>2];i:{if((b|0)!=H[a+48>>2]){H[b>>2]=e;H[a+44>>2]=b+4;break i}d=H[a+40>>2];i=b-d|0;h=i>>2;c=h+1|0;if(c>>>0>=1073741824){break a}f=i>>>1|0;f=i>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}i=pa(f<<2)}else{i=0}c=i+(h<<2)|0;H[c>>2]=e;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+48>>2]=i+(f<<2);H[a+44>>2]=h;H[a+40>>2]=c;if(!d){break i}oa(d)}i=g+1|0;b=H[a+64>>2];if((e|0)==-1){break d}j:{if((e>>>0)%3|0){c=e-1|0;break j}c=e+2|0;if((c|0)==-1){break d}}d=H[H[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1|(e|0)==(f|0)){break d}while(1){b=f+1|0;b=(b>>>0)%3|0?b:f-2|0;if(H[H[a>>2]+(b>>>3&536870908)>>2]>>>b&1){b=H[a+56>>2];k:{if((b|0)!=H[a+60>>2]){H[b>>2]=i;H[a+56>>2]=b+4;break k}d=H[a+52>>2];g=b-d|0;j=g>>2;c=j+1|0;if(c>>>0>=1073741824){break c}h=g>>>1|0;h=g>>>0>=2147483644?1073741823:c>>>0>>0?h:c;if(h){if(h>>>0>=1073741824){break b}g=pa(h<<2)}else{g=0}c=g+(j<<2)|0;H[c>>2]=i;j=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+60>>2]=g+(h<<2);H[a+56>>2]=j;H[a+52>>2]=c;if(!d){break k}oa(d)}d=i+1|0;b=H[a+44>>2];l:{if((b|0)!=H[a+48>>2]){H[b>>2]=f;H[a+44>>2]=b+4;break l}h=H[a+40>>2];g=b-h|0;l=g>>2;c=l+1|0;if(c>>>0>=1073741824){break a}j=g>>>1|0;j=g>>>0>=2147483644?1073741823:c>>>0>>0?j:c;if(j){if(j>>>0>=1073741824){break b}g=pa(j<<2)}else{g=0}c=g+(l<<2)|0;H[c>>2]=f;l=c+4|0;if((b|0)!=(h|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(h|0)){continue}break}}H[a+48>>2]=g+(j<<2);H[a+44>>2]=l;H[a+40>>2]=c;if(!h){break l}oa(h)}g=i;i=d}H[H[a+28>>2]+(f<<2)>>2]=g;b=H[a+64>>2];m:{if((f>>>0)%3|0){c=f-1|0;break m}c=f+2|0;if((c|0)==-1){break d}}d=H[H[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1){break d}if((e|0)!=(f|0)){continue}break}}k=k+1|0;c=H[b+24>>2];if(k>>>0>2]-c>>2>>>0){continue}break}return 1}sa();v()}wa();v()}sa();v()}function ti(a){a=a|0;var b=0,c=0,d=0,e=0;c=H[a+32>>2];d=H[c+16>>2];e=H[c+12>>2];b=H[c+20>>2];if(K[c+8>>2]>d>>>0&(e|0)>=(b|0)|(b|0)<(e|0)){e=I[H[c>>2]+d|0];d=d+1|0;b=d?b:b+1|0;H[c+16>>2]=d;H[c+20>>2]=b;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}a:{b:{c:{d:{switch(e|0){case 0:b=pa(384);H[b>>2]=11384;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+376>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;break c;case 1:b=pa(424);H[b>>2]=11436;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+392>>2]=0;H[b+396>>2]=0;H[b+384>>2]=0;H[b+388>>2]=0;H[b+376>>2]=0;H[b+380>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;c=b+400|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;H[b+416>>2]=-1;H[b+420>>2]=-1;break c;case 2:break d;default:break b}}b=pa(440);H[b>>2]=11484;ra(b+4|0,0,80);H[b+96>>2]=0;H[b+100>>2]=0;H[b+92>>2]=-1;H[b+84>>2]=-1;H[b+88>>2]=-1;H[b+104>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+116>>2]=0;H[b+120>>2]=0;H[b+124>>2]=0;H[b+128>>2]=0;H[b+132>>2]=0;H[b+136>>2]=0;H[b+140>>2]=0;H[b+144>>2]=0;H[b+148>>2]=0;H[b+156>>2]=0;H[b+160>>2]=0;H[b+152>>2]=1065353216;H[b+164>>2]=0;H[b+168>>2]=0;H[b+172>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+184>>2]=0;H[b+188>>2]=0;H[b+192>>2]=0;H[b+196>>2]=0;H[b+200>>2]=0;H[b+204>>2]=0;H[b+208>>2]=0;H[b+212>>2]=-1;H[b+216>>2]=0;H[b+220>>2]=0;H[b+224>>2]=0;Ha(b+232|0);Ha(b+272|0);c=b+312|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;Ha(b+328|0);H[b+392>>2]=0;H[b+396>>2]=0;H[b+384>>2]=0;H[b+388>>2]=0;H[b+376>>2]=0;H[b+380>>2]=0;H[b+368>>2]=0;H[b+372>>2]=0;H[b+416>>2]=0;H[b+420>>2]=0;H[b+408>>2]=2;H[b+412>>2]=7;H[b+400>>2]=-1;H[b+404>>2]=-1;H[b+424>>2]=0;H[b+428>>2]=0;H[b+432>>2]=0;H[b+436>>2]=0}c=H[a+48>>2];H[a+48>>2]=b;if(!c){break a}ea[H[H[c>>2]+4>>2]](c)}b=H[a+48>>2];if(b){break a}return 0}a=ea[H[H[b>>2]+8>>2]](b,a)|0}else{a=0}return a|0}function Lb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;f=ca-96|0;ca=f;e=H[a+16>>2];F[f+92|0]=1;H[f+88>>2]=b;H[f+84>>2]=b;H[f+80>>2]=e;a:{if((b|0)==-1){break a}j=H[a+20>>2];d=H[j>>2];e=H[H[e>>2]+(b<<2)>>2];if(e>>>0>=H[j+4>>2]-d>>2>>>0){break a}e=H[H[a+8>>2]+(H[d+(e<<2)>>2]<<2)>>2];d=H[a+4>>2];if(!I[d+84|0]){e=H[H[d+68>>2]+(e<<2)>>2]}H[f+72>>2]=0;H[f+76>>2]=0;j=f- -64|0;H[j>>2]=0;H[j+4>>2]=0;H[f+56>>2]=0;H[f+60>>2]=0;Sa(d,e,F[d+24|0],f+56|0);e=b+1|0;j=(e>>>0)%3|0?e:b-2|0;n=((b>>>0)%3|0?-1:2)+b|0;b:{c:{while(1){d=j;e=n;d:{if(!H[a+28>>2]){break d}e=b+1|0;d=(e>>>0)%3|0?e:b-2|0;e=b-1|0;if((b>>>0)%3|0){break d}e=b+2|0}if((d|0)==-1){break b}m=H[a+20>>2];b=H[m>>2];d=H[H[H[a+16>>2]>>2]+(d<<2)>>2];if(d>>>0>=H[m+4>>2]-b>>2>>>0){break b}d=H[H[a+8>>2]+(H[(d<<2)+b>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[f+48>>2]=0;H[f+52>>2]=0;H[f+40>>2]=0;H[f+44>>2]=0;H[f+32>>2]=0;H[f+36>>2]=0;Sa(b,d,F[b+24|0],f+32|0);if((e|0)==-1){break c}d=H[a+20>>2];b=H[d>>2];e=H[H[H[a+16>>2]>>2]+(e<<2)>>2];if(e>>>0>=H[d+4>>2]-b>>2>>>0){break c}d=H[H[a+8>>2]+(H[b+(e<<2)>>2]<<2)>>2];b=H[a+4>>2];if(!I[b+84|0]){d=H[H[b+68>>2]+(d<<2)>>2]}H[f+24>>2]=0;H[f+28>>2]=0;H[f+16>>2]=0;H[f+20>>2]=0;H[f+8>>2]=0;H[f+12>>2]=0;Sa(b,d,F[b+24|0],f+8|0);g=H[f+8>>2];b=H[f+56>>2];d=g-b|0;p=H[f+60>>2];t=H[f+12>>2]-(p+(b>>>0>g>>>0)|0)|0;i=H[f+40>>2];e=H[f+64>>2];m=i-e|0;u=H[f+68>>2];y=H[f+44>>2]-(u+(e>>>0>i>>>0)|0)|0;g=Rj(d,t,m,y);w=o-g|0;x=h-(da+(g>>>0>o>>>0)|0)|0;h=w;i=H[f+16>>2];g=i-e|0;u=H[f+20>>2]-((e>>>0>i>>>0)+u|0)|0;k=H[f+32>>2];i=k-b|0;w=H[f+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=Rj(g,u,i,w);o=h+b|0;h=da+x|0;h=b>>>0>o>>>0?h+1|0:h;b=l;l=d;p=t;k=H[f+48>>2];e=H[f+72>>2];d=k-e|0;t=H[f+76>>2];x=H[f+52>>2]-(t+(e>>>0>k>>>0)|0)|0;l=Rj(l,p,d,x);k=b+l|0;b=da+q|0;b=k>>>0>>0?b+1|0:b;l=H[f+24>>2];p=l-e|0;e=H[f+28>>2]-((e>>>0>l>>>0)+t|0)|0;q=Rj(p,e,i,w);l=k-q|0;q=b-(da+(k>>>0>>0)|0)|0;b=Rj(g,u,d,x);d=r-b|0;b=s-(da+(b>>>0>r>>>0)|0)|0;s=Rj(p,e,m,y);r=s+d|0;b=da+b|0;s=r>>>0>>0?b+1|0:b;uc(f+80|0);b=H[f+88>>2];if((b|0)!=-1){continue}break}b=s>>31;e=b^r;d=e-b|0;b=(b^s)-((b>>>0>e>>>0)+b|0)|0;n=-1;e=2147483647;m=q>>31;g=m;i=g^l;j=i-g|0;m=(g^q)-((i>>>0>>0)+g|0)|0;i=m;k=j^-1;g=i^2147483647;m=h;e:{f:{if(!H[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break e}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;e=a;g=h;a=g>>31;d=a;n=d^o;a=n-d|0;h=a;d=(d^g)-((d>>>0>n>>>0)+d|0)|0;a=a+e|0;d=d^2147483647;h=(d|0)==(b|0)&(h^-1)>>>0>>0|b>>>0>d>>>0;a=h?-1:a;if(!(h&0)&(a|0)<=536870912|(a|0)<536870912){break e}b=0;a=a>>>29|0;break f}g:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break g}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=h;h=h>>31;g=h;i=g^o;h=i-g|0;j=(g^k)-((g>>>0>i>>>0)+g|0)|0;g=j^2147483647;d=a;a=h;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break g}b=b+j|0;n=a+d|0;b=n>>>0>>0?b+1|0:b;e=b;if(!b&n>>>0<536870913){break e}}b=e>>>29|0;a=(e&536870911)<<3|n>>>29}o=Sj(o,m,a,b);l=Sj(l,q,a,b);r=Sj(r,s,a,b)}H[c+8>>2]=o;H[c+4>>2]=l;H[c>>2]=r;ca=f+96|0;return}Ca();v()}Ca();v()}Ca();v()}function Wd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if((b|0)<0){break a}c=H[a+12>>2];d=H[a+8>>2];if(c-d>>2>>>0<=b>>>0){break a}d=d+(b<<2)|0;e=H[d>>2];i=H[e+60>>2];f=H[e+56>>2];e=d+4|0;if((e|0)!=(c|0)){while(1){h=H[e>>2];H[e>>2]=0;g=H[d>>2];H[d>>2]=h;if(g){Ga(g)}d=d+4|0;e=e+4|0;if((e|0)!=(c|0)){continue}break}c=H[a+12>>2]}if((c|0)!=(d|0)){while(1){c=c-4|0;e=H[c>>2];H[c>>2]=0;if(e){Ga(e)}if((c|0)!=(d|0)){continue}break}}H[a+12>>2]=d;g=H[a+4>>2];b:{if(!g|(i|0)<0){break b}c=H[g+24>>2];d=H[g+28>>2];if((c|0)==(d|0)){break b}while(1){if((i|0)==H[H[c>>2]+24>>2]){d=c+4|0;i=H[g+28>>2];if((d|0)!=(i|0)){while(1){h=H[d>>2];H[d>>2]=0;e=H[c>>2];H[c>>2]=h;if(e){Ra(e+12|0,H[e+16>>2]);Qa(e,H[e+4>>2]);oa(e)}c=c+4|0;d=d+4|0;if((i|0)!=(d|0)){continue}break}d=H[g+28>>2]}if((c|0)!=(d|0)){while(1){d=d-4|0;e=H[d>>2];H[d>>2]=0;if(e){Ra(e+12|0,H[e+16>>2]);Qa(e,H[e+4>>2]);oa(e)}if((c|0)!=(d|0)){continue}break}}H[g+28>>2]=c;break b}c=c+4|0;if((d|0)!=(c|0)){continue}break}}c:{if((f|0)>4){break c}d:{e=N(f,12)+a|0;c=H[e+20>>2];d=H[e+24>>2];if((c|0)==(d|0)){break d}while(1){if(H[c>>2]==(b|0)){break d}c=c+4|0;if((d|0)!=(c|0)){continue}break}break c}if((c|0)==(d|0)){break c}f=c;c=c+4|0;va(f,c,d-c|0);H[e+24>>2]=d-4}c=H[a+24>>2];d=H[a+20>>2];e:{if((c|0)==(d|0)){break e}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break e}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break e}H[c>>2]=d-1}c=H[a+36>>2];d=H[a+32>>2];f:{if((c|0)==(d|0)){break f}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break f}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break f}H[c>>2]=d-1}c=H[a+48>>2];d=H[a+44>>2];g:{if((c|0)==(d|0)){break g}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break g}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break g}H[c>>2]=d-1}c=H[a+60>>2];d=H[a+56>>2];h:{if((c|0)==(d|0)){break h}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=H[h>>2];if((j|0)>(b|0)){H[h>>2]=j-1}f=d+(f|4)|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break h}c=d+(c<<2)|0;d=H[c>>2];if((d|0)<=(b|0)){break h}H[c>>2]=d-1}c=H[a+72>>2];a=H[a+68>>2];if((c|0)==(a|0)){break a}d=c-a|0;c=d>>2;e=c>>>0<=1?1:c;g=e&1;c=0;if(d>>>0>=8){d=e&-2;e=0;while(1){i=c<<2;f=i+a|0;h=H[f>>2];if((h|0)>(b|0)){H[f>>2]=h-1}i=a+(i|4)|0;f=H[i>>2];if((f|0)>(b|0)){H[i>>2]=f-1}c=c+2|0;e=e+2|0;if((d|0)!=(e|0)){continue}break}}if(!g){break a}f=b;a=a+(c<<2)|0;b=H[a>>2];if((f|0)>=(b|0)){break a}H[a>>2]=b-1}}function oa(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if(!a){break a}d=a-8|0;b=H[a-4>>2];a=b&-8;f=d+a|0;b:{if(b&1){break b}if(!(b&3)){break a}b=H[d>>2];d=d-b|0;if(d>>>0>>0<=255){e=H[d+8>>2];b=b>>>3|0;c=H[d+12>>2];if((c|0)==(e|0)){i=17192,j=H[4298]&Vj(b),H[i>>2]=j;break b}H[e+12>>2]=c;H[c+8>>2]=e;break b}h=H[d+24>>2];b=H[d+12>>2];c:{if((d|0)!=(b|0)){c=H[d+8>>2];H[c+12>>2]=b;H[b+8>>2]=c;break c}d:{e=d+20|0;c=H[e>>2];if(c){break d}e=d+16|0;c=H[e>>2];if(c){break d}b=0;break c}while(1){g=e;b=c;e=b+20|0;c=H[e>>2];if(c){continue}e=b+16|0;c=H[b+16>>2];if(c){continue}break}H[g>>2]=0}if(!h){break b}e=H[d+28>>2];c=(e<<2)+17496|0;e:{if(H[c>>2]==(d|0)){H[c>>2]=b;if(b){break e}i=17196,j=H[4299]&Vj(e),H[i>>2]=j;break b}H[h+(H[h+16>>2]==(d|0)?16:20)>>2]=b;if(!b){break b}}H[b+24>>2]=h;c=H[d+16>>2];if(c){H[b+16>>2]=c;H[c+24>>2]=b}c=H[d+20>>2];if(!c){break b}H[b+20>>2]=c;H[c+24>>2]=b;break b}b=H[f+4>>2];if((b&3)!=3){break b}H[4300]=a;H[f+4>>2]=b&-2;H[d+4>>2]=a|1;H[a+d>>2]=a;return}if(d>>>0>=f>>>0){break a}b=H[f+4>>2];if(!(b&1)){break a}f:{if(!(b&2)){if(H[4304]==(f|0)){H[4304]=d;a=H[4301]+a|0;H[4301]=a;H[d+4>>2]=a|1;if(H[4303]!=(d|0)){break a}H[4300]=0;H[4303]=0;return}if(H[4303]==(f|0)){H[4303]=d;a=H[4300]+a|0;H[4300]=a;H[d+4>>2]=a|1;H[a+d>>2]=a;return}a=(b&-8)+a|0;g:{if(b>>>0<=255){e=H[f+8>>2];b=b>>>3|0;c=H[f+12>>2];if((c|0)==(e|0)){i=17192,j=H[4298]&Vj(b),H[i>>2]=j;break g}H[e+12>>2]=c;H[c+8>>2]=e;break g}h=H[f+24>>2];b=H[f+12>>2];h:{if((f|0)!=(b|0)){c=H[f+8>>2];H[c+12>>2]=b;H[b+8>>2]=c;break h}i:{e=f+20|0;c=H[e>>2];if(c){break i}e=f+16|0;c=H[e>>2];if(c){break i}b=0;break h}while(1){g=e;b=c;e=b+20|0;c=H[e>>2];if(c){continue}e=b+16|0;c=H[b+16>>2];if(c){continue}break}H[g>>2]=0}if(!h){break g}e=H[f+28>>2];c=(e<<2)+17496|0;j:{if(H[c>>2]==(f|0)){H[c>>2]=b;if(b){break j}i=17196,j=H[4299]&Vj(e),H[i>>2]=j;break g}H[h+(H[h+16>>2]==(f|0)?16:20)>>2]=b;if(!b){break g}}H[b+24>>2]=h;c=H[f+16>>2];if(c){H[b+16>>2]=c;H[c+24>>2]=b}c=H[f+20>>2];if(!c){break g}H[b+20>>2]=c;H[c+24>>2]=b}H[d+4>>2]=a|1;H[a+d>>2]=a;if(H[4303]!=(d|0)){break f}H[4300]=a;return}H[f+4>>2]=b&-2;H[d+4>>2]=a|1;H[a+d>>2]=a}if(a>>>0<=255){b=(a&-8)+17232|0;c=H[4298];a=1<<(a>>>3);k:{if(!(c&a)){H[4298]=a|c;a=b;break k}a=H[b+8>>2]}H[b+8>>2]=d;H[a+12>>2]=d;H[d+12>>2]=b;H[d+8>>2]=a;return}e=31;if(a>>>0<=16777215){b=Q(a>>>8|0);e=((a>>>38-b&1)-(b<<1)|0)+62|0}H[d+28>>2]=e;H[d+16>>2]=0;H[d+20>>2]=0;g=(e<<2)+17496|0;l:{m:{c=H[4299];b=1<>2]=d;H[d+24>>2]=g;break n}e=a<<((e|0)!=31?25-(e>>>1|0)|0:0);b=H[g>>2];while(1){c=b;if((H[b+4>>2]&-8)==(a|0)){break m}b=e>>>29|0;e=e<<1;g=c+(b&4)|0;b=H[g+16>>2];if(b){continue}break}H[g+16>>2]=d;H[d+24>>2]=c}H[d+12>>2]=d;H[d+8>>2]=d;break l}a=H[c+8>>2];H[a+12>>2]=d;H[c+8>>2]=d;H[d+24>>2]=0;H[d+12>>2]=c;H[d+8>>2]=a}a=H[4306]-1|0;H[4306]=a?a:-1}}function tj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;H[a+8>>2]=e;n=a+32|0;h=H[n>>2];f=H[a+36>>2]-h>>2;a:{if(f>>>0>>0){ya(n,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=h+(e<<2);d=e}s=H[a+52>>2];p=H[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;m=ra(pa(h),0,h);b:{if((d|0)<=0){break b}g=H[a+32>>2];while(1){d=f<<2;h=H[d+m>>2];j=H[a+16>>2];c:{if((h|0)>(j|0)){H[d+g>>2]=j;break c}d=d+g|0;j=H[a+12>>2];if((j|0)>(h|0)){H[d>>2]=j;break c}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=H[b+h>>2]+H[g+h>>2]|0;H[d>>2]=h;d:{if((h|0)>H[a+16>>2]){i=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break d}i=h+H[a+20>>2]|0}H[d>>2]=i}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];q=H[f>>2];f=H[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=N(e,h);f=H[(h<<2)+q>>2];if((f|0)==-1){break f}f=H[H[p+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}j=H[s>>2];g=H[p>>2];k=H[j+(H[g+(f<<2)>>2]<<2)>>2];i=f+1|0;i=(i>>>0)%3|0?i:f-2|0;if((i|0)!=-1){i=H[g+(i<<2)>>2]}else{i=-1}g:{h:{if((f>>>0)%3|0){f=f-1|0;break h}f=f+2|0;l=-1;if((f|0)==-1){break g}}l=H[g+(f<<2)>>2]}if((h|0)<=(k|0)){break f}f=H[(i<<2)+j>>2];if((f|0)>=(h|0)){break f}g=H[j+(l<<2)>>2];if((g|0)>=(h|0)){break f}i:{if((e|0)<=0){break i}g=N(e,g);j=N(e,f);k=N(e,k);f=0;l=0;if((e|0)!=1){while(1){H[(f<<2)+m>>2]=(H[(f+g<<2)+c>>2]+H[(f+j<<2)+c>>2]|0)-H[(f+k<<2)+c>>2];i=f|1;H[(i<<2)+m>>2]=(H[(g+i<<2)+c>>2]+H[(j+i<<2)+c>>2]|0)-H[(i+k<<2)+c>>2];f=f+2|0;l=l+2|0;if((u|0)!=(l|0)){continue}break}}if(!w){break i}H[(f<<2)+m>>2]=(H[(f+g<<2)+c>>2]+H[(f+j<<2)+c>>2]|0)-H[(f+k<<2)+c>>2]}if((d|0)<=0){break e}j=H[n>>2];f=0;while(1){d=f<<2;g=H[d+m>>2];k=H[a+16>>2];j:{if((g|0)>(k|0)){H[d+j>>2]=k;break j}d=d+j|0;k=H[a+12>>2];if((k|0)>(g|0)){H[d>>2]=k;break j}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+i>>2]+H[g+j>>2]|0;H[d>>2]=g;k:{if((g|0)>H[a+16>>2]){l=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break k}l=g+H[a+20>>2]|0}H[d>>2]=l}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}Ca();v()}if((d|0)<=0){break e}k=(N(h-1|0,e)<<2)+c|0;j=H[n>>2];f=0;while(1){d=f<<2;g=H[d+k>>2];i=H[a+16>>2];l:{if((g|0)>(i|0)){H[d+j>>2]=i;break l}d=d+j|0;i=H[a+12>>2];if((i|0)>(g|0)){H[d>>2]=i;break l}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+i>>2]+H[g+j>>2]|0;H[d>>2]=g;m:{if((g|0)>H[a+16>>2]){l=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break m}l=g+H[a+20>>2]|0}H[d>>2]=l}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}oa(m);return 1}function we(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(H[H[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){e=H[a+48>>2];H[a+52>>2]=e;a:{if((e|0)!=H[a+56>>2]){H[e>>2]=b;H[a+52>>2]=e+4;break a}d=pa(4);H[d>>2]=b;c=d+4|0;H[a+56>>2]=c;H[a+52>>2]=c;H[a+48>>2]=d;if(!e){break a}oa(e)}c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;c=H[H[a+4>>2]+28>>2];k=H[(i<<2)+c>>2];if((k|0)==-1){return 0}e=(b-N(g,3)|0?-1:2)+b|0;j=H[c+(e<<2)>>2];if((j|0)==-1){return 0}b=H[a+36>>2];g=b+(k>>>3&536870908)|0;d=H[g>>2];c=1<>2]=c|d;Ua(a+8|0,k,i);b=H[a+36>>2]}d=(j>>>3&536870908)+b|0;c=H[d>>2];b=1<>2]=b|c;Ua(a+8|0,j,e)}f=H[a+52>>2];if((f|0)==H[a+48>>2]){return 1}k=a+8|0;while(1){b:{c:{f=f-4|0;b=H[f>>2];if((b|0)==-1){break c}c=(b>>>0)/3|0;g=H[a+24>>2]+(c>>>3&268435452)|0;d=H[g>>2];c=1<>2]=c|d;h=H[a+4>>2];c=H[H[h+28>>2]+(b<<2)>>2];if((c|0)==-1){return 0}while(1){d=b;d:{e:{j=H[a+36>>2]+(c>>>3&536870908)|0;i=H[j>>2];e=1<>2]+(c<<2)>>2];g:{if((g|0)==-1){break g}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;if((b|0)==-1|H[H[h>>2]+(b>>>3&536870908)>>2]>>>b&1){break g}g=H[H[H[h+64>>2]+12>>2]+(b<<2)>>2];if((g|0)!=-1){break f}}H[j>>2]=e|i;Ua(k,c,d);h=H[a+4>>2];break e}H[j>>2]=e|i;Ua(k,c,d);h=H[a+4>>2];b=g+1|0;if((((b>>>0)%3|0?b:g-2|0)|0)==-1){break e}b=-1;h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1|H[H[h>>2]+(c>>>3&536870908)>>2]>>>c&1){break h}b=H[H[H[h+64>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];e=c>>>5|0;j=H[f+(e<<2)>>2];break d}i:{j:{if((d|0)==-1){break j}c=-1;b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;if(!((b|0)==-1|H[H[h>>2]+(b>>>3&536870908)>>2]>>>b&1)){c=H[H[H[h+64>>2]+12>>2]+(b<<2)>>2]}k:{l:{if((d>>>0)%3|0){f=d-1|0;break l}f=d+2|0;b=-1;if((f|0)==-1){break k}}b=-1;if(H[H[h>>2]+(f>>>3&536870908)>>2]>>>f&1){break k}b=H[H[H[h+64>>2]+12>>2]+(f<<2)>>2]}g=(b|0)==-1;i=g?-1:(b>>>0)/3|0;if((c|0)!=-1){f=H[a+24>>2];d=(c>>>0)/3|0;e=d>>>5|0;j=H[f+(e<<2)>>2];d=1<>2];e=i>>>5|0;j=H[f+(e<<2)>>2];if(!(d&j)){break d}}f=H[a+52>>2]-4|0;H[a+52>>2]=f;break b}if(g){b=c;break d}if(H[(i>>>3&536870908)+f>>2]>>>i&1){b=c;break d}h=H[a+52>>2];H[h-4>>2]=b;if(H[a+56>>2]!=(h|0)){H[h>>2]=c;f=h+4|0;break c}m:{i=H[a+48>>2];e=h-i|0;g=e>>2;d=g+1|0;if(d>>>0<1073741824){b=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(e){if(e>>>0>=1073741824){break m}d=pa(e<<2)}else{d=0}b=d+(g<<2)|0;H[b>>2]=c;f=b+4|0;if((h|0)!=(i|0)){while(1){b=b-4|0;h=h-4|0;H[b>>2]=H[h>>2];if((h|0)!=(i|0)){continue}break}}H[a+56>>2]=d+(e<<2);H[a+52>>2]=f;H[a+48>>2]=b;if(!i){break b}oa(i);f=H[a+52>>2];break b}sa();v()}wa();v()}H[(e<<2)+f>>2]=d|j;c=H[H[h+28>>2]+(b<<2)>>2];if((c|0)!=-1){continue}break}return 0}H[a+52>>2]=f}if(H[a+48>>2]!=(f|0)){continue}break}}return 1}function Lj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;H[a+8>>2]=e;m=a+32|0;h=H[m>>2];f=H[a+36>>2]-h>>2;a:{if(f>>>0>>0){ya(m,e-f|0);d=H[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}H[a+36>>2]=h+(e<<2);d=e}s=H[a+52>>2];n=H[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;l=ra(pa(h),0,h);b:{if((d|0)<=0){break b}g=H[a+32>>2];while(1){d=f<<2;h=H[d+l>>2];i=H[a+16>>2];c:{if((h|0)>(i|0)){H[d+g>>2]=i;break c}d=d+g|0;i=H[a+12>>2];if((i|0)>(h|0)){H[d>>2]=i;break c}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=H[b+h>>2]+H[g+h>>2]|0;H[d>>2]=h;d:{if((h|0)>H[a+16>>2]){h=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break d}h=h+H[a+20>>2]|0}H[d>>2]=h}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=H[a+56>>2];q=H[f>>2];f=H[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=N(e,h);f=H[(h<<2)+q>>2];if((f|0)==-1|H[H[n>>2]+(f>>>3&536870908)>>2]>>>f&1){break f}f=H[H[H[n+64>>2]+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}i=H[s>>2];g=H[n+28>>2];k=H[i+(H[g+(f<<2)>>2]<<2)>>2];if((k|0)>=(h|0)){break f}j=f+1|0;j=H[i+(H[g+(((j>>>0)%3|0?j:f-2|0)<<2)>>2]<<2)>>2];if((j|0)>=(h|0)){break f}f=H[i+(H[g+(f+((f>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((f|0)>=(h|0)){break f}g:{if((e|0)<=0){break g}g=N(e,f);i=N(e,j);k=N(e,k);f=0;p=0;if((e|0)!=1){while(1){H[(f<<2)+l>>2]=(H[(f+g<<2)+c>>2]+H[(f+i<<2)+c>>2]|0)-H[(f+k<<2)+c>>2];j=f|1;H[(j<<2)+l>>2]=(H[(g+j<<2)+c>>2]+H[(i+j<<2)+c>>2]|0)-H[(k+j<<2)+c>>2];f=f+2|0;p=p+2|0;if((u|0)!=(p|0)){continue}break}}if(!w){break g}H[(f<<2)+l>>2]=(H[(f+g<<2)+c>>2]+H[(f+i<<2)+c>>2]|0)-H[(f+k<<2)+c>>2]}if((d|0)<=0){break e}i=H[m>>2];f=0;while(1){d=f<<2;g=H[d+l>>2];k=H[a+16>>2];h:{if((g|0)>(k|0)){H[d+i>>2]=k;break h}d=d+i|0;k=H[a+12>>2];if((k|0)>(g|0)){H[d>>2]=k;break h}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+j>>2]+H[g+i>>2]|0;H[d>>2]=g;i:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break i}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}Ca();v()}if((d|0)<=0){break e}k=(N(h-1|0,e)<<2)+c|0;i=H[m>>2];f=0;while(1){d=f<<2;g=H[d+k>>2];j=H[a+16>>2];j:{if((g|0)>(j|0)){H[d+i>>2]=j;break j}d=d+i|0;j=H[a+12>>2];if((j|0)>(g|0)){H[d>>2]=j;break j}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=H[g+j>>2]+H[g+i>>2]|0;H[d>>2]=g;k:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break k}g=g+H[a+20>>2]|0}H[d>>2]=g}d=H[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}oa(l);return 1}function Gb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=O(0),k=0,l=0,m=O(0);i=H[c>>2];a:{b:{f=H[b+4>>2];if(!f){break b}g=Uj(f);c:{if(g>>>0>=2){e=i;if(f>>>0<=e>>>0){e=(i>>>0)%(f>>>0)|0}c=H[H[b>>2]+(e<<2)>>2];if(!c){break b}if(g>>>0<=1){break c}while(1){c=H[c>>2];if(!c){break b}g=H[c+4>>2];if((g|0)!=(i|0)){if(f>>>0<=g>>>0){g=(g>>>0)%(f>>>0)|0}if((e|0)!=(g|0)){break b}}if(H[c+8>>2]!=(i|0)){continue}break}b=0;break a}e=f-1&i;c=H[H[b>>2]+(e<<2)>>2];if(!c){break b}}h=f-1|0;while(1){c=H[c>>2];if(!c){break b}g=H[c+4>>2];if((g|0)!=(i|0)&(g&h)!=(e|0)){break b}if(H[c+8>>2]!=(i|0)){continue}break}b=0;break a}c=pa(16);d=H[H[d>>2]>>2];H[c+12>>2]=0;H[c+8>>2]=d;H[c+4>>2]=i;H[c>>2]=0;m=O(H[b+12>>2]+1>>>0);j=L[b+16>>2];d:{if(m>O(j*O(f>>>0))?0:f){break d}e=2;d=(f-1&f)!=0|f>>>0<3|f<<1;j=O(U(O(m/j)));e:{if(j=O(0)){g=~~j>>>0;break e}g=0}d=d>>>0>g>>>0?d:g;f:{if((d|0)==1){break f}if(!(d&d-1)){e=d;break f}e=Kd(d);f=H[b+4>>2]}g:{if(e>>>0<=f>>>0){if(e>>>0>=f>>>0){break g}g=f>>>0<3;j=O(U(O(O(K[b+12>>2])/L[b+16>>2])));h:{if(j=O(0)){d=~~j>>>0;break h}d=0}i:{j:{if(g){break j}if(Uj(f)>>>0>1){break j}d=d>>>0<2?d:1<<32-Q(d-1|0);break i}d=Kd(d)}e=d>>>0>>0?e:d;if(f>>>0<=e>>>0){break g}}f=0;g=0;h=e;k:{l:{m:{n:{if(e){if(h>>>0>=1073741824){break n}d=pa(h<<2);e=H[b>>2];H[b>>2]=d;if(e){oa(e)}H[b+4>>2]=h;d=0;if(h>>>0>=4){e=h&-4;while(1){k=d<<2;H[k+H[b>>2]>>2]=0;H[H[b>>2]+(k|4)>>2]=0;H[H[b>>2]+(k|8)>>2]=0;H[H[b>>2]+(k|12)>>2]=0;d=d+4|0;g=g+4|0;if((e|0)!=(g|0)){continue}break}}e=h&3;if(e){while(1){H[H[b>>2]+(d<<2)>>2]=0;d=d+1|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}e=H[b+8>>2];if(!e){break k}d=b+8|0;f=H[e+4>>2];g=Uj(h);if(g>>>0<2){break m}f=f>>>0>=h>>>0?(f>>>0)%(h>>>0)|0:f;H[H[b>>2]+(f<<2)>>2]=d;d=H[e>>2];if(!d){break k}if(g>>>0<=1){break l}while(1){g=H[d+4>>2];if(h>>>0<=g>>>0){g=(g>>>0)%(h>>>0)|0}o:{if((f|0)==(g|0)){e=d;break o}l=g<<2;k=l+H[b>>2]|0;if(!H[k>>2]){H[k>>2]=e;e=d;f=g;break o}H[e>>2]=H[d>>2];H[d>>2]=H[H[l+H[b>>2]>>2]>>2];H[H[l+H[b>>2]>>2]>>2]=d}d=H[e>>2];if(d){continue}break}break k}d=H[b>>2];H[b>>2]=0;if(d){oa(d)}H[b+4>>2]=0;break k}wa();v()}f=h-1&f;H[H[b>>2]+(f<<2)>>2]=d;d=H[e>>2];if(!d){break k}}k=h-1|0;while(1){g=k&H[d+4>>2];p:{if((g|0)==(f|0)){e=d;break p}l=g<<2;h=l+H[b>>2]|0;if(H[h>>2]){H[e>>2]=H[d>>2];H[d>>2]=H[H[l+H[b>>2]>>2]>>2];H[H[l+H[b>>2]>>2]>>2]=d;break p}H[h>>2]=e;e=d;f=g}d=H[e>>2];if(d){continue}break}}}f=H[b+4>>2];d=f-1|0;if(!(d&f)){e=d&i;break d}if(f>>>0>i>>>0){e=i;break d}e=(i>>>0)%(f>>>0)|0}e=H[b>>2]+(e<<2)|0;d=H[e>>2];q:{r:{if(!d){d=b+8|0;H[c>>2]=H[d>>2];H[b+8>>2]=c;H[e>>2]=d;d=H[c>>2];if(!d){break q}d=H[d+4>>2];e=f-1|0;s:{if(!(e&f)){d=d&e;break s}if(d>>>0>>0){break s}d=(d>>>0)%(f>>>0)|0}d=H[b>>2]+(d<<2)|0;break r}H[c>>2]=H[d>>2]}H[d>>2]=c}H[b+12>>2]=H[b+12>>2]+1;b=1}F[a+4|0]=b;H[a>>2]=c}function Oe(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;f=ca-80|0;ca=f;e=H[c+36>>2];H[f+72>>2]=H[c+32>>2];H[f+76>>2]=e;g=H[c+28>>2];e=f- -64|0;H[e>>2]=H[c+24>>2];H[e+4>>2]=g;e=H[c+20>>2];H[f+56>>2]=H[c+16>>2];H[f+60>>2]=e;e=H[c+12>>2];H[f+48>>2]=H[c+8>>2];H[f+52>>2]=e;e=H[c+4>>2];H[f+40>>2]=H[c>>2];H[f+44>>2]=e;nc(a,f+40|0,f+24|0);a:{if(H[a>>2]){break a}if(F[a+15|0]<0){oa(H[a+4>>2])}if(I[f+31|0]!=1){b=pa(32);F[b+20|0]=0;c=I[1448]|I[1449]<<8|(I[1450]<<16|I[1451]<<24);F[b+16|0]=c;F[b+17|0]=c>>>8;F[b+18|0]=c>>>16;F[b+19|0]=c>>>24;c=I[1444]|I[1445]<<8|(I[1446]<<16|I[1447]<<24);d=I[1440]|I[1441]<<8|(I[1442]<<16|I[1443]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1436]|I[1437]<<8|(I[1438]<<16|I[1439]<<24);d=I[1432]|I[1433]<<8|(I[1434]<<16|I[1435]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;H[a>>2]=-1;za(a+4|0,b,20);oa(b);break a}i=ca-16|0;ca=i;b:{c:{switch(I[f+32|0]){case 0:e=Ke(pa(48));H[e>>2]=13112;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;case 1:e=Ke(pa(52));H[e+48>>2]=0;H[e>>2]=11276;H[f+8>>2]=0;H[f+12>>2]=0;H[f>>2]=0;H[f+4>>2]=0;H[f+16>>2]=e;break b;default:break c}}g=pa(32);F[g+28|0]=0;e=I[1550]|I[1551]<<8|(I[1552]<<16|I[1553]<<24);F[g+24|0]=e;F[g+25|0]=e>>>8;F[g+26|0]=e>>>16;F[g+27|0]=e>>>24;e=I[1546]|I[1547]<<8|(I[1548]<<16|I[1549]<<24);h=I[1542]|I[1543]<<8|(I[1544]<<16|I[1545]<<24);F[g+16|0]=h;F[g+17|0]=h>>>8;F[g+18|0]=h>>>16;F[g+19|0]=h>>>24;F[g+20|0]=e;F[g+21|0]=e>>>8;F[g+22|0]=e>>>16;F[g+23|0]=e>>>24;e=I[1538]|I[1539]<<8|(I[1540]<<16|I[1541]<<24);h=I[1534]|I[1535]<<8|(I[1536]<<16|I[1537]<<24);F[g+8|0]=h;F[g+9|0]=h>>>8;F[g+10|0]=h>>>16;F[g+11|0]=h>>>24;F[g+12|0]=e;F[g+13|0]=e>>>8;F[g+14|0]=e>>>16;F[g+15|0]=e>>>24;e=I[1530]|I[1531]<<8|(I[1532]<<16|I[1533]<<24);h=I[1526]|I[1527]<<8|(I[1528]<<16|I[1529]<<24);F[g|0]=h;F[g+1|0]=h>>>8;F[g+2|0]=h>>>16;F[g+3|0]=h>>>24;F[g+4|0]=e;F[g+5|0]=e>>>8;F[g+6|0]=e>>>16;F[g+7|0]=e>>>24;H[i>>2]=-1;e=i|4;za(e,g,28);j=F[i+15|0];H[f>>2]=H[i>>2];h=f+4|0;d:{if((j|0)>=0){j=H[e+4>>2];H[h>>2]=H[e>>2];H[h+4>>2]=j;H[h+8>>2]=H[e+8>>2];H[f+16>>2]=0;break d}za(h,H[i+4>>2],H[i+8>>2]);e=F[i+15|0];H[f+16>>2]=0;if((e|0)>=0){break d}oa(H[i+4>>2])}oa(g)}ca=i+16|0;e=H[f>>2];e:{if(e){H[a>>2]=e;a=a+4|0;if(F[f+15|0]>=0){b=f|4;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];break e}za(a,H[f+4>>2],H[f+8>>2]);break e}e=H[f+16>>2];H[f+16>>2]=0;H[e+44>>2]=d;te(a,e,b,c,d);if(!H[a>>2]){if(F[a+15|0]<0){oa(H[a+4>>2])}H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}ea[H[H[e>>2]+4>>2]](e)}a=H[f+16>>2];H[f+16>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if(F[f+15|0]>=0){break a}oa(H[f+4>>2])}ca=f+80|0}function Gc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=N(b,12)+a|0;H[j+12>>2]=H[j+8>>2];m=(c|0)==-1?-1:(c>>>0)/3|0;d=1;k=c;a:{b:{c:{while(1){d:{l=d;if(!d){if((k|0)==-1){break d}if((de(a,((k>>>0)%3|0?-1:2)+k|0)|0)==-1){break a}c=k+1|0;d=(c>>>0)%3|0?c:k-2|0;if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}d=H[H[H[a+4>>2]+12>>2]+(c<<2)>>2];if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}m=(c>>>0)/3|0}e:{d=H[a+56>>2]+(m>>>3&536870908)|0;h=H[d>>2];e=1<>2]=e|h;d=H[j+12>>2];f:{if((d|0)!=H[j+16>>2]){H[d>>2]=m;H[j+12>>2]=d+4;break f}n=H[j+8>>2];h=d-n|0;e=h>>2;i=e+1|0;if(i>>>0>=1073741824){break c}g=h>>>1|0;i=h>>>0>=2147483644?1073741823:i>>>0>>0?g:i;if(i){if(i>>>0>=1073741824){break b}g=pa(i<<2)}else{g=0}h=g+(e<<2)|0;H[h>>2]=m;e=h+4|0;if((d|0)!=(n|0)){while(1){h=h-4|0;d=d-4|0;H[h>>2]=H[d>>2];if((d|0)!=(n|0)){continue}break}}H[j+8>>2]=h;H[j+12>>2]=e;H[j+16>>2]=g+(i<<2);if(!n){break f}oa(n)}g=f+1|0;g:{h:{i:{if(!f){break i}if(g&1){if((c|0)==-1){c=-1;break g}d=c+1|0;c=(d>>>0)%3|0?d:c-2|0;break i}k=l?k:c;if((c|0)==-1){c=-1;break g}if((c>>>0)%3|0){d=c-1|0;break h}c=c+2|0}d=c;c=-1;if((d|0)==-1){break g}}c=H[H[H[a+4>>2]+12>>2]+(d<<2)>>2];h=-1;f=-1;e=d+1|0;e=(e>>>0)%3|0?e:d-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(e-N(f,3)<<2)>>2]}j:{if((c|0)==-1){break j}i=((c>>>0)%3|0?-1:2)+c|0;if((i|0)<0){break j}e=(i>>>0)/3|0;h=H[(H[H[a>>2]+96>>2]+N(e,12)|0)+(i-N(e,3)<<2)>>2]}if((f|0)!=(h|0)){c=-1;break g}k:{l:{f=((d>>>0)%3|0?-1:2)+d|0;if((f|0)>=0){d=(f>>>0)/3|0;if((c|0)!=-1){break l}c=-1;break g}d=-1;if((c|0)!=-1){break k}c=-1;break g}d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(f-N(d,3)<<2)>>2]}f=c+1|0;e=(f>>>0)%3|0?f:c-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(e-N(f,3)<<2)>>2]}else{f=-1}if((f|0)!=(d|0)){c=-1;break g}f=g;m=(c>>>0)/3|0;d=H[a+56>>2]+(m>>>3&268435452)|0;h=H[d>>2];e=1<>2]-4|0;g=H[l>>2];d=H[a+56>>2]+(g>>>3&536870908)|0;c=H[d>>2];o=d,p=Vj(g)&c,H[o>>2]=p;H[j+12>>2]=l;break a}d=0;if(l){continue}break a}break}k=-1;de(a,-1);break a}sa();v()}wa();v()}H[((b<<2)+a|0)+44>>2]=k;b=H[j+12>>2];i=H[j+8>>2];m:{if((b|0)==(i|0)){break m}c=b-i|0;b=c>>2;b=b>>>0<=1?1:b;k=b&1;e=H[a+56>>2];d=0;if(c>>>0>=8){f=b&-2;c=0;while(1){l=d<<2;g=H[l+i>>2];b=e+(g>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(g)&a,H[o>>2]=p;g=H[i+(l|4)>>2];b=e+(g>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(g)&a,H[o>>2]=p;d=d+2|0;c=c+2|0;if((f|0)!=(c|0)){continue}break}}if(!k){break m}c=H[i+(d<<2)>>2];b=e+(c>>>3&536870908)|0;a=H[b>>2];o=b,p=Vj(c)&a,H[o>>2]=p}}function Gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{if(J[b+38>>1]<=513){c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break a}f=I[d+H[b>>2]|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(f){break a}}b:{if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}c:{if(d){Wa(a+60|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+72|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+84|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[H[a+48>>2]+64>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+96|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=H[b+8>>2];f=H[b+12>>2];d=c;c=H[b+20>>2];i=c;g=H[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=H[b>>2];k=m+g|0;l=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[b+16>>2]=j;H[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((d|0)<(l|0)){break a}H[a+16>>2]=d;H[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;H[a+20>>2]=b;c=b>>>1|0;H[a+24>>2]=c;H[a+28>>2]=0-c;if(b&1){break a}H[a+24>>2]=c-1;break a}}e=0}ca=h+32|0;return e|0}function pj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{if(J[b+38>>1]<=513){c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break a}f=I[d+H[b>>2]|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(f){break a}}b:{if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}c:{if(d){Wa(a+60|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+72|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+84|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Xa(1,h+28|0,b)){break b}d=H[h+28>>2];c=H[a+48>>2];if(d>>>0>H[c+4>>2]-H[c>>2]>>2>>>0){break b}if(d){e=0;Wa(a+96|0,d);c=h+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;if(!ta(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|H[g>>2]}else{i=H[g>>2]&(f^-1)}H[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=H[b+8>>2];f=H[b+12>>2];d=c;c=H[b+20>>2];i=c;g=H[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=H[b>>2];k=m+g|0;l=I[k|0]|I[k+1|0]<<8|(I[k+2|0]<<16|I[k+3|0]<<24);H[b+16>>2]=j;H[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((d|0)<(l|0)){break a}H[a+16>>2]=d;H[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;H[a+20>>2]=b;c=b>>>1|0;H[a+24>>2]=c;H[a+28>>2]=0-c;if(b&1){break a}H[a+24>>2]=c-1;break a}}e=0}ca=h+32|0;return e|0}function xe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(H[H[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){f=H[a+48>>2];H[a+52>>2]=f;a:{if((f|0)!=H[a+56>>2]){H[f>>2]=b;H[a+52>>2]=f+4;break a}d=pa(4);H[d>>2]=b;c=d+4|0;H[a+56>>2]=c;H[a+52>>2]=c;H[a+48>>2]=d;if(!f){break a}oa(f)}e=-1;d=H[a+4>>2];c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;if((i|0)!=-1){e=H[H[d>>2]+(i<<2)>>2]}b:{h=b-N(g,3)|0;if(h){c=b-1|0;break b}c=b+2|0;if((c|0)!=-1){break b}return 0}if((e|0)==-1){return 0}j=H[H[d>>2]+(c<<2)>>2];if((j|0)==-1){return 0}c=H[a+36>>2];f=c+(e>>>3&536870908)|0;g=H[f>>2];d=1<>2]=d|g;Ua(a+8|0,e,i);c=H[a+36>>2]}g=(j>>>3&536870908)+c|0;d=H[g>>2];c=1<>2]=c|d;Ua(a+8|0,j,(h?-1:2)+b|0)}c=H[a+52>>2];if((c|0)==H[a+48>>2]){return 1}j=a+8|0;while(1){c:{d:{c=c-4|0;b=H[c>>2];if((b|0)==-1){break d}d=(b>>>0)/3|0;f=H[a+24>>2]+(d>>>3&268435452)|0;g=H[f>>2];d=1<>2]=d|g;while(1){i=H[a+4>>2];e=H[H[i>>2]+(b<<2)>>2];if((e|0)==-1){return 0}e:{f:{h=H[a+36>>2]+(e>>>3&536870908)|0;f=H[h>>2];g=1<>2]+(e<<2)>>2];h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break h}d=H[H[i+12>>2]+(c<<2)>>2];if((d|0)!=-1){break g}}H[h>>2]=f|g;Ua(j,e,b);break f}H[h>>2]=f|g;Ua(j,e,b);c=d+1|0;if((((c>>>0)%3|0?c:d-2|0)|0)==-1){break f}c=b-2|0;d=b+1|0;b=-1;c=(d>>>0)%3|0?d:c;if((c|0)!=-1){b=H[H[H[a+4>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];f=c>>>5|0;i=H[e+(f<<2)>>2];break e}c=-1;g=H[a+4>>2];d=b+1|0;d=(d>>>0)%3|0?d:b-2|0;if((d|0)!=-1){c=H[H[g+12>>2]+(d<<2)>>2]}i:{j:{if((b>>>0)%3|0){e=b-1|0;break j}e=b+2|0;b=-1;if((e|0)==-1){break i}}b=H[H[g+12>>2]+(e<<2)>>2]}g=(b|0)==-1;h=g?-1:(b>>>0)/3|0;k:{if((c|0)!=-1){e=H[a+24>>2];d=(c>>>0)/3|0;f=d>>>5|0;i=H[e+(f<<2)>>2];d=1<>2];f=h>>>5|0;i=H[e+(f<<2)>>2];if(!(d&i)){break e}}c=H[a+52>>2]-4|0;H[a+52>>2]=c;break c}if(g){b=c;break e}if(H[(h>>>3&536870908)+e>>2]>>>h&1){b=c;break e}e=H[a+52>>2];H[e-4>>2]=b;if(H[a+56>>2]!=(e|0)){H[e>>2]=c;c=e+4|0;break d}l:{h=H[a+48>>2];f=e-h|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){b=f>>>1|0;f=f>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(f){if(f>>>0>=1073741824){break l}d=pa(f<<2)}else{d=0}b=d+(g<<2)|0;H[b>>2]=c;c=b+4|0;if((e|0)!=(h|0)){while(1){b=b-4|0;e=e-4|0;H[b>>2]=H[e>>2];if((e|0)!=(h|0)){continue}break}}H[a+56>>2]=d+(f<<2);H[a+52>>2]=c;H[a+48>>2]=b;if(!h){break c}oa(h);c=H[a+52>>2];break c}sa();v()}wa();v()}H[(f<<2)+e>>2]=d|i;if((b|0)!=-1){continue}break}return 0}H[a+52>>2]=c}if(H[a+48>>2]!=(c|0)){continue}break}}return 1}function uj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;H[a+68>>2]=f;d=H[a+56>>2];e=H[d>>2];d=H[d+4>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=H[a+56>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(m,H[d+(j<<2)>>2],g+16|0);i=H[g+20>>2];d=i>>31;h=H[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=H[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+16>>2]=H[a+108>>2];break b}f=H[a+108>>2];l=f>>31;h=Sj(Rj(f,l,h,h>>31),da,e,d);H[g+16>>2]=h;d=Sj(Rj(f,l,i,i>>31),da,e,d);H[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){H[g+24>>2]=f-d;break b}H[g+24>>2]=d-f}d=Ba(o);f=H[g+16>>2];c:{if(d){H[g+24>>2]=0-H[g+24>>2];e=0-H[g+20>>2]|0;H[g+20>>2]=e;f=0-f|0;H[g+16>>2]=f;break c}e=H[g+20>>2]}d:{if((f|0)>=0){f=H[a+108>>2];d=f+H[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+24>>2];f=d>>31;f=H[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+100>>2]+(d-(d^e)|0)|0}e=H[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=H[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=H[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}H[g+12>>2]=d;H[g+8>>2]=f;j:{if(H[a+8>>2]<=0){break j}i=H[a+32>>2];f=0;while(1){d=f<<2;e=H[d+(g+8|0)>>2];h=H[a+16>>2];k:{if((e|0)>(h|0)){H[d+i>>2]=h;break k}d=d+i|0;h=H[a+12>>2];if((h|0)>(e|0)){H[d>>2]=h;break k}H[d>>2]=e}f=f+1|0;e=H[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=H[f+k>>2]+H[f+i>>2]|0;H[e>>2]=f;l:{if((f|0)>H[a+16>>2]){f=f-H[a+20>>2]|0}else{if((f|0)>=H[a+12>>2]){break l}f=f+H[a+20>>2]|0}H[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}ca=g+32|0;return 1}Ca();v()}function dj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=ca-32|0;ca=g;H[a+68>>2]=f;d=H[a+56>>2];e=H[d>>2];d=H[d+4>>2];H[g+24>>2]=0;H[g+16>>2]=0;H[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=H[a+56>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(m,H[d+(j<<2)>>2],g+16|0);i=H[g+20>>2];d=i>>31;h=H[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=H[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+16>>2]=H[a+108>>2];break b}f=H[a+108>>2];l=f>>31;h=Sj(Rj(f,l,h,h>>31),da,e,d);H[g+16>>2]=h;d=Sj(Rj(f,l,i,i>>31),da,e,d);H[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){H[g+24>>2]=f-d;break b}H[g+24>>2]=d-f}d=Ba(o);f=H[g+16>>2];c:{if(d){H[g+24>>2]=0-H[g+24>>2];e=0-H[g+20>>2]|0;H[g+20>>2]=e;f=0-f|0;H[g+16>>2]=f;break c}e=H[g+20>>2]}d:{if((f|0)>=0){f=H[a+108>>2];d=f+H[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+24>>2];f=d>>31;f=H[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+100>>2]+(d-(d^e)|0)|0}e=H[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=H[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=H[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}H[g+12>>2]=d;H[g+8>>2]=f;j:{if(H[a+8>>2]<=0){break j}i=H[a+32>>2];f=0;while(1){d=f<<2;e=H[d+(g+8|0)>>2];h=H[a+16>>2];k:{if((e|0)>(h|0)){H[d+i>>2]=h;break k}d=d+i|0;h=H[a+12>>2];if((h|0)>(e|0)){H[d>>2]=h;break k}H[d>>2]=e}f=f+1|0;e=H[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=H[f+k>>2]+H[f+i>>2]|0;H[e>>2]=f;l:{if((f|0)>H[a+16>>2]){f=f-H[a+20>>2]|0}else{if((f|0)>=H[a+12>>2]){break l}f=f+H[a+20>>2]|0}H[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}ca=g+32|0;return 1}Ca();v()}function ke(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=ca-80|0;ca=h;a:{b:{if(I[H[a+28>>2]+36|0]<=1){d=H[b+20>>2];f=H[b+16>>2];c=f+4|0;d=c>>>0<4?d+1|0:d;g=H[b+12>>2];if(K[b+8>>2]>>0&(g|0)<=(d|0)|(d|0)>(g|0)){break a}f=f+H[b>>2]|0;j=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=c;H[b+20>>2]=d;break b}if(!Pc(1,h+76|0,b)){break a}j=H[h+76>>2]}if(!j){break a}d=H[b+8>>2];c=H[b+16>>2];d=Rj(d-c|0,H[b+12>>2]-(H[b+20>>2]+(c>>>0>d>>>0)|0)|0,5,0);c=da;if(d>>>0>>0&(c|0)<=0|(c|0)<0){break a}c=H[a+4>>2];d=H[a+8>>2]-c>>2;c:{if(d>>>0>>0){ya(a+4|0,j-d|0);break c}if(d>>>0<=j>>>0){break c}H[a+8>>2]=c+(j<<2)}p=a+16|0;l=H[a+32>>2];while(1){i=H[b+12>>2];c=i;d=H[b+20>>2];e=H[b+8>>2];f=H[b+16>>2];if((c|0)<=(d|0)&e>>>0<=f>>>0|(c|0)<(d|0)){e=0;break a}n=H[b>>2];q=I[n+f|0];c=d;g=f+1|0;c=g?c:c+1|0;H[b+16>>2]=g;H[b+20>>2]=c;if(e>>>0<=g>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}g=I[g+n|0];c=d;k=f+2|0;c=k>>>0<2?c+1|0:c;H[b+16>>2]=k;H[b+20>>2]=c;if(e>>>0<=k>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}k=I[k+n|0];c=d;m=f+3|0;c=m>>>0<3?c+1|0:c;H[b+16>>2]=m;H[b+20>>2]=c;if(e>>>0<=m>>>0&(c|0)>=(i|0)|(c|0)>(i|0)){e=0;break a}e=I[m+n|0];c=d;d=f+4|0;c=d>>>0<4?c+1|0:c;H[b+16>>2]=d;H[b+20>>2]=c;if(q>>>0>4){e=0;break a}if((g-12&255)>>>0<245){e=0;break a}if(!k){e=0;break a}m=Eb(h+8|0);i=(e|0)!=0;d=g-1|0;if(d>>>0<=10){c=H[(d<<2)+13584>>2]}else{c=-1}d=N(c,k);lc(m,q,k,g,i,d,d>>31);d:{d=J[H[a+28>>2]+36>>1];e:{if(((d<<8|d>>>8)&65535)>>>0<=258){c=H[b+20>>2];f=H[b+16>>2];d=f+2|0;c=d>>>0<2?c+1|0:c;e=H[b+12>>2];if(K[b+8>>2]>>0&(e|0)<=(c|0)|(c|0)>(e|0)){break d}f=f+H[b>>2]|0;e=I[f|0]|I[f+1|0]<<8;H[b+16>>2]=d;H[b+20>>2]=c;break e}if(!Pc(1,h+4|0,b)){break d}e=H[h+4>>2]}H[h+68>>2]=e;d=jc(pa(96),m);ea[H[H[l>>2]+8>>2]](l,H[l+12>>2]-H[l+8>>2]>>2,d);d=(H[l+12>>2]-H[l+8>>2]>>2)-1|0;f=d<<2;H[H[f+H[l+8>>2]>>2]+60>>2]=e;H[H[a+4>>2]+(o<<2)>>2]=d;e=H[a+16>>2];c=H[a+20>>2]-e>>2;f:{if((c|0)>(d|0)){break f}H[h>>2]=-1;d=d+1|0;if(d>>>0>c>>>0){Pa(p,d-c|0,h);e=H[p>>2];break f}if(c>>>0<=d>>>0){break f}H[a+20>>2]=(d<<2)+e}H[e+f>>2]=o;e=1;o=o+1|0;if((o|0)!=(j|0)){continue}break a}break}e=0}ca=h+80|0;return e|0}function nd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;n=ea[H[H[a>>2]+44>>2]](a)|0;a:{if((n|0)<=0){break a}i=H[b+4>>2]-H[b>>2]>>2;e=ca+-64|0;ca=e;f=Eb(e);d=N(H[3400],n);lc(f,H[H[a+8>>2]+56>>2],n&255,5,0,d,d>>31);f=jc(pa(96),f);F[f+84|0]=1;H[f+72>>2]=H[f+68>>2];mb(f,i);H[f+60>>2]=H[H[a+8>>2]+60>>2];d=H[a+16>>2];H[a+16>>2]=f;if(d){Ga(d)}ca=e- -64|0;h=H[a+16>>2];if(!H[h+80>>2]){break a}j=H[H[h>>2]>>2];if(!j){break a}m=H[c+12>>2];e=m;d=H[c+20>>2];g=H[c+8>>2];k=H[c+16>>2];if((e|0)<=(d|0)&g>>>0<=k>>>0|(d|0)>(e|0)){break a}l=N(i,n);i=j+H[h+48>>2]|0;h=H[c>>2];j=I[h+k|0];e=k+1|0;f=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=f;b:{c:{if(j){if(kd(l,n,c,i)){break c}break a}if((f|0)>=(m|0)&e>>>0>=g>>>0|(f|0)>(m|0)){break a}g=I[e+h|0];f=k+2|0;d=f>>>0<2?d+1|0:d;H[c+16>>2]=f;H[c+20>>2]=d;d=H[H[a+16>>2]+64>>2];d=H[d+4>>2]-H[d>>2]|0;if((g|0)==H[3400]){e=l<<2;if(e>>>0>d>>>0){break a}g=H[c+8>>2];k=H[c+12>>2];j=H[c+20>>2];d=H[c+16>>2];f=e+d|0;j=f>>>0>>0?j+1|0:j;if(f>>>0>g>>>0&(j|0)>=(k|0)|(j|0)>(k|0)){break a}qa(i,d+H[c>>2]|0,e);f=H[c+20>>2];d=e+H[c+16>>2]|0;f=d>>>0>>0?f+1|0:f;H[c+16>>2]=d;H[c+20>>2]=f;break c}if(d>>>0>>0){break a}d=H[c+8>>2];f=H[c+16>>2];e=d-f|0;m=d>>>0>>0;d=H[c+20>>2];k=H[c+12>>2]-(m+d|0)|0;m=Rj(g,0,l,0)>>>0>e>>>0;e=da;if(m&(e|0)>=(k|0)|(e|0)>(k|0)){break a}e=1;if(!l){break b}h=0;while(1){k=H[c+8>>2];j=H[c+12>>2];e=f+g|0;d=e>>>0>>0?d+1|0:d;if(e>>>0>k>>>0&(d|0)>=(j|0)|(d|0)>(j|0)){return 0}qa(i+(h<<2)|0,H[c>>2]+f|0,g);d=H[c+20>>2];f=g+H[c+16>>2]|0;d=f>>>0>>0?d+1|0:d;H[c+16>>2]=f;H[c+20>>2]=d;h=h+1|0;if((l|0)!=(h|0)){continue}break}}e=1;if(!l){break b}d=H[a+20>>2];if(d){e=0;if(ea[H[H[d>>2]+32>>2]](d)|0){break b}}g=0;h=0;d:{if((l|0)<=0){break d}if((l|0)!=1){f=l&-2;while(1){e=g<<2;d=H[e+i>>2];H[e+i>>2]=0-(d&1)^d>>>1;d=e|4;e=H[d+i>>2];H[d+i>>2]=0-(e&1)^e>>>1;g=g+2|0;h=h+2|0;if((f|0)!=(h|0)){continue}break}}if(!(l&1)){break d}d=g<<2;f=H[d+i>>2];H[d+i>>2]=0-(f&1)^f>>>1}e=0}d=e;f=H[a+20>>2];e:{if(!f){break e}if(!(ea[H[H[f>>2]+40>>2]](f,c)|0)){break a}if(d){break e}a=H[a+20>>2];if(!(ea[H[H[a>>2]+44>>2]](a,i,i,l,n,H[b>>2])|0)){break a}}o=1}return o|0}function pb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=ca-32|0;ca=h;a:{b:{if(H[a+8>>2]<<5>>>0>=b>>>0){break b}if((b|0)<0){break a}b=(b-1>>>5|0)+1|0;c=pa(b<<2);H[h+24>>2]=b;H[h+20>>2]=0;H[h+16>>2]=c;b=H[a>>2];H[h+12>>2]=0;H[h+8>>2]=b;c=H[a+4>>2];H[h+4>>2]=c&31;H[h>>2]=b+(c>>>3&536870908);e=ca-32|0;ca=e;i=H[h+4>>2];g=H[h+12>>2];j=H[h>>2];d=H[h+8>>2];b=(i-g|0)+(j-d<<3)|0;f=H[h+20>>2];c=b+f|0;H[h+20>>2]=c;if(!((c-1^f-1)>>>0<32?f:0)){H[H[h+16>>2]+((c>>>0>=33?c-1>>>5|0:0)<<2)>>2]=0}c=H[h+16>>2]+(f>>>3&536870908)|0;f=f&31;c:{if((f|0)==(g|0)){if((b|0)<=0){break c}if(g){i=32-g|0;f=(b|0)<(i|0)?b:i;i=-1<>>i-f;H[c>>2]=H[c>>2]&(i^-1)|i&H[d>>2];d=d+4|0;c=(g+f>>>3&536870908)+c|0;b=b-f|0}g=(b|0)/32|0;if(b+31>>>0>=63){va(c,d,g<<2)}b=b-(g<<5)|0;if((b|0)<=0){break c}f=c;c=g<<2;g=f+c|0;b=-1>>>32-b|0;H[g>>2]=H[g>>2]&(b^-1)|b&H[c+d>>2];break c}H[e+28>>2]=g;H[e+24>>2]=d;H[e+20>>2]=i;H[e+16>>2]=j;H[e+12>>2]=f;H[e+8>>2]=c;b=H[e+28>>2];c=H[e+24>>2];g=(H[e+20>>2]-b|0)+(H[e+16>>2]-c<<3)|0;d:{if((g|0)<=0){b=H[e+12>>2];d=H[e+8>>2];break d}e:{if(!b){b=H[e+12>>2];break e}d=H[e+12>>2];j=32-d|0;k=32-b|0;f=(g|0)<(k|0)?g:k;i=f>>>0>j>>>0?j:f;l=H[e+8>>2];m=H[l>>2]&(-1<>>j-i^-1);j=H[c>>2]&(-1<>>k-f);H[l>>2]=m|(b>>>0>>0?j<>>b-d|0);c=d+i|0;b=c&31;H[e+12>>2]=b;d=l+(c>>>3&536870908)|0;H[e+8>>2]=d;c=f-i|0;if((c|0)>0){H[d>>2]=H[d>>2]&(-1>>>32-c^-1)|j>>>i+H[e+28>>2];H[e+12>>2]=c;b=c}g=g-f|0;c=H[e+24>>2]+4|0;H[e+24>>2]=c}i=-1<=32){j=i^-1;while(1){d=H[e+8>>2];c=H[c>>2];H[d>>2]=j&H[d>>2]|c<>2]=d+4;H[d+4>>2]=i&H[d+4>>2]|c>>>f;c=H[e+24>>2]+4|0;H[e+24>>2]=c;d=g>>>0>63;g=g-32|0;if(d){continue}break}}d=H[e+8>>2];if((g|0)<=0){break d}j=f;f=(g|0)>(f|0)?f:g;j=H[d>>2]&(i&-1>>>j-f^-1);i=H[c>>2]&-1>>>32-g;H[d>>2]=j|i<>2]=c;d=(b>>>3&536870908)+d|0;H[e+8>>2]=d;b=g-f|0;if((b|0)<=0){b=c;break d}H[d>>2]=H[d>>2]&(-1>>>32-b^-1)|i>>>f;H[e+12>>2]=b}H[e+4>>2]=b;H[e>>2]=d}ca=e+32|0;b=H[a>>2];H[a>>2]=H[h+16>>2];H[h+16>>2]=b;c=H[a+4>>2];H[a+4>>2]=H[h+20>>2];H[h+20>>2]=c;c=H[a+8>>2];H[a+8>>2]=H[h+24>>2];H[h+24>>2]=c;if(!b){break b}oa(b)}ca=h+32|0;return}sa();v()}function Ne(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=J[b+38>>1];a:{if(!c){break a}b:{if(c>>>0<=511){g=H[b+8>>2];e=H[b+12>>2];d=H[b+20>>2];c=H[b+16>>2];i=c+4|0;d=i>>>0<4?d+1|0:d;if(g>>>0>>0&(d|0)>=(e|0)|(d|0)>(e|0)){break a}c=c+H[b>>2]|0;f=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[a+12>>2]=f;d=H[b+20>>2];c=H[b+16>>2]+4|0;d=c>>>0<4?d+1|0:d;H[b+16>>2]=c;H[b+20>>2]=d;break b}if(!hb(1,a+12|0,b)){break a}c=H[b+16>>2];d=H[b+20>>2];f=H[a+12>>2]}e=H[b+8>>2];i=e-c|0;c=H[b+12>>2]-(d+(c>>>0>e>>>0)|0)|0;if(i>>>0>>6>>>0&(c|0)<=0|(c|0)<0){break a}d=H[a>>2];c=H[a+4>>2]-d>>2;c:{if(c>>>0>>0){ya(a,f-c|0);f=H[a+12>>2];break c}if(c>>>0<=f>>>0){break c}H[a+4>>2]=d+(f<<2)}if(!f){return 1}c=H[b+16>>2];d=H[b+20>>2];l=H[a>>2];i=H[b+8>>2];j=H[b+12>>2];g=0;while(1){if((d|0)>=(j|0)&c>>>0>=i>>>0|(d|0)>(j|0)){return 0}m=H[b>>2];k=I[m+c|0];c=c+1|0;d=c?d:d+1|0;H[b+16>>2]=c;H[b+20>>2]=d;e=k>>>2|0;h=0;d:{e:{f:{g:{n=k&3;switch(n|0){case 0:break e;case 3:break g;default:break f}}e=e+g|0;if(e>>>0>=f>>>0){return 0}ra(l+(g<<2)|0,0,(k&252)+4|0);g=e;break d}while(1){if((c|0)==(i|0)&(d|0)==(j|0)){break a}f=I[c+m|0];c=c+1|0;d=c?d:d+1|0;H[b+16>>2]=c;H[b+20>>2]=d;e=f<<(h<<3|6)|e;h=h+1|0;if((n|0)!=(h|0)){continue}break}}H[l+(g<<2)>>2]=e}f=H[a+12>>2];g=g+1|0;if(f>>>0>g>>>0){continue}break}b=a+16|0;i=H[a>>2];d=H[a+16>>2];c=H[a+20>>2]-d|0;h:{if(c>>>0<=16383){ya(b,4096-(c>>>2|0)|0);break h}if((c|0)==16384){break h}H[a+20>>2]=d+16384}c=a+28|0;g=H[c>>2];d=H[a+32>>2]-g>>3;i:{if(d>>>0>>0){ob(c,f-d|0);g=H[c>>2];break i}if(d>>>0>f>>>0){H[a+32>>2]=(f<<3)+g}if(!f){break a}}d=H[b>>2];b=0;a=0;while(1){c=i+(b<<2)|0;h=H[c>>2];e=a;j=(b<<3)+g|0;H[j+4>>2]=a;H[j>>2]=h;c=H[c>>2];a=c+a|0;if(a>>>0>4096){break a}j:{if(a>>>0<=e>>>0){break j}h=0;j=c&7;if(j){while(1){H[d+(e<<2)>>2]=b;e=e+1|0;h=h+1|0;if((j|0)!=(h|0)){continue}break}}if(c-1>>>0<=6){break j}while(1){c=d+(e<<2)|0;H[c>>2]=b;H[c+28>>2]=b;H[c+24>>2]=b;H[c+20>>2]=b;H[c+16>>2]=b;H[c+12>>2]=b;H[c+8>>2]=b;H[c+4>>2]=b;e=e+8|0;if((e|0)!=(a|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}o=(a|0)==4096}return o}function Ni(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h>>2];h=H[h+4>>2];H[g+36>>2]=d;H[g+32>>2]=f;H[g+24>>2]=i;H[g+28>>2]=h;qc(g+40|0,m,g+32|0,g+24|0);d=c+e|0;H[d>>2]=H[g+40>>2];H[d+4>>2]=H[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ii(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h>>2];h=H[h+4>>2];H[g+36>>2]=d;H[g+32>>2]=f;H[g+24>>2]=i;H[g+28>>2]=h;qc(g+40|0,m,g+32|0,g+24|0);d=c+e|0;H[d>>2]=H[g+40>>2];H[d+4>>2]=H[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Wi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Nb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h+4>>2];H[g+40>>2]=H[h>>2];H[g+44>>2]=i;H[g+28>>2]=d;H[g+24>>2]=f;rc(g+32|0,m,g+24|0,g+40|0);d=c+e|0;H[d>>2]=H[g+32>>2];H[d+4>>2]=H[g+36>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ri(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=ca-48|0;ca=g;d=H[a+8>>2];if(d-2>>>0<=28){H[a+76>>2]=d;e=-1<>2]=d;H[a+80>>2]=e^-1;H[a+92>>2]=(d|0)/2;L[a+88>>2]=O(2)/O(d|0)}H[a+52>>2]=f;d=H[a+40>>2];e=H[d>>2];d=H[d+4>>2];H[g+16>>2]=0;H[g+8>>2]=0;H[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=H[a+40>>2];d=H[e>>2];if(H[e+4>>2]-d>>2>>>0<=j>>>0){break a}Lb(n,H[d+(j<<2)>>2],g+8|0);h=H[g+12>>2];d=h>>31;i=H[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=H[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){H[g+8>>2]=H[a+92>>2];break b}f=H[a+92>>2];k=f>>31;i=Sj(Rj(f,k,i,i>>31),da,e,d);H[g+8>>2]=i;d=Sj(Rj(f,k,h,h>>31),da,e,d);H[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){H[g+16>>2]=f-d;break b}H[g+16>>2]=d-f}d=Ba(p);f=H[g+8>>2];c:{if(d){H[g+16>>2]=0-H[g+16>>2];e=0-H[g+12>>2]|0;H[g+12>>2]=e;f=0-f|0;H[g+8>>2]=f;break c}e=H[g+12>>2]}d:{if((f|0)>=0){f=H[a+92>>2];d=f+H[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=H[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=H[g+16>>2];f=d>>31;f=H[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=H[a+84>>2]+(d-(d^e)|0)|0}e=H[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=H[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=H[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=H[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=H[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=H[h+4>>2];H[g+40>>2]=H[h>>2];H[g+44>>2]=i;H[g+28>>2]=d;H[g+24>>2]=f;rc(g+32|0,m,g+24|0,g+40|0);d=c+e|0;H[d>>2]=H[g+32>>2];H[d+4>>2]=H[g+36>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}ca=g+48|0;return 1}Ca();v()}function Ge(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;f=ca-16|0;ca=f;c=H[a+4>>2];H[a+40>>2]=H[a>>2];H[a+44>>2]=c;c=H[a+36>>2];H[a+72>>2]=H[a+32>>2];H[a+76>>2]=c;d=H[a+28>>2];c=a- -64|0;H[c>>2]=H[a+24>>2];H[c+4>>2]=d;c=H[a+20>>2];H[a+56>>2]=H[a+16>>2];H[a+60>>2]=c;c=H[a+12>>2];H[a+48>>2]=H[a+8>>2];H[a+52>>2]=c;a:{b:{if(Db(a+40|0,1,f+8|0)){c=H[a+44>>2];H[a>>2]=H[a+40>>2];H[a+4>>2]=c;c=H[a+76>>2];H[a+32>>2]=H[a+72>>2];H[a+36>>2]=c;c=H[a+68>>2];H[a+24>>2]=H[a+64>>2];H[a+28>>2]=c;d=H[a+60>>2];h=d;c=H[a+56>>2];H[a+16>>2]=c;H[a+20>>2]=d;e=H[a+52>>2];d=H[a+48>>2];H[a+8>>2]=d;H[a+12>>2]=e;i=d-c|0;g=H[f+12>>2];e=e-((c>>>0>d>>>0)+h|0)|0;d=H[f+8>>2];if((g|0)==(e|0)&i>>>0>=d>>>0|e>>>0>g>>>0){break b}}c=0;break a}e=h+g|0;c=c+d|0;e=c>>>0>>0?e+1|0:e;H[a+16>>2]=c;H[a+20>>2]=e;c:{if(J[a+38>>1]<=513){c=H[a+4>>2];H[a+96>>2]=H[a>>2];H[a+100>>2]=c;c=H[a+36>>2];H[a+128>>2]=H[a+32>>2];H[a+132>>2]=c;c=H[a+28>>2];H[a+120>>2]=H[a+24>>2];H[a+124>>2]=c;c=H[a+20>>2];H[a+112>>2]=H[a+16>>2];H[a+116>>2]=c;c=H[a+12>>2];H[a+104>>2]=H[a+8>>2];H[a+108>>2]=c;d:{if(Db(a+96|0,1,f+8|0)){c=H[a+100>>2];H[a>>2]=H[a+96>>2];H[a+4>>2]=c;c=H[a+132>>2];H[a+32>>2]=H[a+128>>2];H[a+36>>2]=c;c=H[a+124>>2];H[a+24>>2]=H[a+120>>2];H[a+28>>2]=c;d=H[a+116>>2];h=d;c=H[a+112>>2];H[a+16>>2]=c;H[a+20>>2]=d;e=H[a+108>>2];d=H[a+104>>2];H[a+8>>2]=d;H[a+12>>2]=e;i=d-c|0;g=H[f+12>>2];e=e-((c>>>0>d>>>0)+h|0)|0;d=H[f+8>>2];if((g|0)==(e|0)&i>>>0>=d>>>0|e>>>0>g>>>0){break d}}c=0;break a}e=h+g|0;c=c+d|0;e=c>>>0>>0?e+1|0:e;H[a+16>>2]=c;H[a+20>>2]=e;break c}c=0;if(!ta(a+80|0,a)){break a}}c=0;if(!Fe(a)){break a}c=H[a+4>>2];H[b>>2]=H[a>>2];H[b+4>>2]=c;c=H[a+36>>2];H[b+32>>2]=H[a+32>>2];H[b+36>>2]=c;c=H[a+28>>2];H[b+24>>2]=H[a+24>>2];H[b+28>>2]=c;c=H[a+20>>2];H[b+16>>2]=H[a+16>>2];H[b+20>>2]=c;c=H[a+12>>2];H[b+8>>2]=H[a+8>>2];H[b+12>>2]=c;c=1}ca=f+16|0;return c}function oe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;if(!H[a+64>>2]){c=pa(32);H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;d=H[a+64>>2];H[a+64>>2]=c;if(d){c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}oa(d);c=H[a+64>>2]}H[a>>2]=c;d=H[c+20>>2];H[a+8>>2]=H[c+16>>2];H[a+12>>2]=d;d=H[c+24>>2];c=H[c+28>>2];H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+16>>2]=d;H[a+20>>2]=c}a:{F[a+24|0]=I[b+24|0];H[a+28>>2]=H[b+28>>2];F[a+32|0]=I[b+32|0];c=H[b+44>>2];H[a+40>>2]=H[b+40>>2];H[a+44>>2]=c;c=H[b+52>>2];H[a+48>>2]=H[b+48>>2];H[a+52>>2]=c;H[a+56>>2]=H[b+56>>2];c=H[b+12>>2];H[a+8>>2]=H[b+8>>2];H[a+12>>2]=c;c=H[b+20>>2];H[a+16>>2]=H[b+16>>2];H[a+20>>2]=c;H[a+60>>2]=H[b+60>>2];c=H[b>>2];b:{if(!c){H[a>>2]=0;d=1;break b}g=H[a>>2];d=0;if(!g){break b}d=H[c>>2];c=H[c+4>>2]-d|0;se(g,d,c,0);d=1}c:{if(!d){break c}F[a+84|0]=I[b+84|0];H[a+80>>2]=H[b+80>>2];if((a|0)!=(b|0)){Cb(a+68|0,H[b+68>>2],H[b+72>>2])}f=H[b+88>>2];d:{if(f){e=pa(40);b=H[f>>2];H[e+16>>2]=0;H[e+8>>2]=0;H[e+12>>2]=0;H[e>>2]=b;c=H[f+12>>2];b=H[f+8>>2];if((c|0)!=(b|0)){c=c-b|0;if((c|0)<0){break a}b=pa(c);H[e+12>>2]=b;H[e+8>>2]=b;H[e+16>>2]=b+c;c=H[f+8>>2];h=H[f+12>>2];e:{if((c|0)==(h|0)){break e}g=(c^-1)+h|0;d=h-c&7;if(d){while(1){F[b|0]=I[c|0];b=b+1|0;c=c+1|0;i=i+1|0;if((d|0)!=(i|0)){continue}break}}if(g>>>0<7){break e}while(1){F[b|0]=I[c|0];F[b+1|0]=I[c+1|0];F[b+2|0]=I[c+2|0];F[b+3|0]=I[c+3|0];F[b+4|0]=I[c+4|0];F[b+5|0]=I[c+5|0];F[b+6|0]=I[c+6|0];F[b+7|0]=I[c+7|0];b=b+8|0;c=c+8|0;if((h|0)!=(c|0)){continue}break}}H[e+12>>2]=b}b=H[f+36>>2];H[e+32>>2]=H[f+32>>2];H[e+36>>2]=b;b=H[f+28>>2];H[e+24>>2]=H[f+24>>2];H[e+28>>2]=b;b=H[a+88>>2];H[a+88>>2]=e;if(b){break d}break c}b=H[a+88>>2];H[a+88>>2]=0;if(!b){break c}}a=H[b+8>>2];if(a){H[b+12>>2]=a;oa(a)}oa(b)}return}sa();v()}function og(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=ca-32|0;ca=f;e=f+8|0;c=ca-80|0;ca=c;a=H[b+36>>2];H[c+72>>2]=H[b+32>>2];H[c+76>>2]=a;d=H[b+28>>2];a=c- -64|0;H[a>>2]=H[b+24>>2];H[a+4>>2]=d;a=H[b+20>>2];H[c+56>>2]=H[b+16>>2];H[c+60>>2]=a;a=H[b+12>>2];H[c+48>>2]=H[b+8>>2];H[c+52>>2]=a;a=H[b+4>>2];H[c+40>>2]=H[b>>2];H[c+44>>2]=a;nc(c+8|0,c+40|0,c+24|0);a=H[c+8>>2];a:{if(a){H[e>>2]=a;a=e+4|0;if(F[c+23|0]>=0){b=c+8|4;e=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=e;H[a+8>>2]=H[b+8>>2];break a}za(a,H[c+12>>2],H[c+16>>2]);if(F[c+23|0]>=0){break a}oa(H[c+12>>2]);break a}if(F[c+23|0]<0){oa(H[c+12>>2])}a=I[c+31|0];if(a>>>0>=2){b=pa(32);F[b+26|0]=0;a=I[1477]|I[1478]<<8;F[b+24|0]=a;F[b+25|0]=a>>>8;a=I[1473]|I[1474]<<8|(I[1475]<<16|I[1476]<<24);d=I[1469]|I[1470]<<8|(I[1471]<<16|I[1472]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=a;F[b+21|0]=a>>>8;F[b+22|0]=a>>>16;F[b+23|0]=a>>>24;a=I[1465]|I[1466]<<8|(I[1467]<<16|I[1468]<<24);d=I[1461]|I[1462]<<8|(I[1463]<<16|I[1464]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=a;F[b+13|0]=a>>>8;F[b+14|0]=a>>>16;F[b+15|0]=a>>>24;a=I[1457]|I[1458]<<8|(I[1459]<<16|I[1460]<<24);d=I[1453]|I[1454]<<8|(I[1455]<<16|I[1456]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=a;F[b+5|0]=a>>>8;F[b+6|0]=a>>>16;F[b+7|0]=a>>>24;H[c+8>>2]=-1;a=c+8|4;za(a,b,26);d=F[c+23|0];H[e>>2]=H[c+8>>2];e=e+4|0;if((d|0)>=0){d=H[a+4>>2];H[e>>2]=H[a>>2];H[e+4>>2]=d;H[e+8>>2]=H[a+8>>2];oa(b);break a}za(e,H[c+12>>2],H[c+16>>2]);if(F[c+23|0]<0){oa(H[c+12>>2])}oa(b);break a}H[e>>2]=0;H[e+4>>2]=0;H[e+16>>2]=a;H[e+8>>2]=0;H[e+12>>2]=0}ca=c+80|0;a=H[f+24>>2];if(F[f+23|0]<0){oa(H[f+12>>2])}ca=f+32|0;return a|0}function Xd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=ca-16|0;ca=k;H[k+8>>2]=c;h=H[a+12>>2];d=H[a+8>>2];g=h-d>>2;a:{if((g|0)>(b|0)){break a}e=b+1|0;if(e>>>0>g>>>0){l=e-g|0;f=H[a+16>>2];d=H[a+12>>2];if(l>>>0<=f-d>>2>>>0){if(l){e=d;d=l<<2;d=ra(e,0,d)+d|0}H[a+12>>2]=d;break a}b:{c:{d:{m=H[a+8>>2];g=d-m>>2;i=g+l|0;if(i>>>0<1073741824){e=f-m|0;f=e>>>1|0;e=e>>>0>=2147483644?1073741823:f>>>0>i>>>0?f:i;if(e){if(e>>>0>=1073741824){break d}j=pa(e<<2)}h=(g<<2)+j|0;f=l<<2;i=ra(h,0,f);g=f+i|0;e=(e<<2)+j|0;if((d|0)==(m|0)){break c}while(1){d=d-4|0;f=H[d>>2];H[d>>2]=0;h=h-4|0;H[h>>2]=f;if((d|0)!=(m|0)){continue}break}H[a+16>>2]=e;e=H[a+12>>2];H[a+12>>2]=g;d=H[a+8>>2];H[a+8>>2]=h;if((d|0)==(e|0)){break b}while(1){e=e-4|0;f=H[e>>2];H[e>>2]=0;if(f){Ga(f)}if((d|0)!=(e|0)){continue}break}break b}sa();v()}wa();v()}H[a+16>>2]=e;H[a+12>>2]=g;H[a+8>>2]=i}if(d){oa(d)}break a}if(e>>>0>=g>>>0){break a}d=d+(e<<2)|0;if((d|0)!=(h|0)){while(1){h=h-4|0;c=H[h>>2];H[h>>2]=0;if(c){Ga(c)}if((d|0)!=(h|0)){continue}break}c=H[k+8>>2]}H[a+12>>2]=d}e:{f:{d=H[c+56>>2];g:{if((d|0)>4){break g}j=N(d,12)+a|0;d=H[j+24>>2];if((d|0)!=H[j+28>>2]){H[d>>2]=b;H[j+24>>2]=d+4;break g}i=H[j+20>>2];g=d-i|0;f=g>>2;e=f+1|0;if(e>>>0>=1073741824){break f}d=g>>>1|0;e=g>>>0>=2147483644?1073741823:d>>>0>e>>>0?d:e;if(e){if(e>>>0>=1073741824){break e}d=pa(e<<2)}else{d=0}f=d+(f<<2)|0;H[f>>2]=b;d=va(d,i,g);H[j+20>>2]=d;H[j+24>>2]=f+4;H[j+28>>2]=d+(e<<2);if(!i){break g}oa(i)}H[c+60>>2]=b;a=H[a+8>>2];H[k+8>>2]=0;a=a+(b<<2)|0;b=H[a>>2];H[a>>2]=c;if(b){Ga(b)}a=H[k+8>>2];H[k+8>>2]=0;if(a){Ga(a)}ca=k+16|0;return}sa();v()}wa();v()}function Og(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=c;d=a;a:{if(H[a+12>>2]==(b|0)){break a}a=b;b=H[d+4>>2];e=H[d>>2];if((b|0)!=(e|0)){while(1){c=b-12|0;if(F[b-1|0]<0){oa(H[c>>2])}b=c;if((e|0)!=(b|0)){continue}break}}H[d+12>>2]=a;H[d+4>>2]=e;c=H[a>>2];j=a+4|0;if((c|0)==(j|0)){break a}while(1){a=H[d+4>>2];b:{if((a|0)!=H[d+8>>2]){c:{if(F[c+27|0]>=0){b=H[c+20>>2];H[a>>2]=H[c+16>>2];H[a+4>>2]=b;H[a+8>>2]=H[c+24>>2];break c}za(a,H[c+16>>2],H[c+20>>2])}H[d+4>>2]=a+12;break b}g=0;d:{e:{f:{a=H[d+4>>2];e=H[d>>2];f=(a-e|0)/12|0;b=f+1|0;if(b>>>0<357913942){h=(H[d+8>>2]-e|0)/12|0;k=h<<1;b=h>>>0>=178956970?357913941:b>>>0>>0?k:b;if(b){if(b>>>0>=357913942){break f}g=pa(N(b,12))}h=N(b,12);b=N(f,12)+g|0;g:{if(F[c+27|0]>=0){f=H[c+20>>2];H[b>>2]=H[c+16>>2];H[b+4>>2]=f;H[b+8>>2]=H[c+24>>2];break g}za(b,H[c+16>>2],H[c+20>>2]);e=H[d>>2];a=H[d+4>>2]}g=g+h|0;f=b+12|0;if((a|0)==(e|0)){break e}while(1){a=a-12|0;h=H[a+4>>2];b=b-12|0;H[b>>2]=H[a>>2];H[b+4>>2]=h;H[b+8>>2]=H[a+8>>2];H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;if((a|0)!=(e|0)){continue}break}H[d+8>>2]=g;a=H[d+4>>2];H[d+4>>2]=f;e=H[d>>2];H[d>>2]=b;if((a|0)==(e|0)){break d}while(1){b=a-12|0;if(F[a-1|0]<0){oa(H[b>>2])}a=b;if((e|0)!=(b|0)){continue}break}break d}sa();v()}wa();v()}H[d+8>>2]=g;H[d+4>>2]=f;H[d>>2]=b}if(e){oa(e)}}b=H[c+4>>2];h:{if(b){while(1){a=b;b=H[b>>2];if(b){continue}break h}}while(1){a=H[c+8>>2];b=H[a>>2]!=(c|0);c=a;if(b){continue}break}}c=a;if((j|0)!=(a|0)){continue}break}}a=0;i:{if((i|0)<0){break i}b=H[d>>2];if((H[d+4>>2]-b|0)/12>>>0<=i>>>0){break i}a=b+N(i,12)|0;a=F[a+11|0]<0?H[a>>2]:a}return a|0}function bd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;i=ca-16|0;ca=i;H[i>>2]=b;f=-1;a:{if((b|0)==-1){H[i+4>>2]=-1;break a}f=b+1|0;H[i+4>>2]=(f>>>0)%3|0?f:b-2|0;if((b>>>0)%3|0){f=b-1|0;break a}f=b+2|0}H[i+8>>2]=f;n=(b>>>0)/3|0;b:{c:{d:{while(1){e:{f:{j=H[(l<<2)+i>>2];if((j|0)!=-1){f=H[H[H[a+8>>2]+12>>2]+(j<<2)>>2];if((f|0)!=-1){break f}}f=0;g=H[a+216>>2];if((g|0)==H[a+220>>2]){break e}while(1){g=N(f,144)+g|0;d=H[g+136>>2];c=H[g+140>>2];g:{if(d>>>0>>0){H[d>>2]=j;H[g+136>>2]=d+4;break g}e=d;d=H[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break d}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=pa(h<<2)}else{c=0}e=m+c|0;H[e>>2]=j;c=va(c,d,k);H[g+132>>2]=c;H[g+136>>2]=e+4;H[g+140>>2]=c+(h<<2);if(!d){break g}oa(d)}f=f+1|0;g=H[a+216>>2];if(f>>>0<(H[a+220>>2]-g|0)/144>>>0){continue}break}break e}if((b|0)==-1|(f>>>0)/3>>>0>>0){break e}f=0;if(H[a+220>>2]==H[a+216>>2]){break e}while(1){h:{if(!Ba(H[a+368>>2]+(f<<4)|0)){break h}g=H[a+216>>2]+N(f,144)|0;d=H[g+136>>2];c=H[g+140>>2];if(d>>>0>>0){H[d>>2]=j;H[g+136>>2]=d+4;break h}e=d;d=H[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break b}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=pa(h<<2)}else{c=0}e=m+c|0;H[e>>2]=j;c=va(c,d,k);H[g+132>>2]=c;H[g+136>>2]=e+4;H[g+140>>2]=c+(h<<2);if(!d){break h}oa(d)}f=f+1|0;if(f>>>0<(H[a+220>>2]-H[a+216>>2]|0)/144>>>0){continue}break}}l=l+1|0;if((l|0)!=3){continue}break}ca=i+16|0;return 1}sa();v()}wa();v()}sa();v()}function cd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=ca-16|0;ca=h;H[h>>2]=b;c=-1;a:{if((b|0)==-1){H[h+4>>2]=-1;break a}c=b+1|0;H[h+4>>2]=(c>>>0)%3|0?c:b-2|0;if((b>>>0)%3|0){c=b-1|0;break a}c=b+2|0}H[h+8>>2]=c;b:{c:{while(1){i=H[(k<<2)+h>>2];d:{if(!((i|0)==-1|H[H[H[a+8>>2]+12>>2]+(i<<2)>>2]==-1)){b=0;if(H[a+220>>2]==H[a+216>>2]){break d}while(1){e:{f:{if(!Ba(H[a+368>>2]+(b<<4)|0)){break f}c=H[a+216>>2]+N(b,144)|0;e=H[c+136>>2];d=H[c+140>>2];if(e>>>0>>0){H[e>>2]=i;H[c+136>>2]=e+4;break f}f=e;e=H[c+132>>2];j=f-e|0;f=j>>2;g=f+1|0;if(g>>>0>=1073741824){break e}l=f<<2;d=d-e|0;f=d>>>1|0;g=d>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(g){if(g>>>0>=1073741824){break b}d=pa(g<<2)}else{d=0}f=l+d|0;H[f>>2]=i;d=va(d,e,j);H[c+132>>2]=d;H[c+136>>2]=f+4;H[c+140>>2]=d+(g<<2);if(!e){break f}oa(e)}b=b+1|0;if(b>>>0<(H[a+220>>2]-H[a+216>>2]|0)/144>>>0){continue}break d}break}sa();v()}b=0;c=H[a+216>>2];if((c|0)==H[a+220>>2]){break d}while(1){c=N(b,144)+c|0;e=H[c+136>>2];d=H[c+140>>2];g:{if(e>>>0>>0){H[e>>2]=i;H[c+136>>2]=e+4;break g}f=e;e=H[c+132>>2];j=f-e|0;f=j>>2;g=f+1|0;if(g>>>0>=1073741824){break c}l=f<<2;d=d-e|0;f=d>>>1|0;g=d>>>0>=2147483644?1073741823:g>>>0>>0?f:g;if(g){if(g>>>0>=1073741824){break b}d=pa(g<<2)}else{d=0}f=l+d|0;H[f>>2]=i;d=va(d,e,j);H[c+132>>2]=d;H[c+136>>2]=f+4;H[c+140>>2]=d+(g<<2);if(!e){break g}oa(e)}b=b+1|0;c=H[a+216>>2];if(b>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}k=k+1|0;if((k|0)!=3){continue}break}ca=h+16|0;return 1}sa();v()}wa();v()}function vg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=ca-16|0;ca=m;l=H[b+80>>2];e=I[c+24|0];a=N(l,e);a:{b:{c:{d:{b=H[c+28>>2];if(!(!I[c+84|0]|(b|0)!=1&(b|0)!=2)){b=H[c+48>>2];c=H[H[c>>2]>>2];H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;if(a){if((a|0)<0){break d}f=pa(a);h=qa(f,b+c|0,a)+a|0}a=H[d>>2];if(a){H[d+4>>2]=a;oa(a)}H[d+8>>2]=h;H[d+4>>2]=h;H[d>>2]=f;b=1;break a}if(e){f=pa(e);ra(f,0,e)}e:{i=H[d+4>>2];b=H[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=H[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ra(i,0,k)+k|0,H[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=pa(i);ra(j+g|0,0,k);g=va(j,b,g);H[d+8>>2]=g+i;H[d+4>>2]=a+g;H[d>>2]=g;if(!b){break f}oa(b);break f}if(a>>>0>=g>>>0){break f}H[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!ic(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!ic(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){F[H[d>>2]+h|0]=I[a+f|0];F[(H[d>>2]+h|0)+1|0]=I[(a|1)+f|0];F[(H[d>>2]+h|0)+2|0]=I[(a|2)+f|0];F[(H[d>>2]+h|0)+3|0]=I[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){F[H[d>>2]+h|0]=I[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}sa();v()}sa();v()}if(!f){break a}}oa(f)}ca=m+16|0;return b&1}function ug(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=ca-16|0;ca=m;l=H[b+80>>2];e=I[c+24|0];a=N(l,e);a:{b:{c:{d:{b=H[c+28>>2];if(!(!I[c+84|0]|(b|0)!=1&(b|0)!=2)){b=H[c+48>>2];c=H[H[c>>2]>>2];H[m+8>>2]=0;H[m>>2]=0;H[m+4>>2]=0;if(a){if((a|0)<0){break d}f=pa(a);h=qa(f,b+c|0,a)+a|0}a=H[d>>2];if(a){H[d+4>>2]=a;oa(a)}H[d+8>>2]=h;H[d+4>>2]=h;H[d>>2]=f;b=1;break a}if(e){f=pa(e);ra(f,0,e)}e:{i=H[d+4>>2];b=H[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=H[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ra(i,0,k)+k|0,H[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=pa(i);ra(j+g|0,0,k);g=va(j,b,g);H[d+8>>2]=g+i;H[d+4>>2]=a+g;H[d>>2]=g;if(!b){break f}oa(b);break f}if(a>>>0>=g>>>0){break f}H[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!hc(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!hc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){F[H[d>>2]+h|0]=I[a+f|0];F[(H[d>>2]+h|0)+1|0]=I[(a|1)+f|0];F[(H[d>>2]+h|0)+2|0]=I[(a|2)+f|0];F[(H[d>>2]+h|0)+3|0]=I[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){F[H[d>>2]+h|0]=I[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}sa();v()}sa();v()}if(!f){break a}}oa(f)}ca=m+16|0;return b&1}function qc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;k=H[b+16>>2];h=H[c+4>>2]-k|0;e=H[c>>2]-k|0;H[c>>2]=e;f=h;H[c+4>>2]=f;l=H[b+16>>2];f=f>>31;g=(h^f)-f|0;f=e>>31;m=l>>>0>=g+((f^e)-f|0)>>>0;a:{if(m){f=h;break a}b:{c:{if((e|0)>=0){g=1;j=1;if((h|0)>=0){break b}i=1;g=-1;j=-1;if(e){break c}break b}i=-1;g=-1;j=-1;if((h|0)<=0){break b}}g=(h|0)<=0?-1:1;j=i}n=N(j,l);f=(e<<1)-n|0;i=(N(g,j)|0)>=0;e=N(g,l);f=((i?0-f|0:f)+e|0)/2|0;H[c+4>>2]=f;e=(h<<1)-e|0;e=((i?0-e|0:e)+n|0)/2|0;H[c>>2]=e}d:{e:{f:{g:{h:{i:{j:{if(e){if((e|0)<0){break j}if((f|0)>=0){break i}break f}if(f){break h}j=1;g=0;f=0;i=0;break d}j=1;if((f|0)>0){break g}i=(f|0)>0?3:0;g=f;f=e;break d}g=0-f|0;f=0-e|0;i=2;break e}if((f|0)<=0){break f}}f=0-f|0;g=e;i=3;break e}g=0-e|0;i=1}H[c>>2]=f;H[c+4>>2]=g;j=0}e=H[d>>2]+f|0;h=H[b+16>>2];k:{if((e|0)>(h|0)){e=e-H[b+4>>2]|0;break k}if((0-h|0)<=(e|0)){break k}e=H[b+4>>2]+e|0}c=H[d+4>>2]+g|0;l:{if((h|0)<(c|0)){c=c-H[b+4>>2]|0;break l}if((0-h|0)<=(c|0)){break l}c=H[b+4>>2]+c|0}m:{if(j){b=c;break m}b=c;n:{o:{p:{d=4-i|0;switch((d>>>0<4?d:0-i|0)-1|0){case 2:break n;case 1:break o;case 0:break p;default:break m}}b=0-e|0;e=c;break m}b=0-c|0;e=0-e|0;break m}b=e;e=0-c|0}q:{if(m){c=b;break q}r:{s:{if((e|0)>=0){c=1;f=1;if((b|0)>=0){break r}d=1;c=-1;f=-1;if(e){break s}break r}d=-1;c=-1;f=-1;if((b|0)<=0){break r}}c=(b|0)<=0?-1:1;f=d}d=e<<1;e=N(f,h);d=d-e|0;f=(N(c,f)|0)>=0;g=f?0-d|0:d;d=N(c,h);c=(g+d|0)/2|0;b=(b<<1)-d|0;e=(e+(f?0-b|0:b)|0)/2|0}b=a;H[b>>2]=e+k;H[b+4>>2]=c+k}function Cj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=ca-32|0;ca=j;H[j+28>>2]=0;a:{b:{if(J[b+38>>1]<=513){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;h=H[b+12>>2];if(K[b+8>>2]>>0&(h|0)<=(c|0)|(c|0)>(h|0)){break a}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break b}if(!Xa(1,j+28|0,b)){break a}f=H[j+28>>2]}if(!f){break a}c=H[H[a+48>>2]+64>>2];if(H[c+4>>2]-H[c>>2]>>2>>>0>>0){break a}Wa(a+76|0,f);c=j+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c:{if(!ta(c,b)){break c}h=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^h;if(e&1){d=H[g>>2]&(d^-1)}else{d=d|H[g>>2]}h=e^1;H[g>>2]=d;i=i+1|0;if((f|0)!=(i|0)){continue}break}c=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];h=e;f=H[b+16>>2];d=f+4|0;e=d>>>0<4?e+1|0:e;i=d;if(d>>>0>c>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break c}l=H[b>>2];d=l+f|0;k=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;d=c;c=h;e=f+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=i+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(k|0)){break c}H[a+16>>2]=d;H[a+12>>2]=k;c=(d>>31)-((k>>31)+(d>>>0>>0)|0)|0;b=d-k|0;if(!c&b>>>0>2147483646|c){break c}m=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break c}H[a+24>>2]=b-1}}ca=j+32|0;return m|0}function lj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=ca-32|0;ca=j;H[j+28>>2]=0;a:{b:{if(J[b+38>>1]<=513){c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;h=H[b+12>>2];if(K[b+8>>2]>>0&(h|0)<=(c|0)|(c|0)>(h|0)){break a}d=d+H[b>>2]|0;f=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;break b}if(!Xa(1,j+28|0,b)){break a}f=H[j+28>>2]}if(!f){break a}c=H[a+48>>2];if(H[c+4>>2]-H[c>>2]>>2>>>0>>0){break a}Wa(a+76|0,f);c=j+8|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;c:{if(!ta(c,b)){break c}h=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^h;if(e&1){d=H[g>>2]&(d^-1)}else{d=d|H[g>>2]}h=e^1;H[g>>2]=d;i=i+1|0;if((f|0)!=(i|0)){continue}break}c=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];h=e;f=H[b+16>>2];d=f+4|0;e=d>>>0<4?e+1|0:e;i=d;if(d>>>0>c>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break c}l=H[b>>2];d=l+f|0;k=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;d=c;c=h;e=f+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break c}d=i+l|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(k|0)){break c}H[a+16>>2]=d;H[a+12>>2]=k;c=(d>>31)-((k>>31)+(d>>>0>>0)|0)|0;b=d-k|0;if(!c&b>>>0>2147483646|c){break c}m=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break c}H[a+24>>2]=b-1}}ca=j+32|0;return m|0}function cj(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;H[a+8>>2]=e;m=a+32|0;h=H[m>>2];g=H[a+36>>2]-h>>2;a:{if(g>>>0>>0){ya(m,e-g|0);f=H[a+8>>2];break a}f=e;if(f>>>0>=g>>>0){break a}H[a+36>>2]=h+(e<<2);f=e}g=e>>>0>1073741823?-1:e<<2;n=ra(pa(g),0,g);b:{if((f|0)<=0){break b}h=H[a+32>>2];while(1){f=i<<2;g=H[f+n>>2];j=H[a+16>>2];c:{if((g|0)>(j|0)){H[f+h>>2]=j;break c}f=f+h|0;j=H[a+12>>2];if((j|0)>(g|0)){H[f>>2]=j;break c}H[f>>2]=g}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}if((f|0)<=0){break b}i=0;while(1){g=i<<2;f=g+c|0;g=H[b+g>>2]+H[g+h>>2]|0;H[f>>2]=g;d:{if((g|0)>H[a+16>>2]){g=g-H[a+20>>2]|0}else{if((g|0)>=H[a+12>>2]){break d}g=g+H[a+20>>2]|0}H[f>>2]=g}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}if(!((d|0)<=(e|0)|(f|0)<=0)){p=0-e<<2;g=e;while(1){e:{if((f|0)<=0){break e}l=g<<2;o=l+c|0;q=o+p|0;j=H[m>>2];i=0;while(1){f=i<<2;h=H[f+q>>2];k=H[a+16>>2];f:{if((h|0)>(k|0)){H[f+j>>2]=k;break f}f=f+j|0;k=H[a+12>>2];if((k|0)>(h|0)){H[f>>2]=k;break f}H[f>>2]=h}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}i=0;if((f|0)<=0){break e}l=b+l|0;while(1){h=i<<2;f=h+o|0;h=H[h+l>>2]+H[h+j>>2]|0;H[f>>2]=h;g:{if((h|0)>H[a+16>>2]){h=h-H[a+20>>2]|0}else{if((h|0)>=H[a+12>>2]){break g}h=h+H[a+20>>2]|0}H[f>>2]=h}f=H[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}g=e+g|0;if((g|0)<(d|0)){continue}break}}oa(n);return 1}function De(a,b){var c=0,d=0,e=0,f=0,g=0;d=-1;f=-1;a:{if((b|0)==-1){break a}c=b+1|0;d=(c>>>0)%3|0?c:b-2|0;f=b-1|0;if((b>>>0)%3|0){break a}f=b+2|0}b:{c:{d:{e:{f:{g:{e=H[a+184>>2];switch(e|0){case 7:break d;case 3:break e;case 5:break f;case 0:case 1:break g;default:break b}}g=H[a+148>>2];c=-1;e=1;d=((d|0)!=-1?H[H[g>>2]+(d<<2)>>2]:c)<<2;c=H[a+156>>2];d=d+c|0;H[d>>2]=H[d>>2]+1;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+1;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+1;e=2;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+1;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+2;e=1;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0;break c}g=H[a+148>>2];c=H[a+156>>2];e=c+(((b|0)==-1?-1:H[H[g>>2]+(b<<2)>>2])<<2)|0;H[e>>2]=H[e>>2]+2;d=(((d|0)==-1?-1:H[H[g>>2]+(d<<2)>>2])<<2)+c|0;H[d>>2]=H[d>>2]+2;e=2;c=(((f|0)==-1?-1:H[H[g>>2]+(f<<2)>>2])<<2)+c|0}H[c>>2]=H[c>>2]+e;e=H[a+184>>2]}h:{switch(e|0){case 0:case 5:f=H[a+156>>2];c=-1;i:{if((b|0)==-1){break i}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;c=-1;if((b|0)==-1){break i}c=H[H[H[a+148>>2]>>2]+(b<<2)>>2]}if(H[f+(c<<2)>>2]<=5){H[a+188>>2]=5;return}H[a+188>>2]=0;return;default:break h}}H[a+188>>2]=-1}function xg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=H[b+80>>2];b=I[c+24|0];g=N(j,b);a:{if(!b){break a}h=b<<2;f=pa(h);a=f;k=b&7;if(k){while(1){H[a>>2]=-1073741824;a=a+4|0;e=e+1|0;if((k|0)!=(e|0)){continue}break}}if((b-1&1073741823)>>>0<7){break a}e=f+h|0;while(1){H[a+24>>2]=-1073741824;H[a+28>>2]=-1073741824;H[a+16>>2]=-1073741824;H[a+20>>2]=-1073741824;H[a+8>>2]=-1073741824;H[a+12>>2]=-1073741824;H[a>>2]=-1073741824;H[a+4>>2]=-1073741824;a=a+32|0;if((e|0)!=(a|0)){continue}break}}e=H[d>>2];a=H[d+4>>2]-e>>2;b:{if(a>>>0>>0){ya(d,g-a|0);break b}if(a>>>0<=g>>>0){break b}H[d+4>>2]=e+(g<<2)}c:{d:{e:{if(!j){i=1;break e}if(!b){a=0;while(1){if(!Va(c,I[c+84|0]?a:H[H[c+68>>2]+(a<<2)>>2],F[c+24|0],f)){break e}a=a+1|0;i=j>>>0<=a>>>0;if((a|0)!=(j|0)){continue}break}break e}n=b&252;k=b&3;o=b>>>0<4;e=0;b=0;while(1){if(!Va(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],f)){break e}m=H[d>>2];i=0;a=0;l=0;if(!o){while(1){g=(e<<2)+m|0;h=a<<2;L[g>>2]=L[h+f>>2];L[g+4>>2]=L[(h|4)+f>>2];L[g+8>>2]=L[(h|8)+f>>2];L[g+12>>2]=L[(h|12)+f>>2];a=a+4|0;e=e+4|0;l=l+4|0;if((n|0)!=(l|0)){continue}break}}if(k){while(1){L[(e<<2)+m>>2]=L[(a<<2)+f>>2];a=a+1|0;e=e+1|0;i=i+1|0;if((k|0)!=(i|0)){continue}break}}b=b+1|0;i=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break d}if(!f){break c}}oa(f)}return i|0}function mf(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=ca-16|0;ca=e;h=1;i=ea[H[H[a>>2]+24>>2]](a)|0;a:{if((i|0)<=0){break a}l=a+48|0;h=0;while(1){b:{c:{if(!H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2]){break c}j=f<<2;g=H[j+H[a+36>>2]>>2];b=H[g+8>>2];k=rb(g);if(!k){break c}g=H[(ea[H[H[a>>2]+28>>2]](a)|0)+40>>2];H[e+12>>2]=H[b+56>>2];b=pa(32);H[e>>2]=b;H[e+4>>2]=24;H[e+8>>2]=-2147483616;c=I[1206]|I[1207]<<8|(I[1208]<<16|I[1209]<<24);d=I[1202]|I[1203]<<8|(I[1204]<<16|I[1205]<<24);F[b+16|0]=d;F[b+17|0]=d>>>8;F[b+18|0]=d>>>16;F[b+19|0]=d>>>24;F[b+20|0]=c;F[b+21|0]=c>>>8;F[b+22|0]=c>>>16;F[b+23|0]=c>>>24;c=I[1198]|I[1199]<<8|(I[1200]<<16|I[1201]<<24);d=I[1194]|I[1195]<<8|(I[1196]<<16|I[1197]<<24);F[b+8|0]=d;F[b+9|0]=d>>>8;F[b+10|0]=d>>>16;F[b+11|0]=d>>>24;F[b+12|0]=c;F[b+13|0]=c>>>8;F[b+14|0]=c>>>16;F[b+15|0]=c>>>24;c=I[1190]|I[1191]<<8|(I[1192]<<16|I[1193]<<24);d=I[1186]|I[1187]<<8|(I[1188]<<16|I[1189]<<24);F[b|0]=d;F[b+1|0]=d>>>8;F[b+2|0]=d>>>16;F[b+3|0]=d>>>24;F[b+4|0]=c;F[b+5|0]=c>>>8;F[b+6|0]=c>>>16;F[b+7|0]=c>>>24;F[b+24|0]=0;b=sd(g,e+12|0,e);if(F[e+11|0]<0){oa(H[e>>2])}if(!b){break c}oe(H[H[H[a+36>>2]+j>>2]+8>>2],k);break b}b=H[H[a+36>>2]+(f<<2)>>2];if(!(ea[H[H[b>>2]+24>>2]](b,l)|0)){break a}}f=f+1|0;h=(i|0)<=(f|0);if((f|0)!=(i|0)){continue}break}}ca=e+16|0;return h|0}function Ye(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=ca-16|0;ca=k;c=H[b+20>>2];d=H[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=H[b+12>>2];a:{if(K[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){break a}d=d+H[b>>2]|0;h=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((h|0)<0){break a}Wa(a+76|0,h);c=k;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;b:{if(!ta(c,b)){break b}if(h){g=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^g;if(e&1){d=H[f>>2]&(d^-1)}else{d=d|H[f>>2]}g=e^1;H[f>>2]=d;i=i+1|0;if((h|0)!=(i|0)){continue}break}}i=0;c=H[b+8>>2];e=H[b+12>>2];f=e;e=H[b+20>>2];g=e;l=H[b+16>>2];d=l+4|0;e=d>>>0<4?e+1|0:e;h=d;if(d>>>0>c>>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break b}m=H[b>>2];d=m+l|0;j=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=h;H[b+20>>2]=e;d=c;c=g;e=l+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break b}d=h+m|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;if((d|0)<(j|0)){break b}H[a+16>>2]=d;H[a+12>>2]=j;c=(d>>31)-((j>>31)+(d>>>0>>0)|0)|0;b=d-j|0;if(!c&b>>>0>2147483646|c){break b}i=1;c=b+1|0;H[a+20>>2]=c;b=c>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(c&1){break b}H[a+24>>2]=b-1}}ca=k+16|0;return i|0}function rg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=5&(f|0)!=6)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<2;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>2;e:{if(f>>>0>>0){ya(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!dc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!dc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;H[f>>2]=H[i+a>>2];H[f+4>>2]=H[(i|4)+a>>2];H[f+8>>2]=H[(i|8)+a>>2];H[f+12>>2]=H[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){H[(g<<2)+n>>2]=H[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function ge(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=5&(f|0)!=6)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<2;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>2;e:{if(f>>>0>>0){ya(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!ec(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!ec(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;H[f>>2]=H[i+a>>2];H[f+4>>2]=H[(i|4)+a>>2];H[f+8>>2]=H[(i|8)+a>>2];H[f+12>>2]=H[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){H[(g<<2)+n>>2]=H[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function tg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=3&(f|0)!=4)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<1;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>1;e:{if(f>>>0>>0){qe(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!gc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!gc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;G[f>>1]=J[i+a>>1];G[f+2>>1]=J[(i|2)+a>>1];G[f+4>>1]=J[(i|4)+a>>1];G[f+6>>1]=J[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){G[(g<<1)+n>>1]=J[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function sg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=ca-16|0;ca=k;j=H[b+80>>2];e=I[c+24|0];b=N(j,e);a:{b:{c:{d:{f=H[c+28>>2];if(!(!I[c+84|0]|(f|0)!=3&(f|0)!=4)){e=H[c+48>>2];c=H[H[c>>2]>>2];H[k+8>>2]=0;H[k>>2]=0;H[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=pa(b);g=qa(a,c+e|0,b)+b|0}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=a;h=1;break a}if(e){f=e<<1;a=pa(f);ra(a,0,f)}i=H[d>>2];f=H[d+4>>2]-i>>1;e:{if(f>>>0>>0){qe(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}H[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!fc(c,I[c+84|0]?b:H[H[c+68>>2]+(b<<2)>>2],F[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!fc(c,I[c+84|0]?e:H[H[c+68>>2]+(e<<2)>>2],F[c+24|0],a)){break c}n=H[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;G[f>>1]=J[i+a>>1];G[f+2>>1]=J[(i|2)+a>>1];G[f+4>>1]=J[(i|4)+a>>1];G[f+6>>1]=J[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){G[(g<<1)+n>>1]=J[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}sa();v()}if(!a){break a}}oa(a)}ca=k+16|0;return h|0}function Ce(a,b){var c=0,d=0,e=0,f=0,g=0;f=-1;d=-1;a:{if((b|0)==-1){break a}d=b+1|0;f=(d>>>0)%3|0?d:b-2|0;d=b-1|0;if((b>>>0)%3|0){break a}d=b+2|0}b:{c:{d:{switch(H[a+168>>2]){case 0:case 1:e=H[a+148>>2];c=1;b=H[a+156>>2];g=b+(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)|0;H[g>>2]=H[g>>2]+1;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 5:e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+1;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+1;c=2;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 3:e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+1;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+2;c=1;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 7:break d;default:break b}}e=H[a+148>>2];c=-1;c=((b|0)!=-1?H[H[e>>2]+(b<<2)>>2]:c)<<2;b=H[a+156>>2];c=c+b|0;H[c>>2]=H[c>>2]+2;c=(((f|0)==-1?-1:H[H[e>>2]+(f<<2)>>2])<<2)+b|0;H[c>>2]=H[c>>2]+2;c=2;b=(((d|0)==-1?-1:H[H[e>>2]+(d<<2)>>2])<<2)+b|0}H[b>>2]=H[b>>2]+c}c=a;b=H[H[a+156>>2]+(((f|0)==-1?-1:H[H[H[a+148>>2]>>2]+(f<<2)>>2])<<2)>>2];d=H[a+180>>2];a=H[a+176>>2];H[c+172>>2]=(a|0)<=(b|0)?((b|0)<(d|0)?b:d)-a|0:0}function Ac(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;f=H[b+4>>2];g=H[b>>2];e=f-g|0;c=(e|0)/20|0;a:{if((f|0)==(g|0)){break a}b:{if(c>>>0<214748365){f=pa(e);H[a+20>>2]=f;H[a+16>>2]=f;H[a+24>>2]=f+N(c,20);c=H[b>>2];g=H[b+4>>2];if((c|0)==(g|0)){break a}b=f;while(1){e=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=e;H[b+16>>2]=H[c+16>>2];e=H[c+12>>2];H[b+8>>2]=H[c+8>>2];H[b+12>>2]=e;b=b+20|0;c=c+20|0;if((g|0)!=(c|0)){continue}break}g=0;H[a+28>>2]=0;H[a+20>>2]=b;if((b|0)!=(f|0)){b=(b-f|0)/20|0;e=b>>>0<=1?1:b;h=e&3;b=0;c=0;if(e-1>>>0>=3){i=e&-4;e=0;while(1){d=f+N(b,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|1,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|2,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;d=f+N(b|3,20)|0;d=N(H[d+16>>2],H[d+12>>2]);c=c>>>0>d>>>0?c:d;b=b+4|0;e=e+4|0;if((i|0)!=(e|0)){continue}break}}if(h){while(1){e=f+N(b,20)|0;e=N(H[e+16>>2],H[e+12>>2]);c=c>>>0>e>>>0?c:e;b=b+1|0;g=g+1|0;if((h|0)!=(g|0)){continue}break}}if(!c){H[a+12>>2]=0;return a}if((c|0)<0){break b}g=pa(c);b=ra(g,0,c);f=b+c|0;H[a+8>>2]=f;H[a+4>>2]=f;H[a>>2]=b}H[a+12>>2]=g;return a}sa();v()}sa();v()}H[a+28>>2]=0;H[a+12>>2]=0;return a}function Dh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;a:{b=H[a+32>>2];f=H[b+8>>2];h=H[b+12>>2];g=H[b+20>>2];c=H[b+16>>2];e=0;b:{if((h|0)<=(g|0)&c>>>0>=f>>>0|(g|0)>(h|0)){break b}f=I[H[b>>2]+c|0];e=b;b=g;c=c+1|0;b=c?b:b+1|0;H[e+16>>2]=c;H[e+20>>2]=b;c:{if(!f){break c}while(1){if(ea[H[H[a>>2]+16>>2]](a,d)|0){d=d+1|0;if((f|0)!=(d|0)){continue}break c}break}return 0}d=H[a+8>>2];b=H[a+12>>2];if((d|0)!=(b|0)){while(1){c=H[d>>2];if(!(ea[H[H[c>>2]+8>>2]](c,a,H[a+4>>2])|0)){break a}d=d+4|0;if((b|0)!=(d|0)){continue}break}}d:{if(!f){break d}d=0;while(1){b=H[H[a+8>>2]+(d<<2)>>2];if(!(ea[H[H[b>>2]+12>>2]](b,H[a+32>>2])|0)){break a}d=d+1|0;if((f|0)!=(d|0)){continue}break}if(!f){break d}i=a+20|0;b=0;while(1){d=0;j=b<<2;c=H[j+H[a+8>>2]>>2];k=ea[H[H[c>>2]+24>>2]](c)|0;if((k|0)>0){while(1){c=H[H[a+8>>2]+j>>2];c=ea[H[H[c>>2]+20>>2]](c,d)|0;e=H[a+20>>2];g=H[a+24>>2]-e>>2;e:{if(c>>>0>>0){break e}h=c+1|0;if(h>>>0>g>>>0){ya(i,h-g|0);e=H[i>>2];break e}if(g>>>0<=h>>>0){break e}H[a+24>>2]=(h<<2)+e}H[(c<<2)+e>>2]=b;d=d+1|0;if((k|0)!=(d|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}}e=0;if(!(ea[H[H[a>>2]+28>>2]](a)|0)){break b}e=ea[H[H[a>>2]+32>>2]](a)|0}return e|0}return 0}function ta(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=ca-16|0;ca=i;f=H[b+20>>2];d=H[b+12>>2];c=H[b+16>>2];a:{if((f|0)>=(d|0)&c>>>0>=K[b+8>>2]|(d|0)<(f|0)){break a}F[a+12|0]=I[c+H[b>>2]|0];c=H[b+20>>2];g=c;f=H[b+16>>2];e=f+1|0;c=e?c:c+1|0;H[b+16>>2]=e;H[b+20>>2]=c;b:{if(J[b+38>>1]<=513){d=H[b+8>>2];c=H[b+12>>2];h=c;c=g;f=f+5|0;c=f>>>0<5?c+1|0:c;if(d>>>0>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}e=e+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;break b}if(!Qe(1,i+12|0,b)){break a}f=H[b+16>>2];c=H[b+20>>2];d=H[b+8>>2];h=H[b+12>>2];e=H[i+12>>2]}g=d-f|0;d=h-(c+(d>>>0>>0)|0)|0;if((d|0)<=0&e>>>0>g>>>0|(d|0)<0|(e|0)<=0){break a}j=H[b>>2]+f|0;H[a>>2]=j;c:{d:{h=e-1|0;g=h+j|0;d=I[g|0];e:{if(d>>>0<=63){H[a+4>>2]=h;g=I[g|0]&63;break e}f:{switch((d>>>6|0)-1|0){case 1:break d;case 0:break f;default:break a}}if(e>>>0<2){break a}d=e-2|0;H[a+4>>2]=d;d=d+j|0;g=I[d+1|0]<<8&16128|I[d|0]}H[a+8>>2]=g+4096;break c}if(e>>>0<3){break a}d=e-3|0;H[a+4>>2]=d;g=a;a=d+j|0;a=I[a+1|0]<<8|I[a+2|0]<<16&4128768|I[a|0];H[g+8>>2]=a+4096;if(a>>>0>1044479){break a}}a=e+f|0;c=a>>>0>>0?c+1|0:c;H[b+16>>2]=a;H[b+20>>2]=c;k=1}ca=i+16|0;return k}function Wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Xd(a,b,c);c=H[a+84>>2];d=H[a+88>>2]-c>>2;a:{if((d|0)>(b|0)){break a}b=b+1|0;if(b>>>0>d>>>0){b:{d=b-d|0;e=H[a+92>>2];c=H[a+88>>2];if(d>>>0<=e-c>>2>>>0){c:{if(!d){break c}b=c;e=d&7;if(e){while(1){H[b>>2]=1;b=b+4|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}c=(d<<2)+c|0;if((d-1&1073741823)>>>0<7){break c}while(1){H[b+24>>2]=1;H[b+28>>2]=1;H[b+16>>2]=1;H[b+20>>2]=1;H[b+8>>2]=1;H[b+12>>2]=1;H[b>>2]=1;H[b+4>>2]=1;b=b+32|0;if((c|0)!=(b|0)){continue}break}}H[a+88>>2]=c;break b}d:{b=c;c=H[a+84>>2];i=b-c|0;g=i>>2;b=g+d|0;if(b>>>0<1073741824){e=e-c|0;h=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>>0?h:b;if(e){if(e>>>0>=1073741824){break d}j=pa(e<<2)}g=(g<<2)+j|0;b=g;h=d&7;if(h){while(1){H[b>>2]=1;b=b+4|0;f=f+1|0;if((h|0)!=(f|0)){continue}break}}f=g+(d<<2)|0;if((d-1&1073741823)>>>0>=7){while(1){H[b+24>>2]=1;H[b+28>>2]=1;H[b+16>>2]=1;H[b+20>>2]=1;H[b+8>>2]=1;H[b+12>>2]=1;H[b>>2]=1;H[b+4>>2]=1;b=b+32|0;if((f|0)!=(b|0)){continue}break}}b=va(j,c,i);H[a+88>>2]=f;H[a+84>>2]=b;H[a+92>>2]=b+(e<<2);if(c){oa(c)}break b}sa();v()}wa();v()}return}if(b>>>0>=d>>>0){break a}H[a+88>>2]=c+(b<<2)}}function qb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;g=b&7;if(g){while(1){H[d>>2]=H[c>>2];d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}b:{i=H[a>>2];f=e-i>>2;h=f+b|0;if(h>>>0<1073741824){j=d-i|0;d=j>>>1|0;h=j>>>0>=2147483644?1073741823:d>>>0>h>>>0?d:h;if(h){if(h>>>0>=1073741824){break b}k=pa(h<<2)}f=(f<<2)+k|0;d=f;j=b&7;if(j){while(1){H[d>>2]=H[c>>2];d=d+4|0;g=g+1|0;if((j|0)!=(g|0)){continue}break}}g=(b<<2)+f|0;if((b-1&1073741823)>>>0>=7){while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((g|0)!=(d|0)){continue}break}}if((e|0)!=(i|0)){while(1){f=f-4|0;e=e-4|0;H[f>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[a+8>>2]=(h<<2)+k;H[a+4>>2]=g;H[a>>2]=f;if(i){oa(i)}return}sa();v()}wa();v()}function Kc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a>>2];if(d-e>>2>>>0>=b>>>0){f=H[a+4>>2];h=f-e>>2;i=b>>>0>h>>>0?h:b;a:{if(!i){break a}d=e;g=i;j=g&7;if(j){while(1){H[d>>2]=H[c>>2];g=g-1|0;d=d+4|0;k=k+1|0;if((k|0)!=(j|0)){continue}break}}if(i>>>0<8){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;g=g-8|0;if(g){continue}break}}if(b>>>0>h>>>0){b=(b-h<<2)+f|0;while(1){H[f>>2]=H[c>>2];f=f+4|0;if((b|0)!=(f|0)){continue}break}H[a+4>>2]=b;return}H[a+4>>2]=e+(b<<2);return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}b:{if(b>>>0>=1073741824){break b}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:b>>>0>>0?e:b;if(d>>>0>=1073741824){break b}d=d<<2;e=pa(d);H[a>>2]=e;H[a+8>>2]=d+e;c=H[c>>2];d=e;g=b&7;if(g){while(1){H[d>>2]=c;d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=e+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){H[d+28>>2]=c;H[d+24>>2]=c;H[d+20>>2]=c;H[d+16>>2]=c;H[d+12>>2]=c;H[d+8>>2]=c;H[d+4>>2]=c;H[d>>2]=c;d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}sa();v()}function Me(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=ca-16|0;ca=h;a:{b:{if(J[b+38>>1]<=511){e=H[b+8>>2];c=H[b+12>>2];i=c;f=H[b+20>>2];d=H[b+16>>2];g=d+8|0;f=g>>>0<8?f+1|0:f;if(e>>>0>>0&(c|0)<=(f|0)|(c|0)<(f|0)){break a}d=d+H[b>>2]|0;c=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=I[d+4|0]|I[d+5|0]<<8|(I[d+6|0]<<16|I[d+7|0]<<24);H[b+16>>2]=g;H[b+20>>2]=f;break b}if(!gb(1,h+8|0,b)){break a}g=H[b+16>>2];f=H[b+20>>2];e=H[b+8>>2];i=H[b+12>>2];c=H[h+8>>2];d=H[h+12>>2]}j=e-g|0;e=i-(f+(e>>>0>>0)|0)|0;if((e|0)==(d|0)&c>>>0>j>>>0|d>>>0>e>>>0){break a}e=d+f|0;f=c+g|0;e=f>>>0>>0?e+1|0:e;H[b+16>>2]=f;H[b+20>>2]=e;if((c|0)<=0){break a}b=H[b>>2]+g|0;H[a+40>>2]=b;g=c-1|0;e=b+g|0;f=I[e|0];c:{if(f>>>0<=63){H[a+44>>2]=g;b=I[e|0]&63;break c}d:{switch((f>>>6|0)-1|0){case 0:if(c>>>0<2){break a}c=c-2|0;H[a+44>>2]=c;b=b+c|0;b=I[b+1|0]<<8&16128|I[b|0];break c;case 1:if(c>>>0<3){break a}c=c-3|0;H[a+44>>2]=c;b=b+c|0;b=I[b+1|0]<<8|I[b+2|0]<<16&4128768|I[b|0];break c;default:break d}}c=c-4|0;H[a+44>>2]=c;b=b+c|0;b=(I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24))&1073741823}H[a+48>>2]=b+16384;k=b>>>0<4177920}ca=h+16|0;return k}function Ua(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;f=(c>>>0)/3|0;j=H[(H[H[a+8>>2]+96>>2]+N(f,12)|0)+(c-N(f,3)<<2)>>2];a:{h=H[H[a+12>>2]+4>>2];e=H[h+4>>2];if((e|0)!=H[h+8>>2]){H[e>>2]=j;H[h+4>>2]=e+4;break a}b:{i=H[h>>2];f=e-i|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){k=g<<2;g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break b}f=pa(g<<2)}else{f=0}d=k+f|0;H[d>>2]=j;j=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[h+8>>2]=f+(g<<2);H[h+4>>2]=j;H[h>>2]=d;if(i){oa(i)}break a}sa();v()}wa();v()}c:{d:{h=H[a+4>>2];e=H[h+4>>2];e:{if((e|0)!=H[h+8>>2]){H[e>>2]=c;H[h+4>>2]=e+4;break e}i=H[h>>2];f=e-i|0;j=f>>2;d=j+1|0;if(d>>>0>=1073741824){break d}g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break c}f=pa(g<<2)}else{f=0}d=f+(j<<2)|0;H[d>>2]=c;c=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(i|0)){continue}break}}H[h+8>>2]=f+(g<<2);H[h+4>>2]=c;H[h>>2]=d;if(!i){break e}oa(i)}a=H[a+4>>2];H[H[a+12>>2]+(b<<2)>>2]=H[a+24>>2];H[a+24>>2]=H[a+24>>2]+1;return}sa();v()}wa();v()}function Wb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=d-c|0;if((h|0)<=0){return}a:{e=H[a+8>>2];i=H[a+4>>2];if((e-i|0)>=(h|0)){j=i-b|0;if((j|0)>=(h|0)){f=i;g=d;break a}f=i;g=c+j|0;if((g|0)!=(d|0)){e=g;while(1){F[f|0]=I[e|0];f=f+1|0;e=e+1|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=f;if((j|0)>0){break a}return}k=H[a>>2];g=(i-k|0)+h|0;if((g|0)>=0){j=b-k|0;f=e-k|0;e=f<<1;f=f>>>0>=1073741823?2147483647:e>>>0>g>>>0?e:g;if(f){e=pa(f)}else{e=0}g=j+e|0;if((c|0)!=(d|0)){g=qa(g,c,h)+h|0}d=va(e,k,j);c=i-b|0;b=va(g,b,c);H[a+8>>2]=e+f;H[a+4>>2]=b+c;H[a>>2]=d;if(k){oa(k)}return}sa();v()}e=f;d=e-h|0;if(i>>>0>d>>>0){while(1){F[e|0]=I[d|0];e=e+1|0;d=d+1|0;if(i>>>0>d>>>0){continue}break}}H[a+4>>2]=e;a=b+h|0;if((a|0)!=(f|0)){a=f-a|0;va(f-a|0,b,a)}if((c|0)==(g|0)){return}f=(c^-1)+g|0;a=g-c&7;b:{if(!a){e=b;break b}d=0;e=b;while(1){F[e|0]=I[c|0];e=e+1|0;c=c+1|0;d=d+1|0;if((a|0)!=(d|0)){continue}break}}if(f>>>0<7){return}while(1){F[e|0]=I[c|0];F[e+1|0]=I[c+1|0];F[e+2|0]=I[c+2|0];F[e+3|0]=I[c+3|0];F[e+4|0]=I[c+4|0];F[e+5|0]=I[c+5|0];F[e+6|0]=I[c+6|0];F[e+7|0]=I[c+7|0];e=e+8|0;c=c+8|0;if((g|0)!=(c|0)){continue}break}}function qa(a,b,c){var d=0,e=0,f=0;if(c>>>0>=512){ba(a|0,b|0,c|0);return a}e=a+c|0;a:{if(!((a^b)&3)){b:{if(!(a&3)){c=a;break b}if(!c){c=a;break b}c=a;while(1){F[c|0]=I[b|0];b=b+1|0;c=c+1|0;if(!(c&3)){break b}if(c>>>0>>0){continue}break}}d=e&-4;c:{if(d>>>0<64){break c}f=d+-64|0;if(f>>>0>>0){break c}while(1){H[c>>2]=H[b>>2];H[c+4>>2]=H[b+4>>2];H[c+8>>2]=H[b+8>>2];H[c+12>>2]=H[b+12>>2];H[c+16>>2]=H[b+16>>2];H[c+20>>2]=H[b+20>>2];H[c+24>>2]=H[b+24>>2];H[c+28>>2]=H[b+28>>2];H[c+32>>2]=H[b+32>>2];H[c+36>>2]=H[b+36>>2];H[c+40>>2]=H[b+40>>2];H[c+44>>2]=H[b+44>>2];H[c+48>>2]=H[b+48>>2];H[c+52>>2]=H[b+52>>2];H[c+56>>2]=H[b+56>>2];H[c+60>>2]=H[b+60>>2];b=b- -64|0;c=c- -64|0;if(f>>>0>=c>>>0){continue}break}}if(c>>>0>=d>>>0){break a}while(1){H[c>>2]=H[b>>2];b=b+4|0;c=c+4|0;if(d>>>0>c>>>0){continue}break}break a}if(e>>>0<4){c=a;break a}d=e-4|0;if(d>>>0>>0){c=a;break a}c=a;while(1){F[c|0]=I[b|0];F[c+1|0]=I[b+1|0];F[c+2|0]=I[b+2|0];F[c+3|0]=I[b+3|0];b=b+4|0;c=c+4|0;if(d>>>0>=c>>>0){continue}break}}if(c>>>0>>0){while(1){F[c|0]=I[b|0];b=b+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}}return a}function ub(a,b){var c=0,d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;c=a+16|0;H[c>>2]=0;H[c+4>>2]=0;F[c+5|0]=0;F[c+6|0]=0;F[c+7|0]=0;F[c+8|0]=0;F[c+9|0]=0;F[c+10|0]=0;F[c+11|0]=0;F[c+12|0]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+48>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;H[a+68>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+88>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+100>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;g=a+116|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+104>>2]=0;H[a+108>>2]=0;H[a+112>>2]=0;H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;c=1;break a}c=b<<2;e=pa(c);H[a+92>>2]=e;f=c+e|0;H[a+100>>2]=f;ra(e,0,c);H[a+112>>2]=0;H[a+104>>2]=0;H[a+108>>2]=0;H[a+96>>2]=f;e=pa(c);H[a+104>>2]=e;f=c+e|0;H[a+112>>2]=f;ra(e,0,c);H[a+108>>2]=f;e=pa(c);H[d>>2]=e;f=c+e|0;H[d+8>>2]=f;ra(e,0,c);H[d+4>>2]=f;c=b<<5|1}tb(g,c,d);e=H[d>>2];if(e){H[d+4>>2]=e;oa(e)}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;if(b){b=b<<2;e=pa(b);H[d>>2]=e;f=b+e|0;H[d+8>>2]=f;ra(e,0,b);H[d+4>>2]=f}tb(a+128|0,c,d);b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}ca=d+16|0;return a}function ze(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;H[a>>2]=11484;d=a+232|0;b=H[d+196>>2];if(b){H[d+200>>2]=b;oa(b)}c=H[d+184>>2];if(c){b=c;e=H[d+188>>2];if((b|0)!=(e|0)){while(1){b=e-12|0;f=H[b>>2];if(f){H[e-8>>2]=f;oa(f)}e=b;if((b|0)!=(c|0)){continue}break}b=H[d+184>>2]}H[d+188>>2]=c;oa(b)}b=H[d+156>>2];if(b){H[d+160>>2]=b;oa(b)}c=H[d+136>>2];H[d+136>>2]=0;if(c){e=c-4|0;b=H[e>>2];if(b){b=c+(b<<4)|0;while(1){b=b-16|0;if((c|0)!=(b|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}b=H[a+144>>2];if(b){while(1){c=H[b>>2];oa(b);b=c;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Pa(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=H[a+8>>2];e=H[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;f=b&7;if(f){while(1){H[d>>2]=H[c>>2];d=d+4|0;h=h+1|0;if((f|0)!=(h|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e;return}b:{i=H[a>>2];j=e-i|0;f=j>>2;g=f+b|0;if(g>>>0<1073741824){d=d-i|0;e=d>>>1|0;g=d>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break b}k=pa(g<<2)}f=(f<<2)+k|0;d=f;e=b&7;if(e){while(1){H[d>>2]=H[c>>2];d=d+4|0;h=h+1|0;if((e|0)!=(h|0)){continue}break}}e=f+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){H[d>>2]=H[c>>2];H[d+4>>2]=H[c>>2];H[d+8>>2]=H[c>>2];H[d+12>>2]=H[c>>2];H[d+16>>2]=H[c>>2];H[d+20>>2]=H[c>>2];H[d+24>>2]=H[c>>2];H[d+28>>2]=H[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}b=va(k,i,j);H[a+4>>2]=e;H[a>>2]=b;H[a+8>>2]=b+(g<<2);if(i){oa(i)}return}sa();v()}wa();v()}function Cc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(I[a+11|0]>>>7|0){d=H[a+4>>2]}else{d=I[a+11|0]&127}if(d>>>0>>0){h=ca-16|0;ca=h;b=b-d|0;if(b){g=I[a+11|0]>>>7|0?(H[a+8>>2]&2147483647)-1|0:10;if(I[a+11|0]>>>7|0){d=H[a+4>>2]}else{d=I[a+11|0]&127}i=d+b|0;if(g-d>>>0>>0){a:{e=ca-16|0;ca=e;c=i-g|0;if(c>>>0<=2147483631-g>>>0){if(I[a+11|0]>>>7|0){f=H[a>>2]}else{f=a}if(g>>>0<1073741799){H[e+12>>2]=g<<1;H[e>>2]=c+g;c=ca-16|0;ca=c;ca=c+16|0;c=e+12|0;c=H[(K[e>>2]>2]?c:e)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}Zb(e,c);c=H[e>>2];if(d){yb(c,f,d)}if((g|0)!=10){oa(f)}H[a>>2]=c;H[a+8>>2]=H[a+8>>2]&-2147483648|H[e+4>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;ca=e+16|0;break a}Na();v()}}f=d;if(I[a+11|0]>>>7|0){d=H[a>>2]}else{d=a}f=f+d|0;e=ca-16|0;ca=e;F[e+15|0]=0;while(1){if(b){F[f|0]=I[e+15|0];b=b-1|0;f=f+1|0;continue}break}ca=e+16|0;Id(a,i);F[h+15|0]=0;F[d+i|0]=I[h+15|0]}ca=h+16|0;return}if(I[a+11|0]>>>7|0){d=H[a>>2]}else{d=a}f=ca-16|0;ca=f;Id(a,b);F[f+15|0]=0;F[b+d|0]=I[f+15|0];ca=f+16|0}function Jc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=ca-16|0;ca=g;a:{b:{if(b){H[a+88>>2]=0;H[a+92>>2]=0;d=H[a+84>>2];H[a+84>>2]=0;if(d){oa(d)}H[a+76>>2]=0;H[a+80>>2]=0;d=H[a+72>>2];H[a+72>>2]=0;if(d){oa(d)}d=H[b>>2];c=H[b+4>>2];F[g+15|0]=0;Oa(a,c-d>>2,g+15|0);d=H[b+28>>2];c=H[b+24>>2];F[g+14|0]=0;Oa(a+12|0,d-c>>2,g+14|0);Kc(a+28|0,H[b+4>>2]-H[b>>2]>>2,13708);c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;e=H[a+52>>2];c:{if(f>>>0<=H[a+60>>2]-e>>2>>>0){break c}if((c|0)<0){break b}d=H[a+56>>2];c=pa(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(e|0)){continue}break}}H[a+60>>2]=f;H[a+56>>2]=h;H[a+52>>2]=c;if(!e){break c}oa(e)}c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;e=H[a+40>>2];d:{if(f>>>0<=H[a+48>>2]-e>>2>>>0){break d}if((c|0)<0){break a}d=H[a+44>>2];c=pa(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(e|0)){continue}break}}H[a+48>>2]=f;H[a+44>>2]=h;H[a+40>>2]=c;if(!e){break d}oa(e)}F[a+24|0]=1;H[a+64>>2]=b}ca=g+16|0;return}sa();v()}sa();v()}function wb(a,b){var c=0,d=0,e=0,f=0,g=0;c=ca-16|0;ca=c;H[a+12>>2]=b;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;H[a+52>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[a+72>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+92>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+104>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;g=a+120|0;a:{b:{if(b){if(b>>>0<1073741824){break b}sa();v()}H[a+108>>2]=0;H[a+112>>2]=0;H[a+116>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;e=1;break a}e=b<<2;d=pa(e);H[a+96>>2]=d;f=d+e|0;H[a+104>>2]=f;ra(d,0,e);H[a+116>>2]=0;H[a+108>>2]=0;H[a+112>>2]=0;H[a+100>>2]=f;d=pa(e);H[a+108>>2]=d;f=d+e|0;H[a+116>>2]=f;ra(d,0,e);H[a+112>>2]=f;d=pa(e);H[c>>2]=d;f=d+e|0;H[c+8>>2]=f;ra(d,0,e);H[c+4>>2]=f;e=b<<5|1}tb(g,e,c);d=H[c>>2];if(d){H[c+4>>2]=d;oa(d)}H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;if(b){b=b<<2;d=pa(b);H[c>>2]=d;f=b+d|0;H[c+8>>2]=f;ra(d,0,b);H[c+4>>2]=f}tb(a+132|0,e,c);b=H[c>>2];if(b){H[c+4>>2]=b;oa(b)}ca=c+16|0;return a}function Sb(a,b){var c=0,d=0,e=0;c=(a|0)==(b|0);F[b+12|0]=c;a:{if(c){break a}while(1){d=H[b+8>>2];if(I[d+12|0]){break a}b:{c=H[d+8>>2];e=H[c>>2];if((e|0)==(d|0)){e=H[c+4>>2];if(!(!e|I[e+12|0])){break b}c:{if(H[d>>2]==(b|0)){b=d;break c}b=H[d+4>>2];a=H[b>>2];H[d+4>>2]=a;if(a){H[a+8>>2]=d;c=H[d+8>>2]}H[b+8>>2]=c;a=H[d+8>>2];H[((H[a>>2]!=(d|0))<<2)+a>>2]=b;H[b>>2]=d;H[d+8>>2]=b;c=H[b+8>>2];d=H[c>>2]}F[b+12|0]=1;F[c+12|0]=0;a=H[d+4>>2];H[c>>2]=a;if(a){H[a+8>>2]=c}H[d+8>>2]=H[c+8>>2];a=H[c+8>>2];H[((H[a>>2]!=(c|0))<<2)+a>>2]=d;H[d+4>>2]=c;H[c+8>>2]=d;return}if(!(I[e+12|0]|!e)){break b}d:{if(H[d>>2]!=(b|0)){b=d;break d}a=H[b+4>>2];H[d>>2]=a;if(a){H[a+8>>2]=d;c=H[d+8>>2]}H[b+8>>2]=c;a=H[d+8>>2];H[((H[a>>2]!=(d|0))<<2)+a>>2]=b;H[b+4>>2]=d;H[d+8>>2]=b;c=H[b+8>>2]}F[b+12|0]=1;F[c+12|0]=0;a=H[c+4>>2];b=H[a>>2];H[c+4>>2]=b;if(b){H[b+8>>2]=c}H[a+8>>2]=H[c+8>>2];b=H[c+8>>2];H[((H[b>>2]!=(c|0))<<2)+b>>2]=a;H[a>>2]=c;H[c+8>>2]=a;break a}F[d+12|0]=1;F[c+12|0]=(a|0)==(c|0);F[e+12|0]=1;b=c;if((c|0)!=(a|0)){continue}break}}}function Tj(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{k:{if(b){if(!c){break k}if(!d){break j}e=Q(d)-Q(b)|0;if(e>>>0<=31){break i}break c}if((d|0)==1|d>>>0>1){break c}da=0;a=(a>>>0)/(c>>>0)|0;break a}if(!a){break h}if(!d|d-1&d){break g}a=b>>>Qj(d)|0;da=0;break a}if(!(c-1&c)){break f}h=(Q(c)+33|0)-Q(b)|0;g=0-h|0;break d}h=e+1|0;g=63-e|0;break d}da=0;a=(b>>>0)/(d>>>0)|0;break a}e=Q(d)-Q(b)|0;if(e>>>0<31){break e}break c}if((c|0)==1){break b}d=Qj(c);c=d&31;if((d&63)>>>0>=32){a=b>>>c|0}else{e=b>>>c|0;a=((1<>>c}da=e;break a}h=e+1|0;g=63-e|0}e=h&63;f=e&31;if(e>>>0>=32){e=0;i=b>>>f|0}else{e=b>>>f|0;i=((1<>>f}g=g&63;f=g&31;if(g>>>0>=32){b=a<>>32-f|b<>>31;e=i<<1|b>>>31;f=m-(j+(e>>>0>g>>>0)|0)>>31;k=c&f;i=e-k|0;e=j-((d&f)+(e>>>0>>0)|0)|0;b=b<<1|a>>>31;a=l|a<<1;l=f&1;h=h-1|0;if(h){continue}break}}da=b<<1|a>>>31;a=l|a<<1;break a}a=0;b=0}da=b}return a}function rc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=H[b+16>>2];h=H[c+4>>2]-k|0;e=H[c>>2]-k|0;H[c>>2]=e;H[c+4>>2]=h;g=H[b+16>>2];f=h>>31;i=(f^h)-f|0;f=e>>31;l=g>>>0>=i+((f^e)-f|0)>>>0;a:{if(l){f=h;break a}b:{c:{if((e|0)>=0){f=1;i=1;if((h|0)>=0){break b}j=1;f=-1;i=-1;if(e){break c}break b}j=-1;f=-1;i=-1;if((h|0)<=0){break b}}f=(h|0)<=0?-1:1;i=j}j=N(g,i);e=(e<<1)-j|0;i=(N(f,i)|0)>=0;g=N(f,g);f=((i?0-e|0:e)+g|0)/2|0;H[c+4>>2]=f;m=c;c=(h<<1)-g|0;e=(j+(i?0-c|0:c)|0)/2|0;H[m>>2]=e;g=H[b+16>>2]}c=H[d+4>>2]+f|0;e=H[d>>2]+e|0;d:{if((g|0)<(e|0)){e=e-H[b+4>>2]|0;break d}if((0-g|0)<=(e|0)){break d}e=H[b+4>>2]+e|0}e:{if((c|0)>(g|0)){c=c-H[b+4>>2]|0;break e}if((0-g|0)<=(c|0)){break e}c=H[b+4>>2]+c|0}f:{if(l){g=c;break f}g:{h:{if((e|0)>=0){b=1;f=1;if((c|0)>=0){break g}d=1;b=-1;f=-1;if(e){break h}break g}d=-1;b=-1;f=-1;if((c|0)<=0){break g}}b=(c|0)<=0?-1:1;f=d}d=N(f,g);h=(e<<1)-d|0;f=(N(b,f)|0)>=0;b=N(b,g);g=((f?0-h|0:h)+b|0)/2|0;b=(c<<1)-b|0;e=(d+(f?0-b|0:b)|0)/2|0}c=a;H[c>>2]=e+k;H[c+4>>2]=g+k}function Wh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;g=ca-16|0;ca=g;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;h=c+(b-d&-4)|0;c=h;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=h;H[e>>2]=c;if(!d){break b}oa(d)}b=H[a+12>>2];c=H[b+28>>2];b=H[b+24>>2];H[g+12>>2]=0;b=c-b>>2;d=a+96|0;e=H[d>>2];c=H[a+100>>2]-e>>2;c:{if(b>>>0>c>>>0){Pa(d,b-c|0,g+12|0);break c}if(b>>>0>=c>>>0){break c}H[a+100>>2]=e+(b<<2)}e=a+8|0;b=H[a+116>>2];d:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){c=1;break d}b=0;while(1){c=ye(e,H[(b<<2)+d>>2]);if(!c){break d}f=H[a+116>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break d}c=1;a=H[a+12>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break d}a=(a>>2>>>0)/3|0;b=0;while(1){c=ye(e,N(b,3));if(!c){break d}b=b+1|0;if((a|0)!=(b|0)){continue}break}}ca=g+16|0;return c|0}sa();v()}function gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;c=H[b+88>>2];if(!(!c|H[c>>2]!=1)){e=H[c+8>>2];H[a+4>>2]=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);f=a+8|0;d=I[b+24|0];h=H[a+8>>2];g=H[a+12>>2]-h>>2;a:{if(d>>>0>g>>>0){ya(f,d-g|0);d=I[b+24|0];e=H[c+8>>2];break a}if(d>>>0>=g>>>0){break a}H[a+12>>2]=h+(d<<2)}b:{if(!d){b=4;break b}h=d&3;f=H[f>>2];c:{if(d-1>>>0<3){b=4;d=0;break c}k=d&252;d=0;b=4;while(1){g=d<<2;c=b+e|0;H[g+f>>2]=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[f+(g|4)>>2]=I[c+4|0]|I[c+5|0]<<8|(I[c+6|0]<<16|I[c+7|0]<<24);H[f+(g|8)>>2]=I[c+8|0]|I[c+9|0]<<8|(I[c+10|0]<<16|I[c+11|0]<<24);H[f+(g|12)>>2]=I[c+12|0]|I[c+13|0]<<8|(I[c+14|0]<<16|I[c+15|0]<<24);d=d+4|0;b=b+16|0;i=i+4|0;if((k|0)!=(i|0)){continue}break}}if(!h){break b}while(1){c=b+e|0;H[f+(d<<2)>>2]=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);d=d+1|0;b=b+4|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}}d=a;a=b+e|0;H[d+20>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);d=1}return d|0}function se(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;a:{b:{c:{if(!b){if((d|0)<0){break a}f=H[a+4>>2];b=H[a>>2];d=f-b|0;if(c>>>0>d>>>0){g=c-d|0;e=H[a+8>>2];if(g>>>0<=e-f>>>0){i=a,j=ra(f,0,g)+g|0,H[i+4>>2]=j;break c}if((c|0)<0){break b}f=e-b|0;e=f<<1;f=f>>>0>=1073741823?2147483647:c>>>0>>0?e:c;e=pa(f);ra(e+d|0,0,g);d=va(e,b,d);H[a+8>>2]=d+f;H[a+4>>2]=c+d;H[a>>2]=d;if(!b){break c}oa(b);break c}if(c>>>0>=d>>>0){break c}H[a+4>>2]=b+c;break c}if((d|0)<0){break a}e=H[a+4>>2];f=H[a>>2];g=e-f|0;d:{if((d|0)<=0&c>>>0<=g>>>0|(d|0)<0){break d}if(c>>>0>g>>>0){d=c-g|0;h=H[a+8>>2];if(d>>>0<=h-e>>>0){i=a,j=ra(e,0,d)+d|0,H[i+4>>2]=j;break d}if((c|0)<0){break b}e=h-f|0;h=e<<1;e=e>>>0>=1073741823?2147483647:c>>>0>>0?h:c;h=pa(e);ra(h+g|0,0,d);d=va(h,f,g);H[a+8>>2]=d+e;H[a+4>>2]=c+d;H[a>>2]=d;if(!f){break d}oa(f);break d}if(c>>>0>=g>>>0){break d}H[a+4>>2]=c+f}if(!c){break c}va(H[a>>2],b,c)}b=H[a+28>>2];c=H[a+24>>2]+1|0;b=c?b:b+1|0;H[a+24>>2]=c;H[a+28>>2]=b;g=1;break a}sa();v()}return g}function Jh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;k=H[a+12>>2];c=H[a+68>>2];d=H[c+80>>2];F[b+84|0]=0;n=b+68|0;i=H[b+68>>2];e=H[b+72>>2]-i>>2;a:{if(e>>>0>>0){qb(n,d-e|0,12372);c=H[a+68>>2];d=H[c+80>>2];break a}if(d>>>0>=e>>>0){break a}H[b+72>>2]=i+(d<<2)}b=H[c+100>>2];e=H[c+96>>2];i=(b-e|0)/12|0;m=1;b:{if((b|0)==(e|0)){break b}k=H[k+28>>2];f=H[k>>2];if((f|0)==-1){return 0}o=i>>>0<=1?1:i;c=e;b=0;m=0;while(1){g=H[c>>2];if(g>>>0>=d>>>0){break b}j=H[H[a+72>>2]+12>>2];h=H[j+(f<<2)>>2];if(h>>>0>=d>>>0){break b}f=H[n>>2];H[f+(g<<2)>>2]=h;g=k+(l<<2)|0;h=H[g+4>>2];if((h|0)==-1){break b}l=H[c+4>>2];if(l>>>0>=d>>>0){break b}h=H[(h<<2)+j>>2];if(h>>>0>=d>>>0){break b}H[f+(l<<2)>>2]=h;g=H[g+8>>2];if((g|0)==-1){break b}c=H[c+8>>2];if(c>>>0>=d>>>0){break b}j=H[(g<<2)+j>>2];if(j>>>0>=d>>>0){break b}H[f+(c<<2)>>2]=j;b=b+1|0;m=i>>>0<=b>>>0;if((b|0)==(o|0)){break b}c=e+N(b,12)|0;l=N(b,3);f=H[k+(l<<2)>>2];if((f|0)!=-1){continue}break}}return m|0}function Gh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=H[d+80>>2];e=ca-48|0;ca=e;a=H[a+4>>2];m=a-2|0;a:{if(m>>>0>28){break a}j=H[H[d>>2]>>2]+H[d+48>>2]|0;H[e+16>>2]=a;a=-1<>2]=a^-1;a=-2-a|0;H[e+24>>2]=a;H[e+32>>2]=(a|0)/2;L[e+28>>2]=O(2)/O(a|0);f=H[c>>2];if((f|0)!=H[c+4>>2]){a=0;d=0;while(1){g=H[(d<<2)+f>>2];h=e+36|0;k=H[H[b>>2]>>2];l=H[b+48>>2];f=H[b+40>>2];i=H[b+44>>2];if(!I[b+84|0]){g=H[H[b+68>>2]+(g<<2)>>2]}g=Rj(f,i,g,0);i=g;g=g+l|0;qa(h,g+k|0,f);he(e+16|0,h,e+12|0,e+8|0);f=a<<2;H[f+j>>2]=H[e+12>>2];H[(f|4)+j>>2]=H[e+8>>2];a=a+2|0;d=d+1|0;f=H[c>>2];if(d>>>0>2]-f>>2>>>0){continue}break}break a}if(!h){break a}d=0;a=0;while(1){k=e+36|0;l=H[H[b>>2]>>2];i=H[b+48>>2];c=H[b+40>>2];f=Rj(c,H[b+44>>2],I[b+84|0]?a:H[H[b+68>>2]+(a<<2)>>2],0);g=f;f=f+i|0;qa(k,f+l|0,c);he(e+16|0,k,e+12|0,e+8|0);c=d<<2;H[c+j>>2]=H[e+12>>2];H[(c|4)+j>>2]=H[e+8>>2];d=d+2|0;a=a+1|0;if((h|0)!=(a|0)){continue}break}}ca=e+48|0;return m>>>0<29|0}function Re(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=O(0),j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;k=ca-16|0;ca=k;if(H[c+28>>2]==9){d=H[a+4>>2];h=I[c+24|0];e=h<<2;f=pa(e);l=k+8|0;H[l>>2]=1065353216;i=L[a+20>>2];d=-1<0){L[l>>2]=i/O(d|0)}o=(d|0)>0;a:{if(!o){break a}j=H[c+80>>2];if(!j){break a}if(h){p=H[H[b>>2]>>2]+H[b+48>>2]|0;t=h&254;u=h&1;b=0;while(1){m=H[a+8>>2];i=L[l>>2];d=0;n=0;if((h|0)!=1){while(1){g=d<<2;q=(b<<2)+p|0;L[g+f>>2]=O(i*O(H[q>>2]))+L[g+m>>2];g=g|4;L[g+f>>2]=O(i*O(H[q+4>>2]))+L[g+m>>2];d=d+2|0;b=b+2|0;n=n+2|0;if((t|0)!=(n|0)){continue}break}}if(u){d=d<<2;L[d+f>>2]=O(i*O(H[(b<<2)+p>>2]))+L[d+m>>2];b=b+1|0}qa(H[H[c+64>>2]>>2]+r|0,f,e);r=e+r|0;s=s+1|0;if((s|0)!=(j|0)){continue}break}break a}b=0;if((j|0)!=1){a=j&-2;d=0;while(1){qa(H[H[c+64>>2]>>2]+b|0,f,e);b=b+e|0;qa(b+H[H[c+64>>2]>>2]|0,f,e);b=b+e|0;d=d+2|0;if((a|0)!=(d|0)){continue}break}}if(!(j&1)){break a}qa(H[H[c+64>>2]>>2]+b|0,f,e)}oa(f)}ca=k+16|0;return o|0}function Xh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=H[a+12>>2];d=H[a+108>>2];e=H[d+80>>2];F[b+84|0]=0;m=b+68|0;h=H[b+68>>2];f=H[b+72>>2]-h>>2;a:{if(f>>>0>>0){qb(m,e-f|0,12372);d=H[a+108>>2];e=H[d+80>>2];break a}if(e>>>0>=f>>>0){break a}H[b+72>>2]=h+(e<<2)}b=H[d+100>>2];f=H[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=H[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=H[c>>2];if((i|0)==-1){break b}g=H[d>>2];if(g>>>0>=e>>>0){break b}l=H[H[a+112>>2]+12>>2];j=H[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=H[m>>2];H[i+(g<<2)>>2]=j;g=H[c+4>>2];if((g|0)==-1){break b}j=H[d+4>>2];if(j>>>0>=e>>>0){break b}g=H[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}H[i+(j<<2)>>2]=g;c=H[c+8>>2];if((c|0)==-1){break b}d=H[d+8>>2];if(d>>>0>=e>>>0){break b}c=H[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}H[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=N(b,3);d=f+N(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function Ph(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=H[a+12>>2];d=H[a+68>>2];e=H[d+80>>2];F[b+84|0]=0;m=b+68|0;h=H[b+68>>2];f=H[b+72>>2]-h>>2;a:{if(f>>>0>>0){qb(m,e-f|0,12372);d=H[a+68>>2];e=H[d+80>>2];break a}if(e>>>0>=f>>>0){break a}H[b+72>>2]=h+(e<<2)}b=H[d+100>>2];f=H[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=H[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=H[c>>2];if((i|0)==-1){break b}g=H[d>>2];if(g>>>0>=e>>>0){break b}l=H[H[a+72>>2]+12>>2];j=H[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=H[m>>2];H[i+(g<<2)>>2]=j;g=H[c+4>>2];if((g|0)==-1){break b}j=H[d+4>>2];if(j>>>0>=e>>>0){break b}g=H[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}H[i+(j<<2)>>2]=g;c=H[c+8>>2];if((c|0)==-1){break b}d=H[d+8>>2];if(d>>>0>=e>>>0){break b}c=H[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}H[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=N(b,3);d=f+N(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function Wa(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=ca-16|0;ca=d;a:{f=H[a+4>>2];b:{if(f>>>0>>0){e=b-f|0;c=H[a+8>>2];g=c<<5;c:{if(!(e>>>0>g>>>0|f>>>0>g-e>>>0)){H[a+4>>2]=b;h=f&31;b=H[a>>2]+(f>>>3&536870908)|0;break c}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;if((b|0)<0){break a}if(g>>>0<=1073741822){c=c<<6;b=b+31&-32;b=b>>>0>>0?c:b}else{b=2147483647}pb(d,b);f=H[a+4>>2];H[d+4>>2]=f+e;i=H[a>>2];b=H[d>>2];d:{if((f|0)<=0){break d}c=f>>>5|0;if(f>>>0>=32){va(b,i,c<<2)}g=c<<2;b=g+b|0;h=f&31;if(h){c=-1>>>32-h|0;H[b>>2]=H[b>>2]&(c^-1)|H[i+g>>2]&c}i=H[a>>2]}H[a>>2]=H[d>>2];H[d>>2]=i;c=H[a+4>>2];H[a+4>>2]=H[d+4>>2];H[d+4>>2]=c;c=H[a+8>>2];H[a+8>>2]=H[d+8>>2];H[d+8>>2]=c;if(!i){break c}oa(i)}if(!e){break b}if(h){c=32-h|0;a=c>>>0>>0?c:e;H[b>>2]=H[b>>2]&(-1<>>c-a^-1);e=e-a|0;b=b+4|0}a=e>>>5|0;if(e>>>0>=32){ra(b,0,a<<2)}if((e&-32)==(e|0)){break b}a=(a<<2)+b|0;H[a>>2]=H[a>>2]&(-1>>>32-(e&31)^-1);break b}H[a+4>>2]=b}ca=d+16|0;return}sa();v()}function Je(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;e=H[a+12>>2];i=H[a+8>>2];d=e-i>>2;b=I[b+24|0];a:{if(d>>>0>>0){ya(a+8|0,b-d|0);i=H[a+8>>2];e=H[a+12>>2];break a}if(b>>>0>=d>>>0){break a}e=(b<<2)+i|0;H[a+12>>2]=e}b=0;f=H[c+8>>2];h=H[c+12>>2];j=H[c+20>>2];e=e-i|0;d=H[c+16>>2];g=e+d|0;j=e>>>0>g>>>0?j+1|0:j;b:{if(f>>>0>>0&(h|0)<=(j|0)|(h|0)<(j|0)){break b}qa(i,d+H[c>>2]|0,e);d=H[c+20>>2];g=e;e=e+H[c+16>>2]|0;d=g>>>0>e>>>0?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d;f=H[c+8>>2];h=H[c+12>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;if(f>>>0>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break b}d=e+H[c>>2]|0;H[a+20>>2]=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);d=H[c+20>>2];g=d;f=d;e=H[c+16>>2];d=e+4|0;f=d>>>0<4?f+1|0:f;H[c+16>>2]=d;H[c+20>>2]=f;h=H[c+12>>2];if((f|0)>=(h|0)&d>>>0>=K[c+8>>2]|(f|0)>(h|0)){break b}f=I[d+H[c>>2]|0];d=g;e=e+5|0;d=e>>>0<5?d+1|0:d;H[c+16>>2]=e;H[c+20>>2]=d;if(f-1>>>0>29){break b}H[a+4>>2]=f;b=1}return b|0}function qd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{f=H[a+4>>2];b:{if((f|0)!=H[a>>2]){c=f;break b}g=H[a+8>>2];c=H[a+12>>2];if(g>>>0>>0){e=((c-g>>2)+1|0)/2<<2;c=e+g|0;if((f|0)!=(g|0)){d=g-f|0;c=c-d|0;va(c,f,d);f=H[a+8>>2]}H[a+4>>2]=c;H[a+8>>2]=e+f;break b}d=(c|0)==(f|0)?1:c-f>>1;if(d>>>0>=1073741824){break a}c=d<<2;i=pa(c);k=i+c|0;c=(d+3&-4)+i|0;h=c;c:{if((f|0)==(g|0)){break c}g=g-f|0;l=g&-4;e=c;d=f;j=g-4|0;g=(j>>>2|0)+1&7;if(g){h=0;while(1){H[e>>2]=H[d>>2];d=d+4|0;e=e+4|0;h=h+1|0;if((g|0)!=(h|0)){continue}break}}h=c+l|0;if(j>>>0<28){break c}while(1){H[e>>2]=H[d>>2];H[e+4>>2]=H[d+4>>2];H[e+8>>2]=H[d+8>>2];H[e+12>>2]=H[d+12>>2];H[e+16>>2]=H[d+16>>2];H[e+20>>2]=H[d+20>>2];H[e+24>>2]=H[d+24>>2];H[e+28>>2]=H[d+28>>2];d=d+32|0;e=e+32|0;if((h|0)!=(e|0)){continue}break}}H[a+12>>2]=k;H[a+8>>2]=h;H[a+4>>2]=c;H[a>>2]=i;if(!f){break b}oa(f);c=H[a+4>>2]}H[c-4>>2]=H[b>>2];H[a+4>>2]=H[a+4>>2]-4;return}wa();v()}function sb(a,b){var c=0;a:{if(!ta(a,b)){break a}if(!ta(a+16|0,b)){break a}if(!ta(a+32|0,b)){break a}if(!ta(a+48|0,b)){break a}if(!ta(a- -64|0,b)){break a}if(!ta(a+80|0,b)){break a}if(!ta(a+96|0,b)){break a}if(!ta(a+112|0,b)){break a}if(!ta(a+128|0,b)){break a}if(!ta(a+144|0,b)){break a}if(!ta(a+160|0,b)){break a}if(!ta(a+176|0,b)){break a}if(!ta(a+192|0,b)){break a}if(!ta(a+208|0,b)){break a}if(!ta(a+224|0,b)){break a}if(!ta(a+240|0,b)){break a}if(!ta(a+256|0,b)){break a}if(!ta(a+272|0,b)){break a}if(!ta(a+288|0,b)){break a}if(!ta(a+304|0,b)){break a}if(!ta(a+320|0,b)){break a}if(!ta(a+336|0,b)){break a}if(!ta(a+352|0,b)){break a}if(!ta(a+368|0,b)){break a}if(!ta(a+384|0,b)){break a}if(!ta(a+400|0,b)){break a}if(!ta(a+416|0,b)){break a}if(!ta(a+432|0,b)){break a}if(!ta(a+448|0,b)){break a}if(!ta(a+464|0,b)){break a}if(!ta(a+480|0,b)){break a}if(!ta(a+496|0,b)){break a}c=ta(a+512|0,b)}return c}function qf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{if(!ke(a,b)){break a}h=a+36|0;g=ea[H[H[a>>2]+24>>2]](a)|0;e=H[a+40>>2];d=H[a+36>>2];c=e-d>>2;b:{if(g>>>0>c>>>0){Vb(h,g-c|0);break b}if(c>>>0<=g>>>0){break b}d=d+(g<<2)|0;if((d|0)!=(e|0)){while(1){e=e-4|0;c=H[e>>2];H[e>>2]=0;if(c){ea[H[H[c>>2]+4>>2]](c)}if((d|0)!=(e|0)){continue}break}}H[a+40>>2]=d}c=1;if((g|0)<=0){break a}e=0;while(1){c:{c=H[b+20>>2];f=H[b+12>>2];d=H[b+16>>2];if((c|0)>=(f|0)&d>>>0>=K[b+8>>2]|(c|0)>(f|0)){break c}f=I[H[b>>2]+d|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;d=ea[H[H[a>>2]+48>>2]](a,f)|0;f=e<<2;i=f+H[a+36>>2]|0;c=H[i>>2];H[i>>2]=d;if(c){ea[H[H[c>>2]+4>>2]](c)}c=H[H[h>>2]+f>>2];if(!c){break c}if(!(k=c,l=ea[H[H[a>>2]+28>>2]](a)|0,m=ea[H[H[a>>2]+20>>2]](a,e)|0,j=H[H[c>>2]+8>>2],ea[j](k|0,l|0,m|0)|0)){break c}c=1;e=e+1|0;if((g|0)!=(e|0)){continue}break a}break}c=0}return c|0}function he(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=+L[b>>2];k=+L[b+4>>2];l=+L[b+8>>2];g=P(j)+P(k)+P(l);a:{if(!(g>1e-6)){j=1;k=0;e=0;break a}g=1/g;k=g*k;j=g*j;e=g*l<0}h=H[a+16>>2];l=+(h|0);g=T(j*l+.5);b:{if(P(g)<2147483648){m=~~g;break b}m=-2147483648}f=m>>31;i=(f^m)-f|0;g=T(k*l+.5);c:{if(P(g)<2147483648){f=~~g;break c}f=-2147483648}b=f>>31;b=h-(i+((f^b)-b|0)|0)|0;i=(b|0)>0?b:0;e=e?0-i|0:i;f=f+(b>>31&((f|0)>0?b:0-b|0))|0;d:{if((m|0)>=0){b=e+h|0;a=H[a+8>>2];e=h+f|0;break d}b=f>>31;b=(b^f)-b|0;a=H[a+8>>2];b=(e|0)<0?b:a-b|0;e=(f|0)<0?i:a-i|0}e:{if(!(b|e)){b=a;break e}if(!((a|0)!=(b|0)|e)){b=a;break e}if(!((a|0)!=(e|0)|b)){b=a;break e}if(!((b|0)<=(h|0)|e)){b=(h<<1)-b|0;a=0;break e}if(!((a|0)!=(e|0)|(b|0)>=(h|0))){b=(h<<1)-b|0;break e}if(!((a|0)!=(b|0)|(e|0)>=(h|0))){b=a;a=(h<<1)-e|0;break e}if(b){a=e;break e}b=0;if((e|0)<=(h|0)){a=e;break e}a=(h<<1)-e|0}H[c>>2]=a;H[d>>2]=b}function Ve(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];i=c;k=H[b+16>>2];d=k+4|0;c=d>>>0<4?c+1|0:c;a:{if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}l=H[b>>2];f=k+l|0;e=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;c=i;f=k+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}d=d+l|0;j=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=c;if((e|0)>(j|0)){break a}H[a+16>>2]=j;H[a+12>>2]=e;d=j-e|0;e=(j>>31)-((e>>31)+(e>>>0>j>>>0)|0)|0;if(!e&d>>>0>2147483646|e){break a}d=d+1|0;H[a+20>>2]=d;e=d>>>1|0;H[a+24>>2]=e;H[a+28>>2]=0-e;if(!(d&1)){H[a+24>>2]=e-1}if(J[b+38>>1]<=513){if((c|0)>=(h|0)&f>>>0>=g>>>0|(c|0)>(h|0)){break a}g=I[f+l|0];c=i;i=k+9|0;c=i>>>0<9?c+1|0:c;H[b+16>>2]=i;H[b+20>>2]=c;if(g>>>0>1){break a}H[a+88>>2]=g}m=ta(a+112|0,b)}return m|0}function Hc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=H[a>>2];c=g+(b>>>3&536870908)|0;H[c>>2]=H[c>>2]|1<>2];e=(b|0)==-1;d=-1;a:{if(e){break a}c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;d=-1;if((c|0)==-1){break a}d=H[H[f>>2]+(c<<2)>>2]}c=H[a+12>>2];h=(d>>>3&536870908)+c|0;H[h>>2]=H[h>>2]|1<>>0)%3|0){e=b-1|0;break e}e=b+2|0;d=-1;if((e|0)==-1){break d}}d=H[H[f>>2]+(e<<2)>>2]}e=(d>>>3&536870908)+c|0;H[e>>2]=H[e>>2]|1<>2]+(b<<2)>>2];if((b|0)==-1){break b}F[a+24|0]=0;a=(b>>>3&536870908)+g|0;H[a>>2]=H[a>>2]|1<>>0)%3|0?a:b-2|0;if((a|0)!=-1){d=H[H[f>>2]+(a<<2)>>2]}a=c+(d>>>3&536870908)|0;H[a>>2]=H[a>>2]|1<>>0)%3|0){b=b-1|0;break g}b=b+2|0;a=-1;if((b|0)==-1){break f}}a=H[H[f>>2]+(b<<2)>>2]}b=1<>>3&536870908)|0;c=H[a>>2];break c}a=c+536870908|0;b=H[c+536870908>>2];c=-2147483648}H[a>>2]=b|c}}function Fd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=O(0),f=O(0),g=O(0),h=O(0),i=O(0),j=0,k=O(0),l=O(0),m=O(0),n=O(0),o=0;a:{if(H[c+28>>2]!=9|I[c+24|0]!=3){break a}a=H[a+4>>2];if(a-2>>>0>28){break a}o=1;j=H[c+80>>2];if(!j){break a}k=O(O(2)/O((1<>2]>>2]+H[c+48>>2]|0;a=H[H[b>>2]>>2]+H[b+48>>2]|0;b=0;while(1){g=O(0);l=O(0);m=O(0);e=O(O(O(H[a>>2])*k)+O(-1));f=O(O(O(H[a+4>>2])*k)+O(-1));i=O(O(O(1)-O(P(e)))-O(P(f)));h=O(S(O(-i),O(0)));n=O(-h);f=O(f+(f>>8;F[c+10|0]=d>>>16;F[c+11|0]=d>>>24;d=(w(l),y(2));F[c+4|0]=d;F[c+5|0]=d>>>8;F[c+6|0]=d>>>16;F[c+7|0]=d>>>24;d=(w(g),y(2));F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;c=c+12|0;b=b+1|0;if((j|0)!=(b|0)){continue}break}}return o|0}function Vd(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if(b>>>0<=63){b=0;a=H[a+12>>2];if(a>>>0<2){break a}b=a-1|0;e=b&3;d=H[c>>2];c=0;b:{if(a-2>>>0<3){a=1;b=0;break b}f=b&-4;b=0;a=1;while(1){g=a+3|0;h=a+2|0;i=a+1|0;b=K[d+(b<<2)>>2]>K[d+(a<<2)>>2]?a:b;b=K[d+(b<<2)>>2]>K[d+(i<<2)>>2]?i:b;b=K[d+(b<<2)>>2]>K[d+(h<<2)>>2]?h:b;b=K[d+(b<<2)>>2]>K[d+(g<<2)>>2]?g:b;a=a+4|0;j=j+4|0;if((f|0)!=(j|0)){continue}break}}if(!e){break a}while(1){b=K[d+(b<<2)>>2]>K[d+(a<<2)>>2]?a:b;a=a+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}break a}b=H[a+580>>2];d=32-b|0;if((d|0)>=4){c=H[a+576>>2];if((c|0)==H[a+568>>2]){return 0}d=H[c>>2];e=b+4|0;H[a+580>>2]=e;b=d<>>28|0;if((e|0)!=32){break a}H[a+580>>2]=0;H[a+576>>2]=c+4;return b}c=H[a+576>>2];e=c+4|0;if((e|0)==H[a+568>>2]){return 0}f=H[c>>2];H[a+576>>2]=e;H[a+580>>2]=b-28;a=60-b|0;b=H[c+4>>2]>>>a|f<>>a-d}return b}function Ae(a){a=a|0;var b=0,c=0,d=0,e=0;H[a>>2]=11436;b=H[a+388>>2];if(b){H[a+392>>2]=b;oa(b)}d=H[a+368>>2];H[a+368>>2]=0;if(d){e=d-4|0;b=H[e>>2];if(b){c=(b<<4)+d|0;while(1){c=c-16|0;if((d|0)!=(c|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Sg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a:{a=ca-32|0;ca=a;e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=pa(g);H[a+24>>2]=g|-2147483648;H[a+16>>2]=f;H[a+20>>2]=e;g=e+f|0;break c}F[a+27|0]=e;f=a+16|0;g=e+f|0;if(!e){break b}}qa(f,c,e)}F[g|0]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d:{c=nb(b,a+16|0);if((c|0)==(b+4|0)){break d}b=H[c+28>>2];e=H[c+32>>2];if((b|0)==(e|0)){break d}b=e-b|0;if(b&3){break d}e=b>>>2|0;f=H[a+4>>2];b=H[a>>2];g=f-b>>2;e:{if(e>>>0>g>>>0){ya(a,e-g|0);b=H[a>>2];f=H[a+4>>2];break e}if(e>>>0>=g>>>0){break e}f=(e<<2)+b|0;H[a+4>>2]=f}if((b|0)!=(f|0)){e=b;b=H[c+28>>2];qa(e,b,H[c+32>>2]-b|0);break d}Ca();v()}b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d>>2]=H[a>>2];H[d+4>>2]=H[a+4>>2];H[d+8>>2]=H[a+8>>2];if(F[a+27|0]<0){oa(H[a+16>>2])}ca=a+32|0;break a}Na();v()}}function Be(a){a=a|0;var b=0,c=0,d=0,e=0;H[a>>2]=11384;d=H[a+368>>2];H[a+368>>2]=0;if(d){e=d-4|0;b=H[e>>2];if(b){c=(b<<4)+d|0;while(1){c=c-16|0;if((d|0)!=(c|0)){continue}break}}oa(e)}Yc(a+216|0);b=H[a+196>>2];if(b){H[a+200>>2]=b;oa(b)}b=H[a+184>>2];if(b){H[a+188>>2]=b;oa(b)}b=H[a+172>>2];if(b){H[a+176>>2]=b;oa(b)}b=H[a+160>>2];if(b){H[a+164>>2]=b;oa(b)}c=H[a+144>>2];if(c){while(1){b=H[c>>2];oa(c);c=b;if(b){continue}break}}b=H[a+136>>2];H[a+136>>2]=0;if(b){oa(b)}b=H[a+120>>2];if(b){oa(b)}b=H[a+108>>2];if(b){oa(b)}b=H[a+96>>2];if(b){oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+36>>2];if(b){H[a+40>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a+8>>2];H[a+8>>2]=0;if(b){cb(b)}return a|0}function Ug(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=ca-16|0;ca=d;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=pa(f);H[d+8>>2]=f|-2147483648;H[d>>2]=a;H[d+4>>2]=e;f=a+e|0;break c}F[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}qa(a,c,e)}F[f|0]=0;c=I[d+11|0];e=c<<24>>24;b=H[b+4>>2];a=0;d:{if(!b){break d}a=c;c=(e|0)<0;a=c?H[d+4>>2]:a;f=c?H[d>>2]:d;while(1){c=I[b+27|0];g=c<<24>>24<0;c=g?H[b+20>>2]:c;i=c>>>0>>0;e:{f:{g:{h:{i:{j:{h=i?c:a;if(h){g=g?H[b+16>>2]:b+16|0;j=Fa(f,g,h);if(j){break j}if(a>>>0>=c>>>0){break i}break e}if(a>>>0>=c>>>0){break h}break e}if((j|0)<0){break e}}c=Fa(g,f,h);if(c){break g}}if(i){break f}a=1;break d}if((c|0)<0){break f}a=1;break d}b=b+4|0}b=H[b>>2];if(b){continue}break}a=0}if((e|0)<0){oa(H[d>>2])}ca=d+16|0;break a}Na();v()}return a|0}function fd(a,b){var c=0,d=0;c=H[b+8>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=c;H[a+20>>2]=H[b+20>>2];c=H[b+16>>2];H[a+12>>2]=H[b+12>>2];H[a+16>>2]=c;a:{b:{if((a|0)!=(b|0)){c=H[b+28>>2];if(c){d=H[a+24>>2];if(H[a+32>>2]<<5>>>0>>0){if(d){oa(d);H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;c=H[b+28>>2]}if((c|0)<0){break b}c=(c-1>>>5|0)+1|0;d=pa(c<<2);H[a+32>>2]=c;H[a+28>>2]=0;H[a+24>>2]=d;c=H[b+28>>2]}va(d,H[b+24>>2],(c-1>>>3&536870908)+4|0);c=H[b+28>>2]}else{c=0}H[a+28>>2]=c;c=H[b+40>>2];if(c){d=H[a+36>>2];if(H[a+44>>2]<<5>>>0>>0){if(d){oa(d);H[a+44>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;c=H[b+40>>2]}if((c|0)<0){break a}c=(c-1>>>5|0)+1|0;d=pa(c<<2);H[a+44>>2]=c;H[a+40>>2]=0;H[a+36>>2]=d;c=H[b+40>>2]}va(d,H[b+36>>2],(c-1>>>3&536870908)+4|0);b=H[b+40>>2]}else{b=0}H[a+40>>2]=b}return}sa();v()}sa();v()}function uc(a){var b=0,c=0,d=0;b=H[a+8>>2];d=H[a>>2];a:{if(I[a+12|0]){b:{c:{d:{e:{if((b|0)==-1){break e}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;if((b|0)==-1){break e}b=H[H[d+12>>2]+(b<<2)>>2];if((b|0)!=-1){break d}}H[a+8>>2]=-1;break c}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;H[a+8>>2]=b;if((b|0)!=-1){break b}}c=H[a+4>>2];b=-1;f:{if((c|0)==-1){break f}g:{if((c>>>0)%3|0){c=c-1|0;break g}c=c+2|0;b=-1;if((c|0)==-1){break f}}c=H[H[d+12>>2]+(c<<2)>>2];b=-1;if((c|0)==-1){break f}b=c-1|0;if((c>>>0)%3|0){break f}b=c+2|0}F[a+12|0]=0;H[a+8>>2]=b;return}if((b|0)!=H[a+4>>2]){break a}H[a+8>>2]=-1;return}c=-1;h:{if((b|0)==-1){break h}i:{if((b>>>0)%3|0){b=b-1|0;break i}b=b+2|0;c=-1;if((b|0)==-1){break h}}b=H[H[d+12>>2]+(b<<2)>>2];c=-1;if((b|0)==-1){break h}c=b-1|0;if((b>>>0)%3|0){break h}c=b+2|0}H[a+8>>2]=c}}function Rf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;f=ca-32|0;ca=f;d=H[a+28>>2];H[f+16>>2]=d;g=H[a+20>>2];H[f+28>>2]=c;H[f+24>>2]=b;b=g-d|0;H[f+20>>2]=b;g=b+c|0;i=2;a:{b:{b=f+16|0;d=Z(H[a+60>>2],b|0,2,f+12|0)|0;if(d){H[3992]=d;d=-1}else{d=0}c:{d:{if(d){d=b;break d}while(1){e=H[f+12>>2];if((e|0)==(g|0)){break c}if((e|0)<0){d=b;break b}h=H[b+4>>2];j=h>>>0>>0;d=(j<<3)+b|0;h=e-(j?h:0)|0;H[d>>2]=h+H[d>>2];b=(j?12:4)+b|0;H[b>>2]=H[b>>2]-h;g=g-e|0;b=d;i=i-j|0;e=Z(H[a+60>>2],b|0,i|0,f+12|0)|0;if(e){H[3992]=e;e=-1}else{e=0}if(!e){continue}break}}if((g|0)!=-1){break b}}b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];a=c;break a}H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a>>2]=H[a>>2]|32;a=0;if((i|0)==2){break a}a=c-H[d+4>>2]|0}ca=f+32|0;return a|0}function Ih(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+56>>2]-H[b+52>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=g;H[e>>2]=c;if(!d){break b}oa(d)}e=a+8|0;b=H[a+76>>2];c:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){return 1}b=0;while(1){c=we(e,H[(b<<2)+d>>2]);if(!c){break c}f=H[a+76>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=H[H[a+12>>2]+64>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=we(e,N(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}sa();v()}function Oh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+4>>2];d=H[e>>2];a:{b=H[a+12>>2];c=H[b+28>>2]-H[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=H[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=H[e+4>>2];c=pa(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[e+8>>2]=f;H[e+4>>2]=g;H[e>>2]=c;if(!d){break b}oa(d)}e=a+8|0;b=H[a+76>>2];c:{if(b){d=H[b>>2];if((d|0)==H[b+4>>2]){return 1}b=0;while(1){c=xe(e,H[(b<<2)+d>>2]);if(!c){break c}f=H[a+76>>2];d=H[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=H[a+12>>2];a=H[a+4>>2]-H[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=xe(e,N(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}sa();v()}function Te(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;g=H[b+8>>2];h=H[b+12>>2];c=H[b+20>>2];i=c;e=H[b+16>>2];d=e+4|0;c=d>>>0<4?c+1|0:c;a:{if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}j=H[b>>2];f=e+j|0;f=I[f|0]|I[f+1|0]<<8|(I[f+2|0]<<16|I[f+3|0]<<24);H[b+16>>2]=d;H[b+20>>2]=c;k=J[b+38>>1];if(k>>>0<=513){c=i;d=e+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>g>>>0&(c|0)>=(h|0)|(c|0)>(h|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c}if(!(f&1)){break a}e=Q(f)^31;if(e-1>>>0>28){break a}H[a+8>>2]=e+1;i=-2<>2]=e;H[a+12>>2]=i^-1;H[a+24>>2]=e>>1;L[a+20>>2]=O(2)/O(e|0);if(k>>>0<=513){if((c|0)>=(h|0)&d>>>0>=g>>>0|(c|0)>(h|0)){break a}g=I[d+j|0];d=d+1|0;c=d?c:c+1|0;H[b+16>>2]=d;H[b+20>>2]=c;if(g>>>0>1){break a}H[a+72>>2]=g}l=ta(a+96|0,b)}return l|0}function Se(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;f=H[b+8>>2];g=H[b+12>>2];c=H[b+20>>2];h=c;i=H[b+16>>2];e=i+4|0;c=e>>>0<4?c+1|0:c;a:{if(e>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}j=H[b>>2];d=i+j|0;d=I[d|0]|I[d+1|0]<<8|(I[d+2|0]<<16|I[d+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=c;c=h;e=i+8|0;c=e>>>0<8?c+1|0:c;if(e>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=e;H[b+20>>2]=c;if(!(d&1)){break a}d=Q(d)^31;if(d-1>>>0>28){break a}H[a+8>>2]=d+1;k=-2<>2]=d;H[a+12>>2]=k^-1;H[a+24>>2]=d>>1;L[a+20>>2]=O(2)/O(d|0);if(J[b+38>>1]<=513){if((c|0)>=(g|0)&e>>>0>=f>>>0|(c|0)>(g|0)){break a}c=I[e+j|0];f=i+9|0;h=f>>>0<9?h+1|0:h;H[b+16>>2]=f;H[b+20>>2]=h;if(c>>>0>1){break a}H[a+72>>2]=c}l=ta(a+96|0,b)}return l|0} -function va(a,b,c){var d=0,e=0;a:{if((a|0)==(b|0)){break a}e=a+c|0;if(b-e>>>0<=0-(c<<1)>>>0){return qa(a,b,c)}d=(a^b)&3;b:{c:{if(a>>>0>>0){if(d){d=a;break b}if(!(a&3)){d=a;break c}d=a;while(1){if(!c){break a}F[d|0]=I[b|0];b=b+1|0;c=c-1|0;d=d+1|0;if(d&3){continue}break}break c}d:{if(d){break d}if(e&3){while(1){if(!c){break a}c=c-1|0;d=c+a|0;F[d|0]=I[b+c|0];if(d&3){continue}break}}if(c>>>0<=3){break d}while(1){c=c-4|0;H[c+a>>2]=H[b+c>>2];if(c>>>0>3){continue}break}}if(!c){break a}while(1){c=c-1|0;F[c+a|0]=I[b+c|0];if(c){continue}break}break a}if(c>>>0<=3){break b}while(1){H[d>>2]=H[b>>2];b=b+4|0;d=d+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}while(1){F[d|0]=I[b|0];d=d+1|0;b=b+1|0;c=c-1|0;if(c){continue}break}}return a}function ff(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=H[c+12>>2];f=h;e=H[c+20>>2];i=H[c+8>>2];g=H[c+16>>2];a:{if((f|0)<=(e|0)&i>>>0<=g>>>0|(e|0)>(f|0)){break a}j=H[c>>2];k=F[j+g|0];d=e;f=g+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;b:{if((k|0)==-2){break b}if((d|0)>=(h|0)&f>>>0>=i>>>0|(d|0)>(h|0)){break a}d=F[f+j|0];g=g+2|0;e=g>>>0<2?e+1|0:e;H[c+16>>2]=g;H[c+20>>2]=e;if((d-4&255)>>>0<251){break a}e=ea[H[H[a>>2]+40>>2]](a,k,d)|0;d=H[a+20>>2];H[a+20>>2]=e;if(!d){break b}ea[H[H[d>>2]+4>>2]](d)}d=H[a+20>>2];if(d){if(!(ea[H[H[a>>2]+28>>2]](a,d)|0)){break a}}if(!(ea[H[H[a>>2]+36>>2]](a,b,c)|0)){break a}c=H[a+4>>2];if(!(!c|I[c+36|0]>1)){if(!(ea[H[H[a>>2]+48>>2]](a,H[b+4>>2]-H[b>>2]>>2)|0)){break a}}l=1}return l|0}function Vb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=H[a+8>>2];c=H[a+4>>2];if(d-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{b:{c:{g=H[a>>2];f=c-g>>2;e=f+b|0;if(e>>>0<1073741824){d=d-g|0;h=d>>>1|0;e=d>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break c}i=pa(e<<2)}d=(f<<2)+i|0;f=b<<2;b=ra(d,0,f);f=b+f|0;e=(e<<2)+i|0;if((c|0)==(g|0)){break b}while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;d=d-4|0;H[d>>2]=b;if((c|0)!=(g|0)){continue}break}H[a+8>>2]=e;b=H[a+4>>2];H[a+4>>2]=f;c=H[a>>2];H[a>>2]=d;if((b|0)==(c|0)){break a}while(1){b=b-4|0;a=H[b>>2];H[b>>2]=0;if(a){ea[H[H[a>>2]+4>>2]](a)}if((b|0)!=(c|0)){continue}break}break a}sa();v()}wa();v()}H[a+8>>2]=e;H[a+4>>2]=f;H[a>>2]=b}if(c){oa(c)}}function Md(a,b,c){a:{switch(b-9|0){case 0:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];return;case 6:b=H[c>>2];H[c>>2]=b+4;b=G[b>>1];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 7:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=J[b>>1];H[a+4>>2]=0;return;case 8:b=H[c>>2];H[c>>2]=b+4;b=F[b|0];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 9:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=I[b|0];H[a+4>>2]=0;return;case 16:b=H[c>>2]+7&-8;H[c>>2]=b+8;M[a>>3]=M[b>>3];return;case 17:v();default:return;case 1:case 4:case 14:b=H[c>>2];H[c>>2]=b+4;b=H[b>>2];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 2:case 5:case 11:case 15:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];H[a+4>>2]=0;return;case 3:case 10:case 12:case 13:break a}}b=H[c>>2]+7&-8;H[c>>2]=b+8;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c}function Ed(a,b){var c=0,d=0,e=0;c=ca+-64|0;ca=c;d=H[a>>2];e=H[d-4>>2];d=H[d-8>>2];H[c+32>>2]=0;H[c+36>>2]=0;H[c+40>>2]=0;H[c+44>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;F[c+55|0]=0;F[c+56|0]=0;F[c+57|0]=0;F[c+58|0]=0;F[c+59|0]=0;F[c+60|0]=0;F[c+61|0]=0;F[c+62|0]=0;H[c+24>>2]=0;H[c+28>>2]=0;H[c+20>>2]=0;H[c+16>>2]=14924;H[c+12>>2]=a;H[c+8>>2]=b;a=a+d|0;d=0;a:{if(Ya(e,b,0)){H[c+56>>2]=1;ea[H[H[e>>2]+20>>2]](e,c+8|0,a,a,1,0);d=H[c+32>>2]==1?a:0;break a}ea[H[H[e>>2]+24>>2]](e,c+8|0,a,1,0);b:{switch(H[c+44>>2]){case 0:d=H[c+48>>2]==1?H[c+36>>2]==1?H[c+40>>2]==1?H[c+28>>2]:0:0:0;break a;case 1:break b;default:break a}}if(H[c+32>>2]!=1){if(H[c+48>>2]|H[c+36>>2]!=1|H[c+40>>2]!=1){break a}}d=H[c+24>>2]}ca=c- -64|0;return d}function ua(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;H[a+16>>2]=0;e=H[a>>2];H[a+4>>2]=e;H[a+12>>2]=e;e=H[b+8>>2];c=H[b+12>>2];h=c;d=H[b+20>>2];f=H[b+16>>2];g=f+4|0;d=g>>>0<4?d+1|0:d;a:{if(e>>>0>>0&(d|0)>=(c|0)|(d|0)>(c|0)){break a}c=f+H[b>>2]|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=g;H[b+20>>2]=d;if(!c|c&3){break a}f=h-(d+(e>>>0>>0)|0)|0;if(e-g>>>0>>0&(f|0)<=0|(f|0)<0){break a}if(c>>>0>=4){ya(a,c>>>2|0);h=H[b+12>>2];g=H[b+16>>2];d=H[b+20>>2];e=H[b+8>>2]}f=c+g|0;d=f>>>0>>0?d+1|0:d;if(e>>>0>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break a}qa(H[a>>2],H[b>>2]+g|0,c);d=H[b+20>>2];e=c+H[b+16>>2]|0;d=e>>>0>>0?d+1|0:d;H[b+16>>2]=e;H[b+20>>2]=d;H[a+16>>2]=0;H[a+12>>2]=H[a>>2];i=1}return i}function de(a,b){var c=0,d=0,e=0,f=0;d=-1;e=-1;f=-1;a:{b:{if((b|0)==-1){break b}e=H[H[H[a+4>>2]+12>>2]+(b<<2)>>2];c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;if((c|0)>=0){f=(c>>>0)/3|0;f=H[(H[H[a>>2]+96>>2]+N(f,12)|0)+(c-N(f,3)<<2)>>2]}c:{if((e|0)==-1){break c}c=((e>>>0)%3|0?-1:2)+e|0;if((c|0)<0){break c}d=(c>>>0)/3|0;d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(c-N(d,3)<<2)>>2]}c=-1;if((d|0)!=(f|0)){break a}f=-1;d:{b=((b>>>0)%3|0?-1:2)+b|0;if((b|0)>=0){d=(b>>>0)/3|0;d=H[(H[H[a>>2]+96>>2]+N(d,12)|0)+(b-N(d,3)<<2)>>2];if((e|0)==-1){break b}break d}d=-1;if((e|0)!=-1){break d}break b}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)<0){break b}c=H[H[a>>2]+96>>2];a=(b>>>0)/3|0;f=H[(c+N(a,12)|0)+(b-N(a,3)<<2)>>2]}c=(d|0)!=(f|0)?-1:e}return c}function Ah(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;c=pa(72);H[c+4>>2]=0;H[c+8>>2]=0;H[c>>2]=1984;H[c+12>>2]=0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;H[c+32>>2]=0;H[c+36>>2]=0;H[c+40>>2]=0;H[c>>2]=2128;H[c+44>>2]=0;H[c+48>>2]=0;H[c+52>>2]=0;H[c+56>>2]=0;H[c+60>>2]=0;H[c+64>>2]=0;H[c+68>>2]=0;h=c;a:{if((b|0)>=0){g=a+8|0;c=H[a+12>>2];e=H[a+8>>2];f=c-e>>2;b:{if((f|0)>(b|0)){break b}d=b+1|0;if(b>>>0>=f>>>0){Vb(g,d-f|0);break b}if(d>>>0>=f>>>0){break b}e=(d<<2)+e|0;if((e|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){ea[H[H[d>>2]+4>>2]](d)}if((c|0)!=(e|0)){continue}break}}H[a+12>>2]=e}a=H[g>>2]+(b<<2)|0;c=H[a>>2];H[a>>2]=h;if(!c){break a}}ea[H[H[c>>2]+4>>2]](c)}return(b^-1)>>>31|0}function ra(a,b,c){var d=0,e=0,f=0,g=0;a:{if(!c){break a}F[a|0]=b;d=a+c|0;F[d-1|0]=b;if(c>>>0<3){break a}F[a+2|0]=b;F[a+1|0]=b;F[d-3|0]=b;F[d-2|0]=b;if(c>>>0<7){break a}F[a+3|0]=b;F[d-4|0]=b;if(c>>>0<9){break a}d=0-a&3;e=d+a|0;b=N(b&255,16843009);H[e>>2]=b;d=c-d&-4;c=d+e|0;H[c-4>>2]=b;if(d>>>0<9){break a}H[e+8>>2]=b;H[e+4>>2]=b;H[c-8>>2]=b;H[c-12>>2]=b;if(d>>>0<25){break a}H[e+24>>2]=b;H[e+20>>2]=b;H[e+16>>2]=b;H[e+12>>2]=b;H[c-16>>2]=b;H[c-20>>2]=b;H[c-24>>2]=b;H[c-28>>2]=b;g=e&4|24;c=d-g|0;if(c>>>0<32){break a}d=Rj(b,0,1,1);f=da;b=e+g|0;while(1){H[b+24>>2]=d;H[b+28>>2]=f;H[b+16>>2]=d;H[b+20>>2]=f;H[b+8>>2]=d;H[b+12>>2]=f;H[b>>2]=d;H[b+4>>2]=f;b=b+32|0;c=c-32|0;if(c>>>0>31){continue}break}}return a}function Mj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=H[b+8>>2];e=H[b+12>>2];g=e;e=H[b+20>>2];k=e;h=H[b+16>>2];c=h+4|0;e=c>>>0<4?e+1|0:e;i=c;a:{if(c>>>0>d>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break a}j=H[b>>2];c=j+h|0;f=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=i;H[b+20>>2]=e;c=d;d=k;e=h+8|0;d=e>>>0<8?d+1|0:d;if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}c=i+j|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[b+16>>2]=e;H[b+20>>2]=d;if((c|0)<(f|0)){break a}H[a+16>>2]=c;H[a+12>>2]=f;d=(c>>31)-((f>>31)+(c>>>0>>0)|0)|0;b=c-f|0;if(!d&b>>>0>2147483646|d){break a}l=1;d=b+1|0;H[a+20>>2]=d;b=d>>>1|0;H[a+24>>2]=b;H[a+28>>2]=0-b;if(d&1){break a}H[a+24>>2]=b-1}return l|0}function sd(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=a+16|0;d=H[e>>2];a:{if(!d){break a}f=H[b>>2];b=e;while(1){g=(f|0)>H[d+16>>2];b=g?b:d;d=H[(g?d+4|0:d)>>2];if(d){continue}break}if((b|0)==(e|0)|(f|0)>2]){break a}d=H[b+24>>2];if(!d){break a}f=b+20|0;b=I[c+11|0];e=b<<24>>24<0;g=e?H[c>>2]:c;b=e?H[c+4>>2]:b;while(1){e=I[d+27|0];h=e<<24>>24<0;e=h?H[d+20>>2]:e;j=e>>>0>>0;b:{c:{d:{e:{f:{g:{i=j?e:b;if(i){h=h?H[d+16>>2]:d+16|0;k=Fa(g,h,i);if(k){break g}if(b>>>0>=e>>>0){break f}break b}if(b>>>0>=e>>>0){break e}break b}if((k|0)<0){break b}}e=Fa(h,g,i);if(e){break d}}if(j){break c}return Tc(f,c)}if((e|0)<0){break c}return Tc(f,c)}d=d+4|0}d=H[d>>2];if(d){continue}break}}return Tc(a,c)}function be(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=ca-16|0;ca=d;f=H[a+24>>2];k=H[a+28>>2];a:{if((f|0)!=(k|0)){while(1){H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;a=$d(H[f>>2],b,d);g=I[d+11|0];h=g<<24>>24;i=3;b:{c:{d:{if(!a){break d}i=0;a=I[c+11|0];e=a<<24>>24;j=(h|0)<0?H[d+4>>2]:g;if((j|0)!=(((e|0)<0?H[c+4>>2]:a)|0)){break d}a=(e|0)<0?H[c>>2]:c;e=(h|0)<0;e:{if(!e){e=d;if(!h){break e}while(1){if(I[e|0]!=I[a|0]){break d}a=a+1|0;e=e+1|0;g=g-1|0;if(g){continue}break}break e}if(!j){break e}if(Fa(e?H[d>>2]:d,a,j)){break c}}l=H[f>>2];i=1}if((h|0)>=0){break b}}oa(H[d>>2])}f:{switch(i|0){case 0:case 3:break f;default:break a}}f=f+4|0;if((k|0)!=(f|0)){continue}break}}l=0}ca=d+16|0;return l}function Cb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=c-b|0;h=f>>2;d=H[a+8>>2];e=H[a>>2];if(h>>>0<=d-e>>2>>>0){d=H[a+4>>2];g=d-e|0;f=g+b|0;i=g>>2;g=i>>>0>>0?f:c;if((g|0)!=(b|0)){while(1){H[e>>2]=H[b>>2];e=e+4|0;b=b+4|0;if((g|0)!=(b|0)){continue}break}}if(h>>>0>i>>>0){if((c|0)!=(g|0)){while(1){H[d>>2]=H[f>>2];d=d+4|0;f=f+4|0;if((f|0)!=(c|0)){continue}break}}H[a+4>>2]=d;return}H[a+4>>2]=e;return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}a:{if((f|0)<0){break a}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:e>>>0>h>>>0?e:h;if(d>>>0>=1073741824){break a}e=d<<2;d=pa(e);H[a>>2]=d;H[a+8>>2]=d+e;if((b|0)!=(c|0)){c=b;b=(f-4&-4)+4|0;d=qa(d,c,b)+b|0}H[a+4>>2]=d;return}sa();v()}function Oa(a,b,c){var d=0,e=0,f=0;e=ca-16|0;ca=e;H[a+4>>2]=0;a:{b:{if(!b){break b}f=H[a+8>>2];d=f<<5;c:{if(d>>>0>=b>>>0){H[a+4>>2]=b;break c}H[e+8>>2]=0;H[e>>2]=0;H[e+4>>2]=0;if((b|0)<0){break a}if(d>>>0<=1073741822){f=f<<6;d=b+31&-32;d=d>>>0>>0?f:d}else{d=2147483647}pb(e,d);f=H[a>>2];H[a>>2]=H[e>>2];H[e>>2]=f;d=H[a+4>>2];H[a+4>>2]=b;H[e+4>>2]=d;d=H[a+8>>2];H[a+8>>2]=H[e+8>>2];H[e+8>>2]=d;if(!f){break c}oa(f)}d=b>>>5|0;a=H[a>>2];if(I[c|0]){if(b>>>0>=32){ra(a,255,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;H[a>>2]=H[a>>2]|-1>>>32-(b&31);break b}if(b>>>0>=32){ra(a,0,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;H[a>>2]=H[a>>2]&(-1>>>32-(b&31)^-1)}ca=e+16|0;return}sa();v()}function Hg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca-32|0;ca=e;a:{b:{f=Ma(c);if(f>>>0<2147483632){c:{d:{if(f>>>0>=11){a=(f|15)+1|0;g=pa(a);H[e+24>>2]=a|-2147483648;H[e+16>>2]=g;H[e+20>>2]=f;a=f+g|0;break d}F[e+27|0]=f;g=e+16|0;a=f+g|0;if(!f){break c}}qa(g,c,f)}F[a|0]=0;c=Ma(d);if(c>>>0>=2147483632){break b}e:{f:{if(c>>>0>=11){f=(c|15)+1|0;a=pa(f);H[e+8>>2]=f|-2147483648;H[e>>2]=a;H[e+4>>2]=c;g=a+c|0;break f}F[e+11|0]=c;g=c+e|0;a=e;if(!c){break e}}qa(a,d,c)}F[g|0]=0;c=H[b+4>>2];a=-1;g:{if(!c){break g}c=be(c,e+16|0,e);a=-1;if(!c){break g}a=Yd(b,H[c+24>>2])}if(F[e+11|0]<0){oa(H[e>>2])}if(F[e+27|0]<0){oa(H[e+16>>2])}ca=e+32|0;break a}Na();v()}Na();v()}return a|0}function jb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=H[b>>2];h=H[b+8>>2];i=H[b+4>>2];j=H[b>>2];d=H[a>>2];b=H[d+4>>2];a=H[d+8>>2];if(b>>>0>>0){H[b+8>>2]=h;H[b+4>>2]=i;H[b>>2]=j;H[d+4>>2]=b+12;return}a:{e=H[d>>2];g=(b-e|0)/12|0;c=g+1|0;if(c>>>0<357913942){f=(a-e|0)/12|0;a=f<<1;c=f>>>0>=178956970?357913941:a>>>0>c>>>0?a:c;if(c){if(c>>>0>=357913942){break a}f=pa(N(c,12))}else{f=0}a=f+N(g,12)|0;H[a+8>>2]=h;H[a+4>>2]=i;H[a>>2]=j;g=a+12|0;if((b|0)!=(e|0)){while(1){a=a-12|0;b=b-12|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2];if((b|0)!=(e|0)){continue}break}}H[d+8>>2]=f+N(c,12);H[d+4>>2]=g;H[d>>2]=a;if(e){oa(e)}return}sa();v()}wa();v()}function lf(a,b){a=a|0;b=b|0;a=0;a:{switch(b|0){case 0:a=pa(20);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;return a|0;case 1:a=pa(24);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;return a|0;case 2:a=pa(48);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;H[a+24>>2]=1832;H[a>>2]=11048;H[a+32>>2]=0;H[a+36>>2]=0;H[a+28>>2]=-1;H[a+40>>2]=0;H[a+44>>2]=0;return a|0;case 3:a=pa(32);H[a+12>>2]=-1;H[a+16>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=2232;H[a+20>>2]=0;H[a>>2]=2448;H[a+24>>2]=1032;H[a>>2]=7028;H[a+28>>2]=-1;break;default:break a}}return a|0}function tf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=H[b>>2];b=H[b+4>>2];d=H[H[a+8>>2]+40>>2];j=d;m=pa((d|0)<0?-1:d);i=b-f|0;e=1;a:{if((i|0)<4){break a}b=0;g=H[c+16>>2];k=d;f=g+d|0;d=0+H[c+20>>2]|0;d=f>>>0>>0?d+1|0:d;h=H[c+12>>2];e=0;if(K[c+8>>2]>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break a}e=i>>2;i=(e|0)<=1?1:e;while(1){b:{g=qa(m,H[c>>2]+g|0,j);H[c+16>>2]=f;H[c+20>>2]=d;qa(H[H[H[a+8>>2]+64>>2]>>2]+b|0,g,j);l=l+1|0;if((i|0)==(l|0)){break b}b=b+j|0;d=n+H[c+20>>2]|0;g=H[c+16>>2];f=k+g|0;d=f>>>0>>0?d+1|0:d;h=H[c+12>>2];if((d|0)<=(h|0)&K[c+8>>2]>=f>>>0|(d|0)<(h|0)){continue}}break}e=(e|0)<=(l|0)}oa(m);return e|0}function Ti(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;H[b>>2]=1;f=b+8|0;c=H[b+8>>2];d=H[b+12>>2]-c|0;if(d>>>0<=4294967291){kc(f,d+4|0);c=H[f>>2]}c=c+d|0;d=H[a+4>>2];F[c|0]=d;F[c+1|0]=d>>>8;F[c+2|0]=d>>>16;F[c+3|0]=d>>>24;c=H[a+8>>2];if((c|0)!=H[a+12>>2]){d=0;while(1){g=(d<<2)+c|0;c=H[b+8>>2];e=H[b+12>>2]-c|0;if(e>>>0<=4294967291){kc(f,e+4|0);c=H[f>>2]}c=c+e|0;e=H[g>>2];F[c|0]=e;F[c+1|0]=e>>>8;F[c+2|0]=e>>>16;F[c+3|0]=e>>>24;d=d+1|0;c=H[a+8>>2];if(d>>>0>2]-c>>2>>>0){continue}break}}c=H[b+12>>2];b=H[b+8>>2];c=c-b|0;if(c>>>0<=4294967291){kc(f,c+4|0);b=H[f>>2]}b=b+c|0;a=H[a+20>>2];F[b|0]=a;F[b+1|0]=a>>>8;F[b+2|0]=a>>>16;F[b+3|0]=a>>>24}function Aa(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=c-b|0;g=f>>2;d=H[a+8>>2];e=H[a>>2];if(g>>>0<=d-e>>2>>>0){f=H[a+4>>2]-e|0;d=f+b|0;h=f>>2;f=h>>>0>>0?d:c;i=f-b|0;if((b|0)!=(f|0)){va(e,b,i)}if(g>>>0>h>>>0){b=H[a+4>>2];if((c|0)!=(f|0)){while(1){H[b>>2]=H[d>>2];b=b+4|0;d=d+4|0;if((d|0)!=(c|0)){continue}break}}H[a+4>>2]=b;return}H[a+4>>2]=e+i;return}if(e){H[a+4>>2]=e;oa(e);H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;d=0}a:{if((f|0)<0){break a}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(d>>>0>=1073741824){break a}e=d<<2;d=pa(e);H[a>>2]=d;H[a+8>>2]=d+e;if((b|0)!=(c|0)){c=b;b=(f-4&-4)+4|0;d=qa(d,c,b)+b|0}H[a+4>>2]=d;return}sa();v()}function Rb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;c=H[a+4>>2];if((c|0)!=H[a+8>>2]){e=H[b+4>>2];H[c>>2]=H[b>>2];H[c+4>>2]=e;H[c+8>>2]=H[b+8>>2];H[a+4>>2]=c+12;return}a:{g=H[a>>2];d=(c-g|0)/12|0;e=d+1|0;if(e>>>0<357913942){f=d<<1;f=d>>>0>=178956970?357913941:e>>>0>>0?f:e;if(f){if(f>>>0>=357913942){break a}e=pa(N(f,12))}else{e=0}d=e+N(d,12)|0;h=H[b+4>>2];H[d>>2]=H[b>>2];H[d+4>>2]=h;H[d+8>>2]=H[b+8>>2];b=d+12|0;if((c|0)!=(g|0)){while(1){c=c-12|0;h=H[c+4>>2];d=d-12|0;H[d>>2]=H[c>>2];H[d+4>>2]=h;H[d+8>>2]=H[c+8>>2];if((c|0)!=(g|0)){continue}break}c=H[a>>2]}H[a+8>>2]=e+N(f,12);H[a+4>>2]=b;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function Qi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=ca-32|0;ca=f;g=e>>>0>1073741823?-1:e<<2;l=ra(pa(g),0,g);g=l;i=H[g>>2];g=H[g+4>>2];k=H[b+4>>2];H[f+24>>2]=H[b>>2];H[f+28>>2]=k;H[f+8>>2]=i;H[f+12>>2]=g;i=a+8|0;rc(f+16|0,i,f+8|0,f+24|0);H[c>>2]=H[f+16>>2];H[c+4>>2]=H[f+20>>2];if((d|0)>(e|0)){k=0-e<<2;a=e;while(1){h=a<<2;g=h+c|0;j=g+k|0;m=H[j>>2];j=H[j+4>>2];h=b+h|0;n=H[h+4>>2];H[f+24>>2]=H[h>>2];H[f+28>>2]=n;H[f+8>>2]=m;H[f+12>>2]=j;rc(f+16|0,i,f+8|0,f+24|0);H[g>>2]=H[f+16>>2];H[g+4>>2]=H[f+20>>2];a=a+e|0;if((d|0)>(a|0)){continue}break}}oa(l);ca=f+32|0;return 1}function Hi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=ca-32|0;ca=f;h=e>>>0>1073741823?-1:e<<2;h=ra(pa(h),0,h);g=H[b>>2];i=H[b+4>>2];k=H[h+4>>2];H[f+16>>2]=H[h>>2];H[f+20>>2]=k;H[f+8>>2]=g;H[f+12>>2]=i;i=a+8|0;qc(f+24|0,i,f+16|0,f+8|0);H[c>>2]=H[f+24>>2];H[c+4>>2]=H[f+28>>2];if((d|0)>(e|0)){k=0-e<<2;a=e;while(1){g=a<<2;j=g+b|0;m=H[j>>2];j=H[j+4>>2];g=c+g|0;l=g+k|0;n=H[l+4>>2];H[f+16>>2]=H[l>>2];H[f+20>>2]=n;H[f+8>>2]=m;H[f+12>>2]=j;qc(f+24|0,i,f+16|0,f+8|0);H[g>>2]=H[f+24>>2];H[g+4>>2]=H[f+28>>2];a=a+e|0;if((d|0)>(a|0)){continue}break}}oa(h);ca=f+32|0;return 1}function Ag(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:{if(K[b+80>>2]>65535){break a}a=H[b+100>>2];b=H[b+96>>2];e=(a-b|0)/12|0;f=N(e,6);g=(f|0)==(c|0);if((a|0)==(b|0)|(c|0)!=(f|0)){break a}g=1;c=e>>>0<=1?1:e;i=c&1;a=0;if(e>>>0>=2){j=c&-2;c=0;while(1){f=N(a,6);h=f+d|0;e=b+N(a,12)|0;G[h>>1]=H[e>>2];G[(f|2)+d>>1]=H[e+4>>2];G[h+4>>1]=H[e+8>>2];f=a|1;e=N(f,6)+d|0;f=b+N(f,12)|0;G[e>>1]=H[f>>2];G[e+2>>1]=H[f+4>>2];G[e+4>>1]=H[f+8>>2];a=a+2|0;c=c+2|0;if((j|0)!=(c|0)){continue}break}}if(!i){break a}c=N(a,6)+d|0;a=b+N(a,12)|0;G[c>>1]=H[a>>2];G[c+2>>1]=H[a+4>>2];G[c+4>>1]=H[a+8>>2]}return g|0}function Gd(a,b,c,d,e,f,g){var h=0,i=0,j=0;h=ca-16|0;ca=h;if((b^-1)+2147483631>>>0>=c>>>0){if(I[a+11|0]>>>7|0){i=H[a>>2]}else{i=a}if(b>>>0<1073741799){H[h+12>>2]=b<<1;H[h>>2]=b+c;c=ca-16|0;ca=c;ca=c+16|0;c=h+12|0;c=H[(K[h>>2]>2]?c:h)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}Zb(h,c);c=H[h>>2];if(f){yb(c,g,f)}g=d-e|0;if((d|0)!=(e|0)){yb(c+f|0,e+i|0,g)}if((b|0)!=10){oa(i)}H[a>>2]=c;H[a+8>>2]=H[a+8>>2]&-2147483648|H[h+4>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;b=a;a=f+g|0;H[b+4>>2]=a;F[h+12|0]=0;F[a+c|0]=I[h+12|0];ca=h+16|0;return}Na();v()}function Rg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;a=ca-32|0;ca=a;H[a+24>>2]=0;H[a+28>>2]=0;a:{d=Ma(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=pa(e);H[a+16>>2]=e|-2147483648;H[a+8>>2]=f;H[a+12>>2]=d;e=d+f|0;break c}F[a+19|0]=d;f=a+8|0;e=f+d|0;if(!d){break b}}qa(f,c,d)}F[e|0]=0;c=b+4|0;b=nb(b,a+8|0);d:{if((c|0)==(b|0)){break d}c=H[b+32>>2];b=H[b+28>>2];if((c-b|0)!=8){break d}c=I[b+4|0]|I[b+5|0]<<8|(I[b+6|0]<<16|I[b+7|0]<<24);H[a+24>>2]=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[a+28>>2]=c}g=M[a+24>>3];if(F[a+19|0]<0){oa(H[a+8>>2])}ca=a+32|0;break a}Na();v()}return+g}function uf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;f=1;a:{if((ea[H[H[b>>2]+20>>2]](b)|0)<=0){break a}while(1){f=0;c=Zd(H[H[a+4>>2]+4>>2],ea[H[H[b>>2]+24>>2]](b,g)|0);if((c|0)==-1){break a}e=H[a+4>>2];b:{if(I[e+36|0]<=1){if(ea[H[H[b>>2]+28>>2]](b,H[H[H[e+4>>2]+8>>2]+(c<<2)>>2])|0){break b}break a}d=0;c:{if((c|0)<0){break c}h=H[e+4>>2];if(H[h+12>>2]-H[h+8>>2]>>2<=(c|0)){break c}d=H[H[e+8>>2]+(H[H[e+20>>2]+(c<<2)>>2]<<2)>>2];d=ea[H[H[d>>2]+32>>2]](d,c)|0}if(!d){break a}if(!(ea[H[H[b>>2]+28>>2]](b,d)|0)){break a}}f=1;g=g+1|0;if((ea[H[H[b>>2]+20>>2]](b)|0)>(g|0)){continue}break}}return f|0}function tb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;a:{b:{if(b){if(b>>>0>=357913942){break b}b=N(b,12);d=pa(b);H[a+4>>2]=d;H[a>>2]=d;e=b+d|0;H[a+8>>2]=e;f=H[c+4>>2];g=H[c>>2];c:{if((f|0)==(g|0)){b=b-12|0;ra(d,0,(b-((b>>>0)%12|0)|0)+12|0);break c}h=f-g|0;if((h|0)<0){break a}i=h&-4;while(1){H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;b=pa(h);H[d>>2]=b;H[d+8>>2]=b+i;c=g;while(1){H[b>>2]=H[c>>2];b=b+4|0;c=c+4|0;if((f|0)!=(c|0)){continue}break}H[d+4>>2]=b;d=d+12|0;if((e|0)!=(d|0)){continue}break}}H[a+4>>2]=e}return}sa();v()}H[d+8>>2]=0;H[d>>2]=0;H[d+4>>2]=0;sa();v()}function Vi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=H[b+8>>2];d=H[b+12>>2];g=d;d=H[b+20>>2];i=d;h=H[b+16>>2];f=h+4|0;d=f>>>0<4?d+1|0:d;a:{if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}e=h+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=d;if(J[b+38>>1]<=513){f=c;c=i;d=h+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c}if(!(e&1)){break a}b=Q(e)^31;if(b-1>>>0>28){break a}j=1;H[a+8>>2]=b+1;b=-2<>2]=c;H[a+12>>2]=b^-1;H[a+24>>2]=c>>1;L[a+20>>2]=O(2)/O(c|0)}return j|0}function Lc(a,b,c){var d=0,e=0,f=0,g=0;a:{f=b>>>0<1431655766&(b|c)>=0;b:{if(!f){break b}b=N(b,3);Kc(a,b,13648);Kc(a+12|0,b,13652);d=H[a+24>>2];c:{if(H[a+32>>2]-d>>2>>>0>=c>>>0){break c}if(c>>>0>=1073741824){break a}b=H[a+28>>2];e=c<<2;c=pa(e);e=c+e|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;H[c>>2]=H[b>>2];if((b|0)!=(d|0)){continue}break}}H[a+32>>2]=e;H[a+28>>2]=g;H[a+24>>2]=c;if(!d){break c}oa(d)}H[a+80>>2]=0;H[a+84>>2]=0;b=H[a+76>>2];H[a+76>>2]=0;if(b){oa(b)}H[a+68>>2]=0;H[a+72>>2]=0;b=a- -64|0;a=H[b>>2];H[b>>2]=0;if(!a){break b}oa(a)}return f}sa();v()}function Fe(a){var b=0,c=0,d=0,e=0,f=0;f=1;c=H[a+140>>2];a:{if((c|0)<=0){break a}b=c<<4;d=pa(c>>>0>268435455?-1:b|4);H[d>>2]=c;d=d+4|0;c=d+b|0;b=d;while(1){H[b>>2]=0;H[b+4>>2]=0;F[b+5|0]=0;F[b+6|0]=0;F[b+7|0]=0;F[b+8|0]=0;F[b+9|0]=0;F[b+10|0]=0;F[b+11|0]=0;F[b+12|0]=0;b=b+16|0;if((c|0)!=(b|0)){continue}break}e=H[a+136>>2];H[a+136>>2]=d;if(e){c=e-4|0;d=H[c>>2];if(d){b=(d<<4)+e|0;while(1){b=b-16|0;if((e|0)!=(b|0)){continue}break}}oa(c)}b=0;if(H[a+140>>2]<=0){break a}while(1){f=ta(H[a+136>>2]+(b<<4)|0,a);if(!f){break a}b=b+1|0;if((b|0)>2]){continue}break}}return f}function mb(a,b){var c=0,d=0,e=0,f=0,g=0;a:{if(H[a+64>>2]){break a}c=pa(32);H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;d=H[a+64>>2];H[a+64>>2]=c;if(!d){break a}c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}oa(d)}d=H[a+64>>2];c=H[a+28>>2]-1|0;if(c>>>0<=10){c=H[(c<<2)+13584>>2]}else{c=-1}c=N(c,I[a+24|0]);f=c>>31;g=se(d,0,Rj(c,f,b,0),da);if(g){d=H[a+64>>2];H[a>>2]=d;e=H[d+20>>2];H[a+8>>2]=H[d+16>>2];H[a+12>>2]=e;e=H[d+24>>2];d=H[d+28>>2];H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=c;H[a+44>>2]=f;H[a+16>>2]=e;H[a+20>>2]=d;H[a+80>>2]=b}return g}function jc(a,b){var c=0;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;c=H[b+60>>2];H[a+56>>2]=H[b+56>>2];H[a+60>>2]=c;c=H[b+52>>2];H[a+48>>2]=H[b+48>>2];H[a+52>>2]=c;c=H[b+44>>2];H[a+40>>2]=H[b+40>>2];H[a+44>>2]=c;c=H[b+36>>2];H[a+32>>2]=H[b+32>>2];H[a+36>>2]=c;c=H[b+28>>2];H[a+24>>2]=H[b+24>>2];H[a+28>>2]=c;c=H[b+20>>2];H[a+16>>2]=H[b+16>>2];H[a+20>>2]=c;c=H[b+12>>2];H[a+8>>2]=H[b+8>>2];H[a+12>>2]=c;H[a+88>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;F[a+77|0]=0;F[a+78|0]=0;F[a+79|0]=0;F[a+80|0]=0;F[a+81|0]=0;F[a+82|0]=0;F[a+83|0]=0;F[a+84|0]=0;return a}function zg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;a=H[b+100>>2];b=H[b+96>>2];h=a-b|0;a:{if((h|0)!=(c|0)|(a|0)==(b|0)){break a}g=(c|0)/12|0;e=g>>>0<=1?1:g;j=e&1;a=0;if(g>>>0>=2){k=e&-2;g=0;while(1){e=N(a,12);i=e+d|0;f=b+e|0;H[i>>2]=H[f>>2];H[(e|4)+d>>2]=H[f+4>>2];H[i+8>>2]=H[f+8>>2];f=N(a|1,12);e=f+d|0;f=b+f|0;H[e>>2]=H[f>>2];H[e+4>>2]=H[f+4>>2];H[e+8>>2]=H[f+8>>2];a=a+2|0;g=g+2|0;if((k|0)!=(g|0)){continue}break}}if(!j){break a}e=d;d=N(a,12);a=e+d|0;b=b+d|0;H[a>>2]=H[b>>2];H[a+4>>2]=H[b+4>>2];H[a+8>>2]=H[b+8>>2]}return(c|0)==(h|0)|0}function Mi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=H[b+8>>2];d=H[b+12>>2];g=d;d=H[b+20>>2];i=d;h=H[b+16>>2];f=h+4|0;d=f>>>0<4?d+1|0:d;a:{if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}e=h+H[b>>2]|0;e=I[e|0]|I[e+1|0]<<8|(I[e+2|0]<<16|I[e+3|0]<<24);H[b+16>>2]=f;H[b+20>>2]=d;f=c;c=i;d=h+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}H[b+16>>2]=d;H[b+20>>2]=c;if(!(e&1)){break a}b=Q(e)^31;if(b-1>>>0>28){break a}j=1;H[a+8>>2]=b+1;b=-2<>2]=c;H[a+12>>2]=b^-1;H[a+24>>2]=c>>1;L[a+20>>2]=O(2)/O(c|0)}return j|0}function nb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;f=a+4|0;a=H[a+4>>2];a:{b:{if(!a){break b}d=I[b+11|0];c=d<<24>>24<0;g=c?H[b>>2]:b;d=c?H[b+4>>2]:d;b=f;while(1){e=I[a+27|0];c=e<<24>>24<0;e=c?H[a+20>>2]:e;h=e>>>0>d>>>0;i=h?d:e;c:{if(i){c=Fa(c?H[a+16>>2]:a+16|0,g,i);if(c){break c}}c=d>>>0>e>>>0?-1:h}c=(c|0)<0;b=c?b:a;a=H[(c?a+4|0:a)>>2];if(a){continue}break}if((b|0)==(f|0)){break b}c=I[b+27|0];a=c<<24>>24<0;d:{c=a?H[b+20>>2]:c;e=c>>>0>>0?c:d;if(e){a=Fa(g,a?H[b+16>>2]:b+16|0,e);if(a){break d}}if(c>>>0>d>>>0){break b}break a}if((a|0)>=0){break a}}b=f}return b}function Jf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Ya(a,H[b+8>>2],e)){if(!(H[b+28>>2]==1|H[b+4>>2]!=(c|0))){H[b+28>>2]=d}return}a:{if(Ya(a,H[b>>2],e)){if(!(H[b+16>>2]!=(c|0)&H[b+20>>2]!=(c|0))){if((d|0)!=1){break a}H[b+32>>2]=1;return}H[b+32>>2]=d;b:{if(H[b+44>>2]==4){break b}G[b+52>>1]=0;a=H[a+8>>2];ea[H[H[a>>2]+20>>2]](a,b,c,c,1,e);if(I[b+53|0]){H[b+44>>2]=3;if(!I[b+52|0]){break b}break a}H[b+44>>2]=4}H[b+20>>2]=c;H[b+40>>2]=H[b+40>>2]+1;if(H[b+36>>2]!=1|H[b+24>>2]!=2){break a}F[b+54|0]=1;return}a=H[a+8>>2];ea[H[H[a>>2]+24>>2]](a,b,c,d,e)}}function Db(a,b,c){var d=0,e=0,f=0,g=0;a:{b:{if(!b){break b}if(J[a+38>>1]<=513){f=H[a+12>>2];d=H[a+20>>2];b=H[a+16>>2];g=b+8|0;d=g>>>0<8?d+1|0:d;e=0;if(K[a+8>>2]>>0&(d|0)>=(f|0)|(d|0)>(f|0)){break a}b=b+H[a>>2]|0;d=I[b+4|0]|I[b+5|0]<<8|(I[b+6|0]<<16|I[b+7|0]<<24);H[c>>2]=I[b|0]|I[b+1|0]<<8|(I[b+2|0]<<16|I[b+3|0]<<24);H[c+4>>2]=d;b=H[a+20>>2];c=H[a+16>>2]+8|0;b=c>>>0<8?b+1|0:b;H[a+16>>2]=c;H[a+20>>2]=b;break b}e=0;if(!re(1,c,a)){break a}}F[a+36|0]=1;H[a+32>>2]=0;b=H[a+16>>2];c=b+H[a>>2]|0;H[a+24>>2]=c;H[a+28>>2]=(H[a+8>>2]-b|0)+c;e=1}return e}function ve(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;f=pa(64);c=pa(12);H[c+8>>2]=H[H[a+4>>2]+80>>2];H[c>>2]=13216;H[c+4>>2]=0;f=od(f,c);a:{b:{if((b|0)<0){c=f;break b}h=a+8|0;c=H[a+12>>2];e=H[a+8>>2];g=c-e>>2;c:{if((g|0)>(b|0)){break c}d=b+1|0;if(b>>>0>=g>>>0){Vb(h,d-g|0);break c}if(d>>>0>=g>>>0){break c}e=e+(d<<2)|0;if((e|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){ea[H[H[d>>2]+4>>2]](d)}if((c|0)!=(e|0)){continue}break}}H[a+12>>2]=e}a=H[h>>2]+(b<<2)|0;c=H[a>>2];H[a>>2]=f;if(!c){break a}}ea[H[H[c>>2]+4>>2]](c)}return(b^-1)>>>31|0}function Qd(a,b){var c=0,d=0,e=0,f=0;d=ca-16|0;ca=d;H[d+12>>2]=b;c=ca-208|0;ca=c;H[c+204>>2]=b;b=c+160|0;ra(b,0,40);H[c+200>>2]=H[c+204>>2];a:{if((Od(0,a,c+200|0,c+80|0,b)|0)<0){break a}f=H[3941]>=0;b=H[3922];if(H[3940]<=0){H[3922]=b&-33}b:{c:{d:{if(!H[3934]){H[3934]=80;H[3929]=0;H[3926]=0;H[3927]=0;e=H[3933];H[3933]=c;break d}if(H[3926]){break c}}if(Sd(15688)){break b}}Od(15688,a,c+200|0,c+80|0,c+160|0)}if(e){ea[H[3931]](15688,0,0)|0;H[3934]=0;H[3933]=e;H[3929]=0;H[3926]=0;H[3927]=0}H[3922]=H[3922]|b&32;if(!f){break a}}ca=c+208|0;ca=d+16|0}function pf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;c=H[a+60>>2];a:{if(!c){break a}H[c+4>>2]=a+48;if(!(ea[H[H[c>>2]+12>>2]](c)|0)){break a}b:{c=ea[H[H[a>>2]+24>>2]](a)|0;if((c|0)<=0){break b}while(1){c:{f=H[(ea[H[H[a>>2]+28>>2]](a)|0)+4>>2];g=ea[H[H[a>>2]+20>>2]](a,d)|0;e=H[a+60>>2];if(!(ea[H[H[e>>2]+8>>2]](e,H[H[f+8>>2]+(g<<2)>>2])|0)){break c}d=d+1|0;if((c|0)!=(d|0)){continue}break b}break}return 0}d=0;if(!(ea[H[H[a>>2]+36>>2]](a,b)|0)){break a}if(!(ea[H[H[a>>2]+40>>2]](a,b)|0)){break a}d=ea[H[H[a>>2]+44>>2]](a)|0}return d|0}function id(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=H[a+216>>2];if((c|0)!=H[a+220>>2]){while(1){a:{c=H[N(e,144)+c>>2];if((c|0)<0){break a}d=H[a+4>>2];f=H[d+8>>2];if((c|0)>=H[d+12>>2]-f>>2){break a}d=0;c=H[(c<<2)+f>>2];if((ea[H[H[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if((ea[H[H[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if((ea[H[H[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}a=H[a+216>>2]+N(e,144)|0;return(I[a+100|0]?a+4|0:0)|0}e=e+1|0;c=H[a+216>>2];if(e>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}return 0}function xb(a){var b=0,c=0,d=0,e=0;c=H[a+132>>2];if(c){d=c;b=H[a+136>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+132>>2]}H[a+136>>2]=c;oa(d)}c=H[a+120>>2];if(c){d=c;b=H[a+124>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+120>>2]}H[a+124>>2]=c;oa(d)}b=H[a+108>>2];if(b){H[a+112>>2]=b;oa(b)}b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}Za(a+76|0);Za(a+56|0);Za(a+36|0);Za(a+16|0)}function rd(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2128;d=H[a+60>>2];if(d){b=d;c=H[a- -64>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){Ga(b)}if((c|0)!=(d|0)){continue}break}b=H[a+60>>2]}H[a+64>>2]=d;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){b=d;c=H[a+40>>2];if((b|0)!=(c|0)){while(1){c=c-24|0;ea[H[H[c>>2]>>2]](c)|0;if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function ue(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=H[a+8>>2];d=H[a+4>>2];if(c-d>>2>>>0>=b>>>0){if(b){b=b<<2;d=ra(d,0,b)+b|0}H[a+4>>2]=d;return}a:{f=H[a>>2];g=d-f>>2;e=g+b|0;if(e>>>0<1073741824){c=c-f|0;h=c>>>1|0;e=c>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break a}i=pa(e<<2)}c=(g<<2)+i|0;b=b<<2;b=ra(c,0,b)+b|0;if((d|0)!=(f|0)){while(1){c=c-4|0;d=d-4|0;H[c>>2]=H[d>>2];if((d|0)!=(f|0)){continue}break}}H[a+8>>2]=(e<<2)+i;H[a+4>>2]=b;H[a>>2]=c;if(f){oa(f)}return}sa();v()}wa();v()}function rb(a){var b=0,c=0,d=0,e=0,f=0;d=H[a+8>>2];a:{if(I[d+84|0]){break a}b=H[a+16>>2];if(!b|!I[b+84|0]){break a}c=H[d+72>>2];e=H[d+68>>2];F[b+84|0]=0;c=c-e>>2;f=H[b+68>>2];e=H[b+72>>2]-f>>2;b:{if(c>>>0>e>>>0){qb(b+68|0,c-e|0,2316);d=H[a+8>>2];break b}if(c>>>0>=e>>>0){break b}H[b+72>>2]=f+(c<<2)}if(I[d+84|0]){break a}c=H[d+68>>2];if((c|0)==H[d+72>>2]){break a}e=H[H[a+16>>2]+68>>2];b=0;while(1){f=b<<2;H[f+e>>2]=H[c+f>>2];b=b+1|0;c=H[d+68>>2];if(b>>>0>2]-c>>2>>>0){continue}break}}return H[a+16>>2]}function Lg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca+-64|0;ca=e;f=Ha(e+8|0);H[f+16>>2]=0;H[f+20>>2]=0;H[f>>2]=b;H[f+8>>2]=c;H[f+12>>2]=0;b=e+48|0;Pe(b,a,f,d);H[a+24>>2]=H[e+48>>2];f=a+24|0;a:{if((f|0)==(b|0)){break a}b=a+28|0;c=e+48|4;g=I[e+63|0];d=g<<24>>24;if(F[a+39|0]>=0){if((d|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[e+52>>2],H[e+56>>2]);break a}a=(d|0)<0;Yb(b,a?H[e+52>>2]:c,a?H[e+56>>2]:g)}if(F[e+63|0]<0){oa(H[e+52>>2])}ca=e- -64|0;return f|0}function Kg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=ca+-64|0;ca=e;f=Ha(e+8|0);H[f+16>>2]=0;H[f+20>>2]=0;H[f>>2]=b;H[f+8>>2]=c;H[f+12>>2]=0;b=e+48|0;Oe(b,a,f,d);H[a+24>>2]=H[e+48>>2];f=a+24|0;a:{if((f|0)==(b|0)){break a}b=a+28|0;c=e+48|4;g=I[e+63|0];d=g<<24>>24;if(F[a+39|0]>=0){if((d|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[e+52>>2],H[e+56>>2]);break a}a=(d|0)<0;Yb(b,a?H[e+52>>2]:c,a?H[e+56>>2]:g)}if(F[e+63|0]<0){oa(H[e+52>>2])}ca=e- -64|0;return f|0}function Ig(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;a=ca-32|0;ca=a;a:{d=Ma(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=pa(e);H[a+24>>2]=e|-2147483648;H[a+16>>2]=f;H[a+20>>2]=d;e=d+f|0;break c}F[a+27|0]=d;f=a+16|0;e=f+d|0;if(!d){break b}}qa(f,c,d)}F[e|0]=0;F[a+4|0]=0;H[a>>2]=1701667182;F[a+11|0]=4;d=H[b+4>>2];c=-1;d:{if(!d){break d}d=be(d,a,a+16|0);c=-1;if(!d){break d}c=Yd(b,H[d+24>>2])}b=c;if(F[a+11|0]<0){oa(H[a>>2])}if(F[a+27|0]<0){oa(H[a+16>>2])}ca=a+32|0;break a}Na();v()}return b|0}function hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=H[a+216>>2];if((c|0)!=H[a+220>>2]){while(1){a:{c=H[N(e,144)+c>>2];if((c|0)<0){break a}d=H[a+4>>2];f=H[d+8>>2];if((c|0)>=H[d+12>>2]-f>>2){break a}d=0;c=H[(c<<2)+f>>2];if((ea[H[H[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if((ea[H[H[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if((ea[H[H[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}return(H[a+216>>2]+N(e,144)|0)+104|0}e=e+1|0;c=H[a+216>>2];if(e>>>0<(H[a+220>>2]-c|0)/144>>>0){continue}break}}return a+184|0}function ab(a){var b=0,c=0,d=0,e=0;c=H[a+640>>2];if(c){d=c;b=H[a+644>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+640>>2]}H[a+644>>2]=c;oa(d)}c=H[a+628>>2];if(c){d=c;b=H[a+632>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+628>>2]}H[a+632>>2]=c;oa(d)}b=H[a+616>>2];if(b){H[a+620>>2]=b;oa(b)}b=H[a+604>>2];if(b){H[a+608>>2]=b;oa(b)}Za(a+584|0);Za(a+564|0);Za(a+544|0)}function Tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;d=ca-16|0;ca=d;H[d+12>>2]=0;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=pa(f);H[d+8>>2]=f|-2147483648;H[d>>2]=a;H[d+4>>2]=e;f=a+e|0;break c}F[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}qa(a,c,e)}F[f|0]=0;a=nb(b,d);d:{if((a|0)==(b+4|0)){break d}b=H[a+32>>2];a=H[a+28>>2];if((b-a|0)!=4){break d}H[d+12>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24)}a=H[d+12>>2];if(F[d+11|0]<0){oa(H[d>>2])}ca=d+16|0;break a}Na();v()}return a|0}function vb(a){var b=0,c=0,d=0,e=0;c=H[a+128>>2];if(c){d=c;b=H[a+132>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+128>>2]}H[a+132>>2]=c;oa(d)}c=H[a+116>>2];if(c){d=c;b=H[a+120>>2];if((c|0)!=(b|0)){while(1){d=b-12|0;e=H[d>>2];if(e){H[b-8>>2]=e;oa(e)}b=d;if((c|0)!=(b|0)){continue}break}d=H[a+116>>2]}H[a+120>>2]=c;oa(d)}b=H[a+104>>2];if(b){H[a+108>>2]=b;oa(b)}b=H[a+92>>2];if(b){H[a+96>>2]=b;oa(b)}Za(a+72|0);Za(a+52|0);Za(a+32|0)}function kc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;a:{c=H[a+4>>2];e=H[a>>2];d=c-e|0;b:{if(d>>>0>>0){g=b-d|0;f=H[a+8>>2];if(g>>>0<=f-c>>>0){h=a,i=ra(c,0,g)+g|0,H[h+4>>2]=i;break b}if((b|0)<0){break a}c=f-e|0;f=c<<1;c=c>>>0>=1073741823?2147483647:b>>>0>>0?f:b;f=pa(c);ra(f+d|0,0,g);d=va(f,e,d);H[a+8>>2]=d+c;H[a+4>>2]=b+d;H[a>>2]=d;if(!e){break b}oa(e);break b}if(b>>>0>=d>>>0){break b}H[a+4>>2]=b+e}b=H[a+28>>2];c=b;d=b+1|0;b=H[a+24>>2]+1|0;e=b?c:d;H[a+24>>2]=b;H[a+28>>2]=e;return}sa();v()}function Ka(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+4>>2];if((e|0)!=H[a+8>>2]){H[e>>2]=H[b>>2];H[a+4>>2]=e+4;return}a:{g=H[a>>2];f=e-g|0;c=f>>2;d=c+1|0;if(d>>>0<1073741824){h=c<<2;c=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(c){if(c>>>0>=1073741824){break a}f=pa(c<<2)}else{f=0}d=h+f|0;H[d>>2]=H[b>>2];b=d+4|0;if((e|0)!=(g|0)){while(1){d=d-4|0;e=e-4|0;H[d>>2]=H[e>>2];if((e|0)!=(g|0)){continue}break}}H[a+8>>2]=f+(c<<2);H[a+4>>2]=b;H[a>>2]=d;if(g){oa(g)}return}sa();v()}wa();v()}function Ia(a){H[a>>2]=-1;H[a+4>>2]=0;H[a+8>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;F[a+28|0]=1;H[a+20>>2]=0;H[a+24>>2]=0;H[a+12>>2]=0;H[a+16>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;H[a+60>>2]=0;H[a+64>>2]=0;H[a+68>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+88>>2]=0;H[a+92>>2]=0;H[a+96>>2]=0;H[a+72>>2]=a+4;H[a+104>>2]=0;H[a+108>>2]=0;F[a+100|0]=1;H[a+112>>2]=0;H[a+116>>2]=0;H[a+120>>2]=0;H[a+124>>2]=0;H[a+128>>2]=0;H[a+132>>2]=0;H[a+136>>2]=0;H[a+140>>2]=0}function Ld(a,b){if(!a){return 0}a:{b:{if(a){if(b>>>0<=127){break b}c:{if(!H[H[4292]>>2]){if((b&-128)==57216){break b}break c}if(b>>>0<=2047){F[a+1|0]=b&63|128;F[a|0]=b>>>6|192;a=2;break a}if(!((b&-8192)!=57344&b>>>0>=55296)){F[a+2|0]=b&63|128;F[a|0]=b>>>12|224;F[a+1|0]=b>>>6&63|128;a=3;break a}if(b-65536>>>0<=1048575){F[a+3|0]=b&63|128;F[a|0]=b>>>18|240;F[a+2|0]=b>>>6&63|128;F[a+1|0]=b>>>12&63|128;a=4;break a}}H[3992]=25;a=-1}else{a=1}break a}F[a|0]=b;a=1}return a}function Hb(a,b){var c=0,d=0,e=0,f=0;d=H[a+12>>2];c=H[a+16>>2]-d>>2;a:{if(c>>>0>>0){ya(a+12|0,b-c|0);break a}if(b>>>0>=c>>>0){break a}H[a+16>>2]=d+(b<<2)}b:{c=H[a>>2];c:{if(H[a+8>>2]-c>>2>>>0>=b>>>0){break c}if(b>>>0>=1073741824){break b}d=H[a+4>>2];e=b<<2;b=pa(e);e=b+e|0;f=b+(d-c&-4)|0;b=f;if((c|0)!=(d|0)){while(1){b=b-4|0;d=d-4|0;H[b>>2]=H[d>>2];if((c|0)!=(d|0)){continue}break}}H[a+8>>2]=e;H[a+4>>2]=f;H[a>>2]=b;if(!c){break c}oa(c)}return}sa();v()}function _b(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13724;b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}b=H[a+44>>2];if(b){H[a+48>>2]=b;oa(b)}b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}b=H[a+8>>2];if(b){d=b;c=H[a+12>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;d=H[c>>2];H[c>>2]=0;if(d){Ga(d)}if((b|0)!=(c|0)){continue}break}d=H[a+8>>2]}H[a+12>>2]=b;oa(d)}b=H[a+4>>2];H[a+4>>2]=0;if(b){Uc(b)}return a|0}function yb(a,b,c){var d=0,e=0,f=0,g=0,h=0;f=ca-16|0;ca=f;d=ca-32|0;ca=d;e=ca-16|0;ca=e;H[e+12>>2]=b;H[e+8>>2]=b+c;H[d+24>>2]=H[e+12>>2];H[d+28>>2]=H[e+8>>2];ca=e+16|0;c=ca-16|0;ca=c;h=H[d+28>>2];e=H[d+24>>2];g=h-e|0;if((e|0)!=(h|0)){va(a,e,g)}H[c+12>>2]=e+g;H[c+8>>2]=a+g;H[d+16>>2]=H[c+12>>2];H[d+20>>2]=H[c+8>>2];ca=c+16|0;H[d+12>>2]=(H[d+16>>2]-b|0)+b;H[d+8>>2]=(H[d+20>>2]-a|0)+a;H[f+8>>2]=H[d+12>>2];H[f+12>>2]=H[d+8>>2];ca=d+32|0;ca=f+16|0}function ya(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;h=g>>2;d=h+b|0;if(d>>>0<1073741824){e=e-c|0;f=e>>>1|0;d=e>>>0>=2147483644?1073741823:d>>>0>>0?f:d;if(d){if(d>>>0>=1073741824){break a}i=pa(d<<2)}b=b<<2;e=ra((h<<2)+i|0,0,b);f=d<<2;d=va(i,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function Tc(a,b){var c=0,d=0,e=0,f=0;c=a+4|0;a=nb(a,b);a:{if((c|0)==(a|0)){break a}b=a+28|0;b=F[a+39|0]<0?H[b>>2]:b;while(1){a=b;b=a+1|0;c=F[a|0];if((c|0)==32|c-9>>>0<5){continue}break}b:{c:{d:{c=F[a|0];switch(c-43|0){case 0:break c;case 2:break d;default:break b}}e=1}c=F[b|0];a=b}if(c-48>>>0<10){while(1){d=(N(d,10)-F[a|0]|0)+48|0;b=F[a+1|0];a=a+1|0;if(b-48>>>0<10){continue}break}}a=e?d:0-d|0;if((a|0)==-1){break a}f=(a|0)!=0}return f}function bb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;a=H[a>>2];c=H[a+4>>2];e=H[a+8>>2];if(c>>>0>>0){H[c>>2]=H[b>>2];H[a+4>>2]=c+4;return}a:{d=c;c=H[a>>2];g=d-c|0;d=g>>2;f=d+1|0;if(f>>>0<1073741824){h=d<<2;e=e-c|0;d=e>>>1|0;f=e>>>0>=2147483644?1073741823:f>>>0>>0?d:f;if(f){if(f>>>0>=1073741824){break a}e=pa(f<<2)}else{e=0}d=h+e|0;H[d>>2]=H[b>>2];b=va(e,c,g);H[a+8>>2]=b+(f<<2);H[a+4>>2]=d+4;H[a>>2]=b;if(c){oa(c)}return}sa();v()}wa();v()}function ob(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>3>>>0>=b>>>0){if(b){b=b<<3;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;h=g>>3;d=h+b|0;if(d>>>0<536870912){e=e-c|0;f=e>>>2|0;d=e>>>0>=2147483640?536870911:d>>>0>>0?f:d;if(d){if(d>>>0>=536870912){break a}i=pa(d<<3)}b=b<<3;e=ra((h<<3)+i|0,0,b);f=d<<3;d=va(i,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function kf(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2328;b=H[a+60>>2];H[a+60>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){c=H[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function jf(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=2328;b=H[a+60>>2];H[a+60>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}d=H[a+36>>2];if(d){c=H[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+36>>2]}H[a+40>>2]=d;oa(b)}H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}oa(a)}function xi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;d=ca-16|0;ca=d;e=H[a+4>>2];a:{if((e|0)==-1){break a}c=H[b+20>>2];if(!!H[b+16>>2]&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],H[a+8>>2],H[a+12>>2]);c=H[b+20>>2];if(!!H[b+16>>2]&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],a+20|0,a+24|0);c=H[b+20>>2];f=H[b+16>>2];F[d+15|0]=H[a+4>>2];if(!!f&(c|0)>=0|(c|0)>0){break a}Wb(b,H[b+4>>2],d+15|0,d+16|0)}ca=d+16|0;return(e|0)!=-1|0}function Eh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;a:{b=H[a+8>>2];b:{if((b|0)<0){break b}c=H[a+4>>2];e=H[c>>2];d=H[c+4>>2]-e>>2;c:{if(d>>>0>>0){ue(c,b-d|0);f=H[a+8>>2];break c}f=b;if(b>>>0>=d>>>0){break c}H[c+4>>2]=e+(b<<2);f=b}d=f;if((d|0)<=0){break b}a=H[a+4>>2];c=H[a>>2];e=H[a+4>>2]-c>>2;a=0;while(1){if((a|0)==(e|0)){break a}H[c+(a<<2)>>2]=a;a=a+1|0;if((d|0)!=(a|0)){continue}break}}return(b^-1)>>>31|0}Ca();v()}function qe(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+8>>2];c=H[a+4>>2];if(e-c>>1>>>0>=b>>>0){if(b){b=b<<1;c=ra(c,0,b)+b|0}H[a+4>>2]=c;return}a:{f=c;c=H[a>>2];g=f-c|0;f=g>>1;d=f+b|0;if((d|0)>=0){e=e-c|0;d=e>>>0>=2147483646?2147483647:d>>>0>>0?e:d;if(d){if((d|0)<0){break a}h=pa(d<<1)}b=b<<1;e=ra((f<<1)+h|0,0,b);f=d<<1;d=va(h,c,g);H[a+8>>2]=f+d;H[a+4>>2]=b+e;H[a>>2]=d;if(c){oa(c)}return}sa();v()}wa();v()}function ng(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;Pe(d,a,b,c);H[a+24>>2]=H[d>>2];e=a+24|0;a:{if((e|0)==(d|0)){break a}b=a+28|0;c=d|4;f=I[d+15|0];g=f<<24>>24;if(F[a+39|0]>=0){if((g|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[d+4>>2],H[d+8>>2]);break a}a=(g|0)<0;Yb(b,a?H[d+4>>2]:c,a?H[d+8>>2]:f)}if(F[d+15|0]<0){oa(H[d+4>>2])}ca=d+16|0;return e|0}function mg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;Oe(d,a,b,c);H[a+24>>2]=H[d>>2];e=a+24|0;a:{if((e|0)==(d|0)){break a}b=a+28|0;c=d|4;f=I[d+15|0];g=f<<24>>24;if(F[a+39|0]>=0){if((g|0)>=0){a=H[c+4>>2];H[b>>2]=H[c>>2];H[b+4>>2]=a;H[b+8>>2]=H[c+8>>2];break a}Xb(b,H[d+4>>2],H[d+8>>2]);break a}a=(g|0)<0;Yb(b,a?H[d+4>>2]:c,a?H[d+8>>2]:f)}if(F[d+15|0]<0){oa(H[d+4>>2])}ca=d+16|0;return e|0}function za(a,b,c){var d=0,e=0,f=0,g=0;e=ca-16|0;ca=e;a:{b:{if(c>>>0<11){d=a;F[a+11|0]=I[a+11|0]&128|c;F[a+11|0]=I[a+11|0]&127;break b}if(c>>>0>2147483631){break a}g=e+8|0;if(c>>>0>=11){f=c+16&-16;d=f-1|0;d=(d|0)==11?f:d}else{d=10}Zb(g,d+1|0);d=H[e+8>>2];H[a>>2]=d;H[a+8>>2]=H[a+8>>2]&-2147483648|H[e+12>>2]&2147483647;H[a+8>>2]=H[a+8>>2]|-2147483648;H[a+4>>2]=c}yb(d,b,c+1|0);ca=e+16|0;return}Na();v()}function Qg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=ca-16|0;ca=d;a:{e=Ma(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=pa(g);H[d+8>>2]=g|-2147483648;H[d>>2]=f;H[d+4>>2]=e;g=e+f|0;break c}F[d+11|0]=e;g=d+e|0;f=d;if(!e){break b}}qa(f,c,e)}F[g|0]=0;f=a+16|0;c=$d(b,d,f);b=H[a+16>>2];a=F[a+27|0];if(F[d+11|0]<0){oa(H[d>>2])}ca=d+16|0;a=c?(a|0)<0?b:f:0;break a}Na();v()}return a|0}function Mc(a,b){var c=0,d=0,e=0;c=H[a+4>>2];d=c+b|0;H[a+4>>2]=d;if(!((d-1^c-1)>>>0<32?c:0)){H[H[a>>2]+((d>>>0>=33?d-1>>>5|0:0)<<2)>>2]=0}a:{if(!b){break a}a=H[a>>2]+(c>>>3&536870908)|0;c=c&31;if(c){d=32-c|0;e=b>>>0>d>>>0?d:b;H[a>>2]=H[a>>2]&(-1<>>d-e^-1);b=b-e|0;a=a+4|0}c=b>>>5|0;if(b>>>0>=32){ra(a,0,c<<2)}if((b&-32)==(b|0)){break a}a=(c<<2)+a|0;H[a>>2]=H[a>>2]&(-1>>>32-(b&31)^-1)}}function Fc(a,b,c){var d=0,e=0,f=0;d=H[c+16>>2];a:{if(!d){if(Sd(c)){break a}d=H[c+16>>2]}f=H[c+20>>2];if(d-f>>>0>>0){return ea[H[c+36>>2]](c,a,b)|0}b:{if(H[c+80>>2]<0){d=0;break b}e=b;while(1){d=e;if(!d){d=0;break b}e=d-1|0;if(I[e+a|0]!=10){continue}break}e=ea[H[c+36>>2]](c,a,d)|0;if(e>>>0>>0){break a}a=a+d|0;b=b-d|0;f=H[c+20>>2]}qa(f,a,b);H[c+20>>2]=H[c+20>>2]+b;e=b+d|0}return e}function ad(a){var b=0,c=0,d=0,e=0;if(I[a+76|0]){F[a+76|0]=0;e=H[a+60>>2];c=H[a+72>>2]+7|0;b=c>>>0<7?1:b;d=b<<29|c>>>3;c=d+H[a+56>>2]|0;b=(b>>>3|0)+e|0;H[a+56>>2]=c;H[a+60>>2]=c>>>0>>0?b+1|0:b}if(J[a+38>>1]<=513){F[a+132|0]=0;e=H[a+116>>2];b=0;c=H[a+128>>2]+7|0;b=c>>>0<7?1:b;d=b<<29|c>>>3;c=d+H[a+112>>2]|0;b=(b>>>3|0)+e|0;H[a+112>>2]=c;H[a+116>>2]=c>>>0>>0?b+1|0:b}}function re(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=H[c+20>>2];f=H[c+12>>2];e=H[c+16>>2];if((d|0)>=(f|0)&e>>>0>=K[c+8>>2]|(d|0)>(f|0)){break a}f=F[e+H[c>>2]|0];e=e+1|0;d=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!re(a+1|0,b,c)){break a}a=H[b>>2];d=d&127|a<<7;a=H[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}H[b>>2]=d;H[b+4>>2]=a;g=1}return g}function gb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=H[c+20>>2];f=H[c+12>>2];e=H[c+16>>2];if((d|0)>=(f|0)&e>>>0>=K[c+8>>2]|(d|0)>(f|0)){break a}f=F[e+H[c>>2]|0];e=e+1|0;d=e?d:d+1|0;H[c+16>>2]=e;H[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!gb(a+1|0,b,c)){break a}a=H[b>>2];d=d&127|a<<7;a=H[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}H[b>>2]=d;H[b+4>>2]=a;g=1}return g}function Nh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=ca+-64|0;ca=e;d=ea[H[H[a>>2]+44>>2]](a,b)|0;a=ea[H[H[a>>2]+40>>2]](a,b)|0;f=Eb(e);g=H[b+56>>2];h=d&255;i=a;a=a-1|0;if(a>>>0<=10){a=H[(a<<2)+13584>>2]}else{a=-1}d=N(a,d);lc(f,g,h,i,0,d,d>>31);a=jc(pa(96),f);mb(a,c);F[a+84|0]=1;H[a+72>>2]=H[a+68>>2];H[a+60>>2]=H[b+60>>2];ca=e- -64|0;return a|0}function If(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(Ya(a,H[b+8>>2],e)){if(!(H[b+28>>2]==1|H[b+4>>2]!=(c|0))){H[b+28>>2]=d}return}a:{if(!Ya(a,H[b>>2],e)){break a}if(!(H[b+16>>2]!=(c|0)&H[b+20>>2]!=(c|0))){if((d|0)!=1){break a}H[b+32>>2]=1;return}H[b+20>>2]=c;H[b+32>>2]=d;H[b+40>>2]=H[b+40>>2]+1;if(!(H[b+36>>2]!=1|H[b+24>>2]!=2)){F[b+54|0]=1}H[b+44>>2]=4}}function Bh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;e=H[a+32>>2];b=e;h=H[b+8>>2];g=H[b+12>>2];c=H[b+16>>2];b=H[b+20>>2];f=c+4|0;b=f>>>0<4?b+1|0:b;d=0;a:{if(f>>>0>h>>>0&(b|0)>=(g|0)|(b|0)>(g|0)){break a}c=H[e>>2]+c|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[e+16>>2]=f;H[e+20>>2]=b;d=0;if((c|0)<0){break a}H[H[a+4>>2]+80>>2]=c;d=1}return d|0}function qi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=11276;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}return a|0}function Ee(a,b){var c=0,d=0,e=0,f=0;H[a+144>>2]=b;c=H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2];c=H[c>>2]+H[c+16>>2]|0;d=H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2];d=H[d+8>>2]-H[d+16>>2]|0;e=a,f=J[H[(ea[H[H[b>>2]+32>>2]](b)|0)+32>>2]+38>>1],G[e+38>>1]=f;H[a>>2]=c;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=d;H[a+12>>2]=0;e=a,f=ea[H[H[b>>2]+36>>2]](b)|0,H[e+148>>2]=f}function Cd(a,b,c,d){F[a+53|0]=1;a:{if(H[a+4>>2]!=(c|0)){break a}F[a+52|0]=1;c=H[a+16>>2];b:{if(!c){H[a+36>>2]=1;H[a+24>>2]=d;H[a+16>>2]=b;if((d|0)!=1){break a}if(H[a+48>>2]==1){break b}break a}if((b|0)==(c|0)){c=H[a+24>>2];if((c|0)==2){H[a+24>>2]=d;c=d}if(H[a+48>>2]!=1){break a}if((c|0)==1){break b}break a}H[a+36>>2]=H[a+36>>2]+1}F[a+54|0]=1}}function pi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=11276;b=H[a+48>>2];H[a+48>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}oa(a)}function zh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=H[a+32>>2];b=e;g=H[b+8>>2];d=H[b+12>>2];c=H[b+16>>2];b=H[b+20>>2];f=d;d=c+4|0;b=d>>>0<4?b+1|0:b;if((f|0)>=(b|0)&d>>>0<=g>>>0|(b|0)<(f|0)){c=H[e>>2]+c|0;c=I[c|0]|I[c+1|0]<<8|(I[c+2|0]<<16|I[c+3|0]<<24);H[e+16>>2]=d;H[e+20>>2]=b;H[H[a+4>>2]+80>>2]=c}return(b|0)<=(f|0)&d>>>0<=g>>>0|(b|0)<(f|0)}function Mf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=ca+-64|0;ca=e;d=1;a:{if(Ya(a,b,0)){break a}d=0;if(!b){break a}b=Ed(b,14972);d=0;if(!b){break a}d=e+8|0;ra(d|4,0,52);H[e+56>>2]=1;H[e+20>>2]=-1;H[e+16>>2]=a;H[e+8>>2]=b;ea[H[H[b>>2]+28>>2]](b,d,H[c>>2],1);a=H[e+32>>2];if((a|0)==1){H[c>>2]=H[e+24>>2]}d=(a|0)==1}ca=e- -64|0;return d|0}function Ie(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=ca-16|0;ca=d;H[a+4>>2]=b;b=H[b+64>>2];e=H[b>>2];b=H[b+4>>2];F[d+15|0]=0;Oa(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=H[a+4>>2];e=H[b+56>>2];b=H[b+52>>2];F[d+14|0]=0;Oa(a+36|0,e-b>>2,d+14|0);b=H[c+12>>2];H[a+16>>2]=H[c+8>>2];H[a+20>>2]=b;b=H[c+4>>2];H[a+8>>2]=H[c>>2];H[a+12>>2]=b;ca=d+16|0}function pc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!b){H[c>>2]=0;return}h=0-I[a+12|0]&255;e=H[a+4>>2];d=H[a+8>>2];i=H[a>>2];while(1){j=f<<1;if(!((e|0)<=0|d>>>0>4095)){e=e-1|0;H[a+4>>2]=e;d=I[e+i|0]|d<<8}g=d&255;f=g>>>0>>0;k=g;g=N(d>>>8|0,h);d=f?k+g|0:d-(h+g|0)|0;H[a+8>>2]=d;f=f|j;b=b-1|0;if(b){continue}break}H[c>>2]=f}function yg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a=ca-16|0;ca=a;f=F[b+24|0];e=H[3411];H[a+8>>2]=H[3410];H[a+12>>2]=e;e=H[3409];H[a>>2]=H[3408];H[a+4>>2]=e;e=Va(b,c,f,a);if(e){b=0;if(f){c=(f&255)<<2;b=pa(c);g=qa(b,a,c)+c|0}c=H[d>>2];if(c){H[d+4>>2]=c;oa(c)}H[d+8>>2]=g;H[d+4>>2]=g;H[d>>2]=b}ca=a+16|0;return e|0}function of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=ea[H[H[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=H[H[a+36>>2]>>2];g=a+48|0;c=0;if(!(ea[H[H[d>>2]+16>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=H[H[a+36>>2]+(e<<2)>>2];if(ea[H[H[d>>2]+16>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function nf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=ea[H[H[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=H[H[a+36>>2]>>2];g=a+48|0;c=0;if(!(ea[H[H[d>>2]+20>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=H[H[a+36>>2]+(e<<2)>>2];if(ea[H[H[d>>2]+20>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function _c(a,b){var c=0,d=0;a:{c=H[a+4>>2];d=H[a+8>>2];if((c|0)==d<<5){if((c+1|0)<0){break a}if(c>>>0<=1073741822){d=d<<6;c=(c&-32)+32|0;c=c>>>0>>0?d:c}else{c=2147483647}pb(a,c);c=H[a+4>>2]}H[a+4>>2]=c+1;d=1<>2]+(c>>>3&536870908)|0;if(I[b|0]){H[a>>2]=d|H[a>>2];return}H[a>>2]=H[a>>2]&(d^-1);return}sa();v()}function $h(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=ca-16|0;ca=d;H[a+4>>2]=b;e=H[b>>2];b=H[b+4>>2];F[d+15|0]=0;Oa(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=H[a+4>>2];e=H[b+28>>2];b=H[b+24>>2];F[d+14|0]=0;Oa(a+36|0,e-b>>2,d+14|0);b=H[c+12>>2];H[a+16>>2]=H[c+8>>2];H[a+20>>2]=b;b=H[c+4>>2];H[a+8>>2]=H[c>>2];H[a+12>>2]=b;ca=d+16|0}function $b(a){var b=0;H[a>>2]=0;H[a+4>>2]=0;H[a+56>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;b=a- -64|0;H[b>>2]=0;H[b+4>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;H[a+80>>2]=0;H[a+84>>2]=0;H[a+60>>2]=a;return a}function td(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!td(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g} -function hb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!hb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Xa(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Xa(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Qe(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Qe(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Pc(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Pc(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Fb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Fb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Ea(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Ea(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Bb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=H[c+20>>2];e=H[c+12>>2];f=H[c+16>>2];if((d|0)>=(e|0)&f>>>0>=K[c+8>>2]|(d|0)>(e|0)){break a}e=I[H[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;H[c+16>>2]=f;H[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Bb(a+1|0,b,c)){break a}e=d&127|H[b>>2]<<7}H[b>>2]=e;g=1}return g}function Fa(a,b,c){var d=0,e=0;a:{b:{if(c>>>0>=4){if((a|b)&3){break b}while(1){if(H[a>>2]!=H[b>>2]){break b}b=b+4|0;a=a+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}}while(1){d=I[a|0];e=I[b|0];if((d|0)==(e|0)){b=b+1|0;a=a+1|0;c=c-1|0;if(c){continue}break a}break}return d-e|0}return 0}function Yc(a){var b=0,c=0,d=0,e=0;d=H[a>>2];if(d){e=d;c=H[a+4>>2];if((d|0)!=(c|0)){while(1){e=c-144|0;b=H[e+132>>2];if(b){H[c-8>>2]=b;oa(b)}b=H[c-28>>2];if(b){H[c-24>>2]=b;oa(b)}b=H[c-40>>2];if(b){H[c-36>>2]=b;oa(b)}oc(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}e=H[a>>2]}H[a+4>>2]=d;oa(e)}}function Dg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[b+4>>2];a:{if(!d){break a}b=H[H[H[b+8>>2]+(c<<2)>>2]+60>>2];if((b|0)<0){break a}a=H[d+24>>2];c=H[d+28>>2];if((a|0)==(c|0)){break a}b:{while(1){e=H[a>>2];if((b|0)==H[e+24>>2]){break b}a=a+4|0;if((c|0)!=(a|0)){continue}break}e=0}}return e|0}function Zh(a){a=a|0;var b=0;H[a+8>>2]=12384;H[a>>2]=12172;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+80>>2];if(b){H[a+84>>2]=b;oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function Uc(a){var b=0,c=0,d=0;if(a){d=H[a+24>>2];if(d){b=d;c=H[a+28>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){Ra(b+12|0,H[b+16>>2]);Qa(b,H[b+4>>2]);oa(b)}if((c|0)!=(d|0)){continue}break}b=H[a+24>>2]}H[a+28>>2]=d;oa(b)}Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}}function Yh(a){a=a|0;var b=0;H[a+8>>2]=12384;H[a>>2]=12172;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+80>>2];if(b){H[a+84>>2]=b;oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function vi(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}return a|0}function xc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;h=H[c+8>>2];e=H[c+16>>2];g=H[c+12>>2];f=g;d=H[c+20>>2];if(h>>>0>e>>>0&(f|0)>=(d|0)|(d|0)<(f|0)){b=I[H[c>>2]+e|0];i=e+1|0;f=i?d:d+1|0;H[c+16>>2]=i;H[c+20>>2]=f;H[a+4>>2]=b}return e>>>0>>0&(d|0)<=(g|0)|(d|0)<(g|0)}function Wc(a){a=a|0;var b=0,c=0,d=0;H[a>>2]=13280;b=H[a+20>>2];if(b){H[a+24>>2]=b;oa(b)}d=H[a+8>>2];if(d){c=H[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=H[c>>2];H[c>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=H[a+8>>2]}H[a+12>>2]=d;oa(b)}oa(a)}function Ya(a,b,c){var d=0;if(!c){return H[a+4>>2]==H[b+4>>2]}if((a|0)==(b|0)){return 1}d=H[a+4>>2];a=I[d|0];c=H[b+4>>2];b=I[c|0];a:{if(!a|(b|0)!=(a|0)){break a}while(1){b=I[c+1|0];a=I[d+1|0];if(!a){break a}c=c+1|0;d=d+1|0;if((a|0)==(b|0)){continue}break}}return(a|0)==(b|0)}function _h(a){a=a|0;var b=0;H[a>>2]=12384;b=H[a+88>>2];if(b){H[a+92>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){H[a- -64>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function Fg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[b+12>>2];b=H[b+8>>2];a=0;a:{if((d|0)==(b|0)){break a}a=d-b>>2;d=a>>>0<=1?1:a;a=0;b:{while(1){e=H[b+(a<<2)>>2];if(H[e+60>>2]==(c|0)){break b}a=a+1|0;if((d|0)!=(a|0)){continue}break}a=0;break a}a=(a|0)!=-1?e:0}return a|0}function ae(a,b){var c=0,d=0,e=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;a:{c=H[b+4>>2];d=H[b>>2];b:{if((c|0)==(d|0)){a=c;break b}c=c-d|0;if((c|0)<0){break a}d=c;e=pa(c);c=ra(e,0,c);d=d+c|0;H[a+8>>2]=d;H[a+4>>2]=d;H[a>>2]=c;c=H[b>>2];a=H[b+4>>2]}qa(e,c,a-c|0);return}sa();v()}function ed(a){var b=0,c=0,d=0,e=0;c=H[a+4>>2];d=H[a>>2];if((c|0)!=(d|0)){while(1){e=c-144|0;b=H[e+132>>2];if(b){H[c-8>>2]=b;oa(b)}b=H[c-28>>2];if(b){H[c-24>>2]=b;oa(b)}b=H[c-40>>2];if(b){H[c-36>>2]=b;oa(b)}oc(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}}H[a+4>>2]=d}function Vh(a){a=a|0;var b=0;H[a>>2]=12384;b=H[a+88>>2];if(b){H[a+92>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+60>>2];if(b){H[a- -64>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function cb(a){var b=0;if(a){b=H[a+76>>2];if(b){H[a+80>>2]=b;oa(b)}b=H[a- -64>>2];if(b){H[a+68>>2]=b;oa(b)}b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}b=H[a+24>>2];if(b){H[a+28>>2]=b;oa(b)}b=H[a+12>>2];if(b){H[a+16>>2]=b;oa(b)}b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}oa(a)}}function Jd(a,b,c){var d=0,e=0,f=0,g=0;f=ca-16|0;ca=f;d=ca-16|0;ca=d;b=b-a>>2;while(1){if(b){H[d+12>>2]=a;e=b>>>1|0;H[d+12>>2]=H[d+12>>2]+(e<<2);g=(e^-1)+b|0;b=e;e=K[H[d+12>>2]>>2]>2];b=e?g:b;a=e?H[d+12>>2]+4|0:a;continue}break}ca=d+16|0;ca=f+16|0;return a}function oc(a){var b=0;b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}b=H[a+72>>2];if(b){H[a+76>>2]=b;oa(b)}b=H[a+52>>2];if(b){H[a+56>>2]=b;oa(b)}b=H[a+40>>2];if(b){H[a+44>>2]=b;oa(b)}b=H[a+28>>2];if(b){H[a+32>>2]=b;oa(b)}b=H[a+12>>2];if(b){oa(b)}a=H[a>>2];if(a){oa(a)}}function Xc(a,b){var c=0,d=0;d=pa(40);H[d>>2]=-1;c=d+8|0;H[c+16>>2]=0;H[c+20>>2]=0;H[c+8>>2]=0;H[c>>2]=0;H[c+4>>2]=0;H[c+24>>2]=0;H[c+28>>2]=0;ea[H[H[a>>2]+16>>2]](a,d);a=H[b+88>>2];H[b+88>>2]=d;if(a){b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)}return 1}function Ma(a){var b=0,c=0,d=0;b=a;a:{if(b&3){while(1){if(!I[b|0]){break a}b=b+1|0;if(b&3){continue}break}}while(1){c=b;b=b+4|0;d=H[c>>2];if(!((d^-1)&d-16843009&-2139062144)){continue}break}while(1){b=c;c=b+1|0;if(I[b|0]){continue}break}}return b-a|0}function Ba(a){var b=0,c=0,d=0,e=0,f=0;d=I[a+12|0];c=H[a+8>>2];a:{if(c>>>0>4095){break a}b=H[a+4>>2];if((b|0)<=0){break a}b=b-1|0;H[a+4>>2]=b;c=I[b+H[a>>2]|0]|c<<8}d=0-d&255;b=N(d,c>>>8|0);e=c&255;f=e>>>0>>0;H[a+8>>2]=f?b+e|0:c-(b+d|0)|0;return f}function od(a,b){H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=1984;H[a+12>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+32>>2]=0;H[a+36>>2]=0;H[a+40>>2]=0;H[a>>2]=2328;H[a+60>>2]=b;H[a+44>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;H[a+56>>2]=0;return a}function mc(a,b){var c=0,d=0,e=0;c=Ma(b);if(c>>>0<2147483632){a:{b:{if(c>>>0>=11){d=(c|15)+1|0;e=pa(d);H[a+8>>2]=d|-2147483648;H[a>>2]=e;H[a+4>>2]=c;d=c+e|0;break b}F[a+11|0]=c;d=a+c|0;e=a;if(!c){break a}}va(e,b,c)}F[d|0]=0;return a}Na();v()}function Ng(a){a=a|0;var b=0,c=0,d=0;if(a){if(F[a+27|0]<0){oa(H[a+16>>2])}b=H[a>>2];if(b){c=b;d=H[a+4>>2];if((b|0)!=(d|0)){while(1){c=d-12|0;if(F[d-1|0]<0){oa(H[c>>2])}d=c;if((d|0)!=(b|0)){continue}break}c=H[a>>2]}H[a+4>>2]=b;oa(c)}oa(a)}}function Jb(a,b){var c=0,d=0,e=0;a:{c=H[a>>2];b:{if(H[a+8>>2]-c>>2>>>0>=b>>>0){break b}if(b>>>0>=1073741824){break a}d=H[a+4>>2]-c|0;e=b<<2;b=va(pa(e),c,d);H[a+8>>2]=b+e;H[a+4>>2]=b+d;H[a>>2]=b;if(!c){break b}oa(c)}return}sa();v()}function Ga(a){a=a|0;var b=0,c=0;if(a){b=H[a+88>>2];H[a+88>>2]=0;if(b){c=H[b+8>>2];if(c){H[b+12>>2]=c;oa(c)}oa(b)}b=H[a+68>>2];if(b){H[a+72>>2]=b;oa(b)}b=H[a+64>>2];H[a+64>>2]=0;if(b){c=H[b>>2];if(c){H[b+4>>2]=c;oa(c)}oa(b)}oa(a)}}function Nd(a){var b=0,c=0,d=0;if(F[H[a>>2]]-48>>>0>=10){return 0}while(1){d=H[a>>2];c=-1;if(b>>>0<=214748364){c=F[d|0]-48|0;b=N(b,10);c=(c|0)>(b^2147483647)?-1:c+b|0}H[a>>2]=d+1;b=c;if(F[d+1|0]-48>>>0<10){continue}break}return b}function Cg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;b=H[b+96>>2];a=pa(12);b=b+N(c,12)|0;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c;H[a+8>>2]=H[b+8>>2];b=H[d>>2];if(b){H[d+4>>2]=b;oa(b)}H[d>>2]=a;a=a+12|0;H[d+8>>2]=a;H[d+4>>2]=a;return 1}function Ai(a){a=a|0;var b=0;H[a+24>>2]=1832;H[a>>2]=11048;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Sj(a,b,c,d){var e=0,f=0,g=0,h=0;f=b^d;g=f>>31;e=b>>31;a=a^e;h=a-e|0;e=(b^e)-((a>>>0>>0)+e|0)|0;a=d>>31;b=c^a;f=f>>31;a=Tj(h,e,b-a|0,(a^d)-((a>>>0>b>>>0)+a|0)|0)^f;b=a-f|0;da=(g^da)-((a>>>0>>0)+g|0)|0;return b}function yi(a){a=a|0;var b=0;H[a+24>>2]=1832;H[a>>2]=11048;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function Yb(a,b,c){var d=0,e=0,f=0;e=ca-16|0;ca=e;d=H[a+8>>2]&2147483647;a:{if(d>>>0>c>>>0){d=H[a>>2];H[a+4>>2]=c;yb(d,b,c);F[e+15|0]=0;F[c+d|0]=I[e+15|0];break a}f=a;a=H[a+4>>2];Gd(f,d-1|0,(c-d|0)+1|0,a,a,c,b)}ca=e+16|0}function Bf(a,b){a=a|0;b=b|0;var c=0,d=0;c=ca-16|0;ca=c;a=H[a+4>>2];a:{if((a|0)==-1){break a}F[c+15|0]=a;d=H[b+20>>2];if(!!H[b+16>>2]&(d|0)>=0|(d|0)>0){break a}Wb(b,H[b+4>>2],c+15|0,c+16|0)}ca=c+16|0;return(a|0)!=-1|0}function Xb(a,b,c){var d=0,e=0;d=ca-16|0;ca=d;a:{if(c>>>0<=10){F[a+11|0]=I[a+11|0]&128|c;F[a+11|0]=I[a+11|0]&127;yb(a,b,c);F[d+15|0]=0;F[a+c|0]=I[d+15|0];break a}e=a;a=I[a+11|0]&127;Gd(e,10,c-10|0,a,a,c,b)}ca=d+16|0}function Rj(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;e=c>>>16|0;f=a>>>16|0;j=N(e,f);g=c&65535;h=a&65535;i=N(g,h);f=(i>>>16|0)+N(f,g)|0;e=(f&65535)+N(e,h)|0;da=(N(b,c)+j|0)+N(a,d)+(f>>>16)+(e>>>16)|0;return i&65535|e<<16}function Dd(a,b,c){var d=0;d=H[a+16>>2];if(!d){H[a+36>>2]=1;H[a+24>>2]=c;H[a+16>>2]=b;return}a:{if((b|0)==(d|0)){if(H[a+24>>2]!=2){break a}H[a+24>>2]=c;return}F[a+54|0]=1;H[a+24>>2]=2;H[a+36>>2]=H[a+36>>2]+1}}function th(){var a=0;a=Eb(pa(96));H[a+64>>2]=0;H[a+68>>2]=0;H[a+88>>2]=0;H[a+72>>2]=0;H[a+76>>2]=0;F[a+77|0]=0;F[a+78|0]=0;F[a+79|0]=0;F[a+80|0]=0;F[a+81|0]=0;F[a+82|0]=0;F[a+83|0]=0;F[a+84|0]=0;return a|0}function zi(a,b){a=a|0;b=b|0;var c=0,d=0;H[b>>2]=2;c=H[b+8>>2];d=H[b+12>>2]-c|0;if(d>>>0<=4294967291){kc(b+8|0,d+4|0);c=H[b+8>>2]}b=c+d|0;a=H[a+4>>2];F[b|0]=a;F[b+1|0]=a>>>8;F[b+2|0]=a>>>16;F[b+3|0]=a>>>24}function rj(a){a=a|0;var b=0;H[a>>2]=5580;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function ib(a,b,c,d,e){var f=0;f=ca-256|0;ca=f;if(!(e&73728|(c|0)<=(d|0))){d=c-d|0;c=d>>>0<256;ra(f,b&255,c?d:256);if(!c){while(1){Ab(a,f,256);d=d-256|0;if(d>>>0>255){continue}break}}Ab(a,f,d)}ca=f+256|0}function Ij(a){a=a|0;var b=0;H[a>>2]=3564;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Ch(a){a=a|0;var b=0,c=0,d=0;b=H[a+8>>2];d=H[a+12>>2];if((b|0)==(d|0)){return 1}while(1){c=H[b>>2];c=ea[H[H[c>>2]+16>>2]](c,H[a+32>>2])|0;if(c){b=b+4|0;if((d|0)!=(b|0)){continue}}break}return c|0}function Yd(a,b){var c=0,d=0;c=H[a+8>>2];a=H[a+12>>2];if((c|0)!=(a|0)){a=a-c>>2;d=a>>>0<=1?1:a;a=0;while(1){if(H[H[(a<<2)+c>>2]+60>>2]==(b|0)){return a}a=a+1|0;if((d|0)!=(a|0)){continue}break}}return-1}function qj(a){a=a|0;var b=0;H[a>>2]=5580;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Hj(a){a=a|0;var b=0;H[a>>2]=3564;b=H[a+96>>2];if(b){oa(b)}b=H[a+84>>2];if(b){oa(b)}b=H[a+72>>2];if(b){oa(b)}b=H[a+60>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function $d(a,b,c){var d=0,e=0;d=a+4|0;a=nb(a,b);a:{if((d|0)==(a|0)){break a}b=H[a+32>>2];d=H[a+28>>2];if((b|0)==(d|0)){break a}Cc(c,b-d|0);c=Dc(c);b=H[a+28>>2];qa(c,b,H[a+32>>2]-b|0);e=1}return e}function Qf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=ca-16|0;ca=e;a=_(H[a+60>>2],b|0,c|0,d&255,e+8|0)|0;if(a){H[3992]=a;a=-1}else{a=0}ca=e+16|0;da=a?-1:H[e+12>>2];return(a?-1:H[e+8>>2])|0}function Sd(a){var b=0;b=H[a+72>>2];H[a+72>>2]=b-1|b;b=H[a>>2];if(b&8){H[a>>2]=b|32;return-1}H[a+4>>2]=0;H[a+8>>2]=0;b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];return 0}function Eb(a){H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+40>>2]=0;H[a+44>>2]=0;H[a+28>>2]=9;F[a+24|0]=1;H[a+56>>2]=-1;H[a+60>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+48>>2]=0;H[a+52>>2]=0;return a}function hf(a,b){a=a|0;b=b|0;var c=0,d=0;d=H[a+16>>2];c=0;a:{if(H[a+20>>2]-d>>2<=(b|0)){break a}b=H[(b<<2)+d>>2];c=0;if((b|0)<0){break a}c=rb(H[H[a+36>>2]+(b<<2)>>2])}return c|0}function Mg(){var a=0,b=0;a=pa(40);H[a+4>>2]=0;H[a+8>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;b=a+16|0;H[b>>2]=0;H[b+4>>2]=0;H[a>>2]=a+4;H[a+12>>2]=b;H[a+32>>2]=0;H[a+36>>2]=0;return a|0}function Vf(a,b){a=a|0;b=b|0;var c=0,d=0;Wd(a,b);a:{if((b|0)<0){break a}d=H[a+88>>2];c=H[a+84>>2];if(d-c>>2<=(b|0)){break a}c=(b<<2)+c|0;b=c+4|0;va(c,b,d-b|0);H[a+88>>2]=d-4}}function Rh(a){a=a|0;var b=0;H[a+8>>2]=12804;H[a>>2]=12640;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function Lh(a){a=a|0;var b=0;H[a+8>>2]=11872;H[a>>2]=12932;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12124;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}return a|0}function zb(a){var b=0,c=0;b=H[3958];c=a+7&-8;a=b+c|0;a:{if(a>>>0<=b>>>0?c:0){break a}if(a>>>0>fa()<<16>>>0){if(!($(a|0)|0)){break a}}H[3958]=a;return b}H[3992]=48;return-1}function bj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;H[a+4>>2]=b;b=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=b;a=H[a+8>>2];if(I[a+24|0]==3){d=H[a+28>>2]==9}return d|0}function wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=H[a+8>>2];a:{if(!I[d+24|0]){break a}if(!mb(d,H[b+4>>2]-H[b>>2]>>2)){break a}e=ea[H[H[a>>2]+32>>2]](a,b,c)|0}return e|0}function Qh(a){a=a|0;var b=0;H[a+8>>2]=12804;H[a>>2]=12640;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12620;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function Kh(a){a=a|0;var b=0;H[a+8>>2]=11872;H[a>>2]=12932;b=H[a+56>>2];if(b){H[a+60>>2]=b;oa(b)}H[a+8>>2]=12124;b=H[a+44>>2];if(b){oa(b)}b=H[a+32>>2];if(b){oa(b)}oa(a)}function nj(a){a=a|0;var b=0;H[a>>2]=5816;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Ra(a,b){if(b){Ra(a,H[b>>2]);Ra(a,H[b+4>>2]);a=H[b+28>>2];H[b+28>>2]=0;if(a){Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Gi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;H[a+4>>2]=b;d=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=d;return H[H[H[H[b+4>>2]+8>>2]+(c<<2)>>2]+28>>2]==9|0}function Ej(a){a=a|0;var b=0;H[a>>2]=3812;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Vc(a){H[a+40>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;H[a>>2]=13280;H[a+12>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;H[a+32>>2]=0;G[a+36>>1]=0;return a}function Hd(a,b){var c=0,d=0,e=0,f=0;H[a>>2]=15260;H[a>>2]=15372;c=Ma(b);d=pa(c+13|0);H[d+8>>2]=0;H[d+4>>2]=c;H[d>>2]=c;e=a,f=qa(d+12|0,b,c+1|0),H[e+4>>2]=f;return a}function jg(a,b){a=a|0;b=b|0;var c=0;a:{if(!(ea[H[H[a>>2]+36>>2]](a,b)|0)){break a}if(!(ea[H[H[a>>2]+40>>2]](a,b)|0)){break a}c=ea[H[H[a>>2]+44>>2]](a)|0}return c|0}function mj(a){a=a|0;var b=0;H[a>>2]=5816;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Dj(a){a=a|0;var b=0;H[a>>2]=3812;b=H[a+76>>2];if(b){oa(b)}b=H[a+68>>2];H[a+68>>2]=0;if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Xe(a){a=a|0;var b=0;a:{if(!H[a- -64>>2]|!H[a+68>>2]|(!H[a+44>>2]|!H[a+48>>2])){break a}if(!H[a+52>>2]|!H[a+56>>2]){break a}b=H[a+92>>2]!=-1}return b|0}function cf(a){a=a|0;var b=0;H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Pj(a,b){a=a|0;b=b|0;var c=0;b=H[b+88>>2];if(!(!b|H[b>>2]!=2)){c=a;a=H[b+8>>2];H[c+4>>2]=I[a|0]|I[a+1|0]<<8|(I[a+2|0]<<16|I[a+3|0]<<24);c=1}return c|0}function tc(a){a=a|0;var b=0;a:{if(!H[a+48>>2]|!H[a+52>>2]|(!H[a+28>>2]|!H[a+32>>2])){break a}if(!H[a+36>>2]|!H[a+40>>2]){break a}b=H[a+76>>2]!=-1}return b|0}function Sh(a){a=a|0;var b=0;H[a>>2]=12804;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function He(a){a=a|0;var b=0;H[a>>2]=11872;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function bf(a){a=a|0;var b=0;H[a>>2]=2448;b=H[a+20>>2];H[a+20>>2]=0;if(b){ea[H[H[b>>2]+4>>2]](b)}H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function wh(){var a=0,b=0;b=pa(40);H[b>>2]=-1;a=b+8|0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;return b|0}function gf(a,b){a=a|0;b=b|0;var c=0,d=0;d=H[a+4>>2];a:{if(d){c=1;if(I[d+36|0]<2){break a}}c=ea[H[H[a>>2]+48>>2]](a,H[b+4>>2]-H[b>>2]>>2)|0}return c|0}function ci(a){a=a|0;var b=0;H[a>>2]=11872;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Mh(a){a=a|0;var b=0;H[a>>2]=12804;b=H[a+48>>2];if(b){H[a+52>>2]=b;oa(b)}H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Ha(a){H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+32>>2]=0;H[a+24>>2]=0;H[a+28>>2]=0;G[a+38>>1]=0;F[a+36|0]=0;return a}function Hf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Ya(a,H[b+8>>2],f)){Cd(b,c,d,e);return}a=H[a+8>>2];ea[H[H[a>>2]+20>>2]](a,b,c,d,e,f)}function Ei(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(I[H[a+4>>2]+36|0]>=2){b=0;if(!(ea[H[H[a>>2]+52>>2]](a)|0)){break a}}b=Xc(a+24|0,H[a+16>>2])}return b|0}function Fi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a:{if(I[H[a+4>>2]+36|0]<=1){d=0;if(!(ea[H[H[a>>2]+52>>2]](a)|0)){break a}}d=nd(a,b,c)}return d|0}function gh(){var a=0;a=_d(pa(108));H[a+84>>2]=0;H[a+88>>2]=0;H[a>>2]=13664;H[a+92>>2]=0;H[a+96>>2]=0;H[a+100>>2]=0;H[a+104>>2]=0;return a|0}function Zd(a,b){var c=0;c=-1;a:{if((b|0)==-1|(b|0)>4){break a}b=N(b,12)+a|0;a=H[b+20>>2];if((H[b+24>>2]-a|0)<=0){break a}c=H[a>>2]}return c}function lc(a,b,c,d,e,f,g){H[a>>2]=0;H[a+56>>2]=b;H[a+48>>2]=0;H[a+52>>2]=0;H[a+40>>2]=f;H[a+44>>2]=g;F[a+32|0]=e;H[a+28>>2]=d;F[a+24|0]=c}function aj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;a:{if(I[H[a+4>>2]+36|0]<=1){d=0;if(!xc(a+24|0,H[a+8>>2],c)){break a}}d=nd(a,b,c)}return d|0}function $i(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(I[H[a+4>>2]+36|0]>=2){b=0;if(!xc(a+24|0,rb(a),c)){break a}}b=Xc(a+24|0,H[a+16>>2])}return b|0}function Yf(a){a=a|0;var b=0;H[a>>2]=13664;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}return _b(a)|0}function Dc(a){var b=0;if(I[a+11|0]>>>7|0){b=H[a+4>>2]}else{b=I[a+11|0]&127}if(!b){af(1232);v()}if(I[a+11|0]>>>7|0){a=H[a>>2]}return a}function Xf(a){a=a|0;var b=0;H[a>>2]=13664;b=H[a+96>>2];if(b){H[a+100>>2]=b;oa(b)}b=H[a+84>>2];if(b){H[a+88>>2]=b;oa(b)}oa(_b(a))}function zj(a){a=a|0;var b=0;H[a>>2]=4040;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function jj(a){a=a|0;var b=0;H[a>>2]=6032;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function Qa(a,b){if(b){Qa(a,H[b>>2]);Qa(a,H[b+4>>2]);a=H[b+28>>2];if(a){H[b+32>>2]=a;oa(a)}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Vg(){var a=0;a=pa(28);H[a>>2]=0;H[a+4>>2]=0;H[a+24>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0;return a|0}function wg(a){a=a|0;var b=0;H[a>>2]=1984;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a+4>>2];if(b){H[a+8>>2]=b;oa(b)}return a|0}function eh(){var a=0,b=0;a=pa(24);H[a+4>>2]=0;H[a+8>>2]=0;b=a+16|0;H[b>>2]=0;H[b+4>>2]=0;H[a>>2]=a+4;H[a+12>>2]=b;return a|0}function Kf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Ya(a,H[b+8>>2],0)){Dd(b,c,d);return}a=H[a+8>>2];ea[H[H[a>>2]+28>>2]](a,b,c,d)}function yj(a){a=a|0;var b=0;H[a>>2]=4040;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function ij(a){a=a|0;var b=0;H[a>>2]=6032;b=H[a+76>>2];if(b){oa(b)}H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function pa(a){var b=0;a=a?a:1;a:{while(1){b=Ec(a);if(b){break a}b=H[4422];if(b){ea[b|0]();continue}break}X();v()}return b}function Kb(a,b){if(b){Kb(a,H[b>>2]);Kb(a,H[b+4>>2]);if(F[b+39|0]<0){oa(H[b+28>>2])}if(F[b+27|0]<0){oa(H[b+16>>2])}oa(b)}}function Ad(a){a=a|0;var b=0,c=0;H[a>>2]=15372;b=H[a+4>>2]-12|0;c=H[b+8>>2]-1|0;H[b+8>>2]=c;if((c|0)<0){oa(b)}return a|0}function lh(){var a=0;a=pa(24);H[a+8>>2]=0;H[a+12>>2]=0;H[a+4>>2]=-1;H[a>>2]=1832;H[a+16>>2]=0;H[a+20>>2]=0;return a|0}function pd(a,b,c){a=a|0;b=b|0;c=c|0;H[a+4>>2]=b;b=H[H[H[b+4>>2]+8>>2]+(c<<2)>>2];H[a+12>>2]=c;H[a+8>>2]=b;return 1}function wc(a){a=a|0;var b=0;if(!(!H[a+60>>2]|!H[a+44>>2]|(!H[a+48>>2]|!H[a+52>>2]))){b=H[a+56>>2]!=0}return b|0}function Id(a,b){if(I[a+11|0]>>>7|0){H[a+4>>2]=b;return}F[a+11|0]=I[a+11|0]&128|b;F[a+11|0]=I[a+11|0]&127}function wj(a){a=a|0;var b=0;H[a>>2]=4276;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function fj(a){a=a|0;var b=0;H[a>>2]=6256;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function bi(a){a=a|0;var b=0;H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function Uh(a){a=a|0;var b=0;H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}return a|0}function lg(a){a=a|0;if(a){if(F[a+39|0]<0){oa(H[a+28>>2])}Oc(a+12|0,H[a+16>>2]);Kb(a,H[a+4>>2]);oa(a)}}function Pb(a){a=a|0;var b=0;if(!(!H[a+52>>2]|(!H[a+44>>2]|!H[a+48>>2]))){b=H[a+56>>2]!=0}return b|0}function vj(a){a=a|0;var b=0;H[a>>2]=4276;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function vc(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|!b|I[b+24|0]!=3)){H[a+60>>2]=b;c=1}return c|0}function ej(a){a=a|0;var b=0;H[a>>2]=6256;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function ai(a){a=a|0;var b=0;H[a>>2]=12124;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function Th(a){a=a|0;var b=0;H[a>>2]=12620;b=H[a+36>>2];if(b){oa(b)}b=H[a+24>>2];if(b){oa(b)}oa(a)}function xh(a,b,c){a=a|0;b=b|0;c=c|0;H[a+16>>2]=0;H[a+20>>2]=0;H[a>>2]=b;H[a+8>>2]=c;H[a+12>>2]=0}function We(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|I[b+24|0]!=3)){H[a- -64>>2]=b;c=1}return c|0}function yc(a){var b=0;b=H[a+16>>2];if(b){H[a+20>>2]=b;oa(b)}b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}}function sc(a,b){a=a|0;b=b|0;var c=0;if(!(H[b+56>>2]|I[b+24|0]!=3)){H[a+48>>2]=b;c=1}return c|0}function Gf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(Ya(a,H[b+8>>2],f)){Cd(b,c,d,e)}}function wa(){var a=0;a=Bc(4);H[a>>2]=15260;H[a>>2]=15220;H[a>>2]=15240;Y(a|0,15352,14);v()}function sf(a){a=a|0;var b=0;H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}return a|0}function Kj(a){a=a|0;var b=0;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}return a|0}function mi(a){a=a|0;var b=0;H[a>>2]=1832;b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}return a|0}function Ci(a){a=a|0;var b=0;b=rb(a);return Je(a+24|0,b?b:H[a+8>>2],H[H[a+4>>2]+32>>2])|0}function rf(a){a=a|0;var b=0;H[a>>2]=2232;b=H[a+16>>2];H[a+16>>2]=0;if(b){Ga(b)}oa(a)}function ji(a){a=a|0;var b=0;H[a>>2]=1832;b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)} -function Ub(a){a=a|0;var b=0;H[a>>2]=3272;b=H[a+32>>2];if(b){H[a+36>>2]=b;oa(b)}oa(a)}function Za(a){var b=0;H[a+16>>2]=0;b=H[a>>2];H[a+4>>2]=b;H[a+12>>2]=b;if(b){oa(b)}}function Oc(a,b){if(b){Oc(a,H[b>>2]);Oc(a,H[b+4>>2]);Kb(b+20|0,H[b+24>>2]);oa(b)}}function wi(a){a=a|0;if(!H[a+44>>2]){return 0}return ea[H[H[a>>2]+48>>2]](a)|0}function vh(a){a=a|0;var b=0;if(a){b=H[a+8>>2];if(b){H[a+12>>2]=b;oa(b)}oa(a)}}function Uj(a){var b=0;while(1){if(a){a=a-1&a;b=b+1|0;continue}break}return b}function Lf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(Ya(a,H[b+8>>2],0)){Dd(b,c,d)}}function ui(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+20>>2]](a,b)|0}function ni(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+12>>2]](a,b)|0}function li(a,b){a=a|0;b=b|0;a=H[a+48>>2];return ea[H[H[a>>2]+16>>2]](a,b)|0}function lb(){var a=0;a=pa(12);H[a>>2]=0;H[a+4>>2]=0;H[a+8>>2]=0;return a|0}function kb(a){a=a|0;var b=0;if(a){b=H[a>>2];if(b){H[a+4>>2]=b;oa(b)}oa(a)}}function Vj(a){var b=0;b=a&31;a=0-a&31;return(-1>>>b&-2)<>>a} -function dh(a,b,c){a=a|0;b=b|0;c=c|0;H[a+32>>2]=c;H[a+28>>2]=b;return 1}function ch(a){a=a|0;if(a){Ra(a+12|0,H[a+16>>2]);Qa(a,H[a+4>>2]);oa(a)}}function Rd(a,b,c){a:{if(H[c+76>>2]<0){a=Fc(a,b,c);break a}a=Fc(a,b,c)}}function Mb(a,b){a=a|0;b=b|0;if(b>>>0<=1){H[a+28>>2]=b}return b>>>0<2|0}function Fh(a,b){a=a|0;b=b|0;F[b+84|0]=1;H[b+72>>2]=H[b+68>>2];return 1}function si(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+24>>2]](a)|0}function ri(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+28>>2]](a)|0}function oi(a){a=a|0;a=H[a+48>>2];return ea[H[H[a>>2]+36>>2]](a)|0}function ih(){var a=0;a=pa(8);H[a+4>>2]=-1;H[a>>2]=1032;return a|0}function Gg(a,b,c){a=a|0;b=b|0;c=c|0;return H[H[b+8>>2]+(c<<2)>>2]}function _i(a,b){a=a|0;b=b|0;return Fd(a+24|0,rb(a),H[a+8>>2])|0}function Bi(a,b){a=a|0;b=b|0;return Re(a+24|0,rb(a),H[a+8>>2])|0}function xf(a,b){a=a|0;b=b|0;H[a+12>>2]=-1;H[a+8>>2]=b;return 1}function ne(a,b){a=a|0;b=b|0;return ea[H[H[a>>2]+12>>2]](a,b)|0}function Ff(a){a=a|0;if(!a){return 0}return(Ed(a,15068)|0)!=0|0}function Di(a,b){a=a|0;b=b|0;return ea[H[H[a>>2]+56>>2]](a,b)|0}function $g(a){a=a|0;if(a){if(F[a+15|0]<0){oa(H[a+4>>2])}oa(a)}}function kh(a,b){a=a|0;b=b|0;return O(L[H[a+8>>2]+(b<<2)>>2])}function af(a){a=Hd(Bc(8),a);H[a>>2]=15472;Y(a|0,15504,1);v()}function Ue(a){a=Hd(Bc(8),a);H[a>>2]=15420;Y(a|0,15452,1);v()}function _g(a,b){a=a|0;b=b|0;return O(L[H[a>>2]+(b<<2)>>2])}function fh(a){a=a|0;return(H[a+100>>2]-H[a+96>>2]|0)/12|0}function ah(a){a=a|0;return(F[a+15|0]<0?H[a+4>>2]:a+4|0)|0}function _f(a,b){a=a|0;b=b|0;return H[H[a+4>>2]+(b<<2)>>2]}function Pf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;da=0;return 0}function Ke(a){a=Vc(a);H[a+44>>2]=0;H[a>>2]=11180;return a}function ie(a,b){a=a|0;b=b|0;return H[H[a>>2]+(b<<2)>>2]}function Xg(a,b){a=a|0;b=b|0;return G[H[a>>2]+(b<<1)>>1]}function Wg(a,b){a=a|0;b=b|0;return J[H[a>>2]+(b<<1)>>1]}function Zb(a,b){var c=0;c=pa(b);H[a+4>>2]=b;H[a>>2]=c}function Jg(a,b,c){a=a|0;b=b|0;c=c|0;return Zd(b,c)|0}function _d(a){H[a>>2]=13724;ra(a+4|0,0,80);return a}function me(a){a=a|0;return H[a+12>>2]-H[a+8>>2]>>2}function Qj(a){if(a){return 31-Q(a-1^a)|0}return 32}function cc(a){a=a|0;if(a){ea[H[H[a>>2]+4>>2]](a)}}function Zg(a,b){a=a|0;b=b|0;return F[H[a>>2]+b|0]}function Yg(a,b){a=a|0;b=b|0;return I[H[a>>2]+b|0]}function Uf(a){a=a|0;return H[a+8>>2]-H[a+4>>2]>>2}function jd(a,b){a=a|0;b=b|0;H[a+4>>2]=b;return 1}function je(a){a=a|0;return H[a+4>>2]-H[a>>2]>>1}function Qc(a){a=a|0;return H[a+4>>2]-H[a>>2]>>2}function le(a){a=a|0;return H[a+4>>2]-H[a>>2]|0}function Ab(a,b,c){if(!(I[a|0]&32)){Fc(b,c,a)}}function vf(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function hi(a,b){a=a|0;b=b|0;return I[b+24|0]}function Pg(a,b){a=a|0;b=b|0;return H[b+8>>2]}function Nj(a){a=a|0;return I[H[a+8>>2]+24|0]}function Li(a){a=a|0;H[a>>2]=10032;return a|0}function Eg(a,b){a=a|0;b=b|0;return H[b+4>>2]}function Yi(a){a=a|0;H[a>>2]=7144;return a|0}function Ui(a){a=a|0;H[a>>2]=8080;return a|0}function Sf(a){a=a|0;return aa(H[a+60>>2])|0}function Pi(a){a=a|0;H[a>>2]=9028;return a|0}function jh(a){a=a|0;return O(L[a+20>>2])}function Ji(a){a=a|0;H[a>>2]=10032;oa(a)}function Xi(a){a=a|0;H[a>>2]=7144;oa(a)}function Si(a){a=a|0;H[a>>2]=8080;oa(a)}function Oi(a){a=a|0;H[a>>2]=9028;oa(a)}function sh(a){a=a|0;return H[a+88>>2]}function rh(a){a=a|0;return H[a+56>>2]}function oh(a){a=a|0;return H[a+40>>2]}function nh(a){a=a|0;return H[a+48>>2]}function mh(a){a=a|0;return H[a+60>>2]}function eb(a){a=a|0;return H[a+28>>2]}function df(){H[4292]=17048;H[4274]=42}function Rc(a){a=a|0;return H[a+80>>2]}function qh(a){a=a|0;return F[a+24|0]}function ph(a){a=a|0;return I[a+32|0]}function md(a,b){a=a|0;b=b|0;return-1}function db(a){a=a|0;return H[a+4>>2]}function bh(a){a=a|0;return!H[a>>2]|0}function _e(a,b){a=a|0;b=b|0;return 6}function Zc(a){a=a|0;return H[a+8>>2]}function Pd(a,b){a=a|0;b=b|0;return 1}function Ja(a,b){a=a|0;b=b|0;return 0}function Bj(a,b){a=a|0;b=b|0;return 2}function Bc(a){return Ec(a+80|0)+80|0}function pe(a){a=a|0;return H[a>>2]}function yh(){return Ha(pa(40))|0}function uh(){return Eb(pa(64))|0}function hh(){return _d(pa(84))|0}function Sc(a){a=a|0;if(a){oa(a)}}function zc(a){a=a|0;Ad(a);oa(a)}function Ef(a){a=a|0;return 1171}function Df(a){a=a|0;return 1245}function Cf(a){a=a|0;return 1211}function Ta(a){a=a|0;return a|0}function yf(a){a=a|0;oa(rd(a))}function fi(a){a=a|0;oa(Be(a))}function ei(a){a=a|0;oa(Ae(a))}function di(a){a=a|0;oa(ze(a))}function Tf(a){a=a|0;oa(_b(a))}function ld(a){a=a|0;return 3}function _a(a){a=a|0;return 0}function Ze(a){a=a|0;return 5}function Tb(a){a=a|0;return 2}function Ob(a){a=a|0;return 6}function Da(a){a=a|0;return 1}function $e(a){a=a|0;return 4}function sa(){Ue(1164);v()}function Na(){Ue(1232);v()}function La(a){a=a|0;oa(a)}function Ca(){af(1164);v()}function fb(a){a=a|0;v()}function eg(){return 10}function dg(){return 11}function cg(){return 12}function kg(){return 5}function ig(){return 6}function hg(){return 7}function gg(){return 8}function fg(){return 9}function fe(){return 3}function ee(){return 4}function bg(){return-2}function bc(){return-1}function ag(){return-3}function ac(){return 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Da,wi,Dh,Ch,Da,_a,Ja,Ja,qi,pi,ti,ui,ri,oi,ni,li,si,Be,fi,jd,id,hd,gd,ki,Da,db,Zc,Ae,ei,jd,id,hd,gd,ii,Da,db,Zc,ze,di,jd,id,hd,gd,gi,Da,db,Zc,He,ci,Ie,bi,ai,Zh,Yh,Xh,Wh,_h,Vh,$h,Uh,Th,Rh,Qh,Ph,Oh,Sh,Mh,Lh,Kh,Jh,Ih,Wc,ve,Hh,Ta,La,Fh,Eh,fb,_a,Da,Wc,Ah,Bh,Wc,ve,zh,Yf,Xf,Wf,Vf,_b,Tf,Xd,Wd,Sf,Rf,Qf,_a,Pf,Ta,La,Td,Td,Mf,Gf,If,Lf,La,Hf,Jf,Kf,La,Df,La,Cf,La,Ef,zc,db,zc,zc]);function fa(){return E.byteLength/65536|0}function ka(la){la=la|0;var ga=fa()|0;var ha=ga+la|0;if(ga=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}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 lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;assert(INITIAL_MEMORY>=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+INITIAL_MEMORY+"! (STACK_SIZE="+65536+")");if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2147483648/65536})}updateMemoryViews();INITIAL_MEMORY=wasmMemory.buffer.byteLength;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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 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 addOnInit(cb){__ATINIT__.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()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="draco_decoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}var binary=tryParseAsDataURI(file);if(binary){return binary}if(readBinary){return readBinary(file)}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":wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["j"];addOnInit(Module["asm"]["i"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).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)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){var b=wasmMemory.buffer;try{wasmMemory.grow(size-b.byteLength+65535>>>16);updateMemoryViews();return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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={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}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob=="function"?atob:function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();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()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret},copy:function(array,view,offset){offset>>>=0;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offset>>>=1;break;case 4:offset>>>=2;break;case 8:offset>>>=3;break}for(var i=0;i^Ig9e8Ug#nS8>iD7rsl0yBhPOx%^kHo`P`EC3?T<77XZG}`Vl^@P+#6yDSw)CWS z+!ObN8UF4KE&jeZH2HgDnB(s^0{5Qy68rno&?@d|ysnW#QOv|x%%n!E6=wLALW(5M zv|5cuH?*1!CB;NiNJY_Wq;`yrMk~ZtOfj{nr&WZa+fZU`h0ty^LTYqdR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SU;1-RgQt0sBw;-L@hmz`D<>%G9?}ugB+0|i+^hl(K1#k%k-~TSR`*BAe~dIm znohs%?@J+-VBW{c|I}6THE)mBty`xeL{#`Qqfg2G*83Ihyf3u3(8;zE7R$C~UY4R} zeWNdHKlUZ!fIHI<+L!6^GC`zGkJ}>t?Tl)_N4{J~RQofot5+$%{nOTApYkv7-uD;e zDN`ob)ysKN)IU*M+4Ar&?|wshR#G0Vi1 zXk#3BnCqe>uB$OHJNNsjt;;g-FYo?AdDcX=cYT>j-o9FI?4LFa?)>pD|M&F|3=VDG zHaxPuw)5&;*IcVNng<1vz$qFnPy!5Vq&lqnr2Io+Y##LpI_8ZI2{ey!rmlH$OA@$_ zw1;#f>1NVfNu#7O(p{v(qgh!S4qD~V$xi&_P&$4X1DphJZseMkMca*_D^s>yZxWznf}^I2T5OK5X!H@%KqKC zXvfaw(di#}e-!=USDT_w|FA%8e|>#@{e1&{gMCANTl=>44fl=oZSU{v@9!VzAM79M z-`c;ef4G07fBQh+K>xtNz~I2pz}A6n1H%I&1KS7t2KxsG1_uX+2Dc7w8yp@S8Qeb9 zH`G5gFf=$cG_-YS+tBdP$k6t!eOvpt4s0FVI<$4`)@@sdw~lPxzO8Rt|F(f`gWHC- zZQZtQ+wiuLZQFQ+(e72oOH}v=I-+$n~`$q2=zqh}C+y4F2caPt*Uy(ig$B*1Od5tv2|neg0v-ofw^-uKz&!Zzca;(wzK9@4&}yZvF=w=HI@5|4{|pj7?>~Q29@(JtX~| z;QCG`;J1>#jdX%^l5~o6Kj}0{f4B3U@_jogo9{cg|4z~aq`LMF0GsLYMqM|NY{FX`r)?PoIhlzJ~|;`LGOE6PD^;RAmcm0FGZi2&A~;Z`3$%QgQFKKv3t jI`!dwO0TC5&f<9B@5#l>$GA4>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=3)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename)}return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));process["on"]("unhandledRejection",(function(reason,p){process["exit"](1)}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){var data=tryParseAsDataURI(f);if(data){return intArrayToString(data)}return read(f)}}Module["readBinary"]=function readBinary(f){var data;data=tryParseAsDataURI(f);if(data){return data}if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=(function(title){document.title=title})}Module["print"]=typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null;Module["printErr"]=typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||Module["print"];Module.print=Module["print"];Module.printErr=Module["printErr"];for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var STACK_ALIGN=16;function staticAlloc(size){assert(!staticSealed);var ret=STATICTOP;STATICTOP=STATICTOP+size+15&-16;return ret}function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;var ret=size=Math.ceil(size/factor)*factor;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;Module.printErr(text)}}var jsCallStartIndex=1;var functionPointers=new Array(0);var funcWrappers={};function dynCall(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}var GLOBAL_BASE=8;var ABORT=0;var EXITSTATUS=0;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}var JSfuncs={"stackSave":(function(){stackSave()}),"stackRestore":(function(){stackRestore()}),"arrayToC":(function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(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})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};function ccall(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var ALLOC_STATIC=2;var ALLOC_NONE=4;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:staticAlloc,stackAlloc,staticAlloc,dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return UTF8ToString(ptr)}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,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 if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}var WASM_PAGE_SIZE=65536;var ASMJS_PAGE_SIZE=16777216;var MIN_TOTAL_MEMORY=16777216;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 updateGlobalBuffer(buf){Module["buffer"]=buffer=buf}function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}if(!Module["reallocBuffer"])Module["reallocBuffer"]=(function(size){var ret;try{if(ArrayBuffer.transfer){ret=ArrayBuffer.transfer(buffer,size)}else{var oldHEAP8=HEAP8;ret=new ArrayBuffer(size);var temp=new Int8Array(ret);temp.set(oldHEAP8)}}catch(e){return false}var success=_emscripten_replace_memory(ret);if(!success)return false;return ret});function enlargeMemory(){var PAGE_MULTIPLE=Module["usingWasm"]?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE;var LIMIT=2147483648-PAGE_MULTIPLE;if(HEAP32[DYNAMICTOP_PTR>>2]>LIMIT){return false}var OLD_TOTAL_MEMORY=TOTAL_MEMORY;TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);while(TOTAL_MEMORY>2]){if(TOTAL_MEMORY<=536870912){TOTAL_MEMORY=alignUp(2*TOTAL_MEMORY,PAGE_MULTIPLE)}else{TOTAL_MEMORY=Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,PAGE_MULTIPLE),LIMIT)}}var replacement=Module["reallocBuffer"](TOTAL_MEMORY);if(!replacement||replacement.byteLength!=TOTAL_MEMORY){TOTAL_MEMORY=OLD_TOTAL_MEMORY;return false}updateGlobalBuffer(replacement);updateGlobalBufferViews();return true}var byteLength;try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get);byteLength(new ArrayBuffer(4))}catch(e){byteLength=(function(buffer){return buffer.byteLength})}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;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 ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}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 addOnPreMain(cb){__ATMAIN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_max=Math.max;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;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"]={};var memoryInitializer=null;var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}STATIC_BASE=GLOBAL_BASE;STATICTOP=STATIC_BASE+18640;__ATINIT__.push();memoryInitializer="data:application/octet-stream;base64,vBoAACwbAADkGgAAehsAACAAAAAAAAAAvBoAAKEbAADkGgAAvhsAACAAAAAAAAAAvBoAAOcbAADkGgAAAxwAADgAAAAAAAAAvBoAACUcAADkGgAAShwAADgAAAAAAAAA5BoAAI4mAABQAAAAAAAAAOQaAAB6HAAAiAAAAAAAAADkGgAA0xwAAJgAAAAAAAAA5BoAACcdAACoAAAAAAAAAOQaAABbHQAAuAAAAAAAAAC8GgAAhh0AAOQaAACqHQAA0AAAAAAAAAC8GgAASB4AAOQaAADmHgAA6AAAAAAAAADkGgAAfh8AAIgAAAAAAAAA5BoAAAcgAADoAAAAAAAAAOQaAAChIAAA6AAAAAAAAADkGgAARyEAAOgAAAAAAAAA5BoAAN0hAAA4AQAAAAAAALwaAACIIgAA5BoAADMjAABQAQAA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ate_exception(size){return _malloc(size)}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:(function(adjusted){if(!adjusted||EXCEPTIONS.infos[adjusted])return adjusted;for(var ptr in EXCEPTIONS.infos){var info=EXCEPTIONS.infos[ptr];if(info.adjusted===adjusted){return ptr}}return adjusted}),addRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount++}),decRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];assert(info.refcount>0);info.refcount--;if(info.refcount===0&&!info.rethrown){if(info.destructor){Module["dynCall_vi"](info.destructor,ptr)}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}}),clearRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0})};function ___cxa_begin_catch(ptr){var info=EXCEPTIONS.infos[ptr];if(info&&!info.caught){info.caught=true;__ZSt18uncaught_exceptionv.uncaught_exception--}if(info)info.rethrown=false;EXCEPTIONS.caught.push(ptr);EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(ptr));return ptr}function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(setTempRet0(0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(setTempRet0(0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(setTempRet0(typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(setTempRet0(throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);function ___gxx_personality_v0(){}var SYSCALLS={varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function flush_NO_FILESYSTEM(){var fflush=Module["_fflush"];if(fflush)fflush(0);var printChar=___syscall146.printChar;if(!printChar)return;var buffers=___syscall146.buffers;if(buffers[1].length)printChar(1,10);if(buffers[2].length)printChar(2,10)}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffers){___syscall146.buffers=[null,[],[]];___syscall146.printChar=(function(stream,curr){var buffer=___syscall146.buffers[stream];assert(buffer);if(curr===0||curr===10){(stream===1?Module["print"]:Module["printErr"])(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}})}for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=PTHREAD_SPECIFIC_NEXT_KEY;PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0;PTHREAD_SPECIFIC_NEXT_KEY++;return 0}function _pthread_once(ptr,func){if(!_pthread_once.seen)_pthread_once.seen={};if(ptr in _pthread_once.seen)return;Module["dynCall_v"](func);_pthread_once.seen[ptr]=1}function _pthread_setspecific(key,value){if(!(key in PTHREAD_SPECIFIC)){return ERRNO_CODES.EINVAL}PTHREAD_SPECIFIC[key]=value;return 0}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}DYNAMICTOP_PTR=staticAlloc(4);STACK_BASE=STACKTOP=alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;var ASSERTIONS=false;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function intArrayToString(array){var ret=[];for(var i=0;i255){if(ASSERTIONS){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.")}chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}var decodeBase64=typeof atob==="function"?atob:(function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i2147483648)return false;b=new a(newBuffer);d=new c(newBuffer);f=new e(newBuffer);h=new g(newBuffer);j=new i(newBuffer);l=new k(newBuffer);n=new m(newBuffer);p=new o(newBuffer);buffer=newBuffer;return true} -// EMSCRIPTEN_START_FUNCS -function wc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!a)return;b=a+-8|0;c=f[4516]|0;d=f[a+-4>>2]|0;a=d&-8;e=b+a|0;do if(!(d&1)){g=f[b>>2]|0;if(!(d&3))return;h=b+(0-g)|0;i=g+a|0;if(h>>>0>>0)return;if((f[4517]|0)==(h|0)){j=e+4|0;k=f[j>>2]|0;if((k&3|0)!=3){l=h;m=i;n=h;break}f[4514]=i;f[j>>2]=k&-2;f[h+4>>2]=i|1;f[h+i>>2]=i;return}k=g>>>3;if(g>>>0<256){g=f[h+8>>2]|0;j=f[h+12>>2]|0;if((j|0)==(g|0)){f[4512]=f[4512]&~(1<>2]=j;f[j+8>>2]=g;l=h;m=i;n=h;break}}g=f[h+24>>2]|0;j=f[h+12>>2]|0;do if((j|0)==(h|0)){k=h+16|0;o=k+4|0;p=f[o>>2]|0;if(!p){q=f[k>>2]|0;if(!q){r=0;break}else{s=q;t=k}}else{s=p;t=o}while(1){o=s+20|0;p=f[o>>2]|0;if(p|0){s=p;t=o;continue}o=s+16|0;p=f[o>>2]|0;if(!p)break;else{s=p;t=o}}f[t>>2]=0;r=s}else{o=f[h+8>>2]|0;f[o+12>>2]=j;f[j+8>>2]=o;r=j}while(0);if(g){j=f[h+28>>2]|0;o=18352+(j<<2)|0;if((f[o>>2]|0)==(h|0)){f[o>>2]=r;if(!r){f[4513]=f[4513]&~(1<>2]|0)!=(h|0)&1)<<2)>>2]=r;if(!r){l=h;m=i;n=h;break}}f[r+24>>2]=g;j=h+16|0;o=f[j>>2]|0;if(o|0){f[r+16>>2]=o;f[o+24>>2]=r}o=f[j+4>>2]|0;if(o){f[r+20>>2]=o;f[o+24>>2]=r;l=h;m=i;n=h}else{l=h;m=i;n=h}}else{l=h;m=i;n=h}}else{l=b;m=a;n=b}while(0);if(n>>>0>=e>>>0)return;b=e+4|0;a=f[b>>2]|0;if(!(a&1))return;if(!(a&2)){if((f[4518]|0)==(e|0)){r=(f[4515]|0)+m|0;f[4515]=r;f[4518]=l;f[l+4>>2]=r|1;if((l|0)!=(f[4517]|0))return;f[4517]=0;f[4514]=0;return}if((f[4517]|0)==(e|0)){r=(f[4514]|0)+m|0;f[4514]=r;f[4517]=n;f[l+4>>2]=r|1;f[n+r>>2]=r;return}r=(a&-8)+m|0;s=a>>>3;do if(a>>>0<256){t=f[e+8>>2]|0;c=f[e+12>>2]|0;if((c|0)==(t|0)){f[4512]=f[4512]&~(1<>2]=c;f[c+8>>2]=t;break}}else{t=f[e+24>>2]|0;c=f[e+12>>2]|0;do if((c|0)==(e|0)){d=e+16|0;o=d+4|0;j=f[o>>2]|0;if(!j){p=f[d>>2]|0;if(!p){u=0;break}else{v=p;w=d}}else{v=j;w=o}while(1){o=v+20|0;j=f[o>>2]|0;if(j|0){v=j;w=o;continue}o=v+16|0;j=f[o>>2]|0;if(!j)break;else{v=j;w=o}}f[w>>2]=0;u=v}else{o=f[e+8>>2]|0;f[o+12>>2]=c;f[c+8>>2]=o;u=c}while(0);if(t|0){c=f[e+28>>2]|0;h=18352+(c<<2)|0;if((f[h>>2]|0)==(e|0)){f[h>>2]=u;if(!u){f[4513]=f[4513]&~(1<>2]|0)!=(e|0)&1)<<2)>>2]=u;if(!u)break}f[u+24>>2]=t;c=e+16|0;h=f[c>>2]|0;if(h|0){f[u+16>>2]=h;f[h+24>>2]=u}h=f[c+4>>2]|0;if(h|0){f[u+20>>2]=h;f[h+24>>2]=u}}}while(0);f[l+4>>2]=r|1;f[n+r>>2]=r;if((l|0)==(f[4517]|0)){f[4514]=r;return}else x=r}else{f[b>>2]=a&-2;f[l+4>>2]=m|1;f[n+m>>2]=m;x=m}m=x>>>3;if(x>>>0<256){n=18088+(m<<1<<2)|0;a=f[4512]|0;b=1<>2]|0;z=b}f[z>>2]=l;f[y+12>>2]=l;f[l+8>>2]=y;f[l+12>>2]=n;return}n=x>>>8;if(n)if(x>>>0>16777215)A=31;else{y=(n+1048320|0)>>>16&8;z=n<>>16&4;b=z<>>16&2;a=14-(n|y|z)+(b<>>15)|0;A=x>>>(a+7|0)&1|a<<1}else A=0;a=18352+(A<<2)|0;f[l+28>>2]=A;f[l+20>>2]=0;f[l+16>>2]=0;z=f[4513]|0;b=1<>>1)|0);n=f[a>>2]|0;while(1){if((f[n+4>>2]&-8|0)==(x|0)){B=73;break}C=n+16+(y>>>31<<2)|0;m=f[C>>2]|0;if(!m){B=72;break}else{y=y<<1;n=m}}if((B|0)==72){f[C>>2]=l;f[l+24>>2]=n;f[l+12>>2]=l;f[l+8>>2]=l;break}else if((B|0)==73){y=n+8|0;t=f[y>>2]|0;f[t+12>>2]=l;f[y>>2]=l;f[l+8>>2]=t;f[l+12>>2]=n;f[l+24>>2]=0;break}}else{f[4513]=z|b;f[a>>2]=l;f[l+24>>2]=a;f[l+12>>2]=l;f[l+8>>2]=l}while(0);l=(f[4520]|0)+-1|0;f[4520]=l;if(!l)D=18504;else return;while(1){l=f[D>>2]|0;if(!l)break;else D=l+8|0}f[4520]=-1;return}function xc(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=Oa,F=Oa,G=Oa,H=0,I=0,J=0,K=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;e=i;j=i;while(1){k=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;e=(X(k>>>24^k,1540483477)|0)^(X(e,1540483477)|0);j=j+-4|0;if(j>>>0<=3)break;else d=d+4|0}d=i+-4|0;j=d&-4;l=d-j|0;m=g+(j+4)|0;o=e}else{l=i;m=g;o=i}switch(l|0){case 3:{p=h[m+2>>0]<<16^o;q=6;break}case 2:{p=o;q=6;break}case 1:{r=o;q=7;break}default:s=o}if((q|0)==6){r=h[m+1>>0]<<8^p;q=7}if((q|0)==7)s=X(r^h[m>>0],1540483477)|0;m=X(s>>>13^s,1540483477)|0;s=m>>>15^m;m=a+4|0;r=f[m>>2]|0;p=(r|0)==0;a:do if(!p){o=r+-1|0;l=(o&r|0)==0;if(!l)if(s>>>0>>0)t=s;else t=(s>>>0)%(r>>>0)|0;else t=s&o;e=f[(f[a>>2]|0)+(t<<2)>>2]|0;if((e|0)!=0?(j=f[e>>2]|0,(j|0)!=0):0){e=(i|0)==0;if(l){if(e){l=j;while(1){d=f[l+4>>2]|0;if(!((d|0)==(s|0)|(d&o|0)==(t|0))){u=t;break a}d=b[l+8+11>>0]|0;if(!((d<<24>>24<0?f[l+12>>2]|0:d&255)|0)){v=l;break}l=f[l>>2]|0;if(!l){u=t;break a}}w=v+20|0;return w|0}else x=j;b:while(1){l=f[x+4>>2]|0;if(!((l|0)==(s|0)|(l&o|0)==(t|0))){u=t;break a}l=x+8|0;d=b[l+11>>0]|0;k=d<<24>>24<0;y=d&255;do if(((k?f[x+12>>2]|0:y)|0)==(i|0)){d=f[l>>2]|0;if(k)if(!(Pk(d,g,i)|0)){v=x;q=63;break b}else break;if((b[g>>0]|0)==(d&255)<<24>>24){d=l;z=y;A=g;do{z=z+-1|0;d=d+1|0;if(!z){v=x;q=63;break b}A=A+1|0}while((b[d>>0]|0)==(b[A>>0]|0))}}while(0);x=f[x>>2]|0;if(!x){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}if(e){o=j;while(1){y=f[o+4>>2]|0;if((y|0)!=(s|0)){if(y>>>0>>0)B=y;else B=(y>>>0)%(r>>>0)|0;if((B|0)!=(t|0)){u=t;break a}}y=b[o+8+11>>0]|0;if(!((y<<24>>24<0?f[o+12>>2]|0:y&255)|0)){v=o;break}o=f[o>>2]|0;if(!o){u=t;break a}}w=v+20|0;return w|0}else C=j;c:while(1){o=f[C+4>>2]|0;if((o|0)!=(s|0)){if(o>>>0>>0)D=o;else D=(o>>>0)%(r>>>0)|0;if((D|0)!=(t|0)){u=t;break a}}o=C+8|0;e=b[o+11>>0]|0;y=e<<24>>24<0;l=e&255;do if(((y?f[C+12>>2]|0:l)|0)==(i|0)){e=f[o>>2]|0;if(y)if(!(Pk(e,g,i)|0)){v=C;q=63;break c}else break;if((b[g>>0]|0)==(e&255)<<24>>24){e=o;k=l;A=g;do{k=k+-1|0;e=e+1|0;if(!k){v=C;q=63;break c}A=A+1|0}while((b[e>>0]|0)==(b[A>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}else u=t}else u=0;while(0);t=dn(24)|0;dj(t+8|0,c);f[t+20>>2]=0;f[t+4>>2]=s;f[t>>2]=0;c=a+12|0;E=$(((f[c>>2]|0)+1|0)>>>0);F=$(r>>>0);G=$(n[a+16>>2]);do if(p|$(G*F)>>0<3|(r+-1&r|0)!=0)&1;g=~~$(W($(E/G)))>>>0;Ph(a,C>>>0>>0?g:C);C=f[m>>2]|0;g=C+-1|0;if(!(g&C)){H=C;I=g&s;break}if(s>>>0>>0){H=C;I=s}else{H=C;I=(s>>>0)%(C>>>0)|0}}else{H=r;I=u}while(0);u=(f[a>>2]|0)+(I<<2)|0;I=f[u>>2]|0;if(!I){r=a+8|0;f[t>>2]=f[r>>2];f[r>>2]=t;f[u>>2]=r;r=f[t>>2]|0;if(r|0){u=f[r+4>>2]|0;r=H+-1|0;if(r&H)if(u>>>0>>0)J=u;else J=(u>>>0)%(H>>>0)|0;else J=u&r;K=(f[a>>2]|0)+(J<<2)|0;q=61}}else{f[t>>2]=f[I>>2];K=I;q=61}if((q|0)==61)f[K>>2]=t;f[c>>2]=(f[c>>2]|0)+1;v=t;w=v+20|0;return w|0}function yc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0.0,q=0.0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0,H=0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0.0,R=0.0,S=0,T=0.0,U=0,V=0,W=0,X=0.0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0.0,da=0,ea=0.0;g=a+4|0;i=f[g>>2]|0;j=a+100|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=0}else{k=Di(a)|0;l=0}a:while(1){switch(k|0){case 46:{m=8;break a;break}case 48:break;default:{n=0;o=0;p=1.0;q=0.0;r=0;s=k;t=l;u=0;v=0;w=0;x=0;break a}}i=f[g>>2]|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=1;continue}else{k=Di(a)|0;l=1;continue}}if((m|0)==8){k=f[g>>2]|0;if(k>>>0<(f[j>>2]|0)>>>0){f[g>>2]=k+1;y=h[k>>0]|0}else y=Di(a)|0;if((y|0)==48){k=0;i=0;while(1){z=f[g>>2]|0;if(z>>>0<(f[j>>2]|0)>>>0){f[g>>2]=z+1;A=h[z>>0]|0}else A=Di(a)|0;z=Tn(k|0,i|0,-1,-1)|0;B=I;if((A|0)==48){k=z;i=B}else{n=1;o=0;p=1.0;q=0.0;r=0;s=A;t=1;u=0;v=0;w=z;x=B;break}}}else{n=1;o=0;p=1.0;q=0.0;r=0;s=y;t=l;u=0;v=0;w=0;x=0}}while(1){l=s+-48|0;y=s|32;if(l>>>0>=10){A=(s|0)==46;if(!(A|(y+-97|0)>>>0<6)){C=s;break}if(A)if(!n){D=1;E=o;F=p;G=q;H=r;J=t;K=v;L=u;M=v;N=u}else{C=46;break}else m=20}else m=20;if((m|0)==20){m=0;A=(s|0)>57?y+-87|0:l;do if(!((u|0)<0|(u|0)==0&v>>>0<8))if((u|0)<0|(u|0)==0&v>>>0<14){O=p*.0625;P=o;Q=O;R=q+O*+(A|0);S=r;break}else{l=(o|0)!=0|(A|0)==0;P=l?o:1;Q=p;R=l?q:q+p*.5;S=r;break}else{P=o;Q=p;R=q;S=A+(r<<4)|0}while(0);A=Tn(v|0,u|0,1,0)|0;D=n;E=P;F=Q;G=R;H=S;J=1;K=w;L=x;M=A;N=I}A=f[g>>2]|0;if(A>>>0<(f[j>>2]|0)>>>0){f[g>>2]=A+1;n=D;o=E;p=F;q=G;r=H;s=h[A>>0]|0;t=J;u=N;v=M;w=K;x=L;continue}else{n=D;o=E;p=F;q=G;r=H;s=Di(a)|0;t=J;u=N;v=M;w=K;x=L;continue}}do if(!t){L=(f[j>>2]|0)==0;if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(e){if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(!((n|0)==0|L))f[g>>2]=(f[g>>2]|0)+-1}else Rm(a,0);T=+(d|0)*0.0}else{L=(n|0)==0;K=L?v:w;M=L?u:x;if((u|0)<0|(u|0)==0&v>>>0<8){L=r;N=v;J=u;while(1){s=L<<4;H=N;N=Tn(N|0,J|0,1,0)|0;if(!((J|0)<0|(J|0)==0&H>>>0<7)){U=s;break}else{L=s;J=I}}}else U=r;if((C|32|0)==112){J=De(a,e)|0;L=I;if((J|0)==0&(L|0)==-2147483648){if(!e){Rm(a,0);T=0.0;break}if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}}else{V=J;W=L}}else if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}L=Rn(K|0,M|0,2)|0;J=Tn(L|0,I|0,-32,-1)|0;L=Tn(J|0,I|0,V|0,W|0)|0;J=I;if(!U){T=+(d|0)*0.0;break}N=0-c|0;s=((N|0)<0)<<31>>31;if((J|0)>(s|0)|(J|0)==(s|0)&L>>>0>N>>>0){N=ir()|0;f[N>>2]=34;T=+(d|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}N=c+-106|0;s=((N|0)<0)<<31>>31;if((J|0)<(s|0)|(J|0)==(s|0)&L>>>0>>0){N=ir()|0;f[N>>2]=34;T=+(d|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if((U|0)>-1){G=q;N=U;s=L;H=J;while(1){E=!(G>=.5);o=N<<1|(E^1)&1;F=G+(E?G:G+-1.0);E=Tn(s|0,H|0,-1,-1)|0;D=I;if((o|0)>-1){G=F;N=o;s=E;H=D}else{X=F;Y=o;Z=E;_=D;break}}}else{X=q;Y=U;Z=L;_=J}H=((b|0)<0)<<31>>31;s=Vn(32,0,c|0,((c|0)<0)<<31>>31|0)|0;N=Tn(s|0,I|0,Z|0,_|0)|0;s=I;if((s|0)<(H|0)|(s|0)==(H|0)&N>>>0>>0)if((N|0)>0){$=N;m=59}else{aa=0;ba=84;m=61}else{$=b;m=59}if((m|0)==59)if(($|0)<53){aa=$;ba=84-$|0;m=61}else{ca=0.0;da=$;ea=+(d|0)}if((m|0)==61){G=+(d|0);ca=+Gq(+Wj(1.0,ba),G);da=aa;ea=G}N=(Y&1|0)==0&(X!=0.0&(da|0)<32);G=(N?0.0:X)*ea+(ca+ea*+((Y+(N&1)|0)>>>0))-ca;if(!(G!=0.0)){N=ir()|0;f[N>>2]=34}T=+Hq(G,Z)}while(0);return +T}function zc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;g=u;u=u+16|0;h=g+4|0;i=g;if(!(oh(a,d)|0)){j=0;u=g;return j|0}d=a+84|0;k=f[d>>2]|0;l=a+88|0;m=f[l>>2]|0;if((m|0)!=(k|0))f[l>>2]=m+(~((m+-4-k|0)>>>2)<<2);f[d>>2]=0;f[l>>2]=0;f[a+92>>2]=0;if(k|0)br(k);k=a+72|0;l=f[k>>2]|0;d=a+76|0;if((f[d>>2]|0)!=(l|0))f[d>>2]=l;f[k>>2]=0;f[d>>2]=0;f[a+80>>2]=0;if(l|0)br(l);l=a+64|0;d=f[l>>2]|0;if((f[d+4>>2]|0)!=(f[d>>2]|0)){k=a+12|0;m=e+84|0;n=e+68|0;o=c+96|0;p=a+24|0;q=0;r=d;do{f[i>>2]=(q>>>0)/3|0;f[h>>2]=f[i>>2];d=Rj(r,h)|0;r=f[l>>2]|0;do if(!d){s=f[(f[r+12>>2]|0)+(q<<2)>>2]|0;if((s|0)==-1){t=(f[a>>2]|0)+(q>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(q&31);t=q+1|0;v=((t>>>0)%3|0|0)==0?q+-2|0:t;if((v|0)==-1)w=-1;else w=f[(f[r>>2]|0)+(v<<2)>>2]|0;v=(f[k>>2]|0)+(w>>>5<<2)|0;f[v>>2]=f[v>>2]|1<<(w&31);v=(((q>>>0)%3|0|0)==0?2:-1)+q|0;if((v|0)==-1)x=-1;else x=f[(f[r>>2]|0)+(v<<2)>>2]|0;v=(f[k>>2]|0)+(x>>>5<<2)|0;f[v>>2]=f[v>>2]|1<<(x&31);break}if(s>>>0>=q>>>0){v=q+1|0;t=((v>>>0)%3|0|0)==0?q+-2|0:v;y=s+(((s>>>0)%3|0|0)==0?2:-1)|0;z=(t|0)==-1;if(!(b[m>>0]|0)){if(z)A=-1;else A=f[(f[o>>2]|0)+(((t|0)/3|0)*12|0)+(((t|0)%3|0)<<2)>>2]|0;B=(y|0)==-1;if(B)C=-1;else C=f[(f[o>>2]|0)+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;D=f[n>>2]|0;if((f[D+(A<<2)>>2]|0)==(f[D+(C<<2)>>2]|0)){E=t+1|0;if(z)F=-1;else F=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){G=y+2|0;break}else{G=y+-1|0;break}else G=-1;while(0);if((F|0)==-1)H=-1;else H=f[(f[o>>2]|0)+(((F|0)/3|0)*12|0)+(((F|0)%3|0)<<2)>>2]|0;if((G|0)==-1)I=-1;else I=f[(f[o>>2]|0)+(((G|0)/3|0)*12|0)+(((G|0)%3|0)<<2)>>2]|0;if((f[D+(H<<2)>>2]|0)==(f[D+(I<<2)>>2]|0))break}}else{if(z)J=-1;else J=f[(f[o>>2]|0)+(((t|0)/3|0)*12|0)+(((t|0)%3|0)<<2)>>2]|0;B=(y|0)==-1;if(B)K=-1;else K=f[(f[o>>2]|0)+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;if((J|0)==(K|0)){E=t+1|0;if(z)L=-1;else L=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){M=y+2|0;break}else{M=y+-1|0;break}else M=-1;while(0);if((L|0)==-1)N=-1;else N=f[(f[o>>2]|0)+(((L|0)/3|0)*12|0)+(((L|0)%3|0)<<2)>>2]|0;if((M|0)==-1)O=-1;else O=f[(f[o>>2]|0)+(((M|0)/3|0)*12|0)+(((M|0)%3|0)<<2)>>2]|0;if((N|0)==(O|0))break}}b[p>>0]=0;y=f[a>>2]|0;B=y+(q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(q&31);B=y+(s>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(s&31);B=((v>>>0)%3|0|0)==0?q+-2|0:v;if((B|0)==-1)P=-1;else P=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(P>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(P&31);B=(((q>>>0)%3|0|0)==0?2:-1)+q|0;if((B|0)==-1)Q=-1;else Q=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(Q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(Q&31);B=s+1|0;y=((B>>>0)%3|0|0)==0?s+-2|0:B;if((y|0)==-1)R=-1;else R=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(R>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(R&31);y=(((s>>>0)%3|0|0)==0?2:-1)+s|0;if((y|0)==-1)S=-1;else S=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(S>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(S&31)}}while(0);q=q+1|0}while(q>>>0<(f[r+4>>2]|0)-(f[r>>2]|0)>>2>>>0)}if((c|0)!=0&(e|0)!=0){Kc(a,c,e);j=1;u=g;return j|0}else{gd(a,0,0);j=1;u=g;return j|0}return 0}function Ac(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;d=u;u=u+32|0;e=d+12|0;g=d+8|0;h=d+4|0;i=d;j=a+8|0;a:do if(f[j>>2]|0?(k=f[a>>2]|0,l=a+4|0,f[a>>2]=l,f[(f[l>>2]|0)+8>>2]=0,f[l>>2]=0,f[j>>2]=0,m=f[k+4>>2]|0,n=(m|0)==0?k:m,n|0):0){m=a+4|0;k=n;n=f[b>>2]|0;while(1){if((n|0)==(f[c>>2]|0))break;o=k+16|0;f[o>>2]=f[n+16>>2];if((k|0)!=(n|0)){f[h>>2]=f[n+20>>2];f[i>>2]=n+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Hc(k+20|0,g,e)}p=k+8|0;q=f[p>>2]|0;do if(q){r=f[q>>2]|0;if((r|0)==(k|0)){f[q>>2]=0;s=f[q+4>>2]|0;if(!s){t=q;break}else v=s;while(1){s=f[v>>2]|0;if(s|0){v=s;continue}s=f[v+4>>2]|0;if(!s)break;else v=s}t=v;break}else{f[q+4>>2]=0;if(!r){t=q;break}else w=r;while(1){s=f[w>>2]|0;if(s|0){w=s;continue}s=f[w+4>>2]|0;if(!s)break;else w=s}t=w;break}}else t=0;while(0);q=f[l>>2]|0;do if(q){r=f[o>>2]|0;s=q;while(1){if((r|0)<(f[s+16>>2]|0)){x=f[s>>2]|0;if(!x){y=22;break}else z=x}else{A=s+4|0;x=f[A>>2]|0;if(!x){y=25;break}else z=x}s=z}if((y|0)==22){y=0;B=s;C=s;break}else if((y|0)==25){y=0;B=s;C=A;break}}else{B=l;C=l}while(0);f[k>>2]=0;f[k+4>>2]=0;f[p>>2]=B;f[C>>2]=k;q=f[f[a>>2]>>2]|0;if(!q)D=k;else{f[a>>2]=q;D=f[C>>2]|0}Ae(f[m>>2]|0,D);f[j>>2]=(f[j>>2]|0)+1;q=f[n+4>>2]|0;if(!q){o=n+8|0;r=f[o>>2]|0;if((f[r>>2]|0)==(n|0))E=r;else{r=o;do{o=f[r>>2]|0;r=o+8|0;x=f[r>>2]|0}while((f[x>>2]|0)!=(o|0));E=x}}else{r=q;while(1){p=f[r>>2]|0;if(!p)break;else r=p}E=r}f[b>>2]=E;if(!t)break a;else{k=t;n=E}}n=f[k+8>>2]|0;if(!n)F=k;else{m=n;while(1){n=f[m+8>>2]|0;if(!n)break;else m=n}F=m}Dj(a,F)}while(0);F=f[b>>2]|0;E=f[c>>2]|0;if((F|0)==(E|0)){u=d;return}c=a+4|0;t=a+4|0;D=F;while(1){tg(e,a,D+16|0);F=f[c>>2]|0;do if(F){C=f[e>>2]|0;B=f[C+16>>2]|0;A=F;while(1){if((B|0)<(f[A+16>>2]|0)){z=f[A>>2]|0;if(!z){y=43;break}else G=z}else{H=A+4|0;z=f[H>>2]|0;if(!z){y=46;break}else G=z}A=G}if((y|0)==43){y=0;I=A;J=A;K=C;break}else if((y|0)==46){y=0;I=A;J=H;K=C;break}}else{I=c;J=c;K=f[e>>2]|0}while(0);f[K>>2]=0;f[K+4>>2]=0;f[K+8>>2]=I;f[J>>2]=K;F=f[f[a>>2]>>2]|0;if(!F)L=K;else{f[a>>2]=F;L=f[J>>2]|0}Ae(f[t>>2]|0,L);f[j>>2]=(f[j>>2]|0)+1;F=f[D+4>>2]|0;if(!F){m=D+8|0;B=f[m>>2]|0;if((f[B>>2]|0)==(D|0))M=B;else{B=m;do{m=f[B>>2]|0;B=m+8|0;r=f[B>>2]|0}while((f[r>>2]|0)!=(m|0));M=r}}else{B=F;while(1){r=f[B>>2]|0;if(!r)break;else B=r}M=B}f[b>>2]=M;if((M|0)==(E|0))break;else D=M}u=d;return}function Bc(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;g=a+8|0;Ah(g,b,d,e);d=e>>>0>1073741823?-1:e<<2;h=_q(d)|0;hj(h|0,0,d|0)|0;d=f[a+48>>2]|0;i=f[a+56>>2]|0;j=f[i>>2]|0;k=(f[i+4>>2]|0)-j|0;l=k>>2;a:do if((k|0)>4){m=f[a+52>>2]|0;n=a+16|0;o=a+32|0;p=a+12|0;q=a+28|0;r=a+20|0;s=a+24|0;t=d+12|0;u=(e|0)>0;v=j;w=l;while(1){x=w;w=w+-1|0;if(l>>>0<=w>>>0)break;y=f[v+(w<<2)>>2]|0;z=X(w,e)|0;if((y|0)!=-1?(A=f[(f[t>>2]|0)+(y<<2)>>2]|0,(A|0)!=-1):0){y=f[d>>2]|0;B=f[m>>2]|0;C=f[B+(f[y+(A<<2)>>2]<<2)>>2]|0;D=A+1|0;E=((D>>>0)%3|0|0)==0?A+-2|0:D;if((E|0)==-1)F=-1;else F=f[y+(E<<2)>>2]|0;E=f[B+(F<<2)>>2]|0;D=(((A>>>0)%3|0|0)==0?2:-1)+A|0;if((D|0)==-1)G=-1;else G=f[y+(D<<2)>>2]|0;D=f[B+(G<<2)>>2]|0;if((C|0)<(w|0)&(E|0)<(w|0)&(D|0)<(w|0)){B=X(C,e)|0;C=X(E,e)|0;E=X(D,e)|0;if(u){D=0;do{f[h+(D<<2)>>2]=(f[b+(D+E<<2)>>2]|0)+(f[b+(D+C<<2)>>2]|0)-(f[b+(D+B<<2)>>2]|0);D=D+1|0}while((D|0)!=(e|0))}D=b+(z<<2)|0;B=c+(z<<2)|0;C=f[g>>2]|0;if((C|0)>0){E=0;y=h;A=C;while(1){if((A|0)>0){C=0;do{H=f[y+(C<<2)>>2]|0;I=f[n>>2]|0;if((H|0)>(I|0)){J=f[o>>2]|0;f[J+(C<<2)>>2]=I;K=J}else{J=f[p>>2]|0;I=f[o>>2]|0;f[I+(C<<2)>>2]=(H|0)<(J|0)?J:H;K=I}C=C+1|0}while((C|0)<(f[g>>2]|0));L=K}else L=f[o>>2]|0;C=(f[D+(E<<2)>>2]|0)-(f[L+(E<<2)>>2]|0)|0;I=B+(E<<2)|0;f[I>>2]=C;if((C|0)>=(f[q>>2]|0)){if((C|0)>(f[s>>2]|0)){M=C-(f[r>>2]|0)|0;N=42}}else{M=(f[r>>2]|0)+C|0;N=42}if((N|0)==42){N=0;f[I>>2]=M}E=E+1|0;A=f[g>>2]|0;if((E|0)>=(A|0))break;else y=L}}}else N=16}else N=16;if((N|0)==16?(N=0,y=b+(z<<2)|0,A=c+(z<<2)|0,E=f[g>>2]|0,(E|0)>0):0){B=0;D=b+((X(x+-2|0,e)|0)<<2)|0;I=E;while(1){if((I|0)>0){E=0;do{C=f[D+(E<<2)>>2]|0;H=f[n>>2]|0;if((C|0)>(H|0)){J=f[o>>2]|0;f[J+(E<<2)>>2]=H;O=J}else{J=f[p>>2]|0;H=f[o>>2]|0;f[H+(E<<2)>>2]=(C|0)<(J|0)?J:C;O=H}E=E+1|0}while((E|0)<(f[g>>2]|0));P=O}else P=f[o>>2]|0;E=(f[y+(B<<2)>>2]|0)-(f[P+(B<<2)>>2]|0)|0;H=A+(B<<2)|0;f[H>>2]=E;if((E|0)>=(f[q>>2]|0)){if((E|0)>(f[s>>2]|0)){Q=E-(f[r>>2]|0)|0;N=29}}else{Q=(f[r>>2]|0)+E|0;N=29}if((N|0)==29){N=0;f[H>>2]=Q}B=B+1|0;I=f[g>>2]|0;if((B|0)>=(I|0))break;else D=P}}if((x|0)<=2)break a}mq(i)}while(0);if((e|0)>0)hj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){$q(h);return 1}i=a+16|0;P=a+32|0;Q=a+12|0;O=a+28|0;L=a+20|0;M=a+24|0;a=0;K=h;G=e;while(1){if((G|0)>0){e=0;do{F=f[K+(e<<2)>>2]|0;d=f[i>>2]|0;if((F|0)>(d|0)){l=f[P>>2]|0;f[l+(e<<2)>>2]=d;R=l}else{l=f[Q>>2]|0;d=f[P>>2]|0;f[d+(e<<2)>>2]=(F|0)<(l|0)?l:F;R=d}e=e+1|0}while((e|0)<(f[g>>2]|0));S=R}else S=f[P>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[S+(a<<2)>>2]|0)|0;d=c+(a<<2)|0;f[d>>2]=e;if((e|0)>=(f[O>>2]|0)){if((e|0)>(f[M>>2]|0)){T=e-(f[L>>2]|0)|0;N=56}}else{T=(f[L>>2]|0)+e|0;N=56}if((N|0)==56){N=0;f[d>>2]=T}a=a+1|0;G=f[g>>2]|0;if((a|0)>=(G|0))break;else K=S}$q(h);return 1}function Cc(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;g=a+8|0;Ah(g,b,d,e);d=e>>>0>1073741823?-1:e<<2;h=_q(d)|0;hj(h|0,0,d|0)|0;d=f[a+48>>2]|0;i=f[a+56>>2]|0;j=f[i>>2]|0;k=(f[i+4>>2]|0)-j|0;l=k>>2;a:do if((k|0)>4){m=f[a+52>>2]|0;n=a+16|0;o=a+32|0;p=a+12|0;q=a+28|0;r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;C=f[g>>2]|0;if((F|0)>=(C|0))break;else z=K}}}else M=13;if((M|0)==13?(M=0,z=b+(A<<2)|0,C=c+(A<<2)|0,F=f[g>>2]|0,(F|0)>0):0){B=0;E=b+((X(y+-2|0,e)|0)<<2)|0;H=F;while(1){if((H|0)>0){F=0;do{D=f[E+(F<<2)>>2]|0;G=f[n>>2]|0;if((D|0)>(G|0)){I=f[o>>2]|0;f[I+(F<<2)>>2]=G;N=I}else{I=f[p>>2]|0;G=f[o>>2]|0;f[G+(F<<2)>>2]=(D|0)<(I|0)?I:D;N=G}F=F+1|0}while((F|0)<(f[g>>2]|0));O=N}else O=f[o>>2]|0;F=(f[z+(B<<2)>>2]|0)-(f[O+(B<<2)>>2]|0)|0;G=C+(B<<2)|0;f[G>>2]=F;if((F|0)>=(f[q>>2]|0)){if((F|0)>(f[s>>2]|0)){P=F-(f[r>>2]|0)|0;M=26}}else{P=(f[r>>2]|0)+F|0;M=26}if((M|0)==26){M=0;f[G>>2]=P}B=B+1|0;H=f[g>>2]|0;if((B|0)>=(H|0))break;else E=O}}if((y|0)<=2)break a}mq(i)}while(0);if((e|0)>0)hj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){$q(h);return 1}i=a+16|0;O=a+32|0;P=a+12|0;N=a+28|0;K=a+20|0;L=a+24|0;a=0;J=h;d=e;while(1){if((d|0)>0){e=0;do{l=f[J+(e<<2)>>2]|0;j=f[i>>2]|0;if((l|0)>(j|0)){k=f[O>>2]|0;f[k+(e<<2)>>2]=j;Q=k}else{k=f[P>>2]|0;j=f[O>>2]|0;f[j+(e<<2)>>2]=(l|0)<(k|0)?k:l;Q=j}e=e+1|0}while((e|0)<(f[g>>2]|0));R=Q}else R=f[O>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[R+(a<<2)>>2]|0)|0;j=c+(a<<2)|0;f[j>>2]=e;if((e|0)>=(f[N>>2]|0)){if((e|0)>(f[L>>2]|0)){S=e-(f[K>>2]|0)|0;M=53}}else{S=(f[K>>2]|0)+e|0;M=53}if((M|0)==53){M=0;f[j>>2]=S}a=a+1|0;d=f[g>>2]|0;if((a|0)>=(d|0))break;else J=R}$q(h);return 1}function Dc(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0;h=u;u=u+48|0;i=h+28|0;j=h+24|0;k=h;l=h+12|0;m=h+40|0;if((c|0)<0){n=0;u=h;return n|0}if(!c){n=1;u=h;return n|0}o=(d|0)>1;p=o?d:1;f[k>>2]=0;d=k+4|0;f[d>>2]=0;f[k+8>>2]=0;$j(k,c);q=k+8|0;if(o){o=0;r=0;while(1){s=1;t=f[a+(r<<2)>>2]|0;do{v=f[a+(s+r<<2)>>2]|0;t=t>>>0>>0?v:t;s=s+1|0}while((s|0)!=(p|0));s=(_(t|0)|0)^31;v=t>>>0>o>>>0?t:o;w=(t|0)==0?1:s+1|0;f[i>>2]=w;s=f[d>>2]|0;if(s>>>0<(f[q>>2]|0)>>>0){f[s>>2]=w;f[d>>2]=s+4}else Ci(k,i);r=r+p|0;if((r|0)>=(c|0)){x=v;break}else o=v}}else{o=0;r=0;while(1){v=f[a+(o<<2)>>2]|0;s=(_(v|0)|0)^31;w=v>>>0>r>>>0?v:r;y=(v|0)==0?1:s+1|0;f[i>>2]=y;s=f[d>>2]|0;if(s>>>0<(f[q>>2]|0)>>>0){f[s>>2]=y;f[d>>2]=s+4}else Ci(k,i);o=o+p|0;if((o|0)>=(c|0)){x=w;break}else r=w}}f[l>>2]=0;r=l+4|0;f[r>>2]=0;f[l+8>>2]=0;o=f[k>>2]|0;q=(f[d>>2]|0)-o|0;w=q>>2;if(w){if(w>>>0>1073741823)mq(l);s=dn(q)|0;f[r>>2]=s;f[l>>2]=s;f[l+8>>2]=s+(w<<2);w=s;if((q|0)>0){y=s+(q>>>2<<2)|0;Rg(s|0,o|0,q|0)|0;f[r>>2]=y;q=y-w>>2;if((y|0)==(s|0)){z=q;A=s;B=0;C=0}else{y=0;o=0;v=0;while(1){D=Tn(o|0,v|0,f[s+(y<<2)>>2]|0,0)|0;E=I;y=y+1|0;if(y>>>0>=q>>>0){z=q;A=s;B=D;C=E;break}else{o=D;v=E}}}}else{F=w;G=18}}else{F=0;G=18}if((G|0)==18){z=0;A=F;B=0;C=0}F=rg(A,z,32,i)|0;z=I;A=f[i>>2]<<3;w=Rn(A|0,((A|0)<0)<<31>>31|0,1)|0;A=I;v=on(B|0,C|0,p|0,0)|0;C=Tn(F|0,z|0,v|0,I|0)|0;v=Tn(C|0,I|0,w|0,A|0)|0;A=I;w=f[l>>2]|0;if(w|0){l=f[r>>2]|0;if((l|0)!=(w|0))f[r>>2]=l+(~((l+-4-w|0)>>>2)<<2);br(w)}w=rg(a,c,x,i)|0;l=f[i>>2]|0;r=((x-l|0)/64|0)+l<<3;C=l<<3;z=Tn(w|0,I|0,C|0,((C|0)<0)<<31>>31|0)|0;C=Tn(z|0,I|0,r|0,((r|0)<0)<<31>>31|0)|0;r=I;z=(_((x>>>0>1?x:1)|0)|0)^30;if(e){f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;w=dn(32)|0;f[i>>2]=w;f[i+8>>2]=-2147483616;f[i+4>>2]=22;F=w;B=13044;o=F+22|0;do{b[F>>0]=b[B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=(sh(e,i)|0)==0;if((b[i+11>>0]|0)<0)br(f[i>>2]|0);if(!w){f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;w=dn(32)|0;f[i>>2]=w;f[i+8>>2]=-2147483616;f[i+4>>2]=22;F=w;B=13044;o=F+22|0;do{b[F>>0]=b[B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=Ck(e,i)|0;if((b[i+11>>0]|0)<0)br(f[i>>2]|0);H=w}else G=32}else G=32;if((G|0)==32)H=z>>>0<18&((A|0)>(r|0)|(A|0)==(r|0)&v>>>0>=C>>>0)&1;b[m>>0]=H;C=g+16|0;v=f[C+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[C>>2]|0)>>>0>0)){f[j>>2]=f[g+4>>2];f[i>>2]=f[j>>2];ye(g,i,m,m+1|0)|0}switch(H|0){case 0:{J=md(a,c,p,k,g)|0;break}case 1:{J=Nc(a,c,x,l,e,g)|0;break}default:J=0}g=f[k>>2]|0;if(g|0){k=f[d>>2]|0;if((k|0)!=(g|0))f[d>>2]=k+(~((k+-4-g|0)>>>2)<<2);br(g)}n=J;u=h;return n|0}function Ec(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;if((b|0)<0)return;c=a+12|0;d=f[c>>2]|0;e=f[a+8>>2]|0;g=e;h=d;if(d-e>>2>>>0<=b>>>0)return;e=g+(b<<2)|0;d=f[(f[e>>2]|0)+56>>2]|0;i=f[(f[g+(b<<2)>>2]|0)+60>>2]|0;g=e+4|0;if((g|0)!=(h|0)){j=g;g=e;do{k=f[j>>2]|0;f[j>>2]=0;l=f[g>>2]|0;f[g>>2]=k;if(l|0){k=l+88|0;m=f[k>>2]|0;f[k>>2]=0;if(m|0){k=f[m+8>>2]|0;if(k|0){n=m+12|0;if((f[n>>2]|0)!=(k|0))f[n>>2]=k;br(k)}br(m)}m=f[l+68>>2]|0;if(m|0){k=l+72|0;n=f[k>>2]|0;if((n|0)!=(m|0))f[k>>2]=n+(~((n+-4-m|0)>>>2)<<2);br(m)}m=l+64|0;n=f[m>>2]|0;f[m>>2]=0;if(n|0){m=f[n>>2]|0;if(m|0){k=n+4|0;if((f[k>>2]|0)!=(m|0))f[k>>2]=m;br(m)}br(n)}br(l)}j=j+4|0;g=g+4|0}while((j|0)!=(h|0));j=f[c>>2]|0;if((j|0)!=(g|0)){o=g;p=j;q=24}}else{o=e;p=h;q=24}if((q|0)==24){q=p;do{p=q+-4|0;f[c>>2]=p;h=f[p>>2]|0;f[p>>2]=0;if(h|0){p=h+88|0;e=f[p>>2]|0;f[p>>2]=0;if(e|0){p=f[e+8>>2]|0;if(p|0){j=e+12|0;if((f[j>>2]|0)!=(p|0))f[j>>2]=p;br(p)}br(e)}e=f[h+68>>2]|0;if(e|0){p=h+72|0;j=f[p>>2]|0;if((j|0)!=(e|0))f[p>>2]=j+(~((j+-4-e|0)>>>2)<<2);br(e)}e=h+64|0;j=f[e>>2]|0;f[e>>2]=0;if(j|0){e=f[j>>2]|0;if(e|0){p=j+4|0;if((f[p>>2]|0)!=(e|0))f[p>>2]=e;br(e)}br(j)}br(h)}q=f[c>>2]|0}while((q|0)!=(o|0))}o=f[a+4>>2]|0;a:do if(o|0){q=o+44|0;c=f[q>>2]|0;h=f[o+40>>2]|0;while(1){if((h|0)==(c|0))break a;r=h+4|0;if((f[(f[h>>2]|0)+40>>2]|0)==(i|0))break;else h=r}if((r|0)!=(c|0)){j=r;e=h;do{p=f[j>>2]|0;f[j>>2]=0;g=f[e>>2]|0;f[e>>2]=p;if(g|0){Qi(g);br(g)}j=j+4|0;e=e+4|0}while((j|0)!=(c|0));j=f[q>>2]|0;if((j|0)==(e|0))break;else{s=e;t=j}}else{s=h;t=c}j=t;do{g=j+-4|0;f[q>>2]=g;p=f[g>>2]|0;f[g>>2]=0;if(p|0){Qi(p);br(p)}j=f[q>>2]|0}while((j|0)!=(s|0))}while(0);b:do if((d|0)<5){s=f[a+20+(d*12|0)>>2]|0;t=a+20+(d*12|0)+4|0;r=f[t>>2]|0;i=r;c:do if((s|0)==(r|0))u=s;else{o=s;while(1){if((f[o>>2]|0)==(b|0)){u=o;break c}o=o+4|0;if((o|0)==(r|0))break b}}while(0);if((u|0)!=(r|0)){s=u+4|0;o=i-s|0;j=o>>2;if(!j)v=r;else{Xl(u|0,s|0,o|0)|0;v=f[t>>2]|0}o=u+(j<<2)|0;if((v|0)!=(o|0))f[t>>2]=v+(~((v+-4-o|0)>>>2)<<2)}}while(0);v=f[a+24>>2]|0;u=f[a+20>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+36>>2]|0;u=f[a+32>>2]|0;d=u;if((o|0)!=(u|0)){j=o-u>>2;u=0;do{o=d+(u<<2)|0;v=f[o>>2]|0;if((v|0)>(b|0))f[o>>2]=v+-1;u=u+1|0}while(u>>>0>>0)}j=f[a+48>>2]|0;u=f[a+44>>2]|0;d=u;if((j|0)!=(u|0)){v=j-u>>2;u=0;do{j=d+(u<<2)|0;o=f[j>>2]|0;if((o|0)>(b|0))f[j>>2]=o+-1;u=u+1|0}while(u>>>0>>0)}v=f[a+60>>2]|0;u=f[a+56>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+72>>2]|0;u=f[a+68>>2]|0;a=u;if((o|0)==(u|0))return;d=o-u>>2;u=0;do{o=a+(u<<2)|0;j=f[o>>2]|0;if((j|0)>(b|0))f[o>>2]=j+-1;u=u+1|0}while(u>>>0>>0);return}function Fc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;d=u;u=u+32|0;e=d+16|0;g=d;h=c+4|0;i=f[(f[h>>2]|0)+48>>2]|0;j=c+12|0;c=f[j>>2]|0;k=dn(32)|0;f[e>>2]=k;f[e+8>>2]=-2147483616;f[e+4>>2]=17;l=k;m=12932;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[k+17>>0]=0;k=i+16|0;o=f[k>>2]|0;if(o){p=k;q=o;a:while(1){o=q;while(1){if((f[o+16>>2]|0)>=(c|0))break;r=f[o+4>>2]|0;if(!r){s=p;break a}else o=r}q=f[o>>2]|0;if(!q){s=o;break}else p=o}if(((s|0)!=(k|0)?(c|0)>=(f[s+16>>2]|0):0)?(c=s+20|0,(sh(c,e)|0)!=0):0)t=yk(c,e,-1)|0;else v=10}else v=10;if((v|0)==10)t=yk(i,e,-1)|0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);i=(1<>2]=-1;f[e+4>>2]=-1;f[e+8>>2]=-1;f[e+12>>2]=-1;if(i&1|0?(t=(_(i|0)|0)^31,(t+-1|0)>>>0<=28):0){f[e>>2]=t+1;i=2<>2]=i+-1;t=i+-2|0;f[e+8>>2]=t;f[e+12>>2]=(t|0)/2|0}t=Ki(f[j>>2]|0,f[h>>2]|0)|0;i=f[(f[h>>2]|0)+48>>2]|0;c=f[j>>2]|0;s=dn(32)|0;f[g>>2]=s;f[g+8>>2]=-2147483616;f[g+4>>2]=17;l=s;m=12804;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[s+17>>0]=0;s=i+16|0;m=f[s>>2]|0;if(m){l=s;n=m;b:while(1){m=n;while(1){if((f[m+16>>2]|0)>=(c|0))break;k=f[m+4>>2]|0;if(!k){w=l;break b}else m=k}n=f[m>>2]|0;if(!n){w=m;break}else l=m}if(((w|0)!=(s|0)?(c|0)>=(f[w+16>>2]|0):0)?(c=w+20|0,(sh(c,g)|0)!=0):0)x=yk(c,g,t)|0;else v=25}else v=25;if((v|0)==25)x=yk(i,g,t)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);switch(x|0){case 6:{x=f[j>>2]|0;t=f[h>>2]|0;i=f[(f[(f[t+4>>2]|0)+8>>2]|0)+(x<<2)>>2]|0;do if((Qa[f[(f[t>>2]|0)+8>>2]&127](t)|0)==1){rf(g,t,6,x,e,514);c=f[g>>2]|0;if(!c){f[g>>2]=0;y=g;v=34;break}else{z=g;A=c;break}}else{y=g;v=34}while(0);if((v|0)==34){x=dn(24)|0;f[x+4>>2]=i;i=x+8|0;f[i>>2]=f[e>>2];f[i+4>>2]=f[e+4>>2];f[i+8>>2]=f[e+8>>2];f[i+12>>2]=f[e+12>>2];f[x>>2]=2320;i=x;f[g>>2]=i;z=y;A=i}f[a>>2]=A;f[z>>2]=0;u=d;return}case 0:{z=f[j>>2]|0;j=f[h>>2]|0;h=f[(f[(f[j+4>>2]|0)+8>>2]|0)+(z<<2)>>2]|0;do if((Qa[f[(f[j>>2]|0)+8>>2]&127](j)|0)==1){rf(g,j,0,z,e,514);A=f[g>>2]|0;if(!A){f[g>>2]=0;B=g;v=41;break}else{C=g;D=A;break}}else{B=g;v=41}while(0);if((v|0)==41){v=dn(24)|0;f[v+4>>2]=h;h=v+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[v>>2]=2320;e=v;f[g>>2]=e;C=B;D=e}f[a>>2]=D;f[C>>2]=0;u=d;return}default:{f[a>>2]=0;u=d;return}}}function Gc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;b=u;u=u+32|0;c=b+20|0;d=b+8|0;e=b;g=a+4|0;h=f[g>>2]|0;i=f[a>>2]|0;j=h-i|0;k=j>>2;f[c>>2]=0;l=c+4|0;f[l>>2]=0;m=c+8|0;f[m>>2]=0;n=i;if(k|0){if((j|0)<0)mq(c);j=((k+-1|0)>>>5)+1|0;o=dn(j<<2)|0;f[c>>2]=o;f[m>>2]=j;f[l>>2]=k;l=k>>>5;hj(o|0,0,l<<2|0)|0;j=k&31;k=o+(l<<2)|0;if(j|0)f[k>>2]=f[k>>2]&~(-1>>>(32-j|0))}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;k=a+12|0;l=e+4|0;o=d+8|0;m=n;n=h;h=i;while(1){if((n|0)==(h|0))break;else{p=0;q=0;r=h;s=m}while(1){i=f[c>>2]|0;do if(!(f[i+(q>>>5<<2)>>2]&1<<(q&31))){t=f[d>>2]|0;v=f[j>>2]|0;if((v|0)==(t|0))w=t;else{x=v+(~((v+-8-t|0)>>>3)<<3)|0;f[j>>2]=x;w=x}x=q;while(1){v=x+1|0;y=((v>>>0)%3|0|0)==0?x+-2|0:v;if((y|0)==-1){z=x;A=r;B=i;C=s;D=t;E=w;break}v=f[(f[k>>2]|0)+(y<<2)>>2]|0;y=v+1|0;if((v|0)==-1){z=x;A=r;B=i;C=s;D=t;E=w;break}F=((y>>>0)%3|0|0)==0?v+-2|0:y;if(!((F|0)!=(q|0)&(F|0)!=-1)){z=x;A=r;B=i;C=s;D=t;E=w;break}if(!(f[i+(F>>>5<<2)>>2]&1<<(F&31)))x=F;else{z=x;A=r;B=i;C=s;D=t;E=w;break}}a:while(1){t=B+(z>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(z&31);t=z+1|0;F=((t>>>0)%3|0|0)==0?z+-2|0:t;t=f[C+(F<<2)>>2]|0;G=(((z>>>0)%3|0|0)==0?2:-1)+z|0;if((D|0)!=(E|0))if((G|0)==-1){y=D;do{if((f[y>>2]|0)==(t|0)?(v=f[y+4>>2]|0,(v|0)!=-1):0){H=v;I=-1;J=-1;K=25;break a}y=y+8|0}while((y|0)!=(E|0))}else{y=D;do{if((f[y>>2]|0)==(t|0)?(L=f[y+4>>2]|0,M=f[(f[k>>2]|0)+(G<<2)>>2]|0,(M|0)!=(L|0)):0){K=24;break a}y=y+8|0}while((y|0)!=(E|0))}f[e>>2]=0;f[e>>2]=f[C+(G<<2)>>2];f[l>>2]=F;if((E|0)==(f[o>>2]|0))ei(d,e);else{y=e;t=f[y+4>>2]|0;v=E;f[v>>2]=f[y>>2];f[v+4>>2]=t;f[j>>2]=(f[j>>2]|0)+8}if((G|0)==-1){K=38;break}t=f[(f[k>>2]|0)+(G<<2)>>2]|0;if((t|0)==-1){K=38;break}v=t+(((t>>>0)%3|0|0)==0?2:-1)|0;if(!((v|0)!=(x|0)&(v|0)!=-1)){K=40;break}t=f[a>>2]|0;z=v;A=t;B=f[c>>2]|0;C=t;D=f[d>>2]|0;E=f[j>>2]|0}if((K|0)==24){K=0;if((L|0)==-1){N=-1;O=-1;P=M;Q=G}else{H=L;I=M;J=G;K=25}}else if((K|0)==38){K=0;K=40}if((K|0)==25){K=0;N=H;O=f[(f[k>>2]|0)+(H<<2)>>2]|0;P=I;Q=J}else if((K|0)==40){K=0;R=p;S=f[a>>2]|0;break}if((P|0)!=-1)f[(f[k>>2]|0)+(P<<2)>>2]=-1;x=f[k>>2]|0;if((O|0)!=-1)f[x+(O<<2)>>2]=-1;f[x+(Q<<2)>>2]=-1;f[x+(N<<2)>>2]=-1;R=1;S=A}else{R=p;S=r}while(0);q=q+1|0;T=f[g>>2]|0;s=S;if(q>>>0>=T-S>>2>>>0)break;else{p=R;r=S}}if(R){m=s;n=T;h=S}else break}S=f[d>>2]|0;if(S|0){d=f[j>>2]|0;if((d|0)!=(S|0))f[j>>2]=d+(~((d+-8-S|0)>>>3)<<3);br(S)}S=f[c>>2]|0;if(!S){u=b;return 1}br(S);u=b;return 1}function Hc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=a+8|0;a:do if(f[e>>2]|0?(g=f[a>>2]|0,h=a+4|0,f[a>>2]=h,f[(f[h>>2]|0)+8>>2]=0,f[h>>2]=0,f[e>>2]=0,i=f[g+4>>2]|0,j=(i|0)==0?g:i,j|0):0){i=a+4|0;g=j;j=f[c>>2]|0;while(1){if((j|0)==(f[d>>2]|0))break;k=g+16|0;Ql(k,j+16|0)|0;Ql(g+28|0,j+28|0)|0;l=g+8|0;m=f[l>>2]|0;do if(m){n=f[m>>2]|0;if((n|0)==(g|0)){f[m>>2]=0;o=f[m+4>>2]|0;if(!o){p=m;break}else q=o;while(1){o=f[q>>2]|0;if(o|0){q=o;continue}o=f[q+4>>2]|0;if(!o)break;else q=o}p=q;break}else{f[m+4>>2]=0;if(!n){p=m;break}else r=n;while(1){o=f[r>>2]|0;if(o|0){r=o;continue}o=f[r+4>>2]|0;if(!o)break;else r=o}p=r;break}}else p=0;while(0);m=f[h>>2]|0;do if(m){n=b[k+11>>0]|0;o=n<<24>>24<0;s=o?f[g+20>>2]|0:n&255;n=o?f[k>>2]|0:k;o=m;while(1){t=o+16|0;u=b[t+11>>0]|0;v=u<<24>>24<0;w=v?f[o+20>>2]|0:u&255;u=w>>>0>>0?w:s;if((u|0)!=0?(x=Pk(n,v?f[t>>2]|0:t,u)|0,(x|0)!=0):0)if((x|0)<0)y=22;else y=24;else if(s>>>0>>0)y=22;else y=24;if((y|0)==22){y=0;w=f[o>>2]|0;if(!w){y=23;break}else z=w}else if((y|0)==24){y=0;A=o+4|0;w=f[A>>2]|0;if(!w){y=26;break}else z=w}o=z}if((y|0)==23){y=0;B=o;C=o;break}else if((y|0)==26){y=0;B=A;C=o;break}}else{B=h;C=h}while(0);f[g>>2]=0;f[g+4>>2]=0;f[l>>2]=C;f[B>>2]=g;m=f[f[a>>2]>>2]|0;if(!m)D=g;else{f[a>>2]=m;D=f[B>>2]|0}Ae(f[i>>2]|0,D);f[e>>2]=(f[e>>2]|0)+1;m=f[j+4>>2]|0;if(!m){k=j+8|0;s=f[k>>2]|0;if((f[s>>2]|0)==(j|0))E=s;else{s=k;do{k=f[s>>2]|0;s=k+8|0;n=f[s>>2]|0}while((f[n>>2]|0)!=(k|0));E=n}}else{s=m;while(1){l=f[s>>2]|0;if(!l)break;else s=l}E=s}f[c>>2]=E;if(!p)break a;else{g=p;j=E}}j=f[g+8>>2]|0;if(!j)F=g;else{i=j;while(1){j=f[i+8>>2]|0;if(!j)break;else i=j}F=i}sj(a,F)}while(0);F=f[c>>2]|0;E=f[d>>2]|0;if((F|0)==(E|0))return;else G=F;while(1){Qe(a,G+16|0)|0;F=f[G+4>>2]|0;if(!F){d=G+8|0;p=f[d>>2]|0;if((f[p>>2]|0)==(G|0))H=p;else{p=d;do{d=f[p>>2]|0;p=d+8|0;e=f[p>>2]|0}while((f[e>>2]|0)!=(d|0));H=e}}else{p=F;while(1){i=f[p>>2]|0;if(!i)break;else p=i}H=p}f[c>>2]=H;if((H|0)==(E|0))break;else G=H}return}function Ic(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0;g=u;u=u+16|0;h=g;i=c+4|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;j=dn(16)|0;f[h>>2]=j;f[h+8>>2]=-2147483632;f[h+4>>2]=15;k=j;l=12916;m=k+15|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[j+15>>0]=0;j=yk(i,h,-1)|0;if((b[h+11>>0]|0)<0)br(f[h>>2]|0);switch(j|0){case 0:{n=dn(56)|0;k=n;m=k+56|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(m|0));zn(n);o=3728;p=n;break}case -1:{if((Yh(i)|0)==10){n=dn(56)|0;k=n;m=k+56|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(m|0));zn(n);o=3728;p=n}else q=6;break}default:q=6}a:do if((q|0)==6){n=d+8|0;r=d+12|0;s=f[r>>2]|0;t=f[n>>2]|0;b:do if((s-t|0)>0){v=h+8|0;w=h+4|0;x=c+20|0;y=h+11|0;z=0;A=t;B=s;c:while(1){C=f[(f[A+(z<<2)>>2]|0)+28>>2]|0;switch(C|0){case 9:{q=12;break}case 6:case 5:case 4:case 2:{D=A;E=B;break}default:{if((C|2|0)!=3)break c;if((C|0)==9)q=12;else{D=A;E=B}}}if((q|0)==12){q=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;C=dn(32)|0;f[h>>2]=C;f[v>>2]=-2147483616;f[w>>2]=17;k=C;l=12932;m=k+17|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[C+17>>0]=0;F=f[x>>2]|0;if(F){G=x;H=F;d:while(1){F=H;while(1){if((f[F+16>>2]|0)>=0)break;I=f[F+4>>2]|0;if(!I){J=G;break d}else F=I}H=f[F>>2]|0;if(!H){J=F;break}else G=F}if(((J|0)!=(x|0)?(f[J+16>>2]|0)<=0:0)?(G=J+20|0,(sh(G,h)|0)!=0):0)K=yk(G,h,-1)|0;else q=21}else q=21;if((q|0)==21){q=0;K=yk(i,h,-1)|0}if((b[y>>0]|0)<0)br(f[h>>2]|0);if((K|0)<1)break;D=f[n>>2]|0;E=f[r>>2]|0}z=z+1|0;if((z|0)>=(E-D>>2|0))break b;else{A=D;B=E}}if((j|0)!=1){B=dn(56)|0;k=B;m=k+56|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(m|0));zn(B);o=3728;p=B;break a}f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;A=dn(32)|0;f[h>>2]=A;f[h+8>>2]=-2147483616;f[h+4>>2]=24;k=A;l=12950;m=k+24|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[A+24>>0]=0;f[a>>2]=-1;dj(a+4|0,h);if((b[h+11>>0]|0)<0)br(f[h>>2]|0);u=g;return}while(0);r=dn(56)|0;k=r;m=k+56|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(m|0));zn(r);o=3668;p=r}while(0);f[p>>2]=o;tp(p,d);Ad(a,p,i,e);if(!(f[a>>2]|0)){e=a+4|0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);f[c+40>>2]=f[p+52>>2];f[c+44>>2]=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0}Va[f[(f[p>>2]|0)+4>>2]&127](p);u=g;return}function Jc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;b=u;u=u+32|0;c=b+4|0;d=b;e=a+16|0;g=f[e>>2]|0;if(g>>>0>112){f[e>>2]=g+-113;g=a+4|0;e=f[g>>2]|0;h=f[e>>2]|0;i=e+4|0;f[g>>2]=i;e=a+8|0;j=f[e>>2]|0;k=a+12|0;l=f[k>>2]|0;m=l;do if((j|0)==(l|0)){n=f[a>>2]|0;o=n;if(i>>>0>n>>>0){p=i;q=((p-o>>2)+1|0)/-2|0;r=i+(q<<2)|0;s=j-p|0;p=s>>2;if(!p)t=i;else{Xl(r|0,i|0,s|0)|0;t=f[g>>2]|0}s=r+(p<<2)|0;f[e>>2]=s;f[g>>2]=t+(q<<2);v=s;break}s=m-o>>1;o=(s|0)==0?1:s;if(o>>>0>1073741823){s=ra(8)|0;Wo(s,14941);f[s>>2]=6944;va(s|0,1080,114)}s=dn(o<<2)|0;q=s;p=s+(o>>>2<<2)|0;r=p;w=s+(o<<2)|0;if((i|0)==(j|0)){x=r;y=n}else{n=p;p=r;o=i;do{f[n>>2]=f[o>>2];n=p+4|0;p=n;o=o+4|0}while((o|0)!=(j|0));x=p;y=f[a>>2]|0}f[a>>2]=q;f[g>>2]=r;f[e>>2]=x;f[k>>2]=w;if(!y)v=x;else{br(y);v=f[e>>2]|0}}else v=j;while(0);f[v>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}e=a+8|0;h=f[e>>2]|0;v=a+4|0;j=h-(f[v>>2]|0)|0;y=a+12|0;x=f[y>>2]|0;k=x-(f[a>>2]|0)|0;if(j>>>0>=k>>>0){g=k>>1;k=(g|0)==0?1:g;f[c+12>>2]=0;f[c+16>>2]=a+12;if(k>>>0>1073741823){g=ra(8)|0;Wo(g,14941);f[g>>2]=6944;va(g|0,1080,114)}g=dn(k<<2)|0;f[c>>2]=g;i=g+(j>>2<<2)|0;j=c+8|0;f[j>>2]=i;m=c+4|0;f[m>>2]=i;i=c+12|0;f[i>>2]=g+(k<<2);k=dn(4068)|0;f[d>>2]=k;kg(c,d);d=f[e>>2]|0;while(1){z=f[v>>2]|0;if((d|0)==(z|0))break;k=d+-4|0;dg(c,k);d=k}k=z;z=f[a>>2]|0;f[a>>2]=f[c>>2];f[c>>2]=z;f[v>>2]=f[m>>2];f[m>>2]=k;m=f[e>>2]|0;f[e>>2]=f[j>>2];f[j>>2]=m;g=f[y>>2]|0;f[y>>2]=f[i>>2];f[i>>2]=g;g=m;if((d|0)!=(g|0))f[j>>2]=g+(~((g+-4-k|0)>>>2)<<2);if(z|0)br(z);u=b;return}if((x|0)!=(h|0)){h=dn(4068)|0;f[c>>2]=h;kg(a,c);u=b;return}h=dn(4068)|0;f[c>>2]=h;dg(a,c);c=f[v>>2]|0;h=f[c>>2]|0;x=c+4|0;f[v>>2]=x;c=f[e>>2]|0;z=f[y>>2]|0;k=z;do if((c|0)==(z|0)){g=f[a>>2]|0;j=g;if(x>>>0>g>>>0){d=x;m=((d-j>>2)+1|0)/-2|0;i=x+(m<<2)|0;t=c-d|0;d=t>>2;if(!d)A=x;else{Xl(i|0,x|0,t|0)|0;A=f[v>>2]|0}t=i+(d<<2)|0;f[e>>2]=t;f[v>>2]=A+(m<<2);B=t;break}t=k-j>>1;j=(t|0)==0?1:t;if(j>>>0>1073741823){t=ra(8)|0;Wo(t,14941);f[t>>2]=6944;va(t|0,1080,114)}t=dn(j<<2)|0;m=t;d=t+(j>>>2<<2)|0;i=d;l=t+(j<<2)|0;if((x|0)==(c|0)){C=i;D=g}else{g=d;d=i;j=x;do{f[g>>2]=f[j>>2];g=d+4|0;d=g;j=j+4|0}while((j|0)!=(c|0));C=d;D=f[a>>2]|0}f[a>>2]=m;f[v>>2]=i;f[e>>2]=C;f[y>>2]=l;if(!D)B=C;else{br(D);B=f[e>>2]|0}}else B=c;while(0);f[B>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}function Kc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;e=u;u=u+16|0;g=e+8|0;h=e+4|0;i=e;j=a+64|0;k=f[j>>2]|0;if((f[k+28>>2]|0)==(f[k+24>>2]|0)){u=e;return}l=c+96|0;c=a+52|0;m=d+84|0;n=d+68|0;d=a+56|0;o=a+60|0;p=a+12|0;q=a+28|0;r=a+40|0;s=a+44|0;t=a+48|0;v=0;w=0;x=k;while(1){k=f[(f[x+24>>2]|0)+(w<<2)>>2]|0;if((k|0)==-1){y=v;z=x}else{A=v+1|0;B=f[(f[l>>2]|0)+(((k|0)/3|0)*12|0)+(((k|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))C=f[(f[n>>2]|0)+(B<<2)>>2]|0;else C=B;f[g>>2]=C;B=f[d>>2]|0;if(B>>>0<(f[o>>2]|0)>>>0){f[B>>2]=C;f[d>>2]=B+4}else Ci(c,g);f[g>>2]=k;f[h>>2]=0;a:do if(!(f[(f[p>>2]|0)+(w>>>5<<2)>>2]&1<<(w&31)))D=k;else{B=k+1|0;E=((B>>>0)%3|0|0)==0?k+-2|0:B;if(((E|0)!=-1?(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)==0:0)?(B=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0,E=B+1|0,(B|0)!=-1):0){F=((E>>>0)%3|0|0)==0?B+-2|0:E;f[h>>2]=F;if((F|0)==-1){D=k;break}else G=F;while(1){f[g>>2]=G;F=G+1|0;E=((F>>>0)%3|0|0)==0?G+-2|0:F;if((E|0)==-1)break;if(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)break;F=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0;E=F+1|0;if((F|0)==-1)break;B=((E>>>0)%3|0|0)==0?F+-2|0:E;f[h>>2]=B;if((B|0)==-1){D=G;break a}else G=B}f[h>>2]=-1;D=G;break}f[h>>2]=-1;D=k}while(0);f[(f[q>>2]|0)+(D<<2)>>2]=v;k=f[s>>2]|0;if((k|0)==(f[t>>2]|0))Ci(r,g);else{f[k>>2]=f[g>>2];f[s>>2]=k+4}k=f[j>>2]|0;B=f[g>>2]|0;b:do if(((B|0)!=-1?(E=(((B>>>0)%3|0|0)==0?2:-1)+B|0,(E|0)!=-1):0)?(F=f[(f[k+12>>2]|0)+(E<<2)>>2]|0,(F|0)!=-1):0){E=F+(((F>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=E;if((E|0)!=-1&(E|0)!=(B|0)){F=A;H=v;I=E;while(1){E=I+1|0;J=((E>>>0)%3|0|0)==0?I+-2|0:E;do if(f[(f[a>>2]|0)+(J>>>5<<2)>>2]&1<<(J&31)){E=F+1|0;K=f[(f[l>>2]|0)+(((I|0)/3|0)*12|0)+(((I|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))L=f[(f[n>>2]|0)+(K<<2)>>2]|0;else L=K;f[i>>2]=L;K=f[d>>2]|0;if(K>>>0<(f[o>>2]|0)>>>0){f[K>>2]=L;f[d>>2]=K+4}else Ci(c,i);K=f[s>>2]|0;if((K|0)==(f[t>>2]|0)){Ci(r,h);M=E;N=F;break}else{f[K>>2]=f[h>>2];f[s>>2]=K+4;M=E;N=F;break}}else{M=F;N=H}while(0);f[(f[q>>2]|0)+(f[h>>2]<<2)>>2]=N;O=f[j>>2]|0;J=f[h>>2]|0;if((J|0)==-1)break;E=(((J>>>0)%3|0|0)==0?2:-1)+J|0;if((E|0)==-1)break;J=f[(f[O+12>>2]|0)+(E<<2)>>2]|0;if((J|0)==-1)break;I=J+(((J>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=I;if(!((I|0)!=-1?(I|0)!=(f[g>>2]|0):0)){P=M;Q=O;break b}else{F=M;H=N}}f[h>>2]=-1;P=M;Q=O}else{P=A;Q=k}}else R=28;while(0);if((R|0)==28){R=0;f[h>>2]=-1;P=A;Q=k}y=P;z=Q}w=w+1|0;if(w>>>0>=(f[z+28>>2]|0)-(f[z+24>>2]|0)>>2>>>0)break;else{v=y;x=z}}u=e;return}function Lc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,D=0,E=0,F=0;switch(c|0){case 0:{e=-149;g=24;i=4;break}case 1:{e=-1074;g=53;i=4;break}case 2:{e=-1074;g=53;i=4;break}default:j=0.0}a:do if((i|0)==4){c=a+4|0;k=a+100|0;do{l=f[c>>2]|0;if(l>>>0<(f[k>>2]|0)>>>0){f[c>>2]=l+1;m=h[l>>0]|0}else m=Di(a)|0}while((tq(m)|0)!=0);b:do switch(m|0){case 43:case 45:{l=1-(((m|0)==45&1)<<1)|0;n=f[c>>2]|0;if(n>>>0<(f[k>>2]|0)>>>0){f[c>>2]=n+1;o=h[n>>0]|0;p=l;break b}else{o=Di(a)|0;p=l;break b}break}default:{o=m;p=1}}while(0);l=0;n=o;while(1){if((n|32|0)!=(b[17452+l>>0]|0)){q=l;r=n;break}do if(l>>>0<7){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;t=h[s>>0]|0;break}else{t=Di(a)|0;break}}else t=n;while(0);s=l+1|0;if(s>>>0<8){l=s;n=t}else{q=s;r=t;break}}c:do switch(q|0){case 8:break;case 3:{i=23;break}default:{n=(d|0)!=0;if(n&q>>>0>3)if((q|0)==8)break c;else{i=23;break c}d:do if(!q){l=0;s=r;while(1){if((s|32|0)!=(b[17461+l>>0]|0)){u=l;v=s;break d}do if(l>>>0<2){w=f[c>>2]|0;if(w>>>0<(f[k>>2]|0)>>>0){f[c>>2]=w+1;x=h[w>>0]|0;break}else{x=Di(a)|0;break}}else x=s;while(0);w=l+1|0;if(w>>>0<3){l=w;s=x}else{u=w;v=x;break}}}else{u=q;v=r}while(0);switch(u|0){case 3:{s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;y=h[s>>0]|0}else y=Di(a)|0;if((y|0)==40)z=1;else{if(!(f[k>>2]|0)){j=B;break a}f[c>>2]=(f[c>>2]|0)+-1;j=B;break a}while(1){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;A=h[s>>0]|0}else A=Di(a)|0;if(!((A+-48|0)>>>0<10|(A+-65|0)>>>0<26)?!((A|0)==95|(A+-97|0)>>>0<26):0)break;z=z+1|0}if((A|0)==41){j=B;break a}s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!n){l=ir()|0;f[l>>2]=22;Rm(a,0);j=0.0;break a}if(!z){j=B;break a}else D=z;while(1){D=D+-1|0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!D){j=B;break a}}break}case 0:{if((v|0)==48){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;E=h[s>>0]|0}else E=Di(a)|0;if((E|32|0)==120){j=+yc(a,g,e,p,d);break a}if(!(f[k>>2]|0))F=48;else{f[c>>2]=(f[c>>2]|0)+-1;F=48}}else F=v;j=+ob(a,F,g,e,p,d);break a;break}default:{if(f[k>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;s=ir()|0;f[s>>2]=22;Rm(a,0);j=0.0;break a}}}}while(0);if((i|0)==23){s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if((d|0)!=0&q>>>0>3){n=q;do{if(!s)f[c>>2]=(f[c>>2]|0)+-1;n=n+-1|0}while(n>>>0>3)}}j=+$($(p|0)*$(C))}while(0);return +j}function Mc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0;b=u;u=u+16|0;c=b+4|0;d=b;e=f[a+64>>2]|0;if(!e){u=b;return}g=Qa[f[(f[e>>2]|0)+32>>2]&127](e)|0;if(!g){u=b;return}e=g+24|0;h=g+28|0;i=((f[h>>2]|0)-(f[e>>2]|0)>>2)-(f[g+44>>2]|0)|0;j=a+56|0;k=f[j>>2]|0;if(((f[k+12>>2]|0)-(f[k+8>>2]|0)|0)>4){f[c>>2]=0;l=c+4|0;f[l>>2]=0;f[c+8>>2]=0;m=c+8|0;n=0;o=k;while(1){if(!(f[(f[(f[o+8>>2]|0)+(n<<2)>>2]|0)+56>>2]|0))p=o;else{k=Ra[f[(f[a>>2]|0)+56>>2]&127](a,n)|0;f[d>>2]=k;q=k;do if(k|0){r=f[l>>2]|0;if((r|0)==(f[m>>2]|0)){Ci(c,d);break}else{f[r>>2]=q;f[l>>2]=(f[l>>2]|0)+4;break}}while(0);p=f[j>>2]|0}n=n+1|0;if((n|0)>=((f[p+12>>2]|0)-(f[p+8>>2]|0)>>2|0))break;else o=p}o=f[h>>2]|0;h=f[e>>2]|0;e=h;if((o|0)==(h|0)){s=i;t=f[c>>2]|0}else{n=o-h>>2;h=g+12|0;g=f[l>>2]|0;o=f[c>>2]|0;c=(g|0)==(o|0);j=o;d=g-o>>2;o=p+96|0;p=i;g=0;while(1){m=f[e+(g<<2)>>2]|0;if((m|0)==-1)v=p;else{q=f[o>>2]|0;k=f[q+(((m|0)/3|0)*12|0)+(((m|0)%3|0)<<2)>>2]|0;r=(((m>>>0)%3|0|0)==0?2:-1)+m|0;a:do if(((r|0)!=-1?(w=f[(f[h>>2]|0)+(r<<2)>>2]|0,(w|0)!=-1):0)?(x=w+(((w>>>0)%3|0|0)==0?2:-1)|0,(x|0)!=-1):0){if(c){w=0;y=x;z=k;while(1){A=z;z=f[q+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;B=w+((z|0)!=(A|0)&1)|0;if((y|0)==(m|0)){C=B;break a}A=(((y>>>0)%3|0|0)==0?2:-1)+y|0;if((A|0)==-1){C=B;break a}D=f[(f[h>>2]|0)+(A<<2)>>2]|0;if((D|0)==-1){C=B;break a}y=D+(((D>>>0)%3|0|0)==0?2:-1)|0;if((y|0)==-1){C=B;break a}else w=B}}else{E=0;F=x;G=m;H=k}while(1){w=f[q+(((F|0)/3|0)*12|0)+(((F|0)%3|0)<<2)>>2]|0;b:do if((w|0)==(H|0)){y=0;while(1){z=f[(f[j+(y<<2)>>2]|0)+28>>2]|0;y=y+1|0;if((f[z+(F<<2)>>2]|0)!=(f[z+(G<<2)>>2]|0)){I=H;J=28;break b}if(y>>>0>=d>>>0){K=H;L=E;break}}}else{I=w;J=28}while(0);if((J|0)==28){J=0;K=I;L=E+1|0}if((F|0)==(m|0)){C=L;break a}w=(((F>>>0)%3|0|0)==0?2:-1)+F|0;if((w|0)==-1){C=L;break a}y=f[(f[h>>2]|0)+(w<<2)>>2]|0;if((y|0)==-1){C=L;break a}w=y+(((y>>>0)%3|0|0)==0?2:-1)|0;if((w|0)==-1){C=L;break}else{y=F;E=L;F=w;H=K;G=y}}}else C=0;while(0);m=f[e+(g<<2)>>2]|0;q=m+1|0;if(((m|0)!=-1?(k=((q>>>0)%3|0|0)==0?m+-2|0:q,(k|0)!=-1):0)?(q=f[(f[h>>2]|0)+(k<<2)>>2]|0,k=q+1|0,(q|0)!=-1):0)M=((((k>>>0)%3|0|0)==0?q+-2|0:k)|0)==-1;else M=1;v=C+p+(((C|0)!=0&(M^1))<<31>>31)|0}g=g+1|0;if(g>>>0>=n>>>0){s=v;t=j;break}else p=v}}if(t|0){v=f[l>>2]|0;if((v|0)!=(t|0))f[l>>2]=v+(~((v+-4-t|0)>>>2)<<2);br(t)}N=s}else N=i;f[a+52>>2]=N;u=b;return}function Nc(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=u;u=u+32|0;j=i+4|0;k=i;l=i+16|0;m=(_(e|0)|0)^31;if((e|0)>0)if(m>>>0>17){n=0;u=i;return n|0}else o=m+1|0;else o=1;do if(g){m=dn(48)|0;f[j>>2]=m;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=m;p=13067;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[m+33>>0]=0;r=(sh(g,j)|0)==0;if((b[j+11>>0]|0)<0)br(f[j>>2]|0);if(!r){r=dn(48)|0;f[j>>2]=r;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=r;p=13067;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[r+33>>0]=0;p=Ck(g,j)|0;if((b[j+11>>0]|0)<0)br(f[j>>2]|0);if((p|0)<4){s=o+-2|0;break}if((p|0)<6){s=o+-1|0;break}if((p|0)>9){s=o+2|0;break}else{s=o+((p|0)>7&1)|0;break}}else s=o}else s=o;while(0);o=(s|0)>1?s:1;s=(o|0)<18?o:18;b[l>>0]=s;o=h+16|0;g=f[o+4>>2]|0;if(!((g|0)>0|(g|0)==0&(f[o>>2]|0)>>>0>0)){f[k>>2]=f[h+4>>2];f[j>>2]=f[k>>2];ye(h,j,l,l+1|0)|0}do switch(s&31){case 1:case 0:{n=je(a,c,d,h)|0;u=i;return n|0}case 2:{n=ie(a,c,d,h)|0;u=i;return n|0}case 3:{n=he(a,c,d,h)|0;u=i;return n|0}case 4:{n=ge(a,c,d,h)|0;u=i;return n|0}case 5:{n=fe(a,c,d,h)|0;u=i;return n|0}case 6:{n=ee(a,c,d,h)|0;u=i;return n|0}case 7:{n=de(a,c,d,h)|0;u=i;return n|0}case 8:{n=ce(a,c,d,h)|0;u=i;return n|0}case 9:{n=be(a,c,d,h)|0;u=i;return n|0}case 10:{n=ae(a,c,d,h)|0;u=i;return n|0}case 11:{n=$d(a,c,d,h)|0;u=i;return n|0}case 12:{n=_d(a,c,d,h)|0;u=i;return n|0}case 13:{n=Zd(a,c,d,h)|0;u=i;return n|0}case 14:{n=Yd(a,c,d,h)|0;u=i;return n|0}case 15:{n=Xd(a,c,d,h)|0;u=i;return n|0}case 16:{n=Wd(a,c,d,h)|0;u=i;return n|0}case 17:{n=Vd(a,c,d,h)|0;u=i;return n|0}case 18:{n=Ud(a,c,d,h)|0;u=i;return n|0}default:{n=0;u=i;return n|0}}while(0);return 0}function Oc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;wb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Pc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;xb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Qc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;yb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Rc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;zb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Sc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ab(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Tc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*524288.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==524288){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Eb(z,A,g);a:do if((x|0)<524288){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=524288-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>524288;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-524288|0;m=x;while(1){v=524288.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==524288){C=p;D=524288;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=524288){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*1.9073486328125e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Uc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*262144.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==262144){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Bb(z,A,g);a:do if((x|0)<262144){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=262144-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>262144;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-262144|0;m=x;while(1){v=262144.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==262144){C=p;D=262144;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=262144){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*3.814697265625e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Vc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*65536.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==65536){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Cb(z,A,g);a:do if((x|0)<65536){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=65536-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>65536;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-65536|0;m=x;while(1){v=65536.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==65536){C=p;D=65536;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=65536){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.0000152587890625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Wc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*32768.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==32768){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Db(z,A,g);a:do if((x|0)<32768){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=32768-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>32768;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-32768|0;m=x;while(1){v=32768.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==32768){C=p;D=32768;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=32768){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000030517578125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Xc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*8192.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==8192){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Fb(z,A,g);a:do if((x|0)<8192){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=8192-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>8192;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-8192|0;m=x;while(1){v=8192.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==8192){C=p;D=8192;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=8192){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.0001220703125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Yc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Gb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function Zc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Hb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function _c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ib(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function $c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Jb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function ad(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Kb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function bd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Lb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function cd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Mb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Tn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else dh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)mq(h);else{i=l<<2;t=dn(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;hj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Nb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);br(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Fg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=xe(a,d)|0;u=e;return w|0}function ed(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=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,f[k+4>>2]|0)|0;k=I;n=Tn(l|0,k|0,(l|0)==0&(k|0)==0&1|0,0)|0;k=~~((+(j>>>0)+4294967296.0*+(m>>>0))/(+(n>>>0)+4294967296.0*+(I>>>0))*256.0+.5)>>>0;n=k>>>0<255?k:255;k=n+((n|0)==0&1)&255;b[h>>0]=k;n=a+12|0;m=a+16|0;j=((f[m>>2]|0)-(f[n>>2]|0)<<1)+64|0;f[i>>2]=0;l=i+4|0;f[l>>2]=0;f[i+8>>2]=0;if(!j)o=0;else{if((j|0)<0)mq(i);p=dn(j)|0;f[l>>2]=p;f[i>>2]=p;f[i+8>>2]=p+j;q=j;j=p;do{b[j>>0]=0;j=(f[l>>2]|0)+1|0;f[l>>2]=j;q=q+-1|0}while((q|0)!=0);o=f[i>>2]|0}q=a+28|0;j=(f[q>>2]|0)+-1|0;a:do if((j|0)>-1){p=a+24|0;r=j;s=0;t=4096;v=k;while(1){w=(f[p>>2]&1<>>0>>0){y=s;z=t}else{b[o+s>>0]=t;y=s+1|0;z=t>>>8}on(f[3780+(x<<3)>>2]|0,0,z|0,0)|0;A=z+(w?0:0-v&255)+(X((z+I|0)>>>(f[3780+(x<<3)+4>>2]|0),256-x|0)|0)|0;x=r+-1|0;if((x|0)<=-1){B=y;C=A;break a}r=x;s=y;t=A;v=b[h>>0]|0}}else{B=0;C=4096}while(0);y=f[m>>2]|0;if((f[n>>2]|0)==(y|0)){D=B;E=C}else{z=B;B=C;C=y;while(1){C=C+-4|0;y=f[C>>2]|0;k=31;j=z;v=B;while(1){t=b[h>>0]|0;s=(1<>>0>>0){F=j;G=v}else{b[o+j>>0]=v;F=j+1|0;G=v>>>8}on(f[3780+(r<<3)>>2]|0,0,G|0,0)|0;v=G+(s?0:0-t&255)+(X((G+I|0)>>>(f[3780+(r<<3)+4>>2]|0),256-r|0)|0)|0;if((k|0)<=0)break;else{k=k+-1|0;j=F}}if((f[n>>2]|0)==(C|0)){D=F;E=v;break}else{z=F;B=v}}}B=E+-4096|0;do if(B>>>0>=64){if(B>>>0<16384){F=o+D|0;z=E+12288|0;b[F>>0]=z;H=2;J=z>>>8;K=F+1|0;L=25;break}if(B>>>0<4194304){F=o+D|0;z=E+8384512|0;b[F>>0]=z;b[F+1>>0]=z>>>8;H=3;J=z>>>16;K=F+2|0;L=25}else M=D}else{H=1;J=B;K=o+D|0;L=25}while(0);if((L|0)==25){b[K>>0]=J;M=H+D|0}D=c+16|0;H=D;J=f[H+4>>2]|0;if(!((J|0)>0|(J|0)==0&(f[H>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0}Nh(M,c)|0;h=f[i>>2]|0;H=D;D=f[H+4>>2]|0;if(!((D|0)>0|(D|0)==0&(f[H>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+M|0)|0}M=e;f[M>>2]=0;f[M+4>>2]=0;cf(a,2,e);e=f[a+12>>2]|0;M=f[m>>2]|0;if((M|0)!=(e|0))f[m>>2]=M+(~((M+-4-e|0)>>>2)<<2);f[a+24>>2]=0;f[q>>2]=0;q=f[i>>2]|0;if(!q){u=d;return}if((f[l>>2]|0)!=(q|0))f[l>>2]=q;br(q);u=d;return}function gd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;c=u;u=u+16|0;b=c+8|0;d=c+4|0;e=c;g=a+64|0;h=f[g>>2]|0;if((f[h+28>>2]|0)==(f[h+24>>2]|0)){u=c;return}i=a+52|0;j=a+56|0;k=a+60|0;l=a+12|0;m=a+28|0;n=a+40|0;o=a+44|0;p=a+48|0;q=0;r=0;s=h;while(1){h=f[(f[s+24>>2]|0)+(r<<2)>>2]|0;if((h|0)==-1){t=q;v=s}else{w=q+1|0;f[b>>2]=q;x=f[j>>2]|0;if((x|0)==(f[k>>2]|0))Ci(i,b);else{f[x>>2]=q;f[j>>2]=x+4}f[d>>2]=h;f[e>>2]=0;a:do if(!(f[(f[l>>2]|0)+(r>>>5<<2)>>2]&1<<(r&31)))y=h;else{x=h+1|0;z=((x>>>0)%3|0|0)==0?h+-2|0:x;if(((z|0)!=-1?(f[(f[a>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)==0:0)?(x=f[(f[(f[g>>2]|0)+12>>2]|0)+(z<<2)>>2]|0,z=x+1|0,(x|0)!=-1):0){A=((z>>>0)%3|0|0)==0?x+-2|0:z;f[e>>2]=A;if((A|0)==-1){y=h;break}else B=A;while(1){f[d>>2]=B;A=B+1|0;z=((A>>>0)%3|0|0)==0?B+-2|0:A;if((z|0)==-1)break;if(f[(f[a>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)break;A=f[(f[(f[g>>2]|0)+12>>2]|0)+(z<<2)>>2]|0;z=A+1|0;if((A|0)==-1)break;x=((z>>>0)%3|0|0)==0?A+-2|0:z;f[e>>2]=x;if((x|0)==-1){y=B;break a}else B=x}f[e>>2]=-1;y=B;break}f[e>>2]=-1;y=h}while(0);f[(f[m>>2]|0)+(y<<2)>>2]=f[b>>2];h=f[o>>2]|0;if((h|0)==(f[p>>2]|0))Ci(n,d);else{f[h>>2]=f[d>>2];f[o>>2]=h+4}h=f[g>>2]|0;x=f[d>>2]|0;b:do if(((x|0)!=-1?(z=(((x>>>0)%3|0|0)==0?2:-1)+x|0,(z|0)!=-1):0)?(A=f[(f[h+12>>2]|0)+(z<<2)>>2]|0,(A|0)!=-1):0){z=A+(((A>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=z;if((z|0)!=-1&(z|0)!=(x|0)){A=w;C=z;while(1){z=C+1|0;D=((z>>>0)%3|0|0)==0?C+-2|0:z;do if(f[(f[a>>2]|0)+(D>>>5<<2)>>2]&1<<(D&31)){z=A+1|0;f[b>>2]=A;E=f[j>>2]|0;if((E|0)==(f[k>>2]|0))Ci(i,b);else{f[E>>2]=A;f[j>>2]=E+4}E=f[o>>2]|0;if((E|0)==(f[p>>2]|0)){Ci(n,e);F=z;break}else{f[E>>2]=f[e>>2];f[o>>2]=E+4;F=z;break}}else F=A;while(0);f[(f[m>>2]|0)+(f[e>>2]<<2)>>2]=f[b>>2];G=f[g>>2]|0;D=f[e>>2]|0;if((D|0)==-1)break;z=(((D>>>0)%3|0|0)==0?2:-1)+D|0;if((z|0)==-1)break;D=f[(f[G+12>>2]|0)+(z<<2)>>2]|0;if((D|0)==-1)break;C=D+(((D>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=C;if(!((C|0)!=-1?(C|0)!=(f[d>>2]|0):0)){H=F;I=G;break b}else A=F}f[e>>2]=-1;H=F;I=G}else{H=w;I=h}}else J=26;while(0);if((J|0)==26){J=0;f[e>>2]=-1;H=w;I=h}t=H;v=I}r=r+1|0;if(r>>>0>=(f[v+28>>2]|0)-(f[v+24>>2]|0)>>2>>>0)break;else{q=t;s=v}}u=c;return}function hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+124|0;f[h>>2]=(f[h>>2]|0)+1;h=a+88|0;i=a+120|0;j=f[i>>2]|0;k=j+1|0;do if((j|0)!=-1){l=((k>>>0)%3|0|0)==0?j+-2|0:k;if(!((j>>>0)%3|0)){m=j+2|0;n=l;break}else{m=j+-1|0;n=l;break}}else{m=-1;n=-1}while(0);k=a+104|0;l=a+92|0;o=f[l>>2]|0;p=o+(n<<2)|0;q=f[k>>2]|0;r=q+(f[p>>2]<<2)|0;s=f[r>>2]|0;switch(b|0){case 1:case 0:{f[r>>2]=s+-1;r=q+(f[o+(m<<2)>>2]<<2)|0;f[r>>2]=(f[r>>2]|0)+-1;if((b|0)==1){if((m|0)!=-1?(r=f[(f[(f[h>>2]|0)+12>>2]|0)+(m<<2)>>2]|0,(r|0)!=-1):0){t=a+64|0;v=1;w=r;while(1){r=f[t>>2]|0;x=f[(f[r>>2]|0)+36>>2]|0;f[e>>2]=(w>>>0)/3|0;f[d>>2]=f[e>>2];if(Ra[x&127](r,d)|0){y=v;break}r=w+1|0;x=((r>>>0)%3|0|0)==0?w+-2|0:r;if((x|0)==-1){z=12;break}w=f[(f[(f[h>>2]|0)+12>>2]|0)+(x<<2)>>2]|0;x=v+1|0;if((w|0)==-1){y=x;break}else v=x}if((z|0)==12)y=v+1|0;A=y;B=f[k>>2]|0;C=f[l>>2]|0}else{A=1;B=q;C=o}f[B+(f[C+(f[i>>2]<<2)>>2]<<2)>>2]=A;A=a+108|0;i=f[A>>2]|0;C=i-B>>2;B=i;if((n|0)!=-1?(i=f[(f[(f[h>>2]|0)+12>>2]|0)+(n<<2)>>2]|0,(i|0)!=-1):0){n=a+64|0;y=1;v=i;while(1){i=f[n>>2]|0;w=f[(f[i>>2]|0)+36>>2]|0;f[g>>2]=(v>>>0)/3|0;f[d>>2]=f[g>>2];if(Ra[w&127](i,d)|0){D=y;break}i=v+1|0;f[(f[l>>2]|0)+((((i>>>0)%3|0|0)==0?v+-2|0:i)<<2)>>2]=C;i=(((v>>>0)%3|0|0)==0?2:-1)+v|0;if((i|0)==-1){z=20;break}v=f[(f[(f[h>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;i=y+1|0;if((v|0)==-1){D=i;break}else y=i}if((z|0)==20)D=y+1|0;E=D;F=f[A>>2]|0}else{E=1;F=B}f[d>>2]=E;if(F>>>0<(f[a+112>>2]|0)>>>0){f[F>>2]=E;f[A>>2]=F+4}else Ci(k,d)}break}case 5:{k=q+(f[o+(j<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1;k=q+(f[p>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1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&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+2|0;v=e+12|0;w=q+6|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=d[q>>1]|0;A=e;B=x;while(1){C=B+8|0;if(z<<16>>16!=(d[C>>1]|0)){y=A;break d}if((d[u>>1]|0)!=(d[C+2>>1]|0)){y=A;break d}if((d[v>>1]|0)!=(d[B+12>>1]|0)){y=A;break d}if((d[w>>1]|0)!=(d[C+6>>1]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=c;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(b>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+2|0;u=e+12|0;x=w+6|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=d[w>>1]|0;B=e;z=q;while(1){D=z+8|0;if(A<<16>>16!=(d[D>>1]|0)){G=B;break e}if((d[v>>1]|0)!=(d[D+2>>1]|0)){G=B;break e}if((d[u>>1]|0)!=(d[z+12>>1]|0)){G=B;break e}if((d[x>>1]|0)!=(d[D+6>>1]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);c=f[p>>2]|0;if(!c){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function kd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=q+3|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=b[q>>0]|0;A=e;B=x;while(1){C=B+8|0;if(z<<24>>24!=(b[C>>0]|0)){y=A;break d}if((b[u>>0]|0)!=(b[C+1>>0]|0)){y=A;break d}if((b[v>>0]|0)!=(b[C+2>>0]|0)){y=A;break d}if((b[w>>0]|0)!=(b[C+3>>0]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=d;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(c>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+1|0;u=w+2|0;x=w+3|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=b[w>>0]|0;B=e;z=q;while(1){D=z+8|0;if(A<<24>>24!=(b[D>>0]|0)){G=B;break e}if((b[v>>0]|0)!=(b[D+1>>0]|0)){G=B;break e}if((b[u>>0]|0)!=(b[D+2>>0]|0)){G=B;break e}if((b[x>>0]|0)!=(b[D+3>>0]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);d=f[p>>2]|0;if(!d){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function ld(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)br(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}d=dn(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)br(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=d+20|0;v=f[d>>2]|0;d:do if(!v)w=d;else{x=f[d+8>>2]|0;y=d;z=v;while(1){if((x|0)!=(f[z+8>>2]|0)){w=y;break d}if((f[p>>2]|0)!=(f[z+12>>2]|0)){w=y;break d}if((f[t>>2]|0)!=(f[z+16>>2]|0)){w=y;break d}if((f[u>>2]|0)!=(f[z+20>>2]|0)){w=y;break d}A=f[z>>2]|0;if(!A){w=z;break}else{B=z;z=A;y=B}}}while(0);f[i>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}else{d=c;while(1){u=f[d+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(j|0)){o=d;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){q=d;r=D;s=u;break b}u=d+12|0;t=d+16|0;p=d+20|0;v=f[d>>2]|0;e:do if(!v)E=d;else{y=f[d+8>>2]|0;z=d;x=v;while(1){if((y|0)!=(f[x+8>>2]|0)){E=z;break e}if((f[u>>2]|0)!=(f[x+12>>2]|0)){E=z;break e}if((f[t>>2]|0)!=(f[x+16>>2]|0)){E=z;break e}if((f[p>>2]|0)!=(f[x+20>>2]|0)){E=z;break e}B=f[x>>2]|0;if(!B){E=x;break}else{A=x;x=B;z=A}}}while(0);f[i>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}while(0);c=f[o>>2]|0;if(!c){C=43;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){C=43;break}else{j=r;k=q;m=q}}if((C|0)==43)return}function md(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0;i=u;u=u+352|0;j=i+340|0;k=i+336|0;l=i+80|0;m=i+48|0;n=i;hj(l|0,0,256)|0;o=f[e+4>>2]|0;p=f[e>>2]|0;q=p;if((o|0)!=(p|0)){r=o-p>>2;p=0;do{o=l+(f[q+(p<<2)>>2]<<3)|0;s=o;t=Tn(f[s>>2]|0,f[s+4>>2]|0,1,0)|0;s=o;f[s>>2]=t;f[s+4>>2]=I;p=p+1|0}while(p>>>0>>0)}Cn(m);r=Rn(c|0,((c|0)<0)<<31>>31|0,5)|0;p=I;q=n+40|0;s=q;f[s>>2]=0;f[s+4>>2]=0;s=n;t=s+36|0;do{f[s>>2]=0;s=s+4|0}while((s|0)<(t|0));$c(n,l,32,g)|0;l=n+16|0;s=Rn(f[l>>2]|0,f[l+4>>2]|0,1)|0;l=g+4|0;t=(f[l>>2]|0)-(f[g>>2]|0)|0;o=q;f[o>>2]=t;f[o+4>>2]=0;o=Tn(s|0,I|0,39,0)|0;s=Wn(o|0,I|0,3)|0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n+4|0;n=f[v>>2]|0;if((n|0)!=(o|0))f[v>>2]=n+(~((n+-8-o|0)>>>3)<<3);br(o)}o=m+12|0;n=f[o>>2]|0;f[o>>2]=0;if(n|0)br(n);n=f[m>>2]|0;if(!n){u=i;return 1}if((f[d>>2]|0)!=(n|0))f[d>>2]=n;br(n);u=i;return 1}function nd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=e+12|0;v=f[e>>2]|0;d:do if(!v)w=e;else{x=d[q>>1]|0;y=q+2|0;z=e;A=v;while(1){B=A+8|0;if(x<<16>>16!=(d[B>>1]|0)){w=z;break d}if((d[y>>1]|0)!=(d[B+2>>1]|0)){w=z;break d}if((d[u>>1]|0)!=(d[A+12>>1]|0)){w=z;break d}B=f[A>>2]|0;if(!B){w=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)E=u;else E=(u>>>0)%(b>>>0)|0;if((E|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(E<<2)|0;if(!(f[u>>2]|0)){r=e;s=E;t=u;break b}u=e+8|0;v=e+12|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=d[u>>1]|0;A=u+2|0;y=e;x=q;while(1){C=x+8|0;if(z<<16>>16!=(d[C>>1]|0)){F=y;break e}if((d[A>>1]|0)!=(d[C+2>>1]|0)){F=y;break e}if((d[v>>1]|0)!=(d[x+12>>1]|0)){F=y;break e}C=f[x>>2]|0;if(!C){F=x;break}else{B=x;x=C;y=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);c=f[p>>2]|0;if(!c){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function od(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=f[e>>2]|0;d:do if(!w)x=e;else{y=b[q>>0]|0;z=e;A=w;while(1){B=A+8|0;if(y<<24>>24!=(b[B>>0]|0)){x=z;break d}if((b[u>>0]|0)!=(b[B+1>>0]|0)){x=z;break d}if((b[v>>0]|0)!=(b[B+2>>0]|0)){x=z;break d}B=f[A>>2]|0;if(!B){x=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[x>>2];f[x>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=d;while(1){v=f[e+4>>2]|0;if(v>>>0>>0)E=v;else E=(v>>>0)%(c>>>0)|0;if((E|0)==(k|0)){p=e;break c}v=(f[a>>2]|0)+(E<<2)|0;if(!(f[v>>2]|0)){r=e;s=E;t=v;break b}v=e+8|0;u=v+1|0;w=v+2|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=b[v>>0]|0;A=e;y=q;while(1){C=y+8|0;if(z<<24>>24!=(b[C>>0]|0)){F=A;break e}if((b[u>>0]|0)!=(b[C+1>>0]|0)){F=A;break e}if((b[w>>0]|0)!=(b[C+2>>0]|0)){F=A;break e}C=f[y>>2]|0;if(!C){F=y;break}else{B=y;y=C;A=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);d=f[p>>2]|0;if(!d){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function pd(a,b){a=+a;b=+b;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s>>2]|0;g=f[s+4>>2]|0;h=Wn(c|0,d|0,52)|0;i=h&2047;h=Wn(e|0,g|0,52)|0;j=h&2047;h=d&-2147483648;k=Rn(e|0,g|0,1)|0;l=I;a:do if(!((k|0)==0&(l|0)==0)?(m=xo(b)|0,n=I&2147483647,!((i|0)==2047|(n>>>0>2146435072|(n|0)==2146435072&m>>>0>0))):0){m=Rn(c|0,d|0,1)|0;n=I;if(!(n>>>0>l>>>0|(n|0)==(l|0)&m>>>0>k>>>0))return +((m|0)==(k|0)&(n|0)==(l|0)?a*0.0:a);if(!i){n=Rn(c|0,d|0,12)|0;m=I;if((m|0)>-1|(m|0)==-1&n>>>0>4294967295){o=0;q=n;n=m;while(1){m=o+-1|0;q=Rn(q|0,n|0,1)|0;n=I;if(!((n|0)>-1|(n|0)==-1&q>>>0>4294967295)){r=m;break}else o=m}}else r=0;o=Rn(c|0,d|0,1-r|0)|0;t=r;u=o;v=I}else{t=i;u=c;v=d&1048575|1048576}if(!j){o=Rn(e|0,g|0,12)|0;q=I;if((q|0)>-1|(q|0)==-1&o>>>0>4294967295){n=0;m=o;o=q;while(1){q=n+-1|0;m=Rn(m|0,o|0,1)|0;o=I;if(!((o|0)>-1|(o|0)==-1&m>>>0>4294967295)){w=q;break}else n=q}}else w=0;n=Rn(e|0,g|0,1-w|0)|0;x=w;y=n;z=I}else{x=j;y=e;z=g&1048575|1048576}n=Vn(u|0,v|0,y|0,z|0)|0;m=I;o=(m|0)>-1|(m|0)==-1&n>>>0>4294967295;b:do if((t|0)>(x|0)){q=t;A=m;B=o;C=u;D=v;E=n;while(1){if(B)if((E|0)==0&(A|0)==0)break;else{F=E;G=A}else{F=C;G=D}H=Rn(F|0,G|0,1)|0;J=I;K=q+-1|0;L=Vn(H|0,J|0,y|0,z|0)|0;M=I;N=(M|0)>-1|(M|0)==-1&L>>>0>4294967295;if((K|0)>(x|0)){q=K;A=M;B=N;C=H;D=J;E=L}else{O=K;P=N;Q=L;R=M;S=H;T=J;break b}}U=a*0.0;break a}else{O=t;P=o;Q=n;R=m;S=u;T=v}while(0);if(P)if((Q|0)==0&(R|0)==0){U=a*0.0;break}else{V=R;W=Q}else{V=T;W=S}if(V>>>0<1048576|(V|0)==1048576&W>>>0<0){m=O;n=W;o=V;while(1){E=Rn(n|0,o|0,1)|0;D=I;C=m+-1|0;if(D>>>0<1048576|(D|0)==1048576&E>>>0<0){m=C;n=E;o=D}else{X=C;Y=E;Z=D;break}}}else{X=O;Y=W;Z=V}if((X|0)>0){o=Tn(Y|0,Z|0,0,-1048576)|0;n=I;m=Rn(X|0,0,52)|0;_=n|I;$=o|m}else{m=Wn(Y|0,Z|0,1-X|0)|0;_=I;$=m}f[s>>2]=$;f[s+4>>2]=_|h;U=+p[s>>3]}else aa=3;while(0);if((aa|0)==3){ba=a*b;U=ba/ba}return +U}function qd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)br(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}d=dn(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)br(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=f[d>>2]|0;d:do if(!u)v=d;else{w=f[d+8>>2]|0;x=d;y=u;while(1){if((w|0)!=(f[y+8>>2]|0)){v=x;break d}if((f[p>>2]|0)!=(f[y+12>>2]|0)){v=x;break d}if((f[t>>2]|0)!=(f[y+16>>2]|0)){v=x;break d}z=f[y>>2]|0;if(!z){v=y;break}else{A=y;y=z;x=A}}}while(0);f[i>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}else{d=c;while(1){t=f[d+4>>2]|0;if(t>>>0>>0)C=t;else C=(t>>>0)%(b>>>0)|0;if((C|0)==(j|0)){o=d;break c}t=(f[a>>2]|0)+(C<<2)|0;if(!(f[t>>2]|0)){q=d;r=C;s=t;break b}t=d+12|0;p=d+16|0;u=f[d>>2]|0;e:do if(!u)D=d;else{x=f[d+8>>2]|0;y=d;w=u;while(1){if((x|0)!=(f[w+8>>2]|0)){D=y;break e}if((f[t>>2]|0)!=(f[w+12>>2]|0)){D=y;break e}if((f[p>>2]|0)!=(f[w+16>>2]|0)){D=y;break e}A=f[w>>2]|0;if(!A){D=w;break}else{z=w;w=A;y=z}}}while(0);f[i>>2]=f[D>>2];f[D>>2]=f[f[(f[a>>2]|0)+(C<<2)>>2]>>2];f[f[(f[a>>2]|0)+(C<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}while(0);c=f[o>>2]|0;if(!c){B=41;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){B=41;break}else{j=r;k=q;m=q}}if((B|0)==41)return}function rd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){o=d;while(1){e=f[o+4>>2]|0;if(!i)if(e>>>0>>0)p=e;else p=(e>>>0)%(c>>>0)|0;else p=e&h;if((p|0)==(k|0))break;q=(f[a>>2]|0)+(p<<2)|0;if(!(f[q>>2]|0))break b;e=f[o>>2]|0;c:do if(!e)r=o;else{s=o+8|0;t=b[s+11>>0]|0;u=t<<24>>24<0;v=t&255;t=u?f[o+12>>2]|0:v;w=(t|0)==0;if(u){u=o;x=e;while(1){y=x+8|0;z=b[y+11>>0]|0;A=z<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:z&255)|0)){r=u;break c}if(!w?Pk(f[s>>2]|0,A?f[y>>2]|0:y,t)|0:0){r=u;break c}y=f[x>>2]|0;if(!y){r=x;break c}else{A=x;x=y;u=A}}}if(w){u=o;x=e;while(1){A=b[x+8+11>>0]|0;if((A<<24>>24<0?f[x+12>>2]|0:A&255)|0){r=u;break c}A=f[x>>2]|0;if(!A){r=x;break c}else{y=x;x=A;u=y}}}u=o;x=e;while(1){w=x+8|0;y=b[w+11>>0]|0;A=y<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:y&255)|0)){r=u;break c}y=A?f[w>>2]|0:w;if((b[y>>0]|0)==(f[s>>2]&255)<<24>>24){B=s;C=v;D=y}else{r=u;break c}while(1){C=C+-1|0;B=B+1|0;if(!C)break;D=D+1|0;if((b[B>>0]|0)!=(b[D>>0]|0)){r=u;break c}}y=f[x>>2]|0;if(!y){r=x;break}else{w=x;x=y;u=w}}}while(0);f[j>>2]=f[r>>2];f[r>>2]=f[f[(f[a>>2]|0)+(p<<2)>>2]>>2];f[f[(f[a>>2]|0)+(p<<2)>>2]>>2]=o;e=f[g>>2]|0;if(!e){E=43;break a}else o=e}d=f[o>>2]|0;if(!d){E=43;break a}else{g=o;j=o}}f[q>>2]=j;m=f[o>>2]|0;if(!m){E=43;break}else{k=p;l=o;n=o}}if((E|0)==43)return}function sd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+48|0;d=c+8|0;e=c+4|0;g=c;h=a+44|0;Nh(f[h>>2]|0,b)|0;if(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<(k&31)|0)!=0)}while((i|0)>5)}fd(d,b);tj(d)}j=a+100|0;Nh(f[j>>2]|0,b)|0;if(f[j>>2]|0){rn(d);lk(d);h=f[j>>2]|0;if((h|0)>3){j=a+96|0;i=h;do{h=i;i=i+-4|0;Vi(d,(f[(f[j>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)!=0);k=h+-3|0;Vi(d,(f[(f[j>>2]|0)+(k>>>5<<2)>>2]&1<<(k&31)|0)!=0);k=h+-2|0;Vi(d,(f[(f[j>>2]|0)+(k>>>5<<2)>>2]&1<<(k&31)|0)!=0);k=h+-1|0;Vi(d,(f[(f[j>>2]|0)+(k>>>5<<2)>>2]&1<<(k&31)|0)!=0)}while((h|0)>7)}fd(d,b);tj(d)}f[g>>2]=f[a+12>>2];j=b+16|0;i=j;h=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&h>>>0>0){l=k;m=h}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;h=j;l=f[h+4>>2]|0;m=f[h>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;u=c;return 1}function ud(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=d[q>>1]|0;x=q+2|0;y=e;z=u;while(1){A=z+8|0;if(w<<16>>16!=(d[A>>1]|0)){v=y;break d}if((d[x>>1]|0)!=(d[A+2>>1]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=d[u>>1]|0;z=u+2|0;x=e;w=q;while(1){B=w+8|0;if(y<<16>>16!=(d[B>>1]|0)){E=x;break e}if((d[z>>1]|0)!=(d[B+2>>1]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);c=f[p>>2]|0;if(!c){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function vd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=b[q>>0]|0;x=q+1|0;y=e;z=u;while(1){A=z+8|0;if(w<<24>>24!=(b[A>>0]|0)){v=y;break d}if((b[x>>0]|0)!=(b[A+1>>0]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=d;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(c>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=b[u>>0]|0;z=u+1|0;x=e;w=q;while(1){B=w+8|0;if(y<<24>>24!=(b[B>>0]|0)){E=x;break e}if((b[z>>0]|0)!=(b[B+1>>0]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);d=f[p>>2]|0;if(!d){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function wd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=u;u=u+48|0;d=c+32|0;e=c+28|0;g=c+16|0;h=c;i=a+16|0;j=f[i>>2]|0;if(j|0){k=f[b>>2]|0;l=i;m=j;a:while(1){j=m;while(1){if((f[j+16>>2]|0)>=(k|0))break;n=f[j+4>>2]|0;if(!n){o=l;break a}else j=n}m=f[j>>2]|0;if(!m){o=j;break}else l=j}if((o|0)!=(i|0)?(k|0)>=(f[o+16>>2]|0):0){p=o;q=p+20|0;u=c;return q|0}}wp(g);f[h>>2]=f[b>>2];b=h+4|0;f[h+8>>2]=0;o=h+12|0;f[o>>2]=0;k=h+8|0;f[b>>2]=k;l=f[g>>2]|0;m=g+4|0;if((l|0)!=(m|0)){n=k;r=l;while(1){l=r+16|0;f[e>>2]=n;f[d>>2]=f[e>>2];Wg(b,d,l,l)|0;l=f[r+4>>2]|0;if(!l){s=r+8|0;t=f[s>>2]|0;if((f[t>>2]|0)==(r|0))v=t;else{t=s;do{s=f[t>>2]|0;t=s+8|0;w=f[t>>2]|0}while((f[w>>2]|0)!=(s|0));v=w}}else{t=l;while(1){j=f[t>>2]|0;if(!j)break;else t=j}v=t}if((v|0)==(m|0))break;else r=v}}v=a+12|0;r=f[i>>2]|0;do if(r){d=f[h>>2]|0;e=a+16|0;n=r;while(1){l=f[n+16>>2]|0;if((d|0)<(l|0)){j=f[n>>2]|0;if(!j){x=23;break}else{y=n;z=j}}else{if((l|0)>=(d|0)){x=27;break}A=n+4|0;l=f[A>>2]|0;if(!l){x=26;break}else{y=A;z=l}}e=y;n=z}if((x|0)==23){B=n;C=n;break}else if((x|0)==26){B=n;C=A;break}else if((x|0)==27){B=n;C=e;break}}else{B=i;C=i}while(0);i=f[C>>2]|0;if(!i){x=dn(32)|0;f[x+16>>2]=f[h>>2];A=x+20|0;f[A>>2]=f[b>>2];z=x+24|0;y=f[h+8>>2]|0;f[z>>2]=y;r=f[o>>2]|0;f[x+28>>2]=r;if(!r)f[A>>2]=z;else{f[y+8>>2]=z;f[b>>2]=k;f[k>>2]=0;f[o>>2]=0}f[x>>2]=0;f[x+4>>2]=0;f[x+8>>2]=B;f[C>>2]=x;B=f[f[v>>2]>>2]|0;if(!B)D=x;else{f[v>>2]=B;D=f[C>>2]|0}Ae(f[a+16>>2]|0,D);D=a+20|0;f[D>>2]=(f[D>>2]|0)+1;E=x}else E=i;sj(h+4|0,f[k>>2]|0);sj(g,f[m>>2]|0);p=E;q=p+20|0;u=c;return q|0}function xd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;c=i;e=i;while(1){j=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;c=(X(j>>>24^j,1540483477)|0)^(X(c,1540483477)|0);e=e+-4|0;if(e>>>0<=3)break;else d=d+4|0}d=i+-4|0;e=d&-4;k=d-e|0;l=g+(e+4)|0;m=c}else{k=i;l=g;m=i}switch(k|0){case 3:{n=h[l+2>>0]<<16^m;o=6;break}case 2:{n=m;o=6;break}case 1:{p=m;o=7;break}default:q=m}if((o|0)==6){p=h[l+1>>0]<<8^n;o=7}if((o|0)==7)q=X(p^h[l>>0],1540483477)|0;l=X(q>>>13^q,1540483477)|0;q=l>>>15^l;l=f[a+4>>2]|0;if(!l){r=0;return r|0}p=l+-1|0;n=(p&l|0)==0;if(!n)if(q>>>0>>0)s=q;else s=(q>>>0)%(l>>>0)|0;else s=q&p;m=f[(f[a>>2]|0)+(s<<2)>>2]|0;if(!m){r=0;return r|0}a=f[m>>2]|0;if(!a){r=0;return r|0}m=(i|0)==0;if(n){n=a;a:while(1){k=f[n+4>>2]|0;c=(k|0)==(q|0);if(!(c|(k&p|0)==(s|0))){r=0;o=40;break}do if(c?(k=n+8|0,e=b[k+11>>0]|0,d=e<<24>>24<0,j=e&255,((d?f[n+12>>2]|0:j)|0)==(i|0)):0){e=f[k>>2]|0;t=d?e:k;if(d){if(m){r=n;o=40;break a}if(!(Pk(t,g,i)|0)){r=n;o=40;break a}else break}if(m){r=n;o=40;break a}if((b[g>>0]|0)==(e&255)<<24>>24){e=k;k=j;j=g;do{k=k+-1|0;e=e+1|0;if(!k){r=n;o=40;break a}j=j+1|0}while((b[e>>0]|0)==(b[j>>0]|0))}}while(0);n=f[n>>2]|0;if(!n){r=0;o=40;break}}if((o|0)==40)return r|0}else u=a;b:while(1){a=f[u+4>>2]|0;do if((a|0)==(q|0)){n=u+8|0;p=b[n+11>>0]|0;c=p<<24>>24<0;j=p&255;if(((c?f[u+12>>2]|0:j)|0)==(i|0)){p=f[n>>2]|0;e=c?p:n;if(c){if(m){r=u;o=40;break b}if(!(Pk(e,g,i)|0)){r=u;o=40;break b}else break}if(m){r=u;o=40;break b}if((b[g>>0]|0)==(p&255)<<24>>24){p=n;n=j;j=g;do{n=n+-1|0;p=p+1|0;if(!n){r=u;o=40;break b}j=j+1|0}while((b[p>>0]|0)==(b[j>>0]|0))}}}else{if(a>>>0>>0)v=a;else v=(a>>>0)%(l>>>0)|0;if((v|0)!=(s|0)){r=0;o=40;break b}}while(0);u=f[u>>2]|0;if(!u){r=0;o=40;break}}if((o|0)==40)return r|0;return 0}function yd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)br(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}d=dn(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)br(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=f[d>>2]|0;d:do if(!t)u=d;else{v=f[d+8>>2]|0;w=d;x=t;while(1){if((v|0)!=(f[x+8>>2]|0)){u=w;break d}if((f[p>>2]|0)!=(f[x+12>>2]|0)){u=w;break d}y=f[x>>2]|0;if(!y){u=x;break}else{z=x;x=y;w=z}}}while(0);f[i>>2]=f[u>>2];f[u>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}else{d=c;while(1){p=f[d+4>>2]|0;if(p>>>0>>0)B=p;else B=(p>>>0)%(b>>>0)|0;if((B|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(B<<2)|0;if(!(f[p>>2]|0)){q=d;r=B;s=p;break b}p=d+12|0;t=f[d>>2]|0;e:do if(!t)C=d;else{w=f[d+8>>2]|0;x=d;v=t;while(1){if((w|0)!=(f[v+8>>2]|0)){C=x;break e}if((f[p>>2]|0)!=(f[v+12>>2]|0)){C=x;break e}z=f[v>>2]|0;if(!z){C=v;break}else{y=v;v=z;x=y}}}while(0);f[i>>2]=f[C>>2];f[C>>2]=f[f[(f[a>>2]|0)+(B<<2)>>2]>>2];f[f[(f[a>>2]|0)+(B<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}while(0);c=f[o>>2]|0;if(!c){A=39;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){A=39;break}else{j=r;k=q;m=q}}if((A|0)==39)return}function zd(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;h=a+4|0;i=f[c>>2]|0;c=i;do if((i|0)!=(h|0)){j=i+16|0;k=b[j+11>>0]|0;l=k<<24>>24<0;m=l?f[i+20>>2]|0:k&255;k=b[g+11>>0]|0;n=k<<24>>24<0;o=n?f[g+4>>2]|0:k&255;k=m>>>0>>0;p=k?m:o;if((p|0)!=0?(q=Pk(n?f[g>>2]|0:g,l?f[j>>2]|0:j,p)|0,(q|0)!=0):0){if((q|0)<0)break}else r=4;if((r|0)==4?o>>>0>>0:0)break;q=o>>>0>>0?o:m;if((q|0)!=0?(m=Pk(l?f[j>>2]|0:j,n?f[g>>2]|0:g,q)|0,(m|0)!=0):0){if((m|0)>=0)r=37}else r=21;if((r|0)==21?!k:0)r=37;if((r|0)==37){f[d>>2]=c;f[e>>2]=c;s=e;return s|0}k=f[i+4>>2]|0;m=(k|0)==0;if(m){q=i+8|0;j=f[q>>2]|0;if((f[j>>2]|0)==(i|0))t=j;else{j=q;do{q=f[j>>2]|0;j=q+8|0;l=f[j>>2]|0}while((f[l>>2]|0)!=(q|0));t=l}}else{j=k;while(1){l=f[j>>2]|0;if(!l)break;else j=l}t=j}do if((t|0)!=(h|0)){k=t+16|0;l=b[k+11>>0]|0;q=l<<24>>24<0;p=q?f[t+20>>2]|0:l&255;l=p>>>0>>0?p:o;if((l|0)!=0?(u=Pk(n?f[g>>2]|0:g,q?f[k>>2]|0:k,l)|0,(u|0)!=0):0){if((u|0)<0)break}else r=31;if((r|0)==31?o>>>0

>>0:0)break;s=hg(a,d,g)|0;return s|0}while(0);if(m){f[d>>2]=c;s=i+4|0;return s|0}else{f[d>>2]=t;s=t;return s|0}}while(0);t=f[i>>2]|0;do if((f[a>>2]|0)==(i|0))v=c;else{if(!t){h=i;while(1){e=f[h+8>>2]|0;if((f[e>>2]|0)==(h|0))h=e;else{w=e;break}}}else{h=t;while(1){m=f[h+4>>2]|0;if(!m){w=h;break}else h=m}}h=w;m=w+16|0;e=b[g+11>>0]|0;o=e<<24>>24<0;n=o?f[g+4>>2]|0:e&255;e=b[m+11>>0]|0;j=e<<24>>24<0;p=j?f[w+20>>2]|0:e&255;e=n>>>0

>>0?n:p;if((e|0)!=0?(u=Pk(j?f[m>>2]|0:m,o?f[g>>2]|0:g,e)|0,(u|0)!=0):0){if((u|0)<0){v=h;break}}else r=13;if((r|0)==13?p>>>0>>0:0){v=h;break}s=hg(a,d,g)|0;return s|0}while(0);if(!t){f[d>>2]=i;s=i;return s|0}else{f[d>>2]=v;s=v+4|0;return s|0}return 0}function Ad(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=u;u=u+16|0;h=g;f[c+48>>2]=d;f[c+44>>2]=e;e=f[c+8>>2]|0;i=c+12|0;j=f[i>>2]|0;if((j|0)!=(e|0)){k=j;do{j=k+-4|0;f[i>>2]=j;l=f[j>>2]|0;f[j>>2]=0;if(l|0)Va[f[(f[l>>2]|0)+4>>2]&127](l);k=f[i>>2]|0}while((k|0)!=(e|0))}e=f[c+20>>2]|0;k=c+24|0;i=f[k>>2]|0;if((i|0)!=(e|0))f[k>>2]=i+(~((i+-4-e|0)>>>2)<<2);e=f[c+32>>2]|0;i=c+36|0;k=f[i>>2]|0;if((k|0)!=(e|0))f[i>>2]=k+(~((k+-4-e|0)>>>2)<<2);if(!(f[c+4>>2]|0)){e=dn(32)|0;f[h>>2]=e;f[h+8>>2]=-2147483616;f[h+4>>2]=23;m=e;n=14670;o=m+23|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[e+23>>0]=0;f[a>>2]=-1;dj(a+4|0,h);if((b[h+11>>0]|0)<0)br(f[h>>2]|0);u=g;return}Jd(a,c);if(f[a>>2]|0){u=g;return}e=a+4|0;k=e+11|0;if((b[k>>0]|0)<0)br(f[e>>2]|0);Ji(a,c);if(f[a>>2]|0){u=g;return}if((b[k>>0]|0)<0)br(f[e>>2]|0);if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){i=dn(32)|0;f[h>>2]=i;f[h+8>>2]=-2147483616;f[h+4>>2]=29;m=i;n=14694;o=m+29|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[i+29>>0]=0;f[a>>2]=-1;dj(e,h);if((b[h+11>>0]|0)<0)br(f[h>>2]|0);u=g;return}if(!(Qa[f[(f[c>>2]|0)+20>>2]&127](c)|0)){i=dn(32)|0;f[h>>2]=i;f[h+8>>2]=-2147483616;f[h+4>>2]=31;m=i;n=14724;o=m+31|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[i+31>>0]=0;f[a>>2]=-1;dj(e,h);if((b[h+11>>0]|0)<0)br(f[h>>2]|0);u=g;return}Wa[f[(f[c>>2]|0)+24>>2]&15](a,c);if(f[a>>2]|0){u=g;return}if((b[k>>0]|0)<0)br(f[e>>2]|0);if(!(Qa[f[(f[c>>2]|0)+28>>2]&127](c)|0)){k=dn(48)|0;f[h>>2]=k;f[h+8>>2]=-2147483600;f[h+4>>2]=34;m=k;n=14756;o=m+34|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[k+34>>0]=0;f[a>>2]=-1;dj(e,h);if((b[h+11>>0]|0)<0)br(f[h>>2]|0);u=g;return}e=dn(32)|0;f[h>>2]=e;f[h+8>>2]=-2147483616;f[h+4>>2]=30;m=e;n=14791;o=m+30|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[e+30>>0]=0;e=Oj(d,h,0)|0;if((b[h+11>>0]|0)<0)br(f[h>>2]|0);if(e)Va[f[(f[c>>2]|0)+48>>2]&127](c);f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=g;return}function Bd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a;h=b;i=h;j=c;k=d;l=k;if(!i){m=(e|0)!=0;if(!l){if(m){f[e>>2]=(g>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(g>>>0)/(j>>>0)>>>0;return (I=n,o)|0}else{if(!m){n=0;o=0;return (I=n,o)|0}f[e>>2]=a|0;f[e+4>>2]=b&0;n=0;o=0;return (I=n,o)|0}}m=(l|0)==0;do if(j){if(!m){p=(_(l|0)|0)-(_(i|0)|0)|0;if(p>>>0<=31){q=p+1|0;r=31-p|0;s=p-31>>31;t=q;u=g>>>(q>>>0)&s|i<>>(q>>>0)&s;w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}r=j-1|0;if(r&j|0){s=(_(j|0)|0)+33-(_(i|0)|0)|0;q=64-s|0;p=32-s|0;y=p>>31;z=s-32|0;A=z>>31;t=s;u=p-1>>31&i>>>(z>>>0)|(i<>>(s>>>0))&A;v=A&i>>>(s>>>0);w=g<>>(z>>>0))&y|g<>31;break}if(e|0){f[e>>2]=r&g;f[e+4>>2]=0}if((j|0)==1){n=h|b&0;o=a|0|0;return (I=n,o)|0}else{r=im(j|0)|0;n=i>>>(r>>>0)|0;o=i<<32-r|g>>>(r>>>0)|0;return (I=n,o)|0}}else{if(m){if(e|0){f[e>>2]=(i>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(i>>>0)/(j>>>0)>>>0;return (I=n,o)|0}if(!g){if(e|0){f[e>>2]=0;f[e+4>>2]=(i>>>0)%(l>>>0)}n=0;o=(i>>>0)/(l>>>0)>>>0;return (I=n,o)|0}r=l-1|0;if(!(r&l)){if(e|0){f[e>>2]=a|0;f[e+4>>2]=r&i|b&0}n=0;o=i>>>((im(l|0)|0)>>>0);return (I=n,o)|0}r=(_(l|0)|0)-(_(i|0)|0)|0;if(r>>>0<=30){s=r+1|0;p=31-r|0;t=s;u=i<>>(s>>>0);v=i>>>(s>>>0);w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}while(0);if(!t){B=x;C=w;D=v;E=u;F=0;G=0}else{b=c|0|0;c=k|d&0;d=Tn(b|0,c|0,-1,-1)|0;k=I;h=x;x=w;w=v;v=u;u=t;t=0;do{a=h;h=x>>>31|h<<1;x=t|x<<1;g=v<<1|a>>>31|0;a=v>>>31|w<<1|0;Vn(d|0,k|0,g|0,a|0)|0;i=I;l=i>>31|((i|0)<0?-1:0)<<1;t=l&1;v=Vn(g|0,a|0,l&b|0,(((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1)&c|0)|0;w=I;u=u-1|0}while((u|0)!=0);B=h;C=x;D=w;E=v;F=0;G=t}t=C;C=0;if(e|0){f[e>>2]=E;f[e+4>>2]=D}n=(t|0)>>>31|(B|C)<<1|(C<<1|t>>>31)&0|F;o=(t<<1|0>>>31)&-2|G;return (I=n,o)|0}function Cd(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+32|0;d=c+4|0;e=c;g=c+16|0;h=a+48|0;i=f[h>>2]|0;j=dn(32)|0;f[d>>2]=j;f[d+8>>2]=-2147483616;f[d+4>>2]=20;k=j;l=13101;m=k+20|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[j+20>>0]=0;j=vk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)br(f[d>>2]|0);i=f[h>>2]|0;n=dn(32)|0;f[d>>2]=n;f[d+8>>2]=-2147483616;f[d+4>>2]=22;k=n;l=13122;m=k+22|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[n+22>>0]=0;n=vk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)br(f[d>>2]|0);i=a+64|0;o=f[i>>2]|0;f[i>>2]=0;if(o|0)Va[f[(f[o>>2]|0)+4>>2]&127](o);o=f[a+56>>2]|0;p=(((f[o+100>>2]|0)-(f[o+96>>2]|0)|0)/12|0)>>>0<1e3;o=f[h>>2]|0;q=dn(32)|0;f[d>>2]=q;f[d+8>>2]=-2147483616;f[d+4>>2]=18;k=q;l=13145;m=k+18|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[q+18>>0]=0;q=yk(o,d,-1)|0;if((b[d+11>>0]|0)<0)br(f[d>>2]|0);switch(q|0){case -1:{if(j?p|((Yh(f[h>>2]|0)|0)>4|n^1):0)r=13;else r=17;break}case 0:{if(j)r=13;else r=21;break}case 2:{r=17;break}default:r=21}if((r|0)==13){j=f[a+44>>2]|0;b[g>>0]=0;n=j+16|0;h=f[n+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[n>>2]|0)>>>0>0)){f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];ye(j,d,g,g+1|0)|0}j=dn(296)|0;Ni(j);n=f[i>>2]|0;f[i>>2]=j;if(!n)s=j;else{Va[f[(f[n>>2]|0)+4>>2]&127](n);r=21}}else if((r|0)==17){n=f[a+44>>2]|0;b[g>>0]=2;j=n+16|0;h=f[j+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[n+4>>2];f[d>>2]=f[e>>2];ye(n,d,g,g+1|0)|0}g=dn(360)|0;ji(g);d=f[i>>2]|0;f[i>>2]=g;if(!d)s=g;else{Va[f[(f[d>>2]|0)+4>>2]&127](d);r=21}}if((r|0)==21){r=f[i>>2]|0;if(!r){t=0;u=c;return t|0}else s=r}t=Ra[f[(f[s>>2]|0)+8>>2]&127](s,a)|0;u=c;return t|0}function Dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=b+12|0;g=f[e>>2]|0;h=c+4|0;i=(f[h>>2]|0)-g|0;j=c;f[j>>2]=(f[c>>2]|0)-g;f[j+4>>2]=i;i=(f[d>>2]|0)-g|0;j=d+4|0;k=(f[j>>2]|0)-g|0;g=d;f[g>>2]=i;f[g+4>>2]=k;g=f[e>>2]|0;if((((k|0)>-1?k:0-k|0)+((i|0)>-1?i:0-i|0)|0)>(g|0)){l=f[c>>2]|0;m=f[h>>2]|0;if((l|0)>-1)if((m|0)<=-1)if((l|0)<1){n=-1;o=-1}else p=6;else{n=1;o=1}else if((m|0)<1){n=-1;o=-1}else p=6;if((p|0)==6){n=(l|0)>0?1:-1;o=(m|0)>0?1:-1}q=X(g,n)|0;r=X(g,o)|0;g=(l<<1)-q|0;f[c>>2]=g;l=(m<<1)-r|0;f[h>>2]=l;if((X(n,o)|0)>-1){o=0-l|0;f[c>>2]=o;s=0-g|0;t=o}else{f[c>>2]=l;s=g;t=l}f[c>>2]=(t+q|0)/2|0;f[h>>2]=(s+r|0)/2|0;r=f[d>>2]|0;s=f[j>>2]|0;if((r|0)>-1)if((s|0)<=-1)if((r|0)<1){u=-1;v=-1}else p=14;else{u=1;v=1}else if((s|0)<1){u=-1;v=-1}else p=14;if((p|0)==14){u=(r|0)>0?1:-1;v=(s|0)>0?1:-1}q=f[e>>2]|0;e=X(q,u)|0;t=X(q,v)|0;q=(r<<1)-e|0;f[d>>2]=q;r=(s<<1)-t|0;f[j>>2]=r;if((X(u,v)|0)>-1){v=0-r|0;f[d>>2]=v;w=0-q|0;x=v}else{f[d>>2]=r;w=q;x=r}r=(x+e|0)/2|0;f[d>>2]=r;e=(w+t|0)/2|0;f[j>>2]=e;y=r;z=e}else{y=i;z=k}if(!y)if(!z){A=y;B=z}else p=22;else if((y|0)<0&(z|0)<1){A=y;B=z}else p=22;if((p|0)==22){if(!y)C=(z|0)==0?0:(z|0)>0?3:1;else C=(y|0)>0?(z>>31)+2|0:(z|0)<1?0:3;z=f[c>>2]|0;y=f[h>>2]|0;switch(C|0){case 1:{C=c;f[C>>2]=y;f[C+4>>2]=0-z;D=f[j>>2]|0;E=0-(f[d>>2]|0)|0;break}case 2:{C=c;f[C>>2]=0-z;f[C+4>>2]=0-y;D=0-(f[d>>2]|0)|0;E=0-(f[j>>2]|0)|0;break}case 3:{C=c;f[C>>2]=0-y;f[C+4>>2]=z;D=0-(f[j>>2]|0)|0;E=f[d>>2]|0;break}default:{C=c;f[C>>2]=z;f[C+4>>2]=y;D=f[d>>2]|0;E=f[j>>2]|0}}j=d;f[j>>2]=D;f[j+4>>2]=E;A=D;B=E}E=(f[c>>2]|0)-A|0;f[a>>2]=E;A=(f[h>>2]|0)-B|0;B=a+4|0;f[B>>2]=A;if((E|0)<0)F=(f[b+4>>2]|0)+E|0;else F=E;f[a>>2]=F;if((A|0)>=0){G=A;f[B>>2]=G;return}G=(f[b+4>>2]|0)+A|0;f[B>>2]=G;return}function Ed(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){b:do if(i){g=l;c=m;j=n;while(1){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((d[p>>1]|0)==(d[v+8>>1]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}c=f[e>>2]|0;if(!c){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;c=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(b>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=c;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((d[x>>1]|0)==(d[A+8>>1]|0))z=A;else break}f[c>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;c=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Fd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){b:do if(i){g=l;d=m;j=n;while(1){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((b[p>>0]|0)==(b[v+8>>0]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}d=f[e>>2]|0;if(!d){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;d=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(c>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=d;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((b[x>>0]|0)==(b[A+8>>0]|0))z=A;else break}f[d>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;d=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Gd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=f[c>>2]|0;c=f[b>>2]|0;h=g-c|0;i=a+8|0;j=f[i>>2]|0;if(h>>>0<64){if(j>>>0<=1){k=0;return k|0}l=f[e>>2]|0;m=0;n=1;while(1){o=(f[l+(m<<2)>>2]|0)>>>0>(f[l+(n<<2)>>2]|0)>>>0?n:m;n=n+1|0;if(n>>>0>=j>>>0){k=o;break}else m=o}return k|0}if(j){j=f[a+1128>>2]|0;m=f[e>>2]|0;e=f[a+1140>>2]|0;n=f[d>>2]|0;d=b+4|0;l=b+8|0;if((g|0)==(c|0)){b=0;do{o=j+(b<<2)|0;f[o>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){p=f[o>>2]|0;q=h-p|0;f[o>>2]=q>>>0

>>0?p:q}b=b+1|0;q=f[i>>2]|0}while(b>>>0>>0);r=q}else{b=0;do{q=j+(b<<2)|0;f[q>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){o=(f[n+(b<<2)>>2]|0)+(1<>2]|0;s=f[(f[d>>2]|0)+24>>2]|0;t=c;u=f[q>>2]|0;do{v=s+((X(t,p)|0)<<2)+(b<<2)|0;u=u+((f[v>>2]|0)>>>0>>0&1)|0;f[q>>2]=u;t=t+1|0}while((t|0)!=(g|0));t=h-u|0;f[q>>2]=t>>>0>>0?u:t}b=b+1|0;t=f[i>>2]|0}while(b>>>0>>0);r=t}if(r){b=f[a+1140>>2]|0;i=a+1128|0;h=0;g=0;c=0;while(1){if(!(f[b+(g<<2)>>2]|0)){w=h;x=c}else{d=f[(f[i>>2]|0)+(g<<2)>>2]|0;l=h>>>0>>0;w=l?d:h;x=l?g:c}g=g+1|0;if(g>>>0>=r>>>0){y=x;break}else{h=w;c=x}}}else y=0}else y=0;x=a+1088|0;c=a+1104|0;w=f[c>>2]|0;h=32-w|0;if((h|0)<4){r=y&15;g=4-h|0;f[c>>2]=g;h=a+1100|0;i=f[h>>2]|r>>>g;f[h>>2]=i;g=a+1092|0;b=f[g>>2]|0;if((b|0)==(f[a+1096>>2]|0))Ci(x,h);else{f[b>>2]=i;f[g>>2]=b+4}f[h>>2]=r<<32-(f[c>>2]|0);k=y;return k|0}r=a+1100|0;h=f[r>>2]|y<<28>>>w;f[r>>2]=h;b=w+4|0;f[c>>2]=b;if((b|0)!=32){k=y;return k|0}b=a+1092|0;w=f[b>>2]|0;if((w|0)==(f[a+1096>>2]|0))Ci(x,r);else{f[w>>2]=h;f[b>>2]=w+4}f[r>>2]=0;f[c>>2]=0;k=y;return k|0}function Hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)br(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}d=dn(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)br(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){b:do if(h){e=k;c=l;i=m;while(1){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0))break;o=(f[a>>2]|0)+(n<<2)|0;if(!(f[o>>2]|0)){p=d;q=i;r=n;s=o;break b}o=d+8|0;t=d;while(1){u=f[t>>2]|0;if(!u)break;if((f[o>>2]|0)==(f[u+8>>2]|0))t=u;else break}f[i>>2]=u;f[t>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;o=f[e>>2]|0;if(!o){v=37;break a}else d=o}c=f[d>>2]|0;if(!c){v=37;break a}else{e=d;i=d}}}else{i=k;e=l;c=m;while(1){o=e;while(1){w=f[o+4>>2]|0;if(w>>>0>>0)x=w;else x=(w>>>0)%(b>>>0)|0;if((x|0)==(j|0))break;w=(f[a>>2]|0)+(x<<2)|0;if(!(f[w>>2]|0)){p=o;q=c;r=x;s=w;break b}w=o+8|0;y=o;while(1){z=f[y>>2]|0;if(!z)break;if((f[w>>2]|0)==(f[z+8>>2]|0))y=z;else break}f[c>>2]=z;f[y>>2]=f[f[(f[a>>2]|0)+(x<<2)>>2]>>2];f[f[(f[a>>2]|0)+(x<<2)>>2]>>2]=o;w=f[i>>2]|0;if(!w){v=37;break a}else o=w}e=f[o>>2]|0;if(!e){v=37;break a}else{i=o;c=o}}}while(0);f[s>>2]=q;l=f[p>>2]|0;if(!l){v=37;break}else{j=r;k=p;m=p}}if((v|0)==37)return}function Id(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)br(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}e=dn(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)br(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;e=a+24|0;k=j;j=g;l=d;d=g;a:while(1){g=j;m=l;n=d;b:while(1){o=m;while(1){p=f[o+4>>2]|0;if(!i)if(p>>>0>>0)q=p;else q=(p>>>0)%(c>>>0)|0;else q=p&h;if((q|0)==(k|0))break;r=(f[a>>2]|0)+(q<<2)|0;if(!(f[r>>2]|0))break b;p=f[o>>2]|0;c:do if(!p)s=o;else{t=f[o+8>>2]|0;u=f[e>>2]|0;v=f[u+8>>2]|0;w=(f[u+12>>2]|0)-v|0;u=v;v=w>>>2;if((w|0)>0){x=o;y=p}else{w=p;while(1){z=f[w>>2]|0;if(!z){s=w;break c}else w=z}}while(1){w=f[y+8>>2]|0;z=0;do{A=f[u+(z<<2)>>2]|0;if(!(b[A+84>>0]|0)){B=f[A+68>>2]|0;C=f[B+(w<<2)>>2]|0;D=f[B+(t<<2)>>2]|0}else{C=w;D=t}z=z+1|0;if((D|0)!=(C|0)){s=x;break c}}while((z|0)<(v|0));z=f[y>>2]|0;if(!z){s=y;break}else{w=y;y=z;x=w}}}while(0);f[n>>2]=f[s>>2];f[s>>2]=f[f[(f[a>>2]|0)+(q<<2)>>2]>>2];f[f[(f[a>>2]|0)+(q<<2)>>2]>>2]=o;p=f[g>>2]|0;if(!p){E=38;break a}else o=p}m=f[o>>2]|0;if(!m){E=38;break a}else{g=o;n=o}}f[r>>2]=n;l=f[o>>2]|0;if(!l){E=38;break}else{k=q;j=o;d=o}}if((E|0)==38)return}function Jd(a,c){a=a|0;c=c|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+12|0;j=e+11|0;k=e+10|0;l=e+8|0;m=c+44|0;n=f[m>>2]|0;o=n+16|0;p=f[o+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0)){f[h>>2]=f[n+4>>2];f[g>>2]=f[h>>2];ye(n,g,14849,14854)|0}n=Qa[f[(f[c>>2]|0)+8>>2]&127](c)|0;b[i>>0]=n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]);if(w>y){n[m>>2]=y;z=$(n[x>>2])}else z=y;x=s+(v<<2)|0;if($(n[x>>2])>2]=z;v=v+1|0}while((v|0)!=(h|0));t=t+1|0}while(t>>>0

>>0)}while(0);if(d<<24>>24>0){d=f[k>>2]|0;k=0;z=$(n[j>>2]);while(1){y=$(n[s+(k<<2)>>2]);w=$(y-$(n[d+(k<<2)>>2]));if(w>z){n[j>>2]=w;A=w}else A=z;k=k+1|0;if((k|0)==(h|0)){B=A;break}else z=A}}else B=$(n[j>>2]);if(B==$(0.0))n[j>>2]=$(1.0);$q(q);$q(s);i=1;u=e;return i|0}function Ld(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a+8|0;Ah(g,b,d,e);h=d-e|0;if((h|0)>0){d=0-e|0;i=a+16|0;j=a+32|0;k=a+12|0;l=a+28|0;m=a+20|0;n=a+24|0;o=h;h=f[g>>2]|0;while(1){p=b+(o<<2)|0;q=c+(o<<2)|0;if((h|0)>0){r=0;s=p+(d<<2)|0;t=h;while(1){if((t|0)>0){u=0;do{v=f[s+(u<<2)>>2]|0;w=f[i>>2]|0;if((v|0)>(w|0)){x=f[j>>2]|0;f[x+(u<<2)>>2]=w;y=x}else{x=f[k>>2]|0;w=f[j>>2]|0;f[w+(u<<2)>>2]=(v|0)<(x|0)?x:v;y=w}u=u+1|0}while((u|0)<(f[g>>2]|0));z=y}else z=f[j>>2]|0;u=(f[p+(r<<2)>>2]|0)-(f[z+(r<<2)>>2]|0)|0;w=q+(r<<2)|0;f[w>>2]=u;if((u|0)>=(f[l>>2]|0)){if((u|0)>(f[n>>2]|0)){A=u-(f[m>>2]|0)|0;B=31}}else{A=(f[m>>2]|0)+u|0;B=31}if((B|0)==31){B=0;f[w>>2]=A}r=r+1|0;w=f[g>>2]|0;if((r|0)>=(w|0)){C=w;break}else{s=z;t=w}}}else C=h;o=o-e|0;if((o|0)<=0){D=C;break}else h=C}}else D=f[g>>2]|0;C=e>>>0>1073741823?-1:e<<2;e=_q(C)|0;hj(e|0,0,C|0)|0;if((D|0)<=0){$q(e);return 1}C=a+16|0;h=a+32|0;o=a+12|0;z=a+28|0;A=a+20|0;m=a+24|0;a=0;n=e;l=D;while(1){if((l|0)>0){D=0;do{j=f[n+(D<<2)>>2]|0;y=f[C>>2]|0;if((j|0)>(y|0)){k=f[h>>2]|0;f[k+(D<<2)>>2]=y;E=k}else{k=f[o>>2]|0;y=f[h>>2]|0;f[y+(D<<2)>>2]=(j|0)<(k|0)?k:j;E=y}D=D+1|0}while((D|0)<(f[g>>2]|0));F=E}else F=f[h>>2]|0;D=(f[b+(a<<2)>>2]|0)-(f[F+(a<<2)>>2]|0)|0;y=c+(a<<2)|0;f[y>>2]=D;if((D|0)>=(f[z>>2]|0)){if((D|0)>(f[m>>2]|0)){G=D-(f[A>>2]|0)|0;B=16}}else{G=(f[A>>2]|0)+D|0;B=16}if((B|0)==16){B=0;f[y>>2]=G}a=a+1|0;l=f[g>>2]|0;if((a|0)>=(l|0))break;else n=F}$q(e);return 1}function Md(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;e=f[a>>2]|0;g=e;h=(f[b>>2]|0)-g|0;b=e+(h>>2<<2)|0;i=f[c>>2]|0;c=f[d>>2]|0;d=c-i|0;j=d>>2;k=i;l=c;if((d|0)<=0){m=b;return m|0}d=a+8|0;n=f[d>>2]|0;o=a+4|0;p=f[o>>2]|0;q=p;if((j|0)<=(n-q>>2|0)){r=b;s=q-r|0;t=s>>2;if((j|0)>(t|0)){u=k+(t<<2)|0;t=u;if((u|0)==(l|0))v=p;else{w=l+-4-t|0;x=u;u=p;while(1){f[u>>2]=f[x>>2];x=x+4|0;if((x|0)==(l|0))break;else u=u+4|0}u=p+((w>>>2)+1<<2)|0;f[o>>2]=u;v=u}if((s|0)>0){y=t;z=v}else{m=b;return m|0}}else{y=c;z=p}c=z-(b+(j<<2))>>2;v=b+(c<<2)|0;if(v>>>0

>>0){t=(p+(0-c<<2)+~r|0)>>>2;r=v;s=z;while(1){f[s>>2]=f[r>>2];r=r+4|0;if(r>>>0>=p>>>0)break;else s=s+4|0}f[o>>2]=z+(t+1<<2)}if(c|0){c=v;v=z;do{c=c+-4|0;v=v+-4|0;f[v>>2]=f[c>>2]}while((c|0)!=(b|0))}c=y;if((k|0)==(c|0)){m=b;return m|0}else{A=b;B=k}while(1){f[A>>2]=f[B>>2];B=B+4|0;if((B|0)==(c|0)){m=b;break}else A=A+4|0}return m|0}A=(q-g>>2)+j|0;if(A>>>0>1073741823)mq(a);j=n-g|0;g=j>>1;n=j>>2>>>0<536870911?(g>>>0>>0?A:g):1073741823;g=b;A=h>>2;do if(n)if(n>>>0>1073741823){j=ra(8)|0;Wo(j,14941);f[j>>2]=6944;va(j|0,1080,114)}else{j=dn(n<<2)|0;C=j;D=j;break}else{C=0;D=0}while(0);j=D+(A<<2)|0;A=D+(n<<2)|0;if((l|0)==(k|0))E=j;else{n=((l+-4-i|0)>>>2)+1|0;i=k;k=j;while(1){f[k>>2]=f[i>>2];i=i+4|0;if((i|0)==(l|0))break;else k=k+4|0}E=j+(n<<2)|0}if((h|0)>0)Rg(C|0,e|0,h|0)|0;h=q-g|0;if((h|0)>0){Rg(E|0,b|0,h|0)|0;F=E+(h>>>2<<2)|0}else F=E;f[a>>2]=D;f[o>>2]=F;f[d>>2]=A;if(!e){m=j;return m|0}br(e);m=j;return m|0}function Nd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0;switch(c|0){case 1:{c=dn(60)|0;f[c>>2]=1528;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1948;i=c;f[a>>2]=i;return}case 4:{c=dn(168)|0;Ei(c,d,e,g);i=c;f[a>>2]=i;return}case 5:{c=dn(104)|0;f[c>>2]=1528;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2004;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=dn(140)|0;f[c>>2]=1528;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2060;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=2116;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;rn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Od(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0;switch(c|0){case 1:{c=dn(60)|0;f[c>>2]=1528;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1640;i=c;f[a>>2]=i;return}case 4:{c=dn(168)|0;Hi(c,d,e,g);i=c;f[a>>2]=i;return}case 5:{c=dn(104)|0;f[c>>2]=1528;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1696;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=dn(140)|0;f[c>>2]=1528;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=1752;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=1808;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;rn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Pd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=dn(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2628;i=c;f[a>>2]=i;return}case 4:{c=dn(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2684;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Sm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=dn(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2740;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=dn(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2796;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=2852;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;rn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Qd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;switch(b-a>>2|0){case 2:{d=b+-4|0;e=f[d>>2]|0;g=f[a>>2]|0;h=f[c>>2]|0;i=f[h>>2]|0;j=(f[h+4>>2]|0)-i>>3;if(j>>>0<=e>>>0)mq(h);k=i;if(j>>>0<=g>>>0)mq(h);if((f[k+(e<<3)>>2]|0)>>>0>=(f[k+(g<<3)>>2]|0)>>>0){l=1;return l|0}f[a>>2]=e;f[d>>2]=g;l=1;return l|0}case 3:{Cg(a,a+4|0,b+-4|0,c)|0;l=1;return l|0}case 4:{Qg(a,a+4|0,a+8|0,b+-4|0,c)|0;l=1;return l|0}case 5:{Tf(a,a+4|0,a+8|0,a+12|0,b+-4|0,c)|0;l=1;return l|0}case 1:case 0:{l=1;return l|0}default:{g=a+8|0;Cg(a,a+4|0,g,c)|0;d=a+12|0;a:do if((d|0)!=(b|0)){e=f[c>>2]|0;k=f[e>>2]|0;h=(f[e+4>>2]|0)-k>>3;j=k;k=d;i=0;m=g;b:while(1){n=f[k>>2]|0;o=f[m>>2]|0;if(h>>>0<=n>>>0){p=14;break}if(h>>>0<=o>>>0){p=16;break}q=j+(n<<3)|0;if((f[q>>2]|0)>>>0<(f[j+(o<<3)>>2]|0)>>>0){r=m;s=k;t=o;while(1){f[s>>2]=t;if((r|0)==(a|0)){u=a;break}o=r+-4|0;t=f[o>>2]|0;if(h>>>0<=t>>>0){p=20;break b}if((f[q>>2]|0)>>>0>=(f[j+(t<<3)>>2]|0)>>>0){u=r;break}else{v=r;r=o;s=v}}f[u>>2]=n;s=i+1|0;if((s|0)==8){w=0;x=(k+4|0)==(b|0);break a}else y=s}else y=i;s=k+4|0;if((s|0)==(b|0)){w=1;x=0;break a}else{r=k;k=s;i=y;m=r}}if((p|0)==14)mq(e);else if((p|0)==16)mq(e);else if((p|0)==20)mq(e)}else{w=1;x=0}while(0);l=x|w;return l|0}}return 0}function Rd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=dn(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2376;i=c;f[a>>2]=i;return}case 4:{c=dn(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2432;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Sm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=dn(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2488;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=dn(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2544;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=2600;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;rn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Sd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=Oa,t=Oa,u=Oa,v=0,w=0,x=0,y=0,z=0;c=f[b>>2]|0;b=a+4|0;d=f[b>>2]|0;e=(d|0)==0;a:do if(!e){g=d+-1|0;h=(g&d|0)==0;if(!h)if(c>>>0>>0)i=c;else i=(c>>>0)%(d>>>0)|0;else i=g&c;j=f[(f[a>>2]|0)+(i<<2)>>2]|0;if(!j)k=i;else{if(h){h=j;while(1){l=f[h>>2]|0;if(!l){k=i;break a}m=f[l+4>>2]|0;if(!((m|0)==(c|0)|(m&g|0)==(i|0))){k=i;break a}if((f[l+8>>2]|0)==(c|0)){o=l;break}else h=l}p=o+12|0;return p|0}else q=j;while(1){h=f[q>>2]|0;if(!h){k=i;break a}g=f[h+4>>2]|0;if((g|0)!=(c|0)){if(g>>>0>>0)r=g;else r=(g>>>0)%(d>>>0)|0;if((r|0)!=(i|0)){k=i;break a}}if((f[h+8>>2]|0)==(c|0)){o=h;break}else q=h}p=o+12|0;return p|0}}else k=0;while(0);q=dn(16)|0;f[q+8>>2]=c;f[q+12>>2]=0;f[q+4>>2]=c;f[q>>2]=0;i=a+12|0;s=$(((f[i>>2]|0)+1|0)>>>0);t=$(d>>>0);u=$(n[a+16>>2]);do if(e|$(u*t)>>0<3|(d+-1&d|0)!=0)&1;j=~~$(W($(s/u)))>>>0;ti(a,r>>>0>>0?j:r);r=f[b>>2]|0;j=r+-1|0;if(!(j&r)){v=r;w=j&c;break}if(c>>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r-n>>2;m=n;n=r;if(d>>>0<=k>>>0)if(d>>>0>>0?(r=m+(d<<2)|0,(r|0)!=(n|0)):0){f[e>>2]=n+(~((n+-4-r|0)>>>2)<<2);t=s;v=j}else{t=s;v=j}else{oi(i,d-k|0);k=f[b>>2]|0;t=k;v=f[k>>2]|0}k=f[t+4>>2]|0;if((k|0)!=(v|0)){v=f[i>>2]|0;i=f[t>>2]|0;t=k-i>>2;k=0;do{f[v+(k<<2)>>2]=f[i+(k<<2)>>2];k=k+1|0}while(k>>>0>>0)}t=(f[h>>2]|0)-(f[g>>2]|0)+1|0;g=a+136|0;h=a+140|0;a=f[h>>2]|0;k=f[g>>2]|0;i=(a-k|0)/12|0;v=a;if(t>>>0>i>>>0){vf(g,t-i|0);u=c;return 1}if(t>>>0>=i>>>0){u=c;return 1}i=k+(t*12|0)|0;if((i|0)==(v|0)){u=c;return 1}else w=v;while(1){v=w+-12|0;f[h>>2]=v;t=f[v>>2]|0;if(!t)x=v;else{v=w+-8|0;k=f[v>>2]|0;if((k|0)!=(t|0))f[v>>2]=k+(~((k+-4-t|0)>>>2)<<2);br(t);x=f[h>>2]|0}if((x|0)==(i|0))break;else w=x}u=c;return 1}function Ud(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2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1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<20)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}xf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function Xd(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;l=i;p=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(p|0));Rc(i,n,o-n>>3,e)|0;n=i+16|0;o=Rn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Tn(o|0,I|0,39,0)|0;o=Wn(l|0,I|0,3)|0;l=Tn(o|0,I|0,8,0)|0;o=Tn(l|0,I|0,n|0,0)|0;vl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=4194304;if(d){d=c;c=4194304;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<20)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}xf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function Yd(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|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if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<18)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}zf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function $d(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;l=i;p=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(p|0));Vc(i,n,o-n>>3,e)|0;n=i+16|0;o=Rn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Tn(o|0,I|0,39,0)|0;o=Wn(l|0,I|0,3)|0;l=Tn(o|0,I|0,8,0)|0;o=Tn(l|0,I|0,n|0,0)|0;vl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=262144;if(d){d=c;c=262144;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<16)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Cf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function ae(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]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>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Lf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function de(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;l=i;p=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(p|0));Zc(i,n,o-n>>3,e)|0;n=i+16|0;o=Rn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Tn(o|0,I|0,39,0)|0;o=Wn(l|0,I|0,3)|0;l=Tn(o|0,I|0,8,0)|0;o=Tn(l|0,I|0,n|0,0)|0;vl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=16384;if(d){d=c;c=16384;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Lf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function ee(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;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=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Lf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function he(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Tn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;l=i;p=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(p|0));bd(i,n,o-n>>3,e)|0;n=i+16|0;o=Rn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Tn(o|0,I|0,39,0)|0;o=Wn(l|0,I|0,3)|0;l=Tn(o|0,I|0,8,0)|0;o=Tn(l|0,I|0,n|0,0)|0;vl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=16384;if(d){d=c;c=16384;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Lf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);br(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);br(e);u=g;return 1}function ie(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)mq(h);else{l=dn(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;hj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]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g>>2]=f[g>>2]&u|v>>>w;i=(f[b>>2]|0)+4|0;f[b>>2]=i;if((c|0)<=63)break;else c=c+-32|0}x=n+-32-r|0;y=i}else{x=n;y=p}if((x|0)<=0){j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}p=f[y>>2]&-1>>>(32-x|0);y=(w|0)<(x|0)?w:x;n=f[d>>2]|0;i=f[n>>2]&~(-1<>2]&-1>>>(w-y|0));f[n>>2]=i;f[n>>2]=i|p<>2];i=(f[o>>2]|0)+y|0;w=n+(i>>>5<<2)|0;f[d>>2]=w;f[o>>2]=i&31;i=x-y|0;if((i|0)<=0){j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}f[w>>2]=f[w>>2]&~(-1>>>(32-i|0))|p>>>y;f[o>>2]=i;j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}function le(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+9|0;i=d+8|0;j=f[(f[a+184>>2]|0)+(c<<2)>>2]&255;b[h>>0]=j;c=a+4|0;k=f[(f[c>>2]|0)+44>>2]|0;l=k+16|0;m=f[l+4>>2]|0;if((m|0)>0|(m|0)==0&(f[l>>2]|0)>>>0>0)n=j;else{f[g>>2]=f[k+4>>2];f[e>>2]=f[g>>2];ye(k,e,h,h+1|0)|0;n=b[h>>0]|0}a:do if(n<<24>>24>-1){k=a+172|0;j=f[(f[k>>2]|0)+((n<<24>>24)*136|0)>>2]|0;l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+56|0;m=b[h>>0]|0;o=f[k>>2]|0;k=f[o+(m*136|0)+132>>2]|0;switch(f[(f[(f[l>>2]|0)+84>>2]|0)+(j<<2)>>2]|0){case 0:{p=k;q=7;break a;break}case 1:{if(b[o+(m*136|0)+28>>0]|0){p=k;q=7;break a}break}default:{}}m=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=1;o=m+16|0;j=f[o+4>>2]|0;if(!((j|0)>0|(j|0)==0&(f[o>>2]|0)>>>0>0)){f[g>>2]=f[m+4>>2];f[e>>2]=f[g>>2];ye(m,e,i,i+1|0)|0}r=k}else{p=f[a+68>>2]|0;q=7}while(0);if((q|0)==7){q=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=0;a=q+16|0;h=f[a+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[a>>2]|0)>>>0>0)){f[g>>2]=f[q+4>>2];f[e>>2]=f[g>>2];ye(q,e,i,i+1|0)|0}r=p}p=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=r;r=p+16|0;c=f[r+4>>2]|0;if((c|0)>0|(c|0)==0&(f[r>>2]|0)>>>0>0){u=d;return 1}f[g>>2]=f[p+4>>2];f[e>>2]=f[g>>2];ye(p,e,i,i+1|0)|0;u=d;return 1}function me(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Ah(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;mq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];tb(k,i,b,x)|0;l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)mq(z);return 0}function ne(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Ah(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;mq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];sb(k,i,b,x)|0;l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)mq(z);return 0}function oe(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+12|0;g=f[e>>2]|0;h=(f[g+4>>2]|0)-(f[g>>2]|0)>>2;if(!h){u=b;return 1}i=a+152|0;j=a+140|0;k=a+144|0;l=a+148|0;a=0;m=g;while(1){f[d>>2]=(a>>>0)/3|0;f[c>>2]=f[d>>2];if(!(Rj(m,c)|0)?(g=f[e>>2]|0,(f[(f[g+12>>2]|0)+(a<<2)>>2]|0)==-1):0){n=a+1|0;o=((n>>>0)%3|0|0)==0?a+-2|0:n;if((o|0)==-1)p=-1;else p=f[(f[g>>2]|0)+(o<<2)>>2]|0;o=f[i>>2]|0;if((f[o+(p<<2)>>2]|0)==-1){g=f[k>>2]|0;n=f[l>>2]|0;if((g|0)==(n<<5|0)){if((g+1|0)<0){q=11;break}r=n<<6;n=g+32&-32;hi(j,g>>>0<1073741823?(r>>>0>>0?n:r):2147483647);s=f[k>>2]|0;t=f[i>>2]|0}else{s=g;t=o}f[k>>2]=s+1;o=(f[j>>2]|0)+(s>>>5<<2)|0;f[o>>2]=f[o>>2]&~(1<<(s&31));o=t+(p<<2)|0;if((f[o>>2]|0)==-1){r=a;n=o;while(1){f[n>>2]=g;o=r+1|0;a:do if((r|0)!=-1?(v=((o>>>0)%3|0|0)==0?r+-2|0:o,(v|0)!=-1):0){w=f[e>>2]|0;x=f[w+12>>2]|0;y=v;while(1){v=f[x+(y<<2)>>2]|0;if((v|0)==-1)break;z=v+1|0;A=((z>>>0)%3|0|0)==0?v+-2|0:z;if((A|0)==-1){B=-1;C=-1;break a}else y=A}x=y+1|0;A=((x>>>0)%3|0|0)==0?y+-2|0:x;if((A|0)==-1){B=y;C=-1}else{B=y;C=f[(f[w>>2]|0)+(A<<2)>>2]|0}}else{B=-1;C=-1}while(0);n=t+(C<<2)|0;if((f[n>>2]|0)!=-1)break;else r=B}}}}r=a+1|0;if(r>>>0>=h>>>0){q=3;break}a=r;m=f[e>>2]|0}if((q|0)==3){u=b;return 1}else if((q|0)==11)mq(j);return 0} -function pe(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=u;u=u+32|0;e=d+8|0;g=d;h=a+4|0;i=f[h>>2]|0;if(i>>>0>=b>>>0){f[h>>2]=b;u=d;return}j=a+8|0;k=f[j>>2]|0;l=k<<5;m=b-i|0;if(l>>>0>>0|i>>>0>(l-m|0)>>>0){f[e>>2]=0;n=e+4|0;f[n>>2]=0;o=e+8|0;f[o>>2]=0;if((b|0)<0)mq(a);p=k<<6;k=b+31&-32;hi(e,l>>>0<1073741823?(p>>>0>>0?k:p):2147483647);p=f[h>>2]|0;f[n>>2]=p+m;k=f[a>>2]|0;l=k;q=f[e>>2]|0;r=(l+(p>>>5<<2)-k<<3)+(p&31)|0;if((r|0)>0){p=r>>>5;Xl(q|0,k|0,p<<2|0)|0;k=r&31;r=q+(p<<2)|0;s=r;if(!k){t=0;v=s}else{w=-1>>>(32-k|0);f[r>>2]=f[r>>2]&~w|f[l+(p<<2)>>2]&w;t=k;v=s}}else{t=0;v=q}f[g>>2]=v;f[g+4>>2]=t;t=g;g=f[t>>2]|0;v=f[t+4>>2]|0;t=f[a>>2]|0;f[a>>2]=f[e>>2];f[e>>2]=t;e=f[h>>2]|0;f[h>>2]=f[n>>2];f[n>>2]=e;e=f[j>>2]|0;f[j>>2]=f[o>>2];f[o>>2]=e;if(t|0)br(t);x=g;y=v}else{v=(f[a>>2]|0)+(i>>>5<<2)|0;f[h>>2]=b;x=v;y=i&31}if(!m){u=d;return}i=(y|0)==0;v=x;if(c){if(i){z=m;A=x;B=v}else{c=32-y|0;b=c>>>0>m>>>0?m:c;f[v>>2]=f[v>>2]|-1>>>(c-b|0)&-1<>>5;hj(A|0,-1,c<<2|0)|0;A=z&31;z=B+(c<<2)|0;if(!A){u=d;return}f[z>>2]=f[z>>2]|-1>>>(32-A|0);u=d;return}else{if(i){C=m;D=x;E=v}else{x=32-y|0;i=x>>>0>m>>>0?m:x;f[v>>2]=f[v>>2]&~(-1>>>(x-i|0)&-1<>>5;hj(D|0,0,y<<2|0)|0;D=C&31;C=E+(y<<2)|0;if(!D){u=d;return}f[C>>2]=f[C>>2]&~(-1>>>(32-D|0));u=d;return}}function qe(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0;a=u;u=u+48|0;g=a+36|0;h=a+24|0;i=a+12|0;j=a;if(!c){k=0;u=a;return k|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;l=vj(d)|0;if(l>>>0>4294967279)mq(g);if(l>>>0<11){b[g+11>>0]=l;if(!l)m=g;else{n=g;o=7}}else{p=l+16&-16;q=dn(p)|0;f[g>>2]=q;f[g+8>>2]=p|-2147483648;f[g+4>>2]=l;n=q;o=7}if((o|0)==7){Rg(n|0,d|0,l|0)|0;m=n}b[m+l>>0]=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;l=vj(e)|0;if(l>>>0>4294967279)mq(h);if(l>>>0<11){b[h+11>>0]=l;if(!l)r=h;else{s=h;o=13}}else{m=l+16&-16;n=dn(m)|0;f[h>>2]=n;f[h+8>>2]=m|-2147483648;f[h+4>>2]=l;s=n;o=13}if((o|0)==13){Rg(s|0,e|0,l|0)|0;r=s}b[r+l>>0]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;l=vj(d)|0;if(l>>>0>4294967279)mq(i);if(l>>>0<11){b[i+11>>0]=l;if(!l)t=i;else{v=i;o=19}}else{r=l+16&-16;s=dn(r)|0;f[i>>2]=s;f[i+8>>2]=r|-2147483648;f[i+4>>2]=l;v=s;o=19}if((o|0)==19){Rg(v|0,d|0,l|0)|0;t=v}b[t+l>>0]=0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=vj(e)|0;if(l>>>0>4294967279)mq(j);if(l>>>0<11){b[j+11>>0]=l;if(!l)w=j;else{x=j;o=25}}else{t=l+16&-16;v=dn(t)|0;f[j>>2]=v;f[j+8>>2]=t|-2147483648;f[j+4>>2]=l;x=v;o=25}if((o|0)==25){Rg(x|0,e|0,l|0)|0;w=x}b[w+l>>0]=0;en(c,i,j);if((b[j+11>>0]|0)<0)br(f[j>>2]|0);if((b[i+11>>0]|0)<0)br(f[i>>2]|0);if((b[h+11>>0]|0)<0)br(f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>2]=f[e>>2];d=c+92|0;f[g>>2]=f[d>>2];g=c+96|0;f[a+96>>2]=f[g>>2];f[g>>2]=0;f[d>>2]=0;f[e>>2]=0;b[a+100>>0]=b[c+100>>0]|0;e=a+104|0;d=c+104|0;f[e>>2]=0;g=a+108|0;f[g>>2]=0;f[a+112>>2]=0;f[e>>2]=f[d>>2];e=c+108|0;f[g>>2]=f[e>>2];g=c+112|0;f[a+112>>2]=f[g>>2];f[g>>2]=0;f[e>>2]=0;f[d>>2]=0;d=a+116|0;e=c+116|0;f[d>>2]=0;g=a+120|0;f[g>>2]=0;f[a+124>>2]=0;f[d>>2]=f[e>>2];d=c+120|0;f[g>>2]=f[d>>2];g=c+124|0;f[a+124>>2]=f[g>>2];f[g>>2]=0;f[d>>2]=0;f[e>>2]=0;f[a+128>>2]=f[c+128>>2];f[a+132>>2]=f[c+132>>2];return}function se(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;h=u;u=u+48|0;i=h+36|0;j=h+24|0;k=h+8|0;l=h+4|0;m=h;n=e+4|0;Bh(i,c,(f[n>>2]|0)-(f[e>>2]|0)>>2,2,g,d,1);g=f[i>>2]|0;o=(f[f[g>>2]>>2]|0)+(f[g+48>>2]|0)|0;f[k>>2]=-1;f[k+4>>2]=-1;f[k+8>>2]=-1;f[k+12>>2]=-1;p=f[c+4>>2]|0;if((p+-2|0)>>>0<=28){f[k>>2]=p;c=1<>2]=c+-1;p=c+-2|0;f[k+8>>2]=p;f[k+12>>2]=(p|0)/2|0;p=f[e>>2]|0;if((f[n>>2]|0)==(p|0))q=g;else{c=d+84|0;r=d+68|0;s=d+48|0;t=d+40|0;v=0;w=0;x=p;while(1){p=f[x+(v<<2)>>2]|0;if(!(b[c>>0]|0))y=f[(f[r>>2]|0)+(p<<2)>>2]|0;else y=p;p=s;z=f[p>>2]|0;A=f[p+4>>2]|0;p=t;B=f[p>>2]|0;C=on(B|0,f[p+4>>2]|0,y|0,0)|0;p=Tn(C|0,I|0,z|0,A|0)|0;Rg(j|0,(f[f[d>>2]>>2]|0)+p|0,B|0)|0;df(k,j,l,m);f[o+(w<<2)>>2]=f[l>>2];f[o+((w|1)<<2)>>2]=f[m>>2];v=v+1|0;x=f[e>>2]|0;if(v>>>0>=(f[n>>2]|0)-x>>2>>>0)break;else w=w+2|0}q=f[i>>2]|0}f[a>>2]=q;f[i>>2]=0;u=h;return}f[a>>2]=0;f[i>>2]=0;if(!g){u=h;return}i=g+88|0;a=f[i>>2]|0;f[i>>2]=0;if(a|0){i=f[a+8>>2]|0;if(i|0){q=a+12|0;if((f[q>>2]|0)!=(i|0))f[q>>2]=i;br(i)}br(a)}a=f[g+68>>2]|0;if(a|0){i=g+72|0;q=f[i>>2]|0;if((q|0)!=(a|0))f[i>>2]=q+(~((q+-4-a|0)>>>2)<<2);br(a)}a=g+64|0;q=f[a>>2]|0;f[a>>2]=0;if(q|0){a=f[q>>2]|0;if(a|0){i=q+4|0;if((f[i>>2]|0)!=(a|0))f[i>>2]=a;br(a)}br(q)}br(g);u=h;return}function te(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if(((e-h|0)/136|0)>>>0>=c>>>0){i=c;j=h;do{f[j>>2]=-1;Ek(j+4|0);b[j+100>>0]=1;k=j+104|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[k+24>>2]=0;j=(f[g>>2]|0)+136|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/136|0;h=j+c|0;if(h>>>0>31580641)mq(a);k=(e-i|0)/136|0;i=k<<1;e=k>>>0<15790320?(i>>>0>>0?h:i):31580641;do if(e)if(e>>>0>31580641){i=ra(8)|0;Wo(i,14941);f[i>>2]=6944;va(i|0,1080,114)}else{l=dn(e*136|0)|0;break}else l=0;while(0);i=l+(j*136|0)|0;j=i;h=l+(e*136|0)|0;e=c;c=j;l=i;do{f[l>>2]=-1;Ek(l+4|0);b[l+100>>0]=1;k=l+104|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[k+24>>2]=0;l=c+136|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=f[g>>2]|0;if((l|0)==(e|0)){m=j;n=e;o=e}else{k=l;l=j;j=i;do{k=k+-136|0;re(j+-136|0,k);j=l+-136|0;l=j}while((k|0)!=(e|0));m=l;n=f[a>>2]|0;o=f[g>>2]|0}f[a>>2]=m;f[g>>2]=c;f[d>>2]=h;h=n;if((o|0)!=(h|0)){d=o;do{o=f[d+-20>>2]|0;if(o|0){c=d+-16|0;g=f[c>>2]|0;if((g|0)!=(o|0))f[c>>2]=g+(~((g+-4-o|0)>>>2)<<2);br(o)}o=f[d+-32>>2]|0;if(o|0){g=d+-28|0;c=f[g>>2]|0;if((c|0)!=(o|0))f[g>>2]=c+(~((c+-4-o|0)>>>2)<<2);br(o)}yi(d+-132|0);d=d+-136|0}while((d|0)!=(h|0))}if(!n)return;br(n);return}function ue(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=f[b>>2]|0;b=a+12|0;d=(c|0)==-1;e=c+1|0;do if(!d){g=((e>>>0)%3|0|0)==0?c+-2|0:e;if(!((c>>>0)%3|0)){h=g;i=c+2|0;break}else{h=g;i=c+-1|0;break}}else{h=-1;i=-1}while(0);e=d?-1:(c>>>0)/3|0;g=a+28|0;j=(f[g>>2]|0)+(e>>>5<<2)|0;f[j>>2]=1<<(e&31)|f[j>>2];j=a+172|0;e=a+176|0;k=a+280|0;if(((!d?(d=f[(f[(f[b>>2]|0)+12>>2]|0)+(c<<2)>>2]|0,(d|0)!=-1):0)?(a=(d>>>0)/3|0,(f[(f[g>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0):0)?(a=f[j>>2]|0,(f[e>>2]|0)!=(a|0)):0){d=c>>>5;l=1<<(c&31);c=0;m=a;do{a=(f[k>>2]|0)+(c<<5)|0;if(!(l&f[(f[m+(c*136|0)+4>>2]|0)+(d<<2)>>2]))Vi(a,0);else Vi(a,1);c=c+1|0;m=f[j>>2]|0}while(c>>>0<(((f[e>>2]|0)-m|0)/136|0)>>>0)}if((((h|0)!=-1?(m=f[(f[(f[b>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,(m|0)!=-1):0)?(c=(m>>>0)/3|0,(f[(f[g>>2]|0)+(c>>>5<<2)>>2]&1<<(c&31)|0)==0):0)?(c=f[j>>2]|0,(f[e>>2]|0)!=(c|0)):0){m=h>>>5;d=1<<(h&31);h=0;l=c;do{c=(f[k>>2]|0)+(h<<5)|0;if(!(d&f[(f[l+(h*136|0)+4>>2]|0)+(m<<2)>>2]))Vi(c,0);else Vi(c,1);h=h+1|0;l=f[j>>2]|0}while(h>>>0<(((f[e>>2]|0)-l|0)/136|0)>>>0)}if((i|0)==-1)return 1;l=f[(f[(f[b>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;if((l|0)==-1)return 1;b=(l>>>0)/3|0;if(f[(f[g>>2]|0)+(b>>>5<<2)>>2]&1<<(b&31)|0)return 1;b=f[j>>2]|0;if((f[e>>2]|0)==(b|0))return 1;g=i>>>5;l=1<<(i&31);i=0;h=b;do{b=(f[k>>2]|0)+(i<<5)|0;if(!(l&f[(f[h+(i*136|0)+4>>2]|0)+(g<<2)>>2]))Vi(b,0);else Vi(b,1);i=i+1|0;h=f[j>>2]|0}while(i>>>0<(((f[e>>2]|0)-h|0)/136|0)>>>0);return 1}function ve(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=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;h=d+8|0;i=d+4|0;j=d;wp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;k=a+24|0;wp(k);l=b+4|0;if((a|0)!=(l|0)){f[h>>2]=f[l>>2];f[i>>2]=b+8;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Hc(a,g,e)}l=b+28|0;if((k|0)!=(l|0)){f[h>>2]=f[l>>2];f[i>>2]=b+32;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Hc(k,g,e)}f[j>>2]=0;k=c+8|0;l=c+12|0;c=f[l>>2]|0;m=f[k>>2]|0;if((c-m|0)<=0){u=d;return}n=b+20|0;b=m;m=c;c=0;while(1){o=f[(f[b+(c<<2)>>2]|0)+56>>2]|0;p=f[n>>2]|0;if(p){q=n;r=p;a:while(1){p=r;while(1){if((f[p+16>>2]|0)>=(o|0))break;s=f[p+4>>2]|0;if(!s){t=q;break a}else p=s}r=f[p>>2]|0;if(!r){t=p;break}else q=p}if((t|0)!=(n|0)?(o|0)>=(f[t+16>>2]|0):0){q=t+20|0;r=wd(a,j)|0;if((r|0)!=(q|0)){f[h>>2]=f[q>>2];f[i>>2]=t+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Hc(r,g,e)}v=f[j>>2]|0;w=f[k>>2]|0;x=f[l>>2]|0}else{v=c;w=b;x=m}}else{v=c;w=b;x=m}c=v+1|0;f[j>>2]=c;if((c|0)>=(x-w>>2|0))break;else{b=w;m=x}}u=d;return}function xe(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+12|0;Nh(f[i>>2]|0,c)|0;if(!(f[i>>2]|0)){j=1;u=d;return j|0}k=c+16|0;l=c+4|0;m=h+1|0;n=h+1|0;o=h+1|0;p=0;while(1){q=f[a>>2]|0;r=f[q+(p<<3)>>2]|0;if(r>>>0>63)if(r>>>0>16383)if(r>>>0>4194303){j=0;s=20;break}else{t=2;s=13}else{t=1;s=13}else if(!r){v=p+1|0;w=0;while(1){if(f[q+(v+w<<3)>>2]|0){x=w;break}y=w+1|0;if(y>>>0<63)w=y;else{x=y;break}}b[h>>0]=x<<2|3;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];ye(c,e,h,o)|0}z=x+p|0}else{t=0;s=13}if((s|0)==13){s=0;b[h>>0]=t|r<<2;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];ye(c,e,h,n)|0}if(!t)z=p;else{w=0;do{w=w+1|0;b[h>>0]=r>>>((w<<3)+-2|0);v=k;q=f[v+4>>2]|0;if(!((q|0)>0|(q|0)==0&(f[v>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];ye(c,e,h,m)|0}}while((w|0)<(t|0));z=p}}p=z+1|0;if(p>>>0>=(f[i>>2]|0)>>>0){j=1;s=20;break}}if((s|0)==20){u=d;return j|0}return 0}function ye(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;g=f[a>>2]|0;h=g;i=(f[c>>2]|0)-h|0;c=g+i|0;j=e-d|0;if((j|0)<=0){k=c;return k|0}l=a+8|0;m=f[l>>2]|0;n=a+4|0;o=f[n>>2]|0;p=o;if((j|0)<=(m-p|0)){q=p-c|0;if((j|0)>(q|0)){r=d+q|0;if((r|0)==(e|0))s=o;else{t=r;u=o;while(1){b[u>>0]=b[t>>0]|0;t=t+1|0;v=(f[n>>2]|0)+1|0;f[n>>2]=v;if((t|0)==(e|0)){s=v;break}else u=v}}if((q|0)>0){w=r;x=s}else{k=c;return k|0}}else{w=e;x=o}s=x-(c+j)|0;r=c+s|0;if(r>>>0>>0){q=r;r=x;do{b[r>>0]=b[q>>0]|0;q=q+1|0;r=(f[n>>2]|0)+1|0;f[n>>2]=r}while((q|0)!=(o|0))}if(s|0)Xl(x+(0-s)|0,c|0,s|0)|0;if((w|0)==(d|0)){k=c;return k|0}else{y=d;z=c}while(1){b[z>>0]=b[y>>0]|0;y=y+1|0;if((y|0)==(w|0)){k=c;break}else z=z+1|0}return k|0}z=p-h+j|0;if((z|0)<0)mq(a);j=m-h|0;h=j<<1;m=j>>>0<1073741823?(h>>>0>>0?z:h):2147483647;h=c;if(!m)A=0;else A=dn(m)|0;z=A+i|0;i=z;j=A+m|0;if((d|0)==(e|0)){B=i;C=g}else{g=d;d=i;i=z;do{b[i>>0]=b[g>>0]|0;i=d+1|0;d=i;g=g+1|0}while((g|0)!=(e|0));B=d;C=f[a>>2]|0}d=h-C|0;e=z+(0-d)|0;if((d|0)>0)Rg(e|0,C|0,d|0)|0;d=(f[n>>2]|0)-h|0;if((d|0)>0){h=B;Rg(h|0,c|0,d|0)|0;D=h+d|0;E=f[a>>2]|0}else{D=B;E=C}f[a>>2]=e;f[n>>2]=D;f[l>>2]=j;if(!E){k=z;return k|0}br(E);k=z;return k|0}function ze(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+16|0;g=e;h=f[(f[c+4>>2]|0)+(d<<2)>>2]|0;d=f[c+28>>2]|0;c=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(h<<2)>>2]|0;switch(f[c+28>>2]|0){case 5:case 6:case 3:case 4:case 1:case 2:{i=dn(40)|0;Ao(i);j=i;k=j;f[a>>2]=k;u=e;return}case 9:{l=3;break}default:{}}if((l|0)==3){i=f[d+48>>2]|0;d=dn(32)|0;f[g>>2]=d;f[g+8>>2]=-2147483616;f[g+4>>2]=17;m=d;n=12932;o=m+17|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[d+17>>0]=0;d=i+16|0;n=f[d>>2]|0;if(n){p=d;q=n;a:while(1){n=q;while(1){if((f[n+16>>2]|0)>=(h|0))break;r=f[n+4>>2]|0;if(!r){s=p;break a}else n=r}q=f[n>>2]|0;if(!q){s=n;break}else p=n}if(((s|0)!=(d|0)?(h|0)>=(f[s+16>>2]|0):0)?(h=s+20|0,(sh(h,g)|0)!=0):0)t=yk(h,g,-1)|0;else l=12}else l=12;if((l|0)==12)t=yk(i,g,-1)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);if((t|0)>0)if((f[c+56>>2]|0)==1){c=dn(48)|0;m=c;o=m+48|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(o|0));Ao(c);f[c>>2]=2256;f[c+40>>2]=1152;f[c+44>>2]=-1;j=c;k=j;f[a>>2]=k;u=e;return}else{c=dn(64)|0;mm(c);j=c;k=j;f[a>>2]=k;u=e;return}}c=dn(36)|0;wm(c);j=c;k=j;f[a>>2]=k;u=e;return}function Ae(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=(c|0)==(a|0);b[c+12>>0]=d&1;if(d)return;else e=c;while(1){g=e+8|0;h=f[g>>2]|0;c=h+12|0;if(b[c>>0]|0){i=23;break}j=h+8|0;k=f[j>>2]|0;d=f[k>>2]|0;if((d|0)==(h|0)){l=f[k+4>>2]|0;if(!l){i=7;break}m=l+12|0;if(!(b[m>>0]|0))n=m;else{i=7;break}}else{if(!d){i=16;break}m=d+12|0;if(!(b[m>>0]|0))n=m;else{i=16;break}}b[c>>0]=1;c=(k|0)==(a|0);b[k+12>>0]=c&1;b[n>>0]=1;if(c){i=23;break}else e=k}if((i|0)==7){if((f[h>>2]|0)==(e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=f[c+4>>2]|0;sq(i);yo(i,$(n[c+20>>2]),(1<>>0>1073741823?-1:l<<2)|0;m=f[j>>2]|0;j=f[e>>2]|0;e=j;if((m|0)==(j|0)){$q(g);u=h;return}o=d+68|0;p=d+48|0;q=d+40|0;r=c+8|0;c=(b[d+84>>0]|0)==0;s=m-j>>2;if(k<<24>>24>0){t=0;v=0}else{k=0;do{j=f[e+(k<<2)>>2]|0;if(c)w=f[(f[o>>2]|0)+(j<<2)>>2]|0;else w=j;j=p;m=f[j>>2]|0;x=f[j+4>>2]|0;j=q;y=f[j>>2]|0;z=on(y|0,f[j+4>>2]|0,w|0,0)|0;j=Tn(z|0,I|0,m|0,x|0)|0;Rg(g|0,(f[f[d>>2]>>2]|0)+j|0,y|0)|0;k=k+1|0}while(k>>>0>>0);$q(g);u=h;return}while(1){k=f[e+(t<<2)>>2]|0;if(c)A=f[(f[o>>2]|0)+(k<<2)>>2]|0;else A=k;k=p;w=f[k>>2]|0;y=f[k+4>>2]|0;k=q;j=f[k>>2]|0;x=on(j|0,f[k+4>>2]|0,A|0,0)|0;k=Tn(x|0,I|0,w|0,y|0)|0;Rg(g|0,(f[f[d>>2]>>2]|0)+k|0,j|0)|0;j=f[r>>2]|0;B=$(n[i>>2]);k=0;y=v;while(1){C=$(n[g+(k<<2)>>2]);w=~~$(J($($(B*$(C-$(n[j+(k<<2)>>2])))+$(.5))));f[a+(y<<2)>>2]=w;k=k+1|0;if((k|0)==(l|0))break;else y=y+1|0}t=t+1|0;if(t>>>0>=s>>>0)break;else v=v+l|0}$q(g);u=h;return}function Ce(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;d=f[b>>2]|0;b=a+12|0;e=(d|0)==-1;do if(e){g=1;h=-1;i=-1}else{j=d+(((d>>>0)%3|0|0)==0?2:-1)|0;if((j|0)!=-1){k=f[(f[b>>2]|0)+12>>2]|0;l=j;while(1){j=f[k+(l<<2)>>2]|0;if((j|0)==-1){m=0;n=l;break}o=j+1|0;l=((o>>>0)%3|0|0)==0?j+-2|0:o;if((l|0)==-1){m=1;n=-1;break}}if(e){g=m;h=-1;i=n;break}else{p=m;q=n}}else{p=1;q=-1}g=p;h=f[(f[f[b>>2]>>2]|0)+(d<<2)>>2]|0;i=q}while(0);if(c){c=(f[a+84>>2]|0)+(h>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(h&31);r=1}else r=0;c=f[(f[a+152>>2]|0)+(h<<2)>>2]|0;q=(f[a+140>>2]|0)+(c>>>5<<2)|0;f[q>>2]=f[q>>2]|1<<(c&31);if(!g){g=(((i>>>0)%3|0|0)==0?2:-1)+i|0;if((g|0)==-1){s=-1;t=i}else{s=f[(f[f[b>>2]>>2]|0)+(g<<2)>>2]|0;t=i}}else{s=-1;t=-1}if((s|0)==(h|0)){u=r;return u|0}i=f[a+84>>2]|0;a=r;r=s;s=t;while(1){t=i+(r>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(r&31);t=a+1|0;g=s+1|0;a:do if((s|0)!=-1?(c=((g>>>0)%3|0|0)==0?s+-2|0:g,(c|0)!=-1):0){q=f[b>>2]|0;d=f[q+12>>2]|0;p=c;while(1){c=f[d+(p<<2)>>2]|0;if((c|0)==-1)break;n=c+1|0;m=((n>>>0)%3|0|0)==0?c+-2|0:n;if((m|0)==-1){v=-1;w=-1;break a}else p=m}d=(((p>>>0)%3|0|0)==0?2:-1)+p|0;if((d|0)==-1){v=-1;w=p}else{v=f[(f[q>>2]|0)+(d<<2)>>2]|0;w=p}}else{v=-1;w=-1}while(0);if((v|0)==(h|0)){u=t;break}else{a=t;r=v;s=w}}return u|0}function De(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;c=a+4|0;d=f[c>>2]|0;e=a+100|0;if(d>>>0<(f[e>>2]|0)>>>0){f[c>>2]=d+1;g=h[d>>0]|0}else g=Di(a)|0;switch(g|0){case 43:case 45:{d=(g|0)==45&1;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;j=h[i>>0]|0}else j=Di(a)|0;if((b|0)!=0&(j+-48|0)>>>0>9?(f[e>>2]|0)!=0:0){f[c>>2]=(f[c>>2]|0)+-1;k=d;l=j}else{k=d;l=j}break}default:{k=0;l=g}}if((l+-48|0)>>>0>9)if(!(f[e>>2]|0)){m=-2147483648;n=0}else{f[c>>2]=(f[c>>2]|0)+-1;m=-2147483648;n=0}else{g=0;j=l;while(1){g=j+-48+(g*10|0)|0;l=f[c>>2]|0;if(l>>>0<(f[e>>2]|0)>>>0){f[c>>2]=l+1;o=h[l>>0]|0}else o=Di(a)|0;if(!((o+-48|0)>>>0<10&(g|0)<214748364))break;else j=o}j=((g|0)<0)<<31>>31;if((o+-48|0)>>>0<10){l=o;d=g;b=j;while(1){i=on(d|0,b|0,10,0)|0;p=I;q=Tn(l|0,((l|0)<0)<<31>>31|0,-48,-1)|0;r=Tn(q|0,I|0,i|0,p|0)|0;p=I;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;s=h[i>>0]|0}else s=Di(a)|0;if((s+-48|0)>>>0<10&((p|0)<21474836|(p|0)==21474836&r>>>0<2061584302)){l=s;d=r;b=p}else{t=s;u=r;v=p;break}}}else{t=o;u=g;v=j}if((t+-48|0)>>>0<10)do{t=f[c>>2]|0;if(t>>>0<(f[e>>2]|0)>>>0){f[c>>2]=t+1;w=h[t>>0]|0}else w=Di(a)|0}while((w+-48|0)>>>0<10);if(f[e>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;c=(k|0)!=0;k=Vn(0,0,u|0,v|0)|0;m=c?I:v;n=c?k:u}I=m;return n|0}function Ee(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;b=a+1176|0;c=f[b>>2]|0;if(c|0){d=a+1180|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);br(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}br(g)}g=a+1164|0;b=f[g>>2]|0;if(b|0){j=a+1168|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);br(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}br(l)}l=f[a+1152>>2]|0;if(l|0){g=a+1156|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l)}l=f[a+1140>>2]|0;if(l|0){m=a+1144|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);br(l)}l=f[a+1128>>2]|0;if(!l){n=a+1108|0;dl(n);o=a+1088|0;dl(o);p=a+1068|0;dl(p);q=a+1036|0;tj(q);r=a+12|0;xh(r);return}g=a+1132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l);n=a+1108|0;dl(n);o=a+1088|0;dl(o);p=a+1068|0;dl(p);q=a+1036|0;tj(q);r=a+12|0;xh(r);return}function Fe(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d;g=a+4|0;h=f[g>>2]|0;i=f[(f[a>>2]|0)+52>>2]|0;if(!h){if(!(Sa[i&31](a,c,0)|0)){j=0;u=d;return j|0}}else if(!(Sa[i&31](a,c,f[(f[h+4>>2]|0)+80>>2]|0)|0)){j=0;u=d;return j|0}if(!(b[a+28>>0]|0)){j=1;u=d;return j|0}h=f[a+8>>2]|0;i=f[a+32>>2]|0;a=f[h+80>>2]|0;f[e>>2]=0;k=e+4|0;f[k>>2]=0;f[e+8>>2]=0;do if(a)if(a>>>0>1073741823)mq(e);else{l=a<<2;m=dn(l)|0;f[e>>2]=m;n=m+(a<<2)|0;f[e+8>>2]=n;hj(m|0,0,l|0)|0;f[k>>2]=n;o=m;p=n;q=m;break}else{o=0;p=0;q=0}while(0);e=f[c+4>>2]|0;a=f[c>>2]|0;c=a;a:do if((e|0)!=(a|0)){m=e-a>>2;if(b[h+84>>0]|0){n=0;while(1){f[o+(f[c+(n<<2)>>2]<<2)>>2]=n;n=n+1|0;if(n>>>0>=m>>>0)break a}}n=f[h+68>>2]|0;l=0;do{f[o+(f[n+(f[c+(l<<2)>>2]<<2)>>2]<<2)>>2]=l;l=l+1|0}while(l>>>0>>0)}while(0);c=f[(f[(f[g>>2]|0)+4>>2]|0)+80>>2]|0;b:do if(c|0){g=f[i+68>>2]|0;if(b[h+84>>0]|0){a=0;while(1){f[g+(a<<2)>>2]=f[o+(a<<2)>>2];a=a+1|0;if(a>>>0>=c>>>0)break b}}a=f[h+68>>2]|0;e=0;do{f[g+(e<<2)>>2]=f[o+(f[a+(e<<2)>>2]<<2)>>2];e=e+1|0}while(e>>>0>>0)}while(0);if(o|0){if((p|0)!=(o|0))f[k>>2]=p+(~((p+-4-o|0)>>>2)<<2);br(q)}j=1;u=d;return j|0}function Ge(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;yh(a+12|0);rn(a+1036|0);to(a+1068|0);to(a+1088|0);to(a+1108|0);e=a+1128|0;f[e>>2]=0;g=a+1132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g;i=b+16|0;f[a>>2]=f[i>>2];f[a+4>>2]=f[i+4>>2];f[a+8>>2]=f[i+8>>2];f[a+12>>2]=f[i+12>>2];f[a+16>>2]=f[i+16>>2];f[a+20>>2]=f[i+20>>2];j=a+8|0;f[j>>2]=(f[j>>2]|0)+d;j=(d|0)>0;if(j){k=b+4|0;l=a+16|0;m=a+12|0;n=f[b>>2]|0;o=n;q=0;r=o;s=n;n=o;while(1){o=f[c+(q<<2)>>2]|0;t=f[k>>2]|0;if(t-s>>2>>>0>o>>>0){v=r;w=n}else{x=o+1|0;f[h>>2]=0;y=t-s>>2;z=s;A=t;if(x>>>0<=y>>>0)if(x>>>0>>0?(t=z+(x<<2)|0,(t|0)!=(A|0)):0){f[k>>2]=A+(~((A+-4-t|0)>>>2)<<2);B=r}else B=r;else{kh(b,x-y|0,h);B=f[b>>2]|0}v=B;w=B}y=w+(o<<2)|0;x=f[y>>2]|0;s=w;if((x|0)<=1)if((x|0)==0?(f[l>>2]=(f[l>>2]|0)+1,o>>>0>(f[m>>2]|0)>>>0):0){f[m>>2]=o;C=0.0}else C=0.0;else{D=+(x|0);C=+Fg(D)*D}x=(f[y>>2]|0)+1|0;f[y>>2]=x;D=+(x|0);E=+Fg(D)*D-C;p[a>>3]=+p[a>>3]+E;q=q+1|0;if((q|0)==(d|0))break;else{r=v;n=w}}}if(e){f[i>>2]=f[a>>2];f[i+4>>2]=f[a+4>>2];f[i+8>>2]=f[a+8>>2];f[i+12>>2]=f[a+12>>2];f[i+16>>2]=f[a+16>>2];u=g;return}if(!j){u=g;return}j=f[b>>2]|0;b=0;do{a=j+(f[c+(b<<2)>>2]<<2)|0;f[a>>2]=(f[a>>2]|0)+-1;b=b+1|0}while((b|0)!=(d|0));u=g;return}function Ie(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;f[a>>2]=e;break a;break}case 10:{e=(f[c>>2]|0)+(4-1)&~(4-1);d=f[e>>2]|0;f[c>>2]=e+4;e=a;f[e>>2]=d;f[e+4>>2]=((d|0)<0)<<31>>31;break a;break}case 11:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;d=a;f[d>>2]=e;f[d+4>>2]=0;break a;break}case 12:{d=(f[c>>2]|0)+(8-1)&~(8-1);e=d;g=f[e>>2]|0;h=f[e+4>>2]|0;f[c>>2]=d+8;d=a;f[d>>2]=g;f[d+4>>2]=h;break a;break}case 13:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&65535)<<16>>16;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 14:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&65535;f[h+4>>2]=0;break a;break}case 15:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&255)<<24>>24;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 16:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&255;f[h+4>>2]=0;break a;break}case 17:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}case 18:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}default:break a}while(0);while(0);return}function Je(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+16|0;d=c+4|0;e=c;g=c+8|0;if(!(Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)){h=0;u=c;return h|0}i=a+44|0;j=f[i>>2]|0;k=a+8|0;l=a+12|0;m=f[l>>2]|0;n=f[k>>2]|0;b[g>>0]=(m-n|0)>>>2;o=j+16|0;p=f[o+4>>2]|0;if((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0){q=k;r=n;s=m}else{f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];ye(j,d,g,g+1|0)|0;q=k;r=f[k>>2]|0;s=f[l>>2]|0}a:do if((r|0)!=(s|0)){l=a+4|0;k=r;while(1){g=f[k>>2]|0;k=k+4|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,a,f[l>>2]|0)|0)){h=0;break}if((k|0)==(s|0))break a}u=c;return h|0}while(0);if(!(vc(a)|0)){h=0;u=c;return h|0}s=a+32|0;r=f[s>>2]|0;k=a+36|0;l=f[k>>2]|0;b:do if((r|0)!=(l|0)){g=r;do{if(!(Ra[f[(f[a>>2]|0)+40>>2]&127](a,f[g>>2]|0)|0)){h=0;t=18;break}g=g+4|0}while((g|0)!=(l|0));if((t|0)==18){u=c;return h|0}g=f[s>>2]|0;d=f[k>>2]|0;if((g|0)!=(d|0)){j=g;while(1){g=f[(f[q>>2]|0)+(f[j>>2]<<2)>>2]|0;j=j+4|0;if(!(Ra[f[(f[g>>2]|0)+12>>2]&127](g,f[i>>2]|0)|0)){h=0;break}if((j|0)==(d|0))break b}u=c;return h|0}}while(0);h=Qa[f[(f[a>>2]|0)+44>>2]&127](a)|0;u=c;return h|0}function Ke(a,b){a=a|0;b=b|0;fd(a,b);fd(a+32|0,b);fd(a+64|0,b);fd(a+96|0,b);fd(a+128|0,b);fd(a+160|0,b);fd(a+192|0,b);fd(a+224|0,b);fd(a+256|0,b);fd(a+288|0,b);fd(a+320|0,b);fd(a+352|0,b);fd(a+384|0,b);fd(a+416|0,b);fd(a+448|0,b);fd(a+480|0,b);fd(a+512|0,b);fd(a+544|0,b);fd(a+576|0,b);fd(a+608|0,b);fd(a+640|0,b);fd(a+672|0,b);fd(a+704|0,b);fd(a+736|0,b);fd(a+768|0,b);fd(a+800|0,b);fd(a+832|0,b);fd(a+864|0,b);fd(a+896|0,b);fd(a+928|0,b);fd(a+960|0,b);fd(a+992|0,b);fd(a+1024|0,b);return}function Le(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+64|0;g=e+60|0;h=e;i=dn(80)|0;j=f[c+8>>2]|0;f[i+4>>2]=0;f[i>>2]=3232;k=i+8|0;l=i+12|0;m=l+44|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[k>>2]=3256;n=i+56|0;f[n>>2]=0;f[i+60>>2]=0;f[i+64>>2]=0;f[i+68>>2]=j;f[i+72>>2]=d;o=i+76|0;f[o>>2]=0;p=i;q=f[c+12>>2]|0;r=h+4|0;l=r+4|0;m=l+40|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[h>>2]=3256;l=h+48|0;f[l>>2]=0;m=h+52|0;f[m>>2]=0;f[h+56>>2]=0;s=q;f[r>>2]=s;t=((f[s+4>>2]|0)-(f[q>>2]|0)>>2>>>0)/3|0;b[g>>0]=0;Xg(h+24|0,t,g);t=f[r>>2]|0;r=(f[t+28>>2]|0)-(f[t+24>>2]|0)>>2;b[g>>0]=0;Xg(h+36|0,r,g);f[h+8>>2]=q;f[h+12>>2]=d;f[h+16>>2]=j;f[h+20>>2]=i;f[o>>2]=c+72;ef(k,h)|0;Yf(n,f[l>>2]|0,f[m>>2]|0);f[a>>2]=p;f[h>>2]=3256;p=f[l>>2]|0;if(p|0){l=f[m>>2]|0;if((l|0)!=(p|0))f[m>>2]=l+(~((l+-4-p|0)>>>2)<<2);br(p)}f[h>>2]=3276;p=f[h+36>>2]|0;if(p|0)br(p);p=f[h+24>>2]|0;if(!p){u=e;return}br(p);u=e;return}function Me(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;c=u;u=u+32|0;d=c;e=a+4|0;g=f[a>>2]|0;h=(f[e>>2]|0)-g>>2;i=h+1|0;if(i>>>0>1073741823)mq(a);j=a+8|0;k=(f[j>>2]|0)-g|0;g=k>>1;l=k>>2>>>0<536870911?(g>>>0>>0?i:g):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(l)if(l>>>0>1073741823){g=ra(8)|0;Wo(g,14941);f[g>>2]=6944;va(g|0,1080,114)}else{m=dn(l<<2)|0;break}else m=0;while(0);f[d>>2]=m;g=m+(h<<2)|0;h=d+8|0;i=d+4|0;f[i>>2]=g;k=m+(l<<2)|0;l=d+12|0;f[l>>2]=k;m=f[b>>2]|0;f[b>>2]=0;f[g>>2]=m;m=g+4|0;f[h>>2]=m;b=f[a>>2]|0;n=f[e>>2]|0;if((n|0)==(b|0)){o=g;p=l;q=h;r=b;s=m;t=n;v=k;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;Wh(d);u=c;return}else{y=n;z=g}do{y=y+-4|0;g=f[y>>2]|0;f[y>>2]=0;f[z+-4>>2]=g;z=(f[i>>2]|0)+-4|0;f[i>>2]=z}while((y|0)!=(b|0));o=z;p=l;q=h;r=f[a>>2]|0;s=f[h>>2]|0;t=f[e>>2]|0;v=f[l>>2]|0;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;Wh(d);u=c;return}function Ne(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+32|0;e=d+12|0;g=d;h=hl(c,0)|0;if(!h){f[a>>2]=0;u=d;return}i=f[c+100>>2]|0;j=f[c+96>>2]|0;c=i-j|0;k=(c|0)/12|0;f[e>>2]=0;l=e+4|0;f[l>>2]=0;f[e+8>>2]=0;m=j;do if(c)if(k>>>0>357913941)mq(e);else{n=dn(c)|0;f[e>>2]=n;f[e+8>>2]=n+(k*12|0);hj(n|0,0,c|0)|0;f[l>>2]=n+c;o=n;break}else o=0;while(0);f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;a:do if((i|0)!=(j|0)){c=g+4|0;n=g+8|0;if(b[h+84>>0]|0){p=0;while(1){q=m+(p*12|0)|0;f[g>>2]=f[q>>2];f[g+4>>2]=f[q+4>>2];f[g+8>>2]=f[q+8>>2];f[o+(p*12|0)>>2]=f[g>>2];f[o+(p*12|0)+4>>2]=f[c>>2];f[o+(p*12|0)+8>>2]=f[n>>2];p=p+1|0;if(p>>>0>=k>>>0)break a}}p=f[h+68>>2]|0;q=0;do{r=f[p+(f[m+(q*12|0)>>2]<<2)>>2]|0;f[g>>2]=r;s=f[p+(f[m+(q*12|0)+4>>2]<<2)>>2]|0;f[c>>2]=s;t=f[p+(f[m+(q*12|0)+8>>2]<<2)>>2]|0;f[n>>2]=t;f[o+(q*12|0)>>2]=r;f[o+(q*12|0)+4>>2]=s;f[o+(q*12|0)+8>>2]=t;q=q+1|0}while(q>>>0>>0)}while(0);Cj(a,e);a=f[e>>2]|0;if(a|0){e=f[l>>2]|0;if((e|0)!=(a|0))f[l>>2]=e+(~(((e+-12-a|0)>>>0)/12|0)*12|0);br(a)}u=d;return}function Oe(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;rn(a+12|0);to(a+44|0);to(a+64|0);to(a+84|0);e=a+104|0;f[e>>2]=0;g=a+108|0;f[g>>2]=0;f[a+112>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)mq(e);else{i=b<<2;j=dn(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+112>>2]=k;hj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+116|0;f[g>>2]=0;e=a+120|0;f[e>>2]=0;f[a+124>>2]=0;if(!h){k=b<<2;i=dn(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+124>>2]=g;hj(i|0,0,k|0)|0;f[e>>2]=g}g=a+128|0;f[g>>2]=0;e=a+132|0;f[e>>2]=0;f[a+136>>2]=0;if(!h){k=b<<2;i=dn(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+136>>2]=g;hj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=dn(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;hj(i|0,0,k|0)|0;f[e>>2]=j}fk(a+140|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);br(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=dn(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;hj(k|0,0,h|0)|0;f[j>>2]=e}fk(a+152|0,g,d);g=f[d>>2]|0;if(!g){u=c;return}d=f[j>>2]|0;if((d|0)!=(g|0))f[j>>2]=d+(~((d+-4-g|0)>>>2)<<2);br(g);u=c;return}function Pe(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;to(a+12|0);to(a+32|0);to(a+52|0);to(a+72|0);e=a+92|0;f[e>>2]=0;g=a+96|0;f[g>>2]=0;f[a+100>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)mq(e);else{i=b<<2;j=dn(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+100>>2]=k;hj(j|0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20>>2]|0:l&255;l=n>>>0>>0?n:j;if((l|0)!=0?(o=Pk(h,m?f[k>>2]|0:k,l)|0,(o|0)!=0):0)if((o|0)<0)p=7;else p=9;else if(j>>>0>>0)p=7;else p=9;if((p|0)==7){p=0;n=f[i>>2]|0;if(!n){p=8;break}else q=n}else if((p|0)==9){p=0;r=i+4|0;n=f[r>>2]|0;if(!n){p=11;break}else q=n}i=q}if((p|0)==8){s=i;t=i;break}else if((p|0)==11){s=i;t=r;break}}else{s=c;t=c}while(0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=s;f[t>>2]=d;s=f[f[a>>2]>>2]|0;if(!s){u=d;v=a+4|0;w=f[v>>2]|0;Ae(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}f[a>>2]=s;u=f[t>>2]|0;v=a+4|0;w=f[v>>2]|0;Ae(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}function Re(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=Oa,B=Oa;g=u;u=u+16|0;h=g;i=b[d+24>>0]|0;j=i<<24>>24;Bh(a,c,e,j,0,d,1);k=f[a>>2]|0;a=(f[f[k>>2]>>2]|0)+(f[k+48>>2]|0)|0;k=f[c+4>>2]|0;sq(h);yo(h,$(n[c+20>>2]),(1<>>0>1073741823?-1:j<<2)|0;if(!e){$q(k);u=g;return}l=d+68|0;m=d+48|0;o=d+40|0;p=c+8|0;c=(b[d+84>>0]|0)==0;if(i<<24>>24>0){q=0;r=0}else{i=0;do{if(c)s=f[(f[l>>2]|0)+(i<<2)>>2]|0;else s=i;t=m;v=f[t>>2]|0;w=f[t+4>>2]|0;t=o;x=f[t>>2]|0;y=on(x|0,f[t+4>>2]|0,s|0,0)|0;t=Tn(y|0,I|0,v|0,w|0)|0;Rg(k|0,(f[f[d>>2]>>2]|0)+t|0,x|0)|0;i=i+1|0}while((i|0)!=(e|0));$q(k);u=g;return}while(1){if(c)z=f[(f[l>>2]|0)+(r<<2)>>2]|0;else z=r;i=m;s=f[i>>2]|0;x=f[i+4>>2]|0;i=o;t=f[i>>2]|0;w=on(t|0,f[i+4>>2]|0,z|0,0)|0;i=Tn(w|0,I|0,s|0,x|0)|0;Rg(k|0,(f[f[d>>2]>>2]|0)+i|0,t|0)|0;t=f[p>>2]|0;A=$(n[h>>2]);i=0;x=q;while(1){B=$(n[k+(i<<2)>>2]);s=~~$(J($($(A*$(B-$(n[t+(i<<2)>>2])))+$(.5))));f[a+(x<<2)>>2]=s;i=i+1|0;if((i|0)==(j|0))break;else x=x+1|0}r=r+1|0;if((r|0)==(e|0))break;else q=q+j|0}$q(k);u=g;return}function Se(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3340;ii(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}_i(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+140>>2]|0;if(b|0)br(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;br(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)br(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);br(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+84>>2]|0;if(b|0)br(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+28>>2]|0;if(b|0)br(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;ui(a);br(a);return}function Te(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+140|0;c=f[b>>2]|0;if(c|0){d=a+144|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);br(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}br(g)}g=a+128|0;b=f[g>>2]|0;if(b|0){j=a+132|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);br(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}br(l)}l=f[a+116>>2]|0;if(l|0){g=a+120|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l)}l=f[a+104>>2]|0;if(l|0){m=a+108|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);br(l)}l=f[a+92>>2]|0;if(!l){n=a+72|0;dl(n);o=a+52|0;dl(o);p=a+32|0;dl(p);q=a+12|0;dl(q);return}g=a+96|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l);n=a+72|0;dl(n);o=a+52|0;dl(o);p=a+32|0;dl(p);q=a+12|0;dl(q);return}function Ue(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+152|0;c=f[b>>2]|0;if(c|0){d=a+156|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);br(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}br(g)}g=a+140|0;b=f[g>>2]|0;if(b|0){j=a+144|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);br(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}br(l)}l=f[a+128>>2]|0;if(l|0){g=a+132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l)}l=f[a+116>>2]|0;if(l|0){m=a+120|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);br(l)}l=f[a+104>>2]|0;if(!l){n=a+84|0;dl(n);o=a+64|0;dl(o);p=a+44|0;dl(p);q=a+12|0;tj(q);return}g=a+108|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(l);n=a+84|0;dl(n);o=a+64|0;dl(o);p=a+44|0;dl(p);q=a+12|0;tj(q);return}function Ve(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3080;jj(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}_i(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+140>>2]|0;if(b|0)br(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;br(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)br(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);br(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+84>>2]|0;if(b|0)br(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+28>>2]|0;if(b|0)br(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;ui(a);br(a);return}function We(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+48|0;d=c+44|0;e=c+40|0;g=c+36|0;h=c+32|0;i=c;f[h>>2]=f[a+60>>2];j=b+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,h,h+4|0)|0}rn(i);lk(i);if((f[h>>2]|0)>0){k=a+56|0;l=1;m=0;do{n=l;l=(f[(f[k>>2]|0)+(m>>>5<<2)>>2]&1<<(m&31)|0)!=0;Vi(i,n^l^1);m=m+1|0}while((m|0)<(f[h>>2]|0))}fd(i,b);f[g>>2]=f[a+12>>2];h=j;m=f[h>>2]|0;l=f[h+4>>2]|0;if((l|0)>0|(l|0)==0&m>>>0>0){o=l;p=m}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;m=j;o=f[m+4>>2]|0;p=f[m>>2]|0}f[g>>2]=f[a+20>>2];if((o|0)>0|(o|0)==0&p>>>0>0){tj(i);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;tj(i);u=c;return 1}function Xe(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=f[c>>2]|0;c=f[d>>2]|0;e=f[a+4>>2]|0;g=f[d+4>>2]|0;h=e+-1|0;i=(h&e|0)==0;if(!i)if(g>>>0>>0)j=g;else j=(g>>>0)%(e>>>0)|0;else j=h&g;g=(f[a>>2]|0)+(j<<2)|0;k=f[g>>2]|0;while(1){l=f[k>>2]|0;if((l|0)==(d|0))break;else k=l}if((k|0)!=(a+8|0)){l=f[k+4>>2]|0;if(!i)if(l>>>0>>0)m=l;else m=(l>>>0)%(e>>>0)|0;else m=l&h;if((m|0)==(j|0)){n=c;o=21}else o=13}else o=13;do if((o|0)==13){if(c|0){m=f[c+4>>2]|0;if(!i)if(m>>>0>>0)p=m;else p=(m>>>0)%(e>>>0)|0;else p=m&h;if((p|0)==(j|0)){q=c;r=c;o=22;break}}f[g>>2]=0;n=f[d>>2]|0;o=21}while(0);if((o|0)==21){g=n;if(!n)s=g;else{q=n;r=g;o=22}}if((o|0)==22){o=f[q+4>>2]|0;if(!i)if(o>>>0>>0)t=o;else t=(o>>>0)%(e>>>0)|0;else t=o&h;if((t|0)==(j|0))s=r;else{f[(f[a>>2]|0)+(t<<2)>>2]=k;s=f[d>>2]|0}}f[k>>2]=s;f[d>>2]=0;s=a+12|0;f[s>>2]=(f[s>>2]|0)+-1;if(!d)return c|0;s=d+8|0;a=f[d+20>>2]|0;if(a|0){k=d+24|0;if((f[k>>2]|0)!=(a|0))f[k>>2]=a;br(a)}if((b[s+11>>0]|0)<0)br(f[s>>2]|0);br(d);return c|0}function Ye(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;b=u;u=u+16|0;c=b+4|0;d=b;f[c>>2]=0;e=c+4|0;f[e>>2]=0;f[c+8>>2]=0;g=a+56|0;h=f[g>>2]|0;i=(f[h+100>>2]|0)-(f[h+96>>2]|0)|0;j=(i|0)/12|0;if(!i){k=0;l=0}else{i=c+8|0;m=0;n=0;o=h;h=0;p=0;while(1){q=f[o+96>>2]|0;r=f[q+(n*12|0)>>2]|0;s=r-m|0;t=((s|0)>-1?s:0-s|0)<<1|s>>>31;f[d>>2]=t;if((h|0)==(p|0)){Ci(c,d);v=f[e>>2]|0;w=f[i>>2]|0}else{f[h>>2]=t;t=h+4|0;f[e>>2]=t;v=t;w=p}t=f[q+(n*12|0)+4>>2]|0;s=t-r|0;r=((s|0)>-1?s:0-s|0)<<1|s>>>31;f[d>>2]=r;if((v|0)==(w|0)){Ci(c,d);x=f[e>>2]|0;y=f[i>>2]|0}else{f[v>>2]=r;r=v+4|0;f[e>>2]=r;x=r;y=w}r=f[q+(n*12|0)+8>>2]|0;q=r-t|0;t=((q|0)>-1?q:0-q|0)<<1|q>>>31;f[d>>2]=t;if((x|0)==(y|0))Ci(c,d);else{f[x>>2]=t;f[e>>2]=x+4}t=n+1|0;if(t>>>0>=j>>>0)break;m=r;n=t;o=f[g>>2]|0;h=f[e>>2]|0;p=f[i>>2]|0}k=f[c>>2]|0;l=f[e>>2]|0}Dc(k,l-k>>2,1,0,f[a+44>>2]|0)|0;a=f[c>>2]|0;if(!a){u=b;return 1}c=f[e>>2]|0;if((c|0)!=(a|0))f[e>>2]=c+(~((c+-4-a|0)>>>2)<<2);br(a);u=b;return 1}function Ze(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=f[a+12>>2]|0;e=a+108|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{kh(i,h-m|0,3220);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+112|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1){q=0;r=12;break}i=f[d>>2]|0;g=f[i+(h<<2)>>2]|0;if((g|0)==-1){q=0;r=12;break}k=f[(f[m>>2]|0)+12>>2]|0;l=f[k+(g<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}g=f[a>>2]|0;f[g+(f[c+(o*12|0)>>2]<<2)>>2]=l;l=h+1|0;if((l|0)==-1){q=0;r=12;break}j=f[i+(l<<2)>>2]|0;if((j|0)==-1){q=0;r=12;break}l=f[k+(j<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}f[g+(f[c+(o*12|0)+4>>2]<<2)>>2]=l;l=h+2|0;if((l|0)==-1){q=0;r=12;break}h=f[i+(l<<2)>>2]|0;if((h|0)==-1){q=0;r=12;break}l=f[k+(h<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}f[g+(f[c+(o*12|0)+8>>2]<<2)>>2]=l;o=o+1|0;if(o>>>0>=e>>>0){q=1;r=12;break}}if((r|0)==12)return q|0;return 0}function _e(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+48|0;d=c+44|0;e=c+40|0;g=c+36|0;h=c+32|0;i=c;f[h>>2]=f[a+80>>2];j=b+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,h,h+4|0)|0}rn(i);lk(i);if((f[h>>2]|0)>0){k=a+76|0;l=1;m=0;do{n=l;l=(f[(f[k>>2]|0)+(m>>>5<<2)>>2]&1<<(m&31)|0)!=0;Vi(i,n^l^1);m=m+1|0}while((m|0)<(f[h>>2]|0))}fd(i,b);f[g>>2]=f[a+12>>2];h=j;m=f[h>>2]|0;l=f[h+4>>2]|0;if((l|0)>0|(l|0)==0&m>>>0>0){o=l;p=m}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;m=j;o=f[m+4>>2]|0;p=f[m>>2]|0}f[g>>2]=f[a+16>>2];if((o|0)>0|(o|0)==0&p>>>0>0){tj(i);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;tj(i);u=c;return 1}function $e(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=a+12|0;h=f[g>>2]|0;$j(f[a+4>>2]|0,(f[h+28>>2]|0)-(f[h+24>>2]|0)>>2);h=a+96|0;i=f[g>>2]|0;j=(f[i+28>>2]|0)-(f[i+24>>2]|0)>>2;f[c>>2]=0;i=a+100|0;k=f[i>>2]|0;l=f[h>>2]|0;m=k-l>>2;n=l;l=k;if(j>>>0<=m>>>0){if(j>>>0>>0?(k=n+(j<<2)|0,(k|0)!=(l|0)):0)f[i>>2]=l+(~((l+-4-k|0)>>>2)<<2)}else kh(h,j-m|0,c);m=a+116|0;a=f[m>>2]|0;if(!a){j=f[g>>2]|0;g=(f[j+4>>2]|0)-(f[j>>2]|0)>>2;j=(g>>>0)/3|0;if(g>>>0<=2){o=1;u=b;return o|0}g=0;while(1){f[d>>2]=g*3;f[c>>2]=f[d>>2];g=g+1|0;if(!(vb(e,c)|0)){o=0;p=15;break}if((g|0)>=(j|0)){o=1;p=15;break}}if((p|0)==15){u=b;return o|0}}else{j=f[a>>2]|0;if((f[a+4>>2]|0)==(j|0)){o=1;u=b;return o|0}a=0;g=j;while(1){f[d>>2]=f[g+(a<<2)>>2];f[c>>2]=f[d>>2];a=a+1|0;if(!(vb(e,c)|0)){o=0;p=15;break}j=f[m>>2]|0;g=f[j>>2]|0;if(a>>>0>=(f[j+4>>2]|0)-g>>2>>>0){o=1;p=15;break}}if((p|0)==15){u=b;return o|0}}return 0}function af(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=f[a+12>>2]|0;e=a+68|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{kh(i,h-m|0,3220);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+72|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1){q=0;r=12;break}i=f[d>>2]|0;g=f[i+(h<<2)>>2]|0;if((g|0)==-1){q=0;r=12;break}k=f[(f[m>>2]|0)+12>>2]|0;l=f[k+(g<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}g=f[a>>2]|0;f[g+(f[c+(o*12|0)>>2]<<2)>>2]=l;l=h+1|0;if((l|0)==-1){q=0;r=12;break}j=f[i+(l<<2)>>2]|0;if((j|0)==-1){q=0;r=12;break}l=f[k+(j<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}f[g+(f[c+(o*12|0)+4>>2]<<2)>>2]=l;l=h+2|0;if((l|0)==-1){q=0;r=12;break}h=f[i+(l<<2)>>2]|0;if((h|0)==-1){q=0;r=12;break}l=f[k+(h<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=12;break}f[g+(f[c+(o*12|0)+8>>2]<<2)>>2]=l;o=o+1|0;if(o>>>0>=e>>>0){q=1;r=12;break}}if((r|0)==12)return q|0;return 0}function bf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=u;u=u+16|0;d=c+12|0;e=c+8|0;g=c+4|0;h=c;if(!b){i=dn(76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>>2]=p;j=j+-1|0;if(!j)break;else m=m+8|0}}if(!l){m=h+(b<<3)|0;if((m|0)==(n|0))return;else{r=i;s=n+(~((n+-8-m|0)>>>3)<<3)|0;break}}else{m=b-k|0;j=m;p=n;while(1){q=c;o=f[q+4>>2]|0;t=p;f[t>>2]=f[q>>2];f[t+4>>2]=o;j=j+-1|0;if(!j)break;else p=p+8|0}r=i;s=n+(m<<3)|0;break}}else{p=g;if(!g)u=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-8-g|0)>>>3)<<3);br(p);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;u=0}if(b>>>0>536870911)mq(a);j=u>>2;p=u>>3>>>0<268435455?(j>>>0>>0?b:j):536870911;if(p>>>0>536870911)mq(a);j=dn(p<<3)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(p<<3);p=b;l=j;while(1){o=c;t=f[o+4>>2]|0;q=l;f[q>>2]=f[o>>2];f[q+4>>2]=t;p=p+-1|0;if(!p)break;else l=l+8|0}r=k;s=j+(b<<3)|0}while(0);f[r>>2]=s;return}function df(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0.0,g=0.0,h=0.0,i=0.0,j=0.0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=+$(n[b>>2]);g=+K(+e);h=+$(n[b+4>>2]);i=g+ +K(+h);g=+$(n[b+8>>2]);j=i+ +K(+g);b=j>1.0e-06;i=1.0/j;k=f[a+12>>2]|0;j=+(k|0);l=~~+J(+((b?i*e:1.0)*j+.5));m=~~+J(+((b?i*h:0.0)*j+.5));o=(l|0)>-1;p=k-(o?l:0-l|0)-((m|0)>-1?m:0-m|0)|0;l=(p|0)<0;q=(l?((m|0)>0?p:0-p|0):0)+m|0;m=l?0:p;p=(b?i*g:0.0)<0.0?0-m|0:m;do if(!o){if((q|0)<0)r=(p|0)>-1?p:0-p|0;else r=(f[a+8>>2]|0)-((p|0)>-1?p:0-p|0)|0;if((p|0)<0){s=(q|0)>-1?q:0-q|0;t=r;break}else{s=(f[a+8>>2]|0)-((q|0)>-1?q:0-q|0)|0;t=r;break}}else{s=k+p|0;t=k+q|0}while(0);q=(t|0)==0;p=(s|0)==0;r=f[a+8>>2]|0;if(!(s|t)){u=r;v=r;f[c>>2]=u;f[d>>2]=v;return}a=(r|0)==(s|0);if(q&a){u=s;v=s;f[c>>2]=u;f[d>>2]=v;return}o=(r|0)==(t|0);if(p&o){u=t;v=t;f[c>>2]=u;f[d>>2]=v;return}if(q&(k|0)<(s|0)){u=0;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(o&(k|0)>(s|0)){u=t;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(a&(k|0)>(t|0)){u=(k<<1)-t|0;v=s;f[c>>2]=u;f[d>>2]=v;return}if(!p){u=t;v=s;f[c>>2]=u;f[d>>2]=v;return}u=(k|0)<(t|0)?(k<<1)-t|0:t;v=0;f[c>>2]=u;f[d>>2]=v;return}function ef(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=a+4|0;d=b+4|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[c+16>>2]=f[d+16>>2];d=a+24|0;c=b+24|0;if((a|0)==(b|0))return a|0;e=b+28|0;g=f[e>>2]|0;if(!g)h=0;else{i=a+32|0;do if(g>>>0>f[i>>2]<<5>>>0){j=f[d>>2]|0;if(!j)k=g;else{br(j);f[d>>2]=0;f[i>>2]=0;f[a+28>>2]=0;k=f[e>>2]|0}if((k|0)<0)mq(d);else{j=((k+-1|0)>>>5)+1|0;l=dn(j<<2)|0;f[d>>2]=l;f[a+28>>2]=0;f[i>>2]=j;m=f[e>>2]|0;n=l;break}}else{m=g;n=f[d>>2]|0}while(0);Xl(n|0,f[c>>2]|0,((m+-1|0)>>>5<<2)+4|0)|0;h=f[e>>2]|0}f[a+28>>2]=h;h=a+36|0;e=b+36|0;m=b+40|0;b=f[m>>2]|0;if(!b)o=0;else{c=a+44|0;do if(b>>>0>f[c>>2]<<5>>>0){n=f[h>>2]|0;if(!n)p=b;else{br(n);f[h>>2]=0;f[c>>2]=0;f[a+40>>2]=0;p=f[m>>2]|0}if((p|0)<0)mq(h);else{n=((p+-1|0)>>>5)+1|0;d=dn(n<<2)|0;f[h>>2]=d;f[a+40>>2]=0;f[c>>2]=n;q=f[m>>2]|0;r=d;break}}else{q=b;r=f[h>>2]|0}while(0);Xl(r|0,f[e>>2]|0,((q+-1|0)>>>5<<2)+4|0)|0;o=f[m>>2]|0}f[a+40>>2]=o;return a|0}function ff(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],ye(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];ye(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;og(d);m=a+1068|0;Cm(m);k=a+1088|0;Cm(k);l=a+1108|0;Cm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];jb(a,i,h);Ke(d,e);mg(m,e);mg(k,e);mg(l,e);u=g;return 1}function gf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],ye(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];ye(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;og(d);m=a+1068|0;Cm(m);k=a+1088|0;Cm(k);l=a+1108|0;Cm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];mb(a,i,h);Ke(d,e);mg(m,e);mg(k,e);mg(l,e);u=g;return 1}function hf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;c=u;u=u+32|0;d=c;e=a+8|0;g=f[e>>2]|0;h=a+4|0;i=f[h>>2]|0;j=i;if(g-i>>2>>>0>=b>>>0){hj(i|0,0,b<<2|0)|0;f[h>>2]=i+(b<<2);u=c;return}k=f[a>>2]|0;l=i-k>>2;m=l+b|0;n=k;if(m>>>0>1073741823)mq(a);o=g-k|0;p=o>>1;q=o>>2>>>0<536870911?(p>>>0>>0?m:p):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(q)if(q>>>0>1073741823){p=ra(8)|0;Wo(p,14941);f[p>>2]=6944;va(p|0,1080,114)}else{r=dn(q<<2)|0;break}else r=0;while(0);f[d>>2]=r;p=r+(l<<2)|0;l=d+8|0;m=d+4|0;f[m>>2]=p;o=r+(q<<2)|0;q=d+12|0;f[q>>2]=o;r=p+(b<<2)|0;hj(p|0,0,b<<2|0)|0;f[l>>2]=r;if((j|0)==(n|0)){s=p;t=q;v=l;w=k;x=r;y=i;z=o;A=g}else{g=j;j=p;do{g=g+-4|0;p=f[g>>2]|0;f[g>>2]=0;f[j+-4>>2]=p;j=(f[m>>2]|0)+-4|0;f[m>>2]=j}while((g|0)!=(n|0));s=j;t=q;v=l;w=f[a>>2]|0;x=f[l>>2]|0;y=f[h>>2]|0;z=f[q>>2]|0;A=f[e>>2]|0}f[a>>2]=s;f[m>>2]=w;f[h>>2]=x;f[v>>2]=y;f[e>>2]=z;f[t>>2]=A;f[d>>2]=w;Wh(d);u=c;return}function jf(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=u;u=u+16|0;h=d;i=f[a+124>>2]|0;if(!i){u=d;return}j=i+-1|0;k=(j&i|0)==0;if(!k)if(i>>>0>g>>>0)l=g;else l=(g>>>0)%(i>>>0)|0;else l=j&g;m=f[(f[a+120>>2]|0)+(l<<2)>>2]|0;if(!m){u=d;return}n=f[m>>2]|0;if(!n){u=d;return}a:do if(k){m=n;while(1){o=f[m+4>>2]|0;p=(o|0)==(g|0);if(!(p|(o&j|0)==(l|0))){q=24;break}if(p?(f[m+8>>2]|0)==(g|0):0){r=m;break a}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}else{m=n;while(1){p=f[m+4>>2]|0;if((p|0)==(g|0)){if((f[m+8>>2]|0)==(g|0)){r=m;break a}}else{if(p>>>0>>0)s=p;else s=(p>>>0)%(i>>>0)|0;if((s|0)!=(l|0)){q=24;break}}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}while(0);q=f[r+12>>2]|0;if((q|0)==-1){u=d;return}f[h>>2]=q;f[h+4>>2]=c;b[h+8>>0]=e&1;e=a+112|0;c=f[e>>2]|0;if((c|0)==(f[a+116>>2]|0))ki(a+108|0,h);else{f[c>>2]=f[h>>2];f[c+4>>2]=f[h+4>>2];f[c+8>>2]=f[h+8>>2];f[e>>2]=(f[e>>2]|0)+12}u=d;return}function kf(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=d[b>>1]|0;e=d[b+2>>1]|0;g=d[b+4>>1]|0;h=d[b+6>>1]|0;b=((((c^318)&65535)+239^e&65535)+239^g&65535)+239^h&65535;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(b>>>0>>0)m=b;else m=(b>>>0)%(i>>>0)|0;else m=b&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(b|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(d[o>>1]|0)==c<<16>>16):0)?(d[o+2>>1]|0)==e<<16>>16:0)?(d[l+12>>1]|0)==g<<16>>16:0)?(d[o+6>>1]|0)==h<<16>>16:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(b|0)){l=q+8|0;if((((d[l>>1]|0)==c<<16>>16?(d[l+2>>1]|0)==e<<16>>16:0)?(d[q+12>>1]|0)==g<<16>>16:0)?(d[l+6>>1]|0)==h<<16>>16:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function lf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],ye(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];ye(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;Cm(d);m=a+32|0;Cm(m);k=a+52|0;Cm(k);l=a+72|0;Cm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];hb(a,i,h);mg(d,e);mg(m,e);mg(k,e);mg(l,e);u=g;return 1}function mf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],ye(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];ye(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;lk(d);m=a+44|0;Cm(m);k=a+64|0;Cm(k);l=a+84|0;Cm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];nb(a,i,h);fd(d,e);mg(m,e);mg(k,e);mg(l,e);u=g;return 1}function nf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;a=u;u=u+16|0;e=a+4|0;g=a;h=a+8|0;i=d+11|0;j=b[i>>0]|0;k=j<<24>>24<0;if(k){l=f[d+4>>2]|0;if(l>>>0>255){m=0;u=a;return m|0}else n=l}else n=j&255;if(!n){b[h>>0]=0;n=c+16|0;l=f[n+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0}m=1;u=a;return m|0}n=d+4|0;l=f[n>>2]|0;b[h>>0]=k?l:j&255;k=c+16|0;o=k;p=f[o>>2]|0;q=f[o+4>>2]|0;if((q|0)>0|(q|0)==0&p>>>0>0){r=j;s=q;t=p;v=l}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0;h=k;r=b[i>>0]|0;s=f[h+4>>2]|0;t=f[h>>2]|0;v=f[n>>2]|0}n=r<<24>>24<0;h=n?f[d>>2]|0:d;if(!((s|0)>0|(s|0)==0&t>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+(n?v:r&255)|0)|0}m=1;u=a;return m|0}function of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=a+4|0;d=f[a>>2]|0;e=((f[c>>2]|0)-d|0)/24|0;g=e+1|0;if(g>>>0>178956970)mq(a);h=a+8|0;i=((f[h>>2]|0)-d|0)/24|0;d=i<<1;j=i>>>0<89478485?(d>>>0>>0?g:d):178956970;do if(j)if(j>>>0>178956970){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{k=dn(j*24|0)|0;break}else k=0;while(0);d=k+(e*24|0)|0;g=d;i=k+(j*24|0)|0;f[d>>2]=1180;f[k+(e*24|0)+4>>2]=f[b+4>>2];_j(k+(e*24|0)+8|0,b+8|0);f[k+(e*24|0)+20>>2]=f[b+20>>2];b=d+24|0;e=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(e|0)){l=g;m=e;n=e}else{j=k;k=g;g=d;do{f[g+-24>>2]=1180;f[g+-20>>2]=f[j+-20>>2];d=g+-16|0;o=j+-16|0;f[d>>2]=0;p=g+-12|0;f[p>>2]=0;f[g+-8>>2]=0;f[d>>2]=f[o>>2];d=j+-12|0;f[p>>2]=f[d>>2];p=j+-8|0;f[g+-8>>2]=f[p>>2];f[p>>2]=0;f[d>>2]=0;f[o>>2]=0;f[g+-4>>2]=f[j+-4>>2];j=j+-24|0;g=k+-24|0;k=g}while((j|0)!=(e|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=b;f[h>>2]=i;i=m;if((n|0)!=(i|0)){h=n;do{h=h+-24|0;Va[f[f[h>>2]>>2]&127](h)}while((h|0)!=(i|0))}if(!m)return;br(m);return}function pf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;h=b[c+3>>0]|0;c=(((d&255^318)+239^e&255)+239^g&255)+239^h&255;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(c>>>0>>0)m=c;else m=(c>>>0)%(i>>>0)|0;else m=c&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(c|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(b[o>>0]|0)==d<<24>>24):0)?(b[o+1>>0]|0)==e<<24>>24:0)?(b[o+2>>0]|0)==g<<24>>24:0)?(b[o+3>>0]|0)==h<<24>>24:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(c|0)){l=q+8|0;if((((b[l>>0]|0)==d<<24>>24?(b[l+1>>0]|0)==e<<24>>24:0)?(b[l+2>>0]|0)==g<<24>>24:0)?(b[l+3>>0]|0)==h<<24>>24:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function qf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;mq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];tb(l,h,b,w)|0;m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Dd(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)mq(y);return 0}function rf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+52>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+60>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+56>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;Rd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+56>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;Pd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function sf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;mq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];sb(l,h,b,w)|0;m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Dd(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)mq(y);return 0}function tf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=f[b>>2]|0;b=f[c>>2]|0;e=b-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;k=b;if(e>>>0<=h-i>>2>>>0){l=a+4|0;m=(f[l>>2]|0)-i>>2;n=e>>>0>m>>>0;o=n?d+(m<<2)|0:b;b=o-d|0;m=b>>2;if(m|0)Xl(i|0,d|0,b|0)|0;b=j+(m<<2)|0;if(!n){n=f[l>>2]|0;if((n|0)==(b|0))return;f[l>>2]=n+(~((n+-4-b|0)>>>2)<<2);return}b=f[c>>2]|0;c=o;if((b|0)==(c|0))return;n=f[l>>2]|0;m=b+-4-o|0;o=c;c=n;while(1){f[c>>2]=f[o>>2];o=o+4|0;if((o|0)==(b|0))break;else c=c+4|0}f[l>>2]=n+((m>>>2)+1<<2);return}m=i;if(!i)p=h;else{h=a+4|0;n=f[h>>2]|0;if((n|0)!=(j|0))f[h>>2]=n+(~((n+-4-i|0)>>>2)<<2);br(m);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;p=0}if(e>>>0>1073741823)mq(a);h=p>>1;m=p>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(m>>>0>1073741823)mq(a);h=dn(m<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(m<<2);m=d;if((k|0)==(m|0))return;g=k+-4-d|0;d=m;m=h;while(1){f[m>>2]=f[d>>2];d=d+4|0;if((d|0)==(k|0))break;else m=m+4|0}f[e>>2]=h+((g>>>2)+1<<2);return}function uf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=u;u=u+112|0;g=e+100|0;h=e;i=dn(120)|0;j=f[c+8>>2]|0;f[i+4>>2]=0;f[i>>2]=3296;k=i+8|0;l=i+12|0;m=l+44|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[k>>2]=3320;l=i+56|0;m=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[i+96>>2]=0;f[i+100>>2]=0;f[i+104>>2]=0;f[i+108>>2]=j;f[i+112>>2]=d;k=i+116|0;f[k>>2]=0;n=i;o=f[c+12>>2]|0;p=h+4|0;l=p+4|0;m=l+40|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[h>>2]=3320;l=h+48|0;m=l+36|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[h+88>>2]=0;f[h+92>>2]=0;f[h+96>>2]=0;l=o;f[p>>2]=l;m=((f[l+4>>2]|0)-(f[o>>2]|0)>>2>>>0)/3|0;b[g>>0]=0;Xg(h+24|0,m,g);m=f[p>>2]|0;p=(f[m+28>>2]|0)-(f[m+24>>2]|0)>>2;b[g>>0]=0;Xg(h+36|0,p,g);f[h+8>>2]=o;f[h+12>>2]=d;f[h+16>>2]=j;f[h+20>>2]=i;f[k>>2]=c+72;fh(i,h);f[a>>2]=n;Gi(h);u=e;return}function vf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(((d-g|0)/12|0)>>>0>=b>>>0){hj(g|0,0,b*12|0)|0;f[e>>2]=h+(b*12|0);return}i=f[a>>2]|0;j=(g-i|0)/12|0;g=j+b|0;k=i;if(g>>>0>357913941)mq(a);l=(d-i|0)/12|0;d=l<<1;m=l>>>0<178956970?(d>>>0>>0?g:d):357913941;do if(m)if(m>>>0>357913941){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{n=dn(m*12|0)|0;break}else n=0;while(0);d=n+(j*12|0)|0;j=d;g=n+(m*12|0)|0;hj(d|0,0,b*12|0)|0;m=d+(b*12|0)|0;if((h|0)==(k|0)){o=j;p=i;q=h}else{i=h;h=j;j=d;do{d=j+-12|0;b=i;i=i+-12|0;f[d>>2]=0;n=j+-8|0;f[n>>2]=0;f[j+-4>>2]=0;f[d>>2]=f[i>>2];d=b+-8|0;f[n>>2]=f[d>>2];n=b+-4|0;f[j+-4>>2]=f[n>>2];f[n>>2]=0;f[d>>2]=0;f[i>>2]=0;j=h+-12|0;h=j}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=g;g=p;if((q|0)!=(g|0)){c=q;do{q=c;c=c+-12|0;m=f[c>>2]|0;if(m|0){e=q+-8|0;q=f[e>>2]|0;if((q|0)!=(m|0))f[e>>2]=q+(~((q+-4-m|0)>>>2)<<2);br(m)}}while((c|0)!=(g|0))}if(!p)return;br(p);return}function wf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=f[a+12>>2]|0;e=a+68|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{kh(i,h-m|0,3220);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+72|0;a=c+68|0;c=f[o+96>>2]|0;o=f[d+28>>2]|0;d=0;while(1){h=d*3|0;i=f[o+(h<<2)>>2]|0;if((i|0)==-1){q=0;r=11;break}g=f[(f[m>>2]|0)+12>>2]|0;k=f[g+(i<<2)>>2]|0;if(k>>>0>=p>>>0){q=0;r=11;break}i=f[a>>2]|0;f[i+(f[c+(d*12|0)>>2]<<2)>>2]=k;k=f[o+(h+1<<2)>>2]|0;if((k|0)==-1){q=0;r=11;break}l=f[g+(k<<2)>>2]|0;if(l>>>0>=p>>>0){q=0;r=11;break}f[i+(f[c+(d*12|0)+4>>2]<<2)>>2]=l;l=f[o+(h+2<<2)>>2]|0;if((l|0)==-1){q=0;r=11;break}h=f[g+(l<<2)>>2]|0;if(h>>>0>=p>>>0){q=0;r=11;break}f[i+(f[c+(d*12|0)+8>>2]<<2)>>2]=h;d=d+1|0;if(d>>>0>=e>>>0){q=1;r=11;break}}if((r|0)==11)return q|0;return 0}function xf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-4194304|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-4177920|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+4194304|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1077936128|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function yf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-2097152|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-2080768|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+6291456|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1075838976|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function zf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-1048576|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1032192|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+7340032|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074790400|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function Af(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Lm(j);yj(j,d,0,g&255,i,0,g<<1,0,0,0);i=uh(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+((X(d,g)|0)<<1)|0;r=n;s=f[r>>2]|0;t=on(s|0,f[r+4>>2]|0,p|0,0)|0;Rg((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;br(i)}br(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);br(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;br(v)}br(j)}k=w;u=a;return k|0}function Bf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Lm(j);yj(j,d,0,g&255,i,0,g<<2,0,0,0);i=uh(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+((X(d,g)|0)<<2)|0;r=n;s=f[r>>2]|0;t=on(s|0,f[r+4>>2]|0,p|0,0)|0;Rg((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;br(i)}br(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);br(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;br(v)}br(j)}k=w;u=a;return k|0}function Cf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-262144|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-245760|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8126464|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074003968|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function Df(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-131072|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-114688|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8257536|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1073872896|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function Ef(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-32768|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-16384|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8355840|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1073774592|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Cn(e);eh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,o|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,o|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function Ff(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;g=f[b+12>>2]|0;b=(((c^318)+239^d)+239^e)+239^g;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=25;break}if((((n?(f[k+8>>2]|0)==(c|0):0)?(f[k+12>>2]|0)==(d|0):0)?(f[k+16>>2]|0)==(e|0):0)?(f[k+20>>2]|0)==(g|0):0){i=k;o=25;break}k=f[k>>2]|0;if(!k){i=0;o=25;break}}if((o|0)==25)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){if((((f[p+8>>2]|0)==(c|0)?(f[p+12>>2]|0)==(d|0):0)?(f[p+16>>2]|0)==(e|0):0)?(f[p+20>>2]|0)==(g|0):0){i=p;o=25;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=25;break}}p=f[p>>2]|0;if(!p){i=0;o=25;break}}if((o|0)==25)return i|0;return 0}function Gf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Lm(j);yj(j,d,0,g&255,i,0,g,0,0,0);i=uh(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+(X(d,g)|0)|0;r=n;s=f[r>>2]|0;t=on(s|0,f[r+4>>2]|0,p|0,0)|0;Rg((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;br(i)}br(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);br(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;br(v)}br(j)}k=w;u=a;return k|0}function Hf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+52>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+60>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+56>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;Od(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+56>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;Nd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function If(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=f[d>>2]|0;g=f[d+4>>2]|0;if((e|0)==(g|0)){h=0;i=a+12|0;j=a+8|0}else{d=f[c>>2]|0;c=a+8|0;k=a+12|0;a=0;l=e;while(1){e=f[l>>2]|0;m=f[d+(e<<2)>>2]|0;if(m>>>0>>0)n=a;else{o=f[c>>2]|0;p=(f[k>>2]|0)-o|0;q=o;if((p|0)>0){o=p>>>2;p=0;do{r=f[q+(p<<2)>>2]|0;s=f[r+68>>2]|0;if(!(b[r+84>>0]|0))t=f[s+(e<<2)>>2]|0;else t=e;f[s+(m<<2)>>2]=t;p=p+1|0}while((p|0)<(o|0))}n=m+1|0}l=l+4|0;if((l|0)==(g|0)){h=n;i=k;j=c;break}else a=n}}n=f[i>>2]|0;a=f[j>>2]|0;if((n-a|0)>0){u=0;v=a;w=n}else return;while(1){n=f[v+(u<<2)>>2]|0;b[n+84>>0]=0;a=n+68|0;c=n+72|0;n=f[c>>2]|0;k=f[a>>2]|0;g=n-k>>2;l=k;k=n;if(h>>>0<=g>>>0)if(h>>>0>>0?(n=l+(h<<2)|0,(n|0)!=(k|0)):0){f[c>>2]=k+(~((k+-4-n|0)>>>2)<<2);x=v;y=w}else{x=v;y=w}else{kh(a,h-g|0,5908);x=f[j>>2]|0;y=f[i>>2]|0}u=u+1|0;if((u|0)>=(y-x>>2|0))break;else{v=x;w=y}}return}function Jf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)Xl(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=((c+-4-o|0)>>>2)+1|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+(p<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);br(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)mq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)mq(a);h=dn(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=((c+-4-d|0)>>>2)+1|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+(p<<2);return}function Kf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;c=u;u=u+16|0;d=c;e=a+76|0;g=f[e>>2]|0;h=a+80|0;i=f[h>>2]|0;if((i|0)!=(g|0))f[h>>2]=i+(~((i+-4-g|0)>>>2)<<2);f[e>>2]=0;f[h>>2]=0;f[a+84>>2]=0;if(g|0)br(g);g=a+64|0;h=f[g>>2]|0;e=a+68|0;if((f[e>>2]|0)!=(h|0))f[e>>2]=h;f[g>>2]=0;f[e>>2]=0;f[a+72>>2]=0;if(h|0)br(h);h=b+4|0;e=f[h>>2]|0;g=f[b>>2]|0;i=((e-g|0)/12|0)*3|0;j=a+4|0;k=f[j>>2]|0;l=f[a>>2]|0;m=k-l>>2;n=l;l=k;k=g;if(i>>>0<=m>>>0)if(i>>>0>>0?(o=n+(i<<2)|0,(o|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-o|0)>>>2)<<2);p=e;q=g;r=k}else{p=e;q=g;r=k}else{oi(a,i-m|0);m=f[b>>2]|0;p=f[h>>2]|0;q=m;r=m}if((p|0)!=(q|0)){q=f[a>>2]|0;m=(p-r|0)/12|0;p=0;do{h=p*3|0;f[q+(h<<2)>>2]=f[r+(p*12|0)>>2];f[q+(h+1<<2)>>2]=f[r+(p*12|0)+4>>2];f[q+(h+2<<2)>>2]=f[r+(p*12|0)+8>>2];p=p+1|0}while(p>>>0>>0)}f[d>>2]=-1;if(!(oc(a,d)|0)){s=0;u=c;return s|0}Gc(a)|0;fb(a,f[d>>2]|0)|0;s=1;u=c;return s|0}function Lf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-16384|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;b[m>>0]=j;b[m+1>>0]=j>>>8;n=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;o=j+8372224|0;b[m>>0]=o;b[m+1>>0]=o>>>8;b[m+2>>0]=o>>>16;n=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;o=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+-1073758208|0;b[o>>0]=m;b[o+1>>0]=m>>>8;b[o+2>>0]=m>>>16;b[o+3>>0]=m>>>24;n=(f[l>>2]|0)+4|0;break}else{n=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;n=(f[l>>2]|0)+1|0}while(0);k=((n|0)<0)<<31>>31;Cn(e);eh(n,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;Xl(h+a|0,h|0,n|0)|0;Rg(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Tn(a|0,0,n|0,k|0)|0;k=Tn(h|0,I|0,g|0,j|0)|0;vl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)br(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c);u=d;return}function Mf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)Xl(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=c+-4-o|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+((p>>>2)+1<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);br(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)mq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)mq(a);h=dn(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=c+-4-d|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+((p>>>2)+1<<2);return}function Nf(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0;g=u;u=u+80|0;h=g;i=g+64|0;Al(h);j=f[(f[a+8>>2]|0)+56>>2]|0;k=X(Ll(5)|0,d)|0;yj(h,j,0,d&255,5,0,k,((k|0)<0)<<31>>31,0,0);k=dn(96)|0;nl(k,h);pj(k,c)|0;f[i>>2]=k;Wi(a,i);k=f[i>>2]|0;f[i>>2]=0;if(k|0){i=k+88|0;c=f[i>>2]|0;f[i>>2]=0;if(c|0){i=f[c+8>>2]|0;if(i|0){h=c+12|0;if((f[h>>2]|0)!=(i|0))f[h>>2]=i;br(i)}br(c)}c=f[k+68>>2]|0;if(c|0){i=k+72|0;h=f[i>>2]|0;if((h|0)!=(c|0))f[i>>2]=h+(~((h+-4-c|0)>>>2)<<2);br(c)}c=k+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){i=h+4|0;if((f[i>>2]|0)!=(c|0))f[i>>2]=c;br(c)}br(h)}br(k)}if(!e){u=g;return}k=f[a+32>>2]|0;b[k+84>>0]=0;a=k+68|0;h=k+72|0;k=f[h>>2]|0;c=f[a>>2]|0;i=k-c>>2;d=k;if(i>>>0>>0){kh(a,e-i|0,1516);u=g;return}if(i>>>0<=e>>>0){u=g;return}i=c+(e<<2)|0;if((i|0)==(d|0)){u=g;return}f[h>>2]=d+(~((d+-4-i|0)>>>2)<<2);u=g;return}function Of(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;c=u;u=u+16|0;d=c+4|0;e=c;g=a+4|0;h=f[g>>2]|0;i=a+8|0;j=f[i>>2]|0;if((j|0)==(h|0))k=h;else{l=j+(~((j+-4-h|0)>>>2)<<2)|0;f[i>>2]=l;k=l}l=a+16|0;h=f[l>>2]|0;j=a+20|0;m=f[j>>2]|0;n=h;if((m|0)!=(h|0))f[j>>2]=m+(~((m+-4-n|0)>>>2)<<2);m=f[b>>2]|0;h=f[b+4>>2]|0;if((m|0)==(h|0)){u=c;return}b=a+12|0;a=m;m=k;k=n;while(1){n=f[a>>2]|0;f[d>>2]=n;if((m|0)==(f[b>>2]|0)){Ci(g,d);o=f[l>>2]|0}else{f[m>>2]=n;f[i>>2]=m+4;o=k}n=f[d>>2]|0;p=f[j>>2]|0;q=p-o>>2;r=o;if((n|0)<(q|0)){s=r;t=n;v=o}else{w=n+1|0;f[e>>2]=-1;x=p;if(w>>>0<=q>>>0)if(w>>>0>>0?(p=r+(w<<2)|0,(p|0)!=(x|0)):0){f[j>>2]=x+(~((x+-4-p|0)>>>2)<<2);y=n;z=r;A=o}else{y=n;z=r;A=o}else{kh(l,w-q|0,e);q=f[l>>2]|0;y=f[d>>2]|0;z=q;A=q}s=z;t=y;v=A}m=f[i>>2]|0;f[s+(t<<2)>>2]=(m-(f[g>>2]|0)>>2)+-1;a=a+4|0;if((a|0)==(h|0))break;else k=v}u=c;return}function Pf(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=d[b>>1]|0;e=d[b+2>>1]|0;g=d[b+4>>1]|0;b=(((c^318)&65535)+239^e&65535)+239^g&65535;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(d[n>>1]|0)==c<<16>>16):0)?(d[n+2>>1]|0)==e<<16>>16:0)?(d[k+12>>1]|0)==g<<16>>16:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){k=p+8|0;if(((d[k>>1]|0)==c<<16>>16?(d[k+2>>1]|0)==e<<16>>16:0)?(d[p+12>>1]|0)==g<<16>>16:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function Qf(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=u;u=u+32|0;d=c;e=a+16|0;g=e;h=f[g>>2]|0;i=f[g+4>>2]|0;if(!((i|0)>0|(i|0)==0&h>>>0>0)){u=c;return}g=Tn(f[(f[a+12>>2]|0)+4>>2]|0,0,7,0)|0;j=Wn(g|0,I|0,3)|0;g=I;if(!(b[a+24>>0]|0)){k=a+4|0;l=k;m=k;n=h;o=i}else{k=f[a>>2]|0;p=a+4|0;q=k+((f[p>>2]|0)-k)|0;k=Tn(h|0,i|0,8,0)|0;i=q+(0-k)|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;b[d+24>>0]=0;eh(j,g,d)|0;k=d+4|0;q=(f[k>>2]|0)-(f[d>>2]|0)|0;Xl(i+q|0,i+8|0,j|0)|0;Rg(i|0,f[d>>2]|0,q|0)|0;i=e;h=Tn(f[i>>2]|0,f[i+4>>2]|0,8-q|0,0)|0;q=e;f[q>>2]=h;f[q+4>>2]=I;q=d+12|0;h=f[q>>2]|0;f[q>>2]=0;if(h|0)br(h);h=f[d>>2]|0;if(h|0){if((f[k>>2]|0)!=(h|0))f[k>>2]=h;br(h)}h=e;l=p;m=p;n=f[h>>2]|0;o=f[h+4>>2]|0}h=f[l>>2]|0;l=f[a>>2]|0;p=h-l|0;k=Vn(j|0,g|0,n|0,o|0)|0;o=Tn(k|0,I|0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]=q>>24;return}}function Sf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+8|0;e=f[d>>2]|0;g=f[a>>2]|0;h=g;do if(e-g>>2>>>0>=b>>>0){i=a+4|0;j=f[i>>2]|0;k=j-g>>2;l=k>>>0>>0;m=l?k:b;n=j;if(m|0){j=m;m=h;while(1){f[m>>2]=f[c>>2];j=j+-1|0;if(!j)break;else m=m+4|0}}if(!l){m=h+(b<<2)|0;if((m|0)==(n|0))return;else{o=i;p=n+(~((n+-4-m|0)>>>2)<<2)|0;break}}else{m=b-k|0;j=m;q=n;while(1){f[q>>2]=f[c>>2];j=j+-1|0;if(!j)break;else q=q+4|0}o=i;p=n+(m<<2)|0;break}}else{q=g;if(!g)r=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-4-g|0)>>>2)<<2);br(q);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;r=0}if(b>>>0>1073741823)mq(a);j=r>>1;q=r>>2>>>0<536870911?(j>>>0>>0?b:j):1073741823;if(q>>>0>1073741823)mq(a);j=dn(q<<2)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(q<<2);q=b;l=j;while(1){f[l>>2]=f[c>>2];q=q+-1|0;if(!q)break;else l=l+4|0}o=k;p=j+(b<<2)|0}while(0);f[o>>2]=p;return}function Tf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=Qg(a,b,c,d,g)|0;i=f[e>>2]|0;j=f[d>>2]|0;k=f[g>>2]|0;g=f[k>>2]|0;l=(f[k+4>>2]|0)-g>>3;if(l>>>0<=i>>>0)mq(k);m=g;if(l>>>0<=j>>>0)mq(k);if((f[m+(i<<3)>>2]|0)>>>0>=(f[m+(j<<3)>>2]|0)>>>0){n=h;return n|0}f[d>>2]=i;f[e>>2]=j;j=f[d>>2]|0;e=f[c>>2]|0;if(l>>>0<=j>>>0)mq(k);if(l>>>0<=e>>>0)mq(k);if((f[m+(j<<3)>>2]|0)>>>0>=(f[m+(e<<3)>>2]|0)>>>0){n=h+1|0;return n|0}f[c>>2]=j;f[d>>2]=e;e=f[c>>2]|0;d=f[b>>2]|0;if(l>>>0<=e>>>0)mq(k);if(l>>>0<=d>>>0)mq(k);if((f[m+(e<<3)>>2]|0)>>>0>=(f[m+(d<<3)>>2]|0)>>>0){n=h+2|0;return n|0}f[b>>2]=e;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(l>>>0<=d>>>0)mq(k);if(l>>>0<=c>>>0)mq(k);if((f[m+(d<<3)>>2]|0)>>>0>=(f[m+(c<<3)>>2]|0)>>>0){n=h+3|0;return n|0}f[a>>2]=d;f[b>>2]=c;n=h+4|0;return n|0}function Uf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;c=((d&255^318)+239^e&255)+239^g&255;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(c>>>0>>0)l=c;else l=(c>>>0)%(h>>>0)|0;else l=c&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(c|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(b[n>>0]|0)==d<<24>>24):0)?(b[n+1>>0]|0)==e<<24>>24:0)?(b[n+2>>0]|0)==g<<24>>24:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(c|0)){k=p+8|0;if(((b[k>>0]|0)==d<<24>>24?(b[k+1>>0]|0)==e<<24>>24:0)?(b[k+2>>0]|0)==g<<24>>24:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function Vf(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;b=u;u=u+16|0;c=b;d=a+36|0;e=a+4|0;g=a+8|0;h=(f[g>>2]|0)-(f[e>>2]|0)>>2;i=a+40|0;j=f[i>>2]|0;k=f[d>>2]|0;l=j-k>>2;m=k;k=j;if(h>>>0<=l>>>0){if(h>>>0>>0?(j=m+(h<<2)|0,(j|0)!=(k|0)):0){m=k;do{k=m+-4|0;f[i>>2]=k;n=f[k>>2]|0;f[k>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);m=f[i>>2]|0}while((m|0)!=(j|0))}}else ng(d,h-l|0);if((f[g>>2]|0)==(f[e>>2]|0)){o=1;u=b;return o|0}l=a+52|0;h=a+48|0;j=0;while(1){Xa[f[(f[a>>2]|0)+56>>2]&15](c,a,j);m=(f[d>>2]|0)+(j<<2)|0;i=f[c>>2]|0;f[c>>2]=0;n=f[m>>2]|0;f[m>>2]=i;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[c>>2]|0;f[c>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[(f[d>>2]|0)+(j<<2)>>2]|0;if(!n){o=0;p=19;break}if(j>>>0<(f[l>>2]|0)>>>0?f[(f[h>>2]|0)+(j>>>5<<2)>>2]&1<<(j&31)|0:0)Pp(n);j=j+1|0;if(j>>>0>=(f[g>>2]|0)-(f[e>>2]|0)>>2>>>0){o=1;p=19;break}}if((p|0)==19){u=b;return o|0}return 0}function Wf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d+4|0;g=d;Nh(f[c+12>>2]|0,b)|0;h=f[c+8>>2]|0;a:do if(h|0){i=b+16|0;j=b+4|0;k=h;while(1){l=k;if(!(nf(0,b,l+8|0)|0)){m=0;break}n=l+20|0;o=(f[l+24>>2]|0)-(f[n>>2]|0)|0;Nh(o,b)|0;l=f[n>>2]|0;n=i;p=f[n+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[j>>2];f[e>>2]=f[g>>2];ye(b,e,l,l+o|0)|0}k=f[k>>2]|0;if(!k)break a}u=d;return m|0}while(0);Nh(f[c+32>>2]|0,b)|0;e=f[c+28>>2]|0;if(!e){m=1;u=d;return m|0}else q=e;while(1){e=q;if(!(nf(0,b,e+8|0)|0)){m=0;r=10;break}Wf(a,b,f[e+20>>2]|0)|0;q=f[q>>2]|0;if(!q){m=1;r=10;break}}if((r|0)==10){u=d;return m|0}return 0}function Xf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+8|0;i=a+12|0;j=f[h>>2]|0;if((f[i>>2]|0)==(j|0)){k=dn(76)|0;pn(k,b);l=k;f[g>>2]=l;k=f[i>>2]|0;if(k>>>0<(f[a+16>>2]|0)>>>0){f[g>>2]=0;f[k>>2]=l;f[i>>2]=k+4;m=g}else{yg(h,g);m=g}g=f[m>>2]|0;f[m>>2]=0;if(!g){u=c;return 1}Va[f[(f[g>>2]|0)+4>>2]&127](g);u=c;return 1}g=f[j>>2]|0;f[d>>2]=b;j=g+4|0;m=g+8|0;h=f[m>>2]|0;if((h|0)==(f[g+12>>2]|0))Ci(j,d);else{f[h>>2]=b;f[m>>2]=h+4}h=f[d>>2]|0;b=g+16|0;k=g+20|0;g=f[k>>2]|0;i=f[b>>2]|0;l=g-i>>2;a=i;if((h|0)<(l|0)){n=a;o=h}else{i=h+1|0;f[e>>2]=-1;p=g;if(i>>>0<=l>>>0)if(i>>>0>>0?(g=a+(i<<2)|0,(g|0)!=(p|0)):0){f[k>>2]=p+(~((p+-4-g|0)>>>2)<<2);q=h;r=a}else{q=h;r=a}else{kh(b,i-l|0,e);q=f[d>>2]|0;r=f[b>>2]|0}n=r;o=q}f[n+(o<<2)>>2]=((f[m>>2]|0)-(f[j>>2]|0)>>2)+-1;u=c;return 1}function Yf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=c;e=b;g=d-e|0;h=g>>2;i=a+8|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(h>>>0>j-k>>2>>>0){m=k;if(!k)n=j;else{j=a+4|0;o=f[j>>2]|0;if((o|0)!=(l|0))f[j>>2]=o+(~((o+-4-k|0)>>>2)<<2);br(m);f[i>>2]=0;f[j>>2]=0;f[a>>2]=0;n=0}if(h>>>0>1073741823)mq(a);j=n>>1;m=n>>2>>>0<536870911?(j>>>0>>0?h:j):1073741823;if(m>>>0>1073741823)mq(a);j=dn(m<<2)|0;n=a+4|0;f[n>>2]=j;f[a>>2]=j;f[i>>2]=j+(m<<2);if((g|0)<=0)return;Rg(j|0,b|0,g|0)|0;f[n>>2]=j+(g>>>2<<2);return}g=a+4|0;a=f[g>>2]|0;j=a-k>>2;k=h>>>0>j>>>0;h=k?b+(j<<2)|0:c;c=a;j=a;if((h|0)==(b|0))p=l;else{a=h+-4-e|0;e=b;b=l;while(1){f[b>>2]=f[e>>2];e=e+4|0;if((e|0)==(h|0))break;else b=b+4|0}p=l+((a>>>2)+1<<2)|0}if(k){k=d-h|0;if((k|0)<=0)return;Rg(j|0,h|0,k|0)|0;f[g>>2]=(f[g>>2]|0)+(k>>>2<<2);return}else{if((p|0)==(c|0))return;f[g>>2]=c+(~((c+-4-p|0)>>>2)<<2);return}}function Zf(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0;g=u;u=u+96|0;h=g+40|0;i=g;Gm(h,d);we(i,c,d);th(h,i);sj(i+24|0,f[i+28>>2]|0);Dj(i+12|0,f[i+16>>2]|0);sj(i,f[i+4>>2]|0);Si(a,h,e);if(!(f[a>>2]|0)){e=a+4|0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);f[c+40>>2]=f[h+40>>2];f[c+44>>2]=f[h+44>>2];f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0}f[h>>2]=2968;sj(h+28|0,f[h+32>>2]|0);Dj(h+16|0,f[h+20>>2]|0);sj(h+4|0,f[h+8>>2]|0);u=g;return}function _f(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;b=((c^318)+239^d)+239^e;g=f[a+4>>2]|0;if(!g){h=0;return h|0}i=g+-1|0;j=(i&g|0)==0;if(!j)if(b>>>0>>0)k=b;else k=(b>>>0)%(g>>>0)|0;else k=b&i;l=f[(f[a>>2]|0)+(k<<2)>>2]|0;if(!l){h=0;return h|0}a=f[l>>2]|0;if(!a){h=0;return h|0}if(j){j=a;while(1){l=f[j+4>>2]|0;m=(l|0)==(b|0);if(!(m|(l&i|0)==(k|0))){h=0;n=23;break}if(((m?(f[j+8>>2]|0)==(c|0):0)?(f[j+12>>2]|0)==(d|0):0)?(f[j+16>>2]|0)==(e|0):0){h=j;n=23;break}j=f[j>>2]|0;if(!j){h=0;n=23;break}}if((n|0)==23)return h|0}else o=a;while(1){a=f[o+4>>2]|0;if((a|0)==(b|0)){if(((f[o+8>>2]|0)==(c|0)?(f[o+12>>2]|0)==(d|0):0)?(f[o+16>>2]|0)==(e|0):0){h=o;n=23;break}}else{if(a>>>0>>0)p=a;else p=(a>>>0)%(g>>>0)|0;if((p|0)!=(k|0)){h=0;n=23;break}}o=f[o>>2]|0;if(!o){h=0;n=23;break}}if((n|0)==23)return h|0;return 0}function $f(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=u;u=u+16|0;g=e;if(!(ih(a,c,d)|0)){h=0;u=e;return h|0}if((b[(f[a+8>>2]|0)+24>>0]|0)!=3){h=0;u=e;return h|0}i=f[c+48>>2]|0;c=dn(32)|0;f[g>>2]=c;f[g+8>>2]=-2147483616;f[g+4>>2]=17;j=c;k=12932;l=j+17|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[c+17>>0]=0;c=i+16|0;k=f[c>>2]|0;if(k){j=c;l=k;a:while(1){k=l;while(1){if((f[k+16>>2]|0)>=(d|0))break;m=f[k+4>>2]|0;if(!m){n=j;break a}else k=m}l=f[k>>2]|0;if(!l){n=k;break}else j=k}if(((n|0)!=(c|0)?(f[n+16>>2]|0)<=(d|0):0)?(d=n+20|0,(sh(d,g)|0)!=0):0)o=yk(d,g,-1)|0;else p=12}else p=12;if((p|0)==12)o=yk(i,g,-1)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);if((o|0)<1){h=0;u=e;return h|0}tp(a+40|0,o);h=1;u=e;return h|0}function ag(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=c;g=d-e|0;h=a+8|0;i=f[h>>2]|0;j=f[a>>2]|0;k=j;if(g>>>0>(i-j|0)>>>0){if(!j)l=i;else{i=a+4|0;if((f[i>>2]|0)!=(k|0))f[i>>2]=k;br(k);f[h>>2]=0;f[i>>2]=0;f[a>>2]=0;l=0}if((g|0)<0)mq(a);i=l<<1;m=l>>>0<1073741823?(i>>>0>>0?g:i):2147483647;if((m|0)<0)mq(a);i=dn(m)|0;l=a+4|0;f[l>>2]=i;f[a>>2]=i;f[h>>2]=i+m;if((c|0)==(d|0))return;else{n=c;o=i}do{b[o>>0]=b[n>>0]|0;n=n+1|0;o=(f[l>>2]|0)+1|0;f[l>>2]=o}while((n|0)!=(d|0));return}n=a+4|0;a=(f[n>>2]|0)-j|0;j=g>>>0>a>>>0;g=c+a|0;a=j?g:d;if((a|0)==(c|0))p=k;else{o=c;c=k;while(1){b[c>>0]=b[o>>0]|0;o=o+1|0;if((o|0)==(a|0))break;else c=c+1|0}p=k+(a-e)|0}if(!j){if((f[n>>2]|0)==(p|0))return;f[n>>2]=p;return}if((a|0)==(d|0))return;a=g;g=f[n>>2]|0;do{b[g>>0]=b[a>>0]|0;a=a+1|0;g=(f[n>>2]|0)+1|0;f[n>>2]=g}while((a|0)!=(d|0));return}function bg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=c>>>1&1431655765|c<<1&-1431655766;c=d>>>2&858993459|d<<2&-858993460;d=c>>>4&252645135|c<<4&-252645136;c=d>>>8&16711935|d<<8&-16711936;d=32-b|0;e=(c>>>16|c<<16)>>>d;c=e-(e>>>1&1431655765)|0;g=(c>>>2&858993459)+(c&858993459)|0;c=(X((g>>>4)+g&252645135,16843009)|0)>>>24;g=b-c|0;h=f[a>>2]|0;i=h;j=Tn(f[i>>2]|0,f[i+4>>2]|0,g|0,((g|0)<0)<<31>>31|0)|0;g=h;f[g>>2]=j;f[g+4>>2]=I;g=h+8|0;h=g;j=Tn(f[h>>2]|0,f[h+4>>2]|0,c|0,0)|0;c=g;f[c>>2]=j;f[c+4>>2]=I;c=a+28|0;j=f[c>>2]|0;g=32-j|0;h=a+24|0;do if((g|0)>=(b|0)){i=-1>>>d<>2]&~i|i&e<>2]=k;i=j+b|0;f[c>>2]=i;if((i|0)!=32)return;i=a+16|0;l=f[i>>2]|0;if((l|0)==(f[a+20>>2]|0)){Ci(a+12|0,h);m=0;n=0;break}else{f[l>>2]=k;f[i>>2]=l+4;m=0;n=0;break}}else{l=-1>>>j<>2]&~l|l&e<>2]=i;l=a+16|0;k=f[l>>2]|0;if((k|0)==(f[a+20>>2]|0))Ci(a+12|0,h);else{f[k>>2]=i;f[l>>2]=k+4}k=b-g|0;m=k;n=-1>>>(32-k|0)&e>>>g}while(0);f[h>>2]=n;f[c>>2]=m;return}function cg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=c&255;g=(d|0)!=0;a:do if(g&(a&3|0)!=0){h=c&255;i=a;j=d;while(1){if((b[i>>0]|0)==h<<24>>24){k=i;l=j;m=6;break a}n=i+1|0;o=j+-1|0;p=(o|0)!=0;if(p&(n&3|0)!=0){i=n;j=o}else{q=n;r=o;s=p;m=5;break}}}else{q=a;r=d;s=g;m=5}while(0);if((m|0)==5)if(s){k=q;l=r;m=6}else{t=q;u=0}b:do if((m|0)==6){q=c&255;if((b[k>>0]|0)==q<<24>>24){t=k;u=l}else{r=X(e,16843009)|0;c:do if(l>>>0>3){s=k;g=l;while(1){d=f[s>>2]^r;if((d&-2139062144^-2139062144)&d+-16843009|0)break;d=s+4|0;a=g+-4|0;if(a>>>0>3){s=d;g=a}else{v=d;w=a;m=11;break c}}x=s;y=g}else{v=k;w=l;m=11}while(0);if((m|0)==11)if(!w){t=v;u=0;break}else{x=v;y=w}while(1){if((b[x>>0]|0)==q<<24>>24){t=x;u=y;break b}r=x+1|0;y=y+-1|0;if(!y){t=r;u=0;break}else x=r}}}while(0);return (u|0?t:0)|0}function dg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=e;do if((d|0)==(e|0)){h=a+8|0;i=f[h>>2]|0;j=a+12|0;k=f[j>>2]|0;l=k;if(i>>>0>>0){k=i;m=((l-k>>2)+1|0)/2|0;n=i+(m<<2)|0;o=k-d|0;k=o>>2;p=n+(0-k<<2)|0;if(!k){q=n;r=i}else{Xl(p|0,d|0,o|0)|0;q=p;r=f[h>>2]|0}f[c>>2]=q;f[h>>2]=r+(m<<2);s=q;break}m=l-g>>1;l=(m|0)==0?1:m;if(l>>>0>1073741823){m=ra(8)|0;Wo(m,14941);f[m>>2]=6944;va(m|0,1080,114)}m=dn(l<<2)|0;p=m;o=m+((l+3|0)>>>2<<2)|0;n=o;k=m+(l<<2)|0;if((d|0)==(i|0)){t=n;u=d}else{l=o;m=n;v=d;do{f[l>>2]=f[v>>2];l=m+4|0;m=l;v=v+4|0}while((v|0)!=(i|0));t=m;u=f[a>>2]|0}f[a>>2]=p;f[c>>2]=n;f[h>>2]=t;f[j>>2]=k;if(!u)s=o;else{br(u);s=f[c>>2]|0}}else s=d;while(0);f[s+-4>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+-4;return}function eg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+4|0;if((f[i>>2]|0)==-1){j=0;u=d;return j|0}k=f[a+8>>2]|0;l=c+16|0;m=l;n=f[m>>2]|0;o=f[m+4>>2]|0;if(!((o|0)>0|(o|0)==0&n>>>0>0)){m=(f[a+12>>2]|0)-k|0;p=c+4|0;f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];ye(c,e,k,k+m|0)|0;m=l;k=f[m>>2]|0;q=f[m+4>>2]|0;m=a+20|0;if((q|0)>0|(q|0)==0&k>>>0>0){r=q;s=k;t=g}else{f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];ye(c,e,m,m+4|0)|0;m=l;r=f[m+4>>2]|0;s=f[m>>2]|0;t=g}}else{r=o;s=n;t=g}b[h>>0]=f[i>>2];if(!((r|0)>0|(r|0)==0&s>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function fg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;e=u;u=u+16|0;g=e+4|0;h=e;i=a+8|0;a=f[i>>2]|0;j=f[a+40>>2]|0;k=_q((j|0)>-1?j:-1)|0;l=c+4|0;m=f[l>>2]|0;n=f[c>>2]|0;if((m|0)==(n|0)){$q(k);u=e;return 1}o=d+16|0;p=d+4|0;q=k+j|0;j=0;r=n;n=a;s=a;a=m;while(1){m=f[r+(j<<2)>>2]|0;if(!(b[n+84>>0]|0))t=f[(f[n+68>>2]|0)+(m<<2)>>2]|0;else t=m;m=s+48|0;v=f[m>>2]|0;w=f[m+4>>2]|0;m=s+40|0;x=f[m>>2]|0;y=on(x|0,f[m+4>>2]|0,t|0,0)|0;m=Tn(y|0,I|0,v|0,w|0)|0;Rg(k|0,(f[f[s>>2]>>2]|0)+m|0,x|0)|0;x=o;m=f[x+4>>2]|0;if((m|0)>0|(m|0)==0&(f[x>>2]|0)>>>0>0){z=r;A=a}else{f[h>>2]=f[p>>2];f[g>>2]=f[h>>2];ye(d,g,k,q)|0;z=f[c>>2]|0;A=f[l>>2]|0}x=j+1|0;if(x>>>0>=A-z>>2>>>0)break;m=f[i>>2]|0;j=x;r=z;n=m;s=m;a=A}$q(k);u=e;return 1}function gg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=(f[b>>2]|0)*3|0;if((d|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}b=f[a+12>>2]|0;h=f[b+12>>2]|0;if((f[h+(d<<2)>>2]|0)==-1){e=0;g=d;f[c>>2]=g;return e|0}i=f[b>>2]|0;b=f[a+152>>2]|0;if((f[b+(f[i+(d<<2)>>2]<<2)>>2]|0)==-1){a=d+1|0;j=((a>>>0)%3|0|0)==0?d+-2|0:a;if((j|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(j<<2)>>2]|0)==-1){e=0;g=j;f[c>>2]=g;return e|0}if((f[b+(f[i+(j<<2)>>2]<<2)>>2]|0)==-1){a=j+1|0;k=((a>>>0)%3|0|0)==0?j+-2|0:a;if((k|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(k<<2)>>2]|0)==-1){e=0;g=k;f[c>>2]=g;return e|0}if((f[b+(f[i+(k<<2)>>2]<<2)>>2]|0)==-1){i=k+1|0;e=1;g=((i>>>0)%3|0|0)==0?k+-2|0:i;f[c>>2]=g;return e|0}else l=k}else l=j}else l=d;while(1){d=(((l>>>0)%3|0|0)==0?2:-1)+l|0;if((d|0)==-1)break;j=f[h+(d<<2)>>2]|0;if((j|0)==-1)break;d=j+(((j>>>0)%3|0|0)==0?2:-1)|0;if((d|0)==-1)break;else l=d}e=0;g=(((l>>>0)%3|0|0)==0?2:-1)+l|0;f[c>>2]=g;return e|0}function hg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=a+4|0;g=f[e>>2]|0;if(!g){f[c>>2]=e;h=e;return h|0}e=b[d+11>>0]|0;i=e<<24>>24<0;j=i?f[d+4>>2]|0:e&255;e=i?f[d>>2]|0:d;d=a+4|0;a=g;while(1){g=a+16|0;i=b[g+11>>0]|0;k=i<<24>>24<0;l=k?f[a+20>>2]|0:i&255;i=l>>>0>>0;m=i?l:j;if((m|0)!=0?(n=Pk(e,k?f[g>>2]|0:g,m)|0,(n|0)!=0):0)if((n|0)<0)o=8;else o=10;else if(j>>>0>>0)o=8;else o=10;if((o|0)==8){o=0;n=f[a>>2]|0;if(!n){o=9;break}else{p=a;q=n}}else if((o|0)==10){o=0;n=j>>>0>>0?j:l;if((n|0)!=0?(l=Pk(k?f[g>>2]|0:g,e,n)|0,(l|0)!=0):0){if((l|0)>=0){o=16;break}}else o=12;if((o|0)==12?(o=0,!i):0){o=16;break}r=a+4|0;i=f[r>>2]|0;if(!i){o=15;break}else{p=r;q=i}}d=p;a=q}if((o|0)==9){f[c>>2]=a;h=a;return h|0}else if((o|0)==15){f[c>>2]=a;h=r;return h|0}else if((o|0)==16){f[c>>2]=a;h=d;return h|0}return 0}function ig(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;d=u;u=u+32|0;e=d+24|0;g=d+16|0;h=d+8|0;i=d;j=a+4|0;k=f[j>>2]|0;l=f[b>>2]|0;m=f[b+4>>2]|0;b=f[c>>2]|0;n=f[c+4>>2]|0;c=b-l<<3;f[j>>2]=k-m+n+c;j=(f[a>>2]|0)+(k>>>5<<2)|0;a=k&31;k=j;if((m|0)!=(a|0)){f[e>>2]=l;f[e+4>>2]=m;f[g>>2]=b;f[g+4>>2]=n;f[h>>2]=k;f[h+4>>2]=a;ke(i,e,g,h);u=d;return}h=n-m+c|0;c=l;if((h|0)>0){if(!m){o=h;p=j;q=0;r=l;s=c}else{l=32-m|0;n=(h|0)<(l|0)?h:l;g=-1>>>(l-n|0)&-1<>2]=f[j>>2]&~g|f[c>>2]&g;g=n+m|0;l=c+4|0;o=h-n|0;p=j+(g>>>5<<2)|0;q=g&31;r=l;s=l}l=(o|0)/32|0;Xl(p|0,r|0,l<<2|0)|0;r=o-(l<<5)|0;o=p+(l<<2)|0;p=o;if((r|0)>0){g=-1>>>(32-r|0);f[o>>2]=f[o>>2]&~g|f[s+(l<<2)>>2]&g;t=r;v=p}else{t=q;v=p}}else{t=m;v=k}f[i>>2]=v;f[i+4>>2]=t;u=d;return}function jg(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=u;u=u+16|0;h=g;i=c+4|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;j=dn(16)|0;f[h>>2]=j;f[h+8>>2]=-2147483632;f[h+4>>2]=15;k=j;l=12916;m=k+15|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[j+15>>0]=0;j=yk(i,h,-1)|0;if((b[h+11>>0]|0)<0)br(f[h>>2]|0);switch(j|0){case -1:{if((Yh(i)|0)==10)n=6;else n=5;break}case 1:{n=5;break}default:n=6}if((n|0)==5){j=dn(68)|0;Xo(j);o=j}else if((n|0)==6){n=dn(64)|0;Gp(n);o=n}vo(o,d);Ad(a,o,i,e);if(f[a>>2]|0){p=f[o>>2]|0;q=p+4|0;r=f[q>>2]|0;Va[r&127](o);u=g;return}e=a+4|0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);f[c+40>>2]=f[o+52>>2];f[c+44>>2]=f[o+60>>2];f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;p=f[o>>2]|0;q=p+4|0;r=f[q>>2]|0;Va[r&127](o);u=g;return}function kg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;c=a+8|0;d=f[c>>2]|0;e=a+12|0;g=f[e>>2]|0;h=g;do if((d|0)==(g|0)){i=a+4|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(j>>>0>k>>>0){m=j;n=((m-l>>2)+1|0)/-2|0;o=j+(n<<2)|0;p=d-m|0;m=p>>2;if(!m)q=j;else{Xl(o|0,j|0,p|0)|0;q=f[i>>2]|0}p=o+(m<<2)|0;f[c>>2]=p;f[i>>2]=q+(n<<2);r=p;break}p=h-l>>1;l=(p|0)==0?1:p;if(l>>>0>1073741823){p=ra(8)|0;Wo(p,14941);f[p>>2]=6944;va(p|0,1080,114)}p=dn(l<<2)|0;n=p;m=p+(l>>>2<<2)|0;o=m;s=p+(l<<2)|0;if((j|0)==(d|0)){t=o;u=k}else{k=m;m=o;l=j;do{f[k>>2]=f[l>>2];k=m+4|0;m=k;l=l+4|0}while((l|0)!=(d|0));t=m;u=f[a>>2]|0}f[a>>2]=n;f[i>>2]=o;f[c>>2]=t;f[e>>2]=s;if(!u)r=t;else{br(u);r=f[c>>2]|0}}else r=d;while(0);f[r>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+4;return}function lg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=a+12|0;h=f[g>>2]|0;$j(f[a+4>>2]|0,(f[h+56>>2]|0)-(f[h+52>>2]|0)>>2);h=a+76|0;a=f[h>>2]|0;if(!a){i=f[(f[g>>2]|0)+64>>2]|0;g=(f[i+4>>2]|0)-(f[i>>2]|0)>>2;i=(g>>>0)/3|0;if(g>>>0<=2){j=1;u=b;return j|0}g=0;while(1){f[d>>2]=g*3;f[c>>2]=f[d>>2];g=g+1|0;if(!(Tb(e,c)|0)){j=0;k=10;break}if((g|0)>=(i|0)){j=1;k=10;break}}if((k|0)==10){u=b;return j|0}}else{i=f[a>>2]|0;if((f[a+4>>2]|0)==(i|0)){j=1;u=b;return j|0}a=0;g=i;while(1){f[d>>2]=f[g+(a<<2)>>2];f[c>>2]=f[d>>2];a=a+1|0;if(!(Tb(e,c)|0)){j=0;k=10;break}i=f[h>>2]|0;g=f[i>>2]|0;if(a>>>0>=(f[i+4>>2]|0)-g>>2>>>0){j=1;k=10;break}}if((k|0)==10){u=b;return j|0}}return 0}function mg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+12|0;i=a+4|0;j=f[i>>2]|0;if((j|0)==(f[a+8>>2]|0)){Ci(a,h);k=f[i>>2]|0}else{f[j>>2]=f[h>>2];l=j+4|0;f[i>>2]=l;k=l}l=f[a>>2]|0;f[g>>2]=k-l;k=b+16|0;j=k;m=f[j+4>>2]|0;if(!((m|0)>0|(m|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;j=f[a>>2]|0;m=f[g>>2]|0;g=k;k=f[g+4>>2]|0;if((k|0)>0|(k|0)==0&(f[g>>2]|0)>>>0>0){n=j;o=e}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,j,j+m|0)|0;n=f[a>>2]|0;o=e}}else{n=l;o=e}e=f[i>>2]|0;if((e|0)==(n|0)){f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}f[i>>2]=e+(~((e+-4-n|0)>>>2)<<2);f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}function ng(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){hj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}i=f[a>>2]|0;j=g-i>>2;g=j+b|0;k=i;if(g>>>0>1073741823)mq(a);l=d-i|0;d=l>>1;m=l>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(m)if(m>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{n=dn(m<<2)|0;break}else n=0;while(0);d=n+(j<<2)|0;hj(d|0,0,b<<2|0)|0;b=d;j=n+(m<<2)|0;m=n+(g<<2)|0;if((h|0)==(k|0)){o=b;p=i;q=h}else{i=h;h=b;b=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[b+-4>>2]=d;b=h+-4|0;h=b}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=j;j=p;if((q|0)!=(j|0)){c=q;do{c=c+-4|0;q=f[c>>2]|0;f[c>>2]=0;if(q|0)Va[f[(f[q>>2]|0)+4>>2]&127](q)}while((c|0)!=(j|0))}if(!p)return;br(p);return}function og(a){a=a|0;lk(a);lk(a+32|0);lk(a+64|0);lk(a+96|0);lk(a+128|0);lk(a+160|0);lk(a+192|0);lk(a+224|0);lk(a+256|0);lk(a+288|0);lk(a+320|0);lk(a+352|0);lk(a+384|0);lk(a+416|0);lk(a+448|0);lk(a+480|0);lk(a+512|0);lk(a+544|0);lk(a+576|0);lk(a+608|0);lk(a+640|0);lk(a+672|0);lk(a+704|0);lk(a+736|0);lk(a+768|0);lk(a+800|0);lk(a+832|0);lk(a+864|0);lk(a+896|0);lk(a+928|0);lk(a+960|0);lk(a+992|0);lk(a+1024|0);return}function pg(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=$(h);var i=0,j=0,k=0,l=0,m=0,n=0;i=u;u=u+16|0;j=i;k=i+4|0;f[j>>2]=c;c=a+4|0;a=dn(32)|0;f[k>>2]=a;f[k+8>>2]=-2147483616;f[k+4>>2]=17;l=a;m=12932;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[a+17>>0]=0;Nj(wd(c,j)|0,k,d);if((b[k+11>>0]|0)<0)br(f[k>>2]|0);d=dn(32)|0;f[k>>2]=d;f[k+8>>2]=-2147483616;f[k+4>>2]=19;l=d;m=13005;n=l+19|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[d+19>>0]=0;ci(wd(c,j)|0,k,g,e);if((b[k+11>>0]|0)<0)br(f[k>>2]|0);e=dn(32)|0;f[k>>2]=e;f[k+8>>2]=-2147483616;f[k+4>>2]=18;l=e;m=13025;n=l+18|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[e+18>>0]=0;Lj(wd(c,j)|0,k,h);if((b[k+11>>0]|0)>=0){u=i;return}br(f[k>>2]|0);u=i;return}function qg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=c;e=b;g=d-e|0;h=g>>2;i=a+8|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(h>>>0<=j-k>>2>>>0){m=a+4|0;n=(f[m>>2]|0)-k>>2;o=h>>>0>n>>>0;p=o?b+(n<<2)|0:c;c=p;n=c-e|0;e=n>>2;if(e|0)Xl(k|0,b|0,n|0)|0;n=l+(e<<2)|0;if(o){o=d-c|0;if((o|0)<=0)return;Rg(f[m>>2]|0,p|0,o|0)|0;f[m>>2]=(f[m>>2]|0)+(o>>>2<<2);return}else{o=f[m>>2]|0;if((o|0)==(n|0))return;f[m>>2]=o+(~((o+-4-n|0)>>>2)<<2);return}}n=k;if(!k)q=j;else{j=a+4|0;o=f[j>>2]|0;if((o|0)!=(l|0))f[j>>2]=o+(~((o+-4-k|0)>>>2)<<2);br(n);f[i>>2]=0;f[j>>2]=0;f[a>>2]=0;q=0}if(h>>>0>1073741823)mq(a);j=q>>1;n=q>>2>>>0<536870911?(j>>>0>>0?h:j):1073741823;if(n>>>0>1073741823)mq(a);j=dn(n<<2)|0;h=a+4|0;f[h>>2]=j;f[a>>2]=j;f[i>>2]=j+(n<<2);if((g|0)<=0)return;Rg(j|0,b|0,g|0)|0;f[h>>2]=j+(g>>>2<<2);return}function rg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0.0,r=0.0,s=0.0,t=0,v=0.0;e=u;u=u+16|0;g=e;h=c+1|0;f[g>>2]=0;i=g+4|0;f[i>>2]=0;f[g+8>>2]=0;do if(h)if(h>>>0>1073741823)mq(g);else{j=dn(h<<2)|0;f[g>>2]=j;k=j+(h<<2)|0;f[g+8>>2]=k;hj(j|0,0,(c<<2)+4|0)|0;f[i>>2]=k;l=j;m=k;n=j;break}else{l=0;m=0;n=0}while(0);if((b|0)>0){g=0;do{j=l+(f[a+(g<<2)>>2]<<2)|0;f[j>>2]=(f[j>>2]|0)+1;g=g+1|0}while((g|0)!=(b|0))}o=+(b|0);if((c|0)<0){p=0;q=0.0}else{c=0;r=0.0;b=0;while(1){g=f[l+(b<<2)>>2]|0;s=+(g|0);if((g|0)>0){t=c+1|0;v=r+ +Fg(s/o)*s}else{t=c;v=r}b=b+1|0;if((b|0)==(h|0)){p=t;q=v;break}else{c=t;r=v}}}if(d|0)f[d>>2]=p;v=-q;p=~~v>>>0;d=+K(v)>=1.0?(v>0.0?~~+Y(+J(v/4294967296.0),4294967295.0)>>>0:~~+W((v-+(~~v>>>0))/4294967296.0)>>>0):0;if(!l){I=d;u=e;return p|0}if((m|0)!=(l|0))f[i>>2]=m+(~((m+-4-l|0)>>>2)<<2);br(n);I=d;u=e;return p|0}function sg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=a+12|0;h=f[g>>2]|0;$j(f[a+4>>2]|0,(f[h+28>>2]|0)-(f[h+24>>2]|0)>>2);h=a+76|0;a=f[h>>2]|0;if(!a){i=f[g>>2]|0;g=(f[i+4>>2]|0)-(f[i>>2]|0)>>2;i=(g>>>0)/3|0;if(g>>>0<=2){j=1;u=b;return j|0}g=0;while(1){f[d>>2]=g*3;f[c>>2]=f[d>>2];g=g+1|0;if(!(Wb(e,c)|0)){j=0;k=10;break}if((g|0)>=(i|0)){j=1;k=10;break}}if((k|0)==10){u=b;return j|0}}else{i=f[a>>2]|0;if((f[a+4>>2]|0)==(i|0)){j=1;u=b;return j|0}a=0;g=i;while(1){f[d>>2]=f[g+(a<<2)>>2];f[c>>2]=f[d>>2];a=a+1|0;if(!(Wb(e,c)|0)){j=0;k=10;break}i=f[h>>2]|0;g=f[i>>2]|0;if(a>>>0>=(f[i+4>>2]|0)-g>>2>>>0){j=1;k=10;break}}if((k|0)==10){u=b;return j|0}}return 0}function tg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e+4|0;h=e;i=dn(32)|0;f[a>>2]=i;f[a+4>>2]=c+4;c=a+8|0;b[c>>0]=0;f[i+16>>2]=f[d>>2];a=i+20|0;f[i+24>>2]=0;f[i+28>>2]=0;j=i+24|0;f[a>>2]=j;i=f[d+4>>2]|0;k=d+8|0;if((i|0)==(k|0)){b[c>>0]=1;u=e;return}d=j;j=i;while(1){i=j+16|0;f[h>>2]=d;f[g>>2]=f[h>>2];Wg(a,g,i,i)|0;i=f[j+4>>2]|0;if(!i){l=j+8|0;m=f[l>>2]|0;if((f[m>>2]|0)==(j|0))n=m;else{m=l;do{l=f[m>>2]|0;m=l+8|0;o=f[m>>2]|0}while((f[o>>2]|0)!=(l|0));n=o}}else{m=i;while(1){o=f[m>>2]|0;if(!o)break;else m=o}n=m}if((n|0)==(k|0))break;else j=n}b[c>>0]=1;u=e;return}function ug(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;f[e>>2]=b;g=a+8|0;if(((f[a+12>>2]|0)-(f[g>>2]|0)>>2|0)<=(b|0))jh(g,b+1|0);h=f[(f[c>>2]|0)+56>>2]|0;do if((h|0)<5){i=a+20+(h*12|0)+4|0;j=f[i>>2]|0;if((j|0)==(f[a+20+(h*12|0)+8>>2]|0)){Ci(a+20+(h*12|0)|0,e);break}else{f[j>>2]=b;f[i>>2]=j+4;break}}while(0);b=f[c>>2]|0;h=f[e>>2]|0;f[b+60>>2]=h;e=(f[g>>2]|0)+(h<<2)|0;f[c>>2]=0;c=f[e>>2]|0;f[e>>2]=b;if(!c){u=d;return}b=c+88|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0){b=f[e+8>>2]|0;if(b|0){h=e+12|0;if((f[h>>2]|0)!=(b|0))f[h>>2]=b;br(b)}br(e)}e=f[c+68>>2]|0;if(e|0){b=c+72|0;h=f[b>>2]|0;if((h|0)!=(e|0))f[b>>2]=h+(~((h+-4-e|0)>>>2)<<2);br(e)}e=c+64|0;h=f[e>>2]|0;f[e>>2]=0;if(h|0){e=f[h>>2]|0;if(e|0){b=h+4|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;br(e)}br(h)}br(c);u=d;return}function vg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;d=u;u=u+48|0;e=d+16|0;g=d;h=d+32|0;i=a+28|0;j=f[i>>2]|0;f[h>>2]=j;k=a+20|0;l=(f[k>>2]|0)-j|0;f[h+4>>2]=l;f[h+8>>2]=b;f[h+12>>2]=c;b=l+c|0;l=a+60|0;f[g>>2]=f[l>>2];f[g+4>>2]=h;f[g+8>>2]=2;j=ro(Aa(146,g|0)|0)|0;a:do if((b|0)!=(j|0)){g=2;m=b;n=h;o=j;while(1){if((o|0)<0)break;m=m-o|0;p=f[n+4>>2]|0;q=o>>>0>p>>>0;r=q?n+8|0:n;s=g+(q<<31>>31)|0;t=o-(q?p:0)|0;f[r>>2]=(f[r>>2]|0)+t;p=r+4|0;f[p>>2]=(f[p>>2]|0)-t;f[e>>2]=f[l>>2];f[e+4>>2]=r;f[e+8>>2]=s;o=ro(Aa(146,e|0)|0)|0;if((m|0)==(o|0)){v=3;break a}else{g=s;n=r}}f[a+16>>2]=0;f[i>>2]=0;f[k>>2]=0;f[a>>2]=f[a>>2]|32;if((g|0)==2)w=0;else w=c-(f[n+4>>2]|0)|0}else v=3;while(0);if((v|0)==3){v=f[a+44>>2]|0;f[a+16>>2]=v+(f[a+48>>2]|0);a=v;f[i>>2]=a;f[k>>2]=a;w=c}u=d;return w|0}function wg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=5880;b=f[a+68>>2]|0;if(b|0){c=a+72|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+56>>2]|0;if(b|0){d=a+60|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+44>>2]|0;if(b|0){c=a+48|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+32>>2]|0;if(b|0){d=a+36|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+20>>2]|0;if(b|0){c=a+24|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}Sh(a+8|0);b=a+4|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;b=a+40|0;d=f[b>>2]|0;if(d|0){c=a+44|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[c>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0){Qi(i);br(i)}h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}br(g)}Qi(a);br(a);return}function xg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if(((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(f[(f[d>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)==0:0)?(j=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if(((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(f[(f[d>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0)==0:0)?(k=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if((((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(f[(f[d>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0:0)?(h=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function yg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)mq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{k=dn(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n)}while((h|0)!=(g|0))}if(!m)return;br(m);return}function zg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+4|0;a=f[d>>2]|0;do if(a|0){e=b[c+11>>0]|0;g=e<<24>>24<0;h=g?f[c+4>>2]|0:e&255;e=g?f[c>>2]|0:c;g=d;i=a;a:while(1){j=i;while(1){k=j+16|0;l=b[k+11>>0]|0;m=l<<24>>24<0;n=m?f[j+20>>2]|0:l&255;l=h>>>0>>0?h:n;if((l|0)!=0?(o=Pk(m?f[k>>2]|0:k,e,l)|0,(o|0)!=0):0){if((o|0)>=0)break}else p=6;if((p|0)==6?(p=0,n>>>0>=h>>>0):0)break;n=f[j+4>>2]|0;if(!n){q=g;break a}else j=n}i=f[j>>2]|0;if(!i){q=j;break}else g=j}if((q|0)!=(d|0)){g=q+16|0;i=b[g+11>>0]|0;n=i<<24>>24<0;o=n?f[q+20>>2]|0:i&255;i=o>>>0>>0?o:h;if(i|0?(l=Pk(e,n?f[g>>2]|0:g,i)|0,l|0):0){if((l|0)<0)break;else r=q;return r|0}if(h>>>0>=o>>>0){r=q;return r|0}}}while(0);r=d;return r|0}function Ag(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if(((e-h|0)/12|0)>>>0>=b>>>0){i=b;j=h;do{f[j>>2]=f[c>>2];f[j+4>>2]=f[c+4>>2];f[j+8>>2]=f[c+8>>2];j=(f[g>>2]|0)+12|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/12|0;h=j+b|0;if(h>>>0>357913941)mq(a);k=(e-i|0)/12|0;i=k<<1;e=k>>>0<178956970?(i>>>0>>0?h:i):357913941;do if(e)if(e>>>0>357913941){i=ra(8)|0;Wo(i,14941);f[i>>2]=6944;va(i|0,1080,114)}else{l=dn(e*12|0)|0;break}else l=0;while(0);i=l+(j*12|0)|0;j=l+(e*12|0)|0;e=b;b=i;l=i;do{f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];b=l+12|0;l=b;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;b=(f[g>>2]|0)-e|0;c=i+(((b|0)/-12|0)*12|0)|0;if((b|0)>0)Rg(c|0,e|0,b|0)|0;f[a>>2]=c;f[g>>2]=l;f[d>>2]=j;if(!e)return;br(e);return}function Bg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)mq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{k=dn(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0){Qi(n);br(n)}}while((h|0)!=(g|0))}if(!m)return;br(m);return}function Cg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=f[b>>2]|0;g=f[a>>2]|0;h=f[d>>2]|0;d=f[h>>2]|0;i=(f[h+4>>2]|0)-d>>3;if(i>>>0<=e>>>0)mq(h);j=d;if(i>>>0<=g>>>0)mq(h);d=f[j+(e<<3)>>2]|0;k=f[c>>2]|0;if(i>>>0<=k>>>0)mq(h);l=j+(g<<3)|0;m=(f[j+(k<<3)>>2]|0)>>>0>>0;if(d>>>0<(f[l>>2]|0)>>>0){if(m){f[a>>2]=k;f[c>>2]=g;n=1;return n|0}f[a>>2]=e;f[b>>2]=g;d=f[c>>2]|0;if(i>>>0<=d>>>0)mq(h);if((f[j+(d<<3)>>2]|0)>>>0>=(f[l>>2]|0)>>>0){n=1;return n|0}f[b>>2]=d;f[c>>2]=g;n=2;return n|0}if(!m){n=0;return n|0}f[b>>2]=k;f[c>>2]=e;e=f[b>>2]|0;c=f[a>>2]|0;if(i>>>0<=e>>>0)mq(h);if(i>>>0<=c>>>0)mq(h);if((f[j+(e<<3)>>2]|0)>>>0>=(f[j+(c<<3)>>2]|0)>>>0){n=1;return n|0}f[a>>2]=e;f[b>>2]=c;n=2;return n|0}function Dg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=u;u=u+96|0;g=e+40|0;h=e;Am(g,c);we(h,b,c);th(g,h);sj(h+24|0,f[h+28>>2]|0);Dj(h+12|0,f[h+16>>2]|0);sj(h,f[h+4>>2]|0);Si(a,g,d);f[g>>2]=2968;sj(g+28|0,f[g+32>>2]|0);Dj(g+16|0,f[g+20>>2]|0);sj(g+4|0,f[g+8>>2]|0);u=e;return}function Eg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a=u;u=u+16|0;e=a;if(!b){g=0;u=a;return g|0}h=b+96|0;i=b+100|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;b=f[i>>2]|0;j=f[h>>2]|0;k=(b-j|0)/12|0;l=j;j=b;if(k>>>0>=c>>>0){if(k>>>0>c>>>0?(b=l+(c*12|0)|0,(b|0)!=(j|0)):0)f[i>>2]=j+(~(((j+-12-b|0)>>>0)/12|0)*12|0);if(!c){g=1;u=a;return g|0}}else Ag(h,c-k|0,e);k=0;b=f[h>>2]|0;while(1){j=k*3|0;l=f[d+(j<<2)>>2]|0;m=f[d+(j+1<<2)>>2]|0;n=f[d+(j+2<<2)>>2]|0;j=((f[i>>2]|0)-b|0)/12|0;o=k;k=k+1|0;if(o>>>0>>0){p=b;q=b}else{f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;Ag(h,k-j|0,e);j=f[h>>2]|0;p=j;q=j}f[p+(o*12|0)>>2]=l;f[p+(o*12|0)+4>>2]=m;f[p+(o*12|0)+8>>2]=n;if((k|0)==(c|0)){g=1;break}else b=q}u=a;return g|0}function Fg(a){a=+a;var b=0,c=0,d=0,e=0.0,g=0,h=0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0.0,q=0.0,r=0.0,t=0.0;p[s>>3]=a;b=f[s>>2]|0;c=f[s+4>>2]|0;d=(c|0)<0;do if(d|c>>>0<1048576){if((b|0)==0&(c&2147483647|0)==0){e=-1.0/(a*a);break}if(d){e=(a-a)/0.0;break}else{p[s>>3]=a*18014398509481984.0;g=f[s+4>>2]|0;h=-1077;i=g;j=f[s>>2]|0;k=g;l=9;break}}else if(c>>>0<=2146435071)if((b|0)==0&0==0&(c|0)==1072693248)e=0.0;else{h=-1023;i=c;j=b;k=c;l=9}else e=a;while(0);if((l|0)==9){l=i+614242|0;f[s>>2]=j;f[s+4>>2]=(l&1048575)+1072079006;a=+p[s>>3]+-1.0;m=a*a*.5;n=a/(a+2.0);o=n*n;q=o*o;p[s>>3]=a-m;j=f[s+4>>2]|0;f[s>>2]=0;f[s+4>>2]=j;r=+p[s>>3];t=a-r-m+n*(m+(q*(q*(q*.15313837699209373+.22222198432149784)+.3999999999940942)+o*(q*(q*(q*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));q=r*1.4426950407214463;o=+(h+(l>>>20)|0);m=q+o;e=m+(q+(o-m)+(t*1.4426950407214463+(t+r)*1.6751713164886512e-10))}return +e}function Gg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d;g=dn(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=17;h=g;i=12804;j=h+17|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+17>>0]=0;g=c+16|0;i=f[g>>2]|0;if(i){h=g;j=i;a:while(1){i=j;while(1){if((f[i+16>>2]|0)>=(a|0))break;k=f[i+4>>2]|0;if(!k){l=h;break a}else i=k}j=f[i>>2]|0;if(!j){l=i;break}else h=i}if(((l|0)!=(g|0)?(f[l+16>>2]|0)<=(a|0):0)?(a=l+20|0,(sh(a,e)|0)!=0):0)m=a;else n=10}else n=10;if((n|0)==10)m=c;c=yk(m,e,-1)|0;if((b[e+11>>0]|0)>=0){o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}br(f[e>>2]|0);o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}function Hg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[c>>2]|0;f[c>>2]=0;f[e>>2]=g;ug(a,b,e);g=f[e>>2]|0;f[e>>2]=0;if(g|0){e=g+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){h=c+12|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;br(e)}br(c)}c=f[g+68>>2]|0;if(c|0){e=g+72|0;h=f[e>>2]|0;if((h|0)!=(c|0))f[e>>2]=h+(~((h+-4-c|0)>>>2)<<2);br(c)}c=g+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){e=h+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;br(c)}br(h)}br(g)}g=a+84|0;h=a+88|0;a=f[h>>2]|0;c=f[g>>2]|0;e=a-c>>2;if((e|0)>(b|0)){u=d;return}i=b+1|0;b=a;if(i>>>0>e>>>0){nh(g,i-e|0);u=d;return}if(i>>>0>=e>>>0){u=d;return}e=c+(i<<2)|0;if((e|0)==(b|0)){u=d;return}f[h>>2]=b+(~((b+-4-e|0)>>>2)<<2);u=d;return}function Ig(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+56>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=dn(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=14285;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(sh(h,e)|0)==0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(Yh(h)|0)>5&1;b[a+352>>0]=c;u=d;return 1}c=dn(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=14285;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Oj(h,e,0)|0)&1;b[a+352>>0]=c;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return 1}function Jg(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0;c=a+108|0;d=(f[a+112>>2]|0)-(f[c>>2]|0)|0;e=(d|0)/12|0;g=a+4|0;Nh(e,f[(f[g>>2]|0)+44>>2]|0)|0;if(!d)return 1;d=0;a=0;while(1){i=f[c>>2]|0;j=i+(d*12|0)+4|0;Nh((f[j>>2]|0)-a|0,f[(f[g>>2]|0)+44>>2]|0)|0;Nh((f[j>>2]|0)-(f[i+(d*12|0)>>2]|0)|0,f[(f[g>>2]|0)+44>>2]|0)|0;d=d+1|0;if(d>>>0>=e>>>0)break;else a=f[j>>2]|0}li(f[(f[g>>2]|0)+44>>2]|0,e,0,0)|0;a=0;do{d=f[(f[g>>2]|0)+44>>2]|0;j=d+16|0;i=f[j+4>>2]|0;if((i|0)>0|(i|0)==0&(f[j>>2]|0)>>>0>0){j=f[d+12>>2]|0;d=j+4|0;i=f[d>>2]|0;k=b[(f[c>>2]|0)+(a*12|0)+8>>0]&1;l=i>>>3;m=i&7;i=(f[j>>2]|0)+l|0;b[i>>0]=(1<>0]|0);i=(f[j>>2]|0)+l|0;b[i>>0]=k<>0]|0);f[d>>2]=(f[d>>2]|0)+1}a=a+1|0}while(a>>>0>>0);Qf(f[(f[g>>2]|0)+44>>2]|0);return 1}function Kg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+56>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=dn(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=14285;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(sh(h,e)|0)==0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(Yh(h)|0)>5&1;b[a+288>>0]=c;u=d;return 1}c=dn(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=14285;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Oj(h,e,0)|0)&1;b[a+288>>0]=c;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return 1}function Lg(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=u;u=u+32|0;h=g+16|0;i=g+8|0;j=g;k=d-e|0;d=a+8|0;if((k|0)>0){a=0-e|0;l=i+4|0;m=j+4|0;n=h+4|0;o=k;do{k=b+(o<<2)|0;p=k+(a<<2)|0;q=c+(o<<2)|0;r=f[k+4>>2]|0;s=f[p>>2]|0;t=f[p+4>>2]|0;f[i>>2]=f[k>>2];f[l>>2]=r;f[j>>2]=s;f[m>>2]=t;Dd(h,d,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[n>>2];o=o-e|0}while((o|0)>0)}o=e>>>0>1073741823?-1:e<<2;e=_q(o)|0;hj(e|0,0,o|0)|0;o=f[b+4>>2]|0;n=f[e>>2]|0;m=f[e+4>>2]|0;f[i>>2]=f[b>>2];f[i+4>>2]=o;f[j>>2]=n;f[j+4>>2]=m;Dd(h,d,i,j);f[c>>2]=f[h>>2];f[c+4>>2]=f[h+4>>2];$q(e);u=g;return 1}function Mg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+32|0;d=c+12|0;e=c;g=f[b+100>>2]|0;h=f[b+96>>2]|0;b=g-h|0;i=(b|0)/12|0;f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;k=h;do if(b)if(i>>>0>357913941)mq(d);else{l=dn(b)|0;f[d>>2]=l;f[d+8>>2]=l+(i*12|0);hj(l|0,0,b|0)|0;f[j>>2]=l+b;m=l;break}else m=0;while(0);f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;if((g|0)!=(h|0)){h=e+4|0;g=e+8|0;b=0;do{l=k+(b*12|0)|0;f[e>>2]=f[l>>2];f[e+4>>2]=f[l+4>>2];f[e+8>>2]=f[l+8>>2];f[m+(b*12|0)>>2]=f[e>>2];f[m+(b*12|0)+4>>2]=f[h>>2];f[m+(b*12|0)+8>>2]=f[g>>2];b=b+1|0}while(b>>>0>>0)}Cj(a,d);a=f[d>>2]|0;if(!a){u=c;return}d=f[j>>2]|0;if((d|0)!=(a|0))f[j>>2]=d+(~(((d+-12-a|0)>>>0)/12|0)*12|0);br(a);u=c;return}function Ng(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;if(c>>>0>4294967279)mq(a);d=a+11|0;e=b[d>>0]|0;g=e<<24>>24<0;if(g){h=f[a+4>>2]|0;i=(f[a+8>>2]&2147483647)+-1|0}else{h=e&255;i=10}j=h>>>0>c>>>0?h:c;c=j>>>0<11;k=c?10:(j+16&-16)+-1|0;do if((k|0)!=(i|0)){do if(c){j=f[a>>2]|0;if(g){l=0;m=j;n=a;o=13}else{Lo(a,j,(e&255)+1|0)|0;br(j);o=16}}else{j=k+1|0;p=dn(j)|0;if(g){l=1;m=f[a>>2]|0;n=p;o=13;break}else{Lo(p,a,(e&255)+1|0)|0;q=p;r=j;s=a+4|0;o=15;break}}while(0);if((o|0)==13){j=a+4|0;Lo(n,m,(f[j>>2]|0)+1|0)|0;br(m);if(l){q=n;r=k+1|0;s=j;o=15}else o=16}if((o|0)==15){f[a+8>>2]=r|-2147483648;f[s>>2]=h;f[a>>2]=q;break}else if((o|0)==16){b[d>>0]=h;break}}while(0);return}function Og(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=f[b>>2]|0;if((c|0)==-1){d=-1;return d|0}b=f[(f[a+24>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1){d=0;return d|0}c=a+12|0;a=0;e=0;g=b;a:while(1){b:do if(e){h=a+1|0;i=(((g>>>0)%3|0|0)==0?2:-1)+g|0;if((i|0)==-1){d=h;j=15;break a}k=f[(f[c>>2]|0)+(i<<2)>>2]|0;if((k|0)==-1){d=h;j=15;break a}if(!((k>>>0)%3|0)){l=k+2|0;m=h;break}else{l=k+-1|0;m=h;break}}else{h=a;k=g;while(1){i=h+1|0;n=k+1|0;o=((n>>>0)%3|0|0)==0?k+-2|0:n;if((o|0)==-1){l=b;m=i;break b}n=f[(f[c>>2]|0)+(o<<2)>>2]|0;o=n+1|0;if((n|0)==-1){l=b;m=i;break b}k=((o>>>0)%3|0|0)==0?n+-2|0:o;if((k|0)==-1){l=b;m=i;break b}if((k|0)==(b|0)){d=i;j=15;break a}else h=i}}while(0);if((l|0)==-1){d=m;j=15;break}else{a=m;e=1;g=l}}if((j|0)==15)return d|0;return 0}function Pg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=a+8|0;Cg(a,a+4|0,d,c)|0;e=a+12|0;if((e|0)==(b|0))return;g=f[c>>2]|0;c=f[g>>2]|0;h=(f[g+4>>2]|0)-c>>3;i=c;c=e;e=d;a:while(1){d=f[c>>2]|0;j=f[e>>2]|0;if(h>>>0<=d>>>0){k=5;break}if(h>>>0<=j>>>0){k=7;break}l=i+(d<<3)|0;if((f[l>>2]|0)>>>0<(f[i+(j<<3)>>2]|0)>>>0){m=e;n=c;o=j;while(1){f[n>>2]=o;if((m|0)==(a|0)){p=a;break}j=m+-4|0;o=f[j>>2]|0;if(h>>>0<=o>>>0){k=11;break a}if((f[l>>2]|0)>>>0>=(f[i+(o<<3)>>2]|0)>>>0){p=m;break}else{q=m;m=j;n=q}}f[p>>2]=d}n=c+4|0;if((n|0)==(b|0)){k=3;break}else{m=c;c=n;e=m}}if((k|0)==3)return;else if((k|0)==5)mq(g);else if((k|0)==7)mq(g);else if((k|0)==11)mq(g)}function Qg(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=Cg(a,b,c,e)|0;h=f[d>>2]|0;i=f[c>>2]|0;j=f[e>>2]|0;e=f[j>>2]|0;k=(f[j+4>>2]|0)-e>>3;if(k>>>0<=h>>>0)mq(j);l=e;if(k>>>0<=i>>>0)mq(j);if((f[l+(h<<3)>>2]|0)>>>0>=(f[l+(i<<3)>>2]|0)>>>0){m=g;return m|0}f[c>>2]=h;f[d>>2]=i;i=f[c>>2]|0;d=f[b>>2]|0;if(k>>>0<=i>>>0)mq(j);if(k>>>0<=d>>>0)mq(j);if((f[l+(i<<3)>>2]|0)>>>0>=(f[l+(d<<3)>>2]|0)>>>0){m=g+1|0;return m|0}f[b>>2]=i;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(k>>>0<=d>>>0)mq(j);if(k>>>0<=c>>>0)mq(j);if((f[l+(d<<3)>>2]|0)>>>0>=(f[l+(c<<3)>>2]|0)>>>0){m=g+2|0;return m|0}f[a>>2]=d;f[b>>2]=c;m=g+3|0;return m|0}function Rg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;if((d|0)>=8192)return Da(a|0,c|0,d|0)|0;e=a|0;g=a+d|0;if((a&3)==(c&3)){while(a&3){if(!d)return e|0;b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0;d=d-1|0}h=g&-4|0;d=h-64|0;while((a|0)<=(d|0)){f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];f[a+12>>2]=f[c+12>>2];f[a+16>>2]=f[c+16>>2];f[a+20>>2]=f[c+20>>2];f[a+24>>2]=f[c+24>>2];f[a+28>>2]=f[c+28>>2];f[a+32>>2]=f[c+32>>2];f[a+36>>2]=f[c+36>>2];f[a+40>>2]=f[c+40>>2];f[a+44>>2]=f[c+44>>2];f[a+48>>2]=f[c+48>>2];f[a+52>>2]=f[c+52>>2];f[a+56>>2]=f[c+56>>2];f[a+60>>2]=f[c+60>>2];a=a+64|0;c=c+64|0}while((a|0)<(h|0)){f[a>>2]=f[c>>2];a=a+4|0;c=c+4|0}}else{h=g-4|0;while((a|0)<(h|0)){b[a>>0]=b[c>>0]|0;b[a+1>>0]=b[c+1>>0]|0;b[a+2>>0]=b[c+2>>0]|0;b[a+3>>0]=b[c+3>>0]|0;a=a+4|0;c=c+4|0}}while((a|0)<(g|0)){b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0}return e|0}function Sg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+16|0;d=c+4|0;e=c;f[a>>2]=1216;g=a+4|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;f[g+16>>2]=0;f[g+20>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;f[d>>2]=b;b=a+4|0;g=a+8|0;Ci(b,d);h=f[d>>2]|0;i=a+20|0;j=f[i>>2]|0;k=a+16|0;a=f[k>>2]|0;l=j-a>>2;m=a;if((h|0)<(l|0)){n=m;o=h;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}a=h+1|0;f[e>>2]=-1;w=j;if(a>>>0<=l>>>0)if(a>>>0>>0?(j=m+(a<<2)|0,(j|0)!=(w|0)):0){f[i>>2]=w+(~((w+-4-j|0)>>>2)<<2);x=h;y=m}else{x=h;y=m}else{kh(k,a-l|0,e);x=f[d>>2]|0;y=f[k>>2]|0}n=y;o=x;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}function Tg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+4|0;c=f[b>>2]|0;d=(f[c+12>>2]|0)-(f[c+8>>2]|0)|0;c=d>>2;a:do if((d|0)>0){e=0;while(1){if(!(Ra[f[(f[a>>2]|0)+36>>2]&127](a,e)|0)){g=0;break}e=e+1|0;h=f[b>>2]|0;i=(f[h+12>>2]|0)-(f[h+8>>2]|0)>>2;if((e|0)>=(i|0)){j=i;break a}}return g|0}else j=c;while(0);c=a+20|0;b=a+24|0;d=f[b>>2]|0;e=f[c>>2]|0;i=d-e>>2;h=e;e=d;if(j>>>0<=i>>>0){if(j>>>0>>0?(d=h+(j<<2)|0,(d|0)!=(e|0)):0)f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2)}else oi(c,j-i|0);i=f[a+12>>2]|0;j=f[a+8>>2]|0;a=j;if((i|0)==(j|0)){g=1;return g|0}d=i-j>>2;j=0;do{i=f[a+(j<<2)>>2]|0;e=f[i+8>>2]|0;b=f[i+4>>2]|0;i=b;if((e|0)!=(b|0)?(h=f[c>>2]|0,k=e-b>>2,f[h+(f[i>>2]<<2)>>2]=j,k>>>0>1):0){b=1;do{f[h+(f[i+(b<<2)>>2]<<2)>>2]=j;b=b+1|0}while(b>>>0>>0)}j=j+1|0}while(j>>>0>>0);g=1;return g|0}function Ug(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=f[c+88>>2]|0;if(!d){e=0;return e|0}if((f[d>>2]|0)!=1){e=0;return e|0}g=d+8|0;d=f[g>>2]|0;f[a+4>>2]=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;i=a+8|0;j=c+24|0;c=b[j>>0]|0;k=c<<24>>24;l=a+12|0;m=f[l>>2]|0;n=f[i>>2]|0;o=m-n>>2;p=n;n=m;if(o>>>0>=k>>>0)if(o>>>0>k>>>0?(m=p+(k<<2)|0,(m|0)!=(n|0)):0){f[l>>2]=n+(~((n+-4-m|0)>>>2)<<2);q=c;r=d}else{q=c;r=d}else{oi(i,k-o|0);q=b[j>>0]|0;r=f[g>>2]|0}g=r+4|0;j=h[g>>0]|h[g+1>>0]<<8|h[g+2>>0]<<16|h[g+3>>0]<<24;if(q<<24>>24>0){g=f[i>>2]|0;i=q<<24>>24;q=j;o=4;k=0;while(1){f[g+(k<<2)>>2]=q;o=o+4|0;k=k+1|0;d=r+o|0;c=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;if((k|0)>=(i|0)){s=c;break}else q=c}}else s=j;f[a+20>>2]=s;e=1;return e|0}function Vg(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;do if(!(qp(a,f[c+8>>2]|0,g)|0)){if(!(qp(a,f[c>>2]|0,g)|0)){h=f[a+8>>2]|0;Za[f[(f[h>>2]|0)+24>>2]&3](h,c,d,e,g);break}if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;i=c+44|0;if((f[i>>2]|0)==4)break;j=c+52|0;b[j>>0]=0;k=c+53|0;b[k>>0]=0;l=f[a+8>>2]|0;_a[f[(f[l>>2]|0)+20>>2]&3](l,c,d,d,1,g);if(b[k>>0]|0)if(!(b[j>>0]|0)){m=3;n=11}else o=3;else{m=4;n=11}if((n|0)==11){f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0){b[c+54>>0]=1;o=m}else o=m}f[i>>2]=o;break}if((e|0)==1)f[c+32>>2]=1}else Om(0,c,d,e);while(0);return}function Wg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e+12|0;h=e+8|0;i=e;f[i>>2]=f[b>>2];f[g>>2]=f[i>>2];i=zd(a,g,h,e+4|0,c)|0;c=f[i>>2]|0;if(c|0){j=c;u=e;return j|0}c=dn(40)|0;dj(c+16|0,d);dj(c+28|0,d+12|0);d=f[h>>2]|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=d;f[i>>2]=c;d=f[f[a>>2]>>2]|0;if(!d)k=c;else{f[a>>2]=d;k=f[i>>2]|0}Ae(f[a+4>>2]|0,k);k=a+8|0;f[k>>2]=(f[k>>2]|0)+1;j=c;u=e;return j|0}function Xg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=a+4|0;f[h>>2]=0;if(!c){u=e;return}i=a+8|0;j=f[i>>2]|0;k=j<<5;if(k>>>0>>0){f[g>>2]=0;l=g+4|0;f[l>>2]=0;m=g+8|0;f[m>>2]=0;if((c|0)<0)mq(a);n=j<<6;j=c+31&-32;hi(g,k>>>0<1073741823?(n>>>0>>0?j:n):2147483647);n=f[a>>2]|0;f[a>>2]=f[g>>2];f[g>>2]=n;g=f[h>>2]|0;f[h>>2]=c;f[l>>2]=g;g=f[i>>2]|0;f[i>>2]=f[m>>2];f[m>>2]=g;if(n|0)br(n);o=a}else{f[h>>2]=c;o=a}a=f[o>>2]|0;o=a;h=a;a=c>>>5;n=a<<2;if(!(b[d>>0]|0)){hj(h|0,0,n|0)|0;d=c&31;g=o+(a<<2)|0;if(!d){u=e;return}f[g>>2]=f[g>>2]&~(-1>>>(32-d|0));u=e;return}else{hj(h|0,-1,n|0)|0;n=c&31;c=o+(a<<2)|0;if(!n){u=e;return}f[c>>2]=f[c>>2]|-1>>>(32-n|0);u=e;return}}function Yg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+88|0;fd(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;n=a+88|0;fd(n,b);u=c;return 1}function Zg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+108|0;fd(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;n=a+108|0;fd(n,b);u=c;return 1}function _g(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=a+32|0;d=f[a+64>>2]|0;e=(Qa[f[(f[d>>2]|0)+40>>2]&127](d)|0)+56|0;d=f[e>>2]|0;li(c,(((f[d+100>>2]|0)-(f[d+96>>2]|0)|0)/12|0)*3|0,0,1)|0;d=a+68|0;e=f[d>>2]|0;g=(f[a+72>>2]|0)-e|0;if((g|0)<=0){Qf(c);return}i=a+48|0;j=a+44|0;a=(g>>>2)+-1|0;g=e;while(1){e=f[g+(a<<2)>>2]|0;k=f[3124+(e<<2)>>2]|0;l=i;m=f[l+4>>2]|0;if((m|0)>0|(m|0)==0&(f[l>>2]|0)>>>0>0?(l=f[j>>2]|0,171>>>e&1|0):0){m=l+4|0;n=0;o=f[m>>2]|0;do{p=o>>>3;q=o&7;r=(f[l>>2]|0)+p|0;b[r>>0]=(1<>0]|0);r=(f[l>>2]|0)+p|0;b[r>>0]=(e>>>n&1)<>0]|0);o=(f[m>>2]|0)+1|0;f[m>>2]=o;n=n+1|0}while((n|0)!=(k|0))}k=a+-1|0;if((k|0)<=-1)break;a=k;g=f[d>>2]|0}Qf(c);return}function $g(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+48|0;h=g;i=g+32|0;if(!c){j=0;u=g;return j|0}Cn(h);do if((Tl(c,0)|0)!=-1){if(d){if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){k=0;break}Va[f[(f[c>>2]|0)+20>>2]&127](c)}Dg(i,a,c,h);l=(f[i>>2]|0)==0;m=i+4|0;if((b[m+11>>0]|0)<0)br(f[m>>2]|0);if(l){l=f[h>>2]|0;m=h+4|0;ag(e,l,l+((f[m>>2]|0)-l)|0);k=(f[m>>2]|0)-(f[h>>2]|0)|0}else k=0}else k=0;while(0);e=h+12|0;i=f[e>>2]|0;f[e>>2]=0;if(i|0)br(i);i=f[h>>2]|0;if(i|0){e=h+4|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;br(i)}j=k;u=g;return j|0}function ah(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=u;u=u+16|0;d=c;e=f[(f[a>>2]|0)+8>>2]|0;g=a+8|0;h=a+12|0;i=(f[h>>2]|0)-(f[g>>2]|0)>>2;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;Xa[e&15](a,i,d);i=f[d>>2]|0;f[d>>2]=0;if(!i){k=f[h>>2]|0;l=f[g>>2]|0;m=k-l|0;n=m>>2;o=n+-1|0;u=c;return o|0}d=i+88|0;a=f[d>>2]|0;f[d>>2]=0;if(a|0){d=f[a+8>>2]|0;if(d|0){e=a+12|0;if((f[e>>2]|0)!=(d|0))f[e>>2]=d;br(d)}br(a)}a=f[i+68>>2]|0;if(a|0){d=i+72|0;e=f[d>>2]|0;if((e|0)!=(a|0))f[d>>2]=e+(~((e+-4-a|0)>>>2)<<2);br(a)}a=i+64|0;e=f[a>>2]|0;f[a>>2]=0;if(e|0){a=f[e>>2]|0;if(a|0){d=e+4|0;if((f[d>>2]|0)!=(a|0))f[d>>2]=a;br(a)}br(e)}br(i);k=f[h>>2]|0;l=f[g>>2]|0;m=k-l|0;n=m>>2;o=n+-1|0;u=c;return o|0}function bh(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(b[a+352>>0]|0)return 1;c=a+8|0;d=f[c>>2]|0;e=(f[d+12>>2]|0)-(f[d+8>>2]|0)|0;d=e>>2;g=a+172|0;si(g,d+-1|0);if(!((d|0)!=1&(e|0)>0))return 1;e=a+12|0;a=0;h=0;while(1){i=f[(f[(f[c>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[i+56>>2]|0))j=h;else{k=f[g>>2]|0;f[k+(h*136|0)>>2]=a;l=f[k+(h*136|0)+104>>2]|0;m=k+(h*136|0)+108|0;n=f[m>>2]|0;if((n|0)!=(l|0))f[m>>2]=n+(~((n+-4-l|0)>>>2)<<2);l=f[e>>2]|0;$j(k+(h*136|0)+104|0,(f[l+4>>2]|0)-(f[l>>2]|0)>>2);l=f[g>>2]|0;f[l+(h*136|0)+128>>2]=0;zc(l+(h*136|0)+4|0,f[c>>2]|0,f[e>>2]|0,i)|0;j=h+1|0}a=a+1|0;if((a|0)>=(d|0))break;else h=j}return 1}function ch(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;if(b[a+288>>0]|0)return 1;c=a+8|0;d=f[c>>2]|0;e=(f[d+12>>2]|0)-(f[d+8>>2]|0)|0;d=e>>2;g=a+172|0;si(g,d+-1|0);if(!((d|0)!=1&(e|0)>0))return 1;e=a+12|0;a=0;h=0;while(1){i=f[(f[(f[c>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[i+56>>2]|0))j=h;else{k=f[g>>2]|0;f[k+(h*136|0)>>2]=a;l=f[k+(h*136|0)+104>>2]|0;m=k+(h*136|0)+108|0;n=f[m>>2]|0;if((n|0)!=(l|0))f[m>>2]=n+(~((n+-4-l|0)>>>2)<<2);l=f[e>>2]|0;$j(k+(h*136|0)+104|0,(f[l+4>>2]|0)-(f[l>>2]|0)>>2);l=f[g>>2]|0;f[l+(h*136|0)+128>>2]=0;zc(l+(h*136|0)+4|0,f[c>>2]|0,f[e>>2]|0,i)|0;j=h+1|0}a=a+1|0;if((a|0)>=(d|0))break;else h=j}return 1}function dh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;if(d-g>>3>>>0>=b>>>0){h=b;i=g;do{j=i;f[j>>2]=0;f[j+4>>2]=0;i=(f[e>>2]|0)+8|0;f[e>>2]=i;h=h+-1|0}while((h|0)!=0);return}h=f[a>>2]|0;i=g-h>>3;g=i+b|0;if(g>>>0>536870911)mq(a);j=d-h|0;h=j>>2;d=j>>3>>>0<268435455?(h>>>0>>0?g:h):536870911;do if(d)if(d>>>0>536870911){h=ra(8)|0;Wo(h,14941);f[h>>2]=6944;va(h|0,1080,114)}else{k=dn(d<<3)|0;break}else k=0;while(0);h=k+(i<<3)|0;i=k+(d<<3)|0;d=b;b=h;k=h;do{g=b;f[g>>2]=0;f[g+4>>2]=0;b=k+8|0;k=b;d=d+-1|0}while((d|0)!=0);d=f[a>>2]|0;b=(f[e>>2]|0)-d|0;g=h+(0-(b>>3)<<3)|0;if((b|0)>0)Rg(g|0,d|0,b|0)|0;f[a>>2]=g;f[e>>2]=k;f[c>>2]=i;if(!d)return;br(d);return}function eh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+8|0;j=a&255;b[i>>0]=j&127;do if(c>>>0>0|(c|0)==0&a>>>0>127){b[i>>0]=j|-128;k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,i,i+1|0)|0;k=Wn(a|0,c|0,7)|0;m=eh(k,I,d)|0;break}}else{k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,i,i+1|0)|0;n=1;u=e;return n|0}while(0);n=m;u=e;return n|0}function fh(a,b){a=a|0;b=b|0;var c=0;c=a+8|0;ef(c,b)|0;if((c|0)==(b|0)){f[a+92>>2]=f[b+84>>2];return}else{Yf(a+56|0,f[b+48>>2]|0,f[b+52>>2]|0);Yf(a+68|0,f[b+60>>2]|0,f[b+64>>2]|0);Yf(a+80|0,f[b+72>>2]|0,f[b+76>>2]|0);f[a+92>>2]=f[b+84>>2];qg(a+96|0,f[b+88>>2]|0,f[b+92>>2]|0);return}}function gh(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0;g=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1)h=Ki(c,d)|0;else h=b;if((h|0)==-2)i=0;else{do if((Qa[f[(f[d>>2]|0)+8>>2]&127](d)|0)==1){Hf(a,d,h,c,e,514);if(!(f[a>>2]|0)){f[a>>2]=0;break}else return}while(0);c=dn(44)|0;f[c>>2]=1528;f[c+4>>2]=g;g=c+8|0;f[g>>2]=f[e>>2];f[g+4>>2]=f[e+4>>2];f[g+8>>2]=f[e+8>>2];f[g+12>>2]=f[e+12>>2];f[g+16>>2]=f[e+16>>2];f[g+20>>2]=f[e+20>>2];_j(c+32|0,e+24|0);f[c>>2]=1584;i=c}f[a>>2]=i;return}function hh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+224|0;g=e+120|0;h=e+80|0;i=e;j=e+136|0;k=h;l=k+40|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(l|0));f[g>>2]=f[d>>2];if((qb(0,c,g,i,h)|0)<0)m=-1;else{if((f[a+76>>2]|0)>-1)n=gr(a)|0;else n=0;d=f[a>>2]|0;k=d&32;if((b[a+74>>0]|0)<1)f[a>>2]=d&-33;d=a+48|0;if(!(f[d>>2]|0)){l=a+44|0;o=f[l>>2]|0;f[l>>2]=j;p=a+28|0;f[p>>2]=j;q=a+20|0;f[q>>2]=j;f[d>>2]=80;r=a+16|0;f[r>>2]=j+80;j=qb(a,c,g,i,h)|0;if(!o)s=j;else{Sa[f[a+36>>2]&31](a,0,0)|0;t=(f[q>>2]|0)==0?-1:j;f[l>>2]=o;f[d>>2]=0;f[r>>2]=0;f[p>>2]=0;f[q>>2]=0;s=t}}else s=qb(a,c,g,i,h)|0;h=f[a>>2]|0;f[a>>2]=h|k;if(n|0)fr(a);m=(h&32|0)==0?s:-1}u=e;return m|0}function ih(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;if(!(fn(a,b,c)|0)){g=0;u=d;return g|0}if((Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)<<24>>24==1?((f[(f[a+8>>2]|0)+28>>2]|0)+-1|0)>>>0>=6:0){g=0;u=d;return g|0}h=Gg(c,f[b+48>>2]|0)|0;Xa[f[(f[a>>2]|0)+48>>2]&15](e,a,h);h=a+36|0;b=f[e>>2]|0;f[e>>2]=0;c=f[h>>2]|0;f[h>>2]=b;if(!c){f[e>>2]=0;i=b}else{Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[e>>2]|0;f[e>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);i=f[h>>2]|0}if(!i){g=1;u=d;return g|0}if(Ra[f[(f[a>>2]|0)+36>>2]&127](a,i)|0){g=1;u=d;return g|0}i=f[h>>2]|0;f[h>>2]=0;if(!i){g=1;u=d;return g|0}Va[f[(f[i>>2]|0)+4>>2]&127](i);g=1;u=d;return g|0}function jh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e>>2;h=d;if(g>>>0>>0){hf(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b<<2)|0;if((g|0)==(h|0))return;else i=h;do{h=i+-4|0;f[c>>2]=h;b=f[h>>2]|0;f[h>>2]=0;if(b|0){h=b+88|0;e=f[h>>2]|0;f[h>>2]=0;if(e|0){h=f[e+8>>2]|0;if(h|0){a=e+12|0;if((f[a>>2]|0)!=(h|0))f[a>>2]=h;br(h)}br(e)}e=f[b+68>>2]|0;if(e|0){h=b+72|0;a=f[h>>2]|0;if((a|0)!=(e|0))f[h>>2]=a+(~((a+-4-e|0)>>>2)<<2);br(e)}e=b+64|0;a=f[e>>2]|0;f[e>>2]=0;if(a|0){e=f[a>>2]|0;if(e|0){h=a+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;br(e)}br(a)}br(b)}i=f[c>>2]|0}while((i|0)!=(g|0));return}function kh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;i=h;if(e-h>>2>>>0>=b>>>0){j=b;k=i;while(1){f[k>>2]=f[c>>2];j=j+-1|0;if(!j)break;else k=k+4|0}f[g>>2]=i+(b<<2);return}i=f[a>>2]|0;k=h-i|0;h=k>>2;j=h+b|0;if(j>>>0>1073741823)mq(a);l=e-i|0;e=l>>1;m=l>>2>>>0<536870911?(e>>>0>>0?j:e):1073741823;do if(m)if(m>>>0>1073741823){e=ra(8)|0;Wo(e,14941);f[e>>2]=6944;va(e|0,1080,114)}else{e=dn(m<<2)|0;n=e;o=e;break}else{n=0;o=0}while(0);e=n+(h<<2)|0;h=n+(m<<2)|0;m=b;j=e;while(1){f[j>>2]=f[c>>2];m=m+-1|0;if(!m)break;else j=j+4|0}if((k|0)>0)Rg(o|0,i|0,k|0)|0;f[a>>2]=n;f[g>>2]=e+(b<<2);f[d>>2]=h;if(!i)return;br(i);return}function lh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=(f[a>>2]|0)+1794895138|0;g=rp(f[a+8>>2]|0,e)|0;h=rp(f[a+12>>2]|0,e)|0;i=rp(f[a+16>>2]|0,e)|0;a:do if((g>>>0>>2>>>0?(j=c-(g<<2)|0,h>>>0>>0&i>>>0>>0):0)?((i|h)&3|0)==0:0){j=h>>>2;k=i>>>2;l=0;m=g;while(1){n=m>>>1;o=l+n|0;p=o<<1;q=p+j|0;r=rp(f[a+(q<<2)>>2]|0,e)|0;s=rp(f[a+(q+1<<2)>>2]|0,e)|0;if(!(s>>>0>>0&r>>>0<(c-s|0)>>>0)){t=0;break a}if(b[a+(s+r)>>0]|0){t=0;break a}r=bl(d,a+s|0)|0;if(!r)break;s=(r|0)<0;if((m|0)==1){t=0;break a}else{l=s?l:o;m=s?n:m-n|0}}m=p+k|0;l=rp(f[a+(m<<2)>>2]|0,e)|0;j=rp(f[a+(m+1<<2)>>2]|0,e)|0;if(j>>>0>>0&l>>>0<(c-j|0)>>>0)t=(b[a+(j+l)>>0]|0)==0?a+j|0:0;else t=0}else t=0;while(0);return t|0}function mh(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=u;u=u+64|0;i=h;j=f[a>>2]|0;k=a+(f[j+-8>>2]|0)|0;l=f[j+-4>>2]|0;f[i>>2]=e;f[i+4>>2]=a;f[i+8>>2]=c;f[i+12>>2]=g;g=i+16|0;c=i+20|0;a=i+24|0;j=i+28|0;m=i+32|0;n=i+40|0;o=g;p=o+36|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(p|0));d[g+36>>1]=0;b[g+38>>0]=0;a:do if(qp(l,e,0)|0){f[i+48>>2]=1;_a[f[(f[l>>2]|0)+20>>2]&3](l,i,k,k,1,0);q=(f[a>>2]|0)==1?k:0}else{Za[f[(f[l>>2]|0)+24>>2]&3](l,i,k,1,0);switch(f[i+36>>2]|0){case 0:{q=(f[n>>2]|0)==1&(f[j>>2]|0)==1&(f[m>>2]|0)==1?f[c>>2]|0:0;break a;break}case 1:break;default:{q=0;break a}}if((f[a>>2]|0)!=1?!((f[n>>2]|0)==0&(f[j>>2]|0)==1&(f[m>>2]|0)==1):0){q=0;break}q=f[g>>2]|0}while(0);u=h;return q|0}function nh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){i=b;j=h;while(1){f[j>>2]=1;i=i+-1|0;if(!i)break;else j=j+4|0}f[e>>2]=h+(b<<2);return}h=f[a>>2]|0;j=g-h|0;g=j>>2;i=g+b|0;if(i>>>0>1073741823)mq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?i:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{d=dn(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;g=m+(l<<2)|0;l=b;i=d;while(1){f[i>>2]=1;l=l+-1|0;if(!l)break;else i=i+4|0}if((j|0)>0)Rg(n|0,h|0,j|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=g;if(!h)return;br(h);return}function oh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(!c){g=0;u=d;return g|0}h=a+84|0;i=f[h>>2]|0;j=a+88|0;k=f[j>>2]|0;if((k|0)!=(i|0))f[j>>2]=k+(~((k+-4-i|0)>>>2)<<2);f[h>>2]=0;f[j>>2]=0;f[a+92>>2]=0;if(i|0)br(i);i=a+72|0;j=f[i>>2]|0;h=a+76|0;if((f[h>>2]|0)!=(j|0))f[h>>2]=j;f[i>>2]=0;f[h>>2]=0;f[a+80>>2]=0;if(j|0)br(j);j=c+4|0;h=(f[j>>2]|0)-(f[c>>2]|0)>>2;b[e>>0]=0;Xg(a,h,e);h=c+24|0;i=c+28|0;k=(f[i>>2]|0)-(f[h>>2]|0)>>2;b[e>>0]=0;Xg(a+12|0,k,e);Sf(a+28|0,(f[j>>2]|0)-(f[c>>2]|0)>>2,5868);$j(a+52|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);$j(a+40|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);f[a+64>>2]=c;b[a+24>>0]=1;g=1;u=d;return g|0}function ph(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(j=f[(f[d+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(k=f[(f[d+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if(((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(h=f[(f[d+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function qh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Id(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+20>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Id(a,e);return}function rh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+48|0;g=e;h=e+32|0;i=a+4|0;j=f[i>>2]|0;if(!j){k=0;u=e;return k|0}do if(c)if(Qa[f[(f[j>>2]|0)+16>>2]&127](j)|0){l=f[i>>2]|0;Va[f[(f[l>>2]|0)+20>>2]&127](l);break}else{k=0;u=e;return k|0}while(0);Cn(g);Si(h,f[a>>2]|0,g);a=(f[h>>2]|0)==0;i=h+4|0;if((b[i+11>>0]|0)<0)br(f[i>>2]|0);if(a){a=f[g>>2]|0;i=g+4|0;ag(d,a,a+((f[i>>2]|0)-a)|0);m=(f[i>>2]|0)-(f[g>>2]|0)|0}else m=0;i=g+12|0;a=f[i>>2]|0;f[i>>2]=0;if(a|0)br(a);a=f[g>>2]|0;if(a|0){i=g+4|0;if((f[i>>2]|0)!=(a|0))f[i>>2]=a;br(a)}k=m;u=e;return k|0}function sh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=f[a+4>>2]|0;if(!d){e=0;return e|0}a=b[c+11>>0]|0;g=a<<24>>24<0;h=g?f[c+4>>2]|0:a&255;a=g?f[c>>2]|0:c;c=d;while(1){d=c+16|0;g=b[d+11>>0]|0;i=g<<24>>24<0;j=i?f[c+20>>2]|0:g&255;g=j>>>0>>0;k=g?j:h;if((k|0)!=0?(l=Pk(a,i?f[d>>2]|0:d,k)|0,(l|0)!=0):0)if((l|0)<0)m=7;else m=8;else if(h>>>0>>0)m=7;else m=8;if((m|0)==7){m=0;n=c}else if((m|0)==8){m=0;l=h>>>0>>0?h:j;if((l|0)!=0?(j=Pk(i?f[d>>2]|0:d,a,l)|0,(j|0)!=0):0){if((j|0)>=0){e=1;m=14;break}}else m=10;if((m|0)==10?(m=0,!g):0){e=1;m=14;break}n=c+4|0}c=f[n>>2]|0;if(!c){e=0;m=14;break}}if((m|0)==14)return e|0;return 0}function th(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=u;u=u+16|0;d=c+12|0;e=c+8|0;g=c+4|0;h=c;i=a+4|0;j=(i|0)==(b|0);if(!j){f[g>>2]=f[b>>2];f[h>>2]=b+4;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Hc(i,e,d)}if(!j){f[g>>2]=f[b+12>>2];f[h>>2]=b+16;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Ac(a+16|0,e,d)}if(j){u=c;return}f[g>>2]=f[b+24>>2];f[h>>2]=b+28;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Hc(a+28|0,e,d);u=c;return}function uh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=u;u=u+16|0;g=e+4|0;h=e;di(g,a,b,c,d);d=f[g>>2]|0;if(!d){i=-1;f[g>>2]=0;u=e;return i|0}f[g>>2]=0;f[h>>2]=d;d=ah(a,h)|0;a=f[h>>2]|0;f[h>>2]=0;if(!a){i=d;f[g>>2]=0;u=e;return i|0}h=a+88|0;c=f[h>>2]|0;f[h>>2]=0;if(c|0){h=f[c+8>>2]|0;if(h|0){b=c+12|0;if((f[b>>2]|0)!=(h|0))f[b>>2]=h;br(h)}br(c)}c=f[a+68>>2]|0;if(c|0){h=a+72|0;b=f[h>>2]|0;if((b|0)!=(c|0))f[h>>2]=b+(~((b+-4-c|0)>>>2)<<2);br(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){h=b+4|0;if((f[h>>2]|0)!=(c|0))f[h>>2]=c;br(c)}br(b)}br(a);i=d;f[g>>2]=0;u=e;return i|0}function vh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=u;u=u+16|0;g=e+4|0;h=e;i=f[a+8>>2]|0;j=i+24|0;k=b[j>>0]|0;l=c+4|0;Nf(a,(f[l>>2]|0)-(f[c>>2]|0)>>2,k,d);d=f[a+32>>2]|0;a=(f[f[d>>2]>>2]|0)+(f[d+48>>2]|0)|0;d=f[c>>2]|0;c=f[l>>2]|0;if((d|0)==(c|0)){m=1;u=e;return m|0}l=i+84|0;n=i+68|0;o=0;p=d;while(1){d=f[p>>2]|0;if(!(b[l>>0]|0))q=f[(f[n>>2]|0)+(d<<2)>>2]|0;else q=d;f[h>>2]=q;d=b[j>>0]|0;f[g>>2]=f[h>>2];if(!(Pb(i,g,d,a+(o<<2)|0)|0)){m=0;r=7;break}p=p+4|0;if((p|0)==(c|0)){m=1;r=7;break}else o=o+k|0}if((r|0)==7){u=e;return m|0}return 0}function wh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=1392;b=a+72|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[a+60>>2]|0;if(c|0){b=a+64|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);br(c)}c=f[a+48>>2]|0;if(c|0)br(c);c=a+36|0;d=f[c>>2]|0;if(d|0){b=a+40|0;e=f[b>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[b>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0)Va[f[(f[i>>2]|0)+4>>2]&127](i);h=f[b>>2]|0}while((h|0)!=(d|0));g=f[c>>2]|0}br(g)}f[a>>2]=1216;g=f[a+16>>2]|0;if(g|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(g|0))f[c>>2]=d+(~((d+-4-g|0)>>>2)<<2);br(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);br(g);return}function xh(a){a=a|0;tj(a+992|0);tj(a+960|0);tj(a+928|0);tj(a+896|0);tj(a+864|0);tj(a+832|0);tj(a+800|0);tj(a+768|0);tj(a+736|0);tj(a+704|0);tj(a+672|0);tj(a+640|0);tj(a+608|0);tj(a+576|0);tj(a+544|0);tj(a+512|0);tj(a+480|0);tj(a+448|0);tj(a+416|0);tj(a+384|0);tj(a+352|0);tj(a+320|0);tj(a+288|0);tj(a+256|0);tj(a+224|0);tj(a+192|0);tj(a+160|0);tj(a+128|0);tj(a+96|0);tj(a+64|0);tj(a+32|0);tj(a);return}function yh(a){a=a|0;rn(a);rn(a+32|0);rn(a+64|0);rn(a+96|0);rn(a+128|0);rn(a+160|0);rn(a+192|0);rn(a+224|0);rn(a+256|0);rn(a+288|0);rn(a+320|0);rn(a+352|0);rn(a+384|0);rn(a+416|0);rn(a+448|0);rn(a+480|0);rn(a+512|0);rn(a+544|0);rn(a+576|0);rn(a+608|0);rn(a+640|0);rn(a+672|0);rn(a+704|0);rn(a+736|0);rn(a+768|0);rn(a+800|0);rn(a+832|0);rn(a+864|0);rn(a+896|0);rn(a+928|0);rn(a+960|0);rn(a+992|0);return}function zh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+16|0;e=a;if((c|0)<0|((b|0)==0|(d|0)==0)){g=0;u=a;return g|0}h=f[b+8>>2]|0;if(((f[b+12>>2]|0)-h>>2|0)<=(c|0)){g=0;u=a;return g|0}i=b+4|0;if(!(f[i>>2]|0)){j=dn(52)|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;f[j+12>>2]=0;n[j+16>>2]=$(1.0);k=j+20|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;n[j+36>>2]=$(1.0);f[j+40>>2]=0;f[j+44>>2]=0;f[j+48>>2]=0;f[b+4>>2]=j}j=f[(f[h+(c<<2)>>2]|0)+60>>2]|0;c=dn(44)|0;Ub(c,d);f[c+40>>2]=j;j=f[i>>2]|0;f[e>>2]=c;gk(j,e)|0;j=f[e>>2]|0;f[e>>2]=0;if(!j){g=1;u=a;return g|0}Qi(j);br(j);g=1;u=a;return g|0}function Ah(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f[a>>2]=d;e=a+24|0;g=a+28|0;h=f[g>>2]|0;i=f[e>>2]|0;j=h-i>>2;k=i;i=h;if(j>>>0>=d>>>0){if(j>>>0>d>>>0?(h=k+(d<<2)|0,(h|0)!=(i|0)):0)f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2)}else oi(e,d-j|0);if(!c)return;j=f[b>>2]|0;if((c|0)>1){d=j;e=j;h=1;while(1){i=f[b+(h<<2)>>2]|0;g=(i|0)<(e|0);k=g?i:e;l=g?d:(i|0)>(d|0)?i:d;h=h+1|0;if((h|0)==(c|0)){m=l;n=k;break}else{d=l;e=k}}}else{m=j;n=j}f[a+4>>2]=n;f[a+8>>2]=m;j=Vn(m|0,((m|0)<0)<<31>>31|0,n|0,((n|0)<0)<<31>>31|0)|0;n=I;if(!(n>>>0<0|(n|0)==0&j>>>0<2147483647))return;n=j+1|0;f[a+12>>2]=n;j=(n|0)/2|0;m=a+16|0;f[m>>2]=j;f[a+20>>2]=0-j;if(n&1|0)return;f[m>>2]=j+-1;return}function Bh(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0;c=u;u=u+64|0;j=c;k=i?6:5;Al(j);i=f[h+56>>2]|0;h=X(Ll(k)|0,e)|0;yj(j,i,0,e&255,k,0,h,((h|0)<0)<<31>>31,0,0);h=dn(96)|0;nl(h,j);f[a>>2]=h;pj(h,d)|0;d=h+84|0;if(!g){b[d>>0]=1;a=f[h+68>>2]|0;j=h+72|0;k=f[j>>2]|0;if((k|0)==(a|0)){u=c;return}f[j>>2]=k+(~((k+-4-a|0)>>>2)<<2);u=c;return}b[d>>0]=0;d=h+68|0;a=h+72|0;h=f[a>>2]|0;k=f[d>>2]|0;j=h-k>>2;e=h;if(j>>>0>>0){kh(d,g-j|0,1200);u=c;return}if(j>>>0<=g>>>0){u=c;return}j=k+(g<<2)|0;if((j|0)==(e|0)){u=c;return}f[a>>2]=e+(~((e+-4-j|0)>>>2)<<2);u=c;return}function Ch(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){jd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;jd(a,e);return}function Dh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){nd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;nd(a,e);return}function Eh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){ud(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;ud(a,e);return}function Fh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Ed(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Ed(a,e);return}function Gh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){ld(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;ld(a,e);return}function Hh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){qd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;qd(a,e);return}function Ih(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){yd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;yd(a,e);return}function Jh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){kd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;kd(a,e);return}function Kh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){od(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;od(a,e);return}function Lh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){vd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;vd(a,e);return}function Mh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Fd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Fd(a,e);return}function Nh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;b[h>>0]=a&127;do if(a>>>0>127){b[h>>0]=a|128;i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0;k=Nh(a>>>7,c)|0;break}}else{i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0;l=1;u=d;return l|0}while(0);l=k;u=d;return l|0}function Oh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;Be(e,a+40|0,f[a+8>>2]|0,b,c);Wi(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;br(e)}br(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);br(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;br(c)}br(b)}br(a);u=d;return 1}function Ph(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){rd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;rd(a,e);return}function Qh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0;e=u;u=u+48|0;g=e;h=e+32|0;if(!c){i=0;u=e;return i|0}Cn(g);if((Tl(c,0)|0)!=-1?Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0:0){Va[f[(f[c>>2]|0)+20>>2]&127](c);Zf(h,a,c,g);c=(f[h>>2]|0)==0;a=h+4|0;if((b[a+11>>0]|0)<0)br(f[a>>2]|0);if(c){c=f[g>>2]|0;a=g+4|0;ag(d,c,c+((f[a>>2]|0)-c)|0);j=(f[a>>2]|0)-(f[g>>2]|0)|0}else j=0}else j=0;a=g+12|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0)br(c);c=f[g>>2]|0;if(c|0){a=g+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;br(c)}i=j;u=e;return i|0}function Rh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;se(e,a+40|0,f[a+8>>2]|0,b,c);Wi(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;br(e)}br(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);br(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;br(c)}br(b)}br(a);u=d;return 1}function Sh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{d=g+-4|0;f[c>>2]=d;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=h+88|0;i=f[d>>2]|0;f[d>>2]=0;if(i|0){d=f[i+8>>2]|0;if(d|0){j=i+12|0;if((f[j>>2]|0)!=(d|0))f[j>>2]=d;br(d)}br(i)}i=f[h+68>>2]|0;if(i|0){d=h+72|0;j=f[d>>2]|0;if((j|0)!=(i|0))f[d>>2]=j+(~((j+-4-i|0)>>>2)<<2);br(i)}i=h+64|0;j=f[i>>2]|0;f[i>>2]=0;if(j|0){i=f[j>>2]|0;if(i|0){d=j+4|0;if((f[d>>2]|0)!=(i|0))f[d>>2]=i;br(i)}br(j)}br(h)}g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}br(e);return}function Th(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=(d|0)<0;do if(!b){if(e){g=0;return g|0}h=a+4|0;i=f[h>>2]|0;j=f[a>>2]|0;k=i-j|0;if(k>>>0>>0){ri(a,c-k|0);break}if(k>>>0>c>>>0?(k=j+c|0,(k|0)!=(i|0)):0)f[h>>2]=k}else{if(e){g=0;return g|0}k=a+4|0;h=f[k>>2]|0;i=f[a>>2]|0;j=h-i|0;do if(0<(d|0)|0==(d|0)&j>>>0>>0){if(j>>>0>>0){ri(a,c-j|0);break}if(j>>>0>c>>>0?(l=i+c|0,(l|0)!=(h|0)):0){f[k>>2]=l;m=15}else m=15}else m=15;while(0);if((m|0)==15?(c|0)==0:0)break;Xl(f[a>>2]|0,b|0,c|0)|0}while(0);c=a+24|0;a=c;b=Tn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=c;f[a>>2]=b;f[a+4>>2]=I;g=1;return g|0}function Uh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;if(!(ve(a,c)|0)){i=0;u=d;return i|0}j=a+36|0;k=a+40|0;a=f[j>>2]|0;if((f[k>>2]|0)==(a|0)){i=1;u=d;return i|0}l=c+16|0;m=c+4|0;n=h+1|0;o=0;p=a;do{a=f[p+(o<<2)>>2]|0;q=Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0;b[h>>0]=q;q=l;a=f[q+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[q>>2]|0)>>>0>0)){f[g>>2]=f[m>>2];f[e>>2]=f[g>>2];ye(c,e,h,n)|0}o=o+1|0;p=f[j>>2]|0}while(o>>>0<(f[k>>2]|0)-p>>2>>>0);i=1;u=d;return i|0}function Vh(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c;wp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;e=a+24|0;wp(e);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=dn(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=20;g=a;h=13101;i=g+20|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+20>>0]=0;Mj(e,d,1);if((b[d+11>>0]|0)<0)br(f[d>>2]|0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=dn(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=22;g=a;h=13122;i=g+22|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+22>>0]=0;Mj(e,d,1);if((b[d+11>>0]|0)>=0){u=c;return}br(f[d>>2]|0);u=c;return}function Wh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a+4>>2]|0;c=a+8|0;d=f[c>>2]|0;if((d|0)!=(b|0)){e=d;do{d=e+-4|0;f[c>>2]=d;g=f[d>>2]|0;f[d>>2]=0;if(g|0){d=g+88|0;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=f[h+8>>2]|0;if(d|0){i=h+12|0;if((f[i>>2]|0)!=(d|0))f[i>>2]=d;br(d)}br(h)}h=f[g+68>>2]|0;if(h|0){d=g+72|0;i=f[d>>2]|0;if((i|0)!=(h|0))f[d>>2]=i+(~((i+-4-h|0)>>>2)<<2);br(h)}h=g+64|0;i=f[h>>2]|0;f[h>>2]=0;if(i|0){h=f[i>>2]|0;if(h|0){d=i+4|0;if((f[d>>2]|0)!=(h|0))f[d>>2]=h;br(h)}br(i)}br(g)}e=f[c>>2]|0}while((e|0)!=(b|0))}b=f[a>>2]|0;if(!b)return;br(b);return}function Xh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;u=c;return 1}function Yh(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c;e=dn(16)|0;f[d>>2]=e;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=e;h=12975;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[e+14>>0]=0;e=yk(a,d,-1)|0;if((b[d+11>>0]|0)<0)br(f[d>>2]|0);j=dn(16)|0;f[d>>2]=j;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=j;h=12990;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[j+14>>0]=0;j=yk(a,d,-1)|0;if((b[d+11>>0]|0)>=0){k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}br(f[d>>2]|0);k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}function Zh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];ye(b,d,g,g+4|0)|0;u=c;return 1}function _h(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=dn(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;h=g+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{ri(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}Rg(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function $h(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=a+32|0;fd(a,b);c=a+80|0;d=f[c>>2]|0;if((d|0?(e=a+84|0,(f[e>>2]|0)>0):0)?(fd(d,b),(f[e>>2]|0)>1):0){d=1;do{fd((f[c>>2]|0)+(d<<5)|0,b);d=d+1|0}while((d|0)<(f[e>>2]|0))}e=a+136|0;d=a+140|0;a=f[e>>2]|0;if((f[d>>2]|0)==(a|0))return;c=0;g=a;while(1){a=g;Nh((f[a+(c*12|0)+4>>2]|0)-(f[a+(c*12|0)>>2]|0)>>2,b)|0;a=f[e>>2]|0;h=f[a+(c*12|0)>>2]|0;i=(f[a+(c*12|0)+4>>2]|0)-h>>2;if(!i)j=a;else{Dc(h,i,1,0,b)|0;j=f[e>>2]|0}c=c+1|0;if(c>>>0>=(((f[d>>2]|0)-j|0)/12|0)>>>0)break;else g=j}return}function ai(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=d+16|0;g=f[e>>2]|0;if(!g)if(!(pl(d)|0)){h=f[e>>2]|0;i=5}else j=0;else{h=g;i=5}a:do if((i|0)==5){g=d+20|0;e=f[g>>2]|0;k=e;if((h-e|0)>>>0>>0){j=Sa[f[d+36>>2]&31](d,a,c)|0;break}b:do if((b[d+75>>0]|0)>-1){e=c;while(1){if(!e){l=0;m=a;n=c;o=k;break b}p=e+-1|0;if((b[a+p>>0]|0)==10)break;else e=p}p=Sa[f[d+36>>2]&31](d,a,e)|0;if(p>>>0>>0){j=p;break a}l=e;m=a+e|0;n=c-e|0;o=f[g>>2]|0}else{l=0;m=a;n=c;o=k}while(0);Rg(o|0,m|0,n|0)|0;f[g>>2]=(f[g>>2]|0)+n;j=l+n|0}while(0);return j|0}function bi(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+12|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d+28>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;bi(c+8|0);br(c)}while((e|0)!=0)}e=d+20|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0)br(c);c=f[d+8>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;g=c+8|0;h=f[c+20>>2]|0;if(h|0){i=c+24|0;if((f[i>>2]|0)!=(h|0))f[i>>2]=h;br(h)}if((b[g+11>>0]|0)<0)br(f[g>>2]|0);br(c)}while((e|0)!=0)}e=f[d>>2]|0;f[d>>2]=0;if(e|0)br(e);br(d)}if((b[a+11>>0]|0)>=0)return;br(f[a>>2]|0);return}function ci(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0;g=u;u=u+32|0;h=g+12|0;i=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;if((e|0)>0){j=i+11|0;k=i+4|0;l=0;do{if((l|0)>0)vn(h,12890)|0;cl(i,$(n[d+(l<<2)>>2]));m=b[j>>0]|0;o=m<<24>>24<0;$i(h,o?f[i>>2]|0:i,o?f[k>>2]|0:m&255)|0;if((b[j>>0]|0)<0)br(f[i>>2]|0);l=l+1|0}while((l|0)<(e|0))}Ql(mi(a,c)|0,h)|0;if((b[h+11>>0]|0)>=0){u=g;return}br(f[h>>2]|0);u=g;return}function di(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if((f[d+56>>2]|0)==-1){h=0;f[a>>2]=h;return}i=dn(96)|0;nl(i,d);d=i;do if(!e){j=f[c+80>>2]|0;b[i+84>>0]=0;k=i+68|0;l=i+72|0;m=f[l>>2]|0;n=f[k>>2]|0;o=m-n>>2;p=m;if(j>>>0>o>>>0){kh(k,j-o|0,5908);break}if(j>>>0>>0?(o=n+(j<<2)|0,(o|0)!=(p|0)):0)f[l>>2]=p+(~((p+-4-o|0)>>>2)<<2)}else{b[i+84>>0]=1;o=f[i+68>>2]|0;p=i+72|0;l=f[p>>2]|0;if((l|0)!=(o|0))f[p>>2]=l+(~((l+-4-o|0)>>>2)<<2);f[i+80>>2]=f[c+80>>2]}while(0);if(!g){h=d;f[a>>2]=h;return}pj(i,g)|0;h=d;f[a>>2]=h;return}function ei(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=e>>3;h=g+1|0;if(h>>>0>536870911)mq(a);i=a+8|0;j=(f[i>>2]|0)-d|0;k=j>>2;l=j>>3>>>0<268435455?(k>>>0>>0?h:k):536870911;do if(l)if(l>>>0>536870911){k=ra(8)|0;Wo(k,14941);f[k>>2]=6944;va(k|0,1080,114)}else{k=dn(l<<3)|0;m=k;n=k;break}else{m=0;n=0}while(0);k=m+(g<<3)|0;g=b;b=f[g+4>>2]|0;h=k;f[h>>2]=f[g>>2];f[h+4>>2]=b;if((e|0)>0)Rg(n|0,d|0,e|0)|0;f[a>>2]=m;f[c>>2]=k+8;f[i>>2]=m+(l<<3);if(!d)return;br(d);return}function fi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){e=1;u=c;return e|0}g=a+4|0;h=a+20|0;i=a+24|0;j=a+16|0;a=0;while(1){k=f[(f[g>>2]|0)+4>>2]|0;l=Tl(k,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;f[d>>2]=l;if((l|0)==-1)break;k=f[h>>2]|0;if((k|0)==(f[i>>2]|0))Ci(j,d);else{f[k>>2]=l;f[h>>2]=k+4}al(f[g>>2]|0,f[d>>2]|0)|0;a=a+1|0;if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){e=1;m=9;break}}if((m|0)==9){u=c;return e|0}e=0;u=c;return e|0}function gi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=1276;Sh(a+60|0);b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=a+36|0;d=f[b>>2]|0;if(d|0){c=a+40|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-24|0;f[c>>2]=e;Va[f[f[e>>2]>>2]&127](e);h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}br(g)}f[a>>2]=1216;g=f[a+16>>2]|0;if(g|0){b=a+20|0;d=f[b>>2]|0;if((d|0)!=(g|0))f[b>>2]=d+(~((d+-4-g|0)>>>2)<<2);br(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);br(g);return}function hi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=u;u=u+32|0;d=c+16|0;e=c+8|0;g=c;h=a+8|0;if(f[h>>2]<<5>>>0>=b>>>0){u=c;return}f[d>>2]=0;i=d+4|0;f[i>>2]=0;j=d+8|0;f[j>>2]=0;if((b|0)<0)mq(d);k=((b+-1|0)>>>5)+1|0;b=dn(k<<2)|0;f[d>>2]=b;f[i>>2]=0;f[j>>2]=k;k=f[a>>2]|0;f[e>>2]=k;f[e+4>>2]=0;b=a+4|0;l=f[b>>2]|0;f[g>>2]=k+(l>>>5<<2);f[g+4>>2]=l&31;ig(d,e,g);g=f[a>>2]|0;f[a>>2]=f[d>>2];f[d>>2]=g;d=f[b>>2]|0;f[b>>2]=f[i>>2];f[i>>2]=d;d=f[h>>2]|0;f[h>>2]=f[j>>2];f[j>>2]=d;if(g|0)br(g);u=c;return}function ii(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+136|0;c=f[b>>2]|0;if(c|0){d=a+140|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);br(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}br(g)}g=f[a+104>>2]|0;if(g|0){b=a+108|0;j=f[b>>2]|0;if((j|0)!=(g|0))f[b>>2]=j+(~((j+-4-g|0)>>>2)<<2);br(g)}g=f[a+92>>2]|0;if(!g){jj(a);return}j=a+96|0;b=f[j>>2]|0;if((b|0)!=(g|0))f[j>>2]=b+(~((b+-4-g|0)>>>2)<<2);br(g);jj(a);return}function ji(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3340;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;rn(a+200|0);Cn(a+232|0);d=a+316|0;e=a+264|0;g=e+52|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=-1;f[a+320>>2]=-1;f[a+324>>2]=0;f[a+328>>2]=2;f[a+332>>2]=7;f[a+336>>2]=0;f[a+340>>2]=0;f[a+344>>2]=0;b[a+352>>0]=0;return}function ki(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=(e|0)/12|0;h=g+1|0;if(h>>>0>357913941)mq(a);i=a+8|0;j=((f[i>>2]|0)-d|0)/12|0;k=j<<1;l=j>>>0<178956970?(k>>>0>>0?h:k):357913941;do if(l)if(l>>>0>357913941){k=ra(8)|0;Wo(k,14941);f[k>>2]=6944;va(k|0,1080,114)}else{m=dn(l*12|0)|0;break}else m=0;while(0);k=m+(g*12|0)|0;f[k>>2]=f[b>>2];f[k+4>>2]=f[b+4>>2];f[k+8>>2]=f[b+8>>2];b=k+(((e|0)/-12|0)*12|0)|0;if((e|0)>0)Rg(b|0,d|0,e|0)|0;f[a>>2]=b;f[c>>2]=k+12;f[i>>2]=m+(l*12|0);if(!d)return;br(d);return}function li(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=a+16|0;h=g;i=f[h+4>>2]|0;if((d|0)<0|(d|0)==0&c>>>0<1|((i|0)>0|(i|0)==0&(f[h>>2]|0)>>>0>0)){j=0;return j|0}b[a+24>>0]=e&1;h=Tn(c|0,d|0,7,0)|0;d=zk(h|0,I|0,8,0)|0;h=I;c=g;f[c>>2]=d;f[c+4>>2]=h;c=a+4|0;g=f[c>>2]|0;i=f[a>>2]|0;k=g-i|0;l=Tn(k|0,0,8,0)|0;m=e?l:k;l=Tn(m|0,(e?I:0)|0,d|0,h|0)|0;h=i;i=g;if(k>>>0>=l>>>0)if(k>>>0>l>>>0?(g=h+l|0,(g|0)!=(i|0)):0){f[c>>2]=g;n=h}else n=h;else{ri(a,l-k|0);n=f[a>>2]|0}k=dn(8)|0;f[k>>2]=n+m;f[k+4>>2]=0;m=a+12|0;a=f[m>>2]|0;f[m>>2]=k;if(!a){j=1;return j|0}br(a);j=1;return j|0}function mi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=u;u=u+16|0;d=c;e=hg(a,d,b)|0;g=f[e>>2]|0;if(g|0){h=g;i=h+28|0;u=c;return i|0}g=dn(40)|0;dj(g+16|0,b);b=g+28|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;b=f[d>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=b;f[e>>2]=g;b=f[f[a>>2]>>2]|0;if(!b)j=g;else{f[a>>2]=b;j=f[e>>2]|0}Ae(f[a+4>>2]|0,j);j=a+8|0;f[j>>2]=(f[j>>2]|0)+1;h=g;i=h+28|0;u=c;return i|0}function ni(a,c,d,e,g,h,i,j){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0;k=u;u=u+16|0;l=k;if((-18-c|0)>>>0>>0)mq(a);if((b[a+11>>0]|0)<0)m=f[a>>2]|0;else m=a;if(c>>>0<2147483623){n=d+c|0;d=c<<1;o=n>>>0>>0?d:n;p=o>>>0<11?11:o+16&-16}else p=-17;o=dn(p)|0;if(g|0)Lo(o,m,g)|0;if(i|0)Lo(o+g|0,j,i)|0;j=e-h|0;e=j-g|0;if(e|0)Lo(o+g+i|0,m+g+h|0,e)|0;if((c|0)!=10)br(m);f[a>>2]=o;f[a+8>>2]=p|-2147483648;p=j+i|0;f[a+4>>2]=p;b[l>>0]=0;Hp(o+p|0,l);u=k;return}function oi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;if(d-g>>2>>>0>=b>>>0){hj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}h=f[a>>2]|0;i=g-h|0;g=i>>2;j=g+b|0;if(j>>>0>1073741823)mq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?j:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Wo(d,14941);f[d>>2]=6944;va(d|0,1080,114)}else{d=dn(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;hj(d|0,0,b<<2|0)|0;if((i|0)>0)Rg(n|0,h|0,i|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=m+(l<<2);if(!h)return;br(h);return}function pi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=dn(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;dj(g+8|0,e);h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{ri(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}Rg(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function qi(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0,i=0,j=0,k=0.0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=+d;l=j;j=i;while(1){if(j<<24>>24<0)m=f[c>>2]|0;else m=c;p[g>>3]=k;n=wn(m,l+1|0,17468,g)|0;if((n|0)>-1)if(n>>>0>l>>>0)o=n;else break;else o=l<<1|1;wj(c,o,0);l=o;j=b[h>>0]|0}wj(c,n,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function ri(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if((e-h|0)>>>0>=c>>>0){i=c;j=h;do{b[j>>0]=0;j=(f[g>>2]|0)+1|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=h-i|0;h=j+c|0;if((h|0)<0)mq(a);k=e-i|0;i=k<<1;e=k>>>0<1073741823?(i>>>0>>0?h:i):2147483647;if(!e)l=0;else l=dn(e)|0;i=l+j|0;j=l+e|0;e=c;c=i;l=i;do{b[l>>0]=0;l=c+1|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=(f[g>>2]|0)-e|0;h=i+(0-l)|0;if((l|0)>0)Rg(h|0,e|0,l|0)|0;f[a>>2]=h;f[g>>2]=c;f[d>>2]=j;if(!e)return;br(e);return}function si(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=(d-e|0)/136|0;h=d;if(g>>>0>>0){te(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b*136|0)|0;if((g|0)==(h|0))return;else i=h;do{f[c>>2]=i+-136;h=f[i+-20>>2]|0;if(h|0){b=i+-16|0;e=f[b>>2]|0;if((e|0)!=(h|0))f[b>>2]=e+(~((e+-4-h|0)>>>2)<<2);br(h)}h=f[i+-32>>2]|0;if(h|0){e=i+-28|0;b=f[e>>2]|0;if((b|0)!=(h|0))f[e>>2]=b+(~((b+-4-h|0)>>>2)<<2);br(h)}yi(i+-132|0);i=f[c>>2]|0}while((i|0)!=(g|0));return}function ti(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Hd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Hd(a,e);return}function ui(a){a=a|0;var b=0,c=0,d=0;b=f[a+76>>2]|0;if(b|0){c=a+80|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+64>>2]|0;if(b|0){d=a+68|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;br(b)}b=f[a+48>>2]|0;if(b|0){d=a+52|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+24>>2]|0;if(b|0){c=a+28|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+12>>2]|0;if(b|0){d=a+16|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function vi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=j;j=i;while(1){if(j<<24>>24<0)l=f[c>>2]|0;else l=c;f[g>>2]=d;m=wn(l,k+1|0,17465,g)|0;if((m|0)>-1)if(m>>>0>k>>>0)n=m;else break;else n=k<<1|1;wj(c,n,0);k=n;j=b[h>>0]|0}wj(c,m,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function wi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=a+8|0;c=f[b>>2]|0;if((c|0)<0){d=0;return d|0}e=a+4|0;a=f[e>>2]|0;g=a+4|0;h=f[g>>2]|0;i=f[a>>2]|0;j=h-i>>2;k=i;i=h;if(c>>>0<=j>>>0)if(c>>>0>>0?(h=k+(c<<2)|0,(h|0)!=(i|0)):0){f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2);l=c}else l=c;else{oi(a,c-j|0);l=f[b>>2]|0}if((l|0)<=0){d=1;return d|0}b=f[e>>2]|0;e=f[b>>2]|0;j=(f[b+4>>2]|0)-e>>2;c=e;e=0;while(1){if(j>>>0<=e>>>0){m=10;break}f[c+(e<<2)>>2]=e;e=e+1|0;if((e|0)>=(l|0)){d=1;m=12;break}}if((m|0)==10)mq(b);else if((m|0)==12)return d|0;return 0}function xi(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;g=dn(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=30;h=g;i=14791;j=h+30|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+30>>0]=0;g=a+4|0;Mj(g,e,c);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);a=dn(32)|0;f[e>>2]=a;f[e+8>>2]=-2147483616;f[e+4>>2]=29;h=a;i=14510;j=h+29|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[a+29>>0]=0;Mj(g,e,c);if((b[e+11>>0]|0)>=0){u=d;return}br(f[e>>2]|0);u=d;return}function yi(a){a=a|0;var b=0,c=0,d=0;b=f[a+84>>2]|0;if(b|0){c=a+88|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+72>>2]|0;if(b|0){d=a+76|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;br(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+28>>2]|0;if(b|0){d=a+32|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+12>>2]|0;if(b|0)br(b);b=f[a>>2]|0;if(!b)return;br(b);return}function zi(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=1336;b=a+32|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+88|0;d=f[b>>2]|0;f[b>>2]=0;if(d|0){b=f[d+8>>2]|0;if(b|0){e=d+12|0;if((f[e>>2]|0)!=(b|0))f[e>>2]=b;br(b)}br(d)}d=f[c+68>>2]|0;if(d|0){b=c+72|0;e=f[b>>2]|0;if((e|0)!=(d|0))f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2);br(d)}d=c+64|0;e=f[d>>2]|0;f[d>>2]=0;if(e|0){d=f[e>>2]|0;if(d|0){b=e+4|0;if((f[b>>2]|0)!=(d|0))f[b>>2]=d;br(d)}br(e)}br(c)}c=f[a+16>>2]|0;if(!c)return;e=a+20|0;a=f[e>>2]|0;if((a|0)!=(c|0))f[e>>2]=a+(~((a+-4-c|0)>>>2)<<2);br(c);return}function Ai(){var a=0,b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+48|0;b=a+32|0;c=a+24|0;d=a+16|0;e=a;g=a+36|0;a=mn()|0;if(a|0?(h=f[a>>2]|0,h|0):0){a=h+48|0;i=f[a>>2]|0;j=f[a+4>>2]|0;if(!((i&-256|0)==1126902528&(j|0)==1129074247)){f[c>>2]=17607;Dn(17557,c)}if((i|0)==1126902529&(j|0)==1129074247)k=f[h+44>>2]|0;else k=h+80|0;f[g>>2]=k;k=f[h>>2]|0;h=f[k+4>>2]|0;if(Sa[f[(f[250]|0)+16>>2]&31](1e3,k,g)|0){k=f[g>>2]|0;g=Qa[f[(f[k>>2]|0)+8>>2]&127](k)|0;f[e>>2]=17607;f[e+4>>2]=h;f[e+8>>2]=g;Dn(17471,e)}else{f[d>>2]=17607;f[d+4>>2]=h;Dn(17516,d)}}Dn(17595,b)}function Bi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;do if(a){if(c>>>0<128){b[a>>0]=c;e=1;break}d=(Yq()|0)+188|0;if(!(f[f[d>>2]>>2]|0))if((c&-128|0)==57216){b[a>>0]=c;e=1;break}else{d=ir()|0;f[d>>2]=84;e=-1;break}if(c>>>0<2048){b[a>>0]=c>>>6|192;b[a+1>>0]=c&63|128;e=2;break}if(c>>>0<55296|(c&-8192|0)==57344){b[a>>0]=c>>>12|224;b[a+1>>0]=c>>>6&63|128;b[a+2>>0]=c&63|128;e=3;break}if((c+-65536|0)>>>0<1048576){b[a>>0]=c>>>18|240;b[a+1>>0]=c>>>12&63|128;b[a+2>>0]=c>>>6&63|128;b[a+3>>0]=c&63|128;e=4;break}else{d=ir()|0;f[d>>2]=84;e=-1;break}}else e=1;while(0);return e|0}function Ci(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=e>>2;h=g+1|0;if(h>>>0>1073741823)mq(a);i=a+8|0;j=(f[i>>2]|0)-d|0;k=j>>1;l=j>>2>>>0<536870911?(k>>>0>>0?h:k):1073741823;do if(l)if(l>>>0>1073741823){k=ra(8)|0;Wo(k,14941);f[k>>2]=6944;va(k|0,1080,114)}else{k=dn(l<<2)|0;m=k;n=k;break}else{m=0;n=0}while(0);k=m+(g<<2)|0;f[k>>2]=f[b>>2];if((e|0)>0)Rg(n|0,d|0,e|0)|0;f[a>>2]=m;f[c>>2]=k+4;f[i>>2]=m+(l<<2);if(!d)return;br(d);return}function Di(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=a+104|0;d=f[c>>2]|0;if((d|0)!=0?(f[a+108>>2]|0)>=(d|0):0)e=4;else{d=Qm(a)|0;if((d|0)>=0){g=f[c>>2]|0;c=a+8|0;if(g){i=f[c>>2]|0;j=f[a+4>>2]|0;k=g-(f[a+108>>2]|0)|0;g=i;if((i-j|0)<(k|0)){l=g;m=g}else{l=j+(k+-1)|0;m=g}}else{g=f[c>>2]|0;l=g;m=g}f[a+100>>2]=l;l=a+4|0;if(!m)n=f[l>>2]|0;else{g=f[l>>2]|0;l=a+108|0;f[l>>2]=m+1-g+(f[l>>2]|0);n=g}g=n+-1|0;if((d|0)==(h[g>>0]|0|0))o=d;else{b[g>>0]=d;o=d}}else e=4}if((e|0)==4){f[a+100>>2]=0;o=-1}return o|0}function Ei(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1528;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];_j(a+32|0,c+24|0);f[a>>2]=2144;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=2200;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Sm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Fi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=dn(16)|0;f[g>>2]=h;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=h;j=12975;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+14>>0]=0;Nj(a,g,c);if((b[g+11>>0]|0)<0)br(f[g>>2]|0);c=dn(16)|0;f[g>>2]=c;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=c;j=12990;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[c+14>>0]=0;Nj(a,g,d);if((b[g+11>>0]|0)>=0){u=e;return}br(f[g>>2]|0);u=e;return}function Gi(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3320;b=f[a+88>>2]|0;if(b|0){c=a+92|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+72>>2]|0;if(b|0){d=a+76|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+60>>2]|0;if(b|0){c=a+64|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+48>>2]|0;if(b|0){d=a+52|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=3276;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b)return;br(b);return}function Hi(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1528;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];_j(a+32|0,c+24|0);f[a>>2]=1836;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=1892;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Sm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Ii(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2200;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+96>>2]|0;if(b|0)br(b);b=f[a+84>>2]|0;if(b|0)br(b);b=f[a+72>>2]|0;if(b|0)br(b);b=f[a+60>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Ji(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[(f[c+4>>2]|0)+4>>2]|0;if(!g){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=d;return}if(!(rj(d+12|0,f[c+44>>2]|0,g)|0)){g=dn(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=26;c=g;h=14822;i=c+26|0;do{b[c>>0]=b[h>>0]|0;c=c+1|0;h=h+1|0}while((c|0)<(i|0));b[g+26>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0)}else{f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0}u=d;return}function Ki(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=b+48|0;if((Yh(f[c>>2]|0)|0)>9){d=0;return d|0}if((Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)!=1){d=0;return d|0}e=b+4|0;b=(f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0)+56|0;a=f[b>>2]|0;do if((a|0)==3)if((Yh(f[c>>2]|0)|0)<4){d=5;return d|0}else{g=f[b>>2]|0;break}else g=a;while(0);a=Yh(f[c>>2]|0)|0;if((g|0)==1){d=(a|0)<4?6:0;return d|0}if((a|0)>7){d=0;return d|0}if((Yh(f[c>>2]|0)|0)>1){d=1;return d|0}else return ((f[(f[e>>2]|0)+80>>2]|0)>>>0<40?1:4)|0;return 0}function Li(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1892;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+96>>2]|0;if(b|0)br(b);b=f[a+84>>2]|0;if(b|0)br(b);b=f[a+72>>2]|0;if(b|0)br(b);b=f[a+60>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Mi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=u;u=u+128|0;h=g+124|0;i=g;j=i;k=6284;l=j+124|0;do{f[j>>2]=f[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));if((c+-1|0)>>>0>2147483646)if(!c){m=h;n=1;o=4}else{h=ir()|0;f[h>>2]=75;p=-1}else{m=a;n=c;o=4}if((o|0)==4){o=-2-m|0;c=n>>>0>o>>>0?o:n;f[i+48>>2]=c;n=i+20|0;f[n>>2]=m;f[i+44>>2]=m;o=m+c|0;m=i+16|0;f[m>>2]=o;f[i+28>>2]=o;o=hh(i,d,e)|0;if(!c)p=o;else{c=f[n>>2]|0;b[c+(((c|0)==(f[m>>2]|0))<<31>>31)>>0]=0;p=o}}u=g;return p|0}function Ni(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3080;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;rn(a+200|0);Cn(a+232|0);d=a+264|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;b[d+24>>0]=0;return}function Oi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=+e;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=vj(d)|0;if(i>>>0>4294967279)mq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=dn(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){Rg(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;Ol(c,g,e);if((b[g+11>>0]|0)<0)br(f[g>>2]|0);h=1;u=a;return h|0}function Pi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=vj(d)|0;if(i>>>0>4294967279)mq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=dn(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){Rg(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;Pl(c,g,e);if((b[g+11>>0]|0)<0)br(f[g>>2]|0);h=1;u=a;return h|0}function Qi(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;c=f[a+28>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;g=c+20|0;h=f[g>>2]|0;f[g>>2]=0;if(h|0){Qi(h);br(h)}if((b[e+11>>0]|0)<0)br(f[e>>2]|0);br(c)}while((d|0)!=0)}d=a+20|0;c=f[d>>2]|0;f[d>>2]=0;if(c|0)br(c);c=f[a+8>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;h=f[c+20>>2]|0;if(h|0){g=c+24|0;if((f[g>>2]|0)!=(h|0))f[g>>2]=h;br(h)}if((b[e+11>>0]|0)<0)br(f[e>>2]|0);br(c)}while((d|0)!=0)}d=f[a>>2]|0;f[a>>2]=0;if(!d)return;br(d);return}function Ri(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;Wa[f[(f[c>>2]|0)+64>>2]&15](a,c);if(f[a>>2]|0){u=d;return}g=a+4|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);g=f[c+48>>2]|0;h=dn(32)|0;f[e>>2]=h;f[e+8>>2]=-2147483616;f[e+4>>2]=29;i=h;j=14510;k=i+29|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+29>>0]=0;h=Oj(g,e,0)|0;if((b[e+11>>0]|0)<0)br(f[e>>2]|0);if(h)Va[f[(f[c>>2]|0)+68>>2]&127](c);f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=d;return}function Si(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0;e=u;u=u+16|0;g=e;h=f[c+48>>2]|0;if(!h){i=dn(32)|0;f[g>>2]=i;f[g+8>>2]=-2147483616;f[g+4>>2]=23;j=i;k=14670;l=j+23|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+23>>0]=0;f[a>>2]=-1;dj(a+4|0,g);if((b[g+11>>0]|0)<0)br(f[g>>2]|0);u=e;return}g=f[c+52>>2]|0;if(!g){Ic(a,c,h,d);u=e;return}else{jg(a,c,g,d);u=e;return}}function Ti(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;lk(a);b=a+84|0;c=f[b>>2]|0;if((c|0)<=0)return;d=c<<5;e=_q(c>>>0>134217727|d>>>0>4294967291?-1:d+4|0)|0;f[e>>2]=c;d=e+4|0;e=d+(c<<5)|0;c=d;do{rn(c);c=c+32|0}while((c|0)!=(e|0));e=a+80|0;a=f[e>>2]|0;f[e>>2]=d;if(a|0){d=a+-4|0;c=f[d>>2]|0;if(c|0){g=a+(c<<5)|0;do{g=g+-32|0;tj(g)}while((g|0)!=(a|0))}$q(d)}if((f[b>>2]|0)>0)h=0;else return;do{lk((f[e>>2]|0)+(h<<5)|0);h=h+1|0}while((h|0)<(f[b>>2]|0));return}function Ui(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!b){d=0;return d|0}if(f[b+4>>2]|0){d=0;return d|0}a=dn(52)|0;Ub(a,c);f[a+40>>2]=0;f[a+44>>2]=0;f[a+48>>2]=0;c=b+4|0;b=f[c>>2]|0;f[c>>2]=a;if(!b){d=1;return d|0}a=b+40|0;c=f[a>>2]|0;if(c|0){e=b+44|0;g=f[e>>2]|0;if((g|0)==(c|0))h=c;else{i=g;do{g=i+-4|0;f[e>>2]=g;j=f[g>>2]|0;f[g>>2]=0;if(j|0){Qi(j);br(j)}i=f[e>>2]|0}while((i|0)!=(c|0));h=f[a>>2]|0}br(h)}Qi(b);br(b);d=1;return d|0}function Vi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[a>>2]|0;if(b){b=c+8|0;d=b;e=Tn(f[d>>2]|0,f[d+4>>2]|0,1,0)|0;d=b;f[d>>2]=e;f[d+4>>2]=I;d=a+28|0;e=f[d>>2]|0;b=a+24|0;f[b>>2]=f[b>>2]|1<>2]|0,f[e+4>>2]|0,1,0)|0;e=c;f[e>>2]=d;f[e+4>>2]=I;e=a+28|0;g=e;h=f[e>>2]|0}e=h+1|0;f[g>>2]=e;if((e|0)!=32)return;e=a+24|0;h=a+16|0;d=f[h>>2]|0;if((d|0)==(f[a+20>>2]|0))Ci(a+12|0,e);else{f[d>>2]=f[e>>2];f[h>>2]=d+4}f[g>>2]=0;f[e>>2]=0;return}function Wi(a,b){a=a|0;b=b|0;var c=0,d=0;c=a+32|0;a=f[b>>2]|0;f[b>>2]=0;b=f[c>>2]|0;f[c>>2]=a;if(!b)return;a=b+88|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0){a=f[c+8>>2]|0;if(a|0){d=c+12|0;if((f[d>>2]|0)!=(a|0))f[d>>2]=a;br(a)}br(c)}c=f[b+68>>2]|0;if(c|0){a=b+72|0;d=f[a>>2]|0;if((d|0)!=(c|0))f[a>>2]=d+(~((d+-4-c|0)>>>2)<<2);br(c)}c=b+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){a=d+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;br(c)}br(d)}br(b);return}function Xi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;if(c|0){h=a+11|0;i=b[h>>0]|0;if(i<<24>>24<0){j=f[a+4>>2]|0;k=(f[a+8>>2]&2147483647)+-1|0}else{j=i&255;k=10}if((k-j|0)>>>0>>0){lj(a,k,c-k+j|0,j,j,0,0);l=b[h>>0]|0}else l=i;if(l<<24>>24<0)m=f[a>>2]|0;else m=a;On(m+j|0,c,d)|0;d=j+c|0;if((b[h>>0]|0)<0)f[a+4>>2]=d;else b[h>>0]=d;b[g>>0]=0;Hp(m+d|0,g)}u=e;return a|0}function Yi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+48|0;e=d+4|0;g=d;h=f[b+12>>2]|0;i=f[b+4>>2]|0;b=e;j=b+36|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));gh(g,c,h,i,e);i=f[e+24>>2]|0;if(!i){k=f[g>>2]|0;f[a>>2]=k;u=d;return}h=e+28|0;e=f[h>>2]|0;if((e|0)!=(i|0))f[h>>2]=e+(~((e+-4-i|0)>>>2)<<2);br(i);k=f[g>>2]|0;f[a>>2]=k;u=d;return}function Zi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=(f[a+8>>2]&2147483647)+-1|0;else k=10;do if(k>>>0>=d>>>0){if(j)l=f[a>>2]|0;else l=a;Jo(l,c,d)|0;b[g>>0]=0;Hp(l+d|0,g);if((b[h>>0]|0)<0){f[a+4>>2]=d;break}else{b[h>>0]=d;break}}else{if(j)m=f[a+4>>2]|0;else m=i&255;ni(a,k,d-k|0,m,0,m,d,c)}while(0);u=e;return a|0}function _i(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{f[c>>2]=g+-136;d=f[g+-20>>2]|0;if(d|0){h=g+-16|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);br(d)}d=f[g+-32>>2]|0;if(d|0){i=g+-28|0;h=f[i>>2]|0;if((h|0)!=(d|0))f[i>>2]=h+(~((h+-4-d|0)>>>2)<<2);br(d)}yi(g+-132|0);g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}br(e);return}function $i(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j){k=f[a+4>>2]|0;l=(f[a+8>>2]&2147483647)+-1|0}else{k=i&255;l=10}if((l-k|0)>>>0>=d>>>0){if(d|0){if(j)m=f[a>>2]|0;else m=a;Lo(m+k|0,c,d)|0;j=k+d|0;if((b[h>>0]|0)<0)f[a+4>>2]=j;else b[h>>0]=j;b[g>>0]=0;Hp(m+j|0,g)}}else ni(a,l,d-l+k|0,k,k,0,d,c);u=e;return a|0}function aj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=3608;b=f[a+32>>2]|0;if(b|0){c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+20>>2]|0;if(b|0){d=a+24|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=a+8|0;c=f[b>>2]|0;if(!c)return;d=a+12|0;a=f[d>>2]|0;if((a|0)==(c|0))e=c;else{g=a;do{a=g+-4|0;f[d>>2]=a;h=f[a>>2]|0;f[a>>2]=0;if(h|0)Va[f[(f[h>>2]|0)+4>>2]&127](h);g=f[d>>2]|0}while((g|0)!=(c|0));e=f[b>>2]|0}br(e);return}function bj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){d=1;return d|0}a=0;while(1){e=f[(f[c>>2]|0)+4>>2]|0;g=Tl(e,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;if((g|0)==-1){d=0;h=6;break}e=f[(f[b>>2]|0)+28>>2]|0;i=$k(f[c>>2]|0,g)|0;a=a+1|0;if(!(Ra[e&127](b,i)|0)){d=0;h=6;break}if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){d=1;h=6;break}}if((h|0)==6)return d|0;return 0}function cj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!(lo(a,b,c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+52>>2]&127](a)|0)){d=0;return d|0}c=a+4|0;e=a+8|0;g=f[c>>2]|0;if((f[e>>2]|0)==(g|0)){d=1;return d|0}h=a+36|0;a=0;i=g;while(1){g=f[(f[h>>2]|0)+(a<<2)>>2]|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,b,f[i+(a<<2)>>2]|0)|0)){d=0;j=7;break}a=a+1|0;i=f[c>>2]|0;if(a>>>0>=(f[e>>2]|0)-i>>2>>>0){d=1;j=7;break}}if((j|0)==7)return d|0;return 0}function dj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;if((b[c+11>>0]|0)<0){g=f[c>>2]|0;h=f[c+4>>2]|0;if(h>>>0>4294967279)mq(a);if(h>>>0<11){b[a+11>>0]=h;i=a}else{j=h+16&-16;k=dn(j)|0;f[a>>2]=k;f[a+8>>2]=j|-2147483648;f[a+4>>2]=h;i=k}Lo(i,g,h)|0;b[e>>0]=0;Hp(i+h|0,e)}else{f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2]}u=d;return}function ej(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[(f[b+4>>2]|0)+80>>2];h=f[b+44>>2]|0;b=h+16|0;i=f[b+4>>2]|0;if((i|0)>0|(i|0)==0&(f[b>>2]|0)>>>0>0){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=c;return}f[e>>2]=f[h+4>>2];f[d>>2]=f[e>>2];ye(h,d,g,g+4|0)|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=c;return}function fj(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0;b[c+53>>0]=1;do if((f[c+4>>2]|0)==(e|0)){b[c+52>>0]=1;a=c+16|0;h=f[a>>2]|0;if(!h){f[a>>2]=d;f[c+24>>2]=g;f[c+36>>2]=1;if(!((g|0)==1?(f[c+48>>2]|0)==1:0))break;b[c+54>>0]=1;break}if((h|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;b[c+54>>0]=1;break}h=c+24|0;a=f[h>>2]|0;if((a|0)==2){f[h>>2]=g;i=g}else i=a;if((i|0)==1?(f[c+48>>2]|0)==1:0)b[c+54>>0]=1}while(0);return}function gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)!=(e|0)){g=0;h=e;do{eg(h+(g*24|0)|0,b)|0;g=g+1|0;h=f[c>>2]|0}while(g>>>0<(((f[d>>2]|0)-h|0)/24|0)>>>0)}h=a+48|0;d=a+52|0;a=f[h>>2]|0;if((f[d>>2]|0)==(a|0))return 1;else{i=0;j=a}do{a=f[j+(i<<2)>>2]|0;Nh(a<<1^a>>31,b)|0;i=i+1|0;j=f[h>>2]|0}while(i>>>0<(f[d>>2]|0)-j>>2>>>0);return 1}function hj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=a+d|0;c=c&255;if((d|0)>=67){while(a&3){b[a>>0]=c;a=a+1|0}g=e&-4|0;h=g-64|0;i=c|c<<8|c<<16|c<<24;while((a|0)<=(h|0)){f[a>>2]=i;f[a+4>>2]=i;f[a+8>>2]=i;f[a+12>>2]=i;f[a+16>>2]=i;f[a+20>>2]=i;f[a+24>>2]=i;f[a+28>>2]=i;f[a+32>>2]=i;f[a+36>>2]=i;f[a+40>>2]=i;f[a+44>>2]=i;f[a+48>>2]=i;f[a+52>>2]=i;f[a+56>>2]=i;f[a+60>>2]=i;a=a+64|0}while((a|0)<(g|0)){f[a>>2]=i;a=a+4|0}}while((a|0)<(e|0)){b[a>>0]=c;a=a+1|0}return e-d|0}function ij(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;do if(!(qp(a,f[c+8>>2]|0,g)|0)){if(qp(a,f[c>>2]|0,g)|0){if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0)b[c+54>>0]=1;f[c+44>>2]=4;break}if((e|0)==1)f[c+32>>2]=1}}else Om(0,c,d,e);while(0);return}function jj(a){a=a|0;var b=0,c=0,d=0,e=0;b=a+80|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+-4|0;d=f[b>>2]|0;if(d|0){e=c+(d<<5)|0;do{e=e+-32|0;tj(e)}while((e|0)!=(c|0))}$q(b)}b=f[a+68>>2]|0;if(b|0){c=a+72|0;e=f[c>>2]|0;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);br(b)}b=a+44|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0)br(e);e=f[a+32>>2]|0;if(!e){tj(a);return}b=a+36|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;br(e);tj(a);return}function kj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2684;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+76>>2]|0;if(b|0)br(b);b=f[a+64>>2]|0;if(b|0)br(b);b=f[a+52>>2]|0;if(b|0)br(b);b=f[a+40>>2]|0;if(!b)return;br(b);return}function lj(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0;if((-17-c|0)>>>0>>0)mq(a);if((b[a+11>>0]|0)<0)j=f[a>>2]|0;else j=a;if(c>>>0<2147483623){k=d+c|0;d=c<<1;l=k>>>0>>0?d:k;m=l>>>0<11?11:l+16&-16}else m=-17;l=dn(m)|0;if(g|0)Lo(l,j,g)|0;k=e-h-g|0;if(k|0)Lo(l+g+i|0,j+g+h|0,k)|0;if((c|0)!=10)br(j);f[a>>2]=l;f[a+8>>2]=m|-2147483648;return}function mj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2432;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b)}b=f[a+76>>2]|0;if(b|0)br(b);b=f[a+64>>2]|0;if(b|0)br(b);b=f[a+52>>2]|0;if(b|0)br(b);b=f[a+40>>2]|0;if(!b)return;br(b);return}function nj(a,b){a=a|0;b=b|0;if(!b)return;else{nj(a,f[b>>2]|0);nj(a,f[b+4>>2]|0);sj(b+20|0,f[b+24>>2]|0);br(b);return}}function oj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;If(a,b,c);c=f[a+100>>2]|0;d=f[a+96>>2]|0;a=d;if((c|0)==(d|0))return;e=f[b>>2]|0;b=(c-d|0)/12|0;d=0;do{c=a+(d*12|0)|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+4|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+8|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];d=d+1|0}while(d>>>0>>0);return}function pj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=a+64|0;if((f[d>>2]|0)==0?(e=dn(32)|0,tn(e),g=f[d>>2]|0,f[d>>2]=e,g|0):0){e=f[g>>2]|0;if(e|0){h=g+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;br(e)}br(g)}g=Ll(f[a+28>>2]|0)|0;e=X(g,b[a+24>>0]|0)|0;g=((e|0)<0)<<31>>31;h=f[d>>2]|0;i=on(e|0,g|0,c|0,0)|0;if(!(Th(h,0,i,I)|0)){j=0;return j|0}Ak(a,f[d>>2]|0,e,g,0,0);f[a+80>>2]=c;j=1;return j|0}function qj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+64|0;e=d;if(!(qp(a,b,0)|0))if((b|0)!=0?(g=mh(b,1024,1008,0)|0,(g|0)!=0):0){b=e+4|0;h=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(h|0));f[e>>2]=g;f[e+8>>2]=a;f[e+12>>2]=-1;f[e+48>>2]=1;Ya[f[(f[g>>2]|0)+28>>2]&7](g,e,f[c>>2]|0,1);if((f[e+24>>2]|0)==1){f[c>>2]=f[e+16>>2];i=1}else i=0;j=i}else j=0;else j=1;u=d;return j|0}function rj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;if(!c){d=0;return d|0}e=c+40|0;g=c+44|0;Nh((f[g>>2]|0)-(f[e>>2]|0)>>2,b)|0;h=f[e>>2]|0;e=f[g>>2]|0;if((h|0)!=(e|0)){g=h;do{h=f[g>>2]|0;if(h|0){Nh(f[h+40>>2]|0,b)|0;Wf(a,b,h)|0}g=g+4|0}while((g|0)!=(e|0))}Wf(a,b,c)|0;d=1;return d|0}function sj(a,c){a=a|0;c=c|0;var d=0;if(!c)return;sj(a,f[c>>2]|0);sj(a,f[c+4>>2]|0);a=c+16|0;d=c+28|0;if((b[d+11>>0]|0)<0)br(f[d>>2]|0);if((b[a+11>>0]|0)<0)br(f[a>>2]|0);br(c);return}function tj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;cf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e+(~((e+-4-c|0)>>>2)<<2)|0;f[d>>2]=h;g=h}f[a+24>>2]=0;f[a+28>>2]=0;if(c|0){if((g|0)!=(c|0))f[d>>2]=g+(~((g+-4-c|0)>>>2)<<2);br(c)}c=f[a>>2]|0;if(!c){u=b;return}g=a+4|0;a=f[g>>2]|0;if((a|0)!=(c|0))f[g>>2]=a+(~((a+-8-c|0)>>>3)<<3);br(c);u=b;return} -function $a(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0;b=u;u=u+16|0;c=b;do if(a>>>0<245){d=a>>>0<11?16:a+11&-8;e=d>>>3;g=f[4512]|0;h=g>>>e;if(h&3|0){i=(h&1^1)+e|0;j=18088+(i<<1<<2)|0;k=j+8|0;l=f[k>>2]|0;m=l+8|0;n=f[m>>2]|0;if((n|0)==(j|0))f[4512]=g&~(1<>2]=j;f[k>>2]=n}n=i<<3;f[l+4>>2]=n|3;i=l+n+4|0;f[i>>2]=f[i>>2]|1;o=m;u=b;return o|0}m=f[4514]|0;if(d>>>0>m>>>0){if(h|0){i=2<>>12&16;e=i>>>n;i=e>>>5&8;h=e>>>i;e=h>>>2&4;l=h>>>e;h=l>>>1&2;k=l>>>h;l=k>>>1&1;j=(i|n|e|h|l)+(k>>>l)|0;l=18088+(j<<1<<2)|0;k=l+8|0;h=f[k>>2]|0;e=h+8|0;n=f[e>>2]|0;if((n|0)==(l|0)){i=g&~(1<>2]=l;f[k>>2]=n;p=g}n=j<<3;j=n-d|0;f[h+4>>2]=d|3;k=h+d|0;f[k+4>>2]=j|1;f[h+n>>2]=j;if(m|0){n=f[4517]|0;h=m>>>3;l=18088+(h<<1<<2)|0;i=1<>2]|0;r=i}f[r>>2]=n;f[q+12>>2]=n;f[n+8>>2]=q;f[n+12>>2]=l}f[4514]=j;f[4517]=k;o=e;u=b;return o|0}e=f[4513]|0;if(e){k=(e&0-e)+-1|0;j=k>>>12&16;l=k>>>j;k=l>>>5&8;n=l>>>k;l=n>>>2&4;i=n>>>l;n=i>>>1&2;h=i>>>n;i=h>>>1&1;s=f[18352+((k|j|l|n|i)+(h>>>i)<<2)>>2]|0;i=(f[s+4>>2]&-8)-d|0;h=f[s+16+(((f[s+16>>2]|0)==0&1)<<2)>>2]|0;if(!h){t=s;v=i}else{n=s;s=i;i=h;while(1){h=(f[i+4>>2]&-8)-d|0;l=h>>>0>>0;j=l?h:s;h=l?i:n;i=f[i+16+(((f[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!i){t=h;v=j;break}else{n=h;s=j}}}s=t+d|0;if(s>>>0>t>>>0){n=f[t+24>>2]|0;i=f[t+12>>2]|0;do if((i|0)==(t|0)){j=t+20|0;h=f[j>>2]|0;if(!h){l=t+16|0;k=f[l>>2]|0;if(!k){w=0;break}else{x=k;y=l}}else{x=h;y=j}while(1){j=x+20|0;h=f[j>>2]|0;if(h|0){x=h;y=j;continue}j=x+16|0;h=f[j>>2]|0;if(!h)break;else{x=h;y=j}}f[y>>2]=0;w=x}else{j=f[t+8>>2]|0;f[j+12>>2]=i;f[i+8>>2]=j;w=i}while(0);do if(n|0){i=f[t+28>>2]|0;j=18352+(i<<2)|0;if((t|0)==(f[j>>2]|0)){f[j>>2]=w;if(!w){f[4513]=e&~(1<>2]|0)!=(t|0)&1)<<2)>>2]=w;if(!w)break}f[w+24>>2]=n;i=f[t+16>>2]|0;if(i|0){f[w+16>>2]=i;f[i+24>>2]=w}i=f[t+20>>2]|0;if(i|0){f[w+20>>2]=i;f[i+24>>2]=w}}while(0);if(v>>>0<16){n=v+d|0;f[t+4>>2]=n|3;e=t+n+4|0;f[e>>2]=f[e>>2]|1}else{f[t+4>>2]=d|3;f[s+4>>2]=v|1;f[s+v>>2]=v;if(m|0){e=f[4517]|0;n=m>>>3;i=18088+(n<<1<<2)|0;j=1<>2]|0;A=j}f[A>>2]=e;f[z+12>>2]=e;f[e+8>>2]=z;f[e+12>>2]=i}f[4514]=v;f[4517]=s}o=t+8|0;u=b;return o|0}else B=d}else B=d}else B=d}else if(a>>>0<=4294967231){i=a+11|0;e=i&-8;j=f[4513]|0;if(j){n=0-e|0;h=i>>>8;if(h)if(e>>>0>16777215)C=31;else{i=(h+1048320|0)>>>16&8;l=h<>>16&4;k=l<>>16&2;D=14-(h|i|l)+(k<>>15)|0;C=e>>>(D+7|0)&1|D<<1}else C=0;D=f[18352+(C<<2)>>2]|0;a:do if(!D){E=0;F=0;G=n;H=57}else{l=0;k=n;i=D;h=e<<((C|0)==31?0:25-(C>>>1)|0);I=0;while(1){J=(f[i+4>>2]&-8)-e|0;if(J>>>0>>0)if(!J){K=0;L=i;M=i;H=61;break a}else{N=i;O=J}else{N=l;O=k}J=f[i+20>>2]|0;i=f[i+16+(h>>>31<<2)>>2]|0;P=(J|0)==0|(J|0)==(i|0)?I:J;J=(i|0)==0;if(J){E=P;F=N;G=O;H=57;break}else{l=N;k=O;h=h<<((J^1)&1);I=P}}}while(0);if((H|0)==57){if((E|0)==0&(F|0)==0){D=2<>>12&16;d=D>>>n;D=d>>>5&8;s=d>>>D;d=s>>>2&4;g=s>>>d;s=g>>>1&2;m=g>>>s;g=m>>>1&1;Q=0;R=f[18352+((D|n|d|s|g)+(m>>>g)<<2)>>2]|0}else{Q=F;R=E}if(!R){S=Q;T=G}else{K=G;L=R;M=Q;H=61}}if((H|0)==61)while(1){H=0;g=(f[L+4>>2]&-8)-e|0;m=g>>>0>>0;s=m?g:K;g=m?L:M;L=f[L+16+(((f[L+16>>2]|0)==0&1)<<2)>>2]|0;if(!L){S=g;T=s;break}else{K=s;M=g;H=61}}if((S|0)!=0?T>>>0<((f[4514]|0)-e|0)>>>0:0){g=S+e|0;if(g>>>0<=S>>>0){o=0;u=b;return o|0}s=f[S+24>>2]|0;m=f[S+12>>2]|0;do if((m|0)==(S|0)){d=S+20|0;n=f[d>>2]|0;if(!n){D=S+16|0;I=f[D>>2]|0;if(!I){U=0;break}else{V=I;W=D}}else{V=n;W=d}while(1){d=V+20|0;n=f[d>>2]|0;if(n|0){V=n;W=d;continue}d=V+16|0;n=f[d>>2]|0;if(!n)break;else{V=n;W=d}}f[W>>2]=0;U=V}else{d=f[S+8>>2]|0;f[d+12>>2]=m;f[m+8>>2]=d;U=m}while(0);do if(s){m=f[S+28>>2]|0;d=18352+(m<<2)|0;if((S|0)==(f[d>>2]|0)){f[d>>2]=U;if(!U){d=j&~(1<>2]|0)!=(S|0)&1)<<2)>>2]=U;if(!U){X=j;break}}f[U+24>>2]=s;d=f[S+16>>2]|0;if(d|0){f[U+16>>2]=d;f[d+24>>2]=U}d=f[S+20>>2]|0;if(d){f[U+20>>2]=d;f[d+24>>2]=U;X=j}else X=j}else X=j;while(0);do if(T>>>0>=16){f[S+4>>2]=e|3;f[g+4>>2]=T|1;f[g+T>>2]=T;j=T>>>3;if(T>>>0<256){s=18088+(j<<1<<2)|0;d=f[4512]|0;m=1<>2]|0;Z=m}f[Z>>2]=g;f[Y+12>>2]=g;f[g+8>>2]=Y;f[g+12>>2]=s;break}s=T>>>8;if(s)if(T>>>0>16777215)_=31;else{m=(s+1048320|0)>>>16&8;d=s<>>16&4;j=d<>>16&2;n=14-(s|m|d)+(j<>>15)|0;_=T>>>(n+7|0)&1|n<<1}else _=0;n=18352+(_<<2)|0;f[g+28>>2]=_;d=g+16|0;f[d+4>>2]=0;f[d>>2]=0;d=1<<_;if(!(X&d)){f[4513]=X|d;f[n>>2]=g;f[g+24>>2]=n;f[g+12>>2]=g;f[g+8>>2]=g;break}d=T<<((_|0)==31?0:25-(_>>>1)|0);j=f[n>>2]|0;while(1){if((f[j+4>>2]&-8|0)==(T|0)){H=97;break}$=j+16+(d>>>31<<2)|0;n=f[$>>2]|0;if(!n){H=96;break}else{d=d<<1;j=n}}if((H|0)==96){f[$>>2]=g;f[g+24>>2]=j;f[g+12>>2]=g;f[g+8>>2]=g;break}else if((H|0)==97){d=j+8|0;n=f[d>>2]|0;f[n+12>>2]=g;f[d>>2]=g;f[g+8>>2]=n;f[g+12>>2]=j;f[g+24>>2]=0;break}}else{n=T+e|0;f[S+4>>2]=n|3;d=S+n+4|0;f[d>>2]=f[d>>2]|1}while(0);o=S+8|0;u=b;return o|0}else B=e}else B=e}else B=-1;while(0);S=f[4514]|0;if(S>>>0>=B>>>0){T=S-B|0;$=f[4517]|0;if(T>>>0>15){_=$+B|0;f[4517]=_;f[4514]=T;f[_+4>>2]=T|1;f[$+S>>2]=T;f[$+4>>2]=B|3}else{f[4514]=0;f[4517]=0;f[$+4>>2]=S|3;T=$+S+4|0;f[T>>2]=f[T>>2]|1}o=$+8|0;u=b;return o|0}$=f[4515]|0;if($>>>0>B>>>0){T=$-B|0;f[4515]=T;S=f[4518]|0;_=S+B|0;f[4518]=_;f[_+4>>2]=T|1;f[S+4>>2]=B|3;o=S+8|0;u=b;return o|0}if(!(f[4630]|0)){f[4632]=4096;f[4631]=4096;f[4633]=-1;f[4634]=-1;f[4635]=0;f[4623]=0;f[4630]=c&-16^1431655768;aa=4096}else aa=f[4632]|0;c=B+48|0;S=B+47|0;T=aa+S|0;_=0-aa|0;aa=T&_;if(aa>>>0<=B>>>0){o=0;u=b;return o|0}X=f[4622]|0;if(X|0?(Y=f[4620]|0,Z=Y+aa|0,Z>>>0<=Y>>>0|Z>>>0>X>>>0):0){o=0;u=b;return o|0}b:do if(!(f[4623]&4)){X=f[4518]|0;c:do if(X){Z=18496;while(1){Y=f[Z>>2]|0;if(Y>>>0<=X>>>0?(ba=Z+4|0,(Y+(f[ba>>2]|0)|0)>>>0>X>>>0):0)break;Y=f[Z+8>>2]|0;if(!Y){H=118;break c}else Z=Y}j=T-$&_;if(j>>>0<2147483647){Y=Fl(j|0)|0;if((Y|0)==((f[Z>>2]|0)+(f[ba>>2]|0)|0))if((Y|0)==(-1|0))ca=j;else{da=j;ea=Y;H=135;break b}else{fa=Y;ga=j;H=126}}else ca=0}else H=118;while(0);do if((H|0)==118){X=Fl(0)|0;if((X|0)!=(-1|0)?(e=X,j=f[4631]|0,Y=j+-1|0,U=((Y&e|0)==0?0:(Y+e&0-j)-e|0)+aa|0,e=f[4620]|0,j=U+e|0,U>>>0>B>>>0&U>>>0<2147483647):0){Y=f[4622]|0;if(Y|0?j>>>0<=e>>>0|j>>>0>Y>>>0:0){ca=0;break}Y=Fl(U|0)|0;if((Y|0)==(X|0)){da=U;ea=X;H=135;break b}else{fa=Y;ga=U;H=126}}else ca=0}while(0);do if((H|0)==126){U=0-ga|0;if(!(c>>>0>ga>>>0&(ga>>>0<2147483647&(fa|0)!=(-1|0))))if((fa|0)==(-1|0)){ca=0;break}else{da=ga;ea=fa;H=135;break b}Y=f[4632]|0;X=S-ga+Y&0-Y;if(X>>>0>=2147483647){da=ga;ea=fa;H=135;break b}if((Fl(X|0)|0)==(-1|0)){Fl(U|0)|0;ca=0;break}else{da=X+ga|0;ea=fa;H=135;break b}}while(0);f[4623]=f[4623]|4;ha=ca;H=133}else{ha=0;H=133}while(0);if(((H|0)==133?aa>>>0<2147483647:0)?(ca=Fl(aa|0)|0,aa=Fl(0)|0,fa=aa-ca|0,ga=fa>>>0>(B+40|0)>>>0,!((ca|0)==(-1|0)|ga^1|ca>>>0>>0&((ca|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){da=ga?fa:ha;ea=ca;H=135}if((H|0)==135){ca=(f[4620]|0)+da|0;f[4620]=ca;if(ca>>>0>(f[4621]|0)>>>0)f[4621]=ca;ca=f[4518]|0;do if(ca){ha=18496;while(1){ia=f[ha>>2]|0;ja=ha+4|0;ka=f[ja>>2]|0;if((ea|0)==(ia+ka|0)){H=143;break}fa=f[ha+8>>2]|0;if(!fa)break;else ha=fa}if(((H|0)==143?(f[ha+12>>2]&8|0)==0:0)?ea>>>0>ca>>>0&ia>>>0<=ca>>>0:0){f[ja>>2]=ka+da;fa=(f[4515]|0)+da|0;ga=ca+8|0;aa=(ga&7|0)==0?0:0-ga&7;ga=ca+aa|0;S=fa-aa|0;f[4518]=ga;f[4515]=S;f[ga+4>>2]=S|1;f[ca+fa+4>>2]=40;f[4519]=f[4634];break}if(ea>>>0<(f[4516]|0)>>>0)f[4516]=ea;fa=ea+da|0;S=18496;while(1){if((f[S>>2]|0)==(fa|0)){H=151;break}ga=f[S+8>>2]|0;if(!ga){la=18496;break}else S=ga}if((H|0)==151)if(!(f[S+12>>2]&8)){f[S>>2]=ea;ha=S+4|0;f[ha>>2]=(f[ha>>2]|0)+da;ha=ea+8|0;ga=ea+((ha&7|0)==0?0:0-ha&7)|0;ha=fa+8|0;aa=fa+((ha&7|0)==0?0:0-ha&7)|0;ha=ga+B|0;c=aa-ga-B|0;f[ga+4>>2]=B|3;do if((ca|0)!=(aa|0)){if((f[4517]|0)==(aa|0)){ba=(f[4514]|0)+c|0;f[4514]=ba;f[4517]=ha;f[ha+4>>2]=ba|1;f[ha+ba>>2]=ba;break}ba=f[aa+4>>2]|0;if((ba&3|0)==1){_=ba&-8;$=ba>>>3;d:do if(ba>>>0<256){T=f[aa+8>>2]|0;X=f[aa+12>>2]|0;if((X|0)==(T|0)){f[4512]=f[4512]&~(1<<$);break}else{f[T+12>>2]=X;f[X+8>>2]=T;break}}else{T=f[aa+24>>2]|0;X=f[aa+12>>2]|0;do if((X|0)==(aa|0)){U=aa+16|0;Y=U+4|0;j=f[Y>>2]|0;if(!j){e=f[U>>2]|0;if(!e){ma=0;break}else{na=e;oa=U}}else{na=j;oa=Y}while(1){Y=na+20|0;j=f[Y>>2]|0;if(j|0){na=j;oa=Y;continue}Y=na+16|0;j=f[Y>>2]|0;if(!j)break;else{na=j;oa=Y}}f[oa>>2]=0;ma=na}else{Y=f[aa+8>>2]|0;f[Y+12>>2]=X;f[X+8>>2]=Y;ma=X}while(0);if(!T)break;X=f[aa+28>>2]|0;Y=18352+(X<<2)|0;do if((f[Y>>2]|0)!=(aa|0)){f[T+16+(((f[T+16>>2]|0)!=(aa|0)&1)<<2)>>2]=ma;if(!ma)break d}else{f[Y>>2]=ma;if(ma|0)break;f[4513]=f[4513]&~(1<>2]=T;X=aa+16|0;Y=f[X>>2]|0;if(Y|0){f[ma+16>>2]=Y;f[Y+24>>2]=ma}Y=f[X+4>>2]|0;if(!Y)break;f[ma+20>>2]=Y;f[Y+24>>2]=ma}while(0);pa=aa+_|0;qa=_+c|0}else{pa=aa;qa=c}$=pa+4|0;f[$>>2]=f[$>>2]&-2;f[ha+4>>2]=qa|1;f[ha+qa>>2]=qa;$=qa>>>3;if(qa>>>0<256){ba=18088+($<<1<<2)|0;Z=f[4512]|0;Y=1<<$;if(!(Z&Y)){f[4512]=Z|Y;ra=ba;sa=ba+8|0}else{Y=ba+8|0;ra=f[Y>>2]|0;sa=Y}f[sa>>2]=ha;f[ra+12>>2]=ha;f[ha+8>>2]=ra;f[ha+12>>2]=ba;break}ba=qa>>>8;do if(!ba)ta=0;else{if(qa>>>0>16777215){ta=31;break}Y=(ba+1048320|0)>>>16&8;Z=ba<>>16&4;X=Z<<$;Z=(X+245760|0)>>>16&2;j=14-($|Y|Z)+(X<>>15)|0;ta=qa>>>(j+7|0)&1|j<<1}while(0);ba=18352+(ta<<2)|0;f[ha+28>>2]=ta;_=ha+16|0;f[_+4>>2]=0;f[_>>2]=0;_=f[4513]|0;j=1<>2]=ha;f[ha+24>>2]=ba;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}j=qa<<((ta|0)==31?0:25-(ta>>>1)|0);_=f[ba>>2]|0;while(1){if((f[_+4>>2]&-8|0)==(qa|0)){H=192;break}ua=_+16+(j>>>31<<2)|0;ba=f[ua>>2]|0;if(!ba){H=191;break}else{j=j<<1;_=ba}}if((H|0)==191){f[ua>>2]=ha;f[ha+24>>2]=_;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}else if((H|0)==192){j=_+8|0;ba=f[j>>2]|0;f[ba+12>>2]=ha;f[j>>2]=ha;f[ha+8>>2]=ba;f[ha+12>>2]=_;f[ha+24>>2]=0;break}}else{ba=(f[4515]|0)+c|0;f[4515]=ba;f[4518]=ha;f[ha+4>>2]=ba|1}while(0);o=ga+8|0;u=b;return o|0}else la=18496;while(1){ha=f[la>>2]|0;if(ha>>>0<=ca>>>0?(va=ha+(f[la+4>>2]|0)|0,va>>>0>ca>>>0):0)break;la=f[la+8>>2]|0}ga=va+-47|0;ha=ga+8|0;c=ga+((ha&7|0)==0?0:0-ha&7)|0;ha=ca+16|0;ga=c>>>0>>0?ca:c;c=ga+8|0;aa=da+-40|0;fa=ea+8|0;S=(fa&7|0)==0?0:0-fa&7;fa=ea+S|0;ba=aa-S|0;f[4518]=fa;f[4515]=ba;f[fa+4>>2]=ba|1;f[ea+aa+4>>2]=40;f[4519]=f[4634];aa=ga+4|0;f[aa>>2]=27;f[c>>2]=f[4624];f[c+4>>2]=f[4625];f[c+8>>2]=f[4626];f[c+12>>2]=f[4627];f[4624]=ea;f[4625]=da;f[4627]=0;f[4626]=c;c=ga+24|0;do{ba=c;c=c+4|0;f[c>>2]=7}while((ba+8|0)>>>0>>0);if((ga|0)!=(ca|0)){c=ga-ca|0;f[aa>>2]=f[aa>>2]&-2;f[ca+4>>2]=c|1;f[ga>>2]=c;ba=c>>>3;if(c>>>0<256){fa=18088+(ba<<1<<2)|0;S=f[4512]|0;j=1<>2]|0;xa=j}f[xa>>2]=ca;f[wa+12>>2]=ca;f[ca+8>>2]=wa;f[ca+12>>2]=fa;break}fa=c>>>8;if(fa)if(c>>>0>16777215)ya=31;else{j=(fa+1048320|0)>>>16&8;S=fa<>>16&4;ba=S<>>16&2;Z=14-(fa|j|S)+(ba<>>15)|0;ya=c>>>(Z+7|0)&1|Z<<1}else ya=0;Z=18352+(ya<<2)|0;f[ca+28>>2]=ya;f[ca+20>>2]=0;f[ha>>2]=0;S=f[4513]|0;ba=1<>2]=ca;f[ca+24>>2]=Z;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}ba=c<<((ya|0)==31?0:25-(ya>>>1)|0);S=f[Z>>2]|0;while(1){if((f[S+4>>2]&-8|0)==(c|0)){H=213;break}za=S+16+(ba>>>31<<2)|0;Z=f[za>>2]|0;if(!Z){H=212;break}else{ba=ba<<1;S=Z}}if((H|0)==212){f[za>>2]=ca;f[ca+24>>2]=S;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}else if((H|0)==213){ba=S+8|0;c=f[ba>>2]|0;f[c+12>>2]=ca;f[ba>>2]=ca;f[ca+8>>2]=c;f[ca+12>>2]=S;f[ca+24>>2]=0;break}}}else{c=f[4516]|0;if((c|0)==0|ea>>>0>>0)f[4516]=ea;f[4624]=ea;f[4625]=da;f[4627]=0;f[4521]=f[4630];f[4520]=-1;f[4525]=18088;f[4524]=18088;f[4527]=18096;f[4526]=18096;f[4529]=18104;f[4528]=18104;f[4531]=18112;f[4530]=18112;f[4533]=18120;f[4532]=18120;f[4535]=18128;f[4534]=18128;f[4537]=18136;f[4536]=18136;f[4539]=18144;f[4538]=18144;f[4541]=18152;f[4540]=18152;f[4543]=18160;f[4542]=18160;f[4545]=18168;f[4544]=18168;f[4547]=18176;f[4546]=18176;f[4549]=18184;f[4548]=18184;f[4551]=18192;f[4550]=18192;f[4553]=18200;f[4552]=18200;f[4555]=18208;f[4554]=18208;f[4557]=18216;f[4556]=18216;f[4559]=18224;f[4558]=18224;f[4561]=18232;f[4560]=18232;f[4563]=18240;f[4562]=18240;f[4565]=18248;f[4564]=18248;f[4567]=18256;f[4566]=18256;f[4569]=18264;f[4568]=18264;f[4571]=18272;f[4570]=18272;f[4573]=18280;f[4572]=18280;f[4575]=18288;f[4574]=18288;f[4577]=18296;f[4576]=18296;f[4579]=18304;f[4578]=18304;f[4581]=18312;f[4580]=18312;f[4583]=18320;f[4582]=18320;f[4585]=18328;f[4584]=18328;f[4587]=18336;f[4586]=18336;c=da+-40|0;ba=ea+8|0;ha=(ba&7|0)==0?0:0-ba&7;ba=ea+ha|0;ga=c-ha|0;f[4518]=ba;f[4515]=ga;f[ba+4>>2]=ga|1;f[ea+c+4>>2]=40;f[4519]=f[4634]}while(0);ea=f[4515]|0;if(ea>>>0>B>>>0){da=ea-B|0;f[4515]=da;ea=f[4518]|0;ca=ea+B|0;f[4518]=ca;f[ca+4>>2]=da|1;f[ea+4>>2]=B|3;o=ea+8|0;u=b;return o|0}}ea=ir()|0;f[ea>>2]=12;o=0;u=b;return o|0}function ab(a,c,d,e,g,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,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b=-1;jb=rb;while(1){eb=hb+-1|0;sb=Da+eb|0;ib=jb;jb=b[sb>>0]|0;if((jb&255)<(ib&255))break;if((sb|0)==(n|0)){tb=86;break d}else hb=eb}eb=Da+hb|0;if((jb&255)<(rb&255)){ub=Ja;vb=rb}else{ib=Da;gb=Ja;while(1){fb=gb+-1|0;if((jb&255)<(h[ib+-2>>0]|0)){ub=fb;vb=1;break}else{wb=gb;gb=fb;ib=wb}}}b[sb>>0]=vb;b[ub>>0]=jb;if((hb|0)<-1){xb=eb;yb=Ja}else continue;while(1){ib=b[xb>>0]|0;b[xb>>0]=b[yb>>0]|0;b[yb>>0]=ib;ib=xb+1|0;gb=yb+-1|0;if(ib>>>0>>0){xb=ib;yb=gb}else continue d}}if(((tb|0)==86?(tb=0,Oa):0)?(eb=b[n>>0]|0,b[n>>0]=rb,b[Ja>>0]=eb,Ra):0){eb=Pa;hb=ma;do{jb=b[hb>>0]|0;b[hb>>0]=b[eb>>0]|0;b[eb>>0]=jb;hb=hb+1|0;eb=eb+-1|0}while(hb>>>0>>0)}if((db|0)>=(Ka|0)){Xa=La;Ya=Ia;Za=La;_a=Ia;$a=Qa;ab=Ca;bb=Ia;break}else db=db+1|0}}if(Ba){db=f[Z>>2]|0;Ia=o+(Ka+-1<<3)|0;Ca=Ia;Qa=Tn(f[Ca>>2]|0,f[Ca+4>>2]|0,db|0,((db|0)<0)<<31>>31|0)|0;db=Ia;f[db>>2]=Qa;f[db+4>>2]=I}if(T){db=f[ba>>2]|0;Qa=f[C>>2]|0;Ia=0;do{Ca=f[db+(Ia<<2)>>2]|0;f[Qa+(Ia<<2)>>2]=Ca<<1^Ca>>31;Ia=Ia+1|0}while((Ia|0)!=(g|0));zb=Qa}else zb=f[C>>2]|0;go(j,$,zb,g);if(Ba){Qa=Ka+-1|0;Ab=a+60+(Qa*12|0)|0;Ia=a+60+(Qa*12|0)+4|0;db=a+60+(Qa*12|0)+8|0;Qa=0;do{Ca=f[Ia>>2]|0;La=f[db>>2]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=0;while(1){kb=(f[hb+(ib<<2)>>2]|0)-(f[Ba+(ib<<2)>>2]|0)|0;jb=((kb|0)>-1?kb:0-kb|0)+gb|0;f[Oa+(ib<<2)>>2]=kb;f[pb+(ib<<2)>>2]=kb<<1^kb>>31;ib=ib+1|0;if((ib|0)==(g|0)){qb=jb;rb=pb;break}else gb=jb}}else{qb=0;rb=f[Z>>2]|0}while(0);ho(j,_,rb,g);hb=Tk(j)|0;gb=I;ib=om(j)|0;jb=Tn(ib|0,I|0,hb|0,gb|0)|0;gb=I;if(oa){hb=Ma;ib=Tn(f[hb>>2]|0,f[hb+4>>2]|0,fb|0,0)|0;hb=Fa;kb=f[hb>>2]|0;lb=f[hb+4>>2]|0;Va=+W(+(+jm(kb,ib)*(+(kb>>>0)+4294967296.0*+(lb|0))));lb=Tn(jb|0,gb|0,~~Va>>>0|0,(+K(Va)>=1.0?(Va>0.0?~~+Y(+J(Va/4294967296.0),4294967295.0)>>>0:~~+W((Va-+(~~Va>>>0))/4294967296.0)>>>0):0)|0)|0;sb=lb}else sb=jb;jb=f[r>>2]|0;if(!((sb|0)>=(jb|0)?!((sb|0)<=(jb|0)?(qb|0)<(f[T>>2]|0):0):0)){jb=r;f[jb>>2]=sb;f[jb+4>>2]=qb;b[U>>0]=nb;f[V>>2]=fb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[k>>2]=f[v>>2];f[j>>2]=f[w>>2];tf($,k,j);f[x>>2]=Aa;f[y>>2]=Na;f[k>>2]=f[x>>2];f[j>>2]=f[y>>2];tf(aa,k,j)}if(Pa)break;tb=b[Ea>>0]|0;jb=-1;lb=tb;while(1){gb=jb+-1|0;ub=Ga+gb|0;kb=lb;lb=b[ub>>0]|0;if((lb&255)<(kb&255))break;if((ub|0)==(n|0)){vb=86;break d}else jb=gb}gb=Ga+jb|0;if((lb&255)<(tb&255)){wb=Ea;xb=tb}else{kb=Ga;ib=Ea;while(1){hb=ib+-1|0;if((lb&255)<(h[kb+-2>>0]|0)){w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>>>2)<<2);br(oa)}if((pa|0)<=2){Ib=_a;Jb=Za;break a}oa=f[B>>2]|0;ra=f[oa>>2]|0;Aa=qa+-1|0;if((f[oa+4>>2]|0)-ra>>2>>>0<=Aa>>>0){za=oa;vb=18;break}else{oa=qa;qa=Aa;sa=bb;ta=ab;ua=$a;va=_a;wa=Za;xa=Ya;ya=Xa;pa=oa}}if((vb|0)==18)mq(za);else if((vb|0)==114)mq(Cb);else if((vb|0)==119)mq(Cb)}else{Ib=M;Jb=N}while(0);N=f[l>>2]|0;if((g|0)>0?(f[N>>2]=0,(g|0)!=1):0){M=1;do{f[N+(M<<2)>>2]=0;M=M+1|0}while((M|0)!=(g|0))}g=f[z>>2]|0;if((g|0)>0){M=a+16|0;Cb=a+32|0;za=a+12|0;pa=a+28|0;Xa=a+20|0;ya=a+24|0;a=0;Ya=N;N=g;while(1){if((N|0)>0){g=0;do{xa=f[Ya+(g<<2)>>2]|0;Za=f[M>>2]|0;if((xa|0)>(Za|0)){wa=f[Cb>>2]|0;f[wa+(g<<2)>>2]=Za;Kb=wa}else{wa=f[za>>2]|0;Za=f[Cb>>2]|0;f[Za+(g<<2)>>2]=(xa|0)<(wa|0)?wa:xa;Kb=Za}g=g+1|0}while((g|0)<(f[z>>2]|0));Lb=Kb}else Lb=f[Cb>>2]|0;g=(f[c+(a<<2)>>2]|0)-(f[Lb+(a<<2)>>2]|0)|0;Za=d+(a<<2)|0;f[Za>>2]=g;if((g|0)>=(f[pa>>2]|0)){if((g|0)>(f[ya>>2]|0)){Mb=g-(f[Xa>>2]|0)|0;vb=145}}else{Mb=(f[Xa>>2]|0)+g|0;vb=145}if((vb|0)==145){vb=0;f[Za>>2]=Mb}a=a+1|0;N=f[z>>2]|0;if((a|0)>=(N|0))break;else Ya=Lb}}if(Ib|0){if((Jb|0)!=(Ib|0))f[H>>2]=Jb+(~((Jb+-4-Ib|0)>>>2)<<2);br(Ib)}Ib=f[m>>2]|0;if(Ib|0){m=f[E>>2]|0;if((m|0)!=(Ib|0))f[E>>2]=m+(~((m+-4-Ib|0)>>>2)<<2);br(Ib)}Ib=f[l+36>>2]|0;if(Ib|0){m=l+40|0;E=f[m>>2]|0;if((E|0)!=(Ib|0))f[m>>2]=E+(~((E+-4-Ib|0)>>>2)<<2);br(Ib)}Ib=f[l+24>>2]|0;if(Ib|0){E=l+28|0;m=f[E>>2]|0;if((m|0)!=(Ib|0))f[E>>2]=m+(~((m+-4-Ib|0)>>>2)<<2);br(Ib)}Ib=f[l+12>>2]|0;if(Ib|0){m=l+16|0;E=f[m>>2]|0;if((E|0)!=(Ib|0))f[m>>2]=E+(~((E+-4-Ib|0)>>>2)<<2);br(Ib)}Ib=f[l>>2]|0;if(!Ib){u=i;return 1}E=l+4|0;l=f[E>>2]|0;if((l|0)!=(Ib|0))f[E>>2]=l+(~((l+-4-Ib|0)>>>2)<<2);br(Ib);u=i;return 1}function cb(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;b=u;u=u+16|0;c=b;d=b+8|0;e=b+4|0;f[d>>2]=a;do if(a>>>0>=212){g=(a>>>0)/210|0;h=g*210|0;f[e>>2]=a-h;i=0;j=g;g=(zl(6640,6832,e,c)|0)-6640>>2;k=h;a:while(1){l=(f[6640+(g<<2)>>2]|0)+k|0;h=5;while(1){if(h>>>0>=47){m=211;n=i;o=8;break}p=f[6448+(h<<2)>>2]|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0

>>0){o=106;break a}if((l|0)==(X(q,p)|0)){r=i;break}else h=h+1|0}b:do if((o|0)==8){c:while(1){o=0;h=(l>>>0)/(m>>>0)|0;do if(h>>>0>=m>>>0)if((l|0)!=(X(h,m)|0)){p=m+10|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0>=p>>>0)if((l|0)!=(X(q,p)|0)){q=m+12|0;s=(l>>>0)/(q>>>0)|0;if(s>>>0>=q>>>0)if((l|0)!=(X(s,q)|0)){s=m+16|0;t=(l>>>0)/(s>>>0)|0;if(t>>>0>=s>>>0)if((l|0)!=(X(t,s)|0)){t=m+18|0;v=(l>>>0)/(t>>>0)|0;if(v>>>0>=t>>>0)if((l|0)!=(X(v,t)|0)){v=m+22|0;w=(l>>>0)/(v>>>0)|0;if(w>>>0>=v>>>0)if((l|0)!=(X(w,v)|0)){w=m+28|0;x=(l>>>0)/(w>>>0)|0;if(x>>>0>=w>>>0)if((l|0)==(X(x,w)|0)){y=w;z=9;A=n}else{x=m+30|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+36|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+40|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+42|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+46|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+52|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+58|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+60|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+66|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+70|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+72|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+78|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+82|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+88|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+96|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+100|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+102|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+106|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+108|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+112|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+120|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+126|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+130|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+136|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+138|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+142|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+148|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+150|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+156|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+162|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+166|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+168|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+172|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+178|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+180|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+186|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+190|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+192|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+196|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+198|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+208|0;B=(l>>>0)/(x>>>0)|0;C=B>>>0>>0;D=(l|0)==(X(B,x)|0);y=C|D?x:m+210|0;z=C?1:D?9:0;A=C?l:n}else{y=w;z=1;A=l}}else{y=v;z=9;A=n}else{y=v;z=1;A=l}}else{y=t;z=9;A=n}else{y=t;z=1;A=l}}else{y=s;z=9;A=n}else{y=s;z=1;A=l}}else{y=q;z=9;A=n}else{y=q;z=1;A=l}}else{y=p;z=9;A=n}else{y=p;z=1;A=l}}else{y=m;z=9;A=n}else{y=m;z=1;A=l}while(0);switch(z&15){case 9:{r=A;break b;break}case 0:{m=y;n=A;o=8;break}default:break c}}if(!z)r=A;else{o=107;break a}}while(0);h=g+1|0;p=(h|0)==48;q=j+(p&1)|0;i=r;j=q;g=p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ta)>=1.0?(Ta>0.0?~~+Y(+J(Ta/4294967296.0),4294967295.0)>>>0:~~+W((Ta-+(~~Ta>>>0))/4294967296.0)>>>0):0)|0)|0;ob=hb}else ob=fb;fb=f[r>>2]|0;if(!((ob|0)>=(fb|0)?!((ob|0)<=(fb|0)?(mb|0)<(f[U>>2]|0):0):0)){fb=r;f[fb>>2]=ob;f[fb+4>>2]=mb;b[V>>0]=jb;f[Z>>2]=bb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[j>>2]=f[v>>2];f[e>>2]=f[w>>2];tf(aa,j,e);f[x>>2]=Aa;f[y>>2]=Oa;f[j>>2]=f[x>>2];f[e>>2]=f[y>>2];tf(ba,j,e)}if(Ka)break;pb=b[Ha>>0]|0;fb=-1;hb=pb;while(1){cb=fb+-1|0;qb=Ba+cb|0;gb=hb;hb=b[qb>>0]|0;if((hb&255)<(gb&255))break;if((qb|0)==(n|0)){rb=86;break d}else fb=cb}cb=Ba+fb|0;if((hb&255)<(pb&255)){sb=Ha;tb=pb}else{gb=Ba;eb=Ha;while(1){db=eb+-1|0;if((hb&255)<(h[gb+-2>>0]|0)){sb=db;tb=1;break}else{ub=eb;eb=db;gb=ub}}}b[qb>>0]=tb;b[sb>>0]=hb;if((fb|0)<-1){vb=cb;wb=Ha}else continue;while(1){gb=b[vb>>0]|0;b[vb>>0]=b[wb>>0]|0;b[wb>>0]=gb;gb=vb+1|0;eb=wb+-1|0;if(gb>>>0>>0){vb=gb;wb=eb}else continue d}}if(((rb|0)==86?(rb=0,Ma):0)?(cb=b[n>>0]|0,b[n>>0]=pb,b[Ha>>0]=cb,Pa):0){cb=Na;fb=ka;do{hb=b[fb>>0]|0;b[fb>>0]=b[cb>>0]|0;b[cb>>0]=hb;fb=fb+1|0;cb=cb+-1|0}while(fb>>>0>>0)}if((bb|0)>=(Ia|0)){Va=Ja;Wa=Ga;Xa=Ja;Ya=Ga;Za=Oa;_a=Aa;$a=Ga;break}else bb=bb+1|0}}if(za){bb=f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while(1){cb=cb+1|0;hj(n|0,1,ab|0)|0;hj(n|0,0,cb|0)|0;d:while(1){if(S){hj(f[m>>2]|0,0,ka|0)|0;eb=f[m>>2]|0;fb=0;gb=0;while(1){if(!(b[n+fb>>0]|0)){hb=f[l+(fb*12|0)>>2]|0;ib=0;do{jb=eb+(ib<<2)|0;f[jb>>2]=(f[jb>>2]|0)+(f[hb+(ib<<2)>>2]|0);ib=ib+1|0}while((ib|0)!=(g|0));kb=(1<>0]|0))mb=(1<>2]|0;do if(S){f[fb>>2]=(f[fb>>2]|0)/(db|0)|0;if(!la){gb=1;do{eb=fb+(gb<<2)|0;f[eb>>2]=(f[eb>>2]|0)/(db|0)|0;gb=gb+1|0}while((gb|0)!=(g|0));gb=f[Z>>2]|0;if(S)nb=gb;else{ob=0;pb=gb;break}}else nb=f[Z>>2]|0;gb=0;eb=0;while(1){ib=(f[fb+(gb<<2)>>2]|0)-(f[za+(gb<<2)>>2]|0)|0;hb=((ib|0)>-1?ib:0-ib|0)+eb|0;f[Ma+(gb<<2)>>2]=ib;f[nb+(gb<<2)>>2]=ib<<1^ib>>31;gb=gb+1|0;if((gb|0)==(g|0)){ob=hb;pb=nb;break}else eb=hb}}else{ob=0;pb=f[Z>>2]|0}while(0);ho(e,_,pb,g);fb=Tk(e)|0;eb=I;gb=om(e)|0;hb=Tn(gb|0,I|0,fb|0,eb|0)|0;eb=I;if(ma){fb=Ka;gb=Tn(f[fb>>2]|0,f[fb+4>>2]|0,db|0,0)|0;fb=Da;ib=f[fb>>2]|0;jb=f[fb+4>>2]|0;Ta=+W(+(+jm(ib,gb)*(+(ib>>>0)+4294967296.0*+(jb|0))));jb=Tn(hb|0,eb|0,~~Ta>>>0|0,(+K(Ta)>=1.0?(Ta>0.0?~~+Y(+J(Ta/4294967296.0),4294967295.0)>>>0:~~+W((Ta-+(~~Ta>>>0))/4294967296.0)>>>0):0)|0)|0;qb=jb}else qb=hb;hb=f[r>>2]|0;if(!((qb|0)>=(hb|0)?!((qb|0)<=(hb|0)?(ob|0)<(f[T>>2]|0):0):0)){hb=r;f[hb>>2]=qb;f[hb+4>>2]=ob;b[U>>0]=lb;f[V>>2]=db;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[j>>2]=f[v>>2];f[e>>2]=f[w>>2];tf($,j,e);f[x>>2]=ya;f[y>>2]=La;f[j>>2]=f[x>>2];f[e>>2]=f[y>>2];tf(aa,j,e)}if(Na)break;rb=b[Ca>>0]|0;hb=-1;jb=rb;while(1){eb=hb+-1|0;sb=Ea+eb|0;ib=jb;jb=b[sb>>0]|0;if((jb&255)<(ib&255))break;if((sb|0)==(n|0)){tb=86;break d}else hb=eb}eb=Ea+hb|0;if((jb&255)<(rb&255)){ub=Ca;vb=rb}else{ib=Ea;gb=Ca;while(1){fb=gb+-1|0;if((jb&255)<(h[ib+-2>>0]|0)){ub=fb;vb=1;break}else{wb=gb;gb=fb;ib=wb}}}b[sb>>0]=vb;b[ub>>0]=jb;if((hb|0)<-1){xb=eb;yb=Ca}else continue;while(1){ib=b[xb>>0]|0;b[xb>>0]=b[yb>>0]|0;b[yb>>0]=ib;ib=xb+1|0;gb=yb+-1|0;if(ib>>>0>>0){xb=ib;yb=gb}else continue d}}if(((tb|0)==86?(tb=0,bb):0)?(eb=b[n>>0]|0,b[n>>0]=rb,b[Ca>>0]=eb,Ja):0){eb=Ga;hb=ja;do{jb=b[hb>>0]|0;b[hb>>0]=b[eb>>0]|0;b[eb>>0]=jb;hb=hb+1|0;eb=eb+-1|0}while(hb>>>0>>0)}if((db|0)>=(Fa|0)){Va=Ia;Wa=Ma;Xa=Ia;Ya=Ma;Za=La;_a=ya;$a=Ma;break}else db=db+1|0}}if(ma){db=f[V>>2]|0;Ma=o+(Fa+-1<<3)|0;ya=Ma;La=Tn(f[ya>>2]|0,f[ya+4>>2]|0,db|0,((db|0)<0)<<31>>31|0)|0;db=Ma;f[db>>2]=La;f[db+4>>2]=I}if(S){db=f[aa>>2]|0;La=f[C>>2]|0;Ma=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Ma)}if((na|0)<=2){Db=Ya;Eb=Xa;break a}Ma=f[B>>2]|0;wa=f[Ma>>2]|0;ya=oa+-1|0;if((f[Ma+4>>2]|0)-wa>>2>>>0<=ya>>>0){xa=Ma;tb=18;break}else{Ma=oa;oa=ya;pa=$a;qa=_a;ra=Za;sa=Ya;ta=Xa;ua=Wa;va=Va;na=Ma}}if((tb|0)==18)mq(xa);else if((tb|0)==101)mq(Ab);else if((tb|0)==106)mq(Ab)}else{Db=M;Eb=N}while(0);if((g|0)>0)hj(f[l>>2]|0,0,g<<2|0)|0;g=f[l>>2]|0;N=f[c+4>>2]|0;M=f[g>>2]|0;Ab=f[g+4>>2]|0;f[j>>2]=f[c>>2];f[j+4>>2]=N;f[k>>2]=M;f[k+4>>2]=Ab;Dd(e,a+8|0,j,k);f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];if(Db|0){if((Eb|0)!=(Db|0))f[H>>2]=Eb+(~((Eb+-4-Db|0)>>>2)<<2);br(Db)}Db=f[m>>2]|0;if(Db|0){m=f[E>>2]|0;if((m|0)!=(Db|0))f[E>>2]=m+(~((m+-4-Db|0)>>>2)<<2);br(Db)}Db=f[l+36>>2]|0;if(Db|0){m=l+40|0;E=f[m>>2]|0;if((E|0)!=(Db|0))f[m>>2]=E+(~((E+-4-Db|0)>>>2)<<2);br(Db)}Db=f[l+24>>2]|0;if(Db|0){E=l+28|0;m=f[E>>2]|0;if((m|0)!=(Db|0))f[E>>2]=m+(~((m+-4-Db|0)>>>2)<<2);br(Db)}Db=f[l+12>>2]|0;if(Db|0){m=l+16|0;E=f[m>>2]|0;if((E|0)!=(Db|0))f[m>>2]=E+(~((E+-4-Db|0)>>>2)<<2);br(Db)}Db=f[l>>2]|0;if(!Db){u=i;return 1}E=l+4|0;l=f[E>>2]|0;if((l|0)!=(Db|0))f[E>>2]=l+(~((l+-4-Db|0)>>>2)<<2);br(Db);u=i;return 1}function fb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0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]=N+4}N=f[l>>2]|0;R=f[j>>2]|0;if((N|0)==(R<<5|0)){if((N+1|0)<0){S=50;break a}T=R<<6;R=N+32&-32;hi(d,N>>>0<1073741823?(T>>>0>>0?R:T):2147483647);U=f[l>>2]|0}else U=N;f[l>>2]=U+1;N=(f[d>>2]|0)+(U>>>5<<2)|0;f[N>>2]=f[N>>2]&~(1<<(U&31));f[g>>2]=J;O=1;P=J+1|0;Q=J}N=f[d>>2]|0;T=N+(Q>>>5<<2)|0;f[T>>2]=f[T>>2]|1<<(Q&31);T=N;b:do if(O){R=M;while(1){if((R|0)==-1){S=64;break b}V=(f[e>>2]|0)+(R>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(R&31);V=f[g>>2]|0;f[(f[h>>2]|0)+(V<<2)>>2]=R;f[(f[a>>2]|0)+(R<<2)>>2]=V;V=R+1|0;W=((V>>>0)%3|0|0)==0?R+-2|0:V;do if((W|0)==-1)X=-1;else{V=f[(f[x>>2]|0)+(W<<2)>>2]|0;Y=V+1|0;if((V|0)==-1){X=-1;break}X=((Y>>>0)%3|0|0)==0?V+-2|0:Y}while(0);if((X|0)==(M|0))break;else R=X}}else{R=M;while(1){if((R|0)==-1){S=64;break b}W=(f[e>>2]|0)+(R>>>5<<2)|0;f[W>>2]=f[W>>2]|1<<(R&31);f[(f[h>>2]|0)+(f[g>>2]<<2)>>2]=R;W=R+1|0;Y=((W>>>0)%3|0|0)==0?R+-2|0:W;do if((Y|0)==-1)Z=-1;else{W=f[(f[x>>2]|0)+(Y<<2)>>2]|0;V=W+1|0;if((W|0)==-1){Z=-1;break}Z=((V>>>0)%3|0|0)==0?W+-2|0:V}while(0);if((Z|0)==(M|0))break;else R=Z}}while(0);c:do if((S|0)==64){S=0;if((M|0)==-1)break;R=(((M>>>0)%3|0|0)==0?2:-1)+M|0;if((R|0)==-1)break;Y=f[(f[x>>2]|0)+(R<<2)>>2]|0;if((Y|0)==-1)break;R=Y+(((Y>>>0)%3|0|0)==0?2:-1)|0;if((R|0)==-1)break;if(!O){Y=R;while(1){V=(f[e>>2]|0)+(Y>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(Y&31);V=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((V|0)==-1)break c;W=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((W|0)==-1)break c;Y=W+(((W>>>0)%3|0|0)==0?2:-1)|0;if((Y|0)==-1)break c}}Y=f[a>>2]|0;W=R;do{V=(f[e>>2]|0)+(W>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(W&31);f[Y+(W<<2)>>2]=f[g>>2];V=(((W>>>0)%3|0|0)==0?2:-1)+W|0;if((V|0)==-1)break c;_=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((_|0)==-1)break c;W=_+(((_>>>0)%3|0|0)==0?2:-1)|0}while((W|0)!=-1)}while(0);$=P;aa=T;ba=N}else{$=J;aa=I;ba=F}if((H|0)<2){H=H+1|0;J=$;F=ba;I=aa}else{ca=$;da=aa;ea=ba;break}}}else{ca=A;da=D;ea=E}}else{ca=A;da=D;ea=E}C=C+1|0;B=f[a>>2]|0;if(C>>>0>=(((f[m>>2]|0)-B>>2>>>0)/3|0)>>>0){S=18;break}else{A=ca;D=da;E=ea}}if((S|0)==18){fa=da;ga=f[l>>2]|0;break}else if((S|0)==50)mq(d)}else{fa=q;ga=p}}else{fa=q;ga=p}while(0);p=a+44|0;f[p>>2]=0;a=fa;fa=ga>>>5;q=a+(fa<<2)|0;S=ga&31;ga=(fa|0)!=0;d:do if(fa|S|0)if(!S){l=a;da=0;ea=ga;while(1){e:do if(ea){if(!(f[l>>2]&1)){ca=da+1|0;f[p>>2]=ca;ha=ca}else ha=da;if(!(f[l>>2]&2)){ca=ha+1|0;f[p>>2]=ca;ia=ca}else ia=ha;if(!(f[l>>2]&4)){ca=ia+1|0;f[p>>2]=ca;ja=ca}else ja=ia;if(!(f[l>>2]&8)){ca=ja+1|0;f[p>>2]=ca;ka=ca}else ka=ja;if(!(f[l>>2]&16)){ca=ka+1|0;f[p>>2]=ca;la=ca}else la=ka;if(!(f[l>>2]&32)){ca=la+1|0;f[p>>2]=ca;ma=ca}else ma=la;if(!(f[l>>2]&64)){ca=ma+1|0;f[p>>2]=ca;na=ca}else na=ma;if(!(f[l>>2]&128)){ca=na+1|0;f[p>>2]=ca;oa=ca}else oa=na;if(!(f[l>>2]&256)){ca=oa+1|0;f[p>>2]=ca;pa=ca}else pa=oa;if(!(f[l>>2]&512)){ca=pa+1|0;f[p>>2]=ca;qa=ca}else qa=pa;if(!(f[l>>2]&1024)){ca=qa+1|0;f[p>>2]=ca;ra=ca}else ra=qa;if(!(f[l>>2]&2048)){ca=ra+1|0;f[p>>2]=ca;sa=ca}else sa=ra;if(!(f[l>>2]&4096)){ca=sa+1|0;f[p>>2]=ca;ta=ca}else ta=sa;if(!(f[l>>2]&8192)){ca=ta+1|0;f[p>>2]=ca;ua=ca}else ua=ta;if(!(f[l>>2]&16384)){ca=ua+1|0;f[p>>2]=ca;va=ca}else va=ua;if(!(f[l>>2]&32768)){ca=va+1|0;f[p>>2]=ca;wa=ca}else wa=va;if(!(f[l>>2]&65536)){ca=wa+1|0;f[p>>2]=ca;xa=ca}else xa=wa;if(!(f[l>>2]&131072)){ca=xa+1|0;f[p>>2]=ca;ya=ca}else ya=xa;if(!(f[l>>2]&262144)){ca=ya+1|0;f[p>>2]=ca;za=ca}else za=ya;if(!(f[l>>2]&524288)){ca=za+1|0;f[p>>2]=ca;Aa=ca}else Aa=za;if(!(f[l>>2]&1048576)){ca=Aa+1|0;f[p>>2]=ca;Ba=ca}else Ba=Aa;if(!(f[l>>2]&2097152)){ca=Ba+1|0;f[p>>2]=ca;Ca=ca}else Ca=Ba;if(!(f[l>>2]&4194304)){ca=Ca+1|0;f[p>>2]=ca;Da=ca}else Da=Ca;if(!(f[l>>2]&8388608)){ca=Da+1|0;f[p>>2]=ca;Ea=ca}else Ea=Da;if(!(f[l>>2]&16777216)){ca=Ea+1|0;f[p>>2]=ca;Fa=ca}else Fa=Ea;if(!(f[l>>2]&33554432)){ca=Fa+1|0;f[p>>2]=ca;Ga=ca}else Ga=Fa;if(!(f[l>>2]&67108864)){ca=Ga+1|0;f[p>>2]=ca;Ha=ca}else Ha=Ga;if(!(f[l>>2]&134217728)){ca=Ha+1|0;f[p>>2]=ca;Ia=ca}else Ia=Ha;if(!(f[l>>2]&268435456)){ca=Ia+1|0;f[p>>2]=ca;Ja=ca}else Ja=Ia;if(!(f[l>>2]&536870912)){ca=Ja+1|0;f[p>>2]=ca;Ka=ca}else Ka=Ja;if(!(f[l>>2]&1073741824)){ca=Ka+1|0;f[p>>2]=ca;La=ca}else La=Ka;if((f[l>>2]|0)<=-1){Ma=La;break}ca=La+1|0;f[p>>2]=ca;Ma=ca}else{ca=0;m=da;while(1){if(!(f[l>>2]&1<>2]=ba;Na=ba}else Na=m;if((ca|0)==31){Ma=Na;break e}ca=ca+1|0;if(!ca)break d;else m=Na}}while(0);l=l+4|0;if((q|0)==(l|0))break;else{da=Ma;ea=1}}}else{if(ga){ea=0;da=a;l=0;while(1){if(!(f[da>>2]&1)){m=l+1|0;f[p>>2]=m;Oa=m;Pa=m}else{Oa=l;Pa=ea}if(!(f[da>>2]&2)){m=Oa+1|0;f[p>>2]=m;Qa=m;Ra=m}else{Qa=Oa;Ra=Pa}if(!(f[da>>2]&4)){m=Qa+1|0;f[p>>2]=m;Sa=m;Ta=m}else{Sa=Qa;Ta=Ra}if(!(f[da>>2]&8)){m=Sa+1|0;f[p>>2]=m;Ua=m;Va=m}else{Ua=Sa;Va=Ta}if(!(f[da>>2]&16)){m=Ua+1|0;f[p>>2]=m;Wa=m;Xa=m}else{Wa=Ua;Xa=Va}if(!(f[da>>2]&32)){m=Wa+1|0;f[p>>2]=m;Ya=m;Za=m}else{Ya=Wa;Za=Xa}if(!(f[da>>2]&64)){m=Ya+1|0;f[p>>2]=m;_a=m;$a=m}else{_a=Ya;$a=Za}if(!(f[da>>2]&128)){m=_a+1|0;f[p>>2]=m;ab=m;bb=m}else{ab=_a;bb=$a}if(!(f[da>>2]&256)){m=ab+1|0;f[p>>2]=m;cb=m;db=m}else{cb=ab;db=bb}if(!(f[da>>2]&512)){m=cb+1|0;f[p>>2]=m;eb=m;fb=m}else{eb=cb;fb=db}if(!(f[da>>2]&1024)){m=eb+1|0;f[p>>2]=m;gb=m;hb=m}else{gb=eb;hb=fb}if(!(f[da>>2]&2048)){m=gb+1|0;f[p>>2]=m;ib=m;jb=m}else{ib=gb;jb=hb}if(!(f[da>>2]&4096)){m=ib+1|0;f[p>>2]=m;kb=m;lb=m}else{kb=ib;lb=jb}if(!(f[da>>2]&8192)){m=kb+1|0;f[p>>2]=m;mb=m;nb=m}else{mb=kb;nb=lb}if(!(f[da>>2]&16384)){m=mb+1|0;f[p>>2]=m;ob=m;pb=m}else{ob=mb;pb=nb}if(!(f[da>>2]&32768)){m=ob+1|0;f[p>>2]=m;qb=m;rb=m}else{qb=ob;rb=pb}if(!(f[da>>2]&65536)){m=qb+1|0;f[p>>2]=m;sb=m;tb=m}else{sb=qb;tb=rb}if(!(f[da>>2]&131072)){m=sb+1|0;f[p>>2]=m;ub=m;vb=m}else{ub=sb;vb=tb}if(!(f[da>>2]&262144)){m=ub+1|0;f[p>>2]=m;wb=m;xb=m}else{wb=ub;xb=vb}if(!(f[da>>2]&524288)){m=wb+1|0;f[p>>2]=m;yb=m;zb=m}else{yb=wb;zb=xb}if(!(f[da>>2]&1048576)){m=yb+1|0;f[p>>2]=m;Ab=m;Bb=m}else{Ab=yb;Bb=zb}if(!(f[da>>2]&2097152)){m=Ab+1|0;f[p>>2]=m;Cb=m;Db=m}else{Cb=Ab;Db=Bb}if(!(f[da>>2]&4194304)){m=Cb+1|0;f[p>>2]=m;Eb=m;Fb=m}else{Eb=Cb;Fb=Db}if(!(f[da>>2]&8388608)){m=Eb+1|0;f[p>>2]=m;Gb=m;Hb=m}else{Gb=Eb;Hb=Fb}if(!(f[da>>2]&16777216)){m=Gb+1|0;f[p>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>>2]=0;la=dn(32)|0;f[d>>2]=la;f[x>>2]=-2147483616;f[q>>2]=17;ma=la;na=12932;oa=ma+17|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[la+17>>0]=0;pa=ka+16|0;qa=f[pa>>2]|0;if(qa){ra=pa;sa=qa;b:while(1){qa=sa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;ta=f[qa+4>>2]|0;if(!ta){ua=ra;break b}else qa=ta}sa=f[qa>>2]|0;if(!sa){ua=qa;break}else ra=qa}if(((ua|0)!=(pa|0)?(k|0)>=(f[ua+16>>2]|0):0)?(ra=ua+20|0,(sh(ra,d)|0)!=0):0)va=yk(ra,d,-1)|0;else wa=17}else wa=17;if((wa|0)==17){wa=0;va=yk(ka,d,-1)|0}if((b[w>>0]|0)<0)br(f[d>>2]|0);if((va|0)<1)xa=1;else{ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;sa=dn(32)|0;f[d>>2]=sa;f[z>>2]=-2147483616;f[A>>2]=19;ma=sa;na=13005;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[sa+19>>0]=0;ka=ra+16|0;pa=f[ka>>2]|0;if(pa){la=ka;ta=pa;c:while(1){pa=ta;while(1){if((f[pa+16>>2]|0)>=(k|0))break;ya=f[pa+4>>2]|0;if(!ya){za=la;break c}else pa=ya}ta=f[pa>>2]|0;if(!ta){za=pa;break}else la=pa}if((za|0)!=(ka|0)?(k|0)>=(f[za+16>>2]|0):0)Aa=za+20|0;else wa=29}else wa=29;if((wa|0)==29){wa=0;Aa=ra}if(!(sh(Aa,d)|0))Ba=0;else{la=f[(f[j>>2]|0)+48>>2]|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;ta=dn(32)|0;f[e>>2]=ta;f[X>>2]=-2147483616;f[Y>>2]=18;ma=ta;na=13025;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ta+18>>0]=0;ra=la+16|0;ka=f[ra>>2]|0;if(ka){sa=ra;qa=ka;d:while(1){ka=qa;while(1){if((f[ka+16>>2]|0)>=(k|0))break;ya=f[ka+4>>2]|0;if(!ya){Ca=sa;break d}else ka=ya}qa=f[ka>>2]|0;if(!qa){Ca=ka;break}else sa=ka}if((Ca|0)!=(ra|0)?(k|0)>=(f[Ca+16>>2]|0):0)Da=Ca+20|0;else wa=39}else wa=39;if((wa|0)==39){wa=0;Da=la}sa=(sh(Da,e)|0)!=0;if((b[Z>>0]|0)<0)br(f[e>>2]|0);Ba=sa}if((b[B>>0]|0)<0)br(f[d>>2]|0);if(Ba){sa=ja+24|0;qa=b[sa>>0]|0;ta=qa<<24>>24;f[h>>2]=0;f[C>>2]=0;f[D>>2]=0;if(!(qa<<24>>24))Ea=0;else{if(qa<<24>>24<0){wa=48;break a}qa=ta<<2;pa=dn(qa)|0;f[h>>2]=pa;ya=pa+(ta<<2)|0;f[O>>2]=ya;hj(pa|0,0,qa|0)|0;f[C>>2]=ya;Ea=pa}pa=f[(f[j>>2]|0)+48>>2]|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;ya=dn(32)|0;f[i>>2]=ya;f[E>>2]=-2147483616;f[F>>2]=19;ma=ya;na=13005;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+19>>0]=0;la=b[sa>>0]|0;ra=la<<24>>24;qa=pa+16|0;ta=f[qa>>2]|0;if(ta){Fa=qa;Ga=ta;e:while(1){ta=Ga;while(1){if((f[ta+16>>2]|0)>=(k|0))break;Ha=f[ta+4>>2]|0;if(!Ha){Ia=Fa;break e}else ta=Ha}Ga=f[ta>>2]|0;if(!Ga){Ia=ta;break}else Fa=ta}if(((Ia|0)!=(qa|0)?(k|0)>=(f[Ia+16>>2]|0):0)?(Fa=Ia+20|0,(sh(Fa,i)|0)!=0):0){Ga=zg(Fa,i)|0;if((Ga|0)!=(Ia+24|0)){dj(d,Ga+28|0);Ga=b[M>>0]|0;Fa=Ga<<24>>24<0;if(!((Fa?f[N>>2]|0:Ga&255)|0))Ja=Ga;else{if(la<<24>>24>0){ya=Fa?f[d>>2]|0:d;Fa=0;do{Ka=$(pq(ya,e));ka=ya;ya=f[e>>2]|0;if((ka|0)==(ya|0))break;n[Ea+(Fa<<2)>>2]=Ka;Fa=Fa+1|0}while((Fa|0)<(ra|0));La=b[M>>0]|0}else La=Ga;Ja=La}if(Ja<<24>>24<0)br(f[d>>2]|0)}}else wa=69}else wa=69;if((wa|0)==69?(wa=0,Fa=zg(pa,i)|0,(Fa|0)!=(pa+4|0)):0){dj(d,Fa+28|0);Fa=b[G>>0]|0;ya=Fa<<24>>24<0;if(!((ya?f[H>>2]|0:Fa&255)|0))Ma=Fa;else{if(la<<24>>24>0){qa=ya?f[d>>2]|0:d;ya=0;do{Ka=$(pq(qa,e));ka=qa;qa=f[e>>2]|0;if((ka|0)==(qa|0))break;n[Ea+(ya<<2)>>2]=Ka;ya=ya+1|0}while((ya|0)<(ra|0));Na=b[G>>0]|0}else Na=Fa;Ma=Na}if(Ma<<24>>24<0)br(f[d>>2]|0)}if((b[I>>0]|0)<0)br(f[i>>2]|0);ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;ya=dn(32)|0;f[d>>2]=ya;f[J>>2]=-2147483616;f[K>>2]=18;ma=ya;na=13025;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+18>>0]=0;na=ra+16|0;ma=f[na>>2]|0;do if(ma){oa=na;Fa=ma;f:while(1){qa=Fa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;la=f[qa+4>>2]|0;if(!la){Pa=oa;break f}else qa=la}Fa=f[qa>>2]|0;if(!Fa){Pa=qa;break}else oa=qa}if((Pa|0)!=(na|0)?(k|0)>=(f[Pa+16>>2]|0):0){oa=Pa+20|0;if(!(sh(oa,d)|0)){wa=91;break}Qa=$(kk(oa,d,$(1.0)))}else wa=91}else wa=91;while(0);if((wa|0)==91){wa=0;Qa=$(kk(ra,d,$(1.0)))}if((b[L>>0]|0)<0)br(f[d>>2]|0);wl(g,va,f[h>>2]|0,b[sa>>0]|0,Qa);k=f[h>>2]|0;if(k|0){na=f[C>>2]|0;if((na|0)!=(k|0))f[C>>2]=na+(~((na+-4-k|0)>>>2)<<2);br(k)}}else Kd(g,ja,va)|0;k=f[P>>2]|0;if((k|0)==(f[Q>>2]|0))of(R,g);else{f[k>>2]=1180;f[k+4>>2]=f[s>>2];Ra=k+8|0;f[Ra>>2]=0;na=k+12|0;f[na>>2]=0;f[k+16>>2]=0;ma=(f[y>>2]|0)-(f[V>>2]|0)|0;ya=ma>>2;if(ya|0){if(ya>>>0>1073741823){wa=103;break a}oa=dn(ma)|0;f[na>>2]=oa;f[Ra>>2]=oa;f[k+16>>2]=oa+(ya<<2);ya=f[V>>2]|0;ma=(f[y>>2]|0)-ya|0;if((ma|0)>0){Rg(oa|0,ya|0,ma|0)|0;f[na>>2]=oa+(ma>>>2<<2)}}f[k+20>>2]=f[W>>2];f[P>>2]=(f[P>>2]|0)+24}Re(d,g,ja,m);k=f[S>>2]|0;if(k>>>0<(f[T>>2]|0)>>>0){ma=f[d>>2]|0;f[d>>2]=0;f[k>>2]=ma;f[S>>2]=k+4}else Me(U,d);k=f[d>>2]|0;f[d>>2]=0;if(k|0){ma=k+88|0;oa=f[ma>>2]|0;f[ma>>2]=0;if(oa|0){ma=f[oa+8>>2]|0;if(ma|0){na=oa+12|0;if((f[na>>2]|0)!=(ma|0))f[na>>2]=ma;br(ma)}br(oa)}oa=f[k+68>>2]|0;if(oa|0){ma=k+72|0;na=f[ma>>2]|0;if((na|0)!=(oa|0))f[ma>>2]=na+(~((na+-4-oa|0)>>>2)<<2);br(oa)}oa=k+64|0;na=f[oa>>2]|0;f[oa>>2]=0;if(na|0){oa=f[na>>2]|0;if(oa|0){ma=na+4|0;if((f[ma>>2]|0)!=(oa|0))f[ma>>2]=oa;br(oa)}br(na)}br(k)}xa=0}f[g>>2]=1180;k=f[r>>2]|0;if(k|0){na=f[y>>2]|0;if((na|0)!=(k|0))f[y>>2]=na+(~((na+-4-k|0)>>>2)<<2);br(k)}if(xa|0){v=0;wa=169;break a}break}case 1:case 3:case 5:{k=ja+24|0;na=b[k>>0]|0;oa=na<<24>>24;f[g>>2]=0;f[_>>2]=0;f[aa>>2]=0;if(!(na<<24>>24))Sa=0;else{if(na<<24>>24<0){wa=137;break a}na=dn(oa<<2)|0;f[_>>2]=na;f[g>>2]=na;ma=na+(oa<<2)|0;f[a>>2]=ma;ya=oa;oa=na;while(1){f[oa>>2]=2147483647;ya=ya+-1|0;if(!ya)break;else oa=oa+4|0}f[_>>2]=ma;Sa=b[k>>0]|0}oa=Sa<<24>>24;f[h>>2]=0;f[ba>>2]=0;f[ca>>2]=0;if(!(Sa<<24>>24))Ta=0;else{if(Sa<<24>>24<0){wa=144;break a}ya=oa<<2;sa=dn(ya)|0;f[h>>2]=sa;ra=sa+(oa<<2)|0;f[da>>2]=ra;hj(sa|0,0,ya|0)|0;f[ba>>2]=ra;Ta=sa}sa=ja+80|0;ra=b[k>>0]|0;g:do if(!(f[sa>>2]|0))Ua=ra;else{ya=0;oa=ra;na=Ta;while(1){f[e>>2]=ya;f[d>>2]=f[e>>2];Pb(ja,d,oa,na)|0;Fa=b[k>>0]|0;if(Fa<<24>>24>0){ta=f[g>>2]|0;la=f[h>>2]|0;pa=Fa<<24>>24;Ga=0;do{ka=ta+(Ga<<2)|0;Ha=f[la+(Ga<<2)>>2]|0;if((f[ka>>2]|0)>(Ha|0))f[ka>>2]=Ha;Ga=Ga+1|0}while((Ga|0)<(pa|0))}pa=ya+1|0;if(pa>>>0>=(f[sa>>2]|0)>>>0){Ua=Fa;break g}ya=pa;oa=Fa;na=f[h>>2]|0}}while(0);if(Ua<<24>>24>0){sa=0;ja=Ua;while(1){ra=(f[g>>2]|0)+(sa<<2)|0;ma=f[ea>>2]|0;if((ma|0)==(f[fa>>2]|0)){Ci(ga,ra);Va=b[k>>0]|0}else{f[ma>>2]=f[ra>>2];f[ea>>2]=ma+4;Va=ja}sa=sa+1|0;if((sa|0)>=(Va<<24>>24|0))break;else ja=Va}}ja=f[h>>2]|0;if(ja|0){sa=f[ba>>2]|0;if((sa|0)!=(ja|0))f[ba>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);br(ja)}ja=f[g>>2]|0;if(ja|0){sa=f[_>>2]|0;if((sa|0)!=(ja|0))f[_>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);br(ja)}break}default:{}}ja=ha+1|0;sa=f[o>>2]|0;if(ja>>>0>=(f[p>>2]|0)-sa>>2>>>0){v=1;wa=169;break}k=f[j>>2]|0;ha=ja;ia=sa;t=f[k+4>>2]|0;l=k}if((wa|0)==48)mq(h);else if((wa|0)==103)mq(Ra);else if((wa|0)==137)mq(g);else if((wa|0)==144)mq(h);else if((wa|0)==169){u=c;return v|0}return 0}function hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=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=(ca|0)==(ba+-1|0)?0:ca+1|0;f[U+(aa<<2)>>2]=ca;aa=aa+1|0;da=f[g>>2]|0;if(aa>>>0>=da>>>0){ea=da;break}else ba=da}}else ea=$;if(!z){fa=99;break}else{ga=0;ha=ea}while(1){ba=(f[N>>2]|0)+((X(f[M>>2]|0,S+ga|0)|0)<<2)|0;if(!ha)ia=0;else{aa=0;do{ca=f[(f[w>>2]|0)+(aa<<2)>>2]|0;U=(f[a>>2]|0)-(f[(f[Y>>2]|0)+(ca<<2)>>2]|0)|0;do if(U|0){da=f[y>>2]|0;ja=32-da|0;ka=32-U|0;la=f[ba+(ca<<2)>>2]<(ja|0)){ma=la>>>ka;ka=U-ja|0;f[y>>2]=ka;ja=f[h>>2]|ma>>>ka;f[h>>2]=ja;ka=f[j>>2]|0;if((ka|0)==(f[m>>2]|0))Ci(n,h);else{f[ka>>2]=ja;f[j>>2]=ka+4}f[h>>2]=ma<<32-(f[y>>2]|0);break}ma=f[h>>2]|la>>>da;f[h>>2]=ma;la=da+U|0;f[y>>2]=la;if((la|0)!=32)break;la=f[j>>2]|0;if((la|0)==(f[m>>2]|0))Ci(n,h);else{f[la>>2]=ma;f[j>>2]=la+4}f[h>>2]=0;f[y>>2]=0}while(0);aa=aa+1|0;U=f[g>>2]|0}while(aa>>>0>>0);ia=U}ga=ga+1|0;if(ga>>>0>=z>>>0){fa=99;break a}else ha=ia}}$=Z+1|0;qg(R+($*12|0)|0,f[R+(Z*12|0)>>2]|0,f[R+(Z*12|0)+4>>2]|0);aa=(f[(f[k>>2]|0)+($*12|0)>>2]|0)+(V<<2)|0;ba=(f[aa>>2]|0)+(1<>2]=ba;aa=f[A>>2]|0;U=f[B>>2]|0;b:do if((W|0)==(S|0))na=S;else{ca=f[O>>2]|0;if(!aa){if((f[ca+(V<<2)>>2]|0)>>>0>>0){na=W;break}else{oa=W;pa=S}while(1){la=oa;do{la=la+-1|0;if((pa|0)==(la|0)){na=pa;break b}ma=(f[P>>2]|0)+((X(la,U)|0)<<2)+(V<<2)|0}while((f[ma>>2]|0)>>>0>=ba>>>0);pa=pa+1|0;if((pa|0)==(la|0)){na=la;break b}else oa=la}}else{qa=W;ra=S}while(1){ma=ra;while(1){sa=ca+((X(ma,aa)|0)<<2)|0;if((f[sa+(V<<2)>>2]|0)>>>0>=ba>>>0){ta=qa;break}da=ma+1|0;if((da|0)==(qa|0)){na=qa;break b}else ma=da}while(1){ta=ta+-1|0;if((ma|0)==(ta|0)){na=ma;break b}ua=(f[P>>2]|0)+((X(ta,U)|0)<<2)|0;if((f[ua+(V<<2)>>2]|0)>>>0>>0){va=0;break}}do{la=sa+(va<<2)|0;da=ua+(va<<2)|0;ka=f[la>>2]|0;f[la>>2]=f[da>>2];f[da>>2]=ka;va=va+1|0}while((va|0)!=(aa|0));ra=ma+1|0;if((ra|0)==(ta|0)){na=ta;break}else qa=ta}}while(0);ba=(_(z|0)|0)^31;U=na-S|0;ca=W-na|0;ka=U>>>0>>0;if((U|0)!=(ca|0)){da=f[H>>2]|0;if(ka)f[I>>2]=f[I>>2]|1<<31-da;la=da+1|0;f[H>>2]=la;if((la|0)==32){la=f[J>>2]|0;if((la|0)==(f[K>>2]|0))Ci(L,I);else{f[la>>2]=f[I>>2];f[J>>2]=la+4}f[H>>2]=0;f[I>>2]=0}}la=z>>>1;do if(ka){da=f[C>>2]|0;ja=32-da|0;wa=32-ba|0;xa=la-U<(ja|0)){ya=xa>>>wa;wa=ba-ja|0;f[C>>2]=wa;ja=f[D>>2]|ya>>>wa;f[D>>2]=ja;wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ci(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=ya<<32-(f[C>>2]|0);break}ya=f[D>>2]|xa>>>da;f[D>>2]=ya;xa=da+ba|0;f[C>>2]=xa;if((xa|0)==32){xa=f[E>>2]|0;if((xa|0)==(f[F>>2]|0))Ci(G,D);else{f[xa>>2]=ya;f[E>>2]=xa+4}f[D>>2]=0;f[C>>2]=0}}else{xa=f[C>>2]|0;ya=32-xa|0;da=32-ba|0;wa=la-ca<(ya|0)){ja=wa>>>da;da=ba-ya|0;f[C>>2]=da;ya=f[D>>2]|ja>>>da;f[D>>2]=ya;da=f[E>>2]|0;if((da|0)==(f[F>>2]|0))Ci(G,D);else{f[da>>2]=ya;f[E>>2]=da+4}f[D>>2]=ja<<32-(f[C>>2]|0);break}ja=f[D>>2]|wa>>>xa;f[D>>2]=ja;wa=xa+ba|0;f[C>>2]=wa;if((wa|0)==32){wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ci(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=0;f[C>>2]=0}}while(0);ba=f[s>>2]|0;la=f[ba+(Z*12|0)>>2]|0;ka=la+(V<<2)|0;f[ka>>2]=(f[ka>>2]|0)+1;qg(ba+($*12|0)|0,la,f[ba+(Z*12|0)+4>>2]|0);if((na|0)!=(S|0)){ba=f[o>>2]|0;la=f[t>>2]|0;ka=ba-la>>2;wa=f[v>>2]|0;ja=f[l>>2]|0;if((((ka|0)==0?0:(ka*113|0)+-1|0)|0)==(ja+wa|0)){Jc(e);za=f[v>>2]|0;Aa=f[l>>2]|0;Ba=f[o>>2]|0;Ca=f[t>>2]|0}else{za=wa;Aa=ja;Ba=ba;Ca=la}la=Aa+za|0;if((Ba|0)==(Ca|0))Da=0;else Da=(f[Ca+(((la>>>0)/113|0)<<2)>>2]|0)+(((la>>>0)%113|0)*36|0)|0;f[Da>>2]=S;la=Da+4|0;f[la>>2]=r;f[la+4>>2]=x;f[Da+12>>2]=na;f[Da+16>>2]=i;f[Da+20>>2]=aa;f[Da+24>>2]=V;f[Da+28>>2]=U;f[Da+32>>2]=Z;f[l>>2]=(f[l>>2]|0)+1}if((W|0)!=(na|0)){la=f[o>>2]|0;ba=f[t>>2]|0;ja=la-ba>>2;wa=f[v>>2]|0;ka=f[l>>2]|0;if((((ja|0)==0?0:(ja*113|0)+-1|0)|0)==(ka+wa|0)){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4>>2]=29;H=D;I=13227;J=H+29|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[D+29>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}if(!(ch(c)|0)){D=dn(48)|0;f[e>>2]=D;f[e+8>>2]=-2147483600;f[e+4>>2]=36;H=D;I=13257;J=H+36|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[D+36>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}D=c+172|0;G=c+176|0;K=(((f[G>>2]|0)-(f[D>>2]|0)|0)/136|0)&255;b[i>>0]=K;L=f[(f[x>>2]|0)+44>>2]|0;M=L+16|0;N=f[M+4>>2]|0;if((N|0)>0|(N|0)==0&(f[M>>2]|0)>>>0>0)O=K;else{f[g>>2]=f[L+4>>2];f[e>>2]=f[g>>2];ye(L,e,i,i+1|0)|0;O=b[i>>0]|0}i=c+284|0;f[i>>2]=O&255;O=f[t>>2]|0;L=(f[O+4>>2]|0)-(f[O>>2]|0)|0;O=L>>2;Ti(w);f[j>>2]=0;K=j+4|0;f[K>>2]=0;f[j+8>>2]=0;a:do if((L|0)>0){M=c+104|0;N=j+8|0;P=0;b:while(1){Q=(P>>>0)/3|0;R=Q>>>5;S=1<<(Q&31);if((f[(f[v>>2]|0)+(R<<2)>>2]&S|0)==0?(T=f[t>>2]|0,f[k>>2]=Q,f[e>>2]=f[k>>2],!(Rj(T,e)|0)):0){f[g>>2]=0;f[l>>2]=Q;f[e>>2]=f[l>>2];Q=gg(c,e,g)|0;Vi(w,Q);T=f[g>>2]|0;U=(T|0)==-1;do if(Q){do if(U){V=-1;W=-1;X=-1}else{Y=f[f[t>>2]>>2]|0;Z=f[Y+(T<<2)>>2]|0;_=T+1|0;$=((_>>>0)%3|0|0)==0?T+-2|0:_;if(($|0)==-1)aa=-1;else aa=f[Y+($<<2)>>2]|0;$=(((T>>>0)%3|0|0)==0?2:-1)+T|0;if(($|0)==-1){V=-1;W=aa;X=Z;break}V=f[Y+($<<2)>>2]|0;W=aa;X=Z}while(0);Z=f[C>>2]|0;$=Z+(X>>>5<<2)|0;f[$>>2]=f[$>>2]|1<<(X&31);$=Z+(W>>>5<<2)|0;f[$>>2]=f[$>>2]|1<<(W&31);$=Z+(V>>>5<<2)|0;f[$>>2]=f[$>>2]|1<<(V&31);f[e>>2]=1;$=f[B>>2]|0;if($>>>0<(f[M>>2]|0)>>>0){f[$>>2]=1;f[B>>2]=$+4}else Ci(A,e);$=(f[v>>2]|0)+(R<<2)|0;f[$>>2]=f[$>>2]|S;$=T+1|0;if(U)ba=-1;else ba=(($>>>0)%3|0|0)==0?T+-2|0:$;f[e>>2]=ba;Z=f[K>>2]|0;if(Z>>>0<(f[N>>2]|0)>>>0){f[Z>>2]=ba;f[K>>2]=Z+4}else Ci(j,e);if(U)break;Z=(($>>>0)%3|0|0)==0?T+-2|0:$;if((Z|0)==-1)break;$=f[(f[(f[t>>2]|0)+12>>2]|0)+(Z<<2)>>2]|0;Z=($|0)==-1;Y=Z?-1:($>>>0)/3|0;if(Z)break;if(f[(f[v>>2]|0)+(Y>>>5<<2)>>2]&1<<(Y&31)|0)break;f[m>>2]=$;f[e>>2]=f[m>>2];if(!(hc(c,e)|0)){ca=65;break b}}else{$=T+1|0;if(U)da=-1;else da=(($>>>0)%3|0|0)==0?T+-2|0:$;f[n>>2]=da;f[e>>2]=f[n>>2];Ce(c,e,1)|0;f[o>>2]=f[g>>2];f[e>>2]=f[o>>2];if(!(hc(c,e)|0)){ca=71;break b}}while(0)}P=P+1|0;if((P|0)>=(O|0)){ca=77;break a}}if((ca|0)==65){f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;P=dn(48)|0;f[e>>2]=P;f[e+8>>2]=-2147483600;f[e+4>>2]=32;H=P;I=13294;J=H+32|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[P+32>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0)}else if((ca|0)==71){f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;N=dn(48)|0;f[e>>2]=N;f[e+8>>2]=-2147483600;f[e+4>>2]=32;H=N;I=13294;J=H+32|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[N+32>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0)}}else ca=77;while(0);do if((ca|0)==77){O=f[F>>2]|0;o=f[E>>2]|0;n=o;if((O|0)!=(o|0)?(da=o+-4|0,O>>>0>>0):0){o=O;O=da;do{da=f[o>>2]|0;f[o>>2]=f[O>>2];f[O>>2]=da;o=o+4|0;O=O+-4|0}while(o>>>0>>0)}f[p>>2]=n;f[q>>2]=f[j>>2];f[r>>2]=f[K>>2];f[h>>2]=f[p>>2];f[g>>2]=f[q>>2];f[e>>2]=f[r>>2];Md(F,h,g,e)|0;if((f[G>>2]|0)!=(f[D>>2]|0)?(O=f[y>>2]|0,o=((f[O+100>>2]|0)-(f[O+96>>2]|0)|0)/12|0,b[e>>0]=0,Xg(v,o,e),o=f[F>>2]|0,O=f[E>>2]|0,(o|0)!=(O|0)):0){N=o;do{f[s>>2]=f[N>>2];f[e>>2]=f[s>>2];ue(c,e)|0;N=N+4|0}while((N|0)!=(O|0))}_g(w);O=c+232|0;fd(w,O);N=c+280|0;n=f[N>>2]|0;if((n|0?(f[i>>2]|0)>0:0)?(fd(n,O),(f[i>>2]|0)>1):0){n=1;do{fd((f[N>>2]|0)+(n<<5)|0,O);n=n+1|0}while((n|0)<(f[i>>2]|0))}Nh((f[c+272>>2]|0)-(f[c+268>>2]|0)>>2,f[(f[x>>2]|0)+44>>2]|0)|0;Nh(f[z>>2]|0,f[(f[x>>2]|0)+44>>2]|0)|0;if(Jg(c)|0){n=f[(f[x>>2]|0)+44>>2]|0;N=f[O>>2]|0;o=n+16|0;da=f[o+4>>2]|0;if(!((da|0)>0|(da|0)==0&(f[o>>2]|0)>>>0>0)){o=(f[c+236>>2]|0)-N|0;f[g>>2]=f[n+4>>2];f[e>>2]=f[g>>2];ye(n,e,N,N+o|0)|0}f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;break}else{f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;o=dn(32)|0;f[e>>2]=o;f[e+8>>2]=-2147483616;f[e+4>>2]=28;H=o;I=13327;J=H+28|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[o+28>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);break}}while(0);g=f[j>>2]|0;if(g|0){j=f[K>>2]|0;if((j|0)!=(g|0))f[K>>2]=j+(~((j+-4-g|0)>>>2)<<2);br(g)}u=d;return}g=dn(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=29;H=g;I=13197;J=H+29|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[g+29>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}function jb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=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>2]|0)+(Q<<2)|0;Z=(f[$>>2]|0)+(1<>2]=Z;$=f[C>>2]|0;W=f[D>>2]|0;b:do if((T|0)==(P|0))ma=P;else{aa=f[L>>2]|0;if(!$){if((f[aa+(Q<<2)>>2]|0)>>>0>>0){ma=T;break}else{na=T;oa=P}while(1){ja=na;do{ja=ja+-1|0;if((oa|0)==(ja|0)){ma=oa;break b}ka=(f[M>>2]|0)+((X(ja,W)|0)<<2)+(Q<<2)|0}while((f[ka>>2]|0)>>>0>=Z>>>0);oa=oa+1|0;if((oa|0)==(ja|0)){ma=ja;break b}else na=ja}}else{pa=T;qa=P}while(1){ka=qa;while(1){ra=aa+((X(ka,$)|0)<<2)|0;if((f[ra+(Q<<2)>>2]|0)>>>0>=Z>>>0){sa=pa;break}ba=ka+1|0;if((ba|0)==(pa|0)){ma=pa;break b}else ka=ba}while(1){sa=sa+-1|0;if((ka|0)==(sa|0)){ma=ka;break b}ta=(f[M>>2]|0)+((X(sa,W)|0)<<2)|0;if((f[ta+(Q<<2)>>2]|0)>>>0>>0){ua=0;break}}do{ja=ra+(ua<<2)|0;ba=ta+(ua<<2)|0;ia=f[ja>>2]|0;f[ja>>2]=f[ba>>2];f[ba>>2]=ia;ua=ua+1|0}while((ua|0)!=($|0));qa=ka+1|0;if((qa|0)==(sa|0)){ma=sa;break}else pa=sa}}while(0);Z=(_(U|0)|0)^31;W=ma-P|0;aa=T-ma|0;ia=W>>>0>>0;if((W|0)!=(aa|0)){ba=f[E>>2]|0;if(ia)f[F>>2]=f[F>>2]|1<<31-ba;ja=ba+1|0;f[E>>2]=ja;if((ja|0)==32){ja=f[G>>2]|0;if((ja|0)==(f[H>>2]|0))Ci(I,F);else{f[ja>>2]=f[F>>2];f[G>>2]=ja+4}f[E>>2]=0;f[F>>2]=0}}ja=U>>>1;if(ia){ia=ja-W|0;if(Z|0){ba=0;ha=1<>>1}}}else{ha=ja-aa|0;if(Z|0){ba=0;ia=1<>>1}}}ia=f[v>>2]|0;Z=f[ia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<2)>>2]|0;switch(f[fa+28>>2]|0){case 1:case 3:case 5:case 2:case 4:case 6:{ga=fa;ha=aa;break}case 9:{ga=f[(f[Z>>2]|0)+(aa<<2)>>2]|0;ha=aa+1|0;break}default:{ia=0;break a}}if(!ga){ia=0;break a}c:do switch(f[ga+28>>2]|0){case 6:{if(Q){ja=ba;ka=ga+24|0;break c}fa=ga+84|0;la=ga+68|0;ma=ga+48|0;na=ga+40|0;oa=ga+24|0;pa=0;do{if(!(b[fa>>0]|0))qa=f[(f[la>>2]|0)+(pa<<2)>>2]|0;else qa=pa;ra=ma;sa=f[ra>>2]|0;ta=f[ra+4>>2]|0;ra=na;ua=on(f[ra>>2]|0,f[ra+4>>2]|0,qa|0,0)|0;ra=Tn(ua|0,I|0,sa|0,ta|0)|0;Rg((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,(f[f[ga>>2]>>2]|0)+ra|0,b[oa>>0]<<2|0)|0;pa=pa+1|0}while((pa|0)!=(B|0));ja=ba;ka=oa;break}case 1:case 3:case 5:{oa=ga+24|0;pa=b[oa>>0]|0;na=pa<<24>>24;f[j>>2]=0;f[R>>2]=0;f[S>>2]=0;if(!(pa<<24>>24))va=0;else{if(pa<<24>>24<0){wa=24;break b}pa=na<<2;ma=dn(pa)|0;f[j>>2]=ma;la=ma+(na<<2)|0;f[Y>>2]=la;hj(ma|0,0,pa|0)|0;f[R>>2]=la;va=b[oa>>0]|0}la=va<<24>>24;f[k>>2]=0;f[T>>2]=0;f[U>>2]=0;if(!(va<<24>>24)){xa=0;ya=0}else{if(va<<24>>24<0){wa=30;break b}pa=la<<2;ma=dn(pa)|0;f[k>>2]=ma;na=ma+(la<<2)|0;f[V>>2]=na;hj(ma|0,0,pa|0)|0;f[T>>2]=na;xa=ma;ya=ma}if(Q){za=ya;Aa=xa}else{ma=ga+84|0;na=ga+68|0;pa=0;do{if(!(b[ma>>0]|0))Ba=f[(f[na>>2]|0)+(pa<<2)>>2]|0;else Ba=pa;la=f[j>>2]|0;f[g>>2]=Ba;fa=b[oa>>0]|0;f[e>>2]=f[g>>2];Pb(ga,e,fa,la)|0;la=b[oa>>0]|0;fa=la<<24>>24;if(la<<24>>24>0){la=f[j>>2]|0;ra=f[W>>2]|0;ta=f[k>>2]|0;sa=0;do{f[ta+(sa<<2)>>2]=(f[la+(sa<<2)>>2]|0)-(f[ra+(sa+ba<<2)>>2]|0);sa=sa+1|0}while((sa|0)<(fa|0));Ca=ta}else Ca=f[k>>2]|0;Rg((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,Ca|0,fa<<2|0)|0;pa=pa+1|0}while(pa>>>0>>0);pa=f[k>>2]|0;za=pa;Aa=pa}pa=ba+(b[oa>>0]|0)|0;if(za|0){na=f[T>>2]|0;if((na|0)!=(za|0))f[T>>2]=na+(~((na+-4-za|0)>>>2)<<2);br(Aa)}na=f[j>>2]|0;if(na|0){ma=f[R>>2]|0;if((ma|0)!=(na|0))f[R>>2]=ma+(~((ma+-4-na|0)>>>2)<<2);br(na)}ja=pa;ka=oa;break}default:{pa=ga+24|0;na=b[pa>>0]|0;ma=na<<24>>24;f[j>>2]=0;f[K>>2]=0;f[O>>2]=0;if(!(na<<24>>24)){Da=0;Ea=0}else{if(na<<24>>24<0){wa=53;break b}na=ma<<2;ta=dn(na)|0;f[j>>2]=ta;sa=ta+(ma<<2)|0;f[P>>2]=sa;hj(ta|0,0,na|0)|0;f[K>>2]=sa;Da=ta;Ea=ta}if(Q){Fa=Ea;Ga=Da}else{ta=ga+84|0;sa=ga+68|0;na=0;do{if(!(b[ta>>0]|0))Ha=f[(f[sa>>2]|0)+(na<<2)>>2]|0;else Ha=na;ma=f[j>>2]|0;f[g>>2]=Ha;ra=b[pa>>0]|0;f[e>>2]=f[g>>2];Ob(ga,e,ra,ma)|0;Rg((f[H>>2]|0)+((X(f[F>>2]|0,na)|0)<<2)+($<<2)|0,f[j>>2]|0,b[pa>>0]<<2|0)|0;na=na+1|0}while(na>>>0>>0);na=f[j>>2]|0;Fa=na;Ga=na}if(Fa|0){na=f[K>>2]|0;if((na|0)!=(Fa|0))f[K>>2]=na+(~((na+-4-Fa|0)>>>2)<<2);br(Ga)}ja=ba;ka=pa}}while(0);na=ca+1|0;sa=f[G>>2]|0;if(na>>>0>=(f[L>>2]|0)-sa>>2>>>0){wa=66;break}$=$+(b[ka>>0]|0)|0;aa=ha;ba=ja;ca=na;da=sa;ea=f[A>>2]|0}if((wa|0)==24)mq(j);else if((wa|0)==30)mq(k);else if((wa|0)==53)mq(j);else if((wa|0)==66){Ia=f[D>>2]|0;Ja=f[H>>2]|0;wa=67;break}}else{Ia=E;Ja=N;wa=67}while(0);d:do if((wa|0)==67){N=X(Ia,B)|0;if((N|0)>0){E=0;H=0;while(1){D=f[Ja+(E<<2)>>2]|0;if(!D)Ka=H;else{A=(_(D|0)|0)^31;Ka=(A|0)<(H|0)?H:A+1|0}E=E+1|0;if((E|0)>=(N|0)){La=Ka;break}else H=Ka}}else La=0;switch(b[h>>0]|0){case 6:{Ge(j,Ia);f[l>>2]=0;f[l+4>>2]=i;H=f[F>>2]|0;f[l+8>>2]=H;f[m>>2]=f[i>>2];f[m+4>>2]=i;f[m+8>>2]=H;f[k>>2]=La;f[g>>2]=f[l>>2];f[g+4>>2]=f[l+4>>2];f[g+8>>2]=f[l+8>>2];f[e>>2]=f[m>>2];f[e+4>>2]=f[m+4>>2];f[e+8>>2]=f[m+8>>2];H=ff(j,g,e,k,c)|0;Ee(j);if(!H){ia=0;break d}break}case 5:{Ge(j,Ia);f[n>>2]=0;f[n+4>>2]=i;H=f[F>>2]|0;f[n+8>>2]=H;f[o>>2]=f[i>>2];f[o+4>>2]=i;f[o+8>>2]=H;f[k>>2]=La;f[g>>2]=f[n>>2];f[g+4>>2]=f[n+4>>2];f[g+8>>2]=f[n+8>>2];f[e>>2]=f[o>>2];f[e+4>>2]=f[o+4>>2];f[e+8>>2]=f[o+8>>2];H=gf(j,g,e,k,c)|0;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(!H){ia=0;break d}break}case 0:{Pe(j,Ia);f[y>>2]=0;f[y+4>>2]=i;H=f[F>>2]|0;f[y+8>>2]=H;f[z>>2]=f[i>>2];f[z+4>>2]=i;f[z+8>>2]=H;f[k>>2]=La;f[g>>2]=f[y>>2];f[g+4>>2]=f[y+4>>2];f[g+8>>2]=f[y+8>>2];f[e>>2]=f[z>>2];f[e+4>>2]=f[z+4>>2];f[e+8>>2]=f[z+8>>2];H=lf(j,g,e,k,c)|0;Te(j);if(!H){ia=0;break d}break}default:{ia=0;break d}}ia=1}while(0);j=f[i+12>>2]|0;if(!j){u=d;return ia|0}i=f[J>>2]|0;if((i|0)!=(j|0))f[J>>2]=i+(~((i+-4-j|0)>>>2)<<2);br(j);u=d;return ia|0}function lb(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;d=u;u=u+80|0;e=d+56|0;g=d+52|0;h=d+48|0;i=d+68|0;j=d;k=d+44|0;l=d+40|0;m=d+36|0;n=d+32|0;o=d+28|0;p=d+24|0;q=d+20|0;r=d+16|0;s=d+12|0;if(!(b[c+352>>0]|0)){Ne(e,f[c+8>>2]|0);t=c+12|0;v=f[e>>2]|0;f[e>>2]=0;w=f[t>>2]|0;f[t>>2]=v;if(w){ui(w);br(w);w=f[e>>2]|0;f[e>>2]=0;if(w|0){ui(w);br(w)}}else f[e>>2]=0}else{Mg(e,f[c+8>>2]|0);w=c+12|0;v=f[e>>2]|0;f[e>>2]=0;t=f[w>>2]|0;f[w>>2]=v;if(t){ui(t);br(t);t=f[e>>2]|0;f[e>>2]=0;if(t|0){ui(t);br(t)}}else f[e>>2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>>2]=0;E=E+1|0}while((E|0)!=(F|0))}f[D>>2]=0}f[c+144>>2]=0;D=f[t>>2]|0;F=(f[D+28>>2]|0)-(f[D+24>>2]|0)>>2;f[e>>2]=-1;Sf(c+152|0,F,e);F=c+72|0;D=f[F>>2]|0;E=c+76|0;G=f[E>>2]|0;if((G|0)!=(D|0))f[E>>2]=G+(~((G+-4-D|0)>>>2)<<2);D=f[t>>2]|0;$j(F,((f[D+4>>2]|0)-(f[D>>2]|0)>>2>>>0)/3|0);f[c+64>>2]=0;if(!(oe(c)|0)){D=dn(32)|0;f[e>>2]=D;f[e+8>>2]=-2147483616;f[e+4>>2]=29;H=D;I=13227;J=H+29|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[D+29>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}if(!(bh(c)|0)){D=dn(48)|0;f[e>>2]=D;f[e+8>>2]=-2147483600;f[e+4>>2]=36;H=D;I=13257;J=H+36|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[D+36>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}D=c+172|0;G=c+176|0;K=(((f[G>>2]|0)-(f[D>>2]|0)|0)/136|0)&255;b[i>>0]=K;L=f[(f[x>>2]|0)+44>>2]|0;M=L+16|0;N=f[M+4>>2]|0;if((N|0)>0|(N|0)==0&(f[M>>2]|0)>>>0>0)O=K;else{f[g>>2]=f[L+4>>2];f[e>>2]=f[g>>2];ye(L,e,i,i+1|0)|0;O=b[i>>0]|0}f[c+284>>2]=O&255;O=f[t>>2]|0;i=(f[O+4>>2]|0)-(f[O>>2]|0)|0;O=i>>2;Ti(v);f[j>>2]=0;L=j+4|0;f[L>>2]=0;f[j+8>>2]=0;a:do if((i|0)>0){K=c+104|0;M=j+8|0;N=0;b:while(1){P=(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)|0)){ba=65;break b}}else{_=S+1|0;if(T)ca=-1;else ca=((_>>>0)%3|0|0)==0?S+-2|0:_;f[n>>2]=ca;f[e>>2]=f[n>>2];Ce(c,e,1)|0;f[o>>2]=f[g>>2];f[e>>2]=f[o>>2];if(!(Zb(c,e)|0)){ba=71;break b}}while(0)}N=N+1|0;if((N|0)>=(O|0)){ba=77;break a}}if((ba|0)==65){f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;N=dn(48)|0;f[e>>2]=N;f[e+8>>2]=-2147483600;f[e+4>>2]=32;H=N;I=13294;J=H+32|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[N+32>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0)}else if((ba|0)==71){f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;M=dn(48)|0;f[e>>2]=M;f[e+8>>2]=-2147483600;f[e+4>>2]=32;H=M;I=13294;J=H+32|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[M+32>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0)}}else ba=77;while(0);do if((ba|0)==77){O=f[F>>2]|0;o=f[E>>2]|0;n=o;if((O|0)!=(o|0)?(ca=o+-4|0,O>>>0>>0):0){o=O;O=ca;do{ca=f[o>>2]|0;f[o>>2]=f[O>>2];f[O>>2]=ca;o=o+4|0;O=O+-4|0}while(o>>>0>>0)}f[p>>2]=n;f[q>>2]=f[j>>2];f[r>>2]=f[L>>2];f[h>>2]=f[p>>2];f[g>>2]=f[q>>2];f[e>>2]=f[r>>2];Md(F,h,g,e)|0;if((f[G>>2]|0)!=(f[D>>2]|0)?(O=f[y>>2]|0,o=((f[O+100>>2]|0)-(f[O+96>>2]|0)|0)/12|0,b[e>>0]=0,Xg(w,o,e),o=f[F>>2]|0,O=f[E>>2]|0,(o|0)!=(O|0)):0){M=o;do{f[s>>2]=f[M>>2];f[e>>2]=f[s>>2];ue(c,e)|0;M=M+4|0}while((M|0)!=(O|0))}$h(v);Nh(f[c+324>>2]|0,f[(f[x>>2]|0)+44>>2]|0)|0;Nh(f[z>>2]|0,f[(f[x>>2]|0)+44>>2]|0)|0;if(Jg(c)|0){O=f[(f[x>>2]|0)+44>>2]|0;M=f[c+232>>2]|0;n=O+16|0;o=f[n+4>>2]|0;if(!((o|0)>0|(o|0)==0&(f[n>>2]|0)>>>0>0)){n=(f[c+236>>2]|0)-M|0;f[g>>2]=f[O+4>>2];f[e>>2]=f[g>>2];ye(O,e,M,M+n|0)|0}f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;break}else{f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;n=dn(32)|0;f[e>>2]=n;f[e+8>>2]=-2147483616;f[e+4>>2]=28;H=n;I=13327;J=H+28|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[n+28>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);break}}while(0);g=f[j>>2]|0;if(g|0){j=f[L>>2]|0;if((j|0)!=(g|0))f[L>>2]=j+(~((j+-4-g|0)>>>2)<<2);br(g)}u=d;return}g=dn(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=29;H=g;I=13197;J=H+29|0;do{b[H>>0]=b[I>>0]|0;H=H+1|0;I=I+1|0}while((H|0)<(J|0));b[g+29>>0]=0;f[a>>2]=-1;dj(a+4|0,e);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);u=d;return}function mb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I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>2]|0)+(1<>2]=W;V=f[A>>2]|0;P=f[B>>2]|0;b:do if((R|0)==(N|0))ia=N;else{Y=f[J>>2]|0;if(!V){if((f[Y+(Q<<2)>>2]|0)>>>0>>0){ia=R;break}else{ja=R;ka=N}while(1){ga=ja;do{ga=ga+-1|0;if((ka|0)==(ga|0)){ia=ka;break b}ha=(f[K>>2]|0)+((X(ga,P)|0)<<2)+(Q<<2)|0}while((f[ha>>2]|0)>>>0>=W>>>0);ka=ka+1|0;if((ka|0)==(ga|0)){ia=ga;break b}else ja=ga}}else{la=R;ma=N}while(1){ha=ma;while(1){na=Y+((X(ha,V)|0)<<2)|0;if((f[na+(Q<<2)>>2]|0)>>>0>=W>>>0){oa=la;break}Z=ha+1|0;if((Z|0)==(la|0)){ia=la;break b}else ha=Z}while(1){oa=oa+-1|0;if((ha|0)==(oa|0)){ia=ha;break b}pa=(f[K>>2]|0)+((X(oa,P)|0)<<2)|0;if((f[pa+(Q<<2)>>2]|0)>>>0>>0){qa=0;break}}do{ga=na+(qa<<2)|0;Z=pa+(qa<<2)|0;fa=f[ga>>2]|0;f[ga>>2]=f[Z>>2];f[Z>>2]=fa;qa=qa+1|0}while((qa|0)!=(V|0));ma=ha+1|0;if((ma|0)==(oa|0)){ia=oa;break}else la=oa}}while(0);W=(_(z|0)|0)^31;P=ia-N|0;Y=R-ia|0;fa=P>>>0>>0;if((P|0)!=(Y|0)){Z=f[C>>2]|0;if(fa)f[D>>2]=f[D>>2]|1<<31-Z;ga=Z+1|0;f[C>>2]=ga;if((ga|0)==32){ga=f[E>>2]|0;if((ga|0)==(f[F>>2]|0))Ci(G,D);else{f[ga>>2]=f[D>>2];f[E>>2]=ga+4}f[C>>2]=0;f[D>>2]=0}}ga=z>>>1;if(fa){fa=ga-P|0;if(W|0){Z=0;ea=1<>>1}}}else{ea=ga-Y|0;if(W|0){Z=0;fa=1<>>1}}}fa=f[s>>2]|0;W=f[fa+(T*12|0)>>2]|0;Z=W+(Q<<2)|0;f[Z>>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0;f[Q+(W<<2)>>2]=Z;W=W+1|0;$=f[g>>2]|0;if(W>>>0>=$>>>0){aa=$;break}else Y=$}}else aa=V;if(!z){ba=81;break}else{ca=0;da=aa}while(1){Y=(f[J>>2]|0)+((X(f[I>>2]|0,O+ca|0)|0)<<2)|0;if(!da)ea=0;else{W=0;do{Z=f[(f[w>>2]|0)+(W<<2)>>2]|0;Q=(f[a>>2]|0)-(f[(f[T>>2]|0)+(Z<<2)>>2]|0)|0;do if(Q|0){$=f[y>>2]|0;fa=32-$|0;ga=32-Q|0;ha=f[Y+(Z<<2)>>2]<(fa|0)){ia=ha>>>ga;ga=Q-fa|0;f[y>>2]=ga;fa=f[h>>2]|ia>>>ga;f[h>>2]=fa;ga=f[j>>2]|0;if((ga|0)==(f[m>>2]|0))Ci(n,h);else{f[ga>>2]=fa;f[j>>2]=ga+4}f[h>>2]=ia<<32-(f[y>>2]|0);break}ia=f[h>>2]|ha>>>$;f[h>>2]=ia;ha=$+Q|0;f[y>>2]=ha;if((ha|0)!=32)break;ha=f[j>>2]|0;if((ha|0)==(f[m>>2]|0))Ci(n,h);else{f[ha>>2]=ia;f[j>>2]=ha+4}f[h>>2]=0;f[y>>2]=0}while(0);W=W+1|0;Q=f[g>>2]|0}while(W>>>0>>0);ea=Q}ca=ca+1|0;if(ca>>>0>=z>>>0){ba=81;break a}else da=ea}}V=U+1|0;qg(N+(V*12|0)|0,f[N+(U*12|0)>>2]|0,f[N+(U*12|0)+4>>2]|0);W=(f[(f[k>>2]|0)+(V*12|0)>>2]|0)+(R<<2)|0;Y=(f[W>>2]|0)+(1<>2]=Y;W=f[A>>2]|0;Q=f[B>>2]|0;b:do if((S|0)==(O|0))ja=O;else{Z=f[K>>2]|0;if(!W){if((f[Z+(R<<2)>>2]|0)>>>0>>0){ja=S;break}else{ka=S;la=O}while(1){ha=ka;do{ha=ha+-1|0;if((la|0)==(ha|0)){ja=la;break b}ia=(f[L>>2]|0)+((X(ha,Q)|0)<<2)+(R<<2)|0}while((f[ia>>2]|0)>>>0>=Y>>>0);la=la+1|0;if((la|0)==(ha|0)){ja=ha;break b}else ka=ha}}else{ma=S;na=O}while(1){ia=na;while(1){oa=Z+((X(ia,W)|0)<<2)|0;if((f[oa+(R<<2)>>2]|0)>>>0>=Y>>>0){pa=ma;break}$=ia+1|0;if(($|0)==(ma|0)){ja=ma;break b}else ia=$}while(1){pa=pa+-1|0;if((ia|0)==(pa|0)){ja=ia;break b}qa=(f[L>>2]|0)+((X(pa,Q)|0)<<2)|0;if((f[qa+(R<<2)>>2]|0)>>>0>>0){ra=0;break}}do{ha=oa+(ra<<2)|0;$=qa+(ra<<2)|0;ga=f[ha>>2]|0;f[ha>>2]=f[$>>2];f[$>>2]=ga;ra=ra+1|0}while((ra|0)!=(W|0));na=ia+1|0;if((na|0)==(pa|0)){ja=pa;break}else ma=pa}}while(0);Y=(_(z|0)|0)^31;Q=ja-O|0;Z=S-ja|0;ga=Q>>>0>>0;if((Q|0)!=(Z|0)){$=f[D>>2]|0;if(ga)f[E>>2]=f[E>>2]|1<<31-$;ha=$+1|0;f[D>>2]=ha;if((ha|0)==32){ha=f[F>>2]|0;if((ha|0)==(f[G>>2]|0))Ci(H,E);else{f[ha>>2]=f[E>>2];f[F>>2]=ha+4}f[D>>2]=0;f[E>>2]=0}}ha=z>>>1;if(ga)bg(C,Y,ha-Q|0);else bg(C,Y,ha-Z|0);ha=f[s>>2]|0;Y=f[ha+(U*12|0)>>2]|0;ga=Y+(R<<2)|0;f[ga>>2]=(f[ga>>2]|0)+1;qg(ha+(V*12|0)|0,Y,f[ha+(U*12|0)+4>>2]|0);if((ja|0)!=(O|0)){ha=f[o>>2]|0;Y=f[t>>2]|0;ga=ha-Y>>2;$=f[v>>2]|0;fa=f[l>>2]|0;if((((ga|0)==0?0:(ga*113|0)+-1|0)|0)==(fa+$|0)){Jc(e);sa=f[v>>2]|0;ta=f[l>>2]|0;ua=f[o>>2]|0;va=f[t>>2]|0}else{sa=$;ta=fa;ua=ha;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ob=0.0,pb=0.0,qb=0.0,rb=0.0,sb=0.0,tb=0;i=u;u=u+512|0;j=i;k=d+c|0;l=0-k|0;m=a+4|0;n=a+100|0;o=b;b=0;a:while(1){switch(o|0){case 46:{p=6;break a;break}case 48:break;default:{q=0;r=o;s=b;t=0;v=0;break a}}w=f[m>>2]|0;if(w>>>0<(f[n>>2]|0)>>>0){f[m>>2]=w+1;o=h[w>>0]|0;b=1;continue}else{o=Di(a)|0;b=1;continue}}if((p|0)==6){o=f[m>>2]|0;if(o>>>0<(f[n>>2]|0)>>>0){f[m>>2]=o+1;x=h[o>>0]|0}else x=Di(a)|0;if((x|0)==48){o=0;w=0;while(1){y=Tn(o|0,w|0,-1,-1)|0;z=I;A=f[m>>2]|0;if(A>>>0<(f[n>>2]|0)>>>0){f[m>>2]=A+1;B=h[A>>0]|0}else B=Di(a)|0;if((B|0)==48){o=y;w=z}else{q=1;r=B;s=1;t=y;v=z;break}}}else{q=1;r=x;s=b;t=0;v=0}}f[j>>2]=0;b=r+-48|0;x=(r|0)==46;b:do if(x|b>>>0<10){B=j+496|0;w=0;o=0;z=0;y=q;A=s;C=r;D=x;E=b;F=t;G=v;H=0;J=0;c:while(1){do if(D)if(!y){L=w;M=o;N=1;O=z;P=A;Q=H;R=J;S=H;T=J}else break c;else{U=Tn(H|0,J|0,1,0)|0;V=I;W=(C|0)!=48;if((o|0)>=125){if(!W){L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}f[B>>2]=f[B>>2]|1;L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}Y=j+(o<<2)|0;if(!w)Z=E;else Z=C+-48+((f[Y>>2]|0)*10|0)|0;f[Y>>2]=Z;Y=w+1|0;_=(Y|0)==9;L=_?0:Y;M=o+(_&1)|0;N=y;O=W?U:z;P=1;Q=F;R=G;S=U;T=V}while(0);V=f[m>>2]|0;if(V>>>0<(f[n>>2]|0)>>>0){f[m>>2]=V+1;$=h[V>>0]|0}else $=Di(a)|0;E=$+-48|0;D=($|0)==46;if(!(D|E>>>0<10)){aa=L;ba=M;ca=O;da=N;ea=$;fa=P;ga=S;ha=Q;ia=T;ja=R;p=29;break b}else{w=L;o=M;z=O;y=N;A=P;C=$;F=Q;G=R;H=S;J=T}}ka=w;la=o;ma=z;na=H;oa=J;pa=F;qa=G;ra=(A|0)!=0;p=37}else{aa=0;ba=0;ca=0;da=q;ea=r;fa=s;ga=0;ha=t;ia=0;ja=v;p=29}while(0);do if((p|0)==29){v=(da|0)==0;t=v?ga:ha;s=v?ia:ja;v=(fa|0)!=0;if(!(v&(ea|32|0)==101))if((ea|0)>-1){ka=aa;la=ba;ma=ca;na=ga;oa=ia;pa=t;qa=s;ra=v;p=37;break}else{sa=aa;ta=ba;ua=ca;va=ga;wa=ia;xa=v;ya=t;za=s;p=39;break}v=De(a,g)|0;r=I;if((v|0)==0&(r|0)==-2147483648){if(!g){Rm(a,0);Aa=0.0;break}if(!(f[n>>2]|0)){Ba=0;Ca=0}else{f[m>>2]=(f[m>>2]|0)+-1;Ba=0;Ca=0}}else{Ba=v;Ca=r}r=Tn(Ba|0,Ca|0,t|0,s|0)|0;Da=aa;Ea=ba;Fa=ca;Ga=r;Ha=ga;Ia=I;Ja=ia;p=41}while(0);if((p|0)==37)if(f[n>>2]|0){f[m>>2]=(f[m>>2]|0)+-1;if(ra){Da=ka;Ea=la;Fa=ma;Ga=pa;Ha=na;Ia=qa;Ja=oa;p=41}else p=40}else{sa=ka;ta=la;ua=ma;va=na;wa=oa;xa=ra;ya=pa;za=qa;p=39}if((p|0)==39)if(xa){Da=sa;Ea=ta;Fa=ua;Ga=ya;Ha=va;Ia=za;Ja=wa;p=41}else p=40;do if((p|0)==40){wa=ir()|0;f[wa>>2]=22;Rm(a,0);Aa=0.0}else if((p|0)==41){wa=f[j>>2]|0;if(!wa){Aa=+(e|0)*0.0;break}if(((Ja|0)<0|(Ja|0)==0&Ha>>>0<10)&((Ga|0)==(Ha|0)&(Ia|0)==(Ja|0))?(c|0)>30|(wa>>>c|0)==0:0){Aa=+(e|0)*+(wa>>>0);break}wa=(d|0)/-2|0;za=((wa|0)<0)<<31>>31;if((Ia|0)>(za|0)|(Ia|0)==(za|0)&Ga>>>0>wa>>>0){wa=ir()|0;f[wa>>2]=34;Aa=+(e|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}wa=d+-106|0;za=((wa|0)<0)<<31>>31;if((Ia|0)<(za|0)|(Ia|0)==(za|0)&Ga>>>0>>0){wa=ir()|0;f[wa>>2]=34;Aa=+(e|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if(!Da)Ka=Ea;else{if((Da|0)<9){wa=j+(Ea<<2)|0;za=Da;va=f[wa>>2]|0;while(1){va=va*10|0;if((za|0)>=8)break;else za=za+1|0}f[wa>>2]=va}Ka=Ea+1|0}if((Fa|0)<9?(Fa|0)<=(Ga|0)&(Ga|0)<18:0){if((Ga|0)==9){Aa=+(e|0)*+((f[j>>2]|0)>>>0);break}if((Ga|0)<9){Aa=+(e|0)*+((f[j>>2]|0)>>>0)/+(f[6408+(8-Ga<<2)>>2]|0);break}za=c+27+(X(Ga,-3)|0)|0;A=f[j>>2]|0;if((za|0)>30|(A>>>za|0)==0){Aa=+(e|0)*+(A>>>0)*+(f[6408+(Ga+-10<<2)>>2]|0);break}}A=(Ga|0)%9|0;if(!A){La=0;Ma=Ka;Na=0;Oa=Ga}else{za=(Ga|0)>-1?A:A+9|0;A=f[6408+(8-za<<2)>>2]|0;if(Ka){G=1e9/(A|0)|0;F=0;J=0;H=Ga;z=0;do{o=j+(z<<2)|0;w=f[o>>2]|0;ya=((w>>>0)/(A>>>0)|0)+F|0;f[o>>2]=ya;F=X(G,(w>>>0)%(A>>>0)|0)|0;w=(z|0)==(J|0)&(ya|0)==0;H=w?H+-9|0:H;J=w?J+1&127:J;z=z+1|0}while((z|0)!=(Ka|0));if(!F){Pa=J;Qa=Ka;Ra=H}else{f[j+(Ka<<2)>>2]=F;Pa=J;Qa=Ka+1|0;Ra=H}}else{Pa=0;Qa=0;Ra=Ga}La=0;Ma=Qa;Na=Pa;Oa=9-za+Ra|0}d:while(1){z=(Oa|0)<18;A=(Oa|0)==18;G=j+(Na<<2)|0;va=La;wa=Ma;while(1){if(!z){if(!A){Sa=va;Ta=Na;Ua=Oa;Va=wa;break d}if((f[G>>2]|0)>>>0>=9007199){Sa=va;Ta=Na;Ua=18;Va=wa;break d}}w=0;Wa=wa;ya=wa+127|0;while(1){o=ya&127;ua=j+(o<<2)|0;ta=Rn(f[ua>>2]|0,0,29)|0;sa=Tn(ta|0,I|0,w|0,0)|0;ta=I;if(ta>>>0>0|(ta|0)==0&sa>>>0>1e9){xa=up(sa|0,ta|0,1e9,0)|0;qa=an(sa|0,ta|0,1e9,0)|0;Xa=xa;Ya=qa}else{Xa=0;Ya=sa}f[ua>>2]=Ya;ua=(o|0)==(Na|0);Wa=(Ya|0)==0&(((o|0)!=(Wa+127&127|0)|ua)^1)?o:Wa;if(ua)break;else{w=Xa;ya=o+-1|0}}va=va+-29|0;if(Xa|0)break;else wa=Wa}wa=Na+127&127;G=Wa+127&127;A=j+((Wa+126&127)<<2)|0;if((wa|0)==(Wa|0)){f[A>>2]=f[A>>2]|f[j+(G<<2)>>2];Za=G}else Za=Wa;f[j+(wa<<2)>>2]=Xa;La=va;Ma=Za;Na=wa;Oa=Oa+9|0}e:while(1){za=Va+1&127;H=j+((Va+127&127)<<2)|0;J=Sa;F=Ta;wa=Ua;while(1){G=(wa|0)==18;A=(wa|0)>27?9:1;_a=J;$a=F;while(1){z=0;while(1){ya=z+$a&127;if((ya|0)==(Va|0)){ab=2;p=88;break}w=f[j+(ya<<2)>>2]|0;ya=f[6440+(z<<2)>>2]|0;if(w>>>0>>0){ab=2;p=88;break}if(w>>>0>ya>>>0)break;ya=z+1|0;if((z|0)<1)z=ya;else{ab=ya;p=88;break}}if((p|0)==88?(p=0,G&(ab|0)==2):0){bb=0.0;cb=0;db=Va;break e}eb=A+_a|0;if(($a|0)==(Va|0)){_a=eb;$a=Va}else break}G=(1<>>A;fb=0;gb=$a;hb=wa;ya=$a;do{w=j+(ya<<2)|0;o=f[w>>2]|0;ua=(o>>>A)+fb|0;f[w>>2]=ua;fb=X(o&G,z)|0;o=(ya|0)==(gb|0)&(ua|0)==0;hb=o?hb+-9|0:hb;gb=o?gb+1&127:gb;ya=ya+1&127}while((ya|0)!=(Va|0));if(!fb){J=eb;F=gb;wa=hb;continue}if((za|0)!=(gb|0))break;f[H>>2]=f[H>>2]|1;J=eb;F=gb;wa=hb}f[j+(Va<<2)>>2]=fb;Sa=eb;Ta=gb;Ua=hb;Va=za}while(1){wa=cb+$a&127;F=db+1&127;if((wa|0)==(db|0)){f[j+(F+-1<<2)>>2]=0;ib=F}else ib=db;bb=bb*1.0e9+ +((f[j+(wa<<2)>>2]|0)>>>0);cb=cb+1|0;if((cb|0)==2)break;else db=ib}jb=+(e|0);kb=bb*jb;wa=_a+53|0;F=wa-d|0;J=(F|0)<(c|0);H=J?((F|0)>0?F:0):c;if((H|0)<53){lb=+Gq(+Wj(1.0,105-H|0),kb);mb=+Sq(kb,+Wj(1.0,53-H|0));nb=lb;ob=mb;pb=lb+(kb-mb)}else{nb=0.0;ob=0.0;pb=kb}va=$a+2&127;if((va|0)!=(ib|0)){ya=f[j+(va<<2)>>2]|0;do if(ya>>>0>=5e8){if((ya|0)!=5e8){qb=jb*.75+ob;break}if(($a+3&127|0)==(ib|0)){qb=jb*.5+ob;break}else{qb=jb*.75+ob;break}}else{if((ya|0)==0?($a+3&127|0)==(ib|0):0){qb=ob;break}qb=jb*.25+ob}while(0);if((53-H|0)>1?!(+Sq(qb,1.0)!=0.0):0)rb=qb+1.0;else rb=qb}else rb=ob;jb=pb+rb-nb;do if((wa&2147483647|0)>(-2-k|0)){ya=!(+K(+jb)>=9007199254740992.0);va=_a+((ya^1)&1)|0;kb=ya?jb:jb*.5;if((va+50|0)<=(l|0)?!(rb!=0.0&(J&((H|0)!=(F|0)|ya))):0){sb=kb;tb=va;break}ya=ir()|0;f[ya>>2]=34;sb=kb;tb=va}else{sb=jb;tb=_a}while(0);Aa=+Hq(sb,tb)}while(0);u=i;return +Aa}function pb(a,c,d,e,g,i){a=a|0;c=+c;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0,D=0.0,E=0,F=0,G=0,H=0.0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0.0,ga=0.0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0;j=u;u=u+560|0;k=j+8|0;l=j;m=j+524|0;n=m;o=j+512|0;f[l>>2]=0;p=o+12|0;xo(c)|0;if((I|0)<0){q=-c;r=1;s=15511}else{q=c;r=(g&2049|0)!=0&1;s=(g&2048|0)==0?((g&1|0)==0?15512:15517):15514}xo(q)|0;do if(0==0&(I&2146435072|0)==2146435072){t=(i&32|0)!=0;v=r+3|0;Hk(a,32,d,v,g&-65537);ep(a,s,r);ep(a,q!=q|0.0!=0.0?(t?17461:15538):t?15530:15534,3);Hk(a,32,d,v,g^8192);w=v}else{c=+Iq(q,l)*2.0;v=c!=0.0;if(v)f[l>>2]=(f[l>>2]|0)+-1;t=i|32;if((t|0)==97){x=i&32;y=(x|0)==0?s:s+9|0;z=r|2;A=12-e|0;do if(!(e>>>0>11|(A|0)==0)){B=8.0;C=A;do{C=C+-1|0;B=B*16.0}while((C|0)!=0);if((b[y>>0]|0)==45){D=-(B+(-c-B));break}else{D=c+B-B;break}}else D=c;while(0);A=f[l>>2]|0;C=(A|0)<0?0-A|0:A;E=Jj(C,((C|0)<0)<<31>>31,p)|0;if((E|0)==(p|0)){C=o+11|0;b[C>>0]=48;F=C}else F=E;b[F+-1>>0]=(A>>31&2)+43;A=F+-2|0;b[A>>0]=i+15;E=(e|0)<1;C=(g&8|0)==0;G=m;H=D;while(1){J=~~H;K=G+1|0;b[G>>0]=x|h[15542+J>>0];H=(H-+(J|0))*16.0;if((K-n|0)==1?!(C&(E&H==0.0)):0){b[K>>0]=46;L=G+2|0}else L=K;if(!(H!=0.0))break;else G=L}G=L;if((e|0)!=0?(-2-n+G|0)<(e|0):0){M=G-n|0;N=e+2|0}else{E=G-n|0;M=E;N=E}E=p-A|0;G=E+z+N|0;Hk(a,32,d,G,g);ep(a,y,z);Hk(a,48,d,G,g^65536);ep(a,m,M);Hk(a,48,N-M|0,0,0);ep(a,A,E);Hk(a,32,d,G,g^8192);w=G;break}G=(e|0)<0?6:e;if(v){E=(f[l>>2]|0)+-28|0;f[l>>2]=E;O=c*268435456.0;P=E}else{O=c;P=f[l>>2]|0}E=(P|0)<0?k:k+288|0;C=E;H=O;do{x=~~H>>>0;f[C>>2]=x;C=C+4|0;H=(H-+(x>>>0))*1.0e9}while(H!=0.0);if((P|0)>0){v=E;A=C;z=P;while(1){y=(z|0)<29?z:29;x=A+-4|0;if(x>>>0>=v>>>0){K=x;x=0;do{J=Rn(f[K>>2]|0,0,y|0)|0;Q=Tn(J|0,I|0,x|0,0)|0;J=I;R=an(Q|0,J|0,1e9,0)|0;f[K>>2]=R;x=up(Q|0,J|0,1e9,0)|0;K=K+-4|0}while(K>>>0>=v>>>0);if(x){K=v+-4|0;f[K>>2]=x;S=K}else S=v}else S=v;K=A;while(1){if(K>>>0<=S>>>0)break;J=K+-4|0;if(!(f[J>>2]|0))K=J;else break}x=(f[l>>2]|0)-y|0;f[l>>2]=x;if((x|0)>0){v=S;A=K;z=x}else{T=S;U=K;V=x;break}}}else{T=E;U=C;V=P}if((V|0)<0){z=((G+25|0)/9|0)+1|0;A=(t|0)==102;v=T;x=U;J=V;while(1){Q=0-J|0;R=(Q|0)<9?Q:9;if(v>>>0>>0){Q=(1<>>R;Y=0;Z=v;do{_=f[Z>>2]|0;f[Z>>2]=(_>>>R)+Y;Y=X(_&Q,W)|0;Z=Z+4|0}while(Z>>>0>>0);Z=(f[v>>2]|0)==0?v+4|0:v;if(!Y){$=Z;aa=x}else{f[x>>2]=Y;$=Z;aa=x+4|0}}else{$=(f[v>>2]|0)==0?v+4|0:v;aa=x}Z=A?E:$;W=(aa-Z>>2|0)>(z|0)?Z+(z<<2)|0:aa;J=(f[l>>2]|0)+R|0;f[l>>2]=J;if((J|0)>=0){ba=$;ca=W;break}else{v=$;x=W}}}else{ba=T;ca=U}x=E;if(ba>>>0>>0){v=(x-ba>>2)*9|0;J=f[ba>>2]|0;if(J>>>0<10)da=v;else{z=v;v=10;while(1){v=v*10|0;A=z+1|0;if(J>>>0>>0){da=A;break}else z=A}}}else da=0;z=(t|0)==103;v=(G|0)!=0;J=G-((t|0)!=102?da:0)+((v&z)<<31>>31)|0;if((J|0)<(((ca-x>>2)*9|0)+-9|0)){A=J+9216|0;J=E+4+(((A|0)/9|0)+-1024<<2)|0;C=(A|0)%9|0;if((C|0)<8){A=C;C=10;while(1){W=C*10|0;if((A|0)<7){A=A+1|0;C=W}else{ea=W;break}}}else ea=10;C=f[J>>2]|0;A=(C>>>0)%(ea>>>0)|0;t=(J+4|0)==(ca|0);if(!(t&(A|0)==0)){B=(((C>>>0)/(ea>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;W=(ea|0)/2|0;H=A>>>0>>0?.5:t&(A|0)==(W|0)?1.0:1.5;if(!r){fa=H;ga=B}else{W=(b[s>>0]|0)==45;fa=W?-H:H;ga=W?-B:B}W=C-A|0;f[J>>2]=W;if(ga+fa!=ga){A=W+ea|0;f[J>>2]=A;if(A>>>0>999999999){A=ba;W=J;while(1){C=W+-4|0;f[W>>2]=0;if(C>>>0>>0){t=A+-4|0;f[t>>2]=0;ha=t}else ha=A;t=(f[C>>2]|0)+1|0;f[C>>2]=t;if(t>>>0>999999999){A=ha;W=C}else{ia=ha;ja=C;break}}}else{ia=ba;ja=J}W=(x-ia>>2)*9|0;A=f[ia>>2]|0;if(A>>>0<10){ka=ja;la=W;ma=ia}else{C=W;W=10;while(1){W=W*10|0;t=C+1|0;if(A>>>0>>0){ka=ja;la=t;ma=ia;break}else C=t}}}else{ka=J;la=da;ma=ba}}else{ka=J;la=da;ma=ba}C=ka+4|0;na=la;oa=ca>>>0>C>>>0?C:ca;pa=ma}else{na=da;oa=ca;pa=ba}C=oa;while(1){if(C>>>0<=pa>>>0){qa=0;break}W=C+-4|0;if(!(f[W>>2]|0))C=W;else{qa=1;break}}J=0-na|0;do if(z){W=G+((v^1)&1)|0;if((W|0)>(na|0)&(na|0)>-5){ra=i+-1|0;sa=W+-1-na|0}else{ra=i+-2|0;sa=W+-1|0}W=g&8;if(!W){if(qa?(A=f[C+-4>>2]|0,(A|0)!=0):0)if(!((A>>>0)%10|0)){t=0;Z=10;while(1){Z=Z*10|0;Q=t+1|0;if((A>>>0)%(Z>>>0)|0|0){ta=Q;break}else t=Q}}else ta=0;else ta=9;t=((C-x>>2)*9|0)+-9|0;if((ra|32|0)==102){Z=t-ta|0;A=(Z|0)>0?Z:0;ua=ra;va=(sa|0)<(A|0)?sa:A;wa=0;break}else{A=t+na-ta|0;t=(A|0)>0?A:0;ua=ra;va=(sa|0)<(t|0)?sa:t;wa=0;break}}else{ua=ra;va=sa;wa=W}}else{ua=i;va=G;wa=g&8}while(0);G=va|wa;x=(G|0)!=0&1;v=(ua|32|0)==102;if(v){xa=0;ya=(na|0)>0?na:0}else{z=(na|0)<0?J:na;t=Jj(z,((z|0)<0)<<31>>31,p)|0;z=p;if((z-t|0)<2){A=t;while(1){Z=A+-1|0;b[Z>>0]=48;if((z-Z|0)<2)A=Z;else{za=Z;break}}}else za=t;b[za+-1>>0]=(na>>31&2)+43;A=za+-2|0;b[A>>0]=ua;xa=A;ya=z-A|0}A=r+1+va+x+ya|0;Hk(a,32,d,A,g);ep(a,s,r);Hk(a,48,d,A,g^65536);if(v){J=pa>>>0>E>>>0?E:pa;Z=m+9|0;R=Z;Y=m+8|0;Q=J;do{K=Jj(f[Q>>2]|0,0,Z)|0;if((Q|0)==(J|0))if((K|0)==(Z|0)){b[Y>>0]=48;Aa=Y}else Aa=K;else if(K>>>0>m>>>0){hj(m|0,48,K-n|0)|0;y=K;while(1){_=y+-1|0;if(_>>>0>m>>>0)y=_;else{Aa=_;break}}}else Aa=K;ep(a,Aa,R-Aa|0);Q=Q+4|0}while(Q>>>0<=E>>>0);if(G|0)ep(a,15558,1);if(Q>>>0>>0&(va|0)>0){E=va;R=Q;while(1){Y=Jj(f[R>>2]|0,0,Z)|0;if(Y>>>0>m>>>0){hj(m|0,48,Y-n|0)|0;J=Y;while(1){v=J+-1|0;if(v>>>0>m>>>0)J=v;else{Ba=v;break}}}else Ba=Y;ep(a,Ba,(E|0)<9?E:9);R=R+4|0;J=E+-9|0;if(!(R>>>0>>0&(E|0)>9)){Ca=J;break}else E=J}}else Ca=va;Hk(a,48,Ca+9|0,9,0)}else{E=qa?C:pa+4|0;if((va|0)>-1){R=m+9|0;Z=(wa|0)==0;Q=R;G=0-n|0;J=m+8|0;K=va;v=pa;while(1){x=Jj(f[v>>2]|0,0,R)|0;if((x|0)==(R|0)){b[J>>0]=48;Da=J}else Da=x;do if((v|0)==(pa|0)){x=Da+1|0;ep(a,Da,1);if(Z&(K|0)<1){Ea=x;break}ep(a,15558,1);Ea=x}else{if(Da>>>0<=m>>>0){Ea=Da;break}hj(m|0,48,Da+G|0)|0;x=Da;while(1){z=x+-1|0;if(z>>>0>m>>>0)x=z;else{Ea=z;break}}}while(0);Y=Q-Ea|0;ep(a,Ea,(K|0)>(Y|0)?Y:K);x=K-Y|0;v=v+4|0;if(!(v>>>0>>0&(x|0)>-1)){Fa=x;break}else K=x}}else Fa=va;Hk(a,48,Fa+18|0,18,0);ep(a,xa,p-xa|0)}Hk(a,32,d,A,g^8192);w=A}while(0);u=j;return ((w|0)<(d|0)?d:w)|0}function qb(a,c,e,g,h){a=a|0;c=c|0;e=e|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0;i=u;u=u+64|0;j=i+16|0;k=i;l=i+24|0;m=i+8|0;n=i+20|0;f[j>>2]=c;c=(a|0)!=0;o=l+40|0;q=o;r=l+39|0;l=m+4|0;s=0;t=0;v=0;a:while(1){do if((t|0)>-1)if((s|0)>(2147483647-t|0)){w=ir()|0;f[w>>2]=75;x=-1;break}else{x=s+t|0;break}else x=t;while(0);w=f[j>>2]|0;y=b[w>>0]|0;if(!(y<<24>>24)){z=88;break}else{A=y;B=w}b:while(1){switch(A<<24>>24){case 37:{C=B;D=B;z=9;break b;break}case 0:{E=B;break b;break}default:{}}y=B+1|0;f[j>>2]=y;A=b[y>>0]|0;B=y}c:do if((z|0)==9)while(1){z=0;if((b[D+1>>0]|0)!=37){E=C;break c}y=C+1|0;D=D+2|0;f[j>>2]=D;if((b[D>>0]|0)!=37){E=y;break}else{C=y;z=9}}while(0);y=E-w|0;if(c)ep(a,w,y);if(y|0){s=y;t=x;continue}y=(Pq(b[(f[j>>2]|0)+1>>0]|0)|0)==0;F=f[j>>2]|0;if(!y?(b[F+2>>0]|0)==36:0){G=(b[F+1>>0]|0)+-48|0;H=1;J=3}else{G=-1;H=v;J=1}y=F+J|0;f[j>>2]=y;F=b[y>>0]|0;K=(F<<24>>24)+-32|0;if(K>>>0>31|(1<>24)+-32|K;P=F+1|0;f[j>>2]=P;Q=b[P>>0]|0;R=(Q<<24>>24)+-32|0;if(R>>>0>31|(1<>24==42){if((Pq(b[N+1>>0]|0)|0)!=0?(F=f[j>>2]|0,(b[F+2>>0]|0)==36):0){O=F+1|0;f[h+((b[O>>0]|0)+-48<<2)>>2]=10;S=f[g+((b[O>>0]|0)+-48<<3)>>2]|0;T=1;U=F+3|0}else{if(H|0){V=-1;break}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);O=f[F>>2]|0;f[e>>2]=F+4;W=O}else W=0;S=W;T=0;U=(f[j>>2]|0)+1|0}f[j>>2]=U;O=(S|0)<0;X=O?0-S|0:S;Y=O?L|8192:L;Z=T;_=U}else{O=Cl(j)|0;if((O|0)<0){V=-1;break}X=O;Y=L;Z=H;_=f[j>>2]|0}do if((b[_>>0]|0)==46){if((b[_+1>>0]|0)!=42){f[j>>2]=_+1;O=Cl(j)|0;$=O;aa=f[j>>2]|0;break}if(Pq(b[_+2>>0]|0)|0?(O=f[j>>2]|0,(b[O+3>>0]|0)==36):0){F=O+2|0;f[h+((b[F>>0]|0)+-48<<2)>>2]=10;K=f[g+((b[F>>0]|0)+-48<<3)>>2]|0;F=O+4|0;f[j>>2]=F;$=K;aa=F;break}if(Z|0){V=-1;break a}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);K=f[F>>2]|0;f[e>>2]=F+4;ba=K}else ba=0;K=(f[j>>2]|0)+2|0;f[j>>2]=K;$=ba;aa=K}else{$=-1;aa=_}while(0);K=0;F=aa;while(1){if(((b[F>>0]|0)+-65|0)>>>0>57){V=-1;break a}O=F;F=F+1|0;f[j>>2]=F;ca=b[(b[O>>0]|0)+-65+(15030+(K*58|0))>>0]|0;da=ca&255;if((da+-1|0)>>>0>=8)break;else K=da}if(!(ca<<24>>24)){V=-1;break}O=(G|0)>-1;do if(ca<<24>>24==19)if(O){V=-1;break a}else z=50;else{if(O){f[h+(G<<2)>>2]=da;P=g+(G<<3)|0;Q=f[P+4>>2]|0;y=k;f[y>>2]=f[P>>2];f[y+4>>2]=Q;z=50;break}if(!c){V=0;break a}Ie(k,da,e);ea=f[j>>2]|0}while(0);if((z|0)==50){z=0;if(c)ea=F;else{s=0;t=x;v=Z;continue}}O=b[ea+-1>>0]|0;Q=(K|0)!=0&(O&15|0)==3?O&-33:O;O=Y&-65537;y=(Y&8192|0)==0?Y:O;d:do switch(Q|0){case 110:{switch((K&255)<<24>>24){case 0:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 1:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 2:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}case 3:{d[f[k>>2]>>1]=x;s=0;t=x;v=Z;continue a;break}case 4:{b[f[k>>2]>>0]=x;s=0;t=x;v=Z;continue a;break}case 6:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 7:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}default:{s=0;t=x;v=Z;continue a}}break}case 112:{fa=120;ga=$>>>0>8?$:8;ha=y|8;z=62;break}case 88:case 120:{fa=Q;ga=$;ha=y;z=62;break}case 111:{P=k;R=f[P>>2]|0;ia=f[P+4>>2]|0;P=Gl(R,ia,o)|0;ja=q-P|0;ka=P;la=0;ma=15494;na=(y&8|0)==0|($|0)>(ja|0)?$:ja+1|0;oa=y;pa=R;qa=ia;z=68;break}case 105:case 100:{ia=k;R=f[ia>>2]|0;ja=f[ia+4>>2]|0;if((ja|0)<0){ia=Vn(0,0,R|0,ja|0)|0;P=I;ra=k;f[ra>>2]=ia;f[ra+4>>2]=P;sa=1;ta=15494;ua=ia;va=P;z=67;break d}else{sa=(y&2049|0)!=0&1;ta=(y&2048|0)==0?((y&1|0)==0?15494:15496):15495;ua=R;va=ja;z=67;break d}break}case 117:{ja=k;sa=0;ta=15494;ua=f[ja>>2]|0;va=f[ja+4>>2]|0;z=67;break}case 99:{b[r>>0]=f[k>>2];wa=r;xa=0;ya=15494;za=o;Aa=1;Ba=O;break}case 109:{ja=ir()|0;Ca=kp(f[ja>>2]|0)|0;z=72;break}case 115:{ja=f[k>>2]|0;Ca=ja|0?ja:15504;z=72;break}case 67:{f[m>>2]=f[k>>2];f[l>>2]=0;f[k>>2]=m;Da=-1;Ea=m;z=76;break}case 83:{ja=f[k>>2]|0;if(!$){Hk(a,32,X,0,y);Fa=0;z=85}else{Da=$;Ea=ja;z=76}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{s=pb(a,+p[k>>3],X,$,y,Q)|0;t=x;v=Z;continue a;break}default:{wa=w;xa=0;ya=15494;za=o;Aa=$;Ba=y}}while(0);e:do if((z|0)==62){z=0;w=k;Q=f[w>>2]|0;K=f[w+4>>2]|0;w=ol(Q,K,o,fa&32)|0;F=(ha&8|0)==0|(Q|0)==0&(K|0)==0;ka=w;la=F?0:2;ma=F?15494:15494+(fa>>4)|0;na=ga;oa=ha;pa=Q;qa=K;z=68}else if((z|0)==67){z=0;ka=Jj(ua,va,o)|0;la=sa;ma=ta;na=$;oa=y;pa=ua;qa=va;z=68}else if((z|0)==72){z=0;K=cg(Ca,0,$)|0;Q=(K|0)==0;wa=Ca;xa=0;ya=15494;za=Q?Ca+$|0:K;Aa=Q?$:K-Ca|0;Ba=O}else if((z|0)==76){z=0;K=Ea;Q=0;F=0;while(1){w=f[K>>2]|0;if(!w){Ga=Q;Ha=F;break}ja=Yo(n,w)|0;if((ja|0)<0|ja>>>0>(Da-Q|0)>>>0){Ga=Q;Ha=ja;break}w=ja+Q|0;if(Da>>>0>w>>>0){K=K+4|0;Q=w;F=ja}else{Ga=w;Ha=ja;break}}if((Ha|0)<0){V=-1;break a}Hk(a,32,X,Ga,y);if(!Ga){Fa=0;z=85}else{F=Ea;Q=0;while(1){K=f[F>>2]|0;if(!K){Fa=Ga;z=85;break e}ja=Yo(n,K)|0;Q=ja+Q|0;if((Q|0)>(Ga|0)){Fa=Ga;z=85;break e}ep(a,n,ja);if(Q>>>0>=Ga>>>0){Fa=Ga;z=85;break}else F=F+4|0}}}while(0);if((z|0)==68){z=0;O=(pa|0)!=0|(qa|0)!=0;F=(na|0)!=0|O;Q=q-ka+((O^1)&1)|0;wa=F?ka:o;xa=la;ya=ma;za=o;Aa=F?((na|0)>(Q|0)?na:Q):na;Ba=(na|0)>-1?oa&-65537:oa}else if((z|0)==85){z=0;Hk(a,32,X,Fa,y^8192);s=(X|0)>(Fa|0)?X:Fa;t=x;v=Z;continue}Q=za-wa|0;F=(Aa|0)<(Q|0)?Q:Aa;O=F+xa|0;ja=(X|0)<(O|0)?O:X;Hk(a,32,ja,O,Ba);ep(a,ya,xa);Hk(a,48,ja,O,Ba^65536);Hk(a,48,F,Q,0);ep(a,wa,Q);Hk(a,32,ja,O,Ba^8192);s=ja;t=x;v=Z}f:do if((z|0)==88)if(!a)if(v){Z=1;while(1){t=f[h+(Z<<2)>>2]|0;if(!t){Ia=Z;break}Ie(g+(Z<<3)|0,t,e);t=Z+1|0;if((Z|0)<9)Z=t;else{Ia=t;break}}if((Ia|0)<10){Z=Ia;while(1){if(f[h+(Z<<2)>>2]|0){V=-1;break f}if((Z|0)<9)Z=Z+1|0;else{V=1;break}}}else V=1}else V=0;else V=x;while(0);u=i;return V|0}function rb(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=Oa,ma=Oa,na=Oa,oa=0,pa=0,qa=0,ra=0,sa=0;c=u;u=u+64|0;d=c+28|0;e=c+16|0;g=c+4|0;h=c;i=a;j=a+80|0;k=f[j>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=i;l=d+20|0;n[l>>2]=$(1.0);f[d+24>>2]=i;qh(d,k);k=f[j>>2]|0;f[e>>2]=0;i=e+4|0;f[i>>2]=0;f[e+8>>2]=0;m=(k|0)==0;do if(!m)if(k>>>0>1073741823)mq(e);else{o=k<<2;p=dn(o)|0;f[e>>2]=p;q=p+(k<<2)|0;f[e+8>>2]=q;hj(p|0,0,o|0)|0;f[i>>2]=q;break}while(0);f[g>>2]=0;k=g+4|0;f[k>>2]=0;f[g+8>>2]=0;f[h>>2]=0;if(!m){m=d+16|0;q=d+4|0;o=d+12|0;p=d+8|0;r=g+8|0;s=d+24|0;t=0;v=0;while(1){w=f[m>>2]|0;x=f[w+8>>2]|0;y=(f[w+12>>2]|0)-x|0;w=(y|0)>0;z=x;if(w){x=y>>>2;A=0;B=0;while(1){C=f[z+(A<<2)>>2]|0;if(!(b[C+84>>0]|0))D=f[(f[C+68>>2]|0)+(v<<2)>>2]|0;else D=v;C=D+239^B;A=A+1|0;if((A|0)>=(x|0)){E=C;break}else B=C}}else E=0;B=f[q>>2]|0;x=(B|0)==0;a:do if(!x){A=B+-1|0;C=(A&B|0)==0;if(!C)if(E>>>0>>0)F=E;else F=(E>>>0)%(B>>>0)|0;else F=A&E;G=f[(f[d>>2]|0)+(F<<2)>>2]|0;if((G|0)!=0?(H=f[G>>2]|0,(H|0)!=0):0){G=f[s>>2]|0;I=G+8|0;J=G+12|0;b:do if(C){G=H;while(1){K=f[G+4>>2]|0;L=(K|0)==(E|0);if(!(L|(K&A|0)==(F|0))){M=44;break a}c:do if(L){K=f[G+8>>2]|0;N=f[I>>2]|0;O=(f[J>>2]|0)-N|0;P=N;if((O|0)<=0){Q=G;break b}N=O>>>2;O=0;while(1){R=f[P+(O<<2)>>2]|0;if(!(b[R+84>>0]|0)){S=f[R+68>>2]|0;T=f[S+(v<<2)>>2]|0;U=f[S+(K<<2)>>2]|0}else{T=v;U=K}O=O+1|0;if((U|0)!=(T|0))break c;if((O|0)>=(N|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}else{G=H;while(1){L=f[G+4>>2]|0;d:do if((L|0)!=(E|0)){if(L>>>0>>0)X=L;else X=(L>>>0)%(B>>>0)|0;if((X|0)!=(F|0)){M=44;break a}}else{N=f[G+8>>2]|0;O=f[I>>2]|0;K=(f[J>>2]|0)-O|0;P=O;if((K|0)<=0){Q=G;break b}O=K>>>2;K=0;while(1){S=f[P+(K<<2)>>2]|0;if(!(b[S+84>>0]|0)){R=f[S+68>>2]|0;Y=f[R+(v<<2)>>2]|0;Z=f[R+(N<<2)>>2]|0}else{Y=v;Z=N}K=K+1|0;if((Z|0)!=(Y|0))break d;if((K|0)>=(O|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}while(0);if((M|0)==42){M=0;if(!V){M=44;break}else Q=V}f[(f[e>>2]|0)+(v<<2)>>2]=f[Q+12>>2];_=t}else M=44}else M=44;while(0);do if((M|0)==44){M=0;if(w){J=y>>>2;I=0;H=0;while(1){A=f[z+(I<<2)>>2]|0;if(!(b[A+84>>0]|0))aa=f[(f[A+68>>2]|0)+(v<<2)>>2]|0;else aa=v;A=aa+239^H;I=I+1|0;if((I|0)>=(J|0)){ba=A;break}else H=A}}else ba=0;e:do if(!x){H=B+-1|0;J=(H&B|0)==0;if(!J)if(ba>>>0>>0)ca=ba;else ca=(ba>>>0)%(B>>>0)|0;else ca=H&ba;I=f[(f[d>>2]|0)+(ca<<2)>>2]|0;if((I|0)!=0?(A=f[I>>2]|0,(A|0)!=0):0){I=f[s>>2]|0;C=I+8|0;G=I+12|0;if(J){J=A;while(1){I=f[J+4>>2]|0;if(!((I|0)==(ba|0)|(I&H|0)==(ca|0))){da=ca;M=76;break e}I=f[J+8>>2]|0;L=f[C>>2]|0;O=(f[G>>2]|0)-L|0;K=L;if((O|0)<=0){ea=v;break e}L=O>>>2;O=0;while(1){N=f[K+(O<<2)>>2]|0;if(!(b[N+84>>0]|0)){P=f[N+68>>2]|0;fa=f[P+(v<<2)>>2]|0;ga=f[P+(I<<2)>>2]|0}else{fa=v;ga=I}O=O+1|0;if((ga|0)!=(fa|0))break;if((O|0)>=(L|0)){ea=v;break e}}J=f[J>>2]|0;if(!J){da=ca;M=76;break e}}}else ha=A;while(1){J=f[ha+4>>2]|0;if((J|0)!=(ba|0)){if(J>>>0>>0)ia=J;else ia=(J>>>0)%(B>>>0)|0;if((ia|0)!=(ca|0)){da=ca;M=76;break e}}J=f[ha+8>>2]|0;H=f[C>>2]|0;L=(f[G>>2]|0)-H|0;O=H;if((L|0)<=0){ea=v;break e}H=L>>>2;L=0;while(1){I=f[O+(L<<2)>>2]|0;if(!(b[I+84>>0]|0)){K=f[I+68>>2]|0;ja=f[K+(v<<2)>>2]|0;ka=f[K+(J<<2)>>2]|0}else{ja=v;ka=J}L=L+1|0;if((ka|0)!=(ja|0))break;if((L|0)>=(H|0)){ea=v;break e}}ha=f[ha>>2]|0;if(!ha){da=ca;M=76;break}}}else{da=ca;M=76}}else{da=0;M=76}while(0);if((M|0)==76){M=0;G=dn(16)|0;f[G+8>>2]=v;f[G+12>>2]=t;f[G+4>>2]=ba;f[G>>2]=0;la=$(((f[o>>2]|0)+1|0)>>>0);ma=$(B>>>0);na=$(n[l>>2]);do if(x|$(na*ma)>>0<3|(B+-1&B|0)!=0)&1;A=~~$(W($(la/na)))>>>0;qh(d,C>>>0>>0?A:C);C=f[q>>2]|0;A=C+-1|0;if(!(A&C)){oa=C;pa=A&ba;break}if(ba>>>0>>0){oa=C;pa=ba}else{oa=C;pa=(ba>>>0)%(C>>>0)|0}}else{oa=B;pa=da}while(0);C=(f[d>>2]|0)+(pa<<2)|0;A=f[C>>2]|0;if(!A){f[G>>2]=f[p>>2];f[p>>2]=G;f[C>>2]=p;C=f[G>>2]|0;if(C|0){H=f[C+4>>2]|0;C=oa+-1|0;if(C&oa)if(H>>>0>>0)qa=H;else qa=(H>>>0)%(oa>>>0)|0;else qa=H&C;ra=(f[d>>2]|0)+(qa<<2)|0;M=89}}else{f[G>>2]=f[A>>2];ra=A;M=89}if((M|0)==89){M=0;f[ra>>2]=G}f[o>>2]=(f[o>>2]|0)+1;ea=f[h>>2]|0}A=t+1|0;f[(f[e>>2]|0)+(ea<<2)>>2]=t;C=f[k>>2]|0;if((C|0)==(f[r>>2]|0)){Ci(g,h);_=A;break}else{f[C>>2]=f[h>>2];f[k>>2]=C+4;_=A;break}}while(0);v=(f[h>>2]|0)+1|0;f[h>>2]=v;sa=f[j>>2]|0;if(v>>>0>=sa>>>0)break;else t=_}if((_|0)!=(sa|0)){Xa[f[(f[a>>2]|0)+24>>2]&15](a,e,g);f[j>>2]=_}}_=f[g>>2]|0;if(_|0){g=f[k>>2]|0;if((g|0)!=(_|0))f[k>>2]=g+(~((g+-4-_|0)>>>2)<<2);br(_)}_=f[e>>2]|0;if(_|0){e=f[i>>2]|0;if((e|0)!=(_|0))f[i>>2]=e+(~((e+-4-_|0)>>>2)<<2);br(_)}_=f[d+8>>2]|0;if(_|0){e=_;do{_=e;e=f[e>>2]|0;br(_)}while((e|0)!=0)}e=f[d>>2]|0;f[d>>2]=0;if(!e){u=c;return}br(e);u=c;return}function sb(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0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0<1073741823?(L>>>0>>0?N:L):2147483647);ia=f[T>>2]|0;break}else ia=F;while(0);f[T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return 1}while(0);do if(r)ja=m<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return 1}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return 1}function tb(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0;g=u;u=u+80|0;h=g+76|0;i=g+72|0;j=g+48|0;k=g+24|0;l=g;m=a+32|0;n=f[c>>2]|0;c=n+1|0;do if((n|0)!=-1){o=((c>>>0)%3|0|0)==0?n+-2|0:c;if(!((n>>>0)%3|0)){p=n+2|0;q=o;break}else{p=n+-1|0;q=o;break}}else{p=-1;q=-1}while(0);n=f[(f[m>>2]|0)+28>>2]|0;m=f[n+(q<<2)>>2]|0;q=f[n+(p<<2)>>2]|0;p=f[a+36>>2]|0;n=f[p>>2]|0;c=(f[p+4>>2]|0)-n>>2;if(c>>>0<=m>>>0)mq(p);o=n;n=f[o+(m<<2)>>2]|0;if(c>>>0<=q>>>0)mq(p);p=f[o+(q<<2)>>2]|0;q=(n|0)<(e|0);do if(q&(p|0)<(e|0)){o=n<<1;c=f[d+(o<<2)>>2]|0;m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O|0,J|0)|0;J=I;O=on(P|0,U|0,P|0,U|0)|0;U=Tn(O|0,I|0,T|0,J|0)|0;J=I;T=Vn(F|0,M|0,G|0,s|0)|0;M=I;F=Vn(B|0,E|0,H|0,C|0)|0;E=I;B=on(T|0,M|0,T|0,M|0)|0;M=I;T=on(F|0,E|0,F|0,E|0)|0;E=Tn(T|0,I|0,B|0,M|0)|0;M=I;B=a+16|0;T=a+20|0;F=f[T>>2]|0;O=f[a+24>>2]|0;P=(F|0)==(O<<5|0);if(J>>>0>>0|(J|0)==(M|0)&U>>>0>>0){do if(P)if((F+1|0)<0)mq(B);else{E=O<<6;U=F+32&-32;hi(B,F>>>0<1073741823?(E>>>0>>0?U:E):2147483647);da=f[T>>2]|0;break}else da=F;while(0);f[T>>2]=da+1;L=(f[B>>2]|0)+(da>>>5<<2)|0;f[L>>2]=f[L>>2]|1<<(da&31);ea=x;fa=c;ga=K;ha=D}else{do if(P)if((F+1|0)<0)mq(B);else{L=O<<6;N=F+32&-32;hi(B,F>>>0<1073741823?(L>>>0>>0?N:L):2147483647);ia=f[T>>2]|0;break}else ia=F;while(0);f[T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return 1}while(0);do if(q)ja=n<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return 1}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return 1}function ub(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=Oa,D=0,E=0.0,F=0,G=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Tn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){m=b[o>>0]|0;q=g+(r<<3)|0;f[q>>2]=m;f[q+4>>2]=((m|0)<0)<<31>>31;r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=g+(t<<3)|0;f[k>>2]=h[m>>0];f[k+4>>2]=0;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){o=d[l>>1]|0;k=g+(q<<3)|0;f[k>>2]=o;f[k+4>>2]=((o|0)<0)<<31>>31;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=on(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Tn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=j[r>>1];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(r<<3)|0,0,(e<<24>>24)-r<<3|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=on(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Tn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){l=f[t>>2]|0;m=g+(o<<3)|0;f[m>>2]=l;f[m+4>>2]=((l|0)<0)<<31>>31;o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(t<<3)|0,0,(e<<24>>24)-t<<3|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=on(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Tn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){r=g+(m<<3)|0;f[r>>2]=f[q>>2];f[r+4>>2]=0;m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(q<<3)|0,0,(e<<24>>24)-q<<3|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=on(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Tn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){t=k;r=f[t+4>>2]|0;z=g+(l<<3)|0;f[z>>2]=f[t>>2];f[z+4>>2]=r;l=l+1|0;r=b[q>>0]|0;if((l|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){A=r;break}else k=k+8|0}}else A=m;k=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(k<<3)|0,0,(e<<24>>24)-k<<3|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;r=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;z=Tn(r|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+z|0;z=0;while(1){q=o;r=f[q+4>>2]|0;t=g+(z<<3)|0;f[t>>2]=f[q>>2];f[t+4>>2]=r;z=z+1|0;r=b[k>>0]|0;if((z|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){B=r;break}else o=o+8|0}}else B=l;o=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 9:{o=a+24|0;z=b[o>>0]|0;if((z<<24>>24>e<<24>>24?e:z)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;r=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(r|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){C=$(n[m>>2]);k=+K(+C)>=1.0?(+C>0.0?~~+Y(+J(+C/4294967296.0),4294967295.0)>>>0:~~+W((+C-+(~~+C>>>0))/4294967296.0)>>>0):0;r=g+(t<<3)|0;f[r>>2]=~~+C>>>0;f[r+4>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){D=k;break}else m=m+4|0}}else D=z;m=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;r=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+r|0;r=0;while(1){E=+p[l>>3];o=+K(E)>=1.0?(E>0.0?~~+Y(+J(E/4294967296.0),4294967295.0)>>>0:~~+W((E-+(~~E>>>0))/4294967296.0)>>>0):0;k=g+(r<<3)|0;f[k>>2]=~~E>>>0;f[k+4>>2]=o;r=r+1|0;o=b[m>>0]|0;if((r|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){F=o;break}else l=l+8|0}}else F=t;l=F<<24>>24;if(F<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 11:{l=a+24|0;r=b[l>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){m=f[f[a>>2]>>2]|0;z=a+40|0;o=on(f[z>>2]|0,f[z+4>>2]|0,f[c>>2]|0,0)|0;z=a+48|0;k=Tn(o|0,I|0,f[z>>2]|0,f[z+4>>2]|0)|0;z=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=h[z>>0];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){G=m;break}else z=z+1|0}}else G=r;z=G<<24>>24;if(G<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(z<<3)|0,0,(e<<24>>24)-z<<3|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function vb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;c=u;u=u+16|0;d=c+8|0;e=c;if((f[a+92>>2]|0)==(f[a+88>>2]|0)){u=c;return 1}g=a+52|0;h=f[g>>2]|0;if((h|0)==(f[a+56>>2]|0)){Ci(a+48|0,b);i=b}else{f[h>>2]=f[b>>2];f[g>>2]=h+4;i=b}b=a+84|0;f[b>>2]=0;h=a+4|0;g=f[h>>2]|0;j=f[i>>2]|0;k=j+1|0;if((j|0)!=-1){l=((k>>>0)%3|0|0)==0?j+-2|0:k;if((l|0)==-1)m=-1;else m=f[(f[g>>2]|0)+(l<<2)>>2]|0;l=(((j>>>0)%3|0|0)==0?2:-1)+j|0;if((l|0)==-1){n=m;o=-1}else{n=m;o=f[(f[g>>2]|0)+(l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2)>>2]=f[s>>2];f[s>>2]=(f[s>>2]|0)+1}s=f[i>>2]|0;if((s|0)==-1)v=-1;else v=f[(f[f[h>>2]>>2]|0)+(s<<2)>>2]|0;s=(f[l>>2]|0)+(v>>>5<<2)|0;o=1<<(v&31);t=f[s>>2]|0;if(!(o&t)){f[s>>2]=t|o;o=f[i>>2]|0;f[e>>2]=o;t=f[(f[(f[a+16>>2]|0)+96>>2]|0)+(((o>>>0)/3|0)*12|0)+(((o>>>0)%3|0)<<2)>>2]|0;o=f[a+20>>2]|0;f[d>>2]=t;s=f[o+4>>2]|0;o=s+4|0;p=f[o>>2]|0;if((p|0)==(f[s+8>>2]|0))Ci(s,d);else{f[p>>2]=t;f[o>>2]=p+4}p=a+12|0;o=f[p>>2]|0;t=o+4|0;s=f[t>>2]|0;if((s|0)==(f[o+8>>2]|0)){Ci(o,e);w=f[p>>2]|0}else{f[s>>2]=f[e>>2];f[t>>2]=s+4;w=o}o=w+24|0;f[(f[w+12>>2]|0)+(v<<2)>>2]=f[o>>2];f[o>>2]=(f[o>>2]|0)+1}o=f[b>>2]|0;a:do if((o|0)<3){v=a+24|0;w=a+16|0;s=a+20|0;t=a+12|0;p=a+88|0;r=o;while(1){g=r;while(1){x=a+48+(g*12|0)+4|0;y=f[x>>2]|0;if((f[a+48+(g*12|0)>>2]|0)!=(y|0))break;if((g|0)<2)g=g+1|0;else break a}n=y+-4|0;q=f[n>>2]|0;f[x>>2]=n;f[b>>2]=g;f[i>>2]=q;if((q|0)==-1)break;n=(q>>>0)/3|0;j=f[v>>2]|0;do if(!(f[j+(n>>>5<<2)>>2]&1<<(n&31))){k=q;m=j;b:while(1){z=(k>>>0)/3|0;A=m+(z>>>5<<2)|0;f[A>>2]=1<<(z&31)|f[A>>2];A=f[i>>2]|0;if((A|0)==-1)B=-1;else B=f[(f[f[h>>2]>>2]|0)+(A<<2)>>2]|0;z=(f[l>>2]|0)+(B>>>5<<2)|0;C=1<<(B&31);D=f[z>>2]|0;if(!(C&D)){f[z>>2]=D|C;C=f[i>>2]|0;f[e>>2]=C;D=f[(f[(f[w>>2]|0)+96>>2]|0)+(((C>>>0)/3|0)*12|0)+(((C>>>0)%3|0)<<2)>>2]|0;C=f[s>>2]|0;f[d>>2]=D;z=f[C+4>>2]|0;C=z+4|0;E=f[C>>2]|0;if((E|0)==(f[z+8>>2]|0))Ci(z,d);else{f[E>>2]=D;f[C>>2]=E+4}E=f[t>>2]|0;C=E+4|0;D=f[C>>2]|0;if((D|0)==(f[E+8>>2]|0)){Ci(E,e);F=f[t>>2]|0}else{f[D>>2]=f[e>>2];f[C>>2]=D+4;F=E}E=F+24|0;f[(f[F+12>>2]|0)+(B<<2)>>2]=f[E>>2];f[E>>2]=(f[E>>2]|0)+1;G=f[i>>2]|0}else G=A;A=f[h>>2]|0;if((G|0)==-1){H=93;break}E=G+1|0;D=((E>>>0)%3|0|0)==0?G+-2|0:E;if((D|0)==-1)I=-1;else I=f[(f[A+12>>2]|0)+(D<<2)>>2]|0;D=(((G>>>0)%3|0|0)==0?2:-1)+G|0;if((D|0)==-1)J=-1;else J=f[(f[A+12>>2]|0)+(D<<2)>>2]|0;D=(I|0)==-1;E=D?-1:(I>>>0)/3|0;C=(J|0)==-1;z=C?-1:(J>>>0)/3|0;if(D)K=1;else K=(f[(f[v>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)!=0;do if(C)if(K){H=93;break b}else H=82;else{if(f[(f[v>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)if(K){H=93;break b}else{H=82;break}E=f[(f[A>>2]|0)+(J<<2)>>2]|0;if(!(1<<(E&31)&f[(f[l>>2]|0)+(E>>>5<<2)>>2])){L=(f[p>>2]|0)+(E<<2)|0;E=f[L>>2]|0;f[L>>2]=E+1;M=(E|0)>0?1:2}else M=0;if(K?(M|0)<=(f[b>>2]|0):0){N=J;break}f[d>>2]=J;E=a+48+(M*12|0)+4|0;L=f[E>>2]|0;if((L|0)==(f[a+48+(M*12|0)+8>>2]|0))Ci(a+48+(M*12|0)|0,d);else{f[L>>2]=J;f[E>>2]=L+4}if((f[b>>2]|0)>(M|0))f[b>>2]=M;if(K){H=93;break b}else H=82}while(0);if((H|0)==82){H=0;if(D)O=-1;else O=f[(f[f[h>>2]>>2]|0)+(I<<2)>>2]|0;if(!(1<<(O&31)&f[(f[l>>2]|0)+(O>>>5<<2)>>2])){A=(f[p>>2]|0)+(O<<2)|0;z=f[A>>2]|0;f[A>>2]=z+1;P=(z|0)>0?1:2}else P=0;if((P|0)>(f[b>>2]|0))break;else N=I}f[i>>2]=N;k=N;m=f[v>>2]|0}if((H|0)==93){H=0;Q=f[b>>2]|0;break}f[d>>2]=I;m=a+48+(P*12|0)+4|0;k=f[m>>2]|0;if((k|0)==(f[a+48+(P*12|0)+8>>2]|0))Ci(a+48+(P*12|0)|0,d);else{f[k>>2]=I;f[m>>2]=k+4}k=f[b>>2]|0;if((k|0)>(P|0)){f[b>>2]=P;R=P}else R=k;Q=R}else Q=g;while(0);if((Q|0)<3)r=Q;else break a}u=c;return 1}while(0);f[i>>2]=-1;u=c;return 1}function wb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}wb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;wb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function xb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}xb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;xb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function yb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}yb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;yb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function zb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}zb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;zb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Ab(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ab(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ab(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}} -function Bb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Bb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Bb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Cb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Cb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Cb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Db(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Db(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Db(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Eb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Eb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Eb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Fb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Fb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Fb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Gb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Gb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Gb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Hb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Hb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Ib(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ib(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ib(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Jb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Jb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Jb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Kb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Kb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Kb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Lb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Lb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Lb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Mb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Mb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Mb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Nb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=Tf(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Cg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=Qd(h,Y,c)|0;j=Y+4|0;if(Qd(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Nb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Nb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)mq(d);_=$;if(i>>>0<=Y>>>0)mq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Cg(h,h+4|0,e,c)|0;return}case 12:{Qg(h,h+4|0,h+8|0,e,c)|0;return}case 13:{Tf(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{Pg(h,a,c);return}case 20:{mq(p);break}case 22:{mq(p);break}case 26:{mq(p);break}case 32:{mq(p);break}case 38:{mq(A);break}case 40:{mq(A);break}case 46:{mq(A);break}case 47:{mq(A);break}case 51:{mq(p);break}case 57:{mq(R);break}case 59:{mq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)mq(S);else mq(S);break}case 66:{mq(S);break}case 72:{mq(Z);break}case 74:{mq(Z);break}case 84:return}}function Ob(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Tn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=on(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Tn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=on(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Tn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=on(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Tn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=on(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Tn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Tn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2])>>>0;f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3]>>>0;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=on(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Tn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Pb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Tn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=on(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Tn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=on(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Tn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=on(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Tn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=on(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Tn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=on(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Tn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=on(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Tn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2]);f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=on(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Tn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=on(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Tn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}hj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Qb(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=Oa,J=0,K=0,L=0,M=0,N=Oa;e=u;u=u+48|0;g=e+36|0;h=e+24|0;i=e+12|0;j=e;if(!(ih(a,c,d)|0)){k=0;u=e;return k|0}l=f[(f[(f[c+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;if((f[l+28>>2]|0)!=9){k=0;u=e;return k|0}m=c+48|0;c=f[m>>2]|0;o=dn(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=17;p=o;q=12932;r=p+17|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+17>>0]=0;o=c+16|0;s=f[o>>2]|0;if(s){t=o;v=s;a:while(1){s=v;while(1){if((f[s+16>>2]|0)>=(d|0))break;w=f[s+4>>2]|0;if(!w){x=t;break a}else s=w}v=f[s>>2]|0;if(!v){x=s;break}else t=s}if(((x|0)!=(o|0)?(f[x+16>>2]|0)<=(d|0):0)?(o=x+20|0,(sh(o,g)|0)!=0):0)y=yk(o,g,-1)|0;else z=12}else z=12;if((z|0)==12)y=yk(c,g,-1)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);if((y|0)<1){k=0;u=e;return k|0}c=f[m>>2]|0;o=dn(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=19;p=o;q=13005;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+19>>0]=0;o=c+16|0;x=f[o>>2]|0;if(x){t=o;v=x;b:while(1){x=v;while(1){if((f[x+16>>2]|0)>=(d|0))break;w=f[x+4>>2]|0;if(!w){A=t;break b}else x=w}v=f[x>>2]|0;if(!v){A=x;break}else t=x}if((A|0)!=(o|0)?(f[A+16>>2]|0)<=(d|0):0)B=A+20|0;else z=24}else z=24;if((z|0)==24)B=c;if(!(sh(B,g)|0))C=0;else{B=f[m>>2]|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;c=dn(32)|0;f[h>>2]=c;f[h+8>>2]=-2147483616;f[h+4>>2]=18;p=c;q=13025;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[c+18>>0]=0;c=B+16|0;A=f[c>>2]|0;if(A){o=c;t=A;c:while(1){A=t;while(1){if((f[A+16>>2]|0)>=(d|0))break;v=f[A+4>>2]|0;if(!v){D=o;break c}else A=v}t=f[A>>2]|0;if(!t){D=A;break}else o=A}if((D|0)!=(c|0)?(f[D+16>>2]|0)<=(d|0):0)E=D+20|0;else z=34}else z=34;if((z|0)==34)E=B;B=(sh(E,h)|0)!=0;if((b[h+11>>0]|0)<0)br(f[h>>2]|0);C=B}if((b[g+11>>0]|0)<0)br(f[g>>2]|0);if(!C){Kd(a+40|0,l,y)|0;k=1;u=e;return k|0}C=l+24|0;l=b[C>>0]|0;B=l<<24>>24;f[i>>2]=0;E=i+4|0;f[E>>2]=0;f[i+8>>2]=0;do if(l<<24>>24)if(l<<24>>24<0)mq(i);else{D=B<<2;c=dn(D)|0;f[i>>2]=c;o=c+(B<<2)|0;f[i+8>>2]=o;hj(c|0,0,D|0)|0;f[E>>2]=o;F=c;break}else F=0;while(0);B=f[m>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=dn(32)|0;f[j>>2]=l;f[j+8>>2]=-2147483616;f[j+4>>2]=19;p=l;q=13005;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[l+19>>0]=0;l=b[C>>0]|0;c=l<<24>>24;o=B+16|0;D=f[o>>2]|0;if(D){t=o;x=D;d:while(1){D=x;while(1){if((f[D+16>>2]|0)>=(d|0))break;v=f[D+4>>2]|0;if(!v){G=t;break d}else D=v}x=f[D>>2]|0;if(!x){G=D;break}else t=D}if(((G|0)!=(o|0)?(f[G+16>>2]|0)<=(d|0):0)?(o=G+20|0,(sh(o,j)|0)!=0):0){t=zg(o,j)|0;if((t|0)!=(G+24|0)){dj(g,t+28|0);t=g+11|0;G=b[t>>0]|0;o=G<<24>>24<0;if(!((o?f[g+4>>2]|0:G&255)|0))H=G;else{if(l<<24>>24>0){x=o?f[g>>2]|0:g;o=0;do{I=$(pq(x,h));A=x;x=f[h>>2]|0;if((A|0)==(x|0))break;n[F+(o<<2)>>2]=I;o=o+1|0}while((o|0)<(c|0));J=b[t>>0]|0}else J=G;H=J}if(H<<24>>24<0)br(f[g>>2]|0)}}else z=64}else z=64;if((z|0)==64?(H=zg(B,j)|0,(H|0)!=(B+4|0)):0){dj(g,H+28|0);H=g+11|0;B=b[H>>0]|0;J=B<<24>>24<0;if(!((J?f[g+4>>2]|0:B&255)|0))K=B;else{if(l<<24>>24>0){l=J?f[g>>2]|0:g;J=0;do{I=$(pq(l,h));G=l;l=f[h>>2]|0;if((G|0)==(l|0))break;n[F+(J<<2)>>2]=I;J=J+1|0}while((J|0)<(c|0));L=b[H>>0]|0}else L=B;K=L}if(K<<24>>24<0)br(f[g>>2]|0)}if((b[j+11>>0]|0)<0)br(f[j>>2]|0);j=f[m>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;m=dn(32)|0;f[g>>2]=m;f[g+8>>2]=-2147483616;f[g+4>>2]=18;p=m;q=13025;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[m+18>>0]=0;m=j+16|0;q=f[m>>2]|0;if(q){p=m;r=q;e:while(1){q=r;while(1){if((f[q+16>>2]|0)>=(d|0))break;K=f[q+4>>2]|0;if(!K){M=p;break e}else q=K}r=f[q>>2]|0;if(!r){M=q;break}else p=q}if(((M|0)!=(m|0)?(f[M+16>>2]|0)<=(d|0):0)?(d=M+20|0,(sh(d,g)|0)!=0):0)N=$(kk(d,g,$(1.0)));else z=86}else z=86;if((z|0)==86)N=$(kk(j,g,$(1.0)));if((b[g+11>>0]|0)<0)br(f[g>>2]|0);wl(a+40|0,y,f[i>>2]|0,b[C>>0]|0,N);C=f[i>>2]|0;if(C|0){i=f[E>>2]|0;if((i|0)!=(C|0))f[E>>2]=i+(~((i+-4-C|0)>>>2)<<2);br(C)}k=1;u=e;return k|0}function Rb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X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|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){Vi(g,0);ua=k}else{Vi(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U|0;else va=U;U=c+(N<<2)|0;f[U>>2]=va;O=f[ua+4>>2]|0;if((O|0)<0)wa=(f[F>>2]|0)+O|0;else wa=O;f[U+4>>2]=wa;K=K+1|0;if((K|0)>=(r|0)){la=3;break}U=f[o>>2]|0;L=f[U>>2]|0;if((f[U+4>>2]|0)-L>>2>>>0<=K>>>0){J=U;la=4;break}}if((la|0)==3){u=e;return 1}else if((la|0)==4)mq(J);return 0}function Sb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,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){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){Vi(g,0);ua=k}else{Vi(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U|0;else va=U;U=c+(N<<2)|0;f[U>>2]=va;O=f[ua+4>>2]|0;if((O|0)<0)wa=(f[F>>2]|0)+O|0;else wa=O;f[U+4>>2]=wa;K=K+1|0;if((K|0)>=(r|0)){la=3;break}U=f[o>>2]|0;L=f[U>>2]|0;if((f[U+4>>2]|0)-L>>2>>>0<=K>>>0){J=U;la=4;break}}if((la|0)==3){u=e;return 1}else if((la|0)==4)mq(J);return 0}function Tb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;c=u;u=u+16|0;d=c+8|0;e=c;g=f[b>>2]|0;if((g|0)==-1){h=1;u=c;return h|0}i=(g>>>0)/3|0;j=a+24|0;if(f[(f[j>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0){h=1;u=c;return h|0}i=a+48|0;k=f[i>>2]|0;l=a+52|0;m=f[l>>2]|0;if((m|0)==(k|0))n=k;else{o=m+(~((m+-4-k|0)>>>2)<<2)|0;f[l>>2]=o;n=o}o=a+56|0;if((n|0)==(f[o>>2]|0))Ci(i,b);else{f[n>>2]=g;f[l>>2]=n+4}n=a+4|0;g=f[n>>2]|0;k=f[b>>2]|0;m=k+1|0;do if((k|0)!=-1){p=f[g+28>>2]|0;q=f[p+((((m>>>0)%3|0|0)==0?k+-2|0:m)<<2)>>2]|0;if(!((k>>>0)%3|0)){r=q;s=k+2|0;t=p;break}else{r=q;s=k+-1|0;t=p;break}}else{p=f[g+28>>2]|0;r=f[p+-4>>2]|0;s=-1;t=p}while(0);g=f[t+(s<<2)>>2]|0;if((r|0)==-1|(g|0)==-1){h=0;u=c;return h|0}s=a+36|0;t=f[s>>2]|0;k=t+(r>>>5<<2)|0;m=1<<(r&31);p=f[k>>2]|0;if(!(p&m)){f[k>>2]=p|m;m=f[b>>2]|0;p=m+1|0;if((m|0)==-1)v=-1;else v=((p>>>0)%3|0|0)==0?m+-2|0:p;f[e>>2]=v;p=f[(f[(f[a+16>>2]|0)+96>>2]|0)+(((v>>>0)/3|0)*12|0)+(((v>>>0)%3|0)<<2)>>2]|0;v=f[a+20>>2]|0;f[d>>2]=p;m=f[v+4>>2]|0;v=m+4|0;k=f[v>>2]|0;if((k|0)==(f[m+8>>2]|0))Ci(m,d);else{f[k>>2]=p;f[v>>2]=k+4}k=a+12|0;v=f[k>>2]|0;p=v+4|0;m=f[p>>2]|0;if((m|0)==(f[v+8>>2]|0)){Ci(v,e);w=f[k>>2]|0}else{f[m>>2]=f[e>>2];f[p>>2]=m+4;w=v}v=w+24|0;f[(f[w+12>>2]|0)+(r<<2)>>2]=f[v>>2];f[v>>2]=(f[v>>2]|0)+1;x=f[s>>2]|0}else x=t;t=x+(g>>>5<<2)|0;x=1<<(g&31);v=f[t>>2]|0;if(!(v&x)){f[t>>2]=v|x;x=f[b>>2]|0;do if((x|0)!=-1)if(!((x>>>0)%3|0)){y=x+2|0;break}else{y=x+-1|0;break}else y=-1;while(0);f[e>>2]=y;x=f[(f[(f[a+16>>2]|0)+96>>2]|0)+(((y>>>0)/3|0)*12|0)+(((y>>>0)%3|0)<<2)>>2]|0;y=f[a+20>>2]|0;f[d>>2]=x;v=f[y+4>>2]|0;y=v+4|0;t=f[y>>2]|0;if((t|0)==(f[v+8>>2]|0))Ci(v,d);else{f[t>>2]=x;f[y>>2]=t+4}t=a+12|0;y=f[t>>2]|0;x=y+4|0;v=f[x>>2]|0;if((v|0)==(f[y+8>>2]|0)){Ci(y,e);z=f[t>>2]|0}else{f[v>>2]=f[e>>2];f[x>>2]=v+4;z=y}y=z+24|0;f[(f[z+12>>2]|0)+(g<<2)>>2]=f[y>>2];f[y>>2]=(f[y>>2]|0)+1}y=f[i>>2]|0;g=f[l>>2]|0;if((y|0)==(g|0)){h=1;u=c;return h|0}z=a+16|0;v=a+20|0;x=a+12|0;a=g;g=y;a:while(1){y=f[a+-4>>2]|0;f[b>>2]=y;t=(y>>>0)/3|0;if((y|0)!=-1?(y=(f[j>>2]|0)+(t>>>5<<2)|0,r=1<<(t&31),t=f[y>>2]|0,(t&r|0)==0):0){f[y>>2]=t|r;r=f[n>>2]|0;t=f[b>>2]|0;y=f[(f[r+28>>2]|0)+(t<<2)>>2]|0;if((y|0)==-1){h=0;A=79;break}else{B=y;C=r;D=t}b:while(1){t=(f[s>>2]|0)+(B>>>5<<2)|0;r=1<<(B&31);y=f[t>>2]|0;do if(!(y&r)){w=f[(f[C+40>>2]|0)+(B<<2)>>2]|0;if((w|0)==-1)E=1;else{m=f[(f[f[C+64>>2]>>2]|0)+(w<<2)>>2]|0;E=(1<<(m&31)&f[(f[C+12>>2]|0)+(m>>>5<<2)>>2]|0)!=0}f[t>>2]=y|r;m=f[b>>2]|0;f[e>>2]=m;w=f[(f[(f[z>>2]|0)+96>>2]|0)+(((m>>>0)/3|0)*12|0)+(((m>>>0)%3|0)<<2)>>2]|0;m=f[v>>2]|0;f[d>>2]=w;p=f[m+4>>2]|0;m=p+4|0;k=f[m>>2]|0;if((k|0)==(f[p+8>>2]|0))Ci(p,d);else{f[k>>2]=w;f[m>>2]=k+4}k=f[x>>2]|0;m=k+4|0;w=f[m>>2]|0;if((w|0)==(f[k+8>>2]|0)){Ci(k,e);F=f[x>>2]|0}else{f[w>>2]=f[e>>2];f[m>>2]=w+4;F=k}k=F+24|0;f[(f[F+12>>2]|0)+(B<<2)>>2]=f[k>>2];f[k>>2]=(f[k>>2]|0)+1;k=f[n>>2]|0;w=f[b>>2]|0;if(E){G=w;H=k;A=59;break}m=w+1|0;do if((w|0)==-1)I=-1;else{p=((m>>>0)%3|0|0)==0?w+-2|0:m;if((p|0)==-1){I=-1;break}if(f[(f[k>>2]|0)+(p>>>5<<2)>>2]&1<<(p&31)|0){I=-1;break}I=f[(f[(f[k+64>>2]|0)+12>>2]|0)+(p<<2)>>2]|0}while(0);f[b>>2]=I;J=(I>>>0)/3|0;K=k}else{G=D;H=C;A=59}while(0);if((A|0)==59){A=0;r=G+1|0;if((G|0)==-1){A=60;break}y=((r>>>0)%3|0|0)==0?G+-2|0:r;do if((y|0)==-1)L=-1;else{if(f[(f[H>>2]|0)+(y>>>5<<2)>>2]&1<<(y&31)|0){L=-1;break}L=f[(f[(f[H+64>>2]|0)+12>>2]|0)+(y<<2)>>2]|0}while(0);f[d>>2]=L;y=(((G>>>0)%3|0|0)==0?2:-1)+G|0;do if((y|0)==-1)M=-1;else{if(f[(f[H>>2]|0)+(y>>>5<<2)>>2]&1<<(y&31)|0){M=-1;break}M=f[(f[(f[H+64>>2]|0)+12>>2]|0)+(y<<2)>>2]|0}while(0);y=(L|0)==-1;r=(L>>>0)/3|0;t=y?-1:r;m=(M|0)==-1;w=(M>>>0)/3|0;p=m?-1:w;do if(!y){q=f[j>>2]|0;if(f[q+(t>>>5<<2)>>2]&1<<(t&31)|0){A=69;break}if(m){N=L;O=r;break}if(!(f[q+(p>>>5<<2)>>2]&1<<(p&31))){A=74;break b}else{N=L;O=r}}else A=69;while(0);if((A|0)==69){A=0;if(m){A=71;break}if(!(f[(f[j>>2]|0)+(p>>>5<<2)>>2]&1<<(p&31))){N=M;O=w}else{A=71;break}}f[b>>2]=N;J=O;K=H}r=(f[j>>2]|0)+(J>>>5<<2)|0;f[r>>2]=f[r>>2]|1<<(J&31);D=f[b>>2]|0;B=f[(f[K+28>>2]|0)+(D<<2)>>2]|0;if((B|0)==-1){h=0;A=79;break a}else C=K}do if((A|0)==60){A=0;f[d>>2]=-1;A=71}else if((A|0)==74){A=0;r=f[l>>2]|0;f[r+-4>>2]=M;if((r|0)==(f[o>>2]|0)){Ci(i,d);P=f[l>>2]|0;break}else{f[r>>2]=f[d>>2];t=r+4|0;f[l>>2]=t;P=t;break}}while(0);if((A|0)==71){A=0;t=(f[l>>2]|0)+-4|0;f[l>>2]=t;P=t}Q=f[i>>2]|0;R=P}else{t=a+-4|0;f[l>>2]=t;Q=g;R=t}if((Q|0)==(R|0)){h=1;A=79;break}else{a=R;g=Q}}if((A|0)==79){u=c;return h|0}return 0}function Ub(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=Oa,V=Oa,Y=Oa,Z=0,_=0,aa=0,ba=0;d=u;u=u+16|0;e=d;g=a+16|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[g>>2]=$(1.0);i=a+20|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[a+36>>2]=$(1.0);j=f[c+8>>2]|0;a:do if(j|0){k=a+4|0;l=a+12|0;m=a+8|0;o=j;p=j;while(1){q=o+8|0;r=b[q+11>>0]|0;s=r<<24>>24<0;t=s?f[q>>2]|0:q;v=s?f[o+12>>2]|0:r&255;if(v>>>0>3){r=t;s=v;w=v;while(1){x=X(h[r>>0]|h[r+1>>0]<<8|h[r+2>>0]<<16|h[r+3>>0]<<24,1540483477)|0;s=(X(x>>>24^x,1540483477)|0)^(X(s,1540483477)|0);w=w+-4|0;if(w>>>0<=3)break;else r=r+4|0}r=v+-4|0;w=r&-4;y=r-w|0;z=t+(w+4)|0;A=s}else{y=v;z=t;A=v}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=8;break}case 2:{B=A;C=8;break}case 1:{D=A;C=9;break}default:E=A}if((C|0)==8){C=0;D=h[z+1>>0]<<8^B;C=9}if((C|0)==9){C=0;E=X(D^h[z>>0],1540483477)|0}w=X(E>>>13^E,1540483477)|0;r=w>>>15^w;w=f[k>>2]|0;x=(w|0)==0;b:do if(!x){F=w+-1|0;G=(F&w|0)==0;if(!G)if(r>>>0>>0)H=r;else H=(r>>>0)%(w>>>0)|0;else H=r&F;I=f[(f[a>>2]|0)+(H<<2)>>2]|0;if((I|0)!=0?(J=f[I>>2]|0,(J|0)!=0):0){I=(v|0)==0;if(G){if(I){G=J;while(1){K=f[G+4>>2]|0;if(!((K|0)==(r|0)|(K&F|0)==(H|0))){L=H;C=50;break b}K=b[G+8+11>>0]|0;if(!((K<<24>>24<0?f[G+12>>2]|0:K&255)|0))break b;G=f[G>>2]|0;if(!G){L=H;C=50;break b}}}else M=J;while(1){G=f[M+4>>2]|0;if(!((G|0)==(r|0)|(G&F|0)==(H|0))){L=H;C=50;break b}G=M+8|0;K=b[G+11>>0]|0;N=K<<24>>24<0;O=K&255;do if(((N?f[M+12>>2]|0:O)|0)==(v|0)){K=f[G>>2]|0;if(N)if(!(Pk(K,t,v)|0))break b;else break;if((b[t>>0]|0)==(K&255)<<24>>24){K=G;P=O;Q=t;do{P=P+-1|0;K=K+1|0;if(!P)break b;Q=Q+1|0}while((b[K>>0]|0)==(b[Q>>0]|0))}}while(0);M=f[M>>2]|0;if(!M){L=H;C=50;break b}}}if(I){F=J;while(1){O=f[F+4>>2]|0;if((O|0)!=(r|0)){if(O>>>0>>0)R=O;else R=(O>>>0)%(w>>>0)|0;if((R|0)!=(H|0)){L=H;C=50;break b}}O=b[F+8+11>>0]|0;if(!((O<<24>>24<0?f[F+12>>2]|0:O&255)|0))break b;F=f[F>>2]|0;if(!F){L=H;C=50;break b}}}else S=J;while(1){F=f[S+4>>2]|0;if((F|0)!=(r|0)){if(F>>>0>>0)T=F;else T=(F>>>0)%(w>>>0)|0;if((T|0)!=(H|0)){L=H;C=50;break b}}F=S+8|0;I=b[F+11>>0]|0;O=I<<24>>24<0;G=I&255;do if(((O?f[S+12>>2]|0:G)|0)==(v|0)){I=f[F>>2]|0;if(O)if(!(Pk(I,t,v)|0))break b;else break;if((b[t>>0]|0)==(I&255)<<24>>24){I=F;N=G;Q=t;do{N=N+-1|0;I=I+1|0;if(!N)break b;Q=Q+1|0}while((b[I>>0]|0)==(b[Q>>0]|0))}}while(0);S=f[S>>2]|0;if(!S){L=H;C=50;break}}}else{L=H;C=50}}else{L=0;C=50}while(0);if((C|0)==50){C=0;pi(e,a,r,q);U=$(((f[l>>2]|0)+1|0)>>>0);V=$(w>>>0);Y=$(n[g>>2]);do if(x|$(Y*V)>>0<3|(w+-1&w|0)!=0)&1;v=~~$(W($(U/Y)))>>>0;Ph(a,t>>>0>>0?v:t);t=f[k>>2]|0;v=t+-1|0;if(!(v&t)){Z=t;_=v&r;break}if(r>>>0>>0){Z=t;_=r}else{Z=t;_=(r>>>0)%(t>>>0)|0}}else{Z=w;_=L}while(0);w=f[(f[a>>2]|0)+(_<<2)>>2]|0;if(!w){f[f[e>>2]>>2]=f[m>>2];f[m>>2]=f[e>>2];f[(f[a>>2]|0)+(_<<2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l=i+16|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[l>>2]=$(1.0);m=a+80|0;o=f[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)mq(k);q=o<<2;r=dn(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;hj(r|0,0,q|0)|0;f[p>>2]=s;s=c+48|0;q=c+40|0;o=i+4|0;t=i+12|0;v=i+8|0;w=a+40|0;x=a+64|0;y=f[e>>2]|0;e=r;z=0;A=0;B=r;C=r;D=0;E=r;while(1){r=s;F=f[r>>2]|0;G=f[r+4>>2]|0;r=q;H=on(f[r>>2]|0,f[r+4>>2]|0,y+z|0,0)|0;r=Tn(H|0,I|0,F|0,G|0)|0;G=(f[f[c>>2]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8|h[G+2>>0]<<16|h[G+3>>0]<<24;f[j>>2]=r;G=r&65535;F=r>>>16;H=F&65535;J=(r&65535^318)+239^F;F=(D|0)==0;a:do if(!F){K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=J&K;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(d[R>>1]|0)==G<<16>>16):0)?(d[R+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((d[Q>>1]|0)==G<<16>>16?(d[Q+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((d[N>>1]|0)==G<<16>>16?(d[N+2>>1]|0)==H<<16>>16:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((d[L>>1]|0)==G<<16>>16?(d[L+2>>1]|0)==H<<16>>16:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=dn(16)|0;G=H+8|0;d[G>>1]=r;d[G+2>>1]=r>>>16;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;Eh(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(J>>>0>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=on(J|0,f[F+4>>2]|0,A|0,0)|0;Rg((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)|0;f[_>>2]=f[Y+(f[_>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=V}}else{b[Z>>0]=0;Z=a+68|0;V=a+72|0;D=f[V>>2]|0;E=f[Z>>2]|0;Y=D-E>>2;o=E;E=D;if(la>>>0<=Y>>>0)if(la>>>0>>0?(D=o+(la<<2)|0,(D|0)!=(E|0)):0){f[V>>2]=E+(~((E+-4-D|0)>>>2)<<2);oa=la}else oa=la;else{kh(Z,la-Y|0,1204);oa=f[m>>2]|0}Y=f[k>>2]|0;if(!oa)na=Y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[Y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=Y}}f[m>>2]=X;ma=na}if(!ma)pa=X;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);br(ma);pa=X}}else pa=0;X=f[i+8>>2]|0;if(X|0){ma=X;do{X=ma;ma=f[ma>>2]|0;br(X)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}br(ma);u=g;return pa|0}function Wb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0;c=u;u=u+16|0;d=c+8|0;e=c;g=f[b>>2]|0;if((g|0)==-1){h=1;u=c;return h|0}i=(g>>>0)/3|0;j=a+24|0;if(f[(f[j>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0){h=1;u=c;return h|0}i=a+48|0;k=f[i>>2]|0;l=a+52|0;m=f[l>>2]|0;if((m|0)==(k|0))n=k;else{o=m+(~((m+-4-k|0)>>>2)<<2)|0;f[l>>2]=o;n=o}o=a+56|0;if((n|0)==(f[o>>2]|0))Ci(i,b);else{f[n>>2]=g;f[l>>2]=n+4}n=a+4|0;g=f[n>>2]|0;k=f[b>>2]|0;m=k+1|0;if((k|0)==-1){h=0;u=c;return h|0}p=((m>>>0)%3|0|0)==0?k+-2|0:m;if((p|0)==-1)q=-1;else q=f[(f[g>>2]|0)+(p<<2)>>2]|0;p=(((k>>>0)%3|0|0)==0?2:-1)+k|0;if((p|0)==-1){h=0;u=c;return h|0}k=f[(f[g>>2]|0)+(p<<2)>>2]|0;if((q|0)==-1|(k|0)==-1){h=0;u=c;return h|0}p=a+36|0;g=f[p>>2]|0;m=g+(q>>>5<<2)|0;r=1<<(q&31);s=f[m>>2]|0;if(!(s&r)){f[m>>2]=s|r;r=f[b>>2]|0;s=r+1|0;if((r|0)==-1)t=-1;else t=((s>>>0)%3|0|0)==0?r+-2|0:s;f[e>>2]=t;s=f[(f[(f[a+16>>2]|0)+96>>2]|0)+(((t>>>0)/3|0)*12|0)+(((t>>>0)%3|0)<<2)>>2]|0;t=f[a+20>>2]|0;f[d>>2]=s;r=f[t+4>>2]|0;t=r+4|0;m=f[t>>2]|0;if((m|0)==(f[r+8>>2]|0))Ci(r,d);else{f[m>>2]=s;f[t>>2]=m+4}m=a+12|0;t=f[m>>2]|0;s=t+4|0;r=f[s>>2]|0;if((r|0)==(f[t+8>>2]|0)){Ci(t,e);v=f[m>>2]|0}else{f[r>>2]=f[e>>2];f[s>>2]=r+4;v=t}t=v+24|0;f[(f[v+12>>2]|0)+(q<<2)>>2]=f[t>>2];f[t>>2]=(f[t>>2]|0)+1;w=f[p>>2]|0}else w=g;g=w+(k>>>5<<2)|0;w=1<<(k&31);t=f[g>>2]|0;if(!(t&w)){f[g>>2]=t|w;w=f[b>>2]|0;do if((w|0)!=-1)if(!((w>>>0)%3|0)){x=w+2|0;break}else{x=w+-1|0;break}else x=-1;while(0);f[e>>2]=x;w=f[(f[(f[a+16>>2]|0)+96>>2]|0)+(((x>>>0)/3|0)*12|0)+(((x>>>0)%3|0)<<2)>>2]|0;x=f[a+20>>2]|0;f[d>>2]=w;t=f[x+4>>2]|0;x=t+4|0;g=f[x>>2]|0;if((g|0)==(f[t+8>>2]|0))Ci(t,d);else{f[g>>2]=w;f[x>>2]=g+4}g=a+12|0;x=f[g>>2]|0;w=x+4|0;t=f[w>>2]|0;if((t|0)==(f[x+8>>2]|0)){Ci(x,e);y=f[g>>2]|0}else{f[t>>2]=f[e>>2];f[w>>2]=t+4;y=x}x=y+24|0;f[(f[y+12>>2]|0)+(k<<2)>>2]=f[x>>2];f[x>>2]=(f[x>>2]|0)+1}x=f[i>>2]|0;k=f[l>>2]|0;if((x|0)==(k|0)){h=1;u=c;return h|0}y=a+16|0;t=a+20|0;w=a+12|0;a=k;k=x;a:while(1){x=f[a+-4>>2]|0;f[b>>2]=x;g=(x>>>0)/3|0;if((x|0)!=-1?(x=(f[j>>2]|0)+(g>>>5<<2)|0,q=1<<(g&31),g=f[x>>2]|0,(g&q|0)==0):0){f[x>>2]=g|q;q=f[b>>2]|0;if((q|0)==-1){h=0;z=80;break}g=f[n>>2]|0;x=q;b:while(1){q=f[(f[g>>2]|0)+(x<<2)>>2]|0;if((q|0)==-1){h=0;z=80;break a}v=(f[p>>2]|0)+(q>>>5<<2)|0;r=1<<(q&31);s=f[v>>2]|0;do if(!(s&r)){m=f[(f[g+24>>2]|0)+(q<<2)>>2]|0;A=m+1|0;do if((m|0)==-1)B=1;else{C=((A>>>0)%3|0|0)==0?m+-2|0:A;if((C|0)==-1){B=1;break}D=f[(f[g+12>>2]|0)+(C<<2)>>2]|0;C=D+1|0;if((D|0)==-1){B=1;break}B=((((C>>>0)%3|0|0)==0?D+-2|0:C)|0)==-1}while(0);f[v>>2]=s|r;A=f[b>>2]|0;f[e>>2]=A;m=f[(f[(f[y>>2]|0)+96>>2]|0)+(((A>>>0)/3|0)*12|0)+(((A>>>0)%3|0)<<2)>>2]|0;A=f[t>>2]|0;f[d>>2]=m;C=f[A+4>>2]|0;A=C+4|0;D=f[A>>2]|0;if((D|0)==(f[C+8>>2]|0))Ci(C,d);else{f[D>>2]=m;f[A>>2]=D+4}D=f[w>>2]|0;A=D+4|0;m=f[A>>2]|0;if((m|0)==(f[D+8>>2]|0)){Ci(D,e);E=f[w>>2]|0}else{f[m>>2]=f[e>>2];f[A>>2]=m+4;E=D}D=E+24|0;f[(f[E+12>>2]|0)+(q<<2)>>2]=f[D>>2];f[D>>2]=(f[D>>2]|0)+1;D=f[n>>2]|0;m=f[b>>2]|0;if(B)if((m|0)==-1){z=63;break b}else{F=m;G=D;z=64;break}do if((m|0)==-1)H=-1;else{A=m+1|0;C=((A>>>0)%3|0|0)==0?m+-2|0:A;if((C|0)==-1){H=-1;break}H=f[(f[D+12>>2]|0)+(C<<2)>>2]|0}while(0);f[b>>2]=H;I=(H>>>0)/3|0;J=D}else{F=x;G=g;z=64}while(0);if((z|0)==64){z=0;q=F+1|0;r=((q>>>0)%3|0|0)==0?F+-2|0:q;if((r|0)==-1)K=-1;else K=f[(f[G+12>>2]|0)+(r<<2)>>2]|0;f[d>>2]=K;r=(((F>>>0)%3|0|0)==0?2:-1)+F|0;if((r|0)==-1)L=-1;else L=f[(f[G+12>>2]|0)+(r<<2)>>2]|0;r=(K|0)==-1;q=(K>>>0)/3|0;s=r?-1:q;v=(L|0)==-1;m=(L>>>0)/3|0;C=v?-1:m;do if(!r){A=f[j>>2]|0;if(f[A+(s>>>5<<2)>>2]&1<<(s&31)|0){z=70;break}if(v){M=K;N=q;break}if(!(f[A+(C>>>5<<2)>>2]&1<<(C&31))){z=75;break b}else{M=K;N=q}}else z=70;while(0);if((z|0)==70){z=0;if(v){z=72;break}if(!(f[(f[j>>2]|0)+(C>>>5<<2)>>2]&1<<(C&31))){M=L;N=m}else{z=72;break}}f[b>>2]=M;I=N;J=G}q=(f[j>>2]|0)+(I>>>5<<2)|0;f[q>>2]=f[q>>2]|1<<(I&31);x=f[b>>2]|0;if((x|0)==-1){h=0;z=80;break a}else g=J}do if((z|0)==63){z=0;f[d>>2]=-1;z=72}else if((z|0)==75){z=0;g=f[l>>2]|0;f[g+-4>>2]=L;if((g|0)==(f[o>>2]|0)){Ci(i,d);O=f[l>>2]|0;break}else{f[g>>2]=f[d>>2];x=g+4|0;f[l>>2]=x;O=x;break}}while(0);if((z|0)==72){z=0;x=(f[l>>2]|0)+-4|0;f[l>>2]=x;O=x}P=f[i>>2]|0;Q=O}else{x=a+-4|0;f[l>>2]=x;P=k;Q=x}if((P|0)==(Q|0)){h=1;z=80;break}else{a=Q;k=P}}if((z|0)==80){u=c;return h|0}return 0}function Xb(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,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!N){Q=27;break}}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(D|0)){if((f[N+8>>2]|0)==(E|0)?(f[N+12>>2]|0)==(F|0):0){R=N;Q=26;break b}}else{if(P>>>0>>0)S=P;else S=(P>>>0)%(q>>>0)|0;if((S|0)!=(K|0)){Q=27;break b}}N=f[N>>2]|0;if(!N){Q=27;break}}}while(0);if((Q|0)==26){Q=0;f[A+(y<<2)>>2]=f[R+16>>2];T=d;U=z;V=C;X=B;Y=A;break a}else if((Q|0)==27){Q=0;if(G){Z=0;Q=46;break a}else break}}while(0);H=q+-1|0;J=(H&q|0)==0;if(!J)if(D>>>0>>0)_=D;else _=(D>>>0)%(q>>>0)|0;else _=H&D;L=f[(f[g>>2]|0)+(_<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(D|0)|(L&H|0)==(_|0))){Z=_;Q=46;break a}if((f[J+8>>2]|0)==(E|0)?(f[J+12>>2]|0)==(F|0):0){Q=61;break a}J=f[J>>2]|0;if(!J){Z=_;Q=46;break a}}}else aa=M;while(1){J=f[aa+4>>2]|0;if((J|0)!=(D|0)){if(J>>>0>>0)ba=J;else ba=(J>>>0)%(q>>>0)|0;if((ba|0)!=(_|0)){Z=_;Q=46;break a}}if((f[aa+8>>2]|0)==(E|0)?(f[aa+12>>2]|0)==(F|0):0){Q=61;break a}aa=f[aa>>2]|0;if(!aa){Z=_;Q=46;break}}}else{Z=_;Q=46}}else{Z=0;Q=46}while(0);if((Q|0)==46){Q=0;M=dn(20)|0;J=M+8|0;f[J>>2]=E;f[J+4>>2]=F;f[M+16>>2]=z;f[M+4>>2]=D;f[M>>2]=0;ca=$(((f[s>>2]|0)+1|0)>>>0);da=$(q>>>0);ea=$(n[k>>2]);do if(G|$(ea*da)>>0<3|(q+-1&q|0)!=0)&1;H=~~$(W($(ca/ea)))>>>0;Ih(g,J>>>0>>0?H:J);J=f[m>>2]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]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8;d[j>>1]=r;G=r&255;F=(r&65535)>>>8;H=F&255;J=((r&255^318)+239<<16>>16^F)&65535;F=(D|0)==0;a:do if(!F){K=D+-1|0;L=(K&D|0)==0;if(!L)if(D>>>0>J>>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=K&J;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(b[R>>0]|0)==G<<24>>24):0)?(b[R+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((b[Q>>0]|0)==G<<24>>24?(b[Q+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(D>>>0>J>>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((b[N>>0]|0)==G<<24>>24?(b[N+1>>0]|0)==H<<24>>24:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((b[L>>0]|0)==G<<24>>24?(b[L+1>>0]|0)==H<<24>>24:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=dn(16)|0;G=H+8|0;b[G>>0]=r;b[G+1>>0]=r>>8;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;Lh(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(G>>>0>J>>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=on(J|0,f[F+4>>2]|0,A|0,0)|0;Rg((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)|0;f[_>>2]=f[Y+(f[_>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=V}}else{b[Z>>0]=0;Z=a+68|0;V=a+72|0;D=f[V>>2]|0;E=f[Z>>2]|0;Y=D-E>>2;o=E;E=D;if(la>>>0<=Y>>>0)if(la>>>0>>0?(D=o+(la<<2)|0,(D|0)!=(E|0)):0){f[V>>2]=E+(~((E+-4-D|0)>>>2)<<2);oa=la}else oa=la;else{kh(Z,la-Y|0,1204);oa=f[m>>2]|0}Y=f[k>>2]|0;if(!oa)na=Y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[Y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=Y}}f[m>>2]=X;ma=na}if(!ma)pa=X;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);br(ma);pa=X}}else pa=0;X=f[i+8>>2]|0;if(X|0){ma=X;do{X=ma;ma=f[ma>>2]|0;br(X)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}br(ma);u=g;return pa|0}function Zb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;c=u;u=u+16|0;d=c+8|0;e=c;g=c+4|0;h=a+16|0;i=f[h>>2]|0;j=a+20|0;k=f[j>>2]|0;if((k|0)==(i|0))l=i;else{m=k+(~((k+-4-i|0)>>>2)<<2)|0;f[j>>2]=m;l=m}m=a+24|0;if((l|0)==(f[m>>2]|0)){Ci(h,b);n=f[h>>2]|0;o=f[j>>2]|0}else{f[l>>2]=f[b>>2];k=l+4|0;f[j>>2]=k;n=i;o=k}k=f[a+8>>2]|0;i=(f[k+100>>2]|0)-(f[k+96>>2]|0)|0;k=(i|0)/12|0;if((n|0)==(o|0)){u=c;return 1}n=a+28|0;l=(i|0)>0;i=a+164|0;p=a+12|0;q=a+76|0;r=a+80|0;s=a+72|0;t=a+200|0;v=a+320|0;w=a+152|0;x=a+84|0;y=a+324|0;z=a+292|0;A=a+304|0;B=a+316|0;C=a+328|0;D=a+336|0;E=a+332|0;F=a+168|0;G=a+140|0;H=a+120|0;I=o;do{o=f[I+-4>>2]|0;f[b>>2]=o;a:do if((o|0)!=-1?(J=(o>>>0)/3|0,K=f[n>>2]|0,(f[K+(J>>>5<<2)>>2]&1<<(J&31)|0)==0):0){if(l){J=0;L=K;b:while(1){K=J+1|0;f[i>>2]=(f[i>>2]|0)+1;M=f[b>>2]|0;N=(M|0)==-1?-1:(M>>>0)/3|0;M=L+(N>>>5<<2)|0;f[M>>2]=1<<(N&31)|f[M>>2];M=f[q>>2]|0;if((M|0)==(f[r>>2]|0))Ci(s,b);else{f[M>>2]=f[b>>2];f[q>>2]=M+4}f[v>>2]=f[b>>2];M=f[b>>2]|0;if((M|0)==-1)O=-1;else O=f[(f[f[p>>2]>>2]|0)+(M<<2)>>2]|0;P=(f[(f[w>>2]|0)+(O<<2)>>2]|0)!=-1;Q=(f[x>>2]|0)+(O>>>5<<2)|0;R=1<<(O&31);S=f[Q>>2]|0;do if(!(S&R)){f[Q>>2]=S|R;if(P){T=f[b>>2]|0;U=38;break}f[y>>2]=(f[y>>2]|0)+1;V=f[v>>2]|0;W=V+1|0;do if((V|0)!=-1){X=((W>>>0)%3|0|0)==0?V+-2|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+(Q>>>5<<2)>>2]&1<<(Q&31)|0)==0):0){Q=(((T>>>0)%3|0|0)==0?2:-1)+T|0;do if((Q|0)!=-1){V=f[M+(Q<<2)>>2]|0;if((V|0)==-1)break;_=(V>>>0)/3|0;if(!(f[aa+(_>>>5<<2)>>2]&1<<(_&31))){U=62;break b}}while(0);if(!ea)jf(a,f[i>>2]|0,N,0,fa);hd(t,3);ga=f[e>>2]|0}else{if(!R){jf(a,f[i>>2]|0,N,1,S);aa=f[b>>2]|0;if((aa|0)==-1){U=52;break}else ha=aa}else ha=T;aa=(((ha>>>0)%3|0|0)==0?2:-1)+ha|0;if((aa|0)==-1){U=52;break}Q=f[(f[(f[p>>2]|0)+12>>2]|0)+(aa<<2)>>2]|0;if((Q|0)==-1){U=52;break}aa=(Q>>>0)/3|0;if(f[(f[n>>2]|0)+(aa>>>5<<2)>>2]&1<<(aa&31)|0){U=52;break}hd(t,5);ga=da}f[b>>2]=ga}if((K|0)>=(k|0))break a;J=K;L=f[n>>2]|0}do if((U|0)==43){U=0;f[e>>2]=-1;U=54}else if((U|0)==52){U=0;if(ea)U=54;else{jf(a,f[i>>2]|0,N,0,fa);U=54}}else if((U|0)==62){U=0;hd(t,1);f[F>>2]=(f[F>>2]|0)+1;if(P?(L=f[(f[w>>2]|0)+(O<<2)>>2]|0,(1<<(L&31)&f[(f[G>>2]|0)+(L>>>5<<2)>>2]|0)==0):0){f[g>>2]=f[b>>2];f[d>>2]=f[g>>2];Ce(a,d,0)|0}L=f[i>>2]|0;f[d>>2]=N;J=Sd(H,d)|0;f[J>>2]=L;L=f[j>>2]|0;f[L+-4>>2]=da;if((L|0)==(f[m>>2]|0)){Ci(h,e);break}else{f[L>>2]=f[e>>2];f[j>>2]=L+4;break}}while(0);if((U|0)==54){U=0;hd(t,7);f[j>>2]=(f[j>>2]|0)+-4}}}else U=11;while(0);if((U|0)==11){U=0;f[j>>2]=I+-4}I=f[j>>2]|0}while((f[h>>2]|0)!=(I|0));u=c;return 1}function _b(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break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(m=f[r>>2]|0,(m|0)!=0):0){r=(o|0)==0;if(s){if(r){s=m;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=m;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Pk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=m;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=m;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Pk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){_h(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[a+16>>2]);do if(w|$(L*K)>>0<3|(y+-1&y|0)!=0)&1;H=~~$(W($(J/L)))>>>0;Ph(a,A>>>0>>0?H:A);A=f[t>>2]|0;H=A+-1|0;if(!(H&A)){M=A;N=H&z;break}if(z>>>0>>0){M=A;N=z}else{M=A;N=(z>>>0)%(A>>>0)|0}}else{M=y;N=B}while(0);B=f[(f[a>>2]|0)+(N<<2)>>2]|0;if(!B){y=a+8|0;f[f[g>>2]>>2]=f[y>>2];f[y>>2]=f[g>>2];f[(f[a>>2]|0)+(N<<2)>>2]=y;y=f[g>>2]|0;N=f[y>>2]|0;if(!N)O=g;else{z=f[N+4>>2]|0;N=M+-1|0;if(N&M)if(z>>>0>>0)P=z;else P=(z>>>0)%(M>>>0)|0;else P=z&N;f[(f[a>>2]|0)+(P<<2)>>2]=y;O=g}}else{f[f[g>>2]>>2]=f[B>>2];f[B>>2]=f[g>>2];O=g}f[x>>2]=(f[x>>2]|0)+1;f[O>>2]=0}O=f[i+12>>2]|0;if(O|0){if((f[l>>2]|0)!=(O|0))f[l>>2]=O;br(O)}if((b[p>>0]|0)<0)br(f[i>>2]|0);i=f[j>>2]|0;if(!i){u=e;return}if((f[k>>2]|0)!=(i|0))f[k>>2]=i;br(i);u=e;return}function $b(a,c,d){a=a|0;c=c|0;d=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11|0;m=b[l>>0]|0;o=d+4|0;p=f[o>>2]|0;q=m<<24>>24<0?p:m&255;if(!q){r=m;s=p;t=0}else{ri(j,q);r=b[l>>0]|0;s=f[o>>2]|0;t=f[j>>2]|0}o=r<<24>>24<0;Rg(t|0,(o?f[d>>2]|0:d)|0,(o?s:r&255)|0)|0;dj(i,c);c=i+12|0;f[c>>2]=0;r=i+16|0;f[r>>2]=0;f[i+20>>2]=0;s=f[k>>2]|0;o=f[j>>2]|0;d=s-o|0;if(!d){v=o;w=s;x=0}else{ri(c,d);v=f[j>>2]|0;w=f[k>>2]|0;x=f[c>>2]|0}Rg(x|0,v|0,w-v|0)|0;v=i+11|0;w=b[v>>0]|0;x=w<<24>>24<0;c=x?f[i>>2]|0:i;d=x?f[i+4>>2]|0:w&255;if(d>>>0>3){w=c;x=d;s=d;while(1){o=X(h[w>>0]|h[w+1>>0]<<8|h[w+2>>0]<<16|h[w+3>>0]<<24,1540483477)|0;x=(X(o>>>24^o,1540483477)|0)^(X(x,1540483477)|0);s=s+-4|0;if(s>>>0<=3)break;else w=w+4|0}w=d+-4|0;s=w&-4;y=w-s|0;z=c+(s+4)|0;A=x}else{y=d;z=c;A=d}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=12;break}case 2:{B=A;C=12;break}case 1:{D=A;C=13;break}default:E=A}if((C|0)==12){D=h[z+1>>0]<<8^B;C=13}if((C|0)==13)E=X(D^h[z>>0],1540483477)|0;z=X(E>>>13^E,1540483477)|0;E=z>>>15^z;z=a+4|0;D=f[z>>2]|0;B=(D|0)==0;a:do if(!B){A=D+-1|0;y=(A&D|0)==0;if(!y)if(E>>>0>>0)F=E;else F=(E>>>0)%(D>>>0)|0;else F=E&A;x=f[(f[a>>2]|0)+(F<<2)>>2]|0;if((x|0)!=0?(s=f[x>>2]|0,(s|0)!=0):0){x=(d|0)==0;if(y){if(x){y=s;while(1){w=f[y+4>>2]|0;if(!((w|0)==(E|0)|(w&A|0)==(F|0))){G=F;C=54;break a}w=b[y+8+11>>0]|0;if(!((w<<24>>24<0?f[y+12>>2]|0:w&255)|0))break a;y=f[y>>2]|0;if(!y){G=F;C=54;break a}}}else H=s;while(1){y=f[H+4>>2]|0;if(!((y|0)==(E|0)|(y&A|0)==(F|0))){G=F;C=54;break a}y=H+8|0;w=b[y+11>>0]|0;o=w<<24>>24<0;t=w&255;do if(((o?f[H+12>>2]|0:t)|0)==(d|0)){w=f[y>>2]|0;if(o)if(!(Pk(w,c,d)|0))break a;else break;if((b[c>>0]|0)==(w&255)<<24>>24){w=y;l=t;q=c;do{l=l+-1|0;w=w+1|0;if(!l)break a;q=q+1|0}while((b[w>>0]|0)==(b[q>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){G=F;C=54;break a}}}if(x){A=s;while(1){t=f[A+4>>2]|0;if((t|0)!=(E|0)){if(t>>>0>>0)I=t;else I=(t>>>0)%(D>>>0)|0;if((I|0)!=(F|0)){G=F;C=54;break a}}t=b[A+8+11>>0]|0;if(!((t<<24>>24<0?f[A+12>>2]|0:t&255)|0))break a;A=f[A>>2]|0;if(!A){G=F;C=54;break a}}}else J=s;while(1){A=f[J+4>>2]|0;if((A|0)!=(E|0)){if(A>>>0>>0)K=A;else K=(A>>>0)%(D>>>0)|0;if((K|0)!=(F|0)){G=F;C=54;break a}}A=J+8|0;x=b[A+11>>0]|0;t=x<<24>>24<0;y=x&255;do if(((t?f[J+12>>2]|0:y)|0)==(d|0)){x=f[A>>2]|0;if(t)if(!(Pk(x,c,d)|0))break a;else break;if((b[c>>0]|0)==(x&255)<<24>>24){x=A;o=y;q=c;do{o=o+-1|0;x=x+1|0;if(!o)break a;q=q+1|0}while((b[x>>0]|0)==(b[q>>0]|0))}}while(0);J=f[J>>2]|0;if(!J){G=F;C=54;break}}}else{G=F;C=54}}else{G=0;C=54}while(0);if((C|0)==54){_h(g,a,E,i);C=a+12|0;L=$(((f[C>>2]|0)+1|0)>>>0);M=$(D>>>0);N=$(n[a+16>>2]);do if(B|$(N*M)>>0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[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)mq(k);q=o<<2;r=dn(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;hj(r|0,0,q|0)|0;f[p>>2]=s;s=c+48|0;q=c+40|0;o=i+4|0;t=i+12|0;v=i+8|0;w=a+40|0;x=a+64|0;y=f[e>>2]|0;e=0;z=r;A=0;B=0;C=r;D=r;E=r;while(1){r=s;F=f[r>>2]|0;G=f[r+4>>2]|0;r=q;H=on(f[r>>2]|0,f[r+4>>2]|0,y+A|0,0)|0;r=Tn(H|0,I|0,F|0,G|0)|0;G=(f[f[c>>2]>>2]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8;d[j>>1]=r;G=(r^318)&65535;a:do if(e){F=e+-1|0;H=(F&e|0)==0;if(!H)if(e>>>0>G>>>0)J=G;else J=(G>>>0)%(e>>>0)|0;else J=F&G;K=f[i>>2]|0;L=f[K+(J<<2)>>2]|0;b:do if(L|0?(M=f[L>>2]|0,M|0):0){c:do if(H){N=M;while(1){O=f[N+4>>2]|0;P=(O|0)==(G|0);if(!(P|(O&F|0)==(J|0)))break b;if(P?(d[N+8>>1]|0)==r<<16>>16:0){Q=N;break c}N=f[N>>2]|0;if(!N)break b}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(G|0)){if((d[N+8>>1]|0)==r<<16>>16){Q=N;break c}}else{if(P>>>0>>0)R=P;else R=(P>>>0)%(e>>>0)|0;if((R|0)!=(J|0))break b}N=f[N>>2]|0;if(!N)break b}}while(0);f[E+(A<<2)>>2]=f[Q+12>>2];S=z;T=B;U=D;V=C;X=E;break a}while(0);if(!H)if(e>>>0>G>>>0)Y=G;else Y=(G>>>0)%(e>>>0)|0;else Y=F&G;L=f[K+(Y<<2)>>2]|0;if(!L){Z=Y;_=e;aa=0;ba=40}else{if(H){M=L;while(1){M=f[M>>2]|0;if(!M){Z=Y;_=e;aa=0;ba=40;break a}N=f[M+4>>2]|0;if(!((N|0)==(G|0)|(N&F|0)==(Y|0))){Z=Y;_=e;aa=0;ba=40;break a}if((d[M+8>>1]|0)==r<<16>>16){ba=55;break a}}}else ca=L;while(1){ca=f[ca>>2]|0;if(!ca){Z=Y;_=e;aa=0;ba=40;break a}M=f[ca+4>>2]|0;if((M|0)!=(G|0)){if(M>>>0>>0)da=M;else da=(M>>>0)%(e>>>0)|0;if((da|0)!=(Y|0)){Z=Y;_=e;aa=0;ba=40;break a}}if((d[ca+8>>1]|0)==r<<16>>16){ba=55;break}}}}else{Z=0;_=0;aa=1;ba=40}while(0);if((ba|0)==40){ba=0;L=dn(16)|0;d[L+8>>1]=r;f[L+12>>2]=B;f[L+4>>2]=G;f[L>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(_>>>0);ga=$(n[l>>2]);do if(aa|$(ga*fa)>>0<3|(_+-1&_|0)!=0)&1;F=~~$(W($(ea/ga)))>>>0;Fh(i,M>>>0>>0?F:M);M=f[o>>2]|0;F=M+-1|0;if(!(F&M)){ha=M;ia=F&G;break}if(M>>>0>G>>>0){ha=M;ia=G}else{ha=M;ia=(G>>>0)%(M>>>0)|0}}else{ha=_;ia=Z}while(0);G=(f[i>>2]|0)+(ia<<2)|0;r=f[G>>2]|0;if(!r){f[L>>2]=f[v>>2];f[v>>2]=L;f[G>>2]=v;G=f[L>>2]|0;if(G|0){M=f[G+4>>2]|0;G=ha+-1|0;if(G&ha)if(M>>>0>>0)ja=M;else ja=(M>>>0)%(ha>>>0)|0;else ja=M&G;ka=(f[i>>2]|0)+(ja<<2)|0;ba=53}}else{f[L>>2]=f[r>>2];ka=r;ba=53}if((ba|0)==53){ba=0;f[ka>>2]=L}f[t>>2]=(f[t>>2]|0)+1;ba=55}if((ba|0)==55){ba=0;r=w;G=f[r>>2]|0;M=on(G|0,f[r+4>>2]|0,B|0,0)|0;Rg((f[f[x>>2]>>2]|0)+M|0,j|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=B;S=G;T=B+1|0;U=G;V=G;X=G}G=A+1|0;la=f[m>>2]|0;if(G>>>0>=la>>>0)break;e=f[o>>2]|0;z=S;A=G;B=T;C=V;D=U;E=X}if((T|0)==(la|0))ma=V;else{V=a+84|0;if(!(b[V>>0]|0)){X=f[a+72>>2]|0;E=f[a+68>>2]|0;D=E;if((X|0)==(E|0))na=S;else{C=X-E>>2;E=0;do{X=D+(E<<2)|0;f[X>>2]=f[U+(f[X>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=S}}else{b[V>>0]=0;V=a+68|0;S=a+72|0;C=f[S>>2]|0;E=f[V>>2]|0;U=C-E>>2;D=E;E=C;if(la>>>0<=U>>>0)if(la>>>0>>0?(C=D+(la<<2)|0,(C|0)!=(E|0)):0){f[S>>2]=E+(~((E+-4-C|0)>>>2)<<2);oa=la}else oa=la;else{kh(V,la-U|0,1204);oa=f[m>>2]|0}U=f[k>>2]|0;if(!oa)na=U;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[U+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=U}}f[m>>2]=T;ma=na}if(!ma)pa=T;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);br(ma);pa=T}}else pa=0;T=f[i+8>>2]|0;if(T|0){ma=T;do{T=ma;ma=f[ma>>2]|0;br(T)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}br(ma);u=g;return pa|0}function cc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=Oa,K=Oa,L=Oa,M=0,N=0,O=0,P=0;e=u;u=u+64|0;g=e+40|0;i=e+16|0;j=e;k=xd(a,c)|0;if(k|0){f[i>>2]=k;f[g>>2]=f[i>>2];Xe(a,g)|0}f[j>>2]=0;k=j+4|0;f[k>>2]=0;f[j+8>>2]=0;ri(j,4);l=f[j>>2]|0;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[l>>0]=m;b[l+1>>0]=m>>8;b[l+2>>0]=m>>16;b[l+3>>0]=m>>24;dj(i,c);c=i+12|0;f[c>>2]=0;m=i+16|0;f[m>>2]=0;f[i+20>>2]=0;l=f[k>>2]|0;d=f[j>>2]|0;o=l-d|0;if(!o){p=d;q=l;r=0}else{ri(c,o);p=f[j>>2]|0;q=f[k>>2]|0;r=f[c>>2]|0}Rg(r|0,p|0,q-p|0)|0;p=i+11|0;q=b[p>>0]|0;r=q<<24>>24<0;c=r?f[i>>2]|0:i;o=r?f[i+4>>2]|0:q&255;if(o>>>0>3){q=c;r=o;l=o;while(1){d=X(h[q>>0]|h[q+1>>0]<<8|h[q+2>>0]<<16|h[q+3>>0]<<24,1540483477)|0;r=(X(d>>>24^d,1540483477)|0)^(X(r,1540483477)|0);l=l+-4|0;if(l>>>0<=3)break;else q=q+4|0}q=o+-4|0;l=q&-4;s=q-l|0;t=c+(l+4)|0;v=r}else{s=o;t=c;v=o}switch(s|0){case 3:{w=h[t+2>>0]<<16^v;x=10;break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(l=f[r>>2]|0,(l|0)!=0):0){r=(o|0)==0;if(s){if(r){s=l;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=l;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Pk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=l;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=l;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Pk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){_h(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[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k=a+80|0;l=f[k>>2]|0;f[i>>2]=0;m=i+4|0;f[m>>2]=0;f[i+8>>2]=0;if(l){if(l>>>0>1073741823)mq(i);o=l<<2;p=dn(o)|0;f[i>>2]=p;q=p+(l<<2)|0;f[i+8>>2]=q;hj(p|0,0,o|0)|0;f[m>>2]=q;q=c+48|0;o=c+40|0;l=g+4|0;r=g+12|0;s=g+8|0;t=a+40|0;v=a+64|0;w=f[d>>2]|0;d=0;x=p;y=0;z=0;A=p;B=p;C=p;while(1){p=q;D=f[p>>2]|0;E=f[p+4>>2]|0;p=o;F=on(f[p>>2]|0,f[p+4>>2]|0,w+y|0,0)|0;p=Tn(F|0,I|0,D|0,E|0)|0;E=b[(f[f[c>>2]>>2]|0)+p>>0]|0;b[h>>0]=E;p=E&255^318;a:do if(d){D=d+-1|0;F=(D&d|0)==0;if(!F)if(p>>>0>>0)G=p;else G=(p>>>0)%(d>>>0)|0;else G=D&p;H=f[g>>2]|0;J=f[H+(G<<2)>>2]|0;b:do if(J|0?(K=f[J>>2]|0,K|0):0){c:do if(F){L=K;while(1){M=f[L+4>>2]|0;N=(M|0)==(p|0);if(!(N|(M&D|0)==(G|0)))break b;if(N?(b[L+8>>0]|0)==E<<24>>24:0){O=L;break c}L=f[L>>2]|0;if(!L)break b}}else{L=K;while(1){N=f[L+4>>2]|0;if((N|0)==(p|0)){if((b[L+8>>0]|0)==E<<24>>24){O=L;break c}}else{if(N>>>0>>0)P=N;else P=(N>>>0)%(d>>>0)|0;if((P|0)!=(G|0))break b}L=f[L>>2]|0;if(!L)break b}}while(0);f[C+(y<<2)>>2]=f[O+12>>2];Q=x;R=z;S=B;T=A;U=C;break a}while(0);if(!F)if(p>>>0>>0)V=p;else V=(p>>>0)%(d>>>0)|0;else V=D&p;J=f[H+(V<<2)>>2]|0;if(!J){X=V;Y=d;Z=0;_=40}else{if(F){K=J;while(1){K=f[K>>2]|0;if(!K){X=V;Y=d;Z=0;_=40;break a}L=f[K+4>>2]|0;if(!((L|0)==(p|0)|(L&D|0)==(V|0))){X=V;Y=d;Z=0;_=40;break a}if((b[K+8>>0]|0)==E<<24>>24){_=55;break a}}}else aa=J;while(1){aa=f[aa>>2]|0;if(!aa){X=V;Y=d;Z=0;_=40;break a}K=f[aa+4>>2]|0;if((K|0)!=(p|0)){if(K>>>0>>0)ba=K;else ba=(K>>>0)%(d>>>0)|0;if((ba|0)!=(V|0)){X=V;Y=d;Z=0;_=40;break a}}if((b[aa+8>>0]|0)==E<<24>>24){_=55;break}}}}else{X=0;Y=0;Z=1;_=40}while(0);if((_|0)==40){_=0;J=dn(16)|0;b[J+8>>0]=E;f[J+12>>2]=z;f[J+4>>2]=p;f[J>>2]=0;ca=$(((f[r>>2]|0)+1|0)>>>0);da=$(Y>>>0);ea=$(n[j>>2]);do if(Z|$(ea*da)>>0<3|(Y+-1&Y|0)!=0)&1;D=~~$(W($(ca/ea)))>>>0;Mh(g,K>>>0>>0?D:K);K=f[l>>2]|0;D=K+-1|0;if(!(D&K)){fa=K;ga=D&p;break}if(p>>>0>>0){fa=K;ga=p}else{fa=K;ga=(p>>>0)%(K>>>0)|0}}else{fa=Y;ga=X}while(0);p=(f[g>>2]|0)+(ga<<2)|0;E=f[p>>2]|0;if(!E){f[J>>2]=f[s>>2];f[s>>2]=J;f[p>>2]=s;p=f[J>>2]|0;if(p|0){K=f[p+4>>2]|0;p=fa+-1|0;if(p&fa)if(K>>>0>>0)ha=K;else ha=(K>>>0)%(fa>>>0)|0;else ha=K&p;ia=(f[g>>2]|0)+(ha<<2)|0;_=53}}else{f[J>>2]=f[E>>2];ia=E;_=53}if((_|0)==53){_=0;f[ia>>2]=J}f[r>>2]=(f[r>>2]|0)+1;_=55}if((_|0)==55){_=0;E=t;p=f[E>>2]|0;K=on(p|0,f[E+4>>2]|0,z|0,0)|0;Rg((f[f[v>>2]>>2]|0)+K|0,h|0,p|0)|0;p=f[i>>2]|0;f[p+(y<<2)>>2]=z;Q=p;R=z+1|0;S=p;T=p;U=p}p=y+1|0;ja=f[k>>2]|0;if(p>>>0>=ja>>>0)break;d=f[l>>2]|0;x=Q;y=p;z=R;A=T;B=S;C=U}if((R|0)==(ja|0))ka=T;else{T=a+84|0;if(!(b[T>>0]|0)){U=f[a+72>>2]|0;C=f[a+68>>2]|0;B=C;if((U|0)==(C|0))la=Q;else{A=U-C>>2;C=0;do{U=B+(C<<2)|0;f[U>>2]=f[S+(f[U>>2]<<2)>>2];C=C+1|0}while(C>>>0>>0);la=Q}}else{b[T>>0]=0;T=a+68|0;Q=a+72|0;A=f[Q>>2]|0;C=f[T>>2]|0;S=A-C>>2;B=C;C=A;if(ja>>>0<=S>>>0)if(ja>>>0>>0?(A=B+(ja<<2)|0,(A|0)!=(C|0)):0){f[Q>>2]=C+(~((C+-4-A|0)>>>2)<<2);ma=ja}else ma=ja;else{kh(T,ja-S|0,1204);ma=f[k>>2]|0}S=f[i>>2]|0;if(!ma)la=S;else{i=f[a+68>>2]|0;a=0;do{f[i+(a<<2)>>2]=f[S+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);la=S}}f[k>>2]=R;ka=la}if(!ka)na=R;else{la=f[m>>2]|0;if((la|0)!=(ka|0))f[m>>2]=la+(~((la+-4-ka|0)>>>2)<<2);br(ka);na=R}}else na=0;R=f[g+8>>2]|0;if(R|0){ka=R;do{R=ka;ka=f[ka>>2]|0;br(R)}while((ka|0)!=0)}ka=f[g>>2]|0;f[g>>2]=0;if(!ka){u=e;return na|0}br(ka);u=e;return na|0}function ec(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=Oa,ea=Oa,fa=Oa,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0;e=u;u=u+48|0;g=e+16|0;i=e+12|0;j=e;k=g+16|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)mq(j);p=m<<2;q=dn(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;hj(q|0,0,p|0)|0;f[o>>2]=r;r=c+48|0;p=c+40|0;m=g+4|0;s=g+12|0;t=g+8|0;v=a+40|0;w=a+64|0;x=f[d>>2]|0;d=0;y=q;z=0;A=0;B=q;C=q;D=q;while(1){q=r;E=f[q>>2]|0;F=f[q+4>>2]|0;q=p;G=on(f[q>>2]|0,f[q+4>>2]|0,x+z|0,0)|0;q=Tn(G|0,I|0,E|0,F|0)|0;F=(f[f[c>>2]>>2]|0)+q|0;q=h[F>>0]|h[F+1>>0]<<8|h[F+2>>0]<<16|h[F+3>>0]<<24;f[i>>2]=q;F=q^318;a:do if(d){E=d+-1|0;G=(E&d|0)==0;if(!G)if(F>>>0>>0)H=F;else H=(F>>>0)%(d>>>0)|0;else H=E&F;J=f[g>>2]|0;K=f[J+(H<<2)>>2]|0;b:do if(K|0?(L=f[K>>2]|0,L|0):0){c:do if(G){M=L;while(1){N=f[M+4>>2]|0;O=(N|0)==(F|0);if(!(O|(N&E|0)==(H|0)))break b;if(O?(f[M+8>>2]|0)==(q|0):0){P=M;break c}M=f[M>>2]|0;if(!M)break b}}else{M=L;while(1){O=f[M+4>>2]|0;if((O|0)==(F|0)){if((f[M+8>>2]|0)==(q|0)){P=M;break c}}else{if(O>>>0>>0)Q=O;else Q=(O>>>0)%(d>>>0)|0;if((Q|0)!=(H|0))break b}M=f[M>>2]|0;if(!M)break b}}while(0);f[D+(z<<2)>>2]=f[P+12>>2];R=y;S=A;T=C;U=B;V=D;break a}while(0);if(!G)if(F>>>0>>0)X=F;else X=(F>>>0)%(d>>>0)|0;else X=E&F;K=f[J+(X<<2)>>2]|0;if(!K){Y=X;Z=d;_=0;aa=40}else{if(G){L=K;while(1){L=f[L>>2]|0;if(!L){Y=X;Z=d;_=0;aa=40;break a}M=f[L+4>>2]|0;if(!((M|0)==(F|0)|(M&E|0)==(X|0))){Y=X;Z=d;_=0;aa=40;break a}if((f[L+8>>2]|0)==(q|0)){aa=55;break a}}}else ba=K;while(1){ba=f[ba>>2]|0;if(!ba){Y=X;Z=d;_=0;aa=40;break a}L=f[ba+4>>2]|0;if((L|0)!=(F|0)){if(L>>>0>>0)ca=L;else ca=(L>>>0)%(d>>>0)|0;if((ca|0)!=(X|0)){Y=X;Z=d;_=0;aa=40;break a}}if((f[ba+8>>2]|0)==(q|0)){aa=55;break}}}}else{Y=0;Z=0;_=1;aa=40}while(0);if((aa|0)==40){aa=0;K=dn(16)|0;f[K+8>>2]=q;f[K+12>>2]=A;f[K+4>>2]=F;f[K>>2]=0;da=$(((f[s>>2]|0)+1|0)>>>0);ea=$(Z>>>0);fa=$(n[k>>2]);do if(_|$(fa*ea)>>0<3|(Z+-1&Z|0)!=0)&1;E=~~$(W($(da/fa)))>>>0;ti(g,L>>>0>>0?E:L);L=f[m>>2]|0;E=L+-1|0;if(!(E&L)){ga=L;ha=E&F;break}if(F>>>0>>0){ga=L;ha=F}else{ga=L;ha=(F>>>0)%(L>>>0)|0}}else{ga=Z;ha=Y}while(0);F=(f[g>>2]|0)+(ha<<2)|0;q=f[F>>2]|0;if(!q){f[K>>2]=f[t>>2];f[t>>2]=K;f[F>>2]=t;F=f[K>>2]|0;if(F|0){L=f[F+4>>2]|0;F=ga+-1|0;if(F&ga)if(L>>>0>>0)ia=L;else ia=(L>>>0)%(ga>>>0)|0;else ia=L&F;ja=(f[g>>2]|0)+(ia<<2)|0;aa=53}}else{f[K>>2]=f[q>>2];ja=q;aa=53}if((aa|0)==53){aa=0;f[ja>>2]=K}f[s>>2]=(f[s>>2]|0)+1;aa=55}if((aa|0)==55){aa=0;q=v;F=f[q>>2]|0;L=on(F|0,f[q+4>>2]|0,A|0,0)|0;Rg((f[f[w>>2]>>2]|0)+L|0,i|0,F|0)|0;F=f[j>>2]|0;f[F+(z<<2)>>2]=A;R=F;S=A+1|0;T=F;U=F;V=F}F=z+1|0;ka=f[l>>2]|0;if(F>>>0>=ka>>>0)break;d=f[m>>2]|0;y=R;z=F;A=S;B=U;C=T;D=V}if((S|0)==(ka|0))la=U;else{U=a+84|0;if(!(b[U>>0]|0)){V=f[a+72>>2]|0;D=f[a+68>>2]|0;C=D;if((V|0)==(D|0))ma=R;else{B=V-D>>2;D=0;do{V=C+(D<<2)|0;f[V>>2]=f[T+(f[V>>2]<<2)>>2];D=D+1|0}while(D>>>0>>0);ma=R}}else{b[U>>0]=0;U=a+68|0;R=a+72|0;B=f[R>>2]|0;D=f[U>>2]|0;T=B-D>>2;C=D;D=B;if(ka>>>0<=T>>>0)if(ka>>>0>>0?(B=C+(ka<<2)|0,(B|0)!=(D|0)):0){f[R>>2]=D+(~((D+-4-B|0)>>>2)<<2);na=ka}else na=ka;else{kh(U,ka-T|0,1204);na=f[l>>2]|0}T=f[j>>2]|0;if(!na)ma=T;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[T+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);ma=T}}f[l>>2]=S;la=ma}if(!la)oa=S;else{ma=f[o>>2]|0;if((ma|0)!=(la|0))f[o>>2]=ma+(~((ma+-4-la|0)>>>2)<<2);br(la);oa=S}}else oa=0;S=f[g+8>>2]|0;if(S|0){la=S;do{S=la;la=f[la>>2]|0;br(S)}while((la|0)!=0)}la=f[g>>2]|0;f[g>>2]=0;if(!la){u=e;return oa|0}br(la);u=e;return oa|0}function fc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=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a+40|0;x=a+64|0;y=0;z=0;while(1){A=e;B=f[A>>2]|0;C=f[A+4>>2]|0;A=r;D=on(f[A>>2]|0,f[A+4>>2]|0,t+y|0,0)|0;A=Tn(D|0,I|0,B|0,C|0)|0;C=(f[f[c>>2]>>2]|0)+A|0;A=C;B=h[A>>0]|h[A+1>>0]<<8|h[A+2>>0]<<16|h[A+3>>0]<<24;A=C+4|0;C=h[A>>0]|h[A+1>>0]<<8|h[A+2>>0]<<16|h[A+3>>0]<<24;A=j;f[A>>2]=B;f[A+4>>2]=C;A=k;f[A>>2]=B;f[A+4>>2]=C;C=kf(i,k)|0;if(!C){A=k;B=f[A>>2]|0;D=f[A+4>>2]|0;A=B&65535;E=Wn(B|0,D|0,16)|0;F=E&65535;G=D&65535;H=Wn(B|0,D|0,48)|0;J=H&65535;K=((((A^318)&65535)+239^E&65535)+239^D&65535)+239^H&65535;H=f[s>>2]|0;E=(H|0)==0;a:do if(!E){L=H+-1|0;M=(L&H|0)==0;if(!M)if(K>>>0>>0)N=K;else N=(K>>>0)%(H>>>0)|0;else N=K&L;O=f[(f[i>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(K|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((d[O>>1]|0)==A<<16>>16?(d[O+2>>1]|0)==F<<16>>16:0)?(d[M+12>>1]|0)==G<<16>>16:0)?(d[O+6>>1]|0)==J<<16>>16:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(K|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(H>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((d[M>>1]|0)==A<<16>>16?(d[M+2>>1]|0)==F<<16>>16:0)?(d[S+12>>1]|0)==G<<16>>16:0)?(d[M+6>>1]|0)==J<<16>>16:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;J=dn(20)|0;G=J+8|0;F=G;d[F>>1]=B;d[F+2>>1]=B>>>16;F=G+4|0;d[F>>1]=D;d[F+2>>1]=D>>>16;f[J+16>>2]=z;f[J+4>>2]=K;f[J>>2]=0;U=$(((f[p>>2]|0)+1|0)>>>0);V=$(H>>>0);X=$(n[m>>2]);do if(E|$(X*V)>>0<3|(H+-1&H|0)!=0)&1;G=~~$(W($(U/X)))>>>0;Ch(i,F>>>0>>0?G:F);F=f[s>>2]|0;G=F+-1|0;if(!(G&F)){Y=F;Z=G&K;break}if(K>>>0>>0){Y=F;Z=K}else{Y=F;Z=(K>>>0)%(F>>>0)|0}}else{Y=H;Z=Q}while(0);H=(f[i>>2]|0)+(Z<<2)|0;K=f[H>>2]|0;if(!K){f[J>>2]=f[v>>2];f[v>>2]=J;f[H>>2]=v;H=f[J>>2]|0;if(H|0){E=f[H+4>>2]|0;H=Y+-1|0;if(H&Y)if(E>>>0>>0)_=E;else _=(E>>>0)%(Y>>>0)|0;else _=E&H;aa=(f[i>>2]|0)+(_<<2)|0;R=44}}else{f[J>>2]=f[K>>2];aa=K;R=44}if((R|0)==44){R=0;f[aa>>2]=J}f[p>>2]=(f[p>>2]|0)+1}K=w;H=f[K>>2]|0;E=on(H|0,f[K+4>>2]|0,z|0,0)|0;Rg((f[f[x>>2]>>2]|0)+E|0,j|0,H|0)|0;H=f[l>>2]|0;f[H+(y<<2)>>2]=z;ba=z+1|0;ca=H}else{H=f[l>>2]|0;f[H+(y<<2)>>2]=f[C+16>>2];ba=z;ca=H}y=y+1|0;da=f[o>>2]|0;if(y>>>0>=da>>>0)break;else z=ba}if((ba|0)==(da|0))ea=ca;else{z=a+84|0;if(!(b[z>>0]|0)){y=f[a+72>>2]|0;j=f[a+68>>2]|0;x=j;if((y|0)==(j|0))fa=ca;else{w=y-j>>2;j=0;do{y=x+(j<<2)|0;f[y>>2]=f[ca+(f[y>>2]<<2)>>2];j=j+1|0}while(j>>>0>>0);fa=ca}}else{b[z>>0]=0;z=a+68|0;ca=a+72|0;w=f[ca>>2]|0;j=f[z>>2]|0;x=w-j>>2;y=j;j=w;if(da>>>0<=x>>>0)if(da>>>0>>0?(w=y+(da<<2)|0,(w|0)!=(j|0)):0){f[ca>>2]=j+(~((j+-4-w|0)>>>2)<<2);ga=da}else ga=da;else{kh(z,da-x|0,1204);ga=f[o>>2]|0}x=f[l>>2]|0;if(!ga)fa=x;else{l=f[a+68>>2]|0;a=0;do{f[l+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=x}}f[o>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[q>>2]|0;if((fa|0)!=(ea|0))f[q>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);br(ea);ha=ba}}else ha=0;ba=f[i+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;br(ba)}while((ea|0)!=0)}ea=f[i>>2]|0;f[i>>2]=0;if(!ea){u=g;return ha|0}br(ea);u=g;return ha|0}function hc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0;c=u;u=u+16|0;d=c+8|0;e=c;g=c+4|0;h=a+16|0;i=f[h>>2]|0;j=a+20|0;k=f[j>>2]|0;if((k|0)==(i|0))l=i;else{m=k+(~((k+-4-i|0)>>>2)<<2)|0;f[j>>2]=m;l=m}m=a+24|0;if((l|0)==(f[m>>2]|0)){Ci(h,b);n=f[h>>2]|0;o=f[j>>2]|0}else{f[l>>2]=f[b>>2];k=l+4|0;f[j>>2]=k;n=i;o=k}k=f[a+8>>2]|0;i=(f[k+100>>2]|0)-(f[k+96>>2]|0)|0;k=(i|0)/12|0;if((n|0)==(o|0)){u=c;return 1}n=a+28|0;l=(i|0)>0;i=a+164|0;p=a+12|0;q=a+76|0;r=a+80|0;s=a+72|0;t=a+152|0;v=a+84|0;w=a+272|0;x=a+276|0;y=a+268|0;z=a+168|0;A=a+140|0;B=a+120|0;C=o;do{o=f[C+-4>>2]|0;f[b>>2]=o;a:do if((o|0)!=-1?(D=(o>>>0)/3|0,E=f[n>>2]|0,(f[E+(D>>>5<<2)>>2]&1<<(D&31)|0)==0):0){if(l){D=0;F=E;b:while(1){E=D+1|0;f[i>>2]=(f[i>>2]|0)+1;G=f[b>>2]|0;H=(G|0)==-1?-1:(G>>>0)/3|0;G=F+(H>>>5<<2)|0;f[G>>2]=1<<(H&31)|f[G>>2];G=f[q>>2]|0;if((G|0)==(f[r>>2]|0))Ci(s,b);else{f[G>>2]=f[b>>2];f[q>>2]=G+4}G=f[b>>2]|0;if((G|0)==-1)I=-1;else I=f[(f[f[p>>2]>>2]|0)+(G<<2)>>2]|0;J=(f[(f[t>>2]|0)+(I<<2)>>2]|0)!=-1;K=(f[v>>2]|0)+(I>>>5<<2)|0;L=1<<(I&31);M=f[K>>2]|0;do if(!(M&L)){f[K>>2]=M|L;if(J){N=f[b>>2]|0;O=30;break}f[d>>2]=0;P=f[w>>2]|0;if((P|0)==(f[x>>2]|0))Ci(y,d);else{f[P>>2]=0;f[w>>2]=P+4}P=f[b>>2]|0;Q=P+1|0;if((P|0)!=-1?(R=((Q>>>0)%3|0|0)==0?P+-2|0:Q,(R|0)!=-1):0)S=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;else S=-1;f[b>>2]=S}else{N=G;O=30}while(0);if((O|0)==30){O=0;G=N+1|0;if((N|0)==-1){O=35;break}L=((G>>>0)%3|0|0)==0?N+-2|0:G;if((L|0)==-1)T=-1;else T=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;f[e>>2]=T;L=(((N>>>0)%3|0|0)==0?2:-1)+N|0;if((L|0)==-1)U=-1;else U=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;L=(T|0)==-1;M=L?-1:(T>>>0)/3|0;V=(U|0)==-1;W=V?-1:(U>>>0)/3|0;K=((G>>>0)%3|0|0)==0?N+-2|0:G;if(((K|0)!=-1?(G=f[(f[p>>2]|0)+12>>2]|0,R=f[G+(K<<2)>>2]|0,(R|0)!=-1):0)?(K=(R>>>0)/3|0,R=f[n>>2]|0,(f[R+(K>>>5<<2)>>2]&1<<(K&31)|0)==0):0){K=(((N>>>0)%3|0|0)==0?2:-1)+N|0;do if((K|0)!=-1){Q=f[G+(K<<2)>>2]|0;if((Q|0)==-1)break;P=(Q>>>0)/3|0;if(!(f[R+(P>>>5<<2)>>2]&1<<(P&31))){O=63;break b}}while(0);if(!V)jf(a,f[i>>2]|0,H,0,W);f[d>>2]=3;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ci(y,d);else{f[R>>2]=3;f[w>>2]=R+4}X=f[e>>2]|0}else{if(!L){jf(a,f[i>>2]|0,H,1,M);R=f[b>>2]|0;if((R|0)==-1){O=44;break}else Y=R}else Y=N;R=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((R|0)==-1){O=44;break}K=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;if((K|0)==-1){O=44;break}R=(K>>>0)/3|0;if(f[(f[n>>2]|0)+(R>>>5<<2)>>2]&1<<(R&31)|0){O=44;break}f[d>>2]=5;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ci(y,d);else{f[R>>2]=5;f[w>>2]=R+4}X=U}f[b>>2]=X}if((E|0)>=(k|0))break a;D=E;F=f[n>>2]|0}do if((O|0)==35){O=0;f[e>>2]=-1;O=46}else if((O|0)==44){O=0;if(V)O=46;else{jf(a,f[i>>2]|0,H,0,W);O=46}}else if((O|0)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k+8>>2]=s;hj(r|0,0,q|0)|0;f[p>>2]=s;s=f[d>>2]|0;d=c+48|0;q=c+40|0;r=g+4|0;o=g+12|0;t=g+8|0;v=a+40|0;w=a+64|0;x=0;y=0;while(1){z=d;A=f[z>>2]|0;B=f[z+4>>2]|0;z=q;C=on(f[z>>2]|0,f[z+4>>2]|0,s+x|0,0)|0;z=Tn(C|0,I|0,A|0,B|0)|0;B=(f[f[c>>2]>>2]|0)+z|0;z=h[B>>0]|h[B+1>>0]<<8|h[B+2>>0]<<16|h[B+3>>0]<<24;f[i>>2]=z;f[j>>2]=z;z=pf(g,j)|0;if(!z){B=f[j>>2]|0;A=B&255;C=B>>>8;D=C&255;E=B>>>16;F=E&255;G=B>>>24;H=G&255;J=C&255;C=E&255;E=(((B&255^318)+239^J)+239^C)+239^G;G=f[r>>2]|0;K=(G|0)==0;a:do if(!K){L=G+-1|0;M=(L&G|0)==0;if(!M)if(E>>>0>>0)N=E;else N=(E>>>0)%(G>>>0)|0;else N=E&L;O=f[(f[g>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(E|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((b[O>>0]|0)==A<<24>>24?(b[O+1>>0]|0)==D<<24>>24:0)?(b[O+2>>0]|0)==F<<24>>24:0)?(b[O+3>>0]|0)==H<<24>>24:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(E|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(G>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((b[M>>0]|0)==A<<24>>24?(b[M+1>>0]|0)==D<<24>>24:0)?(b[M+2>>0]|0)==F<<24>>24:0)?(b[M+3>>0]|0)==H<<24>>24:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else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]<<2)>>2];i=i+1|0}while(i>>>0>>0);fa=ca}}else{b[y>>0]=0;y=a+68|0;ca=a+72|0;v=f[ca>>2]|0;i=f[y>>2]|0;w=v-i>>2;x=i;i=v;if(da>>>0<=w>>>0)if(da>>>0>>0?(v=x+(da<<2)|0,(v|0)!=(i|0)):0){f[ca>>2]=i+(~((i+-4-v|0)>>>2)<<2);ga=da}else ga=da;else{kh(y,da-w|0,1204);ga=f[m>>2]|0}w=f[k>>2]|0;if(!ga)fa=w;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[w+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=w}}f[m>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[p>>2]|0;if((fa|0)!=(ea|0))f[p>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);br(ea);ha=ba}}else ha=0;ba=f[g+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;br(ba)}while((ea|0)!=0)}ea=f[g>>2]|0;f[g>>2]=0;if(!ea){u=e;return ha|0}br(ea);u=e;return ha|0}function jc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=Oa,V=Oa,X=Oa,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;e=u;u=u+80|0;g=e+48|0;h=e+32|0;i=e+16|0;j=e;k=g+16|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)mq(j);p=m<<2;q=dn(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;hj(q|0,0,p|0)|0;f[o>>2]=r;r=f[d>>2]|0;d=c+48|0;p=c+40|0;q=i+4|0;m=i+8|0;s=i+12|0;t=g+4|0;v=g+12|0;w=g+8|0;x=a+40|0;y=a+64|0;z=0;A=0;while(1){B=d;C=f[B>>2]|0;D=f[B+4>>2]|0;B=p;E=on(f[B>>2]|0,f[B+4>>2]|0,r+A|0,0)|0;B=Tn(E|0,I|0,C|0,D|0)|0;D=(f[f[c>>2]>>2]|0)+B|0;B=h;C=D;E=B+16|0;do{b[B>>0]=b[C>>0]|0;B=B+1|0;C=C+1|0}while((B|0)<(E|0));Xl(i|0,D|0,16)|0;C=Ff(g,i)|0;if(!C){B=f[i>>2]|0;E=f[q>>2]|0;F=f[m>>2]|0;G=f[s>>2]|0;H=(((B^318)+239^E)+239^F)+239^G;J=f[t>>2]|0;K=(J|0)==0;a:do if(!K){L=J+-1|0;M=(L&J|0)==0;if(!M)if(H>>>0>>0)N=H;else N=(H>>>0)%(J>>>0)|0;else N=H&L;O=f[(f[g>>2]|0)+(N<<2)>>2]|0;if((O|0)!=0?(P=f[O>>2]|0,(P|0)!=0):0){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(H|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}if((((f[M+8>>2]|0)==(B|0)?(f[M+12>>2]|0)==(E|0):0)?(f[M+16>>2]|0)==(F|0):0)?(f[M+20>>2]|0)==(G|0):0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(H|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(J>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}if((((f[S+8>>2]|0)==(B|0)?(f[S+12>>2]|0)==(E|0):0)?(f[S+16>>2]|0)==(F|0):0)?(f[S+20>>2]|0)==(G|0):0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;D=dn(28)|0;f[D+8>>2]=B;f[D+12>>2]=E;f[D+16>>2]=F;f[D+20>>2]=G;f[D+24>>2]=z;f[D+4>>2]=H;f[D>>2]=0;U=$(((f[v>>2]|0)+1|0)>>>0);V=$(J>>>0);X=$(n[k>>2]);do if(K|$(X*V)>>0<3|(J+-1&J|0)!=0)&1;M=~~$(W($(U/X)))>>>0;Gh(g,P>>>0>>0?M:P);P=f[t>>2]|0;M=P+-1|0;if(!(M&P)){Y=P;Z=M&H;break}if(H>>>0

>>0){Y=P;Z=H}else{Y=P;Z=(H>>>0)%(P>>>0)|0}}else{Y=J;Z=Q}while(0);J=(f[g>>2]|0)+(Z<<2)|0;H=f[J>>2]|0;if(!H){f[D>>2]=f[w>>2];f[w>>2]=D;f[J>>2]=w;J=f[D>>2]|0;if(J|0){K=f[J+4>>2]|0;J=Y+-1|0;if(J&Y)if(K>>>0>>0)_=K;else _=(K>>>0)%(Y>>>0)|0;else _=K&J;aa=(f[g>>2]|0)+(_<<2)|0;R=44}}else{f[D>>2]=f[H>>2];aa=H;R=44}if((R|0)==44){R=0;f[aa>>2]=D}f[v>>2]=(f[v>>2]|0)+1}H=x;J=f[H>>2]|0;K=on(J|0,f[H+4>>2]|0,z|0,0)|0;Rg((f[f[y>>2]>>2]|0)+K|0,h|0,J|0)|0;J=f[j>>2]|0;f[J+(A<<2)>>2]=z;ba=z+1|0;ca=J}else{J=f[j>>2]|0;f[J+(A<<2)>>2]=f[C+24>>2];ba=z;ca=J}A=A+1|0;da=f[l>>2]|0;if(A>>>0>=da>>>0)break;else z=ba}if((ba|0)==(da|0))ea=ca;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;h=f[a+68>>2]|0;y=h;if((A|0)==(h|0))fa=ca;else{x=A-h>>2;h=0;do{A=y+(h<<2)|0;f[A>>2]=f[ca+(f[A>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);fa=ca}}else{b[z>>0]=0;z=a+68|0;ca=a+72|0;x=f[ca>>2]|0;h=f[z>>2]|0;y=x-h>>2;A=h;h=x;if(da>>>0<=y>>>0)if(da>>>0>>0?(x=A+(da<<2)|0,(x|0)!=(h|0)):0){f[ca>>2]=h+(~((h+-4-x|0)>>>2)<<2);ga=da}else ga=da;else{kh(z,da-y|0,1204);ga=f[l>>2]|0}y=f[j>>2]|0;if(!ga)fa=y;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=y}}f[l>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[o>>2]|0;if((fa|0)!=(ea|0))f[o>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);br(ea);ha=ba}}else ha=0;ba=f[g+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;br(ba)}while((ea|0)!=0)}ea=f[g>>2]|0;f[g>>2]=0;if(!ea){u=e;return ha|0}br(ea);u=e;return ha|0}function kc(a,c,e){a=a|0;c=c|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=Oa,T=Oa,U=Oa,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0;g=u;u=u+48|0;h=g+12|0;i=g+38|0;j=g+32|0;k=g;l=h+16|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;n[l>>2]=$(1.0);m=a+80|0;o=f[m>>2]|0;f[k>>2]=0;p=k+4|0;f[p>>2]=0;f[k+8>>2]=0;if(o){if(o>>>0>1073741823)mq(k);q=o<<2;r=dn(q)|0;f[k>>2]=r;s=r+(o<<2)|0;f[k+8>>2]=s;hj(r|0,0,q|0)|0;f[p>>2]=s;s=f[e>>2]|0;e=c+48|0;q=c+40|0;r=j+2|0;o=j+4|0;t=h+4|0;v=h+12|0;w=h+8|0;x=a+40|0;y=a+64|0;z=0;A=0;while(1){B=e;C=f[B>>2]|0;D=f[B+4>>2]|0;B=q;E=on(f[B>>2]|0,f[B+4>>2]|0,s+A|0,0)|0;B=Tn(E|0,I|0,C|0,D|0)|0;D=(f[f[c>>2]>>2]|0)+B|0;b[i>>0]=b[D>>0]|0;b[i+1>>0]=b[D+1>>0]|0;b[i+2>>0]=b[D+2>>0]|0;b[i+3>>0]=b[D+3>>0]|0;b[i+4>>0]=b[D+4>>0]|0;b[i+5>>0]=b[D+5>>0]|0;Xl(j|0,D|0,6)|0;D=Pf(h,j)|0;if(!D){B=d[j>>1]|0;C=d[r>>1]|0;E=d[o>>1]|0;F=(((B^318)&65535)+239^C&65535)+239^E&65535;G=f[t>>2]|0;H=(G|0)==0;a:do if(!H){J=G+-1|0;K=(J&G|0)==0;if(!K)if(F>>>0>>0)L=F;else L=(F>>>0)%(G>>>0)|0;else L=F&J;M=f[(f[h>>2]|0)+(L<<2)>>2]|0;if((M|0)!=0?(N=f[M>>2]|0,(N|0)!=0):0){if(K){K=N;while(1){M=f[K+4>>2]|0;if(!((M|0)==(F|0)|(M&J|0)==(L|0))){O=L;P=29;break a}M=K+8|0;if(((d[M>>1]|0)==B<<16>>16?(d[M+2>>1]|0)==C<<16>>16:0)?(d[K+12>>1]|0)==E<<16>>16:0)break a;K=f[K>>2]|0;if(!K){O=L;P=29;break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}K=Q+8|0;if(((d[K>>1]|0)==B<<16>>16?(d[K+2>>1]|0)==C<<16>>16:0)?(d[Q+12>>1]|0)==E<<16>>16:0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;N=dn(20)|0;d[N+8>>1]=B;d[N+10>>1]=C;d[N+12>>1]=E;f[N+16>>2]=z;f[N+4>>2]=F;f[N>>2]=0;S=$(((f[v>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[l>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;J=~~$(W($(S/U)))>>>0;Dh(h,K>>>0>>0?J:K);K=f[t>>2]|0;J=K+-1|0;if(!(J&K)){V=K;X=J&F;break}if(F>>>0>>0){V=K;X=F}else{V=K;X=(F>>>0)%(K>>>0)|0}}else{V=G;X=O}while(0);G=(f[h>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[N>>2]=f[w>>2];f[w>>2]=N;f[G>>2]=w;G=f[N>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[h>>2]|0)+(Y<<2)|0;P=42}}else{f[N>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=N}f[v>>2]=(f[v>>2]|0)+1}F=x;G=f[F>>2]|0;H=on(G|0,f[F+4>>2]|0,z|0,0)|0;Rg((f[f[y>>2]>>2]|0)+H|0,i|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=z;_=z+1|0;aa=G}else{G=f[k>>2]|0;f[G+(A<<2)>>2]=f[D+16>>2];_=z;aa=G}A=A+1|0;ba=f[m>>2]|0;if(A>>>0>=ba>>>0)break;else z=_}if((_|0)==(ba|0))ca=aa;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;i=f[a+68>>2]|0;y=i;if((A|0)==(i|0))da=aa;else{x=A-i>>2;i=0;do{A=y+(i<<2)|0;f[A>>2]=f[aa+(f[A>>2]<<2)>>2];i=i+1|0}while(i>>>0>>0);da=aa}}else{b[z>>0]=0;z=a+68|0;aa=a+72|0;x=f[aa>>2]|0;i=f[z>>2]|0;y=x-i>>2;A=i;i=x;if(ba>>>0<=y>>>0)if(ba>>>0>>0?(x=A+(ba<<2)|0,(x|0)!=(i|0)):0){f[aa>>2]=i+(~((i+-4-x|0)>>>2)<<2);ea=ba}else ea=ba;else{kh(z,ba-y|0,1204);ea=f[m>>2]|0}y=f[k>>2]|0;if(!ea)da=y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=y}}f[m>>2]=_;ca=da}if(!ca)fa=_;else{da=f[p>>2]|0;if((da|0)!=(ca|0))f[p>>2]=da+(~((da+-4-ca|0)>>>2)<<2);br(ca);fa=_}}else fa=0;_=f[h+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;br(_)}while((ca|0)!=0)}ca=f[h>>2]|0;f[h>>2]=0;if(!ca){u=g;return fa|0}br(ca);u=g;return fa|0}function lc(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;d=u;u=u+80|0;e=d+72|0;g=d+64|0;h=d;i=d+68|0;j=d+60|0;k=a+352|0;if(b[k>>0]|0?(l=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0,((f[l+12>>2]|0)-(f[l+8>>2]|0)|0)>0):0){l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+8|0;m=f[f[l>>2]>>2]|0;f[e>>2]=c;l=m+4|0;n=m+8|0;o=f[n>>2]|0;if((o|0)==(f[m+12>>2]|0))Ci(l,e);else{f[o>>2]=c;f[n>>2]=o+4}o=f[e>>2]|0;p=m+16|0;q=m+20|0;m=f[q>>2]|0;r=f[p>>2]|0;s=m-r>>2;t=r;if((o|0)<(s|0)){v=t;w=o}else{r=o+1|0;f[g>>2]=-1;x=m;if(r>>>0<=s>>>0)if(r>>>0>>0?(m=t+(r<<2)|0,(m|0)!=(x|0)):0){f[q>>2]=x+(~((x+-4-m|0)>>>2)<<2);y=o;z=t}else{y=o;z=t}else{kh(p,r-s|0,g);y=f[e>>2]|0;z=f[p>>2]|0}v=z;w=y}f[v+(w<<2)>>2]=((f[n>>2]|0)-(f[l>>2]|0)>>2)+-1;A=1;u=d;return A|0}l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+56|0;n=f[(f[(f[l>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;w=f[(f[(f[l>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;l=a+172|0;v=f[a+176>>2]|0;y=f[l>>2]|0;z=y;a:do if((v|0)==(y|0))B=-1;else{p=(v-y|0)/136|0;s=0;while(1){if((f[z+(s*136|0)>>2]|0)==(c|0))break;r=s+1|0;if(r>>>0

>>0)s=r;else{B=-1;break a}}f[g>>2]=s;B=s}while(0);b:do if(!(b[k>>0]|0)){y=(f[w+56>>2]|0)==0;do if(!((n|0)==0|y)){if((n|0)==1?b[z+(B*136|0)+28>>0]|0:0)break;v=z+(B*136|0)+104|0;p=z+(B*136|0)+4|0;r=(f[z+(B*136|0)+60>>2]|0)-(f[z+(B*136|0)+56>>2]|0)>>2;f[e>>2]=-1;Sf(z+(B*136|0)+116|0,r,e);r=dn(80)|0;t=f[a+8>>2]|0;f[r+4>>2]=0;f[r>>2]=3164;o=r+8|0;m=r+12|0;x=m+44|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(x|0));f[o>>2]=3188;q=r+56|0;f[q>>2]=0;f[r+60>>2]=0;f[r+64>>2]=0;f[r+68>>2]=t;f[r+72>>2]=v;C=r+76|0;f[C>>2]=0;D=h+4|0;m=D+4|0;x=m+40|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(x|0));f[h>>2]=3188;m=h+48|0;f[m>>2]=0;x=h+52|0;f[x>>2]=0;f[h+56>>2]=0;f[D>>2]=p;E=f[z+(B*136|0)+68>>2]|0;F=((f[E+4>>2]|0)-(f[E>>2]|0)>>2>>>0)/3|0;b[e>>0]=0;Xg(h+24|0,F,e);F=f[D>>2]|0;E=(f[F+56>>2]|0)-(f[F+52>>2]|0)>>2;b[e>>0]=0;Xg(h+36|0,E,e);f[h+8>>2]=p;f[h+12>>2]=v;f[h+16>>2]=t;f[h+20>>2]=r;f[C>>2]=a+72;ef(o,h)|0;Yf(q,f[m>>2]|0,f[x>>2]|0);E=r;f[h>>2]=3188;F=f[m>>2]|0;if(F|0){m=f[x>>2]|0;if((m|0)!=(F|0))f[x>>2]=m+(~((m+-4-F|0)>>>2)<<2);br(F)}f[h>>2]=3208;F=f[h+36>>2]|0;if(F|0)br(F);F=f[h+24>>2]|0;if(F|0)br(F);G=0;H=E;I=42;break b}while(0);if(!y){s=f[a+12>>2]|0;E=(f[s+28>>2]|0)-(f[s+24>>2]|0)>>2;f[e>>2]=-1;Sf(z+(B*136|0)+116|0,E,e);b[(f[l>>2]|0)+((f[g>>2]|0)*136|0)+100>>0]=0;J=z+(B*136|0)+104|0;I=26}else I=24}else I=24;while(0);if((I|0)==24){J=a+40|0;I=26}if((I|0)==26){B=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((Yh(f[B>>2]|0)|0)==0?(f[w+56>>2]|0)==0:0){if(b[k>>0]|0?(z=f[a+8>>2]|0,((f[z+12>>2]|0)-(f[z+8>>2]|0)|0)>=5):0){I=31;break}uf(e,a,J);K=1;L=f[e>>2]|0}else I=31;while(0);if((I|0)==31){Le(e,a,J);K=0;L=f[e>>2]|0}if(!L)M=0;else{G=K;H=L;I=42}}if((I|0)==42){I=f[g>>2]|0;if((I|0)==-1)N=a+68|0;else N=(f[l>>2]|0)+(I*136|0)+132|0;f[N>>2]=G;G=dn(76)|0;f[i>>2]=H;ml(G,i,c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}else{kh(p,r-s|0,g);y=f[e>>2]|0;z=f[p>>2]|0}v=z;w=y}f[v+(w<<2)>>2]=((f[n>>2]|0)-(f[l>>2]|0)>>2)+-1;A=1;u=d;return A|0}l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+56|0;n=f[(f[(f[l>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;w=f[(f[(f[l>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;l=a+172|0;v=f[a+176>>2]|0;y=f[l>>2]|0;z=y;a:do if((v|0)==(y|0))B=-1;else{p=(v-y|0)/136|0;s=0;while(1){if((f[z+(s*136|0)>>2]|0)==(c|0))break;r=s+1|0;if(r>>>0

>>0)s=r;else{B=-1;break a}}f[g>>2]=s;B=s}while(0);b:do if(!(b[k>>0]|0)){y=(f[w+56>>2]|0)==0;do if(!((n|0)==0|y)){if((n|0)==1?b[z+(B*136|0)+28>>0]|0:0)break;v=z+(B*136|0)+104|0;p=z+(B*136|0)+4|0;r=(f[z+(B*136|0)+60>>2]|0)-(f[z+(B*136|0)+56>>2]|0)>>2;f[e>>2]=-1;Sf(z+(B*136|0)+116|0,r,e);r=dn(80)|0;t=f[a+8>>2]|0;f[r+4>>2]=0;f[r>>2]=3164;o=r+8|0;m=r+12|0;x=m+44|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(x|0));f[o>>2]=3188;q=r+56|0;f[q>>2]=0;f[r+60>>2]=0;f[r+64>>2]=0;f[r+68>>2]=t;f[r+72>>2]=v;C=r+76|0;f[C>>2]=0;D=h+4|0;m=D+4|0;x=m+40|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(x|0));f[h>>2]=3188;m=h+48|0;f[m>>2]=0;x=h+52|0;f[x>>2]=0;f[h+56>>2]=0;f[D>>2]=p;E=f[z+(B*136|0)+68>>2]|0;F=((f[E+4>>2]|0)-(f[E>>2]|0)>>2>>>0)/3|0;b[e>>0]=0;Xg(h+24|0,F,e);F=f[D>>2]|0;E=(f[F+56>>2]|0)-(f[F+52>>2]|0)>>2;b[e>>0]=0;Xg(h+36|0,E,e);f[h+8>>2]=p;f[h+12>>2]=v;f[h+16>>2]=t;f[h+20>>2]=r;f[C>>2]=a+72;ef(o,h)|0;Yf(q,f[m>>2]|0,f[x>>2]|0);E=r;f[h>>2]=3188;F=f[m>>2]|0;if(F|0){m=f[x>>2]|0;if((m|0)!=(F|0))f[x>>2]=m+(~((m+-4-F|0)>>>2)<<2);br(F)}f[h>>2]=3208;F=f[h+36>>2]|0;if(F|0)br(F);F=f[h+24>>2]|0;if(F|0)br(F);G=0;H=E;I=42;break b}while(0);if(!y){s=f[a+12>>2]|0;E=(f[s+28>>2]|0)-(f[s+24>>2]|0)>>2;f[e>>2]=-1;Sf(z+(B*136|0)+116|0,E,e);b[(f[l>>2]|0)+((f[g>>2]|0)*136|0)+100>>0]=0;J=z+(B*136|0)+104|0;I=26}else I=24}else I=24;while(0);if((I|0)==24){J=a+40|0;I=26}if((I|0)==26){B=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((Yh(f[B>>2]|0)|0)==0?(f[w+56>>2]|0)==0:0){if(b[k>>0]|0?(z=f[a+8>>2]|0,((f[z+12>>2]|0)-(f[z+8>>2]|0)|0)>=5):0){I=31;break}uf(e,a,J);K=1;L=f[e>>2]|0}else I=31;while(0);if((I|0)==31){Le(e,a,J);K=0;L=f[e>>2]|0}if(!L)M=0;else{G=K;H=L;I=42}}if((I|0)==42){I=f[g>>2]|0;if((I|0)==-1)N=a+68|0;else N=(f[l>>2]|0)+(I*136|0)+132|0;f[N>>2]=G;G=dn(76)|0;f[i>>2]=H;ml(G,i,c);c=G;G=f[i>>2]|0;f[i>>2]=0;if(G|0)Va[f[(f[G>>2]|0)+4>>2]&127](G);G=a+188|0;i=f[G>>2]|0;if((i|0)==(f[a+192>>2]|0))Ci(a+184|0,g);else{f[i>>2]=f[g>>2];f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Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);P=0-S|0;M=0-_|0;f[j>>2]=0-O;f[r>>2]=P;f[t>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(q=(N|0)==(ca|0),!(M&q)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(q&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);N=K<<1;M=b+(N<<2)|0;H=M+4|0;O=f[H>>2]|0;f[h>>2]=f[M>>2];f[x>>2]=O;f[i>>2]=$;f[y>>2]=aa;Dd(d,n,h,i);O=f[d>>2]|0;f[k>>2]=O;P=f[z>>2]|0;f[A>>2]=P;q=f[H>>2]|0;f[h>>2]=f[M>>2];f[B>>2]=q;f[i>>2]=da;f[C>>2]=ea;Dd(d,n,h,i);q=f[d>>2]|0;f[l>>2]=q;M=f[D>>2]|0;f[E>>2]=M;H=f[v>>2]|0;if((H|0)>=(O|0))if((O|0)<(0-H|0))fa=(f[F>>2]|0)+O|0;else fa=O;else fa=O-(f[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0)+M|0;else ia=M;else ia=M-(f[F>>2]|0)|0;f[G>>2]=ia;if((((ga|0)>-1?ga:0-ga|0)+((fa|0)>-1?fa:0-fa|0)|0)<(((ha|0)>-1?ha:0-ha|0)+((ia|0)>-1?ia:0-ia|0)|0)){Vi(g,0);ja=k}else{Vi(g,1);ja=l}M=f[ja>>2]|0;if((M|0)<0)ka=(f[F>>2]|0)+M|0;else ka=M;M=c+(N<<2)|0;f[M>>2]=ka;N=f[ja+4>>2]|0;if((N|0)<0)la=(f[F>>2]|0)+N|0;else la=N;f[M+4>>2]=la;K=K+1|0;if((K|0)>=(s|0)){ma=5;break}M=f[p>>2]|0;L=f[M>>2]|0;if((f[M+4>>2]|0)-L>>2>>>0<=K>>>0){J=M;ma=6;break}}if((ma|0)==5){u=e;return 1}else if((ma|0)==6)mq(J);return 0}function oc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;c=u;u=u+48|0;d=c+24|0;e=c+12|0;g=c;if(!b){h=0;u=c;return h|0}i=a+12|0;j=a+4|0;k=f[j>>2]|0;l=f[a>>2]|0;m=k-l>>2;n=a+16|0;o=f[n>>2]|0;p=f[i>>2]|0;q=o-p>>2;r=p;p=o;if(m>>>0<=q>>>0)if(m>>>0>>0?(o=r+(m<<2)|0,(o|0)!=(p|0)):0){f[n>>2]=p+(~((p+-4-o|0)>>>2)<<2);s=l;t=k}else{s=l;t=k}else{kh(i,m-q|0,5828);s=f[a>>2]|0;t=f[j>>2]|0}f[d>>2]=0;q=d+4|0;f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(t<<2)>>2]|0)+y|0;t=k}else break}}t=f[j>>2]|0;j=f[a>>2]|0;y=j;if((t|0)!=(j|0)){k=a+40|0;a=t-j>>2;j=H;t=H;g=H;A=H;p=H;x=H;l=0;o=J;while(1){F=f[y+(l<<2)>>2]|0;G=l+1|0;E=((G>>>0)%3|0|0)==0?l+-2|0:G;if((E|0)==-1)M=-1;else M=f[y+(E<<2)>>2]|0;E=((l>>>0)%3|0|0)==0;G=(E?2:-1)+l|0;if((G|0)==-1)N=-1;else N=f[y+(G<<2)>>2]|0;if(E?(M|0)==(N|0)|((F|0)==(M|0)|(F|0)==(N|0)):0){f[k>>2]=(f[k>>2]|0)+1;O=j;P=t;Q=g;R=A;S=p;T=x;U=l+2|0;V=o}else W=51;a:do if((W|0)==51){W=0;E=f[s+(N<<2)>>2]|0;b:do if((E|0)>0){G=0;B=f[o+(N<<2)>>2]|0;while(1){m=f[p+(B<<3)>>2]|0;if((m|0)==-1){X=j;Y=t;Z=A;_=p;break b}if((m|0)==(M|0)){m=f[p+(B<<3)+4>>2]|0;if((m|0)==-1)$=-1;else $=f[y+(m<<2)>>2]|0;if((F|0)!=($|0))break}m=G+1|0;if((m|0)<(E|0)){G=m;B=B+1|0}else{X=j;Y=t;Z=A;_=p;break b}}m=f[A+(B<<3)+4>>2]|0;r=G;n=B;D=t;while(1){r=r+1|0;if((r|0)>=(E|0))break;C=n+1|0;f[D+(n<<3)>>2]=f[D+(C<<3)>>2];f[D+(n<<3)+4>>2]=f[D+(C<<3)+4>>2];if((f[j+(n<<3)>>2]|0)==-1)break;else{n=C;D=j}}f[g+(n<<3)>>2]=-1;if((m|0)==-1){X=g;Y=g;Z=g;_=g}else{D=f[i>>2]|0;f[D+(l<<2)>>2]=m;f[D+(m<<2)>>2]=l;O=g;P=g;Q=g;R=g;S=g;T=x;U=l;V=o;break a}}else{X=j;Y=t;Z=A;_=p}while(0);E=f[s+(M<<2)>>2]|0;if((E|0)>0){D=0;r=f[J+(M<<2)>>2]|0;while(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0;f[o>>2]=r;r=f[d>>2]|0;d=c+48|0;p=c+40|0;q=i+1|0;m=i+2|0;s=g+4|0;t=g+12|0;v=g+8|0;w=a+40|0;x=a+64|0;y=0;z=0;while(1){A=d;B=f[A>>2]|0;C=f[A+4>>2]|0;A=p;D=on(f[A>>2]|0,f[A+4>>2]|0,r+y|0,0)|0;A=Tn(D|0,I|0,B|0,C|0)|0;C=(f[f[c>>2]>>2]|0)+A|0;b[h>>0]=b[C>>0]|0;b[h+1>>0]=b[C+1>>0]|0;b[h+2>>0]=b[C+2>>0]|0;Xl(i|0,C|0,3)|0;C=Uf(g,i)|0;if(!C){A=b[i>>0]|0;B=b[q>>0]|0;D=b[m>>0]|0;E=((A&255^318)+239^B&255)+239^D&255;F=f[s>>2]|0;G=(F|0)==0;a:do if(!G){H=F+-1|0;J=(H&F|0)==0;if(!J)if(E>>>0>>0)K=E;else K=(E>>>0)%(F>>>0)|0;else K=E&H;L=f[(f[g>>2]|0)+(K<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(E|0)|(L&H|0)==(K|0))){N=K;O=29;break a}L=J+8|0;if(((b[L>>0]|0)==A<<24>>24?(b[L+1>>0]|0)==B<<24>>24:0)?(b[L+2>>0]|0)==D<<24>>24:0)break a;J=f[J>>2]|0;if(!J){N=K;O=29;break a}}}else P=M;while(1){J=f[P+4>>2]|0;if((J|0)!=(E|0)){if(J>>>0>>0)Q=J;else Q=(J>>>0)%(F>>>0)|0;if((Q|0)!=(K|0)){N=K;O=29;break a}}J=P+8|0;if(((b[J>>0]|0)==A<<24>>24?(b[J+1>>0]|0)==B<<24>>24:0)?(b[J+2>>0]|0)==D<<24>>24:0)break a;P=f[P>>2]|0;if(!P){N=K;O=29;break}}}else{N=K;O=29}}else{N=0;O=29}while(0);if((O|0)==29){O=0;M=dn(16)|0;b[M+8>>0]=A;b[M+9>>0]=B;b[M+10>>0]=D;f[M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[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0)+M|0;else ia=M;else ia=M-(f[F>>2]|0)|0;f[G>>2]=ia;if((((ga|0)>-1?ga:0-ga|0)+((fa|0)>-1?fa:0-fa|0)|0)<(((ha|0)>-1?ha:0-ha|0)+((ia|0)>-1?ia:0-ia|0)|0)){Vi(g,0);ja=k}else{Vi(g,1);ja=l}M=f[ja>>2]|0;if((M|0)<0)ka=(f[F>>2]|0)+M|0;else ka=M;M=c+(N<<2)|0;f[M>>2]=ka;N=f[ja+4>>2]|0;if((N|0)<0)la=(f[F>>2]|0)+N|0;else la=N;f[M+4>>2]=la;K=K+1|0;if((K|0)>=(s|0)){ma=5;break}M=f[p>>2]|0;L=f[M>>2]|0;if((f[M+4>>2]|0)-L>>2>>>0<=K>>>0){J=M;ma=6;break}}if((ma|0)==5){u=e;return 1}else if((ma|0)==6)mq(J);return 0}function rc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=Oa,T=Oa,U=Oa,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0;e=u;u=u+64|0;g=e+36|0;h=e+24|0;i=e+12|0;j=e;k=g+16|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)mq(j);p=m<<2;q=dn(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;hj(q|0,0,p|0)|0;f[o>>2]=r;r=f[d>>2]|0;d=c+48|0;p=c+40|0;q=i+4|0;m=i+8|0;s=g+4|0;t=g+12|0;v=g+8|0;w=a+40|0;x=a+64|0;y=0;z=0;while(1){A=d;B=f[A>>2]|0;C=f[A+4>>2]|0;A=p;D=on(f[A>>2]|0,f[A+4>>2]|0,r+z|0,0)|0;A=Tn(D|0,I|0,B|0,C|0)|0;C=(f[f[c>>2]>>2]|0)+A|0;A=h;B=C;D=A+12|0;do{b[A>>0]=b[B>>0]|0;A=A+1|0;B=B+1|0}while((A|0)<(D|0));Xl(i|0,C|0,12)|0;B=_f(g,i)|0;if(!B){A=f[i>>2]|0;D=f[q>>2]|0;E=f[m>>2]|0;F=((A^318)+239^D)+239^E;G=f[s>>2]|0;H=(G|0)==0;a:do if(!H){J=G+-1|0;K=(J&G|0)==0;if(!K)if(F>>>0>>0)L=F;else L=(F>>>0)%(G>>>0)|0;else L=F&J;M=f[(f[g>>2]|0)+(L<<2)>>2]|0;if((M|0)!=0?(N=f[M>>2]|0,(N|0)!=0):0){if(K){K=N;while(1){M=f[K+4>>2]|0;if(!((M|0)==(F|0)|(M&J|0)==(L|0))){O=L;P=29;break a}if(((f[K+8>>2]|0)==(A|0)?(f[K+12>>2]|0)==(D|0):0)?(f[K+16>>2]|0)==(E|0):0)break a;K=f[K>>2]|0;if(!K){O=L;P=29;break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}if(((f[Q+8>>2]|0)==(A|0)?(f[Q+12>>2]|0)==(D|0):0)?(f[Q+16>>2]|0)==(E|0):0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;C=dn(24)|0;f[C+8>>2]=A;f[C+12>>2]=D;f[C+16>>2]=E;f[C+20>>2]=y;f[C+4>>2]=F;f[C>>2]=0;S=$(((f[t>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[k>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;K=~~$(W($(S/U)))>>>0;Hh(g,N>>>0>>0?K:N);N=f[s>>2]|0;K=N+-1|0;if(!(K&N)){V=N;X=K&F;break}if(F>>>0>>0){V=N;X=F}else{V=N;X=(F>>>0)%(N>>>0)|0}}else{V=G;X=O}while(0);G=(f[g>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[C>>2]=f[v>>2];f[v>>2]=C;f[G>>2]=v;G=f[C>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[g>>2]|0)+(Y<<2)|0;P=42}}else{f[C>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=C}f[t>>2]=(f[t>>2]|0)+1}F=w;G=f[F>>2]|0;H=on(G|0,f[F+4>>2]|0,y|0,0)|0;Rg((f[f[x>>2]>>2]|0)+H|0,h|0,G|0)|0;G=f[j>>2]|0;f[G+(z<<2)>>2]=y;_=y+1|0;aa=G}else{G=f[j>>2]|0;f[G+(z<<2)>>2]=f[B+20>>2];_=y;aa=G}z=z+1|0;ba=f[l>>2]|0;if(z>>>0>=ba>>>0)break;else y=_}if((_|0)==(ba|0))ca=aa;else{y=a+84|0;if(!(b[y>>0]|0)){z=f[a+72>>2]|0;h=f[a+68>>2]|0;x=h;if((z|0)==(h|0))da=aa;else{w=z-h>>2;h=0;do{z=x+(h<<2)|0;f[z>>2]=f[aa+(f[z>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);da=aa}}else{b[y>>0]=0;y=a+68|0;aa=a+72|0;w=f[aa>>2]|0;h=f[y>>2]|0;x=w-h>>2;z=h;h=w;if(ba>>>0<=x>>>0)if(ba>>>0>>0?(w=z+(ba<<2)|0,(w|0)!=(h|0)):0){f[aa>>2]=h+(~((h+-4-w|0)>>>2)<<2);ea=ba}else ea=ba;else{kh(y,ba-x|0,1204);ea=f[l>>2]|0}x=f[j>>2]|0;if(!ea)da=x;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=x}}f[l>>2]=_;ca=da}if(!ca)fa=_;else{da=f[o>>2]|0;if((da|0)!=(ca|0))f[o>>2]=da+(~((da+-4-ca|0)>>>2)<<2);br(ca);fa=_}}else fa=0;_=f[g+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;br(_)}while((ca|0)!=0)}ca=f[g>>2]|0;f[g>>2]=0;if(!ca){u=e;return fa|0}br(ca);u=e;return fa|0}function sc(a,c){a=a|0;c=c|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;e=u;u=u+32|0;g=e+4|0;h=e;i=e+16|0;j=c+56|0;k=f[j>>2]|0;l=(f[k+100>>2]|0)-(f[k+96>>2]|0)|0;k=(l|0)/12|0;m=c+44|0;Nh(k,f[m>>2]|0)|0;Nh(f[(f[j>>2]|0)+80>>2]|0,f[m>>2]|0)|0;n=f[c+48>>2]|0;o=dn(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=21;p=o;q=14562;r=p+21|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+21>>0]=0;o=Oj(n,g,0)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);n=f[m>>2]|0;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M=n;while(1){n=(f[M+96>>2]|0)+(D*12|0)|0;L=f[m>>2]|0;c=L+16|0;l=f[c+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[c>>2]|0)>>>0>0)){f[h>>2]=f[L+4>>2];f[g>>2]=f[h>>2];ye(L,g,n,n+12|0)|0}n=D+1|0;if(n>>>0>=k>>>0)break;D=n;M=f[j>>2]|0}f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=e;return}function tc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;switch(f[c+28>>2]|0){case 9:{l=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=l;f[g>>2]=f[h>>2];m=ec(a,c,g)|0;break}case 2:{f[i>>2]=l;f[g>>2]=f[i>>2];m=Xb(a,c,g)|0;break}case 3:{f[j>>2]=l;f[g>>2]=f[j>>2];m=rc(a,c,g)|0;break}case 4:{f[k>>2]=l;f[g>>2]=f[k>>2];m=jc(a,c,g)|0;break}default:m=0}n=m;break}case 1:{m=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=m;f[g>>2]=f[h>>2];o=dc(a,c,g)|0;break}case 2:{f[i>>2]=m;f[g>>2]=f[i>>2];o=Yb(a,c,g)|0;break}case 3:{f[j>>2]=m;f[g>>2]=f[j>>2];o=pc(a,c,g)|0;break}case 4:{f[k>>2]=m;f[g>>2]=f[k>>2];o=ic(a,c,g)|0;break}default:o=0}n=o;break}case 11:case 2:{o=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=o;f[g>>2]=f[h>>2];p=dc(a,c,g)|0;break}case 2:{f[i>>2]=o;f[g>>2]=f[i>>2];p=Yb(a,c,g)|0;break}case 3:{f[j>>2]=o;f[g>>2]=f[j>>2];p=pc(a,c,g)|0;break}case 4:{f[k>>2]=o;f[g>>2]=f[k>>2];p=ic(a,c,g)|0;break}default:p=0}n=p;break}case 4:{p=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=p;f[g>>2]=f[h>>2];q=bc(a,c,g)|0;break}case 2:{f[i>>2]=p;f[g>>2]=f[i>>2];q=Vb(a,c,g)|0;break}case 3:{f[j>>2]=p;f[g>>2]=f[j>>2];q=kc(a,c,g)|0;break}case 4:{f[k>>2]=p;f[g>>2]=f[k>>2];q=gc(a,c,g)|0;break}default:q=0}n=q;break}case 3:{q=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=q;f[g>>2]=f[h>>2];r=bc(a,c,g)|0;break}case 2:{f[i>>2]=q;f[g>>2]=f[i>>2];r=Vb(a,c,g)|0;break}case 3:{f[j>>2]=q;f[g>>2]=f[j>>2];r=kc(a,c,g)|0;break}case 4:{f[k>>2]=q;f[g>>2]=f[k>>2];r=gc(a,c,g)|0;break}default:r=0}n=r;break}case 6:{r=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=r;f[g>>2]=f[h>>2];s=ec(a,c,g)|0;break}case 2:{f[i>>2]=r;f[g>>2]=f[i>>2];s=Xb(a,c,g)|0;break}case 3:{f[j>>2]=r;f[g>>2]=f[j>>2];s=rc(a,c,g)|0;break}case 4:{f[k>>2]=r;f[g>>2]=f[k>>2];s=jc(a,c,g)|0;break}default:s=0}n=s;break}case 5:{s=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=s;f[g>>2]=f[h>>2];t=ec(a,c,g)|0;break}case 2:{f[i>>2]=s;f[g>>2]=f[i>>2];t=Xb(a,c,g)|0;break}case 3:{f[j>>2]=s;f[g>>2]=f[j>>2];t=rc(a,c,g)|0;break}case 4:{f[k>>2]=s;f[g>>2]=f[k>>2];t=jc(a,c,g)|0;break}default:t=0}n=t;break}default:{v=-1;u=e;return v|0}}v=(n|0)==0?-1:n;u=e;return v|0}function uc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+29|0;j=e;k=e+28|0;if(!(f[(f[a+8>>2]|0)+80>>2]|0)){l=1;u=e;return l|0}b[i>>0]=-2;m=a+36|0;n=f[m>>2]|0;if(n)if(Ra[f[(f[a>>2]|0)+40>>2]&127](a,n)|0){n=f[m>>2]|0;o=(Qa[f[(f[n>>2]|0)+8>>2]&127](n)|0)&255;b[i>>0]=o;p=5}else q=0;else p=5;if((p|0)==5){o=d+16|0;n=o;r=f[n+4>>2]|0;if(!((r|0)>0|(r|0)==0&(f[n>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,i,i+1|0)|0}i=f[m>>2]|0;if(i|0?(n=(Qa[f[(f[i>>2]|0)+36>>2]&127](i)|0)&255,b[j>>0]=n,n=o,i=f[n+4>>2]|0,!((i|0)>0|(i|0)==0&(f[n>>2]|0)>>>0>0)):0){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,j,j+1|0)|0}n=f[a+32>>2]|0;i=b[n+24>>0]|0;r=X(f[n+80>>2]|0,i)|0;s=(f[f[n>>2]>>2]|0)+(f[n+48>>2]|0)|0;f[j>>2]=0;n=j+4|0;f[n>>2]=0;f[j+8>>2]=0;t=(r|0)==0;do if(!t)if(r>>>0>1073741823)mq(j);else{v=r<<2;w=dn(v)|0;f[j>>2]=w;x=w+(r<<2)|0;f[j+8>>2]=x;hj(w|0,0,v|0)|0;f[n>>2]=x;y=w;break}else y=0;while(0);w=f[m>>2]|0;do if(w){Ta[f[(f[w>>2]|0)+44>>2]&31](w,s,y,r,i,f[c>>2]|0)|0;x=f[m>>2]|0;if(!x){z=s;A=f[j>>2]|0;p=20;break}if(!(Qa[f[(f[x>>2]|0)+32>>2]&127](x)|0)){x=f[j>>2]|0;z=f[m>>2]|0?x:s;A=x;p=20}}else{z=s;A=y;p=20}while(0);if((p|0)==20)km(z,r,A);A=a+4|0;a=f[A>>2]|0;do if(a){z=f[a+48>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;y=dn(48)|0;f[g>>2]=y;f[g+8>>2]=-2147483600;f[g+4>>2]=34;s=y;w=9835;x=s+34|0;do{b[s>>0]=b[w>>0]|0;s=s+1|0;w=w+1|0}while((s|0)<(x|0));b[y+34>>0]=0;w=Oj(z,g,1)|0;if((b[g+11>>0]|0)<0)br(f[g>>2]|0);if(!w){if(!t){w=f[j>>2]|0;s=0;x=0;do{x=f[w+(s<<2)>>2]|x;s=s+1|0}while((s|0)!=(r|0));if(x)B=((_(x|0)|0)>>>3^3)+1|0;else B=1}else B=1;b[k>>0]=0;s=o;w=f[s>>2]|0;z=f[s+4>>2]|0;if((z|0)>0|(z|0)==0&w>>>0>0){C=z;D=w}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,k,k+1|0)|0;w=o;C=f[w+4>>2]|0;D=f[w>>2]|0}b[k>>0]=B;if(!((C|0)>0|(C|0)==0&D>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,k,k+1|0)|0}if((B|0)==(Ll(5)|0)){w=f[j>>2]|0;z=o;s=f[z+4>>2]|0;if(!((s|0)>0|(s|0)==0&(f[z>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];ye(d,g,w,w+(r<<2)|0)|0}p=48;break}if(t)p=48;else{w=d+4|0;z=0;do{s=(f[j>>2]|0)+(z<<2)|0;y=o;v=f[y+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[y>>2]|0)>>>0>0)){f[h>>2]=f[w>>2];f[g>>2]=f[h>>2];ye(d,g,s,s+B|0)|0}z=z+1|0}while(z>>>0>>0);p=48}}else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0)<0)mq(c);p=((l+-1|0)>>>5)+1|0;n=dn(p<<2)|0;f[c>>2]=n;f[k>>2]=p;f[j>>2]=l;j=l>>>5;hj(n|0,0,j<<2|0)|0;p=l&31;l=n+(j<<2)|0;if(p|0)f[l>>2]=f[l>>2]&~(-1>>>(32-p|0))}p=a+20|0;l=0;j=s;s=t;t=v;while(1){if(l>>>0>2>>>0){w=0;x=0;y=l;z=s;A=j}else{B=25;break}while(1){v=x>>>5;n=1<<(x&31);do if(!(f[(f[c>>2]|0)+(v<<2)>>2]&n)){k=f[A+(x<<2)>>2]|0;if((f[k+8>>2]|0)!=(f[k+4>>2]|0)){r=0;o=1;m=A;q=k;while(1){k=f[(f[q+4>>2]|0)+(r<<2)>>2]|0;C=0;D=m;while(1){E=f[D+(x<<2)>>2]|0;if((C|0)>=(Ra[f[(f[E>>2]|0)+24>>2]&127](E,k)|0)){F=o;break}E=f[(f[h>>2]|0)+(x<<2)>>2]|0;G=Sa[f[(f[E>>2]|0)+28>>2]&31](E,k,C)|0;if((G|0)!=(x|0)?(E=f[(f[p>>2]|0)+(G<<2)>>2]|0,(1<<(E&31)&f[(f[c>>2]|0)+(E>>>5<<2)>>2]|0)==0):0){F=0;break}C=C+1|0;D=f[h>>2]|0}r=r+1|0;m=f[h>>2]|0;q=f[m+(x<<2)>>2]|0;if(r>>>0>=(f[q+8>>2]|0)-(f[q+4>>2]|0)>>2>>>0)break;else o=F}o=m;if(F)H=o;else{I=w;J=y;K=o;break}}else H=z;f[(f[g>>2]|0)+(y<<2)>>2]=x;o=(f[c>>2]|0)+(v<<2)|0;f[o>>2]=f[o>>2]|n;I=1;J=y+1|0;K=H}else{I=w;J=y;K=z}while(0);x=x+1|0;L=f[i>>2]|0;M=L-K>>2;A=K;if(x>>>0>=M>>>0)break;else{w=I;y=J;z=K}}if(J>>>0>>0&(I^1)){N=0;break}else{l=J;j=A;s=K;t=L}}if((B|0)==25){f[d>>2]=0;B=d+4|0;f[B>>2]=0;f[d+8>>2]=0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;X=U+1|0}else{W=T;X=U}}else{W=T;X=U}S=S+1|0;if((S|0)>=(l|0))break;else{T=W;U=X}}if(W|(X|0)>=(l|0))R=X;else{O=0;break a}}Of(f[(f[h>>2]|0)+(A<<2)>>2]|0,d);P=f[h>>2]|0;Q=f[i>>2]|0}a=a+1|0;if(a>>>0>=Q-P>>2>>>0){O=1;break}else{L=P;K=P;J=Q}}}while(0);Q=f[e>>2]|0;if(Q|0)br(Q);Q=f[d>>2]|0;if(Q|0){d=f[B>>2]|0;if((d|0)!=(Q|0))f[B>>2]=d+(~((d+-4-Q|0)>>>2)<<2);br(Q)}N=O}O=f[c>>2]|0;if(!O){u=b;return N|0}br(O);u=b;return N|0} -function uj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=u;u=u+16|0;g=e;h=a+4|0;f[h>>2]=c;i=f[c+64>>2]|0;c=((f[i+4>>2]|0)-(f[i>>2]|0)>>2>>>0)/3|0;b[g>>0]=0;Xg(a+24|0,c,g);c=f[h>>2]|0;h=(f[c+56>>2]|0)-(f[c+52>>2]|0)>>2;b[g>>0]=0;Xg(a+36|0,h,g);g=a+8|0;f[g>>2]=f[d>>2];f[g+4>>2]=f[d+4>>2];f[g+8>>2]=f[d+8>>2];f[g+12>>2]=f[d+12>>2];u=e;return}function vj(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a;a:do if(!(c&3)){d=a;e=4}else{g=a;h=c;while(1){if(!(b[g>>0]|0)){i=h;break a}j=g+1|0;h=j;if(!(h&3)){d=j;e=4;break}else g=j}}while(0);if((e|0)==4){e=d;while(1){k=f[e>>2]|0;if(!((k&-2139062144^-2139062144)&k+-16843009))e=e+4|0;else break}if(!((k&255)<<24>>24))l=e;else{k=e;while(1){e=k+1|0;if(!(b[e>>0]|0)){l=e;break}else k=e}}i=l}return i-c|0}function wj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=f[a+4>>2]|0;else k=i&255;do if(k>>>0>=c>>>0)if(j){i=(f[a>>2]|0)+c|0;b[g>>0]=0;Hp(i,g);f[a+4>>2]=c;break}else{b[g>>0]=0;Hp(a+c|0,g);b[h>>0]=c;break}else Xi(a,c-k|0,d)|0;while(0);u=e;return}function xj(a){a=a|0;var b=0,c=0,d=0;if(!a)return;b=a+88|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=f[c+8>>2]|0;if(b|0){d=c+12|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;br(b)}br(c)}c=f[a+68>>2]|0;if(c|0){b=a+72|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);br(c)}c=a+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){b=d+4|0;if((f[b>>2]|0)!=(c|0))f[b>>2]=c;br(c)}br(d)}br(a);return}function yj(a,c,d,e,g,h,i,j,k,l){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0;f[a>>2]=d;if(d|0){m=d+16|0;n=f[m+4>>2]|0;o=a+8|0;f[o>>2]=f[m>>2];f[o+4>>2]=n;n=d+24|0;d=f[n+4>>2]|0;o=a+16|0;f[o>>2]=f[n>>2];f[o+4>>2]=d}b[a+24>>0]=e;f[a+28>>2]=g;b[a+32>>0]=h&1;h=a+40|0;f[h>>2]=i;f[h+4>>2]=j;j=a+48|0;f[j>>2]=k;f[j+4>>2]=l;f[a+56>>2]=c;return}function zj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;if((f[c+76>>2]|0)>=0?(gr(c)|0)!=0:0){d=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(g=c+20|0,h=f[g>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[g>>2]=h+1;b[h>>0]=d;i=e}else i=Bj(c,a)|0;fr(c);j=i}else k=3;do if((k|0)==3){i=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(d=c+20|0,h=f[d>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[d>>2]=h+1;b[h>>0]=i;j=e;break}j=Bj(c,a)|0}while(0);return j|0}function Aj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=f[a+4>>2]|0;if((i|0)==-1){j=0;u=d;return j|0}b[h>>0]=i;i=c+16|0;a=f[i+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[i>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];ye(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function Bj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0;d=u;u=u+16|0;e=d;g=c&255;b[e>>0]=g;i=a+16|0;j=f[i>>2]|0;if(!j)if(!(pl(a)|0)){k=f[i>>2]|0;l=4}else m=-1;else{k=j;l=4}do if((l|0)==4){j=a+20|0;i=f[j>>2]|0;if(i>>>0>>0?(n=c&255,(n|0)!=(b[a+75>>0]|0)):0){f[j>>2]=i+1;b[i>>0]=g;m=n;break}if((Sa[f[a+36>>2]&31](a,e,1)|0)==1)m=h[e>>0]|0;else m=-1}while(0);u=d;return m|0}function Cj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=dn(88)|0;d=c+60|0;e=c;g=e+60|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=c;d=c+64|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;d=Kf(c,b)|0;f[a>>2]=d?c:0;a=d?0:c;if(d)return;ui(a);br(a);return}function Dj(a,b){a=a|0;b=b|0;if(!b)return;else{Dj(a,f[b>>2]|0);Dj(a,f[b+4>>2]|0);sj(b+20|0,f[b+24>>2]|0);br(b);return}}function Ej(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=u;u=u+16|0;g=e;h=a+4|0;f[h>>2]=c;i=((f[c+4>>2]|0)-(f[c>>2]|0)>>2>>>0)/3|0;b[g>>0]=0;Xg(a+24|0,i,g);i=f[h>>2]|0;h=(f[i+28>>2]|0)-(f[i+24>>2]|0)>>2;b[g>>0]=0;Xg(a+36|0,h,g);g=a+8|0;f[g>>2]=f[d>>2];f[g+4>>2]=f[d+4>>2];f[g+8>>2]=f[d+8>>2];f[g+12>>2]=f[d+12>>2];u=e;return}function Fj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=e+4|0;f[g>>2]=c;c=a+4|0;a=dn(32)|0;f[h>>2]=a;f[h+8>>2]=-2147483616;f[h+4>>2]=17;i=a;j=12932;k=i+17|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[a+17>>0]=0;Nj(wd(c,g)|0,h,d);if((b[h+11>>0]|0)>=0){u=e;return}br(f[h>>2]|0);u=e;return}function Gj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=a+48|0;if((f[a+52>>2]|0)>>>0<=e>>>0)pe(b,e+1|0,0);c=(f[b>>2]|0)+(e>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(e&31);c=f[a+36>>2]|0;if((f[a+40>>2]|0)-c>>2>>>0<=e>>>0){d=1;return d|0}Pp(f[c+(e<<2)>>2]|0);d=1;return d|0}function Hj(a){a=a|0;if(!a)return;f[a>>2]=1136;sj(a+28|0,f[a+32>>2]|0);nj(a+16|0,f[a+20>>2]|0);sj(a+4|0,f[a+8>>2]|0);br(a);return}function Ij(a){a=a|0;f[a>>2]=1136;sj(a+28|0,f[a+32>>2]|0);nj(a+16|0,f[a+20>>2]|0);sj(a+4|0,f[a+8>>2]|0);return}function Jj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(c>>>0>0|(c|0)==0&a>>>0>4294967295){e=d;f=a;g=c;while(1){c=an(f|0,g|0,10,0)|0;e=e+-1|0;b[e>>0]=c&255|48;c=f;f=up(f|0,g|0,10,0)|0;if(!(g>>>0>9|(g|0)==9&c>>>0>4294967295))break;else g=I}h=f;i=e}else{h=a;i=d}if(!h)j=i;else{d=h;h=i;while(1){i=h+-1|0;b[i>>0]=(d>>>0)%10|0|48;if(d>>>0<10){j=i;break}else{d=(d>>>0)/10|0;h=i}}}return j|0}function Kj(a){a=a|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=a;while(1){d=c+1|0;if(!(tq(b[c>>0]|0)|0))break;else c=d}a=b[c>>0]|0;switch(a<<24>>24|0){case 45:{e=1;f=5;break}case 43:{e=0;f=5;break}default:{g=0;h=c;i=a}}if((f|0)==5){g=e;h=d;i=b[d>>0]|0}if(!(Pq(i<<24>>24)|0))j=0;else{i=0;d=h;while(1){h=(i*10|0)+48-(b[d>>0]|0)|0;d=d+1|0;if(!(Pq(b[d>>0]|0)|0)){j=h;break}else i=h}}return (g|0?j:0-j|0)|0}function Lj(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0;e=u;u=u+16|0;g=e;cl(g,d);h=mi(a,c)|0;c=h+11|0;if((b[c>>0]|0)<0){b[f[h>>2]>>0]=0;f[h+4>>2]=0}else{b[h>>0]=0;b[c>>0]=0}Ng(h,0);f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];u=e;return}function Mj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;fl(g,d&1);d=mi(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}Ng(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Nj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;fl(g,d);d=mi(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}Ng(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Oj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=zg(a,c)|0;if((e|0)==(a+4|0)){g=-1;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}a=e+28|0;if((b[a+11>>0]|0)<0)k=f[a>>2]|0;else k=a;g=Kj(k)|0;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}function Pj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(c>>>0>10){g=0;u=d;return g|0}h=dn(48)|0;f[e>>2]=h;f[e+8>>2]=-2147483600;f[e+4>>2]=33;i=h;j=13067;k=i+33|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+33>>0]=0;Nj(a,e,c);if((b[e+11>>0]|0)<0)br(f[e>>2]|0);g=1;u=d;return g|0}function Qj(a){a=a|0;f[a>>2]=1136;sj(a+28|0,f[a+32>>2]|0);nj(a+16|0,f[a+20>>2]|0);sj(a+4|0,f[a+8>>2]|0);br(a);return}function Rj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[b>>2]|0;if((c|0)==-1)return 1;b=c*3|0;if((b|0)==-1)return 1;c=f[a>>2]|0;a=f[c+(b<<2)>>2]|0;d=b+1|0;e=((d>>>0)%3|0|0)==0?b+-2|0:d;if((e|0)==-1)g=-1;else g=f[c+(e<<2)>>2]|0;e=(((b>>>0)%3|0|0)==0?2:-1)+b|0;if((e|0)==-1)h=-1;else h=f[c+(e<<2)>>2]|0;if((a|0)==(g|0))return 1;else return (a|0)==(h|0)|(g|0)==(h|0)|0;return 0}function Sj(a){a=a|0;f[a>>2]=2968;sj(a+28|0,f[a+32>>2]|0);Dj(a+16|0,f[a+20>>2]|0);sj(a+4|0,f[a+8>>2]|0);return}function Tj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0;d=0;while(1){if((h[15560+d>>0]|0)==(a|0)){e=2;break}g=d+1|0;if((g|0)==87){i=15648;j=87;e=5;break}else d=g}if((e|0)==2)if(!d)k=15648;else{i=15648;j=d;e=5}if((e|0)==5)while(1){e=0;d=i;do{a=d;d=d+1|0}while((b[a>>0]|0)!=0);j=j+-1|0;if(!j){k=d;break}else{i=d;e=5}}return yq(k,f[c+20>>2]|0)|0}function Uj(a,b){a=+a;b=b|0;var c=0,d=0,e=0,g=0.0,h=0.0,i=0,j=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;e=Wn(c|0,d|0,52)|0;switch(e&2047){case 0:{if(a!=0.0){g=+Uj(a*18446744073709551616.0,b);h=g;i=(f[b>>2]|0)+-64|0}else{h=a;i=0}f[b>>2]=i;j=h;break}case 2047:{j=a;break}default:{f[b>>2]=(e&2047)+-1022;f[s>>2]=c;f[s+4>>2]=d&-2146435073|1071644672;j=+p[s>>3]}}return +j}function Vj(a){a=a|0;f[a>>2]=2968;sj(a+28|0,f[a+32>>2]|0);Dj(a+16|0,f[a+20>>2]|0);sj(a+4|0,f[a+8>>2]|0);br(a);return}function Wj(a,b){a=+a;b=b|0;var c=0.0,d=0,e=0,g=0.0,h=0;if((b|0)<=1023)if((b|0)<-1022){c=a*2.2250738585072014e-308;d=(b|0)<-2044;e=b+2044|0;g=d?c*2.2250738585072014e-308:c;h=d?((e|0)>-1022?e:-1022):b+1022|0}else{g=a;h=b}else{c=a*8988465674311579538646525.0e283;e=(b|0)>2046;d=b+-2046|0;g=e?c*8988465674311579538646525.0e283:c;h=e?((d|0)<1023?d:1023):b+-1023|0}b=Rn(h+1023|0,0,52)|0;h=I;f[s>>2]=b;f[s+4>>2]=h;return +(g*+p[s>>3])}function Xj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;if(!(f[a+80>>2]|0)){b=0;return b|0}c=a+8|0;d=a+12|0;a=f[c>>2]|0;if(((f[d>>2]|0)-a|0)>0){e=0;g=a}else{b=1;return b|0}while(1){a=f[g+(e<<2)>>2]|0;e=e+1|0;if(!(yl(a,a)|0)){b=0;h=5;break}g=f[c>>2]|0;if((e|0)>=((f[d>>2]|0)-g>>2|0)){b=1;h=5;break}}if((h|0)==5)return b|0;return 0}function Yj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)==(e|0)){g=1;return g|0}h=a+60|0;a=0;i=e;while(1){e=f[i+(a<<2)>>2]|0;a=a+1|0;if(!(Sa[f[(f[e>>2]|0)+20>>2]&31](e,h,b)|0)){g=0;j=5;break}i=f[c>>2]|0;if(a>>>0>=(f[d>>2]|0)-i>>2>>>0){g=1;j=5;break}}if((j|0)==5)return g|0;return 0}function Zj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+36|0;d=a+40|0;a=f[c>>2]|0;if((f[d>>2]|0)==(a|0)){e=1;return e|0}else{g=0;h=a}while(1){a=f[h+(g<<2)>>2]|0;g=g+1|0;if(!(Ra[f[(f[a>>2]|0)+24>>2]&127](a,b)|0)){e=0;i=4;break}h=f[c>>2]|0;if(g>>>0>=(f[d>>2]|0)-h>>2>>>0){e=1;i=4;break}}if((i|0)==4)return e|0;return 0}function _j(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;f[a>>2]=0;c=a+4|0;f[c>>2]=0;f[a+8>>2]=0;d=b+4|0;e=(f[d>>2]|0)-(f[b>>2]|0)|0;g=e>>2;if(!g)return;if(g>>>0>1073741823)mq(a);h=dn(e)|0;f[c>>2]=h;f[a>>2]=h;f[a+8>>2]=h+(g<<2);g=f[b>>2]|0;b=(f[d>>2]|0)-g|0;if((b|0)<=0)return;Rg(h|0,g|0,b|0)|0;f[c>>2]=h+(b>>>2<<2);return}function $j(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=a+8|0;d=f[a>>2]|0;if((f[c>>2]|0)-d>>2>>>0>=b>>>0)return;e=a+4|0;if(b>>>0>1073741823){g=ra(8)|0;Wo(g,14941);f[g>>2]=6944;va(g|0,1080,114)}g=(f[e>>2]|0)-d|0;h=dn(b<<2)|0;if((g|0)>0)Rg(h|0,d|0,g|0)|0;f[a>>2]=h;f[e>>2]=h+(g>>2<<2);f[c>>2]=h+(b<<2);if(!d)return;br(d);return}function ak(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=a+36|0;c=a+40|0;d=f[b>>2]|0;if((f[c>>2]|0)==(d|0)){e=1;return e|0}g=a+60|0;a=0;h=d;while(1){d=f[h+(a<<2)>>2]|0;a=a+1|0;if(!(Ra[f[(f[d>>2]|0)+16>>2]&127](d,g)|0)){e=0;i=5;break}h=f[b>>2]|0;if(a>>>0>=(f[c>>2]|0)-h>>2>>>0){e=1;i=5;break}}if((i|0)==5)return e|0;return 0}function bk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;g=dn(16)|0;f[e>>2]=g;f[e+8>>2]=-2147483632;f[e+4>>2]=15;h=g;i=12916;j=h+15|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+15>>0]=0;Nj(a+4|0,e,c);if((b[e+11>>0]|0)>=0){u=d;return}br(f[e>>2]|0);u=d;return}function ck(a,b){a=a|0;b=b|0;var c=0,d=0;f[a>>2]=0;f[a+4>>2]=b;if(b|0?(c=mh(b,992,976,0)|0,c|0):0){d=dn(56)|0;Gm(d,c);c=f[a>>2]|0;f[a>>2]=d;if(!c)return;Va[f[(f[c>>2]|0)+4>>2]&127](c);return}c=dn(56)|0;Am(c,b);b=f[a>>2]|0;f[a>>2]=c;if(!b)return;Va[f[(f[b>>2]|0)+4>>2]&127](b);return}function dk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0;d=f[a+176>>2]|0;e=f[a+172>>2]|0;a=e;if((d|0)==(e|0))return 0;g=(d-e|0)/136|0;e=0;while(1){if((f[a+(e*136|0)>>2]|0)==(c|0)){h=4;break}d=e+1|0;if(d>>>0>>0)e=d;else{h=6;break}}if((h|0)==4)return ((b[a+(e*136|0)+100>>0]|0)==0?0:a+(e*136|0)+4|0)|0;else if((h|0)==6)return 0;return 0}function ek(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[a+72>>2]|0;if(!c){d=0;return d|0}f[c+4>>2]=a+60;if(!(Qa[f[(f[c>>2]|0)+12>>2]&127](c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){d=0;return d|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){d=0;return d|0}d=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return d|0}function fk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;f[a>>2]=0;d=a+4|0;f[d>>2]=0;f[a+8>>2]=0;if(!b)return;if(b>>>0>357913941)mq(a);e=dn(b*12|0)|0;f[d>>2]=e;f[a>>2]=e;f[a+8>>2]=e+(b*12|0);a=b;b=e;do{_j(b,c);b=(f[d>>2]|0)+12|0;f[d>>2]=b;a=a+-1|0}while((a|0)!=0);return}function gk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=f[b>>2]|0;if(!c){d=0;return d|0}e=a+44|0;g=f[e>>2]|0;if(g>>>0<(f[a+48>>2]|0)>>>0){f[b>>2]=0;f[g>>2]=c;f[e>>2]=(f[e>>2]|0)+4;d=1;return d|0}else{Bg(a+40|0,b);d=1;return d|0}return 0}function hk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2880;f[a+40>>2]=1180;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=1460;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){zi(a);br(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);zi(a);br(a);return}function ik(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0;f[c>>2]=2;d=a+4|0;a=c+8|0;e=f[a>>2]|0;g=(f[c+12>>2]|0)-e|0;if(g>>>0<4294967292){Bk(a,g+4|0,0);i=f[a>>2]|0}else i=e;e=i+g|0;g=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[e>>0]=g;b[e+1>>0]=g>>8;b[e+2>>0]=g>>16;b[e+3>>0]=g>>24;return}function jk(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=3164;b=a+8|0;f[b>>2]=3188;c=f[a+56>>2]|0;if(c|0){d=a+60|0;e=f[d>>2]|0;if((e|0)!=(c|0))f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);br(c)}f[b>>2]=3208;b=f[a+44>>2]|0;if(b|0)br(b);b=f[a+32>>2]|0;if(!b){br(a);return}br(b);br(a);return}function kk(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=Oa,h=0;e=zg(a,c)|0;if((e|0)==(a+4|0)){g=d;return $(g)}a=e+28|0;if((b[a+11>>0]|0)<0)h=f[a>>2]|0;else h=a;g=$(+Xq(h));return $(g)}function lk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;cf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0)){g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}function mk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=f[a+176>>2]|0;d=f[a+172>>2]|0;e=d;a:do if((c|0)!=(d|0)){g=(c-d|0)/136|0;h=0;while(1){if((f[e+(h*136|0)>>2]|0)==(b|0))break;i=h+1|0;if(i>>>0>>0)h=i;else break a}j=e+(h*136|0)+104|0;return j|0}while(0);j=a+40|0;return j|0}function nk(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=3232;b=a+8|0;f[b>>2]=3256;c=f[a+56>>2]|0;if(c|0){d=a+60|0;e=f[d>>2]|0;if((e|0)!=(c|0))f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);br(c)}f[b>>2]=3276;b=f[a+44>>2]|0;if(b|0)br(b);b=f[a+32>>2]|0;if(!b){br(a);return}br(b);br(a);return}function ok(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2880;f[a+40>>2]=1180;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=1460;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){zi(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);zi(a);return}function pk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;Ec(a,b);if((b|0)<=-1)return;c=a+88|0;d=f[c>>2]|0;e=f[a+84>>2]|0;if((d-e>>2|0)<=(b|0))return;a=e+(b<<2)|0;b=a+4|0;e=d-b|0;g=e>>2;if(!g)h=d;else{Xl(a|0,b|0,e|0)|0;h=f[c>>2]|0}e=a+(g<<2)|0;if((h|0)==(e|0))return;f[c>>2]=h+(~((h+-4-e|0)>>>2)<<2);return}function qk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=f[a+32>>2]|0;c=f[a+36>>2]|0;if((b|0)==(c|0)){d=1;return d|0}e=a+8|0;g=a+44|0;a=b;while(1){b=f[(f[e>>2]|0)+(f[a>>2]<<2)>>2]|0;a=a+4|0;if(!(Ra[f[(f[b>>2]|0)+20>>2]&127](b,f[g>>2]|0)|0)){d=0;h=5;break}if((a|0)==(c|0)){d=1;h=5;break}}if((h|0)==5)return d|0;return 0}function rk(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=3164;b=a+8|0;f[b>>2]=3188;c=f[a+56>>2]|0;if(c|0){d=a+60|0;e=f[d>>2]|0;if((e|0)!=(c|0))f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);br(c)}f[b>>2]=3208;b=f[a+44>>2]|0;if(b|0)br(b);b=f[a+32>>2]|0;if(!b)return;br(b);return}function sk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;d=u;u=u+128|0;e=d;g=e;h=g+124|0;do{f[g>>2]=0;g=g+4|0}while((g|0)<(h|0));g=e+4|0;f[g>>2]=a;h=e+8|0;f[h>>2]=-1;f[e+44>>2]=a;f[e+76>>2]=-1;Rm(e,0);i=+Lc(e,c,1);c=(f[g>>2]|0)-(f[h>>2]|0)+(f[e+108>>2]|0)|0;if(b|0)f[b>>2]=c|0?a+c|0:a;u=d;return +i}function tk(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0;a=c+16|0;g=f[a>>2]|0;do if(g){if((g|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;f[c+24>>2]=2;b[c+54>>0]=1;break}h=c+24|0;if((f[h>>2]|0)==2)f[h>>2]=e}else{f[a>>2]=d;f[c+24>>2]=e;f[c+36>>2]=1}while(0);return}function uk(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=a+20|0;c=a+28|0;if((f[d>>2]|0)>>>0>(f[c>>2]|0)>>>0)Sa[f[a+36>>2]&31](a,0,0)|0;f[a+16>>2]=0;f[c>>2]=0;f[d>>2]=0;d=f[a>>2]|0;if(!(d&4)){c=(f[a+44>>2]|0)+(f[a+48>>2]|0)|0;f[a+8>>2]=c;f[a+4>>2]=c;e=d<<27>>31}else{f[a>>2]=d|32;e=-1}return e|0}function vk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=zg(a,c)|0;if((d|0)==(a+4|0)){e=0;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=((Kj(g)|0)+1|0)>>>0>1;return e|0}function wk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=5840;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);br(b)}b=f[a+84>>2]|0;if(!b){wg(a);br(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b);wg(a);br(a);return}function xk(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=3232;b=a+8|0;f[b>>2]=3256;c=f[a+56>>2]|0;if(c|0){d=a+60|0;e=f[d>>2]|0;if((e|0)!=(c|0))f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);br(c)}f[b>>2]=3276;b=f[a+44>>2]|0;if(b|0)br(b);b=f[a+32>>2]|0;if(!b)return;br(b);return}function yk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=zg(a,c)|0;if((e|0)==(a+4|0)){g=d;return g|0}d=e+28|0;if((b[d+11>>0]|0)<0)h=f[d>>2]|0;else h=d;g=Kj(h)|0;return g|0}function zk(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;g=d>>31|((d|0)<0?-1:0)<<1;h=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;i=Vn(e^a|0,f^b|0,e|0,f|0)|0;b=I;a=g^e;e=h^f;return Vn((Bd(i,b,Vn(g^c|0,h^d|0,g|0,h|0)|0,I,0)|0)^a|0,I^e|0,a|0,e|0)|0}function Ak(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0;f[a>>2]=b;h=b+16|0;i=f[h+4>>2]|0;j=a+8|0;f[j>>2]=f[h>>2];f[j+4>>2]=i;i=b+24|0;b=f[i+4>>2]|0;j=a+16|0;f[j>>2]=f[i>>2];f[j+4>>2]=b;b=a+40|0;f[b>>2]=c;f[b+4>>2]=d;d=a+48|0;f[d>>2]=e;f[d+4>>2]=g;return}function Bk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;h=e;e=d;if(g>>>0>=b>>>0){if(g>>>0>b>>>0?(d=h+b|0,(d|0)!=(e|0)):0)f[c>>2]=d}else ri(a,b-g|0);g=a+24|0;a=g;b=Tn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=g;f[a>>2]=b;f[a+4>>2]=I;return}function Ck(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=zg(a,c)|0;if((d|0)==(a+4|0)){e=-1;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=Kj(g)|0;return e|0}function Dk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=5840;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);br(b)}b=f[a+84>>2]|0;if(!b){wg(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);br(b);wg(a);return}function Ek(a){a=a|0;var c=0,d=0,e=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=1;c=a+68|0;d=a+28|0;e=d+40|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(e|0));f[c>>2]=a;c=a+72|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;f[c+20>>2]=0;return}function Fk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3188;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=3208;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b){br(a);return}br(b);br(a);return}function Gk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2004;b=f[a+76>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b){br(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Hk(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=u;u=u+256|0;g=f;if((c|0)>(d|0)&(e&73728|0)==0){e=c-d|0;hj(g|0,b<<24>>24|0,(e>>>0<256?e:256)|0)|0;if(e>>>0>255){b=c-d|0;d=e;do{ep(a,g,256);d=d+-256|0}while(d>>>0>255);h=b&255}else h=e;ep(a,g,h)}u=f;return}function Ik(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3256;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=3276;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b){br(a);return}br(b);br(a);return}function Jk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1696;b=f[a+76>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b){br(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Kk(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;if(qp(a,f[b+8>>2]|0,g)|0)fj(0,b,c,d,e);else{h=f[a+8>>2]|0;_a[f[(f[h>>2]|0)+20>>2]&3](h,b,c,d,e,g)}return}function Lk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3188;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=3208;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b)return;br(b);return}function Mk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2060;tj(a+108|0);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b){br(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Nk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3256;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}f[a>>2]=3276;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b)return;br(b);return}function Ok(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1752;tj(a+108|0);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b){br(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Pk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=a;g=d;h=c;while(1){i=b[f>>0]|0;j=b[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Qk(a){a=a|0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function Rk(a){a=a|0;var b=0,c=0;f[a>>2]=2004;b=f[a+76>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Sk(a){a=a|0;var c=0,d=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;c=0;while(1){if((c|0)==3)break;f[a+(c<<2)>>2]=0;c=c+1|0}if((b[a+11>>0]|0)<0)d=(f[a+8>>2]&2147483647)+-1|0;else d=10;wj(a,d,0);return}function Tk(a){a=a|0;var b=0,c=0,d=0,e=0.0,g=0.0;b=f[a+8>>2]|0;if((b|0)<2){c=0;d=0;I=c;return d|0}e=+(b|0);g=+Fg(e)*e;e=+W(+(g-+p[a>>3]));c=+K(e)>=1.0?(e>0.0?~~+Y(+J(e/4294967296.0),4294967295.0)>>>0:~~+W((e-+(~~e>>>0))/4294967296.0)>>>0):0;d=~~e>>>0;I=c;return d|0}function Uk(a){a=a|0;var b=0,c=0;f[a>>2]=1696;b=f[a+76>>2]|0;if(b|0)br(b);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Vk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;e=f[b+32>>2]|0;if(e|0){d=e;return d|0}d=f[b+8>>2]|0;return d|0}function Wk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1216;b=f[a+16>>2]|0;if(b|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b)}b=f[a+4>>2]|0;if(!b)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(b|0))f[d>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Xk(a){a=a|0;var b=0,c=0;f[a>>2]=2060;tj(a+108|0);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Yk(a){a=a|0;if(!(f[a+64>>2]|0))return 0;if(!(f[a+68>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function Zk(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;if(qp(a,f[b+8>>2]|0,0)|0)tk(0,b,c,d);else{e=f[a+8>>2]|0;Ya[f[(f[e>>2]|0)+28>>2]&7](e,b,c,d)}return}function _k(a){a=a|0;var b=0,c=0;f[a>>2]=1752;tj(a+108|0);f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function $k(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+36>>2]&127](d,b)|0;return c|0}function al(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+32>>2]&127](d,b)|0;return c|0}function bl(a,c){a=a|0;c=c|0;var d=0,e=0,f=0,g=0;d=b[a>>0]|0;e=b[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24){f=e;g=d}else{d=c;c=a;do{c=c+1|0;d=d+1|0;a=b[c>>0]|0;e=b[d>>0]|0}while(!(a<<24>>24==0?1:a<<24>>24!=e<<24>>24));f=e;g=a}return (g&255)-(f&255)|0}function cl(a,b){a=a|0;b=$(b);var c=0,d=0;c=u;u=u+16|0;d=c;Sk(d);qi(a,d,b);Go(d);u=c;return}function dl(a){a=a|0;var b=0,c=0,d=0,e=0,g=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d+(~((d+-4-b|0)>>>2)<<2)|0;f[c>>2]=g;e=g}f[a+12>>2]=0;f[a+16>>2]=0;if(!b)return;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);br(b);return}function el(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=f[a+16>>2]|0;if(((f[a+20>>2]|0)-d>>2|0)<=(b|0)){e=-1;return e|0}g=f[d+(b<<2)>>2]|0;if((g|0)<0){e=-1;return e|0}e=f[(f[(f[(f[a+36>>2]|0)+(g<<2)>>2]|0)+16>>2]|0)+(c<<2)>>2]|0;return e|0}function fl(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;Sk(d);vi(a,d,b);Go(d);u=c;return}function gl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;d=u;u=u+32|0;e=d;g=d+20|0;f[e>>2]=f[a+60>>2];f[e+4>>2]=0;f[e+8>>2]=b;f[e+12>>2]=g;f[e+16>>2]=c;if((ro(za(140,e|0)|0)|0)<0){f[g>>2]=-1;h=-1}else h=f[g>>2]|0;u=d;return h|0}function hl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=0;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=0;return c|0}b=f[d>>2]|0;if((b|0)==-1){c=0;return c|0}c=f[(f[a+8>>2]|0)+(b<<2)>>2]|0;return c|0}function il(a){a=a|0;if(!(f[a+40>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function jl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;d=(f[b+20>>2]|0)-(f[b+16>>2]|0)>>2;return d|0}function kl(a){a=a|0;var b=0;if(!(f[a+24>>2]|0)){b=0;return b|0}if(!(f[a+28>>2]|0)){b=0;return b|0}if(!(f[a+32>>2]|0)){b=0;return b|0}b=(f[a+36>>2]|0)!=0;return b|0}function ll(a){a=a|0;if(!(f[a+60>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function ml(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;Sg(a,c);f[a>>2]=1392;c=a+72|0;d=a+36|0;a=d+36|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(a|0));d=f[b>>2]|0;f[b>>2]=0;f[c>>2]=d;return}function nl(a,c){a=a|0;c=c|0;var d=0,e=0;d=a;e=c;c=d+64|0;do{f[d>>2]=f[e>>2];d=d+4|0;e=e+4|0}while((d|0)<(c|0));e=a+64|0;f[a+88>>2]=0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;f[e+12>>2]=0;f[e+16>>2]=0;b[e+20>>0]=0;return}function ol(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;if((a|0)==0&(c|0)==0)f=d;else{g=d;d=c;c=a;while(1){a=g+-1|0;b[a>>0]=h[15542+(c&15)>>0]|0|e;c=Wn(c|0,d|0,4)|0;d=I;if((c|0)==0&(d|0)==0){f=a;break}else g=a}}return f|0}function pl(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=f[a>>2]|0;if(!(d&8)){f[a+8>>2]=0;f[a+4>>2]=0;c=f[a+44>>2]|0;f[a+28>>2]=c;f[a+20>>2]=c;f[a+16>>2]=c+(f[a+48>>2]|0);e=0}else{f[a>>2]=d|32;e=-1}return e|0}function ql(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[b+88>>2]|0;if(!c){d=0;return d|0}if((f[c>>2]|0)!=2){d=0;return d|0}b=f[c+8>>2]|0;f[a+4>>2]=h[b>>0]|h[b+1>>0]<<8|h[b+2>>0]<<16|h[b+3>>0]<<24;d=1;return d|0}function rl(a){a=a|0;var b=0;if(!(f[a+44>>2]|0)){b=0;return b|0}if(!(f[a+48>>2]|0)){b=0;return b|0}if(!(f[a+52>>2]|0)){b=0;return b|0}b=(f[a+56>>2]|0)!=0;return b|0}function sl(a){a=a|0;kj(a);br(a);return}function tl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+40>>2]=c;d=1;return d|0}function ul(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+44>>2]=c;d=1;return d|0}function vl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;if(g>>>0>>0){ri(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+b|0;if((g|0)==(d|0))return;f[c>>2]=g;return}function wl(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=$(e);f[a+4>>2]=b;Jf(a+8|0,c,c+(d<<2)|0);n[a+20>>2]=e;return}function xl(a,b){a=a|0;b=b|0;var c=0;if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){c=0;return c|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){c=0;return c|0}c=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return c|0}function yl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=u;u=u+16|0;d=c+4|0;e=c;f[e>>2]=0;f[d>>2]=f[e>>2];e=tc(a,b,d)|0;u=c;return e|0}function zl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;d=f[c>>2]|0;c=a;e=b-a>>2;while(1){if(!e)break;a=(e|0)/2|0;b=c+(a<<2)|0;g=(f[b>>2]|0)>>>0>>0;c=g?b+4|0:c;e=g?e+-1-a|0:a}return c|0}function Al(a){a=a|0;var c=0;f[a>>2]=0;c=a+8|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;b[a+24>>0]=1;f[a+28>>2]=9;c=a+40|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[a+56>>2]=-1;f[a+60>>2]=0;return}function Bl(a){a=a|0;mj(a);br(a);return}function Cl(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;if(!(Pq(b[f[a>>2]>>0]|0)|0))c=0;else{d=0;while(1){e=f[a>>2]|0;g=(d*10|0)+-48+(b[e>>0]|0)|0;h=e+1|0;f[a>>2]=h;if(!(Pq(b[h>>0]|0)|0)){c=g;break}else d=g}}return c|0}function Dl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+60>>2]=c;d=1;return d|0}function El(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+64>>2]=c;d=1;return d|0}function Fl(a){a=a|0;var b=0,c=0;b=f[r>>2]|0;c=b+a|0;if((a|0)>0&(c|0)<(b|0)|(c|0)<0){ea()|0;ya(12);return -1}f[r>>2]=c;if((c|0)>(da()|0)?(ca()|0)==0:0){f[r>>2]=b;ya(12);return -1}return b|0}function Gl(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0;if((a|0)==0&(c|0)==0)e=d;else{f=d;d=c;c=a;while(1){a=f+-1|0;b[a>>0]=c&7|48;c=Wn(c|0,d|0,3)|0;d=I;if((c|0)==0&(d|0)==0){e=a;break}else f=a}}return e|0}function Hl(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1528;b=f[a+32>>2]|0;if(!b){br(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Il(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;if(qp(a,f[b+8>>2]|0,g)|0)fj(0,b,c,d,e);return}function Jl(a){a=a|0;var b=0,c=0;b=f[a+64>>2]|0;if(!b)return;c=Qa[f[(f[b>>2]|0)+32>>2]&127](b)|0;if(!c)return;f[a+60>>2]=(((f[c+4>>2]|0)-(f[c>>2]|0)>>2>>>0)/3|0)-(f[c+40>>2]|0);return}function Kl(a){a=a|0;Ii(a);br(a);return}function Ll(a){a=a|0;var b=0;switch(a|0){case 11:case 2:case 1:{b=1;break}case 4:case 3:{b=2;break}case 6:case 5:{b=4;break}case 8:case 7:{b=8;break}case 9:{b=4;break}case 10:{b=8;break}default:b=-1}return b|0}function Ml(){var a=0,b=0;a=dn(40)|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[a+16>>2]=$(1.0);b=a+20|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;n[a+36>>2]=$(1.0);return a|0}function Nl(a,b){a=+a;b=+b;var c=0,d=0,e=0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s+4>>2]&-2147483648|d&2147483647;f[s>>2]=c;f[s+4>>2]=e;return +(+p[s>>3])}function Ol(a,b,c){a=a|0;b=b|0;c=+c;var d=0,e=0;d=u;u=u+16|0;e=d;p[e>>3]=c;_b(a,b,e);u=d;return}function Pl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;f[e>>2]=c;cc(a,b,e);u=d;return}function Ql(a,c){a=a|0;c=c|0;var d=0,e=0;if((a|0)!=(c|0)){d=b[c+11>>0]|0;e=d<<24>>24<0;Zi(a,e?f[c>>2]|0:c,e?f[c+4>>2]|0:d&255)|0}return a|0}function Rl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=X(d,c)|0;f=a>>>16;a=(e>>>16)+(X(d,f)|0)|0;d=b>>>16;b=X(d,c)|0;return (I=(a>>>16)+(X(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function Sl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=vj(b)|0;d=dn(c+13|0)|0;f[d>>2]=c;f[d+4>>2]=c;f[d+8>>2]=0;e=Sp(d)|0;Rg(e|0,b|0,c+1|0)|0;f[a>>2]=e;return}function Tl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=-1;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=-1;return c|0}c=f[d>>2]|0;return c|0}function Ul(a){a=a|0;Li(a);br(a);return}function Vl(a){a=a|0;var b=0,c=0;f[a>>2]=1528;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Wl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(qp(a,f[b+8>>2]|0,0)|0)tk(0,b,c,d);return}function Xl(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;if((c|0)<(a|0)&(a|0)<(c+d|0)){e=a;c=c+d|0;a=a+d|0;while((d|0)>0){a=a-1|0;c=c-1|0;d=d-1|0;b[a>>0]=b[c>>0]|0}a=e}else Rg(a,c,d)|0;return a|0}function Yl(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1180;b=f[a+8>>2]|0;if(!b){br(a);return}c=a+12|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);br(b);br(a);return}function Zl(a){a=a|0;var b=0;f[a>>2]=2740;b=f[a+56>>2]|0;if(!b){br(a);return}br(b);br(a);return}function _l(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=u;u=u+16|0;e=d;f[e>>2]=f[c>>2];g=Sa[f[(f[a>>2]|0)+16>>2]&31](a,b,e)|0;if(g)f[c>>2]=f[e>>2];u=d;return g&1|0}function $l(a,b){a=a|0;b=b|0;var c=0;if(b>>>0>=2){c=0;return c|0}f[a+28>>2]=b;c=1;return c|0}function am(a){a=a|0;var b=0,c=0;f[a>>2]=3e3;b=a+64|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){aj(a);return}Va[f[(f[c>>2]|0)+4>>2]&127](c);aj(a);return}function bm(){var a=0,b=0;a=mn()|0;if((a|0?(b=f[a>>2]|0,b|0):0)?(a=b+48|0,(f[a>>2]&-256|0)==1126902528?(f[a+4>>2]|0)==1129074247:0):0)Qo(f[b+12>>2]|0);Qo(bq()|0)}function cm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Bf(a,b,c,d,e,f,6)|0}function dm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Af(a,b,c,d,e,f,4)|0}function em(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Gf(a,b,c,d,e,f,2)|0}function fm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Af(a,b,c,d,e,f,3)|0}function gm(a){a=a|0;var b=0;f[a>>2]=2488;b=f[a+56>>2]|0;if(!b){br(a);return}br(b);br(a);return}function hm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Gf(a,b,c,d,e,f,1)|0}function im(a){a=a|0;var c=0;c=b[w+(a&255)>>0]|0;if((c|0)<8)return c|0;c=b[w+(a>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=b[w+(a>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (b[w+(a>>>24)>>0]|0)+24|0}function jm(a,b){a=a|0;b=b|0;var c=0.0,d=0.0,e=0.0,f=0.0;if(!a){c=0.0;return +c}if((b|0)==0|(a|0)==(b|0)){c=0.0;return +c}d=+(b>>>0)/+(a>>>0);e=1.0-d;f=d*+Fg(d);c=-(f+e*+Fg(e));return +c}function km(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;if((b|0)>0)d=0;else return;do{e=f[a+(d<<2)>>2]|0;f[c+(d<<2)>>2]=e<<1^e>>31;d=d+1|0}while((d|0)!=(b|0));return}function lm(a){a=a|0;var b=0,c=0;if(Eq(a)|0?(b=Zp(f[a>>2]|0)|0,a=b+8|0,c=f[a>>2]|0,f[a>>2]=c+-1,(c+-1|0)<0):0)br(b);return}function mm(a){a=a|0;var b=0;Ao(a);f[a>>2]=2880;f[a+40>>2]=1180;f[a+44>>2]=-1;b=a+48|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function nm(a,c){a=a|0;c=c|0;var d=0;b[c+84>>0]=1;a=f[c+68>>2]|0;d=c+72|0;c=f[d>>2]|0;if((c|0)==(a|0))return 1;f[d>>2]=c+(~((c+-4-a|0)>>>2)<<2);return 1}function om(a){a=a|0;var b=0,c=0;b=f[a+16>>2]|0;c=(((f[a+12>>2]|0)+1-b|0)/64|0)+b<<3;a=b<<3;b=Tn(c|0,((c|0)<0)<<31>>31|0,a|0,((a|0)<0)<<31>>31|0)|0;return b|0}function pm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Bf(a,b,c,d,e,f,5)|0}function qm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Bf(a,b,c,d,e,f,9)|0}function rm(a){a=a|0;var b=0;f[a>>2]=3208;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b){br(a);return}br(b);br(a);return}function sm(a){a=a|0;var b=0;f[a>>2]=2740;b=f[a+56>>2]|0;if(!b)return;br(b);return}function tm(a){a=a|0;var b=0,c=0;f[a>>2]=1460;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);zi(a);br(a);return}function um(a){a=a|0;var b=0,c=0;f[a>>2]=1180;b=f[a+8>>2]|0;if(!b)return;c=a+12|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function vm(a){a=a|0;var b=0;f[a>>2]=3276;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b){br(a);return}br(b);br(a);return}function wm(a){a=a|0;var c=0;f[a>>2]=1336;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=-1;c=a+16|0;f[a+32>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;b[c+12>>0]=0;return}function xm(a){a=a|0;f[a>>2]=3296;Gi(a+8|0);br(a);return}function ym(a){a=a|0;var b=0;f[a>>2]=2488;b=f[a+56>>2]|0;if(!b)return;br(b);return}function zm(a){a=a|0;var b=0,c=0;f[a>>2]=1460;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);zi(a);return}function Am(a,b){a=a|0;b=b|0;f[a>>2]=2968;Vh(a+4|0);f[a+40>>2]=0;f[a+44>>2]=0;f[a>>2]=2984;f[a+48>>2]=b;f[a+52>>2]=0;return}function Bm(a){a=a|0;var b=0,c=0;f[a>>2]=3e3;b=a+64|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);aj(a);br(a);return}function Cm(a){a=a|0;var b=0,c=0,d=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);f[a+12>>2]=0;f[a+16>>2]=0;return}function Dm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=a+20|0;e=f[d>>2]|0;g=(f[a+16>>2]|0)-e|0;a=g>>>0>c>>>0?c:g;Rg(e|0,b|0,a|0)|0;f[d>>2]=(f[d>>2]|0)+a;return c|0}function Em(a){a=a|0;var b=0;f[a>>2]=3208;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b)return;br(b);return}function Fm(a){a=a|0;f[a>>2]=3296;Gi(a+8|0);return}function Gm(a,b){a=a|0;b=b|0;f[a>>2]=2968;Vh(a+4|0);f[a+40>>2]=0;f[a+44>>2]=0;f[a>>2]=2984;f[a+48>>2]=b;f[a+52>>2]=b;return}function Hm(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-8-b|0)>>>3)<<3);br(b);return}function Im(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);br(b);return}function Jm(a,b){a=a|0;b=b|0;var c=0;c=f[b>>2]|0;return (1<<(c&31)&f[(f[a+28>>2]|0)+(c>>>5<<2)>>2]|0)!=0|0}function Km(a,b,c){a=a|0;b=b|0;c=c|0;return Sa[f[(f[a>>2]|0)+44>>2]&31](a,b,c)|0}function Lm(a){a=a|0;var c=0;Al(a);c=a+64|0;f[a+88>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;b[c+20>>0]=0;return}function Mm(a){a=a|0;f[a>>2]=2796;tj(a+88|0);br(a);return}function Nm(a){a=a|0;var b=0;f[a>>2]=3276;b=f[a+36>>2]|0;if(b|0)br(b);b=f[a+24>>2]|0;if(!b)return;br(b);return}function Om(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if((f[b+4>>2]|0)==(c|0)?(c=b+28|0,(f[c>>2]|0)!=1):0)f[c>>2]=d;return}function Pm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);pg(a,b,c,d,e,f);return}function Qm(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;if((uk(a)|0)==0?(Sa[f[a+32>>2]&31](a,c,1)|0)==1:0)d=h[c>>0]|0;else d=-1;u=b;return d|0}function Rm(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;f[a+104>>2]=b;c=f[a+8>>2]|0;d=f[a+4>>2]|0;e=c-d|0;f[a+108>>2]=e;f[a+100>>2]=(b|0)!=0&(e|0)>(b|0)?d+b|0:c;return}function Sm(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;return}function Tm(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=$(g);pg(f[a>>2]|0,b,c,d,e,g);return}function Um(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Pm(a,b,c,d,e,f);return}function Vm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return cm(a,b,c,d,e,f)|0}function Wm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return dm(a,b,c,d,e,f)|0}function Xm(a){a=a|0;var b=0,c=0;if(!a)return;b=f[a>>2]|0;if(b|0){c=a+4|0;if((f[c>>2]|0)!=(b|0))f[c>>2]=b;br(b)}br(a);return}function Ym(a){a=a|0;f[a>>2]=2544;tj(a+88|0);br(a);return}function Zm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return em(a,b,c,d,e,f)|0}function _m(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return fm(a,b,c,d,e,f)|0}function $m(a){a=a|0;f[a>>2]=2796;tj(a+88|0);return}function an(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e|0;Bd(a,b,c,d,g)|0;u=e;return (I=f[g+4>>2]|0,f[g>>2]|0)|0}function bn(a){a=a|0;var b=0;$n(a);f[a>>2]=5840;b=a+84|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;f[b+20>>2]=0;return}function cn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return hm(a,b,c,d,e,f)|0}function dn(a){a=a|0;var b=0,c=0;b=(a|0)==0?1:a;while(1){a=$a(b)|0;if(a|0){c=a;break}a=$p()|0;if(!a){c=0;break}Ua[a&3]()}return c|0}function en(a,b,c){a=a|0;b=b|0;c=c|0;ac(a,b,c);return}function fn(a,b,c){a=a|0;b=b|0;c=c|0;f[a+4>>2]=b;f[a+8>>2]=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(c<<2)>>2];f[a+12>>2]=c;return 1}function gn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return pm(a,b,c,d,e,f)|0}function hn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return qm(a,b,c,d,e,f)|0}function jn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Tm(a,b,c,d,e,f);return}function kn(a){a=a|0;f[a>>2]=2544;tj(a+88|0);return}function ln(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;d=dr(f[a+60>>2]|0)|0;f[c>>2]=d;d=ro(Ba(6,c|0)|0)|0;u=b;return d|0}function mn(){var a=0,b=0;a=u;u=u+16|0;if(!(Ka(18612,3)|0)){b=Ia(f[4654]|0)|0;u=a;return b|0}else Dn(17746,a);return 0}function nn(a){a=a|0;var b=0;if(!a)return;b=f[a>>2]|0;f[a>>2]=0;if(b|0)Va[f[(f[b>>2]|0)+4>>2]&127](b);br(a);return}function on(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=Rl(e,a)|0;f=I;return (I=(X(b,a)|0)+(X(d,e)|0)+f|f&0,c|0|0)|0}function pn(a,b){a=a|0;b=b|0;Sg(a,b);f[a>>2]=1276;b=a+36|0;a=b+40|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function qn(a){a=a|0;Gi(a);br(a);return}function rn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;f[a+24>>2]=0;f[a+28>>2]=0;return}function sn(a){a=a|0;var b=0;b=u;u=u+16|0;wc(a);if(!(La(f[4654]|0,0)|0)){u=b;return}else Dn(17845,b)}function tn(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function un(a,b){a=a|0;b=b|0;return eg(a+40|0,b)|0}function vn(a,b){a=a|0;b=b|0;return $i(a,b,Aq(b)|0)|0}function wn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;f[g>>2]=d;d=Mi(a,b,c,g)|0;u=e;return d|0}function xn(a,b){a=a|0;b=b|0;return Aj(a+40|0,b)|0}function yn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return zh(a,b,c,d)|0}function zn(a){a=a|0;var b=0;f[a>>2]=3608;f[a+52>>2]=0;b=a+4|0;a=b+44|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function An(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return $g(a,b,c,d)|0}function Bn(a,b){a=a|0;b=b|0;var c=0;c=f[a+64>>2]|0;return Ra[f[(f[c>>2]|0)+24>>2]&127](c,b)|0}function Cn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=0;return}function Dn(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;f[d>>2]=b;b=f[1478]|0;hh(b,a,d)|0;zj(10,b)|0;Ca()}function En(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Ta[a&31](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Fn(a){a=a|0;var b=0;b=f[a+56>>2]|0;f[a+60>>2]=((f[b+100>>2]|0)-(f[b+96>>2]|0)|0)/12|0;return}function Gn(a,b){a=a|0;b=b|0;var c=0;c=f[a+64>>2]|0;return Ra[f[(f[c>>2]|0)+16>>2]&127](c,b)|0}function Hn(a,b){a=a|0;b=b|0;var c=0;c=f[a+64>>2]|0;return Ra[f[(f[c>>2]|0)+20>>2]&127](c,b)|0}function In(a,b){a=a|0;b=b|0;var c=0;c=f[a+64>>2]|0;return Ra[f[(f[c>>2]|0)+12>>2]&127](c,b)|0}function Jn(){var a=0;a=u;u=u+16|0;if(!(Ja(18616,117)|0)){u=a;return}else Dn(17795,a)}function Kn(a){a=a|0;f[a>>2]=1136;Vh(a+4|0);f[a+40>>2]=0;f[a+44>>2]=0;f[a>>2]=2944;return}function Ln(a){a=a|0;Se(a);br(a);return}function Mn(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;_a[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function Nn(a,b){a=a|0;b=b|0;var c=0;c=f[b+64>>2]|0;Wa[f[(f[c>>2]|0)+28>>2]&15](a,c);return}function On(a,b,c){a=a|0;b=b|0;c=c|0;if(b|0)hj(a|0,(zq(c)|0)&255|0,b|0)|0;return a|0}function Pn(a){a=a|0;return 4}function Qn(a,b,c){a=a|0;b=b|0;c=c|0;return Ui(0,b,c)|0}function Rn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b<>>32-c;return a<>>0;return (I=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function Un(a,b){a=a|0;b=b|0;var c=0;if(!b)c=0;else c=lh(f[b>>2]|0,f[b+4>>2]|0,a)|0;return (c|0?c:a)|0}function Vn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (I=e,a-c>>>0|0)|0}function Wn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b>>>c;return a>>>c|(b&(1<>>c-32|0}function Xn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return qe(a,b,c,d)|0}function Yn(a){a=a|0;Ve(a);br(a);return}function Zn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=+d;return Oi(a,b,c,d)|0}function _n(a){a=a|0;return 5}function $n(a){a=a|0;var b=0;f[a>>2]=5880;b=a+4|0;a=b+80|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function ao(a){a=a|0;return 6}function bo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Pi(a,b,c,d)|0}function co(a,b,c){a=a|0;b=b|0;c=c|0;Fj(a,b,c);return}function eo(a,b){a=a|0;b=b|0;xi(f[a>>2]|0,b);return}function fo(a,b,c){a=a|0;b=b|0;c=c|0;co(a,b,c);return}function go(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;He(a,b,c,d,1);return}function ho(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;He(a,b,c,d,0);return}function io(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Eg(a,b,c,d)|0}function jo(a,b,c){a=a|0;b=b|0;c=c|0;return Qh(a,b,c)|0}function ko(a){a=a|0;var b=0;b=f[a+64>>2]|0;return Qa[f[(f[b>>2]|0)+32>>2]&127](b)|0}function lo(a,b,c){a=a|0;b=b|0;c=c|0;f[a+28>>2]=b;f[a+32>>2]=c;return 1}function mo(a,b){a=a|0;b=b|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;return}function no(a,b,c){a=a|0;b=b|0;c=c|0;Fj(f[a>>2]|0,b,c);return}function oo(a,b,c){a=a|0;b=b|0;c=c|0;return Ui(a,b,c)|0}function po(a,b,c){a=a|0;b=b|0;c=c|0;return Qn(a,b,c)|0}function qo(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Za[a&3](b|0,c|0,d|0,e|0,f|0)}function ro(a){a=a|0;var b=0,c=0;if(a>>>0>4294963200){b=ir()|0;f[b>>2]=0-a;c=-1}else c=a;return c|0}function so(a,b,c){a=a|0;b=b|0;c=c|0;return rh(a,b,c)|0}function to(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;return}function uo(a,b){a=a|0;b=b|0;f[a+8>>2]=b;f[a+12>>2]=-1;return 1}function vo(a,b){a=a|0;b=b|0;f[a+56>>2]=b;tp(a,b);return}function wo(a,b,c){a=a|0;b=b|0;c=c|0;no(a,b,c);return}function xo(a){a=+a;var b=0;p[s>>3]=a;b=f[s>>2]|0;I=f[s+4>>2]|0;return b|0}function yo(a,b,c){a=a|0;b=$(b);c=c|0;var d=Oa;d=$($(c|0)/b);n[a>>2]=d;return}function zo(a,b){a=a|0;b=b|0;xi(a,b);return}function Ao(a){a=a|0;wm(a);f[a>>2]=1460;f[a+36>>2]=0;return}function Bo(a){a=a|0;zn(a);f[a>>2]=3424;f[a+56>>2]=0;f[a+60>>2]=0;return}function Co(a){a=a|0;var b=0;if(!a)b=0;else b=(mh(a,1024,1112,0)|0)!=0&1;return b|0}function Do(a,b,c){a=a|0;b=b|0;c=c|0;Eo(f[a>>2]|0,b,c);return}function Eo(a,b,c){a=a|0;b=b|0;c=c|0;Fi(a+4|0,b,c);return}function Fo(a){a=a|0;var b=0;b=dn(8)|0;ck(b,a);return b|0}function Go(a){a=a|0;if((b[a+11>>0]|0)<0)br(f[a>>2]|0);return}function Ho(a){a=a|0;if(!a)return;Va[f[(f[a>>2]|0)+4>>2]&127](a);return}function Io(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Ya[a&7](b|0,c|0,d|0,e|0)}function Jo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)Xl(a|0,b|0,c|0)|0;return a|0}function Ko(a,b,c){a=a|0;b=b|0;c=c|0;Do(a,b,c);return}function Lo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)Rg(a|0,b|0,c|0)|0;return a|0}function Mo(a){a=a|0;f[a+52>>2]=f[(f[a+4>>2]|0)+80>>2];return}function No(a,b){a=a|0;b=b|0;eo(a,b);return}function Oo(a){a=a|0;f[a+52>>2]=f[(f[a+56>>2]|0)+80>>2];return}function Po(a,b){a=a|0;b=b|0;return -1}function Qo(a){a=a|0;var b=0;b=u;u=u+16|0;Ua[a&3]();Dn(17898,b)}function Ro(a){a=a|0;wh(a);br(a);return}function So(a,b,c){a=a|0;b=b|0;c=c|0;$o(a,b,c);return}function To(a,b){a=a|0;b=b|0;bk(f[a>>2]|0,b);return}function Uo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Sa[a&31](b|0,c|0,d|0)|0}function Vo(a,b){a=a|0;b=b|0;return (Jp(a,b)|0)<<24>>24|0}function Wo(a,b){a=a|0;b=b|0;f[a>>2]=6924;Sl(a+4|0,b);return}function Xo(a){a=a|0;Bo(a);f[a>>2]=3e3;f[a+64>>2]=0;return}function Yo(a,b){a=a|0;b=b|0;var c=0;if(!a)c=0;else c=Bi(a,b,0)|0;return c|0}function Zo(a,b){a=a|0;b=b|0;zo(a,b);return}function _o(a){a=a|0;return f[a+12>>2]|0}function $o(a,b,c){a=a|0;b=b|0;c=c|0;Eo(a,b,c);return}function ap(){var a=0;a=dn(64)|0;Al(a);return a|0}function bp(a,b){a=a|0;b=b|0;To(a,b);return}function cp(a){a=a|0;if(!a)return;Qi(a);br(a);return}function dp(a){a=a|0;return f[a+4>>2]|0}function ep(a,b,c){a=a|0;b=b|0;c=c|0;if(!(f[a>>2]&32))ai(b,c,a)|0;return}function fp(a){a=a|0;return Mp(a)|0}function gp(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Xa[a&15](b|0,c|0,d|0)}function hp(){var a=0;a=dn(96)|0;Lm(a);return a|0}function ip(a){a=a|0;return Np(a)|0}function jp(a){a=a|0;var b=0;b=u;u=u+a|0;u=u+15&-16;return b|0}function kp(a){a=a|0;var b=0;b=(Yq()|0)+188|0;return Tj(a,f[b>>2]|0)|0}function lp(a){a=a|0;return ((f[a+100>>2]|0)-(f[a+96>>2]|0)|0)/12|0|0}function mp(a,b){a=a|0;b=b|0;vp(a,b);return}function np(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(3);return 0}function op(){var a=0;a=dn(12)|0;Bp(a);return a|0}function pp(a){a=a|0;zi(a);br(a);return}function qp(a,b,c){a=a|0;b=b|0;c=c|0;return (a|0)==(b|0)|0}function rp(a,b){a=a|0;b=b|0;var c=0;c=Fp(a|0)|0;return ((b|0)==0?a:c)|0}function sp(a){a=a|0;return (f[a+12>>2]|0)-(f[a+8>>2]|0)>>2|0}function tp(a,b){a=a|0;b=b|0;f[a+4>>2]=b;return}function up(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Bd(a,b,c,d,0)|0}function vp(a,b){a=a|0;b=b|0;bk(a,b);return}function wp(a){a=a|0;f[a+4>>2]=0;f[a+8>>2]=0;f[a>>2]=a+4;return}function xp(a){a=a|0;return nq(a)|0}function yp(){var a=0;a=dn(84)|0;$n(a);return a|0}function zp(a){a=a|0;gi(a);br(a);return}function Ap(a){a=a|0;return oq(a)|0}function Bp(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;return}function Cp(a){a=a|0;f[a>>2]=6924;lm(a+4|0);return}function Dp(a,b,c){a=a|0;b=b|0;c=c|0;return Ra[a&127](b|0,c|0)|0}function Ep(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(10)}function Fp(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function Gp(a){a=a|0;Bo(a);f[a>>2]=3504;return}function Hp(a,c){a=a|0;c=c|0;b[a>>0]=b[c>>0]|0;return}function Ip(a,b,c){a=a|0;b=b|0;c=c|0;return -1}function Jp(a,c){a=a|0;c=c|0;return b[(f[a>>2]|0)+c>>0]|0}function Kp(a){a=a|0;return (f[a+4>>2]|0)-(f[a>>2]|0)|0}function Lp(a){a=a|0;aj(a);br(a);return}function Mp(a){a=a|0;return f[(f[a>>2]|0)+40>>2]|0}function Np(a){a=a|0;return f[(f[a>>2]|0)+44>>2]|0}function Op(a){a=a|0;if(!a)return;br(a);return}function Pp(a){a=a|0;b[a+28>>0]=1;return}function Qp(a,b){a=a|0;b=b|0;if(!x){x=a;y=b}}function Rp(a,b){a=a|0;b=b|0;return 1}function Sp(a){a=a|0;return a+12|0}function Tp(a,b,c){a=a|0;b=b|0;c=c|0;Wa[a&15](b|0,c|0)}function Up(a,b){a=a|0;b=b|0;f[a+80>>2]=b;return}function Vp(){var a=0;a=dn(48)|0;Fq(a);return a|0}function Wp(a){a=a|0;return vq(a+4|0)|0}function Xp(){var a=0;a=dn(108)|0;bn(a);return a|0}function Yp(a){a=a|0;return (b[a+32>>0]|0)!=0|0}function Zp(a){a=a|0;return a+-12|0}function _p(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;aa(9)}function $p(){var a=0;a=f[4655]|0;f[4655]=a+0;return a|0}function aq(a){a=a|0;return f[a+56>>2]|0}function bq(){var a=0;a=f[1708]|0;f[1708]=a+0;return a|0}function cq(a){a=a|0;wg(a);br(a);return}function dq(a){a=a|0;fr(a);br(a);return}function eq(a){a=a|0;return b[a+24>>0]|0}function fq(a,b){a=a|0;b=b|0;return 0}function gq(a){a=a|0;return f[a+48>>2]|0}function hq(a,b){a=a|0;b=b|0;return Qa[a&127](b|0)|0}function iq(a){a=a|0;return f[a+60>>2]|0}function jq(a){a=a|0;return f[a+28>>2]|0}function kq(a){a=a|0;sa(a|0)|0;bm()}function lq(a){a=a|0;Cp(a);br(a);return}function mq(a){a=a|0;Ca()}function nq(a){a=a|0;return f[a+40>>2]|0}function oq(a){a=a|0;return f[a+44>>2]|0}function pq(a,b){a=a|0;b=b|0;return $(+sk(a,b,0))}function qq(a){a=a|0;return 3}function rq(a,b){a=a|0;b=b|0;u=a;v=b}function sq(a){a=a|0;n[a>>2]=$(1.0);return}function tq(a){a=a|0;return ((a|0)==32|(a+-9|0)>>>0<5)&1|0}function uq(a){a=a|0;return f[a+80>>2]|0}function vq(a){a=a|0;return f[a>>2]|0}function wq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;aa(8)}function xq(a,b){a=a|0;b=b|0;Va[a&127](b|0)}function yq(a,b){a=a|0;b=b|0;return Un(a,b)|0}function zq(a){a=a|0;return a&255|0}function Aq(a){a=a|0;return vj(a)|0}function Bq(a,b){a=a|0;b=b|0;return +(+sk(a,b,1))}function Cq(a,b,c){a=a|0;b=b|0;c=c|0;aa(2);return 0}function Dq(a){a=a|0;return 2}function Eq(a){a=a|0;return 1}function Fq(a){a=a|0;Kn(a);return}function Gq(a,b){a=+a;b=+b;return +(+Nl(a,b))}function Hq(a,b){a=+a;b=b|0;return +(+Wj(a,b))}function Iq(a,b){a=+a;b=b|0;return +(+Uj(a,b))}function Jq(){return 3}function Kq(a,b,c){a=a|0;b=b|0;c=c|0;aa(7)}function Lq(){return 0}function Mq(){return -1}function Nq(){return dn(1)|0}function Oq(){return 4}function Pq(a){a=a|0;return (a+-48|0)>>>0<10|0}function Qq(){return 1}function Rq(){return 2}function Sq(a,b){a=+a;b=+b;return +(+pd(a,b))}function Tq(a,b){a=a|0;b=b|0;aa(1);return 0}function Uq(a){a=a|0;Ha()}function Vq(a){a=a|0;Ua[a&3]()}function Wq(){ua()}function Xq(a){a=a|0;return +(+Bq(a,0))}function Yq(){return lr()|0}function Zq(a,b){a=a|0;b=b|0;aa(6)}function _q(a){a=a|0;return dn(a)|0}function $q(a){a=a|0;br(a);return}function ar(a){a=a|0;u=a}function br(a){a=a|0;wc(a);return}function cr(a){a=a|0;I=a}function dr(a){a=a|0;return a|0}function er(a){a=a|0;aa(0);return 0}function fr(a){a=a|0;return}function gr(a){a=a|0;return 0}function hr(){return I|0}function ir(){return 18544}function jr(){return u|0}function kr(a){a=a|0;aa(5)}function lr(){return 6040}function mr(){aa(4)} - -// EMSCRIPTEN_END_FUNCS -var Qa=[er,Dq,Eq,Eq,Dq,gb,gr,gr,gr,ak,Vf,Eq,dp,gr,gr,Eq,gr,Eq,Eq,rl,_n,ll,Eq,ao,Yk,Eq,jq,Pn,rl,Eq,rl,_n,ll,Eq,ao,Yk,Eq,jq,Pn,rl,Eq,qq,gr,dp,Eq,gr,Eq,qq,Eq,kl,Pn,kl,_n,il,Eq,ao,Qk,Eq,jq,Eq,kl,Pn,kl,_n,il,Eq,ao,Qk,Eq,jq,Eq,Dq,Eq,Eq,Cd,Eq,Je,Tg,qk,ko,_o,dp,lg,sg,$e,_o,dp,Eq,gr,gr,wi,gr,Eq,gr,Xj,ln,Wp,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er,er];var Ra=[Tq,ql,Ug,ve,xl,fq,fq,fq,Rp,kb,gj,uo,Rp,Rp,fi,bj,Uh,ek,jl,Gj,Vk,Yj,Zj,Fe,Po,fq,Zh,fq,Dl,_e,fq,El,Zg,$l,td,fq,Dl,_e,fq,El,Zg,$l,td,xn,Po,fq,Xh,sd,fq,tl,We,fq,ul,Yg,$l,sd,fq,tl,We,fq,ul,Yg,$l,un,Hn,Bn,In,Gn,Kg,dk,mk,mc,le,Jm,wf,af,Ze,Ig,dk,mk,lc,le,Jm,Rp,fq,fq,bf,nm,Xf,bf,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq,Tq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ten_bind_DracoInt8Array_DracoInt8Array_0:op,_emscripten_bind_DracoInt8Array_GetValue_1:Vo,_emscripten_bind_DracoInt8Array___destroy___0:Xm,_emscripten_bind_DracoInt8Array_size_0:Kp,_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2:jo,_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3:An,_emscripten_bind_Encoder_Encoder_0:Vp,_emscripten_bind_Encoder_GetNumberOfEncodedFaces_0:Ap,_emscripten_bind_Encoder_GetNumberOfEncodedPoints_0:xp,_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5:Um,_emscripten_bind_Encoder_SetAttributeQuantization_2:fo,_emscripten_bind_Encoder_SetEncodingMethod_1:mp,_emscripten_bind_Encoder_SetSpeedOptions_2:So,_emscripten_bind_Encoder_SetTrackEncodedProperties_1:Zo,_emscripten_bind_Encoder___destroy___0:Hj,_emscripten_bind_ExpertEncoder_EncodeToDracoBuffer_2:so,_emscripten_bind_ExpertEncoder_ExpertEncoder_1:Fo,_emscripten_bind_ExpertEncoder_GetNumberOfEncodedFaces_0:ip,_emscripten_bind_ExpertEncoder_GetNumberOfEncodedPoints_0:fp,_emscripten_bind_ExpertEncoder_SetAttributeExplicitQuantization_5:jn,_emscripten_bind_ExpertEncoder_SetAttributeQuantization_2:wo,_emscripten_bind_ExpertEncoder_SetEncodingMethod_1:bp,_emscripten_bind_ExpertEncoder_SetSpeedOptions_2:Ko,_emscripten_bind_ExpertEncoder_SetTrackEncodedProperties_1:No,_emscripten_bind_ExpertEncoder___destroy___0:nn,_emscripten_bind_GeometryAttribute_GeometryAttribute_0:ap,_emscripten_bind_GeometryAttribute___destroy___0:Op,_emscripten_bind_MeshBuilder_AddFacesToMesh_3:io,_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5:hn,_emscripten_bind_MeshBuilder_AddFloatAttribute_5:hn,_emscripten_bind_MeshBuilder_AddInt16Attribute_5:_m,_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5:gn,_emscripten_bind_MeshBuilder_AddInt32Attribute_5:gn,_emscripten_bind_MeshBuilder_AddInt8Attribute_5:cn,_emscripten_bind_MeshBuilder_AddMetadataToMesh_2:po,_emscripten_bind_MeshBuilder_AddMetadata_2:oo,_emscripten_bind_MeshBuilder_AddUInt16Attribute_5:Wm,_emscripten_bind_MeshBuilder_AddUInt32Attribute_5:Vm,_emscripten_bind_MeshBuilder_AddUInt8Attribute_5:Zm,_emscripten_bind_MeshBuilder_MeshBuilder_0:Nq,_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3:yn,_emscripten_bind_MeshBuilder___destroy___0:Op,_emscripten_bind_Mesh_Mesh_0:Xp,_emscripten_bind_Mesh___destroy___0:Ho,_emscripten_bind_Mesh_num_attributes_0:sp,_emscripten_bind_Mesh_num_faces_0:lp,_emscripten_bind_Mesh_num_points_0:uq,_emscripten_bind_Mesh_set_num_points_1:Up,_emscripten_bind_MetadataBuilder_AddDoubleEntry_3:Zn,_emscripten_bind_MetadataBuilder_AddIntEntry_3:bo,_emscripten_bind_MetadataBuilder_AddStringEntry_3:Xn,_emscripten_bind_MetadataBuilder_MetadataBuilder_0:Nq,_emscripten_bind_MetadataBuilder___destroy___0:Op,_emscripten_bind_Metadata_Metadata_0:Ml,_emscripten_bind_Metadata___destroy___0:cp,_emscripten_bind_PointAttribute_PointAttribute_0:hp,_emscripten_bind_PointAttribute___destroy___0:xj,_emscripten_bind_PointAttribute_attribute_type_0:aq,_emscripten_bind_PointAttribute_byte_offset_0:gq,_emscripten_bind_PointAttribute_byte_stride_0:nq,_emscripten_bind_PointAttribute_data_type_0:jq,_emscripten_bind_PointAttribute_normalized_0:Yp,_emscripten_bind_PointAttribute_num_components_0:eq,_emscripten_bind_PointAttribute_size_0:uq,_emscripten_bind_PointAttribute_unique_id_0:iq,_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5:hn,_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5:_m,_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5:gn,_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5:cn,_emscripten_bind_PointCloudBuilder_AddMetadata_2:oo,_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5:Wm,_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5:Vm,_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5:Zm,_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0:Nq,_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3:yn,_emscripten_bind_PointCloudBuilder___destroy___0:Op,_emscripten_bind_PointCloud_PointCloud_0:yp,_emscripten_bind_PointCloud___destroy___0:Ho,_emscripten_bind_PointCloud_num_attributes_0:sp,_emscripten_bind_PointCloud_num_points_0:uq,_emscripten_bind_VoidPtr___destroy___0:Op,_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE:Mq,_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD:Lq,_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH:Qq,_emscripten_enum_draco_GeometryAttribute_Type_COLOR:Rq,_emscripten_enum_draco_GeometryAttribute_Type_GENERIC:Oq,_emscripten_enum_draco_GeometryAttribute_Type_INVALID:Mq,_emscripten_enum_draco_GeometryAttribute_Type_NORMAL:Qq,_emscripten_enum_draco_GeometryAttribute_Type_POSITION:Lq,_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD:Jq,_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING:Qq,_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING:Lq,_emscripten_replace_memory:Pa,_free:wc,_i64Add:Tn,_i64Subtract:Vn,_llvm_bswap_i32:Fp,_malloc:$a,_memcpy:Rg,_memmove:Xl,_memset:hj,_sbrk:Fl,dynCall_ii:hq,dynCall_iii:Dp,dynCall_iiii:Uo,dynCall_iiiiiii:En,dynCall_v:Vq,dynCall_vi:xq,dynCall_vii:Tp,dynCall_viii:gp,dynCall_viiii:Io,dynCall_viiiii:qo,dynCall_viiiiii:Mn,establishStackSpace:rq,getTempRet0:hr,runPostSets:Sn,setTempRet0:cr,setThrew:Qp,stackAlloc:jp,stackRestore:ar,stackSave:jr}}) - - -// EMSCRIPTEN_END_ASM -(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _emscripten_bind_DracoInt8Array_DracoInt8Array_0=Module["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"]=asm["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"];var _emscripten_bind_DracoInt8Array_GetValue_1=Module["_emscripten_bind_DracoInt8Array_GetValue_1"]=asm["_emscripten_bind_DracoInt8Array_GetValue_1"];var _emscripten_bind_DracoInt8Array___destroy___0=Module["_emscripten_bind_DracoInt8Array___destroy___0"]=asm["_emscripten_bind_DracoInt8Array___destroy___0"];var _emscripten_bind_DracoInt8Array_size_0=Module["_emscripten_bind_DracoInt8Array_size_0"]=asm["_emscripten_bind_DracoInt8Array_size_0"];var _emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2=Module["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"]=asm["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"];var _emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3=Module["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"]=asm["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"];var _emscripten_bind_Encoder_Encoder_0=Module["_emscripten_bind_Encoder_Encoder_0"]=asm["_emscripten_bind_Encoder_Encoder_0"];var _emscripten_bind_Encoder_GetNumberOfEncodedFaces_0=Module["_emscripten_bind_Encoder_GetNumberOfEncodedFaces_0"]=asm["_emscripten_bind_Encoder_GetNumberOfEncodedFaces_0"];var _emscripten_bind_Encoder_GetNumberOfEncodedPoints_0=Module["_emscripten_bind_Encoder_GetNumberOfEncodedPoints_0"]=asm["_emscripten_bind_Encoder_GetNumberOfEncodedPoints_0"];var _emscripten_bind_Encoder_SetAttributeExplicitQuantization_5=Module["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"]=asm["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"];var _emscripten_bind_Encoder_SetAttributeQuantization_2=Module["_emscripten_bind_Encoder_SetAttributeQuantization_2"]=asm["_emscripten_bind_Encoder_SetAttributeQuantization_2"];var _emscripten_bind_Encoder_SetEncodingMethod_1=Module["_emscripten_bind_Encoder_SetEncodingMethod_1"]=asm["_emscripten_bind_Encoder_SetEncodingMethod_1"];var _emscripten_bind_Encoder_SetSpeedOptions_2=Module["_emscripten_bind_Encoder_SetSpeedOptions_2"]=asm["_emscripten_bind_Encoder_SetSpeedOptions_2"];var _emscripten_bind_Encoder_SetTrackEncodedProperties_1=Module["_emscripten_bind_Encoder_SetTrackEncodedProperties_1"]=asm["_emscripten_bind_Encoder_SetTrackEncodedProperties_1"];var _emscripten_bind_Encoder___destroy___0=Module["_emscripten_bind_Encoder___destroy___0"]=asm["_emscripten_bind_Encoder___destroy___0"];var _emscripten_bind_ExpertEncoder_EncodeToDracoBuffer_2=Module["_emscripten_bind_ExpertEncoder_EncodeToDracoBuffer_2"]=asm["_emscripten_bind_ExpertEncoder_EncodeToDracoBuffer_2"];var _emscripten_bind_ExpertEncoder_ExpertEncoder_1=Module["_emscripten_bind_ExpertEncoder_ExpertEncoder_1"]=asm["_emscripten_bind_ExpertEncoder_ExpertEncoder_1"];var _emscripten_bind_ExpertEncoder_GetNumberOfEncodedFaces_0=Module["_emscripten_bind_ExpertEncoder_GetNumberOfEncodedFaces_0"]=asm["_emscripten_bind_ExpertEncoder_GetNumberOfEncodedFaces_0"];var _emscripten_bind_ExpertEncoder_GetNumberOfEncodedPoints_0=Module["_emscripten_bind_ExpertEncoder_GetNumberOfEncodedPoints_0"]=asm["_emscripten_bind_ExpertEncoder_GetNumberOfEncodedPoints_0"];var _emscripten_bind_ExpertEncoder_SetAttributeExplicitQuantization_5=Module["_emscripten_bind_ExpertEncoder_SetAttributeExplicitQuantization_5"]=asm["_emscripten_bind_ExpertEncoder_SetAttributeExplicitQuantization_5"];var _emscripten_bind_ExpertEncoder_SetAttributeQuantization_2=Module["_emscripten_bind_ExpertEncoder_SetAttributeQuantization_2"]=asm["_emscripten_bind_ExpertEncoder_SetAttributeQuantization_2"];var _emscripten_bind_ExpertEncoder_SetEncodingMethod_1=Module["_emscripten_bind_ExpertEncoder_SetEncodingMethod_1"]=asm["_emscripten_bind_ExpertEncoder_SetEncodingMethod_1"];var _emscripten_bind_ExpertEncoder_SetSpeedOptions_2=Module["_emscripten_bind_ExpertEncoder_SetSpeedOptions_2"]=asm["_emscripten_bind_ExpertEncoder_SetSpeedOptions_2"];var _emscripten_bind_ExpertEncoder_SetTrackEncodedProperties_1=Module["_emscripten_bind_ExpertEncoder_SetTrackEncodedProperties_1"]=asm["_emscripten_bind_ExpertEncoder_SetTrackEncodedProperties_1"];var _emscripten_bind_ExpertEncoder___destroy___0=Module["_emscripten_bind_ExpertEncoder___destroy___0"]=asm["_emscripten_bind_ExpertEncoder___destroy___0"];var _emscripten_bind_GeometryAttribute_GeometryAttribute_0=Module["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"]=asm["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"];var _emscripten_bind_GeometryAttribute___destroy___0=Module["_emscripten_bind_GeometryAttribute___destroy___0"]=asm["_emscripten_bind_GeometryAttribute___destroy___0"];var _emscripten_bind_MeshBuilder_AddFacesToMesh_3=Module["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"]=asm["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"];var _emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddFloatAttribute_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"];var _emscripten_bind_MeshBuilder_AddInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"];var _emscripten_bind_MeshBuilder_AddMetadataToMesh_2=Module["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"];var _emscripten_bind_MeshBuilder_AddMetadata_2=Module["_emscripten_bind_MeshBuilder_AddMetadata_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadata_2"];var _emscripten_bind_MeshBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"];var _emscripten_bind_MeshBuilder_MeshBuilder_0=Module["_emscripten_bind_MeshBuilder_MeshBuilder_0"]=asm["_emscripten_bind_MeshBuilder_MeshBuilder_0"];var _emscripten_bind_MeshBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_MeshBuilder___destroy___0=Module["_emscripten_bind_MeshBuilder___destroy___0"]=asm["_emscripten_bind_MeshBuilder___destroy___0"];var _emscripten_bind_Mesh_Mesh_0=Module["_emscripten_bind_Mesh_Mesh_0"]=asm["_emscripten_bind_Mesh_Mesh_0"];var _emscripten_bind_Mesh___destroy___0=Module["_emscripten_bind_Mesh___destroy___0"]=asm["_emscripten_bind_Mesh___destroy___0"];var _emscripten_bind_Mesh_num_attributes_0=Module["_emscripten_bind_Mesh_num_attributes_0"]=asm["_emscripten_bind_Mesh_num_attributes_0"];var _emscripten_bind_Mesh_num_faces_0=Module["_emscripten_bind_Mesh_num_faces_0"]=asm["_emscripten_bind_Mesh_num_faces_0"];var _emscripten_bind_Mesh_num_points_0=Module["_emscripten_bind_Mesh_num_points_0"]=asm["_emscripten_bind_Mesh_num_points_0"];var _emscripten_bind_Mesh_set_num_points_1=Module["_emscripten_bind_Mesh_set_num_points_1"]=asm["_emscripten_bind_Mesh_set_num_points_1"];var _emscripten_bind_MetadataBuilder_AddDoubleEntry_3=Module["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"];var _emscripten_bind_MetadataBuilder_AddIntEntry_3=Module["_emscripten_bind_MetadataBuilder_AddIntEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddIntEntry_3"];var _emscripten_bind_MetadataBuilder_AddStringEntry_3=Module["_emscripten_bind_MetadataBuilder_AddStringEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddStringEntry_3"];var _emscripten_bind_MetadataBuilder_MetadataBuilder_0=Module["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"]=asm["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"];var _emscripten_bind_MetadataBuilder___destroy___0=Module["_emscripten_bind_MetadataBuilder___destroy___0"]=asm["_emscripten_bind_MetadataBuilder___destroy___0"];var _emscripten_bind_Metadata_Metadata_0=Module["_emscripten_bind_Metadata_Metadata_0"]=asm["_emscripten_bind_Metadata_Metadata_0"];var _emscripten_bind_Metadata___destroy___0=Module["_emscripten_bind_Metadata___destroy___0"]=asm["_emscripten_bind_Metadata___destroy___0"];var _emscripten_bind_PointAttribute_PointAttribute_0=Module["_emscripten_bind_PointAttribute_PointAttribute_0"]=asm["_emscripten_bind_PointAttribute_PointAttribute_0"];var _emscripten_bind_PointAttribute___destroy___0=Module["_emscripten_bind_PointAttribute___destroy___0"]=asm["_emscripten_bind_PointAttribute___destroy___0"];var _emscripten_bind_PointAttribute_attribute_type_0=Module["_emscripten_bind_PointAttribute_attribute_type_0"]=asm["_emscripten_bind_PointAttribute_attribute_type_0"];var _emscripten_bind_PointAttribute_byte_offset_0=Module["_emscripten_bind_PointAttribute_byte_offset_0"]=asm["_emscripten_bind_PointAttribute_byte_offset_0"];var _emscripten_bind_PointAttribute_byte_stride_0=Module["_emscripten_bind_PointAttribute_byte_stride_0"]=asm["_emscripten_bind_PointAttribute_byte_stride_0"];var _emscripten_bind_PointAttribute_data_type_0=Module["_emscripten_bind_PointAttribute_data_type_0"]=asm["_emscripten_bind_PointAttribute_data_type_0"];var _emscripten_bind_PointAttribute_normalized_0=Module["_emscripten_bind_PointAttribute_normalized_0"]=asm["_emscripten_bind_PointAttribute_normalized_0"];var _emscripten_bind_PointAttribute_num_components_0=Module["_emscripten_bind_PointAttribute_num_components_0"]=asm["_emscripten_bind_PointAttribute_num_components_0"];var _emscripten_bind_PointAttribute_size_0=Module["_emscripten_bind_PointAttribute_size_0"]=asm["_emscripten_bind_PointAttribute_size_0"];var _emscripten_bind_PointAttribute_unique_id_0=Module["_emscripten_bind_PointAttribute_unique_id_0"]=asm["_emscripten_bind_PointAttribute_unique_id_0"];var _emscripten_bind_PointCloudBuilder_AddFloatAttribute_5=Module["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddMetadata_2=Module["_emscripten_bind_PointCloudBuilder_AddMetadata_2"]=asm["_emscripten_bind_PointCloudBuilder_AddMetadata_2"];var _emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_PointCloudBuilder_0=Module["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"]=asm["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"];var _emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_PointCloudBuilder___destroy___0=Module["_emscripten_bind_PointCloudBuilder___destroy___0"]=asm["_emscripten_bind_PointCloudBuilder___destroy___0"];var _emscripten_bind_PointCloud_PointCloud_0=Module["_emscripten_bind_PointCloud_PointCloud_0"]=asm["_emscripten_bind_PointCloud_PointCloud_0"];var _emscripten_bind_PointCloud___destroy___0=Module["_emscripten_bind_PointCloud___destroy___0"]=asm["_emscripten_bind_PointCloud___destroy___0"];var _emscripten_bind_PointCloud_num_attributes_0=Module["_emscripten_bind_PointCloud_num_attributes_0"]=asm["_emscripten_bind_PointCloud_num_attributes_0"];var _emscripten_bind_PointCloud_num_points_0=Module["_emscripten_bind_PointCloud_num_points_0"]=asm["_emscripten_bind_PointCloud_num_points_0"];var _emscripten_bind_VoidPtr___destroy___0=Module["_emscripten_bind_VoidPtr___destroy___0"]=asm["_emscripten_bind_VoidPtr___destroy___0"];var _emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=Module["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"]=asm["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"];var _emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=Module["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"]=asm["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"];var _emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=Module["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"]=asm["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"];var _emscripten_enum_draco_GeometryAttribute_Type_COLOR=Module["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"];var _emscripten_enum_draco_GeometryAttribute_Type_GENERIC=Module["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"];var _emscripten_enum_draco_GeometryAttribute_Type_INVALID=Module["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"];var _emscripten_enum_draco_GeometryAttribute_Type_NORMAL=Module["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"];var _emscripten_enum_draco_GeometryAttribute_Type_POSITION=Module["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"];var _emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=Module["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"];var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=asm["_emscripten_replace_memory"];var _free=Module["_free"]=asm["_free"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memmove=Module["_memmove"]=asm["_memmove"];var _memset=Module["_memset"]=asm["_memset"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var setThrew=Module["setThrew"]=asm["setThrew"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];Module["asm"]=asm;if(memoryInitializer){if(!isDataURI(memoryInitializer)){if(typeof Module["locateFile"]==="function"){memoryInitializer=Module["locateFile"](memoryInitializer)}else if(Module["memoryInitializerPrefixURL"]){memoryInitializer=Module["memoryInitializerPrefixURL"]+memoryInitializer}}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=(function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")});function doBrowserLoad(){Module["readAsync"](memoryInitializer,applyMemoryInitializer,(function(){throw"could not load memory initializer "+memoryInitializer}))}var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){function useRequest(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)}if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();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&&Module["noExitRuntime"]&&status===0){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=exit;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:(function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret}),copy:(function(array,view,offset){var offsetShifted=offset;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offsetShifted>>=1;break;case 4:offsetShifted>>=2;break;case 8:offsetShifted>>=3;break}for(var i=0;i>>0,$jscomp.propertyToPolyfillSymbol[h]=$jscomp.IS_SYMBOL_NATIVE? -$jscomp.global.Symbol(h):$jscomp.POLYFILL_PREFIX+l+"$"+h),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[h],{configurable:!0,writable:!0,value:n})))}; -$jscomp.polyfill("Promise",function(k){function n(){this.batch_=null}function l(f){return f instanceof h?f:new h(function(q,v){q(f)})}if(k&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return k;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)}; -var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q=A}},"es6","es3"); -$jscomp.polyfill("Array.prototype.copyWithin",function(k){function n(l){l=Number(l);return Infinity===l||-Infinity===l?l:l|0}return k?k:function(l,p,h){var A=this.length;l=n(l);p=n(p);h=void 0===h?A:n(h);l=0>l?Math.max(A+l,0):Math.min(l,A);p=0>p?Math.max(A+p,0):Math.min(p,A);h=0>h?Math.max(A+h,0):Math.min(h,A);if(lp;)--h in this?this[--l]=this[h]:delete this[--l];return this}},"es6","es3"); -$jscomp.typedArrayCopyWithin=function(k){return k?k:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); -$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); -var DracoDecoderModule=function(){var k="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(k=k||__filename);return function(n){function l(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b,c){var d=b+c;for(c=b;e[c]&&!(c>=d);)++c;if(16g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}return d}function h(e,b){return e?p(ea,e,b):""}function A(){var e=ja.buffer;a.HEAP8=Y=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ea=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=V=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function f(e){if(a.onAbort)a.onAbort(e); -e="Aborted("+e+")";da(e);wa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function q(e){try{if(e==P&&fa)return new Uint8Array(fa);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){f(b)}}function v(){if(!fa&&(xa||ha)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return q(P)}); -if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return q(P)})}function z(e){for(;0>2]=b};this.get_type=function(){return V[this.ptr+4>>2]};this.set_destructor=function(b){V[this.ptr+8>>2]=b};this.get_destructor=function(){return V[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){Y[this.ptr+ -12>>0]=b?1:0};this.get_caught=function(){return 0!=Y[this.ptr+12>>0]};this.set_rethrown=function(b){Y[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=Y[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){V[this.ptr+ -16>>2]=b};this.get_adjusted_ptr=function(){return V[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ya(this.get_type()))return V[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function ba(){function e(){if(!la&&(la=!0,a.calledRun=!0,!wa)){za=!0;z(oa);Aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)Ba.unshift(a.postRun.shift());z(Ba)}}if(!(0=d?b++:2047>=d?b+=2:55296<=d&&57343>= -d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0=u){var X=e.charCodeAt(++g);u=65536+((u&1023)<<10)|X&1023}if(127>=u){if(c>=d)break;b[c++]=u}else{if(2047>=u){if(c+1>=d)break;b[c++]=192|u>>6}else{if(65535>=u){if(c+2>=d)break;b[c++]=224|u>>12}else{if(c+3>=d)break;b[c++]=240|u>>18;b[c++]=128|u>>12&63}b[c++]=128|u>>6&63}b[c++]=128|u&63}}b[c]=0}e=r.alloc(b,Y);r.copy(b,Y,e);return e}return e}function pa(e){if("object"===typeof e){var b= -r.alloc(e,Y);r.copy(e,Y,b);return b}return e}function Z(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=Da();x(S)[this.ptr]=this}function Q(){this.ptr=Ea();x(Q)[this.ptr]=this}function W(){this.ptr=Fa();x(W)[this.ptr]=this}function w(){this.ptr=Ga();x(w)[this.ptr]=this}function C(){this.ptr=Ha();x(C)[this.ptr]=this}function F(){this.ptr=Ia();x(F)[this.ptr]=this}function G(){this.ptr=Ja();x(G)[this.ptr]=this}function E(){this.ptr=Ka();x(E)[this.ptr]=this}function T(){this.ptr= -La();x(T)[this.ptr]=this}function B(){throw"cannot construct a Status, no constructor in IDL";}function H(){this.ptr=Ma();x(H)[this.ptr]=this}function I(){this.ptr=Na();x(I)[this.ptr]=this}function J(){this.ptr=Oa();x(J)[this.ptr]=this}function K(){this.ptr=Pa();x(K)[this.ptr]=this}function L(){this.ptr=Qa();x(L)[this.ptr]=this}function M(){this.ptr=Ra();x(M)[this.ptr]=this}function N(){this.ptr=Sa();x(N)[this.ptr]=this}function y(){this.ptr=Ta();x(y)[this.ptr]=this}function m(){this.ptr=Ua();x(m)[this.ptr]= -this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},Aa,ka;a.ready=new Promise(function(e,b){Aa=e;ka=b});var Va=!1,Wa=!1;a.onRuntimeInitialized=function(){Va=!0;if(Wa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Wa=!0;if(Va&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3=e[1]?!0:0!=e[0]||10>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);A();var u=1;break a}catch(X){}u=void 0}if(u)return!0}return!1},f:function(e){return 52},d:function(e,b,c,d,g){return 70},c:function(e,b,c,d){for(var g=0,u=0;u>2],ab=V[b+4>>2];b+=8;for(var sa=0;sa>2]=g;return 0}};(function(){function e(g,u){a.asm=g.exports;ja=a.asm.h;A();oa.unshift(a.asm.i);aa--;a.monitorRunDependencies&&a.monitorRunDependencies(aa);0==aa&&(null!==ra&&(clearInterval(ra),ra=null),ia&&(g=ia,ia=null,g()))}function b(g){e(g.instance)}function c(g){return v().then(function(u){return WebAssembly.instantiate(u,d)}).then(function(u){return u}).then(g,function(u){da("failed to asynchronously prepare wasm: "+u);f(u)})}var d={a:xd};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa); -if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return fa||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")||P.startsWith("file://")||Ya||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(u){da("wasm streaming compile failed: "+u);da("falling back to ArrayBuffer instantiation"); -return c(b)})})})().catch(ka);return{}})();var bb=a._emscripten_bind_VoidPtr___destroy___0=function(){return(bb=a._emscripten_bind_VoidPtr___destroy___0=a.asm.k).apply(null,arguments)},Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=function(){return(Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.l).apply(null,arguments)},cb=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(cb=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.m).apply(null,arguments)},db=a._emscripten_bind_DecoderBuffer___destroy___0= -function(){return(db=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.n).apply(null,arguments)},Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=a.asm.o).apply(null,arguments)},eb=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return(eb=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.p).apply(null,arguments)},fb=a._emscripten_bind_AttributeTransformData___destroy___0= -function(){return(fb=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.q).apply(null,arguments)},Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=a.asm.r).apply(null,arguments)},gb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(gb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.s).apply(null,arguments)},Ga=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ga= -a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.t).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_size_0=function(){return(hb=a._emscripten_bind_PointAttribute_size_0=a.asm.u).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=function(){return(ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.v).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(jb=a._emscripten_bind_PointAttribute_attribute_type_0= -a.asm.w).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(kb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.x).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(lb=a._emscripten_bind_PointAttribute_num_components_0=a.asm.y).apply(null,arguments)},mb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(mb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.z).apply(null,arguments)},nb=a._emscripten_bind_PointAttribute_byte_stride_0= -function(){return(nb=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.A).apply(null,arguments)},ob=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(ob=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.B).apply(null,arguments)},pb=a._emscripten_bind_PointAttribute_unique_id_0=function(){return(pb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.C).apply(null,arguments)},qb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(qb=a._emscripten_bind_PointAttribute___destroy___0= -a.asm.D).apply(null,arguments)},Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.E).apply(null,arguments)},rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.F).apply(null,arguments)},sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0= -function(){return(sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.G).apply(null,arguments)},tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.H).apply(null,arguments)},ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.I).apply(null,arguments)},vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0= -function(){return(vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.J).apply(null,arguments)},Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=a.asm.K).apply(null,arguments)},wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.L).apply(null, -arguments)},xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.M).apply(null,arguments)},yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.N).apply(null,arguments)},Ja=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Ja=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.O).apply(null, -arguments)},zb=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(zb=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.P).apply(null,arguments)},Ab=a._emscripten_bind_PointCloud_num_points_0=function(){return(Ab=a._emscripten_bind_PointCloud_num_points_0=a.asm.Q).apply(null,arguments)},Bb=a._emscripten_bind_PointCloud___destroy___0=function(){return(Bb=a._emscripten_bind_PointCloud___destroy___0=a.asm.R).apply(null,arguments)},Ka=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ka= -a._emscripten_bind_Mesh_Mesh_0=a.asm.S).apply(null,arguments)},Cb=a._emscripten_bind_Mesh_num_faces_0=function(){return(Cb=a._emscripten_bind_Mesh_num_faces_0=a.asm.T).apply(null,arguments)},Db=a._emscripten_bind_Mesh_num_attributes_0=function(){return(Db=a._emscripten_bind_Mesh_num_attributes_0=a.asm.U).apply(null,arguments)},Eb=a._emscripten_bind_Mesh_num_points_0=function(){return(Eb=a._emscripten_bind_Mesh_num_points_0=a.asm.V).apply(null,arguments)},Fb=a._emscripten_bind_Mesh___destroy___0=function(){return(Fb= -a._emscripten_bind_Mesh___destroy___0=a.asm.W).apply(null,arguments)},La=a._emscripten_bind_Metadata_Metadata_0=function(){return(La=a._emscripten_bind_Metadata_Metadata_0=a.asm.X).apply(null,arguments)},Gb=a._emscripten_bind_Metadata___destroy___0=function(){return(Gb=a._emscripten_bind_Metadata___destroy___0=a.asm.Y).apply(null,arguments)},Hb=a._emscripten_bind_Status_code_0=function(){return(Hb=a._emscripten_bind_Status_code_0=a.asm.Z).apply(null,arguments)},Ib=a._emscripten_bind_Status_ok_0=function(){return(Ib= -a._emscripten_bind_Status_ok_0=a.asm._).apply(null,arguments)},Jb=a._emscripten_bind_Status_error_msg_0=function(){return(Jb=a._emscripten_bind_Status_error_msg_0=a.asm.$).apply(null,arguments)},Kb=a._emscripten_bind_Status___destroy___0=function(){return(Kb=a._emscripten_bind_Status___destroy___0=a.asm.aa).apply(null,arguments)},Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm.ba).apply(null,arguments)}, -Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.ca).apply(null,arguments)},Mb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Mb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.da).apply(null,arguments)},Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ea).apply(null,arguments)},Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0= -function(){return(Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.fa).apply(null,arguments)},Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.ga).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt8Array_size_0=function(){return(Pb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ha).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Qb=a._emscripten_bind_DracoInt8Array___destroy___0= -a.asm.ia).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ja).apply(null,arguments)},Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=a.asm.ka).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Sb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.la).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt8Array___destroy___0= -function(){return(Tb=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ma).apply(null,arguments)},Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.na).apply(null,arguments)},Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=function(){return(Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.oa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Vb=a._emscripten_bind_DracoInt16Array_size_0= -a.asm.pa).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Wb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.qa).apply(null,arguments)},Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=a.asm.ra).apply(null,arguments)},Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.sa).apply(null,arguments)}, -Yb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Yb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.ta).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ua).apply(null,arguments)},Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=function(){return(Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.va).apply(null,arguments)},$b=a._emscripten_bind_DracoInt32Array_GetValue_1= -function(){return($b=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.wa).apply(null,arguments)},ac=a._emscripten_bind_DracoInt32Array_size_0=function(){return(ac=a._emscripten_bind_DracoInt32Array_size_0=a.asm.xa).apply(null,arguments)},bc=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(bc=a._emscripten_bind_DracoInt32Array___destroy___0=a.asm.ya).apply(null,arguments)},Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0= -a.asm.za).apply(null,arguments)},cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.Aa).apply(null,arguments)},dc=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(dc=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.Ba).apply(null,arguments)},ec=a._emscripten_bind_DracoUInt32Array___destroy___0=function(){return(ec=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.Ca).apply(null,arguments)},Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0= -function(){return(Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Da).apply(null,arguments)},fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ea).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=a.asm.Fa).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3= -a.asm.Ga).apply(null,arguments)},ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ha).apply(null,arguments)},jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Ia).apply(null,arguments)},kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ja).apply(null,arguments)}, -lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ka).apply(null,arguments)},mc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(mc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.La).apply(null,arguments)},Ua=a._emscripten_bind_Decoder_Decoder_0=function(){return(Ua=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ma).apply(null,arguments)},nc=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(nc= -a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Na).apply(null,arguments)},oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.Oa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(pc=a._emscripten_bind_Decoder_GetAttributeId_2=a.asm.Pa).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2= -a.asm.Qa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Ra).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(sc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Sa).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Ta).apply(null,arguments)}, -uc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(uc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ua).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Va).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=function(){return(wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Wa).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2= -function(){return(xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Xa).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Ya).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Za).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(Ac= -a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm._a).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.$a).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=a.asm.ab).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(Dc= -a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm.bb).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.cb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=a.asm.db).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3= -function(){return(Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.eb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.fb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=a.asm.gb).apply(null,arguments)},Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5= -function(){return(Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.hb).apply(null,arguments)},Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.ib).apply(null,arguments)},Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=a.asm.jb).apply(null,arguments)},Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2= -function(){return(Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.kb).apply(null,arguments)},Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.lb).apply(null,arguments)},Oc=a._emscripten_bind_Decoder___destroy___0=function(){return(Oc=a._emscripten_bind_Decoder___destroy___0=a.asm.mb).apply(null,arguments)},Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=function(){return(Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM= -a.asm.nb).apply(null,arguments)},Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.ob).apply(null,arguments)},Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=a.asm.pb).apply(null,arguments)},Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM= -function(){return(Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.qb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.rb).apply(null,arguments)},Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=a.asm.sb).apply(null,arguments)},Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL= -function(){return(Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.tb).apply(null,arguments)},Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.ub).apply(null,arguments)},Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=a.asm.vb).apply(null,arguments)},Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC= -function(){return(Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.wb).apply(null,arguments)},Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.xb).apply(null,arguments)},$c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return($c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=a.asm.yb).apply(null,arguments)},ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH= -function(){return(ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.zb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.Ab).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(cd=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.Bb).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(dd=a._emscripten_enum_draco_DataType_DT_UINT8= -a.asm.Cb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_INT16=function(){return(ed=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Db).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(fd=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Eb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(gd=a._emscripten_enum_draco_DataType_DT_INT32=a.asm.Fb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_UINT32= -function(){return(hd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Gb).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(id=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Hb).apply(null,arguments)},jd=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(jd=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Ib).apply(null,arguments)},kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=function(){return(kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Jb).apply(null, -arguments)},ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Kb).apply(null,arguments)},md=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(md=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Lb).apply(null,arguments)},nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=a.asm.Mb).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_OK=function(){return(od= -a._emscripten_enum_draco_StatusCode_OK=a.asm.Nb).apply(null,arguments)},pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Ob).apply(null,arguments)},qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Pb).apply(null,arguments)},rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=function(){return(rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER= -a.asm.Qb).apply(null,arguments)},sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Rb).apply(null,arguments)},td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Sb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Tb).apply(null,arguments)};a._free=function(){return(a._free=a.asm.Ub).apply(null,arguments)}; -var ya=function(){return(ya=a.asm.Vb).apply(null,arguments)};a.___start_em_js=15856;a.___stop_em_js=15954;var la;ia=function b(){la||ba();la||(ia=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0=r.size?(0>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;gb.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}(); -"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule); diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_decoder.js b/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_decoder.js deleted file mode 100644 index 7c84b0b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_decoder.js +++ /dev/null @@ -1,33 +0,0 @@ - -var DracoDecoderModule = (() => { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; - return ( -function(DracoDecoderModule = {}) { - -var Module=typeof DracoDecoderModule!="undefined"?DracoDecoderModule:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var isRuntimeInitialized=false;var isModuleParsed=false;Module["onRuntimeInitialized"]=function(){isRuntimeInitialized=true;if(isModuleParsed){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};Module["onModuleParsed"]=function(){isModuleParsed=true;if(isRuntimeInitialized){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}};function isVersionSupported(versionString){if(typeof versionString!=="string")return false;const version=versionString.split(".");if(version.length<2||version.length>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=5)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{var ret=tryParseAsDataURI(filename);if(ret){return binary?ret:ret.toString()}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{var ret=tryParseAsDataURI(filename);if(ret){onload(ret)}filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}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.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);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;var WebAssembly={Memory:function(opts){this.buffer=new ArrayBuffer(opts["initial"]*65536)},Module:function(binary){},Instance:function(module,info){this.exports=( -// EMSCRIPTEN_START_ASM -function instantiate(ia){function c(d){d.set=function(a,b){this[a]=b};d.get=function(a){return this[a]};return d}var e;var f=new Uint8Array(123);for(var a=25;a>=0;--a){f[48+a]=52+a;f[65+a]=a;f[97+a]=26+a}f[43]=62;f[47]=63;function l(m,n,o){var g,h,a=0,i=n,j=o.length,k=n+(j*3>>2)-(o[j-2]=="=")-(o[j-1]=="=");for(;a>4;if(i>2;if(i>2];o=F[c+12>>2];g=F[c+16>>2];a:{if((e|0)>=(o|0)&g>>>0>=I[c+8>>2]|(e|0)>(o|0)){break a}o=G[g+F[c>>2]|0];g=g+1|0;e=g?e:e+1|0;F[c+16>>2]=g;F[c+20>>2]=e;b:{switch(o|0){case 0:e=a;f=b;g=d;a=0;d=0;j=Z+-64|0;Z=j;F[j+56>>2]=0;F[j+48>>2]=0;F[j+52>>2]=0;F[j+40>>2]=0;F[j+44>>2]=0;F[j+32>>2]=0;F[j+36>>2]=0;F[j+24>>2]=0;F[j+28>>2]=0;F[j+16>>2]=0;F[j+20>>2]=0;F[j+8>>2]=0;F[j+12>>2]=0;c:{if(!Nd(j+8|0,c)){break c}if(!Md(j+8|0,c)|(F[j+20>>2]?0:e)){break c}hc(c,0,0);if(e){s=f<<2;t=F[j+36>>2];u=F[j+48>>2];x=F[j+24>>2];l=F[j+56>>2];i=F[j+52>>2];while(1){d:{if(l>>>0>16383){break d}while(1){if((i|0)<=0){break d}i=i-1|0;F[j+52>>2]=i;l=G[i+u|0]|l<<8;F[j+56>>2]=l;if(l>>>0<16384){continue}break}}a=l&4095;r=F[(a<<2)+x>>2];b=(r<<3)+t|0;l=(L(F[b>>2],l>>>12|0)+a|0)-F[b+4>>2]|0;F[j+56>>2]=l;if((f|0)>0){a=0;if(!G[c+36|0]|r>>>0>32){break c}o=d+f|0;e:{if(!r){ma(g+(d<<2)|0,0,s);break e}y=r&-2;z=r&1;b=F[c+32>>2];h=F[c+28>>2];q=F[c+24>>2];while(1){k=0;a=b;m=0;n=0;if((r|0)!=1){while(1){p=q+(a>>>3|0)|0;f:{if(p>>>0>=h>>>0){p=0;break f}p=G[p|0];b=a+1|0;F[c+32>>2]=b;p=p>>>(a&7)&1;a=b}p=p<>>3|0)|0;if(v>>>0>>0){m=G[v|0];b=a+1|0;F[c+32>>2]=b;m=m>>>(a&7)&1;a=b}v=k|1;k=k+2|0;m=p|m<>>3|0)|0;if(p>>>0>>0){p=G[p|0];b=a+1|0;F[c+32>>2]=b;a=p>>>(a&7)&1}else{a=0}m=a<>2]=m;d=d+1|0;if((o|0)!=(d|0)){continue}break}}d=o}w=f+w|0;if(e>>>0>w>>>0){continue}break}}D[c+36|0]=0;f=F[c+20>>2];a=0;m=F[c+32>>2]+7|0;a=m>>>0<7?1:a;m=a<<29|m>>>3;b=m+F[c+16>>2]|0;a=(a>>>3|0)+f|0;F[c+16>>2]=b;F[c+20>>2]=b>>>0>>0?a+1|0:a;a=1}b=F[j+36>>2];if(b){F[j+40>>2]=b;ja(b)}b=F[j+24>>2];if(b){F[j+28>>2]=b;ja(b)}b=F[j+8>>2];if(b){F[j+12>>2]=b;ja(b)}Z=j- -64|0;return a;case 1:break b;default:break a}}b=0;e=F[c+20>>2];o=F[c+12>>2];g=F[c+16>>2];g:{if((e|0)>=(o|0)&g>>>0>=I[c+8>>2]|(e|0)>(o|0)){break g}o=G[g+F[c>>2]|0];g=g+1|0;e=g?e:e+1|0;F[c+16>>2]=g;F[c+20>>2]=e;h:{switch(o-1|0){case 8:o=a;r=d;e=Z+-64|0;Z=e;F[e+56>>2]=0;F[e+48>>2]=0;F[e+52>>2]=0;F[e+40>>2]=0;F[e+44>>2]=0;F[e+32>>2]=0;F[e+36>>2]=0;F[e+24>>2]=0;F[e+28>>2]=0;F[e+16>>2]=0;F[e+20>>2]=0;F[e+8>>2]=0;F[e+12>>2]=0;h=e+8|0;i:{j:{if(!H[c+38>>1]){break j}if(!Ta(1,h+12|0,c)){break j}b=F[c+8>>2];d=F[c+16>>2];f=b-d|0;i=F[h+12>>2];b=F[c+12>>2]-(F[c+20>>2]+(b>>>0>>0)|0)|0;if(f>>>0>>6>>>0&(b|0)<=0|(b|0)<0){break j}b=F[h>>2];a=F[h+4>>2]-b>>2;k:{if(a>>>0>>0){qa(h,i-a|0);i=F[h+12>>2];break k}if(a>>>0<=i>>>0){break k}F[h+4>>2]=b+(i<<2)}g=1;if(!i){break i}f=F[c+16>>2];d=F[c+20>>2];s=F[h>>2];j=F[c+8>>2];n=F[c+12>>2];b=0;while(1){g=0;if((d|0)>=(n|0)&f>>>0>=j>>>0|(d|0)>(n|0)){break i}g=F[c>>2];p=G[g+f|0];a=d;f=f+1|0;a=f?a:a+1|0;F[c+16>>2]=f;d=a;F[c+20>>2]=a;a=p>>>2|0;l=0;l:{m:{n:{o:{t=p&3;switch(t|0){case 0:break m;case 3:break o;default:break n}}a=a+b|0;g=0;if(a>>>0>=i>>>0){break i}ma(s+(b<<2)|0,0,(p&252)+4|0);b=a;break l}while(1){if((f|0)==(j|0)&(d|0)==(n|0)){break j}i=G[f+g|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;a=i<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}F[s+(b<<2)>>2]=a}b=b+1|0;i=F[h+12>>2];if(b>>>0>>0){continue}break}a=h+16|0;n=F[h>>2];d=F[h+16>>2];b=F[h+20>>2]-d|0;p:{if(b>>>0<=32767){qa(a,8192-(b>>>2|0)|0);break p}if((b|0)==32768){break p}F[h+20>>2]=d+32768}d=h+28|0;b=F[d>>2];f=F[h+32>>2]-b>>3;q:{if(f>>>0>>0){_a(d,i-f|0);b=F[d>>2];break q}if(f>>>0>i>>>0){F[h+32>>2]=(i<<3)+b}if(!i){break j}}j=F[a>>2];f=0;d=0;while(1){g=n+(f<<2)|0;l=F[g>>2];h=(f<<3)+b|0;a=d;F[h+4>>2]=a;F[h>>2]=l;g=F[g>>2];d=g+a|0;if(d>>>0>8192){break j}r:{if(a>>>0>=d>>>0){break r}l=0;h=g&7;if(h){while(1){F[j+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(g-1>>>0<=6){break r}while(1){g=j+(a<<2)|0;F[g>>2]=f;F[g+28>>2]=f;F[g+24>>2]=f;F[g+20>>2]=f;F[g+16>>2]=f;F[g+12>>2]=f;F[g+8>>2]=f;F[g+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((i|0)!=(f|0)){continue}break}k=(d|0)==8192}g=k}s:{if(!g|(F[e+20>>2]?0:o)){break s}d=0;k=Z-16|0;Z=k;t:{if(!Sa(1,k+8|0,c)){break t}a=F[c+8>>2];f=F[c+16>>2];g=a-f|0;j=F[k+12>>2];i=F[c+20>>2];a=F[c+12>>2]-(i+(a>>>0>>0)|0)|0;b=F[k+8>>2];if((j|0)==(a|0)&g>>>0>>0|a>>>0>>0){break t}a=i+j|0;g=b+f|0;a=g>>>0>>0?a+1|0:a;F[c+16>>2]=g;F[c+20>>2]=a;if((b|0)<=0){break t}a=f+F[c>>2]|0;F[e+48>>2]=a;c=b-1|0;f=c+a|0;g=G[f|0];u:{if(g>>>0<=63){F[e+52>>2]=c;a=G[f|0]&63;break u}v:{switch((g>>>6|0)-1|0){case 0:if(b>>>0<2){break t}b=b-2|0;F[e+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8&16128|G[a|0];break u;case 1:if(b>>>0<3){break t}b=b-3|0;F[e+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];break u;default:break v}}b=b-4|0;F[e+52>>2]=b;a=a+b|0;a=(G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&1073741823}F[e+56>>2]=a+32768;d=a>>>0<8355840}Z=k+16|0;if(!d){break s}if(!o){m=1;break s}b=F[e+52>>2];a=F[e+56>>2];c=F[e+36>>2];d=F[e+48>>2];f=F[e+24>>2];while(1){w:{if(a>>>0>32767){break w}while(1){if((b|0)<=0){break w}b=b-1|0;F[e+52>>2]=b;a=G[b+d|0]|a<<8;F[e+56>>2]=a;if(a>>>0<32768){continue}break}}m=a&8191;k=F[f+(m<<2)>>2];g=c+(k<<3)|0;a=(L(F[g>>2],a>>>13|0)+m|0)-F[g+4>>2]|0;F[e+56>>2]=a;F[r+(q<<2)>>2]=k;m=1;q=q+1|0;if((o|0)!=(q|0)){continue}break}}a=F[e+36>>2];if(a){F[e+40>>2]=a;ja(a)}a=F[e+24>>2];if(a){F[e+28>>2]=a;ja(a)}a=F[e+8>>2];if(a){F[e+12>>2]=a;ja(a)}Z=e- -64|0;b=m;break g;case 9:o=a;r=d;g=Z+-64|0;Z=g;F[g+56>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;h=g+8|0;x:{y:{if(!H[c+38>>1]){break y}if(!Ta(1,h+12|0,c)){break y}b=F[c+8>>2];d=F[c+16>>2];f=b-d|0;i=F[h+12>>2];b=F[c+12>>2]-(F[c+20>>2]+(b>>>0>>0)|0)|0;if(f>>>0>>6>>>0&(b|0)<=0|(b|0)<0){break y}b=F[h>>2];a=F[h+4>>2]-b>>2;z:{if(a>>>0>>0){qa(h,i-a|0);i=F[h+12>>2];break z}if(a>>>0<=i>>>0){break z}F[h+4>>2]=b+(i<<2)}e=1;if(!i){break x}f=F[c+16>>2];d=F[c+20>>2];s=F[h>>2];j=F[c+8>>2];n=F[c+12>>2];b=0;while(1){e=0;if((d|0)>=(n|0)&f>>>0>=j>>>0|(d|0)>(n|0)){break x}t=F[c>>2];p=G[t+f|0];e=d;f=f+1|0;e=f?e:e+1|0;F[c+16>>2]=f;d=e;F[c+20>>2]=e;a=p>>>2|0;l=0;A:{B:{C:{D:{e=p&3;switch(e|0){case 0:break B;case 3:break D;default:break C}}a=a+b|0;e=0;if(a>>>0>=i>>>0){break x}ma(s+(b<<2)|0,0,(p&252)+4|0);b=a;break A}while(1){if((f|0)==(j|0)&(d|0)==(n|0)){break y}i=G[f+t|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;a=i<<(l<<3|6)|a;l=l+1|0;if((e|0)!=(l|0)){continue}break}}F[s+(b<<2)>>2]=a}b=b+1|0;i=F[h+12>>2];if(b>>>0>>0){continue}break}a=h+16|0;n=F[h>>2];d=F[h+16>>2];b=F[h+20>>2]-d|0;E:{if(b>>>0<=131071){qa(a,32768-(b>>>2|0)|0);break E}if((b|0)==131072){break E}F[h+20>>2]=d+131072}d=h+28|0;b=F[d>>2];f=F[h+32>>2]-b>>3;F:{if(f>>>0>>0){_a(d,i-f|0);b=F[d>>2];break F}if(f>>>0>i>>>0){F[h+32>>2]=(i<<3)+b}if(!i){break y}}j=F[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;l=F[e>>2];h=(f<<3)+b|0;a=d;F[h+4>>2]=a;F[h>>2]=l;e=F[e>>2];d=e+a|0;if(d>>>0>32768){break y}G:{if(a>>>0>=d>>>0){break G}l=0;h=e&7;if(h){while(1){F[j+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break G}while(1){e=j+(a<<2)|0;F[e>>2]=f;F[e+28>>2]=f;F[e+24>>2]=f;F[e+20>>2]=f;F[e+16>>2]=f;F[e+12>>2]=f;F[e+8>>2]=f;F[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((i|0)!=(f|0)){continue}break}k=(d|0)==32768}e=k}H:{if(!e|(F[g+20>>2]?0:o)){break H}d=0;f=Z-16|0;Z=f;I:{if(!Sa(1,f+8|0,c)){break I}e=F[c+8>>2];b=F[c+16>>2];k=e-b|0;j=F[f+12>>2];i=F[c+20>>2];e=F[c+12>>2]-(i+(b>>>0>e>>>0)|0)|0;a=F[f+8>>2];if((j|0)==(e|0)&k>>>0>>0|e>>>0>>0){break I}e=i+j|0;k=a+b|0;e=k>>>0>>0?e+1|0:e;F[c+16>>2]=k;F[c+20>>2]=e;if((a|0)<=0){break I}b=b+F[c>>2]|0;F[g+48>>2]=b;c=a-1|0;e=c+b|0;k=G[e|0];J:{if(k>>>0<=63){F[g+52>>2]=c;a=G[e|0]&63;break J}K:{switch((k>>>6|0)-1|0){case 0:if(a>>>0<2){break I}a=a-2|0;F[g+52>>2]=a;a=a+b|0;a=G[a+1|0]<<8&16128|G[a|0];break J;case 1:if(a>>>0<3){break I}a=a-3|0;F[g+52>>2]=a;a=a+b|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];break J;default:break K}}a=a-4|0;F[g+52>>2]=a;a=a+b|0;a=(G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&1073741823}F[g+56>>2]=a+131072;d=a>>>0<33423360}Z=f+16|0;if(!d){break H}if(!o){m=1;break H}b=F[g+52>>2];a=F[g+56>>2];c=F[g+36>>2];d=F[g+48>>2];f=F[g+24>>2];while(1){L:{if(a>>>0>131071){break L}while(1){if((b|0)<=0){break L}b=b-1|0;F[g+52>>2]=b;a=G[b+d|0]|a<<8;F[g+56>>2]=a;if(a>>>0<131072){continue}break}}m=a&32767;e=F[f+(m<<2)>>2];k=c+(e<<3)|0;a=(L(F[k>>2],a>>>15|0)+m|0)-F[k+4>>2]|0;F[g+56>>2]=a;F[r+(q<<2)>>2]=e;m=1;q=q+1|0;if((o|0)!=(q|0)){continue}break}}a=F[g+36>>2];if(a){F[g+40>>2]=a;ja(a)}a=F[g+24>>2];if(a){F[g+28>>2]=a;ja(a)}a=F[g+8>>2];if(a){F[g+12>>2]=a;ja(a)}Z=g- -64|0;b=m;break g;case 10:o=a;r=d;g=Z+-64|0;Z=g;F[g+56>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;h=g+8|0;M:{N:{if(!H[c+38>>1]){break N}if(!Ta(1,h+12|0,c)){break N}b=F[c+8>>2];d=F[c+16>>2];f=b-d|0;i=F[h+12>>2];b=F[c+12>>2]-(F[c+20>>2]+(b>>>0>>0)|0)|0;if(f>>>0>>6>>>0&(b|0)<=0|(b|0)<0){break N}b=F[h>>2];a=F[h+4>>2]-b>>2;O:{if(a>>>0>>0){qa(h,i-a|0);i=F[h+12>>2];break O}if(a>>>0<=i>>>0){break O}F[h+4>>2]=b+(i<<2)}e=1;if(!i){break M}f=F[c+16>>2];d=F[c+20>>2];s=F[h>>2];j=F[c+8>>2];n=F[c+12>>2];b=0;while(1){e=0;if((d|0)>=(n|0)&f>>>0>=j>>>0|(d|0)>(n|0)){break M}t=F[c>>2];p=G[t+f|0];a=d;f=f+1|0;a=f?a:a+1|0;F[c+16>>2]=f;d=a;F[c+20>>2]=a;a=p>>>2|0;l=0;P:{Q:{R:{S:{u=p&3;switch(u|0){case 0:break Q;case 3:break S;default:break R}}a=a+b|0;e=0;if(a>>>0>=i>>>0){break M}ma(s+(b<<2)|0,0,(p&252)+4|0);b=a;break P}while(1){if((f|0)==(j|0)&(d|0)==(n|0)){break N}i=G[f+t|0];e=d;f=f+1|0;e=f?e:e+1|0;F[c+16>>2]=f;d=e;F[c+20>>2]=e;a=i<<(l<<3|6)|a;l=l+1|0;if((u|0)!=(l|0)){continue}break}}F[s+(b<<2)>>2]=a}b=b+1|0;i=F[h+12>>2];if(b>>>0>>0){continue}break}a=h+16|0;n=F[h>>2];d=F[h+16>>2];b=F[h+20>>2]-d|0;T:{if(b>>>0<=262143){qa(a,65536-(b>>>2|0)|0);break T}if((b|0)==262144){break T}F[h+20>>2]=d+262144}d=h+28|0;b=F[d>>2];f=F[h+32>>2]-b>>3;U:{if(f>>>0>>0){_a(d,i-f|0);b=F[d>>2];break U}if(f>>>0>i>>>0){F[h+32>>2]=(i<<3)+b}if(!i){break N}}j=F[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;l=F[e>>2];h=(f<<3)+b|0;a=d;F[h+4>>2]=a;F[h>>2]=l;e=F[e>>2];d=e+a|0;if(d>>>0>65536){break N}V:{if(a>>>0>=d>>>0){break V}l=0;h=e&7;if(h){while(1){F[j+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break V}while(1){e=j+(a<<2)|0;F[e>>2]=f;F[e+28>>2]=f;F[e+24>>2]=f;F[e+20>>2]=f;F[e+16>>2]=f;F[e+12>>2]=f;F[e+8>>2]=f;F[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((i|0)!=(f|0)){continue}break}k=(d|0)==65536}e=k}W:{if(!e|(F[g+20>>2]?0:o)){break W}d=0;e=Z-16|0;Z=e;X:{if(!Sa(1,e+8|0,c)){break X}a=F[c+8>>2];f=F[c+16>>2];k=a-f|0;j=F[e+12>>2];i=F[c+20>>2];a=F[c+12>>2]-(i+(a>>>0>>0)|0)|0;b=F[e+8>>2];if((j|0)==(a|0)&k>>>0>>0|a>>>0>>0){break X}a=i+j|0;k=b+f|0;a=k>>>0>>0?a+1|0:a;F[c+16>>2]=k;F[c+20>>2]=a;if((b|0)<=0){break X}a=f+F[c>>2]|0;F[g+48>>2]=a;c=b-1|0;f=c+a|0;k=G[f|0];Y:{if(k>>>0<=63){F[g+52>>2]=c;a=G[f|0]&63;break Y}Z:{switch((k>>>6|0)-1|0){case 0:if(b>>>0<2){break X}b=b-2|0;F[g+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8&16128|G[a|0];break Y;case 1:if(b>>>0<3){break X}b=b-3|0;F[g+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];break Y;default:break Z}}b=b-4|0;F[g+52>>2]=b;a=a+b|0;a=(G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&1073741823}F[g+56>>2]=a+262144;d=a>>>0<66846720}Z=e+16|0;if(!d){break W}if(!o){m=1;break W}b=F[g+52>>2];a=F[g+56>>2];c=F[g+36>>2];d=F[g+48>>2];f=F[g+24>>2];while(1){_:{if(a>>>0>262143){break _}while(1){if((b|0)<=0){break _}b=b-1|0;F[g+52>>2]=b;a=G[b+d|0]|a<<8;F[g+56>>2]=a;if(a>>>0<262144){continue}break}}m=a&65535;e=F[f+(m<<2)>>2];k=c+(e<<3)|0;a=(L(F[k>>2],a>>>16|0)+m|0)-F[k+4>>2]|0;F[g+56>>2]=a;F[r+(q<<2)>>2]=e;m=1;q=q+1|0;if((o|0)!=(q|0)){continue}break}}a=F[g+36>>2];if(a){F[g+40>>2]=a;ja(a)}a=F[g+24>>2];if(a){F[g+28>>2]=a;ja(a)}a=F[g+8>>2];if(a){F[g+12>>2]=a;ja(a)}Z=g- -64|0;b=m;break g;case 11:o=a;r=d;g=Z+-64|0;Z=g;F[g+56>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;h=g+8|0;$:{aa:{if(!H[c+38>>1]){break aa}if(!Ta(1,h+12|0,c)){break aa}b=F[c+8>>2];d=F[c+16>>2];f=b-d|0;i=F[h+12>>2];b=F[c+12>>2]-(F[c+20>>2]+(b>>>0>>0)|0)|0;if(f>>>0>>6>>>0&(b|0)<=0|(b|0)<0){break aa}b=F[h>>2];a=F[h+4>>2]-b>>2;ba:{if(a>>>0>>0){qa(h,i-a|0);i=F[h+12>>2];break ba}if(a>>>0<=i>>>0){break ba}F[h+4>>2]=b+(i<<2)}e=1;if(!i){break $}f=F[c+16>>2];d=F[c+20>>2];s=F[h>>2];j=F[c+8>>2];n=F[c+12>>2];b=0;while(1){e=0;if((d|0)>=(n|0)&f>>>0>=j>>>0|(d|0)>(n|0)){break $}t=F[c>>2];p=G[t+f|0];e=d;f=f+1|0;e=f?e:e+1|0;F[c+16>>2]=f;d=e;F[c+20>>2]=e;a=p>>>2|0;l=0;ca:{da:{ea:{fa:{e=p&3;switch(e|0){case 0:break da;case 3:break fa;default:break ea}}a=a+b|0;e=0;if(a>>>0>=i>>>0){break $}ma(s+(b<<2)|0,0,(p&252)+4|0);b=a;break ca}while(1){if((f|0)==(j|0)&(d|0)==(n|0)){break aa}i=G[f+t|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;a=i<<(l<<3|6)|a;l=l+1|0;if((e|0)!=(l|0)){continue}break}}F[s+(b<<2)>>2]=a}b=b+1|0;i=F[h+12>>2];if(b>>>0>>0){continue}break}a=h+16|0;n=F[h>>2];d=F[h+16>>2];b=F[h+20>>2]-d|0;ga:{if(b>>>0<=1048575){qa(a,262144-(b>>>2|0)|0);break ga}if((b|0)==1048576){break ga}F[h+20>>2]=d- -1048576}d=h+28|0;b=F[d>>2];f=F[h+32>>2]-b>>3;ha:{if(f>>>0>>0){_a(d,i-f|0);b=F[d>>2];break ha}if(f>>>0>i>>>0){F[h+32>>2]=(i<<3)+b}if(!i){break aa}}j=F[a>>2];f=0;d=0;while(1){e=n+(f<<2)|0;l=F[e>>2];h=(f<<3)+b|0;a=d;F[h+4>>2]=a;F[h>>2]=l;e=F[e>>2];d=e+a|0;if(d>>>0>262144){break aa}ia:{if(a>>>0>=d>>>0){break ia}l=0;h=e&7;if(h){while(1){F[j+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(e-1>>>0<=6){break ia}while(1){e=j+(a<<2)|0;F[e>>2]=f;F[e+28>>2]=f;F[e+24>>2]=f;F[e+20>>2]=f;F[e+16>>2]=f;F[e+12>>2]=f;F[e+8>>2]=f;F[e+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((i|0)!=(f|0)){continue}break}k=(d|0)==262144}e=k}ja:{if(!e|(F[g+20>>2]?0:o)){break ja}d=0;f=Z-16|0;Z=f;ka:{if(!Sa(1,f+8|0,c)){break ka}e=F[c+8>>2];b=F[c+16>>2];k=e-b|0;j=F[f+12>>2];i=F[c+20>>2];e=F[c+12>>2]-(i+(b>>>0>e>>>0)|0)|0;a=F[f+8>>2];if((j|0)==(e|0)&k>>>0>>0|e>>>0>>0){break ka}e=i+j|0;k=a+b|0;e=k>>>0>>0?e+1|0:e;F[c+16>>2]=k;F[c+20>>2]=e;if((a|0)<=0){break ka}b=b+F[c>>2]|0;F[g+48>>2]=b;c=a-1|0;e=c+b|0;k=G[e|0];la:{if(k>>>0<=63){F[g+52>>2]=c;a=G[e|0]&63;break la}ma:{switch((k>>>6|0)-1|0){case 0:if(a>>>0<2){break ka}a=a-2|0;F[g+52>>2]=a;a=a+b|0;a=G[a+1|0]<<8&16128|G[a|0];break la;case 1:if(a>>>0<3){break ka}a=a-3|0;F[g+52>>2]=a;a=a+b|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];break la;default:break ma}}a=a-4|0;F[g+52>>2]=a;a=a+b|0;a=(G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&1073741823}F[g+56>>2]=a- -1048576;d=a>>>0<267386880}Z=f+16|0;if(!d){break ja}if(!o){m=1;break ja}b=F[g+52>>2];a=F[g+56>>2];c=F[g+36>>2];d=F[g+48>>2];f=F[g+24>>2];while(1){na:{if(a>>>0>1048575){break na}while(1){if((b|0)<=0){break na}b=b-1|0;F[g+52>>2]=b;a=G[b+d|0]|a<<8;F[g+56>>2]=a;if(a>>>0<1048576){continue}break}}m=a&262143;e=F[f+(m<<2)>>2];k=c+(e<<3)|0;a=(L(F[k>>2],a>>>18|0)+m|0)-F[k+4>>2]|0;F[g+56>>2]=a;F[r+(q<<2)>>2]=e;m=1;q=q+1|0;if((o|0)!=(q|0)){continue}break}}a=F[g+36>>2];if(a){F[g+40>>2]=a;ja(a)}a=F[g+24>>2];if(a){F[g+28>>2]=a;ja(a)}a=F[g+8>>2];if(a){F[g+12>>2]=a;ja(a)}Z=g- -64|0;b=m;break g;case 12:o=a;r=d;e=Z+-64|0;Z=e;F[e+56>>2]=0;F[e+48>>2]=0;F[e+52>>2]=0;F[e+40>>2]=0;F[e+44>>2]=0;F[e+32>>2]=0;F[e+36>>2]=0;F[e+24>>2]=0;F[e+28>>2]=0;F[e+16>>2]=0;F[e+20>>2]=0;F[e+8>>2]=0;F[e+12>>2]=0;h=e+8|0;oa:{pa:{if(!H[c+38>>1]){break pa}if(!Ta(1,h+12|0,c)){break pa}b=F[c+8>>2];d=F[c+16>>2];f=b-d|0;i=F[h+12>>2];b=F[c+12>>2]-(F[c+20>>2]+(b>>>0>>0)|0)|0;if(f>>>0>>6>>>0&(b|0)<=0|(b|0)<0){break pa}b=F[h>>2];a=F[h+4>>2]-b>>2;qa:{if(a>>>0>>0){qa(h,i-a|0);i=F[h+12>>2];break qa}if(a>>>0<=i>>>0){break qa}F[h+4>>2]=b+(i<<2)}g=1;if(!i){break oa}f=F[c+16>>2];d=F[c+20>>2];s=F[h>>2];j=F[c+8>>2];n=F[c+12>>2];b=0;while(1){g=0;if((d|0)>=(n|0)&f>>>0>=j>>>0|(d|0)>(n|0)){break oa}g=F[c>>2];p=G[g+f|0];a=d;f=f+1|0;a=f?a:a+1|0;F[c+16>>2]=f;d=a;F[c+20>>2]=a;a=p>>>2|0;l=0;ra:{sa:{ta:{ua:{t=p&3;switch(t|0){case 0:break sa;case 3:break ua;default:break ta}}a=a+b|0;g=0;if(a>>>0>=i>>>0){break oa}ma(s+(b<<2)|0,0,(p&252)+4|0);b=a;break ra}while(1){if((f|0)==(j|0)&(d|0)==(n|0)){break pa}i=G[f+g|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;a=i<<(l<<3|6)|a;l=l+1|0;if((t|0)!=(l|0)){continue}break}}F[s+(b<<2)>>2]=a}b=b+1|0;i=F[h+12>>2];if(b>>>0>>0){continue}break}a=h+16|0;n=F[h>>2];d=F[h+16>>2];b=F[h+20>>2]-d|0;va:{if(b>>>0<=2097151){qa(a,524288-(b>>>2|0)|0);break va}if((b|0)==2097152){break va}F[h+20>>2]=d+2097152}d=h+28|0;b=F[d>>2];f=F[h+32>>2]-b>>3;wa:{if(f>>>0>>0){_a(d,i-f|0);b=F[d>>2];break wa}if(f>>>0>i>>>0){F[h+32>>2]=(i<<3)+b}if(!i){break pa}}j=F[a>>2];f=0;d=0;while(1){g=n+(f<<2)|0;l=F[g>>2];h=(f<<3)+b|0;a=d;F[h+4>>2]=a;F[h>>2]=l;g=F[g>>2];d=g+a|0;if(d>>>0>524288){break pa}xa:{if(a>>>0>=d>>>0){break xa}l=0;h=g&7;if(h){while(1){F[j+(a<<2)>>2]=f;a=a+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(g-1>>>0<=6){break xa}while(1){g=j+(a<<2)|0;F[g>>2]=f;F[g+28>>2]=f;F[g+24>>2]=f;F[g+20>>2]=f;F[g+16>>2]=f;F[g+12>>2]=f;F[g+8>>2]=f;F[g+4>>2]=f;a=a+8|0;if((d|0)!=(a|0)){continue}break}}f=f+1|0;if((i|0)!=(f|0)){continue}break}k=(d|0)==524288}g=k}ya:{if(!g|(F[e+20>>2]?0:o)){break ya}d=0;k=Z-16|0;Z=k;za:{if(!Sa(1,k+8|0,c)){break za}a=F[c+8>>2];f=F[c+16>>2];g=a-f|0;j=F[k+12>>2];i=F[c+20>>2];a=F[c+12>>2]-(i+(a>>>0>>0)|0)|0;b=F[k+8>>2];if((j|0)==(a|0)&g>>>0>>0|a>>>0>>0){break za}a=i+j|0;g=b+f|0;a=g>>>0>>0?a+1|0:a;F[c+16>>2]=g;F[c+20>>2]=a;if((b|0)<=0){break za}a=f+F[c>>2]|0;F[e+48>>2]=a;c=b-1|0;f=c+a|0;g=G[f|0];Aa:{if(g>>>0<=63){F[e+52>>2]=c;a=G[f|0]&63;break Aa}Ba:{switch((g>>>6|0)-1|0){case 0:if(b>>>0<2){break za}b=b-2|0;F[e+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8&16128|G[a|0];break Aa;case 1:if(b>>>0<3){break za}b=b-3|0;F[e+52>>2]=b;a=a+b|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];break Aa;default:break Ba}}b=b-4|0;F[e+52>>2]=b;a=a+b|0;a=(G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24))&1073741823}F[e+56>>2]=a+2097152;d=a>>>0<534773760}Z=k+16|0;if(!d){break ya}if(!o){m=1;break ya}b=F[e+52>>2];a=F[e+56>>2];c=F[e+36>>2];d=F[e+48>>2];f=F[e+24>>2];while(1){Ca:{if(a>>>0>2097151){break Ca}while(1){if((b|0)<=0){break Ca}b=b-1|0;F[e+52>>2]=b;a=G[b+d|0]|a<<8;F[e+56>>2]=a;if(a>>>0<2097152){continue}break}}m=a&524287;k=F[f+(m<<2)>>2];g=c+(k<<3)|0;a=(L(F[g>>2],a>>>19|0)+m|0)-F[g+4>>2]|0;F[e+56>>2]=a;F[r+(q<<2)>>2]=k;m=1;q=q+1|0;if((o|0)!=(q|0)){continue}break}}a=F[e+36>>2];if(a){F[e+40>>2]=a;ja(a)}a=F[e+24>>2];if(a){F[e+28>>2]=a;ja(a)}a=F[e+8>>2];if(a){F[e+12>>2]=a;ja(a)}Z=e- -64|0;b=m;break g;case 17:b=Ld(a,c,d);break g;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:b=Z+-64|0;Z=b;F[b+56>>2]=0;F[b+48>>2]=0;F[b+52>>2]=0;F[b+40>>2]=0;F[b+44>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;F[b+24>>2]=0;F[b+28>>2]=0;F[b+16>>2]=0;F[b+20>>2]=0;F[b+8>>2]=0;F[b+12>>2]=0;Da:{if(!Nd(b+8|0,c)|(F[b+20>>2]?0:a)){break Da}if(!Md(b+8|0,c)){break Da}if(!a){f=1;break Da}m=F[b+52>>2];c=F[b+56>>2];e=F[b+36>>2];g=F[b+48>>2];o=F[b+24>>2];while(1){Ea:{if(c>>>0>16383){break Ea}while(1){if((m|0)<=0){break Ea}m=m-1|0;F[b+52>>2]=m;c=G[g+m|0]|c<<8;F[b+56>>2]=c;if(c>>>0<16384){continue}break}}f=c&4095;j=F[o+(f<<2)>>2];r=e+(j<<3)|0;c=(L(F[r>>2],c>>>12|0)+f|0)-F[r+4>>2]|0;F[b+56>>2]=c;F[(k<<2)+d>>2]=j;f=1;k=k+1|0;if((k|0)!=(a|0)){continue}break}}a=F[b+36>>2];if(a){F[b+40>>2]=a;ja(a)}a=F[b+24>>2];if(a){F[b+28>>2]=a;ja(a)}a=F[b+8>>2];if(a){F[b+12>>2]=a;ja(a)}Z=b- -64|0;b=f;break g;case 13:case 14:case 15:case 16:break h;default:break g}}b=Ld(a,c,d)}f=b}return f}function ih(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,J=0,K=0,M=0,N=0,O=0,P=0;u=Z+-64|0;Z=u;F[a+132>>2]=0;if(F[a+148>>2]){b=F[a+144>>2];if(b){while(1){f=F[b>>2];ja(b);b=f;if(b){continue}break}}b=0;F[a+144>>2]=0;f=F[a+140>>2];a:{if(!f){break a}if(f>>>0>=4){c=f&-4;while(1){e=b<<2;F[e+F[a+136>>2]>>2]=0;F[F[a+136>>2]+(e|4)>>2]=0;F[F[a+136>>2]+(e|8)>>2]=0;F[F[a+136>>2]+(e|12)>>2]=0;b=b+4|0;d=d+4|0;if((c|0)!=(d|0)){continue}break}}f=f&3;if(!f){break a}d=0;while(1){F[F[a+136>>2]+(b<<2)>>2]=0;b=b+1|0;d=d+1|0;if((f|0)!=(d|0)){continue}break}}F[a+148>>2]=0}b:{c:{if(!Da(1,u+60|0,F[F[a+4>>2]+32>>2])){break c}F[a+156>>2]=F[u+60>>2];if(!Da(1,u+56|0,F[F[a+4>>2]+32>>2])){break c}e=F[u+56>>2];if(e>>>0>1431655765|I[a+156>>2]>L(e,3)>>>0){break c}b=F[F[a+4>>2]+32>>2];c=F[b+8>>2];k=F[b+12>>2];d=F[b+20>>2];f=F[b+16>>2];if((k|0)<=(d|0)&f>>>0>=c>>>0|(d|0)>(k|0)){break c}k=G[f+F[b>>2]|0];f=f+1|0;d=f?d:d+1|0;F[b+16>>2]=f;F[b+20>>2]=d;if(!Da(1,u+52|0,b)){break c}q=F[u+52>>2];if(q>>>0>e>>>0|e>>>0>q+((q>>>0)/3|0)>>>0){break c}if(!Da(1,u+48|0,F[F[a+4>>2]+32>>2])){break c}d=F[u+48>>2];if(d>>>0>q>>>0){break c}F[a+28>>2]=F[a+24>>2];f=Zb(ka(88));b=F[a+8>>2];F[a+8>>2]=f;if(b){Za(b);if(!F[a+8>>2]){break c}}F[a+164>>2]=F[a+160>>2];Ib(a+160|0,e);F[a+176>>2]=F[a+172>>2];Ib(a+172|0,e);F[a- -64>>2]=0;F[a+92>>2]=-1;F[a+84>>2]=-1;F[a+88>>2]=-1;F[a+40>>2]=F[a+36>>2];F[a+52>>2]=F[a+48>>2];F[a+76>>2]=F[a+72>>2];A=a+216|0;Dd(A);Cd(A,k);if(!_c(F[a+8>>2],e,d+F[a+156>>2]|0)){break c}b=F[a+156>>2];D[u+8|0]=1;Ea(a+120|0,b+d|0,u+8|0);if((Bd(a,F[F[a+4>>2]+32>>2])|0)==-1){break c}c=a+232|0;b=c;F[b+144>>2]=a;f=F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2];f=F[f>>2]+F[f+16>>2]|0;e=F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2];e=F[e+8>>2]-F[e+16>>2]|0;O=b,P=H[F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2]+38>>1],E[O+38>>1]=P;F[b>>2]=f;F[b+16>>2]=0;F[b+20>>2]=0;F[b+8>>2]=e;F[b+12>>2]=0;O=b,P=$[F[F[a>>2]+36>>2]](a)|0,F[O+148>>2]=P;F[a+372>>2]=k;F[a+384>>2]=d+F[a+156>>2];K=Ja(u+8|0);k=K;f=0;j=Z-16|0;Z=j;d:{if(!Aa(b+80|0,b)){break d}if(!yd(c)){break d}b=F[c+4>>2];F[k>>2]=F[c>>2];F[k+4>>2]=b;b=F[c+36>>2];F[k+32>>2]=F[c+32>>2];F[k+36>>2]=b;b=F[c+28>>2];F[k+24>>2]=F[c+24>>2];F[k+28>>2]=b;b=F[c+20>>2];F[k+16>>2]=F[c+16>>2];F[k+20>>2]=b;b=F[c+12>>2];F[k+8>>2]=F[c+8>>2];F[k+12>>2]=b;F[c+176>>2]=2;F[c+180>>2]=7;b=F[c+152>>2];if((b|0)<0){break d}F[j+12>>2]=0;f=2;h=F[c+156>>2];e=F[c+160>>2]-h>>2;e:{if(e>>>0>>0){Fa(c+156|0,b-e|0,j+12|0);f=F[c+176>>2];d=F[c+180>>2];break e}d=7;if(b>>>0>=e>>>0){break e}F[c+160>>2]=h+(b<<2)}e=c+184|0;d=(d-f|0)+1|0;b=F[c+188>>2];f=F[c+184>>2];s=(b-f|0)/12|0;f:{if(d>>>0>s>>>0){h=0;b=d-s|0;o=F[e+8>>2];f=F[e+4>>2];g:{if(b>>>0<=(o-f|0)/12>>>0){if(b){b=L(b,12)-12|0;b=(b-((b>>>0)%12|0)|0)+12|0;f=ma(f,0,b)+b|0}F[e+4>>2]=f;break g}h:{i:{j:{s=F[e>>2];g=(f-s|0)/12|0;d=g+b|0;if(d>>>0<357913942){o=(o-s|0)/12|0;i=o<<1;o=o>>>0>=178956970?357913941:d>>>0>>0?i:d;if(o){if(o>>>0>=357913942){break j}h=ka(L(o,12))}d=L(g,12)+h|0;b=L(b,12)-12|0;g=(b-((b>>>0)%12|0)|0)+12|0;b=ma(d,0,g);g=b+g|0;h=L(o,12)+h|0;if((f|0)==(s|0)){break i}while(1){d=d-12|0;f=f-12|0;F[d>>2]=F[f>>2];F[d+4>>2]=F[f+4>>2];F[d+8>>2]=F[f+8>>2];F[f+8>>2]=0;F[f>>2]=0;F[f+4>>2]=0;if((f|0)!=(s|0)){continue}break}F[e+8>>2]=h;b=F[e+4>>2];F[e+4>>2]=g;f=F[e>>2];F[e>>2]=d;if((b|0)==(f|0)){break h}while(1){d=b-12|0;h=F[d>>2];if(h){F[b-8>>2]=h;ja(h)}b=d;if((f|0)!=(b|0)){continue}break}break h}break b}oa();v()}F[e+8>>2]=h;F[e+4>>2]=g;F[e>>2]=b}if(f){ja(f)}}d=F[c+188>>2];break f}if(d>>>0>=s>>>0){d=b;break f}d=f+L(d,12)|0;if((d|0)!=(b|0)){while(1){f=b-12|0;h=F[f>>2];if(h){F[b-8>>2]=h;ja(h)}b=f;if((d|0)!=(b|0)){continue}break}}F[c+188>>2]=d}s=c+196|0;f=F[c+184>>2];b=(d-f|0)/12|0;o=F[c+196>>2];h=F[c+200>>2]-o>>2;k:{if(b>>>0>h>>>0){qa(s,b-h|0);f=F[c+184>>2];d=F[c+188>>2];break k}if(b>>>0>=h>>>0){break k}F[c+200>>2]=o+(b<<2)}if((d|0)==(f|0)){f=1;break d}b=0;while(1){l:{if(!Da(1,j+8|0,k)){break l}f=F[j+8>>2];d=F[c+148>>2];if(f>>>0>(F[d+4>>2]-F[d>>2]>>2>>>0)/3>>>0){break l}if(f){g=L(b,12);h=g+F[e>>2]|0;d=F[h>>2];o=F[h+4>>2]-d>>2;m:{if(o>>>0>>0){qa(h,f-o|0);d=F[g+F[e>>2]>>2];break m}if(f>>>0>=o>>>0){break m}F[h+4>>2]=(f<<2)+d}mc(f,1,k,d);F[F[s>>2]+(b<<2)>>2]=f}f=1;b=b+1|0;if(b>>>0<(F[c+188>>2]-F[c+184>>2]|0)/12>>>0){continue}break d}break}f=0}Z=j+16|0;n:{if(!f){break n}e=0;c=0;d=0;b=0;k=0;f=0;s=0;o=0;l=Z-96|0;Z=l;F[l+72>>2]=0;F[l+64>>2]=0;F[l+68>>2]=0;F[l+48>>2]=0;F[l+52>>2]=0;F[l+40>>2]=0;F[l+44>>2]=0;F[l+56>>2]=1065353216;F[l+32>>2]=0;F[l+24>>2]=0;F[l+28>>2]=0;j=a;C=F[a+124>>2];o:{p:{q:{r:{s:{if((q|0)<=0){break s}J=j+232|0;M=F[j+216>>2]!=F[j+220>>2];B=1;t:{while(1){h=s;s=h+1|0;u:{v:{w:{g=F[j+404>>2];if((g|0)==-1){F[j+400>>2]=7;break w}a=-1;i=F[j+428>>2]+(g<<2)|0;m=F[i>>2];g=m-1|0;F[i>>2]=g;if((m|0)<=0){break r}g=F[F[F[j+416>>2]+L(F[j+404>>2],12)>>2]+(g<<2)>>2];if(g>>>0>4){break r}i=F[(g<<2)+8896>>2];F[j+400>>2]=i;if(!g){if((b|0)==(c|0)){break r}i=-1;m=F[j+8>>2];B=F[m+24>>2];t=c-4|0;e=F[t>>2];g=-1;x:{if((e|0)==-1){break x}p=e+1|0;p=(p>>>0)%3|0?p:e-2|0;g=-1;if((p|0)==-1){break x}g=F[F[m>>2]+(p<<2)>>2]}n=F[B+(g<<2)>>2];if((n|0)!=-1){i=n+1|0;i=(i>>>0)%3|0?i:n-2|0}if((e|0)!=-1&F[F[m+12>>2]+(e<<2)>>2]!=-1|(e|0)==(i|0)){break r}n=F[m+12>>2];if((i|0)!=-1&F[n+(i<<2)>>2]!=-1){break r}p=L(h,3);h=p+1|0;F[n+(e<<2)>>2]=h;x=h<<2;F[x+n>>2]=e;r=p+2|0;F[n+(i<<2)>>2]=r;w=r<<2;F[w+n>>2]=i;n=-1;h=-1;y:{if((e|0)==-1){break y}z:{if((e>>>0)%3|0){e=e-1|0;break z}e=e+2|0;h=-1;if((e|0)==-1){break y}}h=F[F[m>>2]+(e<<2)>>2]}e=h;A:{if((i|0)==-1){break A}h=i+1|0;h=(h>>>0)%3|0?h:i-2|0;if((h|0)==-1){break A}n=F[F[m>>2]+(h<<2)>>2]}if((e|0)==(g|0)|(g|0)==(n|0)){break r}a=F[m>>2];F[a+(p<<2)>>2]=g;F[a+x>>2]=n;F[a+w>>2]=e;if((e|0)!=-1){F[B+(e<<2)>>2]=r}a=F[j+120>>2]+(g>>>3&536870908)|0;e=F[a>>2];O=a,P=oi(g)&e,F[O>>2]=P;F[t>>2]=p;e=b;kc(J,p);break u}B:{switch(i-1|0){case 2:case 4:if((b|0)==(c|0)){break r}r=c-4|0;e=F[r>>2];i=F[j+8>>2];m=F[i+12>>2];if((e|0)!=-1&F[m+(e<<2)>>2]!=-1){break r}c=L(h,3);n=(g|0)==3;g=c+(n?2:1)|0;t=g<<2;F[t+m>>2]=e;F[m+(e<<2)>>2]=g;Ma(i+24|0,8324);p=F[j+8>>2];m=F[p+24>>2];if(F[p+28>>2]-m>>2>(C|0)){break r}a=F[p>>2];w=a+t|0;p=F[i+28>>2];i=F[i+24>>2];t=(p-i>>2)-1|0;F[w>>2]=t;if((i|0)!=(p|0)){F[m+(t<<2)>>2]=g}g=n?c:c+2|0;w=a+(c+n<<2)|0;C:{if((e|0)==-1){F[a+(g<<2)>>2]=-1;i=-1;break C}D:{E:{F:{if((e>>>0)%3|0){i=e-1|0;break F}i=e+2|0;if((i|0)==-1){break E}}i=F[a+(i<<2)>>2];F[a+(g<<2)>>2]=i;if((i|0)==-1){break D}F[m+(i<<2)>>2]=g;break D}F[a+(g<<2)>>2]=-1}i=e+1|0;e=(i>>>0)%3|0?i:e-2|0;i=-1;if((e|0)==-1){break C}i=F[a+(e<<2)>>2]}F[w>>2]=i;F[r>>2]=c;e=b;break v;case 6:break w;case 0:break B;default:break r}}if((e|0)==(c|0)){break r}f=c-4|0;m=F[f>>2];F[l+68>>2]=f;n=F[l+44>>2];G:{if(!n){break G}g=F[l+40>>2];p=ni(n)>>>0>1;a=h&n+2147483647;H:{if(!p){break H}a=h;if(a>>>0>>0){break H}a=(h>>>0)%(n>>>0)|0}i=a;a=F[g+(i<<2)>>2];if(!a){break G}a=F[a>>2];if(!a){break G}I:{if(!p){g=n-1|0;while(1){n=F[a+4>>2];J:{if((n|0)!=(h|0)){if((i|0)==(g&n)){break J}break G}if((h|0)==F[a+8>>2]){break I}}a=F[a>>2];if(a){continue}break}break G}while(1){g=F[a+4>>2];K:{if((g|0)!=(h|0)){if(g>>>0>=n>>>0){g=(g>>>0)%(n>>>0)|0}if((g|0)==(i|0)){break K}break G}if((h|0)==F[a+8>>2]){break I}}a=F[a>>2];if(a){continue}break}break G}if((f|0)!=(k|0)){F[f>>2]=F[a+12>>2];F[l+68>>2]=c;f=c;break G}b=k-e|0;c=b>>2;d=c+1|0;if(d>>>0>=1073741824){break b}f=b>>>1|0;d=b>>>0>=2147483644?1073741823:d>>>0>>0?f:d;if(d){if(d>>>0>=1073741824){break p}f=ka(d<<2)}else{f=0}b=f+(c<<2)|0;F[b>>2]=F[a+12>>2];d=f+(d<<2)|0;f=b+4|0;if((e|0)!=(k|0)){while(1){b=b-4|0;k=k-4|0;F[b>>2]=F[k>>2];if((e|0)!=(k|0)){continue}break}}F[l+72>>2]=d;F[l+68>>2]=f;F[l+64>>2]=b;if(e){ja(e)}e=b;k=d}if((e|0)==(f|0)){break t}x=f-4|0;a=F[x>>2];if((a|0)==(m|0)){break t}i=(a|0)==-1;g=F[j+8>>2];if(!i&F[F[g+12>>2]+(a<<2)>>2]!=-1){break t}n=F[g+12>>2];if((m|0)!=-1&F[n+(m<<2)>>2]!=-1){break t}p=L(h,3);t=p+2|0;F[n+(a<<2)>>2]=t;c=t<<2;F[c+n>>2]=a;h=p+1|0;F[n+(m<<2)>>2]=h;w=h<<2;F[w+n>>2]=m;L:{M:{N:{if(!i){if((a>>>0)%3|0){h=a-1|0;break N}h=a+2|0;if((h|0)!=-1){break N}i=F[g>>2];h=-1;break M}h=-1;i=F[g>>2];F[i+(p<<2)>>2]=-1;r=-1;break L}i=F[g>>2];h=F[i+(h<<2)>>2]}F[(p<<2)+i>>2]=h;r=a+1|0;a=(r>>>0)%3|0?r:a-2|0;r=-1;if((a|0)==-1){break L}r=F[(a<<2)+i>>2]}F[i+w>>2]=r;O:{if((m|0)==-1){F[c+i>>2]=-1;r=-1;c=-1;break O}P:{Q:{R:{if((m>>>0)%3|0){a=m-1|0;break R}a=m+2|0;if((a|0)==-1){break Q}}a=F[(a<<2)+i>>2];F[c+i>>2]=a;if((a|0)==-1){break P}F[F[g+24>>2]+(a<<2)>>2]=t;break P}F[c+i>>2]=-1}r=-1;a=m+1|0;a=(a>>>0)%3|0?a:m-2|0;c=-1;if((a|0)==-1){break O}r=F[(a<<2)+i>>2];c=a}a=F[j+388>>2];t=h<<2;m=a+t|0;w=a;a=r<<2;F[m>>2]=F[m>>2]+F[w+a>>2];w=a;a=F[g+24>>2];m=w+a|0;if((h|0)!=-1){F[a+t>>2]=F[m>>2]}a=c;while(1){if((a|0)!=-1){F[(a<<2)+i>>2]=h;t=a+1|0;a=(t>>>0)%3|0?t:a-2|0;g=-1;S:{if((a|0)==-1){break S}a=F[n+(a<<2)>>2];g=-1;if((a|0)==-1){break S}g=a+1|0;g=(g>>>0)%3|0?g:a-2|0}a=g;if((c|0)!=(a|0)){continue}break t}break}F[m>>2]=-1;T:{U:{if(M){break U}if((y|0)!=(z|0)){F[z>>2]=r;z=z+4|0;F[l+28>>2]=z;break U}a=y-o|0;g=a>>2;c=g+1|0;if(c>>>0>=1073741824){break T}h=a>>>1|0;h=a>>>0>=2147483644?1073741823:c>>>0>>0?h:c;if(h){if(h>>>0>=1073741824){break p}c=ka(h<<2)}else{c=0}a=c+(g<<2)|0;F[a>>2]=r;z=a+4|0;if((o|0)!=(y|0)){while(1){a=a-4|0;y=y-4|0;F[a>>2]=F[y>>2];if((o|0)!=(y|0)){continue}break}}y=c+(h<<2)|0;F[l+32>>2]=y;F[l+28>>2]=z;F[l+24>>2]=a;if(o){ja(o)}o=a}F[x>>2]=p;c=f;kc(J,p);break u}break b}g=F[j+8>>2];Ma(g+24|0,8324);a=-1;k=F[j+8>>2];f=L(h,3);i=F[g+28>>2];m=F[g+24>>2];n=i-m|0;g=n>>2;p=g-1|0;F[F[k>>2]+(f<<2)>>2]=p;Ma(k+24|0,8324);r=f+1|0;F[F[k>>2]+(r<<2)>>2]=(F[k+28>>2]-F[k+24>>2]>>2)-1;k=F[j+8>>2];Ma(k+24|0,8324);t=f+2|0;F[F[k>>2]+(t<<2)>>2]=(F[k+28>>2]-F[k+24>>2]>>2)-1;x=F[j+8>>2];k=F[x+24>>2];if(F[x+28>>2]-k>>2>(C|0)){break r}V:{W:{if((i|0)!=(m|0)){F[k+(p<<2)>>2]=f;a=0;if((n|0)==-4){break W}}F[k+(g<<2)>>2]=r;a=g+1|0;if((a|0)==-1){break V}}F[k+(a<<2)>>2]=t}if((d|0)!=(c|0)){F[c>>2]=f;f=c+4|0;F[l+68>>2]=f;k=d;break v}a=d-b|0;k=a>>2;e=k+1|0;if(e>>>0>=1073741824){break b}c=a>>>1|0;a=a>>>0>=2147483644?1073741823:e>>>0>>0?c:e;if(a){if(a>>>0>=1073741824){break p}c=ka(a<<2)}else{c=0}e=c+(k<<2)|0;F[e>>2]=f;k=c+(a<<2)|0;f=e+4|0;if((b|0)!=(d|0)){while(1){e=e-4|0;d=d-4|0;F[e>>2]=F[d>>2];if((b|0)!=(d|0)){continue}break}}F[l+72>>2]=k;F[l+68>>2]=f;F[l+64>>2]=e;if(b){ja(b)}d=k;b=e}kc(J,F[f-4>>2]);a=F[j+40>>2];X:{if((a|0)==F[j+36>>2]){break X}c=a-12|0;g=F[c+4>>2];h=q+(h^-1)|0;if(g>>>0>h>>>0){break t}if((g|0)!=(h|0)){break X}i=G[a-4|0];g=F[c>>2];F[j+40>>2]=c;if((g|0)<0){break t}m=f-4|0;a=F[m>>2];F[l+20>>2]=q+(g^-1);c=l+20|0;F[l+88>>2]=c;Fb(l,l+40|0,c,l+88|0);g=F[l>>2];Y:{if(i&1){c=-1;if((a|0)==-1){break Y}c=a+1|0;c=(c>>>0)%3|0?c:a-2|0;break Y}c=-1;if((a|0)==-1){break Y}c=a-1|0;if((a>>>0)%3|0){break Y}c=a+2|0}F[g+12>>2]=c;a=F[j+40>>2];if((a|0)==F[j+36>>2]){break X}while(1){c=a-12|0;g=F[c+4>>2];if(g>>>0>h>>>0){break t}if((g|0)!=(h|0)){break X}i=G[a-4|0];g=F[c>>2];F[j+40>>2]=c;if((g|0)<0){break t}a=F[m>>2];F[l+20>>2]=q+(g^-1);c=l+20|0;F[l+88>>2]=c;Fb(l,l+40|0,c,l+88|0);g=F[l>>2];Z:{if(i&1){c=-1;if((a|0)==-1){break Z}c=a+1|0;c=(c>>>0)%3|0?c:a-2|0;break Z}c=-1;if((a|0)==-1){break Z}c=a-1|0;if((a>>>0)%3|0){break Z}c=a+2|0}F[g+12>>2]=c;a=F[j+40>>2];if((a|0)!=F[j+36>>2]){continue}break}}c=f}B=(q|0)>(s|0);if((q|0)!=(s|0)){continue}break}s=q;break s}a=-1;if(B){break r}}a=-1;c=F[j+8>>2];if(F[c+28>>2]-F[c+24>>2]>>2>(C|0)){break r}if((b|0)!=(f|0)){m=j+72|0;k=j+60|0;n=j+312|0;while(1){f=f-4|0;q=F[f>>2];F[l+68>>2]=f;_:{if(wa(n)){g=F[j+8>>2];o=F[g>>2];if(((F[g+4>>2]-o>>2>>>0)/3|0)<=(s|0)){a=-1;break r}b=-1;i=F[g+24>>2];a=-1;$:{if((q|0)==-1){break $}e=q+1|0;e=(e>>>0)%3|0?e:q-2|0;a=-1;if((e|0)==-1){break $}a=F[o+(e<<2)>>2]}e=a;a=F[i+(e<<2)>>2];aa:{if((a|0)==-1){h=1;c=-1;break aa}h=1;c=-1;d=a+1|0;a=(d>>>0)%3|0?d:a-2|0;if((a|0)==-1){break aa}h=0;b=a+1|0;b=(b>>>0)%3|0?b:a-2|0;if((b|0)!=-1){c=F[o+(b<<2)>>2]}b=a}a=-1;d=-1;i=F[i+(c<<2)>>2];if((i|0)!=-1){d=i+1|0;d=(d>>>0)%3|0?d:i-2|0}if((b|0)==(q|0)|(d|0)==(q|0)|((q|0)!=-1&F[F[g+12>>2]+(q<<2)>>2]!=-1|(b|0)==(d|0))){break r}if(!h&F[F[g+12>>2]+(b<<2)>>2]!=-1){break r}h=-1;g=F[g+12>>2];i=-1;ba:{if((d|0)==-1){break ba}if(F[g+(d<<2)>>2]!=-1){break r}a=d+1|0;a=(a>>>0)%3|0?a:d-2|0;i=-1;if((a|0)==-1){break ba}i=F[o+(a<<2)>>2]}a=L(s,3);F[l>>2]=a;F[g+(a<<2)>>2]=q;F[g+(q<<2)>>2]=a;a=F[l>>2]+1|0;F[g+(a<<2)>>2]=b;F[g+(b<<2)>>2]=a;a=F[l>>2]+2|0;F[g+(a<<2)>>2]=d;F[g+(d<<2)>>2]=a;a=F[l>>2];F[o+(a<<2)>>2]=c;b=a+1|0;d=o+(b<<2)|0;F[d>>2]=i;q=a+2|0;o=o+(q<<2)|0;F[o>>2]=e;a=F[j+120>>2];e=b?c:-1;c=a+(e>>>3&536870908)|0;g=F[c>>2];O=c,P=oi(e)&g,F[O>>2]=P;h=(b|0)!=-1?F[d>>2]:h;b=a+(h>>>3&536870908)|0;d=F[b>>2];O=b,P=oi(h)&d,F[O>>2]=P;d=-1;d=(q|0)!=-1?F[o>>2]:d;a=a+(d>>>3&536870908)|0;b=F[a>>2];O=a,P=oi(d)&b,F[O>>2]=P;D[l+88|0]=1;wd(k,l+88|0);Ma(m,l);s=s+1|0;b=F[l+64>>2];break _}d=F[j+64>>2];a=F[j+68>>2];if((d|0)==a<<5){if((d+1|0)<0){break b}if(d>>>0<=1073741822){a=a<<6;d=(d&-32)+32|0;a=a>>>0>d>>>0?a:d}else{a=2147483647}$a(k,a);d=F[j+64>>2]}F[j+64>>2]=d+1;a=F[j+60>>2]+(d>>>3&536870908)|0;e=F[a>>2];O=a,P=oi(d)&e,F[O>>2]=P;d=F[j+76>>2];if((d|0)!=F[j+80>>2]){F[d>>2]=q;F[j+76>>2]=d+4;break _}c=F[m>>2];a=d-c|0;o=a>>2;e=o+1|0;if(e>>>0>=1073741824){break b}h=a>>>1|0;h=a>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(h){if(h>>>0>=1073741824){break p}a=ka(h<<2)}else{a=0}e=a+(o<<2)|0;F[e>>2]=q;q=e+4|0;if((d|0)!=(c|0)){while(1){e=e-4|0;d=d-4|0;F[e>>2]=F[d>>2];if((d|0)!=(c|0)){continue}break}}F[j+80>>2]=a+(h<<2);F[j+76>>2]=q;F[j+72>>2]=e;if(!c){break _}ja(c)}if((b|0)!=(f|0)){continue}break}c=F[j+8>>2]}a=-1;if(((F[c+4>>2]-F[c>>2]>>2>>>0)/3|0)!=(s|0)){break r}a=F[c+28>>2]-F[c+24>>2]>>2;f=F[l+24>>2];h=F[l+28>>2];if((f|0)==(h|0)){break q}while(1){b=F[f>>2];k=F[c+24>>2];d=a-1|0;e=k+(d<<2)|0;if(F[e>>2]==-1){while(1){d=a-2|0;a=a-1|0;e=k+(d<<2)|0;if(F[e>>2]==-1){continue}break}}if(b>>>0<=d>>>0){F[l>>2]=c;e=F[e>>2];D[l+12|0]=1;F[l+8>>2]=e;F[l+4>>2]=e;if((e|0)!=-1){while(1){e=F[F[j+8>>2]>>2]+(e<<2)|0;if(F[e>>2]!=(d|0)){a=-1;break r}F[e>>2]=b;nc(l);e=F[l+8>>2];if((e|0)!=-1){continue}break}c=F[j+8>>2]}k=F[c+24>>2];e=k+(d<<2)|0;if((b|0)!=-1){F[k+(b<<2)>>2]=F[e>>2]}F[e>>2]=-1;e=1<>2];b=k+(b>>>3&536870908)|0;k=k+(d>>>3&536870908)|0;d=1<>2]&d){e=e|F[b>>2]}else{e=F[b>>2]&(e^-1)}F[b>>2]=e;F[k>>2]=F[k>>2]&(d^-1);a=a-1|0}f=f+4|0;if((h|0)!=(f|0)){continue}break}}f=F[l+24>>2]}if(f){ja(f)}b=F[l+48>>2];if(b){while(1){d=F[b>>2];ja(b);b=d;if(b){continue}break}}b=F[l+40>>2];F[l+40>>2]=0;if(b){ja(b)}b=F[l+64>>2];if(b){F[l+68>>2]=b;ja(b)}Z=l+96|0;break o}oa();v()}f=a;if((a|0)==-1){break n}a=K;b=F[a+16>>2];d=b+F[a>>2]|0;b=F[a+8>>2]-b|0;a=F[F[j+4>>2]+32>>2];E[a+38>>1]=H[a+38>>1];F[a>>2]=d;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=b;F[a+12>>2]=0;ca:{if(F[j+216>>2]==F[j+220>>2]){break ca}a=F[j+8>>2];if(F[a+4>>2]==F[a>>2]){break ca}b=0;while(1){if(Ad(j,b)){b=b+3|0;a=F[j+8>>2];if(b>>>0>2]-F[a>>2]>>2>>>0){continue}break ca}break}break n}if(G[j+308|0]){D[j+308|0]=0;d=F[j+292>>2];a=0;e=F[j+304>>2]+7|0;a=e>>>0<7?1:a;e=a<<29|e>>>3;b=e+F[j+288>>2]|0;a=(a>>>3|0)+d|0;F[j+288>>2]=b;F[j+292>>2]=b>>>0>>0?a+1|0:a}b=F[j+216>>2];if((b|0)!=F[j+220>>2]){a=0;while(1){e=L(a,144);Zc((e+b|0)+4|0,F[j+8>>2]);d=F[A>>2];c=d+e|0;b=F[c+132>>2];c=F[c+136>>2];if((b|0)!=(c|0)){while(1){Xc((e+F[A>>2]|0)+4|0,F[b>>2]);b=b+4|0;if((c|0)!=(b|0)){continue}break}d=F[A>>2]}if(!Yc((d+e|0)+4|0)){break n}a=a+1|0;b=F[j+216>>2];if(a>>>0<(F[j+220>>2]-b|0)/144>>>0){continue}break}}a=F[j+8>>2];Hb(j+184|0,F[a+28>>2]-F[a+24>>2]>>2);d=F[j+216>>2];if((d|0)!=F[j+220>>2]){b=0;while(1){a=L(b,144)+d|0;d=F[a+60>>2]-F[a+56>>2]>>2;c=a+104|0;a=F[j+8>>2];a=F[a+28>>2]-F[a+24>>2]>>2;Hb(c,(a|0)<(d|0)?d:a);b=b+1|0;d=F[j+216>>2];if(b>>>0<(F[j+220>>2]-d|0)/144>>>0){continue}break}}N=zd(j,f)}}Z=u- -64|0;return N|0}na();v()}function lh(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,J=0,K=0,M=0,N=0;t=Z+-64|0;Z=t;F[a+132>>2]=0;if(F[a+148>>2]){c=F[a+144>>2];if(c){while(1){b=F[c>>2];ja(c);c=b;if(b){continue}break}}c=0;F[a+144>>2]=0;b=F[a+140>>2];a:{if(!b){break a}if(b>>>0>=4){h=b&-4;while(1){e=c<<2;F[e+F[a+136>>2]>>2]=0;F[F[a+136>>2]+(e|4)>>2]=0;F[F[a+136>>2]+(e|8)>>2]=0;F[F[a+136>>2]+(e|12)>>2]=0;c=c+4|0;g=g+4|0;if((h|0)!=(g|0)){continue}break}}b=b&3;if(!b){break a}g=0;while(1){F[F[a+136>>2]+(c<<2)>>2]=0;c=c+1|0;g=g+1|0;if((b|0)!=(g|0)){continue}break}}F[a+148>>2]=0}b:{if(!Da(1,t+60|0,F[F[a+4>>2]+32>>2])){break b}F[a+156>>2]=F[t+60>>2];if(!Da(1,t+56|0,F[F[a+4>>2]+32>>2])){break b}e=F[t+56>>2];if(e>>>0>1431655765|I[a+156>>2]>L(e,3)>>>0){break b}c=F[F[a+4>>2]+32>>2];h=F[c+8>>2];m=F[c+12>>2];b=F[c+20>>2];g=F[c+16>>2];if((m|0)<=(b|0)&g>>>0>=h>>>0|(b|0)>(m|0)){break b}h=G[g+F[c>>2]|0];g=g+1|0;b=g?b:b+1|0;F[c+16>>2]=g;F[c+20>>2]=b;if(!Da(1,t+52|0,c)){break b}n=F[t+52>>2];if(n>>>0>e>>>0|e>>>0>n+((n>>>0)/3|0)>>>0){break b}if(!Da(1,t+48|0,F[F[a+4>>2]+32>>2])){break b}c=F[t+48>>2];if(c>>>0>n>>>0){break b}F[a+28>>2]=F[a+24>>2];g=Zb(ka(88));b=F[a+8>>2];F[a+8>>2]=g;if(b){Za(b);if(!F[a+8>>2]){break b}}F[a+164>>2]=F[a+160>>2];Ib(a+160|0,e);F[a+176>>2]=F[a+172>>2];Ib(a+172|0,e);F[a- -64>>2]=0;F[a+92>>2]=-1;F[a+84>>2]=-1;F[a+88>>2]=-1;F[a+40>>2]=F[a+36>>2];F[a+52>>2]=F[a+48>>2];F[a+76>>2]=F[a+72>>2];y=a+216|0;Dd(y);Cd(y,h);if(!_c(F[a+8>>2],e,c+F[a+156>>2]|0)){break b}b=F[a+156>>2];D[t+8|0]=1;Ea(a+120|0,b+c|0,t+8|0);if((Bd(a,F[F[a+4>>2]+32>>2])|0)==-1){break b}c=a+232|0;F[c+144>>2]=a;b=F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2];b=F[b>>2]+F[b+16>>2]|0;g=F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2];g=F[g+8>>2]-F[g+16>>2]|0;M=c,N=H[F[($[F[F[a>>2]+32>>2]](a)|0)+32>>2]+38>>1],E[M+38>>1]=N;F[c>>2]=b;F[c+16>>2]=0;F[c+20>>2]=0;F[c+8>>2]=g;F[c+12>>2]=0;F[a+372>>2]=h;C=Ja(t+8|0);h=C;m=0;d=Z-16|0;Z=d;b=F[c+4>>2];F[c+40>>2]=F[c>>2];F[c+44>>2]=b;b=F[c+36>>2];F[c+72>>2]=F[c+32>>2];F[c+76>>2]=b;g=F[c+28>>2];b=c- -64|0;F[b>>2]=F[c+24>>2];F[b+4>>2]=g;b=F[c+20>>2];F[c+56>>2]=F[c+16>>2];F[c+60>>2]=b;b=F[c+12>>2];F[c+48>>2]=F[c+8>>2];F[c+52>>2]=b;c:{d:{if(hc(c+40|0,1,d+8|0)){b=F[c+44>>2];F[c>>2]=F[c+40>>2];F[c+4>>2]=b;b=F[c+76>>2];F[c+32>>2]=F[c+72>>2];F[c+36>>2]=b;b=F[c+68>>2];F[c+24>>2]=F[c+64>>2];F[c+28>>2]=b;g=F[c+60>>2];f=g;b=F[c+56>>2];F[c+16>>2]=b;F[c+20>>2]=g;e=F[c+52>>2];g=F[c+48>>2];F[c+8>>2]=g;F[c+12>>2]=e;k=F[d+12>>2];i=e-((b>>>0>g>>>0)+f|0)|0;e=g-b|0;g=F[d+8>>2];if((k|0)==(i|0)&e>>>0>=g>>>0|i>>>0>k>>>0){break d}}break c}e=f+k|0;b=b+g|0;e=b>>>0>>0?e+1|0:e;F[c+16>>2]=b;F[c+20>>2]=e;if(!Aa(c+80|0,c)){break c}if(!yd(c)){break c}b=F[c+4>>2];F[h>>2]=F[c>>2];F[h+4>>2]=b;b=F[c+36>>2];F[h+32>>2]=F[c+32>>2];F[h+36>>2]=b;b=F[c+28>>2];F[h+24>>2]=F[c+24>>2];F[h+28>>2]=b;b=F[c+20>>2];F[h+16>>2]=F[c+16>>2];F[h+20>>2]=b;b=F[c+12>>2];F[h+8>>2]=F[c+8>>2];F[h+12>>2]=b;m=1}Z=d+16|0;e:{if(!m){break e}b=0;c=0;g=0;m=0;j=Z-96|0;Z=j;F[j+72>>2]=0;F[j+64>>2]=0;F[j+68>>2]=0;F[j+48>>2]=0;F[j+52>>2]=0;F[j+40>>2]=0;F[j+44>>2]=0;F[j+56>>2]=1065353216;F[j+32>>2]=0;F[j+24>>2]=0;F[j+28>>2]=0;h=a;B=F[a+124>>2];f:{g:{h:{i:{j:{k:{l:{m:{if((n|0)<=0){break m}J=F[h+216>>2]!=F[h+220>>2];z=1;while(1){e=m;m=e+1|0;n:{o:{p:{q:{r:{s:{t:{u:{v:{w:{x:{y:{z:{A:{B:{if(!G[h+308|0]){break B}k=F[h+296>>2];d=F[h+304>>2];a=k+(d>>>3|0)|0;l=F[h+300>>2];if(a>>>0>=l>>>0){break B}f=G[a|0];a=d+1|0;F[h+304>>2]=a;p=f>>>(d&7)&1;if(!p){break B}i=0;f=a>>>3|0;r=k+f|0;C:{if(r>>>0>=l>>>0){d=a;a=0;break C}r=G[r|0];d=d+2|0;F[h+304>>2]=d;f=d>>>3|0;a=r>>>(a&7)&1}f=f+k|0;if(f>>>0>>0){f=G[f|0];F[h+304>>2]=d+1;i=f>>>(d&7)<<1&2}f=-1;i=p|(a|i)<<1;switch(i-1|0){case 6:break y;case 0:break z;case 2:case 4:break A;default:break l}}if((c|0)==(g|0)){f=-1;break l}d=-1;i=F[h+8>>2];z=F[i+24>>2];r=c-4|0;b=F[r>>2];a=-1;D:{if((b|0)==-1){break D}k=b+1|0;k=(k>>>0)%3|0?k:b-2|0;a=-1;if((k|0)==-1){break D}a=F[F[i>>2]+(k<<2)>>2]}f=F[z+(a<<2)>>2];if((f|0)!=-1){d=f+1|0;d=(d>>>0)%3|0?d:f-2|0}if((b|0)==(d|0)){f=-1;break l}if((b|0)!=-1){f=-1;if(F[F[i+12>>2]+(b<<2)>>2]!=-1){break l}}k=F[i+12>>2];if((d|0)!=-1){f=-1;if(F[k+(d<<2)>>2]!=-1){break l}}l=L(e,3);e=l+1|0;F[k+(b<<2)>>2]=e;s=e<<2;F[s+k>>2]=b;p=l+2|0;F[k+(d<<2)>>2]=p;u=p<<2;F[u+k>>2]=d;k=-1;e=-1;E:{if((b|0)==-1){break E}F:{if((b>>>0)%3|0){b=b-1|0;break F}b=b+2|0;e=-1;if((b|0)==-1){break E}}e=F[F[i>>2]+(b<<2)>>2]}b=e;G:{if((d|0)==-1){break G}e=d+1|0;e=(e>>>0)%3|0?e:d-2|0;if((e|0)==-1){break G}k=F[F[i>>2]+(e<<2)>>2]}f=-1;if((a|0)==(b|0)|(a|0)==(k|0)){break l}e=F[i>>2];F[e+(l<<2)>>2]=a;F[e+s>>2]=k;F[e+u>>2]=b;if((b|0)!=-1){F[z+(b<<2)>>2]=p}b=F[h+120>>2]+(a>>>3&536870908)|0;e=F[b>>2];M=b,N=oi(a)&e,F[M>>2]=N;F[r>>2]=l;b=g;break n}if((c|0)==(g|0)){break l}r=c-4|0;b=F[r>>2];a=F[h+8>>2];d=F[a+12>>2];if((b|0)!=-1&F[d+(b<<2)>>2]!=-1){break l}l=(i|0)==5;i=L(e,3);p=(l?2:1)+i|0;s=p<<2;F[s+d>>2]=b;F[d+(b<<2)>>2]=p;Ma(a+24|0,8324);d=F[h+8>>2];k=F[d+24>>2];if(F[d+28>>2]-k>>2>(B|0)){break l}d=F[d>>2];u=d+s|0;f=F[a+28>>2];a=F[a+24>>2];s=(f-a>>2)-1|0;F[u>>2]=s;if((a|0)!=(f|0)){F[k+(s<<2)>>2]=p}f=l?i:i+2|0;l=d+(i+l<<2)|0;H:{if((b|0)==-1){F[d+(f<<2)>>2]=-1;a=-1;break H}I:{J:{K:{if((b>>>0)%3|0){a=b-1|0;break K}a=b+2|0;if((a|0)==-1){break J}}a=F[d+(a<<2)>>2];F[d+(f<<2)>>2]=a;if((a|0)==-1){break I}F[k+(a<<2)>>2]=f;break I}F[d+(f<<2)>>2]=-1}f=b+1|0;b=(f>>>0)%3|0?f:b-2|0;a=-1;if((b|0)==-1){break H}a=F[d+(b<<2)>>2]}F[l>>2]=a;F[r>>2]=i;b=g;break t}if((b|0)==(c|0)){break l}a=c-4|0;k=F[a>>2];F[j+68>>2]=a;l=F[j+44>>2];L:{if(!l){c=a;break L}f=F[j+40>>2];p=ni(l)>>>0>1;d=e&l+2147483647;M:{if(!p){break M}d=e;if(d>>>0>>0){break M}d=(e>>>0)%(l>>>0)|0}i=d;d=F[f+(i<<2)>>2];if(!d){c=a;break L}d=F[d>>2];if(!d){c=a;break L}N:{if(!p){f=l-1|0;while(1){l=F[d+4>>2];O:{if((l|0)!=(e|0)){if((i|0)==(f&l)){break O}c=a;break L}if((e|0)==F[d+8>>2]){break N}}d=F[d>>2];if(d){continue}break}c=a;break L}while(1){f=F[d+4>>2];P:{if((f|0)!=(e|0)){if(f>>>0>=l>>>0){f=(f>>>0)%(l>>>0)|0}if((f|0)==(i|0)){break P}c=a;break L}if((e|0)==F[d+8>>2]){break N}}d=F[d>>2];if(d){continue}break}c=a;break L}if((a|0)!=(q|0)){F[a>>2]=F[d+12>>2];F[j+68>>2]=c;break L}a=q-b|0;g=a>>2;c=g+1|0;if(c>>>0>=1073741824){break x}f=a>>>1|0;f=a>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break j}a=ka(f<<2)}else{a=0}g=a+(g<<2)|0;F[g>>2]=F[d+12>>2];c=g+4|0;if((b|0)!=(q|0)){while(1){g=g-4|0;q=q-4|0;F[g>>2]=F[q>>2];if((b|0)!=(q|0)){continue}break}}q=a+(f<<2)|0;F[j+72>>2]=q;F[j+68>>2]=c;F[j+64>>2]=g;if(b){ja(b)}}if((c|0)==(g|0)){break p}s=c-4|0;b=F[s>>2];if((b|0)==(k|0)){break p}a=(b|0)==-1;f=F[h+8>>2];if(!a&F[F[f+12>>2]+(b<<2)>>2]!=-1){break p}l=F[f+12>>2];if((k|0)!=-1&F[l+(k<<2)>>2]!=-1){break p}p=L(e,3);r=p+2|0;F[l+(b<<2)>>2]=r;e=r<<2;F[e+l>>2]=b;d=p+1|0;F[l+(k<<2)>>2]=d;u=d<<2;F[u+l>>2]=k;if(a){break w}if((b>>>0)%3|0){d=b-1|0;break s}d=b+2|0;if((d|0)!=-1){break s}a=F[f>>2];d=-1;break r}i=F[h+8>>2];Ma(i+24|0,8324);d=F[h+8>>2];a=L(e,3);k=F[i+28>>2];l=F[i+24>>2];p=k-l|0;i=p>>2;r=i-1|0;F[F[d>>2]+(a<<2)>>2]=r;Ma(d+24|0,8324);s=a+1|0;F[F[d>>2]+(s<<2)>>2]=(F[d+28>>2]-F[d+24>>2]>>2)-1;d=F[h+8>>2];Ma(d+24|0,8324);u=a+2|0;F[F[d>>2]+(u<<2)>>2]=(F[d+28>>2]-F[d+24>>2]>>2)-1;A=F[h+8>>2];d=F[A+24>>2];if(F[A+28>>2]-d>>2>(B|0)){break l}Q:{R:{if((k|0)!=(l|0)){F[d+(r<<2)>>2]=a;f=0;if((p|0)==-4){break R}}F[d+(i<<2)>>2]=s;f=i+1|0;if((f|0)==-1){break Q}}F[d+(f<<2)>>2]=u}if((c|0)!=(q|0)){F[c>>2]=a;c=c+4|0;F[j+68>>2]=c;break t}g=c-b|0;i=g>>2;d=i+1|0;if(d>>>0>=1073741824){break v}f=g>>>1|0;d=g>>>0>=2147483644?1073741823:d>>>0>>0?f:d;if(d){if(d>>>0>=1073741824){break j}f=ka(d<<2)}else{f=0}g=f+(i<<2)|0;F[g>>2]=a;q=f+(d<<2)|0;a=g+4|0;if((b|0)!=(c|0)){while(1){g=g-4|0;c=c-4|0;F[g>>2]=F[c>>2];if((b|0)!=(c|0)){continue}break}}F[j+72>>2]=q;F[j+68>>2]=a;F[j+64>>2]=g;if(!b){break u}ja(b);break u}na();v()}d=-1;a=F[f>>2];F[a+(p<<2)>>2]=-1;i=-1;break q}na();v()}c=a;b=g}a=F[h+40>>2];if((a|0)==F[h+36>>2]){break n}d=a-12|0;i=F[d+4>>2];f=n+(e^-1)|0;if(i>>>0>f>>>0){break p}if((f|0)!=(i|0)){break n}i=G[a-4|0];e=F[d>>2];F[h+40>>2]=d;if((e|0)<0){break p}k=c-4|0;a=F[k>>2];F[j+20>>2]=n+(e^-1);e=j+20|0;F[j+88>>2]=e;Fb(j,j+40|0,e,j+88|0);d=F[j>>2];S:{if(i&1){e=-1;if((a|0)==-1){break S}e=a+1|0;e=(e>>>0)%3|0?e:a-2|0;break S}e=-1;if((a|0)==-1){break S}e=a-1|0;if((a>>>0)%3|0){break S}e=a+2|0}F[d+12>>2]=e;d=F[h+40>>2];if((d|0)==F[h+36>>2]){break n}while(1){a=d-12|0;e=F[a+4>>2];if(e>>>0>f>>>0){break p}if((f|0)!=(e|0)){break n}d=G[d-4|0];e=F[a>>2];F[h+40>>2]=a;if((e|0)<0){break p}a=F[k>>2];F[j+20>>2]=n+(e^-1);e=j+20|0;F[j+88>>2]=e;Fb(j,j+40|0,e,j+88|0);i=F[j>>2];T:{if(d&1){e=-1;if((a|0)==-1){break T}e=a+1|0;e=(e>>>0)%3|0?e:a-2|0;break T}e=-1;if((a|0)==-1){break T}e=a-1|0;if((a>>>0)%3|0){break T}e=a+2|0}F[i+12>>2]=e;d=F[h+40>>2];if((d|0)!=F[h+36>>2]){continue}break}break n}a=F[f>>2];d=F[a+(d<<2)>>2]}F[(p<<2)+a>>2]=d;A=b+1|0;b=(A>>>0)%3|0?A:b-2|0;i=-1;if((b|0)==-1){break q}i=F[(b<<2)+a>>2]}F[a+u>>2]=i;U:{if((k|0)==-1){F[a+e>>2]=-1;i=-1;e=-1;break U}V:{W:{X:{if((k>>>0)%3|0){b=k-1|0;break X}b=k+2|0;if((b|0)==-1){break W}}b=F[(b<<2)+a>>2];F[a+e>>2]=b;if((b|0)==-1){break V}F[F[f+24>>2]+(b<<2)>>2]=r;break V}F[a+e>>2]=-1}i=-1;b=k+1|0;b=(b>>>0)%3|0?b:k-2|0;e=-1;if((b|0)==-1){break U}i=F[(b<<2)+a>>2];e=b}b=F[f+24>>2];k=b+(i<<2)|0;if((d|0)!=-1){F[b+(d<<2)>>2]=F[k>>2]}b=e;while(1){if((b|0)==-1){break o}F[(b<<2)+a>>2]=d;r=b+1|0;b=(r>>>0)%3|0?r:b-2|0;f=-1;Y:{if((b|0)==-1){break Y}b=F[l+(b<<2)>>2];f=-1;if((b|0)==-1){break Y}f=b+1|0;f=(f>>>0)%3|0?f:b-2|0}b=f;if((e|0)!=(b|0)){continue}break}}f=-1;if(!z){break m}break l}F[k>>2]=-1;Z:{if(J){break Z}if((w|0)!=(x|0)){F[x>>2]=i;x=x+4|0;F[j+28>>2]=x;break Z}a=w-o|0;d=a>>2;b=d+1|0;if(b>>>0>=1073741824){break i}e=a>>>1|0;e=a>>>0>=2147483644?1073741823:b>>>0>>0?e:b;if(e){if(e>>>0>=1073741824){break j}a=ka(e<<2)}else{a=0}b=a+(d<<2)|0;F[b>>2]=i;x=b+4|0;if((o|0)!=(w|0)){while(1){b=b-4|0;w=w-4|0;F[b>>2]=F[w>>2];if((o|0)!=(w|0)){continue}break}}w=a+(e<<2)|0;F[j+32>>2]=w;F[j+28>>2]=x;F[j+24>>2]=b;if(o){ja(o)}o=b}F[s>>2]=p;b=g}z=(m|0)<(n|0);if((m|0)!=(n|0)){continue}break}m=n}f=-1;a=F[h+8>>2];if(F[a+28>>2]-F[a+24>>2]>>2>(B|0)){break l}if((c|0)!=(g|0)){l=h+72|0;e=h+60|0;w=h+312|0;while(1){c=c-4|0;i=F[c>>2];F[j+68>>2]=c;_:{if(wa(w)){q=F[h+8>>2];k=F[q>>2];if(((F[q+4>>2]-k>>2>>>0)/3|0)<=(m|0)){f=-1;break l}a=-1;f=-1;b=-1;x=F[q+24>>2];g=-1;$:{if((i|0)==-1){break $}n=i+1|0;n=(n>>>0)%3|0?n:i-2|0;g=-1;if((n|0)==-1){break $}g=F[k+(n<<2)>>2]}n=g;o=F[x+(n<<2)>>2];aa:{if((o|0)==-1){d=1;g=-1;break aa}d=1;p=o+1|0;o=(p>>>0)%3|0?p:o-2|0;g=-1;if((o|0)==-1){break aa}d=0;a=o;g=a+1|0;g=(g>>>0)%3|0?g:a-2|0;if((g|0)!=-1){g=F[k+(g<<2)>>2]}else{g=-1}}o=F[(g<<2)+x>>2];if((o|0)!=-1){b=o+1|0;b=(b>>>0)%3|0?b:o-2|0}if((a|0)==(i|0)|(b|0)==(i|0)|((i|0)!=-1&F[F[q+12>>2]+(i<<2)>>2]!=-1|(a|0)==(b|0))){break l}if(!d&F[F[q+12>>2]+(a<<2)>>2]!=-1){break l}d=-1;o=F[q+12>>2];q=-1;ba:{if((b|0)==-1){break ba}if(F[o+(b<<2)>>2]!=-1){break l}f=b+1|0;f=(f>>>0)%3|0?f:b-2|0;q=-1;if((f|0)==-1){break ba}q=F[k+(f<<2)>>2]}f=L(m,3);F[j>>2]=f;F[o+(f<<2)>>2]=i;F[o+(i<<2)>>2]=f;f=F[j>>2]+1|0;F[o+(f<<2)>>2]=a;F[o+(a<<2)>>2]=f;a=F[j>>2]+2|0;F[o+(a<<2)>>2]=b;F[o+(b<<2)>>2]=a;a=F[j>>2];F[k+(a<<2)>>2]=g;b=a+1|0;f=k+(b<<2)|0;F[f>>2]=q;o=a+2|0;i=k+(o<<2)|0;F[i>>2]=n;a=F[h+120>>2];g=b?g:-1;n=a+(g>>>3&536870908)|0;k=F[n>>2];M=n,N=oi(g)&k,F[M>>2]=N;d=(b|0)!=-1?F[f>>2]:d;b=a+(d>>>3&536870908)|0;g=F[b>>2];M=b,N=oi(d)&g,F[M>>2]=N;b=-1;b=(o|0)!=-1?F[i>>2]:b;a=a+(b>>>3&536870908)|0;g=F[a>>2];M=a,N=oi(b)&g,F[M>>2]=N;D[j+88|0]=1;wd(e,j+88|0);Ma(l,j);m=m+1|0;g=F[j+64>>2];break _}b=F[h+64>>2];a=F[h+68>>2];if((b|0)==a<<5){if((b+1|0)<0){break h}if(b>>>0<=1073741822){a=a<<6;b=(b&-32)+32|0;a=a>>>0>b>>>0?a:b}else{a=2147483647}$a(e,a);b=F[h+64>>2]}F[h+64>>2]=b+1;a=F[h+60>>2]+(b>>>3&536870908)|0;d=F[a>>2];M=a,N=oi(b)&d,F[M>>2]=N;b=F[h+76>>2];if((b|0)!=F[h+80>>2]){F[b>>2]=i;F[h+76>>2]=b+4;break _}f=F[l>>2];a=b-f|0;o=a>>2;d=o+1|0;if(d>>>0>=1073741824){break g}n=a>>>1|0;n=a>>>0>=2147483644?1073741823:d>>>0>>0?n:d;if(n){if(n>>>0>=1073741824){break j}a=ka(n<<2)}else{a=0}d=a+(o<<2)|0;F[d>>2]=i;o=d+4|0;if((b|0)!=(f|0)){while(1){d=d-4|0;b=b-4|0;F[d>>2]=F[b>>2];if((b|0)!=(f|0)){continue}break}}F[h+80>>2]=a+(n<<2);F[h+76>>2]=o;F[h+72>>2]=d;if(!f){break _}ja(f)}if((c|0)!=(g|0)){continue}break}a=F[h+8>>2]}f=-1;if(((F[a+4>>2]-F[a>>2]>>2>>>0)/3|0)!=(m|0)){break l}f=F[a+28>>2]-F[a+24>>2]>>2;c=F[j+24>>2];n=F[j+28>>2];if((c|0)==(n|0)){break k}while(1){g=F[c>>2];e=F[a+24>>2];b=f-1|0;d=e+(b<<2)|0;if(F[d>>2]==-1){while(1){b=f-2|0;f=f-1|0;d=e+(b<<2)|0;if(F[d>>2]==-1){continue}break}}if(b>>>0>=g>>>0){F[j>>2]=a;d=F[d>>2];D[j+12|0]=1;F[j+8>>2]=d;F[j+4>>2]=d;if((d|0)!=-1){while(1){a=F[F[h+8>>2]>>2]+(d<<2)|0;if(F[a>>2]!=(b|0)){f=-1;break l}F[a>>2]=g;nc(j);d=F[j+8>>2];if((d|0)!=-1){continue}break}a=F[h+8>>2]}m=F[a+24>>2];e=m+(b<<2)|0;if((g|0)!=-1){F[m+(g<<2)>>2]=F[e>>2]}F[e>>2]=-1;e=1<>2];g=m+(g>>>3&536870908)|0;d=1<>>3&536870908)|0;if(d&F[m>>2]){b=e|F[g>>2]}else{b=F[g>>2]&(e^-1)}F[g>>2]=b;F[m>>2]=F[m>>2]&(d^-1);f=f-1|0}c=c+4|0;if((n|0)!=(c|0)){continue}break}}c=F[j+24>>2]}if(c){ja(c)}a=F[j+48>>2];if(a){while(1){c=F[a>>2];ja(a);a=c;if(a){continue}break}}a=F[j+40>>2];F[j+40>>2]=0;if(a){ja(a)}a=F[j+64>>2];if(a){F[j+68>>2]=a;ja(a)}Z=j+96|0;a=f;break f}oa();v()}na();v()}na();v()}na();v()}b=a;if((a|0)==-1){break e}a=C;c=F[a+16>>2];g=c+F[a>>2]|0;c=F[a+8>>2]-c|0;a=F[F[h+4>>2]+32>>2];E[a+38>>1]=H[a+38>>1];F[a>>2]=g;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=c;F[a+12>>2]=0;ca:{if(F[h+216>>2]==F[h+220>>2]){break ca}a=F[h+8>>2];if(F[a+4>>2]==F[a>>2]){break ca}c=0;while(1){if(Ad(h,c)){c=c+3|0;a=F[h+8>>2];if(c>>>0>2]-F[a>>2]>>2>>>0){continue}break ca}break}break e}if(G[h+308|0]){D[h+308|0]=0;g=F[h+292>>2];a=0;e=F[h+304>>2]+7|0;a=e>>>0<7?1:a;c=a>>>3|0;m=a<<29|e>>>3;a=m+F[h+288>>2]|0;e=c+g|0;F[h+288>>2]=a;F[h+292>>2]=a>>>0>>0?e+1|0:e}c=F[h+216>>2];if((c|0)!=F[h+220>>2]){a=0;while(1){e=L(a,144);Zc((e+c|0)+4|0,F[h+8>>2]);g=F[y>>2];m=g+e|0;c=F[m+132>>2];m=F[m+136>>2];if((c|0)!=(m|0)){while(1){Xc((e+F[y>>2]|0)+4|0,F[c>>2]);c=c+4|0;if((m|0)!=(c|0)){continue}break}g=F[y>>2]}if(!Yc((g+e|0)+4|0)){break e}a=a+1|0;c=F[h+216>>2];if(a>>>0<(F[h+220>>2]-c|0)/144>>>0){continue}break}}a=F[h+8>>2];Hb(h+184|0,F[a+28>>2]-F[a+24>>2]>>2);g=F[h+216>>2];if((g|0)!=F[h+220>>2]){c=0;while(1){a=L(c,144)+g|0;g=F[a+60>>2]-F[a+56>>2]>>2;e=a+104|0;a=F[h+8>>2];a=F[a+28>>2]-F[a+24>>2]>>2;Hb(e,(a|0)<(g|0)?g:a);c=c+1|0;g=F[h+216>>2];if(c>>>0<(F[h+220>>2]-g|0)/144>>>0){continue}break}}K=zd(h,b)}}Z=t- -64|0;return K|0}function Cf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,H=0,I=0,J=0,K=0,M=0,N=0,O=0;B=c;c=0;m=Z-96|0;Z=m;l=m+16|0;ma(l,0,76);F[m+92>>2]=-1;F[m+8>>2]=0;F[m>>2]=0;F[m+4>>2]=0;r=Z-16|0;Z=r;F[l+68>>2]=0;F[l+72>>2]=0;F[l>>2]=b;s=Z-16|0;Z=s;u=b;a=F[b+20>>2];a:{if((F[b+24>>2]-a|0)<=0){break a}a=F[a>>2];if((a|0)==-1){break a}c=F[F[u+8>>2]+(a<<2)>>2]}b:{c:{d:{if(!c){a=0;break d}a=F[u+100>>2];e=F[u+96>>2];F[s+8>>2]=0;F[s>>2]=0;F[s+4>>2]=0;f=a-e|0;b=(f|0)/12|0;e:{if((a|0)==(e|0)){break e}if(b>>>0>=357913942){break c}d=ka(f);F[s>>2]=d;F[s+8>>2]=d+L(b,12);a=0;n=d;f=f-12|0;d=(f-((f>>>0)%12|0)|0)+12|0;f=ma(n,0,d);F[s+4>>2]=d+f;if(G[c+84|0]){c=b>>>0<=1?1:b;h=c&1;if(b>>>0>=2){g=c&-2;c=0;while(1){d=L(a,12);b=d+e|0;i=F[b+4>>2];j=F[b>>2];d=d+f|0;F[d+8>>2]=F[b+8>>2];F[d>>2]=j;F[d+4>>2]=i;d=L(a|1,12);b=d+e|0;i=F[b+4>>2];j=F[b>>2];d=d+f|0;F[d+8>>2]=F[b+8>>2];F[d>>2]=j;F[d+4>>2]=i;a=a+2|0;c=c+2|0;if((g|0)!=(c|0)){continue}break}}if(!h){break e}b=L(a,12);a=b+e|0;c=F[a+4>>2];e=F[a>>2];b=b+f|0;F[b+8>>2]=F[a+8>>2];F[b>>2]=e;F[b+4>>2]=c;break e}h=b>>>0<=1?1:b;a=F[c+68>>2];c=0;while(1){d=L(c,12);b=d+e|0;g=F[a+(F[b>>2]<<2)>>2];i=F[a+(F[b+4>>2]<<2)>>2];d=d+f|0;F[d+8>>2]=F[a+(F[b+8>>2]<<2)>>2];F[d+4>>2]=i;F[d>>2]=g;c=c+1|0;if((h|0)!=(c|0)){continue}break}}d=0;H=Z-16|0;Z=H;h=ka(88);Zb(h);C=Z-16|0;Z=C;F[h+80>>2]=0;F[h+84>>2]=0;a=F[h+76>>2];F[h+76>>2]=0;if(a){ja(a)}F[h+68>>2]=0;F[h+72>>2]=0;b=h- -64|0;a=F[b>>2];F[b>>2]=0;if(a){ja(a)}g=F[s+4>>2];b=F[s>>2];c=(g-b|0)/12|0;a=L(c,3);f=F[h>>2];e=F[h+4>>2]-f>>2;f:{if(a>>>0>e>>>0){nd(h,a-e|0);g=F[s+4>>2];b=F[s>>2];c=(g-b|0)/12|0;break f}if(a>>>0>=e>>>0){break f}F[h+4>>2]=f+(a<<2)}g:{if((b|0)==(g|0)){break g}e=c>>>0<=1?1:c;g=e&1;a=F[h>>2];if(c>>>0>=2){i=e&-2;c=0;while(1){e=L(d,12);j=e+a|0;f=b+e|0;F[j>>2]=F[f>>2];F[a+(e|4)>>2]=F[f+4>>2];F[j+8>>2]=F[f+8>>2];f=L(d|1,12);e=f+a|0;f=b+f|0;F[e>>2]=F[f>>2];F[e+4>>2]=F[f+4>>2];F[e+8>>2]=F[f+8>>2];d=d+2|0;c=c+2|0;if((i|0)!=(c|0)){continue}break}}if(!g){break g}c=L(d,12);a=c+a|0;b=b+c|0;F[a>>2]=F[b>>2];F[a+4>>2]=F[b+4>>2];F[a+8>>2]=F[b+8>>2]}F[C+12>>2]=-1;a=0;e=0;g=0;f=Z-32|0;Z=f;h:{i:{w=C+12|0;j:{if(!w){break j}c=F[h+4>>2];j=F[h>>2];d=c-j|0;i=d>>2;n=F[h+12>>2];b=F[h+16>>2]-n>>2;k:{if(i>>>0>b>>>0){ab(h+12|0,i-b|0,10228);c=F[h+4>>2];j=F[h>>2];d=c-j|0;i=d>>2;break k}if(b>>>0<=i>>>0){break k}F[h+16>>2]=n+(i<<2)}F[f+24>>2]=0;F[f+16>>2]=0;F[f+20>>2]=0;b=(c|0)==(j|0);if(!b){if((d|0)<0){break i}e=ka(d);F[f+20>>2]=e;F[f+16>>2]=e;F[f+24>>2]=(i<<2)+e}l:{m:{n:{o:{p:{if(d){while(1){i=F[(a<<2)+j>>2];b=F[f+20>>2]-e>>2;q:{if(i>>>0>>0){break q}F[f>>2]=0;d=i+1|0;if(d>>>0>b>>>0){Fa(f+16|0,d-b|0,f);j=F[h>>2];c=F[h+4>>2];e=F[f+16>>2];break q}if(b>>>0<=d>>>0){break q}F[f+20>>2]=(d<<2)+e}b=(i<<2)+e|0;F[b>>2]=F[b>>2]+1;a=a+1|0;d=c-j|0;i=d>>2;if(a>>>0>>0){continue}break}break p}d=0;if(!b){break o}break n}if((c|0)==(j|0)){d=0;break n}if(d>>>0>=2147483645){break m}}d=ka(d<<1);ma(d,255,i<<3)}F[f+8>>2]=0;F[f>>2]=0;F[f+4>>2]=0;b=F[f+20>>2];a=b-e|0;t=a>>2;r:{s:{if((b|0)==(e|0)){break s}if((a|0)<0){break r}q=ka(a);F[f>>2]=q;F[f+8>>2]=(t<<2)+q;b=ma(q,0,a);F[f+4>>2]=b+a;c=t>>>0<=1?1:t;n=c&3;a=0;if(c-1>>>0>=3){o=c&-4;while(1){c=g<<2;F[c+b>>2]=a;x=c|4;a=F[c+e>>2]+a|0;F[x+b>>2]=a;y=c|8;a=a+F[e+x>>2]|0;F[y+b>>2]=a;c=c|12;a=a+F[e+y>>2]|0;F[c+b>>2]=a;a=a+F[c+e>>2]|0;g=g+4|0;p=p+4|0;if((o|0)!=(p|0)){continue}break}}if(!n){break s}while(1){c=g<<2;F[c+b>>2]=a;g=g+1|0;a=F[c+e>>2]+a|0;k=k+1|0;if((n|0)!=(k|0)){continue}break}}if(!i){break l}x=F[h+40>>2];y=F[h+12>>2];n=0;while(1){I=n<<2;a=I+j|0;k=-1;c=n+1|0;b=(c>>>0)%3|0?c:n-2|0;if((b|0)!=-1){k=F[(b<<2)+j>>2]}b=F[a>>2];t:{u:{if(!((n>>>0)%3|0)){p=-1;a=n+2|0;if((a|0)!=-1){p=F[(a<<2)+j>>2]}if(!((b|0)==(k|0)|(b|0)==(p|0))&(k|0)!=(p|0)){break u}x=x+1|0;F[h+40>>2]=x;c=n+3|0;break t}p=F[a-4>>2]}a=p<<2;A=F[a+e>>2];v:{w:{if((A|0)<=0){break w}a=F[a+q>>2];g=0;while(1){o=(a<<3)+d|0;z=F[o>>2];if((z|0)==-1){break w}x:{if((k|0)!=(z|0)){break x}o=F[o+4>>2];if((o|0)!=-1){z=F[(o<<2)+j>>2]}else{z=-1}if((z|0)==(b|0)){break x}while(1){y:{b=a;g=g+1|0;if((A|0)<=(g|0)){break y}a=b+1|0;J=(a<<3)+d|0;z=F[J>>2];K=(b<<3)+d|0;F[K+4>>2]=F[J+4>>2];F[K>>2]=z;if((z|0)!=-1){continue}}break}F[(b<<3)+d>>2]=-1;if((o|0)==-1){break w}F[y+I>>2]=o;F[y+(o<<2)>>2]=n;break v}a=a+1|0;g=g+1|0;if((A|0)!=(g|0)){continue}break}}a=k<<2;k=F[a+e>>2];if((k|0)<=0){break v}a=F[a+q>>2];g=0;while(1){b=(a<<3)+d|0;if(F[b>>2]==-1){F[b>>2]=p;F[b+4>>2]=n;break v}a=a+1|0;g=g+1|0;if((k|0)!=(g|0)){continue}break}}}n=c;if(n>>>0>>0){continue}break}break l}break i}na();v()}F[w>>2]=t;if(q){ja(q)}if(d){ja(d)}a=F[f+16>>2];if(!a){break j}F[f+20>>2]=a;ja(a)}Z=f+32|0;x=(w|0)!=0;if(x){k=Z-32|0;Z=k;a=F[h>>2];g=F[h+4>>2];F[k+24>>2]=0;F[k+16>>2]=0;F[k+20>>2]=0;if((a|0)==(g|0)){c=g}else{a=g-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=ka(b<<2);F[k+24>>2]=b;F[k+20>>2]=0;F[k+16>>2]=c;Yb(k+16|0,a);g=F[h>>2];c=F[h+4>>2]}F[k+8>>2]=0;F[k>>2]=0;while(1){z:{o=0;i=0;if((c|0)==(g|0)){break z}while(1){b=F[k+16>>2];A:{if(F[b+(i>>>3&536870908)>>2]>>>i&1){break A}c=F[k>>2];F[k+4>>2]=c;e=F[h+12>>2];a=i;while(1){B:{f=a+1|0;d=a;a=(f>>>0)%3|0?f:a-2|0;if((a|0)==-1){break B}a=F[e+(a<<2)>>2];if((a|0)==-1){break B}f=a+1|0;a=(f>>>0)%3|0?f:a-2|0;if((i|0)==(a|0)|(a|0)==-1){break B}if(!(F[b+(a>>>3&536870908)>>2]>>>a&1)){continue}}break}j=d;C:{D:{E:{while(1){a=F[k+16>>2]+(j>>>3&536870908)|0;F[a>>2]=F[a>>2]|1<>>0)%3|0?a:j-2|0;g=F[h>>2];y=(j>>>0)%3|0;b=(y?-1:2)+j|0;n=F[k>>2];A=(n|0)==(c|0);F:{if(A){break F}w=F[(f<<2)+g>>2];q=F[h+12>>2];a=n;if((b|0)!=-1){e=q+(b<<2)|0;while(1){G:{if((w|0)!=F[a>>2]){break G}p=F[a+4>>2];t=F[e>>2];if((p|0)==(t|0)){break G}e=b;c=-1;a=-1;if((p|0)==-1){break C}break D}a=a+8|0;if((c|0)!=(a|0)){continue}break}break F}while(1){if((w|0)==F[a>>2]){t=-1;e=-1;p=F[a+4>>2];if((p|0)!=-1){break D}}a=a+8|0;if((c|0)!=(a|0)){continue}break}}b=F[(b<<2)+g>>2];H:{if(F[k+8>>2]!=(c|0)){F[c>>2]=b;F[c+4>>2]=f;c=c+8|0;F[k+4>>2]=c;break H}a=c-n|0;p=a>>3;e=p+1|0;if(e>>>0>=536870912){break i}g=a>>>2|0;g=a>>>0>=2147483640?536870911:e>>>0>>0?g:e;if(g){if(g>>>0>=536870912){break E}e=ka(g<<3)}else{e=0}a=e+(p<<3)|0;F[a>>2]=b;F[a+4>>2]=f;b=a+8|0;if(!A){while(1){c=c-8|0;f=F[c+4>>2];a=a-8|0;F[a>>2]=F[c>>2];F[a+4>>2]=f;if((c|0)!=(n|0)){continue}break}c=F[k>>2]}F[k+8>>2]=e+(g<<3);F[k+4>>2]=b;F[k>>2]=a;if(c){ja(c)}c=b}I:{J:{if(y){a=j-1|0;break J}a=j+2|0;if((a|0)==-1){break I}}a=F[F[h+12>>2]+(a<<2)>>2];if((a|0)==-1){break I}j=a+((a>>>0)%3|0?-1:2)|0;if((d|0)==(j|0)){break I}if((j|0)!=-1){continue}}break}g=F[h>>2];break A}oa();v()}c=F[q+(p<<2)>>2];b=e;a=p}if((t|0)!=-1){F[q+(t<<2)>>2]=-1}if((c|0)!=-1){F[q+(c<<2)>>2]=-1}F[q+(b<<2)>>2]=-1;F[q+(a<<2)>>2]=-1;o=1}i=i+1|0;c=F[h+4>>2];if(i>>>0>2>>>0){continue}break}if(o){continue}}break}a=F[k>>2];if(a){ja(a)}a=F[k+16>>2];if(a){ja(a)}Z=k+32|0;n=0;g=Z-32|0;Z=g;e=F[C+12>>2];F[h+36>>2]=e;p=h+24|0;b=F[h+24>>2];a=F[h+28>>2]-b>>2;K:{L:{if(a>>>0>>0){ab(p,e-a|0,10228);F[g+24>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;break L}if(a>>>0>e>>>0){F[h+28>>2]=b+(e<<2)}F[g+24>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;if(!e){break K}}if((e|0)<0){break i}a=(e-1>>>5|0)+1|0;b=ka(a<<2);F[g+24>>2]=a;F[g+20>>2]=0;F[g+16>>2]=b;Yb(g+16|0,e)}a=F[h>>2];b=F[h+4>>2];F[g+8>>2]=0;F[g>>2]=0;F[g+4>>2]=0;M:{if((a|0)==(b|0)){a=b}else{a=b-a|0;if((a|0)<0){break i}a=a>>2;b=(a-1>>>5|0)+1|0;c=ka(b<<2);F[g+8>>2]=b;F[g+4>>2]=0;F[g>>2]=c;Yb(g,a);b=F[h>>2];a=F[h+4>>2]}if(a-b>>>0<12){break M}N:{while(1){q=L(n,3);d=(q<<2)+b|0;f=F[d>>2];c=-1;i=q+1|0;if((i|0)!=-1){c=F[(i<<2)+b>>2]}O:{if((c|0)==(f|0)){break O}i=f;f=F[d+8>>2];if((i|0)==(f|0)|(c|0)==(f|0)){break O}k=0;i=F[g>>2];while(1){f=k+q|0;if(!(F[(f>>>3&536870908)+i>>2]>>>f&1)){a=F[(f<<2)+b>>2];c=1<>2];b=a>>>5|0;i=F[d+(b<<2)>>2];t=c&i;if(t){c=F[h+28>>2];P:{if((c|0)!=F[h+32>>2]){F[c>>2]=-1;F[h+28>>2]=c+4;break P}i=F[p>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=ka(j<<2)}else{b=0}d=b+(o<<2)|0;F[d>>2]=-1;o=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;F[d>>2]=F[c>>2];if((c|0)!=(i|0)){continue}break}}F[h+32>>2]=b+(j<<2);F[h+28>>2]=o;F[h+24>>2]=d;if(!i){break P}ja(i)}c=F[h+52>>2];Q:{if((c|0)!=F[h+56>>2]){F[c>>2]=a;F[h+52>>2]=c+4;break Q}i=F[h+48>>2];b=c-i|0;o=b>>2;d=o+1|0;if(d>>>0>=1073741824){break i}j=b>>>1|0;j=b>>>0>=2147483644?1073741823:d>>>0>>0?j:d;if(j){if(j>>>0>=1073741824){break N}b=ka(j<<2)}else{b=0}d=b+(o<<2)|0;F[d>>2]=a;a=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;F[d>>2]=F[c>>2];if((c|0)!=(i|0)){continue}break}}F[h+56>>2]=b+(j<<2);F[h+52>>2]=a;F[h+48>>2]=d;if(!i){break Q}ja(i)}c=F[g+20>>2];a=F[g+24>>2];if((c|0)==a<<5){if((c+1|0)<0){break i}b=g+16|0;if(c>>>0<=1073741822){a=a<<6;c=(c&-32)+32|0;a=a>>>0>c>>>0?a:c}else{a=2147483647}$a(b,a);c=F[g+20>>2]}F[g+20>>2]=c+1;d=F[g+16>>2];a=d+(c>>>3&536870908)|0;b=F[a>>2];N=a,O=oi(c)&b,F[N>>2]=O;c=1<>>5|0;i=F[(b<<2)+d>>2];a=e;e=a+1|0}F[(b<<2)+d>>2]=c|i;o=F[h+24>>2]+(a<<2)|0;j=F[h+12>>2];b=F[h>>2];i=F[g>>2];c=f;R:{S:{T:{while(1){if((c|0)==-1){break T}d=(c>>>3&536870908)+i|0;F[d>>2]=F[d>>2]|1<>2]=c;if(t){F[(c<<2)+b>>2]=a}w=c+1|0;c=(w>>>0)%3|0?w:c-2|0;d=-1;U:{if((c|0)==-1){break U}c=F[j+(c<<2)>>2];d=-1;if((c|0)==-1){break U}d=c+1|0;d=(d>>>0)%3|0?d:c-2|0}c=d;if((f|0)!=(c|0)){continue}break}if((f|0)!=-1){break R}c=1;break S}if((f>>>0)%3|0){c=f-1|0;break S}c=f+2|0;if((c|0)==-1){break R}}c=F[j+(c<<2)>>2];if((c|0)==-1){break R}V:{if((c>>>0)%3|0){c=c-1|0;break V}c=c+2|0;if((c|0)==-1){break R}}f=F[h+12>>2];b=F[h>>2];while(1){d=(c>>>3&536870908)+i|0;F[d>>2]=F[d>>2]|1<>2]=a}W:{if((c>>>0)%3|0){c=c-1|0;break W}c=c+2|0;if((c|0)==-1){break R}}c=F[f+(c<<2)>>2];if((c|0)==-1){break R}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)!=-1){continue}break}}}k=k+1|0;if((k|0)!=3){continue}break}b=F[h>>2];a=F[h+4>>2]}n=n+1|0;if(n>>>0<(a-b>>2>>>0)/3>>>0){continue}break}break M}oa();v()}c=0;F[h+44>>2]=0;a=F[g+16>>2];b=F[g+20>>2];if(b){e=b&31;b=(b>>>3&536870908)+a|0;d=a;i=0;while(1){if(!(F[d>>2]>>>c&1)){i=i+1|0;F[h+44>>2]=i}f=(c|0)==31;c=f?0:c+1|0;d=(f<<2)+d|0;if((b|0)!=(d|0)|(c|0)!=(e|0)){continue}break}}b=F[g>>2];if(b){ja(b);a=F[g+16>>2]}if(a){ja(a)}Z=g+32|0}Z=C+16|0;if(!x){F[H+8>>2]=0;Za(h);h=0}Z=H+16|0;a=h;break h}na();v()}b=F[s>>2];if(!b){break d}F[s+4>>2]=b;ja(b)}Z=s+16|0;break b}na();v()}c=F[l+4>>2];b=a;F[l+4>>2]=a;if(c){Za(c);b=F[l+4>>2]}X:{if(!b){break X}a=F[u+100>>2];c=F[u+96>>2];D[r+12|0]=0;Ea(l+56|0,(a-c|0)/12|0,r+12|0);a=F[u+100>>2];c=F[u+96>>2];if((a|0)==(c|0)){break X}while(1){if(!(F[F[l+56>>2]+(E>>>3&536870908)>>2]>>>E&1)){a=L(E,3);Vb(l,0,a);c=F[l+8>>2];e=F[l+12>>2];Vb(l,1,a+1|0);f=F[l+20>>2];d=F[l+24>>2];Vb(l,2,a+2|0);n=(c|0)==(e|0)?-1:0;a=d-f>>2;c=e-c>>2;e=a>>>0>c>>>0;c=F[l+36>>2]-F[l+32>>2]>>2>>>0>(e?a:c)>>>0?2:e?1:n;Y:{if(F[l+68>>2]<=0){break Y}F[r+12>>2]=F[l+76>>2];F[r+8>>2]=m;Qa(r+8|0,r+12|0);a=F[((c<<2)+l|0)+44>>2];if((a|0)<0){a=-1}else{e=(a>>>0)/3|0;a=F[(F[F[l>>2]+96>>2]+L(e,12)|0)+(a-L(e,3)<<2)>>2]}F[r+12>>2]=a;F[r+8>>2]=m;Qa(r+8|0,r+12|0);e=F[l+72>>2];F[l+72>>2]=e+2;if(!(e&1)){break Y}F[r+12>>2]=a;F[r+8>>2]=m;Qa(r+8|0,r+12|0);F[l+72>>2]=F[l+72>>2]+1}d=0;e=Z-16|0;Z=e;F[l+68>>2]=F[l+68>>2]+1;a=L(c,12)+l|0;a=F[a+12>>2]-F[a+8>>2]|0;if((a|0)>0){a=a>>>2|0;h=a>>>0<=1?1:a;c=F[((c<<2)+l|0)+44>>2];while(1){a=c;f=(a>>>0)/3|0;c=(a|0)==-1;g=c?-1:f;i=F[l+56>>2]+(g>>>3&536870908)|0;F[i>>2]=F[i>>2]|1<>2]=F[l+72>>2]+1;Z:{_:{$:{aa:{ba:{if(!d){ca:{if((a|0)>=0){F[e+12>>2]=F[(F[F[l>>2]+96>>2]+L(f,12)|0)+((a>>>0)%3<<2)>>2];F[e+8>>2]=m;Qa(e+8|0,e+12|0);break ca}F[e+12>>2]=-1;F[e+8>>2]=m;Qa(e+8|0,e+12|0);if(c){break ba}}c=-1;f=a+1|0;f=(f>>>0)%3|0?f:a-2|0;if((f|0)>=0){g=(f>>>0)/3|0;f=F[(F[F[l>>2]+96>>2]+L(g,12)|0)+(f-L(g,3)<<2)>>2]}else{f=-1}F[e+12>>2]=f;F[e+8>>2]=m;Qa(e+8|0,e+12|0);f=((a>>>0)%3|0?-1:2)+a|0;if((f|0)<0){break aa}c=(f>>>0)/3|0;c=F[(F[F[l>>2]+96>>2]+L(c,12)|0)+(f-L(c,3)<<2)>>2];break aa}c=(a|0)<0?-1:F[(F[F[l>>2]+96>>2]+L(f,12)|0)+((a>>>0)%3<<2)>>2];F[l+76>>2]=c;F[e+12>>2]=c;F[e+8>>2]=m;Qa(e+8|0,e+12|0);if(d&1){c=-1;if((a|0)==-1){break Z}if((L(f,3)|0)!=(a|0)){a=a-1|0;break _}a=a+2|0;break $}c=-1;if((a|0)==-1){break Z}c=a+1|0;a=(c>>>0)%3|0?c:a-2|0;break $}c=-1;F[e+12>>2]=-1;F[e+8>>2]=m;Qa(e+8|0,e+12|0)}F[l+76>>2]=c;F[e+12>>2]=c;F[e+8>>2]=m;Qa(e+8|0,e+12|0)}c=-1;if((a|0)==-1){break Z}}c=F[F[F[l+4>>2]+12>>2]+(a<<2)>>2]}d=d+1|0;if((h|0)!=(d|0)){continue}break}}Z=e+16|0;c=F[u+96>>2];a=F[u+100>>2]}E=E+1|0;if(E>>>0<(a-c|0)/12>>>0){continue}break}}Z=r+16|0;da:{if(b){a=F[B>>2];if(a){F[B+4>>2]=a;ja(a)}F[B>>2]=F[m>>2];F[B+4>>2]=F[m+4>>2];F[B+8>>2]=F[m+8>>2];M=F[m+84>>2];break da}a=F[m>>2];if(!a){break da}F[m+4>>2]=a;ja(a)}a=F[m+72>>2];if(a){ja(a)}a=F[m+48>>2];if(a){F[m+52>>2]=a;ja(a)}a=F[m+36>>2];if(a){F[m+40>>2]=a;ja(a)}a=F[m+24>>2];if(a){F[m+28>>2]=a;ja(a)}a=F[m+20>>2];F[m+20>>2]=0;if(a){Za(a)}Z=m+96|0;return M|0}function sf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=b;a=0;b=0;a:{b:{switch(d-1|0){case 0:j=F[i+80>>2];h=G[c+24|0];c:{if((L(j,h)|0)!=(e|0)){break c}d=F[c+28>>2]!=1;b=G[c+84|0];if(!(d|!b)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);b=1;break c}if(h){a=ka(h);ma(a,0,h)}d:{if(!j){b=1;break d}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=F[F[c>>2]>>2];m=F[c+48>>2];g=F[c+40>>2];b=ki(g,F[c+44>>2],G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;la(i,la(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break d}if(b){b=1;h=F[c>>2];e=F[c+48>>2];f=F[c+40>>2];i=F[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=F[h>>2];m=ki(f,i,c,0)+e|0;k=la(a,k+m|0,f);m=F[h>>2];n=ki(f,i,c|1,0)+e|0;la(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break d}c=F[h>>2];d=ki(g,0,f,i)+e|0;la(a,c+d|0,f);break d}b=1;h=F[c>>2];e=F[c+48>>2];g=F[c+68>>2];f=F[c+40>>2];i=F[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=F[h>>2];n=c<<2;l=ki(f,i,F[n+g>>2],0)+e|0;m=la(a,m+l|0,f);l=F[h>>2];n=ki(f,i,F[g+(n|4)>>2],0)+e|0;la(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break d}d=F[h>>2];c=ki(f,i,F[g+(c<<2)>>2],0)+e|0;la(a,c+d|0,f);break d}b=0;if(!h){d=0;while(1){if(!Cb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],a)){break d}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break d}d=0;e=0;while(1){if(!Cb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break d}la(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break c}ja(a)}break a;case 2:n=G[c+24|0];l=n<<1;j=F[i+80>>2];e:{if((L(l,j)|0)!=(e|0)){break e}i=F[c+28>>2]!=3;d=G[c+84|0];if(!(i|!d)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);a=1;break e}f:{if(!n){e=0;break f}e=ka(l);ma(e,0,l)}g:{if(!j){a=1;break g}if(!i){o=F[c+68>>2];k=F[c>>2];b=F[c+48>>2];i=F[c+40>>2];m=F[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=F[k>>2];p=ki(i,m,F[o+(d<<2)>>2],0)+b|0;la((c<<1)+f|0,la(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break g}c=0;while(1){a=1;o=F[k>>2];p=ki(g,h,i,m)+b|0;la((c<<1)+f|0,la(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break g}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=F[k>>2];g=c<<2;n=ki(i,m,F[g+o>>2],0)+b|0;h=la(e,h+n|0,i);n=F[k>>2];g=ki(i,m,F[o+(g|4)>>2],0)+b|0;la(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break g}d=F[k>>2];b=ki(i,m,F[o+(c<<2)>>2],0)+b|0;la(e,b+d|0,i);break g}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=F[k>>2];l=ki(g,h,i,m)+b|0;d=la(e,d+l|0,i);l=F[k>>2];o=ki(i,m,g|1,h)+b|0;la(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break g}c=F[k>>2];b=ki(g,h,i,m)+b|0;la(e,b+c|0,i);break g}if(!n){d=0;while(1){if(!Ab(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break g}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break g}d=0;while(1){if(!Ab(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break g}la((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break e}ja(e)}b=a;break a;case 4:l=G[c+24|0];o=l<<2;j=F[i+80>>2];h:{if((L(o,j)|0)!=(e|0)){break h}i=F[c+28>>2]!=5;d=G[c+84|0];if(!(i|!d)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);b=1;break h}i:{if(!l){e=0;break i}e=ka(o);ma(e,0,o)}b=1;j:{if(!j){break j}if(!i){a=F[c+68>>2];m=F[c>>2];i=F[c+48>>2];k=F[c+40>>2];n=F[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=F[m>>2];p=ki(k,n,F[a+(d<<2)>>2],0)+i|0;la((c<<2)+f|0,la(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break j}c=0;while(1){d=F[m>>2];p=ki(g,h,k,n)+i|0;la((c<<2)+f|0,la(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break j}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=F[m>>2];g=c<<2;l=ki(k,n,F[g+a>>2],0)+i|0;h=la(e,h+l|0,k);l=F[m>>2];g=ki(k,n,F[a+(g|4)>>2],0)+i|0;la(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break j}d=F[m>>2];a=ki(k,n,F[a+(c<<2)>>2],0)+i|0;la(e,a+d|0,k);break j}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=F[m>>2];d=ki(g,h,k,n)+i|0;a=la(e,a+d|0,k);d=F[m>>2];o=ki(k,n,g|1,h)+i|0;la(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break j}a=F[m>>2];c=ki(g,h,k,n)+i|0;la(e,a+c|0,k);break j}b=0;if(!l){d=0;while(1){if(!yb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break j}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break j}d=0;while(1){if(!yb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break j}la((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break h}ja(e)}break a;case 1:j=F[i+80>>2];h=G[c+24|0];k:{if((L(j,h)|0)!=(e|0)){break k}d=F[c+28>>2]!=2;b=G[c+84|0];if(!(d|!b)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);b=1;break k}if(h){a=ka(h);ma(a,0,h)}l:{if(!j){b=1;break l}if(!d){if(h){d=0;e=0;while(1){i=d+f|0;k=F[F[c>>2]>>2];m=F[c+48>>2];g=F[c+40>>2];b=ki(g,F[c+44>>2],G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],0);n=b;b=b+m|0;la(i,la(a,b+k|0,g),h);d=d+h|0;b=1;e=e+1|0;if((j|0)!=(e|0)){continue}break}break l}if(b){b=1;h=F[c>>2];e=F[c+48>>2];f=F[c+40>>2];i=F[c+44>>2];if((j|0)!=1){g=j&-2;c=0;d=0;while(1){k=F[h>>2];m=ki(f,i,c,0)+e|0;k=la(a,k+m|0,f);m=F[h>>2];n=ki(f,i,c|1,0)+e|0;la(k,m+n|0,f);c=c+2|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}g=c}if(!(j&1)){break l}c=F[h>>2];d=ki(g,0,f,i)+e|0;la(a,c+d|0,f);break l}b=1;h=F[c>>2];e=F[c+48>>2];g=F[c+68>>2];f=F[c+40>>2];i=F[c+44>>2];c=0;if((j|0)!=1){k=j&-2;d=0;while(1){m=F[h>>2];n=c<<2;l=ki(f,i,F[n+g>>2],0)+e|0;m=la(a,m+l|0,f);l=F[h>>2];n=ki(f,i,F[g+(n|4)>>2],0)+e|0;la(m,l+n|0,f);c=c+2|0;d=d+2|0;if((k|0)!=(d|0)){continue}break}}if(!(j&1)){break l}d=F[h>>2];c=ki(f,i,F[g+(c<<2)>>2],0)+e|0;la(a,c+d|0,f);break l}b=0;if(!h){d=0;while(1){if(!Bb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],a)){break l}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break l}d=0;e=0;while(1){if(!Bb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break l}la(d+f|0,a,h);d=d+h|0;e=e+1|0;b=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}}if(!a){break k}ja(a)}break a;case 3:n=G[c+24|0];l=n<<1;j=F[i+80>>2];m:{if((L(l,j)|0)!=(e|0)){break m}i=F[c+28>>2]!=4;d=G[c+84|0];if(!(i|!d)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);a=1;break m}n:{if(!n){e=0;break n}e=ka(l);ma(e,0,l)}o:{if(!j){a=1;break o}if(!i){o=F[c+68>>2];k=F[c>>2];b=F[c+48>>2];i=F[c+40>>2];m=F[c+44>>2];if(n){if(!d){c=0;d=0;while(1){a=1;g=F[k>>2];p=ki(i,m,F[o+(d<<2)>>2],0)+b|0;la((c<<1)+f|0,la(e,g+p|0,i),l);c=c+n|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break o}c=0;while(1){a=1;o=F[k>>2];p=ki(g,h,i,m)+b|0;la((c<<1)+f|0,la(e,o+p|0,i),l);c=c+n|0;d=h;g=g+1|0;d=g?d:d+1|0;h=d;if((j|0)!=(g|0)|d){continue}break}break o}if(!d){a=1;c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=F[k>>2];g=c<<2;n=ki(i,m,F[g+o>>2],0)+b|0;h=la(e,h+n|0,i);n=F[k>>2];g=ki(i,m,F[o+(g|4)>>2],0)+b|0;la(h,g+n|0,i);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break o}d=F[k>>2];b=ki(i,m,F[o+(c<<2)>>2],0)+b|0;la(e,b+d|0,i);break o}n=j&1;a=1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){d=F[k>>2];l=ki(g,h,i,m)+b|0;d=la(e,d+l|0,i);l=F[k>>2];o=ki(i,m,g|1,h)+b|0;la(d,l+o|0,i);g=g+2|0;h=g>>>0<2?h+1|0:h;f=f+2|0;d=f>>>0<2?c+1|0:c;c=d;if((f|0)!=(j|0)|c){continue}break}}if(!n){break o}c=F[k>>2];b=ki(g,h,i,m)+b|0;la(e,b+c|0,i);break o}if(!n){d=0;while(1){if(!zb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break o}d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break o}d=0;while(1){if(!zb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break o}la((b<<1)+f|0,e,l);b=b+n|0;d=d+1|0;a=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break m}ja(e)}b=a;break a;case 5:l=G[c+24|0];o=l<<2;j=F[i+80>>2];p:{if((L(o,j)|0)!=(e|0)){break p}i=F[c+28>>2]!=6;d=G[c+84|0];if(!(i|!d)){la(f,F[F[c>>2]>>2]+F[c+48>>2]|0,e);b=1;break p}q:{if(!l){e=0;break q}e=ka(o);ma(e,0,o)}b=1;r:{if(!j){break r}if(!i){a=F[c+68>>2];m=F[c>>2];i=F[c+48>>2];k=F[c+40>>2];n=F[c+44>>2];if(l){if(!d){c=0;d=0;while(1){g=F[m>>2];p=ki(k,n,F[a+(d<<2)>>2],0)+i|0;la((c<<2)+f|0,la(e,g+p|0,k),o);c=c+l|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}break r}c=0;while(1){d=F[m>>2];p=ki(g,h,k,n)+i|0;la((c<<2)+f|0,la(e,d+p|0,k),o);c=c+l|0;g=g+1|0;a=g?h:h+1|0;h=a;if((j|0)!=(g|0)|h){continue}break}break r}if(!d){c=0;if((j|0)!=1){f=j&-2;d=0;while(1){h=F[m>>2];g=c<<2;l=ki(k,n,F[g+a>>2],0)+i|0;h=la(e,h+l|0,k);l=F[m>>2];g=ki(k,n,F[a+(g|4)>>2],0)+i|0;la(h,g+l|0,k);c=c+2|0;d=d+2|0;if((f|0)!=(d|0)){continue}break}}if(!(j&1)){break r}d=F[m>>2];a=ki(k,n,F[a+(c<<2)>>2],0)+i|0;la(e,a+d|0,k);break r}l=j&1;if((j|0)!=1){j=j&-2;f=0;c=0;while(1){a=F[m>>2];d=ki(g,h,k,n)+i|0;a=la(e,a+d|0,k);d=F[m>>2];o=ki(k,n,g|1,h)+i|0;la(a,d+o|0,k);d=h;g=g+2|0;h=g>>>0<2?d+1|0:d;f=f+2|0;a=f>>>0<2?c+1|0:c;c=a;if((f|0)!=(j|0)|c){continue}break}}if(!l){break r}a=F[m>>2];c=ki(g,h,k,n)+i|0;la(e,a+c|0,k);break r}b=0;if(!l){d=0;while(1){if(!xb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break r}d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}break r}d=0;while(1){if(!xb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],e)){break r}la((a<<2)+f|0,e,o);a=a+l|0;d=d+1|0;b=j>>>0<=d>>>0;if((d|0)!=(j|0)){continue}break}}if(!e){break p}ja(e)}break a;case 8:p=G[c+24|0];q=p<<2;k=F[i+80>>2];s:{if((L(q,k)|0)!=(e|0)){break s}i=F[c+28>>2];t:{if(!p){break t}a=ka(q);d=a;m=q-4|0;l=(m>>>2|0)+1&7;if(l){e=0;while(1){F[d>>2]=-1073741824;d=d+4|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}if(m>>>0<28){break t}e=(p<<2)+a|0;while(1){F[d+24>>2]=-1073741824;F[d+28>>2]=-1073741824;F[d+16>>2]=-1073741824;F[d+20>>2]=-1073741824;F[d+8>>2]=-1073741824;F[d+12>>2]=-1073741824;F[d>>2]=-1073741824;F[d+4>>2]=-1073741824;d=d+32|0;if((e|0)!=(d|0)){continue}break}}u:{if(!k){b=1;break u}if((i|0)==9){r=F[c+68>>2];l=F[c>>2];i=F[c+48>>2];s=G[c+84|0];m=F[c+44>>2];c=F[c+40>>2];o=c;if(p){e=0;d=0;while(1){h=(e<<2)+f|0;g=F[l>>2];b=ki(c,m,s?d:F[r+(d<<2)>>2],0)+i|0;la(h,la(a,b+g|0,o),q);e=e+p|0;b=1;d=d+1|0;if((k|0)!=(d|0)){continue}break}break u}if(!s){b=1;d=0;if((k|0)!=1){f=k&-2;e=0;while(1){h=F[l>>2];g=d<<2;j=ki(c,m,F[g+r>>2],0)+i|0;h=la(a,h+j|0,o);j=F[l>>2];g=ki(c,m,F[r+(g|4)>>2],0)+i|0;la(h,j+g|0,o);d=d+2|0;e=e+2|0;if((f|0)!=(e|0)){continue}break}}if(!(k&1)){break u}e=F[l>>2];c=ki(c,m,F[r+(d<<2)>>2],0)+i|0;la(a,c+e|0,o);break u}f=k&1;b=1;if((k|0)!=1){k=k&-2;while(1){d=F[l>>2];e=ki(g,h,c,m)+i|0;d=la(a,d+e|0,o);e=F[l>>2];p=ki(c,m,g|1,h)+i|0;la(d,e+p|0,o);g=g+2|0;h=g>>>0<2?h+1|0:h;d=j;e=n+2|0;d=e>>>0<2?d+1|0:d;n=e;j=d;if((e|0)!=(k|0)|d){continue}break}}if(!f){break u}d=F[l>>2];c=ki(g,h,c,m)+i|0;la(a,c+d|0,o);break u}if(!p){d=0;while(1){if(!lb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],a)){break u}d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}break u}e=0;d=0;while(1){if(!lb(c,G[c+84|0]?d:F[F[c+68>>2]+(d<<2)>>2],D[c+24|0],a)){break u}la((e<<2)+f|0,a,q);e=e+p|0;d=d+1|0;b=k>>>0<=d>>>0;if((d|0)!=(k|0)){continue}break}}if(!a){break s}ja(a)}a=b;break;default:break b}}b=a}return b|0}function Pd(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;h=Z-80|0;Z=h;e=F[c+36>>2];F[h+72>>2]=F[c+32>>2];F[h+76>>2]=e;f=F[c+28>>2];e=h- -64|0;F[e>>2]=F[c+24>>2];F[e+4>>2]=f;e=F[c+20>>2];F[h+56>>2]=F[c+16>>2];F[h+60>>2]=e;e=F[c+12>>2];F[h+48>>2]=F[c+8>>2];F[h+52>>2]=e;e=F[c+4>>2];F[h+40>>2]=F[c>>2];F[h+44>>2]=e;jc(a,h+40|0,h+24|0);a:{if(F[a>>2]){break a}if(D[a+15|0]<0){ja(F[a+4>>2])}if(G[h+31|0]!=1){b=ka(32);D[b+20|0]=0;c=G[1446]|G[1447]<<8|(G[1448]<<16|G[1449]<<24);D[b+16|0]=c;D[b+17|0]=c>>>8;D[b+18|0]=c>>>16;D[b+19|0]=c>>>24;c=G[1442]|G[1443]<<8|(G[1444]<<16|G[1445]<<24);d=G[1438]|G[1439]<<8|(G[1440]<<16|G[1441]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1434]|G[1435]<<8|(G[1436]<<16|G[1437]<<24);d=G[1430]|G[1431]<<8|(G[1432]<<16|G[1433]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,b,20);ja(b);break a}j=Z-16|0;Z=j;b:{c:{switch(G[h+32|0]){case 0:e=Kd(ka(48));F[e>>2]=9864;F[h+8>>2]=0;F[h+12>>2]=0;F[h>>2]=0;F[h+4>>2]=0;F[h+16>>2]=e;break b;case 1:e=Kd(ka(52));F[e+48>>2]=0;F[e>>2]=8176;F[h+8>>2]=0;F[h+12>>2]=0;F[h>>2]=0;F[h+4>>2]=0;F[h+16>>2]=e;break b;default:break c}}f=ka(32);D[f+28|0]=0;e=G[1520]|G[1521]<<8|(G[1522]<<16|G[1523]<<24);D[f+24|0]=e;D[f+25|0]=e>>>8;D[f+26|0]=e>>>16;D[f+27|0]=e>>>24;e=G[1516]|G[1517]<<8|(G[1518]<<16|G[1519]<<24);g=G[1512]|G[1513]<<8|(G[1514]<<16|G[1515]<<24);D[f+16|0]=g;D[f+17|0]=g>>>8;D[f+18|0]=g>>>16;D[f+19|0]=g>>>24;D[f+20|0]=e;D[f+21|0]=e>>>8;D[f+22|0]=e>>>16;D[f+23|0]=e>>>24;e=G[1508]|G[1509]<<8|(G[1510]<<16|G[1511]<<24);g=G[1504]|G[1505]<<8|(G[1506]<<16|G[1507]<<24);D[f+8|0]=g;D[f+9|0]=g>>>8;D[f+10|0]=g>>>16;D[f+11|0]=g>>>24;D[f+12|0]=e;D[f+13|0]=e>>>8;D[f+14|0]=e>>>16;D[f+15|0]=e>>>24;e=G[1500]|G[1501]<<8|(G[1502]<<16|G[1503]<<24);g=G[1496]|G[1497]<<8|(G[1498]<<16|G[1499]<<24);D[f|0]=g;D[f+1|0]=g>>>8;D[f+2|0]=g>>>16;D[f+3|0]=g>>>24;D[f+4|0]=e;D[f+5|0]=e>>>8;D[f+6|0]=e>>>16;D[f+7|0]=e>>>24;F[j>>2]=-1;e=j|4;ra(e,f,28);k=D[j+15|0];F[h>>2]=F[j>>2];g=h+4|0;d:{if((k|0)>=0){k=F[e+4>>2];F[g>>2]=F[e>>2];F[g+4>>2]=k;F[g+8>>2]=F[e+8>>2];F[h+16>>2]=0;break d}ra(g,F[j+4>>2],F[j+8>>2]);e=D[j+15|0];F[h+16>>2]=0;if((e|0)>=0){break d}ja(F[j+4>>2])}ja(f)}Z=j+16|0;e=F[h>>2];e:{if(e){F[a>>2]=e;a=a+4|0;if(D[h+15|0]>=0){b=h|4;c=F[b+4>>2];F[a>>2]=F[b>>2];F[a+4>>2]=c;F[a+8>>2]=F[b+8>>2];break e}ra(a,F[h+4>>2],F[h+8>>2]);break e}e=F[h+16>>2];F[h+16>>2]=0;F[e+44>>2]=d;f=Z-32|0;Z=f;F[e+32>>2]=c;F[e+40>>2]=b;F[e+4>>2]=d;jc(a,c,f+16|0);f:{if(F[a>>2]){break f}if(D[a+15|0]<0){ja(F[a+4>>2])}b=G[f+23|0];if(($[F[F[e>>2]+8>>2]](e)|0)!=(b|0)){b=ka(64);D[b+50|0]=0;c=G[1304]|G[1305]<<8;D[b+48|0]=c;D[b+49|0]=c>>>8;c=G[1300]|G[1301]<<8|(G[1302]<<16|G[1303]<<24);d=G[1296]|G[1297]<<8|(G[1298]<<16|G[1299]<<24);D[b+40|0]=d;D[b+41|0]=d>>>8;D[b+42|0]=d>>>16;D[b+43|0]=d>>>24;D[b+44|0]=c;D[b+45|0]=c>>>8;D[b+46|0]=c>>>16;D[b+47|0]=c>>>24;c=G[1292]|G[1293]<<8|(G[1294]<<16|G[1295]<<24);d=G[1288]|G[1289]<<8|(G[1290]<<16|G[1291]<<24);D[b+32|0]=d;D[b+33|0]=d>>>8;D[b+34|0]=d>>>16;D[b+35|0]=d>>>24;D[b+36|0]=c;D[b+37|0]=c>>>8;D[b+38|0]=c>>>16;D[b+39|0]=c>>>24;c=G[1284]|G[1285]<<8|(G[1286]<<16|G[1287]<<24);d=G[1280]|G[1281]<<8|(G[1282]<<16|G[1283]<<24);D[b+24|0]=d;D[b+25|0]=d>>>8;D[b+26|0]=d>>>16;D[b+27|0]=d>>>24;D[b+28|0]=c;D[b+29|0]=c>>>8;D[b+30|0]=c>>>16;D[b+31|0]=c>>>24;c=G[1276]|G[1277]<<8|(G[1278]<<16|G[1279]<<24);d=G[1272]|G[1273]<<8|(G[1274]<<16|G[1275]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1268]|G[1269]<<8|(G[1270]<<16|G[1271]<<24);d=G[1264]|G[1265]<<8|(G[1266]<<16|G[1267]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1260]|G[1261]<<8|(G[1262]<<16|G[1263]<<24);d=G[1256]|G[1257]<<8|(G[1258]<<16|G[1259]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,b,50);ja(b);break f}c=G[f+21|0];D[e+36|0]=c;d=G[f+22|0];D[e+37|0]=d;if((c|0)!=2){b=ka(32);D[b+26|0]=0;c=G[1427]|G[1428]<<8;D[b+24|0]=c;D[b+25|0]=c>>>8;c=G[1423]|G[1424]<<8|(G[1425]<<16|G[1426]<<24);d=G[1419]|G[1420]<<8|(G[1421]<<16|G[1422]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1415]|G[1416]<<8|(G[1417]<<16|G[1418]<<24);d=G[1411]|G[1412]<<8|(G[1413]<<16|G[1414]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1407]|G[1408]<<8|(G[1409]<<16|G[1410]<<24);d=G[1403]|G[1404]<<8|(G[1405]<<16|G[1406]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-5;ra(a+4|0,b,26);ja(b);break f}b=b?2:3;if((b|0)!=(d|0)){b=ka(32);D[b+26|0]=0;c=G[1400]|G[1401]<<8;D[b+24|0]=c;D[b+25|0]=c>>>8;c=G[1396]|G[1397]<<8|(G[1398]<<16|G[1399]<<24);d=G[1392]|G[1393]<<8|(G[1394]<<16|G[1395]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1388]|G[1389]<<8|(G[1390]<<16|G[1391]<<24);d=G[1384]|G[1385]<<8|(G[1386]<<16|G[1387]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1380]|G[1381]<<8|(G[1382]<<16|G[1383]<<24);d=G[1376]|G[1377]<<8|(G[1378]<<16|G[1379]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-5;ra(a+4|0,b,26);ja(b);break f}E[F[e+32>>2]+38>>1]=b|512;g:{if(E[f+26>>1]>=0){break g}j=Z-16|0;Z=j;d=ka(36);b=d;F[b+4>>2]=0;F[b+8>>2]=0;F[b+24>>2]=0;F[b+28>>2]=0;b=b+16|0;F[b>>2]=0;F[b+4>>2]=0;F[d>>2]=d+4;F[d+32>>2]=0;F[d+12>>2]=b;F[j>>2]=0;c=F[e+32>>2];k=Z-16|0;Z=k;b=0;h:{if(!d){break h}F[j>>2]=c;F[k+12>>2]=0;b=0;if(!fb(1,k+12|0,c)){break h}n=F[k+12>>2];if(n){while(1){i:{if(fb(1,k+8|0,F[j>>2])){b=ka(28);F[b+4>>2]=0;F[b+8>>2]=0;c=b+16|0;F[c>>2]=0;F[c+4>>2]=0;F[b>>2]=b+4;F[b+12>>2]=c;F[b+24>>2]=F[k+8>>2];if(Vc(j,b)){break i}Ca(b+12|0,F[b+16>>2]);Ba(b,F[b+4>>2]);ja(b)}b=0;break h}g=Z-16|0;Z=g;F[g+8>>2]=b;j:{if(!b){break j}c=F[d+28>>2];k:{if(c>>>0>2]){F[g+8>>2]=0;F[c>>2]=b;F[d+28>>2]=c+4;break k}c=0;l:{m:{n:{i=F[d+24>>2];m=F[d+28>>2]-i>>2;b=m+1|0;if(b>>>0<1073741824){i=F[d+32>>2]-i|0;l=i>>>1|0;i=i>>>0>=2147483644?1073741823:b>>>0>>0?l:b;if(i){if(i>>>0>=1073741824){break n}c=ka(i<<2)}l=F[g+8>>2];F[g+8>>2]=0;b=(m<<2)+c|0;F[b>>2]=l;i=(i<<2)+c|0;m=b+4|0;c=F[d+28>>2];l=F[d+24>>2];if((c|0)==(l|0)){break m}while(1){c=c-4|0;p=F[c>>2];F[c>>2]=0;b=b-4|0;F[b>>2]=p;if((c|0)!=(l|0)){continue}break}F[d+32>>2]=i;i=F[d+28>>2];F[d+28>>2]=m;c=F[d+24>>2];F[d+24>>2]=b;if((c|0)==(i|0)){break l}while(1){i=i-4|0;b=F[i>>2];F[i>>2]=0;if(b){Ca(b+12|0,F[b+16>>2]);Ba(b,F[b+4>>2]);ja(b)}if((c|0)!=(i|0)){continue}break}break l}na();v()}oa();v()}F[d+32>>2]=i;F[d+28>>2]=m;F[d+24>>2]=b}if(c){ja(c)}}b=F[g+8>>2];F[g+8>>2]=0;if(!b){break j}Ca(b+12|0,F[b+16>>2]);Ba(b,F[b+4>>2]);ja(b)}Z=g+16|0;o=o+1|0;if((n|0)!=(o|0)){continue}break}}b=Vc(j,d)}Z=k+16|0;o:{if(b){c=F[e+4>>2];b=F[c+4>>2];F[c+4>>2]=d;if(b){ic(b)}F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;break o}b=ka(32);D[b+26|0]=0;c=G[1549]|G[1550]<<8;D[b+24|0]=c;D[b+25|0]=c>>>8;c=G[1545]|G[1546]<<8|(G[1547]<<16|G[1548]<<24);g=G[1541]|G[1542]<<8|(G[1543]<<16|G[1544]<<24);D[b+16|0]=g;D[b+17|0]=g>>>8;D[b+18|0]=g>>>16;D[b+19|0]=g>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1537]|G[1538]<<8|(G[1539]<<16|G[1540]<<24);g=G[1533]|G[1534]<<8|(G[1535]<<16|G[1536]<<24);D[b+8|0]=g;D[b+9|0]=g>>>8;D[b+10|0]=g>>>16;D[b+11|0]=g>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1529]|G[1530]<<8|(G[1531]<<16|G[1532]<<24);g=G[1525]|G[1526]<<8|(G[1527]<<16|G[1528]<<24);D[b|0]=g;D[b+1|0]=g>>>8;D[b+2|0]=g>>>16;D[b+3|0]=g>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,b,26);ja(b);F[j+8>>2]=0;ic(d)}Z=j+16|0;if(F[a>>2]){break f}if(D[a+15|0]>=0){break g}ja(F[a+4>>2])}if(!($[F[F[e>>2]+12>>2]](e)|0)){b=ka(48);D[b+33|0]=0;D[b+32|0]=G[1374];c=G[1370]|G[1371]<<8|(G[1372]<<16|G[1373]<<24);d=G[1366]|G[1367]<<8|(G[1368]<<16|G[1369]<<24);D[b+24|0]=d;D[b+25|0]=d>>>8;D[b+26|0]=d>>>16;D[b+27|0]=d>>>24;D[b+28|0]=c;D[b+29|0]=c>>>8;D[b+30|0]=c>>>16;D[b+31|0]=c>>>24;c=G[1362]|G[1363]<<8|(G[1364]<<16|G[1365]<<24);d=G[1358]|G[1359]<<8|(G[1360]<<16|G[1361]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1354]|G[1355]<<8|(G[1356]<<16|G[1357]<<24);d=G[1350]|G[1351]<<8|(G[1352]<<16|G[1353]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1346]|G[1347]<<8|(G[1348]<<16|G[1349]<<24);d=G[1342]|G[1343]<<8|(G[1344]<<16|G[1345]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,b,33);ja(b);break f}if(!($[F[F[e>>2]+20>>2]](e)|0)){b=Eb(f,1552);F[a>>2]=-1;c=a+4|0;if(D[b+11|0]>=0){d=F[b+4>>2];F[c>>2]=F[b>>2];F[c+4>>2]=d;F[c+8>>2]=F[b+8>>2];break f}ra(c,F[b>>2],F[b+4>>2]);if(D[b+11|0]>=0){break f}ja(F[b>>2]);break f}if(!($[F[F[e>>2]+24>>2]](e)|0)){b=Eb(f,1307);F[a>>2]=-1;c=a+4|0;if(D[b+11|0]>=0){d=F[b+4>>2];F[c>>2]=F[b>>2];F[c+4>>2]=d;F[c+8>>2]=F[b+8>>2];break f}ra(c,F[b>>2],F[b+4>>2]);if(D[b+11|0]>=0){break f}ja(F[b>>2]);break f}F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0}Z=f+32|0;if(!F[a>>2]){if(D[a+15|0]<0){ja(F[a+4>>2])}F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0}$[F[F[e>>2]+4>>2]](e)}a=F[h+16>>2];F[h+16>>2]=0;if(a){$[F[F[a>>2]+4>>2]](a)}if(D[h+15|0]>=0){break a}ja(F[h+4>>2])}Z=h+80|0}function Ub(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;l=Z-16|0;Z=l;a:{b:{c:{d:{e:{f:{g:{h:{i:{if(a>>>0<=244){g=F[2941];h=a>>>0<11?16:a+11&-8;c=h>>>3|0;b=g>>>c|0;if(b&3){c=c+((b^-1)&1)|0;a=c<<3;b=a+11804|0;d=F[a+11812>>2];a=F[d+8>>2];j:{if((b|0)==(a|0)){m=11764,n=oi(c)&g,F[m>>2]=n;break j}F[a+12>>2]=b;F[b+8>>2]=a}a=d+8|0;b=c<<3;F[d+4>>2]=b|3;b=b+d|0;F[b+4>>2]=F[b+4>>2]|1;break a}k=F[2943];if(k>>>0>=h>>>0){break i}if(b){a=2<>2];a=F[e+8>>2];k:{if((b|0)==(a|0)){g=oi(d)&g;F[2941]=g;break k}F[a+12>>2]=b;F[b+8>>2]=a}F[e+4>>2]=h|3;c=e+h|0;a=d<<3;d=a-h|0;F[c+4>>2]=d|1;F[a+e>>2]=d;if(k){b=(k&-8)+11804|0;f=F[2946];a=1<<(k>>>3);l:{if(!(a&g)){F[2941]=a|g;a=b;break l}a=F[b+8>>2]}F[b+8>>2]=f;F[a+12>>2]=f;F[f+12>>2]=b;F[f+8>>2]=a}a=e+8|0;F[2946]=c;F[2943]=d;break a}j=F[2942];if(!j){break i}c=F[(ji(0-j&j)<<2)+12068>>2];f=(F[c+4>>2]&-8)-h|0;b=c;while(1){m:{a=F[b+16>>2];if(!a){a=F[b+20>>2];if(!a){break m}}b=(F[a+4>>2]&-8)-h|0;d=b>>>0>>0;f=d?b:f;c=d?a:c;b=a;continue}break}i=F[c+24>>2];d=F[c+12>>2];if((d|0)!=(c|0)){a=F[c+8>>2];F[a+12>>2]=d;F[d+8>>2]=a;break b}b=c+20|0;a=F[b>>2];if(!a){a=F[c+16>>2];if(!a){break h}b=c+16|0}while(1){e=b;d=a;b=a+20|0;a=F[b>>2];if(a){continue}b=d+16|0;a=F[d+16>>2];if(a){continue}break}F[e>>2]=0;break b}h=-1;if(a>>>0>4294967231){break i}a=a+11|0;h=a&-8;j=F[2942];if(!j){break i}f=0-h|0;g=0;n:{if(h>>>0<256){break n}g=31;if(h>>>0>16777215){break n}a=O(a>>>8|0);g=((h>>>38-a&1)-(a<<1)|0)+62|0}b=F[(g<<2)+12068>>2];o:{p:{q:{if(!b){a=0;break q}a=0;c=h<<((g|0)!=31?25-(g>>>1|0)|0:0);while(1){r:{e=(F[b+4>>2]&-8)-h|0;if(e>>>0>=f>>>0){break r}d=b;f=e;if(e){break r}f=0;a=b;break p}e=F[b+20>>2];b=F[((c>>>29&4)+b|0)+16>>2];a=e?(e|0)==(b|0)?a:e:a;c=c<<1;if(b){continue}break}}if(!(a|d)){d=0;a=2<>2]}if(!a){break o}}while(1){b=(F[a+4>>2]&-8)-h|0;c=b>>>0>>0;f=c?b:f;d=c?a:d;b=F[a+16>>2];if(b){a=b}else{a=F[a+20>>2]}if(a){continue}break}}if(!d|F[2943]-h>>>0<=f>>>0){break i}g=F[d+24>>2];c=F[d+12>>2];if((d|0)!=(c|0)){a=F[d+8>>2];F[a+12>>2]=c;F[c+8>>2]=a;break c}b=d+20|0;a=F[b>>2];if(!a){a=F[d+16>>2];if(!a){break g}b=d+16|0}while(1){e=b;c=a;b=a+20|0;a=F[b>>2];if(a){continue}b=c+16|0;a=F[c+16>>2];if(a){continue}break}F[e>>2]=0;break c}a=F[2943];if(a>>>0>=h>>>0){d=F[2946];b=a-h|0;s:{if(b>>>0>=16){c=d+h|0;F[c+4>>2]=b|1;F[a+d>>2]=b;F[d+4>>2]=h|3;break s}F[d+4>>2]=a|3;a=a+d|0;F[a+4>>2]=F[a+4>>2]|1;c=0;b=0}F[2943]=b;F[2946]=c;a=d+8|0;break a}i=F[2944];if(i>>>0>h>>>0){b=i-h|0;F[2944]=b;c=F[2947];a=c+h|0;F[2947]=a;F[a+4>>2]=b|1;F[c+4>>2]=h|3;a=c+8|0;break a}a=0;j=h+47|0;if(F[3059]){c=F[3061]}else{F[3062]=-1;F[3063]=-1;F[3060]=4096;F[3061]=4096;F[3059]=l+12&-16^1431655768;F[3064]=0;F[3052]=0;c=4096}e=j+c|0;f=0-c|0;b=e&f;if(b>>>0<=h>>>0){break a}d=F[3051];if(d){c=F[3049];g=c+b|0;if(d>>>0>>0|c>>>0>=g>>>0){break a}}t:{if(!(G[12208]&4)){u:{v:{w:{x:{d=F[2947];if(d){a=12212;while(1){c=F[a>>2];if(c>>>0<=d>>>0&d>>>0>2]>>>0){break x}a=F[a+8>>2];if(a){continue}break}}c=eb(0);if((c|0)==-1){break u}g=b;d=F[3060];a=d-1|0;if(a&c){g=(b-c|0)+(a+c&0-d)|0}if(g>>>0<=h>>>0){break u}d=F[3051];if(d){a=F[3049];f=a+g|0;if(d>>>0>>0|a>>>0>=f>>>0){break u}}a=eb(g);if((c|0)!=(a|0)){break w}break t}g=f&e-i;c=eb(g);if((c|0)==(F[a>>2]+F[a+4>>2]|0)){break v}a=c}if((a|0)==-1){break u}if(h+48>>>0<=g>>>0){c=a;break t}c=F[3061];c=c+(j-g|0)&0-c;if((eb(c)|0)==-1){break u}g=c+g|0;c=a;break t}if((c|0)!=-1){break t}}F[3052]=F[3052]|4}c=eb(b);a=eb(0);if((c|0)==-1|(a|0)==-1|a>>>0<=c>>>0){break d}g=a-c|0;if(g>>>0<=h+40>>>0){break d}}a=F[3049]+g|0;F[3049]=a;if(a>>>0>I[3050]){F[3050]=a}y:{e=F[2947];if(e){a=12212;while(1){d=F[a>>2];b=F[a+4>>2];if((d+b|0)==(c|0)){break y}a=F[a+8>>2];if(a){continue}break}break f}a=F[2945];if(!(a>>>0<=c>>>0?a:0)){F[2945]=c}a=0;F[3054]=g;F[3053]=c;F[2949]=-1;F[2950]=F[3059];F[3056]=0;while(1){d=a<<3;b=d+11804|0;F[d+11812>>2]=b;F[d+11816>>2]=b;a=a+1|0;if((a|0)!=32){continue}break}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;F[2944]=b;a=a+c|0;F[2947]=a;F[a+4>>2]=b|1;F[(c+d|0)+4>>2]=40;F[2948]=F[3063];break e}if(G[a+12|0]&8|d>>>0>e>>>0|c>>>0<=e>>>0){break f}F[a+4>>2]=b+g;a=e+8&7?-8-e&7:0;c=a+e|0;F[2947]=c;b=F[2944]+g|0;a=b-a|0;F[2944]=a;F[c+4>>2]=a|1;F[(b+e|0)+4>>2]=40;F[2948]=F[3063];break e}d=0;break b}c=0;break c}if(I[2945]>c>>>0){F[2945]=c}b=c+g|0;a=12212;z:{A:{B:{C:{D:{E:{while(1){if((b|0)!=F[a>>2]){a=F[a+8>>2];if(a){continue}break E}break}if(!(G[a+12|0]&8)){break D}}a=12212;while(1){b=F[a>>2];if(b>>>0<=e>>>0){f=b+F[a+4>>2]|0;if(f>>>0>e>>>0){break C}}a=F[a+8>>2];continue}}F[a>>2]=c;F[a+4>>2]=F[a+4>>2]+g;j=(c+8&7?-8-c&7:0)+c|0;F[j+4>>2]=h|3;g=b+(b+8&7?-8-b&7:0)|0;i=h+j|0;a=g-i|0;if((e|0)==(g|0)){F[2947]=i;a=F[2944]+a|0;F[2944]=a;F[i+4>>2]=a|1;break A}if(F[2946]==(g|0)){F[2946]=i;a=F[2943]+a|0;F[2943]=a;F[i+4>>2]=a|1;F[a+i>>2]=a;break A}f=F[g+4>>2];if((f&3)==1){e=f&-8;F:{if(f>>>0<=255){d=F[g+8>>2];b=f>>>3|0;c=F[g+12>>2];if((c|0)==(d|0)){m=11764,n=F[2941]&oi(b),F[m>>2]=n;break F}F[d+12>>2]=c;F[c+8>>2]=d;break F}h=F[g+24>>2];c=F[g+12>>2];G:{if((g|0)!=(c|0)){b=F[g+8>>2];F[b+12>>2]=c;F[c+8>>2]=b;break G}H:{f=g+20|0;b=F[f>>2];if(b){break H}f=g+16|0;b=F[f>>2];if(b){break H}c=0;break G}while(1){d=f;c=b;f=c+20|0;b=F[f>>2];if(b){continue}f=c+16|0;b=F[c+16>>2];if(b){continue}break}F[d>>2]=0}if(!h){break F}d=F[g+28>>2];b=(d<<2)+12068|0;I:{if(F[b>>2]==(g|0)){F[b>>2]=c;if(c){break I}m=11768,n=F[2942]&oi(d),F[m>>2]=n;break F}F[h+(F[h+16>>2]==(g|0)?16:20)>>2]=c;if(!c){break F}}F[c+24>>2]=h;b=F[g+16>>2];if(b){F[c+16>>2]=b;F[b+24>>2]=c}b=F[g+20>>2];if(!b){break F}F[c+20>>2]=b;F[b+24>>2]=c}g=e+g|0;f=F[g+4>>2];a=a+e|0}F[g+4>>2]=f&-2;F[i+4>>2]=a|1;F[a+i>>2]=a;if(a>>>0<=255){b=(a&-8)+11804|0;c=F[2941];a=1<<(a>>>3);J:{if(!(c&a)){F[2941]=a|c;a=b;break J}a=F[b+8>>2]}F[b+8>>2]=i;F[a+12>>2]=i;F[i+12>>2]=b;F[i+8>>2]=a;break A}f=31;if(a>>>0<=16777215){b=O(a>>>8|0);f=((a>>>38-b&1)-(b<<1)|0)+62|0}F[i+28>>2]=f;F[i+16>>2]=0;F[i+20>>2]=0;b=(f<<2)+12068|0;d=F[2942];c=1<>2]=i;break K}f=a<<((f|0)!=31?25-(f>>>1|0)|0:0);c=F[b>>2];while(1){b=c;if((F[c+4>>2]&-8)==(a|0)){break B}c=f>>>29|0;f=f<<1;d=(c&4)+b|0;c=F[d+16>>2];if(c){continue}break}F[d+16>>2]=i}F[i+24>>2]=b;F[i+12>>2]=i;F[i+8>>2]=i;break A}d=g-40|0;a=c+8&7?-8-c&7:0;b=d-a|0;F[2944]=b;a=a+c|0;F[2947]=a;F[a+4>>2]=b|1;F[(c+d|0)+4>>2]=40;F[2948]=F[3063];a=(f+(f-39&7?39-f&7:0)|0)-47|0;d=a>>>0>>0?e:a;F[d+4>>2]=27;a=F[3056];F[d+16>>2]=F[3055];F[d+20>>2]=a;a=F[3054];F[d+8>>2]=F[3053];F[d+12>>2]=a;F[3055]=d+8;F[3054]=g;F[3053]=c;F[3056]=0;a=d+24|0;while(1){F[a+4>>2]=7;b=a+8|0;a=a+4|0;if(b>>>0>>0){continue}break}if((d|0)==(e|0)){break e}F[d+4>>2]=F[d+4>>2]&-2;f=d-e|0;F[e+4>>2]=f|1;F[d>>2]=f;if(f>>>0<=255){b=(f&-8)+11804|0;c=F[2941];a=1<<(f>>>3);L:{if(!(c&a)){F[2941]=a|c;a=b;break L}a=F[b+8>>2]}F[b+8>>2]=e;F[a+12>>2]=e;F[e+12>>2]=b;F[e+8>>2]=a;break e}a=31;if(f>>>0<=16777215){a=O(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}F[e+28>>2]=a;F[e+16>>2]=0;F[e+20>>2]=0;b=(a<<2)+12068|0;d=F[2942];c=1<>2]=e;break M}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);d=F[b>>2];while(1){b=d;if((f|0)==(F[b+4>>2]&-8)){break z}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;d=F[c+16>>2];if(d){continue}break}F[c+16>>2]=e}F[e+24>>2]=b;F[e+12>>2]=e;F[e+8>>2]=e;break e}a=F[b+8>>2];F[a+12>>2]=i;F[b+8>>2]=i;F[i+24>>2]=0;F[i+12>>2]=b;F[i+8>>2]=a}a=j+8|0;break a}a=F[b+8>>2];F[a+12>>2]=e;F[b+8>>2]=e;F[e+24>>2]=0;F[e+12>>2]=b;F[e+8>>2]=a}a=F[2944];if(a>>>0<=h>>>0){break d}b=a-h|0;F[2944]=b;c=F[2947];a=c+h|0;F[2947]=a;F[a+4>>2]=b|1;F[c+4>>2]=h|3;a=c+8|0;break a}F[2940]=48;a=0;break a}N:{if(!g){break N}b=F[d+28>>2];a=(b<<2)+12068|0;O:{if(F[a>>2]==(d|0)){F[a>>2]=c;if(c){break O}j=oi(b)&j;F[2942]=j;break N}F[g+(F[g+16>>2]==(d|0)?16:20)>>2]=c;if(!c){break N}}F[c+24>>2]=g;a=F[d+16>>2];if(a){F[c+16>>2]=a;F[a+24>>2]=c}a=F[d+20>>2];if(!a){break N}F[c+20>>2]=a;F[a+24>>2]=c}P:{if(f>>>0<=15){a=f+h|0;F[d+4>>2]=a|3;a=a+d|0;F[a+4>>2]=F[a+4>>2]|1;break P}F[d+4>>2]=h|3;e=d+h|0;F[e+4>>2]=f|1;F[e+f>>2]=f;if(f>>>0<=255){b=(f&-8)+11804|0;c=F[2941];a=1<<(f>>>3);Q:{if(!(c&a)){F[2941]=a|c;a=b;break Q}a=F[b+8>>2]}F[b+8>>2]=e;F[a+12>>2]=e;F[e+12>>2]=b;F[e+8>>2]=a;break P}a=31;if(f>>>0<=16777215){a=O(f>>>8|0);a=((f>>>38-a&1)-(a<<1)|0)+62|0}F[e+28>>2]=a;F[e+16>>2]=0;F[e+20>>2]=0;b=(a<<2)+12068|0;R:{c=1<>2]=e;break S}a=f<<((a|0)!=31?25-(a>>>1|0)|0:0);h=F[b>>2];while(1){b=h;if((F[b+4>>2]&-8)==(f|0)){break R}c=a>>>29|0;a=a<<1;c=(c&4)+b|0;h=F[c+16>>2];if(h){continue}break}F[c+16>>2]=e}F[e+24>>2]=b;F[e+12>>2]=e;F[e+8>>2]=e;break P}a=F[b+8>>2];F[a+12>>2]=e;F[b+8>>2]=e;F[e+24>>2]=0;F[e+12>>2]=b;F[e+8>>2]=a}a=d+8|0;break a}T:{if(!i){break T}b=F[c+28>>2];a=(b<<2)+12068|0;U:{if(F[a>>2]==(c|0)){F[a>>2]=d;if(d){break U}m=11768,n=oi(b)&j,F[m>>2]=n;break T}F[i+(F[i+16>>2]==(c|0)?16:20)>>2]=d;if(!d){break T}}F[d+24>>2]=i;a=F[c+16>>2];if(a){F[d+16>>2]=a;F[a+24>>2]=d}a=F[c+20>>2];if(!a){break T}F[d+20>>2]=a;F[a+24>>2]=d}V:{if(f>>>0<=15){a=f+h|0;F[c+4>>2]=a|3;a=a+c|0;F[a+4>>2]=F[a+4>>2]|1;break V}F[c+4>>2]=h|3;d=c+h|0;F[d+4>>2]=f|1;F[d+f>>2]=f;if(k){b=(k&-8)+11804|0;e=F[2946];a=1<<(k>>>3);W:{if(!(a&g)){F[2941]=a|g;a=b;break W}a=F[b+8>>2]}F[b+8>>2]=e;F[a+12>>2]=e;F[e+12>>2]=b;F[e+8>>2]=a}F[2946]=d;F[2943]=f}a=c+8|0}Z=l+16|0;return a|0}function Vc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=Z-32|0;Z=m;o=ka(12);F[o+8>>2]=0;F[o+4>>2]=b;F[o>>2]=0;s=o+12|0;b=s;a:{b:{c:{while(1){b=b-12|0;w=F[b+8>>2];j=F[b+4>>2];t=F[b>>2];if(t){if((w|0)>1e3){break a}F[m+24>>2]=0;F[m+16>>2]=0;F[m+20>>2]=0;d=1;c=F[a>>2];e=F[c+8>>2];h=F[c+12>>2];g=F[c+20>>2];f=F[c+16>>2];d:{if((h|0)<=(g|0)&f>>>0>=e>>>0|(g|0)>(h|0)){break d}e=G[f+F[c>>2]|0];h=c;c=g;f=f+1|0;c=f?c:c+1|0;F[h+16>>2]=f;F[h+20>>2]=c;Sb(m+16|0,e);if(e){c=F[a>>2];n=Tb(m+16|0);p=F[c+8>>2];g=F[c+12>>2];h=F[c+20>>2];f=F[c+16>>2];k=f+e|0;h=k>>>0>>0?h+1|0:h;if((g|0)<=(h|0)&k>>>0>p>>>0|(g|0)<(h|0)){break d}la(n,f+F[c>>2]|0,e);d=F[c+20>>2];f=e;e=e+F[c+16>>2]|0;d=f>>>0>e>>>0?d+1|0:d;F[c+16>>2]=e;F[c+20>>2]=d}j=ka(24);c=j;F[c+4>>2]=0;F[c+8>>2]=0;c=c+16|0;F[c>>2]=0;F[c+4>>2]=0;F[j>>2]=j+4;F[j+12>>2]=c;e=Z-32|0;Z=e;h=t+12|0;c=m+16|0;u=Ya(h,c);i=t+16|0;e:{if((u|0)==(i|0)){F[e+16>>2]=c;f:{g:{d=F[h+4>>2];h:{if(!d){f=h+4|0;c=f;break h}f=G[c+11|0];g=f<<24>>24<0;n=g?F[c>>2]:c;g=g?F[c+4>>2]:f;while(1){c=d;d=G[c+27|0];f=d<<24>>24<0;d=f?F[c+20>>2]:d;p=d>>>0>>0;i:{j:{k:{l:{k=p?d:g;m:{if(k){f=f?F[c+16>>2]:c+16|0;q=sa(n,f,k);if(!q){if(d>>>0>g>>>0){break m}break l}if((q|0)>=0){break l}break m}if(d>>>0<=g>>>0){break k}}f=c;d=F[c>>2];if(d){continue}break h}d=sa(f,n,k);if(d){break j}}if(p){break i}break g}if((d|0)>=0){break g}}d=F[c+4>>2];if(d){continue}break}f=c+4|0}d=ka(32);n=d+16|0;g=F[e+16>>2];n:{if(D[g+11|0]>=0){p=F[g+4>>2];F[n>>2]=F[g>>2];F[n+4>>2]=p;F[n+8>>2]=F[g+8>>2];break n}ra(n,F[g>>2],F[g+4>>2])}F[d+8>>2]=c;F[d>>2]=0;F[d+4>>2]=0;F[d+28>>2]=0;F[f>>2]=d;c=d;g=F[F[h>>2]>>2];if(g){F[h>>2]=g;c=F[f>>2]}nb(F[h+4>>2],c);F[h+8>>2]=F[h+8>>2]+1;c=1;break f}d=c;c=0}D[e+28|0]=c;F[e+24>>2]=d;d=F[e+24>>2];c=F[d+28>>2];F[d+28>>2]=j;if(!c){break e}Ca(c+12|0,F[c+16>>2]);Ba(c,F[c+4>>2]);ja(c);break e}if(!j){break e}Ca(j+12|0,F[j+16>>2]);Ba(j,F[j+4>>2]);ja(j)}Z=e+32|0;d=(i|0)!=(u|0)}if(D[m+27|0]<0){ja(F[m+16>>2])}if(d){break a}}if(!j){break a}F[m+16>>2]=0;if(!fb(1,m+16|0,F[a>>2])){break a}q=0;x=F[m+16>>2];if(x){while(1){d=0;i=Z-32|0;Z=i;F[i+24>>2]=0;F[i+16>>2]=0;F[i+20>>2]=0;c=F[a>>2];f=F[c+8>>2];o:{p:{h=F[c+12>>2];g=F[c+20>>2];e=F[c+16>>2];q:{if((h|0)<=(g|0)&e>>>0>=f>>>0|(g|0)>(h|0)){break q}f=G[e+F[c>>2]|0];h=c;c=g;e=e+1|0;c=e?c:c+1|0;F[h+16>>2]=e;F[h+20>>2]=c;Sb(i+16|0,f);if(f){e=F[a>>2];n=Tb(i+16|0);p=F[e+8>>2];g=F[e+12>>2];c=F[e+20>>2];h=F[e+16>>2];k=h+f|0;c=k>>>0>>0?c+1|0:c;if(k>>>0>p>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break q}la(n,h+F[e>>2]|0,f);c=F[e+20>>2];g=f;f=f+F[e+16>>2]|0;c=g>>>0>f>>>0?c+1|0:c;F[e+16>>2]=f;F[e+20>>2]=c}F[i+12>>2]=0;if(!fb(1,i+12|0,F[a>>2])){break q}f=F[i+12>>2];if(!f){break q}e=F[a>>2];c=F[e+8>>2];h=F[e+16>>2];g=c-h|0;c=F[e+12>>2]-(F[e+20>>2]+(c>>>0>>0)|0)|0;if((c|0)<=0&f>>>0>g>>>0|(c|0)<0){break q}F[i+8>>2]=0;F[i>>2]=0;F[i+4>>2]=0;if((f|0)<0){break p}d=ka(f);F[i>>2]=d;c=d+f|0;F[i+8>>2]=c;l=ma(d,0,f);F[i+4>>2]=c;h=F[e+12>>2];y=h;p=F[e+8>>2];c=F[e+20>>2];k=F[e+16>>2];g=f+k|0;c=g>>>0>>0?c+1|0:c;u=g;n=c;r:{if((c|0)<=(h|0)&g>>>0<=p>>>0|(c|0)<(h|0)){la(l,F[e>>2]+k|0,f);d=F[e+20>>2];c=f+F[e+16>>2]|0;d=c>>>0>>0?d+1|0:d;F[e+16>>2]=c;F[e+20>>2]=d;h=Z-48|0;Z=h;e=Ya(j,i+16|0);if((e|0)!=(j+4|0)){c=F[e+4>>2];s:{if(!c){c=e;while(1){d=F[c+8>>2];f=F[d>>2]!=(c|0);c=d;if(f){continue}break}break s}while(1){d=c;c=F[c>>2];if(c){continue}break}}if((e|0)==F[j>>2]){F[j>>2]=d}F[j+8>>2]=F[j+8>>2]-1;f=F[j+4>>2];t:{u:{g=e;d=e;e=F[d>>2];if(e){c=F[g+4>>2];if(!c){break u}while(1){d=c;c=F[c>>2];if(c){continue}break}}e=F[d+4>>2];if(e){break u}e=0;k=1;break t}F[e+8>>2]=F[d+8>>2];k=0}l=F[d+8>>2];c=F[l>>2];v:{if((d|0)==(c|0)){F[l>>2]=e;if((d|0)==(f|0)){c=0;f=e;break v}c=F[l+4>>2];break v}F[l+4>>2]=e}r=!G[d+12|0];if((d|0)!=(g|0)){l=F[g+8>>2];F[d+8>>2]=l;F[l+(((g|0)!=F[F[g+8>>2]>>2])<<2)>>2]=d;l=F[g>>2];F[d>>2]=l;F[l+8>>2]=d;l=F[g+4>>2];F[d+4>>2]=l;if(l){F[l+8>>2]=d}D[d+12|0]=G[g+12|0];f=(f|0)==(g|0)?d:f}w:{if(r|!f){break w}if(k){while(1){e=G[c+12|0];x:{d=F[c+8>>2];if(F[d>>2]!=(c|0)){if(!e){D[c+12|0]=1;D[d+12|0]=0;e=F[d+4>>2];k=F[e>>2];F[d+4>>2]=k;if(k){F[k+8>>2]=d}F[e+8>>2]=F[d+8>>2];k=F[d+8>>2];F[(((d|0)!=F[k>>2])<<2)+k>>2]=e;F[e>>2]=d;F[d+8>>2]=e;d=c;c=F[c>>2];f=(c|0)==(f|0)?d:f;c=F[c+4>>2]}y:{z:{d=F[c>>2];A:{if(!(G[d+12|0]?0:d)){e=F[c+4>>2];if(G[e+12|0]?0:e){break A}D[c+12|0]=0;c=F[c+8>>2];B:{if((f|0)==(c|0)){c=f;break B}if(G[c+12|0]){break x}}D[c+12|0]=1;break w}e=F[c+4>>2];if(!e){break z}}if(G[e+12|0]){break z}d=c;break y}D[d+12|0]=1;D[c+12|0]=0;e=F[d+4>>2];F[c>>2]=e;if(e){F[e+8>>2]=c}F[d+8>>2]=F[c+8>>2];e=F[c+8>>2];F[((F[e>>2]!=(c|0))<<2)+e>>2]=d;F[d+4>>2]=c;F[c+8>>2]=d;e=c}c=F[d+8>>2];D[d+12|0]=G[c+12|0];D[c+12|0]=1;D[e+12|0]=1;d=F[c+4>>2];e=F[d>>2];F[c+4>>2]=e;if(e){F[e+8>>2]=c}F[d+8>>2]=F[c+8>>2];e=F[c+8>>2];F[(((c|0)!=F[e>>2])<<2)+e>>2]=d;F[d>>2]=c;F[c+8>>2]=d;break w}if(!e){D[c+12|0]=1;D[d+12|0]=0;e=F[c+4>>2];F[d>>2]=e;if(e){F[e+8>>2]=d}F[c+8>>2]=F[d+8>>2];e=F[d+8>>2];F[(((d|0)!=F[e>>2])<<2)+e>>2]=c;F[c+4>>2]=d;F[d+8>>2]=c;f=(d|0)==(f|0)?c:f;c=F[d>>2]}e=F[c>>2];C:{if(!(!e|G[e+12|0])){d=c;break C}d=F[c+4>>2];if(!(G[d+12|0]?0:d)){D[c+12|0]=0;c=F[c+8>>2];if((c|0)!=(f|0)?G[c+12|0]:0){break x}D[c+12|0]=1;break w}if(e){if(!G[e+12|0]){d=c;break C}d=F[c+4>>2]}D[d+12|0]=1;D[c+12|0]=0;e=F[d>>2];F[c+4>>2]=e;if(e){F[e+8>>2]=c}F[d+8>>2]=F[c+8>>2];e=F[c+8>>2];F[((F[e>>2]!=(c|0))<<2)+e>>2]=d;F[d>>2]=c;F[c+8>>2]=d;e=c}c=F[d+8>>2];D[d+12|0]=G[c+12|0];D[c+12|0]=1;D[e+12|0]=1;d=F[c>>2];e=F[d+4>>2];F[c>>2]=e;if(e){F[e+8>>2]=c}F[d+8>>2]=F[c+8>>2];e=F[c+8>>2];F[(((c|0)!=F[e>>2])<<2)+e>>2]=d;F[d+4>>2]=c;F[c+8>>2]=d;break w}d=c;c=F[c+8>>2];c=F[(((d|0)==F[c>>2])<<2)+c>>2];continue}}D[e+12|0]=1}c=F[g+28>>2];if(c){F[g+32>>2]=c;ja(c)}if(D[g+27|0]<0){ja(F[g+16>>2])}ja(g)}F[h+8>>2]=0;F[h>>2]=0;F[h+4>>2]=0;c=F[i+4>>2];d=F[i>>2];f=c-d|0;e=0;D:{E:{if((c|0)!=(d|0)){if((f|0)<0){break E}e=ka(f);c=ma(e,0,f);g=c+f|0;F[h+8>>2]=g;F[h+4>>2]=g;F[h>>2]=c;c=d}la(e,c,f);F:{if(D[i+27|0]>=0){F[h+24>>2]=F[i+24>>2];c=F[i+20>>2];F[h+16>>2]=F[i+16>>2];F[h+20>>2]=c;break F}ra(h+16|0,F[i+16>>2],F[i+20>>2])}Tc(h+28|0,h);f=h+16|0;c=f;G:{H:{d=F[j+4>>2];I:{if(!d){e=j+4|0;c=e;break I}e=G[c+11|0];g=e<<24>>24<0;k=g?F[c>>2]:c;g=g?F[c+4>>2]:e;while(1){c=d;d=G[c+27|0];e=d<<24>>24<0;d=e?F[c+20>>2]:d;l=d>>>0>>0;J:{K:{L:{M:{r=l?d:g;N:{if(r){e=e?F[c+16>>2]:c+16|0;z=sa(k,e,r);if(!z){if(d>>>0>g>>>0){break N}break M}if((z|0)>=0){break M}break N}if(d>>>0<=g>>>0){break L}}e=c;d=F[c>>2];if(d){continue}break I}d=sa(e,k,r);if(d){break K}}if(l){break J}break H}if((d|0)>=0){break H}}d=F[c+4>>2];if(d){continue}break}e=c+4|0}d=ka(40);F[d+24>>2]=F[f+8>>2];g=F[f+4>>2];F[d+16>>2]=F[f>>2];F[d+20>>2]=g;F[f>>2]=0;F[f+4>>2]=0;F[f+8>>2]=0;Tc(d+28|0,f+12|0);F[d+8>>2]=c;F[d>>2]=0;F[d+4>>2]=0;F[e>>2]=d;c=d;f=F[F[j>>2]>>2];if(f){F[j>>2]=f;c=F[e>>2]}nb(F[j+4>>2],c);F[j+8>>2]=F[j+8>>2]+1;c=1;break G}d=c;c=0}D[h+44|0]=c;F[h+40>>2]=d;c=F[h+28>>2];if(c){F[h+32>>2]=c;ja(c)}if(D[h+27|0]<0){ja(F[h+16>>2])}c=F[h>>2];if(c){F[h+4>>2]=c;ja(c)}Z=h+48|0;break D}na();v()}d=F[i>>2];if(!d){break r}}F[i+4>>2]=d;ja(d)}d=(n|0)<=(y|0)&p>>>0>=u>>>0|(n|0)<(y|0)}if(D[i+27|0]<0){ja(F[i+16>>2])}Z=i+32|0;break o}na();v()}if(!d){break a}q=q+1|0;if((x|0)!=(q|0)){continue}break}}F[m+12>>2]=0;if(!fb(1,m+12|0,F[a>>2])){break a}c=F[a>>2];e=F[c+8>>2];f=F[c+16>>2];h=e-f|0;d=F[m+12>>2];c=F[c+12>>2]-(F[c+20>>2]+(e>>>0>>0)|0)|0;if(h>>>0>>0&(c|0)<=0|(c|0)<0){break a}if(d){q=0;h=((t|0)!=0)+w|0;while(1){O:{if(b>>>0>>0){F[b+8>>2]=h;F[b+4>>2]=0;F[b>>2]=j;b=b+12|0;d=F[m+12>>2];break O}c=b-o|0;g=(c|0)/12|0;b=g+1|0;if(b>>>0>=357913942){break c}e=(s-o|0)/12|0;f=e<<1;e=e>>>0>=178956970?357913941:b>>>0>>0?f:b;if(e){if(e>>>0>=357913942){break b}f=ka(L(e,12))}else{f=0}b=f+L(g,12)|0;F[b+8>>2]=h;F[b+4>>2]=0;F[b>>2]=j;c=pa(b+L((c|0)/-12|0,12)|0,o,c);s=f+L(e,12)|0;b=b+12|0;if(o){ja(o)}o=c}q=q+1|0;if(q>>>0>>0){continue}break}}if((b|0)!=(o|0)){continue}break}A=1;break a}na();v()}oa();v()}if(o){ja(o)}Z=m+32|0;return A}function me(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=Z-48|0;Z=h;a:{if((c|0)!=1){break a}i=F[a+4>>2];c=F[a+12>>2];F[h+40>>2]=0;F[h+32>>2]=0;F[h+36>>2]=0;F[h+24>>2]=0;F[h+28>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;F[h+8>>2]=0;F[h+12>>2]=0;d=h+8|0;b:{if((b|0)==-2){break b}k=F[F[F[i+4>>2]+8>>2]+(c<<2)>>2];if(($[F[F[i>>2]+8>>2]](i)|0)==1){j=Z-32|0;Z=j;l=F[F[F[i+4>>2]+8>>2]+(c<<2)>>2];c:{d:{e:{if(($[F[F[i>>2]+8>>2]](i)|0)!=1|b-1>>>0>5){break e}g=$[F[F[i>>2]+36>>2]](i)|0;f=$[F[F[i>>2]+44>>2]](i,c)|0;if(!g|!f){break e}c=$[F[F[i>>2]+40>>2]](i,c)|0;if(c){a=F[i+44>>2];F[j+12>>2]=c;F[j+8>>2]=a;F[j+20>>2]=f;F[j+16>>2]=f+12;f=j+8|0;a=0;f:{g:{switch(b-1|0){case 0:b=ka(60);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b>>2]=2252;a=b;break f;case 3:b=ka(112);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b+60>>2]=0;F[b+64>>2]=0;F[b>>2]=3016;F[b+68>>2]=0;F[b+72>>2]=0;F[b+76>>2]=0;F[b+80>>2]=0;F[b+84>>2]=0;F[b+88>>2]=0;F[b+92>>2]=0;F[b+96>>2]=0;F[b+100>>2]=0;F[b+104>>2]=0;F[b+108>>2]=0;a=b;break f;case 4:b=ka(104);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b+84>>2]=0;F[b+76>>2]=0;F[b+80>>2]=0;F[b+60>>2]=0;F[b+64>>2]=0;F[b>>2]=3264;a=F[f+4>>2];F[b+88>>2]=F[f>>2];F[b+92>>2]=a;a=F[f+12>>2];F[b+96>>2]=F[f+8>>2];F[b+100>>2]=a;a=b;break f;case 5:break g;default:break f}}a=ka(128);F[a+4>>2]=l;F[a>>2]=2960;b=F[d+4>>2];F[a+8>>2]=F[d>>2];F[a+12>>2]=b;b=F[d+12>>2];F[a+16>>2]=F[d+8>>2];F[a+20>>2]=b;b=F[d+20>>2];F[a+24>>2]=F[d+16>>2];F[a+28>>2]=b;F[a+40>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;h:{i:{c=F[d+28>>2];b=F[d+24>>2];if((c|0)!=(b|0)){c=c-b|0;if((c|0)<0){break i}b=ka(c);F[a+36>>2]=b;F[a+32>>2]=b;F[a+40>>2]=(c&-4)+b;e=F[d+24>>2];c=F[d+28>>2];if((e|0)!=(c|0)){while(1){F[b>>2]=F[e>>2];b=b+4|0;e=e+4|0;if((c|0)!=(e|0)){continue}break}}F[a+36>>2]=b}F[a>>2]=2904;b=F[f+4>>2];F[a+44>>2]=F[f>>2];F[a+48>>2]=b;b=F[f+12>>2];F[a+52>>2]=F[f+8>>2];F[a+56>>2]=b;b=a- -64|0;F[b>>2]=0;F[b+4>>2]=0;F[a+60>>2]=4128;F[a>>2]=3500;b=F[f+4>>2];F[a+72>>2]=F[f>>2];F[a+76>>2]=b;b=F[f+12>>2];F[a+80>>2]=F[f+8>>2];F[a+84>>2]=b;F[a+104>>2]=1065353216;F[a+108>>2]=-1;F[a+96>>2]=-1;F[a+100>>2]=-1;F[a+88>>2]=1;F[a+92>>2]=-1;F[a+60>>2]=3736;F[a+112>>2]=0;F[a+116>>2]=0;D[a+117|0]=0;D[a+118|0]=0;D[a+119|0]=0;D[a+120|0]=0;D[a+121|0]=0;D[a+122|0]=0;D[a+123|0]=0;D[a+124|0]=0;break h}na();v()}break f}e=a;break e}a=F[i+44>>2];F[j+12>>2]=g;F[j+8>>2]=a;F[j+20>>2]=f;F[j+16>>2]=f+12;f=j+8|0;a=0;j:{k:{switch(b-1|0){case 0:b=ka(60);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b>>2]=4156;a=b;break j;case 3:b=ka(112);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b+60>>2]=0;F[b+64>>2]=0;F[b>>2]=4580;F[b+68>>2]=0;F[b+72>>2]=0;F[b+76>>2]=0;F[b+80>>2]=0;F[b+84>>2]=0;F[b+88>>2]=0;F[b+92>>2]=0;F[b+96>>2]=0;F[b+100>>2]=0;F[b+104>>2]=0;F[b+108>>2]=0;a=b;break j;case 4:b=ka(104);F[b+4>>2]=l;F[b>>2]=2960;a=F[d+4>>2];F[b+8>>2]=F[d>>2];F[b+12>>2]=a;a=F[d+12>>2];F[b+16>>2]=F[d+8>>2];F[b+20>>2]=a;a=F[d+20>>2];F[b+24>>2]=F[d+16>>2];F[b+28>>2]=a;F[b+40>>2]=0;F[b+32>>2]=0;F[b+36>>2]=0;a=F[d+24>>2];g=F[d+28>>2];if((a|0)!=(g|0)){c=g-a|0;if((c|0)<0){break d}e=ka(c);F[b+32>>2]=e;F[b+40>>2]=(c&-4)+e;while(1){F[e>>2]=F[a>>2];e=e+4|0;a=a+4|0;if((g|0)!=(a|0)){continue}break}F[b+36>>2]=e}a=F[f+4>>2];F[b+44>>2]=F[f>>2];F[b+48>>2]=a;a=F[f+12>>2];F[b+52>>2]=F[f+8>>2];F[b+56>>2]=a;F[b+84>>2]=0;F[b+76>>2]=0;F[b+80>>2]=0;F[b+60>>2]=0;F[b+64>>2]=0;F[b>>2]=4816;a=F[f+4>>2];F[b+88>>2]=F[f>>2];F[b+92>>2]=a;a=F[f+12>>2];F[b+96>>2]=F[f+8>>2];F[b+100>>2]=a;a=b;break j;case 5:break k;default:break j}}a=ka(128);F[a+4>>2]=l;F[a>>2]=2960;b=F[d+4>>2];F[a+8>>2]=F[d>>2];F[a+12>>2]=b;b=F[d+12>>2];F[a+16>>2]=F[d+8>>2];F[a+20>>2]=b;b=F[d+20>>2];F[a+24>>2]=F[d+16>>2];F[a+28>>2]=b;F[a+40>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;l:{m:{c=F[d+28>>2];b=F[d+24>>2];if((c|0)!=(b|0)){c=c-b|0;if((c|0)<0){break m}b=ka(c);F[a+36>>2]=b;F[a+32>>2]=b;F[a+40>>2]=(c&-4)+b;e=F[d+24>>2];c=F[d+28>>2];if((e|0)!=(c|0)){while(1){F[b>>2]=F[e>>2];b=b+4|0;e=e+4|0;if((c|0)!=(e|0)){continue}break}}F[a+36>>2]=b}F[a>>2]=4524;b=F[f+4>>2];F[a+44>>2]=F[f>>2];F[a+48>>2]=b;b=F[f+12>>2];F[a+52>>2]=F[f+8>>2];F[a+56>>2]=b;b=a- -64|0;F[b>>2]=0;F[b+4>>2]=0;F[a+60>>2]=5624;F[a>>2]=5040;b=F[f+4>>2];F[a+72>>2]=F[f>>2];F[a+76>>2]=b;b=F[f+12>>2];F[a+80>>2]=F[f+8>>2];F[a+84>>2]=b;F[a+104>>2]=1065353216;F[a+108>>2]=-1;F[a+96>>2]=-1;F[a+100>>2]=-1;F[a+88>>2]=1;F[a+92>>2]=-1;F[a+60>>2]=5260;F[a+112>>2]=0;F[a+116>>2]=0;D[a+117|0]=0;D[a+118|0]=0;D[a+119|0]=0;D[a+120|0]=0;D[a+121|0]=0;D[a+122|0]=0;D[a+123|0]=0;D[a+124|0]=0;break l}na();v()}break j}e=a}Z=j+32|0;break c}na();v()}if(e){break b}}e=ka(44);F[e+4>>2]=k;F[e>>2]=2960;a=F[d+4>>2];F[e+8>>2]=F[d>>2];F[e+12>>2]=a;a=F[d+12>>2];F[e+16>>2]=F[d+8>>2];F[e+20>>2]=a;a=F[d+20>>2];F[e+24>>2]=F[d+16>>2];F[e+28>>2]=a;F[e+40>>2]=0;F[e+32>>2]=0;F[e+36>>2]=0;n:{c=F[d+24>>2];b=F[d+28>>2];if((c|0)!=(b|0)){a=b-c|0;if((a|0)<0){break n}k=ka(a);F[e+32>>2]=k;F[e+40>>2]=(a&-4)+k;while(1){F[k>>2]=F[c>>2];k=k+4|0;c=c+4|0;if((b|0)!=(c|0)){continue}break}F[e+36>>2]=k}F[e>>2]=5652;break b}na();v()}k=e;a=F[h+32>>2];if(!a){break a}F[h+36>>2]=a;ja(a)}Z=h+48|0;return k|0}function rf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0;m=Z-16|0;Z=m;F[m+12>>2]=b;b=ka(32);F[m>>2]=b;F[m+4>>2]=24;F[m+8>>2]=-2147483616;c=G[1196]|G[1197]<<8|(G[1198]<<16|G[1199]<<24);d=G[1192]|G[1193]<<8|(G[1194]<<16|G[1195]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1188]|G[1189]<<8|(G[1190]<<16|G[1191]<<24);d=G[1184]|G[1185]<<8|(G[1186]<<16|G[1187]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1180]|G[1181]<<8|(G[1182]<<16|G[1183]<<24);d=G[1176]|G[1177]<<8|(G[1178]<<16|G[1179]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;D[b+24|0]=0;l=Z-48|0;Z=l;f=F[m+12>>2];d=a;a=a+16|0;b=F[a>>2];a:{b:{if(!b){break b}c=a;while(1){e=(f|0)>F[b+16>>2];c=e?c:b;b=F[(e?b+4|0:b)>>2];if(b){continue}break}if((a|0)==(c|0)){break b}if((f|0)>=F[c+16>>2]){break a}}F[l+28>>2]=0;F[l+32>>2]=0;y=l+24|0;F[l+24>>2]=y|4;a=l+16|0;F[a>>2]=0;F[a+4>>2]=0;F[l+8>>2]=f;F[l+12>>2]=a;t=l+8|0;a=t;x=Z-16|0;Z=x;u=d+12|0;c=F[u+4>>2];c:{d:{if(!c){o=u+4|0;d=o;break d}a=F[a>>2];while(1){d=c;b=F[c+16>>2];if((b|0)>(a|0)){o=d;c=F[d>>2];if(c){continue}break d}if((a|0)<=(b|0)){g=d;a=0;break c}c=F[d+4>>2];if(c){continue}break}o=d+4|0}g=ka(32);b=F[t>>2];q=g+24|0;a=q;F[a>>2]=0;F[a+4>>2]=0;F[g+16>>2]=b;r=g+20|0;F[r>>2]=a;c=F[t+4>>2];z=t+8|0;if((c|0)!=(z|0)){while(1){p=Z-16|0;Z=p;a=p+8|0;k=c+16|0;e:{f:{g:{h:{i:{j:{k:{f=q;e=r+4|0;l:{if((f|0)==(e|0)){break l}b=G[f+27|0];h=b<<24>>24<0;i=G[k+11|0];n=i<<24>>24;j=(n|0)<0;i=j?F[k+4>>2]:i;b=h?F[f+20>>2]:b;s=i>>>0>b>>>0;w=s?b:i;if(w){j=j?F[k>>2]:k;h=h?F[f+16>>2]:f+16|0;A=sa(j,h,w);if(!A){if(b>>>0>i>>>0){break l}break k}if((A|0)>=0){break k}break l}if(b>>>0<=i>>>0){break j}}h=F[f>>2];m:{a=f;n:{if((a|0)==F[r>>2]){break n}o:{if(!h){b=f;while(1){a=F[b+8>>2];i=F[a>>2]==(b|0);b=a;if(i){continue}break}break o}b=h;while(1){a=b;b=F[b+4>>2];if(b){continue}break}}i=G[k+11|0];s=i<<24>>24;b=(s|0)<0;j=G[a+27|0];n=j<<24>>24<0;p:{i=b?F[k+4>>2]:i;j=n?F[a+20>>2]:j;w=i>>>0>>0?i:j;if(w){b=sa(n?F[a+16>>2]:a+16|0,b?F[k>>2]:k,w);if(b){break p}}if(i>>>0>j>>>0){break n}break m}if((b|0)>=0){break m}}if(!h){F[p+12>>2]=f;a=f;break e}F[p+12>>2]=a;a=a+4|0;break e}b=F[e>>2];if(!b){F[p+12>>2]=e;a=e;break e}h=(s|0)<0?F[k>>2]:k;f=e;while(1){a=b;b=G[b+27|0];e=b<<24>>24<0;b=e?F[a+20>>2]:b;k=b>>>0>>0;q:{r:{s:{t:{n=k?b:i;u:{if(n){e=e?F[a+16>>2]:a+16|0;j=sa(h,e,n);if(!j){if(b>>>0>i>>>0){break u}break t}if((j|0)>=0){break t}break u}if(b>>>0<=i>>>0){break s}}f=a;b=F[a>>2];if(b){continue}break g}b=sa(e,h,n);if(b){break r}}if(k){break q}break g}if((b|0)>=0){break g}}f=a+4|0;b=F[a+4>>2];if(b){continue}break}break g}b=sa(h,j,w);if(b){break i}}if(s){break h}break f}if((b|0)>=0){break f}}h=F[f+4>>2];v:{if(!h){b=f;while(1){a=F[b+8>>2];j=F[a>>2]!=(b|0);b=a;if(j){continue}break}break v}b=h;while(1){a=b;b=F[b>>2];if(b){continue}break}}w:{x:{if((a|0)==(e|0)){break x}j=G[a+27|0];b=j<<24>>24<0;y:{j=b?F[a+20>>2]:j;s=i>>>0>j>>>0?j:i;if(s){b=sa((n|0)<0?F[k>>2]:k,b?F[a+16>>2]:a+16|0,s);if(b){break y}}if(i>>>0>>0){break x}break w}if((b|0)>=0){break w}}if(!h){F[p+12>>2]=f;a=f+4|0;break e}F[p+12>>2]=a;break e}b=F[e>>2];if(!b){F[p+12>>2]=e;a=e;break e}h=(n|0)<0?F[k>>2]:k;f=e;while(1){a=b;b=G[b+27|0];e=b<<24>>24<0;b=e?F[a+20>>2]:b;k=b>>>0>>0;z:{A:{B:{C:{n=k?b:i;D:{if(n){e=e?F[a+16>>2]:a+16|0;j=sa(h,e,n);if(!j){if(b>>>0>i>>>0){break D}break C}if((j|0)>=0){break C}break D}if(b>>>0<=i>>>0){break B}}f=a;b=F[a>>2];if(b){continue}break g}b=sa(e,h,n);if(b){break A}}if(k){break z}break g}if((b|0)>=0){break g}}f=a+4|0;b=F[a+4>>2];if(b){continue}break}}F[p+12>>2]=a;a=f;break e}F[p+12>>2]=f;F[a>>2]=f}f=a;a=F[a>>2];if(a){b=0}else{a=ka(40);b=a+16|0;E:{if(D[c+27|0]>=0){e=F[c+20>>2];F[b>>2]=F[c+16>>2];F[b+4>>2]=e;F[b+8>>2]=F[c+24>>2];break E}ra(b,F[c+16>>2],F[c+20>>2])}b=a+28|0;F:{if(D[c+39|0]>=0){e=F[c+32>>2];F[b>>2]=F[c+28>>2];F[b+4>>2]=e;F[b+8>>2]=F[c+36>>2];break F}ra(b,F[c+28>>2],F[c+32>>2])}F[a+8>>2]=F[p+12>>2];F[a>>2]=0;F[a+4>>2]=0;F[f>>2]=a;b=a;e=F[F[r>>2]>>2];if(e){F[r>>2]=e;b=F[f>>2]}nb(F[r+4>>2],b);F[r+8>>2]=F[r+8>>2]+1;b=1}D[x+12|0]=b;F[x+8>>2]=a;Z=p+16|0;b=F[c+4>>2];G:{if(b){while(1){c=b;b=F[b>>2];if(b){continue}break G}}while(1){a=c;c=F[c+8>>2];if((a|0)!=F[c>>2]){continue}break}}if((c|0)!=(z|0)){continue}break}}F[g+8>>2]=d;F[g>>2]=0;F[g+4>>2]=0;F[o>>2]=g;c=g;a=F[F[u>>2]>>2];if(a){F[u>>2]=a;c=F[o>>2]}nb(F[u+4>>2],c);F[u+8>>2]=F[u+8>>2]+1;a=1}D[l+44|0]=a;F[l+40>>2]=g;Z=x+16|0;c=F[l+40>>2];ib(t|4,F[l+16>>2]);ib(y,F[l+28>>2])}f=Z-48|0;Z=f;d=f+8|0;g=Z-32|0;Z=g;o=g+32|0;b=o;a=g+21|0;H:{if((b|0)==(a|0)){break H}}e=b-a|0;I:{if((e|0)<=9){h=61;if((e|0)<(I[2684]<=1|0)){break I}}D[a|0]=49;b=a+1|0;h=0}F[g+12>>2]=h;F[g+8>>2]=b;h=Z-16|0;Z=h;e=Z-16|0;Z=e;J:{q=F[g+8>>2];g=q-a|0;if(g>>>0<=2147483631){K:{if(g>>>0<11){D[d+11|0]=g|G[d+11|0]&128;D[d+11|0]=G[d+11|0]&127;b=d;break K}t=e+8|0;if(g>>>0>=11){k=g+16&-16;b=k-1|0;b=(b|0)==11?k:b}else{b=10}sb(t,b+1|0);b=F[e+8>>2];F[d>>2]=b;F[d+8>>2]=F[d+8>>2]&-2147483648|F[e+12>>2]&2147483647;F[d+8>>2]=F[d+8>>2]|-2147483648;F[d+4>>2]=g}while(1){if((a|0)!=(q|0)){D[b|0]=G[a|0];b=b+1|0;a=a+1|0;continue}break}D[e+7|0]=0;D[b|0]=G[e+7|0];Z=e+16|0;break J}za();v()}Z=h+16|0;Z=o;F[f+32>>2]=m;L:{M:{a=c+20|0;d=F[a+4>>2];N:{if(!d){g=a+4|0;c=g;break N}b=G[m+11|0];c=b<<24>>24<0;e=c?F[m>>2]:m;b=c?F[m+4>>2]:b;while(1){c=d;d=G[c+27|0];g=d<<24>>24<0;d=g?F[c+20>>2]:d;o=d>>>0>>0;O:{P:{Q:{R:{h=o?d:b;S:{if(h){g=g?F[c+16>>2]:c+16|0;q=sa(e,g,h);if(!q){if(b>>>0>>0){break S}break R}if((q|0)>=0){break R}break S}if(b>>>0>=d>>>0){break Q}}g=c;d=F[c>>2];if(d){continue}break N}d=sa(g,e,h);if(d){break P}}if(o){break O}break M}if((d|0)>=0){break M}}d=F[c+4>>2];if(d){continue}break}g=c+4|0}d=ka(40);e=d+16|0;b=F[f+32>>2];T:{if(D[b+11|0]>=0){o=F[b+4>>2];F[e>>2]=F[b>>2];F[e+4>>2]=o;F[e+8>>2]=F[b+8>>2];break T}ra(e,F[b>>2],F[b+4>>2])}F[d+8>>2]=c;F[d>>2]=0;F[d+4>>2]=0;F[d+36>>2]=0;F[d+28>>2]=0;F[d+32>>2]=0;F[g>>2]=d;c=d;b=F[F[a>>2]>>2];if(b){F[a>>2]=b;c=F[g>>2]}nb(F[a+4>>2],c);F[a+8>>2]=F[a+8>>2]+1;a=1;break L}d=c;a=0}D[f+44|0]=a;F[f+40>>2]=d;a=F[f+40>>2];if(D[a+39|0]<0){ja(F[a+28>>2])}b=F[f+12>>2];F[a+28>>2]=F[f+8>>2];F[a+32>>2]=b;F[a+36>>2]=F[f+16>>2];Z=f+48|0;Z=l+48|0;if(D[m+11|0]<0){ja(F[m>>2])}Z=m+16|0}function zd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;h=Z-32|0;Z=h;g=F[F[a+4>>2]+44>>2];c=F[a+8>>2];d=F[c>>2];c=F[c+4>>2];F[h+24>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;d=(c-d>>2>>>0)/3|0;c=F[g+96>>2];f=(F[g+100>>2]-c|0)/12|0;a:{if(d>>>0>f>>>0){e=d-f|0;i=F[g+104>>2];c=F[g+100>>2];if(e>>>0<=(i-c|0)/12>>>0){b:{if(!e){break b}d=c;f=L(e,12)-12|0;i=((f>>>0)/12|0)+1&3;if(i){while(1){l=F[h+20>>2];F[d>>2]=F[h+16>>2];F[d+4>>2]=l;F[d+8>>2]=F[h+24>>2];d=d+12|0;j=j+1|0;if((i|0)!=(j|0)){continue}break}}c=L(e,12)+c|0;if(f>>>0<36){break b}while(1){f=F[h+20>>2];F[d>>2]=F[h+16>>2];F[d+4>>2]=f;F[d+8>>2]=F[h+24>>2];F[d+20>>2]=F[h+24>>2];f=F[h+20>>2];F[d+12>>2]=F[h+16>>2];F[d+16>>2]=f;F[d+32>>2]=F[h+24>>2];f=F[h+20>>2];F[d+24>>2]=F[h+16>>2];F[d+28>>2]=f;f=F[h+20>>2];F[d+36>>2]=F[h+16>>2];F[d+40>>2]=f;F[d+44>>2]=F[h+24>>2];d=d+48|0;if((d|0)!=(c|0)){continue}break}}F[g+100>>2]=c;break a}c:{f=F[g+96>>2];n=(c-f|0)/12|0;d=n+e|0;if(d>>>0<357913942){f=(i-f|0)/12|0;i=f<<1;i=f>>>0>=178956970?357913941:d>>>0>>0?i:d;if(i){if(i>>>0>=357913942){break c}l=ka(L(i,12))}f=L(n,12)+l|0;d=f;e=L(e,12);n=e-12|0;q=((n>>>0)/12|0)+1&3;if(q){while(1){r=F[h+20>>2];F[d>>2]=F[h+16>>2];F[d+4>>2]=r;F[d+8>>2]=F[h+24>>2];d=d+12|0;j=j+1|0;if((q|0)!=(j|0)){continue}break}}e=e+f|0;if(n>>>0>=36){while(1){j=F[h+20>>2];F[d>>2]=F[h+16>>2];F[d+4>>2]=j;F[d+8>>2]=F[h+24>>2];F[d+20>>2]=F[h+24>>2];j=F[h+20>>2];F[d+12>>2]=F[h+16>>2];F[d+16>>2]=j;F[d+32>>2]=F[h+24>>2];j=F[h+20>>2];F[d+24>>2]=F[h+16>>2];F[d+28>>2]=j;j=F[h+20>>2];F[d+36>>2]=F[h+16>>2];F[d+40>>2]=j;F[d+44>>2]=F[h+24>>2];d=d+48|0;if((e|0)!=(d|0)){continue}break}}j=F[g+96>>2];if((j|0)!=(c|0)){while(1){c=c-12|0;n=F[c+4>>2];f=f-12|0;d=f;F[d>>2]=F[c>>2];F[d+4>>2]=n;F[d+8>>2]=F[c+8>>2];if((c|0)!=(j|0)){continue}break}c=F[g+96>>2]}F[g+104>>2]=L(i,12)+l;F[g+100>>2]=e;F[g+96>>2]=f;if(c){ja(c)}break a}na();v()}oa();v()}if(d>>>0>=f>>>0){break a}F[g+100>>2]=c+L(d,12)}d:{if(F[a+216>>2]==F[a+220>>2]){j=F[a+4>>2];c=F[j+44>>2];d=F[c+100>>2];f=F[c+96>>2];if((d|0)!=(f|0)){c=(d-f|0)/12|0;o=c>>>0<=1?1:c;c=0;while(1){d=F[a+8>>2];i=f+L(c,12)|0;g=L(c,3);e:{f:{if((g|0)==-1){e=F[(F[d>>2]+(g<<2)|0)+4>>2];k=-1;g=1;break f}e=-1;k=F[F[d>>2]+(g<<2)>>2];l=g+1|0;if((l|0)==-1){g=0;break f}e=F[F[d>>2]+(l<<2)>>2];g=g+2|0;m=-1;if((g|0)==-1){break e}}m=F[F[d>>2]+(g<<2)>>2]}F[i+8>>2]=m;F[i+4>>2]=e;F[i>>2]=k;c=c+1|0;if((o|0)!=(c|0)){continue}break}}F[F[j+4>>2]+80>>2]=b;c=1;break d}d=0;F[h+24>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;l=F[a+8>>2];c=F[l>>2];g=F[l+4>>2];F[h+8>>2]=0;F[h>>2]=0;F[h+4>>2]=0;b=0;g:{h:{i:{j:{k:{l:{if((c|0)!=(g|0)){c=g-c|0;if((c|0)<0){break l}b=ka(c);F[h>>2]=b;F[h+8>>2]=(c&-4)+b;u=h,w=ma(b,0,c)+c|0,F[u+4>>2]=w}c=F[l+24>>2];if((F[l+28>>2]-c|0)<4){break h}f=0;while(1){g=F[(p<<2)+c>>2];m:{if((g|0)==-1){break m}n:{if(F[F[a+120>>2]+(p>>>3&536870908)>>2]>>>p&1){break n}n=F[a+216>>2];c=F[a+220>>2];if((n|0)==(c|0)){break n}e=g+2|0;i=(g>>>0)%3|0;q=i?g-1|0:e;c=(c-n|0)/144|0;r=c>>>0<=1?1:c;j=0;t=(i|0)!=0|(e|0)!=-1;while(1){s=g<<2;i=L(j,144)+n|0;c=F[s+F[F[i+68>>2]>>2]>>2];o:{if(!(F[F[i+16>>2]+(c>>>3&536870908)>>2]>>>c&1)){break o}c=-1;p:{if(!t){break p}e=F[F[l+12>>2]+(q<<2)>>2];c=-1;if((e|0)==-1){break p}c=e-1|0;if((e>>>0)%3|0){break p}c=e+2|0}if((g|0)==(c|0)){break o}e=s;s=F[i+32>>2];i=F[e+s>>2];while(1){e=0;if((c|0)==-1){break g}if((i|0)!=F[s+(c<<2)>>2]){g=c;break n}q:{r:{if((c>>>0)%3|0){e=c-1|0;break r}e=c+2|0;m=-1;if((e|0)==-1){break q}}c=F[F[l+12>>2]+(e<<2)>>2];m=-1;if((c|0)==-1){break q}m=c-1|0;if((c>>>0)%3|0){break q}m=c+2|0}c=m;if((g|0)!=(c|0)){continue}break}}j=j+1|0;if((r|0)!=(j|0)){continue}break}}i=k-f|0;e=i>>2;F[(g<<2)+b>>2]=e;s:{if(k>>>0>>0){F[k>>2]=g;k=k+4|0;F[h+20>>2]=k;break s}c=e+1|0;if(c>>>0>=1073741824){break k}d=o-f|0;k=d>>>1|0;c=d>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}d=ka(c<<2)}else{d=0}e=d+(e<<2)|0;F[e>>2]=g;m=c<<2;c=pa(d,f,i);o=m+c|0;F[h+24>>2]=o;k=e+4|0;F[h+20>>2]=k;F[h+16>>2]=c;if(f){ja(f);l=F[a+8>>2]}f=c}if((g|0)==-1){break m}t:{if((g>>>0)%3|0){c=g-1|0;break t}c=g+2|0;if((c|0)==-1){break m}}c=F[F[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=g;if((c|0)==(g|0)){break m}while(1){i=c;u:{v:{c=F[a+220>>2];j=F[a+216>>2];if((c|0)==(j|0)){break v}c=(c-j|0)/144|0;n=c>>>0<=1?1:c;c=0;while(1){q=F[(j+L(c,144)|0)+32>>2];r=i<<2;if(F[q+r>>2]==F[q+(e<<2)>>2]){c=c+1|0;if((n|0)!=(c|0)){continue}break v}break}j=k-d|0;e=j>>2;F[b+r>>2]=e;if(k>>>0>>0){F[k>>2]=i;k=k+4|0;F[h+20>>2]=k;f=d;break u}c=e+1|0;if(c>>>0>=1073741824){break i}f=o-d|0;k=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>>0?k:c;if(c){if(c>>>0>=1073741824){break j}f=ka(c<<2)}else{f=0}e=f+(e<<2)|0;F[e>>2]=i;m=c<<2;c=pa(f,d,j);o=m+c|0;F[h+24>>2]=o;k=e+4|0;F[h+20>>2]=k;F[h+16>>2]=c;if(!d){d=c;break u}ja(d);l=F[a+8>>2];d=c;break u}F[(i<<2)+b>>2]=F[(e<<2)+b>>2]}if((i|0)==-1){break m}w:{if((i>>>0)%3|0){c=i-1|0;break w}c=i+2|0;if((c|0)==-1){break m}}c=F[F[l+12>>2]+(c<<2)>>2];if((c|0)==-1){break m}c=c+((c>>>0)%3|0?-1:2)|0;if((c|0)==-1){break m}e=i;if((c|0)!=(g|0)){continue}break}}p=p+1|0;c=F[l+24>>2];if((p|0)>2]-c>>2){continue}break}break h}na();v()}na();v()}oa();v()}na();v()}i=F[a+4>>2];a=F[i+44>>2];c=F[a+100>>2];a=F[a+96>>2];x:{if((c|0)==(a|0)){break x}g=(c-a|0)/12|0;f=g>>>0<=1?1:g;l=f&1;c=0;if(g>>>0>=2){j=f&-2;g=0;while(1){e=L(c,12);f=e+b|0;o=F[f>>2];p=F[f+4>>2];e=a+e|0;F[e+8>>2]=F[f+8>>2];F[e>>2]=o;F[e+4>>2]=p;e=L(c|1,12);f=e+b|0;o=F[f>>2];p=F[f+4>>2];e=a+e|0;F[e+8>>2]=F[f+8>>2];F[e>>2]=o;F[e+4>>2]=p;c=c+2|0;g=g+2|0;if((j|0)!=(g|0)){continue}break}}if(!l){break x}g=L(c,12);c=g+b|0;f=F[c>>2];e=F[c+4>>2];a=a+g|0;F[a+8>>2]=F[c+8>>2];F[a>>2]=f;F[a+4>>2]=e}F[F[i+4>>2]+80>>2]=k-d>>2;e=1}c=e;if(b){ja(b)}if(!d){break d}F[h+20>>2]=d;ja(d)}Z=h+32|0;return c}function de(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,H=0,I=0,J=0,K=0,M=0,N=0,O=0,P=0;g=Z+-64|0;Z=g;F[a+8>>2]=e;y=a+32|0;f=F[y>>2];d=F[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){qa(y,e-d|0);F[g+56>>2]=0;F[g+60>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g>>2]=0;break b}if(d>>>0>e>>>0){F[a+36>>2]=f+(e<<2)}F[g+56>>2]=0;F[g+60>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g>>2]=0;d=0;if(!e){break a}}Fa(g+16|0,e,g);h=F[g+28>>2];d=F[g+32>>2]}F[g>>2]=0;d=d-h>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}F[g+32>>2]=(e<<2)+h;break c}Fa(g+16|12,e-d|0,g)}F[g>>2]=0;f=F[g+40>>2];d=F[g+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}F[g+44>>2]=f+(e<<2);break d}Fa(g+40|0,e-d|0,g)}F[g>>2]=0;f=F[g+52>>2];d=F[g+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}F[g+56>>2]=f+(e<<2);break e}Fa(g+52|0,e-d|0,g)}f:{if(F[a+8>>2]<=0){break f}i=F[g+16>>2];j=F[a+32>>2];h=0;while(1){d=h<<2;f=F[d+i>>2];m=F[a+16>>2];g:{if((f|0)>(m|0)){F[d+j>>2]=m;break g}d=d+j|0;m=F[a+12>>2];if((m|0)>(f|0)){F[d>>2]=m;break g}F[d>>2]=f}h=h+1|0;d=F[a+8>>2];if((h|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){i=d<<2;f=i+c|0;i=F[b+i>>2]+F[j+i>>2]|0;F[f>>2]=i;h:{if((i|0)>F[a+16>>2]){i=i-F[a+20>>2]|0}else{if((i|0)>=F[a+12>>2]){break h}i=i+F[a+20>>2]|0}F[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}H=F[a+52>>2];t=F[a+48>>2];z=ka(16);d=z;F[d>>2]=0;F[d+4>>2]=0;F[d+8>>2]=0;F[d+12>>2]=0;F[g+8>>2]=0;F[g>>2]=0;F[g+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;r=ka(d);F[g>>2]=r;F[g+8>>2]=d+r;ma(r,0,d)}A=1;d=F[a+56>>2];B=F[d>>2];d=F[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;G=e-1|0;M=e<<2;N=e>>>0<4;A=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=F[(m<<2)+B>>2];if((f|0)==-1){break p}k=1;d=f+2|0;j=(f>>>0)%3|0;x=j?f-1|0:d;s=1<>2];O=n+(x>>>3&536870908)|0;i=0;P=(j|0)!=0|(d|0)!=-1;d=f;q:{while(1){r:{if(F[n+(d>>>3&536870908)>>2]>>>d&1){break r}j=F[F[F[t+64>>2]+12>>2]+(d<<2)>>2];if((j|0)==-1){break r}l=F[H>>2];h=F[t+28>>2];p=F[l+(F[h+(j<<2)>>2]<<2)>>2];if((p|0)>=(m|0)){break r}q=j+1|0;q=F[l+(F[h+(((q>>>0)%3|0?q:j-2|0)<<2)>>2]<<2)>>2];if((q|0)>=(m|0)){break r}h=F[l+(F[h+(j+((j>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((h|0)>=(m|0)){break r}s:{if(!e){break s}j=F[(g+16|0)+L(i,12)>>2];l=L(e,h);q=L(e,q);p=L(e,p);h=0;o=0;if(G){while(1){F[j+(h<<2)>>2]=(F[(h+l<<2)+c>>2]+F[(h+q<<2)+c>>2]|0)-F[(h+p<<2)+c>>2];u=h|1;F[j+(u<<2)>>2]=(F[(l+u<<2)+c>>2]+F[(q+u<<2)+c>>2]|0)-F[(p+u<<2)+c>>2];h=h+2|0;o=o+2|0;if((C|0)!=(o|0)){continue}break}}if(!D){break s}F[j+(h<<2)>>2]=(F[(h+l<<2)+c>>2]+F[(h+q<<2)+c>>2]|0)-F[(h+p<<2)+c>>2]}j=4;i=i+1|0;if((i|0)==4){break q}}t:{if(k&1){h=d-2|0;j=d+1|0;d=-1;j=(j>>>0)%3|0?j:h;if((j|0)==-1|F[n+(j>>>3&536870908)>>2]>>>j&1){break t}j=F[F[F[t+64>>2]+12>>2]+(j<<2)>>2];if((j|0)==-1){break t}d=j+1|0;d=(d>>>0)%3|0?d:j-2|0;break t}u:{if((d>>>0)%3|0){h=d-1|0;break u}h=d+2|0;d=-1;if((h|0)==-1){break t}}d=-1;if(F[n+(h>>>3&536870908)>>2]>>>h&1){break t}j=F[F[F[t+64>>2]+12>>2]+(h<<2)>>2];if((j|0)==-1){break t}if((j>>>0)%3|0){d=j-1|0;break t}d=j+2|0}v:{if((d|0)==(f|0)){break v}if((d|0)==-1&k){if(!P|s&F[O>>2]){break v}d=F[F[F[t+64>>2]+12>>2]+(x<<2)>>2];if((d|0)==-1){break v}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}j=i;if((j|0)<=0){break p}}if(e){ma(r,0,M)}d=j-1|0;q=(d<<2)+z|0;d=L(d,12)+a|0;u=d;x=F[d- -64>>2];k=0;d=F[g>>2];f=0;while(1){i=F[q>>2];F[q>>2]=i+1;if(i>>>0>=x>>>0){break j}w:{if(F[F[u+60>>2]+(i>>>3&536870908)>>2]>>>i&1){break w}f=f+1|0;if(!e){break w}n=F[(g+16|0)+L(k,12)>>2];i=0;h=0;p=0;if(!N){while(1){l=h<<2;o=l+d|0;F[o>>2]=F[l+n>>2]+F[o>>2];o=l|4;s=o+d|0;F[s>>2]=F[n+o>>2]+F[s>>2];o=l|8;s=o+d|0;F[s>>2]=F[n+o>>2]+F[s>>2];l=l|12;o=l+d|0;F[o>>2]=F[l+n>>2]+F[o>>2];h=h+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break w}while(1){l=h<<2;p=l+d|0;F[p>>2]=F[l+n>>2]+F[p>>2];h=h+1|0;i=i+1|0;if((E|0)!=(i|0)){continue}break}}k=k+1|0;if((k|0)!=(j|0)){continue}break}i=L(e,m);if(!f){break o}if(!e){break l}h=0;d=0;if(G){break n}break m}i=L(e,m)}if(F[a+8>>2]<=0){break k}k=(L(m-1|0,e)<<2)+c|0;j=F[y>>2];h=0;while(1){d=h<<2;f=F[d+k>>2];n=F[a+16>>2];x:{if((f|0)>(n|0)){F[d+j>>2]=n;break x}d=d+j|0;n=F[a+12>>2];if((n|0)>(f|0)){F[d>>2]=n;break x}F[d>>2]=f}h=h+1|0;f=F[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=F[i+k>>2]+F[j+i>>2]|0;F[f>>2]=i;y:{if((i|0)>F[a+16>>2]){i=i-F[a+20>>2]|0}else{if((i|0)>=F[a+12>>2]){break y}i=i+F[a+20>>2]|0}F[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}break k}ta();v()}while(1){j=h<<2;k=j+r|0;F[k>>2]=F[k>>2]/(f|0);j=(j|4)+r|0;F[j>>2]=F[j>>2]/(f|0);h=h+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(h<<2)+r|0;F[d>>2]=F[d>>2]/(f|0)}if(F[a+8>>2]<=0){break k}j=F[y>>2];h=0;while(1){d=h<<2;f=F[d+r>>2];k=F[a+16>>2];z:{if((f|0)>(k|0)){F[d+j>>2]=k;break z}d=d+j|0;k=F[a+12>>2];if((k|0)>(f|0)){F[d>>2]=k;break z}F[d>>2]=f}h=h+1|0;f=F[a+8>>2];if((h|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=i<<2;h=f+c|0;k=b+f|0;while(1){i=d<<2;f=i+h|0;i=F[i+k>>2]+F[j+i>>2]|0;F[f>>2]=i;A:{if((i|0)>F[a+16>>2]){i=i-F[a+20>>2]|0}else{if((i|0)>=F[a+12>>2]){break A}i=i+F[a+20>>2]|0}F[f>>2]=i}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;A=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=F[g>>2];if(a){ja(a)}ja(z);a=F[g+52>>2];if(a){F[g+56>>2]=a;ja(a)}a=F[g+40>>2];if(a){F[g+44>>2]=a;ja(a)}a=F[g+28>>2];if(a){F[g+32>>2]=a;ja(a)}a=F[g+16>>2];if(a){F[g+20>>2]=a;ja(a)}Z=g- -64|0;return A|0}na();v()}function $h(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,G=0,H=0,I=0,J=0,K=0,M=0,N=0;h=Z+-64|0;Z=h;F[a+8>>2]=e;x=a+32|0;f=F[x>>2];d=F[a+36>>2]-f>>2;a:{b:{if(d>>>0>>0){qa(x,e-d|0);F[h+56>>2]=0;F[h+60>>2]=0;F[h+48>>2]=0;F[h+52>>2]=0;F[h+40>>2]=0;F[h+44>>2]=0;F[h+32>>2]=0;F[h+36>>2]=0;F[h+24>>2]=0;F[h+28>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;F[h>>2]=0;break b}if(d>>>0>e>>>0){F[a+36>>2]=f+(e<<2)}F[h+56>>2]=0;F[h+60>>2]=0;F[h+48>>2]=0;F[h+52>>2]=0;F[h+40>>2]=0;F[h+44>>2]=0;F[h+32>>2]=0;F[h+36>>2]=0;F[h+24>>2]=0;F[h+28>>2]=0;F[h+16>>2]=0;F[h+20>>2]=0;F[h>>2]=0;d=0;if(!e){break a}}Fa(h+16|0,e,h);i=F[h+28>>2];d=F[h+32>>2]}F[h>>2]=0;d=d-i>>2;c:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break c}F[h+32>>2]=(e<<2)+i;break c}Fa(h+16|12,e-d|0,h)}F[h>>2]=0;f=F[h+40>>2];d=F[h+44>>2]-f>>2;d:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break d}F[h+44>>2]=f+(e<<2);break d}Fa(h+40|0,e-d|0,h)}F[h>>2]=0;f=F[h+52>>2];d=F[h+56>>2]-f>>2;e:{if(d>>>0>=e>>>0){if(d>>>0<=e>>>0){break e}F[h+56>>2]=f+(e<<2);break e}Fa(h+52|0,e-d|0,h)}f:{if(F[a+8>>2]<=0){break f}g=F[h+16>>2];j=F[a+32>>2];i=0;while(1){d=i<<2;f=F[d+g>>2];m=F[a+16>>2];g:{if((f|0)>(m|0)){F[d+j>>2]=m;break g}d=d+j|0;m=F[a+12>>2];if((m|0)>(f|0)){F[d>>2]=m;break g}F[d>>2]=f}i=i+1|0;d=F[a+8>>2];if((i|0)<(d|0)){continue}break}if((d|0)<=0){break f}d=0;while(1){g=d<<2;f=g+c|0;g=F[b+g>>2]+F[g+j>>2]|0;F[f>>2]=g;h:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break h}g=g+F[a+20>>2]|0}F[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}H=F[a+52>>2];A=F[a+48>>2];y=ka(16);d=y;F[d>>2]=0;F[d+4>>2]=0;F[d+8>>2]=0;F[d+12>>2]=0;F[h+8>>2]=0;F[h>>2]=0;F[h+4>>2]=0;i:{if(e){if(e>>>0>=1073741824){break i}d=e<<2;t=ka(d);F[h>>2]=t;F[h+8>>2]=d+t;ma(t,0,d)}z=1;d=F[a+56>>2];B=F[d>>2];d=F[d+4>>2]-B|0;j:{if((d|0)<8){break j}w=d>>2;I=(w|0)<=2?2:w;J=w>>>0<=1?1:w;C=e&-2;D=e&1;K=e&-4;E=e&3;G=e-1|0;M=e<<2;N=e>>>0<4;z=0;m=1;while(1){k:{l:{m:{n:{if((m|0)!=(J|0)){o:{p:{f=F[(m<<2)+B>>2];if((f|0)==-1){break p}n=F[A+12>>2];d=f+2|0;g=(f>>>0)%3|0;q=n+((g?f-1|0:d)<<2)|0;j=0;u=(g|0)!=0|(d|0)!=-1;k=1;d=f;q:{while(1){g=F[n+(d<<2)>>2];r:{if((g|0)==-1){break r}l=-1;p=F[H>>2];r=F[A>>2];i=p+(F[r+(g<<2)>>2]<<2)|0;o=g+1|0;o=(o>>>0)%3|0?o:g-2|0;if((o|0)!=-1){l=F[r+(o<<2)>>2]}o=F[i>>2];s:{t:{if((g>>>0)%3|0){i=g-1|0;break t}i=g+2|0;s=-1;if((i|0)==-1){break s}}s=F[r+(i<<2)>>2]}if((m|0)<=(o|0)){break r}i=F[p+(l<<2)>>2];if((i|0)>=(m|0)){break r}l=F[p+(s<<2)>>2];if((l|0)>=(m|0)){break r}g=F[(h+16|0)+L(j,12)>>2];u:{if(!e){break u}l=L(e,l);r=L(e,i);p=L(e,o);i=0;s=0;if(G){while(1){F[g+(i<<2)>>2]=(F[(i+l<<2)+c>>2]+F[(i+r<<2)+c>>2]|0)-F[(i+p<<2)+c>>2];o=i|1;F[g+(o<<2)>>2]=(F[(l+o<<2)+c>>2]+F[(o+r<<2)+c>>2]|0)-F[(o+p<<2)+c>>2];i=i+2|0;s=s+2|0;if((C|0)!=(s|0)){continue}break}}if(!D){break u}F[g+(i<<2)>>2]=(F[(i+l<<2)+c>>2]+F[(i+r<<2)+c>>2]|0)-F[(i+p<<2)+c>>2]}g=4;j=j+1|0;if((j|0)==4){break q}}v:{if(k&1){i=d+1|0;d=(i>>>0)%3|0?i:d-2|0;g=-1;if((d|0)==-1){break v}d=F[n+(d<<2)>>2];g=-1;if((d|0)==-1){break v}g=d+1|0;g=(g>>>0)%3|0?g:d-2|0;break v}w:{if((d>>>0)%3|0){i=d-1|0;break w}i=d+2|0;g=-1;if((i|0)==-1){break v}}d=F[n+(i<<2)>>2];g=-1;if((d|0)==-1){break v}g=d-1|0;if((d>>>0)%3|0){break v}g=d+2|0}d=g;x:{if((f|0)==(d|0)){break x}if((d|0)==-1&k){if(!u){break x}d=F[q>>2];if((d|0)==-1){break x}k=0;d=(d>>>0)%3|0?d-1|0:d+2|0}if((d|0)!=-1){continue}}break}g=j;if((g|0)<=0){break p}}if(e){ma(t,0,M)}d=g-1|0;r=(d<<2)+y|0;d=L(d,12)+a|0;o=d;s=F[d- -64>>2];k=0;d=F[h>>2];f=0;while(1){j=F[r>>2];F[r>>2]=j+1;if(j>>>0>=s>>>0){break j}y:{if(F[F[o+60>>2]+(j>>>3&536870908)>>2]>>>j&1){break y}f=f+1|0;if(!e){break y}j=F[(h+16|0)+L(k,12)>>2];l=0;i=0;p=0;if(!N){while(1){n=i<<2;q=n+d|0;F[q>>2]=F[j+n>>2]+F[q>>2];q=n|4;u=q+d|0;F[u>>2]=F[j+q>>2]+F[u>>2];q=n|8;u=q+d|0;F[u>>2]=F[j+q>>2]+F[u>>2];n=n|12;q=n+d|0;F[q>>2]=F[j+n>>2]+F[q>>2];i=i+4|0;p=p+4|0;if((K|0)!=(p|0)){continue}break}}if(!E){break y}while(1){n=i<<2;p=n+d|0;F[p>>2]=F[j+n>>2]+F[p>>2];i=i+1|0;l=l+1|0;if((E|0)!=(l|0)){continue}break}}k=k+1|0;if((k|0)!=(g|0)){continue}break}g=L(e,m);if(!f){break o}if(!e){break l}i=0;d=0;if(G){break n}break m}g=L(e,m)}if(F[a+8>>2]<=0){break k}k=(L(m-1|0,e)<<2)+c|0;j=F[x>>2];i=0;while(1){d=i<<2;f=F[d+k>>2];l=F[a+16>>2];z:{if((f|0)>(l|0)){F[d+j>>2]=l;break z}d=d+j|0;l=F[a+12>>2];if((l|0)>(f|0)){F[d>>2]=l;break z}F[d>>2]=f}i=i+1|0;f=F[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=F[g+k>>2]+F[g+j>>2]|0;F[f>>2]=g;A:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break A}g=g+F[a+20>>2]|0}F[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}break k}ta();v()}while(1){j=i<<2;k=j+t|0;F[k>>2]=F[k>>2]/(f|0);j=(j|4)+t|0;F[j>>2]=F[j>>2]/(f|0);i=i+2|0;d=d+2|0;if((C|0)!=(d|0)){continue}break}}if(!D){break l}d=(i<<2)+t|0;F[d>>2]=F[d>>2]/(f|0)}if(F[a+8>>2]<=0){break k}j=F[x>>2];i=0;while(1){d=i<<2;f=F[d+t>>2];k=F[a+16>>2];B:{if((f|0)>(k|0)){F[d+j>>2]=k;break B}d=d+j|0;k=F[a+12>>2];if((k|0)>(f|0)){F[d>>2]=k;break B}F[d>>2]=f}i=i+1|0;f=F[a+8>>2];if((i|0)<(f|0)){continue}break}d=0;if((f|0)<=0){break k}f=g<<2;i=f+c|0;k=b+f|0;while(1){g=d<<2;f=g+i|0;g=F[g+k>>2]+F[g+j>>2]|0;F[f>>2]=g;C:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break C}g=g+F[a+20>>2]|0}F[f>>2]=g}d=d+1|0;if((d|0)>2]){continue}break}}m=m+1|0;z=(w|0)<=(m|0);if((m|0)!=(I|0)){continue}break}}a=F[h>>2];if(a){ja(a)}ja(y);a=F[h+52>>2];if(a){F[h+56>>2]=a;ja(a)}a=F[h+40>>2];if(a){F[h+44>>2]=a;ja(a)}a=F[h+28>>2];if(a){F[h+32>>2]=a;ja(a)}a=F[h+16>>2];if(a){F[h+20>>2]=a;ja(a)}Z=h- -64|0;return z|0}na();v()}function Yh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,$=0,aa=0;a:{b:{if((e|0)!=2){break b}F[a+8>>2]=2;F[a- -64>>2]=f;M=a+32|0;e=F[M>>2];d=F[a+36>>2]-e|0;c:{if(d>>>0<=7){qa(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}F[a+36>>2]=e+8}i=1;d=F[a+56>>2];d=F[d+4>>2]-F[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){f=F[a+56>>2];e=F[f>>2];if(F[f+4>>2]-e>>2>>>0<=d>>>0){break a}k=Z-80|0;Z=k;f=-1;d:{e:{e=F[e+(d<<2)>>2];if((e|0)==-1){break e}i=F[o+32>>2];g=e+1|0;g=(g>>>0)%3|0?g:e-2|0;if((g|0)!=-1){f=F[F[i>>2]+(g<<2)>>2]}p=-1;e=e+((e>>>0)%3|0?-1:2)|0;if((e|0)!=-1){p=F[F[i>>2]+(e<<2)>>2]}i=F[o+36>>2];e=F[i>>2];i=F[i+4>>2]-e>>2;if(i>>>0<=f>>>0|i>>>0<=p>>>0){break e}f:{g:{h:{i:{j:{k:{j=F[e+(p<<2)>>2];f=F[e+(f<<2)>>2];if((j|0)>=(d|0)|(f|0)>=(d|0)){break k}i=(j<<3)+c|0;w=F[i+4>>2];g=(f<<3)+c|0;e=F[g+4>>2];l=F[i>>2];i=F[g>>2];if(!((l|0)!=(i|0)|(e|0)!=(w|0))){F[o+8>>2]=i;F[o+12>>2]=e;break j}p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+N|0;h=f>>>0>>0?h+1|0:h;n=i-f|0;f=T-((f>>>0>i>>>0)+h|0)|0;n=ki(n,f,n,f);x=_;f=g;h=li(ki(j,q,A,I),_,r,s);i=h+z|0;g=_+O|0;g=h>>>0>i>>>0?g+1|0:g;h=f-i|0;f=U-((f>>>0>>0)+g|0)|0;g=ki(h,f,h,f);i=g+n|0;f=_+x|0;f=g>>>0>i>>>0?f+1|0:f;n=i;g=li(ki(j,q,C,J),_,r,s);i=g+B|0;h=_+P|0;h=g>>>0>i>>>0?h+1|0:h;g=m-i|0;i=V-((i>>>0>m>>>0)+h|0)|0;m=ki(g,i,g,i);i=m+n|0;g=_+f|0;f=ki(i,i>>>0>>0?g+1|0:g,r,s);i=_;m=i;if(!i&f>>>0<=1){break i}h=f;while(1){g=e<<1|l>>>31;l=l<<1;e=g;n=!i&h>>>0>7|(i|0)!=0;h=(i&3)<<30|h>>>2;i=i>>>2|0;if(n){continue}break}break h}if((d|0)>(f|0)){e=f<<1}else{if((d|0)<=0){F[o+8>>2]=0;F[o+12>>2]=0;break j}e=(d<<1)-2|0}e=(e<<2)+c|0;F[o+8>>2]=F[e>>2];F[o+12>>2]=F[e+4>>2]}p=1;break f}e=m;l=f;if(f-1|0){break g}}while(1){i=mi(f,m,l,e);h=e+_|0;e=i+l|0;h=e>>>0>>0?h+1|0:h;l=(h&1)<<31|e>>>1;e=h>>>1|0;i=ki(l,e,l,e);g=_;if((m|0)==(g|0)&f>>>0>>0|g>>>0>m>>>0){continue}break}}f=F[o+20>>2];if(!f){break f}g=f-1|0;h=F[F[o+16>>2]+(g>>>3&536870908)>>2];F[o+20>>2]=g;p=1;f=ki(j,q,y,w);i=_;n=ki(r,s,K,S);m=n+f|0;f=_+i|0;f=m>>>0>>0?f+1|0:f;i=ki(l,e,E,W);g=h>>>g&1;h=g?0-i|0:i;m=h+m|0;n=f;f=_;i=n+(g?0-(f+((i|0)!=0)|0)|0:f)|0;$=o,aa=li(m,h>>>0>m>>>0?i+1|0:i,r,s),F[$+12>>2]=aa;f=ki(j,q,E,W);i=_;j=ki(r,s,Q,R);f=j+f|0;h=_+i|0;e=ki(l,e,y,w);i=0-e|0;l=_;h=(f>>>0>>0?h+1|0:h)+(g?l:0-(((e|0)!=0)+l|0)|0)|0;i=g?e:i;f=i+f|0;$=o,aa=li(f,f>>>0>>0?h+1|0:h,r,s),F[$+8>>2]=aa}Z=k+80|0;e=p;break d}ta();v()}i=e;if(!e){return 0}l:{if(F[a+8>>2]<=0){break l}l=F[M>>2];e=0;while(1){f=e<<2;g=F[f+Y>>2];j=F[a+16>>2];m:{if((g|0)>(j|0)){F[f+l>>2]=j;break m}f=f+l|0;j=F[a+12>>2];if((j|0)>(g|0)){F[f>>2]=j;break m}F[f>>2]=g}e=e+1|0;g=F[a+8>>2];if((e|0)<(g|0)){continue}break}f=0;if((g|0)<=0){break l}e=d<<3;j=e+c|0;q=b+e|0;while(1){g=f<<2;e=g+j|0;g=F[g+q>>2]+F[g+l>>2]|0;F[e>>2]=g;n:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break n}g=g+F[a+20>>2]|0}F[e>>2]=g}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return i|0}ta();v()}function hi(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,E=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,$=0,aa=0;a:{b:{if((e|0)!=2){break b}F[a+8>>2]=2;F[a- -64>>2]=f;M=a+32|0;e=F[M>>2];d=F[a+36>>2]-e|0;c:{if(d>>>0<=7){qa(M,2-(d>>>2|0)|0);break c}if((d|0)==8){break c}F[a+36>>2]=e+8}p=1;d=F[a+56>>2];d=F[d+4>>2]-F[d>>2]|0;if((d|0)<=0){break b}o=a+60|0;d=d>>>2|0;X=d>>>0<=1?1:d;Y=a+68|0;d=0;while(1){e=F[a+56>>2];h=F[e>>2];if(F[e+4>>2]-h>>2>>>0<=d>>>0){break a}k=Z-80|0;Z=k;f=-1;h=F[h+(d<<2)>>2];e=-1;d:{if((h|0)==-1){break d}e=h+1|0;f=(e>>>0)%3|0?e:h-2|0;e=h-1|0;if((h>>>0)%3|0){break d}e=h+2|0}g=F[o+36>>2];h=F[g>>2];e:{f:{g:{h:{i:{g=F[g+4>>2]-h>>2;i=f<<2;f=F[F[o+32>>2]+28>>2];j=F[i+f>>2];if(g>>>0<=j>>>0){break i}e=F[f+(e<<2)>>2];if(e>>>0>=g>>>0){break i}j:{k:{l=F[h+(e<<2)>>2];f=F[h+(j<<2)>>2];if((l|0)>=(d|0)|(f|0)>=(d|0)){break k}h=(l<<3)+c|0;w=F[h+4>>2];g=(f<<3)+c|0;e=F[g+4>>2];j=F[h>>2];h=F[g>>2];if(!((j|0)!=(h|0)|(e|0)!=(w|0))){F[o+8>>2]=h;F[o+12>>2]=e;break j}p=F[F[o+4>>2]+(d<<2)>>2];F[k+72>>2]=0;F[k+76>>2]=0;g=k- -64|0;F[g>>2]=0;F[g+4>>2]=0;F[k+56>>2]=0;F[k+60>>2]=0;g=F[o>>2];if(!G[g+84|0]){p=F[F[g+68>>2]+(p<<2)>>2]}Ga(g,p,D[g+24|0],k+56|0);p=F[F[o+4>>2]+(f<<2)>>2];F[k+48>>2]=0;F[k+52>>2]=0;F[k+40>>2]=0;F[k+44>>2]=0;F[k+32>>2]=0;F[k+36>>2]=0;g=F[o>>2];if(!G[g+84|0]){p=F[F[g+68>>2]+(p<<2)>>2]}Ga(g,p,D[g+24|0],k+32|0);p=F[F[o+4>>2]+(l<<2)>>2];F[k+24>>2]=0;F[k+28>>2]=0;F[k+16>>2]=0;F[k+20>>2]=0;F[k+8>>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1;e=g;n=!h&i>>>0>7|(h|0)!=0;i=(h&3)<<30|i>>>2;h=h>>>2|0;if(n){continue}break}break g}if((d|0)>(f|0)){e=f<<1}else{if((d|0)<=0){F[o+8>>2]=0;F[o+12>>2]=0;break j}e=(d<<1)-2|0}e=(e<<2)+c|0;F[o+8>>2]=F[e>>2];F[o+12>>2]=F[e+4>>2]}p=1;break e}ta();v()}e=m;j=f;if(f-1|0){break f}}while(1){h=mi(f,m,j,e);i=e+_|0;e=h+j|0;i=e>>>0>>0?i+1|0:i;j=(i&1)<<31|e>>>1;e=i>>>1|0;h=ki(j,e,j,e);g=_;if((m|0)==(g|0)&f>>>0>>0|g>>>0>m>>>0){continue}break}}f=F[o+20>>2];if(!f){break e}g=f-1|0;i=F[F[o+16>>2]+(g>>>3&536870908)>>2];F[o+20>>2]=g;p=1;f=ki(l,q,y,w);h=_;n=ki(r,s,K,S);m=n+f|0;f=_+h|0;f=m>>>0>>0?f+1|0:f;h=ki(j,e,E,W);g=i>>>g&1;i=g?0-h|0:h;m=i+m|0;n=f;f=_;h=n+(g?0-(f+((h|0)!=0)|0)|0:f)|0;$=o,aa=li(m,i>>>0>m>>>0?h+1|0:h,r,s),F[$+12>>2]=aa;f=ki(l,q,E,W);h=_;l=ki(r,s,Q,R);f=l+f|0;i=_+h|0;e=ki(j,e,y,w);h=0-e|0;j=_;i=(f>>>0>>0?i+1|0:i)+(g?j:0-(((e|0)!=0)+j|0)|0)|0;h=g?e:h;f=h+f|0;$=o,aa=li(f,f>>>0>>0?i+1|0:i,r,s),F[$+8>>2]=aa}Z=k+80|0;if(!p){return 0}l:{if(F[a+8>>2]<=0){break l}g=F[M>>2];e=0;while(1){f=e<<2;h=F[f+Y>>2];j=F[a+16>>2];m:{if((h|0)>(j|0)){F[f+g>>2]=j;break m}f=f+g|0;j=F[a+12>>2];if((j|0)>(h|0)){F[f>>2]=j;break m}F[f>>2]=h}e=e+1|0;h=F[a+8>>2];if((e|0)<(h|0)){continue}break}f=0;if((h|0)<=0){break l}e=d<<3;j=e+c|0;l=b+e|0;while(1){h=f<<2;e=h+j|0;h=F[h+l>>2]+F[h+g>>2]|0;F[e>>2]=h;n:{if((h|0)>F[a+16>>2]){i=h-F[a+20>>2]|0}else{if((h|0)>=F[a+12>>2]){break n}i=h+F[a+20>>2]|0}F[e>>2]=i}f=f+1|0;if((f|0)>2]){continue}break}}d=d+1|0;if((X|0)!=(d|0)){continue}break}}return p|0}ta();v()}function Gd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;n=Z-96|0;Z=n;m=F[a+4>>2];d=F[m+32>>2];j=F[d+8>>2];i=F[d+12>>2];e=i;c=F[d+20>>2];f=F[d+16>>2];a:{if((e|0)<=(c|0)&f>>>0>=j>>>0|(c|0)>(e|0)){break a}o=F[d>>2];h=G[o+f|0];g=f+1|0;e=g?c:c+1|0;F[d+16>>2]=g;F[d+20>>2]=e;if((e|0)>=(i|0)&g>>>0>=j>>>0|(e|0)>(i|0)){break a}p=G[g+o|0];g=f+2|0;e=g>>>0<2?c+1|0:c;F[d+16>>2]=g;F[d+20>>2]=e;l=h<<24>>24;b:{if((l|0)>=0){k=F[a+216>>2];if(h>>>0>=(F[a+220>>2]-k|0)/144>>>0){break a}k=k+L(h,144)|0;if(F[k>>2]<0){break b}break a}if(F[a+212>>2]>=0){break a}k=a+212|0}F[k>>2]=b;c:{d:{e:{f:{g:{h:{k=H[m+36>>1];i:{if(((k<<8|k>>>8)&65535)>>>0>=258){if((e|0)>=(i|0)&g>>>0>=j>>>0|(e|0)>(i|0)){break a}e=G[g+o|0];f=f+3|0;c=f>>>0<3?c+1|0:c;F[d+16>>2]=f;F[d+20>>2]=c;if(e>>>0>1){break a}d=e>>>0<2?e:0;if(!p){break i}if(!d){break h}break a}if(p){break g}d=0}if((l|0)<0){e=a+184|0}else{c=F[a+216>>2]+L(h,144)|0;D[c+100|0]=0;e=c+104|0}if((d|0)!=1){break e}c=Z-112|0;Z=c;g=F[F[a+4>>2]+44>>2];d=ka(120);F[d>>2]=8924;F[d+4>>2]=0;F[d+116>>2]=0;F[d+112>>2]=e;F[d+108>>2]=g;F[d+12>>2]=0;F[d+16>>2]=0;F[d+20>>2]=0;F[d+24>>2]=0;F[d+28>>2]=0;F[d+32>>2]=0;F[d+36>>2]=0;F[d+40>>2]=0;F[d+44>>2]=0;F[d+48>>2]=0;F[d+52>>2]=0;F[d+56>>2]=0;F[d+60>>2]=0;F[d+8>>2]=9136;f=d- -64|0;F[f>>2]=0;F[f+4>>2]=0;F[d+72>>2]=0;F[d+76>>2]=0;F[d+80>>2]=0;F[d+84>>2]=0;F[d+88>>2]=0;F[d+104>>2]=0;F[d+96>>2]=0;F[d+100>>2]=0;f=F[a+8>>2];F[c+48>>2]=0;F[c+52>>2]=0;F[c+40>>2]=0;F[c+44>>2]=0;j=c+32|0;F[j>>2]=0;F[j+4>>2]=0;F[c+24>>2]=0;F[c+28>>2]=0;h=c- -64|0;F[h>>2]=0;F[h+4>>2]=0;F[c+72>>2]=0;F[c+76>>2]=0;F[c+80>>2]=0;F[c+84>>2]=0;F[c+88>>2]=0;F[c+104>>2]=0;F[c+16>>2]=0;F[c+20>>2]=0;F[c+56>>2]=0;F[c+60>>2]=0;F[c+8>>2]=9136;F[c+96>>2]=0;F[c+100>>2]=0;F[c+12>>2]=f;h=F[f>>2];i=F[f+4>>2];D[c+111|0]=0;k=j;j=c+111|0;Ea(k,(i-h>>2>>>0)/3|0,j);h=F[c+12>>2];i=F[h+28>>2];h=F[h+24>>2];D[c+111|0]=0;Ea(c+44|0,i-h>>2,j);F[c+28>>2]=d;F[c+24>>2]=g;F[c+20>>2]=e;F[c+16>>2]=f;f=d+8|0;e=c+8|0;lc(f,e);j:{if((e|0)==(f|0)){F[d+92>>2]=F[e+84>>2];break j}gb(d+56|0,F[e+48>>2],F[e+52>>2]);gb(d+68|0,F[e+60>>2],F[e- -64>>2]);gb(d+80|0,F[e+72>>2],F[e+76>>2]);F[d+92>>2]=F[e+84>>2];k:{h=F[e+92>>2];j=F[e+88>>2];i=h-j|0;e=i>>2;f=F[d+104>>2];g=F[d+96>>2];if(e>>>0<=f-g>>2>>>0){i=F[d+100>>2]-g|0;f=i+j|0;m=i>>2;i=e>>>0>m>>>0?f:h;l=i-j|0;if((i|0)!=(j|0)){pa(g,j,l)}if(e>>>0>m>>>0){e=F[d+100>>2];if((h|0)!=(i|0)){while(1){F[e>>2]=F[f>>2];e=e+4|0;f=f+4|0;if((h|0)!=(f|0)){continue}break}}F[d+100>>2]=e;break k}F[d+100>>2]=g+l;break k}if(g){F[d+100>>2]=g;ja(g);F[d+104>>2]=0;F[d+96>>2]=0;F[d+100>>2]=0;f=0}l:{if((i|0)<0){break l}g=f>>>1|0;e=f>>>0>=2147483644?1073741823:e>>>0>>0?g:e;if(e>>>0>=1073741824){break l}f=e<<2;e=ka(f);F[d+96>>2]=e;F[d+104>>2]=e+f;if((h|0)!=(j|0)){f=e;e=(i-4&-4)+4|0;e=la(f,j,e)+e|0}F[d+100>>2]=e;break k}na();v()}}F[c+8>>2]=9136;e=F[c+96>>2];if(e){F[c+100>>2]=e;ja(e)}e=F[c+80>>2];if(e){F[c+84>>2]=e;ja(e)}e=F[c+68>>2];if(e){F[c+72>>2]=e;ja(e)}e=F[c+56>>2];if(e){F[c+60>>2]=e;ja(e)}F[c+8>>2]=9372;e=F[c+44>>2];if(e){ja(e)}e=F[c+32>>2];if(e){ja(e)}Z=c+112|0;break d}if((l|0)>=0){break f}break a}if((l|0)<0){break a}}e=F[a+216>>2];c=F[m+44>>2];d=ka(80);F[d>>2]=9684;F[d+4>>2]=0;F[d+76>>2]=0;F[d+68>>2]=c;F[d+8>>2]=8624;F[d+12>>2]=0;F[d+16>>2]=0;F[d+20>>2]=0;F[d+24>>2]=0;F[d+28>>2]=0;F[d+32>>2]=0;F[d+36>>2]=0;F[d+40>>2]=0;F[d+44>>2]=0;F[d+48>>2]=0;F[d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l-i>>2>>>0)/3|0,h);i=F[c+4>>2];l=F[i+28>>2];i=F[i+24>>2];D[c+63|0]=0;Ea(c+36|0,l-i>>2,h);F[c+20>>2]=d;F[c+16>>2]=g;F[c+12>>2]=e;F[c+8>>2]=f;lc(d+8|0,c);gb(j,F[c+48>>2],F[c+52>>2]);F[c>>2]=9556;e=F[c+48>>2];if(e){F[c+52>>2]=e;ja(e)}F[c>>2]=9372;e=F[c+36>>2];if(e){ja(e)}e=F[c+24>>2];if(e){ja(e)}Z=c- -64|0}if(!d){break a}}d=yc(ka(64),d);c=F[a+4>>2];a=d;d=b;m:{n:{if((d|0)>=0){g=c+8|0;b=F[c+12>>2];j=F[c+8>>2];e=b-j>>2;o:{if((e|0)>(d|0)){break o}f=d+1|0;if(d>>>0>=e>>>0){Pb(g,f-e|0);break o}if(e>>>0<=f>>>0){break o}f=j+(f<<2)|0;if((f|0)!=(b|0)){while(1){b=b-4|0;e=F[b>>2];F[b>>2]=0;if(e){$[F[F[e>>2]+4>>2]](e)}if((b|0)!=(f|0)){continue}break}}F[c+12>>2]=f}c=F[g>>2]+(d<<2)|0;b=F[c>>2];F[c>>2]=a;if(b){break n}break m}b=a;if(!a){break m}}$[F[F[b>>2]+4>>2]](b)}q=(d^-1)>>>31|0}Z=n+96|0;return q|0}function Ab(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=M(0),n=M(0),o=0;a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=D[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=H[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=E[b>>1];if((e|0)<0){break b}E[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(e+32768>>>0>65535){break b}E[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(e>>>0>32767){break b}E[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=F[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=F[b+4>>2];e=F[b>>2];i=e+32768|0;h=i>>>0<32768?h+1|0:h;if(!h&i>>>0>65535|h){break b}E[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=F[b+4>>2];e=F[b>>2];if(!k&e>>>0>32767|k){break b}E[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=F[a>>2];j=F[e>>2];g=j;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-j|0;if(!G[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(32767)|m>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(32767)|mM(1)){break d}e=(b<<1)+d|0;l=R(+m*32767+.5);f:{if(N(l)<2147483648){i=~~l;break f}i=-2147483648}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ma((e<<1)+d|0,0,c-e<<1)}return j;case 9:g:{h:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=F[a>>2];j=F[e>>2];g=j;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-j|0;if(!G[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=K[g>>3];if(l>=32767|l<-32768|l!=l){break g}o=N(l);if(o==Infinity){break g}e=(b<<1)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=K[g>>3];if(l>=32767|l<-32768|(N(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<1)+d|0;l=R(l*32767+.5);i:{if(N(l)<2147483648){i=~~l;break i}i=-2147483648}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ma((e<<1)+d|0,0,c-e<<1)}return j;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ma((e<<1)+d|0,0,(c&255)-e<<1)}return j}ma((e<<1)+d|0,0,(c&255)-e<<1);return 1}function yb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=M(0),n=M(0),o=0;a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=D[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=E[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=H[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=F[b>>2];b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=F[b>>2];if((e|0)<0){break b}F[(g<<2)+d>>2]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;k=F[e+4>>2];while(1){if(b>>>0>=k>>>0){break b}h=F[b+4>>2];e=F[b>>2];if(e- -2147483648>>>0<2147483648?h+1|0:h){break b}F[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=F[b+4>>2];e=F[b>>2];if(!k&e>>>0>2147483647|k){break b}F[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=F[a>>2];j=F[e>>2];g=j;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-j|0;if(!G[a+32|0]){j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(2147483648)|m>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(2147483648)|mM(1)){break d}e=(b<<2)+d|0;l=R(+m*2147483647+.5);f:{if(N(l)<2147483648){i=~~l;break f}i=-2147483648}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}j=1;if(c>>>0<=e>>>0){break d}ma((e<<2)+d|0,0,c-e<<2)}return j;case 9:g:{h:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=F[a>>2];j=F[e>>2];g=j;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-j|0;if(!G[a+32|0]){j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=K[g>>3];if(l>=2147483647|l<-2147483648|l!=l){break g}o=N(l);if(o==Infinity){break g}e=(b<<2)+d|0;if(o<2147483648){i=~~l}else{i=-2147483648}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=0;if((b|0)>=(e|0)){break g}b=0;while(1){l=K[g>>3];if(l>=2147483647|l<-2147483648|(N(l)==Infinity|l!=l)){break g}if(l<0|l>1){break g}e=(b<<2)+d|0;l=R(l*2147483647+.5);i:{if(N(l)<2147483648){i=~~l;break i}i=-2147483648}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}j=1;if(c>>>0<=e>>>0){break g}ma((e<<2)+d|0,0,c-e<<2)}return j;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}j=1;if(e>>>0>=f>>>0){break b}ma((e<<2)+d|0,0,(c&255)-e<<2)}return j}ma((e<<2)+d|0,0,(c&255)-e<<2);return 1}function zb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=M(0);a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=D[b|0];if((e|0)<0){break b}E[(g<<1)+d>>1]=e&255;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){return 0}e=E[b>>1];if((e|0)<0){break b}E[(g<<1)+d>>1]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=H[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(e>>>0>65535){break b}E[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(e>>>0>65535){break b}E[(g<<1)+d>>1]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=F[b+4>>2];e=F[b>>2];if(!k&e>>>0>65535|k){break b}E[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}k=F[b+4>>2];e=F[b>>2];if(!k&e>>>0>65535|k){break b}E[(g<<1)+d>>1]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=F[a>>2];l=F[e>>2];g=l;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-l|0;if(!G[a+32|0]){l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(65535)|m=M(0)){i=~~m>>>0}else{i=0}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(65535)|mM(1)){break d}e=(b<<1)+d|0;j=R(+m*65535+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}l=1;if(c>>>0<=e>>>0){break d}ma((e<<1)+d|0,0,c-e<<1)}return l;case 9:g:{h:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=F[a>>2];l=F[e>>2];g=l;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-l|0;if(!G[a+32|0]){l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=K[g>>3];if(j>=65535|j<0|(N(j)==Infinity|j!=j)){break g}e=(b<<1)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=K[g>>3];if(j>=65535|j<0|(N(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<1)+d|0;j=R(j*65535+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}E[e>>1]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}l=1;if(c>>>0<=e>>>0){break g}ma((e<<1)+d|0,0,c-e<<1)}return l;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];k=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+k|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}E[(g<<1)+d>>1]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break b}ma((e<<1)+d|0,0,(c&255)-e<<1)}return l}ma((e<<1)+d|0,0,(c&255)-e<<1);return 1}function Ga(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=M(0),l=0,m=0,n=M(0),o=0;a:{if(!d){break a}b:{c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=D[b|0];F[e>>2]=i;F[e+4>>2]=i>>31;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;F[e>>2]=G[b|0];F[e+4>>2]=0;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=E[b>>1];F[e>>2]=i;F[e+4>>2]=i>>31;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;F[e>>2]=H[b>>1];F[e+4>>2]=0;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;i=F[b>>2];F[e>>2]=i;F[e+4>>2]=i>>31;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;F[e>>2]=F[b>>2];F[e+4>>2]=0;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}i=F[b+4>>2];e=(g<<3)+d|0;F[e>>2]=F[b>>2];F[e+4>>2]=i;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=F[b>>2];i=F[b+4>>2];if((i|0)<0){break a}j=(g<<3)+d|0;F[j>>2]=e;F[j+4>>2]=i;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 8:d:{e=G[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break d}if(G[a+32|0]){break a}e=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+e|0;e=F[a>>2];i=F[e+4>>2];e=F[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){k=J[g>>2];if(k>=M(0x8000000000000000)|k=M(1)?~~(k>M(0)?M(P(M(R(M(k*M(2.3283064365386963e-10)))),M(4294967296))):M(S(M(M(k-M(~~k>>>0>>>0))*M(2.3283064365386963e-10)))))>>>0:0;m=~~k>>>0;break e}j=-2147483648;m=0}F[e>>2]=m;F[e+4>>2]=j;b=b+1|0;e=G[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break d}g=g+4|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 9:f:{e=G[a+24|0];f=c&255;if(!(e>>>0>>0?e:f)){break f}if(G[a+32|0]){break a}e=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+e|0;e=F[a>>2];i=F[e+4>>2];e=F[e>>2];if((b|0)>=(i-e|0)){break a}g=b+e|0;h=c&255;b=0;while(1){l=K[g>>3];if(l>=0x8000000000000000|l<-0x8000000000000000|l!=l){break a}o=N(l);if(o==Infinity){break a}e=(b<<3)+d|0;g:{if(o<0x8000000000000000){j=N(l)>=1?~~(l>0?P(R(l*2.3283064365386963e-10),4294967295):S((l-+(~~l>>>0>>>0))*2.3283064365386963e-10))>>>0:0;m=~~l>>>0;break g}j=-2147483648;m=0}F[e>>2]=m;F[e+4>>2]=j;b=b+1|0;e=G[a+24|0];if(b>>>0>=(e>>>0>>0?e:h)>>>0){break f}g=g+8|0;if(i>>>0>g>>>0){continue}break}break a}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);j=b;b=b+i|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break a}e=(g<<3)+d|0;F[e>>2]=G[b|0];F[e+4>>2]=0;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}if(e>>>0>=f>>>0){break a}d=(e<<3)+d|0;a=(c&255)-e|0}ma(d,0,a<<3)}}function le(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=a;a:{b:{c:{d:{e:{f:{g:{h:{a=F[a+8>>2];switch(F[a+28>>2]-1|0){case 4:break c;case 5:break d;case 2:break e;case 3:break f;case 0:break g;case 1:break h;default:break a}}f=G[a+24|0];c=ka(f);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;D[a+c|0]=F[k>>2];D[(a|1)+c|0]=F[k+4>>2];D[(a|2)+c|0]=F[k+8>>2];D[(a|3)+c|0]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){D[a+c|0]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}f=G[a+24|0];c=ka(f);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(f){o=f&252;l=f&3;h=f>>>0<4;while(1){a=0;e=0;if(!h){while(1){k=g+(d<<2)|0;D[a+c|0]=F[k>>2];D[(a|1)+c|0]=F[k+4>>2];D[(a|2)+c|0]=F[k+8>>2];D[(a|3)+c|0]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){D[a+c|0]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+m|0,c,f);m=f+m|0;n=n+1|0;if((n|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,f);a=a+f|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,f);a=a+f|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,f);break b}h=G[a+24|0];i=h<<1;c=ka(i);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;E[f+c>>1]=F[k>>2];E[(f|2)+c>>1]=F[k+4>>2];E[(f|4)+c>>1]=F[k+8>>2];E[(f|6)+c>>1]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){E[(a<<1)+c>>1]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=G[a+24|0];i=h<<1;c=ka(i);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<1;k=g+(d<<2)|0;E[f+c>>1]=F[k>>2];E[(f|2)+c>>1]=F[k+4>>2];E[(f|4)+c>>1]=F[k+8>>2];E[(f|6)+c>>1]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){E[(a<<1)+c>>1]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=G[a+24|0];i=h<<2;c=ka(i);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;F[f+c>>2]=F[k>>2];F[(f|4)+c>>2]=F[k+4>>2];F[(f|8)+c>>2]=F[k+8>>2];F[(f|12)+c>>2]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[(a<<2)+c>>2]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);break b}h=G[a+24|0];i=h<<2;c=ka(i);a=F[j+16>>2];if(F[a+80>>2]){g=F[F[a>>2]>>2]+F[a+48>>2]|0}else{g=0}if(!b){break b}if(h){o=h&252;l=h&3;h=h>>>0<4;while(1){a=0;e=0;if(!h){while(1){f=a<<2;k=g+(d<<2)|0;F[f+c>>2]=F[k>>2];F[(f|4)+c>>2]=F[k+4>>2];F[(f|8)+c>>2]=F[k+8>>2];F[(f|12)+c>>2]=F[k+12>>2];a=a+4|0;d=d+4|0;e=e+4|0;if((o|0)!=(e|0)){continue}break}}e=0;if(l){while(1){F[(a<<2)+c>>2]=F[g+(d<<2)>>2];a=a+1|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}la(F[F[F[j+8>>2]+64>>2]>>2]+n|0,c,i);n=i+n|0;m=m+1|0;if((m|0)!=(b|0)){continue}break}break b}a=0;if((b|0)!=1){g=b&-2;while(1){la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i);a=a+i|0;la(a+F[F[F[j+8>>2]+64>>2]>>2]|0,c,i);a=a+i|0;d=d+2|0;if((g|0)!=(d|0)){continue}break}}if(!(b&1)){break b}la(F[F[F[j+8>>2]+64>>2]>>2]+a|0,c,i)}ja(c);c=1}return c|0}function xb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=M(0);a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=D[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=E[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=H[b>>1];b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=F[b>>2];b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=F[b>>2];b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(F[b+4>>2]){break b}F[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}e=F[b>>2];if(F[b+4>>2]){break b}F[(g<<2)+d>>2]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:d:{e:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break e}e=F[a>>2];k=F[e>>2];g=k;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-k|0;if(!G[a+32|0]){k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(4294967296)|m=M(0)){i=~~m>>>0}else{i=0}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=0;if((b|0)>=(e|0)){break d}b=0;while(1){m=J[g>>2];if(m>=M(4294967296)|mM(1)){break d}e=(b<<2)+d|0;j=R(+m*4294967295+.5);f:{if(j<4294967296&j>=0){i=~~j>>>0;break f}i=0}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break e}g=g+4|0;if(f>>>0>g>>>0){continue}break}break d}k=1;if(c>>>0<=e>>>0){break d}ma((e<<2)+d|0,0,c-e<<2)}return k;case 9:g:{h:{e=G[a+24|0];c=c&255;if(!(c>>>0>e>>>0?e:c)){break h}e=F[a>>2];k=F[e>>2];g=k;f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+f|0;g=b+g|0;f=F[e+4>>2];e=f-k|0;if(!G[a+32|0]){k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=K[g>>3];if(j>=4294967295|j<0|(N(j)==Infinity|j!=j)){break g}e=(b<<2)+d|0;if(j<4294967296&j>=0){i=~~j>>>0}else{i=0}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=0;if((b|0)>=(e|0)){break g}b=0;while(1){j=K[g>>3];if(j>=4294967295|j<0|(N(j)==Infinity|j!=j)){break g}if(j>1){break g}e=(b<<2)+d|0;j=R(j*4294967295+.5);i:{if(j<4294967296&j>=0){i=~~j>>>0;break i}i=0}F[e>>2]=i;b=b+1|0;e=G[a+24|0];if(b>>>0>=(c>>>0>e>>>0?e:c)>>>0){break h}g=g+8|0;if(f>>>0>g>>>0){continue}break}break g}k=1;if(c>>>0<=e>>>0){break g}ma((e<<2)+d|0,0,c-e<<2)}return k;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];h=F[e>>2];l=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);i=b;b=b+l|0;b=b+h|0;h=F[e+4>>2];while(1){if(b>>>0>=h>>>0){break b}F[(g<<2)+d>>2]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ma((e<<2)+d|0,0,(c&255)-e<<2)}return k}ma((e<<2)+d|0,0,(c&255)-e<<2);return 1}function rd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{b:{c:{d:{e:{if(F[a+92>>2]==F[a+88>>2]){break e}c=F[a+52>>2];f:{if((c|0)!=F[a+56>>2]){F[c>>2]=b;F[a+52>>2]=c+4;break f}h=F[a+48>>2];g=c-h|0;d=g>>2;f=d+1|0;if(f>>>0>=1073741824){break a}e=g>>>1|0;g=g>>>0>=2147483644?1073741823:f>>>0>>0?e:f;if(g){if(g>>>0>=1073741824){break d}e=ka(g<<2)}else{e=0}f=e+(d<<2)|0;F[f>>2]=b;d=f+4|0;if((c|0)!=(h|0)){while(1){f=f-4|0;c=c-4|0;F[f>>2]=F[c>>2];if((c|0)!=(h|0)){continue}break}}F[a+56>>2]=e+(g<<2);F[a+52>>2]=d;F[a+48>>2]=f;if(!h){break f}ja(h)}F[a+84>>2]=0;c=-1;e=-1;g:{if((b|0)==-1){break g}d=F[a+4>>2];e=b+1|0;e=(e>>>0)%3|0?e:b-2|0;if((e|0)!=-1){c=F[F[d>>2]+(e<<2)>>2]}h:{if((b>>>0)%3|0){l=b-1|0;break h}l=b+2|0;e=-1;if((l|0)==-1){break g}}e=F[F[d>>2]+(l<<2)>>2]}i=e>>>3&536870908;d=F[a+36>>2];h=d+(c>>>3&536870908)|0;g=F[h>>2];f=1<>2]=f|g;f=a+8|0;if((b|0)!=-1){d=b+1|0;d=(d>>>0)%3|0?d:b-2|0}else{d=-1}Ka(f,c,d);d=F[a+36>>2]}f=d+i|0;d=F[f>>2];c=1<>2]=c|d;d=a+8|0;c=-1;i:{if((b|0)==-1){break i}c=b-1|0;if((b>>>0)%3|0){break i}c=b+2|0}Ka(d,e,c)}c=-1;c=(b|0)!=-1?F[F[F[a+4>>2]>>2]+(b<<2)>>2]:c;f=F[a+36>>2]+(c>>>3&536870908)|0;d=F[f>>2];e=1<>2]=d|e;Ka(a+8|0,c,b)}d=F[a+84>>2];if((d|0)>2){break e}while(1){e=L(d,12)+a|0;b=F[e+52>>2];if((b|0)==F[e+48>>2]){d=d+1|0;if((d|0)!=3){continue}break e}b=b-4|0;c=F[b>>2];F[e+52>>2]=b;F[a+84>>2]=d;if((c|0)==-1){break e}f=F[a+24>>2];b=(c>>>0)/3|0;j:{if(F[f+(b>>>3&268435452)>>2]>>>b&1){break j}k:{while(1){k=(c>>>0)/3|0;b=(k>>>3&268435452)+f|0;F[b>>2]=F[b>>2]|1<>2]>>2]+(c<<2)>>2]:d;f=F[a+36>>2]+(d>>>3&536870908)|0;e=F[f>>2];b=1<>2]=b|e;i=F[(F[F[a+16>>2]+96>>2]+L(k,12)|0)+((c>>>0)%3<<2)>>2];l=F[F[a+20>>2]+4>>2];f=F[l+4>>2];t:{if((f|0)!=F[l+8>>2]){F[f>>2]=i;F[l+4>>2]=f+4;break t}j=F[l>>2];h=f-j|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break s}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=ka(h<<2)}else{e=0}b=e+(g<<2)|0;F[b>>2]=i;g=b+4|0;if((f|0)!=(j|0)){while(1){b=b-4|0;f=f-4|0;F[b>>2]=F[f>>2];if((f|0)!=(j|0)){continue}break}}F[l+8>>2]=e+(h<<2);F[l+4>>2]=g;F[l>>2]=b;if(!j){break t}ja(j)}j=F[a+12>>2];f=F[j+4>>2];u:{if((f|0)!=F[j+8>>2]){F[f>>2]=c;F[j+4>>2]=f+4;break u}i=F[j>>2];h=f-i|0;g=h>>2;e=g+1|0;if(e>>>0>=1073741824){break r}b=h>>>1|0;h=h>>>0>=2147483644?1073741823:b>>>0>e>>>0?b:e;if(h){if(h>>>0>=1073741824){break d}e=ka(h<<2)}else{e=0}b=e+(g<<2)|0;F[b>>2]=c;g=b+4|0;if((f|0)!=(i|0)){while(1){b=b-4|0;f=f-4|0;F[b>>2]=F[f>>2];if((f|0)!=(i|0)){continue}break}}F[j+8>>2]=e+(h<<2);F[j+4>>2]=g;F[j>>2]=b;if(!i){break u}ja(i)}b=F[a+12>>2];F[F[b+12>>2]+(d<<2)>>2]=F[b+24>>2];F[b+24>>2]=F[b+24>>2]+1}if((c|0)==-1){break k}g=F[a+4>>2];f=-1;b=c+1|0;b=(b>>>0)%3|0?b:c-2|0;if((b|0)!=-1){f=F[F[g+12>>2]+(b<<2)>>2]}v:{w:{if((L(k,3)|0)!=(c|0)){d=c-1|0;break w}d=c+2|0;c=-1;if((d|0)==-1){break v}}c=F[F[g+12>>2]+(d<<2)>>2]}d=(c|0)==-1;e=(c>>>0)/3|0;if((f|0)!=-1){b=(f>>>0)/3|0;b=F[F[a+24>>2]+(b>>>3&268435452)>>2]&1<>2]+(b>>>3&536870908)>>2]>>>b&1){break x}k=0;b=F[F[g>>2]+(c<<2)>>2];if(!(F[F[a+36>>2]+(b>>>3&536870908)>>2]>>>b&1)){b=F[a+88>>2]+(b<<2)|0;e=F[b>>2];F[b>>2]=e+1;k=(e|0)<=0?2:1}if(F[a+84>>2]>=(k|0)&l){break m}j=L(k,12)+a|0;b=F[j+52>>2];y:{if((b|0)!=F[j+56>>2]){F[b>>2]=c;F[j+52>>2]=b+4;break y}i=F[j+48>>2];h=b-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break c}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=ka(g<<2)}else{e=0}d=e+(d<<2)|0;F[d>>2]=c;c=d+4|0;if((b|0)!=(i|0)){while(1){d=d-4|0;b=b-4|0;F[d>>2]=F[b>>2];if((b|0)!=(i|0)){continue}break}}F[j+48>>2]=d;F[j+52>>2]=c;F[j+56>>2]=e+(g<<2);if(!i){break y}ja(i)}if(F[a+84>>2]<=(k|0)){break x}F[a+84>>2]=k}if(l){break k}c=-1;if((f|0)==-1){break n}}c=F[F[F[a+4>>2]>>2]+(f<<2)>>2]}b=0;if(!(F[F[a+36>>2]+(c>>>3&536870908)>>2]>>>c&1)){b=F[a+88>>2]+(c<<2)|0;c=F[b>>2];F[b>>2]=c+1;b=(c|0)<=0?2:1}if(F[a+84>>2]<(b|0)){break l}c=f}f=F[a+24>>2];continue}break}k=L(b,12)+a|0;c=F[k+52>>2];z:{if((c|0)!=F[k+56>>2]){F[c>>2]=f;F[k+52>>2]=c+4;break z}i=F[k+48>>2];h=c-i|0;d=h>>2;g=d+1|0;if(g>>>0>=1073741824){break b}e=h>>>1|0;g=h>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break d}e=ka(g<<2)}else{e=0}d=e+(d<<2)|0;F[d>>2]=f;f=d+4|0;if((c|0)!=(i|0)){while(1){d=d-4|0;c=c-4|0;F[d>>2]=F[c>>2];if((c|0)!=(i|0)){continue}break}}F[k+48>>2]=d;F[k+52>>2]=f;F[k+56>>2]=e+(g<<2);if(!i){break z}ja(i)}d=F[a+84>>2];if((d|0)<=(b|0)){break j}F[a+84>>2]=b;d=b;break j}d=F[a+84>>2]}if((d|0)<3){continue}break}}return 1}oa();v()}na();v()}na();v()}na();v()}function Mc(a){var b=0,c=0,d=0,e=0,f=0,g=0;e=Z-16|0;Z=e;F[e+12>>2]=a;a:{if(a>>>0<=211){d=F[Lc(10352,10544,e+12|0)>>2];break a}if(a>>>0>=4294967292){V();v()}f=(a>>>0)/210|0;d=L(f,210);F[e+8>>2]=a-d;g=Lc(10544,10736,e+8|0)-10544>>2;while(1){d=F[(g<<2)+10544>>2]+d|0;a=5;while(1){b:{if((a|0)==47){a=211;while(1){b=(d>>>0)/(a>>>0)|0;if(b>>>0>>0){break a}if((L(a,b)|0)==(d|0)){break b}b=a+10|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+12|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+16|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+18|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+22|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+28|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+30|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+36|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+40|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+42|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+46|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+52|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+58|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+60|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+66|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+70|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+72|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+78|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+82|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+88|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+96|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+100|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+102|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+106|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+108|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+112|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+120|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+126|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+130|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+136|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+138|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+142|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+148|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+150|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+156|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+162|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+166|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+168|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+172|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+178|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+180|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+186|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+190|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+192|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+196|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+198|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}if((L(b,c)|0)==(d|0)){break b}b=a+208|0;c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+210|0;if((L(b,c)|0)!=(d|0)){continue}break}break b}b=F[(a<<2)+10352>>2];c=(d>>>0)/(b>>>0)|0;if(b>>>0>c>>>0){break a}a=a+1|0;if((L(b,c)|0)!=(d|0)){continue}}break}d=g+1|0;a=(d|0)==48;g=a?0:d;f=a+f|0;d=L(f,210);continue}}Z=e+16|0;return d}function lb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=M(0),k=0,l=0;a:{if(!d){break a}b:{c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(D[b|0]);J[(h<<2)+d>>2]=i?M(j/M(127)):j;b=b+1|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(G[b|0]);J[(h<<2)+d>>2]=i?M(j/M(255)):j;b=b+1|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(E[b>>1]);J[(h<<2)+d>>2]=i?M(j/M(32767)):j;b=b+2|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(H[b>>1]);J[(h<<2)+d>>2]=i?M(j/M(65535)):j;b=b+2|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(F[b>>2]);J[(h<<2)+d>>2]=i?M(j*M(4.656612873077393e-10)):j;b=b+4|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(I[b>>2]);J[(h<<2)+d>>2]=i?M(j*M(2.3283064365386963e-10)):j;b=b+4|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(+I[b>>2]+ +F[b+4>>2]*4294967296);J[(h<<2)+d>>2]=i?M(j*M(10842021724855044e-35)):j;b=b+8|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];i=G[a+32|0];while(1){if(b>>>0>=g>>>0){break a}j=M(+I[b>>2]+ +I[b+4>>2]*4294967296);J[(h<<2)+d>>2]=i?M(j*M(5.421010862427522e-20)):j;b=b+8|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 8:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}J[(h<<2)+d>>2]=J[b>>2];b=b+4|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 9:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}J[(h<<2)+d>>2]=K[b>>3];b=b+8|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0;break b;case 10:break c;default:break a}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[a>>2];g=F[e>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);k=b;b=b+i|0;b=b+g|0;g=F[e+4>>2];while(1){if(b>>>0>=g>>>0){break a}J[(h<<2)+d>>2]=G[b|0]?M(1):M(0);b=b+1|0;h=h+1|0;e=G[a+24|0];if(h>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}l=1;if(e>>>0>=f>>>0){break a}d=(e<<2)+d|0;a=(c&255)-e|0}ma(d,0,a<<2)}return l}function Cb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=M(0),m=M(0);a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}D[d+g|0]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){return 0}e=D[b|0];if((e|0)<0){break b}D[d+g|0]=e;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>1];if((e+128&65535)>>>0>255){break b}D[d+g|0]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>1];if(e>>>0>127){break b}D[d+g|0]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=F[b>>2];if(e+128>>>0>255){break b}D[d+g|0]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=F[b>>2];if(e>>>0>127){break b}D[d+g|0]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}i=F[b+4>>2];e=F[b>>2];h=e+128|0;i=h>>>0<128?i+1|0:i;if(!i&h>>>0>255|i){break b}D[d+g|0]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}i=F[b+4>>2];e=F[b>>2];if(!i&e>>>0>127|i){break b}D[d+g|0]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=G[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=F[F[a>>2]>>2];f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break d}l=J[b>>2];if(l>=M(127)|lM(1)){break d}j=R(+l*127+.5);if(!(N(j)<2147483648)){break f}h=~~j;break e}if(!(m>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ma(d+e|0,0,c-e|0)}return k;case 9:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}j=K[b>>3];if(j>=127|j<-128|(N(j)==Infinity|j!=j)){break b}e=d+g|0;if(G[a+32|0]){if(j<0|j>1){break b}j=R(j*127+.5)}g:{if(N(j)<2147483648){h=~~j;break g}h=-2147483648}D[e|0]=h;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}D[d+g|0]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ma(d+e|0,0,(c&255)-e|0)}return k}ma(d+e|0,0,(c&255)-e|0);return 1}function Bb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=M(0);a:{b:{if(!d){break b}c:{switch(F[a+28>>2]-1|0){case 0:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){return 0}e=D[b|0];if((e|0)<0){break b}D[d+g|0]=e;b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 1:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}D[d+g|0]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 2:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>1];if(e>>>0>255){break b}D[d+g|0]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 3:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=H[b>>1];if(e>>>0>255){break b}D[d+g|0]=e;b=b+2|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 4:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=F[b>>2];if(e>>>0>255){break b}D[d+g|0]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 5:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}e=F[b>>2];if(e>>>0>255){break b}D[d+g|0]=e;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 6:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}i=F[b+4>>2];e=F[b>>2];if(!i&e>>>0>255|i){break b}D[d+g|0]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 7:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}i=F[b+4>>2];e=F[b>>2];if(!i&e>>>0>255|i){break b}D[d+g|0]=e;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 8:e=G[a+24|0];c=c&255;d:{if(c>>>0>e>>>0?e:c){e=F[F[a>>2]>>2];f=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+f|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break d}l=J[b>>2];if(l>=M(255)|lM(1)){break d}j=R(+l*255+.5);if(!(j<4294967296&j>=0)){break f}h=~~j>>>0;break e}if(!(l=M(0))){break f}h=~~l>>>0;break e}h=0}D[e|0]=h;b=b+4|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(c>>>0>e>>>0?e:c)>>>0){continue}break}}k=1;if(c>>>0<=e>>>0){break d}ma(d+e|0,0,c-e|0)}return k;case 9:e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}j=K[b>>3];if(j>=255|j<0|(N(j)==Infinity|j!=j)){break b}e=d+g|0;if(G[a+32|0]){if(j>1){break b}j=R(j*255+.5)}g:{if(j<4294967296&j>=0){h=~~j>>>0;break g}h=0}D[e|0]=h;b=b+8|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}break a;case 10:break c;default:break b}}e=G[a+24|0];f=c&255;if(e>>>0>>0?e:f){e=F[F[a>>2]>>2];i=F[a+48>>2];b=ki(F[a+40>>2],F[a+44>>2],b,0);h=b;b=b+i|0;b=b+e|0;while(1){if(I[F[a>>2]+4>>2]<=b>>>0){break b}D[d+g|0]=G[b|0];b=b+1|0;g=g+1|0;e=G[a+24|0];if(g>>>0<(e>>>0>>0?e:f)>>>0){continue}break}}k=1;if(e>>>0>=f>>>0){break b}ma(d+e|0,0,(c&255)-e|0)}return k}ma(d+e|0,0,(c&255)-e|0);return 1}function jc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;e=Z-48|0;Z=e;f=H[5053]|H[5054]<<16;d=H[5051]|H[5052]<<16;E[e+38>>1]=d;E[e+40>>1]=d>>>16;E[e+42>>1]=f;E[e+44>>1]=f>>>16;d=F[2525];F[e+32>>2]=F[2524];F[e+36>>2]=d;d=F[2523];F[e+24>>2]=F[2522];F[e+28>>2]=d;d=F[2521];F[e+16>>2]=F[2520];F[e+20>>2]=d;g=F[b+8>>2];i=F[b+12>>2];h=F[b+20>>2];d=F[b+16>>2];f=d+5|0;h=f>>>0<5?h+1|0:h;a:{b:{if(g>>>0>>0&(h|0)>=(i|0)|(h|0)>(i|0)){d=ya(e+16|0);if(d>>>0>=2147483632){break a}c:{d:{if(d>>>0>=11){b=(d|15)+1|0;c=ka(b);F[e+8>>2]=b|-2147483648;F[e>>2]=c;F[e+4>>2]=d;b=c+d|0;break d}D[e+11|0]=d;b=d+e|0;c=e;if(!d){break c}}la(c,e+16|0,d)}D[b|0]=0;F[a>>2]=-2;b=a+4|0;if(D[e+11|0]>=0){a=F[e+4>>2];F[b>>2]=F[e>>2];F[b+4>>2]=a;F[b+8>>2]=F[e+8>>2];break b}ra(b,F[e>>2],F[e+4>>2]);if(D[e+11|0]>=0){break b}ja(F[e>>2]);break b}f=d+F[b>>2]|0;d=G[f|0]|G[f+1|0]<<8|(G[f+2|0]<<16|G[f+3|0]<<24);D[c|0]=d;D[c+1|0]=d>>>8;D[c+2|0]=d>>>16;D[c+3|0]=d>>>24;D[c+4|0]=G[f+4|0];d=F[b+20>>2];f=F[b+16>>2]+5|0;d=f>>>0<5?d+1|0:d;F[b+16>>2]=f;F[b+20>>2]=d;if(sa(c,1250,5)){d=ka(32);D[d+17|0]=0;D[d+16|0]=G[1494];c=G[1490]|G[1491]<<8|(G[1492]<<16|G[1493]<<24);b=G[1486]|G[1487]<<8|(G[1488]<<16|G[1489]<<24);D[d+8|0]=b;D[d+9|0]=b>>>8;D[d+10|0]=b>>>16;D[d+11|0]=b>>>24;D[d+12|0]=c;D[d+13|0]=c>>>8;D[d+14|0]=c>>>16;D[d+15|0]=c>>>24;c=G[1482]|G[1483]<<8|(G[1484]<<16|G[1485]<<24);b=G[1478]|G[1479]<<8|(G[1480]<<16|G[1481]<<24);D[d|0]=b;D[d+1|0]=b>>>8;D[d+2|0]=b>>>16;D[d+3|0]=b>>>24;D[d+4|0]=c;D[d+5|0]=c>>>8;D[d+6|0]=c>>>16;D[d+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,d,17);ja(d);break b}g=F[b+12>>2];if((g|0)<=(d|0)&I[b+8>>2]<=f>>>0|(d|0)>(g|0)){d=ya(e+16|0);if(d>>>0>=2147483632){break a}e:{f:{if(d>>>0>=11){b=(d|15)+1|0;c=ka(b);F[e+8>>2]=b|-2147483648;F[e>>2]=c;F[e+4>>2]=d;b=c+d|0;break f}D[e+11|0]=d;b=d+e|0;c=e;if(!d){break e}}la(c,e+16|0,d)}D[b|0]=0;F[a>>2]=-2;b=a+4|0;if(D[e+11|0]>=0){a=F[e+4>>2];F[b>>2]=F[e>>2];F[b+4>>2]=a;F[b+8>>2]=F[e+8>>2];break b}ra(b,F[e>>2],F[e+4>>2]);if(D[e+11|0]>=0){break b}ja(F[e>>2]);break b}D[c+5|0]=G[f+F[b>>2]|0];g=F[b+20>>2];d=F[b+16>>2]+1|0;g=d?g:g+1|0;F[b+16>>2]=d;F[b+20>>2]=g;f=F[b+12>>2];if((f|0)<=(g|0)&I[b+8>>2]<=d>>>0|(g|0)>(f|0)){d=ya(e+16|0);if(d>>>0>=2147483632){break a}g:{h:{if(d>>>0>=11){b=(d|15)+1|0;c=ka(b);F[e+8>>2]=b|-2147483648;F[e>>2]=c;F[e+4>>2]=d;b=c+d|0;break h}D[e+11|0]=d;b=d+e|0;c=e;if(!d){break g}}la(c,e+16|0,d)}D[b|0]=0;F[a>>2]=-2;b=a+4|0;if(D[e+11|0]>=0){a=F[e+4>>2];F[b>>2]=F[e>>2];F[b+4>>2]=a;F[b+8>>2]=F[e+8>>2];break b}ra(b,F[e>>2],F[e+4>>2]);if(D[e+11|0]>=0){break b}ja(F[e>>2]);break b}D[c+6|0]=G[d+F[b>>2]|0];h=F[b+20>>2];d=F[b+16>>2]+1|0;h=d?h:h+1|0;F[b+16>>2]=d;F[b+20>>2]=h;f=F[b+12>>2];if((f|0)<=(h|0)&I[b+8>>2]<=d>>>0|(f|0)<(h|0)){d=ya(e+16|0);if(d>>>0>=2147483632){break a}i:{j:{if(d>>>0>=11){b=(d|15)+1|0;c=ka(b);F[e+8>>2]=b|-2147483648;F[e>>2]=c;F[e+4>>2]=d;b=c+d|0;break j}D[e+11|0]=d;b=d+e|0;c=e;if(!d){break i}}la(c,e+16|0,d)}D[b|0]=0;F[a>>2]=-2;b=a+4|0;if(D[e+11|0]>=0){a=F[e+4>>2];F[b>>2]=F[e>>2];F[b+4>>2]=a;F[b+8>>2]=F[e+8>>2];break b}ra(b,F[e>>2],F[e+4>>2]);if(D[e+11|0]>=0){break b}ja(F[e>>2]);break b}D[c+7|0]=G[d+F[b>>2]|0];g=F[b+20>>2];d=F[b+16>>2]+1|0;g=d?g:g+1|0;F[b+16>>2]=d;F[b+20>>2]=g;f=F[b+12>>2];if((f|0)<=(g|0)&I[b+8>>2]<=d>>>0|(g|0)>(f|0)){c=Eb(e,e+16|0);F[a>>2]=-2;b=a+4|0;if(D[c+11|0]>=0){a=F[c+4>>2];F[b>>2]=F[c>>2];F[b+4>>2]=a;F[b+8>>2]=F[c+8>>2];break b}ra(b,F[c>>2],F[c+4>>2]);if(D[c+11|0]>=0){break b}ja(F[c>>2]);break b}D[c+8|0]=G[d+F[b>>2]|0];d=F[b+20>>2];g=F[b+16>>2];f=g+1|0;i=f?d:d+1|0;F[b+16>>2]=f;F[b+20>>2]=i;i=F[b+8>>2];h=F[b+12>>2];g=g+3|0;d=g>>>0<3?d+1|0:d;if(g>>>0>i>>>0&(d|0)>=(h|0)|(d|0)>(h|0)){c=Eb(e,e+16|0);F[a>>2]=-2;b=a+4|0;if(D[c+11|0]>=0){a=F[c+4>>2];F[b>>2]=F[c>>2];F[b+4>>2]=a;F[b+8>>2]=F[c+8>>2];break b}ra(b,F[c>>2],F[c+4>>2]);if(D[c+11|0]>=0){break b}ja(F[c>>2]);break b}d=c;c=F[b>>2]+f|0;E[d+10>>1]=G[c|0]|G[c+1|0]<<8;g=F[b+20>>2];c=F[b+16>>2]+2|0;g=c>>>0<2?g+1|0:g;F[b+16>>2]=c;F[b+20>>2]=g;F[a+8>>2]=0;F[a+12>>2]=0;F[a>>2]=0;F[a+4>>2]=0}Z=e+48|0;return}za();v()}function Mb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;e=Z-96|0;Z=e;f=F[a+16>>2];D[e+92|0]=1;F[e+88>>2]=b;F[e+84>>2]=b;F[e+80>>2]=f;j=F[a+20>>2];d=F[j>>2];a:{b:{f=F[F[f+28>>2]+(b<<2)>>2];if(f>>>0>2]-d>>2>>>0){d=F[F[a+8>>2]+(F[d+(f<<2)>>2]<<2)>>2];f=F[a+4>>2];if(!G[f+84|0]){d=F[F[f+68>>2]+(d<<2)>>2]}F[e+72>>2]=0;F[e+76>>2]=0;j=e- -64|0;F[j>>2]=0;F[j+4>>2]=0;F[e+56>>2]=0;F[e+60>>2]=0;Ga(f,d,D[f+24|0],e+56|0);if((b|0)!=-1){f=b+1|0;j=(f>>>0)%3|0?f:b-2|0;m=((b>>>0)%3|0?-1:2)+b|0;while(1){d=j;f=m;c:{if(!F[a+28>>2]){break c}f=b+1|0;d=(f>>>0)%3|0?f:b-2|0;f=b-1|0;if((b>>>0)%3|0){break c}f=b+2|0}n=F[a+20>>2];b=F[n>>2];d=F[F[F[a+16>>2]+28>>2]+(d<<2)>>2];if(d>>>0>=F[n+4>>2]-b>>2>>>0){break b}d=F[F[a+8>>2]+(F[b+(d<<2)>>2]<<2)>>2];b=F[a+4>>2];if(!G[b+84|0]){d=F[F[b+68>>2]+(d<<2)>>2]}F[e+48>>2]=0;F[e+52>>2]=0;F[e+40>>2]=0;F[e+44>>2]=0;F[e+32>>2]=0;F[e+36>>2]=0;Ga(b,d,D[b+24|0],e+32|0);d=F[a+20>>2];b=F[d>>2];f=F[F[F[a+16>>2]+28>>2]+(f<<2)>>2];if(f>>>0>=F[d+4>>2]-b>>2>>>0){break a}d=F[F[a+8>>2]+(F[b+(f<<2)>>2]<<2)>>2];b=F[a+4>>2];if(!G[b+84|0]){d=F[F[b+68>>2]+(d<<2)>>2]}F[e+24>>2]=0;F[e+28>>2]=0;F[e+16>>2]=0;F[e+20>>2]=0;F[e+8>>2]=0;F[e+12>>2]=0;Ga(b,d,D[b+24|0],e+8|0);g=F[e+8>>2];b=F[e+56>>2];d=g-b|0;p=F[e+60>>2];t=F[e+12>>2]-(p+(b>>>0>g>>>0)|0)|0;h=F[e+40>>2];f=F[e+64>>2];n=h-f|0;u=F[e+68>>2];y=F[e+44>>2]-(u+(f>>>0>h>>>0)|0)|0;g=ki(d,t,n,y);w=o-g|0;x=i-(_+(g>>>0>o>>>0)|0)|0;i=w;h=F[e+16>>2];g=h-f|0;u=F[e+20>>2]-((f>>>0>h>>>0)+u|0)|0;k=F[e+32>>2];h=k-b|0;w=F[e+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=ki(g,u,h,w);o=i+b|0;i=_+x|0;i=b>>>0>o>>>0?i+1|0:i;b=l;l=d;p=t;k=F[e+48>>2];f=F[e+72>>2];d=k-f|0;t=F[e+76>>2];x=F[e+52>>2]-(t+(f>>>0>k>>>0)|0)|0;l=ki(l,p,d,x);k=b+l|0;b=_+q|0;b=k>>>0>>0?b+1|0:b;l=F[e+24>>2];p=l-f|0;f=F[e+28>>2]-((f>>>0>l>>>0)+t|0)|0;q=ki(p,f,h,w);l=k-q|0;q=b-(_+(k>>>0>>0)|0)|0;b=ki(g,u,d,x);d=r-b|0;b=s-(_+(b>>>0>r>>>0)|0)|0;s=ki(p,f,n,y);r=s+d|0;b=_+b|0;s=r>>>0>>0?b+1|0:b;b=F[e+88>>2];f=F[e+80>>2];d:{if(G[e+92|0]){e:{f:{g:{h:{if((b|0)==-1){break h}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;if((b|0)==-1|F[F[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break h}b=F[F[F[f+64>>2]+12>>2]+(b<<2)>>2];if((b|0)!=-1){break g}}F[e+88>>2]=-1;break f}d=b+1|0;b=(d>>>0)%3|0?d:b-2|0;F[e+88>>2]=b;if((b|0)!=-1){break e}}b=F[e+84>>2];d=-1;i:{if((b|0)==-1){break i}j:{if((b>>>0)%3|0){b=b-1|0;break j}b=b+2|0;d=-1;if((b|0)==-1){break i}}d=-1;if(F[F[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break i}b=F[F[F[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break i}d=b-1|0;if((b>>>0)%3|0){break i}d=b+2|0}D[e+92|0]=0;F[e+88>>2]=d;break d}if((b|0)!=F[e+84>>2]){break d}F[e+88>>2]=-1;break d}d=-1;k:{if((b|0)==-1){break k}l:{if((b>>>0)%3|0){b=b-1|0;break l}b=b+2|0;d=-1;if((b|0)==-1){break k}}d=-1;if(F[F[f>>2]+(b>>>3&536870908)>>2]>>>b&1){break k}b=F[F[F[f+64>>2]+12>>2]+(b<<2)>>2];d=-1;if((b|0)==-1){break k}d=b-1|0;if((b>>>0)%3|0){break k}d=b+2|0}F[e+88>>2]=d}b=F[e+88>>2];if((b|0)!=-1){continue}break}}b=s>>31;f=b^r;d=f-b|0;b=(b^s)-((b>>>0>f>>>0)+b|0)|0;m=-1;f=2147483647;g=q>>31;h=g^l;j=h-g|0;n=(g^q)-((h>>>0>>0)+g|0)|0;h=n;k=j^-1;g=h^2147483647;n=i;m:{n:{if(!F[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break m}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;f=a;g=i;a=g>>31;d=a;m=d^o;a=m-d|0;i=a;d=(d^g)-((d>>>0>m>>>0)+d|0)|0;a=a+f|0;d=d^2147483647;i=(d|0)==(b|0)&(i^-1)>>>0>>0|b>>>0>d>>>0;a=i?-1:a;if(!(i&0)&(a|0)<=536870912|(a|0)<536870912){break m}b=0;a=a>>>29|0;break n}o:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break o}b=b+h|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=i;d=i>>31;h=d^o;i=h-d|0;j=(d^k)-((d>>>0>h>>>0)+d|0)|0;g=j^2147483647;d=a;a=i;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break o}b=b+j|0;m=a+d|0;b=m>>>0>>0?b+1|0:b;f=b;if(!b&m>>>0<536870913){break m}}b=f>>>29|0;a=(f&536870911)<<3|m>>>29}o=li(o,n,a,b);l=li(l,q,a,b);r=li(r,s,a,b)}F[c+8>>2]=o;F[c+4>>2]=l;F[c>>2]=r;Z=e+96|0;return}ta();v()}ta();v()}ta();v()}function te(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;g=Z-16|0;Z=g;f=1;m=$[F[F[a>>2]+24>>2]](a)|0;a:{if((m|0)<=0){break a}r=a+48|0;f=0;while(1){b:{c:{if(!F[($[F[F[a>>2]+28>>2]](a)|0)+40>>2]){break c}o=l<<2;d=F[o+F[a+36>>2]>>2];c=F[d+8>>2];e=bb(d);if(!e){break c}h=F[($[F[F[a>>2]+28>>2]](a)|0)+40>>2];F[g+12>>2]=F[c+56>>2];d=ka(32);F[g>>2]=d;F[g+4>>2]=24;F[g+8>>2]=-2147483616;c=G[1196]|G[1197]<<8|(G[1198]<<16|G[1199]<<24);b=G[1192]|G[1193]<<8|(G[1194]<<16|G[1195]<<24);D[d+16|0]=b;D[d+17|0]=b>>>8;D[d+18|0]=b>>>16;D[d+19|0]=b>>>24;D[d+20|0]=c;D[d+21|0]=c>>>8;D[d+22|0]=c>>>16;D[d+23|0]=c>>>24;c=G[1188]|G[1189]<<8|(G[1190]<<16|G[1191]<<24);b=G[1184]|G[1185]<<8|(G[1186]<<16|G[1187]<<24);D[d+8|0]=b;D[d+9|0]=b>>>8;D[d+10|0]=b>>>16;D[d+11|0]=b>>>24;D[d+12|0]=c;D[d+13|0]=c>>>8;D[d+14|0]=c>>>16;D[d+15|0]=c>>>24;c=G[1180]|G[1181]<<8|(G[1182]<<16|G[1183]<<24);b=G[1176]|G[1177]<<8|(G[1178]<<16|G[1179]<<24);D[d|0]=b;D[d+1|0]=b>>>8;D[d+2|0]=b>>>16;D[d+3|0]=b>>>24;D[d+4|0]=c;D[d+5|0]=c>>>8;D[d+6|0]=c>>>16;D[d+7|0]=c>>>24;D[d+24|0]=0;c=h+16|0;b=F[c>>2];d:{e:{if(!b){break e}i=F[g+12>>2];d=c;while(1){k=(i|0)>F[b+16>>2];d=k?d:b;b=F[(k?b+4|0:b)>>2];if(b){continue}break}if((c|0)==(d|0)|(i|0)>2]){break e}b=F[d+24>>2];if(!b){break e}i=d+20|0;d=G[g+11|0];c=d<<24>>24<0;k=c?F[g>>2]:g;d=c?F[g+4>>2]:d;while(1){c=G[b+27|0];j=c<<24>>24<0;c=j?F[b+20>>2]:c;p=c>>>0>>0;f:{g:{h:{i:{j:{k:{n=p?c:d;if(n){j=j?F[b+16>>2]:b+16|0;q=sa(k,j,n);if(q){break k}if(c>>>0<=d>>>0){break j}break f}if(c>>>0<=d>>>0){break i}break f}if((q|0)<0){break f}}c=sa(j,k,n);if(c){break h}}if(p){break g}d=gc(i,g);break d}if((c|0)<0){break g}d=gc(i,g);break d}b=b+4|0}b=F[b>>2];if(b){continue}break}}d=gc(h,g)}if(D[g+11|0]<0){ja(F[g>>2])}if(!d){break c}d=0;c=F[F[o+F[a+36>>2]>>2]+8>>2];if(!F[c+64>>2]){b=ka(32);F[b+16>>2]=0;F[b+20>>2]=0;F[b+8>>2]=0;F[b>>2]=0;F[b+4>>2]=0;F[b+24>>2]=0;F[b+28>>2]=0;f=F[c+64>>2];F[c+64>>2]=b;if(f){b=F[f>>2];if(b){F[f+4>>2]=b;ja(b)}ja(f);b=F[c+64>>2]}F[c>>2]=b;f=F[b+20>>2];F[c+8>>2]=F[b+16>>2];F[c+12>>2]=f;f=F[b+24>>2];b=F[b+28>>2];F[c+48>>2]=0;F[c+52>>2]=0;F[c+40>>2]=0;F[c+44>>2]=0;F[c+16>>2]=f;F[c+20>>2]=b}l:{D[c+24|0]=G[e+24|0];F[c+28>>2]=F[e+28>>2];D[c+32|0]=G[e+32|0];b=F[e+44>>2];F[c+40>>2]=F[e+40>>2];F[c+44>>2]=b;b=F[e+52>>2];F[c+48>>2]=F[e+48>>2];F[c+52>>2]=b;F[c+56>>2]=F[e+56>>2];b=F[e+12>>2];F[c+8>>2]=F[e+8>>2];F[c+12>>2]=b;b=F[e+20>>2];F[c+16>>2]=F[e+16>>2];F[c+20>>2]=b;F[c+60>>2]=F[e+60>>2];f=F[e>>2];m:{if(!f){F[c>>2]=0;b=1;break m}h=F[c>>2];b=0;if(!h){break m}b=F[f>>2];f=F[f+4>>2]-b|0;md(h,b,f,0);b=1}if(!b){break l}D[c+84|0]=G[e+84|0];F[c+80>>2]=F[e+80>>2];if((c|0)!=(e|0)){gb(c+68|0,F[e+68>>2],F[e+72>>2])}n:{h=F[e+88>>2];o:{if(h){f=ka(40);e=F[h>>2];F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;F[f>>2]=e;e=F[h+12>>2];b=F[h+8>>2];if((e|0)!=(b|0)){b=e-b|0;if((b|0)<0){break n}e=ka(b);F[f+12>>2]=e;F[f+8>>2]=e;F[f+16>>2]=b+e;b=F[h+8>>2];i=F[h+12>>2];p:{if((b|0)==(i|0)){break p}k=i+(b^-1)|0;j=i-b&7;if(j){while(1){D[e|0]=G[b|0];e=e+1|0;b=b+1|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}}if(k>>>0<7){break p}while(1){D[e|0]=G[b|0];D[e+1|0]=G[b+1|0];D[e+2|0]=G[b+2|0];D[e+3|0]=G[b+3|0];D[e+4|0]=G[b+4|0];D[e+5|0]=G[b+5|0];D[e+6|0]=G[b+6|0];D[e+7|0]=G[b+7|0];e=e+8|0;b=b+8|0;if((i|0)!=(b|0)){continue}break}}F[f+12>>2]=e}d=F[h+36>>2];F[f+32>>2]=F[h+32>>2];F[f+36>>2]=d;d=F[h+28>>2];F[f+24>>2]=F[h+24>>2];F[f+28>>2]=d;e=F[c+88>>2];F[c+88>>2]=f;if(e){break o}break l}e=F[c+88>>2];F[c+88>>2]=0;if(!e){break l}}d=F[e+8>>2];if(d){F[e+12>>2]=d;ja(d)}ja(e);break l}na();v()}break b}d=F[F[a+36>>2]+(l<<2)>>2];if(!($[F[F[d>>2]+24>>2]](d,r)|0)){break a}}l=l+1|0;f=(m|0)<=(l|0);if((l|0)!=(m|0)){continue}break}}Z=g+16|0;return f|0}function Jg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=Z-32|0;Z=f;a:{if(!hb(1,f+28|0,F[a+32>>2])){break a}if(!hb(1,f+24|0,F[a+32>>2])){break a}l=F[f+28>>2];if(l>>>0>1431655765){break a}d=F[a+32>>2];c=d;i=F[c+8>>2];b=F[c+16>>2];h=F[c+12>>2];c=F[c+20>>2];g=li(i-b|0,h-(c+(b>>>0>i>>>0)|0)|0,3,0);if(!_&g>>>0>>0){break a}n=F[f+24>>2];g=ki(l,0,3,0);if(!_&g>>>0>>0|((c|0)>=(h|0)&b>>>0>=i>>>0|(c|0)>(h|0))){break a}i=G[b+F[d>>2]|0];b=b+1|0;c=b?c:c+1|0;F[d+16>>2]=b;F[d+20>>2]=c;b:{c:{if(!i){d=0;c=Z-32|0;Z=c;F[c+24>>2]=0;F[c+16>>2]=0;F[c+20>>2]=0;d:{e:{b=L(l,3);if(b){if(b>>>0>=1073741824){break e}i=L(l,12);d=ka(i);ma(d,0,i)}b=mc(b,1,F[a+32>>2],d);f:{g:{if(!(!l|!b)){i=0;while(1){h:{g=e;b=(i<<2)+d|0;h=F[b>>2];e=h>>>1|0;h=g+(h&1?0-e|0:e)|0;if((h|0)<0){break h}F[c>>2]=h;e=F[b+4>>2];g=e>>>1|0;h=h+(e&1?0-g|0:g)|0;if((h|0)<0){break h}F[c+4>>2]=h;b=F[b+8>>2];e=b>>>1|0;e=h+(b&1?0-e|0:e)|0;if((e|0)<0){break h}F[c+8>>2]=e;mb(F[a+44>>2]+96|0,c);i=i+3|0;b=1;j=j+1|0;if((j|0)!=(l|0)){continue}break g}break}b=0;break g}if(!d){break f}}ja(d)}Z=c+32|0;break d}na();v()}if(b){break c}break a}if(n>>>0<=255){if(!l){break c}while(1){i:{F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;d=F[a+32>>2];b=d;i=F[b+16>>2];e=F[b+8>>2];c=F[b+20>>2];g=F[b+12>>2];b=g;if(e>>>0<=i>>>0&(c|0)>=(b|0)|(b|0)<(c|0)){break i}j=F[d>>2];m=G[j+i|0];b=c;h=i+1|0;b=h?b:b+1|0;F[d+16>>2]=h;F[d+20>>2]=b;F[f+8>>2]=m;m=e>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0);e=m?i:e;g=m?c:g;if((e|0)==(h|0)&(g|0)==(b|0)){break i}m=G[h+j|0];b=c;h=i+2|0;b=h>>>0<2?b+1|0:b;F[d+16>>2]=h;F[d+20>>2]=b;F[f+12>>2]=m;if((e|0)==(h|0)&(b|0)==(g|0)){break i}h=G[h+j|0];b=c;c=i+3|0;b=c>>>0<3?b+1|0:b;F[d+16>>2]=c;F[d+20>>2]=b;F[f+16>>2]=h;mb(F[a+44>>2]+96|0,f+8|0);k=k+1|0;if((l|0)!=(k|0)){continue}break c}break}k=0;break a}if(n>>>0<=65535){if(!l){break c}while(1){j:{F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;j=F[a+32>>2];b=j;c=F[b+8>>2];d=F[b+12>>2];h=F[b+16>>2];b=F[b+20>>2];i=b;e=h+2|0;b=e>>>0<2?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break j}m=F[j>>2];g=m+h|0;g=G[g|0]|G[g+1|0]<<8;F[j+16>>2]=e;F[j+20>>2]=b;F[f+8>>2]=g;b=i;g=h+4|0;b=g>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break j}e=e+m|0;e=G[e|0]|G[e+1|0]<<8;F[j+16>>2]=g;F[j+20>>2]=b;F[f+12>>2]=e;e=c;b=i;c=h+6|0;b=c>>>0<6?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break j}d=g+m|0;d=G[d|0]|G[d+1|0]<<8;F[j+16>>2]=c;F[j+20>>2]=b;F[f+16>>2]=d;mb(F[a+44>>2]+96|0,f+8|0);k=k+1|0;if((l|0)!=(k|0)){continue}break c}break}k=0;break a}k:{if(n>>>0>2097151){break k}b=H[a+36>>1];if(((b<<8|b>>>8)&65535)>>>0<514){break k}if(!l){break c}while(1){l:{F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;if(!hb(1,f+4|0,F[a+32>>2])){break l}F[f+8>>2]=F[f+4>>2];if(!hb(1,f+4|0,F[a+32>>2])){break l}F[f+12>>2]=F[f+4>>2];if(!hb(1,f+4|0,F[a+32>>2])){break l}F[f+16>>2]=F[f+4>>2];mb(F[a+44>>2]+96|0,f+8|0);k=k+1|0;if((l|0)!=(k|0)){continue}break c}break}k=0;break a}if(!l){break c}while(1){F[f+16>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;j=F[a+32>>2];b=j;c=F[b+8>>2];d=F[b+12>>2];h=F[b+16>>2];b=F[b+20>>2];i=b;e=h+4|0;b=e>>>0<4?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break b}m=F[j>>2];g=m+h|0;g=G[g|0]|G[g+1|0]<<8|(G[g+2|0]<<16|G[g+3|0]<<24);F[j+16>>2]=e;F[j+20>>2]=b;F[f+8>>2]=g;b=i;g=h+8|0;b=g>>>0<8?b+1|0:b;if(c>>>0>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break b}e=e+m|0;e=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);F[j+16>>2]=g;F[j+20>>2]=b;F[f+12>>2]=e;e=c;b=i;c=h+12|0;b=c>>>0<12?b+1|0:b;if(c>>>0>e>>>0&(b|0)>=(d|0)|(b|0)>(d|0)){break b}d=g+m|0;d=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[j+16>>2]=c;F[j+20>>2]=b;F[f+16>>2]=d;mb(F[a+44>>2]+96|0,f+8|0);k=k+1|0;if((l|0)!=(k|0)){continue}break}}F[F[a+4>>2]+80>>2]=n;k=1;break a}k=0}Z=f+32|0;return k|0}function Ld(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=Z+-64|0;Z=g;F[g+56>>2]=0;F[g+48>>2]=0;F[g+52>>2]=0;F[g+40>>2]=0;F[g+44>>2]=0;F[g+32>>2]=0;F[g+36>>2]=0;F[g+24>>2]=0;F[g+28>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;h=g+8|0;a:{b:{if(!H[b+38>>1]){break b}if(!Ta(1,h+12|0,b)){break b}e=F[b+8>>2];f=F[b+16>>2];j=e-f|0;k=F[h+12>>2];e=F[b+12>>2]-(F[b+20>>2]+(e>>>0>>0)|0)|0;if(j>>>0>>6>>>0&(e|0)<=0|(e|0)<0){break b}e=F[h>>2];d=F[h+4>>2]-e>>2;c:{if(d>>>0>>0){qa(h,k-d|0);k=F[h+12>>2];break c}if(d>>>0<=k>>>0){break c}F[h+4>>2]=e+(k<<2)}i=1;if(!k){break a}e=F[b+16>>2];d=F[b+20>>2];r=F[h>>2];l=F[b+8>>2];o=F[b+12>>2];j=0;while(1){i=0;if((d|0)>=(o|0)&e>>>0>=l>>>0|(d|0)>(o|0)){break a}i=F[b>>2];p=G[i+e|0];e=e+1|0;d=e?d:d+1|0;F[b+16>>2]=e;F[b+20>>2]=d;f=p>>>2|0;m=0;d:{e:{f:{g:{s=p&3;switch(s|0){case 3:break g;case 0:break e;default:break f}}f=f+j|0;i=0;if(f>>>0>=k>>>0){break a}ma(r+(j<<2)|0,0,(p&252)+4|0);j=f;break d}while(1){if((e|0)==(l|0)&(d|0)==(o|0)){break b}k=G[e+i|0];e=e+1|0;d=e?d:d+1|0;F[b+16>>2]=e;F[b+20>>2]=d;f=k<<(m<<3|6)|f;m=m+1|0;if((s|0)!=(m|0)){continue}break}}F[r+(j<<2)>>2]=f}j=j+1|0;k=F[h+12>>2];if(j>>>0>>0){continue}break}d=h+16|0;o=F[h>>2];f=F[h+16>>2];e=F[h+20>>2]-f|0;h:{if(e>>>0<=4194303){qa(d,1048576-(e>>>2|0)|0);break h}if((e|0)==4194304){break h}F[h+20>>2]=f+4194304}e=h+28|0;j=F[e>>2];f=F[h+32>>2]-j>>3;i:{if(f>>>0>>0){_a(e,k-f|0);j=F[e>>2];break i}if(f>>>0>k>>>0){F[h+32>>2]=(k<<3)+j}if(!k){break b}}l=F[d>>2];d=0;i=0;while(1){e=o+(d<<2)|0;h=F[e>>2];m=(d<<3)+j|0;f=i;F[m+4>>2]=f;F[m>>2]=h;e=F[e>>2];i=e+f|0;if(i>>>0>1048576){break b}j:{if(f>>>0>=i>>>0){break j}m=0;h=e&7;if(h){while(1){F[l+(f<<2)>>2]=d;f=f+1|0;m=m+1|0;if((h|0)!=(m|0)){continue}break}}if(e-1>>>0<=6){break j}while(1){e=l+(f<<2)|0;F[e>>2]=d;F[e+28>>2]=d;F[e+24>>2]=d;F[e+20>>2]=d;F[e+16>>2]=d;F[e+12>>2]=d;F[e+8>>2]=d;F[e+4>>2]=d;f=f+8|0;if((i|0)!=(f|0)){continue}break}}d=d+1|0;if((k|0)!=(d|0)){continue}break}n=(i|0)==1048576}i=n}k:{if(!i|(F[g+20>>2]?0:a)){break k}i=0;j=Z-16|0;Z=j;l:{if(!Sa(1,j+8|0,b)){break l}d=F[b+8>>2];f=F[b+16>>2];l=d-f|0;n=F[j+12>>2];h=F[b+20>>2];d=F[b+12>>2]-(h+(d>>>0>>0)|0)|0;e=F[j+8>>2];if((n|0)==(d|0)&e>>>0>l>>>0|d>>>0>>0){break l}d=h+n|0;l=e+f|0;d=l>>>0>>0?d+1|0:d;F[b+16>>2]=l;F[b+20>>2]=d;if((e|0)<=0){break l}b=f+F[b>>2]|0;F[g+48>>2]=b;d=e-1|0;f=d+b|0;l=G[f|0];m:{if(l>>>0<=63){F[g+52>>2]=d;b=G[f|0]&63;break m}n:{switch((l>>>6|0)-1|0){case 0:if(e>>>0<2){break l}d=e-2|0;F[g+52>>2]=d;b=b+d|0;b=G[b+1|0]<<8&16128|G[b|0];break m;case 1:if(e>>>0<3){break l}d=e-3|0;F[g+52>>2]=d;b=b+d|0;b=G[b+1|0]<<8|G[b+2|0]<<16&4128768|G[b|0];break m;default:break n}}d=e-4|0;F[g+52>>2]=d;b=b+d|0;b=(G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24))&1073741823}F[g+56>>2]=b+4194304;i=b>>>0<1069547520}Z=j+16|0;if(!i){break k}if(!a){t=1;break k}b=F[g+52>>2];f=F[g+56>>2];d=F[g+36>>2];e=F[g+48>>2];j=F[g+24>>2];while(1){o:{if(f>>>0>4194303){break o}while(1){if((b|0)<=0){break o}b=b-1|0;F[g+52>>2]=b;f=G[b+e|0]|f<<8;F[g+56>>2]=f;if(f>>>0<4194304){continue}break}}i=f&1048575;l=F[j+(i<<2)>>2];n=d+(l<<3)|0;f=(L(F[n>>2],f>>>20|0)+i|0)-F[n+4>>2]|0;F[g+56>>2]=f;F[(q<<2)+c>>2]=l;t=1;q=q+1|0;if((q|0)!=(a|0)){continue}break}}a=F[g+36>>2];if(a){F[g+40>>2]=a;ja(a)}a=F[g+24>>2];if(a){F[g+28>>2]=a;ja(a)}a=F[g+8>>2];if(a){F[g+12>>2]=a;ja(a)}Z=g- -64|0;return t}function kh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=M(0),f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=M(0),p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;if(F[c>>2]==F[c+4>>2]){m=F[d+80>>2];u=Z-16|0;Z=u;g=F[a+4>>2];k=G[b+24|0];h=F[d+48>>2];n=F[F[d>>2]>>2];c=u+8|0;F[c>>2]=1065353216;d=c;J[c>>2]=M(-1<>2];c=ka(k<<2);a:{if(!m|!k){break a}p=h+n|0;o=J[d>>2];n=F[a+8>>2];v=F[b>>2];d=F[b+48>>2];g=F[b+40>>2];w=F[b+44>>2];if(!G[b+84|0]){f=F[b+68>>2];s=k&254;t=k&1;a=0;while(1){b=F[v>>2];l=ki(g,w,F[f+(i<<2)>>2],0)+d|0;h=la(c,b+l|0,g);b=0;q=0;if((k|0)!=1){while(1){l=p+(a<<2)|0;j=b<<2;e=M(R(M(M(o*M(J[j+h>>2]-J[n+j>>2]))+M(.5))));b:{if(M(N(e))>2]=r;j=j|4;e=M(R(M(M(o*M(J[j+h>>2]-J[n+j>>2]))+M(.5))));c:{if(M(N(e))>2]=j;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){l=p+(a<<2)|0;b=b<<2;e=M(R(M(M(o*M(J[b+h>>2]-J[b+n>>2]))+M(.5))));d:{if(M(N(e))>2]=b;a=a+1|0}i=i+1|0;if((m|0)!=(i|0)){continue}break}break a}s=k&254;t=k&1;a=0;while(1){b=F[v>>2];h=ki(g,w,i,l)+d|0;j=la(c,b+h|0,g);b=0;q=0;if((k|0)!=1){while(1){h=p+(a<<2)|0;f=b<<2;e=M(R(M(M(o*M(J[f+j>>2]-J[f+n>>2]))+M(.5))));e:{if(M(N(e))>2]=r;f=f|4;e=M(R(M(M(o*M(J[f+j>>2]-J[f+n>>2]))+M(.5))));f:{if(M(N(e))>2]=f;b=b+2|0;a=a+2|0;q=q+2|0;if((s|0)!=(q|0)){continue}break}}if(t){h=p+(a<<2)|0;b=b<<2;e=M(R(M(M(o*M(J[b+j>>2]-J[b+n>>2]))+M(.5))));g:{if(M(N(e))>2]=b;a=a+1|0}b=l;i=i+1|0;b=i?b:b+1|0;l=b;if((i|0)!=(m|0)|b){continue}break}}ja(c);Z=u+16|0;return 1}j=Z-16|0;Z=j;m=F[a+4>>2];i=G[b+24|0];g=F[d+48>>2];h=F[F[d>>2]>>2];d=j+8|0;F[d>>2]=1065353216;l=d;J[d>>2]=M(-1<>2];d=ka(i<<2);m=F[c+4>>2];q=F[c>>2];h:{if(!i|(m|0)==(q|0)){break h}n=h+g|0;c=m-q>>2;u=c>>>0<=1?1:c;o=J[l>>2];h=F[a+8>>2];v=F[b>>2];l=F[b+48>>2];m=F[b+40>>2];w=F[b+44>>2];if(G[b+84|0]){s=i&254;t=i&1;a=0;c=0;while(1){b=F[v>>2];g=ki(m,w,F[q+(c<<2)>>2],0)+l|0;p=la(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=M(R(M(M(o*M(J[f+p>>2]-J[h+f>>2]))+M(.5))));i:{if(M(N(e))>2]=r;f=f|4;e=M(R(M(M(o*M(J[f+p>>2]-J[h+f>>2]))+M(.5))));j:{if(M(N(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((s|0)!=(k|0)){continue}break}}if(t){g=n+(a<<2)|0;b=b<<2;e=M(R(M(M(o*M(J[b+p>>2]-J[b+h>>2]))+M(.5))));k:{if(M(N(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}break h}s=F[b+68>>2];t=i&254;x=i&1;a=0;c=0;while(1){b=F[v>>2];g=ki(m,w,F[s+(F[q+(c<<2)>>2]<<2)>>2],0)+l|0;p=la(d,b+g|0,m);b=0;k=0;if((i|0)!=1){while(1){g=n+(a<<2)|0;f=b<<2;e=M(R(M(M(o*M(J[f+p>>2]-J[h+f>>2]))+M(.5))));l:{if(M(N(e))>2]=r;f=f|4;e=M(R(M(M(o*M(J[f+p>>2]-J[h+f>>2]))+M(.5))));m:{if(M(N(e))>2]=f;b=b+2|0;a=a+2|0;k=k+2|0;if((t|0)!=(k|0)){continue}break}}if(x){g=n+(a<<2)|0;b=b<<2;e=M(R(M(M(o*M(J[b+p>>2]-J[b+h>>2]))+M(.5))));n:{if(M(N(e))>2]=b;a=a+1|0}c=c+1|0;if((u|0)!=(c|0)){continue}break}}ja(d);Z=j+16|0;return 1} -function Cd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=F[a+4>>2];e=F[a>>2];f=(c-e|0)/144|0;if(f>>>0>>0){e=a;b=b-f|0;h=F[a+8>>2];c=F[a+4>>2];a:{if(b>>>0<=(h-c|0)/144>>>0){b:{if(!b){break b}a=c;f=b&7;if(f){while(1){va(a);a=a+144|0;d=d+1|0;if((f|0)!=(d|0)){continue}break}}c=L(b,144)+c|0;if((b-1&268435455)>>>0<7){break b}while(1){va(a);va(a+144|0);va(a+288|0);va(a+432|0);va(a+576|0);va(a+720|0);va(a+864|0);va(a+1008|0);a=a+1152|0;if((c|0)!=(a|0)){continue}break}}F[e+4>>2]=c;break a}c:{d:{e:{a=c;c=F[e>>2];i=(a-c|0)/144|0;a=i+b|0;if(a>>>0<29826162){c=(h-c|0)/144|0;f=c<<1;f=c>>>0>=14913080?29826161:a>>>0>>0?f:a;if(f){if(f>>>0>=29826162){break e}g=ka(L(f,144))}c=L(i,144)+g|0;a=c;h=b&7;if(h){while(1){va(a);a=a+144|0;d=d+1|0;if((h|0)!=(d|0)){continue}break}}h=L(b,144)+c|0;if((b-1&268435455)>>>0>=7){while(1){va(a);va(a+144|0);va(a+288|0);va(a+432|0);va(a+576|0);va(a+720|0);va(a+864|0);va(a+1008|0);a=a+1152|0;if((h|0)!=(a|0)){continue}break}}b=L(f,144)+g|0;d=F[e+4>>2];f=F[e>>2];if((d|0)==(f|0)){break d}while(1){c=c-144|0;d=d-144|0;a=d;F[c>>2]=F[a>>2];F[c+4>>2]=F[a+4>>2];F[c+8>>2]=F[a+8>>2];F[c+12>>2]=F[a+12>>2];F[a+12>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[c+16>>2]=F[a+16>>2];F[c+20>>2]=F[a+20>>2];F[c+24>>2]=F[a+24>>2];F[a+24>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;g=G[a+28|0];F[c+40>>2]=0;F[c+32>>2]=0;F[c+36>>2]=0;D[c+28|0]=g;F[c+32>>2]=F[a+32>>2];F[c+36>>2]=F[a+36>>2];F[c+40>>2]=F[a+40>>2];F[a+40>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[c+52>>2]=0;F[c+44>>2]=0;F[c+48>>2]=0;F[c+44>>2]=F[a+44>>2];F[c+48>>2]=F[a+48>>2];F[c+52>>2]=F[a+52>>2];F[a+52>>2]=0;F[a+44>>2]=0;F[a+48>>2]=0;g=c- -64|0;F[g>>2]=0;F[c+56>>2]=0;F[c+60>>2]=0;F[c+56>>2]=F[a+56>>2];F[c+60>>2]=F[a+60>>2];i=g;g=a- -64|0;F[i>>2]=F[g>>2];F[g>>2]=0;F[a+56>>2]=0;F[a+60>>2]=0;F[c+68>>2]=F[a+68>>2];g=F[a+72>>2];F[c+84>>2]=0;F[c+76>>2]=0;F[c+80>>2]=0;F[c+72>>2]=g;F[c+76>>2]=F[a+76>>2];F[c+80>>2]=F[a+80>>2];F[c+84>>2]=F[a+84>>2];F[a+84>>2]=0;F[a+76>>2]=0;F[a+80>>2]=0;F[c+96>>2]=0;F[c+88>>2]=0;F[c+92>>2]=0;F[c+88>>2]=F[a+88>>2];F[c+92>>2]=F[a+92>>2];F[c+96>>2]=F[a+96>>2];F[a+96>>2]=0;F[a+88>>2]=0;F[a+92>>2]=0;g=G[a+100|0];F[c+112>>2]=0;F[c+104>>2]=0;F[c+108>>2]=0;D[c+100|0]=g;F[c+104>>2]=F[a+104>>2];F[c+108>>2]=F[a+108>>2];F[c+112>>2]=F[a+112>>2];F[a+112>>2]=0;F[a+104>>2]=0;F[a+108>>2]=0;F[c+124>>2]=0;F[c+116>>2]=0;F[c+120>>2]=0;F[c+116>>2]=F[a+116>>2];F[c+120>>2]=F[a+120>>2];F[c+124>>2]=F[a+124>>2];F[a+124>>2]=0;F[a+116>>2]=0;F[a+120>>2]=0;g=F[a+128>>2];F[c+140>>2]=0;F[c+132>>2]=0;F[c+136>>2]=0;F[c+128>>2]=g;F[c+132>>2]=F[a+132>>2];F[c+136>>2]=F[a+136>>2];F[c+140>>2]=F[a+140>>2];F[a+140>>2]=0;F[a+132>>2]=0;F[a+136>>2]=0;if((a|0)!=(f|0)){continue}break}F[e+8>>2]=b;a=F[e+4>>2];F[e+4>>2]=h;d=F[e>>2];F[e>>2]=c;if((a|0)==(d|0)){break c}while(1){b=a-144|0;c=F[b+132>>2];if(c){F[a-8>>2]=c;ja(c)}c=F[a-28>>2];if(c){F[a-24>>2]=c;ja(c)}c=F[a-40>>2];if(c){F[a-36>>2]=c;ja(c)}Gb(a-140|0);a=b;if((d|0)!=(a|0)){continue}break}break c}na();v()}oa();v()}F[e+8>>2]=b;F[e+4>>2]=h;F[e>>2]=c}if(d){ja(d)}}return}if(b>>>0>>0){e=e+L(b,144)|0;if((e|0)!=(c|0)){while(1){b=c-144|0;d=F[b+132>>2];if(d){F[c-8>>2]=d;ja(d)}d=F[c-28>>2];if(d){F[c-24>>2]=d;ja(d)}d=F[c-40>>2];if(d){F[c-36>>2]=d;ja(d)}Gb(c-140|0);c=b;if((e|0)!=(c|0)){continue}break}}F[a+4>>2]=e}}function Yc(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;F[a+56>>2]=F[a+52>>2];F[a+44>>2]=F[a+40>>2];b=F[a+64>>2];c=F[b+24>>2];if((c|0)==F[b+28>>2]){return 1}a:{b:{c:{while(1){g=i;i=F[(k<<2)+c>>2];d:{if((i|0)==-1){i=g;break d}b=F[a+56>>2];e:{if((b|0)!=F[a+60>>2]){F[b>>2]=g;F[a+56>>2]=b+4;break e}d=F[a+52>>2];e=b-d|0;h=e>>2;c=h+1|0;if(c>>>0>=1073741824){break c}f=e>>>1|0;f=e>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}e=ka(f<<2)}else{e=0}c=e+(h<<2)|0;F[c>>2]=g;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[a+60>>2]=e+(f<<2);F[a+56>>2]=h;F[a+52>>2]=c;if(!d){break e}ja(d)}f:{g:{if(!(F[F[a+12>>2]+(k>>>3&536870908)>>2]>>>k&1)){break g}e=i+1|0;e=(e>>>0)%3|0?e:i-2|0;if((e|0)==-1|F[F[a>>2]+(e>>>3&536870908)>>2]>>>e&1){break g}e=F[F[F[a+64>>2]+12>>2]+(e<<2)>>2];if((e|0)==-1){break g}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)==-1){break g}c=F[a+64>>2];f=F[a>>2];while(1){e=b;b=-1;d=e+1|0;d=(d>>>0)%3|0?d:e-2|0;h:{if((d|0)==-1|F[f+(d>>>3&536870908)>>2]>>>d&1){break h}d=F[F[c+12>>2]+(d<<2)>>2];if((d|0)==-1){break h}b=d+1|0;b=(b>>>0)%3|0?b:d-2|0}if((b|0)!=(i|0)){if((b|0)==-1){break f}continue}break}return 0}e=i}F[F[a+28>>2]+(e<<2)>>2]=g;b=F[a+44>>2];i:{if((b|0)!=F[a+48>>2]){F[b>>2]=e;F[a+44>>2]=b+4;break i}d=F[a+40>>2];i=b-d|0;h=i>>2;c=h+1|0;if(c>>>0>=1073741824){break a}f=i>>>1|0;f=i>>>0>=2147483644?1073741823:c>>>0>>0?f:c;if(f){if(f>>>0>=1073741824){break b}i=ka(f<<2)}else{i=0}c=i+(h<<2)|0;F[c>>2]=e;h=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[a+48>>2]=i+(f<<2);F[a+44>>2]=h;F[a+40>>2]=c;if(!d){break i}ja(d)}i=g+1|0;b=F[a+64>>2];if((e|0)==-1){break d}j:{if((e>>>0)%3|0){c=e-1|0;break j}c=e+2|0;if((c|0)==-1){break d}}d=F[F[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1|(e|0)==(f|0)){break d}while(1){b=f+1|0;b=(b>>>0)%3|0?b:f-2|0;if(F[F[a>>2]+(b>>>3&536870908)>>2]>>>b&1){b=F[a+56>>2];k:{if((b|0)!=F[a+60>>2]){F[b>>2]=i;F[a+56>>2]=b+4;break k}d=F[a+52>>2];g=b-d|0;j=g>>2;c=j+1|0;if(c>>>0>=1073741824){break c}h=g>>>1|0;h=g>>>0>=2147483644?1073741823:c>>>0>>0?h:c;if(h){if(h>>>0>=1073741824){break b}g=ka(h<<2)}else{g=0}c=g+(j<<2)|0;F[c>>2]=i;j=c+4|0;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[a+60>>2]=g+(h<<2);F[a+56>>2]=j;F[a+52>>2]=c;if(!d){break k}ja(d)}d=i+1|0;b=F[a+44>>2];l:{if((b|0)!=F[a+48>>2]){F[b>>2]=f;F[a+44>>2]=b+4;break l}h=F[a+40>>2];g=b-h|0;l=g>>2;c=l+1|0;if(c>>>0>=1073741824){break a}j=g>>>1|0;j=g>>>0>=2147483644?1073741823:c>>>0>>0?j:c;if(j){if(j>>>0>=1073741824){break b}g=ka(j<<2)}else{g=0}c=g+(l<<2)|0;F[c>>2]=f;l=c+4|0;if((b|0)!=(h|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(h|0)){continue}break}}F[a+48>>2]=g+(j<<2);F[a+44>>2]=l;F[a+40>>2]=c;if(!h){break l}ja(h)}g=i;i=d}F[F[a+28>>2]+(f<<2)>>2]=g;b=F[a+64>>2];m:{if((f>>>0)%3|0){c=f-1|0;break m}c=f+2|0;if((c|0)==-1){break d}}d=F[F[b+12>>2]+(c<<2)>>2];if((d|0)==-1){break d}f=d+((d>>>0)%3|0?-1:2)|0;if((f|0)==-1){break d}if((e|0)!=(f|0)){continue}break}}k=k+1|0;c=F[b+24>>2];if(k>>>0>2]-c>>2>>>0){continue}break}return 1}na();v()}oa();v()}na();v()}function Kb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0,x=0,y=0;f=Z-96|0;Z=f;e=F[a+16>>2];D[f+92|0]=1;F[f+88>>2]=b;F[f+84>>2]=b;F[f+80>>2]=e;a:{if((b|0)==-1){break a}j=F[a+20>>2];d=F[j>>2];e=F[F[e>>2]+(b<<2)>>2];if(e>>>0>=F[j+4>>2]-d>>2>>>0){break a}e=F[F[a+8>>2]+(F[d+(e<<2)>>2]<<2)>>2];d=F[a+4>>2];if(!G[d+84|0]){e=F[F[d+68>>2]+(e<<2)>>2]}F[f+72>>2]=0;F[f+76>>2]=0;j=f- -64|0;F[j>>2]=0;F[j+4>>2]=0;F[f+56>>2]=0;F[f+60>>2]=0;Ga(d,e,D[d+24|0],f+56|0);e=b+1|0;j=(e>>>0)%3|0?e:b-2|0;n=((b>>>0)%3|0?-1:2)+b|0;b:{c:{while(1){d=j;e=n;d:{if(!F[a+28>>2]){break d}e=b+1|0;d=(e>>>0)%3|0?e:b-2|0;e=b-1|0;if((b>>>0)%3|0){break d}e=b+2|0}if((d|0)==-1){break b}m=F[a+20>>2];b=F[m>>2];d=F[F[F[a+16>>2]>>2]+(d<<2)>>2];if(d>>>0>=F[m+4>>2]-b>>2>>>0){break b}d=F[F[a+8>>2]+(F[(d<<2)+b>>2]<<2)>>2];b=F[a+4>>2];if(!G[b+84|0]){d=F[F[b+68>>2]+(d<<2)>>2]}F[f+48>>2]=0;F[f+52>>2]=0;F[f+40>>2]=0;F[f+44>>2]=0;F[f+32>>2]=0;F[f+36>>2]=0;Ga(b,d,D[b+24|0],f+32|0);if((e|0)==-1){break c}d=F[a+20>>2];b=F[d>>2];e=F[F[F[a+16>>2]>>2]+(e<<2)>>2];if(e>>>0>=F[d+4>>2]-b>>2>>>0){break c}d=F[F[a+8>>2]+(F[b+(e<<2)>>2]<<2)>>2];b=F[a+4>>2];if(!G[b+84|0]){d=F[F[b+68>>2]+(d<<2)>>2]}F[f+24>>2]=0;F[f+28>>2]=0;F[f+16>>2]=0;F[f+20>>2]=0;F[f+8>>2]=0;F[f+12>>2]=0;Ga(b,d,D[b+24|0],f+8|0);g=F[f+8>>2];b=F[f+56>>2];d=g-b|0;p=F[f+60>>2];t=F[f+12>>2]-(p+(b>>>0>g>>>0)|0)|0;i=F[f+40>>2];e=F[f+64>>2];m=i-e|0;u=F[f+68>>2];y=F[f+44>>2]-(u+(e>>>0>i>>>0)|0)|0;g=ki(d,t,m,y);w=o-g|0;x=h-(_+(g>>>0>o>>>0)|0)|0;h=w;i=F[f+16>>2];g=i-e|0;u=F[f+20>>2]-((e>>>0>i>>>0)+u|0)|0;k=F[f+32>>2];i=k-b|0;w=F[f+36>>2]-((b>>>0>k>>>0)+p|0)|0;b=ki(g,u,i,w);o=h+b|0;h=_+x|0;h=b>>>0>o>>>0?h+1|0:h;b=l;l=d;p=t;k=F[f+48>>2];e=F[f+72>>2];d=k-e|0;t=F[f+76>>2];x=F[f+52>>2]-(t+(e>>>0>k>>>0)|0)|0;l=ki(l,p,d,x);k=b+l|0;b=_+q|0;b=k>>>0>>0?b+1|0:b;l=F[f+24>>2];p=l-e|0;e=F[f+28>>2]-((e>>>0>l>>>0)+t|0)|0;q=ki(p,e,i,w);l=k-q|0;q=b-(_+(k>>>0>>0)|0)|0;b=ki(g,u,d,x);d=r-b|0;b=s-(_+(b>>>0>r>>>0)|0)|0;s=ki(p,e,m,y);r=s+d|0;b=_+b|0;s=r>>>0>>0?b+1|0:b;nc(f+80|0);b=F[f+88>>2];if((b|0)!=-1){continue}break}b=s>>31;e=b^r;d=e-b|0;b=(b^s)-((b>>>0>e>>>0)+b|0)|0;n=-1;e=2147483647;m=q>>31;g=m;i=g^l;j=i-g|0;m=(g^q)-((i>>>0>>0)+g|0)|0;i=m;k=j^-1;g=i^2147483647;m=h;e:{f:{if(!F[a+28>>2]){if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break e}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;e=a;g=h;a=g>>31;d=a;n=d^o;a=n-d|0;h=a;d=(d^g)-((d>>>0>n>>>0)+d|0)|0;a=a+e|0;d=d^2147483647;h=(d|0)==(b|0)&(h^-1)>>>0>>0|b>>>0>d>>>0;a=h?-1:a;if(!(h&0)&(a|0)<=536870912|(a|0)<536870912){break e}b=0;a=a>>>29|0;break f}g:{if((b|0)==(g|0)&d>>>0>k>>>0|b>>>0>g>>>0){break g}b=b+i|0;a=d+j|0;b=a>>>0>>0?b+1|0:b;k=h;h=h>>31;g=h;i=g^o;h=i-g|0;j=(g^k)-((g>>>0>i>>>0)+g|0)|0;g=j^2147483647;d=a;a=h;if((g|0)==(b|0)&d>>>0>(a^-1)>>>0|b>>>0>g>>>0){break g}b=b+j|0;n=a+d|0;b=n>>>0>>0?b+1|0:b;e=b;if(!b&n>>>0<536870913){break e}}b=e>>>29|0;a=(e&536870911)<<3|n>>>29}o=li(o,m,a,b);l=li(l,q,a,b);r=li(r,s,a,b)}F[c+8>>2]=o;F[c+4>>2]=l;F[c>>2]=r;Z=f+96|0;return}ta();v()}ta();v()}ta();v()}function Nc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if((b|0)<0){break a}c=F[a+12>>2];d=F[a+8>>2];if(c-d>>2>>>0<=b>>>0){break a}d=d+(b<<2)|0;e=F[d>>2];i=F[e+60>>2];f=F[e+56>>2];e=d+4|0;if((e|0)!=(c|0)){while(1){h=F[e>>2];F[e>>2]=0;g=F[d>>2];F[d>>2]=h;if(g){xa(g)}d=d+4|0;e=e+4|0;if((e|0)!=(c|0)){continue}break}c=F[a+12>>2]}if((c|0)!=(d|0)){while(1){c=c-4|0;e=F[c>>2];F[c>>2]=0;if(e){xa(e)}if((c|0)!=(d|0)){continue}break}}F[a+12>>2]=d;g=F[a+4>>2];b:{if(!g|(i|0)<0){break b}c=F[g+24>>2];d=F[g+28>>2];if((c|0)==(d|0)){break b}while(1){if((i|0)==F[F[c>>2]+24>>2]){d=c+4|0;i=F[g+28>>2];if((d|0)!=(i|0)){while(1){h=F[d>>2];F[d>>2]=0;e=F[c>>2];F[c>>2]=h;if(e){Ca(e+12|0,F[e+16>>2]);Ba(e,F[e+4>>2]);ja(e)}c=c+4|0;d=d+4|0;if((i|0)!=(d|0)){continue}break}d=F[g+28>>2]}if((c|0)!=(d|0)){while(1){d=d-4|0;e=F[d>>2];F[d>>2]=0;if(e){Ca(e+12|0,F[e+16>>2]);Ba(e,F[e+4>>2]);ja(e)}if((c|0)!=(d|0)){continue}break}}F[g+28>>2]=c;break b}c=c+4|0;if((d|0)!=(c|0)){continue}break}}c:{if((f|0)>4){break c}d:{e=L(f,12)+a|0;c=F[e+20>>2];d=F[e+24>>2];if((c|0)==(d|0)){break d}while(1){if(F[c>>2]==(b|0)){break d}c=c+4|0;if((d|0)!=(c|0)){continue}break}break c}if((c|0)==(d|0)){break c}f=c;c=c+4|0;pa(f,c,d-c|0);F[e+24>>2]=d-4}c=F[a+24>>2];d=F[a+20>>2];e:{if((c|0)==(d|0)){break e}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=F[h>>2];if((j|0)>(b|0)){F[h>>2]=j-1}f=d+(f|4)|0;h=F[f>>2];if((h|0)>(b|0)){F[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break e}c=d+(c<<2)|0;d=F[c>>2];if((d|0)<=(b|0)){break e}F[c>>2]=d-1}c=F[a+36>>2];d=F[a+32>>2];f:{if((c|0)==(d|0)){break f}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=F[h>>2];if((j|0)>(b|0)){F[h>>2]=j-1}f=d+(f|4)|0;h=F[f>>2];if((h|0)>(b|0)){F[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break f}c=d+(c<<2)|0;d=F[c>>2];if((d|0)<=(b|0)){break f}F[c>>2]=d-1}c=F[a+48>>2];d=F[a+44>>2];g:{if((c|0)==(d|0)){break g}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=F[h>>2];if((j|0)>(b|0)){F[h>>2]=j-1}f=d+(f|4)|0;h=F[f>>2];if((h|0)>(b|0)){F[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break g}c=d+(c<<2)|0;d=F[c>>2];if((d|0)<=(b|0)){break g}F[c>>2]=d-1}c=F[a+60>>2];d=F[a+56>>2];h:{if((c|0)==(d|0)){break h}e=c-d|0;c=e>>2;g=c>>>0<=1?1:c;i=g&1;c=0;if(e>>>0>=8){g=g&-2;e=0;while(1){f=c<<2;h=f+d|0;j=F[h>>2];if((j|0)>(b|0)){F[h>>2]=j-1}f=d+(f|4)|0;h=F[f>>2];if((h|0)>(b|0)){F[f>>2]=h-1}c=c+2|0;e=e+2|0;if((g|0)!=(e|0)){continue}break}}if(!i){break h}c=d+(c<<2)|0;d=F[c>>2];if((d|0)<=(b|0)){break h}F[c>>2]=d-1}c=F[a+72>>2];a=F[a+68>>2];if((c|0)==(a|0)){break a}d=c-a|0;c=d>>2;e=c>>>0<=1?1:c;g=e&1;c=0;if(d>>>0>=8){d=e&-2;e=0;while(1){i=c<<2;f=i+a|0;h=F[f>>2];if((h|0)>(b|0)){F[f>>2]=h-1}i=a+(i|4)|0;f=F[i>>2];if((f|0)>(b|0)){F[i>>2]=f-1}c=c+2|0;e=e+2|0;if((d|0)!=(e|0)){continue}break}}if(!g){break a}f=b;a=a+(c<<2)|0;b=F[a>>2];if((f|0)>=(b|0)){break a}F[a>>2]=b-1}}function ja(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;a:{if(!a){break a}d=a-8|0;b=F[a-4>>2];a=b&-8;f=d+a|0;b:{if(b&1){break b}if(!(b&3)){break a}b=F[d>>2];d=d-b|0;if(d>>>0>>0<=255){e=F[d+8>>2];b=b>>>3|0;c=F[d+12>>2];if((c|0)==(e|0)){i=11764,j=F[2941]&oi(b),F[i>>2]=j;break b}F[e+12>>2]=c;F[c+8>>2]=e;break b}h=F[d+24>>2];b=F[d+12>>2];c:{if((d|0)!=(b|0)){c=F[d+8>>2];F[c+12>>2]=b;F[b+8>>2]=c;break c}d:{e=d+20|0;c=F[e>>2];if(c){break d}e=d+16|0;c=F[e>>2];if(c){break d}b=0;break c}while(1){g=e;b=c;e=b+20|0;c=F[e>>2];if(c){continue}e=b+16|0;c=F[b+16>>2];if(c){continue}break}F[g>>2]=0}if(!h){break b}e=F[d+28>>2];c=(e<<2)+12068|0;e:{if(F[c>>2]==(d|0)){F[c>>2]=b;if(b){break e}i=11768,j=F[2942]&oi(e),F[i>>2]=j;break b}F[h+(F[h+16>>2]==(d|0)?16:20)>>2]=b;if(!b){break b}}F[b+24>>2]=h;c=F[d+16>>2];if(c){F[b+16>>2]=c;F[c+24>>2]=b}c=F[d+20>>2];if(!c){break b}F[b+20>>2]=c;F[c+24>>2]=b;break b}b=F[f+4>>2];if((b&3)!=3){break b}F[2943]=a;F[f+4>>2]=b&-2;F[d+4>>2]=a|1;F[a+d>>2]=a;return}if(d>>>0>=f>>>0){break a}b=F[f+4>>2];if(!(b&1)){break a}f:{if(!(b&2)){if(F[2947]==(f|0)){F[2947]=d;a=F[2944]+a|0;F[2944]=a;F[d+4>>2]=a|1;if(F[2946]!=(d|0)){break a}F[2943]=0;F[2946]=0;return}if(F[2946]==(f|0)){F[2946]=d;a=F[2943]+a|0;F[2943]=a;F[d+4>>2]=a|1;F[a+d>>2]=a;return}a=(b&-8)+a|0;g:{if(b>>>0<=255){e=F[f+8>>2];b=b>>>3|0;c=F[f+12>>2];if((c|0)==(e|0)){i=11764,j=F[2941]&oi(b),F[i>>2]=j;break g}F[e+12>>2]=c;F[c+8>>2]=e;break g}h=F[f+24>>2];b=F[f+12>>2];h:{if((f|0)!=(b|0)){c=F[f+8>>2];F[c+12>>2]=b;F[b+8>>2]=c;break h}i:{e=f+20|0;c=F[e>>2];if(c){break i}e=f+16|0;c=F[e>>2];if(c){break i}b=0;break h}while(1){g=e;b=c;e=b+20|0;c=F[e>>2];if(c){continue}e=b+16|0;c=F[b+16>>2];if(c){continue}break}F[g>>2]=0}if(!h){break g}e=F[f+28>>2];c=(e<<2)+12068|0;j:{if(F[c>>2]==(f|0)){F[c>>2]=b;if(b){break j}i=11768,j=F[2942]&oi(e),F[i>>2]=j;break g}F[h+(F[h+16>>2]==(f|0)?16:20)>>2]=b;if(!b){break g}}F[b+24>>2]=h;c=F[f+16>>2];if(c){F[b+16>>2]=c;F[c+24>>2]=b}c=F[f+20>>2];if(!c){break g}F[b+20>>2]=c;F[c+24>>2]=b}F[d+4>>2]=a|1;F[a+d>>2]=a;if(F[2946]!=(d|0)){break f}F[2943]=a;return}F[f+4>>2]=b&-2;F[d+4>>2]=a|1;F[a+d>>2]=a}if(a>>>0<=255){b=(a&-8)+11804|0;c=F[2941];a=1<<(a>>>3);k:{if(!(c&a)){F[2941]=a|c;a=b;break k}a=F[b+8>>2]}F[b+8>>2]=d;F[a+12>>2]=d;F[d+12>>2]=b;F[d+8>>2]=a;return}e=31;if(a>>>0<=16777215){b=O(a>>>8|0);e=((a>>>38-b&1)-(b<<1)|0)+62|0}F[d+28>>2]=e;F[d+16>>2]=0;F[d+20>>2]=0;g=(e<<2)+12068|0;l:{m:{c=F[2942];b=1<>2]=d;F[d+24>>2]=g;break n}e=a<<((e|0)!=31?25-(e>>>1|0)|0:0);b=F[g>>2];while(1){c=b;if((F[b+4>>2]&-8)==(a|0)){break m}b=e>>>29|0;e=e<<1;g=c+(b&4)|0;b=F[g+16>>2];if(b){continue}break}F[g+16>>2]=d;F[d+24>>2]=c}F[d+12>>2]=d;F[d+8>>2]=d;break l}a=F[c+8>>2];F[a+12>>2]=d;F[c+8>>2]=d;F[d+24>>2]=0;F[d+12>>2]=c;F[d+8>>2]=a}a=F[2949]-1|0;F[2949]=a?a:-1}}function di(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;F[a+8>>2]=e;n=a+32|0;h=F[n>>2];f=F[a+36>>2]-h>>2;a:{if(f>>>0>>0){qa(n,e-f|0);d=F[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}F[a+36>>2]=h+(e<<2);d=e}s=F[a+52>>2];p=F[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;m=ma(ka(h),0,h);b:{if((d|0)<=0){break b}g=F[a+32>>2];while(1){d=f<<2;h=F[d+m>>2];j=F[a+16>>2];c:{if((h|0)>(j|0)){F[d+g>>2]=j;break c}d=d+g|0;j=F[a+12>>2];if((j|0)>(h|0)){F[d>>2]=j;break c}F[d>>2]=h}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=F[b+h>>2]+F[g+h>>2]|0;F[d>>2]=h;d:{if((h|0)>F[a+16>>2]){i=h-F[a+20>>2]|0}else{if((h|0)>=F[a+12>>2]){break d}i=h+F[a+20>>2]|0}F[d>>2]=i}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=F[a+56>>2];q=F[f>>2];f=F[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=L(e,h);f=F[(h<<2)+q>>2];if((f|0)==-1){break f}f=F[F[p+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}j=F[s>>2];g=F[p>>2];k=F[j+(F[g+(f<<2)>>2]<<2)>>2];i=f+1|0;i=(i>>>0)%3|0?i:f-2|0;if((i|0)!=-1){i=F[g+(i<<2)>>2]}else{i=-1}g:{h:{if((f>>>0)%3|0){f=f-1|0;break h}f=f+2|0;l=-1;if((f|0)==-1){break g}}l=F[g+(f<<2)>>2]}if((h|0)<=(k|0)){break f}f=F[(i<<2)+j>>2];if((f|0)>=(h|0)){break f}g=F[j+(l<<2)>>2];if((g|0)>=(h|0)){break f}i:{if((e|0)<=0){break i}g=L(e,g);j=L(e,f);k=L(e,k);f=0;l=0;if((e|0)!=1){while(1){F[(f<<2)+m>>2]=(F[(f+g<<2)+c>>2]+F[(f+j<<2)+c>>2]|0)-F[(f+k<<2)+c>>2];i=f|1;F[(i<<2)+m>>2]=(F[(g+i<<2)+c>>2]+F[(j+i<<2)+c>>2]|0)-F[(i+k<<2)+c>>2];f=f+2|0;l=l+2|0;if((u|0)!=(l|0)){continue}break}}if(!w){break i}F[(f<<2)+m>>2]=(F[(f+g<<2)+c>>2]+F[(f+j<<2)+c>>2]|0)-F[(f+k<<2)+c>>2]}if((d|0)<=0){break e}j=F[n>>2];f=0;while(1){d=f<<2;g=F[d+m>>2];k=F[a+16>>2];j:{if((g|0)>(k|0)){F[d+j>>2]=k;break j}d=d+j|0;k=F[a+12>>2];if((k|0)>(g|0)){F[d>>2]=k;break j}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=F[g+i>>2]+F[g+j>>2]|0;F[d>>2]=g;k:{if((g|0)>F[a+16>>2]){l=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break k}l=g+F[a+20>>2]|0}F[d>>2]=l}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}ta();v()}if((d|0)<=0){break e}k=(L(h-1|0,e)<<2)+c|0;j=F[n>>2];f=0;while(1){d=f<<2;g=F[d+k>>2];i=F[a+16>>2];l:{if((g|0)>(i|0)){F[d+j>>2]=i;break l}d=d+j|0;i=F[a+12>>2];if((i|0)>(g|0)){F[d>>2]=i;break l}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;i=b+d|0;while(1){g=f<<2;d=g+k|0;g=F[g+i>>2]+F[g+j>>2]|0;F[d>>2]=g;m:{if((g|0)>F[a+16>>2]){l=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break m}l=g+F[a+20>>2]|0}F[d>>2]=l}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}ja(m);return 1}function od(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(F[F[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){e=F[a+48>>2];F[a+52>>2]=e;a:{if((e|0)!=F[a+56>>2]){F[e>>2]=b;F[a+52>>2]=e+4;break a}d=ka(4);F[d>>2]=b;c=d+4|0;F[a+56>>2]=c;F[a+52>>2]=c;F[a+48>>2]=d;if(!e){break a}ja(e)}c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;c=F[F[a+4>>2]+28>>2];k=F[(i<<2)+c>>2];if((k|0)==-1){return 0}e=(b-L(g,3)|0?-1:2)+b|0;j=F[c+(e<<2)>>2];if((j|0)==-1){return 0}b=F[a+36>>2];g=b+(k>>>3&536870908)|0;d=F[g>>2];c=1<>2]=c|d;Ka(a+8|0,k,i);b=F[a+36>>2]}d=(j>>>3&536870908)+b|0;c=F[d>>2];b=1<>2]=b|c;Ka(a+8|0,j,e)}f=F[a+52>>2];if((f|0)==F[a+48>>2]){return 1}k=a+8|0;while(1){b:{c:{f=f-4|0;b=F[f>>2];if((b|0)==-1){break c}c=(b>>>0)/3|0;g=F[a+24>>2]+(c>>>3&268435452)|0;d=F[g>>2];c=1<>2]=c|d;h=F[a+4>>2];c=F[F[h+28>>2]+(b<<2)>>2];if((c|0)==-1){return 0}while(1){d=b;d:{e:{j=F[a+36>>2]+(c>>>3&536870908)|0;i=F[j>>2];e=1<>2]+(c<<2)>>2];g:{if((g|0)==-1){break g}b=g+1|0;b=(b>>>0)%3|0?b:g-2|0;if((b|0)==-1|F[F[h>>2]+(b>>>3&536870908)>>2]>>>b&1){break g}g=F[F[F[h+64>>2]+12>>2]+(b<<2)>>2];if((g|0)!=-1){break f}}F[j>>2]=e|i;Ka(k,c,d);h=F[a+4>>2];break e}F[j>>2]=e|i;Ka(k,c,d);h=F[a+4>>2];b=g+1|0;if((((b>>>0)%3|0?b:g-2|0)|0)==-1){break e}b=-1;h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1|F[F[h>>2]+(c>>>3&536870908)>>2]>>>c&1){break h}b=F[F[F[h+64>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];e=c>>>5|0;j=F[f+(e<<2)>>2];break d}i:{j:{if((d|0)==-1){break j}c=-1;b=d+1|0;b=(b>>>0)%3|0?b:d-2|0;if(!((b|0)==-1|F[F[h>>2]+(b>>>3&536870908)>>2]>>>b&1)){c=F[F[F[h+64>>2]+12>>2]+(b<<2)>>2]}k:{l:{if((d>>>0)%3|0){f=d-1|0;break l}f=d+2|0;b=-1;if((f|0)==-1){break k}}b=-1;if(F[F[h>>2]+(f>>>3&536870908)>>2]>>>f&1){break k}b=F[F[F[h+64>>2]+12>>2]+(f<<2)>>2]}g=(b|0)==-1;i=g?-1:(b>>>0)/3|0;if((c|0)!=-1){f=F[a+24>>2];d=(c>>>0)/3|0;e=d>>>5|0;j=F[f+(e<<2)>>2];d=1<>2];e=i>>>5|0;j=F[f+(e<<2)>>2];if(!(d&j)){break d}}f=F[a+52>>2]-4|0;F[a+52>>2]=f;break b}if(g){b=c;break d}if(F[(i>>>3&536870908)+f>>2]>>>i&1){b=c;break d}h=F[a+52>>2];F[h-4>>2]=b;if(F[a+56>>2]!=(h|0)){F[h>>2]=c;f=h+4|0;break c}m:{i=F[a+48>>2];e=h-i|0;g=e>>2;d=g+1|0;if(d>>>0<1073741824){b=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(e){if(e>>>0>=1073741824){break m}d=ka(e<<2)}else{d=0}b=d+(g<<2)|0;F[b>>2]=c;f=b+4|0;if((h|0)!=(i|0)){while(1){b=b-4|0;h=h-4|0;F[b>>2]=F[h>>2];if((h|0)!=(i|0)){continue}break}}F[a+56>>2]=d+(e<<2);F[a+52>>2]=f;F[a+48>>2]=b;if(!i){break b}ja(i);f=F[a+52>>2];break b}na();v()}oa();v()}F[(e<<2)+f>>2]=d|j;c=F[F[h+28>>2]+(b<<2)>>2];if((c|0)!=-1){continue}break}return 0}F[a+52>>2]=f}if(F[a+48>>2]!=(f|0)){continue}break}}return 1}function he(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,w=0;F[a+8>>2]=e;m=a+32|0;h=F[m>>2];f=F[a+36>>2]-h>>2;a:{if(f>>>0>>0){qa(m,e-f|0);d=F[a+8>>2];break a}d=e;if(d>>>0>=f>>>0){break a}F[a+36>>2]=h+(e<<2);d=e}s=F[a+52>>2];n=F[a+48>>2];f=0;h=e>>>0>1073741823?-1:e<<2;l=ma(ka(h),0,h);b:{if((d|0)<=0){break b}g=F[a+32>>2];while(1){d=f<<2;h=F[d+l>>2];i=F[a+16>>2];c:{if((h|0)>(i|0)){F[d+g>>2]=i;break c}d=d+g|0;i=F[a+12>>2];if((i|0)>(h|0)){F[d>>2]=i;break c}F[d>>2]=h}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}if((d|0)<=0){break b}f=0;while(1){h=f<<2;d=h+c|0;h=F[b+h>>2]+F[g+h>>2]|0;F[d>>2]=h;d:{if((h|0)>F[a+16>>2]){h=h-F[a+20>>2]|0}else{if((h|0)>=F[a+12>>2]){break d}h=h+F[a+20>>2]|0}F[d>>2]=h}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}f=F[a+56>>2];q=F[f>>2];f=F[f+4>>2]-q|0;if((f|0)>=5){o=f>>>2|0;t=o>>>0<=2?2:o;u=e&-2;w=e&1;h=1;while(1){e:{f:{if((h|0)!=(o|0)){r=L(e,h);f=F[(h<<2)+q>>2];if((f|0)==-1|F[F[n>>2]+(f>>>3&536870908)>>2]>>>f&1){break f}f=F[F[F[n+64>>2]+12>>2]+(f<<2)>>2];if((f|0)==-1){break f}i=F[s>>2];g=F[n+28>>2];k=F[i+(F[g+(f<<2)>>2]<<2)>>2];if((k|0)>=(h|0)){break f}j=f+1|0;j=F[i+(F[g+(((j>>>0)%3|0?j:f-2|0)<<2)>>2]<<2)>>2];if((j|0)>=(h|0)){break f}f=F[i+(F[g+(f+((f>>>0)%3|0?-1:2)<<2)>>2]<<2)>>2];if((f|0)>=(h|0)){break f}g:{if((e|0)<=0){break g}g=L(e,f);i=L(e,j);k=L(e,k);f=0;p=0;if((e|0)!=1){while(1){F[(f<<2)+l>>2]=(F[(f+g<<2)+c>>2]+F[(f+i<<2)+c>>2]|0)-F[(f+k<<2)+c>>2];j=f|1;F[(j<<2)+l>>2]=(F[(g+j<<2)+c>>2]+F[(i+j<<2)+c>>2]|0)-F[(k+j<<2)+c>>2];f=f+2|0;p=p+2|0;if((u|0)!=(p|0)){continue}break}}if(!w){break g}F[(f<<2)+l>>2]=(F[(f+g<<2)+c>>2]+F[(f+i<<2)+c>>2]|0)-F[(f+k<<2)+c>>2]}if((d|0)<=0){break e}i=F[m>>2];f=0;while(1){d=f<<2;g=F[d+l>>2];k=F[a+16>>2];h:{if((g|0)>(k|0)){F[d+i>>2]=k;break h}d=d+i|0;k=F[a+12>>2];if((k|0)>(g|0)){F[d>>2]=k;break h}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=F[g+j>>2]+F[g+i>>2]|0;F[d>>2]=g;i:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break i}g=g+F[a+20>>2]|0}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}break e}ta();v()}if((d|0)<=0){break e}k=(L(h-1|0,e)<<2)+c|0;i=F[m>>2];f=0;while(1){d=f<<2;g=F[d+k>>2];j=F[a+16>>2];j:{if((g|0)>(j|0)){F[d+i>>2]=j;break j}d=d+i|0;j=F[a+12>>2];if((j|0)>(g|0)){F[d>>2]=j;break j}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}f=0;if((d|0)<=0){break e}d=r<<2;k=d+c|0;j=b+d|0;while(1){g=f<<2;d=g+k|0;g=F[g+j>>2]+F[g+i>>2]|0;F[d>>2]=g;k:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break k}g=g+F[a+20>>2]|0}F[d>>2]=g}d=F[a+8>>2];f=f+1|0;if((d|0)>(f|0)){continue}break}}h=h+1|0;if((t|0)!=(h|0)){continue}break}}ja(l);return 1}function Fb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=M(0),k=0,l=0,m=M(0);i=F[c>>2];a:{b:{f=F[b+4>>2];if(!f){break b}g=ni(f);c:{if(g>>>0>=2){e=i;if(f>>>0<=e>>>0){e=(i>>>0)%(f>>>0)|0}c=F[F[b>>2]+(e<<2)>>2];if(!c){break b}if(g>>>0<=1){break c}while(1){c=F[c>>2];if(!c){break b}g=F[c+4>>2];if((g|0)!=(i|0)){if(f>>>0<=g>>>0){g=(g>>>0)%(f>>>0)|0}if((e|0)!=(g|0)){break b}}if(F[c+8>>2]!=(i|0)){continue}break}b=0;break a}e=f-1&i;c=F[F[b>>2]+(e<<2)>>2];if(!c){break b}}h=f-1|0;while(1){c=F[c>>2];if(!c){break b}g=F[c+4>>2];if((g|0)!=(i|0)&(g&h)!=(e|0)){break b}if(F[c+8>>2]!=(i|0)){continue}break}b=0;break a}c=ka(16);d=F[F[d>>2]>>2];F[c+12>>2]=0;F[c+8>>2]=d;F[c+4>>2]=i;F[c>>2]=0;m=M(F[b+12>>2]+1>>>0);j=J[b+16>>2];d:{if(m>M(j*M(f>>>0))?0:f){break d}e=2;d=(f-1&f)!=0|f>>>0<3|f<<1;j=M(S(M(m/j)));e:{if(j=M(0)){g=~~j>>>0;break e}g=0}d=d>>>0>g>>>0?d:g;f:{if((d|0)==1){break f}if(!(d&d-1)){e=d;break f}e=Mc(d);f=F[b+4>>2]}g:{if(e>>>0<=f>>>0){if(e>>>0>=f>>>0){break g}g=f>>>0<3;j=M(S(M(M(I[b+12>>2])/J[b+16>>2])));h:{if(j=M(0)){d=~~j>>>0;break h}d=0}i:{j:{if(g){break j}if(ni(f)>>>0>1){break j}d=d>>>0<2?d:1<<32-O(d-1|0);break i}d=Mc(d)}e=d>>>0>>0?e:d;if(f>>>0<=e>>>0){break g}}f=0;g=0;h=e;k:{l:{m:{n:{if(e){if(h>>>0>=1073741824){break n}d=ka(h<<2);e=F[b>>2];F[b>>2]=d;if(e){ja(e)}F[b+4>>2]=h;d=0;if(h>>>0>=4){e=h&-4;while(1){k=d<<2;F[k+F[b>>2]>>2]=0;F[F[b>>2]+(k|4)>>2]=0;F[F[b>>2]+(k|8)>>2]=0;F[F[b>>2]+(k|12)>>2]=0;d=d+4|0;g=g+4|0;if((e|0)!=(g|0)){continue}break}}e=h&3;if(e){while(1){F[F[b>>2]+(d<<2)>>2]=0;d=d+1|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}e=F[b+8>>2];if(!e){break k}d=b+8|0;f=F[e+4>>2];g=ni(h);if(g>>>0<2){break m}f=f>>>0>=h>>>0?(f>>>0)%(h>>>0)|0:f;F[F[b>>2]+(f<<2)>>2]=d;d=F[e>>2];if(!d){break k}if(g>>>0<=1){break l}while(1){g=F[d+4>>2];if(h>>>0<=g>>>0){g=(g>>>0)%(h>>>0)|0}o:{if((f|0)==(g|0)){e=d;break o}l=g<<2;k=l+F[b>>2]|0;if(!F[k>>2]){F[k>>2]=e;e=d;f=g;break o}F[e>>2]=F[d>>2];F[d>>2]=F[F[l+F[b>>2]>>2]>>2];F[F[l+F[b>>2]>>2]>>2]=d}d=F[e>>2];if(d){continue}break}break k}d=F[b>>2];F[b>>2]=0;if(d){ja(d)}F[b+4>>2]=0;break k}oa();v()}f=h-1&f;F[F[b>>2]+(f<<2)>>2]=d;d=F[e>>2];if(!d){break k}}k=h-1|0;while(1){g=k&F[d+4>>2];p:{if((g|0)==(f|0)){e=d;break p}l=g<<2;h=l+F[b>>2]|0;if(F[h>>2]){F[e>>2]=F[d>>2];F[d>>2]=F[F[l+F[b>>2]>>2]>>2];F[F[l+F[b>>2]>>2]>>2]=d;break p}F[h>>2]=e;e=d;f=g}d=F[e>>2];if(d){continue}break}}}f=F[b+4>>2];d=f-1|0;if(!(d&f)){e=d&i;break d}if(f>>>0>i>>>0){e=i;break d}e=(i>>>0)%(f>>>0)|0}e=F[b>>2]+(e<<2)|0;d=F[e>>2];q:{r:{if(!d){d=b+8|0;F[c>>2]=F[d>>2];F[b+8>>2]=c;F[e>>2]=d;d=F[c>>2];if(!d){break q}d=F[d+4>>2];e=f-1|0;s:{if(!(e&f)){d=d&e;break s}if(d>>>0>>0){break s}d=(d>>>0)%(f>>>0)|0}d=F[b>>2]+(d<<2)|0;break r}F[c>>2]=F[d>>2]}F[d>>2]=c}F[b+12>>2]=F[b+12>>2]+1;b=1}D[a+4|0]=b;F[a>>2]=c}function Vb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=L(b,12)+a|0;F[j+12>>2]=F[j+8>>2];m=(c|0)==-1?-1:(c>>>0)/3|0;d=1;k=c;a:{b:{c:{while(1){d:{l=d;if(!d){if((k|0)==-1){break d}if((Wc(a,((k>>>0)%3|0?-1:2)+k|0)|0)==-1){break a}c=k+1|0;d=(c>>>0)%3|0?c:k-2|0;if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}d=F[F[F[a+4>>2]+12>>2]+(c<<2)>>2];if((d|0)==-1){break a}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break a}m=(c>>>0)/3|0}e:{d=F[a+56>>2]+(m>>>3&536870908)|0;h=F[d>>2];e=1<>2]=e|h;d=F[j+12>>2];f:{if((d|0)!=F[j+16>>2]){F[d>>2]=m;F[j+12>>2]=d+4;break f}n=F[j+8>>2];h=d-n|0;e=h>>2;i=e+1|0;if(i>>>0>=1073741824){break c}g=h>>>1|0;i=h>>>0>=2147483644?1073741823:i>>>0>>0?g:i;if(i){if(i>>>0>=1073741824){break b}g=ka(i<<2)}else{g=0}h=g+(e<<2)|0;F[h>>2]=m;e=h+4|0;if((d|0)!=(n|0)){while(1){h=h-4|0;d=d-4|0;F[h>>2]=F[d>>2];if((d|0)!=(n|0)){continue}break}}F[j+8>>2]=h;F[j+12>>2]=e;F[j+16>>2]=g+(i<<2);if(!n){break f}ja(n)}g=f+1|0;g:{h:{i:{if(!f){break i}if(g&1){if((c|0)==-1){c=-1;break g}d=c+1|0;c=(d>>>0)%3|0?d:c-2|0;break i}k=l?k:c;if((c|0)==-1){c=-1;break g}if((c>>>0)%3|0){d=c-1|0;break h}c=c+2|0}d=c;c=-1;if((d|0)==-1){break g}}c=F[F[F[a+4>>2]+12>>2]+(d<<2)>>2];h=-1;f=-1;e=d+1|0;e=(e>>>0)%3|0?e:d-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=F[(F[F[a>>2]+96>>2]+L(f,12)|0)+(e-L(f,3)<<2)>>2]}j:{if((c|0)==-1){break j}i=((c>>>0)%3|0?-1:2)+c|0;if((i|0)<0){break j}e=(i>>>0)/3|0;h=F[(F[F[a>>2]+96>>2]+L(e,12)|0)+(i-L(e,3)<<2)>>2]}if((f|0)!=(h|0)){c=-1;break g}k:{l:{f=((d>>>0)%3|0?-1:2)+d|0;if((f|0)>=0){d=(f>>>0)/3|0;if((c|0)!=-1){break l}c=-1;break g}d=-1;if((c|0)!=-1){break k}c=-1;break g}d=F[(F[F[a>>2]+96>>2]+L(d,12)|0)+(f-L(d,3)<<2)>>2]}f=c+1|0;e=(f>>>0)%3|0?f:c-2|0;if((e|0)>=0){f=(e>>>0)/3|0;f=F[(F[F[a>>2]+96>>2]+L(f,12)|0)+(e-L(f,3)<<2)>>2]}else{f=-1}if((f|0)!=(d|0)){c=-1;break g}f=g;m=(c>>>0)/3|0;d=F[a+56>>2]+(m>>>3&268435452)|0;h=F[d>>2];e=1<>2]-4|0;g=F[l>>2];d=F[a+56>>2]+(g>>>3&536870908)|0;c=F[d>>2];o=d,p=oi(g)&c,F[o>>2]=p;F[j+12>>2]=l;break a}d=0;if(l){continue}break a}break}k=-1;Wc(a,-1);break a}na();v()}oa();v()}F[((b<<2)+a|0)+44>>2]=k;b=F[j+12>>2];i=F[j+8>>2];m:{if((b|0)==(i|0)){break m}c=b-i|0;b=c>>2;b=b>>>0<=1?1:b;k=b&1;e=F[a+56>>2];d=0;if(c>>>0>=8){f=b&-2;c=0;while(1){l=d<<2;g=F[l+i>>2];b=e+(g>>>3&536870908)|0;a=F[b>>2];o=b,p=oi(g)&a,F[o>>2]=p;g=F[i+(l|4)>>2];b=e+(g>>>3&536870908)|0;a=F[b>>2];o=b,p=oi(g)&a,F[o>>2]=p;d=d+2|0;c=c+2|0;if((f|0)!=(c|0)){continue}break}}if(!k){break m}c=F[i+(d<<2)>>2];b=e+(c>>>3&536870908)|0;a=F[b>>2];o=b,p=oi(c)&a,F[o>>2]=p}}function pd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if((b|0)==-1){return 1}g=(b>>>0)/3|0;if(!(F[F[a+24>>2]+(g>>>3&268435452)>>2]>>>g&1)){f=F[a+48>>2];F[a+52>>2]=f;a:{if((f|0)!=F[a+56>>2]){F[f>>2]=b;F[a+52>>2]=f+4;break a}d=ka(4);F[d>>2]=b;c=d+4|0;F[a+56>>2]=c;F[a+52>>2]=c;F[a+48>>2]=d;if(!f){break a}ja(f)}e=-1;d=F[a+4>>2];c=b+1|0;i=(c>>>0)%3|0?c:b-2|0;if((i|0)!=-1){e=F[F[d>>2]+(i<<2)>>2]}b:{h=b-L(g,3)|0;if(h){c=b-1|0;break b}c=b+2|0;if((c|0)!=-1){break b}return 0}if((e|0)==-1){return 0}j=F[F[d>>2]+(c<<2)>>2];if((j|0)==-1){return 0}c=F[a+36>>2];f=c+(e>>>3&536870908)|0;g=F[f>>2];d=1<>2]=d|g;Ka(a+8|0,e,i);c=F[a+36>>2]}g=(j>>>3&536870908)+c|0;d=F[g>>2];c=1<>2]=c|d;Ka(a+8|0,j,(h?-1:2)+b|0)}c=F[a+52>>2];if((c|0)==F[a+48>>2]){return 1}j=a+8|0;while(1){c:{d:{c=c-4|0;b=F[c>>2];if((b|0)==-1){break d}d=(b>>>0)/3|0;f=F[a+24>>2]+(d>>>3&268435452)|0;g=F[f>>2];d=1<>2]=d|g;while(1){i=F[a+4>>2];e=F[F[i>>2]+(b<<2)>>2];if((e|0)==-1){return 0}e:{f:{h=F[a+36>>2]+(e>>>3&536870908)|0;f=F[h>>2];g=1<>2]+(e<<2)>>2];h:{if((d|0)==-1){break h}c=d+1|0;c=(c>>>0)%3|0?c:d-2|0;if((c|0)==-1){break h}d=F[F[i+12>>2]+(c<<2)>>2];if((d|0)!=-1){break g}}F[h>>2]=f|g;Ka(j,e,b);break f}F[h>>2]=f|g;Ka(j,e,b);c=d+1|0;if((((c>>>0)%3|0?c:d-2|0)|0)==-1){break f}c=b-2|0;d=b+1|0;b=-1;c=(d>>>0)%3|0?d:c;if((c|0)!=-1){b=F[F[F[a+4>>2]+12>>2]+(c<<2)>>2]}c=(b>>>0)/3|0;d=1<>2];f=c>>>5|0;i=F[e+(f<<2)>>2];break e}c=-1;g=F[a+4>>2];d=b+1|0;d=(d>>>0)%3|0?d:b-2|0;if((d|0)!=-1){c=F[F[g+12>>2]+(d<<2)>>2]}i:{j:{if((b>>>0)%3|0){e=b-1|0;break j}e=b+2|0;b=-1;if((e|0)==-1){break i}}b=F[F[g+12>>2]+(e<<2)>>2]}g=(b|0)==-1;h=g?-1:(b>>>0)/3|0;k:{if((c|0)!=-1){e=F[a+24>>2];d=(c>>>0)/3|0;f=d>>>5|0;i=F[e+(f<<2)>>2];d=1<>2];f=h>>>5|0;i=F[e+(f<<2)>>2];if(!(d&i)){break e}}c=F[a+52>>2]-4|0;F[a+52>>2]=c;break c}if(g){b=c;break e}if(F[(h>>>3&536870908)+e>>2]>>>h&1){b=c;break e}e=F[a+52>>2];F[e-4>>2]=b;if(F[a+56>>2]!=(e|0)){F[e>>2]=c;c=e+4|0;break d}l:{h=F[a+48>>2];f=e-h|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){b=f>>>1|0;f=f>>>0>=2147483644?1073741823:b>>>0>d>>>0?b:d;if(f){if(f>>>0>=1073741824){break l}d=ka(f<<2)}else{d=0}b=d+(g<<2)|0;F[b>>2]=c;c=b+4|0;if((e|0)!=(h|0)){while(1){b=b-4|0;e=e-4|0;F[b>>2]=F[e>>2];if((e|0)!=(h|0)){continue}break}}F[a+56>>2]=d+(f<<2);F[a+52>>2]=c;F[a+48>>2]=b;if(!h){break c}ja(h);c=F[a+52>>2];break c}na();v()}oa();v()}F[(f<<2)+e>>2]=d|i;if((b|0)!=-1){continue}break}return 0}F[a+52>>2]=c}if(F[a+48>>2]!=(c|0)){continue}break}}return 1}function ee(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=Z-32|0;Z=h;a:{b:{if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[F[a+48>>2]+64>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}c:{if(d){Na(a+60|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[F[a+48>>2]+64>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+72|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[F[a+48>>2]+64>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+84|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[F[a+48>>2]+64>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+96|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=F[b+8>>2];f=F[b+12>>2];d=c;c=F[b+20>>2];i=c;g=F[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=F[b>>2];k=m+g|0;l=G[k|0]|G[k+1|0]<<8|(G[k+2|0]<<16|G[k+3|0]<<24);F[b+16>>2]=j;F[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[b+16>>2]=f;F[b+20>>2]=c;if((d|0)<(l|0)){break a}F[a+16>>2]=d;F[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;F[a+20>>2]=b;c=b>>>1|0;F[a+24>>2]=c;F[a+28>>2]=0-c;if(b&1){break a}F[a+24>>2]=c-1;break a}}e=0}Z=h+32|0;return e|0}function ai(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=Z-32|0;Z=h;a:{b:{if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[a+48>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}c:{if(d){Na(a+60|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[a+48>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+72|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[a+48>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+84|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}if(!Oa(1,h+28|0,b)){break b}d=F[h+28>>2];c=F[a+48>>2];if(d>>>0>F[c+4>>2]-F[c>>2]>>2>>>0){break b}if(d){e=0;Na(a+96|0,d);c=h+8|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;if(!Aa(c,b)){break c}while(1){f=1<>2]+(e>>>3&536870908)|0;if(j){i=f|F[g>>2]}else{i=F[g>>2]&(f^-1)}F[g>>2]=i;e=e+1|0;if((d|0)!=(e|0)){continue}break}}e=0;c=F[b+8>>2];f=F[b+12>>2];d=c;c=F[b+20>>2];i=c;g=F[b+16>>2];j=g+4|0;c=j>>>0<4?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break a}m=F[b>>2];k=m+g|0;l=G[k|0]|G[k+1|0]<<8|(G[k+2|0]<<16|G[k+3|0]<<24);F[b+16>>2]=j;F[b+20>>2]=c;k=d;d=f;c=i;f=g+8|0;c=f>>>0<8?c+1|0:c;if(f>>>0>k>>>0&(c|0)>=(d|0)|(c|0)>(d|0)){break a}d=j+m|0;d=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[b+16>>2]=f;F[b+20>>2]=c;if((d|0)<(l|0)){break a}F[a+16>>2]=d;F[a+12>>2]=l;c=(d>>31)-((l>>31)+(d>>>0>>0)|0)|0;b=d-l|0;if(!c&b>>>0>2147483646|c){break a}e=1;b=b+1|0;F[a+20>>2]=b;c=b>>>1|0;F[a+24>>2]=c;F[a+28>>2]=0-c;if(b&1){break a}F[a+24>>2]=c-1;break a}}e=0}Z=h+32|0;return e|0}function uh(a){a=a|0;var b=0,c=0,d=0,e=0;c=F[a+32>>2];d=F[c+16>>2];e=F[c+12>>2];b=F[c+20>>2];if(I[c+8>>2]>d>>>0&(e|0)>=(b|0)|(b|0)<(e|0)){e=G[F[c>>2]+d|0];d=d+1|0;b=d?b:b+1|0;F[c+16>>2]=d;F[c+20>>2]=b;b=F[a+48>>2];F[a+48>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}a:{b:{c:{d:{switch(e|0){case 0:b=ka(384);F[b>>2]=8284;ma(b+4|0,0,80);F[b+96>>2]=0;F[b+100>>2]=0;F[b+92>>2]=-1;F[b+84>>2]=-1;F[b+88>>2]=-1;F[b+104>>2]=0;F[b+108>>2]=0;F[b+112>>2]=0;F[b+116>>2]=0;F[b+120>>2]=0;F[b+124>>2]=0;F[b+128>>2]=0;F[b+132>>2]=0;F[b+136>>2]=0;F[b+140>>2]=0;F[b+144>>2]=0;F[b+148>>2]=0;F[b+156>>2]=0;F[b+160>>2]=0;F[b+152>>2]=1065353216;F[b+164>>2]=0;F[b+168>>2]=0;F[b+172>>2]=0;F[b+176>>2]=0;F[b+180>>2]=0;F[b+184>>2]=0;F[b+188>>2]=0;F[b+192>>2]=0;F[b+196>>2]=0;F[b+200>>2]=0;F[b+204>>2]=0;F[b+208>>2]=0;F[b+212>>2]=-1;F[b+216>>2]=0;F[b+220>>2]=0;F[b+224>>2]=0;Ja(b+232|0);Ja(b+272|0);c=b+312|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;Ja(b+328|0);F[b+376>>2]=0;F[b+368>>2]=0;F[b+372>>2]=0;break c;case 2:break d;default:break b}}b=ka(440);F[b>>2]=8336;ma(b+4|0,0,80);F[b+96>>2]=0;F[b+100>>2]=0;F[b+92>>2]=-1;F[b+84>>2]=-1;F[b+88>>2]=-1;F[b+104>>2]=0;F[b+108>>2]=0;F[b+112>>2]=0;F[b+116>>2]=0;F[b+120>>2]=0;F[b+124>>2]=0;F[b+128>>2]=0;F[b+132>>2]=0;F[b+136>>2]=0;F[b+140>>2]=0;F[b+144>>2]=0;F[b+148>>2]=0;F[b+156>>2]=0;F[b+160>>2]=0;F[b+152>>2]=1065353216;F[b+164>>2]=0;F[b+168>>2]=0;F[b+172>>2]=0;F[b+176>>2]=0;F[b+180>>2]=0;F[b+184>>2]=0;F[b+188>>2]=0;F[b+192>>2]=0;F[b+196>>2]=0;F[b+200>>2]=0;F[b+204>>2]=0;F[b+208>>2]=0;F[b+212>>2]=-1;F[b+216>>2]=0;F[b+220>>2]=0;F[b+224>>2]=0;Ja(b+232|0);Ja(b+272|0);c=b+312|0;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;Ja(b+328|0);F[b+392>>2]=0;F[b+396>>2]=0;F[b+384>>2]=0;F[b+388>>2]=0;F[b+376>>2]=0;F[b+380>>2]=0;F[b+368>>2]=0;F[b+372>>2]=0;F[b+416>>2]=0;F[b+420>>2]=0;F[b+408>>2]=2;F[b+412>>2]=7;F[b+400>>2]=-1;F[b+404>>2]=-1;F[b+424>>2]=0;F[b+428>>2]=0;F[b+432>>2]=0;F[b+436>>2]=0}c=F[a+48>>2];F[a+48>>2]=b;if(!c){break a}$[F[F[c>>2]+4>>2]](c)}b=F[a+48>>2];if(b){break a}return 0}a=$[F[F[b>>2]+8>>2]](b,a)|0}else{a=0}return a|0}function ei(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=Z-32|0;Z=g;F[a+68>>2]=f;d=F[a+56>>2];e=F[d>>2];d=F[d+4>>2];F[g+24>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=F[a+56>>2];d=F[e>>2];if(F[e+4>>2]-d>>2>>>0<=j>>>0){break a}Mb(m,F[d+(j<<2)>>2],g+16|0);i=F[g+20>>2];d=i>>31;h=F[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=F[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){F[g+16>>2]=F[a+108>>2];break b}f=F[a+108>>2];l=f>>31;h=li(ki(f,l,h,h>>31),_,e,d);F[g+16>>2]=h;d=li(ki(f,l,i,i>>31),_,e,d);F[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){F[g+24>>2]=f-d;break b}F[g+24>>2]=d-f}d=wa(o);f=F[g+16>>2];c:{if(d){F[g+24>>2]=0-F[g+24>>2];e=0-F[g+20>>2]|0;F[g+20>>2]=e;f=0-f|0;F[g+16>>2]=f;break c}e=F[g+20>>2]}d:{if((f|0)>=0){f=F[a+108>>2];d=f+F[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=F[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=F[g+24>>2];f=d>>31;f=F[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=F[a+100>>2]+(d-(d^e)|0)|0}e=F[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=F[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=F[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=F[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=F[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}F[g+12>>2]=d;F[g+8>>2]=f;j:{if(F[a+8>>2]<=0){break j}i=F[a+32>>2];f=0;while(1){d=f<<2;e=F[d+(g+8|0)>>2];h=F[a+16>>2];k:{if((e|0)>(h|0)){F[d+i>>2]=h;break k}d=d+i|0;h=F[a+12>>2];if((h|0)>(e|0)){F[d>>2]=h;break k}F[d>>2]=e}f=f+1|0;e=F[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=F[f+k>>2]+F[f+i>>2]|0;F[e>>2]=f;l:{if((f|0)>F[a+16>>2]){f=f-F[a+20>>2]|0}else{if((f|0)>=F[a+12>>2]){break l}f=f+F[a+20>>2]|0}F[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}Z=g+32|0;return 1}ta();v()}function Vh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;g=Z-32|0;Z=g;F[a+68>>2]=f;d=F[a+56>>2];e=F[d>>2];d=F[d+4>>2];F[g+24>>2]=0;F[g+16>>2]=0;F[g+20>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+60|0;d=d>>>2|0;n=d>>>0<=1?1:d;o=a+112|0;while(1){e=F[a+56>>2];d=F[e>>2];if(F[e+4>>2]-d>>2>>>0<=j>>>0){break a}Kb(m,F[d+(j<<2)>>2],g+16|0);i=F[g+20>>2];d=i>>31;h=F[g+16>>2];e=h>>31;f=(d^i)-d+((e^h)-e)|0;k=F[g+24>>2];d=k>>31;e=(d^k)-d|0;d=0;l=e;e=e+f|0;d=l>>>0>e>>>0?1:d;b:{if(!(d|e)){F[g+16>>2]=F[a+108>>2];break b}f=F[a+108>>2];l=f>>31;h=li(ki(f,l,h,h>>31),_,e,d);F[g+16>>2]=h;d=li(ki(f,l,i,i>>31),_,e,d);F[g+20>>2]=d;e=d;d=d>>31;e=(e^d)-d|0;d=h>>31;d=e+((d^h)-d|0)|0;if((k|0)>=0){F[g+24>>2]=f-d;break b}F[g+24>>2]=d-f}d=wa(o);f=F[g+16>>2];c:{if(d){F[g+24>>2]=0-F[g+24>>2];e=0-F[g+20>>2]|0;F[g+20>>2]=e;f=0-f|0;F[g+16>>2]=f;break c}e=F[g+20>>2]}d:{if((f|0)>=0){f=F[a+108>>2];d=f+F[g+24>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=F[g+24>>2];f=d>>31;f=(d^f)-f|0;break e}d=F[g+24>>2];f=d>>31;f=F[a+100>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=F[a+100>>2]+(d-(d^e)|0)|0}e=F[a+100>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}i=F[a+108>>2];if((i|0)>=(d|0)){break g}d=(i<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}i=F[a+108>>2];if((i|0)<=(d|0)){break h}d=(i<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=F[a+108>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=F[a+108>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}F[g+12>>2]=d;F[g+8>>2]=f;j:{if(F[a+8>>2]<=0){break j}i=F[a+32>>2];f=0;while(1){d=f<<2;e=F[d+(g+8|0)>>2];h=F[a+16>>2];k:{if((e|0)>(h|0)){F[d+i>>2]=h;break k}d=d+i|0;h=F[a+12>>2];if((h|0)>(e|0)){F[d>>2]=h;break k}F[d>>2]=e}f=f+1|0;e=F[a+8>>2];if((f|0)<(e|0)){continue}break}d=0;if((e|0)<=0){break j}e=j<<3;h=e+c|0;k=b+e|0;while(1){f=d<<2;e=f+h|0;f=F[f+k>>2]+F[f+i>>2]|0;F[e>>2]=f;l:{if((f|0)>F[a+16>>2]){f=f-F[a+20>>2]|0}else{if((f|0)>=F[a+12>>2]){break l}f=f+F[a+20>>2]|0}F[e>>2]=f}d=d+1|0;if((d|0)>2]){continue}break}}j=j+1|0;if((n|0)!=(j|0)){continue}break}}Z=g+32|0;return 1}ta();v()}function $a(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=Z-32|0;Z=h;a:{b:{if(F[a+8>>2]<<5>>>0>=b>>>0){break b}if((b|0)<0){break a}b=(b-1>>>5|0)+1|0;c=ka(b<<2);F[h+24>>2]=b;F[h+20>>2]=0;F[h+16>>2]=c;b=F[a>>2];F[h+12>>2]=0;F[h+8>>2]=b;c=F[a+4>>2];F[h+4>>2]=c&31;F[h>>2]=b+(c>>>3&536870908);e=Z-32|0;Z=e;i=F[h+4>>2];g=F[h+12>>2];j=F[h>>2];d=F[h+8>>2];b=(i-g|0)+(j-d<<3)|0;f=F[h+20>>2];c=b+f|0;F[h+20>>2]=c;if(!((c-1^f-1)>>>0<32?f:0)){F[F[h+16>>2]+((c>>>0>=33?c-1>>>5|0:0)<<2)>>2]=0}c=F[h+16>>2]+(f>>>3&536870908)|0;f=f&31;c:{if((f|0)==(g|0)){if((b|0)<=0){break c}if(g){i=32-g|0;f=(b|0)<(i|0)?b:i;i=-1<>>i-f;F[c>>2]=F[c>>2]&(i^-1)|i&F[d>>2];d=d+4|0;c=(g+f>>>3&536870908)+c|0;b=b-f|0}g=(b|0)/32|0;if(b+31>>>0>=63){pa(c,d,g<<2)}b=b-(g<<5)|0;if((b|0)<=0){break c}f=c;c=g<<2;g=f+c|0;b=-1>>>32-b|0;F[g>>2]=F[g>>2]&(b^-1)|b&F[c+d>>2];break c}F[e+28>>2]=g;F[e+24>>2]=d;F[e+20>>2]=i;F[e+16>>2]=j;F[e+12>>2]=f;F[e+8>>2]=c;b=F[e+28>>2];c=F[e+24>>2];g=(F[e+20>>2]-b|0)+(F[e+16>>2]-c<<3)|0;d:{if((g|0)<=0){b=F[e+12>>2];d=F[e+8>>2];break d}e:{if(!b){b=F[e+12>>2];break e}d=F[e+12>>2];j=32-d|0;k=32-b|0;f=(g|0)<(k|0)?g:k;i=f>>>0>j>>>0?j:f;l=F[e+8>>2];m=F[l>>2]&(-1<>>j-i^-1);j=F[c>>2]&(-1<>>k-f);F[l>>2]=m|(b>>>0>>0?j<>>b-d|0);c=d+i|0;b=c&31;F[e+12>>2]=b;d=l+(c>>>3&536870908)|0;F[e+8>>2]=d;c=f-i|0;if((c|0)>0){F[d>>2]=F[d>>2]&(-1>>>32-c^-1)|j>>>i+F[e+28>>2];F[e+12>>2]=c;b=c}g=g-f|0;c=F[e+24>>2]+4|0;F[e+24>>2]=c}i=-1<=32){j=i^-1;while(1){d=F[e+8>>2];c=F[c>>2];F[d>>2]=j&F[d>>2]|c<>2]=d+4;F[d+4>>2]=i&F[d+4>>2]|c>>>f;c=F[e+24>>2]+4|0;F[e+24>>2]=c;d=g>>>0>63;g=g-32|0;if(d){continue}break}}d=F[e+8>>2];if((g|0)<=0){break d}j=f;f=(g|0)>(f|0)?f:g;j=F[d>>2]&(i&-1>>>j-f^-1);i=F[c>>2]&-1>>>32-g;F[d>>2]=j|i<>2]=c;d=(b>>>3&536870908)+d|0;F[e+8>>2]=d;b=g-f|0;if((b|0)<=0){b=c;break d}F[d>>2]=F[d>>2]&(-1>>>32-b^-1)|i>>>f;F[e+12>>2]=b}F[e+4>>2]=b;F[e>>2]=d}Z=e+32|0;b=F[a>>2];F[a>>2]=F[h+16>>2];F[h+16>>2]=b;c=F[a+4>>2];F[a+4>>2]=F[h+20>>2];F[h+20>>2]=c;c=F[a+8>>2];F[a+8>>2]=F[h+24>>2];F[h+24>>2]=c;if(!b){break b}ja(b)}Z=h+32|0;return}na();v()}function xc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;n=$[F[F[a>>2]+44>>2]](a)|0;a:{if((n|0)<=0){break a}i=F[b+4>>2]-F[b>>2]>>2;e=Z+-64|0;Z=e;f=kb(e);d=L(F[2541],n);cc(f,F[F[a+8>>2]+56>>2],n&255,5,0,d,d>>31);f=bc(ka(96),f);D[f+84|0]=1;F[f+72>>2]=F[f+68>>2];ac(f,i);F[f+60>>2]=F[F[a+8>>2]+60>>2];d=F[a+16>>2];F[a+16>>2]=f;if(d){xa(d)}Z=e- -64|0;h=F[a+16>>2];if(!F[h+80>>2]){break a}j=F[F[h>>2]>>2];if(!j){break a}m=F[c+12>>2];e=m;d=F[c+20>>2];g=F[c+8>>2];k=F[c+16>>2];if((e|0)<=(d|0)&g>>>0<=k>>>0|(d|0)>(e|0)){break a}l=L(i,n);i=j+F[h+48>>2]|0;h=F[c>>2];j=G[h+k|0];e=k+1|0;f=e?d:d+1|0;F[c+16>>2]=e;F[c+20>>2]=f;b:{c:{if(j){if(mc(l,n,c,i)){break c}break a}if((f|0)>=(m|0)&e>>>0>=g>>>0|(f|0)>(m|0)){break a}g=G[e+h|0];f=k+2|0;d=f>>>0<2?d+1|0:d;F[c+16>>2]=f;F[c+20>>2]=d;d=F[F[a+16>>2]+64>>2];d=F[d+4>>2]-F[d>>2]|0;if((g|0)==F[2541]){e=l<<2;if(e>>>0>d>>>0){break a}g=F[c+8>>2];k=F[c+12>>2];j=F[c+20>>2];d=F[c+16>>2];f=e+d|0;j=f>>>0>>0?j+1|0:j;if(f>>>0>g>>>0&(j|0)>=(k|0)|(j|0)>(k|0)){break a}la(i,d+F[c>>2]|0,e);f=F[c+20>>2];d=e+F[c+16>>2]|0;f=d>>>0>>0?f+1|0:f;F[c+16>>2]=d;F[c+20>>2]=f;break c}if(d>>>0>>0){break a}d=F[c+8>>2];f=F[c+16>>2];e=d-f|0;m=d>>>0>>0;d=F[c+20>>2];k=F[c+12>>2]-(m+d|0)|0;m=ki(g,0,l,0)>>>0>e>>>0;e=_;if(m&(e|0)>=(k|0)|(e|0)>(k|0)){break a}e=1;if(!l){break b}h=0;while(1){k=F[c+8>>2];j=F[c+12>>2];e=f+g|0;d=e>>>0>>0?d+1|0:d;if(e>>>0>k>>>0&(d|0)>=(j|0)|(d|0)>(j|0)){return 0}la(i+(h<<2)|0,F[c>>2]+f|0,g);d=F[c+20>>2];f=g+F[c+16>>2]|0;d=f>>>0>>0?d+1|0:d;F[c+16>>2]=f;F[c+20>>2]=d;h=h+1|0;if((l|0)!=(h|0)){continue}break}}e=1;if(!l){break b}d=F[a+20>>2];if(d){e=0;if($[F[F[d>>2]+32>>2]](d)|0){break b}}g=0;h=0;d:{if((l|0)<=0){break d}if((l|0)!=1){f=l&-2;while(1){e=g<<2;d=F[e+i>>2];F[e+i>>2]=0-(d&1)^d>>>1;d=e|4;e=F[d+i>>2];F[d+i>>2]=0-(e&1)^e>>>1;g=g+2|0;h=h+2|0;if((f|0)!=(h|0)){continue}break}}if(!(l&1)){break d}d=g<<2;f=F[d+i>>2];F[d+i>>2]=0-(f&1)^f>>>1}e=0}d=e;f=F[a+20>>2];e:{if(!f){break e}if(!($[F[F[f>>2]+40>>2]](f,c)|0)){break a}if(d){break e}a=F[a+20>>2];if(!($[F[F[a>>2]+44>>2]](a,i,i,l,n,F[b>>2])|0)){break a}}o=1}return o|0}function Lh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=Z-48|0;Z=g;d=F[a+8>>2];if(d-2>>>0<=28){F[a+76>>2]=d;e=-1<>2]=d;F[a+80>>2]=e^-1;F[a+92>>2]=(d|0)/2;J[a+88>>2]=M(2)/M(d|0)}F[a+52>>2]=f;d=F[a+40>>2];e=F[d>>2];d=F[d+4>>2];F[g+16>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=F[a+40>>2];d=F[e>>2];if(F[e+4>>2]-d>>2>>>0<=j>>>0){break a}Mb(n,F[d+(j<<2)>>2],g+8|0);h=F[g+12>>2];d=h>>31;i=F[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=F[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){F[g+8>>2]=F[a+92>>2];break b}f=F[a+92>>2];k=f>>31;i=li(ki(f,k,i,i>>31),_,e,d);F[g+8>>2]=i;d=li(ki(f,k,h,h>>31),_,e,d);F[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){F[g+16>>2]=f-d;break b}F[g+16>>2]=d-f}d=wa(p);f=F[g+8>>2];c:{if(d){F[g+16>>2]=0-F[g+16>>2];e=0-F[g+12>>2]|0;F[g+12>>2]=e;f=0-f|0;F[g+8>>2]=f;break c}e=F[g+12>>2]}d:{if((f|0)>=0){f=F[a+92>>2];d=f+F[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=F[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=F[g+16>>2];f=d>>31;f=F[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=F[a+84>>2]+(d-(d^e)|0)|0}e=F[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=F[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=F[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=F[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=F[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=F[h>>2];h=F[h+4>>2];F[g+36>>2]=d;F[g+32>>2]=f;F[g+24>>2]=i;F[g+28>>2]=h;Jb(g+40|0,m,g+32|0,g+24|0);d=c+e|0;F[d>>2]=F[g+40>>2];F[d+4>>2]=F[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}Z=g+48|0;return 1}ta();v()}function Hh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=Z-48|0;Z=g;d=F[a+8>>2];if(d-2>>>0<=28){F[a+76>>2]=d;e=-1<>2]=d;F[a+80>>2]=e^-1;F[a+92>>2]=(d|0)/2;J[a+88>>2]=M(2)/M(d|0)}F[a+52>>2]=f;d=F[a+40>>2];e=F[d>>2];d=F[d+4>>2];F[g+16>>2]=0;F[g+8>>2]=0;F[g+12>>2]=0;a:{d=d-e|0;if((d|0)>0){m=a+8|0;n=a+44|0;d=d>>>2|0;o=d>>>0<=1?1:d;p=a+96|0;while(1){e=F[a+40>>2];d=F[e>>2];if(F[e+4>>2]-d>>2>>>0<=j>>>0){break a}Kb(n,F[d+(j<<2)>>2],g+8|0);h=F[g+12>>2];d=h>>31;i=F[g+8>>2];e=i>>31;f=(d^h)-d+((e^i)-e)|0;l=F[g+16>>2];d=l>>31;e=(d^l)-d|0;d=0;k=e;e=e+f|0;d=k>>>0>e>>>0?1:d;b:{if(!(d|e)){F[g+8>>2]=F[a+92>>2];break b}f=F[a+92>>2];k=f>>31;i=li(ki(f,k,i,i>>31),_,e,d);F[g+8>>2]=i;d=li(ki(f,k,h,h>>31),_,e,d);F[g+12>>2]=d;e=d>>31;e=(d^e)-e|0;d=i>>31;d=e+((d^i)-d|0)|0;if((l|0)>=0){F[g+16>>2]=f-d;break b}F[g+16>>2]=d-f}d=wa(p);f=F[g+8>>2];c:{if(d){F[g+16>>2]=0-F[g+16>>2];e=0-F[g+12>>2]|0;F[g+12>>2]=e;f=0-f|0;F[g+8>>2]=f;break c}e=F[g+12>>2]}d:{if((f|0)>=0){f=F[a+92>>2];d=f+F[g+16>>2]|0;f=e+f|0;break d}e:{if((e|0)<0){d=F[g+16>>2];f=d>>31;f=(d^f)-f|0;break e}d=F[g+16>>2];f=d>>31;f=F[a+84>>2]+(f-(d^f)|0)|0}if((d|0)<0){d=e>>31;d=(d^e)-d|0;break d}d=e>>31;d=F[a+84>>2]+(d-(d^e)|0)|0}e=F[a+84>>2];f:{if(!(d|f)){d=e;f=d;break f}if(!((d|0)!=(e|0)|f)){f=d;break f}if(!((e|0)!=(f|0)|d)){d=f;break f}g:{if(f){break g}h=F[a+92>>2];if((h|0)>=(d|0)){break g}d=(h<<1)-d|0;f=0;break f}h:{if((e|0)!=(f|0)){break h}h=F[a+92>>2];if((h|0)<=(d|0)){break h}d=(h<<1)-d|0;break f}i:{if((d|0)!=(e|0)){break i}e=F[a+92>>2];if((e|0)<=(f|0)){break i}f=(e<<1)-f|0;break f}if(d){break f}d=0;e=F[a+92>>2];if((e|0)>=(f|0)){break f}f=(e<<1)-f|0}e=j<<3;h=e+b|0;i=F[h>>2];h=F[h+4>>2];F[g+36>>2]=d;F[g+32>>2]=f;F[g+24>>2]=i;F[g+28>>2]=h;Jb(g+40|0,m,g+32|0,g+24|0);d=c+e|0;F[d>>2]=F[g+40>>2];F[d+4>>2]=F[g+44>>2];j=j+1|0;if((o|0)!=(j|0)){continue}break}}Z=g+48|0;return 1}ta();v()}function Nd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;a:{if(!H[b+38>>1]){break a}if(!Ta(1,a+12|0,b)){break a}d=F[b+8>>2];e=F[b+16>>2];g=d-e|0;f=F[a+12>>2];d=F[b+12>>2]-(F[b+20>>2]+(d>>>0>>0)|0)|0;if(g>>>0>>6>>>0&(d|0)<=0|(d|0)<0){break a}d=F[a>>2];c=F[a+4>>2]-d>>2;b:{if(c>>>0>>0){qa(a,f-c|0);f=F[a+12>>2];break b}if(c>>>0<=f>>>0){break b}F[a+4>>2]=d+(f<<2)}if(!f){return 1}d=F[b+16>>2];c=F[b+20>>2];l=F[a>>2];j=F[b+8>>2];i=F[b+12>>2];g=0;while(1){if((c|0)>=(i|0)&d>>>0>=j>>>0|(c|0)>(i|0)){return 0}m=F[b>>2];k=G[m+d|0];d=d+1|0;c=d?c:c+1|0;F[b+16>>2]=d;F[b+20>>2]=c;e=k>>>2|0;h=0;c:{d:{e:{f:{n=k&3;switch(n|0){case 3:break f;case 0:break d;default:break e}}e=e+g|0;if(e>>>0>=f>>>0){return 0}ma(l+(g<<2)|0,0,(k&252)+4|0);g=e;break c}while(1){if((d|0)==(j|0)&(c|0)==(i|0)){break a}f=G[d+m|0];d=d+1|0;c=d?c:c+1|0;F[b+16>>2]=d;F[b+20>>2]=c;e=f<<(h<<3|6)|e;h=h+1|0;if((n|0)!=(h|0)){continue}break}}F[l+(g<<2)>>2]=e}f=F[a+12>>2];g=g+1|0;if(f>>>0>g>>>0){continue}break}b=a+16|0;j=F[a>>2];d=F[a+16>>2];c=F[a+20>>2]-d|0;g:{if(c>>>0<=16383){qa(b,4096-(c>>>2|0)|0);break g}if((c|0)==16384){break g}F[a+20>>2]=d+16384}c=a+28|0;g=F[c>>2];d=F[a+32>>2]-g>>3;h:{if(d>>>0>>0){_a(c,f-d|0);g=F[c>>2];break h}if(d>>>0>f>>>0){F[a+32>>2]=(f<<3)+g}if(!f){break a}}d=F[b>>2];b=0;a=0;while(1){c=j+(b<<2)|0;h=F[c>>2];e=a;i=(b<<3)+g|0;F[i+4>>2]=a;F[i>>2]=h;c=F[c>>2];a=c+a|0;if(a>>>0>4096){break a}i:{if(a>>>0<=e>>>0){break i}h=0;i=c&7;if(i){while(1){F[d+(e<<2)>>2]=b;e=e+1|0;h=h+1|0;if((i|0)!=(h|0)){continue}break}}if(c-1>>>0<=6){break i}while(1){c=d+(e<<2)|0;F[c>>2]=b;F[c+28>>2]=b;F[c+24>>2]=b;F[c+20>>2]=b;F[c+16>>2]=b;F[c+12>>2]=b;F[c+8>>2]=b;F[c+4>>2]=b;e=e+8|0;if((e|0)!=(a|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}o=(a|0)==4096}return o}function qf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=Z-32|0;Z=f;e=f+8|0;c=Z-80|0;Z=c;a=F[b+36>>2];F[c+72>>2]=F[b+32>>2];F[c+76>>2]=a;d=F[b+28>>2];a=c- -64|0;F[a>>2]=F[b+24>>2];F[a+4>>2]=d;a=F[b+20>>2];F[c+56>>2]=F[b+16>>2];F[c+60>>2]=a;a=F[b+12>>2];F[c+48>>2]=F[b+8>>2];F[c+52>>2]=a;a=F[b+4>>2];F[c+40>>2]=F[b>>2];F[c+44>>2]=a;jc(c+8|0,c+40|0,c+24|0);a=F[c+8>>2];a:{if(a){F[e>>2]=a;a=e+4|0;if(D[c+23|0]>=0){b=c+8|4;e=F[b+4>>2];F[a>>2]=F[b>>2];F[a+4>>2]=e;F[a+8>>2]=F[b+8>>2];break a}ra(a,F[c+12>>2],F[c+16>>2]);if(D[c+23|0]>=0){break a}ja(F[c+12>>2]);break a}if(D[c+23|0]<0){ja(F[c+12>>2])}a=G[c+31|0];if(a>>>0>=2){b=ka(32);D[b+26|0]=0;a=G[1475]|G[1476]<<8;D[b+24|0]=a;D[b+25|0]=a>>>8;a=G[1471]|G[1472]<<8|(G[1473]<<16|G[1474]<<24);d=G[1467]|G[1468]<<8|(G[1469]<<16|G[1470]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=a;D[b+21|0]=a>>>8;D[b+22|0]=a>>>16;D[b+23|0]=a>>>24;a=G[1463]|G[1464]<<8|(G[1465]<<16|G[1466]<<24);d=G[1459]|G[1460]<<8|(G[1461]<<16|G[1462]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=a;D[b+13|0]=a>>>8;D[b+14|0]=a>>>16;D[b+15|0]=a>>>24;a=G[1455]|G[1456]<<8|(G[1457]<<16|G[1458]<<24);d=G[1451]|G[1452]<<8|(G[1453]<<16|G[1454]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=a;D[b+5|0]=a>>>8;D[b+6|0]=a>>>16;D[b+7|0]=a>>>24;F[c+8>>2]=-1;a=c+8|4;ra(a,b,26);d=D[c+23|0];F[e>>2]=F[c+8>>2];e=e+4|0;if((d|0)>=0){d=F[a+4>>2];F[e>>2]=F[a>>2];F[e+4>>2]=d;F[e+8>>2]=F[a+8>>2];ja(b);break a}ra(e,F[c+12>>2],F[c+16>>2]);if(D[c+23|0]<0){ja(F[c+12>>2])}ja(b);break a}F[e>>2]=0;F[e+4>>2]=0;F[e+16>>2]=a;F[e+8>>2]=0;F[e+12>>2]=0}Z=c+80|0;a=F[f+24>>2];if(D[f+23|0]<0){ja(F[f+12>>2])}Z=f+32|0;return a|0}function Ph(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=Z-32|0;Z=e;a:{if((c|0)!=3){break a}c=F[a+4>>2];f=F[a+12>>2];F[e+24>>2]=-1;F[e+16>>2]=-1;F[e+20>>2]=1065353216;F[e+8>>2]=-1;F[e+12>>2]=-1;if((b|0)==-2){break a}i=F[F[F[c+4>>2]+8>>2]+(f<<2)>>2];if(($[F[F[c>>2]+8>>2]](c)|0)==1){h=F[F[F[c+4>>2]+8>>2]+(f<<2)>>2];b:{if(($[F[F[c>>2]+8>>2]](c)|0)!=1|b-1>>>0>5){break b}g=$[F[F[c>>2]+36>>2]](c)|0;a=$[F[F[c>>2]+44>>2]](c,f)|0;if(!g|!a){break b}f=$[F[F[c>>2]+40>>2]](c,f)|0;c:{if(f){if((b|0)!=6){break b}b=F[c+44>>2];d=ka(112);F[d+4>>2]=h;c=F[e+12>>2];F[d+8>>2]=F[e+8>>2];F[d+12>>2]=c;c=F[e+20>>2];F[d+16>>2]=F[e+16>>2];F[d+20>>2]=c;F[d+24>>2]=F[e+24>>2];F[d+40>>2]=a;c=a+12|0;F[d+36>>2]=c;F[d+32>>2]=f;F[d+28>>2]=b;F[d+68>>2]=a;F[d- -64>>2]=c;F[d+60>>2]=f;F[d+56>>2]=b;F[d+48>>2]=0;F[d+52>>2]=0;F[d>>2]=5928;F[d+88>>2]=1065353216;F[d+92>>2]=-1;F[d+80>>2]=-1;F[d+84>>2]=-1;F[d+72>>2]=1;F[d+76>>2]=-1;F[d+44>>2]=6492;a=d+96|0;break c}if((b|0)!=6){break b}b=F[c+44>>2];d=ka(112);F[d+4>>2]=h;c=F[e+12>>2];F[d+8>>2]=F[e+8>>2];F[d+12>>2]=c;c=F[e+20>>2];F[d+16>>2]=F[e+16>>2];F[d+20>>2]=c;F[d+24>>2]=F[e+24>>2];F[d+40>>2]=a;c=a+12|0;F[d+36>>2]=c;F[d+32>>2]=g;F[d+28>>2]=b;F[d+68>>2]=a;F[d- -64>>2]=c;F[d+60>>2]=g;F[d+56>>2]=b;F[d+48>>2]=0;F[d+52>>2]=0;F[d>>2]=6932;F[d+88>>2]=1065353216;F[d+92>>2]=-1;F[d+80>>2]=-1;F[d+84>>2]=-1;F[d+72>>2]=1;F[d+76>>2]=-1;F[d+44>>2]=7352;a=d+96|0}F[a>>2]=0;F[a+4>>2]=0;D[a+5|0]=0;D[a+6|0]=0;D[a+7|0]=0;D[a+8|0]=0;D[a+9|0]=0;D[a+10|0]=0;D[a+11|0]=0;D[a+12|0]=0}if(d){break a}}d=ka(28);F[d+4>>2]=i;a=F[e+12>>2];F[d+8>>2]=F[e+8>>2];F[d+12>>2]=a;a=F[e+20>>2];F[d+16>>2]=F[e+16>>2];F[d+20>>2]=a;F[d+24>>2]=F[e+24>>2];F[d>>2]=7764}Z=e+32|0;return d|0}function $c(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f=Z-80|0;Z=f;a:{if(!Wb(1,f+76|0,b)){break a}k=F[f+76>>2];if(!k){break a}c=F[b+8>>2];e=F[b+16>>2];c=ki(c-e|0,F[b+12>>2]-(F[b+20>>2]+(c>>>0>>0)|0)|0,5,0);e=_;if(c>>>0>>0&(e|0)<=0|(e|0)<0){break a}c=F[a+4>>2];d=F[a+8>>2]-c>>2;b:{if(d>>>0>>0){qa(a+4|0,k-d|0);break b}if(d>>>0<=k>>>0){break b}F[a+8>>2]=c+(k<<2)}p=a+16|0;l=F[a+32>>2];while(1){g=F[b+12>>2];c=g;d=F[b+20>>2];h=F[b+8>>2];e=F[b+16>>2];if((c|0)<=(d|0)&h>>>0<=e>>>0|(c|0)<(d|0)){d=0;break a}m=F[b>>2];q=G[m+e|0];c=d;i=e+1|0;c=i?c:c+1|0;F[b+16>>2]=i;F[b+20>>2]=c;if(h>>>0<=i>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){d=0;break a}i=G[i+m|0];c=d;j=e+2|0;c=j>>>0<2?c+1|0:c;F[b+16>>2]=j;F[b+20>>2]=c;if(h>>>0<=j>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){d=0;break a}j=G[j+m|0];c=d;n=e+3|0;c=n>>>0<3?c+1|0:c;F[b+16>>2]=n;F[b+20>>2]=c;if(h>>>0<=n>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){d=0;break a}h=G[m+n|0];c=d;d=e+4|0;c=d>>>0<4?c+1|0:c;F[b+16>>2]=d;F[b+20>>2]=c;if(q>>>0>4){d=0;break a}if((i-12&255)>>>0<245){d=0;break a}if(!j){d=0;break a}c=kb(f+8|0);g=(h|0)!=0;d=i-1|0;if(d>>>0<=10){d=F[(d<<2)+10148>>2]}else{d=-1}d=L(d,j);cc(c,q,j,i,g,d,d>>31);if(Wb(1,f+4|0,b)){e=F[f+4>>2];F[f+68>>2]=e;d=bc(ka(96),c);$[F[F[l>>2]+8>>2]](l,F[l+12>>2]-F[l+8>>2]>>2,d);d=(F[l+12>>2]-F[l+8>>2]>>2)-1|0;h=d<<2;F[F[h+F[l+8>>2]>>2]+60>>2]=e;F[F[a+4>>2]+(o<<2)>>2]=d;c=F[a+16>>2];e=F[a+20>>2]-c>>2;c:{if((e|0)>(d|0)){break c}F[f>>2]=-1;d=d+1|0;if(d>>>0>e>>>0){Fa(p,d-e|0,f);c=F[p>>2];break c}if(d>>>0>=e>>>0){break c}F[a+20>>2]=(d<<2)+c}F[c+h>>2]=o;d=1;o=o+1|0;if((o|0)!=(k|0)){continue}break a}break}d=0}Z=f+80|0;return d|0}function Oc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=Z-16|0;Z=k;F[k+8>>2]=c;h=F[a+12>>2];d=F[a+8>>2];g=h-d>>2;a:{if((g|0)>(b|0)){break a}e=b+1|0;if(e>>>0>g>>>0){l=e-g|0;f=F[a+16>>2];d=F[a+12>>2];if(l>>>0<=f-d>>2>>>0){if(l){e=d;d=l<<2;d=ma(e,0,d)+d|0}F[a+12>>2]=d;break a}b:{c:{d:{m=F[a+8>>2];g=d-m>>2;i=g+l|0;if(i>>>0<1073741824){e=f-m|0;f=e>>>1|0;e=e>>>0>=2147483644?1073741823:f>>>0>i>>>0?f:i;if(e){if(e>>>0>=1073741824){break d}j=ka(e<<2)}h=(g<<2)+j|0;f=l<<2;i=ma(h,0,f);g=f+i|0;e=(e<<2)+j|0;if((d|0)==(m|0)){break c}while(1){d=d-4|0;f=F[d>>2];F[d>>2]=0;h=h-4|0;F[h>>2]=f;if((d|0)!=(m|0)){continue}break}F[a+16>>2]=e;e=F[a+12>>2];F[a+12>>2]=g;d=F[a+8>>2];F[a+8>>2]=h;if((d|0)==(e|0)){break b}while(1){e=e-4|0;f=F[e>>2];F[e>>2]=0;if(f){xa(f)}if((d|0)!=(e|0)){continue}break}break b}na();v()}oa();v()}F[a+16>>2]=e;F[a+12>>2]=g;F[a+8>>2]=i}if(d){ja(d)}break a}if(e>>>0>=g>>>0){break a}d=d+(e<<2)|0;if((d|0)!=(h|0)){while(1){h=h-4|0;c=F[h>>2];F[h>>2]=0;if(c){xa(c)}if((d|0)!=(h|0)){continue}break}c=F[k+8>>2]}F[a+12>>2]=d}e:{f:{d=F[c+56>>2];g:{if((d|0)>4){break g}j=L(d,12)+a|0;d=F[j+24>>2];if((d|0)!=F[j+28>>2]){F[d>>2]=b;F[j+24>>2]=d+4;break g}i=F[j+20>>2];g=d-i|0;f=g>>2;e=f+1|0;if(e>>>0>=1073741824){break f}d=g>>>1|0;e=g>>>0>=2147483644?1073741823:d>>>0>e>>>0?d:e;if(e){if(e>>>0>=1073741824){break e}d=ka(e<<2)}else{d=0}f=d+(f<<2)|0;F[f>>2]=b;d=pa(d,i,g);F[j+20>>2]=d;F[j+24>>2]=f+4;F[j+28>>2]=d+(e<<2);if(!i){break g}ja(i)}F[c+60>>2]=b;a=F[a+8>>2];F[k+8>>2]=0;a=a+(b<<2)|0;b=F[a>>2];F[a>>2]=c;if(b){xa(b)}a=F[k+8>>2];F[k+8>>2]=0;if(a){xa(a)}Z=k+16|0;return}na();v()}oa();v()}function Pf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=c;d=a;a:{if(F[a+12>>2]==(b|0)){break a}a=b;b=F[d+4>>2];e=F[d>>2];if((b|0)!=(e|0)){while(1){c=b-12|0;if(D[b-1|0]<0){ja(F[c>>2])}b=c;if((e|0)!=(b|0)){continue}break}}F[d+12>>2]=a;F[d+4>>2]=e;c=F[a>>2];j=a+4|0;if((c|0)==(j|0)){break a}while(1){a=F[d+4>>2];b:{if((a|0)!=F[d+8>>2]){c:{if(D[c+27|0]>=0){b=F[c+20>>2];F[a>>2]=F[c+16>>2];F[a+4>>2]=b;F[a+8>>2]=F[c+24>>2];break c}ra(a,F[c+16>>2],F[c+20>>2])}F[d+4>>2]=a+12;break b}g=0;d:{e:{f:{a=F[d+4>>2];e=F[d>>2];f=(a-e|0)/12|0;b=f+1|0;if(b>>>0<357913942){h=(F[d+8>>2]-e|0)/12|0;k=h<<1;b=h>>>0>=178956970?357913941:b>>>0>>0?k:b;if(b){if(b>>>0>=357913942){break f}g=ka(L(b,12))}h=L(b,12);b=L(f,12)+g|0;g:{if(D[c+27|0]>=0){f=F[c+20>>2];F[b>>2]=F[c+16>>2];F[b+4>>2]=f;F[b+8>>2]=F[c+24>>2];break g}ra(b,F[c+16>>2],F[c+20>>2]);e=F[d>>2];a=F[d+4>>2]}g=g+h|0;f=b+12|0;if((a|0)==(e|0)){break e}while(1){a=a-12|0;h=F[a+4>>2];b=b-12|0;F[b>>2]=F[a>>2];F[b+4>>2]=h;F[b+8>>2]=F[a+8>>2];F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;if((a|0)!=(e|0)){continue}break}F[d+8>>2]=g;a=F[d+4>>2];F[d+4>>2]=f;e=F[d>>2];F[d>>2]=b;if((a|0)==(e|0)){break d}while(1){b=a-12|0;if(D[a-1|0]<0){ja(F[b>>2])}a=b;if((e|0)!=(b|0)){continue}break}break d}na();v()}oa();v()}F[d+8>>2]=g;F[d+4>>2]=f;F[d>>2]=b}if(e){ja(e)}}b=F[c+4>>2];h:{if(b){while(1){a=b;b=F[b>>2];if(b){continue}break h}}while(1){a=F[c+8>>2];b=F[a>>2]!=(c|0);c=a;if(b){continue}break}}c=a;if((j|0)!=(a|0)){continue}break}}a=0;i:{if((i|0)<0){break i}b=F[d>>2];if((F[d+4>>2]-b|0)/12>>>0<=i>>>0){break i}a=b+L(i,12)|0;a=D[a+11|0]<0?F[a>>2]:a}return a|0}function Ad(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;i=Z-16|0;Z=i;F[i>>2]=b;f=-1;a:{if((b|0)==-1){F[i+4>>2]=-1;break a}f=b+1|0;F[i+4>>2]=(f>>>0)%3|0?f:b-2|0;if((b>>>0)%3|0){f=b-1|0;break a}f=b+2|0}F[i+8>>2]=f;n=(b>>>0)/3|0;b:{c:{d:{while(1){e:{f:{j=F[(l<<2)+i>>2];if((j|0)!=-1){f=F[F[F[a+8>>2]+12>>2]+(j<<2)>>2];if((f|0)!=-1){break f}}f=0;g=F[a+216>>2];if((g|0)==F[a+220>>2]){break e}while(1){g=L(f,144)+g|0;d=F[g+136>>2];c=F[g+140>>2];g:{if(d>>>0>>0){F[d>>2]=j;F[g+136>>2]=d+4;break g}e=d;d=F[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break d}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=ka(h<<2)}else{c=0}e=m+c|0;F[e>>2]=j;c=pa(c,d,k);F[g+132>>2]=c;F[g+136>>2]=e+4;F[g+140>>2]=c+(h<<2);if(!d){break g}ja(d)}f=f+1|0;g=F[a+216>>2];if(f>>>0<(F[a+220>>2]-g|0)/144>>>0){continue}break}break e}if((b|0)==-1|(f>>>0)/3>>>0>>0){break e}f=0;if(F[a+220>>2]==F[a+216>>2]){break e}while(1){h:{if(!wa(F[a+368>>2]+(f<<4)|0)){break h}g=F[a+216>>2]+L(f,144)|0;d=F[g+136>>2];c=F[g+140>>2];if(d>>>0>>0){F[d>>2]=j;F[g+136>>2]=d+4;break h}e=d;d=F[g+132>>2];k=e-d|0;e=k>>2;h=e+1|0;if(h>>>0>=1073741824){break b}m=e<<2;c=c-d|0;e=c>>>1|0;h=c>>>0>=2147483644?1073741823:h>>>0>>0?e:h;if(h){if(h>>>0>=1073741824){break c}c=ka(h<<2)}else{c=0}e=m+c|0;F[e>>2]=j;c=pa(c,d,k);F[g+132>>2]=c;F[g+136>>2]=e+4;F[g+140>>2]=c+(h<<2);if(!d){break h}ja(d)}f=f+1|0;if(f>>>0<(F[a+220>>2]-F[a+216>>2]|0)/144>>>0){continue}break}}l=l+1|0;if((l|0)!=3){continue}break}Z=i+16|0;return 1}na();v()}oa();v()}na();v()}function Bd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=Z-16|0;Z=h;m=-1;a:{b:{c:{if(!Da(1,h+12|0,b)){break c}j=F[h+12>>2];if(j){c=F[a+8>>2];if((F[c+4>>2]-F[c>>2]>>2>>>0)/3>>>0>>0){break c}while(1){if(!Da(1,h+8|0,b)){break c}c=F[h+8>>2];if(!Da(1,h+8|0,b)){break c}g=c+g|0;c=F[h+8>>2];if(g>>>0>>0){break c}e=g-c|0;c=F[a+40>>2];d:{if((c|0)!=F[a+44>>2]){F[c+4>>2]=g;F[c>>2]=e;F[a+40>>2]=c+12;j=F[h+12>>2];break d}d=c;c=F[a+36>>2];l=d-c|0;d=(l|0)/12|0;f=d+1|0;if(f>>>0>=357913942){break b}i=d<<1;f=d>>>0>=178956970?357913941:f>>>0>>0?i:f;if(f){if(f>>>0>=357913942){break a}i=ka(L(f,12))}else{i=0}d=i+L(d,12)|0;F[d+4>>2]=g;F[d>>2]=e;e=pa(d+L((l|0)/-12|0,12)|0,c,l);F[a+44>>2]=i+L(f,12);F[a+40>>2]=d+12;F[a+36>>2]=e;if(!c){break d}ja(c)}k=k+1|0;if(k>>>0>>0){continue}break}g=0;hc(b,0,0);if(j){while(1){c=G[b+36|0];d=H[F[a+4>>2]+36>>1];e:{f:{if(((d<<8|d>>>8)&65535)>>>0<=513){if(!c){break e}e=0;d=F[b+32>>2];k=d>>>3|0;f=F[b+24>>2];c=k+f|0;i=F[b+28>>2];g:{if(c>>>0>=i>>>0){c=d;break g}e=G[c|0];c=d+1|0;F[b+32>>2]=c;k=c>>>3|0;e=e>>>(d&7)&1}if(i>>>0>f+k>>>0){break f}break e}if(!c){break e}e=0;c=F[b+32>>2];d=F[b+24>>2]+(c>>>3|0)|0;if(d>>>0>=I[b+28>>2]){break e}e=G[d|0]>>>(c&7)&1}F[b+32>>2]=c+1}c=F[a+36>>2]+L(g,12)|0;D[c+8|0]=G[c+8|0]&254|e&1;g=g+1|0;if((j|0)!=(g|0)){continue}break}}D[b+36|0]=0;d=F[b+20>>2];a=0;e=F[b+32>>2]+7|0;a=e>>>0<7?1:a;e=a<<29|e>>>3;c=e+F[b+16>>2]|0;a=(a>>>3|0)+d|0;F[b+16>>2]=c;F[b+20>>2]=c>>>0>>0?a+1|0:a}m=F[b+16>>2]}Z=h+16|0;return m}na();v()}oa();v()}function xf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=Z-16|0;Z=m;l=F[b+80>>2];e=G[c+24|0];a=L(l,e);a:{b:{c:{d:{b=F[c+28>>2];if(!(!G[c+84|0]|(b|0)!=1&(b|0)!=2)){b=F[c+48>>2];c=F[F[c>>2]>>2];F[m+8>>2]=0;F[m>>2]=0;F[m+4>>2]=0;if(a){if((a|0)<0){break d}f=ka(a);h=la(f,b+c|0,a)+a|0}a=F[d>>2];if(a){F[d+4>>2]=a;ja(a)}F[d+8>>2]=h;F[d+4>>2]=h;F[d>>2]=f;b=1;break a}if(e){f=ka(e);ma(f,0,e)}e:{i=F[d+4>>2];b=F[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=F[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ma(i,0,k)+k|0,F[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=ka(i);ma(j+g|0,0,k);g=pa(j,b,g);F[d+8>>2]=g+i;F[d+4>>2]=a+g;F[d>>2]=g;if(!b){break f}ja(b);break f}if(a>>>0>=g>>>0){break f}F[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!Cb(c,G[c+84|0]?a:F[F[c+68>>2]+(a<<2)>>2],D[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!Cb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){D[F[d>>2]+h|0]=G[a+f|0];D[(F[d>>2]+h|0)+1|0]=G[(a|1)+f|0];D[(F[d>>2]+h|0)+2|0]=G[(a|2)+f|0];D[(F[d>>2]+h|0)+3|0]=G[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){D[F[d>>2]+h|0]=G[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}na();v()}na();v()}if(!f){break a}}ja(f)}Z=m+16|0;return b&1}function wf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;m=Z-16|0;Z=m;l=F[b+80>>2];e=G[c+24|0];a=L(l,e);a:{b:{c:{d:{b=F[c+28>>2];if(!(!G[c+84|0]|(b|0)!=1&(b|0)!=2)){b=F[c+48>>2];c=F[F[c>>2]>>2];F[m+8>>2]=0;F[m>>2]=0;F[m+4>>2]=0;if(a){if((a|0)<0){break d}f=ka(a);h=la(f,b+c|0,a)+a|0}a=F[d>>2];if(a){F[d+4>>2]=a;ja(a)}F[d+8>>2]=h;F[d+4>>2]=h;F[d>>2]=f;b=1;break a}if(e){f=ka(e);ma(f,0,e)}e:{i=F[d+4>>2];b=F[d>>2];g=i-b|0;f:{if(g>>>0>>0){k=a-g|0;j=F[d+8>>2];if(k>>>0<=j-i>>>0){n=d,o=ma(i,0,k)+k|0,F[n+4>>2]=o;break f}if((a|0)<0){break e}i=j-b|0;j=i<<1;i=i>>>0>=1073741823?2147483647:a>>>0>>0?j:a;j=ka(i);ma(j+g|0,0,k);g=pa(j,b,g);F[d+8>>2]=g+i;F[d+4>>2]=a+g;F[d>>2]=g;if(!b){break f}ja(b);break f}if(a>>>0>=g>>>0){break f}F[d+4>>2]=a+b}if(!l){b=1;break c}if(!e){b=0;a=0;while(1){if(!Bb(c,G[c+84|0]?a:F[F[c+68>>2]+(a<<2)>>2],D[c+24|0],f)){break c}a=a+1|0;b=l>>>0<=a>>>0;if((a|0)!=(l|0)){continue}break}break c}i=e&252;g=e&3;b=0;j=e>>>0<4;e=0;while(1){if(!Bb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],f)){break c}b=0;a=0;k=0;if(!j){while(1){D[F[d>>2]+h|0]=G[a+f|0];D[(F[d>>2]+h|0)+1|0]=G[(a|1)+f|0];D[(F[d>>2]+h|0)+2|0]=G[(a|2)+f|0];D[(F[d>>2]+h|0)+3|0]=G[(a|3)+f|0];a=a+4|0;h=h+4|0;k=k+4|0;if((i|0)!=(k|0)){continue}break}}if(g){while(1){D[F[d>>2]+h|0]=G[a+f|0];a=a+1|0;h=h+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}e=e+1|0;b=l>>>0<=e>>>0;if((e|0)!=(l|0)){continue}break}break b}na();v()}na();v()}if(!f){break a}}ja(f)}Z=m+16|0;return b&1}function Jb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;k=F[b+16>>2];h=F[c+4>>2]-k|0;e=F[c>>2]-k|0;F[c>>2]=e;f=h;F[c+4>>2]=f;l=F[b+16>>2];f=f>>31;g=(h^f)-f|0;f=e>>31;m=l>>>0>=g+((f^e)-f|0)>>>0;a:{if(m){f=h;break a}b:{c:{if((e|0)>=0){g=1;j=1;if((h|0)>=0){break b}i=1;g=-1;j=-1;if(e){break c}break b}i=-1;g=-1;j=-1;if((h|0)<=0){break b}}g=(h|0)<=0?-1:1;j=i}n=L(j,l);f=(e<<1)-n|0;i=(L(g,j)|0)>=0;e=L(g,l);f=((i?0-f|0:f)+e|0)/2|0;F[c+4>>2]=f;e=(h<<1)-e|0;e=((i?0-e|0:e)+n|0)/2|0;F[c>>2]=e}d:{e:{f:{g:{h:{i:{j:{if(e){if((e|0)<0){break j}if((f|0)>=0){break i}break f}if(f){break h}j=1;g=0;f=0;i=0;break d}j=1;if((f|0)>0){break g}i=(f|0)>0?3:0;g=f;f=e;break d}g=0-f|0;f=0-e|0;i=2;break e}if((f|0)<=0){break f}}f=0-f|0;g=e;i=3;break e}g=0-e|0;i=1}F[c>>2]=f;F[c+4>>2]=g;j=0}e=F[d>>2]+f|0;h=F[b+16>>2];k:{if((e|0)>(h|0)){e=e-F[b+4>>2]|0;break k}if((0-h|0)<=(e|0)){break k}e=F[b+4>>2]+e|0}c=F[d+4>>2]+g|0;l:{if((h|0)<(c|0)){c=c-F[b+4>>2]|0;break l}if((0-h|0)<=(c|0)){break l}c=F[b+4>>2]+c|0}m:{if(j){b=c;break m}b=c;n:{o:{p:{d=4-i|0;switch((d>>>0<4?d:0-i|0)-1|0){case 2:break n;case 1:break o;case 0:break p;default:break m}}b=0-e|0;e=c;break m}b=0-c|0;e=0-e|0;break m}b=e;e=0-c|0}q:{if(m){c=b;break q}r:{s:{if((e|0)>=0){c=1;f=1;if((b|0)>=0){break r}d=1;c=-1;f=-1;if(e){break s}break r}d=-1;c=-1;f=-1;if((b|0)<=0){break r}}c=(b|0)<=0?-1:1;f=d}d=e<<1;e=L(f,h);d=d-e|0;f=(L(c,f)|0)>=0;g=f?0-d|0:d;d=L(c,h);c=(g+d|0)/2|0;b=(b<<1)-d|0;e=(e+(f?0-b|0:b)|0)/2|0}b=a;F[b>>2]=e+k;F[b+4>>2]=c+k}function Uh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;F[a+8>>2]=e;m=a+32|0;h=F[m>>2];g=F[a+36>>2]-h>>2;a:{if(g>>>0>>0){qa(m,e-g|0);f=F[a+8>>2];break a}f=e;if(f>>>0>=g>>>0){break a}F[a+36>>2]=h+(e<<2);f=e}g=e>>>0>1073741823?-1:e<<2;n=ma(ka(g),0,g);b:{if((f|0)<=0){break b}h=F[a+32>>2];while(1){f=i<<2;g=F[f+n>>2];j=F[a+16>>2];c:{if((g|0)>(j|0)){F[f+h>>2]=j;break c}f=f+h|0;j=F[a+12>>2];if((j|0)>(g|0)){F[f>>2]=j;break c}F[f>>2]=g}f=F[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}if((f|0)<=0){break b}i=0;while(1){g=i<<2;f=g+c|0;g=F[b+g>>2]+F[g+h>>2]|0;F[f>>2]=g;d:{if((g|0)>F[a+16>>2]){g=g-F[a+20>>2]|0}else{if((g|0)>=F[a+12>>2]){break d}g=g+F[a+20>>2]|0}F[f>>2]=g}f=F[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}if(!((d|0)<=(e|0)|(f|0)<=0)){p=0-e<<2;g=e;while(1){e:{if((f|0)<=0){break e}l=g<<2;o=l+c|0;q=o+p|0;j=F[m>>2];i=0;while(1){f=i<<2;h=F[f+q>>2];k=F[a+16>>2];f:{if((h|0)>(k|0)){F[f+j>>2]=k;break f}f=f+j|0;k=F[a+12>>2];if((k|0)>(h|0)){F[f>>2]=k;break f}F[f>>2]=h}f=F[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}i=0;if((f|0)<=0){break e}l=b+l|0;while(1){h=i<<2;f=h+o|0;h=F[h+l>>2]+F[h+j>>2]|0;F[f>>2]=h;g:{if((h|0)>F[a+16>>2]){h=h-F[a+20>>2]|0}else{if((h|0)>=F[a+12>>2]){break g}h=h+F[a+20>>2]|0}F[f>>2]=h}f=F[a+8>>2];i=i+1|0;if((f|0)>(i|0)){continue}break}}g=e+g|0;if((g|0)<(d|0)){continue}break}}ja(n);return 1}function yf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=F[b+80>>2];b=G[c+24|0];g=L(j,b);a:{if(!b){break a}h=b<<2;f=ka(h);a=f;k=b&7;if(k){while(1){F[a>>2]=-1073741824;a=a+4|0;e=e+1|0;if((k|0)!=(e|0)){continue}break}}if((b-1&1073741823)>>>0<7){break a}e=f+h|0;while(1){F[a+24>>2]=-1073741824;F[a+28>>2]=-1073741824;F[a+16>>2]=-1073741824;F[a+20>>2]=-1073741824;F[a+8>>2]=-1073741824;F[a+12>>2]=-1073741824;F[a>>2]=-1073741824;F[a+4>>2]=-1073741824;a=a+32|0;if((e|0)!=(a|0)){continue}break}}e=F[d>>2];a=F[d+4>>2]-e>>2;b:{if(a>>>0>>0){qa(d,g-a|0);break b}if(a>>>0<=g>>>0){break b}F[d+4>>2]=e+(g<<2)}c:{d:{e:{if(!j){i=1;break e}if(!b){a=0;while(1){if(!lb(c,G[c+84|0]?a:F[F[c+68>>2]+(a<<2)>>2],D[c+24|0],f)){break e}a=a+1|0;i=j>>>0<=a>>>0;if((a|0)!=(j|0)){continue}break}break e}n=b&252;k=b&3;o=b>>>0<4;e=0;b=0;while(1){if(!lb(c,G[c+84|0]?b:F[F[c+68>>2]+(b<<2)>>2],D[c+24|0],f)){break e}m=F[d>>2];i=0;a=0;l=0;if(!o){while(1){g=(e<<2)+m|0;h=a<<2;J[g>>2]=J[h+f>>2];J[g+4>>2]=J[(h|4)+f>>2];J[g+8>>2]=J[(h|8)+f>>2];J[g+12>>2]=J[(h|12)+f>>2];a=a+4|0;e=e+4|0;l=l+4|0;if((n|0)!=(l|0)){continue}break}}if(k){while(1){J[(e<<2)+m>>2]=J[(a<<2)+f>>2];a=a+1|0;e=e+1|0;i=i+1|0;if((k|0)!=(i|0)){continue}break}}b=b+1|0;i=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break d}if(!f){break c}}ja(f)}return i|0}function $d(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;k=Z-16|0;Z=k;c=F[b+20>>2];d=F[b+16>>2];e=d+4|0;c=e>>>0<4?c+1|0:c;g=F[b+12>>2];a:{if(I[b+8>>2]>>0&(g|0)<=(c|0)|(c|0)>(g|0)){break a}d=d+F[b>>2]|0;h=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[b+16>>2]=e;F[b+20>>2]=c;if((h|0)<0){break a}Na(a+76|0,h);c=k;F[c>>2]=0;F[c+4>>2]=0;D[c+5|0]=0;D[c+6|0]=0;D[c+7|0]=0;D[c+8|0]=0;D[c+9|0]=0;D[c+10|0]=0;D[c+11|0]=0;D[c+12|0]=0;b:{if(!Aa(c,b)){break b}if(h){g=1;while(1){d=1<>2]+(i>>>3&536870908)|0;e=e^g;if(e&1){d=F[f>>2]&(d^-1)}else{d=d|F[f>>2]}g=e^1;F[f>>2]=d;i=i+1|0;if((h|0)!=(i|0)){continue}break}}i=0;c=F[b+8>>2];e=F[b+12>>2];f=e;e=F[b+20>>2];g=e;l=F[b+16>>2];d=l+4|0;e=d>>>0<4?e+1|0:e;h=d;if(d>>>0>c>>>0&(e|0)>=(f|0)|(e|0)>(f|0)){break b}m=F[b>>2];d=m+l|0;j=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[b+16>>2]=h;F[b+20>>2]=e;d=c;c=g;e=l+8|0;c=e>>>0<8?c+1|0:c;if(d>>>0>>0&(c|0)>=(f|0)|(c|0)>(f|0)){break b}d=h+m|0;d=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);F[b+16>>2]=e;F[b+20>>2]=c;if((d|0)<(j|0)){break b}F[a+16>>2]=d;F[a+12>>2]=j;c=(d>>31)-((j>>31)+(d>>>0>>0)|0)|0;b=d-j|0;if(!c&b>>>0>2147483646|c){break b}i=1;c=b+1|0;F[a+20>>2]=c;b=c>>>1|0;F[a+24>>2]=b;F[a+28>>2]=0-b;if(c&1){break b}F[a+24>>2]=b-1}}Z=k+16|0;return i|0}function tf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=Z-16|0;Z=k;j=F[b+80>>2];e=G[c+24|0];b=L(j,e);a:{b:{c:{d:{f=F[c+28>>2];if(!(!G[c+84|0]|(f|0)!=5&(f|0)!=6)){e=F[c+48>>2];c=F[F[c>>2]>>2];F[k+8>>2]=0;F[k>>2]=0;F[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=ka(b);g=la(a,c+e|0,b)+b|0}b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d+8>>2]=g;F[d+4>>2]=g;F[d>>2]=a;h=1;break a}if(e){f=e<<2;a=ka(f);ma(a,0,f)}i=F[d>>2];f=F[d+4>>2]-i>>2;e:{if(f>>>0>>0){qa(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}F[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!xb(c,G[c+84|0]?b:F[F[c+68>>2]+(b<<2)>>2],D[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!xb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break c}n=F[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;F[f>>2]=F[i+a>>2];F[f+4>>2]=F[(i|4)+a>>2];F[f+8>>2]=F[(i|8)+a>>2];F[f+12>>2]=F[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){F[(g<<2)+n>>2]=F[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}na();v()}if(!a){break a}}ja(a)}Z=k+16|0;return h|0}function cd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=Z-16|0;Z=k;j=F[b+80>>2];e=G[c+24|0];b=L(j,e);a:{b:{c:{d:{f=F[c+28>>2];if(!(!G[c+84|0]|(f|0)!=5&(f|0)!=6)){e=F[c+48>>2];c=F[F[c>>2]>>2];F[k+8>>2]=0;F[k>>2]=0;F[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<2;a=ka(b);g=la(a,c+e|0,b)+b|0}b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d+8>>2]=g;F[d+4>>2]=g;F[d>>2]=a;h=1;break a}if(e){f=e<<2;a=ka(f);ma(a,0,f)}i=F[d>>2];f=F[d+4>>2]-i>>2;e:{if(f>>>0>>0){qa(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}F[d+4>>2]=i+(b<<2)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!yb(c,G[c+84|0]?b:F[F[c+68>>2]+(b<<2)>>2],D[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!yb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break c}n=F[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<2)+n|0;i=b<<2;F[f>>2]=F[i+a>>2];F[f+4>>2]=F[(i|4)+a>>2];F[f+8>>2]=F[(i|8)+a>>2];F[f+12>>2]=F[(i|12)+a>>2];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){F[(g<<2)+n>>2]=F[(b<<2)+a>>2];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}na();v()}if(!a){break a}}ja(a)}Z=k+16|0;return h|0}function vf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=Z-16|0;Z=k;j=F[b+80>>2];e=G[c+24|0];b=L(j,e);a:{b:{c:{d:{f=F[c+28>>2];if(!(!G[c+84|0]|(f|0)!=3&(f|0)!=4)){e=F[c+48>>2];c=F[F[c>>2]>>2];F[k+8>>2]=0;F[k>>2]=0;F[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=ka(b);g=la(a,c+e|0,b)+b|0}b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d+8>>2]=g;F[d+4>>2]=g;F[d>>2]=a;h=1;break a}if(e){f=e<<1;a=ka(f);ma(a,0,f)}i=F[d>>2];f=F[d+4>>2]-i>>1;e:{if(f>>>0>>0){kd(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}F[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!Ab(c,G[c+84|0]?b:F[F[c+68>>2]+(b<<2)>>2],D[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!Ab(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break c}n=F[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;E[f>>1]=H[i+a>>1];E[f+2>>1]=H[(i|2)+a>>1];E[f+4>>1]=H[(i|4)+a>>1];E[f+6>>1]=H[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){E[(g<<1)+n>>1]=H[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}na();v()}if(!a){break a}}ja(a)}Z=k+16|0;return h|0}function uf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a=0;k=Z-16|0;Z=k;j=F[b+80>>2];e=G[c+24|0];b=L(j,e);a:{b:{c:{d:{f=F[c+28>>2];if(!(!G[c+84|0]|(f|0)!=3&(f|0)!=4)){e=F[c+48>>2];c=F[F[c>>2]>>2];F[k+8>>2]=0;F[k>>2]=0;F[k+4>>2]=0;if(b){if((b|0)<0){break d}b=b<<1;a=ka(b);g=la(a,c+e|0,b)+b|0}b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d+8>>2]=g;F[d+4>>2]=g;F[d>>2]=a;h=1;break a}if(e){f=e<<1;a=ka(f);ma(a,0,f)}i=F[d>>2];f=F[d+4>>2]-i>>1;e:{if(f>>>0>>0){kd(d,b-f|0);break e}if(b>>>0>=f>>>0){break e}F[d+4>>2]=i+(b<<1)}if(!j){h=1;break c}if(!e){b=0;while(1){if(!zb(c,G[c+84|0]?b:F[F[c+68>>2]+(b<<2)>>2],D[c+24|0],a)){break c}b=b+1|0;h=j>>>0<=b>>>0;if((b|0)!=(j|0)){continue}break}break c}o=e&252;m=e&3;p=e>>>0<4;e=0;while(1){if(!zb(c,G[c+84|0]?e:F[F[c+68>>2]+(e<<2)>>2],D[c+24|0],a)){break c}n=F[d>>2];l=0;b=0;h=0;if(!p){while(1){f=(g<<1)+n|0;i=b<<1;E[f>>1]=H[i+a>>1];E[f+2>>1]=H[(i|2)+a>>1];E[f+4>>1]=H[(i|4)+a>>1];E[f+6>>1]=H[(i|6)+a>>1];b=b+4|0;g=g+4|0;h=h+4|0;if((o|0)!=(h|0)){continue}break}}if(m){while(1){E[(g<<1)+n>>1]=H[(b<<1)+a>>1];b=b+1|0;g=g+1|0;l=l+1|0;if((l|0)!=(m|0)){continue}break}}e=e+1|0;h=j>>>0<=e>>>0;if((e|0)!=(j|0)){continue}break}break b}na();v()}if(!a){break a}}ja(a)}Z=k+16|0;return h|0}function kc(a,b){var c=0,d=0,e=0,f=0,g=0;f=-1;d=-1;a:{if((b|0)==-1){break a}d=b+1|0;f=(d>>>0)%3|0?d:b-2|0;d=b-1|0;if((b>>>0)%3|0){break a}d=b+2|0}b:{c:{d:{switch(F[a+168>>2]){case 0:case 1:e=F[a+148>>2];c=1;b=F[a+156>>2];g=b+(((f|0)==-1?-1:F[F[e>>2]+(f<<2)>>2])<<2)|0;F[g>>2]=F[g>>2]+1;b=(((d|0)==-1?-1:F[F[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 5:e=F[a+148>>2];c=-1;c=((b|0)!=-1?F[F[e>>2]+(b<<2)>>2]:c)<<2;b=F[a+156>>2];c=c+b|0;F[c>>2]=F[c>>2]+1;c=(((f|0)==-1?-1:F[F[e>>2]+(f<<2)>>2])<<2)+b|0;F[c>>2]=F[c>>2]+1;c=2;b=(((d|0)==-1?-1:F[F[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 3:e=F[a+148>>2];c=-1;c=((b|0)!=-1?F[F[e>>2]+(b<<2)>>2]:c)<<2;b=F[a+156>>2];c=c+b|0;F[c>>2]=F[c>>2]+1;c=(((f|0)==-1?-1:F[F[e>>2]+(f<<2)>>2])<<2)+b|0;F[c>>2]=F[c>>2]+2;c=1;b=(((d|0)==-1?-1:F[F[e>>2]+(d<<2)>>2])<<2)+b|0;break c;case 7:break d;default:break b}}e=F[a+148>>2];c=-1;c=((b|0)!=-1?F[F[e>>2]+(b<<2)>>2]:c)<<2;b=F[a+156>>2];c=c+b|0;F[c>>2]=F[c>>2]+2;c=(((f|0)==-1?-1:F[F[e>>2]+(f<<2)>>2])<<2)+b|0;F[c>>2]=F[c>>2]+2;c=2;b=(((d|0)==-1?-1:F[F[e>>2]+(d<<2)>>2])<<2)+b|0}F[b>>2]=F[b>>2]+c}c=a;b=F[F[a+156>>2]+(((f|0)==-1?-1:F[F[F[a+148>>2]>>2]+(f<<2)>>2])<<2)>>2];d=F[a+180>>2];a=F[a+176>>2];F[c+172>>2]=(a|0)<=(b|0)?((b|0)<(d|0)?b:d)-a|0:0}function Dg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;a:{b=F[a+32>>2];f=F[b+8>>2];h=F[b+12>>2];g=F[b+20>>2];c=F[b+16>>2];e=0;b:{if((h|0)<=(g|0)&c>>>0>=f>>>0|(g|0)>(h|0)){break b}f=G[F[b>>2]+c|0];e=b;b=g;c=c+1|0;b=c?b:b+1|0;F[e+16>>2]=c;F[e+20>>2]=b;c:{if(!f){break c}while(1){if($[F[F[a>>2]+16>>2]](a,d)|0){d=d+1|0;if((f|0)!=(d|0)){continue}break c}break}return 0}d=F[a+8>>2];b=F[a+12>>2];if((d|0)!=(b|0)){while(1){c=F[d>>2];if(!($[F[F[c>>2]+8>>2]](c,a,F[a+4>>2])|0)){break a}d=d+4|0;if((b|0)!=(d|0)){continue}break}}d:{if(!f){break d}d=0;while(1){b=F[F[a+8>>2]+(d<<2)>>2];if(!($[F[F[b>>2]+12>>2]](b,F[a+32>>2])|0)){break a}d=d+1|0;if((f|0)!=(d|0)){continue}break}if(!f){break d}i=a+20|0;b=0;while(1){d=0;j=b<<2;c=F[j+F[a+8>>2]>>2];k=$[F[F[c>>2]+24>>2]](c)|0;if((k|0)>0){while(1){c=F[F[a+8>>2]+j>>2];c=$[F[F[c>>2]+20>>2]](c,d)|0;e=F[a+20>>2];g=F[a+24>>2]-e>>2;e:{if(c>>>0>>0){break e}h=c+1|0;if(h>>>0>g>>>0){qa(i,h-g|0);e=F[i>>2];break e}if(g>>>0<=h>>>0){break e}F[a+24>>2]=(h<<2)+e}F[(c<<2)+e>>2]=b;d=d+1|0;if((k|0)!=(d|0)){continue}break}}b=b+1|0;if((f|0)!=(b|0)){continue}break}}e=0;if(!($[F[F[a>>2]+28>>2]](a)|0)){break b}e=$[F[F[a>>2]+32>>2]](a)|0}return e|0}return 0}function Ye(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;Oc(a,b,c);c=F[a+84>>2];d=F[a+88>>2]-c>>2;a:{if((d|0)>(b|0)){break a}b=b+1|0;if(b>>>0>d>>>0){b:{d=b-d|0;e=F[a+92>>2];c=F[a+88>>2];if(d>>>0<=e-c>>2>>>0){c:{if(!d){break c}b=c;e=d&7;if(e){while(1){F[b>>2]=1;b=b+4|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}}c=(d<<2)+c|0;if((d-1&1073741823)>>>0<7){break c}while(1){F[b+24>>2]=1;F[b+28>>2]=1;F[b+16>>2]=1;F[b+20>>2]=1;F[b+8>>2]=1;F[b+12>>2]=1;F[b>>2]=1;F[b+4>>2]=1;b=b+32|0;if((c|0)!=(b|0)){continue}break}}F[a+88>>2]=c;break b}d:{b=c;c=F[a+84>>2];i=b-c|0;g=i>>2;b=g+d|0;if(b>>>0<1073741824){e=e-c|0;h=e>>>1|0;e=e>>>0>=2147483644?1073741823:b>>>0>>0?h:b;if(e){if(e>>>0>=1073741824){break d}j=ka(e<<2)}g=(g<<2)+j|0;b=g;h=d&7;if(h){while(1){F[b>>2]=1;b=b+4|0;f=f+1|0;if((h|0)!=(f|0)){continue}break}}f=g+(d<<2)|0;if((d-1&1073741823)>>>0>=7){while(1){F[b+24>>2]=1;F[b+28>>2]=1;F[b+16>>2]=1;F[b+20>>2]=1;F[b+8>>2]=1;F[b+12>>2]=1;F[b>>2]=1;F[b+4>>2]=1;b=b+32|0;if((f|0)!=(b|0)){continue}break}}b=pa(j,c,i);F[a+88>>2]=f;F[a+84>>2]=b;F[a+92>>2]=b+(e<<2);if(c){ja(c)}break b}na();v()}oa();v()}return}if(b>>>0>=d>>>0){break a}F[a+88>>2]=c+(b<<2)}}function ab(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=F[a+8>>2];e=F[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;g=b&7;if(g){while(1){F[d>>2]=F[c>>2];d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){F[d>>2]=F[c>>2];F[d+4>>2]=F[c>>2];F[d+8>>2]=F[c>>2];F[d+12>>2]=F[c>>2];F[d+16>>2]=F[c>>2];F[d+20>>2]=F[c>>2];F[d+24>>2]=F[c>>2];F[d+28>>2]=F[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}F[a+4>>2]=e;return}b:{i=F[a>>2];f=e-i>>2;h=f+b|0;if(h>>>0<1073741824){j=d-i|0;d=j>>>1|0;h=j>>>0>=2147483644?1073741823:d>>>0>h>>>0?d:h;if(h){if(h>>>0>=1073741824){break b}k=ka(h<<2)}f=(f<<2)+k|0;d=f;j=b&7;if(j){while(1){F[d>>2]=F[c>>2];d=d+4|0;g=g+1|0;if((j|0)!=(g|0)){continue}break}}g=(b<<2)+f|0;if((b-1&1073741823)>>>0>=7){while(1){F[d>>2]=F[c>>2];F[d+4>>2]=F[c>>2];F[d+8>>2]=F[c>>2];F[d+12>>2]=F[c>>2];F[d+16>>2]=F[c>>2];F[d+20>>2]=F[c>>2];F[d+24>>2]=F[c>>2];F[d+28>>2]=F[c>>2];d=d+32|0;if((g|0)!=(d|0)){continue}break}}if((e|0)!=(i|0)){while(1){f=f-4|0;e=e-4|0;F[f>>2]=F[e>>2];if((e|0)!=(i|0)){continue}break}}F[a+8>>2]=(h<<2)+k;F[a+4>>2]=g;F[a>>2]=f;if(i){ja(i)}return}na();v()}oa();v()}function Xb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=F[a+8>>2];e=F[a>>2];if(d-e>>2>>>0>=b>>>0){f=F[a+4>>2];h=f-e>>2;i=b>>>0>h>>>0?h:b;a:{if(!i){break a}d=e;g=i;j=g&7;if(j){while(1){F[d>>2]=F[c>>2];g=g-1|0;d=d+4|0;k=k+1|0;if((k|0)!=(j|0)){continue}break}}if(i>>>0<8){break a}while(1){F[d>>2]=F[c>>2];F[d+4>>2]=F[c>>2];F[d+8>>2]=F[c>>2];F[d+12>>2]=F[c>>2];F[d+16>>2]=F[c>>2];F[d+20>>2]=F[c>>2];F[d+24>>2]=F[c>>2];F[d+28>>2]=F[c>>2];d=d+32|0;g=g-8|0;if(g){continue}break}}if(b>>>0>h>>>0){b=(b-h<<2)+f|0;while(1){F[f>>2]=F[c>>2];f=f+4|0;if((b|0)!=(f|0)){continue}break}F[a+4>>2]=b;return}F[a+4>>2]=e+(b<<2);return}if(e){F[a+4>>2]=e;ja(e);F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;d=0}b:{if(b>>>0>=1073741824){break b}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:b>>>0>>0?e:b;if(d>>>0>=1073741824){break b}d=d<<2;e=ka(d);F[a>>2]=e;F[a+8>>2]=d+e;c=F[c>>2];d=e;g=b&7;if(g){while(1){F[d>>2]=c;d=d+4|0;f=f+1|0;if((g|0)!=(f|0)){continue}break}}e=e+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){F[d+28>>2]=c;F[d+24>>2]=c;F[d+20>>2]=c;F[d+16>>2]=c;F[d+12>>2]=c;F[d+8>>2]=c;F[d+4>>2]=c;F[d>>2]=c;d=d+32|0;if((e|0)!=(d|0)){continue}break}}F[a+4>>2]=e;return}na();v()}function Ka(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;f=(c>>>0)/3|0;j=F[(F[F[a+8>>2]+96>>2]+L(f,12)|0)+(c-L(f,3)<<2)>>2];a:{h=F[F[a+12>>2]+4>>2];e=F[h+4>>2];if((e|0)!=F[h+8>>2]){F[e>>2]=j;F[h+4>>2]=e+4;break a}b:{i=F[h>>2];f=e-i|0;g=f>>2;d=g+1|0;if(d>>>0<1073741824){k=g<<2;g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break b}f=ka(g<<2)}else{f=0}d=k+f|0;F[d>>2]=j;j=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;F[d>>2]=F[e>>2];if((e|0)!=(i|0)){continue}break}}F[h+8>>2]=f+(g<<2);F[h+4>>2]=j;F[h>>2]=d;if(i){ja(i)}break a}na();v()}oa();v()}c:{d:{h=F[a+4>>2];e=F[h+4>>2];e:{if((e|0)!=F[h+8>>2]){F[e>>2]=c;F[h+4>>2]=e+4;break e}i=F[h>>2];f=e-i|0;j=f>>2;d=j+1|0;if(d>>>0>=1073741824){break d}g=f>>>1|0;g=f>>>0>=2147483644?1073741823:d>>>0>>0?g:d;if(g){if(g>>>0>=1073741824){break c}f=ka(g<<2)}else{f=0}d=f+(j<<2)|0;F[d>>2]=c;c=d+4|0;if((e|0)!=(i|0)){while(1){d=d-4|0;e=e-4|0;F[d>>2]=F[e>>2];if((e|0)!=(i|0)){continue}break}}F[h+8>>2]=f+(g<<2);F[h+4>>2]=c;F[h>>2]=d;if(!i){break e}ja(i)}a=F[a+4>>2];F[F[a+12>>2]+(b<<2)>>2]=F[a+24>>2];F[a+24>>2]=F[a+24>>2]+1;return}na();v()}oa();v()}function pb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=d-c|0;if((h|0)<=0){return}a:{e=F[a+8>>2];i=F[a+4>>2];if((e-i|0)>=(h|0)){j=i-b|0;if((j|0)>=(h|0)){f=i;g=d;break a}f=i;g=c+j|0;if((g|0)!=(d|0)){e=g;while(1){D[f|0]=G[e|0];f=f+1|0;e=e+1|0;if((e|0)!=(d|0)){continue}break}}F[a+4>>2]=f;if((j|0)>0){break a}return}k=F[a>>2];g=(i-k|0)+h|0;if((g|0)>=0){j=b-k|0;f=e-k|0;e=f<<1;f=f>>>0>=1073741823?2147483647:e>>>0>g>>>0?e:g;if(f){e=ka(f)}else{e=0}g=j+e|0;if((c|0)!=(d|0)){g=la(g,c,h)+h|0}d=pa(e,k,j);c=i-b|0;b=pa(g,b,c);F[a+8>>2]=e+f;F[a+4>>2]=b+c;F[a>>2]=d;if(k){ja(k)}return}na();v()}e=f;d=e-h|0;if(i>>>0>d>>>0){while(1){D[e|0]=G[d|0];e=e+1|0;d=d+1|0;if(i>>>0>d>>>0){continue}break}}F[a+4>>2]=e;a=b+h|0;if((a|0)!=(f|0)){a=f-a|0;pa(f-a|0,b,a)}if((c|0)==(g|0)){return}f=(c^-1)+g|0;a=g-c&7;b:{if(!a){e=b;break b}d=0;e=b;while(1){D[e|0]=G[c|0];e=e+1|0;c=c+1|0;d=d+1|0;if((a|0)!=(d|0)){continue}break}}if(f>>>0<7){return}while(1){D[e|0]=G[c|0];D[e+1|0]=G[c+1|0];D[e+2|0]=G[c+2|0];D[e+3|0]=G[c+3|0];D[e+4|0]=G[c+4|0];D[e+5|0]=G[c+5|0];D[e+6|0]=G[c+6|0];D[e+7|0]=G[c+7|0];e=e+8|0;c=c+8|0;if((g|0)!=(c|0)){continue}break}}function la(a,b,c){var d=0,e=0,f=0;if(c>>>0>=512){Y(a|0,b|0,c|0);return a}e=a+c|0;a:{if(!((a^b)&3)){b:{if(!(a&3)){c=a;break b}if(!c){c=a;break b}c=a;while(1){D[c|0]=G[b|0];b=b+1|0;c=c+1|0;if(!(c&3)){break b}if(c>>>0>>0){continue}break}}d=e&-4;c:{if(d>>>0<64){break c}f=d+-64|0;if(f>>>0>>0){break c}while(1){F[c>>2]=F[b>>2];F[c+4>>2]=F[b+4>>2];F[c+8>>2]=F[b+8>>2];F[c+12>>2]=F[b+12>>2];F[c+16>>2]=F[b+16>>2];F[c+20>>2]=F[b+20>>2];F[c+24>>2]=F[b+24>>2];F[c+28>>2]=F[b+28>>2];F[c+32>>2]=F[b+32>>2];F[c+36>>2]=F[b+36>>2];F[c+40>>2]=F[b+40>>2];F[c+44>>2]=F[b+44>>2];F[c+48>>2]=F[b+48>>2];F[c+52>>2]=F[b+52>>2];F[c+56>>2]=F[b+56>>2];F[c+60>>2]=F[b+60>>2];b=b- -64|0;c=c- -64|0;if(f>>>0>=c>>>0){continue}break}}if(c>>>0>=d>>>0){break a}while(1){F[c>>2]=F[b>>2];b=b+4|0;c=c+4|0;if(d>>>0>c>>>0){continue}break}break a}if(e>>>0<4){c=a;break a}d=e-4|0;if(d>>>0>>0){c=a;break a}c=a;while(1){D[c|0]=G[b|0];D[c+1|0]=G[b+1|0];D[c+2|0]=G[b+2|0];D[c+3|0]=G[b+3|0];b=b+4|0;c=c+4|0;if(d>>>0>=c>>>0){continue}break}}if(c>>>0>>0){while(1){D[c|0]=G[b|0];b=b+1|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}}return a}function sd(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;F[a>>2]=8336;d=a+232|0;b=F[d+196>>2];if(b){F[d+200>>2]=b;ja(b)}c=F[d+184>>2];if(c){b=c;e=F[d+188>>2];if((b|0)!=(e|0)){while(1){b=e-12|0;f=F[b>>2];if(f){F[e-8>>2]=f;ja(f)}e=b;if((b|0)!=(c|0)){continue}break}b=F[d+184>>2]}F[d+188>>2]=c;ja(b)}b=F[d+156>>2];if(b){F[d+160>>2]=b;ja(b)}c=F[d+136>>2];F[d+136>>2]=0;if(c){e=c-4|0;b=F[e>>2];if(b){b=c+(b<<4)|0;while(1){b=b-16|0;if((c|0)!=(b|0)){continue}break}}ja(e)}td(a+216|0);b=F[a+196>>2];if(b){F[a+200>>2]=b;ja(b)}b=F[a+184>>2];if(b){F[a+188>>2]=b;ja(b)}b=F[a+172>>2];if(b){F[a+176>>2]=b;ja(b)}b=F[a+160>>2];if(b){F[a+164>>2]=b;ja(b)}b=F[a+144>>2];if(b){while(1){c=F[b>>2];ja(b);b=c;if(b){continue}break}}b=F[a+136>>2];F[a+136>>2]=0;if(b){ja(b)}b=F[a+120>>2];if(b){ja(b)}b=F[a+108>>2];if(b){ja(b)}b=F[a+96>>2];if(b){ja(b)}b=F[a+72>>2];if(b){F[a+76>>2]=b;ja(b)}b=F[a+60>>2];if(b){ja(b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}b=F[a+36>>2];if(b){F[a+40>>2]=b;ja(b)}b=F[a+24>>2];if(b){F[a+28>>2]=b;ja(b)}b=F[a+12>>2];if(b){F[a+16>>2]=b;ja(b)}b=F[a+8>>2];F[a+8>>2]=0;if(b){Za(b)}return a|0}function Fa(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;d=F[a+8>>2];e=F[a+4>>2];if(d-e>>2>>>0>=b>>>0){a:{if(!b){break a}d=e;f=b&7;if(f){while(1){F[d>>2]=F[c>>2];d=d+4|0;h=h+1|0;if((f|0)!=(h|0)){continue}break}}e=(b<<2)+e|0;if((b-1&1073741823)>>>0<7){break a}while(1){F[d>>2]=F[c>>2];F[d+4>>2]=F[c>>2];F[d+8>>2]=F[c>>2];F[d+12>>2]=F[c>>2];F[d+16>>2]=F[c>>2];F[d+20>>2]=F[c>>2];F[d+24>>2]=F[c>>2];F[d+28>>2]=F[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}F[a+4>>2]=e;return}b:{i=F[a>>2];j=e-i|0;f=j>>2;g=f+b|0;if(g>>>0<1073741824){d=d-i|0;e=d>>>1|0;g=d>>>0>=2147483644?1073741823:e>>>0>g>>>0?e:g;if(g){if(g>>>0>=1073741824){break b}k=ka(g<<2)}f=(f<<2)+k|0;d=f;e=b&7;if(e){while(1){F[d>>2]=F[c>>2];d=d+4|0;h=h+1|0;if((e|0)!=(h|0)){continue}break}}e=f+(b<<2)|0;if((b-1&1073741823)>>>0>=7){while(1){F[d>>2]=F[c>>2];F[d+4>>2]=F[c>>2];F[d+8>>2]=F[c>>2];F[d+12>>2]=F[c>>2];F[d+16>>2]=F[c>>2];F[d+20>>2]=F[c>>2];F[d+24>>2]=F[c>>2];F[d+28>>2]=F[c>>2];d=d+32|0;if((e|0)!=(d|0)){continue}break}}b=pa(k,i,j);F[a+4>>2]=e;F[a>>2]=b;F[a+8>>2]=b+(g<<2);if(i){ja(i)}return}na();v()}oa();v()}function Sb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(G[a+11|0]>>>7|0){d=F[a+4>>2]}else{d=G[a+11|0]&127}if(d>>>0>>0){h=Z-16|0;Z=h;b=b-d|0;if(b){g=G[a+11|0]>>>7|0?(F[a+8>>2]&2147483647)-1|0:10;if(G[a+11|0]>>>7|0){d=F[a+4>>2]}else{d=G[a+11|0]&127}i=d+b|0;if(g-d>>>0>>0){a:{e=Z-16|0;Z=e;c=i-g|0;if(c>>>0<=2147483631-g>>>0){if(G[a+11|0]>>>7|0){f=F[a>>2]}else{f=a}if(g>>>0<1073741799){F[e+12>>2]=g<<1;F[e>>2]=c+g;c=Z-16|0;Z=c;Z=c+16|0;c=e+12|0;c=F[(I[e>>2]>2]?c:e)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}sb(e,c);c=F[e>>2];if(d){db(c,f,d)}if((g|0)!=10){ja(f)}F[a>>2]=c;F[a+8>>2]=F[a+8>>2]&-2147483648|F[e+4>>2]&2147483647;F[a+8>>2]=F[a+8>>2]|-2147483648;Z=e+16|0;break a}za();v()}}f=d;if(G[a+11|0]>>>7|0){d=F[a>>2]}else{d=a}f=f+d|0;e=Z-16|0;Z=e;D[e+15|0]=0;while(1){if(b){D[f|0]=G[e+15|0];b=b-1|0;f=f+1|0;continue}break}Z=e+16|0;Ic(a,i);D[h+15|0]=0;D[d+i|0]=G[h+15|0]}Z=h+16|0;return}if(G[a+11|0]>>>7|0){d=F[a>>2]}else{d=a}f=Z-16|0;Z=f;Ic(a,b);D[f+15|0]=0;D[b+d|0]=G[f+15|0];Z=f+16|0}function Zc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=Z-16|0;Z=g;a:{b:{if(b){F[a+88>>2]=0;F[a+92>>2]=0;d=F[a+84>>2];F[a+84>>2]=0;if(d){ja(d)}F[a+76>>2]=0;F[a+80>>2]=0;d=F[a+72>>2];F[a+72>>2]=0;if(d){ja(d)}d=F[b>>2];c=F[b+4>>2];D[g+15|0]=0;Ea(a,c-d>>2,g+15|0);d=F[b+28>>2];c=F[b+24>>2];D[g+14|0]=0;Ea(a+12|0,d-c>>2,g+14|0);Xb(a+28|0,F[b+4>>2]-F[b>>2]>>2,10284);c=F[b+28>>2]-F[b+24>>2]|0;f=c>>2;e=F[a+52>>2];c:{if(f>>>0<=F[a+60>>2]-e>>2>>>0){break c}if((c|0)<0){break b}d=F[a+56>>2];c=ka(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;F[c>>2]=F[d>>2];if((d|0)!=(e|0)){continue}break}}F[a+60>>2]=f;F[a+56>>2]=h;F[a+52>>2]=c;if(!e){break c}ja(e)}c=F[b+28>>2]-F[b+24>>2]|0;f=c>>2;e=F[a+40>>2];d:{if(f>>>0<=F[a+48>>2]-e>>2>>>0){break d}if((c|0)<0){break a}d=F[a+44>>2];c=ka(c);f=c+(f<<2)|0;h=c+(d-e&-4)|0;c=h;if((d|0)!=(e|0)){while(1){c=c-4|0;d=d-4|0;F[c>>2]=F[d>>2];if((d|0)!=(e|0)){continue}break}}F[a+48>>2]=f;F[a+44>>2]=h;F[a+40>>2]=c;if(!e){break d}ja(e)}D[a+24|0]=1;F[a+64>>2]=b}Z=g+16|0;return}na();v()}na();v()}function nb(a,b){var c=0,d=0,e=0;c=(a|0)==(b|0);D[b+12|0]=c;a:{if(c){break a}while(1){d=F[b+8>>2];if(G[d+12|0]){break a}b:{c=F[d+8>>2];e=F[c>>2];if((e|0)==(d|0)){e=F[c+4>>2];if(!(!e|G[e+12|0])){break b}c:{if(F[d>>2]==(b|0)){b=d;break c}b=F[d+4>>2];a=F[b>>2];F[d+4>>2]=a;if(a){F[a+8>>2]=d;c=F[d+8>>2]}F[b+8>>2]=c;a=F[d+8>>2];F[((F[a>>2]!=(d|0))<<2)+a>>2]=b;F[b>>2]=d;F[d+8>>2]=b;c=F[b+8>>2];d=F[c>>2]}D[b+12|0]=1;D[c+12|0]=0;a=F[d+4>>2];F[c>>2]=a;if(a){F[a+8>>2]=c}F[d+8>>2]=F[c+8>>2];a=F[c+8>>2];F[((F[a>>2]!=(c|0))<<2)+a>>2]=d;F[d+4>>2]=c;F[c+8>>2]=d;return}if(!(G[e+12|0]|!e)){break b}d:{if(F[d>>2]!=(b|0)){b=d;break d}a=F[b+4>>2];F[d>>2]=a;if(a){F[a+8>>2]=d;c=F[d+8>>2]}F[b+8>>2]=c;a=F[d+8>>2];F[((F[a>>2]!=(d|0))<<2)+a>>2]=b;F[b+4>>2]=d;F[d+8>>2]=b;c=F[b+8>>2]}D[b+12|0]=1;D[c+12|0]=0;a=F[c+4>>2];b=F[a>>2];F[c+4>>2]=b;if(b){F[b+8>>2]=c}F[a+8>>2]=F[c+8>>2];b=F[c+8>>2];F[((F[b>>2]!=(c|0))<<2)+b>>2]=a;F[a>>2]=c;F[c+8>>2]=a;break a}D[d+12|0]=1;D[c+12|0]=(a|0)==(c|0);D[e+12|0]=1;b=c;if((c|0)!=(a|0)){continue}break}}}function mi(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{k:{if(b){if(!c){break k}if(!d){break j}e=O(d)-O(b)|0;if(e>>>0<=31){break i}break c}if((d|0)==1|d>>>0>1){break c}_=0;a=(a>>>0)/(c>>>0)|0;break a}if(!a){break h}if(!d|d-1&d){break g}a=b>>>ji(d)|0;_=0;break a}if(!(c-1&c)){break f}h=(O(c)+33|0)-O(b)|0;g=0-h|0;break d}h=e+1|0;g=63-e|0;break d}_=0;a=(b>>>0)/(d>>>0)|0;break a}e=O(d)-O(b)|0;if(e>>>0<31){break e}break c}if((c|0)==1){break b}d=ji(c);c=d&31;if((d&63)>>>0>=32){a=b>>>c|0}else{e=b>>>c|0;a=((1<>>c}_=e;break a}h=e+1|0;g=63-e|0}e=h&63;f=e&31;if(e>>>0>=32){e=0;i=b>>>f|0}else{e=b>>>f|0;i=((1<>>f}g=g&63;f=g&31;if(g>>>0>=32){b=a<>>32-f|b<>>31;e=i<<1|b>>>31;f=m-(j+(e>>>0>g>>>0)|0)>>31;k=c&f;i=e-k|0;e=j-((d&f)+(e>>>0>>0)|0)|0;b=b<<1|a>>>31;a=l|a<<1;l=f&1;h=h-1|0;if(h){continue}break}}_=b<<1|a>>>31;a=l|a<<1;break a}a=0;b=0}_=b}return a}function yh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;c=F[b+88>>2];if(!(!c|F[c>>2]!=1)){e=F[c+8>>2];F[a+4>>2]=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);f=a+8|0;d=G[b+24|0];h=F[a+8>>2];g=F[a+12>>2]-h>>2;a:{if(d>>>0>g>>>0){qa(f,d-g|0);d=G[b+24|0];e=F[c+8>>2];break a}if(d>>>0>=g>>>0){break a}F[a+12>>2]=h+(d<<2)}b:{if(!d){b=4;break b}h=d&3;f=F[f>>2];c:{if(d-1>>>0<3){b=4;d=0;break c}k=d&252;d=0;b=4;while(1){g=d<<2;c=b+e|0;F[g+f>>2]=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);F[f+(g|4)>>2]=G[c+4|0]|G[c+5|0]<<8|(G[c+6|0]<<16|G[c+7|0]<<24);F[f+(g|8)>>2]=G[c+8|0]|G[c+9|0]<<8|(G[c+10|0]<<16|G[c+11|0]<<24);F[f+(g|12)>>2]=G[c+12|0]|G[c+13|0]<<8|(G[c+14|0]<<16|G[c+15|0]<<24);d=d+4|0;b=b+16|0;i=i+4|0;if((k|0)!=(i|0)){continue}break}}if(!h){break b}while(1){c=b+e|0;F[f+(d<<2)>>2]=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);d=d+1|0;b=b+4|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}}d=a;a=b+e|0;F[d+20>>2]=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);d=1}return d|0}function Yg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;g=Z-16|0;Z=g;e=F[a+4>>2];d=F[e>>2];a:{b=F[a+12>>2];c=F[b+28>>2]-F[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=F[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=F[e+4>>2];c=ka(c);f=c+(f<<2)|0;h=c+(b-d&-4)|0;c=h;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[e+8>>2]=f;F[e+4>>2]=h;F[e>>2]=c;if(!d){break b}ja(d)}b=F[a+12>>2];c=F[b+28>>2];b=F[b+24>>2];F[g+12>>2]=0;b=c-b>>2;d=a+96|0;e=F[d>>2];c=F[a+100>>2]-e>>2;c:{if(b>>>0>c>>>0){Fa(d,b-c|0,g+12|0);break c}if(b>>>0>=c>>>0){break c}F[a+100>>2]=e+(b<<2)}e=a+8|0;b=F[a+116>>2];d:{if(b){d=F[b>>2];if((d|0)==F[b+4>>2]){c=1;break d}b=0;while(1){c=rd(e,F[(b<<2)+d>>2]);if(!c){break d}f=F[a+116>>2];d=F[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break d}c=1;a=F[a+12>>2];a=F[a+4>>2]-F[a>>2]|0;if(a>>>0<12){break d}a=(a>>2>>>0)/3|0;b=0;while(1){c=rd(e,L(b,3));if(!c){break d}b=b+1|0;if((a|0)!=(b|0)){continue}break}}Z=g+16|0;return c|0}na();v()}function md(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;a:{b:{c:{if(!b){if((d|0)<0){break a}f=F[a+4>>2];b=F[a>>2];d=f-b|0;if(c>>>0>d>>>0){g=c-d|0;e=F[a+8>>2];if(g>>>0<=e-f>>>0){i=a,j=ma(f,0,g)+g|0,F[i+4>>2]=j;break c}if((c|0)<0){break b}f=e-b|0;e=f<<1;f=f>>>0>=1073741823?2147483647:c>>>0>>0?e:c;e=ka(f);ma(e+d|0,0,g);d=pa(e,b,d);F[a+8>>2]=d+f;F[a+4>>2]=c+d;F[a>>2]=d;if(!b){break c}ja(b);break c}if(c>>>0>=d>>>0){break c}F[a+4>>2]=b+c;break c}if((d|0)<0){break a}e=F[a+4>>2];f=F[a>>2];g=e-f|0;d:{if((d|0)<=0&c>>>0<=g>>>0|(d|0)<0){break d}if(c>>>0>g>>>0){d=c-g|0;h=F[a+8>>2];if(d>>>0<=h-e>>>0){i=a,j=ma(e,0,d)+d|0,F[i+4>>2]=j;break d}if((c|0)<0){break b}e=h-f|0;h=e<<1;e=e>>>0>=1073741823?2147483647:c>>>0>>0?h:c;h=ka(e);ma(h+g|0,0,d);d=pa(h,f,g);F[a+8>>2]=d+e;F[a+4>>2]=c+d;F[a>>2]=d;if(!f){break d}ja(f);break d}if(c>>>0>=g>>>0){break d}F[a+4>>2]=c+f}if(!c){break c}pa(F[a>>2],b,c)}b=F[a+28>>2];c=F[a+24>>2]+1|0;b=c?b:b+1|0;F[a+24>>2]=c;F[a+28>>2]=b;g=1;break a}na();v()}return g}function Lg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;k=F[a+12>>2];c=F[a+68>>2];d=F[c+80>>2];D[b+84|0]=0;n=b+68|0;i=F[b+68>>2];e=F[b+72>>2]-i>>2;a:{if(e>>>0>>0){ab(n,d-e|0,9124);c=F[a+68>>2];d=F[c+80>>2];break a}if(d>>>0>=e>>>0){break a}F[b+72>>2]=i+(d<<2)}b=F[c+100>>2];e=F[c+96>>2];i=(b-e|0)/12|0;m=1;b:{if((b|0)==(e|0)){break b}k=F[k+28>>2];f=F[k>>2];if((f|0)==-1){return 0}o=i>>>0<=1?1:i;c=e;b=0;m=0;while(1){g=F[c>>2];if(g>>>0>=d>>>0){break b}j=F[F[a+72>>2]+12>>2];h=F[j+(f<<2)>>2];if(h>>>0>=d>>>0){break b}f=F[n>>2];F[f+(g<<2)>>2]=h;g=k+(l<<2)|0;h=F[g+4>>2];if((h|0)==-1){break b}l=F[c+4>>2];if(l>>>0>=d>>>0){break b}h=F[(h<<2)+j>>2];if(h>>>0>=d>>>0){break b}F[f+(l<<2)>>2]=h;g=F[g+8>>2];if((g|0)==-1){break b}c=F[c+8>>2];if(c>>>0>=d>>>0){break b}j=F[(g<<2)+j>>2];if(j>>>0>=d>>>0){break b}F[f+(c<<2)>>2]=j;b=b+1|0;m=i>>>0<=b>>>0;if((b|0)==(o|0)){break b}c=e+L(b,12)|0;l=L(b,3);f=F[k+(l<<2)>>2];if((f|0)!=-1){continue}break}}return m|0}function ag(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=F[d+80>>2];e=Z-48|0;Z=e;a=F[a+4>>2];m=a-2|0;a:{if(m>>>0>28){break a}j=F[F[d>>2]>>2]+F[d+48>>2]|0;F[e+16>>2]=a;a=-1<>2]=a^-1;a=-2-a|0;F[e+24>>2]=a;F[e+32>>2]=(a|0)/2;J[e+28>>2]=M(2)/M(a|0);f=F[c>>2];if((f|0)!=F[c+4>>2]){a=0;d=0;while(1){g=F[(d<<2)+f>>2];h=e+36|0;k=F[F[b>>2]>>2];l=F[b+48>>2];f=F[b+40>>2];i=F[b+44>>2];if(!G[b+84|0]){g=F[F[b+68>>2]+(g<<2)>>2]}g=ki(f,i,g,0);i=g;g=g+l|0;la(h,g+k|0,f);Kc(e+16|0,h,e+12|0,e+8|0);f=a<<2;F[f+j>>2]=F[e+12>>2];F[(f|4)+j>>2]=F[e+8>>2];a=a+2|0;d=d+1|0;f=F[c>>2];if(d>>>0>2]-f>>2>>>0){continue}break}break a}if(!h){break a}d=0;a=0;while(1){k=e+36|0;l=F[F[b>>2]>>2];i=F[b+48>>2];c=F[b+40>>2];f=ki(c,F[b+44>>2],G[b+84|0]?a:F[F[b+68>>2]+(a<<2)>>2],0);g=f;f=f+i|0;la(k,f+l|0,c);Kc(e+16|0,k,e+12|0,e+8|0);c=d<<2;F[c+j>>2]=F[e+12>>2];F[(c|4)+j>>2]=F[e+8>>2];d=d+2|0;a=a+1|0;if((h|0)!=(a|0)){continue}break}}Z=e+48|0;return m>>>0<29|0}function Zg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=F[a+12>>2];d=F[a+108>>2];e=F[d+80>>2];D[b+84|0]=0;m=b+68|0;h=F[b+68>>2];f=F[b+72>>2]-h>>2;a:{if(f>>>0>>0){ab(m,e-f|0,9124);d=F[a+108>>2];e=F[d+80>>2];break a}if(e>>>0>=f>>>0){break a}F[b+72>>2]=h+(e<<2)}b=F[d+100>>2];f=F[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=F[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=F[c>>2];if((i|0)==-1){break b}g=F[d>>2];if(g>>>0>=e>>>0){break b}l=F[F[a+112>>2]+12>>2];j=F[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=F[m>>2];F[i+(g<<2)>>2]=j;g=F[c+4>>2];if((g|0)==-1){break b}j=F[d+4>>2];if(j>>>0>=e>>>0){break b}g=F[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}F[i+(j<<2)>>2]=g;c=F[c+8>>2];if((c|0)==-1){break b}d=F[d+8>>2];if(d>>>0>=e>>>0){break b}c=F[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}F[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=L(b,3);d=f+L(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function xd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=M(0),j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;k=Z-16|0;Z=k;if(F[c+28>>2]==9){d=F[a+4>>2];h=G[c+24|0];e=h<<2;f=ka(e);l=k+8|0;F[l>>2]=1065353216;i=J[a+20>>2];d=-1<0){J[l>>2]=i/M(d|0)}o=(d|0)>0;a:{if(!o){break a}j=F[c+80>>2];if(!j){break a}if(h){p=F[F[b>>2]>>2]+F[b+48>>2]|0;t=h&254;u=h&1;b=0;while(1){m=F[a+8>>2];i=J[l>>2];d=0;n=0;if((h|0)!=1){while(1){g=d<<2;q=(b<<2)+p|0;J[g+f>>2]=M(i*M(F[q>>2]))+J[g+m>>2];g=g|4;J[g+f>>2]=M(i*M(F[q+4>>2]))+J[g+m>>2];d=d+2|0;b=b+2|0;n=n+2|0;if((t|0)!=(n|0)){continue}break}}if(u){d=d<<2;J[d+f>>2]=M(i*M(F[(b<<2)+p>>2]))+J[d+m>>2];b=b+1|0}la(F[F[c+64>>2]>>2]+r|0,f,e);r=e+r|0;s=s+1|0;if((s|0)!=(j|0)){continue}break}break a}b=0;if((j|0)!=1){a=j&-2;d=0;while(1){la(F[F[c+64>>2]>>2]+b|0,f,e);b=b+e|0;la(b+F[F[c+64>>2]>>2]|0,f,e);b=b+e|0;d=d+2|0;if((a|0)!=(d|0)){continue}break}}if(!(j&1)){break a}la(F[F[c+64>>2]>>2]+b|0,f,e)}ja(f)}Z=k+16|0;return o|0}function Rg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=F[a+12>>2];d=F[a+68>>2];e=F[d+80>>2];D[b+84|0]=0;m=b+68|0;h=F[b+68>>2];f=F[b+72>>2]-h>>2;a:{if(f>>>0>>0){ab(m,e-f|0,9124);d=F[a+68>>2];e=F[d+80>>2];break a}if(e>>>0>=f>>>0){break a}F[b+72>>2]=h+(e<<2)}b=F[d+100>>2];f=F[d+96>>2];h=(b-f|0)/12|0;k=1;b:{if((b|0)==(f|0)){break b}n=h>>>0<=1?1:h;o=F[c>>2];c=0;d=f;b=0;k=0;while(1){c=(c<<2)+o|0;i=F[c>>2];if((i|0)==-1){break b}g=F[d>>2];if(g>>>0>=e>>>0){break b}l=F[F[a+72>>2]+12>>2];j=F[l+(i<<2)>>2];if(j>>>0>=e>>>0){break b}i=F[m>>2];F[i+(g<<2)>>2]=j;g=F[c+4>>2];if((g|0)==-1){break b}j=F[d+4>>2];if(j>>>0>=e>>>0){break b}g=F[(g<<2)+l>>2];if(g>>>0>=e>>>0){break b}F[i+(j<<2)>>2]=g;c=F[c+8>>2];if((c|0)==-1){break b}d=F[d+8>>2];if(d>>>0>=e>>>0){break b}c=F[(c<<2)+l>>2];if(c>>>0>=e>>>0){break b}F[i+(d<<2)>>2]=c;b=b+1|0;k=h>>>0<=b>>>0;if((b|0)==(n|0)){break b}c=L(b,3);d=f+L(b,12)|0;if((b|0)!=1431655765){continue}break}}return k|0}function Na(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=Z-16|0;Z=d;a:{f=F[a+4>>2];b:{if(f>>>0>>0){e=b-f|0;c=F[a+8>>2];g=c<<5;c:{if(!(e>>>0>g>>>0|f>>>0>g-e>>>0)){F[a+4>>2]=b;h=f&31;b=F[a>>2]+(f>>>3&536870908)|0;break c}F[d+8>>2]=0;F[d>>2]=0;F[d+4>>2]=0;if((b|0)<0){break a}if(g>>>0<=1073741822){c=c<<6;b=b+31&-32;b=b>>>0>>0?c:b}else{b=2147483647}$a(d,b);f=F[a+4>>2];F[d+4>>2]=f+e;i=F[a>>2];b=F[d>>2];d:{if((f|0)<=0){break d}c=f>>>5|0;if(f>>>0>=32){pa(b,i,c<<2)}g=c<<2;b=g+b|0;h=f&31;if(h){c=-1>>>32-h|0;F[b>>2]=F[b>>2]&(c^-1)|F[i+g>>2]&c}i=F[a>>2]}F[a>>2]=F[d>>2];F[d>>2]=i;c=F[a+4>>2];F[a+4>>2]=F[d+4>>2];F[d+4>>2]=c;c=F[a+8>>2];F[a+8>>2]=F[d+8>>2];F[d+8>>2]=c;if(!i){break c}ja(i)}if(!e){break b}if(h){c=32-h|0;a=c>>>0>>0?c:e;F[b>>2]=F[b>>2]&(-1<>>c-a^-1);e=e-a|0;b=b+4|0}a=e>>>5|0;if(e>>>0>=32){ma(b,0,a<<2)}if((e&-32)==(e|0)){break b}a=(a<<2)+b|0;F[a>>2]=F[a>>2]&(-1>>>32-(e&31)^-1);break b}F[a+4>>2]=b}Z=d+16|0;return}na();v()}function Aa(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;i=Z-16|0;Z=i;f=F[b+20>>2];h=F[b+12>>2];c=F[b+16>>2];a:{if((f|0)>=(h|0)&c>>>0>=I[b+8>>2]|(f|0)>(h|0)){break a}D[a+12|0]=G[c+F[b>>2]|0];c=F[b+20>>2];f=F[b+16>>2]+1|0;c=f?c:c+1|0;F[b+16>>2]=f;F[b+20>>2]=c;if(!Qd(1,i+12|0,b)){break a}h=F[b+8>>2];f=F[b+16>>2];g=h-f|0;c=F[i+12>>2];d=f>>>0>h>>>0;h=F[b+20>>2];e=F[b+12>>2]-(d+h|0)|0;if(g>>>0>>0&(e|0)<=0|(e|0)<0|(c|0)<=0){break a}g=f+F[b>>2]|0;F[a>>2]=g;b:{c:{e=c-1|0;j=e+g|0;d=G[j|0];d:{if(d>>>0<=63){F[a+4>>2]=e;d=G[j|0]&63;break d}e:{switch((d>>>6|0)-1|0){case 1:break c;case 0:break e;default:break a}}if(c>>>0<2){break a}e=c-2|0;F[a+4>>2]=e;g=g+e|0;d=G[g+1|0]<<8&16128|G[g|0]}F[a+8>>2]=d+4096;break b}if(c>>>0<3){break a}e=c-3|0;F[a+4>>2]=e;d=a;a=g+e|0;a=G[a+1|0]<<8|G[a+2|0]<<16&4128768|G[a|0];F[d+8>>2]=a+4096;if(a>>>0>1044479){break a}}a=h;d=c;c=c+f|0;a=d>>>0>c>>>0?a+1|0:a;F[b+16>>2]=c;F[b+20>>2]=a;k=1}Z=i+16|0;return k}function qd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;e=F[a+12>>2];i=F[a+8>>2];d=e-i>>2;b=G[b+24|0];a:{if(d>>>0>>0){qa(a+8|0,b-d|0);i=F[a+8>>2];e=F[a+12>>2];break a}if(b>>>0>=d>>>0){break a}e=(b<<2)+i|0;F[a+12>>2]=e}b=0;f=F[c+8>>2];h=F[c+12>>2];j=F[c+20>>2];e=e-i|0;d=F[c+16>>2];g=e+d|0;j=e>>>0>g>>>0?j+1|0:j;b:{if(f>>>0>>0&(h|0)<=(j|0)|(h|0)<(j|0)){break b}la(i,d+F[c>>2]|0,e);d=F[c+20>>2];g=e;e=e+F[c+16>>2]|0;d=g>>>0>e>>>0?d+1|0:d;F[c+16>>2]=e;F[c+20>>2]=d;f=F[c+8>>2];h=F[c+12>>2];g=e+4|0;d=g>>>0<4?d+1|0:d;if(f>>>0>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break b}d=e+F[c>>2]|0;F[a+20>>2]=G[d|0]|G[d+1|0]<<8|(G[d+2|0]<<16|G[d+3|0]<<24);d=F[c+20>>2];g=d;f=d;e=F[c+16>>2];d=e+4|0;f=d>>>0<4?f+1|0:f;F[c+16>>2]=d;F[c+20>>2]=f;h=F[c+12>>2];if((f|0)>=(h|0)&d>>>0>=I[c+8>>2]|(f|0)>(h|0)){break b}f=G[d+F[c>>2]|0];d=g;e=e+5|0;d=e>>>0<5?d+1|0:d;F[c+16>>2]=e;F[c+20>>2]=d;if(f-1>>>0>29){break b}F[a+4>>2]=f;b=1}return b|0}function Kc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=+J[b>>2];k=+J[b+4>>2];l=+J[b+8>>2];g=N(j)+N(k)+N(l);a:{if(!(g>1e-6)){j=1;k=0;e=0;break a}g=1/g;k=g*k;j=g*j;e=g*l<0}h=F[a+16>>2];l=+(h|0);g=R(j*l+.5);b:{if(N(g)<2147483648){m=~~g;break b}m=-2147483648}f=m>>31;i=(f^m)-f|0;g=R(k*l+.5);c:{if(N(g)<2147483648){f=~~g;break c}f=-2147483648}b=f>>31;b=h-(i+((f^b)-b|0)|0)|0;i=(b|0)>0?b:0;e=e?0-i|0:i;f=f+(b>>31&((f|0)>0?b:0-b|0))|0;d:{if((m|0)>=0){b=e+h|0;a=F[a+8>>2];e=h+f|0;break d}b=f>>31;b=(b^f)-b|0;a=F[a+8>>2];b=(e|0)<0?b:a-b|0;e=(f|0)<0?i:a-i|0}e:{if(!(b|e)){b=a;break e}if(!((a|0)!=(b|0)|e)){b=a;break e}if(!((a|0)!=(e|0)|b)){b=a;break e}if(!((b|0)<=(h|0)|e)){b=(h<<1)-b|0;a=0;break e}if(!((a|0)!=(e|0)|(b|0)>=(h|0))){b=(h<<1)-b|0;break e}if(!((a|0)!=(b|0)|(e|0)>=(h|0))){b=a;a=(h<<1)-e|0;break e}if(b){a=e;break e}b=0;if((e|0)<=(h|0)){a=e;break e}a=(h<<1)-e|0}F[c>>2]=a;F[d>>2]=b}function ye(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;a:{if(!$c(a,b)){break a}h=a+36|0;g=$[F[F[a>>2]+24>>2]](a)|0;e=F[a+40>>2];d=F[a+36>>2];c=e-d>>2;b:{if(g>>>0>c>>>0){Pb(h,g-c|0);break b}if(c>>>0<=g>>>0){break b}d=d+(g<<2)|0;if((d|0)!=(e|0)){while(1){e=e-4|0;c=F[e>>2];F[e>>2]=0;if(c){$[F[F[c>>2]+4>>2]](c)}if((d|0)!=(e|0)){continue}break}}F[a+40>>2]=d}c=1;if((g|0)<=0){break a}e=0;while(1){c:{c=F[b+20>>2];f=F[b+12>>2];d=F[b+16>>2];if((c|0)>=(f|0)&d>>>0>=I[b+8>>2]|(c|0)>(f|0)){break c}f=G[F[b>>2]+d|0];d=d+1|0;c=d?c:c+1|0;F[b+16>>2]=d;F[b+20>>2]=c;d=$[F[F[a>>2]+48>>2]](a,f)|0;f=e<<2;i=f+F[a+36>>2]|0;c=F[i>>2];F[i>>2]=d;if(c){$[F[F[c>>2]+4>>2]](c)}c=F[F[h>>2]+f>>2];if(!c){break c}if(!(k=c,l=$[F[F[a>>2]+28>>2]](a)|0,m=$[F[F[a>>2]+20>>2]](a,e)|0,j=F[F[c>>2]+8>>2],$[j](k|0,l|0,m|0)|0)){break c}c=1;e=e+1|0;if((g|0)!=(e|0)){continue}break a}break}c=0}return c|0}function Xc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;g=F[a>>2];c=g+(b>>>3&536870908)|0;F[c>>2]=F[c>>2]|1<>2];e=(b|0)==-1;d=-1;a:{if(e){break a}c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;d=-1;if((c|0)==-1){break a}d=F[F[f>>2]+(c<<2)>>2]}c=F[a+12>>2];h=(d>>>3&536870908)+c|0;F[h>>2]=F[h>>2]|1<>>0)%3|0){e=b-1|0;break e}e=b+2|0;d=-1;if((e|0)==-1){break d}}d=F[F[f>>2]+(e<<2)>>2]}e=(d>>>3&536870908)+c|0;F[e>>2]=F[e>>2]|1<>2]+(b<<2)>>2];if((b|0)==-1){break b}D[a+24|0]=0;a=(b>>>3&536870908)+g|0;F[a>>2]=F[a>>2]|1<>>0)%3|0?a:b-2|0;if((a|0)!=-1){d=F[F[f>>2]+(a<<2)>>2]}a=c+(d>>>3&536870908)|0;F[a>>2]=F[a>>2]|1<>>0)%3|0){b=b-1|0;break g}b=b+2|0;a=-1;if((b|0)==-1){break f}}a=F[F[f>>2]+(b<<2)>>2]}b=1<>>3&536870908)|0;c=F[a>>2];break c}a=c+536870908|0;b=F[c+536870908>>2];c=-2147483648}F[a>>2]=b|c}}function zc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=M(0),f=M(0),g=M(0),h=M(0),i=M(0),j=0,k=M(0),l=M(0),m=M(0),n=M(0),o=0;a:{if(F[c+28>>2]!=9|G[c+24|0]!=3){break a}a=F[a+4>>2];if(a-2>>>0>28){break a}o=1;j=F[c+80>>2];if(!j){break a}k=M(M(2)/M((1<>2]>>2]+F[c+48>>2]|0;a=F[F[b>>2]>>2]+F[b+48>>2]|0;b=0;while(1){g=M(0);l=M(0);m=M(0);e=M(M(M(F[a>>2])*k)+M(-1));f=M(M(M(F[a+4>>2])*k)+M(-1));i=M(M(M(1)-M(N(e)))-M(N(f)));h=M(Q(M(-i),M(0)));n=M(-h);f=M(f+(f>>8;D[c+10|0]=d>>>16;D[c+11|0]=d>>>24;d=(w(l),y(2));D[c+4|0]=d;D[c+5|0]=d>>>8;D[c+6|0]=d>>>16;D[c+7|0]=d>>>24;d=(w(g),y(2));D[c|0]=d;D[c+1|0]=d>>>8;D[c+2|0]=d>>>16;D[c+3|0]=d>>>24;c=c+12|0;b=b+1|0;if((j|0)!=(b|0)){continue}break}}return o|0}function Md(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;g=Z-16|0;Z=g;a:{if(!Sa(1,g+8|0,b)){break a}d=F[b+8>>2];e=F[b+16>>2];f=d-e|0;h=F[g+12>>2];c=d>>>0>>0;d=F[b+20>>2];i=F[b+12>>2]-(c+d|0)|0;c=F[g+8>>2];if((h|0)==(i|0)&c>>>0>f>>>0|h>>>0>i>>>0){break a}d=d+h|0;f=c+e|0;d=f>>>0>>0?d+1|0:d;F[b+16>>2]=f;F[b+20>>2]=d;if((c|0)<=0){break a}b=F[b>>2]+e|0;F[a+40>>2]=b;e=c-1|0;d=b+e|0;f=G[d|0];b:{if(f>>>0<=63){F[a+44>>2]=e;b=G[d|0]&63;break b}c:{switch((f>>>6|0)-1|0){case 0:if(c>>>0<2){break a}c=c-2|0;F[a+44>>2]=c;b=b+c|0;b=G[b+1|0]<<8&16128|G[b|0];break b;case 1:if(c>>>0<3){break a}c=c-3|0;F[a+44>>2]=c;b=b+c|0;b=G[b+1|0]<<8|G[b+2|0]<<16&4128768|G[b|0];break b;default:break c}}c=c-4|0;F[a+44>>2]=c;b=b+c|0;b=(G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24))&1073741823}F[a+48>>2]=b+16384;j=b>>>0<4177920}Z=g+16|0;return j}function Tf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a:{a=Z-32|0;Z=a;e=ya(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=ka(g);F[a+24>>2]=g|-2147483648;F[a+16>>2]=f;F[a+20>>2]=e;g=e+f|0;break c}D[a+27|0]=e;f=a+16|0;g=e+f|0;if(!e){break b}}la(f,c,e)}D[g|0]=0;F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;d:{c=Ya(b,a+16|0);if((c|0)==(b+4|0)){break d}b=F[c+28>>2];e=F[c+32>>2];if((b|0)==(e|0)){break d}b=e-b|0;if(b&3){break d}e=b>>>2|0;f=F[a+4>>2];b=F[a>>2];g=f-b>>2;e:{if(e>>>0>g>>>0){qa(a,e-g|0);b=F[a>>2];f=F[a+4>>2];break e}if(e>>>0>=g>>>0){break e}f=(e<<2)+b|0;F[a+4>>2]=f}if((b|0)!=(f|0)){e=b;b=F[c+28>>2];la(e,b,F[c+32>>2]-b|0);break d}ta();v()}b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d>>2]=F[a>>2];F[d+4>>2]=F[a+4>>2];F[d+8>>2]=F[a+8>>2];if(D[a+27|0]<0){ja(F[a+16>>2])}Z=a+32|0;break a}za();v()}}function ud(a){a=a|0;var b=0,c=0,d=0,e=0;F[a>>2]=8284;d=F[a+368>>2];F[a+368>>2]=0;if(d){e=d-4|0;b=F[e>>2];if(b){c=(b<<4)+d|0;while(1){c=c-16|0;if((d|0)!=(c|0)){continue}break}}ja(e)}td(a+216|0);b=F[a+196>>2];if(b){F[a+200>>2]=b;ja(b)}b=F[a+184>>2];if(b){F[a+188>>2]=b;ja(b)}b=F[a+172>>2];if(b){F[a+176>>2]=b;ja(b)}b=F[a+160>>2];if(b){F[a+164>>2]=b;ja(b)}c=F[a+144>>2];if(c){while(1){b=F[c>>2];ja(c);c=b;if(b){continue}break}}b=F[a+136>>2];F[a+136>>2]=0;if(b){ja(b)}b=F[a+120>>2];if(b){ja(b)}b=F[a+108>>2];if(b){ja(b)}b=F[a+96>>2];if(b){ja(b)}b=F[a+72>>2];if(b){F[a+76>>2]=b;ja(b)}b=F[a+60>>2];if(b){ja(b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}b=F[a+36>>2];if(b){F[a+40>>2]=b;ja(b)}b=F[a+24>>2];if(b){F[a+28>>2]=b;ja(b)}b=F[a+12>>2];if(b){F[a+16>>2]=b;ja(b)}b=F[a+8>>2];F[a+8>>2]=0;if(b){Za(b)}return a|0}function Vf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=Z-16|0;Z=d;a:{e=ya(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=ka(f);F[d+8>>2]=f|-2147483648;F[d>>2]=a;F[d+4>>2]=e;f=a+e|0;break c}D[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}la(a,c,e)}D[f|0]=0;c=G[d+11|0];e=c<<24>>24;b=F[b+4>>2];a=0;d:{if(!b){break d}a=c;c=(e|0)<0;a=c?F[d+4>>2]:a;f=c?F[d>>2]:d;while(1){c=G[b+27|0];g=c<<24>>24<0;c=g?F[b+20>>2]:c;i=c>>>0>>0;e:{f:{g:{h:{i:{j:{h=i?c:a;if(h){g=g?F[b+16>>2]:b+16|0;j=sa(f,g,h);if(j){break j}if(a>>>0>=c>>>0){break i}break e}if(a>>>0>=c>>>0){break h}break e}if((j|0)<0){break e}}c=sa(g,f,h);if(c){break g}}if(i){break f}a=1;break d}if((c|0)<0){break f}a=1;break d}b=b+4|0}b=F[b>>2];if(b){continue}break}a=0}if((e|0)<0){ja(F[d>>2])}Z=d+16|0;break a}za();v()}return a|0}function lc(a,b){var c=0,d=0;c=F[b+8>>2];F[a+4>>2]=F[b+4>>2];F[a+8>>2]=c;F[a+20>>2]=F[b+20>>2];c=F[b+16>>2];F[a+12>>2]=F[b+12>>2];F[a+16>>2]=c;a:{b:{if((a|0)!=(b|0)){c=F[b+28>>2];if(c){d=F[a+24>>2];if(F[a+32>>2]<<5>>>0>>0){if(d){ja(d);F[a+32>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;c=F[b+28>>2]}if((c|0)<0){break b}c=(c-1>>>5|0)+1|0;d=ka(c<<2);F[a+32>>2]=c;F[a+28>>2]=0;F[a+24>>2]=d;c=F[b+28>>2]}pa(d,F[b+24>>2],(c-1>>>3&536870908)+4|0);c=F[b+28>>2]}else{c=0}F[a+28>>2]=c;c=F[b+40>>2];if(c){d=F[a+36>>2];if(F[a+44>>2]<<5>>>0>>0){if(d){ja(d);F[a+44>>2]=0;F[a+36>>2]=0;F[a+40>>2]=0;c=F[b+40>>2]}if((c|0)<0){break a}c=(c-1>>>5|0)+1|0;d=ka(c<<2);F[a+44>>2]=c;F[a+40>>2]=0;F[a+36>>2]=d;c=F[b+40>>2]}pa(d,F[b+36>>2],(c-1>>>3&536870908)+4|0);b=F[b+40>>2]}else{b=0}F[a+40>>2]=b}return}na();v()}na();v()}function nc(a){var b=0,c=0,d=0;b=F[a+8>>2];d=F[a>>2];a:{if(G[a+12|0]){b:{c:{d:{e:{if((b|0)==-1){break e}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;if((b|0)==-1){break e}b=F[F[d+12>>2]+(b<<2)>>2];if((b|0)!=-1){break d}}F[a+8>>2]=-1;break c}c=b+1|0;b=(c>>>0)%3|0?c:b-2|0;F[a+8>>2]=b;if((b|0)!=-1){break b}}c=F[a+4>>2];b=-1;f:{if((c|0)==-1){break f}g:{if((c>>>0)%3|0){c=c-1|0;break g}c=c+2|0;b=-1;if((c|0)==-1){break f}}c=F[F[d+12>>2]+(c<<2)>>2];b=-1;if((c|0)==-1){break f}b=c-1|0;if((c>>>0)%3|0){break f}b=c+2|0}D[a+12|0]=0;F[a+8>>2]=b;return}if((b|0)!=F[a+4>>2]){break a}F[a+8>>2]=-1;return}c=-1;h:{if((b|0)==-1){break h}i:{if((b>>>0)%3|0){b=b-1|0;break i}b=b+2|0;c=-1;if((b|0)==-1){break h}}b=F[F[d+12>>2]+(b<<2)>>2];c=-1;if((b|0)==-1){break h}c=b-1|0;if((b>>>0)%3|0){break h}c=b+2|0}F[a+8>>2]=c}}function Od(a){var b=0,c=0,d=0;b=ka(32);D[b+26|0]=0;c=G[1475]|G[1476]<<8;D[b+24|0]=c;D[b+25|0]=c>>>8;c=G[1471]|G[1472]<<8|(G[1473]<<16|G[1474]<<24);d=G[1467]|G[1468]<<8|(G[1469]<<16|G[1470]<<24);D[b+16|0]=d;D[b+17|0]=d>>>8;D[b+18|0]=d>>>16;D[b+19|0]=d>>>24;D[b+20|0]=c;D[b+21|0]=c>>>8;D[b+22|0]=c>>>16;D[b+23|0]=c>>>24;c=G[1463]|G[1464]<<8|(G[1465]<<16|G[1466]<<24);d=G[1459]|G[1460]<<8|(G[1461]<<16|G[1462]<<24);D[b+8|0]=d;D[b+9|0]=d>>>8;D[b+10|0]=d>>>16;D[b+11|0]=d>>>24;D[b+12|0]=c;D[b+13|0]=c>>>8;D[b+14|0]=c>>>16;D[b+15|0]=c>>>24;c=G[1455]|G[1456]<<8|(G[1457]<<16|G[1458]<<24);d=G[1451]|G[1452]<<8|(G[1453]<<16|G[1454]<<24);D[b|0]=d;D[b+1|0]=d>>>8;D[b+2|0]=d>>>16;D[b+3|0]=d>>>24;D[b+4|0]=c;D[b+5|0]=c>>>8;D[b+6|0]=c>>>16;D[b+7|0]=c>>>24;F[a>>2]=-1;ra(a+4|0,b,26);ja(b)}function Kg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=F[a+4>>2];d=F[e>>2];a:{b=F[a+12>>2];c=F[b+56>>2]-F[b+52>>2]|0;f=c>>2;b:{if(f>>>0<=F[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=F[e+4>>2];c=ka(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[e+8>>2]=f;F[e+4>>2]=g;F[e>>2]=c;if(!d){break b}ja(d)}e=a+8|0;b=F[a+76>>2];c:{if(b){d=F[b>>2];if((d|0)==F[b+4>>2]){return 1}b=0;while(1){c=od(e,F[(b<<2)+d>>2]);if(!c){break c}f=F[a+76>>2];d=F[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=F[F[a+12>>2]+64>>2];a=F[a+4>>2]-F[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=od(e,L(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}na();v()}function Qg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;e=F[a+4>>2];d=F[e>>2];a:{b=F[a+12>>2];c=F[b+28>>2]-F[b+24>>2]|0;f=c>>2;b:{if(f>>>0<=F[e+8>>2]-d>>2>>>0){break b}if((c|0)<0){break a}b=F[e+4>>2];c=ka(c);f=c+(f<<2)|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[e+8>>2]=f;F[e+4>>2]=g;F[e>>2]=c;if(!d){break b}ja(d)}e=a+8|0;b=F[a+76>>2];c:{if(b){d=F[b>>2];if((d|0)==F[b+4>>2]){return 1}b=0;while(1){c=pd(e,F[(b<<2)+d>>2]);if(!c){break c}f=F[a+76>>2];d=F[f>>2];b=b+1|0;if(b>>>0>2]-d>>2>>>0){continue}break}break c}c=1;a=F[a+12>>2];a=F[a+4>>2]-F[a>>2]|0;if(a>>>0<12){break c}a=(a>>2>>>0)/3|0;b=0;while(1){c=pd(e,L(b,3));if(!c){break c}b=b+1|0;if((a|0)!=(b|0)){continue}break}}return c|0}na();v()}function pa(a,b,c){var d=0,e=0;a:{if((a|0)==(b|0)){break a}e=a+c|0;if(b-e>>>0<=0-(c<<1)>>>0){return la(a,b,c)}d=(a^b)&3;b:{c:{if(a>>>0>>0){if(d){d=a;break b}if(!(a&3)){d=a;break c}d=a;while(1){if(!c){break a}D[d|0]=G[b|0];b=b+1|0;c=c-1|0;d=d+1|0;if(d&3){continue}break}break c}d:{if(d){break d}if(e&3){while(1){if(!c){break a}c=c-1|0;d=c+a|0;D[d|0]=G[b+c|0];if(d&3){continue}break}}if(c>>>0<=3){break d}while(1){c=c-4|0;F[c+a>>2]=F[b+c>>2];if(c>>>0>3){continue}break}}if(!c){break a}while(1){c=c-1|0;D[c+a|0]=G[b+c|0];if(c){continue}break}break a}if(c>>>0<=3){break b}while(1){F[d>>2]=F[b>>2];b=b+4|0;d=d+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}while(1){D[d|0]=G[b|0];d=d+1|0;b=b+1|0;c=c-1|0;if(c){continue}break}}return a}function Pb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;d=F[a+8>>2];c=F[a+4>>2];if(d-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ma(c,0,b)+b|0}F[a+4>>2]=c;return}a:{b:{c:{g=F[a>>2];f=c-g>>2;e=f+b|0;if(e>>>0<1073741824){d=d-g|0;h=d>>>1|0;e=d>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break c}i=ka(e<<2)}d=(f<<2)+i|0;f=b<<2;b=ma(d,0,f);f=b+f|0;e=(e<<2)+i|0;if((c|0)==(g|0)){break b}while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;d=d-4|0;F[d>>2]=b;if((c|0)!=(g|0)){continue}break}F[a+8>>2]=e;b=F[a+4>>2];F[a+4>>2]=f;c=F[a>>2];F[a>>2]=d;if((b|0)==(c|0)){break a}while(1){b=b-4|0;a=F[b>>2];F[b>>2]=0;if(a){$[F[F[a>>2]+4>>2]](a)}if((b|0)!=(c|0)){continue}break}break a}na();v()}oa();v()}F[a+8>>2]=e;F[a+4>>2]=f;F[a>>2]=b}if(c){ja(c)}}function Yd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;e=F[b+8>>2];d=F[b+12>>2];g=d;d=F[b+20>>2];k=d;h=F[b+16>>2];c=h+4|0;d=c>>>0<4?d+1|0:d;i=c;a:{if(c>>>0>e>>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}j=F[b>>2];c=j+h|0;f=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);F[b+16>>2]=i;F[b+20>>2]=d;c=e;e=k;d=h+8|0;e=d>>>0<8?e+1|0:e;if(c>>>0>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break a}c=i+j|0;c=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);F[b+16>>2]=d;F[b+20>>2]=e;if((c|0)<(f|0)){break a}F[a+16>>2]=c;F[a+12>>2]=f;d=(c>>31)-((f>>31)+(c>>>0>>0)|0)|0;e=c-f|0;if(!d&e>>>0>2147483646|d){break a}d=e+1|0;F[a+20>>2]=d;e=d>>>1|0;F[a+24>>2]=e;F[a+28>>2]=0-e;if(!(d&1)){F[a+24>>2]=e-1}l=Aa(a+112|0,b)}return l|0}function Wc(a,b){var c=0,d=0,e=0,f=0;d=-1;e=-1;f=-1;a:{b:{if((b|0)==-1){break b}e=F[F[F[a+4>>2]+12>>2]+(b<<2)>>2];c=b+1|0;c=(c>>>0)%3|0?c:b-2|0;if((c|0)>=0){f=(c>>>0)/3|0;f=F[(F[F[a>>2]+96>>2]+L(f,12)|0)+(c-L(f,3)<<2)>>2]}c:{if((e|0)==-1){break c}c=((e>>>0)%3|0?-1:2)+e|0;if((c|0)<0){break c}d=(c>>>0)/3|0;d=F[(F[F[a>>2]+96>>2]+L(d,12)|0)+(c-L(d,3)<<2)>>2]}c=-1;if((d|0)!=(f|0)){break a}f=-1;d:{b=((b>>>0)%3|0?-1:2)+b|0;if((b|0)>=0){d=(b>>>0)/3|0;d=F[(F[F[a>>2]+96>>2]+L(d,12)|0)+(b-L(d,3)<<2)>>2];if((e|0)==-1){break b}break d}d=-1;if((e|0)!=-1){break d}break b}b=e+1|0;b=(b>>>0)%3|0?b:e-2|0;if((b|0)<0){break b}c=F[F[a>>2]+96>>2];a=(b>>>0)/3|0;f=F[(c+L(a,12)|0)+(b-L(a,3)<<2)>>2]}c=(d|0)!=(f|0)?-1:e}return c}function Fc(a,b){var c=0,d=0,e=0;c=Z+-64|0;Z=c;d=F[a>>2];e=F[d-4>>2];d=F[d-8>>2];F[c+32>>2]=0;F[c+36>>2]=0;F[c+40>>2]=0;F[c+44>>2]=0;F[c+48>>2]=0;F[c+52>>2]=0;D[c+55|0]=0;D[c+56|0]=0;D[c+57|0]=0;D[c+58|0]=0;D[c+59|0]=0;D[c+60|0]=0;D[c+61|0]=0;D[c+62|0]=0;F[c+24>>2]=0;F[c+28>>2]=0;F[c+20>>2]=0;F[c+16>>2]=11020;F[c+12>>2]=a;F[c+8>>2]=b;a=a+d|0;d=0;a:{if(La(e,b,0)){F[c+56>>2]=1;$[F[F[e>>2]+20>>2]](e,c+8|0,a,a,1,0);d=F[c+32>>2]==1?a:0;break a}$[F[F[e>>2]+24>>2]](e,c+8|0,a,1,0);b:{switch(F[c+44>>2]){case 0:d=F[c+48>>2]==1?F[c+36>>2]==1?F[c+40>>2]==1?F[c+28>>2]:0:0:0;break a;case 1:break b;default:break a}}if(F[c+32>>2]!=1){if(F[c+48>>2]|F[c+36>>2]!=1|F[c+40>>2]!=1){break a}}d=F[c+24>>2]}Z=c- -64|0;return d}function ma(a,b,c){var d=0,e=0,f=0,g=0;a:{if(!c){break a}D[a|0]=b;d=a+c|0;D[d-1|0]=b;if(c>>>0<3){break a}D[a+2|0]=b;D[a+1|0]=b;D[d-3|0]=b;D[d-2|0]=b;if(c>>>0<7){break a}D[a+3|0]=b;D[d-4|0]=b;if(c>>>0<9){break a}d=0-a&3;e=d+a|0;b=L(b&255,16843009);F[e>>2]=b;d=c-d&-4;c=d+e|0;F[c-4>>2]=b;if(d>>>0<9){break a}F[e+8>>2]=b;F[e+4>>2]=b;F[c-8>>2]=b;F[c-12>>2]=b;if(d>>>0<25){break a}F[e+24>>2]=b;F[e+20>>2]=b;F[e+16>>2]=b;F[e+12>>2]=b;F[c-16>>2]=b;F[c-20>>2]=b;F[c-24>>2]=b;F[c-28>>2]=b;g=e&4|24;c=d-g|0;if(c>>>0<32){break a}d=ki(b,0,1,1);f=_;b=e+g|0;while(1){F[b+24>>2]=d;F[b+28>>2]=f;F[b+16>>2]=d;F[b+20>>2]=f;F[b+8>>2]=d;F[b+12>>2]=f;F[b>>2]=d;F[b+4>>2]=f;b=b+32|0;c=c-32|0;if(c>>>0>31){continue}break}}return a}function ie(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=F[b+8>>2];e=F[b+12>>2];g=e;e=F[b+20>>2];k=e;h=F[b+16>>2];c=h+4|0;e=c>>>0<4?e+1|0:e;i=c;a:{if(c>>>0>d>>>0&(e|0)>=(g|0)|(e|0)>(g|0)){break a}j=F[b>>2];c=j+h|0;f=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);F[b+16>>2]=i;F[b+20>>2]=e;c=d;d=k;e=h+8|0;d=e>>>0<8?d+1|0:d;if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}c=i+j|0;c=G[c|0]|G[c+1|0]<<8|(G[c+2|0]<<16|G[c+3|0]<<24);F[b+16>>2]=e;F[b+20>>2]=d;if((c|0)<(f|0)){break a}F[a+16>>2]=c;F[a+12>>2]=f;d=(c>>31)-((f>>31)+(c>>>0>>0)|0)|0;b=c-f|0;if(!d&b>>>0>2147483646|d){break a}l=1;d=b+1|0;F[a+20>>2]=d;b=d>>>1|0;F[a+24>>2]=b;F[a+28>>2]=0-b;if(d&1){break a}F[a+24>>2]=b-1}return l|0}function Uc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;d=Z-16|0;Z=d;f=F[a+24>>2];k=F[a+28>>2];a:{if((f|0)!=(k|0)){while(1){F[d+8>>2]=0;F[d>>2]=0;F[d+4>>2]=0;a=Sc(F[f>>2],b,d);g=G[d+11|0];h=g<<24>>24;i=3;b:{c:{d:{if(!a){break d}i=0;a=G[c+11|0];e=a<<24>>24;j=(h|0)<0?F[d+4>>2]:g;if((j|0)!=(((e|0)<0?F[c+4>>2]:a)|0)){break d}a=(e|0)<0?F[c>>2]:c;e=(h|0)<0;e:{if(!e){e=d;if(!h){break e}while(1){if(G[e|0]!=G[a|0]){break d}a=a+1|0;e=e+1|0;g=g-1|0;if(g){continue}break}break e}if(!j){break e}if(sa(e?F[d>>2]:d,a,j)){break c}}l=F[f>>2];i=1}if((h|0)>=0){break b}}ja(F[d>>2])}f:{switch(i|0){case 0:case 3:break f;default:break a}}f=f+4|0;if((k|0)!=(f|0)){continue}break}}l=0}Z=d+16|0;return l}function gb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=c-b|0;h=f>>2;d=F[a+8>>2];e=F[a>>2];if(h>>>0<=d-e>>2>>>0){d=F[a+4>>2];g=d-e|0;f=g+b|0;i=g>>2;g=i>>>0>>0?f:c;if((g|0)!=(b|0)){while(1){F[e>>2]=F[b>>2];e=e+4|0;b=b+4|0;if((g|0)!=(b|0)){continue}break}}if(h>>>0>i>>>0){if((c|0)!=(g|0)){while(1){F[d>>2]=F[f>>2];d=d+4|0;f=f+4|0;if((f|0)!=(c|0)){continue}break}}F[a+4>>2]=d;return}F[a+4>>2]=e;return}if(e){F[a+4>>2]=e;ja(e);F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;d=0}a:{if((f|0)<0){break a}e=d>>>1|0;d=d>>>0>=2147483644?1073741823:e>>>0>h>>>0?e:h;if(d>>>0>=1073741824){break a}e=d<<2;d=ka(e);F[a>>2]=d;F[a+8>>2]=d+e;if((b|0)!=(c|0)){c=b;b=(f-4&-4)+4|0;d=la(d,c,b)+b|0}F[a+4>>2]=d;return}na();v()}function Ea(a,b,c){var d=0,e=0,f=0;e=Z-16|0;Z=e;F[a+4>>2]=0;a:{b:{if(!b){break b}f=F[a+8>>2];d=f<<5;c:{if(d>>>0>=b>>>0){F[a+4>>2]=b;break c}F[e+8>>2]=0;F[e>>2]=0;F[e+4>>2]=0;if((b|0)<0){break a}if(d>>>0<=1073741822){f=f<<6;d=b+31&-32;d=d>>>0>>0?f:d}else{d=2147483647}$a(e,d);f=F[a>>2];F[a>>2]=F[e>>2];F[e>>2]=f;d=F[a+4>>2];F[a+4>>2]=b;F[e+4>>2]=d;d=F[a+8>>2];F[a+8>>2]=F[e+8>>2];F[e+8>>2]=d;if(!f){break c}ja(f)}d=b>>>5|0;a=F[a>>2];if(G[c|0]){if(b>>>0>=32){ma(a,255,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;F[a>>2]=F[a>>2]|-1>>>32-(b&31);break b}if(b>>>0>=32){ma(a,0,d<<2)}if((b&-32)==(b|0)){break b}a=a+(d<<2)|0;F[a>>2]=F[a>>2]&(-1>>>32-(b&31)^-1)}Z=e+16|0;return}na();v()}function If(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=Z-32|0;Z=e;a:{b:{f=ya(c);if(f>>>0<2147483632){c:{d:{if(f>>>0>=11){a=(f|15)+1|0;g=ka(a);F[e+24>>2]=a|-2147483648;F[e+16>>2]=g;F[e+20>>2]=f;a=f+g|0;break d}D[e+27|0]=f;g=e+16|0;a=f+g|0;if(!f){break c}}la(g,c,f)}D[a|0]=0;c=ya(d);if(c>>>0>=2147483632){break b}e:{f:{if(c>>>0>=11){f=(c|15)+1|0;a=ka(f);F[e+8>>2]=f|-2147483648;F[e>>2]=a;F[e+4>>2]=c;g=a+c|0;break f}D[e+11|0]=c;g=c+e|0;a=e;if(!c){break e}}la(a,d,c)}D[g|0]=0;c=F[b+4>>2];a=-1;g:{if(!c){break g}c=Uc(c,e+16|0,e);a=-1;if(!c){break g}a=Pc(b,F[c+24>>2])}if(D[e+11|0]<0){ja(F[e>>2])}if(D[e+27|0]<0){ja(F[e+16>>2])}Z=e+32|0;break a}za();v()}za();v()}return a|0}function se(a,b){a=a|0;b=b|0;a=0;a:{switch(b|0){case 0:a=ka(20);F[a+12>>2]=-1;F[a+16>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=1920;return a|0;case 1:a=ka(24);F[a+12>>2]=-1;F[a+16>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=1920;F[a+20>>2]=0;F[a>>2]=2136;return a|0;case 2:a=ka(48);F[a+12>>2]=-1;F[a+16>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=1920;F[a+20>>2]=0;F[a>>2]=2136;F[a+24>>2]=1624;F[a>>2]=7948;F[a+32>>2]=0;F[a+36>>2]=0;F[a+28>>2]=-1;F[a+40>>2]=0;F[a+44>>2]=0;return a|0;case 3:a=ka(32);F[a+12>>2]=-1;F[a+16>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=1920;F[a+20>>2]=0;F[a>>2]=2136;F[a+24>>2]=1032;F[a>>2]=5812;F[a+28>>2]=-1;break;default:break a}}return a|0}function Be(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=F[b>>2];b=F[b+4>>2];d=F[F[a+8>>2]+40>>2];j=d;m=ka((d|0)<0?-1:d);i=b-f|0;e=1;a:{if((i|0)<4){break a}b=0;g=F[c+16>>2];k=d;f=g+d|0;d=0+F[c+20>>2]|0;d=f>>>0>>0?d+1|0:d;h=F[c+12>>2];e=0;if(I[c+8>>2]>>0&(d|0)>=(h|0)|(d|0)>(h|0)){break a}e=i>>2;i=(e|0)<=1?1:e;while(1){b:{g=la(m,F[c>>2]+g|0,j);F[c+16>>2]=f;F[c+20>>2]=d;la(F[F[F[a+8>>2]+64>>2]>>2]+b|0,g,j);l=l+1|0;if((i|0)==(l|0)){break b}b=b+j|0;d=n+F[c+20>>2]|0;g=F[c+16>>2];f=k+g|0;d=f>>>0>>0?d+1|0:d;h=F[c+12>>2];if((d|0)<=(h|0)&I[c+8>>2]>=f>>>0|(d|0)<(h|0)){continue}}break}e=(e|0)<=(l|0)}ja(m);return e|0}function mh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;F[b>>2]=1;f=b+8|0;c=F[b+8>>2];d=F[b+12>>2]-c|0;if(d>>>0<=4294967291){Db(f,d+4|0);c=F[f>>2]}c=c+d|0;d=F[a+4>>2];D[c|0]=d;D[c+1|0]=d>>>8;D[c+2|0]=d>>>16;D[c+3|0]=d>>>24;c=F[a+8>>2];if((c|0)!=F[a+12>>2]){d=0;while(1){g=(d<<2)+c|0;c=F[b+8>>2];e=F[b+12>>2]-c|0;if(e>>>0<=4294967291){Db(f,e+4|0);c=F[f>>2]}c=c+e|0;e=F[g>>2];D[c|0]=e;D[c+1|0]=e>>>8;D[c+2|0]=e>>>16;D[c+3|0]=e>>>24;d=d+1|0;c=F[a+8>>2];if(d>>>0>2]-c>>2>>>0){continue}break}}c=F[b+12>>2];b=F[b+8>>2];c=c-b|0;if(c>>>0<=4294967291){Db(f,c+4|0);b=F[f>>2]}b=b+c|0;a=F[a+20>>2];D[b|0]=a;D[b+1|0]=a>>>8;D[b+2|0]=a>>>16;D[b+3|0]=a>>>24}function mb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;c=F[a+4>>2];if((c|0)!=F[a+8>>2]){e=F[b+4>>2];F[c>>2]=F[b>>2];F[c+4>>2]=e;F[c+8>>2]=F[b+8>>2];F[a+4>>2]=c+12;return}a:{g=F[a>>2];d=(c-g|0)/12|0;e=d+1|0;if(e>>>0<357913942){f=d<<1;f=d>>>0>=178956970?357913941:e>>>0>>0?f:e;if(f){if(f>>>0>=357913942){break a}e=ka(L(f,12))}else{e=0}d=e+L(d,12)|0;h=F[b+4>>2];F[d>>2]=F[b>>2];F[d+4>>2]=h;F[d+8>>2]=F[b+8>>2];b=d+12|0;if((c|0)!=(g|0)){while(1){c=c-12|0;h=F[c+4>>2];d=d-12|0;F[d>>2]=F[c>>2];F[d+4>>2]=h;F[d+8>>2]=F[c+8>>2];if((c|0)!=(g|0)){continue}break}c=F[a>>2]}F[a+8>>2]=e+L(f,12);F[a+4>>2]=b;F[a>>2]=d;if(c){ja(c)}return}na();v()}oa();v()}function ne(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;h=F[c+12>>2];f=h;e=F[c+20>>2];i=F[c+8>>2];g=F[c+16>>2];a:{if((f|0)<=(e|0)&i>>>0<=g>>>0|(e|0)>(f|0)){break a}j=F[c>>2];k=D[j+g|0];d=e;f=g+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;b:{if((k|0)==-2){break b}if((d|0)>=(h|0)&f>>>0>=i>>>0|(d|0)>(h|0)){break a}d=D[f+j|0];g=g+2|0;e=g>>>0<2?e+1|0:e;F[c+16>>2]=g;F[c+20>>2]=e;if((d-4&255)>>>0<251){break a}e=$[F[F[a>>2]+40>>2]](a,k,d)|0;d=F[a+20>>2];F[a+20>>2]=e;if(!d){break b}$[F[F[d>>2]+4>>2]](d)}d=F[a+20>>2];if(d){if(!($[F[F[a>>2]+28>>2]](a,d)|0)){break a}}l=$[F[F[a>>2]+36>>2]](a,b,c)|0}return l|0}function Bf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:{if(I[b+80>>2]>65535){break a}a=F[b+100>>2];b=F[b+96>>2];e=(a-b|0)/12|0;f=L(e,6);g=(f|0)==(c|0);if((a|0)==(b|0)|(c|0)!=(f|0)){break a}g=1;c=e>>>0<=1?1:e;i=c&1;a=0;if(e>>>0>=2){j=c&-2;c=0;while(1){f=L(a,6);h=f+d|0;e=b+L(a,12)|0;E[h>>1]=F[e>>2];E[(f|2)+d>>1]=F[e+4>>2];E[h+4>>1]=F[e+8>>2];f=a|1;e=L(f,6)+d|0;f=b+L(f,12)|0;E[e>>1]=F[f>>2];E[e+2>>1]=F[f+4>>2];E[e+4>>1]=F[f+8>>2];a=a+2|0;c=c+2|0;if((j|0)!=(c|0)){continue}break}}if(!i){break a}c=L(a,6)+d|0;a=b+L(a,12)|0;E[c>>1]=F[a>>2];E[c+2>>1]=F[a+4>>2];E[c+4>>1]=F[a+8>>2]}return g|0}function Gh(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f=Z-32|0;Z=f;h=e>>>0>1073741823?-1:e<<2;h=ma(ka(h),0,h);g=F[b>>2];i=F[b+4>>2];k=F[h+4>>2];F[f+16>>2]=F[h>>2];F[f+20>>2]=k;F[f+8>>2]=g;F[f+12>>2]=i;i=a+8|0;Jb(f+24|0,i,f+16|0,f+8|0);F[c>>2]=F[f+24>>2];F[c+4>>2]=F[f+28>>2];if((d|0)>(e|0)){k=0-e<<2;a=e;while(1){g=a<<2;j=g+b|0;m=F[j>>2];j=F[j+4>>2];g=c+g|0;l=g+k|0;n=F[l+4>>2];F[f+16>>2]=F[l>>2];F[f+20>>2]=n;F[f+8>>2]=m;F[f+12>>2]=j;Jb(f+24|0,i,f+16|0,f+8|0);F[g>>2]=F[f+24>>2];F[g+4>>2]=F[f+28>>2];a=a+e|0;if((d|0)>(a|0)){continue}break}}ja(h);Z=f+32|0;return 1}function Sf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;a=Z-32|0;Z=a;F[a+24>>2]=0;F[a+28>>2]=0;a:{d=ya(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=ka(e);F[a+16>>2]=e|-2147483648;F[a+8>>2]=f;F[a+12>>2]=d;e=d+f|0;break c}D[a+19|0]=d;f=a+8|0;e=f+d|0;if(!d){break b}}la(f,c,d)}D[e|0]=0;c=b+4|0;b=Ya(b,a+8|0);d:{if((c|0)==(b|0)){break d}c=F[b+32>>2];b=F[b+28>>2];if((c-b|0)!=8){break d}c=G[b+4|0]|G[b+5|0]<<8|(G[b+6|0]<<16|G[b+7|0]<<24);F[a+24>>2]=G[b|0]|G[b+1|0]<<8|(G[b+2|0]<<16|G[b+3|0]<<24);F[a+28>>2]=c}g=K[a+24>>3];if(D[a+19|0]<0){ja(F[a+8>>2])}Z=a+32|0;break a}za();v()}return+g}function Gc(a,b,c,d,e,f,g){var h=0,i=0,j=0;h=Z-16|0;Z=h;if((b^-1)+2147483631>>>0>=c>>>0){if(G[a+11|0]>>>7|0){i=F[a>>2]}else{i=a}if(b>>>0<1073741799){F[h+12>>2]=b<<1;F[h>>2]=b+c;c=Z-16|0;Z=c;Z=c+16|0;c=h+12|0;c=F[(I[h>>2]>2]?c:h)>>2];if(c>>>0>=11){j=c+16&-16;c=j-1|0;c=(c|0)==11?j:c}else{c=10}c=c+1|0}else{c=2147483631}sb(h,c);c=F[h>>2];if(f){db(c,g,f)}g=d-e|0;if((d|0)!=(e|0)){db(c+f|0,e+i|0,g)}if((b|0)!=10){ja(i)}F[a>>2]=c;F[a+8>>2]=F[a+8>>2]&-2147483648|F[h+4>>2]&2147483647;F[a+8>>2]=F[a+8>>2]|-2147483648;b=a;a=f+g|0;F[b+4>>2]=a;D[h+12|0]=0;D[a+c|0]=G[h+12|0];Z=h+16|0;return}za();v()}function _c(a,b,c){var d=0,e=0,f=0,g=0;a:{f=b>>>0<1431655766&(b|c)>=0;b:{if(!f){break b}b=L(b,3);Xb(a,b,10224);Xb(a+12|0,b,10228);d=F[a+24>>2];c:{if(F[a+32>>2]-d>>2>>>0>=c>>>0){break c}if(c>>>0>=1073741824){break a}b=F[a+28>>2];e=c<<2;c=ka(e);e=c+e|0;g=c+(b-d&-4)|0;c=g;if((b|0)!=(d|0)){while(1){c=c-4|0;b=b-4|0;F[c>>2]=F[b>>2];if((b|0)!=(d|0)){continue}break}}F[a+32>>2]=e;F[a+28>>2]=g;F[a+24>>2]=c;if(!d){break c}ja(d)}F[a+80>>2]=0;F[a+84>>2]=0;b=F[a+76>>2];F[a+76>>2]=0;if(b){ja(b)}F[a+68>>2]=0;F[a+72>>2]=0;b=a- -64|0;a=F[b>>2];F[b>>2]=0;if(!a){break b}ja(a)}return f}na();v()}function yd(a){var b=0,c=0,d=0,e=0,f=0;f=1;c=F[a+140>>2];a:{if((c|0)<=0){break a}b=c<<4;d=ka(c>>>0>268435455?-1:b|4);F[d>>2]=c;d=d+4|0;c=d+b|0;b=d;while(1){F[b>>2]=0;F[b+4>>2]=0;D[b+5|0]=0;D[b+6|0]=0;D[b+7|0]=0;D[b+8|0]=0;D[b+9|0]=0;D[b+10|0]=0;D[b+11|0]=0;D[b+12|0]=0;b=b+16|0;if((c|0)!=(b|0)){continue}break}e=F[a+136>>2];F[a+136>>2]=d;if(e){c=e-4|0;d=F[c>>2];if(d){b=(d<<4)+e|0;while(1){b=b-16|0;if((e|0)!=(b|0)){continue}break}}ja(c)}b=0;if(F[a+140>>2]<=0){break a}while(1){f=Aa(F[a+136>>2]+(b<<4)|0,a);if(!f){break a}b=b+1|0;if((b|0)>2]){continue}break}}return f} -function Sd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=F[b+8>>2];c=F[b+12>>2];g=c;c=F[b+20>>2];i=c;h=F[b+16>>2];f=h+4|0;c=f>>>0<4?c+1|0:c;a:{if(d>>>0>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}e=h+F[b>>2]|0;e=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);F[b+16>>2]=f;F[b+20>>2]=c;f=d;d=i;c=h+8|0;d=c>>>0<8?d+1|0:d;if(c>>>0>f>>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}F[b+16>>2]=c;F[b+20>>2]=d;if(!(e&1)){break a}d=O(e)^31;if(d-1>>>0>28){break a}F[a+8>>2]=d+1;d=-2<>2]=c;F[a+12>>2]=d^-1;F[a+24>>2]=c>>1;J[a+20>>2]=M(2)/M(c|0);j=Aa(a+96|0,b)}return j|0}function bc(a,b){var c=0;c=F[b+4>>2];F[a>>2]=F[b>>2];F[a+4>>2]=c;c=F[b+60>>2];F[a+56>>2]=F[b+56>>2];F[a+60>>2]=c;c=F[b+52>>2];F[a+48>>2]=F[b+48>>2];F[a+52>>2]=c;c=F[b+44>>2];F[a+40>>2]=F[b+40>>2];F[a+44>>2]=c;c=F[b+36>>2];F[a+32>>2]=F[b+32>>2];F[a+36>>2]=c;c=F[b+28>>2];F[a+24>>2]=F[b+24>>2];F[a+28>>2]=c;c=F[b+20>>2];F[a+16>>2]=F[b+16>>2];F[a+20>>2]=c;c=F[b+12>>2];F[a+8>>2]=F[b+8>>2];F[a+12>>2]=c;F[a+88>>2]=0;F[a+64>>2]=0;F[a+68>>2]=0;F[a+72>>2]=0;F[a+76>>2]=0;D[a+77|0]=0;D[a+78|0]=0;D[a+79|0]=0;D[a+80|0]=0;D[a+81|0]=0;D[a+82|0]=0;D[a+83|0]=0;D[a+84|0]=0;return a}function ac(a,b){var c=0,d=0,e=0,f=0,g=0;a:{if(F[a+64>>2]){break a}c=ka(32);F[c+16>>2]=0;F[c+20>>2]=0;F[c+8>>2]=0;F[c>>2]=0;F[c+4>>2]=0;F[c+24>>2]=0;F[c+28>>2]=0;d=F[a+64>>2];F[a+64>>2]=c;if(!d){break a}c=F[d>>2];if(c){F[d+4>>2]=c;ja(c)}ja(d)}d=F[a+64>>2];c=F[a+28>>2]-1|0;if(c>>>0<=10){c=F[(c<<2)+10148>>2]}else{c=-1}c=L(c,G[a+24|0]);f=c>>31;g=md(d,0,ki(c,f,b,0),_);if(g){d=F[a+64>>2];F[a>>2]=d;e=F[d+20>>2];F[a+8>>2]=F[d+16>>2];F[a+12>>2]=e;e=F[d+24>>2];d=F[d+28>>2];F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=c;F[a+44>>2]=f;F[a+16>>2]=e;F[a+20>>2]=d;F[a+80>>2]=b}return g}function Af(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;a=F[b+100>>2];b=F[b+96>>2];h=a-b|0;a:{if((h|0)!=(c|0)|(a|0)==(b|0)){break a}g=(c|0)/12|0;e=g>>>0<=1?1:g;j=e&1;a=0;if(g>>>0>=2){k=e&-2;g=0;while(1){e=L(a,12);i=e+d|0;f=b+e|0;F[i>>2]=F[f>>2];F[(e|4)+d>>2]=F[f+4>>2];F[i+8>>2]=F[f+8>>2];f=L(a|1,12);e=f+d|0;f=b+f|0;F[e>>2]=F[f>>2];F[e+4>>2]=F[f+4>>2];F[e+8>>2]=F[f+8>>2];a=a+2|0;g=g+2|0;if((k|0)!=(g|0)){continue}break}}if(!j){break a}e=d;d=L(a,12);a=e+d|0;b=b+d|0;F[a>>2]=F[b>>2];F[a+4>>2]=F[b+4>>2];F[a+8>>2]=F[b+8>>2]}return(c|0)==(h|0)|0}function Kh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=F[b+8>>2];d=F[b+12>>2];g=d;d=F[b+20>>2];i=d;h=F[b+16>>2];f=h+4|0;d=f>>>0<4?d+1|0:d;a:{if(c>>>0>>0&(d|0)>=(g|0)|(d|0)>(g|0)){break a}e=h+F[b>>2]|0;e=G[e|0]|G[e+1|0]<<8|(G[e+2|0]<<16|G[e+3|0]<<24);F[b+16>>2]=f;F[b+20>>2]=d;f=c;c=i;d=h+8|0;c=d>>>0<8?c+1|0:c;if(d>>>0>f>>>0&(c|0)>=(g|0)|(c|0)>(g|0)){break a}F[b+16>>2]=d;F[b+20>>2]=c;if(!(e&1)){break a}b=O(e)^31;if(b-1>>>0>28){break a}j=1;F[a+8>>2]=b+1;b=-2<>2]=c;F[a+12>>2]=b^-1;F[a+24>>2]=c>>1;J[a+20>>2]=M(2)/M(c|0)}return j|0}function Ya(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;f=a+4|0;a=F[a+4>>2];a:{b:{if(!a){break b}d=G[b+11|0];c=d<<24>>24<0;g=c?F[b>>2]:b;d=c?F[b+4>>2]:d;b=f;while(1){e=G[a+27|0];c=e<<24>>24<0;e=c?F[a+20>>2]:e;h=e>>>0>d>>>0;i=h?d:e;c:{if(i){c=sa(c?F[a+16>>2]:a+16|0,g,i);if(c){break c}}c=d>>>0>e>>>0?-1:h}c=(c|0)<0;b=c?b:a;a=F[(c?a+4|0:a)>>2];if(a){continue}break}if((b|0)==(f|0)){break b}c=G[b+27|0];a=c<<24>>24<0;d:{c=a?F[b+20>>2]:c;e=c>>>0>>0?c:d;if(e){a=sa(g,a?F[b+16>>2]:b+16|0,e);if(a){break d}}if(c>>>0>d>>>0){break b}break a}if((a|0)>=0){break a}}b=f}return b}function Oe(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(La(a,F[b+8>>2],e)){if(!(F[b+28>>2]==1|F[b+4>>2]!=(c|0))){F[b+28>>2]=d}return}a:{if(La(a,F[b>>2],e)){if(!(F[b+16>>2]!=(c|0)&F[b+20>>2]!=(c|0))){if((d|0)!=1){break a}F[b+32>>2]=1;return}F[b+32>>2]=d;b:{if(F[b+44>>2]==4){break b}E[b+52>>1]=0;a=F[a+8>>2];$[F[F[a>>2]+20>>2]](a,b,c,c,1,e);if(G[b+53|0]){F[b+44>>2]=3;if(!G[b+52|0]){break b}break a}F[b+44>>2]=4}F[b+20>>2]=c;F[b+40>>2]=F[b+40>>2]+1;if(F[b+36>>2]!=1|F[b+24>>2]!=2){break a}D[b+54|0]=1;return}a=F[a+8>>2];$[F[F[a>>2]+24>>2]](a,b,c,d,e)}}function Ig(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;f=ka(64);c=ka(12);F[c+8>>2]=F[F[a+4>>2]+80>>2];F[c>>2]=9968;F[c+4>>2]=0;f=yc(f,c);a:{b:{if((b|0)<0){c=f;break b}h=a+8|0;c=F[a+12>>2];e=F[a+8>>2];g=c-e>>2;c:{if((g|0)>(b|0)){break c}d=b+1|0;if(b>>>0>=g>>>0){Pb(h,d-g|0);break c}if(d>>>0>=g>>>0){break c}e=e+(d<<2)|0;if((e|0)!=(c|0)){while(1){c=c-4|0;d=F[c>>2];F[c>>2]=0;if(d){$[F[F[d>>2]+4>>2]](d)}if((c|0)!=(e|0)){continue}break}}F[a+12>>2]=e}a=F[h>>2]+(b<<2)|0;c=F[a>>2];F[a>>2]=f;if(!c){break a}}$[F[F[c>>2]+4>>2]](c)}return(b^-1)>>>31|0}function we(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;c=F[a+60>>2];a:{if(!c){break a}F[c+4>>2]=a+48;if(!($[F[F[c>>2]+12>>2]](c)|0)){break a}b:{c=$[F[F[a>>2]+24>>2]](a)|0;if((c|0)<=0){break b}while(1){c:{f=F[($[F[F[a>>2]+28>>2]](a)|0)+4>>2];g=$[F[F[a>>2]+20>>2]](a,d)|0;e=F[a+60>>2];if(!($[F[F[e>>2]+8>>2]](e,F[F[f+8>>2]+(g<<2)>>2])|0)){break c}d=d+1|0;if((c|0)!=(d|0)){continue}break b}break}return 0}d=0;if(!($[F[F[a>>2]+36>>2]](a,b)|0)){break a}if(!($[F[F[a>>2]+40>>2]](a,b)|0)){break a}d=$[F[F[a>>2]+44>>2]](a)|0}return d|0}function Id(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=F[a+216>>2];if((c|0)!=F[a+220>>2]){while(1){a:{c=F[L(e,144)+c>>2];if((c|0)<0){break a}d=F[a+4>>2];f=F[d+8>>2];if((c|0)>=F[d+12>>2]-f>>2){break a}d=0;c=F[(c<<2)+f>>2];if(($[F[F[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if(($[F[F[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if(($[F[F[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}a=F[a+216>>2]+L(e,144)|0;return(G[a+100|0]?a+4|0:0)|0}e=e+1|0;c=F[a+216>>2];if(e>>>0<(F[a+220>>2]-c|0)/144>>>0){continue}break}}return 0}function nd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;c=F[a+8>>2];d=F[a+4>>2];if(c-d>>2>>>0>=b>>>0){if(b){b=b<<2;d=ma(d,0,b)+b|0}F[a+4>>2]=d;return}a:{f=F[a>>2];g=d-f>>2;e=g+b|0;if(e>>>0<1073741824){c=c-f|0;h=c>>>1|0;e=c>>>0>=2147483644?1073741823:e>>>0>>0?h:e;if(e){if(e>>>0>=1073741824){break a}i=ka(e<<2)}c=(g<<2)+i|0;b=b<<2;b=ma(c,0,b)+b|0;if((d|0)!=(f|0)){while(1){c=c-4|0;d=d-4|0;F[c>>2]=F[d>>2];if((d|0)!=(f|0)){continue}break}}F[a+8>>2]=(e<<2)+i;F[a+4>>2]=b;F[a>>2]=c;if(f){ja(f)}return}na();v()}oa();v()}function bb(a){var b=0,c=0,d=0,e=0,f=0;d=F[a+8>>2];a:{if(G[d+84|0]){break a}b=F[a+16>>2];if(!b|!G[b+84|0]){break a}c=F[d+72>>2];e=F[d+68>>2];D[b+84|0]=0;c=c-e>>2;f=F[b+68>>2];e=F[b+72>>2]-f>>2;b:{if(c>>>0>e>>>0){ab(b+68|0,c-e|0,2004);d=F[a+8>>2];break b}if(c>>>0>=e>>>0){break b}F[b+72>>2]=f+(c<<2)}if(G[d+84|0]){break a}c=F[d+68>>2];if((c|0)==F[d+72>>2]){break a}e=F[F[a+16>>2]+68>>2];b=0;while(1){f=b<<2;F[f+e>>2]=F[c+f>>2];b=b+1|0;c=F[d+68>>2];if(b>>>0>2]-c>>2>>>0){continue}break}}return F[a+16>>2]}function Lf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=Z+-64|0;Z=e;f=Ja(e+8|0);F[f+16>>2]=0;F[f+20>>2]=0;F[f>>2]=b;F[f+8>>2]=c;F[f+12>>2]=0;b=e+48|0;Pd(b,a,f,d);F[a+24>>2]=F[e+48>>2];f=a+24|0;a:{if((f|0)==(b|0)){break a}b=a+28|0;c=e+48|4;g=G[e+63|0];d=g<<24>>24;if(D[a+39|0]>=0){if((d|0)>=0){a=F[c+4>>2];F[b>>2]=F[c>>2];F[b+4>>2]=a;F[b+8>>2]=F[c+8>>2];break a}qb(b,F[e+52>>2],F[e+56>>2]);break a}a=(d|0)<0;rb(b,a?F[e+52>>2]:c,a?F[e+56>>2]:g)}if(D[e+63|0]<0){ja(F[e+52>>2])}Z=e- -64|0;return f|0}function Jf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;a=Z-32|0;Z=a;a:{d=ya(c);if(d>>>0<2147483632){b:{c:{if(d>>>0>=11){e=(d|15)+1|0;f=ka(e);F[a+24>>2]=e|-2147483648;F[a+16>>2]=f;F[a+20>>2]=d;e=d+f|0;break c}D[a+27|0]=d;f=a+16|0;e=f+d|0;if(!d){break b}}la(f,c,d)}D[e|0]=0;D[a+4|0]=0;F[a>>2]=1701667182;D[a+11|0]=4;d=F[b+4>>2];c=-1;d:{if(!d){break d}d=Uc(d,a,a+16|0);c=-1;if(!d){break d}c=Pc(b,F[d+24>>2])}b=c;if(D[a+11|0]<0){ja(F[a>>2])}if(D[a+27|0]<0){ja(F[a+16>>2])}Z=a+32|0;break a}za();v()}return b|0}function Hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=F[a+216>>2];if((c|0)!=F[a+220>>2]){while(1){a:{c=F[L(e,144)+c>>2];if((c|0)<0){break a}d=F[a+4>>2];f=F[d+8>>2];if((c|0)>=F[d+12>>2]-f>>2){break a}d=0;c=F[(c<<2)+f>>2];if(($[F[F[c>>2]+24>>2]](c)|0)<=0){break a}while(1){if(($[F[F[c>>2]+20>>2]](c,d)|0)!=(b|0)){d=d+1|0;if(($[F[F[c>>2]+24>>2]](c)|0)>(d|0)){continue}break a}break}return(F[a+216>>2]+L(e,144)|0)+104|0}e=e+1|0;c=F[a+216>>2];if(e>>>0<(F[a+220>>2]-c|0)/144>>>0){continue}break}}return a+184|0}function Uf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;d=Z-16|0;Z=d;F[d+12>>2]=0;a:{e=ya(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){f=(e|15)+1|0;a=ka(f);F[d+8>>2]=f|-2147483648;F[d>>2]=a;F[d+4>>2]=e;f=a+e|0;break c}D[d+11|0]=e;f=d+e|0;a=d;if(!e){break b}}la(a,c,e)}D[f|0]=0;a=Ya(b,d);d:{if((a|0)==(b+4|0)){break d}b=F[a+32>>2];a=F[a+28>>2];if((b-a|0)!=4){break d}F[d+12>>2]=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24)}a=F[d+12>>2];if(D[d+11|0]<0){ja(F[d>>2])}Z=d+16|0;break a}za();v()}return a|0}function Mf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;d=Z+-64|0;Z=d;e=Ja(d+8|0);F[e+16>>2]=0;F[e+20>>2]=0;F[e>>2]=b;F[e+8>>2]=c;F[e+12>>2]=0;b=d+48|0;Od(b);F[a+24>>2]=F[d+48>>2];f=a+24|0;a:{if((b|0)==(f|0)){break a}b=a+28|0;c=d+48|4;g=G[d+63|0];e=g<<24>>24;if(D[a+39|0]>=0){if((e|0)>=0){a=F[c+4>>2];F[b>>2]=F[c>>2];F[b+4>>2]=a;F[b+8>>2]=F[c+8>>2];break a}qb(b,F[d+52>>2],F[d+56>>2]);break a}a=(e|0)<0;rb(b,a?F[d+52>>2]:c,a?F[d+56>>2]:g)}if(D[d+63|0]<0){ja(F[d+52>>2])}Z=d- -64|0;return f|0}function Ce(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0;e=1;a:{if(($[F[F[b>>2]+20>>2]](b)|0)<=0){break a}while(1){e=0;d=Qc(F[F[a+4>>2]+4>>2],$[F[F[b>>2]+24>>2]](b,f)|0);if((d|0)==-1){break a}g=F[a+4>>2];c=0;b:{if((d|0)<0){break b}h=F[g+4>>2];if((d|0)>=F[h+12>>2]-F[h+8>>2]>>2){break b}c=F[F[g+8>>2]+(F[F[g+20>>2]+(d<<2)>>2]<<2)>>2];c=$[F[F[c>>2]+32>>2]](c,d)|0}if(!c){break a}if(!($[F[F[b>>2]+28>>2]](b,c)|0)){break a}e=1;f=f+1|0;if(($[F[F[b>>2]+20>>2]](b)|0)>(f|0)){continue}break}}return e|0}function Db(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;a:{c=F[a+4>>2];e=F[a>>2];d=c-e|0;b:{if(d>>>0>>0){g=b-d|0;f=F[a+8>>2];if(g>>>0<=f-c>>>0){h=a,i=ma(c,0,g)+g|0,F[h+4>>2]=i;break b}if((b|0)<0){break a}c=f-e|0;f=c<<1;c=c>>>0>=1073741823?2147483647:b>>>0>>0?f:b;f=ka(c);ma(f+d|0,0,g);d=pa(f,e,d);F[a+8>>2]=d+c;F[a+4>>2]=b+d;F[a>>2]=d;if(!e){break b}ja(e);break b}if(b>>>0>=d>>>0){break b}F[a+4>>2]=b+e}b=F[a+28>>2];c=b;d=b+1|0;b=F[a+24>>2]+1|0;e=b?c:d;F[a+24>>2]=b;F[a+28>>2]=e;return}na();v()}function Ma(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=F[a+4>>2];if((e|0)!=F[a+8>>2]){F[e>>2]=F[b>>2];F[a+4>>2]=e+4;return}a:{g=F[a>>2];f=e-g|0;c=f>>2;d=c+1|0;if(d>>>0<1073741824){h=c<<2;c=f>>>1|0;c=f>>>0>=2147483644?1073741823:c>>>0>d>>>0?c:d;if(c){if(c>>>0>=1073741824){break a}f=ka(c<<2)}else{f=0}d=h+f|0;F[d>>2]=F[b>>2];b=d+4|0;if((e|0)!=(g|0)){while(1){d=d-4|0;e=e-4|0;F[d>>2]=F[e>>2];if((e|0)!=(g|0)){continue}break}}F[a+8>>2]=f+(c<<2);F[a+4>>2]=b;F[a>>2]=d;if(g){ja(g)}return}na();v()}oa();v()}function va(a){F[a>>2]=-1;F[a+4>>2]=0;F[a+8>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;D[a+28|0]=1;F[a+20>>2]=0;F[a+24>>2]=0;F[a+12>>2]=0;F[a+16>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+56>>2]=0;F[a+60>>2]=0;F[a+64>>2]=0;F[a+68>>2]=0;F[a+76>>2]=0;F[a+80>>2]=0;F[a+84>>2]=0;F[a+88>>2]=0;F[a+92>>2]=0;F[a+96>>2]=0;F[a+72>>2]=a+4;F[a+104>>2]=0;F[a+108>>2]=0;D[a+100|0]=1;F[a+112>>2]=0;F[a+116>>2]=0;F[a+120>>2]=0;F[a+124>>2]=0;F[a+128>>2]=0;F[a+132>>2]=0;F[a+136>>2]=0;F[a+140>>2]=0}function Hb(a,b){var c=0,d=0,e=0,f=0;d=F[a+12>>2];c=F[a+16>>2]-d>>2;a:{if(c>>>0>>0){qa(a+12|0,b-c|0);break a}if(b>>>0>=c>>>0){break a}F[a+16>>2]=d+(b<<2)}b:{c=F[a>>2];c:{if(F[a+8>>2]-c>>2>>>0>=b>>>0){break c}if(b>>>0>=1073741824){break b}d=F[a+4>>2];e=b<<2;b=ka(e);e=b+e|0;f=b+(d-c&-4)|0;b=f;if((c|0)!=(d|0)){while(1){b=b-4|0;d=d-4|0;F[b>>2]=F[d>>2];if((c|0)!=(d|0)){continue}break}}F[a+8>>2]=e;F[a+4>>2]=f;F[a>>2]=b;if(!c){break c}ja(c)}return}na();v()}function tb(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=10300;b=F[a+68>>2];if(b){F[a+72>>2]=b;ja(b)}b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}b=F[a+44>>2];if(b){F[a+48>>2]=b;ja(b)}b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}b=F[a+20>>2];if(b){F[a+24>>2]=b;ja(b)}b=F[a+8>>2];if(b){d=b;c=F[a+12>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;d=F[c>>2];F[c>>2]=0;if(d){xa(d)}if((b|0)!=(c|0)){continue}break}d=F[a+8>>2]}F[a+12>>2]=b;ja(d)}b=F[a+4>>2];F[a+4>>2]=0;if(b){ic(b)}return a|0}function qa(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=F[a+8>>2];c=F[a+4>>2];if(e-c>>2>>>0>=b>>>0){if(b){b=b<<2;c=ma(c,0,b)+b|0}F[a+4>>2]=c;return}a:{f=c;c=F[a>>2];g=f-c|0;h=g>>2;d=h+b|0;if(d>>>0<1073741824){e=e-c|0;f=e>>>1|0;d=e>>>0>=2147483644?1073741823:d>>>0>>0?f:d;if(d){if(d>>>0>=1073741824){break a}i=ka(d<<2)}b=b<<2;e=ma((h<<2)+i|0,0,b);f=d<<2;d=pa(i,c,g);F[a+8>>2]=f+d;F[a+4>>2]=b+e;F[a>>2]=d;if(c){ja(c)}return}na();v()}oa();v()}function gc(a,b){var c=0,d=0,e=0,f=0;c=a+4|0;a=Ya(a,b);a:{if((c|0)==(a|0)){break a}b=a+28|0;b=D[a+39|0]<0?F[b>>2]:b;while(1){a=b;b=a+1|0;c=D[a|0];if((c|0)==32|c-9>>>0<5){continue}break}b:{c:{d:{c=D[a|0];switch(c-43|0){case 0:break c;case 2:break d;default:break b}}e=1}c=D[b|0];a=b}if(c-48>>>0<10){while(1){d=(L(d,10)-D[a|0]|0)+48|0;b=D[a+1|0];a=a+1|0;if(b-48>>>0<10){continue}break}}a=e?d:0-d|0;if((a|0)==-1){break a}f=(a|0)!=0}return f}function Qa(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;a=F[a>>2];c=F[a+4>>2];e=F[a+8>>2];if(c>>>0>>0){F[c>>2]=F[b>>2];F[a+4>>2]=c+4;return}a:{d=c;c=F[a>>2];g=d-c|0;d=g>>2;f=d+1|0;if(f>>>0<1073741824){h=d<<2;e=e-c|0;d=e>>>1|0;f=e>>>0>=2147483644?1073741823:f>>>0>>0?d:f;if(f){if(f>>>0>=1073741824){break a}e=ka(f<<2)}else{e=0}d=h+e|0;F[d>>2]=F[b>>2];b=pa(e,c,g);F[a+8>>2]=b+(f<<2);F[a+4>>2]=d+4;F[a>>2]=b;if(c){ja(c)}return}na();v()}oa();v()}function db(a,b,c){var d=0,e=0,f=0,g=0,h=0;f=Z-16|0;Z=f;d=Z-32|0;Z=d;e=Z-16|0;Z=e;F[e+12>>2]=b;F[e+8>>2]=b+c;F[d+24>>2]=F[e+12>>2];F[d+28>>2]=F[e+8>>2];Z=e+16|0;c=Z-16|0;Z=c;h=F[d+28>>2];e=F[d+24>>2];g=h-e|0;if((e|0)!=(h|0)){pa(a,e,g)}F[c+12>>2]=e+g;F[c+8>>2]=a+g;F[d+16>>2]=F[c+12>>2];F[d+20>>2]=F[c+8>>2];Z=c+16|0;F[d+12>>2]=(F[d+16>>2]-b|0)+b;F[d+8>>2]=(F[d+20>>2]-a|0)+a;F[f+8>>2]=F[d+12>>2];F[f+12>>2]=F[d+8>>2];Z=d+32|0;Z=f+16|0}function _a(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;e=F[a+8>>2];c=F[a+4>>2];if(e-c>>3>>>0>=b>>>0){if(b){b=b<<3;c=ma(c,0,b)+b|0}F[a+4>>2]=c;return}a:{f=c;c=F[a>>2];g=f-c|0;h=g>>3;d=h+b|0;if(d>>>0<536870912){e=e-c|0;f=e>>>2|0;d=e>>>0>=2147483640?536870911:d>>>0>>0?f:d;if(d){if(d>>>0>=536870912){break a}i=ka(d<<3)}b=b<<3;e=ma((h<<3)+i|0,0,b);f=d<<3;d=pa(i,c,g);F[a+8>>2]=f+d;F[a+4>>2]=b+e;F[a>>2]=d;if(c){ja(c)}return}na();v()}oa();v()}function re(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=2016;b=F[a+60>>2];F[a+60>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}d=F[a+36>>2];if(d){c=F[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+36>>2]}F[a+40>>2]=d;ja(b)}F[a>>2]=1776;b=F[a+16>>2];if(b){F[a+20>>2]=b;ja(b)}b=F[a+4>>2];if(b){F[a+8>>2]=b;ja(b)}return a|0}function qe(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=2016;b=F[a+60>>2];F[a+60>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}d=F[a+36>>2];if(d){c=F[a+40>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+36>>2]}F[a+40>>2]=d;ja(b)}F[a>>2]=1776;b=F[a+16>>2];if(b){F[a+20>>2]=b;ja(b)}b=F[a+4>>2];if(b){F[a+8>>2]=b;ja(b)}ja(a)}function Eg(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;a:{b=F[a+8>>2];b:{if((b|0)<0){break b}c=F[a+4>>2];e=F[c>>2];d=F[c+4>>2]-e>>2;c:{if(d>>>0>>0){nd(c,b-d|0);f=F[a+8>>2];break c}f=b;if(b>>>0>=d>>>0){break c}F[c+4>>2]=e+(b<<2);f=b}d=f;if((d|0)<=0){break b}a=F[a+4>>2];c=F[a>>2];e=F[a+4>>2]-c>>2;a=0;while(1){if((a|0)==(e|0)){break a}F[c+(a<<2)>>2]=a;a=a+1|0;if((d|0)!=(a|0)){continue}break}}return(b^-1)>>>31|0}ta();v()}function fh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;d=Z-16|0;Z=d;e=F[a+4>>2];a:{if((e|0)==-1){break a}c=F[b+20>>2];if(!!F[b+16>>2]&(c|0)>=0|(c|0)>0){break a}pb(b,F[b+4>>2],F[a+8>>2],F[a+12>>2]);c=F[b+20>>2];if(!!F[b+16>>2]&(c|0)>=0|(c|0)>0){break a}pb(b,F[b+4>>2],a+20|0,a+24|0);c=F[b+20>>2];f=F[b+16>>2];D[d+15|0]=F[a+4>>2];if(!!f&(c|0)>=0|(c|0)>0){break a}pb(b,F[b+4>>2],d+15|0,d+16|0)}Z=d+16|0;return(e|0)!=-1|0}function kd(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;e=F[a+8>>2];c=F[a+4>>2];if(e-c>>1>>>0>=b>>>0){if(b){b=b<<1;c=ma(c,0,b)+b|0}F[a+4>>2]=c;return}a:{f=c;c=F[a>>2];g=f-c|0;f=g>>1;d=f+b|0;if((d|0)>=0){e=e-c|0;d=e>>>0>=2147483646?2147483647:d>>>0>>0?e:d;if(d){if((d|0)<0){break a}h=ka(d<<1)}b=b<<1;e=ma((f<<1)+h|0,0,b);f=d<<1;d=pa(h,c,g);F[a+8>>2]=f+d;F[a+4>>2]=b+e;F[a>>2]=d;if(c){ja(c)}return}na();v()}oa();v()}function of(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=Z-16|0;Z=d;Pd(d,a,b,c);F[a+24>>2]=F[d>>2];e=a+24|0;a:{if((e|0)==(d|0)){break a}b=a+28|0;c=d|4;f=G[d+15|0];g=f<<24>>24;if(D[a+39|0]>=0){if((g|0)>=0){a=F[c+4>>2];F[b>>2]=F[c>>2];F[b+4>>2]=a;F[b+8>>2]=F[c+8>>2];break a}qb(b,F[d+4>>2],F[d+8>>2]);break a}a=(g|0)<0;rb(b,a?F[d+4>>2]:c,a?F[d+8>>2]:f)}if(D[d+15|0]<0){ja(F[d+4>>2])}Z=d+16|0;return e|0}function ra(a,b,c){var d=0,e=0,f=0,g=0;e=Z-16|0;Z=e;a:{b:{if(c>>>0<11){d=a;D[a+11|0]=G[a+11|0]&128|c;D[a+11|0]=G[a+11|0]&127;break b}if(c>>>0>2147483631){break a}g=e+8|0;if(c>>>0>=11){f=c+16&-16;d=f-1|0;d=(d|0)==11?f:d}else{d=10}sb(g,d+1|0);d=F[e+8>>2];F[a>>2]=d;F[a+8>>2]=F[a+8>>2]&-2147483648|F[e+12>>2]&2147483647;F[a+8>>2]=F[a+8>>2]|-2147483648;F[a+4>>2]=c}db(d,b,c+1|0);Z=e+16|0;return}za();v()}function pf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;b=Z-16|0;Z=b;Od(b);F[a+24>>2]=F[b>>2];e=a+24|0;a:{if((e|0)==(b|0)){break a}c=a+28|0;d=b|4;f=G[b+15|0];g=f<<24>>24;if(D[a+39|0]>=0){if((g|0)>=0){a=F[d+4>>2];F[c>>2]=F[d>>2];F[c+4>>2]=a;F[c+8>>2]=F[d+8>>2];break a}qb(c,F[b+4>>2],F[b+8>>2]);break a}a=(g|0)<0;rb(c,a?F[b+4>>2]:d,a?F[b+8>>2]:f)}if(D[b+15|0]<0){ja(F[b+4>>2])}Z=b+16|0;return e|0}function Rf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=Z-16|0;Z=d;a:{e=ya(c);if(e>>>0<2147483632){b:{c:{if(e>>>0>=11){g=(e|15)+1|0;f=ka(g);F[d+8>>2]=g|-2147483648;F[d>>2]=f;F[d+4>>2]=e;g=e+f|0;break c}D[d+11|0]=e;g=d+e|0;f=d;if(!e){break b}}la(f,c,e)}D[g|0]=0;f=a+16|0;c=Sc(b,d,f);b=F[a+16>>2];a=D[a+27|0];if(D[d+11|0]<0){ja(F[d>>2])}Z=d+16|0;a=c?(a|0)<0?b:f:0;break a}za();v()}return a|0}function Yb(a,b){var c=0,d=0,e=0;c=F[a+4>>2];d=c+b|0;F[a+4>>2]=d;if(!((d-1^c-1)>>>0<32?c:0)){F[F[a>>2]+((d>>>0>=33?d-1>>>5|0:0)<<2)>>2]=0}a:{if(!b){break a}a=F[a>>2]+(c>>>3&536870908)|0;c=c&31;if(c){d=32-c|0;e=b>>>0>d>>>0?d:b;F[a>>2]=F[a>>2]&(-1<>>d-e^-1);b=b-e|0;a=a+4|0}c=b>>>5|0;if(b>>>0>=32){ma(a,0,c<<2)}if((b&-32)==(b|0)){break a}a=(c<<2)+a|0;F[a>>2]=F[a>>2]&(-1>>>32-(b&31)^-1)}}function ld(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=F[c+20>>2];f=F[c+12>>2];e=F[c+16>>2];if((d|0)>=(f|0)&e>>>0>=I[c+8>>2]|(d|0)>(f|0)){break a}f=D[e+F[c>>2]|0];e=e+1|0;d=e?d:d+1|0;F[c+16>>2]=e;F[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!ld(a+1|0,b,c)){break a}a=F[b>>2];d=d&127|a<<7;a=F[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}F[b>>2]=d;F[b+4>>2]=a;g=1}return g}function Sa(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>10){break a}d=F[c+20>>2];f=F[c+12>>2];e=F[c+16>>2];if((d|0)>=(f|0)&e>>>0>=I[c+8>>2]|(d|0)>(f|0)){break a}f=D[e+F[c>>2]|0];e=e+1|0;d=e?d:d+1|0;F[c+16>>2]=e;F[c+20>>2]=d;d=f;b:{if((d|0)<0){if(!Sa(a+1|0,b,c)){break a}a=F[b>>2];d=d&127|a<<7;a=F[b+4>>2]<<7|a>>>25;break b}d=d&255;a=0}F[b>>2]=d;F[b+4>>2]=a;g=1}return g}function Ne(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(La(a,F[b+8>>2],e)){if(!(F[b+28>>2]==1|F[b+4>>2]!=(c|0))){F[b+28>>2]=d}return}a:{if(!La(a,F[b>>2],e)){break a}if(!(F[b+16>>2]!=(c|0)&F[b+20>>2]!=(c|0))){if((d|0)!=1){break a}F[b+32>>2]=1;return}F[b+20>>2]=c;F[b+32>>2]=d;F[b+40>>2]=F[b+40>>2]+1;if(!(F[b+36>>2]!=1|F[b+24>>2]!=2)){D[b+54|0]=1}F[b+44>>2]=4}}function jg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;e=Z+-64|0;Z=e;d=$[F[F[a>>2]+44>>2]](a,b)|0;a=$[F[F[a>>2]+40>>2]](a,b)|0;f=kb(e);g=F[b+56>>2];h=d&255;i=a;a=a-1|0;if(a>>>0<=10){a=F[(a<<2)+10148>>2]}else{a=-1}d=L(a,d);cc(f,g,h,i,0,d,d>>31);a=bc(ka(96),f);ac(a,c);D[a+84|0]=1;F[a+72>>2]=F[a+68>>2];F[a+60>>2]=F[b+60>>2];Z=e- -64|0;return a|0}function rh(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=8176;b=F[a+48>>2];F[a+48>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=10032;b=F[a+20>>2];if(b){F[a+24>>2]=b;ja(b)}d=F[a+8>>2];if(d){c=F[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+8>>2]}F[a+12>>2]=d;ja(b)}return a|0}function Dc(a,b,c,d){D[a+53|0]=1;a:{if(F[a+4>>2]!=(c|0)){break a}D[a+52|0]=1;c=F[a+16>>2];b:{if(!c){F[a+36>>2]=1;F[a+24>>2]=d;F[a+16>>2]=b;if((d|0)!=1){break a}if(F[a+48>>2]==1){break b}break a}if((b|0)==(c|0)){c=F[a+24>>2];if((c|0)==2){F[a+24>>2]=d;c=d}if(F[a+48>>2]!=1){break a}if((c|0)==1){break b}break a}F[a+36>>2]=F[a+36>>2]+1}D[a+54|0]=1}}function qh(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=8176;b=F[a+48>>2];F[a+48>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=10032;b=F[a+20>>2];if(b){F[a+24>>2]=b;ja(b)}d=F[a+8>>2];if(d){c=F[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+8>>2]}F[a+12>>2]=d;ja(b)}ja(a)}function Se(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=Z+-64|0;Z=e;d=1;a:{if(La(a,b,0)){break a}d=0;if(!b){break a}b=Fc(b,11068);d=0;if(!b){break a}d=e+8|0;ma(d|4,0,52);F[e+56>>2]=1;F[e+20>>2]=-1;F[e+16>>2]=a;F[e+8>>2]=b;$[F[F[b>>2]+28>>2]](b,d,F[c>>2],1);a=F[e+32>>2];if((a|0)==1){F[c>>2]=F[e+24>>2]}d=(a|0)==1}Z=e- -64|0;return d|0}function Fd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Z-16|0;Z=d;F[a+4>>2]=b;b=F[b+64>>2];e=F[b>>2];b=F[b+4>>2];D[d+15|0]=0;Ea(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=F[a+4>>2];e=F[b+56>>2];b=F[b+52>>2];D[d+14|0]=0;Ea(a+36|0,e-b>>2,d+14|0);b=F[c+12>>2];F[a+16>>2]=F[c+8>>2];F[a+20>>2]=b;b=F[c+4>>2];F[a+8>>2]=F[c>>2];F[a+12>>2]=b;Z=d+16|0}function zf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;a=Z-16|0;Z=a;f=D[b+24|0];e=F[2555];F[a+8>>2]=F[2554];F[a+12>>2]=e;e=F[2553];F[a>>2]=F[2552];F[a+4>>2]=e;e=lb(b,c,f,a);if(e){b=0;if(f){c=(f&255)<<2;b=ka(c);g=la(b,a,c)+c|0}c=F[d>>2];if(c){F[d+4>>2]=c;ja(c)}F[d+8>>2]=g;F[d+4>>2]=g;F[d>>2]=b}Z=a+16|0;return e|0}function wd(a,b){var c=0,d=0;a:{c=F[a+4>>2];d=F[a+8>>2];if((c|0)==d<<5){if((c+1|0)<0){break a}if(c>>>0<=1073741822){d=d<<6;c=(c&-32)+32|0;c=c>>>0>>0?d:c}else{c=2147483647}$a(a,c);c=F[a+4>>2]}F[a+4>>2]=c+1;d=1<>2]+(c>>>3&536870908)|0;if(G[b|0]){F[a>>2]=d|F[a>>2];return}F[a>>2]=F[a>>2]&(d^-1);return}na();v()}function Zb(a){var b=0;F[a>>2]=0;F[a+4>>2]=0;F[a+56>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;b=a- -64|0;F[b>>2]=0;F[b+4>>2]=0;F[a+72>>2]=0;F[a+76>>2]=0;F[a+80>>2]=0;F[a+84>>2]=0;F[a+60>>2]=a;return a}function ve(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=$[F[F[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=F[F[a+36>>2]>>2];g=a+48|0;c=0;if(!($[F[F[d>>2]+16>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=F[F[a+36>>2]+(e<<2)>>2];if($[F[F[d>>2]+16>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function ue(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0;f=$[F[F[a>>2]+24>>2]](a)|0;c=1;a:{if((f|0)<=0){break a}d=F[F[a+36>>2]>>2];g=a+48|0;c=0;if(!($[F[F[d>>2]+20>>2]](d,g,b)|0)){break a}while(1){e=e+1|0;if((f|0)!=(e|0)){d=F[F[a+36>>2]+(e<<2)>>2];if($[F[F[d>>2]+20>>2]](d,g,b)|0){continue}}break}c=(e|0)>=(f|0)}return c|0}function bh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=Z-16|0;Z=d;F[a+4>>2]=b;e=F[b>>2];b=F[b+4>>2];D[d+15|0]=0;Ea(a+24|0,(b-e>>2>>>0)/3|0,d+15|0);b=F[a+4>>2];e=F[b+28>>2];b=F[b+24>>2];D[d+14|0]=0;Ea(a+36|0,e-b>>2,d+14|0);b=F[c+12>>2];F[a+16>>2]=F[c+8>>2];F[a+20>>2]=b;b=F[c+4>>2];F[a+8>>2]=F[c>>2];F[a+12>>2]=b;Z=d+16|0}function hb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!hb(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function fb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!fb(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function Wb(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Wb(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function Ta(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Ta(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function Qd(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Qd(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function Oa(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Oa(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function Da(a,b,c){var d=0,e=0,f=0,g=0;a:{if(a>>>0>5){break a}d=F[c+20>>2];e=F[c+12>>2];f=F[c+16>>2];if((d|0)>=(e|0)&f>>>0>=I[c+8>>2]|(d|0)>(e|0)){break a}e=G[F[c>>2]+f|0];f=f+1|0;d=f?d:d+1|0;F[c+16>>2]=f;F[c+20>>2]=d;d=e<<24>>24;if((d|0)<0){if(!Da(a+1|0,b,c)){break a}e=d&127|F[b>>2]<<7}F[b>>2]=e;g=1}return g}function sa(a,b,c){var d=0,e=0;a:{b:{if(c>>>0>=4){if((a|b)&3){break b}while(1){if(F[a>>2]!=F[b>>2]){break b}b=b+4|0;a=a+4|0;c=c-4|0;if(c>>>0>3){continue}break}}if(!c){break a}}while(1){d=G[a|0];e=G[b|0];if((d|0)==(e|0)){b=b+1|0;a=a+1|0;c=c-1|0;if(c){continue}break a}break}return d-e|0}return 0}function td(a){var b=0,c=0,d=0,e=0;d=F[a>>2];if(d){e=d;c=F[a+4>>2];if((d|0)!=(c|0)){while(1){e=c-144|0;b=F[e+132>>2];if(b){F[c-8>>2]=b;ja(b)}b=F[c-28>>2];if(b){F[c-24>>2]=b;ja(b)}b=F[c-40>>2];if(b){F[c-36>>2]=b;ja(b)}Gb(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}e=F[a>>2]}F[a+4>>2]=d;ja(e)}}function Ef(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=F[b+4>>2];a:{if(!d){break a}b=F[F[F[b+8>>2]+(c<<2)>>2]+60>>2];if((b|0)<0){break a}a=F[d+24>>2];c=F[d+28>>2];if((a|0)==(c|0)){break a}b:{while(1){e=F[a>>2];if((b|0)==F[e+24>>2]){break b}a=a+4|0;if((c|0)!=(a|0)){continue}break}e=0}}return e|0}function ic(a){var b=0,c=0,d=0;if(a){d=F[a+24>>2];if(d){b=d;c=F[a+28>>2];if((b|0)!=(c|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){Ca(b+12|0,F[b+16>>2]);Ba(b,F[b+4>>2]);ja(b)}if((c|0)!=(d|0)){continue}break}b=F[a+24>>2]}F[a+28>>2]=d;ja(b)}Ca(a+12|0,F[a+16>>2]);Ba(a,F[a+4>>2]);ja(a)}}function $g(a){a=a|0;var b=0;F[a+8>>2]=9136;F[a>>2]=8924;b=F[a+96>>2];if(b){F[a+100>>2]=b;ja(b)}b=F[a+80>>2];if(b){F[a+84>>2]=b;ja(b)}b=F[a+68>>2];if(b){F[a+72>>2]=b;ja(b)}b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=9372;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}return a|0}function _g(a){a=a|0;var b=0;F[a+8>>2]=9136;F[a>>2]=8924;b=F[a+96>>2];if(b){F[a+100>>2]=b;ja(b)}b=F[a+80>>2];if(b){F[a+84>>2]=b;ja(b)}b=F[a+68>>2];if(b){F[a+72>>2]=b;ja(b)}b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=9372;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}ja(a)}function wh(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=10032;b=F[a+20>>2];if(b){F[a+24>>2]=b;ja(b)}d=F[a+8>>2];if(d){c=F[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+8>>2]}F[a+12>>2]=d;ja(b)}return a|0}function uc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0;h=F[c+8>>2];e=F[c+16>>2];g=F[c+12>>2];f=g;d=F[c+20>>2];if(h>>>0>e>>>0&(f|0)>=(d|0)|(d|0)<(f|0)){b=G[F[c>>2]+e|0];i=e+1|0;f=i?d:d+1|0;F[c+16>>2]=i;F[c+20>>2]=f;F[a+4>>2]=b}return e>>>0>>0&(d|0)<=(g|0)|(d|0)<(g|0)}function La(a,b,c){var d=0;if(!c){return F[a+4>>2]==F[b+4>>2]}if((a|0)==(b|0)){return 1}d=F[a+4>>2];a=G[d|0];c=F[b+4>>2];b=G[c|0];a:{if(!a|(b|0)!=(a|0)){break a}while(1){b=G[c+1|0];a=G[d+1|0];if(!a){break a}c=c+1|0;d=d+1|0;if((a|0)==(b|0)){continue}break}}return(a|0)==(b|0)}function Gg(a){a=a|0;var b=0,c=0,d=0;F[a>>2]=10032;b=F[a+20>>2];if(b){F[a+24>>2]=b;ja(b)}d=F[a+8>>2];if(d){c=F[a+12>>2];b=d;if((c|0)!=(b|0)){while(1){c=c-4|0;b=F[c>>2];F[c>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}if((c|0)!=(d|0)){continue}break}b=F[a+8>>2]}F[a+12>>2]=d;ja(b)}ja(a)}function Gf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=F[b+12>>2];b=F[b+8>>2];a=0;a:{if((d|0)==(b|0)){break a}a=d-b>>2;d=a>>>0<=1?1:a;a=0;b:{while(1){e=F[b+(a<<2)>>2];if(F[e+60>>2]==(c|0)){break b}a=a+1|0;if((d|0)!=(a|0)){continue}break}a=0;break a}a=(a|0)!=-1?e:0}return a|0}function ah(a){a=a|0;var b=0;F[a>>2]=9136;b=F[a+88>>2];if(b){F[a+92>>2]=b;ja(b)}b=F[a+72>>2];if(b){F[a+76>>2]=b;ja(b)}b=F[a+60>>2];if(b){F[a- -64>>2]=b;ja(b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}return a|0}function Tc(a,b){var c=0,d=0,e=0;F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;a:{c=F[b+4>>2];d=F[b>>2];b:{if((c|0)==(d|0)){a=c;break b}c=c-d|0;if((c|0)<0){break a}d=c;e=ka(c);c=ma(e,0,c);d=d+c|0;F[a+8>>2]=d;F[a+4>>2]=d;F[a>>2]=c;c=F[b>>2];a=F[b+4>>2]}la(e,c,a-c|0);return}na();v()}function Dd(a){var b=0,c=0,d=0,e=0;c=F[a+4>>2];d=F[a>>2];if((c|0)!=(d|0)){while(1){e=c-144|0;b=F[e+132>>2];if(b){F[c-8>>2]=b;ja(b)}b=F[c-28>>2];if(b){F[c-24>>2]=b;ja(b)}b=F[c-40>>2];if(b){F[c-36>>2]=b;ja(b)}Gb(c-140|0);c=e;if((d|0)!=(c|0)){continue}break}}F[a+4>>2]=d}function Xg(a){a=a|0;var b=0;F[a>>2]=9136;b=F[a+88>>2];if(b){F[a+92>>2]=b;ja(b)}b=F[a+72>>2];if(b){F[a+76>>2]=b;ja(b)}b=F[a+60>>2];if(b){F[a- -64>>2]=b;ja(b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}ja(a)}function Za(a){var b=0;if(a){b=F[a+76>>2];if(b){F[a+80>>2]=b;ja(b)}b=F[a- -64>>2];if(b){F[a+68>>2]=b;ja(b)}b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}b=F[a+24>>2];if(b){F[a+28>>2]=b;ja(b)}b=F[a+12>>2];if(b){F[a+16>>2]=b;ja(b)}b=F[a>>2];if(b){F[a+4>>2]=b;ja(b)}ja(a)}}function Gb(a){var b=0;b=F[a+84>>2];if(b){F[a+88>>2]=b;ja(b)}b=F[a+72>>2];if(b){F[a+76>>2]=b;ja(b)}b=F[a+52>>2];if(b){F[a+56>>2]=b;ja(b)}b=F[a+40>>2];if(b){F[a+44>>2]=b;ja(b)}b=F[a+28>>2];if(b){F[a+32>>2]=b;ja(b)}b=F[a+12>>2];if(b){ja(b)}a=F[a>>2];if(a){ja(a)}}function Lc(a,b,c){var d=0,e=0,f=0,g=0;f=Z-16|0;Z=f;d=Z-16|0;Z=d;b=b-a>>2;while(1){if(b){F[d+12>>2]=a;e=b>>>1|0;F[d+12>>2]=F[d+12>>2]+(e<<2);g=(e^-1)+b|0;b=e;e=I[F[d+12>>2]>>2]>2];b=e?g:b;a=e?F[d+12>>2]+4|0:a;continue}break}Z=d+16|0;Z=f+16|0;return a}function id(a,b){var c=0,d=0;d=ka(40);F[d>>2]=-1;c=d+8|0;F[c+16>>2]=0;F[c+20>>2]=0;F[c+8>>2]=0;F[c>>2]=0;F[c+4>>2]=0;F[c+24>>2]=0;F[c+28>>2]=0;$[F[F[a>>2]+16>>2]](a,d);a=F[b+88>>2];F[b+88>>2]=d;if(a){b=F[a+8>>2];if(b){F[a+12>>2]=b;ja(b)}ja(a)}return 1}function ya(a){var b=0,c=0,d=0;b=a;a:{if(b&3){while(1){if(!G[b|0]){break a}b=b+1|0;if(b&3){continue}break}}while(1){c=b;b=b+4|0;d=F[c>>2];if(!((d^-1)&d-16843009&-2139062144)){continue}break}while(1){b=c;c=b+1|0;if(G[b|0]){continue}break}}return b-a|0}function wa(a){var b=0,c=0,d=0,e=0,f=0;d=G[a+12|0];c=F[a+8>>2];a:{if(c>>>0>4095){break a}b=F[a+4>>2];if((b|0)<=0){break a}b=b-1|0;F[a+4>>2]=b;c=G[b+F[a>>2]|0]|c<<8}d=0-d&255;b=L(d,c>>>8|0);e=c&255;f=e>>>0>>0;F[a+8>>2]=f?b+e|0:c-(b+d|0)|0;return f}function yc(a,b){F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=1776;F[a+12>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+32>>2]=0;F[a+36>>2]=0;F[a+40>>2]=0;F[a>>2]=2016;F[a+60>>2]=b;F[a+44>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;F[a+56>>2]=0;return a}function Eb(a,b){var c=0,d=0,e=0;c=ya(b);if(c>>>0<2147483632){a:{b:{if(c>>>0>=11){d=(c|15)+1|0;e=ka(d);F[a+8>>2]=d|-2147483648;F[a>>2]=e;F[a+4>>2]=c;d=c+e|0;break b}D[a+11|0]=c;d=a+c|0;e=a;if(!c){break a}}pa(e,b,c)}D[d|0]=0;return a}za();v()}function Of(a){a=a|0;var b=0,c=0,d=0;if(a){if(D[a+27|0]<0){ja(F[a+16>>2])}b=F[a>>2];if(b){c=b;d=F[a+4>>2];if((b|0)!=(d|0)){while(1){c=d-12|0;if(D[d-1|0]<0){ja(F[c>>2])}d=c;if((d|0)!=(b|0)){continue}break}c=F[a>>2]}F[a+4>>2]=b;ja(c)}ja(a)}}function xa(a){a=a|0;var b=0,c=0;if(a){b=F[a+88>>2];F[a+88>>2]=0;if(b){c=F[b+8>>2];if(c){F[b+12>>2]=c;ja(c)}ja(b)}b=F[a+68>>2];if(b){F[a+72>>2]=b;ja(b)}b=F[a+64>>2];F[a+64>>2]=0;if(b){c=F[b>>2];if(c){F[b+4>>2]=c;ja(c)}ja(b)}ja(a)}}function Ib(a,b){var c=0,d=0,e=0;a:{c=F[a>>2];b:{if(F[a+8>>2]-c>>2>>>0>=b>>>0){break b}if(b>>>0>=1073741824){break a}d=F[a+4>>2]-c|0;e=b<<2;b=pa(ka(e),c,d);F[a+8>>2]=b+e;F[a+4>>2]=b+d;F[a>>2]=b;if(!c){break b}ja(c)}return}na();v()}function Df(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;b=F[b+96>>2];a=ka(12);b=b+L(c,12)|0;c=F[b+4>>2];F[a>>2]=F[b>>2];F[a+4>>2]=c;F[a+8>>2]=F[b+8>>2];b=F[d>>2];if(b){F[d+4>>2]=b;ja(b)}F[d>>2]=a;a=a+12|0;F[d+8>>2]=a;F[d+4>>2]=a;return 1}function Ah(a){a=a|0;var b=0;F[a+24>>2]=1624;F[a>>2]=7948;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}F[a>>2]=2136;b=F[a+20>>2];F[a+20>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}return a|0}function li(a,b,c,d){var e=0,f=0,g=0,h=0;f=b^d;g=f>>31;e=b>>31;a=a^e;h=a-e|0;e=(b^e)-((a>>>0>>0)+e|0)|0;a=d>>31;b=c^a;f=f>>31;a=mi(h,e,b-a|0,(a^d)-((a>>>0>b>>>0)+a|0)|0)^f;b=a-f|0;_=(g^_)-((a>>>0>>0)+g|0)|0;return b}function zh(a){a=a|0;var b=0;F[a+24>>2]=1624;F[a>>2]=7948;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}F[a>>2]=2136;b=F[a+20>>2];F[a+20>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}ja(a)}function rb(a,b,c){var d=0,e=0,f=0;e=Z-16|0;Z=e;d=F[a+8>>2]&2147483647;a:{if(d>>>0>c>>>0){d=F[a>>2];F[a+4>>2]=c;db(d,b,c);D[e+15|0]=0;D[c+d|0]=G[e+15|0];break a}f=a;a=F[a+4>>2];Gc(f,d-1|0,(c-d|0)+1|0,a,a,c,b)}Z=e+16|0}function xe(a,b){a=a|0;b=b|0;var c=0,d=0;c=Z-16|0;Z=c;a=F[a+4>>2];a:{if((a|0)==-1){break a}D[c+15|0]=a;d=F[b+20>>2];if(!!F[b+16>>2]&(d|0)>=0|(d|0)>0){break a}pb(b,F[b+4>>2],c+15|0,c+16|0)}Z=c+16|0;return(a|0)!=-1|0}function ki(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;e=c>>>16|0;f=a>>>16|0;j=L(e,f);g=c&65535;h=a&65535;i=L(g,h);f=(i>>>16|0)+L(f,g)|0;e=(f&65535)+L(e,h)|0;_=(L(b,c)+j|0)+L(a,d)+(f>>>16)+(e>>>16)|0;return i&65535|e<<16}function qb(a,b,c){var d=0,e=0;d=Z-16|0;Z=d;a:{if(c>>>0<=10){D[a+11|0]=G[a+11|0]&128|c;D[a+11|0]=G[a+11|0]&127;db(a,b,c);D[d+15|0]=0;D[a+c|0]=G[d+15|0];break a}e=a;a=G[a+11|0]&127;Gc(e,10,c-10|0,a,a,c,b)}Z=d+16|0}function Ec(a,b,c){var d=0;d=F[a+16>>2];if(!d){F[a+36>>2]=1;F[a+24>>2]=c;F[a+16>>2]=b;return}a:{if((b|0)==(d|0)){if(F[a+24>>2]!=2){break a}F[a+24>>2]=c;return}D[a+54|0]=1;F[a+24>>2]=2;F[a+36>>2]=F[a+36>>2]+1}}function vg(){var a=0;a=kb(ka(96));F[a+64>>2]=0;F[a+68>>2]=0;F[a+88>>2]=0;F[a+72>>2]=0;F[a+76>>2]=0;D[a+77|0]=0;D[a+78|0]=0;D[a+79|0]=0;D[a+80|0]=0;D[a+81|0]=0;D[a+82|0]=0;D[a+83|0]=0;D[a+84|0]=0;return a|0}function jh(a,b){a=a|0;b=b|0;var c=0,d=0;F[b>>2]=2;c=F[b+8>>2];d=F[b+12>>2]-c|0;if(d>>>0<=4294967291){Db(b+8|0,d+4|0);c=F[b+8>>2]}b=c+d|0;a=F[a+4>>2];D[b|0]=a;D[b+1|0]=a>>>8;D[b+2|0]=a>>>16;D[b+3|0]=a>>>24}function ge(a){a=a|0;var b=0;F[a>>2]=3016;b=F[a+96>>2];if(b){ja(b)}b=F[a+84>>2];if(b){ja(b)}b=F[a+72>>2];if(b){ja(b)}b=F[a+60>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function ci(a){a=a|0;var b=0;F[a>>2]=4580;b=F[a+96>>2];if(b){ja(b)}b=F[a+84>>2];if(b){ja(b)}b=F[a+72>>2];if(b){ja(b)}b=F[a+60>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function Cg(a){a=a|0;var b=0,c=0,d=0;b=F[a+8>>2];d=F[a+12>>2];if((b|0)==(d|0)){return 1}while(1){c=F[b>>2];c=$[F[F[c>>2]+16>>2]](c,F[a+32>>2])|0;if(c){b=b+4|0;if((d|0)!=(b|0)){continue}}break}return c|0}function Pc(a,b){var c=0,d=0;c=F[a+8>>2];a=F[a+12>>2];if((c|0)!=(a|0)){a=a-c>>2;d=a>>>0<=1?1:a;a=0;while(1){if(F[F[(a<<2)+c>>2]+60>>2]==(b|0)){return a}a=a+1|0;if((d|0)!=(a|0)){continue}break}}return-1}function fe(a){a=a|0;var b=0;F[a>>2]=3016;b=F[a+96>>2];if(b){ja(b)}b=F[a+84>>2];if(b){ja(b)}b=F[a+72>>2];if(b){ja(b)}b=F[a+60>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function bi(a){a=a|0;var b=0;F[a>>2]=4580;b=F[a+96>>2];if(b){ja(b)}b=F[a+84>>2];if(b){ja(b)}b=F[a+72>>2];if(b){ja(b)}b=F[a+60>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function Sc(a,b,c){var d=0,e=0;d=a+4|0;a=Ya(a,b);a:{if((d|0)==(a|0)){break a}b=F[a+32>>2];d=F[a+28>>2];if((b|0)==(d|0)){break a}Sb(c,b-d|0);c=Tb(c);b=F[a+28>>2];la(c,b,F[a+32>>2]-b|0);e=1}return e}function Kd(a){F[a+40>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;F[a>>2]=10032;F[a+12>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;F[a+32>>2]=0;E[a+36>>1]=0;F[a+44>>2]=0;F[a>>2]=8080;return a}function kb(a){F[a+8>>2]=0;F[a+12>>2]=0;F[a>>2]=0;F[a+40>>2]=0;F[a+44>>2]=0;F[a+28>>2]=9;D[a+24|0]=1;F[a+56>>2]=-1;F[a+60>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+48>>2]=0;F[a+52>>2]=0;return a}function pe(a,b){a=a|0;b=b|0;var c=0,d=0;d=F[a+16>>2];c=0;a:{if(F[a+20>>2]-d>>2<=(b|0)){break a}b=F[(b<<2)+d>>2];c=0;if((b|0)<0){break a}c=bb(F[F[a+36>>2]+(b<<2)>>2])}return c|0}function Nf(){var a=0,b=0;a=ka(40);F[a+4>>2]=0;F[a+8>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;b=a+16|0;F[b>>2]=0;F[b+4>>2]=0;F[a>>2]=a+4;F[a+12>>2]=b;F[a+32>>2]=0;F[a+36>>2]=0;return a|0}function Xe(a,b){a=a|0;b=b|0;var c=0,d=0;Nc(a,b);a:{if((b|0)<0){break a}d=F[a+88>>2];c=F[a+84>>2];if(d-c>>2<=(b|0)){break a}c=(b<<2)+c|0;b=c+4|0;pa(c,b,d-b|0);F[a+88>>2]=d-4}}function eb(a){var b=0,c=0;b=F[2909];c=a+7&-8;a=b+c|0;a:{if(a>>>0<=b>>>0?c:0){break a}if(a>>>0>aa()<<16>>>0){if(!(X(a|0)|0)){break a}}F[2909]=a;return b}F[2940]=48;return-1}function Th(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;F[a+4>>2]=b;b=F[F[F[b+4>>2]+8>>2]+(c<<2)>>2];F[a+12>>2]=c;F[a+8>>2]=b;a=F[a+8>>2];if(G[a+24|0]==3){d=F[a+28>>2]==9}return d|0}function Tg(a){a=a|0;var b=0;F[a+8>>2]=9556;F[a>>2]=9392;b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=9372;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}return a|0}function Ng(a){a=a|0;var b=0;F[a+8>>2]=8624;F[a>>2]=9684;b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=8876;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}return a|0}function Ee(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=F[a+8>>2];a:{if(!G[d+24|0]){break a}if(!ac(d,F[b+4>>2]-F[b>>2]>>2)){break a}e=$[F[F[a>>2]+32>>2]](a,b,c)|0}return e|0}function Fh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;F[a+4>>2]=b;d=F[F[F[b+4>>2]+8>>2]+(c<<2)>>2];F[a+12>>2]=c;F[a+8>>2]=d;return F[F[F[F[b+4>>2]+8>>2]+(c<<2)>>2]+28>>2]==9|0}function Ca(a,b){if(b){Ca(a,F[b>>2]);Ca(a,F[b+4>>2]);a=F[b+28>>2];F[b+28>>2]=0;if(a){Ca(a+12|0,F[a+16>>2]);Ba(a,F[a+4>>2]);ja(a)}if(D[b+27|0]<0){ja(F[b+16>>2])}ja(b)}}function Sg(a){a=a|0;var b=0;F[a+8>>2]=9556;F[a>>2]=9392;b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=9372;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}ja(a)}function Mg(a){a=a|0;var b=0;F[a+8>>2]=8624;F[a>>2]=9684;b=F[a+56>>2];if(b){F[a+60>>2]=b;ja(b)}F[a+8>>2]=8876;b=F[a+44>>2];if(b){ja(b)}b=F[a+32>>2];if(b){ja(b)}ja(a)}function Hc(a,b){var c=0,d=0,e=0,f=0;F[a>>2]=11356;F[a>>2]=11468;c=ya(b);d=ka(c+13|0);F[d+8>>2]=0;F[d+4>>2]=c;F[d>>2]=c;e=a,f=la(d+12|0,b,c+1|0),F[e+4>>2]=f;return a}function hc(a,b,c){a:{if(b){b=0;if(!ld(1,c,a)){break a}}D[a+36|0]=1;F[a+32>>2]=0;b=F[a+16>>2];c=b+F[a>>2]|0;F[a+24>>2]=c;F[a+28>>2]=c+(F[a+8>>2]-b|0);b=1}return b}function Ue(a,b){a=a|0;b=b|0;var c=0;a:{if(!($[F[F[a>>2]+36>>2]](a,b)|0)){break a}if(!($[F[F[a>>2]+40>>2]](a,b)|0)){break a}c=$[F[F[a>>2]+44>>2]](a)|0}return c|0}function _d(a){a=a|0;var b=0;a:{if(!F[a- -64>>2]|!F[a+68>>2]|(!F[a+44>>2]|!F[a+48>>2])){break a}if(!F[a+52>>2]|!F[a+56>>2]){break a}b=F[a+92>>2]!=-1}return b|0}function ii(a,b){a=a|0;b=b|0;var c=0;b=F[b+88>>2];if(!(!b|F[b>>2]!=2)){c=a;a=F[b+8>>2];F[c+4>>2]=G[a|0]|G[a+1|0]<<8|(G[a+2|0]<<16|G[a+3|0]<<24);c=1}return c|0}function wc(a){a=a|0;var b=0;F[a>>2]=2136;b=F[a+20>>2];F[a+20>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}return a|0}function Ud(a){a=a|0;var b=0;a:{if(!F[a+48>>2]|!F[a+52>>2]|(!F[a+28>>2]|!F[a+32>>2])){break a}if(!F[a+36>>2]|!F[a+40>>2]){break a}b=F[a+76>>2]!=-1}return b|0}function Ug(a){a=a|0;var b=0;F[a>>2]=9556;b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}return a|0}function Ed(a){a=a|0;var b=0;F[a>>2]=8624;b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=8876;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}return a|0}function vc(a){a=a|0;var b=0;F[a>>2]=2136;b=F[a+20>>2];F[a+20>>2]=0;if(b){$[F[F[b>>2]+4>>2]](b)}F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}ja(a)}function yg(){var a=0,b=0;b=ka(40);F[b>>2]=-1;a=b+8|0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a>>2]=0;F[a+4>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;return b|0}function eh(a){a=a|0;var b=0;F[a>>2]=8624;b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=8876;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}ja(a)}function Og(a){a=a|0;var b=0;F[a>>2]=9556;b=F[a+48>>2];if(b){F[a+52>>2]=b;ja(b)}F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}ja(a)}function Ja(a){F[a+8>>2]=0;F[a+12>>2]=0;F[a>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+32>>2]=0;F[a+24>>2]=0;F[a+28>>2]=0;E[a+38>>1]=0;D[a+36|0]=0;return a}function Me(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(La(a,F[b+8>>2],f)){Dc(b,c,d,e);return}a=F[a+8>>2];$[F[F[a>>2]+20>>2]](a,b,c,d,e,f)}function Eh(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(G[F[a+4>>2]+36|0]>=2){b=0;if(!($[F[F[a>>2]+52>>2]](a)|0)){break a}}b=id(a+24|0,F[a+16>>2])}return b|0}function hg(){var a=0;a=Rc(ka(108));F[a+84>>2]=0;F[a+88>>2]=0;F[a>>2]=10240;F[a+92>>2]=0;F[a+96>>2]=0;F[a+100>>2]=0;F[a+104>>2]=0;return a|0}function Qc(a,b){var c=0;c=-1;a:{if((b|0)==-1|(b|0)>4){break a}b=L(b,12)+a|0;a=F[b+20>>2];if((F[b+24>>2]-a|0)<=0){break a}c=F[a>>2]}return c}function cc(a,b,c,d,e,f,g){F[a>>2]=0;F[a+56>>2]=b;F[a+48>>2]=0;F[a+52>>2]=0;F[a+40>>2]=f;F[a+44>>2]=g;D[a+32|0]=e;F[a+28>>2]=d;D[a+24|0]=c}function Sh(a,b,c){a=a|0;b=b|0;c=c|0;a:{if(G[F[a+4>>2]+36|0]>=2){b=0;if(!uc(a+24|0,bb(a),c)){break a}}b=id(a+24|0,F[a+16>>2])}return b|0}function _e(a){a=a|0;var b=0;F[a>>2]=10240;b=F[a+96>>2];if(b){F[a+100>>2]=b;ja(b)}b=F[a+84>>2];if(b){F[a+88>>2]=b;ja(b)}return tb(a)|0}function Tb(a){var b=0;if(G[a+11|0]>>>7|0){b=F[a+4>>2]}else{b=G[a+11|0]&127}if(!b){sc(1222);v()}if(G[a+11|0]>>>7|0){a=F[a>>2]}return a}function Ze(a){a=a|0;var b=0;F[a>>2]=10240;b=F[a+96>>2];if(b){F[a+100>>2]=b;ja(b)}b=F[a+84>>2];if(b){F[a+88>>2]=b;ja(b)}ja(tb(a))}function ce(a){a=a|0;var b=0;F[a>>2]=3264;b=F[a+76>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function _h(a){a=a|0;var b=0;F[a>>2]=4816;b=F[a+76>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function Ba(a,b){if(b){Ba(a,F[b>>2]);Ba(a,F[b+4>>2]);a=F[b+28>>2];if(a){F[b+32>>2]=a;ja(a)}if(D[b+27|0]<0){ja(F[b+16>>2])}ja(b)}}function Wf(){var a=0;a=ka(28);F[a>>2]=0;F[a+4>>2]=0;F[a+24>>2]=0;F[a+16>>2]=0;F[a+20>>2]=0;F[a+8>>2]=0;F[a+12>>2]=0;return a|0}function We(a){a=a|0;var b=0;F[a>>2]=1776;b=F[a+16>>2];if(b){F[a+20>>2]=b;ja(b)}b=F[a+4>>2];if(b){F[a+8>>2]=b;ja(b)}return a|0}function fg(){var a=0,b=0;a=ka(24);F[a+4>>2]=0;F[a+8>>2]=0;b=a+16|0;F[b>>2]=0;F[b+4>>2]=0;F[a>>2]=a+4;F[a+12>>2]=b;return a|0}function Pe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(La(a,F[b+8>>2],0)){Ec(b,c,d);return}a=F[a+8>>2];$[F[F[a>>2]+28>>2]](a,b,c,d)}function be(a){a=a|0;var b=0;F[a>>2]=3264;b=F[a+76>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function Zh(a){a=a|0;var b=0;F[a>>2]=4816;b=F[a+76>>2];if(b){ja(b)}F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function ka(a){var b=0;a=a?a:1;a:{while(1){b=Ub(a);if(b){break a}b=F[3065];if(b){$[b|0]();continue}break}V();v()}return b}function ib(a,b){if(b){ib(a,F[b>>2]);ib(a,F[b+4>>2]);if(D[b+39|0]<0){ja(F[b+28>>2])}if(D[b+27|0]<0){ja(F[b+16>>2])}ja(b)}}function Cc(a){a=a|0;var b=0,c=0;F[a>>2]=11468;b=F[a+4>>2]-12|0;c=F[b+8>>2]-1|0;F[b+8>>2]=c;if((c|0)<0){ja(b)}return a|0}function ng(){var a=0;a=ka(24);F[a+8>>2]=0;F[a+12>>2]=0;F[a+4>>2]=-1;F[a>>2]=1624;F[a+16>>2]=0;F[a+20>>2]=0;return a|0}function Ac(a,b,c){a=a|0;b=b|0;c=c|0;F[a+4>>2]=b;b=F[F[F[b+4>>2]+8>>2]+(c<<2)>>2];F[a+12>>2]=c;F[a+8>>2]=b;return 1}function pc(a){a=a|0;var b=0;if(!(!F[a+60>>2]|!F[a+44>>2]|(!F[a+48>>2]|!F[a+52>>2]))){b=F[a+56>>2]!=0}return b|0}function Ic(a,b){if(G[a+11|0]>>>7|0){F[a+4>>2]=b;return}D[a+11|0]=G[a+11|0]&128|b;D[a+11|0]=G[a+11|0]&127}function gi(a){a=a|0;var b=0;F[a>>2]=3500;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function Xh(a){a=a|0;var b=0;F[a>>2]=5040;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function nf(a){a=a|0;if(a){if(D[a+39|0]<0){ja(F[a+28>>2])}$b(a+12|0,F[a+16>>2]);ib(a,F[a+4>>2]);ja(a)}}function dh(a){a=a|0;var b=0;F[a>>2]=8876;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}return a|0}function Wg(a){a=a|0;var b=0;F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}return a|0}function ob(a){a=a|0;var b=0;if(!(!F[a+52>>2]|(!F[a+44>>2]|!F[a+48>>2]))){b=F[a+56>>2]!=0}return b|0}function oc(a,b){a=a|0;b=b|0;var c=0;if(!(F[b+56>>2]|!b|G[b+24|0]!=3)){F[a+60>>2]=b;c=1}return c|0}function fi(a){a=a|0;var b=0;F[a>>2]=3500;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function Wh(a){a=a|0;var b=0;F[a>>2]=5040;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function zg(a,b,c){a=a|0;b=b|0;c=c|0;F[a+16>>2]=0;F[a+20>>2]=0;F[a>>2]=b;F[a+8>>2]=c;F[a+12>>2]=0}function ch(a){a=a|0;var b=0;F[a>>2]=8876;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}ja(a)}function Zd(a,b){a=a|0;b=b|0;var c=0;if(!(F[b+56>>2]|G[b+24|0]!=3)){F[a- -64>>2]=b;c=1}return c|0}function Vg(a){a=a|0;var b=0;F[a>>2]=9372;b=F[a+36>>2];if(b){ja(b)}b=F[a+24>>2];if(b){ja(b)}ja(a)}function Td(a,b){a=a|0;b=b|0;var c=0;if(!(F[b+56>>2]|G[b+24|0]!=3)){F[a+48>>2]=b;c=1}return c|0}function Le(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;if(La(a,F[b+8>>2],f)){Dc(b,c,d,e)}}function oa(){var a=0;a=Rb(4);F[a>>2]=11356;F[a>>2]=11316;F[a>>2]=11336;W(a|0,11448,14);v()}function je(a){a=a|0;var b=0;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}return a|0}function Ae(a){a=a|0;var b=0;F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}return a|0}function Pg(a){a=a|0;var b=0;F[a>>2]=1624;b=F[a+8>>2];if(b){F[a+12>>2]=b;ja(b)}return a|0}function Ch(a){a=a|0;var b=0;b=bb(a);return qd(a+24|0,b?b:F[a+8>>2],F[F[a+4>>2]+32>>2])|0}function ze(a){a=a|0;var b=0;F[a>>2]=1920;b=F[a+16>>2];F[a+16>>2]=0;if(b){xa(b)}ja(a)}function Ob(a){a=a|0;var b=0;F[a>>2]=2960;b=F[a+32>>2];if(b){F[a+36>>2]=b;ja(b)}ja(a)}function Hg(a){a=a|0;var b=0;F[a>>2]=1624;b=F[a+8>>2];if(b){F[a+12>>2]=b;ja(b)}ja(a)}function oe(a,b){a=a|0;b=b|0;return $[F[F[a>>2]+48>>2]](a,F[b+4>>2]-F[b>>2]>>2)|0}function $b(a,b){if(b){$b(a,F[b>>2]);$b(a,F[b+4>>2]);ib(b+20|0,F[b+24>>2]);ja(b)}}function xg(a){a=a|0;var b=0;if(a){b=F[a+8>>2];if(b){F[a+12>>2]=b;ja(b)}ja(a)}}function xh(a){a=a|0;if(!F[a+44>>2]){return 0}return $[F[F[a>>2]+48>>2]](a)|0}function ni(a){var b=0;while(1){if(a){a=a-1&a;b=b+1|0;continue}break}return b}function Qe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(La(a,F[b+8>>2],0)){Ec(b,c,d)}}function vh(a,b){a=a|0;b=b|0;a=F[a+48>>2];return $[F[F[a>>2]+20>>2]](a,b)|0}function oi(a){var b=0;b=a&31;a=0-a&31;return(-1>>>b&-2)<>>a} -function oh(a,b){a=a|0;b=b|0;a=F[a+48>>2];return $[F[F[a>>2]+12>>2]](a,b)|0}function nh(a,b){a=a|0;b=b|0;a=F[a+48>>2];return $[F[F[a>>2]+16>>2]](a,b)|0}function Xa(){var a=0;a=ka(12);F[a>>2]=0;F[a+4>>2]=0;F[a+8>>2]=0;return a|0}function Wa(a){a=a|0;var b=0;if(a){b=F[a>>2];if(b){F[a+4>>2]=b;ja(b)}ja(a)}}function mf(a,b,c){a=a|0;b=b|0;c=c|0;F[a+32>>2]=c;F[a+28>>2]=b;return 1}function eg(a){a=a|0;if(a){Ca(a+12|0,F[a+16>>2]);Ba(a,F[a+4>>2]);ja(a)}}function Lb(a,b){a=a|0;b=b|0;if(b>>>0<=1){F[a+28>>2]=b}return b>>>0<2|0}function Fg(a,b){a=a|0;b=b|0;D[b+84|0]=1;F[b+72>>2]=F[b+68>>2];return 1}function kg(){var a=0;a=ka(8);F[a+4>>2]=-1;F[a>>2]=1032;return a|0}function Hf(a,b,c){a=a|0;b=b|0;c=c|0;return F[F[b+8>>2]+(c<<2)>>2]}function th(a){a=a|0;a=F[a+48>>2];return $[F[F[a>>2]+24>>2]](a)|0}function sh(a){a=a|0;a=F[a+48>>2];return $[F[F[a>>2]+28>>2]](a)|0}function ph(a){a=a|0;a=F[a+48>>2];return $[F[F[a>>2]+36>>2]](a)|0}function Rh(a,b){a=a|0;b=b|0;return zc(a+24|0,bb(a),F[a+8>>2])|0}function Bh(a,b){a=a|0;b=b|0;return xd(a+24|0,bb(a),F[a+8>>2])|0}function bg(a){a=a|0;if(a){if(D[a+15|0]<0){ja(F[a+4>>2])}ja(a)}}function Ke(a){a=a|0;if(!a){return 0}return(Fc(a,11164)|0)!=0|0}function Fe(a,b){a=a|0;b=b|0;F[a+12>>2]=-1;F[a+8>>2]=b;return 1}function hd(a,b){a=a|0;b=b|0;return $[F[F[a>>2]+12>>2]](a,b)|0}function Dh(a,b){a=a|0;b=b|0;return $[F[F[a>>2]+56>>2]](a,b)|0}function sc(a){a=Hc(Rb(8),a);F[a>>2]=11568;W(a|0,11600,1);v()}function mg(a,b){a=a|0;b=b|0;return M(J[F[a+8>>2]+(b<<2)>>2])}function Rd(a){a=Hc(Rb(8),a);F[a>>2]=11516;W(a|0,11548,1);v()}function $f(a,b){a=a|0;b=b|0;return M(J[F[a>>2]+(b<<2)>>2])}function gg(a){a=a|0;return(F[a+100>>2]-F[a+96>>2]|0)/12|0}function cg(a){a=a|0;return(D[a+15|0]<0?F[a+4>>2]:a+4|0)|0}function Re(a,b){a=a|0;b=b|0;return F[F[a+4>>2]+(b<<2)>>2]}function dd(a,b){a=a|0;b=b|0;return F[F[a>>2]+(b<<2)>>2]}function Yf(a,b){a=a|0;b=b|0;return E[F[a>>2]+(b<<1)>>1]}function Xf(a,b){a=a|0;b=b|0;return H[F[a>>2]+(b<<1)>>1]}function Vd(a,b,c){a=a|0;b=b|0;c=c|0;return xc(a,b,c)|0}function sb(a,b){var c=0;c=ka(b);F[a+4>>2]=b;F[a>>2]=c}function Kf(a,b,c){a=a|0;b=b|0;c=c|0;return Qc(b,c)|0}function Rc(a){F[a>>2]=10300;ma(a+4|0,0,80);return a}function ji(a){if(a){return 31-O(a-1^a)|0}return 32}function gd(a){a=a|0;return F[a+12>>2]-F[a+8>>2]>>2}function _f(a,b){a=a|0;b=b|0;return D[F[a>>2]+b|0]}function Zf(a,b){a=a|0;b=b|0;return G[F[a>>2]+b|0]}function Ie(a){a=a|0;return F[a+8>>2]-F[a+4>>2]>>2}function wb(a){a=a|0;if(a){$[F[F[a>>2]+4>>2]](a)}}function Jd(a,b){a=a|0;b=b|0;F[a+4>>2]=b;return 1}function ed(a){a=a|0;return F[a+4>>2]-F[a>>2]>>1}function dc(a){a=a|0;return F[a+4>>2]-F[a>>2]>>2}function fd(a){a=a|0;return F[a+4>>2]-F[a>>2]|0}function ke(a){a=a|0;return G[F[a+8>>2]+24|0]}function Qf(a,b){a=a|0;b=b|0;return F[b+8>>2]}function Ff(a,b){a=a|0;b=b|0;return F[b+4>>2]}function De(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function Bg(a,b){a=a|0;b=b|0;return G[b+24|0]}function Oh(a){a=a|0;F[a>>2]=5928;return a|0}function Jh(a){a=a|0;F[a>>2]=6932;return a|0}function lg(a){a=a|0;return M(J[a+20>>2])}function Nh(a){a=a|0;F[a>>2]=5928;ja(a)}function Ih(a){a=a|0;F[a>>2]=6932;ja(a)}function ug(a){a=a|0;return F[a+88>>2]}function tg(a){a=a|0;return F[a+56>>2]}function qg(a){a=a|0;return F[a+40>>2]}function pg(a){a=a|0;return F[a+48>>2]}function og(a){a=a|0;return F[a+60>>2]}function ec(a){a=a|0;return F[a+80>>2]}function cb(a){a=a|0;return F[a+28>>2]}function vd(a){a=a|0;return F[a+8>>2]}function tc(a,b){a=a|0;b=b|0;return-1}function sg(a){a=a|0;return D[a+24|0]}function rg(a){a=a|0;return G[a+32|0]}function dg(a){a=a|0;return!F[a>>2]|0}function Wd(a,b){a=a|0;b=b|0;return 6}function Va(a){a=a|0;return F[a+4>>2]}function Rb(a){return Ub(a+80|0)+80|0}function Qh(a,b){a=a|0;b=b|0;return 2}function Ia(a,b){a=a|0;b=b|0;return 0}function Bc(a,b){a=a|0;b=b|0;return 1}function jd(a){a=a|0;return F[a>>2]}function wg(){return kb(ka(64))|0}function ig(){return Rc(ka(84))|0}function fc(a){a=a|0;if(a){ja(a)}}function Ag(){return Ja(ka(40))|0}function Qb(a){a=a|0;Cc(a);ja(a)}function Je(a){a=a|0;return 1161}function He(a){a=a|0;return 1235}function Ge(a){a=a|0;return 1201}function Pa(a){a=a|0;return a|0}function hh(a){a=a|0;ja(ud(a))}function gh(a){a=a|0;ja(sd(a))}function Ve(a){a=a|0;ja(tb(a))}function ua(a){a=a|0;return 1}function rc(a){a=a|0;return 4}function qc(a){a=a|0;return 5}function Xd(a){a=a|0;return 2}function Ua(a){a=a|0;return 0}function Nb(a){a=a|0;return 6}function Mh(a){a=a|0;return 3}function za(){Rd(1222);v()}function ta(){sc(1154);v()}function na(){Rd(1154);v()}function Ha(a){a=a|0;ja(a)}function Ra(a){a=a|0;v()}function ff(){return 10}function ef(){return 11}function df(){return 12}function vb(){return-1}function ub(){return 1}function lf(){return 5}function kf(){return 6}function jf(){return 7}function jb(){return 0}function hf(){return 8}function gf(){return 9}function cf(){return-2}function bf(){return-3}function bd(){return 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ig,Jg,Pa,Ha,Fg,Eg,Ra,Ua,ua,_e,Ze,Ye,Xe,tb,Ve,Oc,Nc,Pa,Ha,Jc,Jc,Se,Le,Ne,Qe,Ha,Me,Oe,Pe,Ha,He,Ha,Ge,Ha,Je,Qb,Va,Qb,Qb]);function aa(){return C.byteLength/65536|0}function fa(ga){ga=ga|0;var ba=aa()|0;var ca=ba+ga|0;if(ba=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}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 lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;assert(INITIAL_MEMORY>=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+INITIAL_MEMORY+"! (STACK_SIZE="+65536+")");if(Module["wasmMemory"]){wasmMemory=Module["wasmMemory"]}else{wasmMemory=new WebAssembly.Memory({"initial":INITIAL_MEMORY/65536,"maximum":2147483648/65536})}updateMemoryViews();INITIAL_MEMORY=wasmMemory.buffer.byteLength;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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 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 addOnInit(cb){__ATINIT__.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()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="draco_decoder_gltf.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}var binary=tryParseAsDataURI(file);if(binary){return binary}if(readBinary){return readBinary(file)}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":wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmTable=Module["asm"]["g"];addOnInit(Module["asm"]["f"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).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)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function intArrayToString(array){var ret=[];for(var i=0;i255){chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function getHeapMax(){return 2147483648}function emscripten_realloc_buffer(size){var b=wasmMemory.buffer;try{wasmMemory.grow(size-b.byteLength+65535>>>16);updateMemoryViews();return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob=="function"?atob:function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();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()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret},copy:function(array,view,offset){offset>>>=0;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offset>>>=1;break;case 4:offset>>>=2;break;case 8:offset>>>=3;break}for(var i=0;iR=dRaow_U3hI`+>x-y=(}?b|No!R6%5+PQ1x-p^5i&q6!TJ7Gr1(JzR&I)+Ejk29!*yutDAJQ)IA;UDVo6b<&q2j_$9+W&Nt+Ib~S z|1{0fxGRc&zt{8GjG)Ndfj*4?$>^`oyRlFF%{qd!!+)Jt;PuR2mbFylYzJ^ci^5s! zakDK|%s-%`)ovN!0UQb-vhmljt0(ORA85Ga=#{?mo&V?)ux44e%S)GZz>mL3uuj=C z@A#Yjz2V*fdi>#V_;6@<8R+_<2lArx1MRnZ|IL(tiM!Rmlo(_bx-jJ-2Vvv74D-=O4YlY9-y&vCyJ{Bzwe2mg(N^IG>` zf`6X-rQrXqyD#_`xvhS)`-Kqp>~V`>?;iIx;rcypYk2V<_n$-f<~{C5e0YgcU#irX z?QuUJ!pkjnQK?HxyzgkNfvN+^WV7 zDDf3ayv-6{sl-<)vEJkUQwTfuxStK-l0EJ}hH&W~_a8#IY>)ey5H8>2?hWCJJ?;Y` z?A+ttAHuFZ?x#a|#vb>+5U$+gekz2k_PC!6;p#o^o)Dh7$Gta%-Fw_mgz&6A?mZ!V z{T}z@A$-Fg_wEp$y~o`h!Zmx`kA?7@J?=+Cc!G+bi|b>rb;B2qE6P)dJ-vQ3{x^D+(d)hQ4tTmO_N9uBYdbARFg+`q>Ewf`&skbkZJjQ>mjhyH*2|KtDE|AGIs{}cbm z{*U~@J6_}emw(V7dcgml|9yYIf8N}aE}5`NngeH+S(*W#{~4c2D-oi{G35 zME0KS$Fo%8-Pz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D2kk@8Yvv zJi2XY@X(>dr%zAaJ#+ui(D(knZH4e6{SD-CYH0VfeV)9pWxfM zsl~1xt4c!$Bw;!LY18ctrIUe&F?hbg;<>zgR!Ye@Qg zIy~FS{Wam)>G14Y?%zzhV`*2@caLu*%kCo&&zqijJXf2~^IYHGu{1o`(wi^jdz3ta zM}N<8Rn>$1Gi3D*4dI%D)8F*M0^Wlv_w(dYx%wmao8=#F<{x%n!SDfj^bLpRSlRmK wVEASv^UeIJr9<=g9K!qXUWpw0=DP3=ZEFyi-l@&+y#^`x`$P|T{>{1n3!i-vWB>pF diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_encoder.js b/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_encoder.js deleted file mode 100755 index a67cdf2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/draco/gltf/draco_encoder.js +++ /dev/null @@ -1,33 +0,0 @@ -var DracoEncoderModule = function(DracoEncoderModule) { - DracoEncoderModule = DracoEncoderModule || {}; - -var Module=typeof DracoEncoderModule!=="undefined"?DracoEncoderModule:{};var isRuntimeInitialized=false;var isModuleParsed=false;Module["onRuntimeInitialized"]=(function(){isRuntimeInitialized=true;if(isModuleParsed){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}});Module["onModuleParsed"]=(function(){isModuleParsed=true;if(isRuntimeInitialized){if(typeof Module["onModuleLoaded"]==="function"){Module["onModuleLoaded"](Module)}}});function isVersionSupported(versionString){if(typeof versionString!=="string")return false;const version=versionString.split(".");if(version.length<2||version.length>3)return false;if(version[0]==1&&version[1]>=0&&version[1]<=3)return true;if(version[0]!=0||version[1]>10)return false;return true}Module["isVersionSupported"]=isVersionSupported;var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename)}return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));process["on"]("unhandledRejection",(function(reason,p){process["exit"](1)}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){var data=tryParseAsDataURI(f);if(data){return intArrayToString(data)}return read(f)}}Module["readBinary"]=function readBinary(f){var data;data=tryParseAsDataURI(f);if(data){return data}if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText}catch(err){var data=tryParseAsDataURI(url);if(data){return intArrayToString(data)}throw err}};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){try{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}catch(err){var data=tryParseAsDataURI(url);if(data){return data}throw err}}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}var data=tryParseAsDataURI(url);if(data){onload(data.buffer);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=(function(title){document.title=title})}Module["print"]=typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null;Module["printErr"]=typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||Module["print"];Module.print=Module["print"];Module.printErr=Module["printErr"];for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var STACK_ALIGN=16;function staticAlloc(size){assert(!staticSealed);var ret=STATICTOP;STATICTOP=STATICTOP+size+15&-16;return ret}function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;var ret=size=Math.ceil(size/factor)*factor;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;Module.printErr(text)}}var jsCallStartIndex=1;var functionPointers=new Array(0);var funcWrappers={};function dynCall(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return Module["dynCall_"+sig].call(null,ptr)}}var GLOBAL_BASE=8;var ABORT=0;var EXITSTATUS=0;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}var JSfuncs={"stackSave":(function(){stackSave()}),"stackRestore":(function(){stackRestore()}),"arrayToC":(function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(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})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};function ccall(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}var ALLOC_STATIC=2;var ALLOC_NONE=4;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:staticAlloc,stackAlloc,staticAlloc,dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return UTF8ToString(ptr)}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(u8Array,idx){var endPtr=idx;while(u8Array[endPtr])++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}}function UTF8ToString(ptr){return UTF8ArrayToString(HEAPU8,ptr)}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,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 if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function demangle(func){return func}function demangleAll(text){var regex=/__Z[\w\d_]+/g;return text.replace(regex,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}var WASM_PAGE_SIZE=65536;var ASMJS_PAGE_SIZE=16777216;var MIN_TOTAL_MEMORY=16777216;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 updateGlobalBuffer(buf){Module["buffer"]=buffer=buf}function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE,STATICTOP,staticSealed;var STACK_BASE,STACKTOP,STACK_MAX;var DYNAMIC_BASE,DYNAMICTOP_PTR;STATIC_BASE=STATICTOP=STACK_BASE=STACKTOP=STACK_MAX=DYNAMIC_BASE=DYNAMICTOP_PTR=0;staticSealed=false;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or (4) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}if(!Module["reallocBuffer"])Module["reallocBuffer"]=(function(size){var ret;try{if(ArrayBuffer.transfer){ret=ArrayBuffer.transfer(buffer,size)}else{var oldHEAP8=HEAP8;ret=new ArrayBuffer(size);var temp=new Int8Array(ret);temp.set(oldHEAP8)}}catch(e){return false}var success=_emscripten_replace_memory(ret);if(!success)return false;return ret});function enlargeMemory(){var PAGE_MULTIPLE=Module["usingWasm"]?WASM_PAGE_SIZE:ASMJS_PAGE_SIZE;var LIMIT=2147483648-PAGE_MULTIPLE;if(HEAP32[DYNAMICTOP_PTR>>2]>LIMIT){return false}var OLD_TOTAL_MEMORY=TOTAL_MEMORY;TOTAL_MEMORY=Math.max(TOTAL_MEMORY,MIN_TOTAL_MEMORY);while(TOTAL_MEMORY>2]){if(TOTAL_MEMORY<=536870912){TOTAL_MEMORY=alignUp(2*TOTAL_MEMORY,PAGE_MULTIPLE)}else{TOTAL_MEMORY=Math.min(alignUp((3*TOTAL_MEMORY+2147483648)/4,PAGE_MULTIPLE),LIMIT)}}var replacement=Module["reallocBuffer"](TOTAL_MEMORY);if(!replacement||replacement.byteLength!=TOTAL_MEMORY){TOTAL_MEMORY=OLD_TOTAL_MEMORY;return false}updateGlobalBuffer(replacement);updateGlobalBufferViews();return true}var byteLength;try{byteLength=Function.prototype.call.bind(Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get);byteLength(new ArrayBuffer(4))}catch(e){byteLength=(function(buffer){return buffer.byteLength})}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;if(TOTAL_MEMORY0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Module["dynCall_v"](func)}else{Module["dynCall_vi"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;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 ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}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 addOnPreMain(cb){__ATMAIN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_round=Math.round;var Math_min=Math.min;var Math_max=Math.max;var Math_clz32=Math.clz32;var Math_trunc=Math.trunc;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"]={};var memoryInitializer=null;var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return String.prototype.startsWith?filename.startsWith(dataURIPrefix):filename.indexOf(dataURIPrefix)===0}STATIC_BASE=GLOBAL_BASE;STATICTOP=STATIC_BASE+19728;__ATINIT__.push();memoryInitializer="data:application/octet-stream;base64,HBwAAGQcAAAYAAAAAAAAAPQbAACLHAAAHBwAAKgcAAAYAAAAAAAAAPQbAADRHAAAHBwAAO0cAAAwAAAAAAAAAPQbAAAPHQAAHBwAADQdAAAwAAAAAAAAABwcAADsKQAASAAAAAAAAAAcHAAAZB0AAIAAAAAAAAAAHBwAAL0dAACQAAAAAAAAABwcAAARHgAAoAAAAAAAAAAcHAAARR4AALAAAAAAAAAA9BsAAHAeAAAcHAAAlB4AAMgAAAAAAAAA9BsAADIfAAAcHAAA0B8AAOAAAAAAAAAAHBwAAGggAACAAAAAAAAAABwcAADxIAAA4AAAAAAAAAAcHAAAiyEAAOAAAAAAAAAAHBwAAB0iAADgAAAAAAAAABwcAADDIgAA4AAAAAAAAAAcHAAAXiMAAOAAAAAAAAAAHBwAAPQjAABQAQAAAAAAAPQbAACfJAAAHBwAAEolAABoAQAAAAAAABwcAADvJQAAgAAAAAAAAAAcHAAAhSYAAGgBAAAAAAAAHBwAACwnAABoAQAAA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YWQgdmFsdWUgZm9yIF9fY3hhX2dldF9nbG9iYWxzKCkAdGVybWluYXRlX2hhbmRsZXIgdW5leHBlY3RlZGx5IHJldHVybmVkAFN0MTFsb2dpY19lcnJvcgBTdDEybGVuZ3RoX2Vycm9yAE4xMF9fY3h4YWJpdjExOV9fcG9pbnRlcl90eXBlX2luZm9FAE4xMF9fY3h4YWJpdjExN19fcGJhc2VfdHlwZV9pbmZvRQ==";var tempDoublePtr=STATICTOP;STATICTOP+=16;function ___cxa_allocate_exception(size){return _malloc(size)}function __ZSt18uncaught_exceptionv(){return!!__ZSt18uncaught_exceptionv.uncaught_exception}var EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:(function(adjusted){if(!adjusted||EXCEPTIONS.infos[adjusted])return adjusted;for(var ptr in EXCEPTIONS.infos){var info=EXCEPTIONS.infos[ptr];if(info.adjusted===adjusted){return ptr}}return adjusted}),addRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount++}),decRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];assert(info.refcount>0);info.refcount--;if(info.refcount===0&&!info.rethrown){if(info.destructor){Module["dynCall_vi"](info.destructor,ptr)}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}}),clearRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0})};function ___cxa_begin_catch(ptr){var info=EXCEPTIONS.infos[ptr];if(info&&!info.caught){info.caught=true;__ZSt18uncaught_exceptionv.uncaught_exception--}if(info)info.rethrown=false;EXCEPTIONS.caught.push(ptr);EXCEPTIONS.addRef(EXCEPTIONS.deAdjust(ptr));return ptr}function ___cxa_pure_virtual(){ABORT=true;throw"Pure virtual function called!"}function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(setTempRet0(0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(setTempRet0(0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(setTempRet0(typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(setTempRet0(throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0,caught:false,rethrown:false};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_STATIC);function ___gxx_personality_v0(){}var SYSCALLS={varargs:0,get:(function(varargs){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret}),getStr:(function(){var ret=Pointer_stringify(SYSCALLS.get());return ret}),get64:(function(){var low=SYSCALLS.get(),high=SYSCALLS.get();if(low>=0)assert(high===0);else assert(high===-1);return low}),getZero:(function(){assert(SYSCALLS.get()===0)})};function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);HEAP32[result>>2]=stream.position;if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS==="undefined"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function flush_NO_FILESYSTEM(){var fflush=Module["_fflush"];if(fflush)fflush(0);var printChar=___syscall146.printChar;if(!printChar)return;var buffers=___syscall146.buffers;if(buffers[1].length)printChar(1,10);if(buffers[2].length)printChar(2,10)}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.get(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();var ret=0;if(!___syscall146.buffers){___syscall146.buffers=[null,[],[]];___syscall146.printChar=(function(stream,curr){var buffer=___syscall146.buffers[stream];assert(buffer);if(curr===0||curr===10){(stream===1?Module["print"]:Module["printErr"])(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}})}for(var i=0;i>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j>2]=PTHREAD_SPECIFIC_NEXT_KEY;PTHREAD_SPECIFIC[PTHREAD_SPECIFIC_NEXT_KEY]=0;PTHREAD_SPECIFIC_NEXT_KEY++;return 0}function _pthread_once(ptr,func){if(!_pthread_once.seen)_pthread_once.seen={};if(ptr in _pthread_once.seen)return;Module["dynCall_v"](func);_pthread_once.seen[ptr]=1}function _pthread_setspecific(key,value){if(!(key in PTHREAD_SPECIFIC)){return ERRNO_CODES.EINVAL}PTHREAD_SPECIFIC[key]=value;return 0}function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}DYNAMICTOP_PTR=staticAlloc(4);STACK_BASE=STACKTOP=alignMemory(STATICTOP);STACK_MAX=STACK_BASE+TOTAL_STACK;DYNAMIC_BASE=alignMemory(STACK_MAX);HEAP32[DYNAMICTOP_PTR>>2]=DYNAMIC_BASE;staticSealed=true;var ASSERTIONS=false;function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function intArrayToString(array){var ret=[];for(var i=0;i255){if(ASSERTIONS){assert(false,"Character code "+chr+" ("+String.fromCharCode(chr)+") at offset "+i+" not in 0x00-0xFF.")}chr&=255}ret.push(String.fromCharCode(chr))}return ret.join("")}var decodeBase64=typeof atob==="function"?atob:(function(input){var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i2147483648)return false;b=new a(newBuffer);d=new c(newBuffer);f=new e(newBuffer);h=new g(newBuffer);j=new i(newBuffer);l=new k(newBuffer);n=new m(newBuffer);p=new o(newBuffer);buffer=newBuffer;return true} -// EMSCRIPTEN_START_FUNCS -function be(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;f[a+72>>2]=e;f[a+64>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;k=a+68|0;l=f[k>>2]|0;f[k>>2]=g;if(l|0)Mq(l);l=a+8|0;Mh(l,b,d,e);d=a+56|0;g=f[d>>2]|0;m=f[g+4>>2]|0;n=f[g>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+16|0;q=a+32|0;r=a+12|0;s=a+28|0;t=a+20|0;v=a+24|0;if(m-n>>2>>>0>p>>>0){w=p;x=n}else{y=g;aq(y)}while(1){f[j>>2]=f[x+(w<<2)>>2];f[i>>2]=f[j>>2];Cc(a,i,b,w);g=X(w,e)|0;n=b+(g<<2)|0;p=c+(g<<2)|0;g=f[l>>2]|0;if((g|0)>0){m=0;z=f[k>>2]|0;A=g;while(1){if((A|0)>0){g=0;do{B=f[z+(g<<2)>>2]|0;C=f[o>>2]|0;if((B|0)>(C|0)){D=f[q>>2]|0;f[D+(g<<2)>>2]=C;E=D}else{D=f[r>>2]|0;C=f[q>>2]|0;f[C+(g<<2)>>2]=(B|0)<(D|0)?D:B;E=C}g=g+1|0}while((g|0)<(f[l>>2]|0));F=E}else F=f[q>>2]|0;g=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=g;if((g|0)>=(f[s>>2]|0)){if((g|0)>(f[v>>2]|0)){G=g-(f[t>>2]|0)|0;H=21}}else{G=(f[t>>2]|0)+g|0;H=21}if((H|0)==21){H=0;f[C>>2]=G}m=m+1|0;A=f[l>>2]|0;if((m|0)>=(A|0))break;else z=F}}w=w+-1|0;if((w|0)<=-1){H=5;break}z=f[d>>2]|0;x=f[z>>2]|0;if((f[z+4>>2]|0)-x>>2>>>0<=w>>>0){y=z;H=6;break}}if((H|0)==5){u=h;return 1}else if((H|0)==6)aq(y);return 0}function ce(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;f[i+16>>2]=0;f[i+20>>2]=0;Uc(i,n,o-n>>3,e)|0;n=i+16|0;o=Tn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Vn(o|0,I|0,39,0)|0;o=Yn(l|0,I|0,3)|0;l=Vn(o|0,I|0,8,0)|0;o=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=4194304;if(d){d=c;c=4194304;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<20)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Mf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function de(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[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(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Vn(o|0,I|0,39,0)|0;o=Yn(l|0,I|0,3)|0;l=Vn(o|0,I|0,8,0)|0;o=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=4194304;if(d){d=c;c=4194304;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<20)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Mf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function he(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=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0)<<18)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Of(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function je(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=Oa,t=Oa,u=Oa,v=0,w=0,x=0,y=0,z=0;c=f[b>>2]|0;b=a+4|0;d=f[b>>2]|0;e=(d|0)==0;a:do if(!e){g=d+-1|0;h=(g&d|0)==0;if(!h)if(c>>>0>>0)i=c;else i=(c>>>0)%(d>>>0)|0;else i=g&c;j=f[(f[a>>2]|0)+(i<<2)>>2]|0;if(!j)k=i;else{if(h){h=j;while(1){l=f[h>>2]|0;if(!l){k=i;break a}m=f[l+4>>2]|0;if(!((m|0)==(c|0)|(m&g|0)==(i|0))){k=i;break a}if((f[l+8>>2]|0)==(c|0)){o=l;break}else h=l}p=o+12|0;return p|0}else q=j;while(1){h=f[q>>2]|0;if(!h){k=i;break a}g=f[h+4>>2]|0;if((g|0)!=(c|0)){if(g>>>0>>0)r=g;else r=(g>>>0)%(d>>>0)|0;if((r|0)!=(i|0)){k=i;break a}}if((f[h+8>>2]|0)==(c|0)){o=h;break}else q=h}p=o+12|0;return p|0}}else k=0;while(0);q=ln(16)|0;f[q+8>>2]=c;f[q+12>>2]=0;f[q+4>>2]=c;f[q>>2]=0;i=a+12|0;s=$(((f[i>>2]|0)+1|0)>>>0);t=$(d>>>0);u=$(n[a+16>>2]);do if(e|$(u*t)>>0<3|(d+-1&d|0)!=0)&1;j=~~$(W($(s/u)))>>>0;Hi(a,r>>>0>>0?j:r);r=f[b>>2]|0;j=r+-1|0;if(!(j&r)){v=r;w=j&c;break}if(c>>>0>>0){v=r;w=c}else{v=r;w=(c>>>0)%(r>>>0)|0}}else{v=d;w=k}while(0);k=(f[a>>2]|0)+(w<<2)|0;w=f[k>>2]|0;if(!w){d=a+8|0;f[q>>2]=f[d>>2];f[d>>2]=q;f[k>>2]=d;d=f[q>>2]|0;if(d|0){k=f[d+4>>2]|0;d=v+-1|0;if(d&v)if(k>>>0>>0)x=k;else x=(k>>>0)%(v>>>0)|0;else x=k&d;y=(f[a>>2]|0)+(x<<2)|0;z=30}}else{f[q>>2]=f[w>>2];y=w;z=30}if((z|0)==30)f[y>>2]=q;f[i>>2]=(f[i>>2]|0)+1;o=q;p=o+12|0;return p|0}function ke(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;f[i+16>>2]=0;f[i+20>>2]=0;$c(i,n,o-n>>3,e)|0;n=i+16|0;o=Tn(f[n>>2]|0,f[n+4>>2]|0,1)|0;n=(f[e+4>>2]|0)-(f[e>>2]|0)|0;l=j;f[l>>2]=n;f[l+4>>2]=0;l=Vn(o|0,I|0,39,0)|0;o=Yn(l|0,I|0,3)|0;l=Vn(o|0,I|0,8,0)|0;o=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=262144;if(d){d=c;c=262144;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<16)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}Rf(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function le(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=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;f[j>>2]=0;n=i+32|0;f[n>>2]=16384;if(d){d=c;c=16384;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}_f(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function oe(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2]|0,1,0)|0;l=m;f[l>>2]=p;f[l+4>>2]=I;j=j+1|0}while((j|0)!=(c|0))}j=i+40|0;l=j;f[l>>2]=0;f[l+4>>2]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i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,I|0,39,0)|0;o=Yn(l|0,I|0,3)|0;l=Vn(o|0,I|0,8,0)|0;o=Vn(l|0,I|0,n|0,0)|0;Cl(e,o,I);o=i+24|0;f[o>>2]=(f[e>>2]|0)+(f[j>>2]|0);j=i+28|0;f[j>>2]=0;n=i+32|0;f[n>>2]=16384;if(d){d=c;c=16384;do{l=d;d=d+-1|0;p=f[a+(d<<2)>>2]|0;m=f[i>>2]|0;q=f[m+(p<<3)>>2]|0;r=q<<10;if(c>>>0>>0)s=c;else{t=c;while(1){v=f[o>>2]|0;w=f[j>>2]|0;f[j>>2]=w+1;b[v+w>>0]=t;w=(f[n>>2]|0)>>>8;f[n>>2]=w;if(w>>>0>>0){s=w;break}else t=w}}c=(((s>>>0)/(q>>>0)|0)<<12)+((s>>>0)%(q>>>0)|0)+(f[m+(p<<3)+4>>2]|0)|0;f[n>>2]=c}while((l|0)>1)}_f(i,e);e=f[i>>2]|0;if(e|0){c=i+4|0;i=f[c>>2]|0;if((i|0)!=(e|0))f[c>>2]=i+(~((i+-8-e|0)>>>3)<<3);Oq(e)}e=f[h>>2]|0;if(!e){u=g;return 1}h=f[k>>2]|0;if((h|0)!=(e|0))f[k>>2]=h+(~((h+-8-e|0)>>>3)<<3);Oq(e);u=g;return 1}function se(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;g=u;u=u+64|0;h=g+48|0;i=g;j=d+1|0;f[h>>2]=0;k=h+4|0;f[k>>2]=0;f[h+8>>2]=0;do if(j)if(j>>>0>536870911)aq(h);else{l=ln(j<<3)|0;f[h>>2]=l;m=l+(j<<3)|0;f[h+8>>2]=m;sj(l|0,0,(d<<3)+8|0)|0;f[k>>2]=m;n=l;o=m;break}else{n=0;o=0}while(0);d=(c|0)>0;if(d){j=0;do{m=n+(f[a+(j<<2)>>2]<<3)|0;l=m;p=Vn(f[l>>2]|0,f[l+4>>2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[j>>2]|0;f[r+(s<<2)>>2]=n;s=s+1|0}while(s>>>0<(f[i>>2]|0)-r>>2>>>0)}i=a+92|0;s=f[b>>2]|0;j=f[s>>2]|0;d=(f[s+4>>2]|0)-j>>2;e=a+96|0;r=f[e>>2]|0;n=f[i>>2]|0;k=r-n>>2;m=n;n=r;if(d>>>0<=k>>>0)if(d>>>0>>0?(r=m+(d<<2)|0,(r|0)!=(n|0)):0){f[e>>2]=n+(~((n+-4-r|0)>>>2)<<2);t=s;v=j}else{t=s;v=j}else{Ci(i,d-k|0);k=f[b>>2]|0;t=k;v=f[k>>2]|0}k=f[t+4>>2]|0;if((k|0)!=(v|0)){v=f[i>>2]|0;i=f[t>>2]|0;t=k-i>>2;k=0;do{f[v+(k<<2)>>2]=f[i+(k<<2)>>2];k=k+1|0}while(k>>>0>>0)}t=(f[h>>2]|0)-(f[g>>2]|0)+1|0;g=a+136|0;h=a+140|0;a=f[h>>2]|0;k=f[g>>2]|0;i=(a-k|0)/12|0;v=a;if(t>>>0>i>>>0){Kf(g,t-i|0);u=c;return 1}if(t>>>0>=i>>>0){u=c;return 1}i=k+(t*12|0)|0;if((i|0)==(v|0)){u=c;return 1}else w=v;while(1){v=w+-12|0;f[h>>2]=v;t=f[v>>2]|0;if(!t)x=v;else{v=w+-8|0;k=f[v>>2]|0;if((k|0)!=(t|0))f[v>>2]=k+(~((k+-4-t|0)>>>2)<<2);Oq(t);x=f[h>>2]|0}if((x|0)==(i|0))break;else w=x}u=c;return 1}function we(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;e=f[b>>2]|0;g=f[b+4>>2]|0;h=((f[c>>2]|0)-e<<3)+(f[c+4>>2]|0)-g|0;c=e;if((h|0)<=0){i=d+4|0;j=f[d>>2]|0;f[a>>2]=j;k=a+4|0;l=f[i>>2]|0;f[k>>2]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}if((x|0)<=0){j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}p=f[y>>2]&-1>>>(32-x|0);y=(w|0)<(x|0)?w:x;n=f[d>>2]|0;i=f[n>>2]&~(-1<>2]&-1>>>(w-y|0));f[n>>2]=i;f[n>>2]=i|p<>2];i=(f[o>>2]|0)+y|0;w=n+(i>>>5<<2)|0;f[d>>2]=w;f[o>>2]=i&31;i=x-y|0;if((i|0)<=0){j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}f[w>>2]=f[w>>2]&~(-1>>>(32-i|0))|p>>>y;f[o>>2]=i;j=o;k=f[d>>2]|0;f[a>>2]=k;l=a+4|0;m=f[j>>2]|0;f[l>>2]=m;return}function ye(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+9|0;i=d+8|0;j=f[(f[a+184>>2]|0)+(c<<2)>>2]&255;b[h>>0]=j;c=a+4|0;k=f[(f[c>>2]|0)+44>>2]|0;l=k+16|0;m=f[l+4>>2]|0;if((m|0)>0|(m|0)==0&(f[l>>2]|0)>>>0>0)n=j;else{f[g>>2]=f[k+4>>2];f[e>>2]=f[g>>2];Me(k,e,h,h+1|0)|0;n=b[h>>0]|0}a:do if(n<<24>>24>-1){k=a+172|0;j=f[(f[k>>2]|0)+((n<<24>>24)*136|0)>>2]|0;l=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+52|0;m=b[h>>0]|0;o=f[k>>2]|0;k=f[o+(m*136|0)+132>>2]|0;switch(f[(f[(f[l>>2]|0)+84>>2]|0)+(j<<2)>>2]|0){case 0:{p=k;q=7;break a;break}case 1:{if(b[o+(m*136|0)+28>>0]|0){p=k;q=7;break a}break}default:{}}m=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=1;o=m+16|0;j=f[o+4>>2]|0;if(!((j|0)>0|(j|0)==0&(f[o>>2]|0)>>>0>0)){f[g>>2]=f[m+4>>2];f[e>>2]=f[g>>2];Me(m,e,i,i+1|0)|0}r=k}else{p=f[a+68>>2]|0;q=7}while(0);if((q|0)==7){q=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=0;a=q+16|0;h=f[a+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[a>>2]|0)>>>0>0)){f[g>>2]=f[q+4>>2];f[e>>2]=f[g>>2];Me(q,e,i,i+1|0)|0}r=p}p=f[(f[c>>2]|0)+44>>2]|0;b[i>>0]=r;r=p+16|0;c=f[r+4>>2]|0;if((c|0)>0|(c|0)==0&(f[r>>2]|0)>>>0>0){u=d;return 1}f[g>>2]=f[p+4>>2];f[e>>2]=f[g>>2];Me(p,e,i,i+1|0)|0;u=d;return 1}function ze(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Mh(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;aq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];ub(k,i,b,x);l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)aq(z);return 0}function Ae(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;h=u;u=u+16|0;i=h+4|0;j=h;k=a+60|0;f[a+64>>2]=g;g=a+8|0;Mh(g,b,d,e);d=a+56|0;l=f[d>>2]|0;m=f[l+4>>2]|0;n=f[l>>2]|0;o=m-n|0;if((o|0)<=0){u=h;return 1}p=(o>>>2)+-1|0;o=a+68|0;q=a+16|0;r=a+32|0;s=a+12|0;t=a+28|0;v=a+20|0;w=a+24|0;if(m-n>>2>>>0>p>>>0){x=p;y=n}else{z=l;aq(z)}while(1){f[j>>2]=f[y+(x<<2)>>2];f[i>>2]=f[j>>2];tb(k,i,b,x);l=X(x,e)|0;n=b+(l<<2)|0;p=c+(l<<2)|0;l=f[g>>2]|0;if((l|0)>0){m=0;a=o;A=l;while(1){if((A|0)>0){l=0;do{B=f[a+(l<<2)>>2]|0;C=f[q>>2]|0;if((B|0)>(C|0)){D=f[r>>2]|0;f[D+(l<<2)>>2]=C;E=D}else{D=f[s>>2]|0;C=f[r>>2]|0;f[C+(l<<2)>>2]=(B|0)<(D|0)?D:B;E=C}l=l+1|0}while((l|0)<(f[g>>2]|0));F=E}else F=f[r>>2]|0;l=(f[n+(m<<2)>>2]|0)-(f[F+(m<<2)>>2]|0)|0;C=p+(m<<2)|0;f[C>>2]=l;if((l|0)>=(f[t>>2]|0)){if((l|0)>(f[w>>2]|0)){G=l-(f[v>>2]|0)|0;H=18}}else{G=(f[v>>2]|0)+l|0;H=18}if((H|0)==18){H=0;f[C>>2]=G}m=m+1|0;A=f[g>>2]|0;if((m|0)>=(A|0))break;else a=F}}x=x+-1|0;if((x|0)<=-1){H=3;break}a=f[d>>2]|0;y=f[a>>2]|0;if((f[a+4>>2]|0)-y>>2>>>0<=x>>>0){z=a;H=4;break}}if((H|0)==3){u=h;return 1}else if((H|0)==4)aq(z);return 0}function Be(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+12|0;g=f[e>>2]|0;h=(f[g+4>>2]|0)-(f[g>>2]|0)>>2;if(!h){u=b;return 1}i=a+152|0;j=a+140|0;k=a+144|0;l=a+148|0;a=0;m=g;while(1){f[d>>2]=(a>>>0)/3|0;f[c>>2]=f[d>>2];if(!(_j(m,c)|0)?(g=f[e>>2]|0,(f[(f[g+12>>2]|0)+(a<<2)>>2]|0)==-1):0){n=a+1|0;o=((n>>>0)%3|0|0)==0?a+-2|0:n;if((o|0)==-1)p=-1;else p=f[(f[g>>2]|0)+(o<<2)>>2]|0;o=f[i>>2]|0;if((f[o+(p<<2)>>2]|0)==-1){g=f[k>>2]|0;n=f[l>>2]|0;if((g|0)==(n<<5|0)){if((g+1|0)<0){q=11;break}r=n<<6;n=g+32&-32;vi(j,g>>>0<1073741823?(r>>>0>>0?n:r):2147483647);s=f[k>>2]|0;t=f[i>>2]|0}else{s=g;t=o}f[k>>2]=s+1;o=(f[j>>2]|0)+(s>>>5<<2)|0;f[o>>2]=f[o>>2]&~(1<<(s&31));o=t+(p<<2)|0;if((f[o>>2]|0)==-1){r=a;n=o;while(1){f[n>>2]=g;o=r+1|0;a:do if((r|0)!=-1?(v=((o>>>0)%3|0|0)==0?r+-2|0:o,(v|0)!=-1):0){w=f[e>>2]|0;x=f[w+12>>2]|0;y=v;while(1){v=f[x+(y<<2)>>2]|0;if((v|0)==-1)break;z=v+1|0;A=((z>>>0)%3|0|0)==0?v+-2|0:z;if((A|0)==-1){B=-1;C=-1;break a}else y=A}x=y+1|0;A=((x>>>0)%3|0|0)==0?y+-2|0:x;if((A|0)==-1){B=y;C=-1}else{B=y;C=f[(f[w>>2]|0)+(A<<2)>>2]|0}}else{B=-1;C=-1}while(0);n=t+(C<<2)|0;if((f[n>>2]|0)!=-1)break;else r=B}}}}r=a+1|0;if(r>>>0>=h>>>0){q=3;break}a=r;m=f[e>>2]|0}if((q|0)==3){u=b;return 1}else if((q|0)==11)aq(j);return 0}function Ce(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=u;u=u+32|0;e=d+8|0;g=d;h=a+4|0;i=f[h>>2]|0;if(i>>>0>=b>>>0){f[h>>2]=b;u=d;return}j=a+8|0;k=f[j>>2]|0;l=k<<5;m=b-i|0;if(l>>>0>>0|i>>>0>(l-m|0)>>>0){f[e>>2]=0;n=e+4|0;f[n>>2]=0;o=e+8|0;f[o>>2]=0;if((b|0)<0)aq(a);p=k<<6;k=b+31&-32;vi(e,l>>>0<1073741823?(p>>>0>>0?k:p):2147483647);p=f[h>>2]|0;f[n>>2]=p+m;k=f[a>>2]|0;l=k;q=f[e>>2]|0;r=(l+(p>>>5<<2)-k<<3)+(p&31)|0;if((r|0)>0){p=r>>>5;im(q|0,k|0,p<<2|0)|0;k=r&31;r=q+(p<<2)|0;s=r;if(!k){t=0;v=s}else{w=-1>>>(32-k|0);f[r>>2]=f[r>>2]&~w|f[l+(p<<2)>>2]&w;t=k;v=s}}else{t=0;v=q}f[g>>2]=v;f[g+4>>2]=t;t=g;g=f[t>>2]|0;v=f[t+4>>2]|0;t=f[a>>2]|0;f[a>>2]=f[e>>2];f[e>>2]=t;e=f[h>>2]|0;f[h>>2]=f[n>>2];f[n>>2]=e;e=f[j>>2]|0;f[j>>2]=f[o>>2];f[o>>2]=e;if(t|0)Oq(t);x=g;y=v}else{v=(f[a>>2]|0)+(i>>>5<<2)|0;f[h>>2]=b;x=v;y=i&31}if(!m){u=d;return}i=(y|0)==0;v=x;if(c){if(i){z=m;A=x;B=v}else{c=32-y|0;b=c>>>0>m>>>0?m:c;f[v>>2]=f[v>>2]|-1>>>(c-b|0)&-1<>>5;sj(A|0,-1,c<<2|0)|0;A=z&31;z=B+(c<<2)|0;if(!A){u=d;return}f[z>>2]=f[z>>2]|-1>>>(32-A|0);u=d;return}else{if(i){C=m;D=x;E=v}else{x=32-y|0;i=x>>>0>m>>>0?m:x;f[v>>2]=f[v>>2]&~(-1>>>(x-i|0)&-1<>>5;sj(D|0,0,y<<2|0)|0;D=C&31;C=E+(y<<2)|0;if(!D){u=d;return}f[C>>2]=f[C>>2]&~(-1>>>(32-D|0));u=d;return}}function De(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0;a=u;u=u+48|0;g=a+36|0;h=a+24|0;i=a+12|0;j=a;if(!c){k=0;u=a;return k|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;l=Gj(d)|0;if(l>>>0>4294967279)aq(g);if(l>>>0<11){b[g+11>>0]=l;if(!l)m=g;else{n=g;o=7}}else{p=l+16&-16;q=ln(p)|0;f[g>>2]=q;f[g+8>>2]=p|-2147483648;f[g+4>>2]=l;n=q;o=7}if((o|0)==7){kh(n|0,d|0,l|0)|0;m=n}b[m+l>>0]=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;l=Gj(e)|0;if(l>>>0>4294967279)aq(h);if(l>>>0<11){b[h+11>>0]=l;if(!l)r=h;else{s=h;o=13}}else{m=l+16&-16;n=ln(m)|0;f[h>>2]=n;f[h+8>>2]=m|-2147483648;f[h+4>>2]=l;s=n;o=13}if((o|0)==13){kh(s|0,e|0,l|0)|0;r=s}b[r+l>>0]=0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;l=Gj(d)|0;if(l>>>0>4294967279)aq(i);if(l>>>0<11){b[i+11>>0]=l;if(!l)t=i;else{v=i;o=19}}else{r=l+16&-16;s=ln(r)|0;f[i>>2]=s;f[i+8>>2]=r|-2147483648;f[i+4>>2]=l;v=s;o=19}if((o|0)==19){kh(v|0,d|0,l|0)|0;t=v}b[t+l>>0]=0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=Gj(e)|0;if(l>>>0>4294967279)aq(j);if(l>>>0<11){b[j+11>>0]=l;if(!l)w=j;else{x=j;o=25}}else{t=l+16&-16;v=ln(t)|0;f[j>>2]=v;f[j+8>>2]=t|-2147483648;f[j+4>>2]=l;x=v;o=25}if((o|0)==25){kh(x|0,e|0,l|0)|0;w=x}b[w+l>>0]=0;mn(c,i,j);if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);if((b[i+11>>0]|0)<0)Oq(f[i>>2]|0);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);k=1;u=a;return k|0}function Ee(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;f[a>>2]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,A|0)|0;kh(j|0,(f[f[d>>2]>>2]|0)+p|0,B|0)|0;rf(k,j,l,m);f[o+(w<<2)>>2]=f[l>>2];f[o+((w|1)<<2)>>2]=f[m>>2];v=v+1|0;x=f[e>>2]|0;if(v>>>0>=(f[n>>2]|0)-x>>2>>>0)break;else w=w+2|0}q=f[i>>2]|0}f[a>>2]=q;f[i>>2]=0;u=h;return}f[a>>2]=0;f[i>>2]=0;if(!g){u=h;return}i=g+88|0;a=f[i>>2]|0;f[i>>2]=0;if(a|0){i=f[a+8>>2]|0;if(i|0){q=a+12|0;if((f[q>>2]|0)!=(i|0))f[q>>2]=i;Oq(i)}Oq(a)}a=f[g+68>>2]|0;if(a|0){i=g+72|0;q=f[i>>2]|0;if((q|0)!=(a|0))f[i>>2]=q+(~((q+-4-a|0)>>>2)<<2);Oq(a)}a=g+64|0;q=f[a>>2]|0;f[a>>2]=0;if(q|0){a=f[q>>2]|0;if(a|0){i=q+4|0;if((f[i>>2]|0)!=(a|0))f[i>>2]=a;Oq(a)}Oq(q)}Oq(g);u=h;return}function Ge(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if(((e-h|0)/136|0)>>>0>=c>>>0){i=c;j=h;do{f[j>>2]=-1;Ok(j+4|0);b[j+100>>0]=1;k=j+104|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[k+24>>2]=0;j=(f[g>>2]|0)+136|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/136|0;h=j+c|0;if(h>>>0>31580641)aq(a);k=(e-i|0)/136|0;i=k<<1;e=k>>>0<15790320?(i>>>0>>0?h:i):31580641;do if(e)if(e>>>0>31580641){i=ra(8)|0;Oo(i,16035);f[i>>2]=7256;va(i|0,1112,110)}else{l=ln(e*136|0)|0;break}else l=0;while(0);i=l+(j*136|0)|0;j=i;h=l+(e*136|0)|0;e=c;c=j;l=i;do{f[l>>2]=-1;Ok(l+4|0);b[l+100>>0]=1;k=l+104|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[k+24>>2]=0;l=c+136|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=f[g>>2]|0;if((l|0)==(e|0)){m=j;n=e;o=e}else{k=l;l=j;j=i;do{k=k+-136|0;Ee(j+-136|0,k);j=l+-136|0;l=j}while((k|0)!=(e|0));m=l;n=f[a>>2]|0;o=f[g>>2]|0}f[a>>2]=m;f[g>>2]=c;f[d>>2]=h;h=n;if((o|0)!=(h|0)){d=o;do{o=f[d+-20>>2]|0;if(o|0){c=d+-16|0;g=f[c>>2]|0;if((g|0)!=(o|0))f[c>>2]=g+(~((g+-4-o|0)>>>2)<<2);Oq(o)}o=f[d+-32>>2]|0;if(o|0){g=d+-28|0;c=f[g>>2]|0;if((c|0)!=(o|0))f[g>>2]=c+(~((c+-4-o|0)>>>2)<<2);Oq(o)}Mi(d+-132|0);d=d+-136|0}while((d|0)!=(h|0))}if(!n)return;Oq(n);return}function He(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=f[b>>2]|0;b=a+12|0;d=(c|0)==-1;e=c+1|0;do if(!d){g=((e>>>0)%3|0|0)==0?c+-2|0:e;if(!((c>>>0)%3|0)){h=g;i=c+2|0;break}else{h=g;i=c+-1|0;break}}else{h=-1;i=-1}while(0);e=d?-1:(c>>>0)/3|0;g=a+28|0;j=(f[g>>2]|0)+(e>>>5<<2)|0;f[j>>2]=1<<(e&31)|f[j>>2];j=a+172|0;e=a+176|0;k=a+280|0;if(((!d?(d=f[(f[(f[b>>2]|0)+12>>2]|0)+(c<<2)>>2]|0,(d|0)!=-1):0)?(a=(d>>>0)/3|0,(f[(f[g>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0):0)?(a=f[j>>2]|0,(f[e>>2]|0)!=(a|0)):0){d=c>>>5;l=1<<(c&31);c=0;m=a;do{a=(f[k>>2]|0)+(c<<5)|0;if(!(l&f[(f[m+(c*136|0)+4>>2]|0)+(d<<2)>>2]))fj(a,0);else fj(a,1);c=c+1|0;m=f[j>>2]|0}while(c>>>0<(((f[e>>2]|0)-m|0)/136|0)>>>0)}if((((h|0)!=-1?(m=f[(f[(f[b>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,(m|0)!=-1):0)?(c=(m>>>0)/3|0,(f[(f[g>>2]|0)+(c>>>5<<2)>>2]&1<<(c&31)|0)==0):0)?(c=f[j>>2]|0,(f[e>>2]|0)!=(c|0)):0){m=h>>>5;d=1<<(h&31);h=0;l=c;do{c=(f[k>>2]|0)+(h<<5)|0;if(!(d&f[(f[l+(h*136|0)+4>>2]|0)+(m<<2)>>2]))fj(c,0);else fj(c,1);h=h+1|0;l=f[j>>2]|0}while(h>>>0<(((f[e>>2]|0)-l|0)/136|0)>>>0)}if((i|0)==-1)return 1;l=f[(f[(f[b>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;if((l|0)==-1)return 1;b=(l>>>0)/3|0;if(f[(f[g>>2]|0)+(b>>>5<<2)>>2]&1<<(b&31)|0)return 1;b=f[j>>2]|0;if((f[e>>2]|0)==(b|0))return 1;g=i>>>5;l=1<<(i&31);i=0;h=b;do{b=(f[k>>2]|0)+(i<<5)|0;if(!(l&f[(f[h+(i*136|0)+4>>2]|0)+(g<<2)>>2]))fj(b,0);else fj(b,1);i=i+1|0;h=f[j>>2]|0}while(i>>>0<(((f[e>>2]|0)-h|0)/136|0)>>>0);return 1}function Ie(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;d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j>>2]|0)-(f[e>>2]|0)>>2,l,g,d,1);g=f[a>>2]|0;a=(f[f[g>>2]>>2]|0)+(f[g+48>>2]|0)|0;g=f[c+4>>2]|0;Ap(i);Ko(i,$(n[c+20>>2]),(1<>>0>1073741823?-1:l<<2)|0;m=f[j>>2]|0;j=f[e>>2]|0;e=j;if((m|0)==(j|0)){Mq(g);u=h;return}o=d+68|0;p=d+48|0;q=d+40|0;r=c+8|0;c=i+4|0;s=(b[d+84>>0]|0)==0;t=m-j>>2;if(k<<24>>24>0){v=0;w=0}else{k=0;do{j=f[e+(k<<2)>>2]|0;if(s)x=f[(f[o>>2]|0)+(j<<2)>>2]|0;else x=j;j=p;m=f[j>>2]|0;y=f[j+4>>2]|0;j=q;z=f[j>>2]|0;A=un(z|0,f[j+4>>2]|0,x|0,0)|0;j=Vn(A|0,I|0,m|0,y|0)|0;kh(g|0,(f[f[d>>2]>>2]|0)+j|0,z|0)|0;k=k+1|0}while(k>>>0>>0);Mq(g);u=h;return}while(1){k=f[e+(v<<2)>>2]|0;if(s)B=f[(f[o>>2]|0)+(k<<2)>>2]|0;else B=k;k=p;x=f[k>>2]|0;z=f[k+4>>2]|0;k=q;j=f[k>>2]|0;y=un(j|0,f[k+4>>2]|0,B|0,0)|0;k=Vn(y|0,I|0,x|0,z|0)|0;kh(g|0,(f[f[d>>2]>>2]|0)+k|0,j|0)|0;j=f[r>>2]|0;C=$(n[i>>2]);k=0;z=w;while(1){D=$(n[g+(k<<2)>>2]);E=$(D-$(n[j+(k<<2)>>2]));x=E<$(0.0);D=$(-E);F=$((x?D:E)/C);y=~~$(J($($(F*$(f[c>>2]|0))+$(.5))));f[a+(z<<2)>>2]=x?0-y|0:y;k=k+1|0;if((k|0)==(l|0))break;else z=z+1|0}v=v+1|0;if(v>>>0>=t>>>0)break;else w=w+l|0}Mq(g);u=h;return}function Ke(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0;d=u;u=u+32|0;e=d+16|0;g=d+12|0;h=d+8|0;i=d+4|0;j=d;lp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;k=a+24|0;lp(k);if((a|0)!=(b|0)){f[h>>2]=f[b>>2];f[i>>2]=b+4;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(a,g,e)}l=b+24|0;if((k|0)!=(l|0)){f[h>>2]=f[l>>2];f[i>>2]=b+28;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(k,g,e)}f[j>>2]=0;k=c+8|0;l=c+12|0;c=f[l>>2]|0;m=f[k>>2]|0;if((c-m|0)<=0){u=d;return}n=b+16|0;b=m;m=c;c=0;while(1){o=f[(f[b+(c<<2)>>2]|0)+56>>2]|0;p=f[n>>2]|0;if(p){q=n;r=p;a:while(1){p=r;while(1){if((f[p+16>>2]|0)>=(o|0))break;s=f[p+4>>2]|0;if(!s){t=q;break a}else p=s}r=f[p>>2]|0;if(!r){t=p;break}else q=p}if((t|0)!=(n|0)?(o|0)>=(f[t+16>>2]|0):0){q=t+20|0;r=Hd(a,j)|0;if((r|0)!=(q|0)){f[h>>2]=f[q>>2];f[i>>2]=t+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(r,g,e)}v=f[j>>2]|0;w=f[k>>2]|0;x=f[l>>2]|0}else{v=c;w=b;x=m}}else{v=c;w=b;x=m}c=v+1|0;f[j>>2]=c;if((c|0)>=(x-w>>2|0))break;else{b=w;m=x}}u=d;return}function Le(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+12|0;ci(f[i>>2]|0,c)|0;if(!(f[i>>2]|0)){j=1;u=d;return j|0}k=c+16|0;l=c+4|0;m=h+1|0;n=h+1|0;o=h+1|0;p=0;while(1){q=f[a>>2]|0;r=f[q+(p<<3)>>2]|0;if(r>>>0>63)if(r>>>0>16383)if(r>>>0>4194303){j=0;s=20;break}else{t=2;s=13}else{t=1;s=13}else if(!r){v=p+1|0;w=0;while(1){if(f[q+(v+w<<3)>>2]|0){x=w;break}y=w+1|0;if(y>>>0<63)w=y;else{x=y;break}}b[h>>0]=x<<2|3;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,o)|0}z=x+p|0}else{t=0;s=13}if((s|0)==13){s=0;b[h>>0]=t|r<<2;w=k;v=f[w+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[w>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,n)|0}if(!t)z=p;else{w=0;do{w=w+1|0;b[h>>0]=r>>>((w<<3)+-2|0);v=k;q=f[v+4>>2]|0;if(!((q|0)>0|(q|0)==0&(f[v>>2]|0)>>>0>0)){f[g>>2]=f[l>>2];f[e>>2]=f[g>>2];Me(c,e,h,m)|0}}while((w|0)<(t|0));z=p}}p=z+1|0;if(p>>>0>=(f[i>>2]|0)>>>0){j=1;s=20;break}}if((s|0)==20){u=d;return j|0}return 0}function Me(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;g=f[a>>2]|0;h=g;i=(f[c>>2]|0)-h|0;c=g+i|0;j=e-d|0;if((j|0)<=0){k=c;return k|0}l=a+8|0;m=f[l>>2]|0;n=a+4|0;o=f[n>>2]|0;p=o;if((j|0)<=(m-p|0)){q=p-c|0;if((j|0)>(q|0)){r=d+q|0;if((r|0)==(e|0))s=o;else{t=r;u=o;while(1){b[u>>0]=b[t>>0]|0;t=t+1|0;v=(f[n>>2]|0)+1|0;f[n>>2]=v;if((t|0)==(e|0)){s=v;break}else u=v}}if((q|0)>0){w=r;x=s}else{k=c;return k|0}}else{w=e;x=o}s=x-(c+j)|0;r=c+s|0;if(r>>>0>>0){q=r;r=x;do{b[r>>0]=b[q>>0]|0;q=q+1|0;r=(f[n>>2]|0)+1|0;f[n>>2]=r}while((q|0)!=(o|0))}if(s|0)im(x+(0-s)|0,c|0,s|0)|0;if((w|0)==(d|0)){k=c;return k|0}else{y=d;z=c}while(1){b[z>>0]=b[y>>0]|0;y=y+1|0;if((y|0)==(w|0)){k=c;break}else z=z+1|0}return k|0}z=p-h+j|0;if((z|0)<0)aq(a);j=m-h|0;h=j<<1;m=j>>>0<1073741823?(h>>>0>>0?z:h):2147483647;h=c;if(!m)A=0;else A=ln(m)|0;z=A+i|0;i=z;j=A+m|0;if((d|0)==(e|0)){B=i;C=g}else{g=d;d=i;i=z;do{b[i>>0]=b[g>>0]|0;i=d+1|0;d=i;g=g+1|0}while((g|0)!=(e|0));B=d;C=f[a>>2]|0}d=h-C|0;e=z+(0-d)|0;if((d|0)>0)kh(e|0,C|0,d|0)|0;d=(f[n>>2]|0)-h|0;if((d|0)>0){h=B;kh(h|0,c|0,d|0)|0;D=h+d|0;E=f[a>>2]|0}else{D=B;E=C}f[a>>2]=e;f[n>>2]=D;f[l>>2]=j;if(!E){k=z;return k|0}Oq(E);k=z;return k|0}function Ne(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+16|0;g=e;h=f[(f[c+4>>2]|0)+(d<<2)>>2]|0;d=f[c+28>>2]|0;c=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(h<<2)>>2]|0;switch(f[c+28>>2]|0){case 5:case 6:case 3:case 4:case 1:case 2:{i=ln(40)|0;zo(i);j=i;k=j;f[a>>2]=k;u=e;return}case 9:{l=3;break}default:{}}if((l|0)==3){i=f[d+48>>2]|0;d=ln(32)|0;f[g>>2]=d;f[g+8>>2]=-2147483616;f[g+4>>2]=17;m=d;n=14495;o=m+17|0;do{b[m>>0]=b[n>>0]|0;m=m+1|0;n=n+1|0}while((m|0)<(o|0));b[d+17>>0]=0;d=i+16|0;n=f[d>>2]|0;if(n){p=d;q=n;a:while(1){n=q;while(1){if((f[n+16>>2]|0)>=(h|0))break;r=f[n+4>>2]|0;if(!r){s=p;break a}else n=r}q=f[n>>2]|0;if(!q){s=n;break}else p=n}if(((s|0)!=(d|0)?(h|0)>=(f[s+16>>2]|0):0)?(h=s+20|0,(Jh(h,g)|0)!=0):0)t=Hk(h,g,-1)|0;else l=12}else l=12;if((l|0)==12)t=Hk(i,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((t|0)>0)if((f[c+56>>2]|0)==1){c=ln(48)|0;m=c;o=m+48|0;do{f[m>>2]=0;m=m+4|0}while((m|0)<(o|0));zo(c);f[c>>2]=2496;f[c+40>>2]=1168;f[c+44>>2]=-1;j=c;k=j;f[a>>2]=k;u=e;return}else{c=ln(64)|0;ym(c);j=c;k=j;f[a>>2]=k;u=e;return}}c=ln(36)|0;Hm(c);j=c;k=j;f[a>>2]=k;u=e;return}function Oe(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=(c|0)==(a|0);b[c+12>>0]=d&1;if(d)return;else e=c;while(1){g=e+8|0;h=f[g>>2]|0;c=h+12|0;if(b[c>>0]|0){i=23;break}j=h+8|0;k=f[j>>2]|0;d=f[k>>2]|0;if((d|0)==(h|0)){l=f[k+4>>2]|0;if(!l){i=7;break}m=l+12|0;if(!(b[m>>0]|0))n=m;else{i=7;break}}else{if(!d){i=16;break}m=d+12|0;if(!(b[m>>0]|0))n=m;else{i=16;break}}b[c>>0]=1;c=(k|0)==(a|0);b[k+12>>0]=c&1;b[n>>0]=1;if(c){i=23;break}else e=k}if((i|0)==7){if((f[h>>2]|0)==(e|0)){o=h;p=k}else{n=h+4|0;a=f[n>>2]|0;c=f[a>>2]|0;f[n>>2]=c;if(!c)q=k;else{f[c+8>>2]=h;q=f[j>>2]|0}f[a+8>>2]=q;q=f[j>>2]|0;f[((f[q>>2]|0)==(h|0)?q:q+4|0)>>2]=a;f[a>>2]=h;f[j>>2]=a;o=a;p=f[a+8>>2]|0}b[o+12>>0]=1;b[p+12>>0]=0;o=f[p>>2]|0;a=o+4|0;q=f[a>>2]|0;f[p>>2]=q;if(q|0)f[q+8>>2]=p;q=p+8|0;f[o+8>>2]=f[q>>2];c=f[q>>2]|0;f[((f[c>>2]|0)==(p|0)?c:c+4|0)>>2]=o;f[a>>2]=p;f[q>>2]=o;return}else if((i|0)==16){if((f[h>>2]|0)==(e|0)){o=e+4|0;q=f[o>>2]|0;f[h>>2]=q;if(!q)r=k;else{f[q+8>>2]=h;r=f[j>>2]|0}f[g>>2]=r;r=f[j>>2]|0;f[((f[r>>2]|0)==(h|0)?r:r+4|0)>>2]=e;f[o>>2]=h;f[j>>2]=e;s=e;t=f[e+8>>2]|0}else{s=h;t=k}b[s+12>>0]=1;b[t+12>>0]=0;s=t+4|0;k=f[s>>2]|0;h=f[k>>2]|0;f[s>>2]=h;if(h|0)f[h+8>>2]=t;h=t+8|0;f[k+8>>2]=f[h>>2];s=f[h>>2]|0;f[((f[s>>2]|0)==(t|0)?s:s+4|0)>>2]=k;f[k>>2]=t;f[h>>2]=k;return}else if((i|0)==23)return}function Pe(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;d=f[b>>2]|0;b=a+12|0;e=(d|0)==-1;do if(e){g=1;h=-1;i=-1}else{j=d+(((d>>>0)%3|0|0)==0?2:-1)|0;if((j|0)!=-1){k=f[(f[b>>2]|0)+12>>2]|0;l=j;while(1){j=f[k+(l<<2)>>2]|0;if((j|0)==-1){m=0;n=l;break}o=j+1|0;l=((o>>>0)%3|0|0)==0?j+-2|0:o;if((l|0)==-1){m=1;n=-1;break}}if(e){g=m;h=-1;i=n;break}else{p=m;q=n}}else{p=1;q=-1}g=p;h=f[(f[f[b>>2]>>2]|0)+(d<<2)>>2]|0;i=q}while(0);if(c){c=(f[a+84>>2]|0)+(h>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(h&31);r=1}else r=0;c=f[(f[a+152>>2]|0)+(h<<2)>>2]|0;q=(f[a+140>>2]|0)+(c>>>5<<2)|0;f[q>>2]=f[q>>2]|1<<(c&31);if(!g){g=(((i>>>0)%3|0|0)==0?2:-1)+i|0;if((g|0)==-1){s=-1;t=i}else{s=f[(f[f[b>>2]>>2]|0)+(g<<2)>>2]|0;t=i}}else{s=-1;t=-1}if((s|0)==(h|0)){u=r;return u|0}i=f[a+84>>2]|0;a=r;r=s;s=t;while(1){t=i+(r>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(r&31);t=a+1|0;g=s+1|0;a:do if((s|0)!=-1?(c=((g>>>0)%3|0|0)==0?s+-2|0:g,(c|0)!=-1):0){q=f[b>>2]|0;d=f[q+12>>2]|0;p=c;while(1){c=f[d+(p<<2)>>2]|0;if((c|0)==-1)break;n=c+1|0;m=((n>>>0)%3|0|0)==0?c+-2|0:n;if((m|0)==-1){v=-1;w=-1;break a}else p=m}d=(((p>>>0)%3|0|0)==0?2:-1)+p|0;if((d|0)==-1){v=-1;w=p}else{v=f[(f[q>>2]|0)+(d<<2)>>2]|0;w=p}}else{v=-1;w=-1}while(0);if((v|0)==(h|0)){u=t;break}else{a=t;r=v;s=w}}return u|0}function Qe(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa;g=u;u=u+16|0;h=g;i=b[d+24>>0]|0;j=i<<24>>24;Rh(a,c,e,j,0,d,1);k=f[a>>2]|0;a=(f[f[k>>2]>>2]|0)+(f[k+48>>2]|0)|0;k=f[c+4>>2]|0;Ap(h);Ko(h,$(n[c+20>>2]),(1<>>0>1073741823?-1:j<<2)|0;if(!e){Mq(k);u=g;return}l=d+68|0;m=d+48|0;o=d+40|0;p=c+8|0;c=h+4|0;q=(b[d+84>>0]|0)==0;if(i<<24>>24>0){r=0;s=0}else{i=0;do{if(q)t=f[(f[l>>2]|0)+(i<<2)>>2]|0;else t=i;v=m;w=f[v>>2]|0;x=f[v+4>>2]|0;v=o;y=f[v>>2]|0;z=un(y|0,f[v+4>>2]|0,t|0,0)|0;v=Vn(z|0,I|0,w|0,x|0)|0;kh(k|0,(f[f[d>>2]>>2]|0)+v|0,y|0)|0;i=i+1|0}while((i|0)!=(e|0));Mq(k);u=g;return}while(1){if(q)A=f[(f[l>>2]|0)+(s<<2)>>2]|0;else A=s;i=m;t=f[i>>2]|0;y=f[i+4>>2]|0;i=o;v=f[i>>2]|0;x=un(v|0,f[i+4>>2]|0,A|0,0)|0;i=Vn(x|0,I|0,t|0,y|0)|0;kh(k|0,(f[f[d>>2]>>2]|0)+i|0,v|0)|0;v=f[p>>2]|0;B=$(n[h>>2]);i=0;y=r;while(1){C=$(n[k+(i<<2)>>2]);D=$(C-$(n[v+(i<<2)>>2]));t=D<$(0.0);C=$(-D);E=$((t?C:D)/B);x=~~$(J($($(E*$(f[c>>2]|0))+$(.5))));f[a+(y<<2)>>2]=t?0-x|0:x;i=i+1|0;if((i|0)==(j|0))break;else y=y+1|0}s=s+1|0;if((s|0)==(e|0))break;else r=r+j|0}Mq(k);u=g;return}function Re(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;c=a+4|0;d=f[c>>2]|0;e=a+100|0;if(d>>>0<(f[e>>2]|0)>>>0){f[c>>2]=d+1;g=h[d>>0]|0}else g=Si(a)|0;switch(g|0){case 43:case 45:{d=(g|0)==45&1;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;j=h[i>>0]|0}else j=Si(a)|0;if((b|0)!=0&(j+-48|0)>>>0>9?(f[e>>2]|0)!=0:0){f[c>>2]=(f[c>>2]|0)+-1;k=d;l=j}else{k=d;l=j}break}default:{k=0;l=g}}if((l+-48|0)>>>0>9)if(!(f[e>>2]|0)){m=-2147483648;n=0}else{f[c>>2]=(f[c>>2]|0)+-1;m=-2147483648;n=0}else{g=0;j=l;while(1){g=j+-48+(g*10|0)|0;l=f[c>>2]|0;if(l>>>0<(f[e>>2]|0)>>>0){f[c>>2]=l+1;o=h[l>>0]|0}else o=Si(a)|0;if(!((o+-48|0)>>>0<10&(g|0)<214748364))break;else j=o}j=((g|0)<0)<<31>>31;if((o+-48|0)>>>0<10){l=o;d=g;b=j;while(1){i=un(d|0,b|0,10,0)|0;p=I;q=Vn(l|0,((l|0)<0)<<31>>31|0,-48,-1)|0;r=Vn(q|0,I|0,i|0,p|0)|0;p=I;i=f[c>>2]|0;if(i>>>0<(f[e>>2]|0)>>>0){f[c>>2]=i+1;s=h[i>>0]|0}else s=Si(a)|0;if((s+-48|0)>>>0<10&((p|0)<21474836|(p|0)==21474836&r>>>0<2061584302)){l=s;d=r;b=p}else{t=s;u=r;v=p;break}}}else{t=o;u=g;v=j}if((t+-48|0)>>>0<10)do{t=f[c>>2]|0;if(t>>>0<(f[e>>2]|0)>>>0){f[c>>2]=t+1;w=h[t>>0]|0}else w=Si(a)|0}while((w+-48|0)>>>0<10);if(f[e>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;c=(k|0)!=0;k=Xn(0,0,u|0,v|0)|0;m=c?I:v;n=c?k:u}I=m;return n|0}function Se(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;b=a+1176|0;c=f[b>>2]|0;if(c|0){d=a+1180|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+1164|0;b=f[g>>2]|0;if(b|0){j=a+1168|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+1152>>2]|0;if(l|0){g=a+1156|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+1140>>2]|0;if(l|0){m=a+1144|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+1128>>2]|0;if(!l){n=a+1108|0;jl(n);o=a+1088|0;jl(o);p=a+1068|0;jl(p);q=a+1036|0;Fj(q);r=a+12|0;Nh(r);return}g=a+1132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+1108|0;jl(n);o=a+1088|0;jl(o);p=a+1068|0;jl(p);q=a+1036|0;Fj(q);r=a+12|0;Nh(r);return}function Te(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d;g=a+4|0;h=f[g>>2]|0;i=f[(f[a>>2]|0)+52>>2]|0;if(!h){if(!(Sa[i&31](a,c,0)|0)){j=0;u=d;return j|0}}else if(!(Sa[i&31](a,c,f[(f[h+4>>2]|0)+80>>2]|0)|0)){j=0;u=d;return j|0}if(!(b[a+28>>0]|0)){j=1;u=d;return j|0}h=f[a+8>>2]|0;i=f[a+32>>2]|0;a=f[h+80>>2]|0;f[e>>2]=0;k=e+4|0;f[k>>2]=0;f[e+8>>2]=0;do if(a)if(a>>>0>1073741823)aq(e);else{l=a<<2;m=ln(l)|0;f[e>>2]=m;n=m+(a<<2)|0;f[e+8>>2]=n;sj(m|0,0,l|0)|0;f[k>>2]=n;o=m;p=n;q=m;break}else{o=0;p=0;q=0}while(0);e=f[c+4>>2]|0;a=f[c>>2]|0;c=a;a:do if((e|0)!=(a|0)){m=e-a>>2;if(b[h+84>>0]|0){n=0;while(1){f[o+(f[c+(n<<2)>>2]<<2)>>2]=n;n=n+1|0;if(n>>>0>=m>>>0)break a}}n=f[h+68>>2]|0;l=0;do{f[o+(f[n+(f[c+(l<<2)>>2]<<2)>>2]<<2)>>2]=l;l=l+1|0}while(l>>>0>>0)}while(0);c=f[(f[(f[g>>2]|0)+4>>2]|0)+80>>2]|0;b:do if(c|0){g=f[i+68>>2]|0;if(b[h+84>>0]|0){a=0;while(1){f[g+(a<<2)>>2]=f[o+(a<<2)>>2];a=a+1|0;if(a>>>0>=c>>>0)break b}}a=f[h+68>>2]|0;e=0;do{f[g+(e<<2)>>2]=f[o+(f[a+(e<<2)>>2]<<2)>>2];e=e+1|0}while(e>>>0>>0)}while(0);if(o|0){if((p|0)!=(o|0))f[k>>2]=p+(~((p+-4-o|0)>>>2)<<2);Oq(q)}j=1;u=d;return j|0}function Ue(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;Oh(a+12|0);wn(a+1036|0);vo(a+1068|0);vo(a+1088|0);vo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=0,B=0,C=0.0,D=0.0,E=0.0;g=u;u=u+16|0;h=g;i=b+16|0;f[a>>2]=f[i>>2];f[a+4>>2]=f[i+4>>2];f[a+8>>2]=f[i+8>>2];f[a+12>>2]=f[i+12>>2];f[a+16>>2]=f[i+16>>2];f[a+20>>2]=f[i+20>>2];j=a+8|0;f[j>>2]=(f[j>>2]|0)+d;j=(d|0)>0;if(j){k=b+4|0;l=a+16|0;m=a+12|0;n=f[b>>2]|0;o=n;q=0;r=o;s=n;n=o;while(1){o=f[c+(q<<2)>>2]|0;t=f[k>>2]|0;if(t-s>>2>>>0>o>>>0){v=r;w=n}else{x=o+1|0;f[h>>2]=0;y=t-s>>2;z=s;A=t;if(x>>>0<=y>>>0)if(x>>>0>>0?(t=z+(x<<2)|0,(t|0)!=(A|0)):0){f[k>>2]=A+(~((A+-4-t|0)>>>2)<<2);B=r}else B=r;else{Ch(b,x-y|0,h);B=f[b>>2]|0}v=B;w=B}y=w+(o<<2)|0;x=f[y>>2]|0;s=w;if((x|0)<=1)if((x|0)==0?(f[l>>2]=(f[l>>2]|0)+1,o>>>0>(f[m>>2]|0)>>>0):0){f[m>>2]=o;C=0.0}else C=0.0;else{D=+(x|0);C=+Zg(D)*D}x=(f[y>>2]|0)+1|0;f[y>>2]=x;D=+(x|0);E=+Zg(D)*D-C;p[a>>3]=+p[a>>3]+E;q=q+1|0;if((q|0)==(d|0))break;else{r=v;n=w}}}if(e){f[i>>2]=f[a>>2];f[i+4>>2]=f[a+4>>2];f[i+8>>2]=f[a+8>>2];f[i+12>>2]=f[a+12>>2];f[i+16>>2]=f[a+16>>2];u=g;return}if(!j){u=g;return}j=f[b>>2]|0;b=0;do{a=j+(f[c+(b<<2)>>2]<<2)|0;f[a>>2]=(f[a>>2]|0)+-1;b=b+1|0}while((b|0)!=(d|0));u=g;return}function We(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;a:do if(b>>>0<=20)do switch(b|0){case 9:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;f[a>>2]=e;break a;break}case 10:{e=(f[c>>2]|0)+(4-1)&~(4-1);d=f[e>>2]|0;f[c>>2]=e+4;e=a;f[e>>2]=d;f[e+4>>2]=((d|0)<0)<<31>>31;break a;break}case 11:{d=(f[c>>2]|0)+(4-1)&~(4-1);e=f[d>>2]|0;f[c>>2]=d+4;d=a;f[d>>2]=e;f[d+4>>2]=0;break a;break}case 12:{d=(f[c>>2]|0)+(8-1)&~(8-1);e=d;g=f[e>>2]|0;h=f[e+4>>2]|0;f[c>>2]=d+8;d=a;f[d>>2]=g;f[d+4>>2]=h;break a;break}case 13:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&65535)<<16>>16;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 14:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&65535;f[h+4>>2]=0;break a;break}case 15:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=(d&255)<<24>>24;d=a;f[d>>2]=h;f[d+4>>2]=((h|0)<0)<<31>>31;break a;break}case 16:{h=(f[c>>2]|0)+(4-1)&~(4-1);d=f[h>>2]|0;f[c>>2]=h+4;h=a;f[h>>2]=d&255;f[h+4>>2]=0;break a;break}case 17:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}case 18:{h=(f[c>>2]|0)+(8-1)&~(8-1);i=+p[h>>3];f[c>>2]=h+8;p[a>>3]=i;break a;break}default:break a}while(0);while(0);return}function Xe(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+16|0;d=c+4|0;e=c;g=c+8|0;if(!(Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)){h=0;u=c;return h|0}i=a+44|0;j=f[i>>2]|0;k=a+8|0;l=a+12|0;m=f[l>>2]|0;n=f[k>>2]|0;b[g>>0]=(m-n|0)>>>2;o=j+16|0;p=f[o+4>>2]|0;if((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0){q=k;r=n;s=m}else{f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];Me(j,d,g,g+1|0)|0;q=k;r=f[k>>2]|0;s=f[l>>2]|0}a:do if((r|0)!=(s|0)){l=a+4|0;k=r;while(1){g=f[k>>2]|0;k=k+4|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,a,f[l>>2]|0)|0)){h=0;break}if((k|0)==(s|0))break a}u=c;return h|0}while(0);if(!(xc(a)|0)){h=0;u=c;return h|0}s=a+32|0;r=f[s>>2]|0;k=a+36|0;l=f[k>>2]|0;b:do if((r|0)!=(l|0)){g=r;do{if(!(Ra[f[(f[a>>2]|0)+40>>2]&127](a,f[g>>2]|0)|0)){h=0;t=18;break}g=g+4|0}while((g|0)!=(l|0));if((t|0)==18){u=c;return h|0}g=f[s>>2]|0;d=f[k>>2]|0;if((g|0)!=(d|0)){j=g;while(1){g=f[(f[q>>2]|0)+(f[j>>2]<<2)>>2]|0;j=j+4|0;if(!(Ra[f[(f[g>>2]|0)+12>>2]&127](g,f[i>>2]|0)|0)){h=0;break}if((j|0)==(d|0))break b}u=c;return h|0}}while(0);h=Qa[f[(f[a>>2]|0)+44>>2]&127](a)|0;u=c;return h|0}function Ye(a,b){a=a|0;b=b|0;ld(a,b);ld(a+32|0,b);ld(a+64|0,b);ld(a+96|0,b);ld(a+128|0,b);ld(a+160|0,b);ld(a+192|0,b);ld(a+224|0,b);ld(a+256|0,b);ld(a+288|0,b);ld(a+320|0,b);ld(a+352|0,b);ld(a+384|0,b);ld(a+416|0,b);ld(a+448|0,b);ld(a+480|0,b);ld(a+512|0,b);ld(a+544|0,b);ld(a+576|0,b);ld(a+608|0,b);ld(a+640|0,b);ld(a+672|0,b);ld(a+704|0,b);ld(a+736|0,b);ld(a+768|0,b);ld(a+800|0,b);ld(a+832|0,b);ld(a+864|0,b);ld(a+896|0,b);ld(a+928|0,b);ld(a+960|0,b);ld(a+992|0,b);ld(a+1024|0,b);return}function Ze(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0;c=u;u=u+32|0;d=c;e=a+4|0;g=f[a>>2]|0;h=(f[e>>2]|0)-g>>2;i=h+1|0;if(i>>>0>1073741823)aq(a);j=a+8|0;k=(f[j>>2]|0)-g|0;g=k>>1;l=k>>2>>>0<536870911?(g>>>0>>0?i:g):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(l)if(l>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}else{m=ln(l<<2)|0;break}else m=0;while(0);f[d>>2]=m;g=m+(h<<2)|0;h=d+8|0;i=d+4|0;f[i>>2]=g;k=m+(l<<2)|0;l=d+12|0;f[l>>2]=k;m=f[b>>2]|0;f[b>>2]=0;f[g>>2]=m;m=g+4|0;f[h>>2]=m;b=f[a>>2]|0;n=f[e>>2]|0;if((n|0)==(b|0)){o=g;p=l;q=h;r=b;s=m;t=n;v=k;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;ki(d);u=c;return}else{y=n;z=g}do{y=y+-4|0;g=f[y>>2]|0;f[y>>2]=0;f[z+-4>>2]=g;z=(f[i>>2]|0)+-4|0;f[i>>2]=z}while((y|0)!=(b|0));o=z;p=l;q=h;r=f[a>>2]|0;s=f[h>>2]|0;t=f[e>>2]|0;v=f[l>>2]|0;w=o;f[a>>2]=w;f[i>>2]=r;f[e>>2]=s;f[q>>2]=t;x=f[j>>2]|0;f[j>>2]=v;f[p>>2]=x;f[d>>2]=r;ki(d);u=c;return}function _e(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+32|0;e=d+12|0;g=d;h=nl(c,0)|0;if(!h){f[a>>2]=0;u=d;return}i=f[c+100>>2]|0;j=f[c+96>>2]|0;c=i-j|0;k=(c|0)/12|0;f[e>>2]=0;l=e+4|0;f[l>>2]=0;f[e+8>>2]=0;m=j;do if(c)if(k>>>0>357913941)aq(e);else{n=ln(c)|0;f[e>>2]=n;f[e+8>>2]=n+(k*12|0);sj(n|0,0,c|0)|0;f[l>>2]=n+c;o=n;break}else o=0;while(0);f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;a:do if((i|0)!=(j|0)){c=g+4|0;n=g+8|0;if(b[h+84>>0]|0){p=0;while(1){q=m+(p*12|0)|0;f[g>>2]=f[q>>2];f[g+4>>2]=f[q+4>>2];f[g+8>>2]=f[q+8>>2];f[o+(p*12|0)>>2]=f[g>>2];f[o+(p*12|0)+4>>2]=f[c>>2];f[o+(p*12|0)+8>>2]=f[n>>2];p=p+1|0;if(p>>>0>=k>>>0)break a}}p=f[h+68>>2]|0;q=0;do{r=f[p+(f[m+(q*12|0)>>2]<<2)>>2]|0;f[g>>2]=r;s=f[p+(f[m+(q*12|0)+4>>2]<<2)>>2]|0;f[c>>2]=s;t=f[p+(f[m+(q*12|0)+8>>2]<<2)>>2]|0;f[n>>2]=t;f[o+(q*12|0)>>2]=r;f[o+(q*12|0)+4>>2]=s;f[o+(q*12|0)+8>>2]=t;q=q+1|0}while(q>>>0>>0)}while(0);Kj(a,e);a=f[e>>2]|0;if(a|0){e=f[l>>2]|0;if((e|0)!=(a|0))f[l>>2]=e+(~(((e+-12-a|0)>>>0)/12|0)*12|0);Oq(a)}u=d;return}function $e(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;wn(a+12|0);vo(a+44|0);vo(a+64|0);vo(a+84|0);e=a+104|0;f[e>>2]=0;g=a+108|0;f[g>>2]=0;f[a+112>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)aq(e);else{i=b<<2;j=ln(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+112>>2]=k;sj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+116|0;f[g>>2]=0;e=a+120|0;f[e>>2]=0;f[a+124>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+124>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=a+128|0;f[g>>2]=0;e=a+132|0;f[e>>2]=0;f[a+136>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+136>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;sj(i|0,0,k|0)|0;f[e>>2]=j}lk(a+140|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);Oq(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=ln(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;sj(k|0,0,h|0)|0;f[j>>2]=e}lk(a+152|0,g,d);g=f[d>>2]|0;if(!g){u=c;return}d=f[j>>2]|0;if((d|0)!=(g|0))f[j>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g);u=c;return}function af(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;c=u;u=u+16|0;d=c;f[a>>2]=0;f[a+8>>2]=b;vo(a+12|0);vo(a+32|0);vo(a+52|0);vo(a+72|0);e=a+92|0;f[e>>2]=0;g=a+96|0;f[g>>2]=0;f[a+100>>2]=0;h=(b|0)==0;do if(!h)if(b>>>0>1073741823)aq(e);else{i=b<<2;j=ln(i)|0;f[e>>2]=j;k=j+(b<<2)|0;f[a+100>>2]=k;sj(j|0,0,i|0)|0;f[g>>2]=k;break}while(0);g=a+104|0;f[g>>2]=0;e=a+108|0;f[e>>2]=0;f[a+112>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+112>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=a+116|0;f[g>>2]=0;e=a+120|0;f[e>>2]=0;f[a+124>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[g>>2]=i;g=i+(b<<2)|0;f[a+124>>2]=g;sj(i|0,0,k|0)|0;f[e>>2]=g}g=b<<5|1;f[d>>2]=0;e=d+4|0;f[e>>2]=0;f[d+8>>2]=0;if(!h){k=b<<2;i=ln(k)|0;f[d>>2]=i;j=i+(b<<2)|0;f[d+8>>2]=j;sj(i|0,0,k|0)|0;f[e>>2]=j}lk(a+128|0,g,d);j=f[d>>2]|0;if(j|0){k=f[e>>2]|0;if((k|0)!=(j|0))f[e>>2]=k+(~((k+-4-j|0)>>>2)<<2);Oq(j)}f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;if(!h){h=b<<2;k=ln(h)|0;f[d>>2]=k;e=k+(b<<2)|0;f[d+8>>2]=e;sj(k|0,0,h|0)|0;f[j>>2]=e}lk(a+140|0,g,d);g=f[d>>2]|0;if(!g){u=c;return}d=f[j>>2]|0;if((d|0)!=(g|0))f[j>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g);u=c;return}function bf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;d=ln(40)|0;e=d+16|0;pj(e,c);pj(d+28|0,c+12|0);c=a+4|0;g=f[c>>2]|0;do if(g){h=b[d+27>>0]|0;i=h<<24>>24<0;j=i?f[d+20>>2]|0:h&255;h=i?f[e>>2]|0:e;i=g;while(1){k=i+16|0;l=b[k+11>>0]|0;m=l<<24>>24<0;n=m?f[i+20>>2]|0:l&255;l=n>>>0>>0?n:j;if((l|0)!=0?(o=Vk(h,m?f[k>>2]|0:k,l)|0,(o|0)!=0):0)if((o|0)<0)p=7;else p=9;else if(j>>>0>>0)p=7;else p=9;if((p|0)==7){p=0;n=f[i>>2]|0;if(!n){p=8;break}else q=n}else if((p|0)==9){p=0;r=i+4|0;n=f[r>>2]|0;if(!n){p=11;break}else q=n}i=q}if((p|0)==8){s=i;t=i;break}else if((p|0)==11){s=i;t=r;break}}else{s=c;t=c}while(0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=s;f[t>>2]=d;s=f[f[a>>2]>>2]|0;if(!s){u=d;v=a+4|0;w=f[v>>2]|0;Oe(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}f[a>>2]=s;u=f[t>>2]|0;v=a+4|0;w=f[v>>2]|0;Oe(w,u);x=a+8|0;y=f[x>>2]|0;z=y+1|0;f[x>>2]=z;return d|0}function cf(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3680;wi(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}kj(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+140>>2]|0;if(b|0)Oq(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;Oq(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)Oq(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0)Oq(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Ii(a);Oq(a);return}function df(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+140|0;c=f[b>>2]|0;if(c|0){d=a+144|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+128|0;b=f[g>>2]|0;if(b|0){j=a+132|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+116>>2]|0;if(l|0){g=a+120|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+104>>2]|0;if(l|0){m=a+108|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+92>>2]|0;if(!l){n=a+72|0;jl(n);o=a+52|0;jl(o);p=a+32|0;jl(p);q=a+12|0;jl(q);return}g=a+96|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+72|0;jl(n);o=a+52|0;jl(o);p=a+32|0;jl(p);q=a+12|0;jl(q);return}function ef(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;b=a+152|0;c=f[b>>2]|0;if(c|0){d=a+156|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=a+140|0;b=f[g>>2]|0;if(b|0){j=a+144|0;h=f[j>>2]|0;if((h|0)==(b|0))l=b;else{c=h;while(1){h=c+-12|0;f[j>>2]=h;d=f[h>>2]|0;if(!d)m=h;else{h=c+-8|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d);m=f[j>>2]|0}if((m|0)==(b|0))break;else c=m}l=f[g>>2]|0}Oq(l)}l=f[a+128>>2]|0;if(l|0){g=a+132|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+116>>2]|0;if(l|0){m=a+120|0;g=f[m>>2]|0;if((g|0)!=(l|0))f[m>>2]=g+(~((g+-4-l|0)>>>2)<<2);Oq(l)}l=f[a+104>>2]|0;if(!l){n=a+84|0;jl(n);o=a+64|0;jl(o);p=a+44|0;jl(p);q=a+12|0;Fj(q);return}g=a+108|0;m=f[g>>2]|0;if((m|0)!=(l|0))f[g>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(l);n=a+84|0;jl(n);o=a+64|0;jl(o);p=a+44|0;jl(p);q=a+12|0;Fj(q);return}function ff(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3480;uj(a+200|0);b=f[a+184>>2]|0;if(b|0){c=a+188|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}kj(a+172|0);b=f[a+152>>2]|0;if(b|0){d=a+156|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+140>>2]|0;if(b|0)Oq(b);b=f[a+128>>2]|0;if(b|0){c=b;do{b=c;c=f[c>>2]|0;Oq(b)}while((c|0)!=0)}c=a+120|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0)Oq(b);b=f[a+108>>2]|0;if(b|0){c=a+112|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0){c=a+76|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0)Oq(b);b=f[a+16>>2]|0;if(b|0){d=a+20|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+12|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Ii(a);Oq(a);return}function gf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;e=u;u=u+144|0;g=e+136|0;h=e+104|0;i=e;j=ln(124)|0;k=f[c+8>>2]|0;f[j+4>>2]=0;f[j>>2]=3656;f[j+12>>2]=3636;f[j+100>>2]=0;f[j+104>>2]=0;f[j+108>>2]=0;l=j+16|0;m=l+80|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));f[j+112>>2]=k;f[j+116>>2]=d;n=j+120|0;f[n>>2]=0;o=j;f[h>>2]=3636;p=h+4|0;q=p+4|0;f[q>>2]=0;f[q+4>>2]=0;f[q+8>>2]=0;f[q+12>>2]=0;f[q+16>>2]=0;f[q+20>>2]=0;q=f[c+12>>2]|0;f[i+4>>2]=3636;f[i+92>>2]=0;f[i+96>>2]=0;f[i+100>>2]=0;l=i+8|0;m=l+80|0;do{f[l>>2]=0;l=l+4|0}while((l|0)<(m|0));l=q;f[p>>2]=l;m=((f[l+4>>2]|0)-(f[q>>2]|0)>>2>>>0)/3|0;b[g>>0]=0;qh(h+8|0,m,g);Va[f[(f[h>>2]|0)+8>>2]&127](h);f[i>>2]=f[p>>2];fg(i+4|0,h)|0;f[i+36>>2]=q;f[i+40>>2]=d;f[i+44>>2]=k;f[i+48>>2]=j;f[n>>2]=c+72;Sg(j,i);f[a>>2]=o;Qi(i);f[h>>2]=3636;i=f[h+20>>2]|0;if(i|0)Oq(i);i=f[h+8>>2]|0;if(!i){u=e;return}Oq(i);u=e;return}function hf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+48|0;d=c+44|0;e=c+40|0;g=c+36|0;h=c+32|0;i=c;f[h>>2]=f[a+60>>2];j=b+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,h,h+4|0)|0}wn(i);tk(i);if((f[h>>2]|0)>0){k=a+56|0;l=1;m=0;do{n=l;l=(f[(f[k>>2]|0)+(m>>>5<<2)>>2]&1<<(m&31)|0)!=0;fj(i,n^l^1);m=m+1|0}while((m|0)<(f[h>>2]|0))}ld(i,b);f[g>>2]=f[a+12>>2];h=j;m=f[h>>2]|0;l=f[h+4>>2]|0;if((l|0)>0|(l|0)==0&m>>>0>0){o=l;p=m}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;m=j;o=f[m+4>>2]|0;p=f[m>>2]|0}f[g>>2]=f[a+20>>2];if((o|0)>0|(o|0)==0&p>>>0>0){Fj(i);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;Fj(i);u=c;return 1}function jf(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;g=u;u=u+16|0;h=g;if((f[c+56>>2]|0)==-1){i=-1;u=g;return i|0}j=ln(96)|0;tl(j,c);f[h>>2]=j;j=vh(a,h)|0;c=f[h>>2]|0;f[h>>2]=0;if(c|0){h=c+88|0;k=f[h>>2]|0;f[h>>2]=0;if(k|0){h=f[k+8>>2]|0;if(h|0){l=k+12|0;if((f[l>>2]|0)!=(h|0))f[l>>2]=h;Oq(h)}Oq(k)}k=f[c+68>>2]|0;if(k|0){h=c+72|0;l=f[h>>2]|0;if((l|0)!=(k|0))f[h>>2]=l+(~((l+-4-k|0)>>>2)<<2);Oq(k)}k=c+64|0;l=f[k>>2]|0;f[k>>2]=0;if(l|0){k=f[l>>2]|0;if(k|0){h=l+4|0;if((f[h>>2]|0)!=(k|0))f[h>>2]=k;Oq(k)}Oq(l)}Oq(c)}c=a+8|0;l=(f[c>>2]|0)+(j<<2)|0;k=f[l>>2]|0;do if(!d){h=f[a+80>>2]|0;b[k+84>>0]=0;m=k+68|0;n=k+72|0;o=f[n>>2]|0;p=f[m>>2]|0;q=o-p>>2;r=o;if(h>>>0>q>>>0){Ch(m,h-q|0,6220);break}if(h>>>0>>0?(q=p+(h<<2)|0,(q|0)!=(r|0)):0)f[n>>2]=r+(~((r+-4-q|0)>>>2)<<2)}else{b[k+84>>0]=1;q=f[k+68>>2]|0;r=k+72|0;n=f[r>>2]|0;if((n|0)==(q|0))s=k;else{f[r>>2]=n+(~((n+-4-q|0)>>>2)<<2);s=f[l>>2]|0}f[s+80>>2]=f[a+80>>2]}while(0);if(!e){i=j;u=g;return i|0}Bj(f[(f[c>>2]|0)+(j<<2)>>2]|0,e)|0;i=j;u=g;return i|0}function kf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;f[a+52>>2]=e;f[a+44>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;l=a+48|0;m=f[l>>2]|0;f[l>>2]=g;if(m|0)Mq(m);m=a+36|0;g=f[m>>2]|0;n=f[g+4>>2]|0;o=f[g>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=i+4|0;s=j+4|0;t=h+4|0;if(n-o>>2>>>0>q>>>0){v=q;w=o}else{x=g;aq(x)}while(1){f[k>>2]=f[w+(v<<2)>>2];f[h>>2]=f[k>>2];Bc(a,h,b,v);g=X(v,e)|0;o=b+(g<<2)|0;q=f[l>>2]|0;n=c+(g<<2)|0;g=f[o+4>>2]|0;y=f[q>>2]|0;z=f[q+4>>2]|0;f[i>>2]=f[o>>2];f[r>>2]=g;f[j>>2]=y;f[s>>2]=z;Od(h,p,i,j);f[n>>2]=f[h>>2];f[n+4>>2]=f[t>>2];v=v+-1|0;if((v|0)<=-1){A=5;break}n=f[m>>2]|0;w=f[n>>2]|0;if((f[n+4>>2]|0)-w>>2>>>0<=v>>>0){x=n;A=6;break}}if((A|0)==5){u=d;return 1}else if((A|0)==6)aq(x);return 0}function lf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=f[c>>2]|0;c=f[d>>2]|0;e=f[a+4>>2]|0;g=f[d+4>>2]|0;h=e+-1|0;i=(h&e|0)==0;if(!i)if(g>>>0>>0)j=g;else j=(g>>>0)%(e>>>0)|0;else j=h&g;g=(f[a>>2]|0)+(j<<2)|0;k=f[g>>2]|0;while(1){l=f[k>>2]|0;if((l|0)==(d|0))break;else k=l}if((k|0)!=(a+8|0)){l=f[k+4>>2]|0;if(!i)if(l>>>0>>0)m=l;else m=(l>>>0)%(e>>>0)|0;else m=l&h;if((m|0)==(j|0)){n=c;o=21}else o=13}else o=13;do if((o|0)==13){if(c|0){m=f[c+4>>2]|0;if(!i)if(m>>>0>>0)p=m;else p=(m>>>0)%(e>>>0)|0;else p=m&h;if((p|0)==(j|0)){q=c;r=c;o=22;break}}f[g>>2]=0;n=f[d>>2]|0;o=21}while(0);if((o|0)==21){g=n;if(!n)s=g;else{q=n;r=g;o=22}}if((o|0)==22){o=f[q+4>>2]|0;if(!i)if(o>>>0>>0)t=o;else t=(o>>>0)%(e>>>0)|0;else t=o&h;if((t|0)==(j|0))s=r;else{f[(f[a>>2]|0)+(t<<2)>>2]=k;s=f[d>>2]|0}}f[k>>2]=s;f[d>>2]=0;s=a+12|0;f[s>>2]=(f[s>>2]|0)+-1;if(!d)return c|0;s=d+8|0;a=f[d+20>>2]|0;if(a|0){k=d+24|0;if((f[k>>2]|0)!=(a|0))f[k>>2]=a;Oq(a)}if((b[s+11>>0]|0)<0)Oq(f[s>>2]|0);Oq(d);return c|0}function mf(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;b=u;u=u+16|0;c=b+4|0;d=b;f[c>>2]=0;e=c+4|0;f[e>>2]=0;f[c+8>>2]=0;g=a+52|0;h=f[g>>2]|0;i=(f[h+100>>2]|0)-(f[h+96>>2]|0)|0;j=(i|0)/12|0;if(!i){k=0;l=0}else{i=c+8|0;m=0;n=0;o=h;h=0;p=0;while(1){q=f[o+96>>2]|0;r=f[q+(n*12|0)>>2]|0;s=r-m|0;t=((s|0)>-1?s:0-s|0)<<1|s>>>31;f[d>>2]=t;if((h|0)==(p|0)){Ri(c,d);v=f[e>>2]|0;w=f[i>>2]|0}else{f[h>>2]=t;t=h+4|0;f[e>>2]=t;v=t;w=p}t=f[q+(n*12|0)+4>>2]|0;s=t-r|0;r=((s|0)>-1?s:0-s|0)<<1|s>>>31;f[d>>2]=r;if((v|0)==(w|0)){Ri(c,d);x=f[e>>2]|0;y=f[i>>2]|0}else{f[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y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;f[a+52>>2]=e;f[a+44>>2]=g;g=Lq(e>>>0>1073741823?-1:e<<2)|0;l=a+48|0;m=f[l>>2]|0;f[l>>2]=g;if(m|0)Mq(m);m=a+36|0;g=f[m>>2]|0;n=f[g+4>>2]|0;o=f[g>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=i+4|0;s=j+4|0;t=h+4|0;if(n-o>>2>>>0>q>>>0){v=q;w=o}else{x=g;aq(x)}while(1){f[k>>2]=f[w+(v<<2)>>2];f[h>>2]=f[k>>2];Ac(a,h,b,v);g=X(v,e)|0;o=b+(g<<2)|0;q=f[l>>2]|0;n=c+(g<<2)|0;g=f[o+4>>2]|0;y=f[q>>2]|0;z=f[q+4>>2]|0;f[i>>2]=f[o>>2];f[r>>2]=g;f[j>>2]=y;f[s>>2]=z;Od(h,p,i,j);f[n>>2]=f[h>>2];f[n+4>>2]=f[t>>2];v=v+-1|0;if((v|0)<=-1){A=5;break}n=f[m>>2]|0;w=f[n>>2]|0;if((f[n+4>>2]|0)-w>>2>>>0<=v>>>0){x=n;A=6;break}}if((A|0)==5){u=d;return 1}else if((A|0)==6)aq(x);return 0}function qf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=a+8|0;e=f[d>>2]|0;g=f[a>>2]|0;h=g;do if(e-g>>3>>>0>=b>>>0){i=a+4|0;j=f[i>>2]|0;k=j-g>>3;l=k>>>0>>0;m=l?k:b;n=j;if(m|0){j=m;m=h;while(1){o=c;p=f[o+4>>2]|0;q=m;f[q>>2]=f[o>>2];f[q+4>>2]=p;j=j+-1|0;if(!j)break;else m=m+8|0}}if(!l){m=h+(b<<3)|0;if((m|0)==(n|0))return;else{r=i;s=n+(~((n+-8-m|0)>>>3)<<3)|0;break}}else{m=b-k|0;j=m;p=n;while(1){q=c;o=f[q+4>>2]|0;t=p;f[t>>2]=f[q>>2];f[t+4>>2]=o;j=j+-1|0;if(!j)break;else p=p+8|0}r=i;s=n+(m<<3)|0;break}}else{p=g;if(!g)u=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-8-g|0)>>>3)<<3);Oq(p);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;u=0}if(b>>>0>536870911)aq(a);j=u>>2;p=u>>3>>>0<268435455?(j>>>0>>0?b:j):536870911;if(p>>>0>536870911)aq(a);j=ln(p<<3)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(p<<3);p=b;l=j;while(1){o=c;t=f[o+4>>2]|0;q=l;f[q>>2]=f[o>>2];f[q+4>>2]=t;p=p+-1|0;if(!p)break;else l=l+8|0}r=k;s=j+(b<<3)|0}while(0);f[r>>2]=s;return}function rf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0.0,g=0.0,h=0.0,i=0.0,j=0.0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;e=+$(n[b>>2]);g=+K(+e);h=+$(n[b+4>>2]);i=g+ +K(+h);g=+$(n[b+8>>2]);j=i+ +K(+g);b=j>1.0e-06;i=1.0/j;k=f[a+12>>2]|0;j=+(k|0);l=~~+J(+((b?i*e:1.0)*j+.5));m=~~+J(+((b?i*h:0.0)*j+.5));o=(l|0)>-1;p=k-(o?l:0-l|0)-((m|0)>-1?m:0-m|0)|0;l=(p|0)<0;q=(l?((m|0)>0?p:0-p|0):0)+m|0;m=l?0:p;p=(b?i*g:0.0)<0.0?0-m|0:m;do if(!o){if((q|0)<0)r=(p|0)>-1?p:0-p|0;else r=(f[a+8>>2]|0)-((p|0)>-1?p:0-p|0)|0;if((p|0)<0){s=(q|0)>-1?q:0-q|0;t=r;break}else{s=(f[a+8>>2]|0)-((q|0)>-1?q:0-q|0)|0;t=r;break}}else{s=k+p|0;t=k+q|0}while(0);q=(t|0)==0;p=(s|0)==0;r=f[a+8>>2]|0;if(!(s|t)){u=r;v=r;f[c>>2]=u;f[d>>2]=v;return}a=(r|0)==(s|0);if(q&a){u=s;v=s;f[c>>2]=u;f[d>>2]=v;return}o=(r|0)==(t|0);if(p&o){u=t;v=t;f[c>>2]=u;f[d>>2]=v;return}if(q&(k|0)<(s|0)){u=0;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(o&(k|0)>(s|0)){u=t;v=(k<<1)-s|0;f[c>>2]=u;f[d>>2]=v;return}if(a&(k|0)>(t|0)){u=(k<<1)-t|0;v=s;f[c>>2]=u;f[d>>2]=v;return}if(!p){u=t;v=s;f[c>>2]=u;f[d>>2]=v;return}u=(k|0)<(t|0)?(k<<1)-t|0:t;v=0;f[c>>2]=u;f[d>>2]=v;return}function sf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],Me(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];Me(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;Gg(d);m=a+1068|0;Mm(m);k=a+1088|0;Mm(k);l=a+1108|0;Mm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];ib(a,i,h);Ye(d,e);Bg(m,e);Bg(k,e);Bg(l,e);u=g;return 1}function tf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=a+4|0;f[d>>2]=(f[c>>2]|0)-(f[b>>2]|0);j=e+16|0;k=j;l=f[k+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0)?(k=e+4|0,f[i>>2]=f[k>>2],f[h>>2]=f[i>>2],Me(e,h,a,a+4|0)|0,l=j,j=f[l+4>>2]|0,!((j|0)>0|(j|0)==0&(f[l>>2]|0)>>>0>0)):0){f[i>>2]=f[k>>2];f[h>>2]=f[i>>2];Me(e,h,d,d+4|0)|0;m=i}else m=i;if(!(f[d>>2]|0)){u=g;return 1}d=a+12|0;Gg(d);m=a+1068|0;Mm(m);k=a+1088|0;Mm(k);l=a+1108|0;Mm(l);f[i>>2]=f[b>>2];f[i+4>>2]=f[b+4>>2];f[i+8>>2]=f[b+8>>2];f[h>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];kb(a,i,h);Ye(d,e);Bg(m,e);Bg(k,e);Bg(l,e);u=g;return 1}function uf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;c=u;u=u+32|0;d=c;e=a+8|0;g=f[e>>2]|0;h=a+4|0;i=f[h>>2]|0;j=i;if(g-i>>2>>>0>=b>>>0){sj(i|0,0,b<<2|0)|0;f[h>>2]=i+(b<<2);u=c;return}k=f[a>>2]|0;l=i-k>>2;m=l+b|0;n=k;if(m>>>0>1073741823)aq(a);o=g-k|0;p=o>>1;q=o>>2>>>0<536870911?(p>>>0>>0?m:p):1073741823;f[d+12>>2]=0;f[d+16>>2]=a+8;do if(q)if(q>>>0>1073741823){p=ra(8)|0;Oo(p,16035);f[p>>2]=7256;va(p|0,1112,110)}else{r=ln(q<<2)|0;break}else r=0;while(0);f[d>>2]=r;p=r+(l<<2)|0;l=d+8|0;m=d+4|0;f[m>>2]=p;o=r+(q<<2)|0;q=d+12|0;f[q>>2]=o;r=p+(b<<2)|0;sj(p|0,0,b<<2|0)|0;f[l>>2]=r;if((j|0)==(n|0)){s=p;t=q;v=l;w=k;x=r;y=i;z=o;A=g}else{g=j;j=p;do{g=g+-4|0;p=f[g>>2]|0;f[g>>2]=0;f[j+-4>>2]=p;j=(f[m>>2]|0)+-4|0;f[m>>2]=j}while((g|0)!=(n|0));s=j;t=q;v=l;w=f[a>>2]|0;x=f[l>>2]|0;y=f[h>>2]|0;z=f[q>>2]|0;A=f[e>>2]|0}f[a>>2]=s;f[m>>2]=w;f[h>>2]=x;f[v>>2]=y;f[e>>2]=z;f[t>>2]=A;f[d>>2]=w;ki(d);u=c;return}function vf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=f[a+8>>2]|0;e=a+76|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+80|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1)r=-1;else r=f[(f[d>>2]|0)+(h<<2)>>2]|0;i=f[(f[m>>2]|0)+12>>2]|0;g=f[i+(r<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}k=f[a>>2]|0;f[k+(f[c+(o*12|0)>>2]<<2)>>2]=g;g=h+1|0;if((g|0)==-1)t=-1;else t=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(t<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+4>>2]<<2)>>2]=g;g=h+2|0;if((g|0)==-1)u=-1;else u=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(u<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+8>>2]<<2)>>2]=g;o=o+1|0;if(o>>>0>=e>>>0){q=1;s=12;break}}if((s|0)==12)return q|0;return 0}function wf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;d=f[a+8>>2]|0;e=a+112|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=a+116|0;a=c+68|0;c=f[o+96>>2]|0;o=0;while(1){h=o*3|0;if((h|0)==-1)r=-1;else r=f[(f[d>>2]|0)+(h<<2)>>2]|0;i=f[(f[m>>2]|0)+12>>2]|0;g=f[i+(r<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}k=f[a>>2]|0;f[k+(f[c+(o*12|0)>>2]<<2)>>2]=g;g=h+1|0;if((g|0)==-1)t=-1;else t=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(t<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+4>>2]<<2)>>2]=g;g=h+2|0;if((g|0)==-1)u=-1;else u=f[(f[d>>2]|0)+(g<<2)>>2]|0;g=f[i+(u<<2)>>2]|0;if(g>>>0>=p>>>0){q=0;s=12;break}f[k+(f[c+(o*12|0)+8>>2]<<2)>>2]=g;o=o+1|0;if(o>>>0>=e>>>0){q=1;s=12;break}}if((s|0)==12)return q|0;return 0}function xf(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=u;u=u+16|0;h=d;i=f[a+124>>2]|0;if(!i){u=d;return}j=i+-1|0;k=(j&i|0)==0;if(!k)if(i>>>0>g>>>0)l=g;else l=(g>>>0)%(i>>>0)|0;else l=j&g;m=f[(f[a+120>>2]|0)+(l<<2)>>2]|0;if(!m){u=d;return}n=f[m>>2]|0;if(!n){u=d;return}a:do if(k){m=n;while(1){o=f[m+4>>2]|0;p=(o|0)==(g|0);if(!(p|(o&j|0)==(l|0))){q=24;break}if(p?(f[m+8>>2]|0)==(g|0):0){r=m;break a}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}else{m=n;while(1){p=f[m+4>>2]|0;if((p|0)==(g|0)){if((f[m+8>>2]|0)==(g|0)){r=m;break a}}else{if(p>>>0>>0)s=p;else s=(p>>>0)%(i>>>0)|0;if((s|0)!=(l|0)){q=24;break}}m=f[m>>2]|0;if(!m){q=24;break}}if((q|0)==24){u=d;return}}while(0);q=f[r+12>>2]|0;if((q|0)==-1){u=d;return}f[h>>2]=q;f[h+4>>2]=c;b[h+8>>0]=e&1;e=a+112|0;c=f[e>>2]|0;if((c|0)==(f[a+116>>2]|0))yi(a+108|0,h);else{f[c>>2]=f[h>>2];f[c+4>>2]=f[h+4>>2];f[c+8>>2]=f[h+8>>2];f[e>>2]=(f[e>>2]|0)+12}u=d;return}function yf(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=d[b>>1]|0;e=d[b+2>>1]|0;g=d[b+4>>1]|0;h=d[b+6>>1]|0;b=((((c^318)&65535)+239^e&65535)+239^g&65535)+239^h&65535;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(b>>>0>>0)m=b;else m=(b>>>0)%(i>>>0)|0;else m=b&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(b|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(d[o>>1]|0)==c<<16>>16):0)?(d[o+2>>1]|0)==e<<16>>16:0)?(d[l+12>>1]|0)==g<<16>>16:0)?(d[o+6>>1]|0)==h<<16>>16:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(b|0)){l=q+8|0;if((((d[l>>1]|0)==c<<16>>16?(d[l+2>>1]|0)==e<<16>>16:0)?(d[q+12>>1]|0)==g<<16>>16:0)?(d[l+6>>1]|0)==h<<16>>16:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function zf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+32|0;h=g+12|0;i=g;f[a>>2]=f[d>>2];d=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>>2]=f[c>>2];f[h+4>>2]=f[c+4>>2];f[h+8>>2]=f[c+8>>2];lb(a,i,h);ld(d,e);Bg(m,e);Bg(k,e);Bg(l,e);u=g;return 1}function Bf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;a=u;u=u+16|0;e=a+4|0;g=a;h=a+8|0;i=d+11|0;j=b[i>>0]|0;k=j<<24>>24<0;if(k){l=f[d+4>>2]|0;if(l>>>0>255){m=0;u=a;return m|0}else n=l}else n=j&255;if(!n){b[h>>0]=0;n=c+16|0;l=f[n+4>>2]|0;if(!((l|0)>0|(l|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}m=1;u=a;return m|0}n=d+4|0;l=f[n>>2]|0;b[h>>0]=k?l:j&255;k=c+16|0;o=k;p=f[o>>2]|0;q=f[o+4>>2]|0;if((q|0)>0|(q|0)==0&p>>>0>0){r=j;s=q;t=p;v=l}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;h=k;r=b[i>>0]|0;s=f[h+4>>2]|0;t=f[h>>2]|0;v=f[n>>2]|0}n=r<<24>>24<0;h=n?f[d>>2]|0:d;if(!((s|0)>0|(s|0)==0&t>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+(n?v:r&255)|0)|0}m=1;u=a;return m|0}function Cf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=a+4|0;d=f[a>>2]|0;e=((f[c>>2]|0)-d|0)/24|0;g=e+1|0;if(g>>>0>178956970)aq(a);h=a+8|0;i=((f[h>>2]|0)-d|0)/24|0;d=i<<1;j=i>>>0<89478485?(d>>>0>>0?g:d):178956970;do if(j)if(j>>>0>178956970){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j*24|0)|0;break}else k=0;while(0);d=k+(e*24|0)|0;g=d;i=k+(j*24|0)|0;f[d>>2]=1196;f[k+(e*24|0)+4>>2]=f[b+4>>2];fk(k+(e*24|0)+8|0,b+8|0);f[k+(e*24|0)+20>>2]=f[b+20>>2];b=d+24|0;e=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(e|0)){l=g;m=e;n=e}else{j=k;k=g;g=d;do{f[g+-24>>2]=1196;f[g+-20>>2]=f[j+-20>>2];d=g+-16|0;o=j+-16|0;f[d>>2]=0;p=g+-12|0;f[p>>2]=0;f[g+-8>>2]=0;f[d>>2]=f[o>>2];d=j+-12|0;f[p>>2]=f[d>>2];p=j+-8|0;f[g+-8>>2]=f[p>>2];f[p>>2]=0;f[d>>2]=0;f[o>>2]=0;f[g+-4>>2]=f[j+-4>>2];j=j+-24|0;g=k+-24|0;k=g}while((j|0)!=(e|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=b;f[h>>2]=i;i=m;if((n|0)!=(i|0)){h=n;do{h=h+-24|0;Va[f[f[h>>2]>>2]&127](h)}while((h|0)!=(i|0))}if(!m)return;Oq(m);return}function Df(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+32|0;d=c+24|0;e=c+16|0;g=c+8|0;h=c;f[a>>2]=3588;f[a+4>>2]=f[b+4>>2];i=a+8|0;j=b+8|0;f[i>>2]=0;k=a+12|0;f[k>>2]=0;l=a+16|0;f[l>>2]=0;m=b+12|0;n=f[m>>2]|0;do if(n|0)if((n|0)<0)aq(i);else{o=((n+-1|0)>>>5)+1|0;p=ln(o<<2)|0;f[i>>2]=p;f[k>>2]=0;f[l>>2]=o;o=f[j>>2]|0;f[g>>2]=o;f[g+4>>2]=0;p=f[m>>2]|0;f[h>>2]=o+(p>>>5<<2);f[h+4>>2]=p&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);break}while(0);i=a+20|0;f[i>>2]=0;m=a+24|0;f[m>>2]=0;j=a+28|0;f[j>>2]=0;a=b+24|0;l=f[a>>2]|0;if(!l){u=c;return}if((l|0)<0)aq(i);k=((l+-1|0)>>>5)+1|0;l=ln(k<<2)|0;f[i>>2]=l;f[m>>2]=0;f[j>>2]=k;k=f[b+20>>2]|0;f[g>>2]=k;f[g+4>>2]=0;b=f[a>>2]|0;f[h>>2]=k+(b>>>5<<2);f[h+4>>2]=b&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);u=c;return}function Ef(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;h=b[c+3>>0]|0;c=(((d&255^318)+239^e&255)+239^g&255)+239^h&255;i=f[a+4>>2]|0;if(!i){j=0;return j|0}k=i+-1|0;l=(k&i|0)==0;if(!l)if(c>>>0>>0)m=c;else m=(c>>>0)%(i>>>0)|0;else m=c&k;n=f[(f[a>>2]|0)+(m<<2)>>2]|0;if(!n){j=0;return j|0}a=f[n>>2]|0;if(!a){j=0;return j|0}if(l){l=a;while(1){n=f[l+4>>2]|0;o=(n|0)==(c|0);if(!(o|(n&k|0)==(m|0))){j=0;p=25;break}if((((o?(o=l+8|0,(b[o>>0]|0)==d<<24>>24):0)?(b[o+1>>0]|0)==e<<24>>24:0)?(b[o+2>>0]|0)==g<<24>>24:0)?(b[o+3>>0]|0)==h<<24>>24:0){j=l;p=25;break}l=f[l>>2]|0;if(!l){j=0;p=25;break}}if((p|0)==25)return j|0}else q=a;while(1){a=f[q+4>>2]|0;if((a|0)==(c|0)){l=q+8|0;if((((b[l>>0]|0)==d<<24>>24?(b[l+1>>0]|0)==e<<24>>24:0)?(b[l+2>>0]|0)==g<<24>>24:0)?(b[l+3>>0]|0)==h<<24>>24:0){j=q;p=25;break}}else{if(a>>>0>>0)r=a;else r=(a>>>0)%(i>>>0)|0;if((r|0)!=(m|0)){j=0;p=25;break}}q=f[q>>2]|0;if(!q){j=0;p=25;break}}if((p|0)==25)return j|0;return 0}function Ff(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+32|0;d=c+24|0;e=c+16|0;g=c+8|0;h=c;f[a>>2]=3636;f[a+4>>2]=f[b+4>>2];i=a+8|0;j=b+8|0;f[i>>2]=0;k=a+12|0;f[k>>2]=0;l=a+16|0;f[l>>2]=0;m=b+12|0;n=f[m>>2]|0;do if(n|0)if((n|0)<0)aq(i);else{o=((n+-1|0)>>>5)+1|0;p=ln(o<<2)|0;f[i>>2]=p;f[k>>2]=0;f[l>>2]=o;o=f[j>>2]|0;f[g>>2]=o;f[g+4>>2]=0;p=f[m>>2]|0;f[h>>2]=o+(p>>>5<<2);f[h+4>>2]=p&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);break}while(0);i=a+20|0;f[i>>2]=0;m=a+24|0;f[m>>2]=0;j=a+28|0;f[j>>2]=0;a=b+24|0;l=f[a>>2]|0;if(!l){u=c;return}if((l|0)<0)aq(i);k=((l+-1|0)>>>5)+1|0;l=ln(k<<2)|0;f[i>>2]=l;f[m>>2]=0;f[j>>2]=k;k=f[b+20>>2]|0;f[g>>2]=k;f[g+4>>2]=0;b=f[a>>2]|0;f[h>>2]=k+(b>>>5<<2);f[h+4>>2]=b&31;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[d>>2]=f[h>>2];f[d+4>>2]=f[h+4>>2];Tf(i,e,d);u=c;return}function Gf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;aq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];ub(l,h,b,w);m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Od(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)aq(y);return 0}function Hf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+48>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+52>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+52>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;Cd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+52>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;Ad(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function If(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;d=u;u=u+32|0;h=d+24|0;i=d+16|0;j=d;k=d+8|0;l=a+40|0;f[a+44>>2]=g;g=a+36|0;m=f[g>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;if((p|0)<=0){u=d;return 1}q=(p>>>2)+-1|0;p=a+8|0;r=a+48|0;s=a+52|0;a=i+4|0;t=j+4|0;v=h+4|0;if(n-o>>2>>>0>q>>>0){w=q;x=o}else{y=m;aq(y)}while(1){f[k>>2]=f[x+(w<<2)>>2];f[h>>2]=f[k>>2];tb(l,h,b,w);m=X(w,e)|0;o=b+(m<<2)|0;q=c+(m<<2)|0;m=f[o+4>>2]|0;n=f[r>>2]|0;z=f[s>>2]|0;f[i>>2]=f[o>>2];f[a>>2]=m;f[j>>2]=n;f[t>>2]=z;Od(h,p,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[v>>2];w=w+-1|0;if((w|0)<=-1){A=3;break}q=f[g>>2]|0;x=f[q>>2]|0;if((f[q+4>>2]|0)-x>>2>>>0<=w>>>0){y=q;A=4;break}}if((A|0)==3){u=d;return 1}else if((A|0)==4)aq(y);return 0}function Jf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=f[b>>2]|0;b=f[c>>2]|0;e=b-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;k=b;if(e>>>0<=h-i>>2>>>0){l=a+4|0;m=(f[l>>2]|0)-i>>2;n=e>>>0>m>>>0;o=n?d+(m<<2)|0:b;b=o-d|0;m=b>>2;if(m|0)im(i|0,d|0,b|0)|0;b=j+(m<<2)|0;if(!n){n=f[l>>2]|0;if((n|0)==(b|0))return;f[l>>2]=n+(~((n+-4-b|0)>>>2)<<2);return}b=f[c>>2]|0;c=o;if((b|0)==(c|0))return;n=f[l>>2]|0;m=b+-4-o|0;o=c;c=n;while(1){f[c>>2]=f[o>>2];o=o+4|0;if((o|0)==(b|0))break;else c=c+4|0}f[l>>2]=n+((m>>>2)+1<<2);return}m=i;if(!i)p=h;else{h=a+4|0;n=f[h>>2]|0;if((n|0)!=(j|0))f[h>>2]=n+(~((n+-4-i|0)>>>2)<<2);Oq(m);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;p=0}if(e>>>0>1073741823)aq(a);h=p>>1;m=p>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(m>>>0>1073741823)aq(a);h=ln(m<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(m<<2);m=d;if((k|0)==(m|0))return;g=k+-4-d|0;d=m;m=h;while(1){f[m>>2]=f[d>>2];d=d+4|0;if((d|0)==(k|0))break;else m=m+4|0}f[e>>2]=h+((g>>>2)+1<<2);return}function Kf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(((d-g|0)/12|0)>>>0>=b>>>0){sj(g|0,0,b*12|0)|0;f[e>>2]=h+(b*12|0);return}i=f[a>>2]|0;j=(g-i|0)/12|0;g=j+b|0;k=i;if(g>>>0>357913941)aq(a);l=(d-i|0)/12|0;d=l<<1;m=l>>>0<178956970?(d>>>0>>0?g:d):357913941;do if(m)if(m>>>0>357913941){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{n=ln(m*12|0)|0;break}else n=0;while(0);d=n+(j*12|0)|0;j=d;g=n+(m*12|0)|0;sj(d|0,0,b*12|0)|0;m=d+(b*12|0)|0;if((h|0)==(k|0)){o=j;p=i;q=h}else{i=h;h=j;j=d;do{d=j+-12|0;b=i;i=i+-12|0;f[d>>2]=0;n=j+-8|0;f[n>>2]=0;f[j+-4>>2]=0;f[d>>2]=f[i>>2];d=b+-8|0;f[n>>2]=f[d>>2];n=b+-4|0;f[j+-4>>2]=f[n>>2];f[n>>2]=0;f[d>>2]=0;f[i>>2]=0;j=h+-12|0;h=j}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=g;g=p;if((q|0)!=(g|0)){c=q;do{q=c;c=c+-12|0;m=f[c>>2]|0;if(m|0){e=q+-8|0;q=f[e>>2]|0;if((q|0)!=(m|0))f[e>>2]=q+(~((q+-4-m|0)>>>2)<<2);Oq(m)}}while((c|0)!=(g|0))}if(!p)return;Oq(p);return}function Lf(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+28>>2]|0)-(f[g+24>>2]|0)>>2);g=a+100|0;h=f[e>>2]|0;i=(f[h+28>>2]|0)-(f[h+24>>2]|0)>>2;f[c>>2]=0;h=a+104|0;j=f[h>>2]|0;k=f[g>>2]|0;l=j-k>>2;m=k;k=j;if(i>>>0<=l>>>0){if(i>>>0>>0?(j=m+(i<<2)|0,(j|0)!=(k|0)):0)f[h>>2]=k+(~((k+-4-j|0)>>>2)<<2)}else Ch(g,i-l|0,c);l=a+120|0;a=f[l>>2]|0;if(!a){i=f[e>>2]|0;g=(f[i+4>>2]|0)-(f[i>>2]|0)>>2;i=(g>>>0)/3|0;if(g>>>0<=2){u=b;return 1}g=0;do{f[d>>2]=g*3;f[c>>2]=f[d>>2];wb(e,c);g=g+1|0}while((g|0)<(i|0));u=b;return 1}else{i=f[a>>2]|0;if((f[a+4>>2]|0)==(i|0)){u=b;return 1}a=0;g=i;do{f[d>>2]=f[g+(a<<2)>>2];f[c>>2]=f[d>>2];wb(e,c);a=a+1|0;i=f[l>>2]|0;g=f[i>>2]|0}while(a>>>0<(f[i+4>>2]|0)-g>>2>>>0);u=b;return 1}return 0}function Mf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-4194304|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-4177920|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+4194304|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1077936128|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Nf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-2097152|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-2080768|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+6291456|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1075838976|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Of(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-1048576|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1032192|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+7340032|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074790400|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Pf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Tm(j);Jj(j,d,0,g&255,i,0,g<<1,0,0,0);i=jf(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+((X(d,g)|0)<<1)|0;r=n;s=f[r>>2]|0;t=un(s|0,f[r+4>>2]|0,p|0,0)|0;kh((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}Oq(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);Oq(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Qf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Tm(j);Jj(j,d,0,g&255,i,0,g<<2,0,0,0);i=jf(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+((X(d,g)|0)<<2)|0;r=n;s=f[r>>2]|0;t=un(s|0,f[r+4>>2]|0,p|0,0)|0;kh((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}Oq(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);Oq(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Rf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-262144|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-245760|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8126464|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1074003968|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Sf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-131072|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-114688|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8257536|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1073872896|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+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&~e|f[n>>2]&e;e=p+o|0;b=n+4|0;r=j-p|0;s=e&31;t=l+(e>>>5<<2)|0;v=b;w=b}b=(r|0)/32|0;im(t|0,v|0,b<<2|0)|0;v=r-(b<<5)|0;r=t+(b<<2)|0;t=r;if((v|0)>0){e=-1>>>(32-v|0);f[r>>2]=f[r>>2]&~e|f[w+(b<<2)>>2]&e;x=v;y=t}else{x=s;y=t}}else{x=o;y=m}f[k>>2]=y;f[k+4>>2]=x;u=d;return}function Uf(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-32768|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-16384|0;b[m>>0]=n;b[m+1>>0]=n>>>8;o=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;n=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+8355840|0;b[n>>0]=m;b[n+1>>0]=m>>>8;b[n+2>>0]=m>>>16;o=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;n=j+-1073774592|0;b[m>>0]=n;b[m+1>>0]=n>>>8;b[m+2>>0]=n>>>16;b[m+3>>0]=n>>>24;o=(f[l>>2]|0)+4|0;break}else{o=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;o=(f[l>>2]|0)+1|0}while(0);k=((o|0)<0)<<31>>31;Gn(e);yh(o,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,o|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,o|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function Vf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;g=f[b+12>>2]|0;b=(((c^318)+239^d)+239^e)+239^g;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=25;break}if((((n?(f[k+8>>2]|0)==(c|0):0)?(f[k+12>>2]|0)==(d|0):0)?(f[k+16>>2]|0)==(e|0):0)?(f[k+20>>2]|0)==(g|0):0){i=k;o=25;break}k=f[k>>2]|0;if(!k){i=0;o=25;break}}if((o|0)==25)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){if((((f[p+8>>2]|0)==(c|0)?(f[p+12>>2]|0)==(d|0):0)?(f[p+16>>2]|0)==(e|0):0)?(f[p+20>>2]|0)==(g|0):0){i=p;o=25;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=25;break}}p=f[p>>2]|0;if(!p){i=0;o=25;break}}if((o|0)==25)return i|0;return 0}function Wf(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;a=u;u=u+96|0;j=a;if(!c){k=-1;u=a;return k|0}Tm(j);Jj(j,d,0,g&255,i,0,g,0,0,0);i=jf(c,j,1,e)|0;d=f[(f[c+8>>2]|0)+(i<<2)>>2]|0;if(e|0){l=d+84|0;m=d+68|0;n=d+40|0;o=d+64|0;d=0;do{if(!(b[l>>0]|0))p=f[(f[m>>2]|0)+(d<<2)>>2]|0;else p=d;q=h+(X(d,g)|0)|0;r=n;s=f[r>>2]|0;t=un(s|0,f[r+4>>2]|0,p|0,0)|0;kh((f[f[o>>2]>>2]|0)+t|0,q|0,s|0)|0;d=d+1|0}while((d|0)!=(e|0))}d=c+80|0;c=f[d>>2]|0;if(c)if((c|0)==(e|0))v=10;else w=-1;else{f[d>>2]=e;v=10}if((v|0)==10)w=i;i=j+88|0;v=f[i>>2]|0;f[i>>2]=0;if(v|0){i=f[v+8>>2]|0;if(i|0){e=v+12|0;if((f[e>>2]|0)!=(i|0))f[e>>2]=i;Oq(i)}Oq(v)}v=f[j+68>>2]|0;if(v|0){i=j+72|0;e=f[i>>2]|0;if((e|0)!=(v|0))f[i>>2]=e+(~((e+-4-v|0)>>>2)<<2);Oq(v)}v=j+64|0;j=f[v>>2]|0;f[v>>2]=0;if(j|0){v=f[j>>2]|0;if(v|0){e=j+4|0;if((f[e>>2]|0)!=(v|0))f[e>>2]=v;Oq(v)}Oq(j)}k=w;u=a;return k|0}function Xf(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=u;u=u+32|0;i=h;j=h+16|0;k=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;do if((c+-1|0)>>>0<6&(Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)==1){l=Qa[f[(f[b>>2]|0)+48>>2]&127](b)|0;m=Ra[f[(f[b>>2]|0)+56>>2]&127](b,d)|0;if((l|0)==0|(m|0)==0){f[a>>2]=0;u=h;return}n=Ra[f[(f[b>>2]|0)+52>>2]&127](b,d)|0;if(!n){f[i>>2]=f[b+52>>2];f[i+4>>2]=l;f[i+12>>2]=m;f[i+8>>2]=m+12;qd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}else{f[i>>2]=f[b+52>>2];f[i+4>>2]=n;f[i+12>>2]=m;f[i+8>>2]=m+12;pd(a,j,c,k,e,i,g);if(!(f[a>>2]|0)){f[a>>2]=0;break}u=h;return}}while(0);f[a>>2]=0;u=h;return}function Yf(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=f[d>>2]|0;g=f[d+4>>2]|0;if((e|0)==(g|0)){h=0;i=a+12|0;j=a+8|0}else{d=f[c>>2]|0;c=a+8|0;k=a+12|0;a=0;l=e;while(1){e=f[l>>2]|0;m=f[d+(e<<2)>>2]|0;if(m>>>0>>0)n=a;else{o=f[c>>2]|0;p=(f[k>>2]|0)-o|0;q=o;if((p|0)>0){o=p>>>2;p=0;do{r=f[q+(p<<2)>>2]|0;s=f[r+68>>2]|0;if(!(b[r+84>>0]|0))t=f[s+(e<<2)>>2]|0;else t=e;f[s+(m<<2)>>2]=t;p=p+1|0}while((p|0)<(o|0))}n=m+1|0}l=l+4|0;if((l|0)==(g|0)){h=n;i=k;j=c;break}else a=n}}n=f[i>>2]|0;a=f[j>>2]|0;if((n-a|0)>0){u=0;v=a;w=n}else return;while(1){n=f[v+(u<<2)>>2]|0;b[n+84>>0]=0;a=n+68|0;c=n+72|0;n=f[c>>2]|0;k=f[a>>2]|0;g=n-k>>2;l=k;k=n;if(h>>>0<=g>>>0)if(h>>>0>>0?(n=l+(h<<2)|0,(n|0)!=(k|0)):0){f[c>>2]=k+(~((k+-4-n|0)>>>2)<<2);x=v;y=w}else{x=v;y=w}else{Ch(a,h-g|0,6220);x=f[j>>2]|0;y=f[i>>2]|0}u=u+1|0;if((u|0)>=(y-x>>2|0))break;else{v=x;w=y}}return}function Zf(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)im(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=((c+-4-o|0)>>>2)+1|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+(p<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);Oq(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)aq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)aq(a);h=ln(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=((c+-4-d|0)>>>2)+1|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+(p<<2);return}function _f(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=u;u=u+32|0;e=d;g=a+40|0;h=(f[c>>2]|0)+(f[g>>2]|0)|0;i=a+24|0;j=f[a+32>>2]|0;k=j+-16384|0;do if(k>>>0>=64){if(k>>>0<16384){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;b[m>>0]=j;b[m+1>>0]=j>>>8;n=(f[l>>2]|0)+2|0;break}if(k>>>0<4194304){l=a+28|0;m=(f[i>>2]|0)+(f[l>>2]|0)|0;o=j+8372224|0;b[m>>0]=o;b[m+1>>0]=o>>>8;b[m+2>>0]=o>>>16;n=(f[l>>2]|0)+3|0;break}if(k>>>0<1073741824){l=a+28|0;o=(f[i>>2]|0)+(f[l>>2]|0)|0;m=j+-1073758208|0;b[o>>0]=m;b[o+1>>0]=m>>>8;b[o+2>>0]=m>>>16;b[o+3>>0]=m>>>24;n=(f[l>>2]|0)+4|0;break}else{n=f[a+28>>2]|0;break}}else{l=a+28|0;b[(f[i>>2]|0)+(f[l>>2]|0)>>0]=k;n=(f[l>>2]|0)+1|0}while(0);k=((n|0)<0)<<31>>31;Gn(e);yh(n,k,e)|0;i=e+4|0;a=(f[i>>2]|0)-(f[e>>2]|0)|0;im(h+a|0,h|0,n|0)|0;kh(h|0,f[e>>2]|0,a|0)|0;h=g;g=f[h>>2]|0;j=f[h+4>>2]|0;h=Vn(a|0,0,n|0,k|0)|0;k=Vn(h|0,I|0,g|0,j|0)|0;Cl(c,k,I);k=e+12|0;c=f[k>>2]|0;f[k>>2]=0;if(c|0)Oq(c);c=f[e>>2]|0;if(!c){u=d;return}if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c);u=d;return}function $f(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=b;e=c-d>>2;g=a+8|0;h=f[g>>2]|0;i=f[a>>2]|0;j=i;if(e>>>0<=h-i>>2>>>0){k=a+4|0;l=(f[k>>2]|0)-i>>2;m=e>>>0>l>>>0;n=b+(l<<2)|0;l=m?n:c;o=l;p=o-d|0;q=p>>2;if(q|0)im(i|0,b|0,p|0)|0;p=j+(q<<2)|0;if(!m){m=f[k>>2]|0;if((m|0)==(p|0))return;f[k>>2]=m+(~((m+-4-p|0)>>>2)<<2);return}if((l|0)==(c|0))return;l=f[k>>2]|0;p=c+-4-o|0;o=n;n=l;while(1){f[n>>2]=f[o>>2];o=o+4|0;if((o|0)==(c|0))break;else n=n+4|0}f[k>>2]=l+((p>>>2)+1<<2);return}p=i;if(!i)r=h;else{h=a+4|0;l=f[h>>2]|0;if((l|0)!=(j|0))f[h>>2]=l+(~((l+-4-i|0)>>>2)<<2);Oq(p);f[g>>2]=0;f[h>>2]=0;f[a>>2]=0;r=0}if(e>>>0>1073741823)aq(a);h=r>>1;p=r>>2>>>0<536870911?(h>>>0>>0?e:h):1073741823;if(p>>>0>1073741823)aq(a);h=ln(p<<2)|0;e=a+4|0;f[e>>2]=h;f[a>>2]=h;f[g>>2]=h+(p<<2);if((b|0)==(c|0))return;p=c+-4-d|0;d=b;b=h;while(1){f[b>>2]=f[d>>2];d=d+4|0;if((d|0)==(c|0))break;else b=b+4|0}f[e>>2]=h+((p>>>2)+1<<2);return}function ag(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0;g=u;u=u+80|0;h=g;i=g+64|0;Il(h);j=f[(f[a+8>>2]|0)+56>>2]|0;k=X(Vl(5)|0,d)|0;Jj(h,j,0,d&255,5,0,k,((k|0)<0)<<31>>31,0,0);k=ln(96)|0;tl(k,h);Bj(k,c)|0;f[i>>2]=k;gj(a,i);k=f[i>>2]|0;f[i>>2]=0;if(k|0){i=k+88|0;c=f[i>>2]|0;f[i>>2]=0;if(c|0){i=f[c+8>>2]|0;if(i|0){h=c+12|0;if((f[h>>2]|0)!=(i|0))f[h>>2]=i;Oq(i)}Oq(c)}c=f[k+68>>2]|0;if(c|0){i=k+72|0;h=f[i>>2]|0;if((h|0)!=(c|0))f[i>>2]=h+(~((h+-4-c|0)>>>2)<<2);Oq(c)}c=k+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){i=h+4|0;if((f[i>>2]|0)!=(c|0))f[i>>2]=c;Oq(c)}Oq(h)}Oq(k)}if(!e){u=g;return}k=f[a+32>>2]|0;b[k+84>>0]=0;a=k+68|0;h=k+72|0;k=f[h>>2]|0;c=f[a>>2]|0;i=k-c>>2;d=k;if(i>>>0>>0){Ch(a,e-i|0,1532);u=g;return}if(i>>>0<=e>>>0){u=g;return}i=c+(e<<2)|0;if((i|0)==(d|0)){u=g;return}f[h>>2]=d+(~((d+-4-i|0)>>>2)<<2);u=g;return}function bg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;c=u;u=u+16|0;d=c+4|0;e=c;g=a+4|0;h=f[g>>2]|0;i=a+8|0;j=f[i>>2]|0;if((j|0)==(h|0))k=h;else{l=j+(~((j+-4-h|0)>>>2)<<2)|0;f[i>>2]=l;k=l}l=a+16|0;h=f[l>>2]|0;j=a+20|0;m=f[j>>2]|0;n=h;if((m|0)!=(h|0))f[j>>2]=m+(~((m+-4-n|0)>>>2)<<2);m=f[b>>2]|0;h=f[b+4>>2]|0;if((m|0)==(h|0)){u=c;return}b=a+12|0;a=m;m=k;k=n;while(1){n=f[a>>2]|0;f[d>>2]=n;if((m|0)==(f[b>>2]|0)){Ri(g,d);o=f[l>>2]|0}else{f[m>>2]=n;f[i>>2]=m+4;o=k}n=f[d>>2]|0;p=f[j>>2]|0;q=p-o>>2;r=o;if((n|0)<(q|0)){s=r;t=n;v=o}else{w=n+1|0;f[e>>2]=-1;x=p;if(w>>>0<=q>>>0)if(w>>>0>>0?(p=r+(w<<2)|0,(p|0)!=(x|0)):0){f[j>>2]=x+(~((x+-4-p|0)>>>2)<<2);y=n;z=r;A=o}else{y=n;z=r;A=o}else{Ch(l,w-q|0,e);q=f[l>>2]|0;y=f[d>>2]|0;z=q;A=q}s=z;t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d[b+4>>1]|0;b=(((c^318)&65535)+239^e&65535)+239^g&65535;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(b>>>0>>0)l=b;else l=(b>>>0)%(h>>>0)|0;else l=b&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(b|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(d[n>>1]|0)==c<<16>>16):0)?(d[n+2>>1]|0)==e<<16>>16:0)?(d[k+12>>1]|0)==g<<16>>16:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(b|0)){k=p+8|0;if(((d[k>>1]|0)==c<<16>>16?(d[k+2>>1]|0)==e<<16>>16:0)?(d[p+12>>1]|0)==g<<16>>16:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function eg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=u;u=u+32|0;d=c;e=a+16|0;g=e;h=f[g>>2]|0;i=f[g+4>>2]|0;if(!((i|0)>0|(i|0)==0&h>>>0>0)){u=c;return}g=Vn(f[(f[a+12>>2]|0)+4>>2]|0,0,7,0)|0;j=Yn(g|0,I|0,3)|0;g=I;if(!(b[a+24>>0]|0)){k=a+4|0;l=k;m=k;n=h;o=i}else{k=f[a>>2]|0;p=a+4|0;q=k+((f[p>>2]|0)-k)|0;k=Vn(h|0,i|0,8,0)|0;i=q+(0-k)|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>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;if(!b)o=0;else{d=a+28|0;do if(b>>>0>f[d>>2]<<5>>>0){n=f[h>>2]|0;if(!n)p=b;else{Oq(n);f[h>>2]=0;f[d>>2]=0;f[a+24>>2]=0;p=f[m>>2]|0}if((p|0)<0)aq(h);else{n=((p+-1|0)>>>5)+1|0;c=ln(n<<2)|0;f[h>>2]=c;f[a+24>>2]=0;f[d>>2]=n;q=f[m>>2]|0;r=c;break}}else{q=b;r=f[h>>2]|0}while(0);im(r|0,f[e>>2]|0,((q+-1|0)>>>5<<2)+4|0)|0;o=f[m>>2]|0}f[a+24>>2]=o;return a|0}function gg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;f[c>>2]=1;d=a+4|0;e=c+8|0;g=c+12|0;c=f[e>>2]|0;i=(f[g>>2]|0)-c|0;if(i>>>0<4294967292){Lk(e,i+4|0,0);j=f[e>>2]|0}else j=c;c=j+i|0;i=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[c>>0]=i;b[c+1>>0]=i>>8;b[c+2>>0]=i>>16;b[c+3>>0]=i>>24;i=a+8|0;c=a+12|0;d=f[i>>2]|0;if((f[c>>2]|0)!=(d|0)){j=0;k=d;do{d=k+(j<<2)|0;l=f[e>>2]|0;m=(f[g>>2]|0)-l|0;if(m>>>0<4294967292){Lk(e,m+4|0,0);n=f[e>>2]|0}else n=l;l=n+m|0;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[l>>0]=m;b[l+1>>0]=m>>8;b[l+2>>0]=m>>16;b[l+3>>0]=m>>24;j=j+1|0;k=f[i>>2]|0}while(j>>>0<(f[c>>2]|0)-k>>2>>>0)}k=a+20|0;a=f[e>>2]|0;c=(f[g>>2]|0)-a|0;if(c>>>0<4294967292){Lk(e,c+4|0,0);o=f[e>>2]|0;p=o+c|0;q=h[k>>0]|h[k+1>>0]<<8|h[k+2>>0]<<16|h[k+3>>0]<<24;b[p>>0]=q;b[p+1>>0]=q>>8;b[p+2>>0]=q>>16;b[p+3>>0]=q>>24;return}else{o=a;p=o+c|0;q=h[k>>0]|h[k+1>>0]<<8|h[k+2>>0]<<16|h[k+3>>0]<<24;b[p>>0]=q;b[p+1>>0]=q>>8;b[p+2>>0]=q>>16;b[p+3>>0]=q>>24;return}}function hg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+8|0;e=f[d>>2]|0;g=f[a>>2]|0;h=g;do if(e-g>>2>>>0>=b>>>0){i=a+4|0;j=f[i>>2]|0;k=j-g>>2;l=k>>>0>>0;m=l?k:b;n=j;if(m|0){j=m;m=h;while(1){f[m>>2]=f[c>>2];j=j+-1|0;if(!j)break;else m=m+4|0}}if(!l){m=h+(b<<2)|0;if((m|0)==(n|0))return;else{o=i;p=n+(~((n+-4-m|0)>>>2)<<2)|0;break}}else{m=b-k|0;j=m;q=n;while(1){f[q>>2]=f[c>>2];j=j+-1|0;if(!j)break;else q=q+4|0}o=i;p=n+(m<<2)|0;break}}else{q=g;if(!g)r=e;else{j=a+4|0;k=f[j>>2]|0;if((k|0)!=(h|0))f[j>>2]=k+(~((k+-4-g|0)>>>2)<<2);Oq(q);f[d>>2]=0;f[j>>2]=0;f[a>>2]=0;r=0}if(b>>>0>1073741823)aq(a);j=r>>1;q=r>>2>>>0<536870911?(j>>>0>>0?b:j):1073741823;if(q>>>0>1073741823)aq(a);j=ln(q<<2)|0;k=a+4|0;f[k>>2]=j;f[a>>2]=j;f[d>>2]=j+(q<<2);q=b;l=j;while(1){f[l>>2]=f[c>>2];q=q+-1|0;if(!q)break;else l=l+4|0}o=k;p=j+(b<<2)|0}while(0);f[o>>2]=p;return}function ig(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=jh(a,b,c,d,g)|0;i=f[e>>2]|0;j=f[d>>2]|0;k=f[g>>2]|0;g=f[k>>2]|0;l=(f[k+4>>2]|0)-g>>3;if(l>>>0<=i>>>0)aq(k);m=g;if(l>>>0<=j>>>0)aq(k);if((f[m+(i<<3)>>2]|0)>>>0>=(f[m+(j<<3)>>2]|0)>>>0){n=h;return n|0}f[d>>2]=i;f[e>>2]=j;j=f[d>>2]|0;e=f[c>>2]|0;if(l>>>0<=j>>>0)aq(k);if(l>>>0<=e>>>0)aq(k);if((f[m+(j<<3)>>2]|0)>>>0>=(f[m+(e<<3)>>2]|0)>>>0){n=h+1|0;return n|0}f[c>>2]=j;f[d>>2]=e;e=f[c>>2]|0;d=f[b>>2]|0;if(l>>>0<=e>>>0)aq(k);if(l>>>0<=d>>>0)aq(k);if((f[m+(e<<3)>>2]|0)>>>0>=(f[m+(d<<3)>>2]|0)>>>0){n=h+2|0;return n|0}f[b>>2]=e;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(l>>>0<=d>>>0)aq(k);if(l>>>0<=c>>>0)aq(k);if((f[m+(d<<3)>>2]|0)>>>0>=(f[m+(c<<3)>>2]|0)>>>0){n=h+3|0;return n|0}f[a>>2]=d;f[b>>2]=c;n=h+4|0;return n|0}function jg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=b[c>>0]|0;e=b[c+1>>0]|0;g=b[c+2>>0]|0;c=((d&255^318)+239^e&255)+239^g&255;h=f[a+4>>2]|0;if(!h){i=0;return i|0}j=h+-1|0;k=(j&h|0)==0;if(!k)if(c>>>0>>0)l=c;else l=(c>>>0)%(h>>>0)|0;else l=c&j;m=f[(f[a>>2]|0)+(l<<2)>>2]|0;if(!m){i=0;return i|0}a=f[m>>2]|0;if(!a){i=0;return i|0}if(k){k=a;while(1){m=f[k+4>>2]|0;n=(m|0)==(c|0);if(!(n|(m&j|0)==(l|0))){i=0;o=23;break}if(((n?(n=k+8|0,(b[n>>0]|0)==d<<24>>24):0)?(b[n+1>>0]|0)==e<<24>>24:0)?(b[n+2>>0]|0)==g<<24>>24:0){i=k;o=23;break}k=f[k>>2]|0;if(!k){i=0;o=23;break}}if((o|0)==23)return i|0}else p=a;while(1){a=f[p+4>>2]|0;if((a|0)==(c|0)){k=p+8|0;if(((b[k>>0]|0)==d<<24>>24?(b[k+1>>0]|0)==e<<24>>24:0)?(b[k+2>>0]|0)==g<<24>>24:0){i=p;o=23;break}}else{if(a>>>0>>0)q=a;else q=(a>>>0)%(h>>>0)|0;if((q|0)!=(l|0)){i=0;o=23;break}}p=f[p>>2]|0;if(!p){i=0;o=23;break}}if((o|0)==23)return i|0;return 0}function kg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;b=u;u=u+16|0;c=b;d=a+36|0;e=a+4|0;g=a+8|0;h=(f[g>>2]|0)-(f[e>>2]|0)>>2;i=a+40|0;j=f[i>>2]|0;k=f[d>>2]|0;l=j-k>>2;m=k;k=j;if(h>>>0<=l>>>0){if(h>>>0>>0?(j=m+(h<<2)|0,(j|0)!=(k|0)):0){m=k;do{k=m+-4|0;f[i>>2]=k;n=f[k>>2]|0;f[k>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);m=f[i>>2]|0}while((m|0)!=(j|0))}}else Eg(d,h-l|0);if((f[g>>2]|0)==(f[e>>2]|0)){o=1;u=b;return o|0}l=a+52|0;h=a+48|0;j=0;while(1){Xa[f[(f[a>>2]|0)+56>>2]&15](c,a,j);m=(f[d>>2]|0)+(j<<2)|0;i=f[c>>2]|0;f[c>>2]=0;n=f[m>>2]|0;f[m>>2]=i;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[c>>2]|0;f[c>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n);n=f[(f[d>>2]|0)+(j<<2)>>2]|0;if(!n){o=0;p=19;break}if(j>>>0<(f[l>>2]|0)>>>0?f[(f[h>>2]|0)+(j>>>5<<2)>>2]&1<<(j&31)|0:0)Bp(n);j=j+1|0;if(j>>>0>=(f[g>>2]|0)-(f[e>>2]|0)>>2>>>0){o=1;p=19;break}}if((p|0)==19){u=b;return o|0}return 0}function lg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d+4|0;g=d;ci(f[c+12>>2]|0,b)|0;h=f[c+8>>2]|0;a:do if(h|0){i=b+16|0;j=b+4|0;k=h;while(1){l=k;if(!(Bf(0,b,l+8|0)|0)){m=0;break}n=l+20|0;o=(f[l+24>>2]|0)-(f[n>>2]|0)|0;ci(o,b)|0;l=f[n>>2]|0;n=i;p=f[n+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[j>>2];f[e>>2]=f[g>>2];Me(b,e,l,l+o|0)|0}k=f[k>>2]|0;if(!k)break a}u=d;return m|0}while(0);ci(f[c+32>>2]|0,b)|0;e=f[c+28>>2]|0;if(!e){m=1;u=d;return m|0}else q=e;while(1){e=q;if(!(Bf(0,b,e+8|0)|0)){m=0;r=10;break}lg(a,b,f[e+20>>2]|0)|0;q=f[q>>2]|0;if(!q){m=1;r=10;break}}if((r|0)==10){u=d;return m|0}return 0}function mg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+8|0;i=a+12|0;j=f[h>>2]|0;if((f[i>>2]|0)==(j|0)){k=ln(76)|0;vn(k,b);l=k;f[g>>2]=l;k=f[i>>2]|0;if(k>>>0<(f[a+16>>2]|0)>>>0){f[g>>2]=0;f[k>>2]=l;f[i>>2]=k+4;m=g}else{Qg(h,g);m=g}g=f[m>>2]|0;f[m>>2]=0;if(!g){u=c;return 1}Va[f[(f[g>>2]|0)+4>>2]&127](g);u=c;return 1}g=f[j>>2]|0;f[d>>2]=b;j=g+4|0;m=g+8|0;h=f[m>>2]|0;if((h|0)==(f[g+12>>2]|0))Ri(j,d);else{f[h>>2]=b;f[m>>2]=h+4}h=f[d>>2]|0;b=g+16|0;k=g+20|0;g=f[k>>2]|0;i=f[b>>2]|0;l=g-i>>2;a=i;if((h|0)<(l|0)){n=a;o=h}else{i=h+1|0;f[e>>2]=-1;p=g;if(i>>>0<=l>>>0)if(i>>>0>>0?(g=a+(i<<2)|0,(g|0)!=(p|0)):0){f[k>>2]=p+(~((p+-4-g|0)>>>2)<<2);q=h;r=a}else{q=h;r=a}else{Ch(b,i-l|0,e);q=f[d>>2]|0;r=f[b>>2]|0}n=r;o=q}f[n+(o<<2)>>2]=((f[m>>2]|0)-(f[j>>2]|0)>>2)+-1;u=c;return 1}function ng(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;d=c;e=b;g=d-e|0;h=g>>2;i=a+8|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(h>>>0>j-k>>2>>>0){m=k;if(!k)n=j;else{j=a+4|0;o=f[j>>2]|0;if((o|0)!=(l|0))f[j>>2]=o+(~((o+-4-k|0)>>>2)<<2);Oq(m);f[i>>2]=0;f[j>>2]=0;f[a>>2]=0;n=0}if(h>>>0>1073741823)aq(a);j=n>>1;m=n>>2>>>0<536870911?(j>>>0>>0?h:j):1073741823;if(m>>>0>1073741823)aq(a);j=ln(m<<2)|0;n=a+4|0;f[n>>2]=j;f[a>>2]=j;f[i>>2]=j+(m<<2);if((g|0)<=0)return;kh(j|0,b|0,g|0)|0;f[n>>2]=j+(g>>>2<<2);return}g=a+4|0;a=f[g>>2]|0;j=a-k>>2;k=h>>>0>j>>>0;h=k?b+(j<<2)|0:c;c=a;j=a;if((h|0)==(b|0))p=l;else{a=h+-4-e|0;e=b;b=l;while(1){f[b>>2]=f[e>>2];e=e+4|0;if((e|0)==(h|0))break;else b=b+4|0}p=l+((a>>>2)+1<<2)|0}if(k){k=d-h|0;if((k|0)<=0)return;kh(j|0,h|0,k|0)|0;f[g>>2]=(f[g>>2]|0)+(k>>>2<<2);return}else{if((p|0)==(c|0))return;f[g>>2]=c+(~((c+-4-p|0)>>>2)<<2);return}}function og(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=f[a+8>>2]|0;e=a+76|0;g=f[e>>2]|0;h=f[g+80>>2]|0;b[c+84>>0]=0;i=c+68|0;j=c+72|0;k=f[j>>2]|0;l=f[i>>2]|0;m=k-l>>2;n=l;l=k;if(h>>>0<=m>>>0)if(h>>>0>>0?(k=n+(h<<2)|0,(k|0)!=(l|0)):0){f[j>>2]=l+(~((l+-4-k|0)>>>2)<<2);o=g;p=h}else{o=g;p=h}else{Ch(i,h-m|0,3600);m=f[e>>2]|0;o=m;p=f[m+80>>2]|0}m=(f[o+100>>2]|0)-(f[o+96>>2]|0)|0;e=(m|0)/12|0;if(!m){q=1;return q|0}m=c+68|0;c=f[o+96>>2]|0;o=f[d+28>>2]|0;d=f[(f[a+80>>2]|0)+12>>2]|0;a=0;while(1){h=a*3|0;i=f[d+(f[o+(h<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}g=f[m>>2]|0;f[g+(f[c+(a*12|0)>>2]<<2)>>2]=i;i=f[d+(f[o+(h+1<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}f[g+(f[c+(a*12|0)+4>>2]<<2)>>2]=i;i=f[d+(f[o+(h+2<<2)>>2]<<2)>>2]|0;if(i>>>0>=p>>>0){q=0;r=10;break}f[g+(f[c+(a*12|0)+8>>2]<<2)>>2]=i;a=a+1|0;if(a>>>0>=e>>>0){q=1;r=10;break}}if((r|0)==10)return q|0;return 0}function pg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=u;u=u+16|0;g=e;if(!(xh(a,c,d)|0)){h=0;u=e;return h|0}if((b[(f[a+8>>2]|0)+24>>0]|0)!=3){h=0;u=e;return h|0}i=f[c+48>>2]|0;c=ln(32)|0;f[g>>2]=c;f[g+8>>2]=-2147483616;f[g+4>>2]=17;j=c;k=14495;l=j+17|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[c+17>>0]=0;c=i+16|0;k=f[c>>2]|0;if(k){j=c;l=k;a:while(1){k=l;while(1){if((f[k+16>>2]|0)>=(d|0))break;m=f[k+4>>2]|0;if(!m){n=j;break a}else k=m}l=f[k>>2]|0;if(!l){n=k;break}else j=k}if(((n|0)!=(c|0)?(f[n+16>>2]|0)<=(d|0):0)?(d=n+20|0,(Jh(d,g)|0)!=0):0)o=Hk(d,g,-1)|0;else p=12}else p=12;if((p|0)==12)o=Hk(i,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((o|0)<1){h=0;u=e;return h|0}ip(a+40|0,o);h=1;u=e;return h|0}function qg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=f[b>>2]|0;d=f[b+4>>2]|0;e=f[b+8>>2]|0;b=((c^318)+239^d)+239^e;g=f[a+4>>2]|0;if(!g){h=0;return h|0}i=g+-1|0;j=(i&g|0)==0;if(!j)if(b>>>0>>0)k=b;else k=(b>>>0)%(g>>>0)|0;else k=b&i;l=f[(f[a>>2]|0)+(k<<2)>>2]|0;if(!l){h=0;return h|0}a=f[l>>2]|0;if(!a){h=0;return h|0}if(j){j=a;while(1){l=f[j+4>>2]|0;m=(l|0)==(b|0);if(!(m|(l&i|0)==(k|0))){h=0;n=23;break}if(((m?(f[j+8>>2]|0)==(c|0):0)?(f[j+12>>2]|0)==(d|0):0)?(f[j+16>>2]|0)==(e|0):0){h=j;n=23;break}j=f[j>>2]|0;if(!j){h=0;n=23;break}}if((n|0)==23)return h|0}else o=a;while(1){a=f[o+4>>2]|0;if((a|0)==(b|0)){if(((f[o+8>>2]|0)==(c|0)?(f[o+12>>2]|0)==(d|0):0)?(f[o+16>>2]|0)==(e|0):0){h=o;n=23;break}}else{if(a>>>0>>0)p=a;else p=(a>>>0)%(g>>>0)|0;if((p|0)!=(k|0)){h=0;n=23;break}}o=f[o>>2]|0;if(!o){h=0;n=23;break}}if((n|0)==23)return h|0;return 0}function rg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=c;g=d-e|0;h=a+8|0;i=f[h>>2]|0;j=f[a>>2]|0;k=j;if(g>>>0>(i-j|0)>>>0){if(!j)l=i;else{i=a+4|0;if((f[i>>2]|0)!=(k|0))f[i>>2]=k;Oq(k);f[h>>2]=0;f[i>>2]=0;f[a>>2]=0;l=0}if((g|0)<0)aq(a);i=l<<1;m=l>>>0<1073741823?(i>>>0>>0?g:i):2147483647;if((m|0)<0)aq(a);i=ln(m)|0;l=a+4|0;f[l>>2]=i;f[a>>2]=i;f[h>>2]=i+m;if((c|0)==(d|0))return;else{n=c;o=i}do{b[o>>0]=b[n>>0]|0;n=n+1|0;o=(f[l>>2]|0)+1|0;f[l>>2]=o}while((n|0)!=(d|0));return}n=a+4|0;a=(f[n>>2]|0)-j|0;j=g>>>0>a>>>0;g=c+a|0;a=j?g:d;if((a|0)==(c|0))p=k;else{o=c;c=k;while(1){b[c>>0]=b[o>>0]|0;o=o+1|0;if((o|0)==(a|0))break;else c=c+1|0}p=k+(a-e)|0}if(!j){if((f[n>>2]|0)==(p|0))return;f[n>>2]=p;return}if((a|0)==(d|0))return;a=g;g=f[n>>2]|0;do{b[g>>0]=b[a>>0]|0;a=a+1|0;g=(f[n>>2]|0)+1|0;f[n>>2]=g}while((a|0)!=(d|0));return}function sg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=c>>>1&1431655765|c<<1&-1431655766;c=d>>>2&858993459|d<<2&-858993460;d=c>>>4&252645135|c<<4&-252645136;c=d>>>8&16711935|d<<8&-16711936;d=32-b|0;e=(c>>>16|c<<16)>>>d;c=e-(e>>>1&1431655765)|0;g=(c>>>2&858993459)+(c&858993459)|0;c=(X((g>>>4)+g&252645135,16843009)|0)>>>24;g=b-c|0;h=f[a>>2]|0;i=h;j=Vn(f[i>>2]|0,f[i+4>>2]|0,g|0,((g|0)<0)<<31>>31|0)|0;g=h;f[g>>2]=j;f[g+4>>2]=I;g=h+8|0;h=g;j=Vn(f[h>>2]|0,f[h+4>>2]|0,c|0,0)|0;c=g;f[c>>2]=j;f[c+4>>2]=I;c=a+28|0;j=f[c>>2]|0;g=32-j|0;h=a+24|0;do if((g|0)>=(b|0)){i=-1>>>d<>2]&~i|i&e<>2]=k;i=j+b|0;f[c>>2]=i;if((i|0)!=32)return;i=a+16|0;l=f[i>>2]|0;if((l|0)==(f[a+20>>2]|0)){Ri(a+12|0,h);m=0;n=0;break}else{f[l>>2]=k;f[i>>2]=l+4;m=0;n=0;break}}else{l=-1>>>j<>2]&~l|l&e<>2]=i;l=a+16|0;k=f[l>>2]|0;if((k|0)==(f[a+20>>2]|0))Ri(a+12|0,h);else{f[k>>2]=i;f[l>>2]=k+4}k=b-g|0;m=k;n=-1>>>(32-k|0)&e>>>g}while(0);f[h>>2]=n;f[c>>2]=m;return}function tg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;e=c&255;g=(d|0)!=0;a:do if(g&(a&3|0)!=0){h=c&255;i=a;j=d;while(1){if((b[i>>0]|0)==h<<24>>24){k=i;l=j;m=6;break a}n=i+1|0;o=j+-1|0;p=(o|0)!=0;if(p&(n&3|0)!=0){i=n;j=o}else{q=n;r=o;s=p;m=5;break}}}else{q=a;r=d;s=g;m=5}while(0);if((m|0)==5)if(s){k=q;l=r;m=6}else{t=q;u=0}b:do if((m|0)==6){q=c&255;if((b[k>>0]|0)==q<<24>>24){t=k;u=l}else{r=X(e,16843009)|0;c:do if(l>>>0>3){s=k;g=l;while(1){d=f[s>>2]^r;if((d&-2139062144^-2139062144)&d+-16843009|0)break;d=s+4|0;a=g+-4|0;if(a>>>0>3){s=d;g=a}else{v=d;w=a;m=11;break c}}x=s;y=g}else{v=k;w=l;m=11}while(0);if((m|0)==11)if(!w){t=v;u=0;break}else{x=v;y=w}while(1){if((b[x>>0]|0)==q<<24>>24){t=x;u=y;break b}r=x+1|0;y=y+-1|0;if(!y){t=r;u=0;break}else x=r}}}while(0);return (u|0?t:0)|0}function ug(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=e;do if((d|0)==(e|0)){h=a+8|0;i=f[h>>2]|0;j=a+12|0;k=f[j>>2]|0;l=k;if(i>>>0>>0){k=i;m=((l-k>>2)+1|0)/2|0;n=i+(m<<2)|0;o=k-d|0;k=o>>2;p=n+(0-k<<2)|0;if(!k){q=n;r=i}else{im(p|0,d|0,o|0)|0;q=p;r=f[h>>2]|0}f[c>>2]=q;f[h>>2]=r+(m<<2);s=q;break}m=l-g>>1;l=(m|0)==0?1:m;if(l>>>0>1073741823){m=ra(8)|0;Oo(m,16035);f[m>>2]=7256;va(m|0,1112,110)}m=ln(l<<2)|0;p=m;o=m+((l+3|0)>>>2<<2)|0;n=o;k=m+(l<<2)|0;if((d|0)==(i|0)){t=n;u=d}else{l=o;m=n;v=d;do{f[l>>2]=f[v>>2];l=m+4|0;m=l;v=v+4|0}while((v|0)!=(i|0));t=m;u=f[a>>2]|0}f[a>>2]=p;f[c>>2]=n;f[h>>2]=t;f[j>>2]=k;if(!u)s=o;else{Oq(u);s=f[c>>2]|0}}else s=d;while(0);f[s+-4>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+-4;return}function vg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=a+4|0;if((f[i>>2]|0)==-1){j=0;u=d;return j|0}k=f[a+8>>2]|0;l=c+16|0;m=l;n=f[m>>2]|0;o=f[m+4>>2]|0;if(!((o|0)>0|(o|0)==0&n>>>0>0)){m=(f[a+12>>2]|0)-k|0;p=c+4|0;f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];Me(c,e,k,k+m|0)|0;m=l;k=f[m>>2]|0;q=f[m+4>>2]|0;m=a+20|0;if((q|0)>0|(q|0)==0&k>>>0>0){r=q;s=k;t=g}else{f[g>>2]=f[p>>2];f[e>>2]=f[g>>2];Me(c,e,m,m+4|0)|0;m=l;r=f[m+4>>2]|0;s=f[m>>2]|0;t=g}}else{r=o;s=n;t=g}b[h>>0]=f[i>>2];if(!((r|0)>0|(r|0)==0&s>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function wg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0;e=u;u=u+16|0;g=e+4|0;h=e;i=a+8|0;a=f[i>>2]|0;j=f[a+40>>2]|0;k=Lq((j|0)>-1?j:-1)|0;l=c+4|0;m=f[l>>2]|0;n=f[c>>2]|0;if((m|0)==(n|0)){Mq(k);u=e;return 1}o=d+16|0;p=d+4|0;q=k+j|0;j=0;r=n;n=a;s=a;a=m;while(1){m=f[r+(j<<2)>>2]|0;if(!(b[n+84>>0]|0))t=f[(f[n+68>>2]|0)+(m<<2)>>2]|0;else t=m;m=s+48|0;v=f[m>>2]|0;w=f[m+4>>2]|0;m=s+40|0;x=f[m>>2]|0;y=un(x|0,f[m+4>>2]|0,t|0,0)|0;m=Vn(y|0,I|0,v|0,w|0)|0;kh(k|0,(f[f[s>>2]>>2]|0)+m|0,x|0)|0;x=o;m=f[x+4>>2]|0;if((m|0)>0|(m|0)==0&(f[x>>2]|0)>>>0>0){z=r;A=a}else{f[h>>2]=f[p>>2];f[g>>2]=f[h>>2];Me(d,g,k,q)|0;z=f[c>>2]|0;A=f[l>>2]|0}x=j+1|0;if(x>>>0>=A-z>>2>>>0)break;m=f[i>>2]|0;j=x;r=z;n=m;s=m;a=A}Mq(k);u=e;return 1}function xg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=(f[b>>2]|0)*3|0;if((d|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}b=f[a+12>>2]|0;h=f[b+12>>2]|0;if((f[h+(d<<2)>>2]|0)==-1){e=0;g=d;f[c>>2]=g;return e|0}i=f[b>>2]|0;b=f[a+152>>2]|0;if((f[b+(f[i+(d<<2)>>2]<<2)>>2]|0)==-1){a=d+1|0;j=((a>>>0)%3|0|0)==0?d+-2|0:a;if((j|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(j<<2)>>2]|0)==-1){e=0;g=j;f[c>>2]=g;return e|0}if((f[b+(f[i+(j<<2)>>2]<<2)>>2]|0)==-1){a=j+1|0;k=((a>>>0)%3|0|0)==0?j+-2|0:a;if((k|0)==-1){e=0;g=-1;f[c>>2]=g;return e|0}if((f[h+(k<<2)>>2]|0)==-1){e=0;g=k;f[c>>2]=g;return e|0}if((f[b+(f[i+(k<<2)>>2]<<2)>>2]|0)==-1){i=k+1|0;e=1;g=((i>>>0)%3|0|0)==0?k+-2|0:i;f[c>>2]=g;return e|0}else l=k}else l=j}else l=d;while(1){d=(((l>>>0)%3|0|0)==0?2:-1)+l|0;if((d|0)==-1)break;j=f[h+(d<<2)>>2]|0;if((j|0)==-1)break;d=j+(((j>>>0)%3|0|0)==0?2:-1)|0;if((d|0)==-1)break;else l=d}e=0;g=(((l>>>0)%3|0|0)==0?2:-1)+l|0;f[c>>2]=g;return e|0}function yg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=a+4|0;g=f[e>>2]|0;if(!g){f[c>>2]=e;h=e;return h|0}e=b[d+11>>0]|0;i=e<<24>>24<0;j=i?f[d+4>>2]|0:e&255;e=i?f[d>>2]|0:d;d=a+4|0;a=g;while(1){g=a+16|0;i=b[g+11>>0]|0;k=i<<24>>24<0;l=k?f[a+20>>2]|0:i&255;i=l>>>0>>0;m=i?l:j;if((m|0)!=0?(n=Vk(e,k?f[g>>2]|0:g,m)|0,(n|0)!=0):0)if((n|0)<0)o=8;else o=10;else if(j>>>0>>0)o=8;else o=10;if((o|0)==8){o=0;n=f[a>>2]|0;if(!n){o=9;break}else{p=a;q=n}}else if((o|0)==10){o=0;n=j>>>0>>0?j:l;if((n|0)!=0?(l=Vk(k?f[g>>2]|0:g,e,n)|0,(l|0)!=0):0){if((l|0)>=0){o=16;break}}else o=12;if((o|0)==12?(o=0,!i):0){o=16;break}r=a+4|0;i=f[r>>2]|0;if(!i){o=15;break}else{p=r;q=i}}d=p;a=q}if((o|0)==9){f[c>>2]=a;h=a;return h|0}else if((o|0)==15){f[c>>2]=a;h=r;return h|0}else if((o|0)==16){f[c>>2]=a;h=d;return h|0}return 0}function zg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;d=u;u=u+32|0;e=d+24|0;g=d+16|0;h=d+8|0;i=d;j=a+4|0;k=f[j>>2]|0;l=f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2)|0;if((j|0)==(d|0)){t=o;u=k}else{k=m;m=o;l=j;do{f[k>>2]=f[l>>2];k=m+4|0;m=k;l=l+4|0}while((l|0)!=(d|0));t=m;u=f[a>>2]|0}f[a>>2]=n;f[i>>2]=o;f[c>>2]=t;f[e>>2]=s;if(!u)r=t;else{Oq(u);r=f[c>>2]|0}}else r=d;while(0);f[r>>2]=f[b>>2];f[c>>2]=(f[c>>2]|0)+4;return}function Bg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+12|0;i=a+4|0;j=f[i>>2]|0;if((j|0)==(f[a+8>>2]|0)){Ri(a,h);k=f[i>>2]|0}else{f[j>>2]=f[h>>2];l=j+4|0;f[i>>2]=l;k=l}l=f[a>>2]|0;f[g>>2]=k-l;k=b+16|0;j=k;m=f[j+4>>2]|0;if(!((m|0)>0|(m|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=f[a>>2]|0;m=f[g>>2]|0;g=k;k=f[g+4>>2]|0;if((k|0)>0|(k|0)==0&(f[g>>2]|0)>>>0>0){n=j;o=e}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,j,j+m|0)|0;n=f[a>>2]|0;o=e}}else{n=l;o=e}e=f[i>>2]|0;if((e|0)==(n|0)){f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}f[i>>2]=e+(~((e+-4-n|0)>>>2)<<2);f[h>>2]=0;p=a+16|0;f[p>>2]=0;u=c;return}function Cg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=c;g=d-e|0;h=a+8|0;i=f[h>>2]|0;j=f[a>>2]|0;k=j;if(g>>>0>(i-j|0)>>>0){if(!j)l=i;else{i=a+4|0;if((f[i>>2]|0)!=(k|0))f[i>>2]=k;Oq(k);f[h>>2]=0;f[i>>2]=0;f[a>>2]=0;l=0}if((g|0)<0)aq(a);i=l<<1;m=l>>>0<1073741823?(i>>>0>>0?g:i):2147483647;if((m|0)<0)aq(a);i=ln(m)|0;l=a+4|0;f[l>>2]=i;f[a>>2]=i;f[h>>2]=i+m;if((c|0)==(d|0))return;else{n=c;o=i}do{b[o>>0]=b[n>>0]|0;n=n+1|0;o=(f[l>>2]|0)+1|0;f[l>>2]=o}while((n|0)!=(d|0));return}else{n=a+4|0;a=(f[n>>2]|0)-j|0;j=g>>>0>a>>>0;g=c+a|0;a=j?g:d;o=a-e|0;if(o|0)im(k|0,c|0,o|0)|0;c=k+o|0;if(!j){if((f[n>>2]|0)==(c|0))return;f[n>>2]=c;return}if((a|0)==(d|0))return;a=g;g=f[n>>2]|0;do{b[g>>0]=b[a>>0]|0;a=a+1|0;g=(f[n>>2]|0)+1|0;f[n>>2]=g}while((a|0)!=(d|0));return}}function Dg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c;if(b[a+352>>0]|0){u=c;return 1}e=a+8|0;g=f[e>>2]|0;h=(f[g+12>>2]|0)-(f[g+8>>2]|0)|0;g=h>>2;i=a+172|0;Gi(i,g+-1|0);if(!((g|0)!=1&(h|0)>0)){u=c;return 1}h=a+12|0;a=0;j=0;while(1){k=f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[k+56>>2]|0))l=j;else{m=f[i>>2]|0;f[m+(j*136|0)>>2]=a;n=f[m+(j*136|0)+104>>2]|0;o=m+(j*136|0)+108|0;p=f[o>>2]|0;if((p|0)!=(n|0))f[o>>2]=p+(~((p+-4-n|0)>>>2)<<2);n=f[h>>2]|0;gk(m+(j*136|0)+104|0,(f[n+4>>2]|0)-(f[n>>2]|0)>>2);n=(f[i>>2]|0)+(j*136|0)+116|0;m=f[h>>2]|0;p=(f[m+4>>2]|0)-(f[m>>2]|0)>>2;f[d>>2]=-1;hg(n,p,d);p=f[i>>2]|0;f[p+(j*136|0)+128>>2]=0;Gc(p+(j*136|0)+4|0,f[e>>2]|0,f[h>>2]|0,k)|0;l=j+1|0}a=a+1|0;if((a|0)>=(g|0))break;else j=l}u=c;return 1}function Eg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){sj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}i=f[a>>2]|0;j=g-i>>2;g=j+b|0;k=i;if(g>>>0>1073741823)aq(a);l=d-i|0;d=l>>1;m=l>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(m)if(m>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{n=ln(m<<2)|0;break}else n=0;while(0);d=n+(j<<2)|0;sj(d|0,0,b<<2|0)|0;b=d;j=n+(m<<2)|0;m=n+(g<<2)|0;if((h|0)==(k|0)){o=b;p=i;q=h}else{i=h;h=b;b=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[b+-4>>2]=d;b=h+-4|0;h=b}while((i|0)!=(k|0));o=h;p=f[a>>2]|0;q=f[e>>2]|0}f[a>>2]=o;f[e>>2]=m;f[c>>2]=j;j=p;if((q|0)!=(j|0)){c=q;do{c=c+-4|0;q=f[c>>2]|0;f[c>>2]=0;if(q|0)Va[f[(f[q>>2]|0)+4>>2]&127](q)}while((c|0)!=(j|0))}if(!p)return;Oq(p);return}function Fg(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=$(h);var i=0,j=0,k=0,l=0,m=0,n=0;i=u;u=u+16|0;j=i;k=i+4|0;f[j>>2]=c;c=ln(32)|0;f[k>>2]=c;f[k+8>>2]=-2147483616;f[k+4>>2]=17;l=c;m=14495;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[c+17>>0]=0;Xj(Hd(a,j)|0,k,d);if((b[k+11>>0]|0)<0)Oq(f[k>>2]|0);d=ln(32)|0;f[k>>2]=d;f[k+8>>2]=-2147483616;f[k+4>>2]=19;l=d;m=14438;n=l+19|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[d+19>>0]=0;si(Hd(a,j)|0,k,g,e);if((b[k+11>>0]|0)<0)Oq(f[k>>2]|0);e=ln(32)|0;f[k>>2]=e;f[k+8>>2]=-2147483616;f[k+4>>2]=18;l=e;m=14458;n=l+18|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[e+18>>0]=0;Tj(Hd(a,j)|0,k,h);if((b[k+11>>0]|0)>=0){u=i;return}Oq(f[k>>2]|0);u=i;return}function Gg(a){a=a|0;tk(a);tk(a+32|0);tk(a+64|0);tk(a+96|0);tk(a+128|0);tk(a+160|0);tk(a+192|0);tk(a+224|0);tk(a+256|0);tk(a+288|0);tk(a+320|0);tk(a+352|0);tk(a+384|0);tk(a+416|0);tk(a+448|0);tk(a+480|0);tk(a+512|0);tk(a+544|0);tk(a+576|0);tk(a+608|0);tk(a+640|0);tk(a+672|0);tk(a+704|0);tk(a+736|0);tk(a+768|0);tk(a+800|0);tk(a+832|0);tk(a+864|0);tk(a+896|0);tk(a+928|0);tk(a+960|0);tk(a+992|0);tk(a+1024|0);return}function Hg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=u;u=u+16|0;d=c;if(b[a+288>>0]|0){u=c;return 1}e=a+8|0;g=f[e>>2]|0;h=(f[g+12>>2]|0)-(f[g+8>>2]|0)|0;g=h>>2;i=a+172|0;Gi(i,g+-1|0);if(!((g|0)!=1&(h|0)>0)){u=c;return 1}h=a+12|0;a=0;j=0;while(1){k=f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0;if(!(f[k+56>>2]|0))l=j;else{m=f[i>>2]|0;f[m+(j*136|0)>>2]=a;n=f[m+(j*136|0)+104>>2]|0;o=m+(j*136|0)+108|0;p=f[o>>2]|0;if((p|0)!=(n|0))f[o>>2]=p+(~((p+-4-n|0)>>>2)<<2);n=f[h>>2]|0;gk(m+(j*136|0)+104|0,(f[n+4>>2]|0)-(f[n>>2]|0)>>2);n=(f[i>>2]|0)+(j*136|0)+116|0;m=f[h>>2]|0;p=(f[m+4>>2]|0)-(f[m>>2]|0)>>2;f[d>>2]=-1;hg(n,p,d);p=f[i>>2]|0;f[p+(j*136|0)+128>>2]=0;Gc(p+(j*136|0)+4|0,f[e>>2]|0,f[h>>2]|0,k)|0;l=j+1|0}a=a+1|0;if((a|0)>=(g|0))break;else j=l}u=c;return 1}function Ig(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=c;e=b;g=d-e|0;h=g>>2;i=a+8|0;j=f[i>>2]|0;k=f[a>>2]|0;l=k;if(h>>>0<=j-k>>2>>>0){m=a+4|0;n=(f[m>>2]|0)-k>>2;o=h>>>0>n>>>0;p=o?b+(n<<2)|0:c;c=p;n=c-e|0;e=n>>2;if(e|0)im(k|0,b|0,n|0)|0;n=l+(e<<2)|0;if(o){o=d-c|0;if((o|0)<=0)return;kh(f[m>>2]|0,p|0,o|0)|0;f[m>>2]=(f[m>>2]|0)+(o>>>2<<2);return}else{o=f[m>>2]|0;if((o|0)==(n|0))return;f[m>>2]=o+(~((o+-4-n|0)>>>2)<<2);return}}n=k;if(!k)q=j;else{j=a+4|0;o=f[j>>2]|0;if((o|0)!=(l|0))f[j>>2]=o+(~((o+-4-k|0)>>>2)<<2);Oq(n);f[i>>2]=0;f[j>>2]=0;f[a>>2]=0;q=0}if(h>>>0>1073741823)aq(a);j=q>>1;n=q>>2>>>0<536870911?(j>>>0>>0?h:j):1073741823;if(n>>>0>1073741823)aq(a);j=ln(n<<2)|0;h=a+4|0;f[h>>2]=j;f[a>>2]=j;f[i>>2]=j+(n<<2);if((g|0)<=0)return;kh(j|0,b|0,g|0)|0;f[h>>2]=j+(g>>>2<<2);return}function Jg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0.0,p=0,q=0.0,r=0.0,s=0.0,t=0,v=0.0;e=u;u=u+16|0;g=e;h=c+1|0;f[g>>2]=0;i=g+4|0;f[i>>2]=0;f[g+8>>2]=0;do if(h)if(h>>>0>1073741823)aq(g);else{j=ln(h<<2)|0;f[g>>2]=j;k=j+(h<<2)|0;f[g+8>>2]=k;sj(j|0,0,(c<<2)+4|0)|0;f[i>>2]=k;l=j;m=k;n=j;break}else{l=0;m=0;n=0}while(0);if((b|0)>0){g=0;do{j=l+(f[a+(g<<2)>>2]<<2)|0;f[j>>2]=(f[j>>2]|0)+1;g=g+1|0}while((g|0)!=(b|0))}o=+(b|0);if((c|0)<0){p=0;q=0.0}else{c=0;r=0.0;b=0;while(1){g=f[l+(b<<2)>>2]|0;s=+(g|0);if((g|0)>0){t=c+1|0;v=r+ +Zg(s/o)*s}else{t=c;v=r}b=b+1|0;if((b|0)==(h|0)){p=t;q=v;break}else{c=t;r=v}}}if(d|0)f[d>>2]=p;v=-q;p=~~v>>>0;d=+K(v)>=1.0?(v>0.0?~~+Y(+J(v/4294967296.0),4294967295.0)>>>0:~~+W((v-+(~~v>>>0))/4294967296.0)>>>0):0;if(!l){I=d;u=e;return p|0}if((m|0)!=(l|0))f[i>>2]=m+(~((m+-4-l|0)>>>2)<<2);Oq(n);I=d;u=e;return p|0}function Kg(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e+4|0;h=e;i=ln(32)|0;f[a>>2]=i;f[a+4>>2]=c+4;c=a+8|0;b[c>>0]=0;f[i+16>>2]=f[d>>2];a=i+20|0;f[i+24>>2]=0;f[i+28>>2]=0;j=i+24|0;f[a>>2]=j;i=f[d+4>>2]|0;k=d+8|0;if((i|0)==(k|0)){b[c>>0]=1;u=e;return}d=j;j=i;while(1){i=j+16|0;f[h>>2]=d;f[g>>2]=f[h>>2];ph(a,g,i,i)|0;i=f[j+4>>2]|0;if(!i){l=j+8|0;m=f[l>>2]|0;if((f[m>>2]|0)==(j|0))n=m;else{m=l;do{l=f[m>>2]|0;m=l+8|0;o=f[m>>2]|0}while((f[o>>2]|0)!=(l|0));n=o}}else{m=i;while(1){o=f[m>>2]|0;if(!o)break;else m=o}n=m}if((n|0)==(k|0))break;else j=n}b[c>>0]=1;u=e;return}function Lg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;f[e>>2]=b;g=a+8|0;if(((f[a+12>>2]|0)-(f[g>>2]|0)>>2|0)<=(b|0))Bh(g,b+1|0);h=f[(f[c>>2]|0)+56>>2]|0;do if((h|0)<5){i=a+20+(h*12|0)+4|0;j=f[i>>2]|0;if((j|0)==(f[a+20+(h*12|0)+8>>2]|0)){Ri(a+20+(h*12|0)|0,e);break}else{f[j>>2]=b;f[i>>2]=j+4;break}}while(0);b=f[c>>2]|0;h=f[e>>2]|0;f[b+60>>2]=h;e=(f[g>>2]|0)+(h<<2)|0;f[c>>2]=0;c=f[e>>2]|0;f[e>>2]=b;if(!c){u=d;return}b=c+88|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0){b=f[e+8>>2]|0;if(b|0){h=e+12|0;if((f[h>>2]|0)!=(b|0))f[h>>2]=b;Oq(b)}Oq(e)}e=f[c+68>>2]|0;if(e|0){b=c+72|0;h=f[b>>2]|0;if((h|0)!=(e|0))f[b>>2]=h+(~((h+-4-e|0)>>>2)<<2);Oq(e)}e=c+64|0;h=f[e>>2]|0;f[e>>2]=0;if(h|0){e=f[h>>2]|0;if(e|0){b=h+4|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(h)}Oq(c);u=d;return}function Mg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+56>>2]|0)-(f[g+52>>2]|0)>>2);g=a+84|0;a=f[g>>2]|0;if(!a){h=f[(f[e>>2]|0)+64>>2]|0;i=(f[h+4>>2]|0)-(f[h>>2]|0)>>2;h=(i>>>0)/3|0;if(i>>>0<=2){u=b;return 1}i=0;do{f[d>>2]=i*3;f[c>>2]=f[d>>2];Zb(e,c);i=i+1|0}while((i|0)<(h|0));u=b;return 1}else{h=f[a>>2]|0;if((f[a+4>>2]|0)==(h|0)){u=b;return 1}a=0;i=h;do{f[d>>2]=f[i+(a<<2)>>2];f[c>>2]=f[d>>2];Zb(e,c);a=a+1|0;h=f[g>>2]|0;i=f[h>>2]|0}while(a>>>0<(f[h+4>>2]|0)-i>>2>>>0);u=b;return 1}return 0}function Ng(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0;d=u;u=u+48|0;e=d+16|0;g=d;h=d+32|0;i=a+28|0;j=f[i>>2]|0;f[h>>2]=j;k=a+20|0;l=(f[k>>2]|0)-j|0;f[h+4>>2]=l;f[h+8>>2]=b;f[h+12>>2]=c;b=l+c|0;l=a+60|0;f[g>>2]=f[l>>2];f[g+4>>2]=h;f[g+8>>2]=2;j=to(Aa(146,g|0)|0)|0;a:do if((b|0)!=(j|0)){g=2;m=b;n=h;o=j;while(1){if((o|0)<0)break;m=m-o|0;p=f[n+4>>2]|0;q=o>>>0>p>>>0;r=q?n+8|0:n;s=g+(q<<31>>31)|0;t=o-(q?p:0)|0;f[r>>2]=(f[r>>2]|0)+t;p=r+4|0;f[p>>2]=(f[p>>2]|0)-t;f[e>>2]=f[l>>2];f[e+4>>2]=r;f[e+8>>2]=s;o=to(Aa(146,e|0)|0)|0;if((m|0)==(o|0)){v=3;break a}else{g=s;n=r}}f[a+16>>2]=0;f[i>>2]=0;f[k>>2]=0;f[a>>2]=f[a>>2]|32;if((g|0)==2)w=0;else w=c-(f[n+4>>2]|0)|0}else v=3;while(0);if((v|0)==3){v=f[a+44>>2]|0;f[a+16>>2]=v+(f[a+48>>2]|0);a=v;f[i>>2]=a;f[k>>2]=a;w=c}u=d;return w|0}function Og(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=6192;b=f[a+68>>2]|0;if(b|0){c=a+72|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+56>>2]|0;if(b|0){d=a+60|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+44>>2]|0;if(b|0){c=a+48|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+32>>2]|0;if(b|0){d=a+36|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+20>>2]|0;if(b|0){c=a+24|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}hi(a+8|0);b=a+4|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;b=a+40|0;d=f[b>>2]|0;if(d|0){c=a+44|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[c>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0){bj(i);Oq(i)}h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}Oq(g)}bj(a);Oq(a);return}function Pg(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if(((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(f[(f[d>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)==0:0)?(j=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if(((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(f[(f[d>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0)==0:0)?(k=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if((((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(f[(f[d>>2]|0)+(a>>>5<<2)>>2]&1<<(a&31)|0)==0:0)?(h=f[(f[(f[d+64>>2]|0)+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function Qg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)aq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0)Va[f[(f[n>>2]|0)+4>>2]&127](n)}while((h|0)!=(g|0))}if(!m)return;Oq(m);return}function Rg(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=a+4|0;a=f[d>>2]|0;do if(a|0){e=b[c+11>>0]|0;g=e<<24>>24<0;h=g?f[c+4>>2]|0:e&255;e=g?f[c>>2]|0:c;g=d;i=a;a:while(1){j=i;while(1){k=j+16|0;l=b[k+11>>0]|0;m=l<<24>>24<0;n=m?f[j+20>>2]|0:l&255;l=h>>>0>>0?h:n;if((l|0)!=0?(o=Vk(m?f[k>>2]|0:k,e,l)|0,(o|0)!=0):0){if((o|0)>=0)break}else p=6;if((p|0)==6?(p=0,n>>>0>=h>>>0):0)break;n=f[j+4>>2]|0;if(!n){q=g;break a}else j=n}i=f[j>>2]|0;if(!i){q=j;break}else g=j}if((q|0)!=(d|0)){g=q+16|0;i=b[g+11>>0]|0;n=i<<24>>24<0;o=n?f[q+20>>2]|0:i&255;i=o>>>0>>0?o:h;if(i|0?(l=Vk(e,n?f[g>>2]|0:g,i)|0,l|0):0){if((l|0)<0)break;else r=q;return r|0}if(h>>>0>=o>>>0){r=q;return r|0}}}while(0);r=d;return r|0}function Sg(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=a+8|0;f[c>>2]=f[b>>2];fg(a+12|0,b+4|0)|0;d=a+44|0;e=b+36|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];if((c|0)==(b|0)){f[a+96>>2]=f[b+88>>2];return}else{ng(a+60|0,f[b+52>>2]|0,f[b+56>>2]|0);ng(a+72|0,f[b+64>>2]|0,f[b+68>>2]|0);ng(a+84|0,f[b+76>>2]|0,f[b+80>>2]|0);f[a+96>>2]=f[b+88>>2];Ig(a+100|0,f[b+92>>2]|0,f[b+96>>2]|0);return}}function Tg(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if(((e-h|0)/12|0)>>>0>=b>>>0){i=b;j=h;do{f[j>>2]=f[c>>2];f[j+4>>2]=f[c+4>>2];f[j+8>>2]=f[c+8>>2];j=(f[g>>2]|0)+12|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=(h-i|0)/12|0;h=j+b|0;if(h>>>0>357913941)aq(a);k=(e-i|0)/12|0;i=k<<1;e=k>>>0<178956970?(i>>>0>>0?h:i):357913941;do if(e)if(e>>>0>357913941){i=ra(8)|0;Oo(i,16035);f[i>>2]=7256;va(i|0,1112,110)}else{l=ln(e*12|0)|0;break}else l=0;while(0);i=l+(j*12|0)|0;j=l+(e*12|0)|0;e=b;b=i;l=i;do{f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];b=l+12|0;l=b;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;b=(f[g>>2]|0)-e|0;c=i+(((b|0)/-12|0)*12|0)|0;if((b|0)>0)kh(c|0,e|0,b|0)|0;f[a>>2]=c;f[g>>2]=l;f[d>>2]=j;if(!e)return;Oq(e);return}function Ug(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d>>2;g=e+1|0;if(g>>>0>1073741823)aq(a);h=a+8|0;i=(f[h>>2]|0)-d|0;d=i>>1;j=i>>2>>>0<536870911?(d>>>0>>0?g:d):1073741823;do if(j)if(j>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{k=ln(j<<2)|0;break}else k=0;while(0);d=k+(e<<2)|0;e=d;g=k+(j<<2)|0;j=f[b>>2]|0;f[b>>2]=0;f[d>>2]=j;j=d+4|0;b=f[a>>2]|0;k=f[c>>2]|0;if((k|0)==(b|0)){l=e;m=b;n=b}else{i=k;k=e;e=d;do{i=i+-4|0;d=f[i>>2]|0;f[i>>2]=0;f[e+-4>>2]=d;e=k+-4|0;k=e}while((i|0)!=(b|0));l=k;m=f[a>>2]|0;n=f[c>>2]|0}f[a>>2]=l;f[c>>2]=j;f[h>>2]=g;g=m;if((n|0)!=(g|0)){h=n;do{h=h+-4|0;n=f[h>>2]|0;f[h>>2]=0;if(n|0){bj(n);Oq(n)}}while((h|0)!=(g|0))}if(!m)return;Oq(m);return}function Vg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=f[b>>2]|0;g=f[a>>2]|0;h=f[d>>2]|0;d=f[h>>2]|0;i=(f[h+4>>2]|0)-d>>3;if(i>>>0<=e>>>0)aq(h);j=d;if(i>>>0<=g>>>0)aq(h);d=f[j+(e<<3)>>2]|0;k=f[c>>2]|0;if(i>>>0<=k>>>0)aq(h);l=j+(g<<3)|0;m=(f[j+(k<<3)>>2]|0)>>>0>>0;if(d>>>0<(f[l>>2]|0)>>>0){if(m){f[a>>2]=k;f[c>>2]=g;n=1;return n|0}f[a>>2]=e;f[b>>2]=g;d=f[c>>2]|0;if(i>>>0<=d>>>0)aq(h);if((f[j+(d<<3)>>2]|0)>>>0>=(f[l>>2]|0)>>>0){n=1;return n|0}f[b>>2]=d;f[c>>2]=g;n=2;return n|0}if(!m){n=0;return n|0}f[b>>2]=k;f[c>>2]=e;e=f[b>>2]|0;c=f[a>>2]|0;if(i>>>0<=e>>>0)aq(h);if(i>>>0<=c>>>0)aq(h);if((f[j+(e<<3)>>2]|0)>>>0>=(f[j+(c<<3)>>2]|0)>>>0){n=1;return n|0}f[a>>2]=e;f[b>>2]=c;n=2;return n|0}function Wg(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=u;u=u+16|0;c=b+4|0;d=b;e=a+8|0;g=f[e>>2]|0;gk(f[a+4>>2]|0,(f[g+28>>2]|0)-(f[g+24>>2]|0)>>2);g=a+84|0;a=f[g>>2]|0;if(!a){h=f[e>>2]|0;i=(f[h+4>>2]|0)-(f[h>>2]|0)>>2;h=(i>>>0)/3|0;if(i>>>0<=2){u=b;return 1}i=0;do{f[d>>2]=i*3;f[c>>2]=f[d>>2];dc(e,c);i=i+1|0}while((i|0)<(h|0));u=b;return 1}else{h=f[a>>2]|0;if((f[a+4>>2]|0)==(h|0)){u=b;return 1}a=0;i=h;do{f[d>>2]=f[i+(a<<2)>>2];f[c>>2]=f[d>>2];dc(e,c);a=a+1|0;h=f[g>>2]|0;i=f[h>>2]|0}while(a>>>0<(f[h+4>>2]|0)-i>>2>>>0);u=b;return 1}return 0}function Xg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a=u;u=u+16|0;e=a;if(!b){g=0;u=a;return g|0}h=b+96|0;i=b+100|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;b=f[i>>2]|0;j=f[h>>2]|0;k=(b-j|0)/12|0;l=j;j=b;if(k>>>0>=c>>>0){if(k>>>0>c>>>0?(b=l+(c*12|0)|0,(b|0)!=(j|0)):0)f[i>>2]=j+(~(((j+-12-b|0)>>>0)/12|0)*12|0);if(!c){g=1;u=a;return g|0}}else Tg(h,c-k|0,e);k=0;b=f[h>>2]|0;while(1){j=k*3|0;l=f[d+(j<<2)>>2]|0;m=f[d+(j+1<<2)>>2]|0;n=f[d+(j+2<<2)>>2]|0;j=((f[i>>2]|0)-b|0)/12|0;o=k;k=k+1|0;if(o>>>0>>0){p=b;q=b}else{f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;Tg(h,k-j|0,e);j=f[h>>2]|0;p=j;q=j}f[p+(o*12|0)>>2]=l;f[p+(o*12|0)+4>>2]=m;f[p+(o*12|0)+8>>2]=n;if((k|0)==(c|0)){g=1;break}else b=q}u=a;return g|0}function Yg(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=u;u=u+80|0;g=e+36|0;h=e;ao(g,c);Ke(h,b,c);Ph(g,h);Ej(h+24|0,f[h+28>>2]|0);Oj(h+12|0,f[h+16>>2]|0);Ej(h,f[h+4>>2]|0);cj(a,g,d);Ej(g+24|0,f[g+28>>2]|0);Oj(g+12|0,f[g+16>>2]|0);Ej(g,f[g+4>>2]|0);u=e;return}function Zg(a){a=+a;var b=0,c=0,d=0,e=0.0,g=0,h=0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0.0,q=0.0,r=0.0,t=0.0;p[s>>3]=a;b=f[s>>2]|0;c=f[s+4>>2]|0;d=(c|0)<0;do if(d|c>>>0<1048576){if((b|0)==0&(c&2147483647|0)==0){e=-1.0/(a*a);break}if(d){e=(a-a)/0.0;break}else{p[s>>3]=a*18014398509481984.0;g=f[s+4>>2]|0;h=-1077;i=g;j=f[s>>2]|0;k=g;l=9;break}}else if(c>>>0<=2146435071)if((b|0)==0&0==0&(c|0)==1072693248)e=0.0;else{h=-1023;i=c;j=b;k=c;l=9}else e=a;while(0);if((l|0)==9){l=i+614242|0;f[s>>2]=j;f[s+4>>2]=(l&1048575)+1072079006;a=+p[s>>3]+-1.0;m=a*a*.5;n=a/(a+2.0);o=n*n;q=o*o;p[s>>3]=a-m;j=f[s+4>>2]|0;f[s>>2]=0;f[s+4>>2]=j;r=+p[s>>3];t=a-r-m+n*(m+(q*(q*(q*.15313837699209373+.22222198432149784)+.3999999999940942)+o*(q*(q*(q*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));q=r*1.4426950407214463;o=+(h+(l>>>20)|0);m=q+o;e=m+(q+(o-m)+(t*1.4426950407214463+(t+r)*1.6751713164886512e-10))}return +e}function _g(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;d=u;u=u+16|0;e=d;g=ln(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=17;h=g;i=14390;j=h+17|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+17>>0]=0;g=c+16|0;i=f[g>>2]|0;if(i){h=g;j=i;a:while(1){i=j;while(1){if((f[i+16>>2]|0)>=(a|0))break;k=f[i+4>>2]|0;if(!k){l=h;break a}else i=k}j=f[i>>2]|0;if(!j){l=i;break}else h=i}if(((l|0)!=(g|0)?(f[l+16>>2]|0)<=(a|0):0)?(a=l+20|0,(Jh(a,e)|0)!=0):0)m=a;else n=10}else n=10;if((n|0)==10)m=c;c=Hk(m,e,-1)|0;if((b[e+11>>0]|0)>=0){o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}Oq(f[e>>2]|0);o=(c|0)==-1;p=c>>>0>6;q=p?-2:c;r=o?-1:q;u=d;return r|0}function $g(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[c>>2]|0;f[c>>2]=0;f[e>>2]=g;Lg(a,b,e);g=f[e>>2]|0;f[e>>2]=0;if(g|0){e=g+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){h=c+12|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(c)}c=f[g+68>>2]|0;if(c|0){e=g+72|0;h=f[e>>2]|0;if((h|0)!=(c|0))f[e>>2]=h+(~((h+-4-c|0)>>>2)<<2);Oq(c)}c=g+64|0;h=f[c>>2]|0;f[c>>2]=0;if(h|0){c=f[h>>2]|0;if(c|0){e=h+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(h)}Oq(g)}g=a+84|0;h=a+88|0;a=f[h>>2]|0;c=f[g>>2]|0;e=a-c>>2;if((e|0)>(b|0)){u=d;return}i=b+1|0;b=a;if(i>>>0>e>>>0){Fh(g,i-e|0);u=d;return}if(i>>>0>=e>>>0){u=d;return}e=c+(i<<2)|0;if((e|0)==(b|0)){u=d;return}f[h>>2]=b+(~((b+-4-e|0)>>>2)<<2);u=d;return}function ah(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+52>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Jh(h,e)|0)==0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(mi(h)|0)>5&1;b[a+352>>0]=c;u=d;return 1}c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Yj(h,e,0)|0)&1;b[a+352>>0]=c;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);u=d;return 1}function bh(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0;c=a+108|0;d=(f[a+112>>2]|0)-(f[c>>2]|0)|0;e=(d|0)/12|0;g=a+4|0;ci(e,f[(f[g>>2]|0)+44>>2]|0)|0;if(!d)return 1;d=0;a=0;while(1){i=f[c>>2]|0;j=i+(d*12|0)+4|0;ci((f[j>>2]|0)-a|0,f[(f[g>>2]|0)+44>>2]|0)|0;ci((f[j>>2]|0)-(f[i+(d*12|0)>>2]|0)|0,f[(f[g>>2]|0)+44>>2]|0)|0;d=d+1|0;if(d>>>0>=e>>>0)break;else a=f[j>>2]|0}zi(f[(f[g>>2]|0)+44>>2]|0,e,0,0)|0;a=0;do{d=f[(f[g>>2]|0)+44>>2]|0;j=d+16|0;i=f[j+4>>2]|0;if((i|0)>0|(i|0)==0&(f[j>>2]|0)>>>0>0){j=f[d+12>>2]|0;d=j+4|0;i=f[d>>2]|0;k=b[(f[c>>2]|0)+(a*12|0)+8>>0]&1;l=i>>>3;m=i&7;i=(f[j>>2]|0)+l|0;b[i>>0]=(1<>0]|0);i=(f[j>>2]|0)+l|0;b[i>>0]=k<>0]|0);f[d>>2]=(f[d>>2]|0)+1}a=a+1|0}while(a>>>0>>0);eg(f[(f[g>>2]|0)+44>>2]|0);return 1}function ch(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=u;u=u+80|0;g=e+36|0;h=e;io(g,c);Ke(h,b,c);Ph(g,h);Ej(h+24|0,f[h+28>>2]|0);Oj(h+12|0,f[h+16>>2]|0);Ej(h,f[h+4>>2]|0);cj(a,g,d);Ej(g+24|0,f[g+28>>2]|0);Oj(g+12|0,f[g+16>>2]|0);Ej(g,f[g+4>>2]|0);u=e;return}function dh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;g=a+4|0;f[g>>2]=c;f[a+8>>2]=f[c+52>>2];h=f[a+184>>2]|0;i=a+188|0;j=f[i>>2]|0;if((j|0)!=(h|0))f[i>>2]=j+(~((j+-4-h|0)>>>2)<<2);h=f[c+48>>2]|0;c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Jh(h,e)|0)==0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);h=f[(f[g>>2]|0)+48>>2]|0;if(c){c=(mi(h)|0)>5&1;b[a+288>>0]=c;u=d;return 1}c=ln(32)|0;f[e>>2]=c;f[e+8>>2]=-2147483616;f[e+4>>2]=19;j=c;i=15351;k=j+19|0;do{b[j>>0]=b[i>>0]|0;j=j+1|0;i=i+1|0}while((j|0)<(k|0));b[c+19>>0]=0;c=(Yj(h,e,0)|0)&1;b[a+288>>0]=c;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);u=d;return 1}function eh(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;g=u;u=u+32|0;h=g+16|0;i=g+8|0;j=g;k=d-e|0;d=a+8|0;if((k|0)>0){a=0-e|0;l=i+4|0;m=j+4|0;n=h+4|0;o=k;do{k=b+(o<<2)|0;p=k+(a<<2)|0;q=c+(o<<2)|0;r=f[k+4>>2]|0;s=f[p>>2]|0;t=f[p+4>>2]|0;f[i>>2]=f[k>>2];f[l>>2]=r;f[j>>2]=s;f[m>>2]=t;Od(h,d,i,j);f[q>>2]=f[h>>2];f[q+4>>2]=f[n>>2];o=o-e|0}while((o|0)>0)}o=e>>>0>1073741823?-1:e<<2;e=Lq(o)|0;sj(e|0,0,o|0)|0;o=f[b+4>>2]|0;n=f[e>>2]|0;m=f[e+4>>2]|0;f[i>>2]=f[b>>2];f[i+4>>2]=o;f[j>>2]=n;f[j+4>>2]=m;Od(h,d,i,j);f[c>>2]=f[h>>2];f[c+4>>2]=f[h+4>>2];Mq(e);u=g;return 1}function fh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+32|0;d=c+12|0;e=c;g=f[b+100>>2]|0;h=f[b+96>>2]|0;b=g-h|0;i=(b|0)/12|0;f[d>>2]=0;j=d+4|0;f[j>>2]=0;f[d+8>>2]=0;k=h;do if(b)if(i>>>0>357913941)aq(d);else{l=ln(b)|0;f[d>>2]=l;f[d+8>>2]=l+(i*12|0);sj(l|0,0,b|0)|0;f[j>>2]=l+b;m=l;break}else m=0;while(0);f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;if((g|0)!=(h|0)){h=e+4|0;g=e+8|0;b=0;do{l=k+(b*12|0)|0;f[e>>2]=f[l>>2];f[e+4>>2]=f[l+4>>2];f[e+8>>2]=f[l+8>>2];f[m+(b*12|0)>>2]=f[e>>2];f[m+(b*12|0)+4>>2]=f[h>>2];f[m+(b*12|0)+8>>2]=f[g>>2];b=b+1|0}while(b>>>0>>0)}Kj(a,d);a=f[d>>2]|0;if(!a){u=c;return}d=f[j>>2]|0;if((d|0)!=(a|0))f[j>>2]=d+(~(((d+-12-a|0)>>>0)/12|0)*12|0);Oq(a);u=c;return}function gh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;if(c>>>0>4294967279)aq(a);d=a+11|0;e=b[d>>0]|0;g=e<<24>>24<0;if(g){h=f[a+4>>2]|0;i=(f[a+8>>2]&2147483647)+-1|0}else{h=e&255;i=10}j=h>>>0>c>>>0?h:c;c=j>>>0<11;k=c?10:(j+16&-16)+-1|0;do if((k|0)!=(i|0)){do if(c){j=f[a>>2]|0;if(g){l=0;m=j;n=a;o=13}else{Fo(a,j,(e&255)+1|0)|0;Oq(j);o=16}}else{j=k+1|0;p=ln(j)|0;if(g){l=1;m=f[a>>2]|0;n=p;o=13;break}else{Fo(p,a,(e&255)+1|0)|0;q=p;r=j;s=a+4|0;o=15;break}}while(0);if((o|0)==13){j=a+4|0;Fo(n,m,(f[j>>2]|0)+1|0)|0;Oq(m);if(l){q=n;r=k+1|0;s=j;o=15}else o=16}if((o|0)==15){f[a+8>>2]=r|-2147483648;f[s>>2]=h;f[a>>2]=q;break}else if((o|0)==16){b[d>>0]=h;break}}while(0);return}function hh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=f[b>>2]|0;if((c|0)==-1){d=-1;return d|0}b=f[(f[a+24>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1){d=0;return d|0}c=a+12|0;a=0;e=0;g=b;a:while(1){b:do if(e){h=a+1|0;i=(((g>>>0)%3|0|0)==0?2:-1)+g|0;if((i|0)==-1){d=h;j=15;break a}k=f[(f[c>>2]|0)+(i<<2)>>2]|0;if((k|0)==-1){d=h;j=15;break a}if(!((k>>>0)%3|0)){l=k+2|0;m=h;break}else{l=k+-1|0;m=h;break}}else{h=a;k=g;while(1){i=h+1|0;n=k+1|0;o=((n>>>0)%3|0|0)==0?k+-2|0:n;if((o|0)==-1){l=b;m=i;break b}n=f[(f[c>>2]|0)+(o<<2)>>2]|0;o=n+1|0;if((n|0)==-1){l=b;m=i;break b}k=((o>>>0)%3|0|0)==0?n+-2|0:o;if((k|0)==-1){l=b;m=i;break b}if((k|0)==(b|0)){d=i;j=15;break a}else h=i}}while(0);if((l|0)==-1){d=m;j=15;break}else{a=m;e=1;g=l}}if((j|0)==15)return d|0;return 0}function ih(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=a+8|0;Vg(a,a+4|0,d,c)|0;e=a+12|0;if((e|0)==(b|0))return;g=f[c>>2]|0;c=f[g>>2]|0;h=(f[g+4>>2]|0)-c>>3;i=c;c=e;e=d;a:while(1){d=f[c>>2]|0;j=f[e>>2]|0;if(h>>>0<=d>>>0){k=5;break}if(h>>>0<=j>>>0){k=7;break}l=i+(d<<3)|0;if((f[l>>2]|0)>>>0<(f[i+(j<<3)>>2]|0)>>>0){m=e;n=c;o=j;while(1){f[n>>2]=o;if((m|0)==(a|0)){p=a;break}j=m+-4|0;o=f[j>>2]|0;if(h>>>0<=o>>>0){k=11;break a}if((f[l>>2]|0)>>>0>=(f[i+(o<<3)>>2]|0)>>>0){p=m;break}else{q=m;m=j;n=q}}f[p>>2]=d}n=c+4|0;if((n|0)==(b|0)){k=3;break}else{m=c;c=n;e=m}}if((k|0)==3)return;else if((k|0)==5)aq(g);else if((k|0)==7)aq(g);else if((k|0)==11)aq(g)}function jh(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=Vg(a,b,c,e)|0;h=f[d>>2]|0;i=f[c>>2]|0;j=f[e>>2]|0;e=f[j>>2]|0;k=(f[j+4>>2]|0)-e>>3;if(k>>>0<=h>>>0)aq(j);l=e;if(k>>>0<=i>>>0)aq(j);if((f[l+(h<<3)>>2]|0)>>>0>=(f[l+(i<<3)>>2]|0)>>>0){m=g;return m|0}f[c>>2]=h;f[d>>2]=i;i=f[c>>2]|0;d=f[b>>2]|0;if(k>>>0<=i>>>0)aq(j);if(k>>>0<=d>>>0)aq(j);if((f[l+(i<<3)>>2]|0)>>>0>=(f[l+(d<<3)>>2]|0)>>>0){m=g+1|0;return m|0}f[b>>2]=i;f[c>>2]=d;d=f[b>>2]|0;c=f[a>>2]|0;if(k>>>0<=d>>>0)aq(j);if(k>>>0<=c>>>0)aq(j);if((f[l+(d<<3)>>2]|0)>>>0>=(f[l+(c<<3)>>2]|0)>>>0){m=g+2|0;return m|0}f[a>>2]=d;f[b>>2]=c;m=g+3|0;return m|0}function kh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;if((d|0)>=8192)return Da(a|0,c|0,d|0)|0;e=a|0;g=a+d|0;if((a&3)==(c&3)){while(a&3){if(!d)return e|0;b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0;d=d-1|0}h=g&-4|0;d=h-64|0;while((a|0)<=(d|0)){f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];f[a+12>>2]=f[c+12>>2];f[a+16>>2]=f[c+16>>2];f[a+20>>2]=f[c+20>>2];f[a+24>>2]=f[c+24>>2];f[a+28>>2]=f[c+28>>2];f[a+32>>2]=f[c+32>>2];f[a+36>>2]=f[c+36>>2];f[a+40>>2]=f[c+40>>2];f[a+44>>2]=f[c+44>>2];f[a+48>>2]=f[c+48>>2];f[a+52>>2]=f[c+52>>2];f[a+56>>2]=f[c+56>>2];f[a+60>>2]=f[c+60>>2];a=a+64|0;c=c+64|0}while((a|0)<(h|0)){f[a>>2]=f[c>>2];a=a+4|0;c=c+4|0}}else{h=g-4|0;while((a|0)<(h|0)){b[a>>0]=b[c>>0]|0;b[a+1>>0]=b[c+1>>0]|0;b[a+2>>0]=b[c+2>>0]|0;b[a+3>>0]=b[c+3>>0]|0;a=a+4|0;c=c+4|0}}while((a|0)<(g|0)){b[a>>0]=b[c>>0]|0;a=a+1|0;c=c+1|0}return e|0}function lh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+16|0;d=c+4|0;e=c;f[a>>2]=1232;g=a+4|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;f[g+16>>2]=0;f[g+20>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;f[d>>2]=b;b=a+4|0;g=a+8|0;Ri(b,d);h=f[d>>2]|0;i=a+20|0;j=f[i>>2]|0;k=a+16|0;a=f[k>>2]|0;l=j-a>>2;m=a;if((h|0)<(l|0)){n=m;o=h;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}a=h+1|0;f[e>>2]=-1;w=j;if(a>>>0<=l>>>0)if(a>>>0>>0?(j=m+(a<<2)|0,(j|0)!=(w|0)):0){f[i>>2]=w+(~((w+-4-j|0)>>>2)<<2);x=h;y=m}else{x=h;y=m}else{Ch(k,a-l|0,e);x=f[d>>2]|0;y=f[k>>2]|0}n=y;o=x;p=f[g>>2]|0;q=f[b>>2]|0;r=p-q|0;s=r>>2;t=s+-1|0;v=n+(o<<2)|0;f[v>>2]=t;u=c;return}function mh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+4|0;c=f[b>>2]|0;d=(f[c+12>>2]|0)-(f[c+8>>2]|0)|0;c=d>>2;a:do if((d|0)>0){e=0;while(1){if(!(Ra[f[(f[a>>2]|0)+36>>2]&127](a,e)|0)){g=0;break}e=e+1|0;h=f[b>>2]|0;i=(f[h+12>>2]|0)-(f[h+8>>2]|0)>>2;if((e|0)>=(i|0)){j=i;break a}}return g|0}else j=c;while(0);c=a+20|0;b=a+24|0;d=f[b>>2]|0;e=f[c>>2]|0;i=d-e>>2;h=e;e=d;if(j>>>0<=i>>>0){if(j>>>0>>0?(d=h+(j<<2)|0,(d|0)!=(e|0)):0)f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2)}else Ci(c,j-i|0);i=f[a+12>>2]|0;j=f[a+8>>2]|0;a=j;if((i|0)==(j|0)){g=1;return g|0}d=i-j>>2;j=0;do{i=f[a+(j<<2)>>2]|0;e=f[i+8>>2]|0;b=f[i+4>>2]|0;i=b;if((e|0)!=(b|0)?(h=f[c>>2]|0,k=e-b>>2,f[h+(f[i>>2]<<2)>>2]=j,k>>>0>1):0){b=1;do{f[h+(f[i+(b<<2)>>2]<<2)>>2]=j;b=b+1|0}while(b>>>0>>0)}j=j+1|0}while(j>>>0>>0);g=1;return g|0}function nh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;d=f[c+88>>2]|0;if(!d){e=0;return e|0}if((f[d>>2]|0)!=1){e=0;return e|0}g=d+8|0;d=f[g>>2]|0;f[a+4>>2]=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;i=a+8|0;j=c+24|0;c=b[j>>0]|0;k=c<<24>>24;l=a+12|0;m=f[l>>2]|0;n=f[i>>2]|0;o=m-n>>2;p=n;n=m;if(o>>>0>=k>>>0)if(o>>>0>k>>>0?(m=p+(k<<2)|0,(m|0)!=(n|0)):0){f[l>>2]=n+(~((n+-4-m|0)>>>2)<<2);q=c;r=d}else{q=c;r=d}else{Ci(i,k-o|0);q=b[j>>0]|0;r=f[g>>2]|0}g=r+4|0;j=h[g>>0]|h[g+1>>0]<<8|h[g+2>>0]<<16|h[g+3>>0]<<24;if(q<<24>>24>0){g=f[i>>2]|0;i=q<<24>>24;q=j;o=4;k=0;while(1){f[g+(k<<2)>>2]=q;o=o+4|0;k=k+1|0;d=r+o|0;c=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;if((k|0)>=(i|0)){s=c;break}else q=c}}else s=j;f[a+20>>2]=s;e=1;return e|0}function oh(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;do if(!(fp(a,f[c+8>>2]|0,g)|0)){if(!(fp(a,f[c>>2]|0,g)|0)){h=f[a+8>>2]|0;Za[f[(f[h>>2]|0)+24>>2]&3](h,c,d,e,g);break}if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;i=c+44|0;if((f[i>>2]|0)==4)break;j=c+52|0;b[j>>0]=0;k=c+53|0;b[k>>0]=0;l=f[a+8>>2]|0;_a[f[(f[l>>2]|0)+20>>2]&3](l,c,d,d,1,g);if(b[k>>0]|0)if(!(b[j>>0]|0)){m=3;n=11}else o=3;else{m=4;n=11}if((n|0)==11){f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0){b[c+54>>0]=1;o=m}else o=m}f[i>>2]=o;break}if((e|0)==1)f[c+32>>2]=1}else Vm(0,c,d,e);while(0);return}function ph(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e+12|0;h=e+8|0;i=e;f[i>>2]=f[b>>2];f[g>>2]=f[i>>2];i=Kd(a,g,h,e+4|0,c)|0;c=f[i>>2]|0;if(c|0){j=c;u=e;return j|0}c=ln(40)|0;pj(c+16|0,d);pj(c+28|0,d+12|0);d=f[h>>2]|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=d;f[i>>2]=c;d=f[f[a>>2]>>2]|0;if(!d)k=c;else{f[a>>2]=d;k=f[i>>2]|0}Oe(f[a+4>>2]|0,k);k=a+8|0;f[k>>2]=(f[k>>2]|0)+1;j=c;u=e;return j|0}function qh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=a+4|0;f[h>>2]=0;if(!c){u=e;return}i=a+8|0;j=f[i>>2]|0;k=j<<5;if(k>>>0>>0){f[g>>2]=0;l=g+4|0;f[l>>2]=0;m=g+8|0;f[m>>2]=0;if((c|0)<0)aq(a);n=j<<6;j=c+31&-32;vi(g,k>>>0<1073741823?(n>>>0>>0?j:n):2147483647);n=f[a>>2]|0;f[a>>2]=f[g>>2];f[g>>2]=n;g=f[h>>2]|0;f[h>>2]=c;f[l>>2]=g;g=f[i>>2]|0;f[i>>2]=f[m>>2];f[m>>2]=g;if(n|0)Oq(n);o=a}else{f[h>>2]=c;o=a}a=f[o>>2]|0;o=a;h=a;a=c>>>5;n=a<<2;if(!(b[d>>0]|0)){sj(h|0,0,n|0)|0;d=c&31;g=o+(a<<2)|0;if(!d){u=e;return}f[g>>2]=f[g>>2]&~(-1>>>(32-d|0));u=e;return}else{sj(h|0,-1,n|0)|0;n=c&31;c=o+(a<<2)|0;if(!n){u=e;return}f[c>>2]=f[c>>2]|-1>>>(32-n|0);u=e;return}}function rh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+88|0;ld(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;n=a+88|0;ld(n,b);u=c;return 1}function sh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){n=a+108|0;ld(n,b);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;n=a+108|0;ld(n,b);u=c;return 1}function th(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;c=a+32|0;d=f[a+64>>2]|0;e=(Qa[f[(f[d>>2]|0)+40>>2]&127](d)|0)+52|0;d=f[e>>2]|0;zi(c,(((f[d+100>>2]|0)-(f[d+96>>2]|0)|0)/12|0)*3|0,0,1)|0;d=a+68|0;e=f[d>>2]|0;g=(f[a+72>>2]|0)-e|0;if((g|0)<=0){eg(c);return}i=a+48|0;j=a+44|0;a=(g>>>2)+-1|0;g=e;while(1){e=f[g+(a<<2)>>2]|0;k=f[3524+(e<<2)>>2]|0;l=i;m=f[l+4>>2]|0;if((m|0)>0|(m|0)==0&(f[l>>2]|0)>>>0>0?(l=f[j>>2]|0,171>>>e&1|0):0){m=l+4|0;n=0;o=f[m>>2]|0;do{p=o>>>3;q=o&7;r=(f[l>>2]|0)+p|0;b[r>>0]=(1<>0]|0);r=(f[l>>2]|0)+p|0;b[r>>0]=(e>>>n&1)<>0]|0);o=(f[m>>2]|0)+1|0;f[m>>2]=o;n=n+1|0}while((n|0)!=(k|0))}k=a+-1|0;if((k|0)<=-1)break;a=k;g=f[d>>2]|0}eg(c);return}function uh(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;g=u;u=u+48|0;h=g;i=g+32|0;if(!c){j=0;u=g;return j|0}Gn(h);do if((dm(c,0)|0)!=-1){if(d){if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){k=0;break}Va[f[(f[c>>2]|0)+20>>2]&127](c)}Yg(i,a,c,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>>>0){h=b;i=g;do{j=i;f[j>>2]=0;f[j+4>>2]=0;i=(f[e>>2]|0)+8|0;f[e>>2]=i;h=h+-1|0}while((h|0)!=0);return}h=f[a>>2]|0;i=g-h>>3;g=i+b|0;if(g>>>0>536870911)aq(a);j=d-h|0;h=j>>2;d=j>>3>>>0<268435455?(h>>>0>>0?g:h):536870911;do if(d)if(d>>>0>536870911){h=ra(8)|0;Oo(h,16035);f[h>>2]=7256;va(h|0,1112,110)}else{k=ln(d<<3)|0;break}else k=0;while(0);h=k+(i<<3)|0;i=k+(d<<3)|0;d=b;b=h;k=h;do{g=b;f[g>>2]=0;f[g+4>>2]=0;b=k+8|0;k=b;d=d+-1|0}while((d|0)!=0);d=f[a>>2]|0;b=(f[e>>2]|0)-d|0;g=h+(0-(b>>3)<<3)|0;if((b|0)>0)kh(g|0,d|0,b|0)|0;f[a>>2]=g;f[e>>2]=k;f[c>>2]=i;if(!d)return;Oq(d);return}function xh(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;if(!(bn(a,b,c)|0)){g=0;u=d;return g|0}if((Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0)<<24>>24==1?((f[(f[a+8>>2]|0)+28>>2]|0)+-1|0)>>>0>=6:0){g=0;u=d;return g|0}h=_g(c,f[b+48>>2]|0)|0;Xa[f[(f[a>>2]|0)+48>>2]&15](e,a,h);h=a+36|0;b=f[e>>2]|0;f[e>>2]=0;c=f[h>>2]|0;f[h>>2]=b;if(!c){f[e>>2]=0;i=b}else{Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[e>>2]|0;f[e>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);i=f[h>>2]|0}if(!i){g=1;u=d;return g|0}if(Ra[f[(f[a>>2]|0)+36>>2]&127](a,i)|0){g=1;u=d;return g|0}i=f[h>>2]|0;f[h>>2]=0;if(!i){g=1;u=d;return g|0}Va[f[(f[i>>2]|0)+4>>2]&127](i);g=1;u=d;return g|0}function yh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+8|0;j=a&255;b[i>>0]=j&127;do if(c>>>0>0|(c|0)==0&a>>>0>127){b[i>>0]=j|-128;k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0;k=Yn(a|0,c|0,7)|0;m=yh(k,I,d)|0;break}}else{k=d+16|0;l=f[k+4>>2]|0;if((l|0)>0|(l|0)==0&(f[k>>2]|0)>>>0>0){m=0;break}f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0;n=1;u=e;return n|0}while(0);n=m;u=e;return n|0}function zh(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0;g=f[(f[(f[d+4>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;if((b|0)==-1)h=Xi(c,d)|0;else h=b;if((h|0)==-2)i=0;else{do if((Qa[f[(f[d>>2]|0)+8>>2]&127](d)|0)==1){Xf(a,d,h,c,e,514);if(!(f[a>>2]|0)){f[a>>2]=0;break}else return}while(0);c=ln(44)|0;f[c>>2]=1544;f[c+4>>2]=g;g=c+8|0;f[g>>2]=f[e>>2];f[g+4>>2]=f[e+4>>2];f[g+8>>2]=f[e+8>>2];f[g+12>>2]=f[e+12>>2];f[g+16>>2]=f[e+16>>2];f[g+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);f[c>>2]=1600;i=c}f[a>>2]=i;return}function Ah(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=u;u=u+224|0;g=e+120|0;h=e+80|0;i=e;j=e+136|0;k=h;l=k+40|0;do{f[k>>2]=0;k=k+4|0}while((k|0)<(l|0));f[g>>2]=f[d>>2];if((qb(0,c,g,i,h)|0)<0)m=-1;else{if((f[a+76>>2]|0)>-1)n=Tq(a)|0;else n=0;d=f[a>>2]|0;k=d&32;if((b[a+74>>0]|0)<1)f[a>>2]=d&-33;d=a+48|0;if(!(f[d>>2]|0)){l=a+44|0;o=f[l>>2]|0;f[l>>2]=j;p=a+28|0;f[p>>2]=j;q=a+20|0;f[q>>2]=j;f[d>>2]=80;r=a+16|0;f[r>>2]=j+80;j=qb(a,c,g,i,h)|0;if(!o)s=j;else{Sa[f[a+36>>2]&31](a,0,0)|0;t=(f[q>>2]|0)==0?-1:j;f[l>>2]=o;f[d>>2]=0;f[r>>2]=0;f[p>>2]=0;f[q>>2]=0;s=t}}else s=qb(a,c,g,i,h)|0;h=f[a>>2]|0;f[a>>2]=h|k;if(n|0)Sq(a);m=(h&32|0)==0?s:-1}u=e;return m|0}function Bh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e>>2;h=d;if(g>>>0>>0){uf(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b<<2)|0;if((g|0)==(h|0))return;else i=h;do{h=i+-4|0;f[c>>2]=h;b=f[h>>2]|0;f[h>>2]=0;if(b|0){h=b+88|0;e=f[h>>2]|0;f[h>>2]=0;if(e|0){h=f[e+8>>2]|0;if(h|0){a=e+12|0;if((f[a>>2]|0)!=(h|0))f[a>>2]=h;Oq(h)}Oq(e)}e=f[b+68>>2]|0;if(e|0){h=b+72|0;a=f[h>>2]|0;if((a|0)!=(e|0))f[h>>2]=a+(~((a+-4-e|0)>>>2)<<2);Oq(e)}e=b+64|0;a=f[e>>2]|0;f[e>>2]=0;if(a|0){e=f[a>>2]|0;if(e|0){h=a+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(a)}Oq(b)}i=f[c>>2]|0}while((i|0)!=(g|0));return}function Ch(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;i=h;if(e-h>>2>>>0>=b>>>0){j=b;k=i;while(1){f[k>>2]=f[c>>2];j=j+-1|0;if(!j)break;else k=k+4|0}f[g>>2]=i+(b<<2);return}i=f[a>>2]|0;k=h-i|0;h=k>>2;j=h+b|0;if(j>>>0>1073741823)aq(a);l=e-i|0;e=l>>1;m=l>>2>>>0<536870911?(e>>>0>>0?j:e):1073741823;do if(m)if(m>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}else{e=ln(m<<2)|0;n=e;o=e;break}else{n=0;o=0}while(0);e=n+(h<<2)|0;h=n+(m<<2)|0;m=b;j=e;while(1){f[j>>2]=f[c>>2];m=m+-1|0;if(!m)break;else j=j+4|0}if((k|0)>0)kh(o|0,i|0,k|0)|0;f[a>>2]=n;f[g>>2]=e+(b<<2);f[d>>2]=h;if(!i)return;Oq(i);return}function Dh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;e=(f[a>>2]|0)+1794895138|0;g=gp(f[a+8>>2]|0,e)|0;h=gp(f[a+12>>2]|0,e)|0;i=gp(f[a+16>>2]|0,e)|0;a:do if((g>>>0>>2>>>0?(j=c-(g<<2)|0,h>>>0>>0&i>>>0>>0):0)?((i|h)&3|0)==0:0){j=h>>>2;k=i>>>2;l=0;m=g;while(1){n=m>>>1;o=l+n|0;p=o<<1;q=p+j|0;r=gp(f[a+(q<<2)>>2]|0,e)|0;s=gp(f[a+(q+1<<2)>>2]|0,e)|0;if(!(s>>>0>>0&r>>>0<(c-s|0)>>>0)){t=0;break a}if(b[a+(s+r)>>0]|0){t=0;break a}r=hl(d,a+s|0)|0;if(!r)break;s=(r|0)<0;if((m|0)==1){t=0;break a}else{l=s?l:o;m=s?n:m-n|0}}m=p+k|0;l=gp(f[a+(m<<2)>>2]|0,e)|0;j=gp(f[a+(m+1<<2)>>2]|0,e)|0;if(j>>>0>>0&l>>>0<(c-j|0)>>>0)t=(b[a+(j+l)>>0]|0)==0?a+j|0:0;else t=0}else t=0;while(0);return t|0}function Eh(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;h=u;u=u+64|0;i=h;j=f[a>>2]|0;k=a+(f[j+-8>>2]|0)|0;l=f[j+-4>>2]|0;f[i>>2]=e;f[i+4>>2]=a;f[i+8>>2]=c;f[i+12>>2]=g;g=i+16|0;c=i+20|0;a=i+24|0;j=i+28|0;m=i+32|0;n=i+40|0;o=g;p=o+36|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(p|0));d[g+36>>1]=0;b[g+38>>0]=0;a:do if(fp(l,e,0)|0){f[i+48>>2]=1;_a[f[(f[l>>2]|0)+20>>2]&3](l,i,k,k,1,0);q=(f[a>>2]|0)==1?k:0}else{Za[f[(f[l>>2]|0)+24>>2]&3](l,i,k,1,0);switch(f[i+36>>2]|0){case 0:{q=(f[n>>2]|0)==1&(f[j>>2]|0)==1&(f[m>>2]|0)==1?f[c>>2]|0:0;break a;break}case 1:break;default:{q=0;break a}}if((f[a>>2]|0)!=1?!((f[n>>2]|0)==0&(f[j>>2]|0)==1&(f[m>>2]|0)==1):0){q=0;break}q=f[g>>2]|0}while(0);u=h;return q|0}function Fh(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;h=g;if(d-g>>2>>>0>=b>>>0){i=b;j=h;while(1){f[j>>2]=1;i=i+-1|0;if(!i)break;else j=j+4|0}f[e>>2]=h+(b<<2);return}h=f[a>>2]|0;j=g-h|0;g=j>>2;i=g+b|0;if(i>>>0>1073741823)aq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?i:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{d=ln(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;g=m+(l<<2)|0;l=b;i=d;while(1){f[i>>2]=1;l=l+-1|0;if(!l)break;else i=i+4|0}if((j|0)>0)kh(n|0,h|0,j|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=g;if(!h)return;Oq(h);return}function Gh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(!c){g=0;u=d;return g|0}h=a+84|0;i=f[h>>2]|0;j=a+88|0;k=f[j>>2]|0;if((k|0)!=(i|0))f[j>>2]=k+(~((k+-4-i|0)>>>2)<<2);f[h>>2]=0;f[j>>2]=0;f[a+92>>2]=0;if(i|0)Oq(i);i=a+72|0;j=f[i>>2]|0;h=a+76|0;if((f[h>>2]|0)!=(j|0))f[h>>2]=j;f[i>>2]=0;f[h>>2]=0;f[a+80>>2]=0;if(j|0)Oq(j);j=c+4|0;h=(f[j>>2]|0)-(f[c>>2]|0)>>2;b[e>>0]=0;qh(a,h,e);h=c+24|0;i=c+28|0;k=(f[i>>2]|0)-(f[h>>2]|0)>>2;b[e>>0]=0;qh(a+12|0,k,e);hg(a+28|0,(f[j>>2]|0)-(f[c>>2]|0)>>2,6180);gk(a+52|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);gk(a+40|0,(f[i>>2]|0)-(f[h>>2]|0)>>2);f[a+64>>2]=c;b[a+24>>0]=1;g=1;u=d;return g|0}function Hh(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a+12|0;d=f[a>>2]|0;e=a+8|0;g=f[e>>2]|0;h=(g|0)==-1;if(!(b[c>>0]|0)){do if((!h?(i=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(i|0)!=-1):0)?(j=f[(f[d+12>>2]|0)+(i<<2)>>2]|0,(j|0)!=-1):0)if(!((j>>>0)%3|0)){k=j+2|0;break}else{k=j+-1|0;break}else k=-1;while(0);f[e>>2]=k;return}k=g+1|0;if((!h?(h=((k>>>0)%3|0|0)==0?g+-2|0:k,(h|0)!=-1):0)?(k=f[(f[d+12>>2]|0)+(h<<2)>>2]|0,h=k+1|0,(k|0)!=-1):0){g=((h>>>0)%3|0|0)==0?k+-2|0:h;f[e>>2]=g;if((g|0)!=-1){if((g|0)!=(f[a+4>>2]|0))return;f[e>>2]=-1;return}}else f[e>>2]=-1;g=f[a+4>>2]|0;do if(((g|0)!=-1?(a=(((g>>>0)%3|0|0)==0?2:-1)+g|0,(a|0)!=-1):0)?(h=f[(f[d+12>>2]|0)+(a<<2)>>2]|0,(h|0)!=-1):0)if(!((h>>>0)%3|0)){l=h+2|0;break}else{l=h+-1|0;break}else l=-1;while(0);f[e>>2]=l;b[c>>0]=0;return}function Ih(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Td(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+20>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Td(a,e);return}function Jh(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=f[a+4>>2]|0;if(!d){e=0;return e|0}a=b[c+11>>0]|0;g=a<<24>>24<0;h=g?f[c+4>>2]|0:a&255;a=g?f[c>>2]|0:c;c=d;while(1){d=c+16|0;g=b[d+11>>0]|0;i=g<<24>>24<0;j=i?f[c+20>>2]|0:g&255;g=j>>>0>>0;k=g?j:h;if((k|0)!=0?(l=Vk(a,i?f[d>>2]|0:d,k)|0,(l|0)!=0):0)if((l|0)<0)m=7;else m=8;else if(h>>>0>>0)m=7;else m=8;if((m|0)==7){m=0;n=c}else if((m|0)==8){m=0;l=h>>>0>>0?h:j;if((l|0)!=0?(j=Vk(i?f[d>>2]|0:d,a,l)|0,(j|0)!=0):0){if((j|0)>=0){e=1;m=14;break}}else m=10;if((m|0)==10?(m=0,!g):0){e=1;m=14;break}n=c+4|0}c=f[n>>2]|0;if(!c){e=0;m=14;break}}if((m|0)==14)return e|0;return 0}function Kh(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;e=u;u=u+16|0;g=e+4|0;h=e;i=f[a+8>>2]|0;j=i+24|0;k=b[j>>0]|0;l=c+4|0;ag(a,(f[l>>2]|0)-(f[c>>2]|0)>>2,k,d);d=f[a+32>>2]|0;a=(f[f[d>>2]>>2]|0)+(f[d+48>>2]|0)|0;d=f[c>>2]|0;c=f[l>>2]|0;if((d|0)==(c|0)){m=1;u=e;return m|0}l=i+84|0;n=i+68|0;o=0;p=d;while(1){d=f[p>>2]|0;if(!(b[l>>0]|0))q=f[(f[n>>2]|0)+(d<<2)>>2]|0;else q=d;f[h>>2]=q;d=b[j>>0]|0;f[g>>2]=f[h>>2];if(!(Qb(i,g,d,a+(o<<2)|0)|0)){m=0;r=7;break}p=p+4|0;if((p|0)==(c|0)){m=1;r=7;break}else o=o+k|0}if((r|0)==7){u=e;return m|0}return 0}function Lh(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;f[a>>2]=1408;b=a+72|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);c=f[a+60>>2]|0;if(c|0){b=a+64|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=f[a+48>>2]|0;if(c|0)Oq(c);c=a+36|0;d=f[c>>2]|0;if(d|0){b=a+40|0;e=f[b>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-4|0;f[b>>2]=e;i=f[e>>2]|0;f[e>>2]=0;if(i|0)Va[f[(f[i>>2]|0)+4>>2]&127](i);h=f[b>>2]|0}while((h|0)!=(d|0));g=f[c>>2]|0}Oq(g)}f[a>>2]=1232;g=f[a+16>>2]|0;if(g|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(g|0))f[c>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);Oq(g);return}function Mh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;f[a>>2]=d;e=a+24|0;g=a+28|0;h=f[g>>2]|0;i=f[e>>2]|0;j=h-i>>2;k=i;i=h;if(j>>>0>=d>>>0){if(j>>>0>d>>>0?(h=k+(d<<2)|0,(h|0)!=(i|0)):0)f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2)}else Ci(e,d-j|0);if(!c)return;j=f[b>>2]|0;if((c|0)>1){d=j;e=j;h=1;while(1){i=f[b+(h<<2)>>2]|0;g=(i|0)<(e|0);k=g?i:e;l=g?d:(i|0)>(d|0)?i:d;h=h+1|0;if((h|0)==(c|0)){m=l;n=k;break}else{d=l;e=k}}}else{m=j;n=j}f[a+4>>2]=n;f[a+8>>2]=m;j=Xn(m|0,((m|0)<0)<<31>>31|0,n|0,((n|0)<0)<<31>>31|0)|0;n=I;if(!(n>>>0<0|(n|0)==0&j>>>0<2147483647))return;n=j+1|0;f[a+12>>2]=n;j=(n|0)/2|0;m=a+16|0;f[m>>2]=j;f[a+20>>2]=0-j;if(n&1|0)return;f[m>>2]=j+-1;return}function Nh(a){a=a|0;Fj(a+992|0);Fj(a+960|0);Fj(a+928|0);Fj(a+896|0);Fj(a+864|0);Fj(a+832|0);Fj(a+800|0);Fj(a+768|0);Fj(a+736|0);Fj(a+704|0);Fj(a+672|0);Fj(a+640|0);Fj(a+608|0);Fj(a+576|0);Fj(a+544|0);Fj(a+512|0);Fj(a+480|0);Fj(a+448|0);Fj(a+416|0);Fj(a+384|0);Fj(a+352|0);Fj(a+320|0);Fj(a+288|0);Fj(a+256|0);Fj(a+224|0);Fj(a+192|0);Fj(a+160|0);Fj(a+128|0);Fj(a+96|0);Fj(a+64|0);Fj(a+32|0);Fj(a);return}function Oh(a){a=a|0;wn(a);wn(a+32|0);wn(a+64|0);wn(a+96|0);wn(a+128|0);wn(a+160|0);wn(a+192|0);wn(a+224|0);wn(a+256|0);wn(a+288|0);wn(a+320|0);wn(a+352|0);wn(a+384|0);wn(a+416|0);wn(a+448|0);wn(a+480|0);wn(a+512|0);wn(a+544|0);wn(a+576|0);wn(a+608|0);wn(a+640|0);wn(a+672|0);wn(a+704|0);wn(a+736|0);wn(a+768|0);wn(a+800|0);wn(a+832|0);wn(a+864|0);wn(a+896|0);wn(a+928|0);wn(a+960|0);wn(a+992|0);return}function Ph(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c+12|0;e=c+8|0;g=c+4|0;h=c;i=(a|0)==(b|0);if(!i){f[g>>2]=f[b>>2];f[h>>2]=b+4;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Oc(a,e,d)}if(!i){f[g>>2]=f[b+12>>2];f[h>>2]=b+16;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Hc(a+12|0,e,d)}if(i){u=c;return}f[g>>2]=f[b+24>>2];f[h>>2]=b+28;f[e>>2]=f[g>>2];f[d>>2]=f[h>>2];Oc(a+24|0,e,d);u=c;return}function Qh(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+16|0;e=a;if((c|0)<0|((b|0)==0|(d|0)==0)){g=0;u=a;return g|0}h=f[b+8>>2]|0;if(((f[b+12>>2]|0)-h>>2|0)<=(c|0)){g=0;u=a;return g|0}i=b+4|0;if(!(f[i>>2]|0)){j=ln(52)|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;f[j+12>>2]=0;n[j+16>>2]=$(1.0);k=j+20|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;n[j+36>>2]=$(1.0);f[j+40>>2]=0;f[j+44>>2]=0;f[j+48>>2]=0;f[b+4>>2]=j}j=f[(f[h+(c<<2)>>2]|0)+60>>2]|0;c=ln(44)|0;Ub(c,d);f[c+40>>2]=j;j=f[i>>2]|0;f[e>>2]=c;mk(j,e)|0;j=f[e>>2]|0;f[e>>2]=0;if(!j){g=1;u=a;return g|0}bj(j);Oq(j);g=1;u=a;return g|0}function Rh(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0;c=u;u=u+64|0;j=c;k=i?6:5;Il(j);i=f[h+56>>2]|0;h=X(Vl(k)|0,e)|0;Jj(j,i,0,e&255,k,0,h,((h|0)<0)<<31>>31,0,0);h=ln(96)|0;tl(h,j);f[a>>2]=h;Bj(h,d)|0;d=h+84|0;if(!g){b[d>>0]=1;a=f[h+68>>2]|0;j=h+72|0;k=f[j>>2]|0;if((k|0)==(a|0)){u=c;return}f[j>>2]=k+(~((k+-4-a|0)>>>2)<<2);u=c;return}b[d>>0]=0;d=h+68|0;a=h+72|0;h=f[a>>2]|0;k=f[d>>2]|0;j=h-k>>2;e=h;if(j>>>0>>0){Ch(d,g-j|0,1216);u=c;return}if(j>>>0<=g>>>0){u=c;return}j=k+(g<<2)|0;if((j|0)==(e|0)){u=c;return}f[a>>2]=e+(~((e+-4-j|0)>>>2)<<2);u=c;return}function Sh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){rd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;rd(a,e);return}function Th(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){vd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;vd(a,e);return}function Uh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Fd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Fd(a,e);return}function Vh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Pd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Pd(a,e);return}function Wh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){ud(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;ud(a,e);return}function Xh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){zd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;zd(a,e);return}function Yh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Jd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Jd(a,e);return}function Zh(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){sd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;sd(a,e);return}function _h(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){wd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;wd(a,e);return}function $h(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Gd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Gd(a,e);return}function ai(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Qd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Qd(a,e);return}function bi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=u;u=u+16|0;h=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;i=ln(16)|0;f[h>>2]=i;f[h+8>>2]=-2147483632;f[h+4>>2]=15;j=i;k=14479;l=j+15|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+15>>0]=0;i=Hk(c,h,-1)|0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);switch(i|0){case -1:{if((mi(c)|0)==10)m=6;else m=5;break}case 1:{m=5;break}default:m=6}if((m|0)==5){i=ln(60)|0;Lo(i);n=i}else if((m|0)==6){m=ln(56)|0;tp(m);n=m}xo(n,d);Md(a,n,c,e);Va[f[(f[n>>2]|0)+4>>2]&127](n);u=g;return}function ci(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;b[h>>0]=a&127;do if(a>>>0>127){b[h>>0]=a|128;i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}else{f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;k=ci(a>>>7,c)|0;break}}else{i=c+16|0;j=f[i+4>>2]|0;if((j|0)>0|(j|0)==0&(f[i>>2]|0)>>>0>0){k=0;break}f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0;l=1;u=d;return l|0}while(0);l=k;u=d;return l|0} -function vc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+8|0;j=e+4|0;k=e;switch(f[c+28>>2]|0){case 9:{l=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=l;f[g>>2]=f[h>>2];m=hc(a,c,g)|0;break}case 2:{f[i>>2]=l;f[g>>2]=f[i>>2];m=Wb(a,c,g)|0;break}case 3:{f[j>>2]=l;f[g>>2]=f[j>>2];m=uc(a,c,g)|0;break}case 4:{f[k>>2]=l;f[g>>2]=f[k>>2];m=mc(a,c,g)|0;break}default:m=0}n=m;break}case 1:{m=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=m;f[g>>2]=f[h>>2];o=gc(a,c,g)|0;break}case 2:{f[i>>2]=m;f[g>>2]=f[i>>2];o=Xb(a,c,g)|0;break}case 3:{f[j>>2]=m;f[g>>2]=f[j>>2];o=sc(a,c,g)|0;break}case 4:{f[k>>2]=m;f[g>>2]=f[k>>2];o=lc(a,c,g)|0;break}default:o=0}n=o;break}case 11:case 2:{o=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=o;f[g>>2]=f[h>>2];p=gc(a,c,g)|0;break}case 2:{f[i>>2]=o;f[g>>2]=f[i>>2];p=Xb(a,c,g)|0;break}case 3:{f[j>>2]=o;f[g>>2]=f[j>>2];p=sc(a,c,g)|0;break}case 4:{f[k>>2]=o;f[g>>2]=f[k>>2];p=lc(a,c,g)|0;break}default:p=0}n=p;break}case 4:{p=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=p;f[g>>2]=f[h>>2];q=ec(a,c,g)|0;break}case 2:{f[i>>2]=p;f[g>>2]=f[i>>2];q=Vb(a,c,g)|0;break}case 3:{f[j>>2]=p;f[g>>2]=f[j>>2];q=nc(a,c,g)|0;break}case 4:{f[k>>2]=p;f[g>>2]=f[k>>2];q=jc(a,c,g)|0;break}default:q=0}n=q;break}case 3:{q=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=q;f[g>>2]=f[h>>2];r=ec(a,c,g)|0;break}case 2:{f[i>>2]=q;f[g>>2]=f[i>>2];r=Vb(a,c,g)|0;break}case 3:{f[j>>2]=q;f[g>>2]=f[j>>2];r=nc(a,c,g)|0;break}case 4:{f[k>>2]=q;f[g>>2]=f[k>>2];r=jc(a,c,g)|0;break}default:r=0}n=r;break}case 6:{r=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=r;f[g>>2]=f[h>>2];s=hc(a,c,g)|0;break}case 2:{f[i>>2]=r;f[g>>2]=f[i>>2];s=Wb(a,c,g)|0;break}case 3:{f[j>>2]=r;f[g>>2]=f[j>>2];s=uc(a,c,g)|0;break}case 4:{f[k>>2]=r;f[g>>2]=f[k>>2];s=mc(a,c,g)|0;break}default:s=0}n=s;break}case 5:{s=f[d>>2]|0;switch(b[c+24>>0]|0){case 1:{f[h>>2]=s;f[g>>2]=f[h>>2];t=hc(a,c,g)|0;break}case 2:{f[i>>2]=s;f[g>>2]=f[i>>2];t=Wb(a,c,g)|0;break}case 3:{f[j>>2]=s;f[g>>2]=f[j>>2];t=uc(a,c,g)|0;break}case 4:{f[k>>2]=s;f[g>>2]=f[k>>2];t=mc(a,c,g)|0;break}default:t=0}n=t;break}default:{v=-1;u=e;return v|0}}v=(n|0)==0?-1:n;u=e;return v|0}function wc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;e=u;u=u+32|0;g=e+16|0;h=e+12|0;i=e+29|0;j=e;k=e+28|0;if(!(f[(f[a+8>>2]|0)+80>>2]|0)){l=1;u=e;return l|0}b[i>>0]=-2;m=a+36|0;n=f[m>>2]|0;if(n)if(Ra[f[(f[a>>2]|0)+40>>2]&127](a,n)|0){n=f[m>>2]|0;o=(Qa[f[(f[n>>2]|0)+8>>2]&127](n)|0)&255;b[i>>0]=o;p=5}else q=0;else p=5;if((p|0)==5){o=d+16|0;n=o;r=f[n+4>>2]|0;if(!((r|0)>0|(r|0)==0&(f[n>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,i,i+1|0)|0}i=f[m>>2]|0;if(i|0?(n=(Qa[f[(f[i>>2]|0)+36>>2]&127](i)|0)&255,b[j>>0]=n,n=o,i=f[n+4>>2]|0,!((i|0)>0|(i|0)==0&(f[n>>2]|0)>>>0>0)):0){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,j,j+1|0)|0}n=f[a+32>>2]|0;i=b[n+24>>0]|0;r=X(f[n+80>>2]|0,i)|0;s=(f[f[n>>2]>>2]|0)+(f[n+48>>2]|0)|0;f[j>>2]=0;n=j+4|0;f[n>>2]=0;f[j+8>>2]=0;t=(r|0)==0;do if(!t)if(r>>>0>1073741823)aq(j);else{v=r<<2;w=ln(v)|0;f[j>>2]=w;x=w+(r<<2)|0;f[j+8>>2]=x;sj(w|0,0,v|0)|0;f[n>>2]=x;y=w;break}else y=0;while(0);w=f[m>>2]|0;do if(w){Ta[f[(f[w>>2]|0)+44>>2]&31](w,s,y,r,i,f[c>>2]|0)|0;x=f[m>>2]|0;if(!x){z=s;A=f[j>>2]|0;p=20;break}if(!(Qa[f[(f[x>>2]|0)+32>>2]&127](x)|0)){x=f[j>>2]|0;z=f[m>>2]|0?x:s;A=x;p=20}}else{z=s;A=y;p=20}while(0);if((p|0)==20)xm(z,r,A);A=a+4|0;a=f[A>>2]|0;do if(a){z=f[a+48>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;y=ln(48)|0;f[g>>2]=y;f[g+8>>2]=-2147483600;f[g+4>>2]=34;s=y;w=10697;x=s+34|0;do{b[s>>0]=b[w>>0]|0;s=s+1|0;w=w+1|0}while((s|0)<(x|0));b[y+34>>0]=0;w=Yj(z,g,1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if(!w){if(!t){w=f[j>>2]|0;s=0;x=0;do{x=f[w+(s<<2)>>2]|x;s=s+1|0}while((s|0)!=(r|0));if(x)B=((_(x|0)|0)>>>3^3)+1|0;else B=1}else B=1;b[k>>0]=0;s=o;w=f[s>>2]|0;z=f[s+4>>2]|0;if((z|0)>0|(z|0)==0&w>>>0>0){C=z;D=w}else{f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0;w=o;C=f[w+4>>2]|0;D=f[w>>2]|0}b[k>>0]=B;if(!((C|0)>0|(C|0)==0&D>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0}if((B|0)==(Vl(5)|0)){w=f[j>>2]|0;z=o;s=f[z+4>>2]|0;if(!((s|0)>0|(s|0)==0&(f[z>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,w,w+(r<<2)|0)|0}p=48;break}if(t)p=48;else{w=d+4|0;z=0;do{s=(f[j>>2]|0)+(z<<2)|0;y=o;v=f[y+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[y>>2]|0)>>>0>0)){f[h>>2]=f[w>>2];f[g>>2]=f[h>>2];Me(d,g,s,s+B|0)|0}z=z+1|0}while(z>>>0>>0);p=48}}else p=27}else p=27;while(0);if((p|0)==27){b[k>>0]=1;r=o;o=f[r+4>>2]|0;if(!((o|0)>0|(o|0)==0&(f[r>>2]|0)>>>0>0)){f[h>>2]=f[d+4>>2];f[g>>2]=f[h>>2];Me(d,g,k,k+1|0)|0}lp(g);k=f[A>>2]|0;if(k|0)Zj(g,10-(mi(f[k+48>>2]|0)|0)|0)|0;k=Mc(f[j>>2]|0,X((f[c+4>>2]|0)-(f[c>>2]|0)>>2,i)|0,i,g,d)|0;Ej(g,f[g+4>>2]|0);if(k)p=48;else E=0}if((p|0)==48){p=f[m>>2]|0;if(!p)E=1;else{Ra[f[(f[p>>2]|0)+40>>2]&127](p,d)|0;E=1}}d=f[j>>2]|0;if(d|0){j=f[n>>2]|0;if((j|0)!=(d|0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if((I|0)<8){P=K;Q=J}else{I=f[B>>2]|0;M=f[d>>2]|0;z=I-M>>2;y=M;M=I;if(l>>>0<=z>>>0)if(l>>>0>>0?(I=y+(l<<2)|0,(I|0)!=(M|0)):0){f[B>>2]=M+(~((M+-4-I|0)>>>2)<<2);R=0}else R=0;else{Ci(d,l-z|0);R=0}while(1){if((R|0)<(l|0)){S=0;T=0;U=R}else break;while(1){z=f[(f[h>>2]|0)+(A<<2)>>2]|0;I=f[(f[z+4>>2]|0)+(S<<2)>>2]|0;M=S>>>5;y=1<<(S&31);if(!(f[(f[e>>2]|0)+(M<<2)>>2]&y)){w=0;x=1;H=z;while(1){if((w|0)>=(Ra[f[(f[H>>2]|0)+24>>2]&127](H,I)|0)){V=x;break}z=f[(f[h>>2]|0)+(A<<2)>>2]|0;F=Sa[f[(f[z>>2]|0)+28>>2]&31](z,I,w)|0;z=(f[(f[e>>2]|0)+(F>>>5<<2)>>2]&1<<(F&31)|0)!=0;F=x&z;if(!z){V=F;break}w=w+1|0;x=F;H=f[(f[h>>2]|0)+(A<<2)>>2]|0}if(V){f[(f[d>>2]|0)+(U<<2)>>2]=S;H=(f[e>>2]|0)+(M<<2)|0;f[H>>2]=f[H>>2]|y;W=1;X=U+1|0}else{W=T;X=U}}else{W=T;X=U}S=S+1|0;if((S|0)>=(l|0))break;else{T=W;U=X}}if(W|(X|0)>=(l|0))R=X;else{O=0;break a}}bg(f[(f[h>>2]|0)+(A<<2)>>2]|0,d);P=f[h>>2]|0;Q=f[i>>2]|0}a=a+1|0;if(a>>>0>=Q-P>>2>>>0){O=1;break}else{L=P;K=P;J=Q}}}while(0);Q=f[e>>2]|0;if(Q|0)Oq(Q);Q=f[d>>2]|0;if(Q|0){d=f[B>>2]|0;if((d|0)!=(Q|0))f[B>>2]=d+(~((d+-4-Q|0)>>>2)<<2);Oq(Q)}N=O}O=f[c>>2]|0;if(!O){u=b;return N|0}Oq(O);u=b;return N|0}function yc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!a)return;b=a+-8|0;c=f[4788]|0;d=f[a+-4>>2]|0;a=d&-8;e=b+a|0;do if(!(d&1)){g=f[b>>2]|0;if(!(d&3))return;h=b+(0-g)|0;i=g+a|0;if(h>>>0>>0)return;if((f[4789]|0)==(h|0)){j=e+4|0;k=f[j>>2]|0;if((k&3|0)!=3){l=h;m=i;n=h;break}f[4786]=i;f[j>>2]=k&-2;f[h+4>>2]=i|1;f[h+i>>2]=i;return}k=g>>>3;if(g>>>0<256){g=f[h+8>>2]|0;j=f[h+12>>2]|0;if((j|0)==(g|0)){f[4784]=f[4784]&~(1<>2]=j;f[j+8>>2]=g;l=h;m=i;n=h;break}}g=f[h+24>>2]|0;j=f[h+12>>2]|0;do if((j|0)==(h|0)){k=h+16|0;o=k+4|0;p=f[o>>2]|0;if(!p){q=f[k>>2]|0;if(!q){r=0;break}else{s=q;t=k}}else{s=p;t=o}while(1){o=s+20|0;p=f[o>>2]|0;if(p|0){s=p;t=o;continue}o=s+16|0;p=f[o>>2]|0;if(!p)break;else{s=p;t=o}}f[t>>2]=0;r=s}else{o=f[h+8>>2]|0;f[o+12>>2]=j;f[j+8>>2]=o;r=j}while(0);if(g){j=f[h+28>>2]|0;o=19440+(j<<2)|0;if((f[o>>2]|0)==(h|0)){f[o>>2]=r;if(!r){f[4785]=f[4785]&~(1<>2]|0)!=(h|0)&1)<<2)>>2]=r;if(!r){l=h;m=i;n=h;break}}f[r+24>>2]=g;j=h+16|0;o=f[j>>2]|0;if(o|0){f[r+16>>2]=o;f[o+24>>2]=r}o=f[j+4>>2]|0;if(o){f[r+20>>2]=o;f[o+24>>2]=r;l=h;m=i;n=h}else{l=h;m=i;n=h}}else{l=h;m=i;n=h}}else{l=b;m=a;n=b}while(0);if(n>>>0>=e>>>0)return;b=e+4|0;a=f[b>>2]|0;if(!(a&1))return;if(!(a&2)){if((f[4790]|0)==(e|0)){r=(f[4787]|0)+m|0;f[4787]=r;f[4790]=l;f[l+4>>2]=r|1;if((l|0)!=(f[4789]|0))return;f[4789]=0;f[4786]=0;return}if((f[4789]|0)==(e|0)){r=(f[4786]|0)+m|0;f[4786]=r;f[4789]=n;f[l+4>>2]=r|1;f[n+r>>2]=r;return}r=(a&-8)+m|0;s=a>>>3;do if(a>>>0<256){t=f[e+8>>2]|0;c=f[e+12>>2]|0;if((c|0)==(t|0)){f[4784]=f[4784]&~(1<>2]=c;f[c+8>>2]=t;break}}else{t=f[e+24>>2]|0;c=f[e+12>>2]|0;do if((c|0)==(e|0)){d=e+16|0;o=d+4|0;j=f[o>>2]|0;if(!j){p=f[d>>2]|0;if(!p){u=0;break}else{v=p;w=d}}else{v=j;w=o}while(1){o=v+20|0;j=f[o>>2]|0;if(j|0){v=j;w=o;continue}o=v+16|0;j=f[o>>2]|0;if(!j)break;else{v=j;w=o}}f[w>>2]=0;u=v}else{o=f[e+8>>2]|0;f[o+12>>2]=c;f[c+8>>2]=o;u=c}while(0);if(t|0){c=f[e+28>>2]|0;h=19440+(c<<2)|0;if((f[h>>2]|0)==(e|0)){f[h>>2]=u;if(!u){f[4785]=f[4785]&~(1<>2]|0)!=(e|0)&1)<<2)>>2]=u;if(!u)break}f[u+24>>2]=t;c=e+16|0;h=f[c>>2]|0;if(h|0){f[u+16>>2]=h;f[h+24>>2]=u}h=f[c+4>>2]|0;if(h|0){f[u+20>>2]=h;f[h+24>>2]=u}}}while(0);f[l+4>>2]=r|1;f[n+r>>2]=r;if((l|0)==(f[4789]|0)){f[4786]=r;return}else x=r}else{f[b>>2]=a&-2;f[l+4>>2]=m|1;f[n+m>>2]=m;x=m}m=x>>>3;if(x>>>0<256){n=19176+(m<<1<<2)|0;a=f[4784]|0;b=1<>2]|0;z=b}f[z>>2]=l;f[y+12>>2]=l;f[l+8>>2]=y;f[l+12>>2]=n;return}n=x>>>8;if(n)if(x>>>0>16777215)A=31;else{y=(n+1048320|0)>>>16&8;z=n<>>16&4;b=z<>>16&2;a=14-(n|y|z)+(b<>>15)|0;A=x>>>(a+7|0)&1|a<<1}else A=0;a=19440+(A<<2)|0;f[l+28>>2]=A;f[l+20>>2]=0;f[l+16>>2]=0;z=f[4785]|0;b=1<>>1)|0);n=f[a>>2]|0;while(1){if((f[n+4>>2]&-8|0)==(x|0)){B=73;break}C=n+16+(y>>>31<<2)|0;m=f[C>>2]|0;if(!m){B=72;break}else{y=y<<1;n=m}}if((B|0)==72){f[C>>2]=l;f[l+24>>2]=n;f[l+12>>2]=l;f[l+8>>2]=l;break}else if((B|0)==73){y=n+8|0;t=f[y>>2]|0;f[t+12>>2]=l;f[y>>2]=l;f[l+8>>2]=t;f[l+12>>2]=n;f[l+24>>2]=0;break}}else{f[4785]=z|b;f[a>>2]=l;f[l+24>>2]=a;f[l+12>>2]=l;f[l+8>>2]=l}while(0);l=(f[4792]|0)+-1|0;f[4792]=l;if(!l)D=19592;else return;while(1){l=f[D>>2]|0;if(!l)break;else D=l+8|0}f[4792]=-1;return}function zc(a){a=a|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0;c=u;u=u+32|0;e=c+4|0;g=c;h=c+16|0;i=a+52|0;j=f[i>>2]|0;k=(f[j+100>>2]|0)-(f[j+96>>2]|0)|0;j=(k|0)/12|0;l=a+44|0;ci(j,f[l>>2]|0)|0;ci(f[(f[i>>2]|0)+80>>2]|0,f[l>>2]|0)|0;m=f[a+48>>2]|0;n=ln(32)|0;f[e>>2]=n;f[e+8>>2]=-2147483616;f[e+4>>2]=21;o=n;p=15598;q=o+21|0;do{b[o>>0]=b[p>>0]|0;o=o+1|0;p=p+1|0}while((o|0)<(q|0));b[n+21>>0]=0;n=Yj(m,e,0)|0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);m=f[l>>2]|0;if(n){b[h>>0]=0;n=m+16|0;p=f[n+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[n>>2]|0)>>>0>0)){f[g>>2]=f[m+4>>2];f[e>>2]=f[g>>2];Me(m,e,h,h+1|0)|0}mf(a)|0;u=c;return 1}b[h>>0]=1;a=m+16|0;n=f[a+4>>2]|0;if(!((n|0)>0|(n|0)==0&(f[a>>2]|0)>>>0>0)){f[g>>2]=f[m+4>>2];f[e>>2]=f[g>>2];Me(m,e,h,h+1|0)|0}m=f[i>>2]|0;a=f[m+80>>2]|0;if(a>>>0<256){if(!k){u=c;return 1}n=h+1|0;p=h+1|0;o=h+1|0;q=0;r=m;while(1){s=f[r+96>>2]|0;t=f[l>>2]|0;b[h>>0]=f[s+(q*12|0)>>2];v=t+16|0;w=f[v>>2]|0;x=f[v+4>>2]|0;if((x|0)>0|(x|0)==0&w>>>0>0){y=w;z=t;A=x}else{f[g>>2]=f[t+4>>2];f[e>>2]=f[g>>2];Me(t,e,h,o)|0;t=f[l>>2]|0;x=t+16|0;y=f[x>>2]|0;z=t;A=f[x+4>>2]|0}b[h>>0]=f[s+(q*12|0)+4>>2];if((A|0)>0|(A|0)==0&y>>>0>0){B=A;C=y;D=z}else{f[g>>2]=f[z+4>>2];f[e>>2]=f[g>>2];Me(z,e,h,p)|0;x=f[l>>2]|0;t=x+16|0;B=f[t+4>>2]|0;C=f[t>>2]|0;D=x}b[h>>0]=f[s+(q*12|0)+8>>2];if(!((B|0)>0|(B|0)==0&C>>>0>0)){f[g>>2]=f[D+4>>2];f[e>>2]=f[g>>2];Me(D,e,h,n)|0}s=q+1|0;if(s>>>0>=j>>>0)break;q=s;r=f[i>>2]|0}u=c;return 1}if(a>>>0<65536){if(!k){u=c;return 1}r=h+2|0;q=h+2|0;n=h+2|0;D=0;C=m;while(1){B=f[C+96>>2]|0;p=f[l>>2]|0;d[h>>1]=f[B+(D*12|0)>>2];z=p+16|0;y=f[z>>2]|0;A=f[z+4>>2]|0;if((A|0)>0|(A|0)==0&y>>>0>0){E=A;F=y;G=p}else{f[g>>2]=f[p+4>>2];f[e>>2]=f[g>>2];Me(p,e,h,n)|0;p=f[l>>2]|0;y=p+16|0;E=f[y+4>>2]|0;F=f[y>>2]|0;G=p}d[h>>1]=f[B+(D*12|0)+4>>2];if((E|0)>0|(E|0)==0&F>>>0>0){H=E;I=F;J=G}else{f[g>>2]=f[G+4>>2];f[e>>2]=f[g>>2];Me(G,e,h,q)|0;p=f[l>>2]|0;y=p+16|0;H=f[y+4>>2]|0;I=f[y>>2]|0;J=p}d[h>>1]=f[B+(D*12|0)+8>>2];if(!((H|0)>0|(H|0)==0&I>>>0>0)){f[g>>2]=f[J+4>>2];f[e>>2]=f[g>>2];Me(J,e,h,r)|0}B=D+1|0;if(B>>>0>=j>>>0)break;D=B;C=f[i>>2]|0}u=c;return 1}C=(k|0)!=0;if(a>>>0<2097152){if(C){K=0;L=m}else{u=c;return 1}while(1){a=f[L+96>>2]|0;ci(f[a+(K*12|0)>>2]|0,f[l>>2]|0)|0;ci(f[a+(K*12|0)+4>>2]|0,f[l>>2]|0)|0;ci(f[a+(K*12|0)+8>>2]|0,f[l>>2]|0)|0;a=K+1|0;if(a>>>0>=j>>>0)break;K=a;L=f[i>>2]|0}u=c;return 1}if(!C){u=c;return 1}C=0;L=m;while(1){m=(f[L+96>>2]|0)+(C*12|0)|0;K=f[l>>2]|0;a=K+16|0;k=f[a+4>>2]|0;if(!((k|0)>0|(k|0)==0&(f[a>>2]|0)>>>0>0)){f[g>>2]=f[K+4>>2];f[e>>2]=f[g>>2];Me(K,e,m,m+12|0)|0}m=C+1|0;if(m>>>0>=j>>>0)break;C=m;L=f[i>>2]|0}u=c;return 1}function Ac(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=Oa,w=Oa,x=Oa,y=Oa,z=0,A=0,B=0,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=Oa,P=0,Q=Oa,R=Oa,S=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+28|0;o=f[c>>2]|0;c=o+1|0;if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;c=o+(((o>>>0)%3|0|0)==0?2:-1)|0;if((p|0)==-1)q=-1;else q=f[(f[f[m>>2]>>2]|0)+(p<<2)>>2]|0;if((c|0)==-1){r=-1;s=q}else{r=f[(f[f[m>>2]>>2]|0)+(c<<2)>>2]|0;s=q}}else{r=-1;s=-1}q=f[a+32>>2]|0;c=f[q>>2]|0;m=(f[q+4>>2]|0)-c>>2;if(m>>>0<=s>>>0)aq(q);p=c;c=f[p+(s<<2)>>2]|0;if(m>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(c|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)t=c;else{if((e|0)>0){t=e+-1|0;break}p=a+52|0;if((f[p>>2]|0)<=0){u=g;return}m=f[a+48>>2]|0;s=0;do{f[m+(s<<2)>>2]=0;s=s+1|0}while((s|0)<(f[p>>2]|0));u=g;return}while(0);r=a+52|0;p=f[r>>2]|0;s=X(p,t)|0;if((p|0)<=0){u=g;return}p=f[a+48>>2]|0;t=0;do{f[p+(t<<2)>>2]=f[d+(t+s<<2)>>2];t=t+1|0}while((t|0)<(f[r>>2]|0));u=g;return}r=a+52|0;t=f[r>>2]|0;s=X(t,c)|0;v=$(f[d+(s<<2)>>2]|0);w=$(f[d+(s+1<<2)>>2]|0);s=X(t,q)|0;x=$(f[d+(s<<2)>>2]|0);y=$(f[d+(s+1<<2)>>2]|0);if(!(x!=v|y!=w)){s=f[a+48>>2]|0;f[s>>2]=~~x;f[s+4>>2]=~~y;u=g;return}s=a+44|0;t=f[(f[s>>2]|0)+(e<<2)>>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E=$(v-N);v=$(H-w);j=$($($(y*y)+$(0.0))+$(M*M))<$($($(E*E)+$(0.0))+$(v*v));d=a+56|0;e=a+60|0;r=f[e>>2]|0;k=f[a+64>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;B=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?B:j):2147483647);P=f[e>>2]|0;break}else P=r;while(0);f[e>>2]=P+1;j=(f[d>>2]|0)+(P>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(P&31);Q=O;R=x}else{do if(l)if((r+1|0)<0)aq(d);else{P=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(P>>>0>>0?j:P):2147483647);S=f[e>>2]|0;break}else S=r;while(0);f[e>>2]=S+1;e=(f[d>>2]|0)+(S>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(S&31));Q=N;R=w}S=~~+J(+(+Q+.5));e=f[a+48>>2]|0;f[e>>2]=S;S=~~+J(+(+R+.5));f[e+4>>2]=S;u=g;return}function Bc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=Oa,v=Oa,w=Oa,x=Oa,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=0,P=Oa,Q=Oa,R=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+28|0;o=f[c>>2]|0;c=o+1|0;do if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;if(!((o>>>0)%3|0)){q=o+2|0;r=p;break}else{q=o+-1|0;r=p;break}}else{q=-1;r=-1}while(0);o=f[(f[m>>2]|0)+28>>2]|0;m=f[o+(r<<2)>>2]|0;r=f[o+(q<<2)>>2]|0;q=f[a+32>>2]|0;o=f[q>>2]|0;c=(f[q+4>>2]|0)-o>>2;if(c>>>0<=m>>>0)aq(q);p=o;o=f[p+(m<<2)>>2]|0;if(c>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(o|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)s=o;else{if((e|0)>0){s=e+-1|0;break}p=a+52|0;if((f[p>>2]|0)<=0){u=g;return}c=f[a+48>>2]|0;m=0;do{f[c+(m<<2)>>2]=0;m=m+1|0}while((m|0)<(f[p>>2]|0));u=g;return}while(0);r=a+52|0;p=f[r>>2]|0;m=X(p,s)|0;if((p|0)<=0){u=g;return}p=f[a+48>>2]|0;s=0;do{f[p+(s<<2)>>2]=f[d+(s+m<<2)>>2];s=s+1|0}while((s|0)<(f[r>>2]|0));u=g;return}r=a+52|0;s=f[r>>2]|0;m=X(s,o)|0;t=$(f[d+(m<<2)>>2]|0);v=$(f[d+(m+1<<2)>>2]|0);m=X(s,q)|0;w=$(f[d+(m<<2)>>2]|0);x=$(f[d+(m+1<<2)>>2]|0);if(!(w!=t|x!=v)){m=f[a+48>>2]|0;f[m>>2]=~~w;f[m+4>>2]=~~x;u=g;return}m=a+44|0;s=f[(f[m>>2]|0)+(e<<2)>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;p=a+40|0;c=f[p>>2]|0;if(!(b[c+84>>0]|0))y=f[(f[c+68>>2]|0)+(s<<2)>>2]|0;else y=s;f[i>>2]=y;y=b[c+24>>0]|0;f[h>>2]=f[i>>2];mb(c,h,y,j)|0;y=f[(f[m>>2]|0)+(o<<2)>>2]|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;o=f[p>>2]|0;if(!(b[o+84>>0]|0))z=f[(f[o+68>>2]|0)+(y<<2)>>2]|0;else z=y;f[i>>2]=z;z=b[o+24>>0]|0;f[h>>2]=f[i>>2];mb(o,h,z,k)|0;z=f[(f[m>>2]|0)+(q<<2)>>2]|0;f[l>>2]=0;f[l+4>>2]=0;f[l+8>>2]=0;q=f[p>>2]|0;if(!(b[q+84>>0]|0))A=f[(f[q+68>>2]|0)+(z<<2)>>2]|0;else A=z;f[i>>2]=A;A=b[q+24>>0]|0;f[h>>2]=f[i>>2];mb(q,h,A,l)|0;B=$(n[l>>2]);C=$(n[k>>2]);D=$(B-C);B=$(n[l+4>>2]);E=$(n[k+4>>2]);F=$(B-E);B=$(n[l+8>>2]);G=$(n[k+8>>2]);H=$(B-G);B=$($(n[j>>2])-C);C=$($(n[j+4>>2])-E);E=$($(n[j+8>>2])-G);G=$($($($(D*D)+$(0.0))+$(F*F))+$(H*H));if(G>$(0.0)){I=$($($($($(D*B)+$(0.0))+$(F*C))+$(H*E))/G);K=$(B-$(D*I));D=$(C-$(F*I));F=$(E-$(H*I));M=I;N=$(L($($($(F*F)+$($(D*D)+$($(K*K)+$(0.0))))/G)))}else{M=$(0.0);N=$(0.0)}G=$(w-t);w=$(x-v);x=$($(G*M)+t);t=$(G*N);G=$($(w*M)+v);v=$(w*N);N=$(x-v);w=$(G+t);M=$(x+v);v=$(G-t);j=X(f[r>>2]|0,e)|0;t=$(f[d+(j<<2)>>2]|0);G=$(f[d+(j+1<<2)>>2]|0);x=$(t-N);K=$(G-w);D=$(t-M);t=$(G-v);j=$($($(x*x)+$(0.0))+$(K*K))<$($($(D*D)+$(0.0))+$(t*t));d=a+56|0;e=a+60|0;r=f[e>>2]|0;k=f[a+64>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;A=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?A:j):2147483647);O=f[e>>2]|0;break}else O=r;while(0);f[e>>2]=O+1;j=(f[d>>2]|0)+(O>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(O&31);P=N;Q=w}else{do if(l)if((r+1|0)<0)aq(d);else{O=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(O>>>0>>0?j:O):2147483647);R=f[e>>2]|0;break}else R=r;while(0);f[e>>2]=R+1;e=(f[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*K));N=K;O=$(L($($($(G*G)+$($(E*E)+$($(M*M)+$(0.0))))/H)))}else{N=$(0.0);O=$(0.0)}H=$(x-v);x=$(y-w);y=$($(H*N)+v);v=$(H*O);H=$($(x*N)+w);w=$(x*O);O=$(y-w);x=$(H+v);N=$(y+w);w=$(H-v);j=X(f[r>>2]|0,e)|0;v=$(f[d+(j<<2)>>2]|0);H=$(f[d+(j+1<<2)>>2]|0);y=$(v-O);M=$(H-x);E=$(v-N);v=$(H-w);j=$($($(y*y)+$(0.0))+$(M*M))<$($($(E*E)+$(0.0))+$(v*v));d=a+76|0;e=a+80|0;r=f[e>>2]|0;k=f[a+84>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;B=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?B:j):2147483647);P=f[e>>2]|0;break}else P=r;while(0);f[e>>2]=P+1;j=(f[d>>2]|0)+(P>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(P&31);Q=O;R=x}else{do if(l)if((r+1|0)<0)aq(d);else{P=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(P>>>0>>0?j:P):2147483647);S=f[e>>2]|0;break}else S=r;while(0);f[e>>2]=S+1;e=(f[d>>2]|0)+(S>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(S&31));Q=N;R=w}S=~~+J(+(+Q+.5));e=f[a+68>>2]|0;f[e>>2]=S;S=~~+J(+(+R+.5));f[e+4>>2]=S;u=g;return}function Dc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=Oa,v=Oa,w=Oa,x=Oa,y=0,z=0,A=0,B=Oa,C=Oa,D=Oa,E=Oa,F=Oa,G=Oa,H=Oa,I=Oa,K=Oa,M=Oa,N=Oa,O=0,P=Oa,Q=Oa,R=0;g=u;u=u+48|0;h=g+40|0;i=g+36|0;j=g+24|0;k=g+12|0;l=g;m=a+48|0;o=f[c>>2]|0;c=o+1|0;do if((o|0)!=-1){p=((c>>>0)%3|0|0)==0?o+-2|0:c;if(!((o>>>0)%3|0)){q=o+2|0;r=p;break}else{q=o+-1|0;r=p;break}}else{q=-1;r=-1}while(0);o=f[(f[m>>2]|0)+28>>2]|0;m=f[o+(r<<2)>>2]|0;r=f[o+(q<<2)>>2]|0;q=f[a+52>>2]|0;o=f[q>>2]|0;c=(f[q+4>>2]|0)-o>>2;if(c>>>0<=m>>>0)aq(q);p=o;o=f[p+(m<<2)>>2]|0;if(c>>>0<=r>>>0)aq(q);q=f[p+(r<<2)>>2]|0;r=(o|0)<(e|0);if(!(r&(q|0)<(e|0))){do if(r)s=o;else{if((e|0)>0){s=e+-1|0;break}p=a+72|0;if((f[p>>2]|0)<=0){u=g;return}c=f[a+68>>2]|0;m=0;do{f[c+(m<<2)>>2]=0;m=m+1|0}while((m|0)<(f[p>>2]|0));u=g;return}while(0);r=a+72|0;p=f[r>>2]|0;m=X(p,s)|0;if((p|0)<=0){u=g;return}p=f[a+68>>2]|0;s=0;do{f[p+(s<<2)>>2]=f[d+(s+m<<2)>>2];s=s+1|0}while((s|0)<(f[r>>2]|0));u=g;return}r=a+72|0;s=f[r>>2]|0;m=X(s,o)|0;t=$(f[d+(m<<2)>>2]|0);v=$(f[d+(m+1<<2)>>2]|0);m=X(s,q)|0;w=$(f[d+(m<<2)>>2]|0);x=$(f[d+(m+1<<2)>>2]|0);if(!(w!=t|x!=v)){m=f[a+68>>2]|0;f[m>>2]=~~w;f[m+4>>2]=~~x;u=g;return}m=a+64|0;s=f[(f[m>>2]|0)+(e<<2)>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;p=a+60|0;c=f[p>>2]|0;if(!(b[c+84>>0]|0))y=f[(f[c+68>>2]|0)+(s<<2)>>2]|0;else y=s;f[i>>2]=y;y=b[c+24>>0]|0;f[h>>2]=f[i>>2];mb(c,h,y,j)|0;y=f[(f[m>>2]|0)+(o<<2)>>2]|0;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;o=f[p>>2]|0;if(!(b[o+84>>0]|0))z=f[(f[o+68>>2]|0)+(y<<2)>>2]|0;else z=y;f[i>>2]=z;z=b[o+24>>0]|0;f[h>>2]=f[i>>2];mb(o,h,z,k)|0;z=f[(f[m>>2]|0)+(q<<2)>>2]|0;f[l>>2]=0;f[l+4>>2]=0;f[l+8>>2]=0;q=f[p>>2]|0;if(!(b[q+84>>0]|0))A=f[(f[q+68>>2]|0)+(z<<2)>>2]|0;else A=z;f[i>>2]=A;A=b[q+24>>0]|0;f[h>>2]=f[i>>2];mb(q,h,A,l)|0;B=$(n[l>>2]);C=$(n[k>>2]);D=$(B-C);B=$(n[l+4>>2]);E=$(n[k+4>>2]);F=$(B-E);B=$(n[l+8>>2]);G=$(n[k+8>>2]);H=$(B-G);B=$($(n[j>>2])-C);C=$($(n[j+4>>2])-E);E=$($(n[j+8>>2])-G);G=$($($($(D*D)+$(0.0))+$(F*F))+$(H*H));if(G>$(0.0)){I=$($($($($(D*B)+$(0.0))+$(F*C))+$(H*E))/G);K=$(B-$(D*I));D=$(C-$(F*I));F=$(E-$(H*I));M=I;N=$(L($($($(F*F)+$($(D*D)+$($(K*K)+$(0.0))))/G)))}else{M=$(0.0);N=$(0.0)}G=$(w-t);w=$(x-v);x=$($(G*M)+t);t=$(G*N);G=$($(w*M)+v);v=$(w*N);N=$(x-v);w=$(G+t);M=$(x+v);v=$(G-t);j=X(f[r>>2]|0,e)|0;t=$(f[d+(j<<2)>>2]|0);G=$(f[d+(j+1<<2)>>2]|0);x=$(t-N);K=$(G-w);D=$(t-M);t=$(G-v);j=$($($(x*x)+$(0.0))+$(K*K))<$($($(D*D)+$(0.0))+$(t*t));d=a+76|0;e=a+80|0;r=f[e>>2]|0;k=f[a+84>>2]|0;l=(r|0)==(k<<5|0);if(j){do if(l)if((r+1|0)<0)aq(d);else{j=k<<6;A=r+32&-32;vi(d,r>>>0<1073741823?(j>>>0>>0?A:j):2147483647);O=f[e>>2]|0;break}else O=r;while(0);f[e>>2]=O+1;j=(f[d>>2]|0)+(O>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(O&31);P=N;Q=w}else{do if(l)if((r+1|0)<0)aq(d);else{O=k<<6;j=r+32&-32;vi(d,r>>>0<1073741823?(O>>>0>>0?j:O):2147483647);R=f[e>>2]|0;break}else R=r;while(0);f[e>>2]=R+1;e=(f[d>>2]|0)+(R>>>5<<2)|0;f[e>>2]=f[e>>2]&~(1<<(R&31));P=M;Q=v}R=~~+J(+(+P+.5));e=f[a+68>>2]|0;f[e>>2]=R;R=~~+J(+(+Q+.5));f[e+4>>2]=R;u=g;return}function Ec(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=Oa,F=Oa,G=Oa,H=0,I=0,J=0,K=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;e=i;j=i;while(1){k=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;e=(X(k>>>24^k,1540483477)|0)^(X(e,1540483477)|0);j=j+-4|0;if(j>>>0<=3)break;else d=d+4|0}d=i+-4|0;j=d&-4;l=d-j|0;m=g+(j+4)|0;o=e}else{l=i;m=g;o=i}switch(l|0){case 3:{p=h[m+2>>0]<<16^o;q=6;break}case 2:{p=o;q=6;break}case 1:{r=o;q=7;break}default:s=o}if((q|0)==6){r=h[m+1>>0]<<8^p;q=7}if((q|0)==7)s=X(r^h[m>>0],1540483477)|0;m=X(s>>>13^s,1540483477)|0;s=m>>>15^m;m=a+4|0;r=f[m>>2]|0;p=(r|0)==0;a:do if(!p){o=r+-1|0;l=(o&r|0)==0;if(!l)if(s>>>0>>0)t=s;else t=(s>>>0)%(r>>>0)|0;else t=s&o;e=f[(f[a>>2]|0)+(t<<2)>>2]|0;if((e|0)!=0?(j=f[e>>2]|0,(j|0)!=0):0){e=(i|0)==0;if(l){if(e){l=j;while(1){d=f[l+4>>2]|0;if(!((d|0)==(s|0)|(d&o|0)==(t|0))){u=t;break a}d=b[l+8+11>>0]|0;if(!((d<<24>>24<0?f[l+12>>2]|0:d&255)|0)){v=l;break}l=f[l>>2]|0;if(!l){u=t;break a}}w=v+20|0;return w|0}else x=j;b:while(1){l=f[x+4>>2]|0;if(!((l|0)==(s|0)|(l&o|0)==(t|0))){u=t;break a}l=x+8|0;d=b[l+11>>0]|0;k=d<<24>>24<0;y=d&255;do if(((k?f[x+12>>2]|0:y)|0)==(i|0)){d=f[l>>2]|0;if(k)if(!(Vk(d,g,i)|0)){v=x;q=63;break b}else break;if((b[g>>0]|0)==(d&255)<<24>>24){d=l;z=y;A=g;do{z=z+-1|0;d=d+1|0;if(!z){v=x;q=63;break b}A=A+1|0}while((b[d>>0]|0)==(b[A>>0]|0))}}while(0);x=f[x>>2]|0;if(!x){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}if(e){o=j;while(1){y=f[o+4>>2]|0;if((y|0)!=(s|0)){if(y>>>0>>0)B=y;else B=(y>>>0)%(r>>>0)|0;if((B|0)!=(t|0)){u=t;break a}}y=b[o+8+11>>0]|0;if(!((y<<24>>24<0?f[o+12>>2]|0:y&255)|0)){v=o;break}o=f[o>>2]|0;if(!o){u=t;break a}}w=v+20|0;return w|0}else C=j;c:while(1){o=f[C+4>>2]|0;if((o|0)!=(s|0)){if(o>>>0>>0)D=o;else D=(o>>>0)%(r>>>0)|0;if((D|0)!=(t|0)){u=t;break a}}o=C+8|0;e=b[o+11>>0]|0;y=e<<24>>24<0;l=e&255;do if(((y?f[C+12>>2]|0:l)|0)==(i|0)){e=f[o>>2]|0;if(y)if(!(Vk(e,g,i)|0)){v=C;q=63;break c}else break;if((b[g>>0]|0)==(e&255)<<24>>24){e=o;k=l;A=g;do{k=k+-1|0;e=e+1|0;if(!k){v=C;q=63;break c}A=A+1|0}while((b[e>>0]|0)==(b[A>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){u=t;break a}}if((q|0)==63){w=v+20|0;return w|0}}else u=t}else u=0;while(0);t=ln(24)|0;pj(t+8|0,c);f[t+20>>2]=0;f[t+4>>2]=s;f[t>>2]=0;c=a+12|0;E=$(((f[c>>2]|0)+1|0)>>>0);F=$(r>>>0);G=$(n[a+16>>2]);do if(p|$(G*F)>>0<3|(r+-1&r|0)!=0)&1;g=~~$(W($(E/G)))>>>0;ei(a,C>>>0>>0?g:C);C=f[m>>2]|0;g=C+-1|0;if(!(g&C)){H=C;I=g&s;break}if(s>>>0>>0){H=C;I=s}else{H=C;I=(s>>>0)%(C>>>0)|0}}else{H=r;I=u}while(0);u=(f[a>>2]|0)+(I<<2)|0;I=f[u>>2]|0;if(!I){r=a+8|0;f[t>>2]=f[r>>2];f[r>>2]=t;f[u>>2]=r;r=f[t>>2]|0;if(r|0){u=f[r+4>>2]|0;r=H+-1|0;if(r&H)if(u>>>0>>0)J=u;else J=(u>>>0)%(H>>>0)|0;else J=u&r;K=(f[a>>2]|0)+(J<<2)|0;q=61}}else{f[t>>2]=f[I>>2];K=I;q=61}if((q|0)==61)f[K>>2]=t;f[c>>2]=(f[c>>2]|0)+1;v=t;w=v+20|0;return w|0}function Fc(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0.0,q=0.0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0,H=0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0.0,R=0.0,S=0,T=0.0,U=0,V=0,W=0,X=0.0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0.0,da=0,ea=0.0;g=a+4|0;i=f[g>>2]|0;j=a+100|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=0}else{k=Si(a)|0;l=0}a:while(1){switch(k|0){case 46:{m=8;break a;break}case 48:break;default:{n=0;o=0;p=1.0;q=0.0;r=0;s=k;t=l;u=0;v=0;w=0;x=0;break a}}i=f[g>>2]|0;if(i>>>0<(f[j>>2]|0)>>>0){f[g>>2]=i+1;k=h[i>>0]|0;l=1;continue}else{k=Si(a)|0;l=1;continue}}if((m|0)==8){k=f[g>>2]|0;if(k>>>0<(f[j>>2]|0)>>>0){f[g>>2]=k+1;y=h[k>>0]|0}else y=Si(a)|0;if((y|0)==48){k=0;i=0;while(1){z=f[g>>2]|0;if(z>>>0<(f[j>>2]|0)>>>0){f[g>>2]=z+1;A=h[z>>0]|0}else A=Si(a)|0;z=Vn(k|0,i|0,-1,-1)|0;B=I;if((A|0)==48){k=z;i=B}else{n=1;o=0;p=1.0;q=0.0;r=0;s=A;t=1;u=0;v=0;w=z;x=B;break}}}else{n=1;o=0;p=1.0;q=0.0;r=0;s=y;t=l;u=0;v=0;w=0;x=0}}while(1){l=s+-48|0;y=s|32;if(l>>>0>=10){A=(s|0)==46;if(!(A|(y+-97|0)>>>0<6)){C=s;break}if(A)if(!n){D=1;E=o;F=p;G=q;H=r;J=t;K=v;L=u;M=v;N=u}else{C=46;break}else m=20}else m=20;if((m|0)==20){m=0;A=(s|0)>57?y+-87|0:l;do if(!((u|0)<0|(u|0)==0&v>>>0<8))if((u|0)<0|(u|0)==0&v>>>0<14){O=p*.0625;P=o;Q=O;R=q+O*+(A|0);S=r;break}else{l=(o|0)!=0|(A|0)==0;P=l?o:1;Q=p;R=l?q:q+p*.5;S=r;break}else{P=o;Q=p;R=q;S=A+(r<<4)|0}while(0);A=Vn(v|0,u|0,1,0)|0;D=n;E=P;F=Q;G=R;H=S;J=1;K=w;L=x;M=A;N=I}A=f[g>>2]|0;if(A>>>0<(f[j>>2]|0)>>>0){f[g>>2]=A+1;n=D;o=E;p=F;q=G;r=H;s=h[A>>0]|0;t=J;u=N;v=M;w=K;x=L;continue}else{n=D;o=E;p=F;q=G;r=H;s=Si(a)|0;t=J;u=N;v=M;w=K;x=L;continue}}do if(!t){L=(f[j>>2]|0)==0;if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(e){if(!L)f[g>>2]=(f[g>>2]|0)+-1;if(!((n|0)==0|L))f[g>>2]=(f[g>>2]|0)+-1}else Ym(a,0);T=+(d|0)*0.0}else{L=(n|0)==0;K=L?v:w;M=L?u:x;if((u|0)<0|(u|0)==0&v>>>0<8){L=r;N=v;J=u;while(1){s=L<<4;H=N;N=Vn(N|0,J|0,1,0)|0;if(!((J|0)<0|(J|0)==0&H>>>0<7)){U=s;break}else{L=s;J=I}}}else U=r;if((C|32|0)==112){J=Re(a,e)|0;L=I;if((J|0)==0&(L|0)==-2147483648){if(!e){Ym(a,0);T=0.0;break}if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}}else{V=J;W=L}}else if(!(f[j>>2]|0)){V=0;W=0}else{f[g>>2]=(f[g>>2]|0)+-1;V=0;W=0}L=Tn(K|0,M|0,2)|0;J=Vn(L|0,I|0,-32,-1)|0;L=Vn(J|0,I|0,V|0,W|0)|0;J=I;if(!U){T=+(d|0)*0.0;break}N=0-c|0;s=((N|0)<0)<<31>>31;if((J|0)>(s|0)|(J|0)==(s|0)&L>>>0>N>>>0){N=Vq()|0;f[N>>2]=34;T=+(d|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}N=c+-106|0;s=((N|0)<0)<<31>>31;if((J|0)<(s|0)|(J|0)==(s|0)&L>>>0>>0){N=Vq()|0;f[N>>2]=34;T=+(d|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if((U|0)>-1){G=q;N=U;s=L;H=J;while(1){E=!(G>=.5);o=N<<1|(E^1)&1;F=G+(E?G:G+-1.0);E=Vn(s|0,H|0,-1,-1)|0;D=I;if((o|0)>-1){G=F;N=o;s=E;H=D}else{X=F;Y=o;Z=E;_=D;break}}}else{X=q;Y=U;Z=L;_=J}H=((b|0)<0)<<31>>31;s=Xn(32,0,c|0,((c|0)<0)<<31>>31|0)|0;N=Vn(s|0,I|0,Z|0,_|0)|0;s=I;if((s|0)<(H|0)|(s|0)==(H|0)&N>>>0>>0)if((N|0)>0){$=N;m=59}else{aa=0;ba=84;m=61}else{$=b;m=59}if((m|0)==59)if(($|0)<53){aa=$;ba=84-$|0;m=61}else{ca=0.0;da=$;ea=+(d|0)}if((m|0)==61){G=+(d|0);ca=+rq(+bk(1.0,ba),G);da=aa;ea=G}N=(Y&1|0)==0&(X!=0.0&(da|0)<32);G=(N?0.0:X)*ea+(ca+ea*+((Y+(N&1)|0)>>>0))-ca;if(!(G!=0.0)){N=Vq()|0;f[N>>2]=34}T=+sq(G,Z)}while(0);return +T}function Gc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;g=u;u=u+16|0;h=g+4|0;i=g;if(!(Gh(a,d)|0)){j=0;u=g;return j|0}d=a+84|0;k=f[d>>2]|0;l=a+88|0;m=f[l>>2]|0;if((m|0)!=(k|0))f[l>>2]=m+(~((m+-4-k|0)>>>2)<<2);f[d>>2]=0;f[l>>2]=0;f[a+92>>2]=0;if(k|0)Oq(k);k=a+72|0;l=f[k>>2]|0;d=a+76|0;if((f[d>>2]|0)!=(l|0))f[d>>2]=l;f[k>>2]=0;f[d>>2]=0;f[a+80>>2]=0;if(l|0)Oq(l);l=a+64|0;d=f[l>>2]|0;if((f[d+4>>2]|0)!=(f[d>>2]|0)){k=a+12|0;m=e+84|0;n=e+68|0;o=c+96|0;p=a+24|0;q=0;r=d;do{f[i>>2]=(q>>>0)/3|0;f[h>>2]=f[i>>2];d=_j(r,h)|0;r=f[l>>2]|0;do if(!d){s=f[(f[r+12>>2]|0)+(q<<2)>>2]|0;if((s|0)==-1){t=(f[a>>2]|0)+(q>>>5<<2)|0;f[t>>2]=f[t>>2]|1<<(q&31);t=q+1|0;v=((t>>>0)%3|0|0)==0?q+-2|0:t;if((v|0)==-1)w=-1;else w=f[(f[r>>2]|0)+(v<<2)>>2]|0;v=(f[k>>2]|0)+(w>>>5<<2)|0;f[v>>2]=f[v>>2]|1<<(w&31);v=(((q>>>0)%3|0|0)==0?2:-1)+q|0;if((v|0)==-1)x=-1;else x=f[(f[r>>2]|0)+(v<<2)>>2]|0;v=(f[k>>2]|0)+(x>>>5<<2)|0;f[v>>2]=f[v>>2]|1<<(x&31);break}if(s>>>0>=q>>>0){v=q+1|0;t=((v>>>0)%3|0|0)==0?q+-2|0:v;y=s+(((s>>>0)%3|0|0)==0?2:-1)|0;z=(t|0)==-1;if(!(b[m>>0]|0)){if(z)A=-1;else A=f[(f[o>>2]|0)+(((t|0)/3|0)*12|0)+(((t|0)%3|0)<<2)>>2]|0;B=(y|0)==-1;if(B)C=-1;else C=f[(f[o>>2]|0)+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;D=f[n>>2]|0;if((f[D+(A<<2)>>2]|0)==(f[D+(C<<2)>>2]|0)){E=t+1|0;if(z)F=-1;else F=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){G=y+2|0;break}else{G=y+-1|0;break}else G=-1;while(0);if((F|0)==-1)H=-1;else H=f[(f[o>>2]|0)+(((F|0)/3|0)*12|0)+(((F|0)%3|0)<<2)>>2]|0;if((G|0)==-1)I=-1;else I=f[(f[o>>2]|0)+(((G|0)/3|0)*12|0)+(((G|0)%3|0)<<2)>>2]|0;if((f[D+(H<<2)>>2]|0)==(f[D+(I<<2)>>2]|0))break}}else{if(z)J=-1;else J=f[(f[o>>2]|0)+(((t|0)/3|0)*12|0)+(((t|0)%3|0)<<2)>>2]|0;B=(y|0)==-1;if(B)K=-1;else K=f[(f[o>>2]|0)+(((y|0)/3|0)*12|0)+(((y|0)%3|0)<<2)>>2]|0;if((J|0)==(K|0)){E=t+1|0;if(z)L=-1;else L=((E>>>0)%3|0|0)==0?t+-2|0:E;do if(!B)if(!((y>>>0)%3|0)){M=y+2|0;break}else{M=y+-1|0;break}else M=-1;while(0);if((L|0)==-1)N=-1;else N=f[(f[o>>2]|0)+(((L|0)/3|0)*12|0)+(((L|0)%3|0)<<2)>>2]|0;if((M|0)==-1)O=-1;else O=f[(f[o>>2]|0)+(((M|0)/3|0)*12|0)+(((M|0)%3|0)<<2)>>2]|0;if((N|0)==(O|0))break}}b[p>>0]=0;y=f[a>>2]|0;B=y+(q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(q&31);B=y+(s>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(s&31);B=((v>>>0)%3|0|0)==0?q+-2|0:v;if((B|0)==-1)P=-1;else P=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(P>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(P&31);B=(((q>>>0)%3|0|0)==0?2:-1)+q|0;if((B|0)==-1)Q=-1;else Q=f[(f[r>>2]|0)+(B<<2)>>2]|0;B=(f[k>>2]|0)+(Q>>>5<<2)|0;f[B>>2]=f[B>>2]|1<<(Q&31);B=s+1|0;y=((B>>>0)%3|0|0)==0?s+-2|0:B;if((y|0)==-1)R=-1;else R=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(R>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(R&31);y=(((s>>>0)%3|0|0)==0?2:-1)+s|0;if((y|0)==-1)S=-1;else S=f[(f[r>>2]|0)+(y<<2)>>2]|0;y=(f[k>>2]|0)+(S>>>5<<2)|0;f[y>>2]=f[y>>2]|1<<(S&31)}}while(0);q=q+1|0}while(q>>>0<(f[r+4>>2]|0)-(f[r>>2]|0)>>2>>>0)}if((c|0)!=0&(e|0)!=0){Qc(a,c,e);j=1;u=g;return j|0}else{md(a,0,0);j=1;u=g;return j|0}return 0}function Hc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0;d=u;u=u+32|0;e=d+12|0;g=d+8|0;h=d+4|0;i=d;j=a+8|0;a:do if(f[j>>2]|0?(k=f[a>>2]|0,l=a+4|0,f[a>>2]=l,f[(f[l>>2]|0)+8>>2]=0,f[l>>2]=0,f[j>>2]=0,m=f[k+4>>2]|0,n=(m|0)==0?k:m,n|0):0){m=a+4|0;k=n;n=f[b>>2]|0;while(1){if((n|0)==(f[c>>2]|0))break;o=k+16|0;f[o>>2]=f[n+16>>2];if((k|0)!=(n|0)){f[h>>2]=f[n+20>>2];f[i>>2]=n+24;f[g>>2]=f[h>>2];f[e>>2]=f[i>>2];Oc(k+20|0,g,e)}p=k+8|0;q=f[p>>2]|0;do if(q){r=f[q>>2]|0;if((r|0)==(k|0)){f[q>>2]=0;s=f[q+4>>2]|0;if(!s){t=q;break}else v=s;while(1){s=f[v>>2]|0;if(s|0){v=s;continue}s=f[v+4>>2]|0;if(!s)break;else v=s}t=v;break}else{f[q+4>>2]=0;if(!r){t=q;break}else w=r;while(1){s=f[w>>2]|0;if(s|0){w=s;continue}s=f[w+4>>2]|0;if(!s)break;else w=s}t=w;break}}else t=0;while(0);q=f[l>>2]|0;do if(q){r=f[o>>2]|0;s=q;while(1){if((r|0)<(f[s+16>>2]|0)){x=f[s>>2]|0;if(!x){y=22;break}else z=x}else{A=s+4|0;x=f[A>>2]|0;if(!x){y=25;break}else z=x}s=z}if((y|0)==22){y=0;B=s;C=s;break}else if((y|0)==25){y=0;B=s;C=A;break}}else{B=l;C=l}while(0);f[k>>2]=0;f[k+4>>2]=0;f[p>>2]=B;f[C>>2]=k;q=f[f[a>>2]>>2]|0;if(!q)D=k;else{f[a>>2]=q;D=f[C>>2]|0}Oe(f[m>>2]|0,D);f[j>>2]=(f[j>>2]|0)+1;q=f[n+4>>2]|0;if(!q){o=n+8|0;r=f[o>>2]|0;if((f[r>>2]|0)==(n|0))E=r;else{r=o;do{o=f[r>>2]|0;r=o+8|0;x=f[r>>2]|0}while((f[x>>2]|0)!=(o|0));E=x}}else{r=q;while(1){p=f[r>>2]|0;if(!p)break;else r=p}E=r}f[b>>2]=E;if(!t)break a;else{k=t;n=E}}n=f[k+8>>2]|0;if(!n)F=k;else{m=n;while(1){n=f[m+8>>2]|0;if(!n)break;else m=n}F=m}Oj(a,F)}while(0);F=f[b>>2]|0;E=f[c>>2]|0;if((F|0)==(E|0)){u=d;return}c=a+4|0;t=a+4|0;D=F;while(1){Kg(e,a,D+16|0);F=f[c>>2]|0;do if(F){C=f[e>>2]|0;B=f[C+16>>2]|0;A=F;while(1){if((B|0)<(f[A+16>>2]|0)){z=f[A>>2]|0;if(!z){y=43;break}else G=z}else{H=A+4|0;z=f[H>>2]|0;if(!z){y=46;break}else G=z}A=G}if((y|0)==43){y=0;I=A;J=A;K=C;break}else if((y|0)==46){y=0;I=A;J=H;K=C;break}}else{I=c;J=c;K=f[e>>2]|0}while(0);f[K>>2]=0;f[K+4>>2]=0;f[K+8>>2]=I;f[J>>2]=K;F=f[f[a>>2]>>2]|0;if(!F)L=K;else{f[a>>2]=F;L=f[J>>2]|0}Oe(f[t>>2]|0,L);f[j>>2]=(f[j>>2]|0)+1;F=f[D+4>>2]|0;if(!F){m=D+8|0;B=f[m>>2]|0;if((f[B>>2]|0)==(D|0))M=B;else{B=m;do{m=f[B>>2]|0;B=m+8|0;r=f[B>>2]|0}while((f[r>>2]|0)!=(m|0));M=r}}else{B=F;while(1){r=f[B>>2]|0;if(!r)break;else B=r}M=B}f[b>>2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((y|0)!=-1?(A=f[(f[t>>2]|0)+(y<<2)>>2]|0,(A|0)!=-1):0){y=f[d>>2]|0;B=f[m>>2]|0;C=f[B+(f[y+(A<<2)>>2]<<2)>>2]|0;D=A+1|0;E=((D>>>0)%3|0|0)==0?A+-2|0:D;if((E|0)==-1)F=-1;else F=f[y+(E<<2)>>2]|0;E=f[B+(F<<2)>>2]|0;D=(((A>>>0)%3|0|0)==0?2:-1)+A|0;if((D|0)==-1)G=-1;else G=f[y+(D<<2)>>2]|0;D=f[B+(G<<2)>>2]|0;if((C|0)<(w|0)&(E|0)<(w|0)&(D|0)<(w|0)){B=X(C,e)|0;C=X(E,e)|0;E=X(D,e)|0;if(u){D=0;do{f[h+(D<<2)>>2]=(f[b+(D+E<<2)>>2]|0)+(f[b+(D+C<<2)>>2]|0)-(f[b+(D+B<<2)>>2]|0);D=D+1|0}while((D|0)!=(e|0))}D=b+(z<<2)|0;B=c+(z<<2)|0;C=f[g>>2]|0;if((C|0)>0){E=0;y=h;A=C;while(1){if((A|0)>0){C=0;do{H=f[y+(C<<2)>>2]|0;I=f[n>>2]|0;if((H|0)>(I|0)){J=f[o>>2]|0;f[J+(C<<2)>>2]=I;K=J}else{J=f[p>>2]|0;I=f[o>>2]|0;f[I+(C<<2)>>2]=(H|0)<(J|0)?J:H;K=I}C=C+1|0}while((C|0)<(f[g>>2]|0));L=K}else L=f[o>>2]|0;C=(f[D+(E<<2)>>2]|0)-(f[L+(E<<2)>>2]|0)|0;I=B+(E<<2)|0;f[I>>2]=C;if((C|0)>=(f[q>>2]|0)){if((C|0)>(f[s>>2]|0)){M=C-(f[r>>2]|0)|0;N=42}}else{M=(f[r>>2]|0)+C|0;N=42}if((N|0)==42){N=0;f[I>>2]=M}E=E+1|0;A=f[g>>2]|0;if((E|0)>=(A|0))break;else y=L}}}else N=16}else N=16;if((N|0)==16?(N=0,y=b+(z<<2)|0,A=c+(z<<2)|0,E=f[g>>2]|0,(E|0)>0):0){B=0;D=b+((X(x+-2|0,e)|0)<<2)|0;I=E;while(1){if((I|0)>0){E=0;do{C=f[D+(E<<2)>>2]|0;H=f[n>>2]|0;if((C|0)>(H|0)){J=f[o>>2]|0;f[J+(E<<2)>>2]=H;O=J}else{J=f[p>>2]|0;H=f[o>>2]|0;f[H+(E<<2)>>2]=(C|0)<(J|0)?J:C;O=H}E=E+1|0}while((E|0)<(f[g>>2]|0));P=O}else P=f[o>>2]|0;E=(f[y+(B<<2)>>2]|0)-(f[P+(B<<2)>>2]|0)|0;H=A+(B<<2)|0;f[H>>2]=E;if((E|0)>=(f[q>>2]|0)){if((E|0)>(f[s>>2]|0)){Q=E-(f[r>>2]|0)|0;N=29}}else{Q=(f[r>>2]|0)+E|0;N=29}if((N|0)==29){N=0;f[H>>2]=Q}B=B+1|0;I=f[g>>2]|0;if((B|0)>=(I|0))break;else D=P}}if((x|0)<=2)break a}aq(i)}while(0);if((e|0)>0)sj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(h);return 1}i=a+16|0;P=a+32|0;Q=a+12|0;O=a+28|0;L=a+20|0;M=a+24|0;a=0;K=h;G=e;while(1){if((G|0)>0){e=0;do{F=f[K+(e<<2)>>2]|0;d=f[i>>2]|0;if((F|0)>(d|0)){l=f[P>>2]|0;f[l+(e<<2)>>2]=d;R=l}else{l=f[Q>>2]|0;d=f[P>>2]|0;f[d+(e<<2)>>2]=(F|0)<(l|0)?l:F;R=d}e=e+1|0}while((e|0)<(f[g>>2]|0));S=R}else S=f[P>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[S+(a<<2)>>2]|0)|0;d=c+(a<<2)|0;f[d>>2]=e;if((e|0)>=(f[O>>2]|0)){if((e|0)>(f[M>>2]|0)){T=e-(f[L>>2]|0)|0;N=56}}else{T=(f[L>>2]|0)+e|0;N=56}if((N|0)==56){N=0;f[d>>2]=T}a=a+1|0;G=f[g>>2]|0;if((a|0)>=(G|0))break;else K=S}Mq(h);return 1}function Kc(a,b,c,d,e,g){a=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e)|0;S=X(R,e)|0;if(t){R=0;do{f[n+(R<<2)>>2]=(f[b+(R+S<<2)>>2]|0)+(f[b+(R+Q<<2)>>2]|0)-(f[b+(R+N<<2)>>2]|0);R=R+1|0}while((R|0)!=(e|0));if(t){R=0;do{N=m+(R<<2)|0;f[N>>2]=(f[N>>2]|0)+(f[n+(R<<2)>>2]|0);R=R+1|0}while((R|0)!=(e|0))}}T=L+1|0}else T=L;R=(((M>>>0)%3|0|0)==0?2:-1)+M|0;do if(((R|0)!=-1?(f[s+(R>>>5<<2)>>2]&1<<(R&31)|0)==0:0)?(N=f[(f[(f[D>>2]|0)+12>>2]|0)+(R<<2)>>2]|0,(N|0)!=-1):0)if(!((N>>>0)%3|0)){U=N+2|0;break}else{U=N+-1|0;break}else U=-1;while(0);M=(U|0)==(G|0)?-1:U;if((M|0)==-1)break;else L=T}L=X(I,e)|0;if(!T){V=L;W=28}else{if(t){M=0;do{G=m+(M<<2)|0;f[G>>2]=(f[G>>2]|0)/(T|0)|0;M=M+1|0}while((M|0)!=(e|0))}M=b+(L<<2)|0;G=c+(L<<2)|0;s=f[M+4>>2]|0;R=f[m>>2]|0;N=f[z>>2]|0;f[h>>2]=f[M>>2];f[A>>2]=s;f[i>>2]=R;f[B>>2]=N;Od(d,v,h,i);f[G>>2]=f[d>>2];f[G+4>>2]=f[C>>2]}}else{V=X(I,e)|0;W=28}if((W|0)==28){W=0;G=b+(V<<2)|0;N=b+((X(H+-2|0,e)|0)<<2)|0;R=c+(V<<2)|0;s=f[G+4>>2]|0;M=f[N>>2]|0;Q=f[N+4>>2]|0;f[h>>2]=f[G>>2];f[w>>2]=s;f[i>>2]=M;f[x>>2]=Q;Od(d,v,h,i);f[R>>2]=f[d>>2];f[R+4>>2]=f[y>>2]}if((H|0)<=2)break a;R=f[l>>2]|0;J=f[R>>2]|0;Q=I+-1|0;if((f[R+4>>2]|0)-J>>2>>>0<=Q>>>0){K=R;break}else{R=I;I=Q;H=R}}aq(K)}while(0);if((e|0)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|0)<<2)|0;H=F;while(1){if((H|0)>0){F=0;do{D=f[E+(F<<2)>>2]|0;G=f[n>>2]|0;if((D|0)>(G|0)){I=f[o>>2]|0;f[I+(F<<2)>>2]=G;N=I}else{I=f[p>>2]|0;G=f[o>>2]|0;f[G+(F<<2)>>2]=(D|0)<(I|0)?I:D;N=G}F=F+1|0}while((F|0)<(f[g>>2]|0));O=N}else O=f[o>>2]|0;F=(f[z+(B<<2)>>2]|0)-(f[O+(B<<2)>>2]|0)|0;G=C+(B<<2)|0;f[G>>2]=F;if((F|0)>=(f[q>>2]|0)){if((F|0)>(f[s>>2]|0)){P=F-(f[r>>2]|0)|0;M=26}}else{P=(f[r>>2]|0)+F|0;M=26}if((M|0)==26){M=0;f[G>>2]=P}B=B+1|0;H=f[g>>2]|0;if((B|0)>=(H|0))break;else E=O}}if((y|0)<=2)break a}aq(i)}while(0);if((e|0)>0)sj(h|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(h);return 1}i=a+16|0;O=a+32|0;P=a+12|0;N=a+28|0;K=a+20|0;L=a+24|0;a=0;J=h;d=e;while(1){if((d|0)>0){e=0;do{l=f[J+(e<<2)>>2]|0;j=f[i>>2]|0;if((l|0)>(j|0)){k=f[O>>2]|0;f[k+(e<<2)>>2]=j;Q=k}else{k=f[P>>2]|0;j=f[O>>2]|0;f[j+(e<<2)>>2]=(l|0)<(k|0)?k:l;Q=j}e=e+1|0}while((e|0)<(f[g>>2]|0));R=Q}else R=f[O>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[R+(a<<2)>>2]|0)|0;j=c+(a<<2)|0;f[j>>2]=e;if((e|0)>=(f[N>>2]|0)){if((e|0)>(f[L>>2]|0)){S=e-(f[K>>2]|0)|0;M=53}}else{S=(f[K>>2]|0)+e|0;M=53}if((M|0)==53){M=0;f[j>>2]=S}a=a+1|0;d=f[g>>2]|0;if((a|0)>=(d|0))break;else J=R}Mq(h);return 1}function Mc(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0;h=u;u=u+48|0;i=h+28|0;j=h+24|0;k=h;l=h+12|0;m=h+40|0;if((c|0)<0){n=0;u=h;return n|0}if(!c){n=1;u=h;return n|0}o=(d|0)>1;p=o?d:1;f[k>>2]=0;d=k+4|0;f[d>>2]=0;f[k+8>>2]=0;gk(k,c);q=k+8|0;if(o){o=0;r=0;while(1){s=1;t=f[a+(r<<2)>>2]|0;do{v=f[a+(s+r<<2)>>2]|0;t=t>>>0>>0?v:t;s=s+1|0}while((s|0)!=(p|0));s=(_(t|0)|0)^31;v=t>>>0>o>>>0?t:o;w=(t|0)==0?1:s+1|0;f[i>>2]=w;s=f[d>>2]|0;if(s>>>0<(f[q>>2]|0)>>>0){f[s>>2]=w;f[d>>2]=s+4}else Ri(k,i);r=r+p|0;if((r|0)>=(c|0)){x=v;break}else o=v}}else{o=0;r=0;while(1){v=f[a+(o<<2)>>2]|0;s=(_(v|0)|0)^31;w=v>>>0>r>>>0?v:r;y=(v|0)==0?1:s+1|0;f[i>>2]=y;s=f[d>>2]|0;if(s>>>0<(f[q>>2]|0)>>>0){f[s>>2]=y;f[d>>2]=s+4}else Ri(k,i);o=o+p|0;if((o|0)>=(c|0)){x=w;break}else r=w}}f[l>>2]=0;r=l+4|0;f[r>>2]=0;f[l+8>>2]=0;o=f[k>>2]|0;q=(f[d>>2]|0)-o|0;w=q>>2;if(w){if(w>>>0>1073741823)aq(l);s=ln(q)|0;f[r>>2]=s;f[l>>2]=s;f[l+8>>2]=s+(w<<2);w=s;if((q|0)>0){y=s+(q>>>2<<2)|0;kh(s|0,o|0,q|0)|0;f[r>>2]=y;q=y-w>>2;if((y|0)==(s|0)){z=q;A=s;B=0;C=0}else{y=0;o=0;v=0;while(1){D=Vn(o|0,v|0,f[s+(y<<2)>>2]|0,0)|0;E=I;y=y+1|0;if(y>>>0>=q>>>0){z=q;A=s;B=D;C=E;break}else{o=D;v=E}}}}else{F=w;G=18}}else{F=0;G=18}if((G|0)==18){z=0;A=F;B=0;C=0}F=Jg(A,z,32,i)|0;z=I;A=f[i>>2]<<3;w=Tn(A|0,((A|0)<0)<<31>>31|0,1)|0;A=I;v=un(B|0,C|0,p|0,0)|0;C=Vn(F|0,z|0,v|0,I|0)|0;v=Vn(C|0,I|0,w|0,A|0)|0;A=I;w=f[l>>2]|0;if(w|0){l=f[r>>2]|0;if((l|0)!=(w|0))f[r>>2]=l+(~((l+-4-w|0)>>>2)<<2);Oq(w)}w=Jg(a,c,x,i)|0;l=f[i>>2]|0;r=((x-l|0)/64|0)+l<<3;C=l<<3;z=Vn(w|0,I|0,C|0,((C|0)<0)<<31>>31|0)|0;C=Vn(z|0,I|0,r|0,((r|0)<0)<<31>>31|0)|0;r=I;z=(_((x>>>0>1?x:1)|0)|0)^30;if(e){f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;w=ln(32)|0;f[i>>2]=w;f[i+8>>2]=-2147483616;f[i+4>>2]=22;F=w;B=15964;o=F+22|0;do{b[F>>0]=b[B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=(Jh(e,i)|0)==0;if((b[i+11>>0]|0)<0)Oq(f[i>>2]|0);if(!w){f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;w=ln(32)|0;f[i>>2]=w;f[i+8>>2]=-2147483616;f[i+4>>2]=22;F=w;B=15964;o=F+22|0;do{b[F>>0]=b[B>>0]|0;F=F+1|0;B=B+1|0}while((F|0)<(o|0));b[w+22>>0]=0;w=Mk(e,i)|0;if((b[i+11>>0]|0)<0)Oq(f[i>>2]|0);H=w}else G=32}else G=32;if((G|0)==32)H=z>>>0<18&((A|0)>(r|0)|(A|0)==(r|0)&v>>>0>=C>>>0)&1;b[m>>0]=H;C=g+16|0;v=f[C+4>>2]|0;if(!((v|0)>0|(v|0)==0&(f[C>>2]|0)>>>0>0)){f[j>>2]=f[g+4>>2];f[i>>2]=f[j>>2];Me(g,i,m,m+1|0)|0}switch(H|0){case 0:{J=td(a,c,p,k,g)|0;break}case 1:{J=Tc(a,c,x,l,e,g)|0;break}default:J=0}g=f[k>>2]|0;if(g|0){k=f[d>>2]|0;if((k|0)!=(g|0))f[d>>2]=k+(~((k+-4-g|0)>>>2)<<2);Oq(g)}n=J;u=h;return n|0}function Nc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;if((b|0)<0)return;c=a+12|0;d=f[c>>2]|0;e=f[a+8>>2]|0;g=e;h=d;if(d-e>>2>>>0<=b>>>0)return;e=g+(b<<2)|0;d=f[(f[e>>2]|0)+56>>2]|0;i=f[(f[g+(b<<2)>>2]|0)+60>>2]|0;g=e+4|0;if((g|0)!=(h|0)){j=g;g=e;do{k=f[j>>2]|0;f[j>>2]=0;l=f[g>>2]|0;f[g>>2]=k;if(l|0){k=l+88|0;m=f[k>>2]|0;f[k>>2]=0;if(m|0){k=f[m+8>>2]|0;if(k|0){n=m+12|0;if((f[n>>2]|0)!=(k|0))f[n>>2]=k;Oq(k)}Oq(m)}m=f[l+68>>2]|0;if(m|0){k=l+72|0;n=f[k>>2]|0;if((n|0)!=(m|0))f[k>>2]=n+(~((n+-4-m|0)>>>2)<<2);Oq(m)}m=l+64|0;n=f[m>>2]|0;f[m>>2]=0;if(n|0){m=f[n>>2]|0;if(m|0){k=n+4|0;if((f[k>>2]|0)!=(m|0))f[k>>2]=m;Oq(m)}Oq(n)}Oq(l)}j=j+4|0;g=g+4|0}while((j|0)!=(h|0));j=f[c>>2]|0;if((j|0)!=(g|0)){o=g;p=j;q=24}}else{o=e;p=h;q=24}if((q|0)==24){q=p;do{p=q+-4|0;f[c>>2]=p;h=f[p>>2]|0;f[p>>2]=0;if(h|0){p=h+88|0;e=f[p>>2]|0;f[p>>2]=0;if(e|0){p=f[e+8>>2]|0;if(p|0){j=e+12|0;if((f[j>>2]|0)!=(p|0))f[j>>2]=p;Oq(p)}Oq(e)}e=f[h+68>>2]|0;if(e|0){p=h+72|0;j=f[p>>2]|0;if((j|0)!=(e|0))f[p>>2]=j+(~((j+-4-e|0)>>>2)<<2);Oq(e)}e=h+64|0;j=f[e>>2]|0;f[e>>2]=0;if(j|0){e=f[j>>2]|0;if(e|0){p=j+4|0;if((f[p>>2]|0)!=(e|0))f[p>>2]=e;Oq(e)}Oq(j)}Oq(h)}q=f[c>>2]|0}while((q|0)!=(o|0))}o=f[a+4>>2]|0;a:do if(o|0){q=o+44|0;c=f[q>>2]|0;h=f[o+40>>2]|0;while(1){if((h|0)==(c|0))break a;r=h+4|0;if((f[(f[h>>2]|0)+40>>2]|0)==(i|0))break;else h=r}if((r|0)!=(c|0)){j=r;e=h;do{p=f[j>>2]|0;f[j>>2]=0;g=f[e>>2]|0;f[e>>2]=p;if(g|0){bj(g);Oq(g)}j=j+4|0;e=e+4|0}while((j|0)!=(c|0));j=f[q>>2]|0;if((j|0)==(e|0))break;else{s=e;t=j}}else{s=h;t=c}j=t;do{g=j+-4|0;f[q>>2]=g;p=f[g>>2]|0;f[g>>2]=0;if(p|0){bj(p);Oq(p)}j=f[q>>2]|0}while((j|0)!=(s|0))}while(0);b:do if((d|0)<5){s=f[a+20+(d*12|0)>>2]|0;t=a+20+(d*12|0)+4|0;r=f[t>>2]|0;i=r;c:do if((s|0)==(r|0))u=s;else{o=s;while(1){if((f[o>>2]|0)==(b|0)){u=o;break c}o=o+4|0;if((o|0)==(r|0))break b}}while(0);if((u|0)!=(r|0)){s=u+4|0;o=i-s|0;j=o>>2;if(!j)v=r;else{im(u|0,s|0,o|0)|0;v=f[t>>2]|0}o=u+(j<<2)|0;if((v|0)!=(o|0))f[t>>2]=v+(~((v+-4-o|0)>>>2)<<2)}}while(0);v=f[a+24>>2]|0;u=f[a+20>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+36>>2]|0;u=f[a+32>>2]|0;d=u;if((o|0)!=(u|0)){j=o-u>>2;u=0;do{o=d+(u<<2)|0;v=f[o>>2]|0;if((v|0)>(b|0))f[o>>2]=v+-1;u=u+1|0}while(u>>>0>>0)}j=f[a+48>>2]|0;u=f[a+44>>2]|0;d=u;if((j|0)!=(u|0)){v=j-u>>2;u=0;do{j=d+(u<<2)|0;o=f[j>>2]|0;if((o|0)>(b|0))f[j>>2]=o+-1;u=u+1|0}while(u>>>0>>0)}v=f[a+60>>2]|0;u=f[a+56>>2]|0;d=u;if((v|0)!=(u|0)){o=v-u>>2;u=0;do{v=d+(u<<2)|0;j=f[v>>2]|0;if((j|0)>(b|0))f[v>>2]=j+-1;u=u+1|0}while(u>>>0>>0)}o=f[a+72>>2]|0;u=f[a+68>>2]|0;a=u;if((o|0)==(u|0))return;d=o-u>>2;u=0;do{o=a+(u<<2)|0;j=f[o>>2]|0;if((j|0)>(b|0))f[o>>2]=j+-1;u=u+1|0}while(u>>>0>>0);return}function Oc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;e=a+8|0;a:do if(f[e>>2]|0?(g=f[a>>2]|0,h=a+4|0,f[a>>2]=h,f[(f[h>>2]|0)+8>>2]=0,f[h>>2]=0,f[e>>2]=0,i=f[g+4>>2]|0,j=(i|0)==0?g:i,j|0):0){i=a+4|0;g=j;j=f[c>>2]|0;while(1){if((j|0)==(f[d>>2]|0))break;k=g+16|0;am(k,j+16|0)|0;am(g+28|0,j+28|0)|0;l=g+8|0;m=f[l>>2]|0;do if(m){n=f[m>>2]|0;if((n|0)==(g|0)){f[m>>2]=0;o=f[m+4>>2]|0;if(!o){p=m;break}else q=o;while(1){o=f[q>>2]|0;if(o|0){q=o;continue}o=f[q+4>>2]|0;if(!o)break;else q=o}p=q;break}else{f[m+4>>2]=0;if(!n){p=m;break}else r=n;while(1){o=f[r>>2]|0;if(o|0){r=o;continue}o=f[r+4>>2]|0;if(!o)break;else r=o}p=r;break}}else p=0;while(0);m=f[h>>2]|0;do if(m){n=b[k+11>>0]|0;o=n<<24>>24<0;s=o?f[g+20>>2]|0:n&255;n=o?f[k>>2]|0:k;o=m;while(1){t=o+16|0;u=b[t+11>>0]|0;v=u<<24>>24<0;w=v?f[o+20>>2]|0:u&255;u=w>>>0>>0?w:s;if((u|0)!=0?(x=Vk(n,v?f[t>>2]|0:t,u)|0,(x|0)!=0):0)if((x|0)<0)y=22;else y=24;else if(s>>>0>>0)y=22;else y=24;if((y|0)==22){y=0;w=f[o>>2]|0;if(!w){y=23;break}else z=w}else if((y|0)==24){y=0;A=o+4|0;w=f[A>>2]|0;if(!w){y=26;break}else z=w}o=z}if((y|0)==23){y=0;B=o;C=o;break}else if((y|0)==26){y=0;B=A;C=o;break}}else{B=h;C=h}while(0);f[g>>2]=0;f[g+4>>2]=0;f[l>>2]=C;f[B>>2]=g;m=f[f[a>>2]>>2]|0;if(!m)D=g;else{f[a>>2]=m;D=f[B>>2]|0}Oe(f[i>>2]|0,D);f[e>>2]=(f[e>>2]|0)+1;m=f[j+4>>2]|0;if(!m){k=j+8|0;s=f[k>>2]|0;if((f[s>>2]|0)==(j|0))E=s;else{s=k;do{k=f[s>>2]|0;s=k+8|0;n=f[s>>2]|0}while((f[n>>2]|0)!=(k|0));E=n}}else{s=m;while(1){l=f[s>>2]|0;if(!l)break;else s=l}E=s}f[c>>2]=E;if(!p)break a;else{g=p;j=E}}j=f[g+8>>2]|0;if(!j)F=g;else{i=j;while(1){j=f[i+8>>2]|0;if(!j)break;else i=j}F=i}Ej(a,F)}while(0);F=f[c>>2]|0;E=f[d>>2]|0;if((F|0)==(E|0))return;else G=F;while(1){bf(a,G+16|0)|0;F=f[G+4>>2]|0;if(!F){d=G+8|0;p=f[d>>2]|0;if((f[p>>2]|0)==(G|0))H=p;else{p=d;do{d=f[p>>2]|0;p=d+8|0;e=f[p>>2]|0}while((f[e>>2]|0)!=(d|0));H=e}}else{p=F;while(1){i=f[p>>2]|0;if(!i)break;else p=i}H=p}f[c>>2]=H;if((H|0)==(E|0))break;else G=H}return}function Pc(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;b=u;u=u+32|0;c=b+4|0;d=b;e=a+16|0;g=f[e>>2]|0;if(g>>>0>112){f[e>>2]=g+-113;g=a+4|0;e=f[g>>2]|0;h=f[e>>2]|0;i=e+4|0;f[g>>2]=i;e=a+8|0;j=f[e>>2]|0;k=a+12|0;l=f[k>>2]|0;m=l;do if((j|0)==(l|0)){n=f[a>>2]|0;o=n;if(i>>>0>n>>>0){p=i;q=((p-o>>2)+1|0)/-2|0;r=i+(q<<2)|0;s=j-p|0;p=s>>2;if(!p)t=i;else{im(r|0,i|0,s|0)|0;t=f[g>>2]|0}s=r+(p<<2)|0;f[e>>2]=s;f[g>>2]=t+(q<<2);v=s;break}s=m-o>>1;o=(s|0)==0?1:s;if(o>>>0>1073741823){s=ra(8)|0;Oo(s,16035);f[s>>2]=7256;va(s|0,1112,110)}s=ln(o<<2)|0;q=s;p=s+(o>>>2<<2)|0;r=p;w=s+(o<<2)|0;if((i|0)==(j|0)){x=r;y=n}else{n=p;p=r;o=i;do{f[n>>2]=f[o>>2];n=p+4|0;p=n;o=o+4|0}while((o|0)!=(j|0));x=p;y=f[a>>2]|0}f[a>>2]=q;f[g>>2]=r;f[e>>2]=x;f[k>>2]=w;if(!y)v=x;else{Oq(y);v=f[e>>2]|0}}else v=j;while(0);f[v>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}e=a+8|0;h=f[e>>2]|0;v=a+4|0;j=h-(f[v>>2]|0)|0;y=a+12|0;x=f[y>>2]|0;k=x-(f[a>>2]|0)|0;if(j>>>0>=k>>>0){g=k>>1;k=(g|0)==0?1:g;f[c+12>>2]=0;f[c+16>>2]=a+12;if(k>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}g=ln(k<<2)|0;f[c>>2]=g;i=g+(j>>2<<2)|0;j=c+8|0;f[j>>2]=i;m=c+4|0;f[m>>2]=i;i=c+12|0;f[i>>2]=g+(k<<2);k=ln(4068)|0;f[d>>2]=k;Ag(c,d);d=f[e>>2]|0;while(1){z=f[v>>2]|0;if((d|0)==(z|0))break;k=d+-4|0;ug(c,k);d=k}k=z;z=f[a>>2]|0;f[a>>2]=f[c>>2];f[c>>2]=z;f[v>>2]=f[m>>2];f[m>>2]=k;m=f[e>>2]|0;f[e>>2]=f[j>>2];f[j>>2]=m;g=f[y>>2]|0;f[y>>2]=f[i>>2];f[i>>2]=g;g=m;if((d|0)!=(g|0))f[j>>2]=g+(~((g+-4-k|0)>>>2)<<2);if(z|0)Oq(z);u=b;return}if((x|0)!=(h|0)){h=ln(4068)|0;f[c>>2]=h;Ag(a,c);u=b;return}h=ln(4068)|0;f[c>>2]=h;ug(a,c);c=f[v>>2]|0;h=f[c>>2]|0;x=c+4|0;f[v>>2]=x;c=f[e>>2]|0;z=f[y>>2]|0;k=z;do if((c|0)==(z|0)){g=f[a>>2]|0;j=g;if(x>>>0>g>>>0){d=x;m=((d-j>>2)+1|0)/-2|0;i=x+(m<<2)|0;t=c-d|0;d=t>>2;if(!d)A=x;else{im(i|0,x|0,t|0)|0;A=f[v>>2]|0}t=i+(d<<2)|0;f[e>>2]=t;f[v>>2]=A+(m<<2);B=t;break}t=k-j>>1;j=(t|0)==0?1:t;if(j>>>0>1073741823){t=ra(8)|0;Oo(t,16035);f[t>>2]=7256;va(t|0,1112,110)}t=ln(j<<2)|0;m=t;d=t+(j>>>2<<2)|0;i=d;l=t+(j<<2)|0;if((x|0)==(c|0)){C=i;D=g}else{g=d;d=i;j=x;do{f[g>>2]=f[j>>2];g=d+4|0;d=g;j=j+4|0}while((j|0)!=(c|0));C=d;D=f[a>>2]|0}f[a>>2]=m;f[v>>2]=i;f[e>>2]=C;f[y>>2]=l;if(!D)B=C;else{Oq(D);B=f[e>>2]|0}}else B=c;while(0);f[B>>2]=h;f[e>>2]=(f[e>>2]|0)+4;u=b;return}function Qc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;e=u;u=u+16|0;g=e+8|0;h=e+4|0;i=e;j=a+64|0;k=f[j>>2]|0;if((f[k+28>>2]|0)==(f[k+24>>2]|0)){u=e;return}l=c+96|0;c=a+52|0;m=d+84|0;n=d+68|0;d=a+56|0;o=a+60|0;p=a+12|0;q=a+28|0;r=a+40|0;s=a+44|0;t=a+48|0;v=0;w=0;x=k;while(1){k=f[(f[x+24>>2]|0)+(w<<2)>>2]|0;if((k|0)==-1){y=v;z=x}else{A=v+1|0;B=f[(f[l>>2]|0)+(((k|0)/3|0)*12|0)+(((k|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))C=f[(f[n>>2]|0)+(B<<2)>>2]|0;else C=B;f[g>>2]=C;B=f[d>>2]|0;if(B>>>0<(f[o>>2]|0)>>>0){f[B>>2]=C;f[d>>2]=B+4}else Ri(c,g);f[g>>2]=k;f[h>>2]=0;a:do if(!(f[(f[p>>2]|0)+(w>>>5<<2)>>2]&1<<(w&31)))D=k;else{B=k+1|0;E=((B>>>0)%3|0|0)==0?k+-2|0:B;if(((E|0)!=-1?(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)==0:0)?(B=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0,E=B+1|0,(B|0)!=-1):0){F=((E>>>0)%3|0|0)==0?B+-2|0:E;f[h>>2]=F;if((F|0)==-1){D=k;break}else G=F;while(1){f[g>>2]=G;F=G+1|0;E=((F>>>0)%3|0|0)==0?G+-2|0:F;if((E|0)==-1)break;if(f[(f[a>>2]|0)+(E>>>5<<2)>>2]&1<<(E&31)|0)break;F=f[(f[(f[j>>2]|0)+12>>2]|0)+(E<<2)>>2]|0;E=F+1|0;if((F|0)==-1)break;B=((E>>>0)%3|0|0)==0?F+-2|0:E;f[h>>2]=B;if((B|0)==-1){D=G;break a}else G=B}f[h>>2]=-1;D=G;break}f[h>>2]=-1;D=k}while(0);f[(f[q>>2]|0)+(D<<2)>>2]=v;k=f[s>>2]|0;if((k|0)==(f[t>>2]|0))Ri(r,g);else{f[k>>2]=f[g>>2];f[s>>2]=k+4}k=f[j>>2]|0;B=f[g>>2]|0;b:do if(((B|0)!=-1?(E=(((B>>>0)%3|0|0)==0?2:-1)+B|0,(E|0)!=-1):0)?(F=f[(f[k+12>>2]|0)+(E<<2)>>2]|0,(F|0)!=-1):0){E=F+(((F>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=E;if((E|0)!=-1&(E|0)!=(B|0)){F=A;H=v;I=E;while(1){E=I+1|0;J=((E>>>0)%3|0|0)==0?I+-2|0:E;do if(f[(f[a>>2]|0)+(J>>>5<<2)>>2]&1<<(J&31)){E=F+1|0;K=f[(f[l>>2]|0)+(((I|0)/3|0)*12|0)+(((I|0)%3|0)<<2)>>2]|0;if(!(b[m>>0]|0))L=f[(f[n>>2]|0)+(K<<2)>>2]|0;else L=K;f[i>>2]=L;K=f[d>>2]|0;if(K>>>0<(f[o>>2]|0)>>>0){f[K>>2]=L;f[d>>2]=K+4}else Ri(c,i);K=f[s>>2]|0;if((K|0)==(f[t>>2]|0)){Ri(r,h);M=E;N=F;break}else{f[K>>2]=f[h>>2];f[s>>2]=K+4;M=E;N=F;break}}else{M=F;N=H}while(0);f[(f[q>>2]|0)+(f[h>>2]<<2)>>2]=N;O=f[j>>2]|0;J=f[h>>2]|0;if((J|0)==-1)break;E=(((J>>>0)%3|0|0)==0?2:-1)+J|0;if((E|0)==-1)break;J=f[(f[O+12>>2]|0)+(E<<2)>>2]|0;if((J|0)==-1)break;I=J+(((J>>>0)%3|0|0)==0?2:-1)|0;f[h>>2]=I;if(!((I|0)!=-1?(I|0)!=(f[g>>2]|0):0)){P=M;Q=O;break b}else{F=M;H=N}}f[h>>2]=-1;P=M;Q=O}else{P=A;Q=k}}else R=28;while(0);if((R|0)==28){R=0;f[h>>2]=-1;P=A;Q=k}y=P;z=Q}w=w+1|0;if(w>>>0>=(f[z+28>>2]|0)-(f[z+24>>2]|0)>>2>>>0)break;else{v=y;x=z}}u=e;return}function Rc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,D=0,E=0,F=0;switch(c|0){case 0:{e=-149;g=24;i=4;break}case 1:{e=-1074;g=53;i=4;break}case 2:{e=-1074;g=53;i=4;break}default:j=0.0}a:do if((i|0)==4){c=a+4|0;k=a+100|0;do{l=f[c>>2]|0;if(l>>>0<(f[k>>2]|0)>>>0){f[c>>2]=l+1;m=h[l>>0]|0}else m=Si(a)|0}while((eq(m)|0)!=0);b:do switch(m|0){case 43:case 45:{l=1-(((m|0)==45&1)<<1)|0;n=f[c>>2]|0;if(n>>>0<(f[k>>2]|0)>>>0){f[c>>2]=n+1;o=h[n>>0]|0;p=l;break b}else{o=Si(a)|0;p=l;break b}break}default:{o=m;p=1}}while(0);l=0;n=o;while(1){if((n|32|0)!=(b[18546+l>>0]|0)){q=l;r=n;break}do if(l>>>0<7){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;t=h[s>>0]|0;break}else{t=Si(a)|0;break}}else t=n;while(0);s=l+1|0;if(s>>>0<8){l=s;n=t}else{q=s;r=t;break}}c:do switch(q|0){case 8:break;case 3:{i=23;break}default:{n=(d|0)!=0;if(n&q>>>0>3)if((q|0)==8)break c;else{i=23;break c}d:do if(!q){l=0;s=r;while(1){if((s|32|0)!=(b[18555+l>>0]|0)){u=l;v=s;break d}do if(l>>>0<2){w=f[c>>2]|0;if(w>>>0<(f[k>>2]|0)>>>0){f[c>>2]=w+1;x=h[w>>0]|0;break}else{x=Si(a)|0;break}}else x=s;while(0);w=l+1|0;if(w>>>0<3){l=w;s=x}else{u=w;v=x;break}}}else{u=q;v=r}while(0);switch(u|0){case 3:{s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;y=h[s>>0]|0}else y=Si(a)|0;if((y|0)==40)z=1;else{if(!(f[k>>2]|0)){j=B;break a}f[c>>2]=(f[c>>2]|0)+-1;j=B;break a}while(1){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;A=h[s>>0]|0}else A=Si(a)|0;if(!((A+-48|0)>>>0<10|(A+-65|0)>>>0<26)?!((A|0)==95|(A+-97|0)>>>0<26):0)break;z=z+1|0}if((A|0)==41){j=B;break a}s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!n){l=Vq()|0;f[l>>2]=22;Ym(a,0);j=0.0;break a}if(!z){j=B;break a}else D=z;while(1){D=D+-1|0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if(!D){j=B;break a}}break}case 0:{if((v|0)==48){s=f[c>>2]|0;if(s>>>0<(f[k>>2]|0)>>>0){f[c>>2]=s+1;E=h[s>>0]|0}else E=Si(a)|0;if((E|32|0)==120){j=+Fc(a,g,e,p,d);break a}if(!(f[k>>2]|0))F=48;else{f[c>>2]=(f[c>>2]|0)+-1;F=48}}else F=v;j=+nb(a,F,g,e,p,d);break a;break}default:{if(f[k>>2]|0)f[c>>2]=(f[c>>2]|0)+-1;s=Vq()|0;f[s>>2]=22;Ym(a,0);j=0.0;break a}}}}while(0);if((i|0)==23){s=(f[k>>2]|0)==0;if(!s)f[c>>2]=(f[c>>2]|0)+-1;if((d|0)!=0&q>>>0>3){n=q;do{if(!s)f[c>>2]=(f[c>>2]|0)+-1;n=n+-1|0}while(n>>>0>3)}}j=+$($(p|0)*$(C))}while(0);return +j}function Sc(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;g=u;u=u+16|0;h=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;i=ln(16)|0;f[h>>2]=i;f[h+8>>2]=-2147483632;f[h+4>>2]=15;j=i;k=14479;l=j+15|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+15>>0]=0;i=Hk(c,h,-1)|0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);switch(i|0){case 0:{m=ln(52)|0;j=m;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(m);n=4044;o=m;break}case -1:{if((mi(c)|0)==10){m=ln(52)|0;j=m;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(m);n=4044;o=m}else p=6;break}default:p=6}a:do if((p|0)==6){m=d+8|0;q=d+12|0;r=f[q>>2]|0;s=f[m>>2]|0;b:do if((r-s|0)>0){t=h+8|0;v=h+4|0;w=c+16|0;x=h+11|0;y=0;z=s;A=r;c:while(1){B=f[(f[z+(y<<2)>>2]|0)+28>>2]|0;switch(B|0){case 9:{p=12;break}case 6:case 5:case 4:case 2:{C=z;D=A;break}default:{if((B|2|0)!=3)break c;if((B|0)==9)p=12;else{C=z;D=A}}}if((p|0)==12){p=0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;B=ln(32)|0;f[h>>2]=B;f[t>>2]=-2147483616;f[v>>2]=17;j=B;k=14495;l=j+17|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[B+17>>0]=0;E=f[w>>2]|0;if(E){F=w;G=E;d:while(1){E=G;while(1){if((f[E+16>>2]|0)>=0)break;H=f[E+4>>2]|0;if(!H){I=F;break d}else E=H}G=f[E>>2]|0;if(!G){I=E;break}else F=E}if(((I|0)!=(w|0)?(f[I+16>>2]|0)<=0:0)?(F=I+20|0,(Jh(F,h)|0)!=0):0)J=Hk(F,h,-1)|0;else p=21}else p=21;if((p|0)==21){p=0;J=Hk(c,h,-1)|0}if((b[x>>0]|0)<0)Oq(f[h>>2]|0);if((J|0)<1)break;C=f[m>>2]|0;D=f[q>>2]|0}y=y+1|0;if((y|0)>=(D-C>>2|0))break b;else{z=C;A=D}}if((i|0)!=1){A=ln(52)|0;j=A;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(A);n=4044;o=A;break a}f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;z=ln(32)|0;f[h>>2]=z;f[h+8>>2]=-2147483616;f[h+4>>2]=24;j=z;k=14513;l=j+24|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[z+24>>0]=0;f[a>>2]=-1;pj(a+4|0,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}while(0);q=ln(52)|0;j=q;l=j+52|0;do{f[j>>2]=0;j=j+4|0}while((j|0)<(l|0));Zn(q);n=3988;o=q}while(0);f[o>>2]=n;ip(o,d);Md(a,o,c,e);Va[f[(f[o>>2]|0)+4>>2]&127](o);u=g;return}function Tc(a,c,d,e,g,h){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;i=u;u=u+32|0;j=i+4|0;k=i;l=i+16|0;m=(_(e|0)|0)^31;if((e|0)>0)if(m>>>0>17){n=0;u=i;return n|0}else o=m+1|0;else o=1;do if(g){m=ln(48)|0;f[j>>2]=m;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=m;p=15987;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[m+33>>0]=0;r=(Jh(g,j)|0)==0;if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);if(!r){r=ln(48)|0;f[j>>2]=r;f[j+8>>2]=-2147483600;f[j+4>>2]=33;e=r;p=15987;q=e+33|0;do{b[e>>0]=b[p>>0]|0;e=e+1|0;p=p+1|0}while((e|0)<(q|0));b[r+33>>0]=0;p=Mk(g,j)|0;if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);if((p|0)<4){s=o+-2|0;break}if((p|0)<6){s=o+-1|0;break}if((p|0)>9){s=o+2|0;break}else{s=o+((p|0)>7&1)|0;break}}else s=o}else s=o;while(0);o=(s|0)>1?s:1;s=(o|0)<18?o:18;b[l>>0]=s;o=h+16|0;g=f[o+4>>2]|0;if(!((g|0)>0|(g|0)==0&(f[o>>2]|0)>>>0>0)){f[k>>2]=f[h+4>>2];f[j>>2]=f[k>>2];Me(h,j,l,l+1|0)|0}do switch(s&31){case 1:case 0:{n=ue(a,c,d,h)|0;u=i;return n|0}case 2:{n=te(a,c,d,h)|0;u=i;return n|0}case 3:{n=se(a,c,d,h)|0;u=i;return n|0}case 4:{n=re(a,c,d,h)|0;u=i;return n|0}case 5:{n=qe(a,c,d,h)|0;u=i;return n|0}case 6:{n=pe(a,c,d,h)|0;u=i;return n|0}case 7:{n=oe(a,c,d,h)|0;u=i;return n|0}case 8:{n=ne(a,c,d,h)|0;u=i;return n|0}case 9:{n=me(a,c,d,h)|0;u=i;return n|0}case 10:{n=le(a,c,d,h)|0;u=i;return n|0}case 11:{n=ke(a,c,d,h)|0;u=i;return n|0}case 12:{n=ie(a,c,d,h)|0;u=i;return n|0}case 13:{n=he(a,c,d,h)|0;u=i;return n|0}case 14:{n=ge(a,c,d,h)|0;u=i;return n|0}case 15:{n=fe(a,c,d,h)|0;u=i;return n|0}case 16:{n=ee(a,c,d,h)|0;u=i;return n|0}case 17:{n=de(a,c,d,h)|0;u=i;return n|0}case 18:{n=ce(a,c,d,h)|0;u=i;return n|0}default:{n=0;u=i;return n|0}}while(0);return 0}function Uc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;xb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Vc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;yb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Wc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;zb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Xc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ab(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Yc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*1048576.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==1048576){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Fb(z,A,g);a:do if((x|0)<1048576){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=1048576-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>1048576;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-1048576|0;m=x;while(1){v=1048576.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==1048576){C=p;D=1048576;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=1048576){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*9.5367431640625e-07)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function Zc(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*524288.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==524288){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Bb(z,A,g);a:do if((x|0)<524288){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=524288-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>524288;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-524288|0;m=x;while(1){v=524288.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==524288){C=p;D=524288;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=524288){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*1.9073486328125e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function _c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*262144.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==262144){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Cb(z,A,g);a:do if((x|0)<262144){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=262144-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>262144;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-262144|0;m=x;while(1){v=262144.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==262144){C=p;D=262144;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=262144){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*3.814697265625e-06)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function $c(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*65536.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==65536){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Db(z,A,g);a:do if((x|0)<65536){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=65536-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>65536;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-65536|0;m=x;while(1){v=65536.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==65536){C=p;D=65536;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=65536){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.0000152587890625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function ad(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*32768.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==32768){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Eb(z,A,g);a:do if((x|0)<32768){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=32768-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>32768;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-32768|0;m=x;while(1){v=32768.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==32768){C=p;D=32768;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=32768){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000030517578125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function bd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*8192.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==8192){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Gb(z,A,g);a:do if((x|0)<8192){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=8192-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>8192;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-8192|0;m=x;while(1){v=8192.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==8192){C=p;D=8192;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=8192){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.0001220703125)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function cd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Hb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function dd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ib(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function ed(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Jb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function fd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Kb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function gd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Lb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function hd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Mb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function id(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Nb(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function jd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0;e=u;u=u+16|0;g=e;h=e+4|0;if((c|0)>0){i=0;j=0;k=0;l=0;while(1){m=b+(j<<3)|0;n=f[m>>2]|0;o=f[m+4>>2]|0;m=Vn(n|0,o|0,k|0,l|0)|0;p=I;q=(n|0)==0&(o|0)==0?i:j;j=j+1|0;if((j|0)==(c|0)){r=q;s=p;t=m;break}else{i=q;k=m;l=p}}}else{r=0;s=0;t=0}l=r+1|0;f[a+12>>2]=l;k=a+4|0;i=f[k>>2]|0;c=f[a>>2]|0;j=i-c>>3;p=c;c=i;if(l>>>0<=j>>>0){if(l>>>0>>0?(i=p+(l<<3)|0,(i|0)!=(c|0)):0)f[k>>2]=c+(~((c+-8-i|0)>>>3)<<3)}else wh(a,l-j|0);v=+(t>>>0)+4294967296.0*+(s>>>0);s=(r|0)<0;if(!s){t=f[a>>2]|0;j=0;i=0;do{c=b+(i<<3)|0;k=f[c>>2]|0;p=f[c+4>>2]|0;c=~~((+(k>>>0)+4294967296.0*+(p>>>0))/v*4096.0+.5)>>>0;m=((k|0)!=0|(p|0)!=0)&(c|0)==0?1:c;f[t+(i<<3)>>2]=m;j=m+j|0;i=i+1|0}while((i|0)!=(l|0));if((j|0)==4096){if(s){w=0;u=e;return w|0}}else{x=j;y=12}}else{x=0;y=12}if((y|0)==12){f[h>>2]=0;j=h+4|0;f[j>>2]=0;f[h+8>>2]=0;do if(l)if(l>>>0>1073741823)aq(h);else{i=l<<2;t=ln(i)|0;f[h>>2]=t;m=t+(l<<2)|0;f[h+8>>2]=m;sj(t|0,0,i|0)|0;f[j>>2]=m;z=t;A=m;break}else{z=0;A=0}while(0);if(!s?(f[z>>2]=0,r|0):0){m=1;do{f[z+(m<<2)>>2]=m;m=m+1|0}while((m|0)!=(l|0))}f[g>>2]=a;Ob(z,A,g);a:do if((x|0)<4096){g=(f[a>>2]|0)+(f[(f[j>>2]|0)+-4>>2]<<3)|0;f[g>>2]=4096-x+(f[g>>2]|0);B=0}else{g=f[h>>2]|0;if((r|0)<=0){A=(x|0)>4096;while(1)if(!A){B=0;break a}}A=f[a>>2]|0;z=x+-4096|0;m=x;while(1){v=4096.0/+(m|0);t=r;i=z;c=m;while(1){p=A+(f[g+(t<<2)>>2]<<3)|0;k=f[p>>2]|0;if(k>>>0<2){y=28;break}q=k-~~+J(+(v*+(k>>>0)))|0;o=(q|0)==0?1:q;q=(o|0)<(k|0)?o:k+-1|0;o=(q|0)>(i|0)?i:q;f[p>>2]=k-o;k=c-o|0;p=i-o|0;if((k|0)==4096){C=p;D=4096;break}if((t|0)>1){t=t+-1|0;i=p;c=k}else{C=p;D=k;break}}if((y|0)==28){y=0;if((t|0)==(r|0)){B=1;break a}else{C=i;D=c}}if((C|0)>0){z=C;m=D}else{B=0;break}}}while(0);D=f[h>>2]|0;if(D|0){h=f[j>>2]|0;if((h|0)!=(D|0))f[j>>2]=h+(~((h+-4-D|0)>>>2)<<2);Oq(D)}if((B|0)!=0|s){w=0;u=e;return w|0}}B=f[a>>2]|0;D=0;h=0;do{f[B+(D<<3)+4>>2]=h;h=(f[B+(D<<3)>>2]|0)+h|0;D=D+1|0}while((D|0)!=(l|0));if((h|0)!=4096){w=0;u=e;return w|0}if(s)E=0.0;else{s=f[a>>2]|0;h=0;v=0.0;while(1){D=f[s+(h<<3)>>2]|0;if(!D)F=v;else{B=b+(h<<3)|0;G=+((f[B>>2]|0)>>>0)+4294967296.0*+((f[B+4>>2]|0)>>>0);F=v+ +Zg(+(D>>>0)*.000244140625)*G}h=h+1|0;if((h|0)==(l|0)){E=F;break}else v=F}}F=+W(+-E);l=+K(F)>=1.0?(F>0.0?~~+Y(+J(F/4294967296.0),4294967295.0)>>>0:~~+W((F-+(~~F>>>0))/4294967296.0)>>>0):0;h=a+16|0;f[h>>2]=~~F>>>0;f[h+4>>2]=l;w=Le(a,d)|0;u=e;return w|0}function kd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0;g=u;u=u+32|0;d=g+16|0;h=g+8|0;i=g;j=e>>>0>1073741823?-1:e<<2;k=Lq(j)|0;sj(k|0,0,j|0)|0;j=f[a+28>>2]|0;l=a+36|0;m=f[l>>2]|0;n=f[m+4>>2]|0;o=f[m>>2]|0;p=n-o|0;a:do if((p|0)>4){q=p>>2;r=f[a+32>>2]|0;s=a+8|0;t=h+4|0;v=i+4|0;w=d+4|0;x=j+12|0;y=(e|0)>0;z=k+4|0;A=h+4|0;B=i+4|0;C=d+4|0;D=q+-1|0;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f[i>>2]=p;f[i+8>>2]=p+j;q=j;j=p;do{b[j>>0]=0;j=(f[l>>2]|0)+1|0;f[l>>2]=j;q=q+-1|0}while((q|0)!=0);o=f[i>>2]|0}q=a+28|0;j=(f[q>>2]|0)+-1|0;a:do if((j|0)>-1){p=a+24|0;r=j;s=4096;t=0;v=k;while(1){w=(f[p>>2]&1<>>0>>0){y=t;z=s}else{b[o+t>>0]=s;y=t+1|0;z=s>>>8}un(f[4092+(x<<3)>>2]|0,0,z|0,0)|0;A=z+(w?0:0-v&255)+(X((z+I|0)>>>(f[4092+(x<<3)+4>>2]|0),256-x|0)|0)|0;x=r+-1|0;if((x|0)<=-1){B=A;C=y;break a}r=x;s=A;t=y;v=b[h>>0]|0}}else{B=4096;C=0}while(0);y=f[m>>2]|0;if((f[n>>2]|0)==(y|0)){D=B;E=C}else{z=B;B=C;C=y;while(1){C=C+-4|0;y=f[C>>2]|0;k=31;j=z;v=B;while(1){t=b[h>>0]|0;s=(1<>>0>>0){F=v;G=j}else{b[o+v>>0]=j;F=v+1|0;G=j>>>8}un(f[4092+(r<<3)>>2]|0,0,G|0,0)|0;j=G+(s?0:0-t&255)+(X((G+I|0)>>>(f[4092+(r<<3)+4>>2]|0),256-r|0)|0)|0;if((k|0)<=0)break;else{k=k+-1|0;v=F}}if((f[n>>2]|0)==(C|0)){D=j;E=F;break}else{z=j;B=F}}}F=D+-4096|0;do if(F>>>0>=64){if(F>>>0<16384){B=o+E|0;z=D+12288|0;b[B>>0]=z;H=2;J=z>>>8;K=B+1|0;L=25;break}if(F>>>0<4194304){B=o+E|0;z=D+8384512|0;b[B>>0]=z;b[B+1>>0]=z>>>8;H=3;J=z>>>16;K=B+2|0;L=25}else M=E}else{H=1;J=F;K=o+E|0;L=25}while(0);if((L|0)==25){b[K>>0]=J;M=H+E|0}E=c+16|0;H=E;J=f[H+4>>2]|0;if(!((J|0)>0|(J|0)==0&(f[H>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f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z>>>0)%3|0|0)==0?x+-2|0:z;f[e>>2]=A;if((A|0)==-1){y=h;break}else B=A;while(1){f[d>>2]=B;A=B+1|0;z=((A>>>0)%3|0|0)==0?B+-2|0:A;if((z|0)==-1)break;if(f[(f[a>>2]|0)+(z>>>5<<2)>>2]&1<<(z&31)|0)break;A=f[(f[(f[g>>2]|0)+12>>2]|0)+(z<<2)>>2]|0;z=A+1|0;if((A|0)==-1)break;x=((z>>>0)%3|0|0)==0?A+-2|0:z;f[e>>2]=x;if((x|0)==-1){y=B;break a}else B=x}f[e>>2]=-1;y=B;break}f[e>>2]=-1;y=h}while(0);f[(f[m>>2]|0)+(y<<2)>>2]=f[b>>2];h=f[o>>2]|0;if((h|0)==(f[p>>2]|0))Ri(n,d);else{f[h>>2]=f[d>>2];f[o>>2]=h+4}h=f[g>>2]|0;x=f[d>>2]|0;b:do if(((x|0)!=-1?(z=(((x>>>0)%3|0|0)==0?2:-1)+x|0,(z|0)!=-1):0)?(A=f[(f[h+12>>2]|0)+(z<<2)>>2]|0,(A|0)!=-1):0){z=A+(((A>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=z;if((z|0)!=-1&(z|0)!=(x|0)){A=w;C=z;while(1){z=C+1|0;D=((z>>>0)%3|0|0)==0?C+-2|0:z;do if(f[(f[a>>2]|0)+(D>>>5<<2)>>2]&1<<(D&31)){z=A+1|0;f[b>>2]=A;E=f[j>>2]|0;if((E|0)==(f[k>>2]|0))Ri(i,b);else{f[E>>2]=A;f[j>>2]=E+4}E=f[o>>2]|0;if((E|0)==(f[p>>2]|0)){Ri(n,e);F=z;break}else{f[E>>2]=f[e>>2];f[o>>2]=E+4;F=z;break}}else F=A;while(0);f[(f[m>>2]|0)+(f[e>>2]<<2)>>2]=f[b>>2];G=f[g>>2]|0;D=f[e>>2]|0;if((D|0)==-1)break;z=(((D>>>0)%3|0|0)==0?2:-1)+D|0;if((z|0)==-1)break;D=f[(f[G+12>>2]|0)+(z<<2)>>2]|0;if((D|0)==-1)break;C=D+(((D>>>0)%3|0|0)==0?2:-1)|0;f[e>>2]=C;if(!((C|0)!=-1?(C|0)!=(f[d>>2]|0):0)){H=F;I=G;break b}else A=F}f[e>>2]=-1;H=F;I=G}else{H=w;I=h}}else J=26;while(0);if((J|0)==26){J=0;f[e>>2]=-1;H=w;I=h}t=H;v=I}r=r+1|0;if(r>>>0>=(f[v+28>>2]|0)-(f[v+24>>2]|0)>>2>>>0)break;else{q=t;s=v}}u=c;return}function nd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;h=a+124|0;f[h>>2]=(f[h>>2]|0)+1;h=a+88|0;i=a+120|0;j=f[i>>2]|0;k=j+1|0;do if((j|0)!=-1){l=((k>>>0)%3|0|0)==0?j+-2|0:k;if(!((j>>>0)%3|0)){m=j+2|0;n=l;break}else{m=j+-1|0;n=l;break}}else{m=-1;n=-1}while(0);k=a+104|0;l=a+92|0;o=f[l>>2]|0;p=o+(n<<2)|0;q=f[k>>2]|0;r=q+(f[p>>2]<<2)|0;s=f[r>>2]|0;switch(b|0){case 1:case 0:{f[r>>2]=s+-1;r=q+(f[o+(m<<2)>>2]<<2)|0;f[r>>2]=(f[r>>2]|0)+-1;if((b|0)==1){if((m|0)!=-1?(r=f[(f[(f[h>>2]|0)+12>>2]|0)+(m<<2)>>2]|0,(r|0)!=-1):0){t=a+64|0;v=1;w=r;while(1){r=f[t>>2]|0;x=f[(f[r>>2]|0)+36>>2]|0;f[e>>2]=(w>>>0)/3|0;f[d>>2]=f[e>>2];if(Ra[x&127](r,d)|0){y=v;break}r=w+1|0;x=((r>>>0)%3|0|0)==0?w+-2|0:r;if((x|0)==-1){z=12;break}w=f[(f[(f[h>>2]|0)+12>>2]|0)+(x<<2)>>2]|0;x=v+1|0;if((w|0)==-1){y=x;break}else v=x}if((z|0)==12)y=v+1|0;A=y;B=f[k>>2]|0;C=f[l>>2]|0}else{A=1;B=q;C=o}f[B+(f[C+(f[i>>2]<<2)>>2]<<2)>>2]=A;A=a+108|0;i=f[A>>2]|0;C=i-B>>2;B=i;if((n|0)!=-1?(i=f[(f[(f[h>>2]|0)+12>>2]|0)+(n<<2)>>2]|0,(i|0)!=-1):0){n=a+64|0;y=1;v=i;while(1){i=f[n>>2]|0;w=f[(f[i>>2]|0)+36>>2]|0;f[g>>2]=(v>>>0)/3|0;f[d>>2]=f[g>>2];if(Ra[w&127](i,d)|0){D=y;break}i=v+1|0;f[(f[l>>2]|0)+((((i>>>0)%3|0|0)==0?v+-2|0:i)<<2)>>2]=C;i=(((v>>>0)%3|0|0)==0?2:-1)+v|0;if((i|0)==-1){z=20;break}v=f[(f[(f[h>>2]|0)+12>>2]|0)+(i<<2)>>2]|0;i=y+1|0;if((v|0)==-1){D=i;break}else y=i}if((z|0)==20)D=y+1|0;E=D;F=f[A>>2]|0}else{E=1;F=B}f[d>>2]=E;if(F>>>0<(f[a+112>>2]|0)>>>0){f[F>>2]=E;f[A>>2]=F+4}else Ri(k,d)}break}case 5:{k=q+(f[o+(j<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1;k=q+(f[p>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1;k=q+(f[o+(m<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-2;break}case 3:{k=q+(f[o+(j<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1;k=q+(f[p>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-2;k=q+(f[o+(m<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-1;break}case 7:{k=q+(f[o+(j<<2)>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-2;k=q+(f[p>>2]<<2)|0;f[k>>2]=(f[k>>2]|0)+-2;k=q+(f[o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=_;Mq(k);u=g;return 1}sj(k|0,0,e<<2|0)|0;O=a+8|0;P=b+4|0;Q=f[b>>2]|0;R=f[P>>2]|0;S=k+4|0;T=f[k>>2]|0;U=f[S>>2]|0;f[h>>2]=Q;V=h+4|0;f[V>>2]=R;f[i>>2]=T;W=i+4|0;f[W>>2]=U;Od(d,O,h,i);Y=f[d>>2]|0;f[c>>2]=Y;Z=d+4|0;_=f[Z>>2]|0;$=c+4|0;f[$>>2]=_;Mq(k);u=g;return 1}function pd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0;switch(c|0){case 1:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2076;i=c;f[a>>2]=i;return}case 2:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2132;i=c;f[a>>2]=i;return}case 4:{c=ln(168)|0;Ti(c,d,e,g);i=c;f[a>>2]=i;return}case 3:{c=ln(88)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2188;h=c+60|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(104)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2244;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(140)|0;f[c>>2]=1544;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2300;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=2356;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function qd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0;switch(c|0){case 1:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1656;i=c;f[a>>2]=i;return}case 2:{c=ln(60)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1712;i=c;f[a>>2]=i;return}case 4:{c=ln(168)|0;Ui(c,d,e,g);i=c;f[a>>2]=i;return}case 3:{c=ln(88)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1768;h=c+60|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(104)|0;f[c>>2]=1544;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[h+16>>2]=f[e+16>>2];f[h+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);h=c+44|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=1824;f[c+60>>2]=0;f[c+64>>2]=0;f[c+76>>2]=0;f[c+80>>2]=0;f[c+84>>2]=0;h=c+88|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(140)|0;f[c>>2]=1544;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];f[d+16>>2]=f[e+16>>2];f[d+20>>2]=f[e+20>>2];fk(c+32|0,e+24|0);e=c+44|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=1880;f[c+64>>2]=0;f[c+68>>2]=0;e=c+72|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+60>>2]=1936;f[c+88>>2]=1;g=c+92|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+108|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function rd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+2|0;v=e+12|0;w=q+6|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=d[q>>1]|0;A=e;B=x;while(1){C=B+8|0;if(z<<16>>16!=(d[C>>1]|0)){y=A;break d}if((d[u>>1]|0)!=(d[C+2>>1]|0)){y=A;break d}if((d[v>>1]|0)!=(d[B+12>>1]|0)){y=A;break d}if((d[w>>1]|0)!=(d[C+6>>1]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=c;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(b>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+2|0;u=e+12|0;x=w+6|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=d[w>>1]|0;B=e;z=q;while(1){D=z+8|0;if(A<<16>>16!=(d[D>>1]|0)){G=B;break e}if((d[v>>1]|0)!=(d[D+2>>1]|0)){G=B;break e}if((d[u>>1]|0)!=(d[z+12>>1]|0)){G=B;break e}if((d[x>>1]|0)!=(d[D+6>>1]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);c=f[p>>2]|0;if(!c){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function sd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=q+3|0;x=f[e>>2]|0;d:do if(!x)y=e;else{z=b[q>>0]|0;A=e;B=x;while(1){C=B+8|0;if(z<<24>>24!=(b[C>>0]|0)){y=A;break d}if((b[u>>0]|0)!=(b[C+1>>0]|0)){y=A;break d}if((b[v>>0]|0)!=(b[C+2>>0]|0)){y=A;break d}if((b[w>>0]|0)!=(b[C+3>>0]|0)){y=A;break d}C=f[B>>2]|0;if(!C){y=B;break}else{D=B;B=C;A=D}}}while(0);f[j>>2]=f[y>>2];f[y>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}else{e=d;while(1){w=f[e+4>>2]|0;if(w>>>0>>0)F=w;else F=(w>>>0)%(c>>>0)|0;if((F|0)==(k|0)){p=e;break c}w=(f[a>>2]|0)+(F<<2)|0;if(!(f[w>>2]|0)){r=e;s=F;t=w;break b}w=e+8|0;v=w+1|0;u=w+2|0;x=w+3|0;q=f[e>>2]|0;e:do if(!q)G=e;else{A=b[w>>0]|0;B=e;z=q;while(1){D=z+8|0;if(A<<24>>24!=(b[D>>0]|0)){G=B;break e}if((b[v>>0]|0)!=(b[D+1>>0]|0)){G=B;break e}if((b[u>>0]|0)!=(b[D+2>>0]|0)){G=B;break e}if((b[x>>0]|0)!=(b[D+3>>0]|0)){G=B;break e}D=f[z>>2]|0;if(!D){G=z;break}else{C=z;z=D;B=C}}}while(0);f[j>>2]=f[G>>2];f[G>>2]=f[f[(f[a>>2]|0)+(F<<2)>>2]>>2];f[f[(f[a>>2]|0)+(F<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){E=43;break a}}}while(0);d=f[p>>2]|0;if(!d){E=43;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){E=43;break}else{k=s;l=r;n=r}}if((E|0)==43)return}function td(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0;i=u;u=u+352|0;j=i+340|0;k=i+336|0;l=i+80|0;m=i+48|0;n=i;sj(l|0,0,256)|0;o=f[e+4>>2]|0;p=f[e>>2]|0;q=p;if((o|0)!=(p|0)){r=o-p>>2;p=0;do{o=l+(f[q+(p<<2)>>2]<<3)|0;s=o;t=Vn(f[s>>2]|0,f[s+4>>2]|0,1,0)|0;s=o;f[s>>2]=t;f[s+4>>2]=I;p=p+1|0}while(p>>>0>>0)}Gn(m);r=Tn(c|0,((c|0)<0)<<31>>31|0,5)|0;p=I;q=n+40|0;s=q;f[s>>2]=0;f[s+4>>2]=0;f[n>>2]=0;f[n+4>>2]=0;f[n+8>>2]=0;f[n+12>>2]=0;f[n+16>>2]=0;f[n+20>>2]=0;fd(n,l,32,g)|0;l=n+16|0;s=Tn(f[l>>2]|0,f[l+4>>2]|0,1)|0;l=g+4|0;t=(f[l>>2]|0)-(f[g>>2]|0)|0;o=q;f[o>>2]=t;f[o+4>>2]=0;o=Vn(s|0,I|0,39,0)|0;s=Yn(o|0,I|0,3)|0;o=Vn(s|0,I|0,8,0)|0;s=Vn(o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0))f[v>>2]=n+(~((n+-8-o|0)>>>3)<<3);Oq(o)}o=m+12|0;n=f[o>>2]|0;f[o>>2]=0;if(n|0)Oq(n);n=f[m>>2]|0;if(!n){u=i;return 1}if((f[d>>2]|0)!=(n|0))f[d>>2]=n;Oq(n);u=i;return 1}function ud(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=d+20|0;v=f[d>>2]|0;d:do if(!v)w=d;else{x=f[d+8>>2]|0;y=d;z=v;while(1){if((x|0)!=(f[z+8>>2]|0)){w=y;break d}if((f[p>>2]|0)!=(f[z+12>>2]|0)){w=y;break d}if((f[t>>2]|0)!=(f[z+16>>2]|0)){w=y;break d}if((f[u>>2]|0)!=(f[z+20>>2]|0)){w=y;break d}A=f[z>>2]|0;if(!A){w=z;break}else{B=z;z=A;y=B}}}while(0);f[i>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}else{d=c;while(1){u=f[d+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(j|0)){o=d;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){q=d;r=D;s=u;break b}u=d+12|0;t=d+16|0;p=d+20|0;v=f[d>>2]|0;e:do if(!v)E=d;else{y=f[d+8>>2]|0;z=d;x=v;while(1){if((y|0)!=(f[x+8>>2]|0)){E=z;break e}if((f[u>>2]|0)!=(f[x+12>>2]|0)){E=z;break e}if((f[t>>2]|0)!=(f[x+16>>2]|0)){E=z;break e}if((f[p>>2]|0)!=(f[x+20>>2]|0)){E=z;break e}B=f[x>>2]|0;if(!B){E=x;break}else{A=x;x=B;z=A}}}while(0);f[i>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){C=43;break a}}}while(0);c=f[o>>2]|0;if(!c){C=43;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){C=43;break}else{j=r;k=q;m=q}}if((C|0)==43)return}function vd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=e+12|0;v=f[e>>2]|0;d:do if(!v)w=e;else{x=d[q>>1]|0;y=q+2|0;z=e;A=v;while(1){B=A+8|0;if(x<<16>>16!=(d[B>>1]|0)){w=z;break d}if((d[y>>1]|0)!=(d[B+2>>1]|0)){w=z;break d}if((d[u>>1]|0)!=(d[A+12>>1]|0)){w=z;break d}B=f[A>>2]|0;if(!B){w=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[w>>2];f[w>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)E=u;else E=(u>>>0)%(b>>>0)|0;if((E|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(E<<2)|0;if(!(f[u>>2]|0)){r=e;s=E;t=u;break b}u=e+8|0;v=e+12|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=d[u>>1]|0;A=u+2|0;y=e;x=q;while(1){C=x+8|0;if(z<<16>>16!=(d[C>>1]|0)){F=y;break e}if((d[A>>1]|0)!=(d[C+2>>1]|0)){F=y;break e}if((d[v>>1]|0)!=(d[x+12>>1]|0)){F=y;break e}C=f[x>>2]|0;if(!C){F=x;break}else{B=x;x=C;y=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);c=f[p>>2]|0;if(!c){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function wd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=q+1|0;v=q+2|0;w=f[e>>2]|0;d:do if(!w)x=e;else{y=b[q>>0]|0;z=e;A=w;while(1){B=A+8|0;if(y<<24>>24!=(b[B>>0]|0)){x=z;break d}if((b[u>>0]|0)!=(b[B+1>>0]|0)){x=z;break d}if((b[v>>0]|0)!=(b[B+2>>0]|0)){x=z;break d}B=f[A>>2]|0;if(!B){x=A;break}else{C=A;A=B;z=C}}}while(0);f[j>>2]=f[x>>2];f[x>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}else{e=d;while(1){v=f[e+4>>2]|0;if(v>>>0>>0)E=v;else E=(v>>>0)%(c>>>0)|0;if((E|0)==(k|0)){p=e;break c}v=(f[a>>2]|0)+(E<<2)|0;if(!(f[v>>2]|0)){r=e;s=E;t=v;break b}v=e+8|0;u=v+1|0;w=v+2|0;q=f[e>>2]|0;e:do if(!q)F=e;else{z=b[v>>0]|0;A=e;y=q;while(1){C=y+8|0;if(z<<24>>24!=(b[C>>0]|0)){F=A;break e}if((b[u>>0]|0)!=(b[C+1>>0]|0)){F=A;break e}if((b[w>>0]|0)!=(b[C+2>>0]|0)){F=A;break e}C=f[y>>2]|0;if(!C){F=y;break}else{B=y;y=C;A=B}}}while(0);f[j>>2]=f[F>>2];f[F>>2]=f[f[(f[a>>2]|0)+(E<<2)>>2]>>2];f[f[(f[a>>2]|0)+(E<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){D=41;break a}}}while(0);d=f[p>>2]|0;if(!d){D=41;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){D=41;break}else{k=s;l=r;n=r}}if((D|0)==41)return}function xd(a,b){a=+a;b=+b;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0.0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s>>2]|0;g=f[s+4>>2]|0;h=Yn(c|0,d|0,52)|0;i=h&2047;h=Yn(e|0,g|0,52)|0;j=h&2047;h=d&-2147483648;k=Tn(e|0,g|0,1)|0;l=I;a:do if(!((k|0)==0&(l|0)==0)?(m=yo(b)|0,n=I&2147483647,!((i|0)==2047|(n>>>0>2146435072|(n|0)==2146435072&m>>>0>0))):0){m=Tn(c|0,d|0,1)|0;n=I;if(!(n>>>0>l>>>0|(n|0)==(l|0)&m>>>0>k>>>0))return +((m|0)==(k|0)&(n|0)==(l|0)?a*0.0:a);if(!i){n=Tn(c|0,d|0,12)|0;m=I;if((m|0)>-1|(m|0)==-1&n>>>0>4294967295){o=0;q=n;n=m;while(1){m=o+-1|0;q=Tn(q|0,n|0,1)|0;n=I;if(!((n|0)>-1|(n|0)==-1&q>>>0>4294967295)){r=m;break}else o=m}}else r=0;o=Tn(c|0,d|0,1-r|0)|0;t=r;u=o;v=I}else{t=i;u=c;v=d&1048575|1048576}if(!j){o=Tn(e|0,g|0,12)|0;q=I;if((q|0)>-1|(q|0)==-1&o>>>0>4294967295){n=0;m=o;o=q;while(1){q=n+-1|0;m=Tn(m|0,o|0,1)|0;o=I;if(!((o|0)>-1|(o|0)==-1&m>>>0>4294967295)){w=q;break}else n=q}}else w=0;n=Tn(e|0,g|0,1-w|0)|0;x=w;y=n;z=I}else{x=j;y=e;z=g&1048575|1048576}n=Xn(u|0,v|0,y|0,z|0)|0;m=I;o=(m|0)>-1|(m|0)==-1&n>>>0>4294967295;b:do if((t|0)>(x|0)){q=t;A=m;B=o;C=u;D=v;E=n;while(1){if(B)if((E|0)==0&(A|0)==0)break;else{F=E;G=A}else{F=C;G=D}H=Tn(F|0,G|0,1)|0;J=I;K=q+-1|0;L=Xn(H|0,J|0,y|0,z|0)|0;M=I;N=(M|0)>-1|(M|0)==-1&L>>>0>4294967295;if((K|0)>(x|0)){q=K;A=M;B=N;C=H;D=J;E=L}else{O=K;P=N;Q=L;R=M;S=H;T=J;break b}}U=a*0.0;break a}else{O=t;P=o;Q=n;R=m;S=u;T=v}while(0);if(P)if((Q|0)==0&(R|0)==0){U=a*0.0;break}else{V=R;W=Q}else{V=T;W=S}if(V>>>0<1048576|(V|0)==1048576&W>>>0<0){m=O;n=W;o=V;while(1){E=Tn(n|0,o|0,1)|0;D=I;C=m+-1|0;if(D>>>0<1048576|(D|0)==1048576&E>>>0<0){m=C;n=E;o=D}else{X=C;Y=E;Z=D;break}}}else{X=O;Y=W;Z=V}if((X|0)>0){o=Vn(Y|0,Z|0,0,-1048576)|0;n=I;m=Tn(X|0,0,52)|0;_=n|I;$=o|m}else{m=Yn(Y|0,Z|0,1-X|0)|0;_=I;$=m}f[s>>2]=$;f[s+4>>2]=_|h;U=+p[s>>3]}else aa=3;while(0);if((aa|0)==3){ba=a*b;U=ba/ba}return +U}function yd(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;d=u;u=u+32|0;e=d+8|0;g=d;h=c+4|0;i=f[(f[h>>2]|0)+48>>2]|0;j=c+12|0;c=f[j>>2]|0;k=ln(32)|0;f[e>>2]=k;f[e+8>>2]=-2147483616;f[e+4>>2]=17;l=k;m=14495;n=l+17|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[k+17>>0]=0;k=i+16|0;m=f[k>>2]|0;if(m){l=k;n=m;a:while(1){m=n;while(1){if((f[m+16>>2]|0)>=(c|0))break;o=f[m+4>>2]|0;if(!o){p=l;break a}else m=o}n=f[m>>2]|0;if(!n){p=m;break}else l=m}if(((p|0)!=(k|0)?(c|0)>=(f[p+16>>2]|0):0)?(c=p+20|0,(Jh(c,e)|0)!=0):0)q=Hk(c,e,-1)|0;else r=10}else r=10;if((r|0)==10)q=Hk(i,e,-1)|0;if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);f[e>>2]=-1;f[e+4>>2]=-1;f[e+8>>2]=-1;f[e+12>>2]=-1;i=(_((1<>>0<=28){f[e>>2]=i+1;q=2<>2]=q+-1;i=q+-2|0;f[e+8>>2]=i;f[e+12>>2]=(i|0)/2|0}switch(Xi(f[j>>2]|0,f[h>>2]|0)|0){case 6:{i=f[j>>2]|0;q=f[h>>2]|0;c=f[(f[(f[q+4>>2]|0)+8>>2]|0)+(i<<2)>>2]|0;do if((Qa[f[(f[q>>2]|0)+8>>2]&127](q)|0)==1){Hf(g,q,6,i,e,514);p=f[g>>2]|0;if(!p){f[g>>2]=0;s=g;r=21;break}else{t=g;v=p;break}}else{s=g;r=21}while(0);if((r|0)==21){i=ln(24)|0;f[i+4>>2]=c;c=i+8|0;f[c>>2]=f[e>>2];f[c+4>>2]=f[e+4>>2];f[c+8>>2]=f[e+8>>2];f[c+12>>2]=f[e+12>>2];f[i>>2]=2560;c=i;f[g>>2]=c;t=s;v=c}f[a>>2]=v;f[t>>2]=0;u=d;return}case 0:{t=f[j>>2]|0;j=f[h>>2]|0;h=f[(f[(f[j+4>>2]|0)+8>>2]|0)+(t<<2)>>2]|0;do if((Qa[f[(f[j>>2]|0)+8>>2]&127](j)|0)==1){Hf(g,j,0,t,e,514);v=f[g>>2]|0;if(!v){f[g>>2]=0;w=g;r=28;break}else{x=g;y=v;break}}else{w=g;r=28}while(0);if((r|0)==28){r=ln(24)|0;f[r+4>>2]=h;h=r+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];f[r>>2]=2560;e=r;f[g>>2]=e;x=w;y=e}f[a>>2]=y;f[x>>2]=0;u=d;return}default:{f[a>>2]=0;u=d;return}}}function zd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=d+16|0;u=f[d>>2]|0;d:do if(!u)v=d;else{w=f[d+8>>2]|0;x=d;y=u;while(1){if((w|0)!=(f[y+8>>2]|0)){v=x;break d}if((f[p>>2]|0)!=(f[y+12>>2]|0)){v=x;break d}if((f[t>>2]|0)!=(f[y+16>>2]|0)){v=x;break d}z=f[y>>2]|0;if(!z){v=y;break}else{A=y;y=z;x=A}}}while(0);f[i>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}else{d=c;while(1){t=f[d+4>>2]|0;if(t>>>0>>0)C=t;else C=(t>>>0)%(b>>>0)|0;if((C|0)==(j|0)){o=d;break c}t=(f[a>>2]|0)+(C<<2)|0;if(!(f[t>>2]|0)){q=d;r=C;s=t;break b}t=d+12|0;p=d+16|0;u=f[d>>2]|0;e:do if(!u)D=d;else{x=f[d+8>>2]|0;y=d;w=u;while(1){if((x|0)!=(f[w+8>>2]|0)){D=y;break e}if((f[t>>2]|0)!=(f[w+12>>2]|0)){D=y;break e}if((f[p>>2]|0)!=(f[w+16>>2]|0)){D=y;break e}A=f[w>>2]|0;if(!A){D=w;break}else{z=w;w=A;y=z}}}while(0);f[i>>2]=f[D>>2];f[D>>2]=f[f[(f[a>>2]|0)+(C<<2)>>2]>>2];f[f[(f[a>>2]|0)+(C<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){B=41;break a}}}while(0);c=f[o>>2]|0;if(!c){B=41;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){B=41;break}else{j=r;k=q;m=q}}if((B|0)==41)return}function Ad(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2980;i=c;f[a>>2]=i;return}case 2:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3036;i=c;f[a>>2]=i;return}case 4:{c=ln(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3092;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Zm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 3:{c=ln(68)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3148;h=c+40|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=3204;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=3260;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=3316;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Bd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){o=d;while(1){e=f[o+4>>2]|0;if(!i)if(e>>>0>>0)p=e;else p=(e>>>0)%(c>>>0)|0;else p=e&h;if((p|0)==(k|0))break;q=(f[a>>2]|0)+(p<<2)|0;if(!(f[q>>2]|0))break b;e=f[o>>2]|0;c:do if(!e)r=o;else{s=o+8|0;t=b[s+11>>0]|0;u=t<<24>>24<0;v=t&255;t=u?f[o+12>>2]|0:v;w=(t|0)==0;if(u){u=o;x=e;while(1){y=x+8|0;z=b[y+11>>0]|0;A=z<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:z&255)|0)){r=u;break c}if(!w?Vk(f[s>>2]|0,A?f[y>>2]|0:y,t)|0:0){r=u;break c}y=f[x>>2]|0;if(!y){r=x;break c}else{A=x;x=y;u=A}}}if(w){u=o;x=e;while(1){A=b[x+8+11>>0]|0;if((A<<24>>24<0?f[x+12>>2]|0:A&255)|0){r=u;break c}A=f[x>>2]|0;if(!A){r=x;break c}else{y=x;x=A;u=y}}}u=o;x=e;while(1){w=x+8|0;y=b[w+11>>0]|0;A=y<<24>>24<0;if((t|0)!=((A?f[x+12>>2]|0:y&255)|0)){r=u;break c}y=A?f[w>>2]|0:w;if((b[y>>0]|0)==(f[s>>2]&255)<<24>>24){B=s;C=v;D=y}else{r=u;break c}while(1){C=C+-1|0;B=B+1|0;if(!C)break;D=D+1|0;if((b[B>>0]|0)!=(b[D>>0]|0)){r=u;break c}}y=f[x>>2]|0;if(!y){r=x;break}else{w=x;x=y;u=w}}}while(0);f[j>>2]=f[r>>2];f[r>>2]=f[f[(f[a>>2]|0)+(p<<2)>>2]>>2];f[f[(f[a>>2]|0)+(p<<2)>>2]>>2]=o;e=f[g>>2]|0;if(!e){E=43;break a}else o=e}d=f[o>>2]|0;if(!d){E=43;break a}else{g=o;j=o}}f[q>>2]=j;m=f[o>>2]|0;if(!m){E=43;break}else{k=p;l=o;n=o}}if((E|0)==43)return}function Cd(a,b,c,d,e,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;var i=0,j=0;switch(c|0){case 1:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2616;i=c;f[a>>2]=i;return}case 2:{c=ln(40)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2672;i=c;f[a>>2]=i;return}case 4:{c=ln(152)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2728;h=c+96|0;b=c+40|0;j=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));Zm(h);f[c+136>>2]=0;f[c+140>>2]=0;f[c+144>>2]=0;i=c;f[a>>2]=i;return}case 3:{c=ln(68)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2784;h=c+40|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;f[h+12>>2]=0;f[h+16>>2]=0;f[h+20>>2]=0;f[h+24>>2]=0;i=c;f[a>>2]=i;return}case 5:{c=ln(84)|0;f[c+4>>2]=d;h=c+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[h+12>>2]=f[e+12>>2];h=c+24|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];f[c>>2]=2840;f[c+40>>2]=0;f[c+44>>2]=0;f[c+56>>2]=0;f[c+60>>2]=0;f[c+64>>2]=0;h=c+68|0;f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];f[h+12>>2]=f[g+12>>2];i=c;f[a>>2]=i;return}case 6:{c=ln(120)|0;f[c+4>>2]=d;d=c+8|0;f[d>>2]=f[e>>2];f[d+4>>2]=f[e+4>>2];f[d+8>>2]=f[e+8>>2];f[d+12>>2]=f[e+12>>2];e=c+24|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c>>2]=2896;f[c+44>>2]=0;f[c+48>>2]=0;e=c+52|0;f[e>>2]=f[g>>2];f[e+4>>2]=f[g+4>>2];f[e+8>>2]=f[g+8>>2];f[e+12>>2]=f[g+12>>2];f[c+40>>2]=2952;f[c+68>>2]=1;g=c+72|0;f[g>>2]=-1;f[g+4>>2]=-1;f[g+8>>2]=-1;f[g+12>>2]=-1;wn(c+88|0);i=c;f[a>>2]=i;return}default:{i=0;f[a>>2]=i;return}}}function Dd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+48|0;d=c+8|0;e=c+4|0;g=c;h=a+44|0;ci(f[h>>2]|0,b)|0;if(f[h>>2]|0){wn(d);tk(d);i=(f[h>>2]|0)+-1|0;if((i|0)>-1){h=a+40|0;j=i;do{fj(d,(f[(f[h>>2]|0)+(j>>>5<<2)>>2]&1<<(j&31)|0)!=0);j=j+-1|0}while((j|0)>-1)}ld(d,b);Fj(d)}j=a+56|0;ci(f[j>>2]|0,b)|0;if(f[j>>2]|0){wn(d);tk(d);h=(f[j>>2]|0)+-2|0;if((h|0)>-1){j=a+52|0;i=h;do{fj(d,(f[(f[j>>2]|0)+(i>>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>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)!=0);i=j+3|0;fj(d,(f[(f[h>>2]|0)+(i>>>5<<2)>>2]&1<<(i&31)|0)!=0);j=j+-4|0}while((j|0)>-1)}ld(d,b);Fj(d)}f[g>>2]=f[a+12>>2];j=b+16|0;h=j;i=f[h>>2]|0;k=f[h+4>>2]|0;if((k|0)>0|(k|0)==0&i>>>0>0){l=k;m=i}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;i=j;l=f[i+4>>2]|0;m=f[i>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;u=c;return 1}function Fd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){g=l;c=m;j=n;b:while(1){c:do if(i){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=d[q>>1]|0;x=q+2|0;y=e;z=u;while(1){A=z+8|0;if(w<<16>>16!=(d[A>>1]|0)){v=y;break d}if((d[x>>1]|0)!=(d[A+2>>1]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=c;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(b>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=d[u>>1]|0;z=u+2|0;x=e;w=q;while(1){B=w+8|0;if(y<<16>>16!=(d[B>>1]|0)){E=x;break e}if((d[z>>1]|0)!=(d[B+2>>1]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);c=f[p>>2]|0;if(!c){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function Gd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){g=l;d=m;j=n;b:while(1){c:do if(i){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0)){p=e;break c}q=(f[a>>2]|0)+(o<<2)|0;if(!(f[q>>2]|0)){r=e;s=o;t=q;break b}q=e+8|0;u=f[e>>2]|0;d:do if(!u)v=e;else{w=b[q>>0]|0;x=q+1|0;y=e;z=u;while(1){A=z+8|0;if(w<<24>>24!=(b[A>>0]|0)){v=y;break d}if((b[x>>0]|0)!=(b[A+1>>0]|0)){v=y;break d}A=f[z>>2]|0;if(!A){v=z;break}else{B=z;z=A;y=B}}}while(0);f[j>>2]=f[v>>2];f[v>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}else{e=d;while(1){u=f[e+4>>2]|0;if(u>>>0>>0)D=u;else D=(u>>>0)%(c>>>0)|0;if((D|0)==(k|0)){p=e;break c}u=(f[a>>2]|0)+(D<<2)|0;if(!(f[u>>2]|0)){r=e;s=D;t=u;break b}u=e+8|0;q=f[e>>2]|0;e:do if(!q)E=e;else{y=b[u>>0]|0;z=u+1|0;x=e;w=q;while(1){B=w+8|0;if(y<<24>>24!=(b[B>>0]|0)){E=x;break e}if((b[z>>0]|0)!=(b[B+1>>0]|0)){E=x;break e}B=f[w>>2]|0;if(!B){E=w;break}else{A=w;w=B;x=A}}}while(0);f[j>>2]=f[E>>2];f[E>>2]=f[f[(f[a>>2]|0)+(D<<2)>>2]>>2];f[f[(f[a>>2]|0)+(D<<2)>>2]>>2]=e;e=f[g>>2]|0;if(!e){C=39;break a}}}while(0);d=f[p>>2]|0;if(!d){C=39;break a}else{g=p;j=p}}f[t>>2]=j;m=f[r>>2]|0;if(!m){C=39;break}else{k=s;l=r;n=r}}if((C|0)==39)return}function Hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;c=u;u=u+48|0;d=c+32|0;e=c+28|0;g=c+16|0;h=c;i=a+16|0;j=f[i>>2]|0;if(j|0){k=f[b>>2]|0;l=i;m=j;a:while(1){j=m;while(1){if((f[j+16>>2]|0)>=(k|0))break;n=f[j+4>>2]|0;if(!n){o=l;break a}else j=n}m=f[j>>2]|0;if(!m){o=j;break}else l=j}if((o|0)!=(i|0)?(k|0)>=(f[o+16>>2]|0):0){p=o;q=p+20|0;u=c;return q|0}}lp(g);f[h>>2]=f[b>>2];b=h+4|0;f[h+8>>2]=0;o=h+12|0;f[o>>2]=0;k=h+8|0;f[b>>2]=k;l=f[g>>2]|0;m=g+4|0;if((l|0)!=(m|0)){n=k;r=l;while(1){l=r+16|0;f[e>>2]=n;f[d>>2]=f[e>>2];ph(b,d,l,l)|0;l=f[r+4>>2]|0;if(!l){s=r+8|0;t=f[s>>2]|0;if((f[t>>2]|0)==(r|0))v=t;else{t=s;do{s=f[t>>2]|0;t=s+8|0;w=f[t>>2]|0}while((f[w>>2]|0)!=(s|0));v=w}}else{t=l;while(1){j=f[t>>2]|0;if(!j)break;else t=j}v=t}if((v|0)==(m|0))break;else r=v}}v=a+12|0;r=f[i>>2]|0;do if(r){d=f[h>>2]|0;e=a+16|0;n=r;while(1){l=f[n+16>>2]|0;if((d|0)<(l|0)){j=f[n>>2]|0;if(!j){x=23;break}else{y=n;z=j}}else{if((l|0)>=(d|0)){x=27;break}A=n+4|0;l=f[A>>2]|0;if(!l){x=26;break}else{y=A;z=l}}e=y;n=z}if((x|0)==23){B=n;C=n;break}else if((x|0)==26){B=n;C=A;break}else if((x|0)==27){B=n;C=e;break}}else{B=i;C=i}while(0);i=f[C>>2]|0;if(!i){x=ln(32)|0;f[x+16>>2]=f[h>>2];A=x+20|0;f[A>>2]=f[b>>2];z=x+24|0;y=f[h+8>>2]|0;f[z>>2]=y;r=f[o>>2]|0;f[x+28>>2]=r;if(!r)f[A>>2]=z;else{f[y+8>>2]=z;f[b>>2]=k;f[k>>2]=0;f[o>>2]=0}f[x>>2]=0;f[x+4>>2]=0;f[x+8>>2]=B;f[C>>2]=x;B=f[f[v>>2]>>2]|0;if(!B)D=x;else{f[v>>2]=B;D=f[C>>2]|0}Oe(f[a+16>>2]|0,D);D=a+20|0;f[D>>2]=(f[D>>2]|0)+1;E=x}else E=i;Ej(h+4|0,f[k>>2]|0);Ej(g,f[m>>2]|0);p=E;q=p+20|0;u=c;return q|0}function Id(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;d=b[c+11>>0]|0;e=d<<24>>24<0;g=e?f[c>>2]|0:c;i=e?f[c+4>>2]|0:d&255;if(i>>>0>3){d=g;c=i;e=i;while(1){j=X(h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24,1540483477)|0;c=(X(j>>>24^j,1540483477)|0)^(X(c,1540483477)|0);e=e+-4|0;if(e>>>0<=3)break;else d=d+4|0}d=i+-4|0;e=d&-4;k=d-e|0;l=g+(e+4)|0;m=c}else{k=i;l=g;m=i}switch(k|0){case 3:{n=h[l+2>>0]<<16^m;o=6;break}case 2:{n=m;o=6;break}case 1:{p=m;o=7;break}default:q=m}if((o|0)==6){p=h[l+1>>0]<<8^n;o=7}if((o|0)==7)q=X(p^h[l>>0],1540483477)|0;l=X(q>>>13^q,1540483477)|0;q=l>>>15^l;l=f[a+4>>2]|0;if(!l){r=0;return r|0}p=l+-1|0;n=(p&l|0)==0;if(!n)if(q>>>0>>0)s=q;else s=(q>>>0)%(l>>>0)|0;else s=q&p;m=f[(f[a>>2]|0)+(s<<2)>>2]|0;if(!m){r=0;return r|0}a=f[m>>2]|0;if(!a){r=0;return r|0}m=(i|0)==0;if(n){n=a;a:while(1){k=f[n+4>>2]|0;c=(k|0)==(q|0);if(!(c|(k&p|0)==(s|0))){r=0;o=40;break}do if(c?(k=n+8|0,e=b[k+11>>0]|0,d=e<<24>>24<0,j=e&255,((d?f[n+12>>2]|0:j)|0)==(i|0)):0){e=f[k>>2]|0;t=d?e:k;if(d){if(m){r=n;o=40;break a}if(!(Vk(t,g,i)|0)){r=n;o=40;break a}else break}if(m){r=n;o=40;break a}if((b[g>>0]|0)==(e&255)<<24>>24){e=k;k=j;j=g;do{k=k+-1|0;e=e+1|0;if(!k){r=n;o=40;break a}j=j+1|0}while((b[e>>0]|0)==(b[j>>0]|0))}}while(0);n=f[n>>2]|0;if(!n){r=0;o=40;break}}if((o|0)==40)return r|0}else u=a;b:while(1){a=f[u+4>>2]|0;do if((a|0)==(q|0)){n=u+8|0;p=b[n+11>>0]|0;c=p<<24>>24<0;j=p&255;if(((c?f[u+12>>2]|0:j)|0)==(i|0)){p=f[n>>2]|0;e=c?p:n;if(c){if(m){r=u;o=40;break b}if(!(Vk(e,g,i)|0)){r=u;o=40;break b}else break}if(m){r=u;o=40;break b}if((b[g>>0]|0)==(p&255)<<24>>24){p=n;n=j;j=g;do{n=n+-1|0;p=p+1|0;if(!n){r=u;o=40;break b}j=j+1|0}while((b[p>>0]|0)==(b[j>>0]|0))}}}else{if(a>>>0>>0)v=a;else v=(a>>>0)%(l>>>0)|0;if((v|0)!=(s|0)){r=0;o=40;break b}}while(0);u=f[u>>2]|0;if(!u){r=0;o=40;break}}if((o|0)==40)return r|0;return 0}function Jd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){e=k;c=l;i=m;b:while(1){c:do if(h){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(n<<2)|0;if(!(f[p>>2]|0)){q=d;r=n;s=p;break b}p=d+12|0;t=f[d>>2]|0;d:do if(!t)u=d;else{v=f[d+8>>2]|0;w=d;x=t;while(1){if((v|0)!=(f[x+8>>2]|0)){u=w;break d}if((f[p>>2]|0)!=(f[x+12>>2]|0)){u=w;break d}y=f[x>>2]|0;if(!y){u=x;break}else{z=x;x=y;w=z}}}while(0);f[i>>2]=f[u>>2];f[u>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}else{d=c;while(1){p=f[d+4>>2]|0;if(p>>>0>>0)B=p;else B=(p>>>0)%(b>>>0)|0;if((B|0)==(j|0)){o=d;break c}p=(f[a>>2]|0)+(B<<2)|0;if(!(f[p>>2]|0)){q=d;r=B;s=p;break b}p=d+12|0;t=f[d>>2]|0;e:do if(!t)C=d;else{w=f[d+8>>2]|0;x=d;v=t;while(1){if((w|0)!=(f[v+8>>2]|0)){C=x;break e}if((f[p>>2]|0)!=(f[v+12>>2]|0)){C=x;break e}z=f[v>>2]|0;if(!z){C=v;break}else{y=v;v=z;x=y}}}while(0);f[i>>2]=f[C>>2];f[C>>2]=f[f[(f[a>>2]|0)+(B<<2)>>2]>>2];f[f[(f[a>>2]|0)+(B<<2)>>2]>>2]=d;d=f[e>>2]|0;if(!d){A=39;break a}}}while(0);c=f[o>>2]|0;if(!c){A=39;break a}else{e=o;i=o}}f[s>>2]=i;l=f[q>>2]|0;if(!l){A=39;break}else{j=r;k=q;m=q}}if((A|0)==39)return}function Kd(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;h=a+4|0;i=f[c>>2]|0;c=i;do if((i|0)!=(h|0)){j=i+16|0;k=b[j+11>>0]|0;l=k<<24>>24<0;m=l?f[i+20>>2]|0:k&255;k=b[g+11>>0]|0;n=k<<24>>24<0;o=n?f[g+4>>2]|0:k&255;k=m>>>0>>0;p=k?m:o;if((p|0)!=0?(q=Vk(n?f[g>>2]|0:g,l?f[j>>2]|0:j,p)|0,(q|0)!=0):0){if((q|0)<0)break}else r=4;if((r|0)==4?o>>>0>>0:0)break;q=o>>>0>>0?o:m;if((q|0)!=0?(m=Vk(l?f[j>>2]|0:j,n?f[g>>2]|0:g,q)|0,(m|0)!=0):0){if((m|0)>=0)r=37}else r=21;if((r|0)==21?!k:0)r=37;if((r|0)==37){f[d>>2]=c;f[e>>2]=c;s=e;return s|0}k=f[i+4>>2]|0;m=(k|0)==0;if(m){q=i+8|0;j=f[q>>2]|0;if((f[j>>2]|0)==(i|0))t=j;else{j=q;do{q=f[j>>2]|0;j=q+8|0;l=f[j>>2]|0}while((f[l>>2]|0)!=(q|0));t=l}}else{j=k;while(1){l=f[j>>2]|0;if(!l)break;else j=l}t=j}do if((t|0)!=(h|0)){k=t+16|0;l=b[k+11>>0]|0;q=l<<24>>24<0;p=q?f[t+20>>2]|0:l&255;l=p>>>0>>0?p:o;if((l|0)!=0?(u=Vk(n?f[g>>2]|0:g,q?f[k>>2]|0:k,l)|0,(u|0)!=0):0){if((u|0)<0)break}else r=31;if((r|0)==31?o>>>0

>>0:0)break;s=yg(a,d,g)|0;return s|0}while(0);if(m){f[d>>2]=c;s=i+4|0;return s|0}else{f[d>>2]=t;s=t;return s|0}}while(0);t=f[i>>2]|0;do if((f[a>>2]|0)==(i|0))v=c;else{if(!t){h=i;while(1){e=f[h+8>>2]|0;if((f[e>>2]|0)==(h|0))h=e;else{w=e;break}}}else{h=t;while(1){m=f[h+4>>2]|0;if(!m){w=h;break}else h=m}}h=w;m=w+16|0;e=b[g+11>>0]|0;o=e<<24>>24<0;n=o?f[g+4>>2]|0:e&255;e=b[m+11>>0]|0;j=e<<24>>24<0;p=j?f[w+20>>2]|0:e&255;e=n>>>0

>>0?n:p;if((e|0)!=0?(u=Vk(j?f[m>>2]|0:m,o?f[g>>2]|0:g,e)|0,(u|0)!=0):0){if((u|0)<0){v=h;break}}else r=13;if((r|0)==13?p>>>0>>0:0){v=h;break}s=yg(a,d,g)|0;return s|0}while(0);if(!t){f[d>>2]=i;s=i;return s|0}else{f[d>>2]=v;s=v+4|0;return s|0}return 0}function Ld(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a;h=b;i=h;j=c;k=d;l=k;if(!i){m=(e|0)!=0;if(!l){if(m){f[e>>2]=(g>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(g>>>0)/(j>>>0)>>>0;return (I=n,o)|0}else{if(!m){n=0;o=0;return (I=n,o)|0}f[e>>2]=a|0;f[e+4>>2]=b&0;n=0;o=0;return (I=n,o)|0}}m=(l|0)==0;do if(j){if(!m){p=(_(l|0)|0)-(_(i|0)|0)|0;if(p>>>0<=31){q=p+1|0;r=31-p|0;s=p-31>>31;t=q;u=g>>>(q>>>0)&s|i<>>(q>>>0)&s;w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}r=j-1|0;if(r&j|0){s=(_(j|0)|0)+33-(_(i|0)|0)|0;q=64-s|0;p=32-s|0;y=p>>31;z=s-32|0;A=z>>31;t=s;u=p-1>>31&i>>>(z>>>0)|(i<>>(s>>>0))&A;v=A&i>>>(s>>>0);w=g<>>(z>>>0))&y|g<>31;break}if(e|0){f[e>>2]=r&g;f[e+4>>2]=0}if((j|0)==1){n=h|b&0;o=a|0|0;return (I=n,o)|0}else{r=vm(j|0)|0;n=i>>>(r>>>0)|0;o=i<<32-r|g>>>(r>>>0)|0;return (I=n,o)|0}}else{if(m){if(e|0){f[e>>2]=(i>>>0)%(j>>>0);f[e+4>>2]=0}n=0;o=(i>>>0)/(j>>>0)>>>0;return (I=n,o)|0}if(!g){if(e|0){f[e>>2]=0;f[e+4>>2]=(i>>>0)%(l>>>0)}n=0;o=(i>>>0)/(l>>>0)>>>0;return (I=n,o)|0}r=l-1|0;if(!(r&l)){if(e|0){f[e>>2]=a|0;f[e+4>>2]=r&i|b&0}n=0;o=i>>>((vm(l|0)|0)>>>0);return (I=n,o)|0}r=(_(l|0)|0)-(_(i|0)|0)|0;if(r>>>0<=30){s=r+1|0;p=31-r|0;t=s;u=i<>>(s>>>0);v=i>>>(s>>>0);w=0;x=g<>2]=a|0;f[e+4>>2]=h|b&0;n=0;o=0;return (I=n,o)|0}while(0);if(!t){B=x;C=w;D=v;E=u;F=0;G=0}else{b=c|0|0;c=k|d&0;d=Vn(b|0,c|0,-1,-1)|0;k=I;h=x;x=w;w=v;v=u;u=t;t=0;do{a=h;h=x>>>31|h<<1;x=t|x<<1;g=v<<1|a>>>31|0;a=v>>>31|w<<1|0;Xn(d|0,k|0,g|0,a|0)|0;i=I;l=i>>31|((i|0)<0?-1:0)<<1;t=l&1;v=Xn(g|0,a|0,l&b|0,(((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1)&c|0)|0;w=I;u=u-1|0}while((u|0)!=0);B=h;C=x;D=w;E=v;F=0;G=t}t=C;C=0;if(e|0){f[e>>2]=E;f[e+4>>2]=D}n=(t|0)>>>31|(B|C)<<1|(C<<1|t>>>31)&0|F;o=(t<<1|0>>>31)&-2|G;return (I=n,o)|0}function Md(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=u;u=u+16|0;h=g;f[c+48>>2]=d;f[c+44>>2]=e;e=f[c+8>>2]|0;d=c+12|0;i=f[d>>2]|0;if((i|0)!=(e|0)){j=i;do{i=j+-4|0;f[d>>2]=i;k=f[i>>2]|0;f[i>>2]=0;if(k|0)Va[f[(f[k>>2]|0)+4>>2]&127](k);j=f[d>>2]|0}while((j|0)!=(e|0))}e=f[c+20>>2]|0;j=c+24|0;d=f[j>>2]|0;if((d|0)!=(e|0))f[j>>2]=d+(~((d+-4-e|0)>>>2)<<2);e=f[c+32>>2]|0;d=c+36|0;j=f[d>>2]|0;if((j|0)!=(e|0))f[d>>2]=j+(~((j+-4-e|0)>>>2)<<2);if(!(f[c+4>>2]|0)){e=ln(32)|0;f[h>>2]=e;f[h+8>>2]=-2147483616;f[h+4>>2]=23;l=e;m=15706;n=l+23|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[e+23>>0]=0;f[a>>2]=-1;pj(a+4|0,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}Ud(a,c);if(f[a>>2]|0){u=g;return}e=a+4|0;j=e+11|0;if((b[j>>0]|0)<0)Oq(f[e>>2]|0);Wi(a,c);if(f[a>>2]|0){u=g;return}if((b[j>>0]|0)<0)Oq(f[e>>2]|0);if(!(Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=29;l=j;m=15730;n=l+29|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+29>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(!(Qa[f[(f[c>>2]|0)+20>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=31;l=j;m=15760;n=l+31|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+31>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(!(Qa[f[(f[c>>2]|0)+24>>2]&127](c)|0)){j=ln(32)|0;f[h>>2]=j;f[h+8>>2]=-2147483616;f[h+4>>2]=31;l=j;m=15792;n=l+31|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[j+31>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}if(Qa[f[(f[c>>2]|0)+28>>2]&127](c)|0){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=g;return}c=ln(48)|0;f[h>>2]=c;f[h+8>>2]=-2147483600;f[h+4>>2]=34;l=c;m=15824;n=l+34|0;do{b[l>>0]=b[m>>0]|0;l=l+1|0;m=m+1|0}while((l|0)<(n|0));b[c+34>>0]=0;f[a>>2]=-1;pj(e,h);if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);u=g;return}function Nd(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=u;u=u+32|0;d=c+4|0;e=c;g=c+16|0;h=a+48|0;i=f[h>>2]|0;j=ln(32)|0;f[d>>2]=j;f[d+8>>2]=-2147483616;f[d+4>>2]=20;k=j;l=14538;m=k+20|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[j+20>>0]=0;j=Fk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);i=f[h>>2]|0;n=ln(32)|0;f[d>>2]=n;f[d+8>>2]=-2147483616;f[d+4>>2]=22;k=n;l=14559;m=k+22|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[n+22>>0]=0;n=Fk(i+24|0,d)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);i=a+56|0;o=f[i>>2]|0;f[i>>2]=0;if(o|0)Va[f[(f[o>>2]|0)+4>>2]&127](o);o=f[a+52>>2]|0;p=(((f[o+100>>2]|0)-(f[o+96>>2]|0)|0)/12|0)>>>0<1e3;o=f[h>>2]|0;q=ln(32)|0;f[d>>2]=q;f[d+8>>2]=-2147483616;f[d+4>>2]=18;k=q;l=14582;m=k+18|0;do{b[k>>0]=b[l>>0]|0;k=k+1|0;l=l+1|0}while((k|0)<(m|0));b[q+18>>0]=0;q=Hk(o,d,-1)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);switch(q|0){case -1:{if(j?p|((mi(f[h>>2]|0)|0)>4|n^1):0)r=13;else r=17;break}case 0:{if(j)r=13;else r=21;break}case 2:{r=17;break}default:r=21}if((r|0)==13){j=f[a+44>>2]|0;b[g>>0]=0;n=j+16|0;h=f[n+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[n>>2]|0)>>>0>0)){f[e>>2]=f[j+4>>2];f[d>>2]=f[e>>2];Me(j,d,g,g+1|0)|0}j=ln(296)|0;_i(j);n=f[i>>2]|0;f[i>>2]=j;if(!n)s=j;else{Va[f[(f[n>>2]|0)+4>>2]&127](n);r=21}}else if((r|0)==17){n=f[a+44>>2]|0;b[g>>0]=2;j=n+16|0;h=f[j+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[j>>2]|0)>>>0>0)){f[e>>2]=f[n+4>>2];f[d>>2]=f[e>>2];Me(n,d,g,g+1|0)|0}g=ln(360)|0;xi(g);d=f[i>>2]|0;f[i>>2]=g;if(!d)s=g;else{Va[f[(f[d>>2]|0)+4>>2]&127](d);r=21}}if((r|0)==21){r=f[i>>2]|0;if(!r){t=0;u=c;return t|0}else s=r}t=Ra[f[(f[s>>2]|0)+8>>2]&127](s,a)|0;u=c;return t|0}function Od(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;e=b+12|0;g=f[e>>2]|0;h=c+4|0;i=(f[h>>2]|0)-g|0;j=c;f[j>>2]=(f[c>>2]|0)-g;f[j+4>>2]=i;i=(f[d>>2]|0)-g|0;j=d+4|0;k=(f[j>>2]|0)-g|0;g=d;f[g>>2]=i;f[g+4>>2]=k;g=f[e>>2]|0;if((((k|0)>-1?k:0-k|0)+((i|0)>-1?i:0-i|0)|0)>(g|0)){l=f[c>>2]|0;m=f[h>>2]|0;if((l|0)>-1)if((m|0)<=-1)if((l|0)<1){n=-1;o=-1}else p=6;else{n=1;o=1}else if((m|0)<1){n=-1;o=-1}else p=6;if((p|0)==6){n=(l|0)>0?1:-1;o=(m|0)>0?1:-1}q=X(g,n)|0;r=X(g,o)|0;g=(l<<1)-q|0;f[c>>2]=g;l=(m<<1)-r|0;f[h>>2]=l;if((X(n,o)|0)>-1){o=0-l|0;f[c>>2]=o;s=0-g|0;t=o}else{f[c>>2]=l;s=g;t=l}f[c>>2]=(t+q|0)/2|0;f[h>>2]=(s+r|0)/2|0;r=f[d>>2]|0;s=f[j>>2]|0;if((r|0)>-1)if((s|0)<=-1)if((r|0)<1){u=-1;v=-1}else p=14;else{u=1;v=1}else if((s|0)<1){u=-1;v=-1}else p=14;if((p|0)==14){u=(r|0)>0?1:-1;v=(s|0)>0?1:-1}q=f[e>>2]|0;e=X(q,u)|0;t=X(q,v)|0;q=(r<<1)-e|0;f[d>>2]=q;r=(s<<1)-t|0;f[j>>2]=r;if((X(u,v)|0)>-1){v=0-r|0;f[d>>2]=v;w=0-q|0;x=v}else{f[d>>2]=r;w=q;x=r}r=(x+e|0)/2|0;f[d>>2]=r;e=(w+t|0)/2|0;f[j>>2]=e;y=r;z=e}else{y=i;z=k}if(!y)if(!z){A=y;B=z}else p=22;else if((y|0)<0&(z|0)<1){A=y;B=z}else p=22;if((p|0)==22){if(!y)C=(z|0)==0?0:(z|0)>0?3:1;else C=(y|0)>0?(z>>31)+2|0:(z|0)<1?0:3;z=f[c>>2]|0;y=f[h>>2]|0;switch(C|0){case 1:{C=c;f[C>>2]=y;f[C+4>>2]=0-z;D=f[j>>2]|0;E=0-(f[d>>2]|0)|0;break}case 2:{C=c;f[C>>2]=0-z;f[C+4>>2]=0-y;D=0-(f[d>>2]|0)|0;E=0-(f[j>>2]|0)|0;break}case 3:{C=c;f[C>>2]=0-y;f[C+4>>2]=z;D=0-(f[j>>2]|0)|0;E=f[d>>2]|0;break}default:{C=c;f[C>>2]=z;f[C+4>>2]=y;D=f[d>>2]|0;E=f[j>>2]|0}}j=d;f[j>>2]=D;f[j+4>>2]=E;A=D;B=E}E=(f[c>>2]|0)-A|0;f[a>>2]=E;A=(f[h>>2]|0)-B|0;B=a+4|0;f[B>>2]=A;if((E|0)<0)F=(f[b+4>>2]|0)+E|0;else F=E;f[a>>2]=F;if((A|0)>=0){G=A;f[B>>2]=G;return}G=(f[b+4>>2]|0)+A|0;f[B>>2]=G;return}function Pd(a,b){a=a|0;b=b|0;var c=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;c=a+4|0;if(!b){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[c>>2]=0;return}if(b>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(b<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;g=f[c>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=b+-1|0;i=(h&b|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(b>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=c;c=f[g>>2]|0;if(!c)return;else{k=j;l=g;m=c;n=g}a:while(1){b:do if(i){g=l;c=m;j=n;while(1){e=c;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((d[p>>1]|0)==(d[v+8>>1]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}c=f[e>>2]|0;if(!c){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;c=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(b>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=c;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((d[x>>1]|0)==(d[A+8>>1]|0))z=A;else break}f[c>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;c=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Qd(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;else{k=j;l=g;m=d;n=g}a:while(1){b:do if(i){g=l;d=m;j=n;while(1){e=d;while(1){o=f[e+4>>2]&h;if((o|0)==(k|0))break;p=(f[a>>2]|0)+(o<<2)|0;if(!(f[p>>2]|0)){q=e;r=j;s=o;t=p;break b}p=e+8|0;u=e;while(1){v=f[u>>2]|0;if(!v)break;if((b[p>>0]|0)==(b[v+8>>0]|0))u=v;else break}f[j>>2]=v;f[u>>2]=f[f[(f[a>>2]|0)+(o<<2)>>2]>>2];f[f[(f[a>>2]|0)+(o<<2)>>2]>>2]=e;p=f[g>>2]|0;if(!p){w=37;break a}else e=p}d=f[e>>2]|0;if(!d){w=37;break a}else{g=e;j=e}}}else{j=l;g=m;d=n;while(1){p=g;while(1){x=f[p+4>>2]|0;if(x>>>0>>0)y=x;else y=(x>>>0)%(c>>>0)|0;if((y|0)==(k|0))break;x=(f[a>>2]|0)+(y<<2)|0;if(!(f[x>>2]|0)){q=p;r=d;s=y;t=x;break b}x=p+8|0;z=p;while(1){A=f[z>>2]|0;if(!A)break;if((b[x>>0]|0)==(b[A+8>>0]|0))z=A;else break}f[d>>2]=A;f[z>>2]=f[f[(f[a>>2]|0)+(y<<2)>>2]>>2];f[f[(f[a>>2]|0)+(y<<2)>>2]>>2]=p;x=f[j>>2]|0;if(!x){w=37;break a}else p=x}g=f[p>>2]|0;if(!g){w=37;break a}else{j=p;d=p}}}while(0);f[t>>2]=r;m=f[q>>2]|0;if(!m){w=37;break}else{k=s;l=q;n=q}}if((w|0)==37)return}function Rd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=f[c>>2]|0;c=f[b>>2]|0;h=g-c|0;i=a+8|0;j=f[i>>2]|0;if(h>>>0<64){if(j>>>0<=1){k=0;return k|0}l=f[e>>2]|0;m=0;n=1;while(1){o=(f[l+(m<<2)>>2]|0)>>>0>(f[l+(n<<2)>>2]|0)>>>0?n:m;n=n+1|0;if(n>>>0>=j>>>0){k=o;break}else m=o}return k|0}if(j){j=f[a+1128>>2]|0;m=f[e>>2]|0;e=f[a+1140>>2]|0;n=f[d>>2]|0;d=b+4|0;l=b+8|0;if((g|0)==(c|0)){b=0;do{o=j+(b<<2)|0;f[o>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){p=f[o>>2]|0;q=h-p|0;f[o>>2]=q>>>0

>>0?p:q}b=b+1|0;q=f[i>>2]|0}while(b>>>0>>0);r=q}else{b=0;do{q=j+(b<<2)|0;f[q>>2]=0;p=(f[a>>2]|0)-(f[m+(b<<2)>>2]|0)|0;f[e+(b<<2)>>2]=p;if(p|0){o=(f[n+(b<<2)>>2]|0)+(1<>2]|0;s=f[(f[d>>2]|0)+24>>2]|0;t=c;u=f[q>>2]|0;do{v=s+((X(t,p)|0)<<2)+(b<<2)|0;u=u+((f[v>>2]|0)>>>0>>0&1)|0;f[q>>2]=u;t=t+1|0}while((t|0)!=(g|0));t=h-u|0;f[q>>2]=t>>>0>>0?u:t}b=b+1|0;t=f[i>>2]|0}while(b>>>0>>0);r=t}if(r){b=f[a+1140>>2]|0;i=a+1128|0;h=0;g=0;c=0;while(1){if(!(f[b+(g<<2)>>2]|0)){w=h;x=c}else{d=f[(f[i>>2]|0)+(g<<2)>>2]|0;l=h>>>0>>0;w=l?d:h;x=l?g:c}g=g+1|0;if(g>>>0>=r>>>0){y=x;break}else{h=w;c=x}}}else y=0}else y=0;x=a+1088|0;c=a+1104|0;w=f[c>>2]|0;h=32-w|0;if((h|0)<4){r=y&15;g=4-h|0;f[c>>2]=g;h=a+1100|0;i=f[h>>2]|r>>>g;f[h>>2]=i;g=a+1092|0;b=f[g>>2]|0;if((b|0)==(f[a+1096>>2]|0))Ri(x,h);else{f[b>>2]=i;f[g>>2]=b+4}f[h>>2]=r<<32-(f[c>>2]|0);k=y;return k|0}r=a+1100|0;h=f[r>>2]|y<<28>>>w;f[r>>2]=h;b=w+4|0;f[c>>2]=b;if((b|0)!=32){k=y;return k|0}b=a+1092|0;w=f[b>>2]|0;if((w|0)==(f[a+1096>>2]|0))Ri(x,r);else{f[w>>2]=h;f[b>>2]=w+4}f[r>>2]=0;f[c>>2]=0;k=y;return k|0}function Sd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;c=a+4|0;if(!b){d=f[a>>2]|0;f[a>>2]=0;if(d|0)Oq(d);f[c>>2]=0;return}if(b>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}d=ln(b<<2)|0;e=f[a>>2]|0;f[a>>2]=d;if(e|0)Oq(e);f[c>>2]=b;c=0;do{f[(f[a>>2]|0)+(c<<2)>>2]=0;c=c+1|0}while((c|0)!=(b|0));c=a+8|0;e=f[c>>2]|0;if(!e)return;d=f[e+4>>2]|0;g=b+-1|0;h=(g&b|0)==0;if(!h)if(d>>>0>>0)i=d;else i=(d>>>0)%(b>>>0)|0;else i=d&g;f[(f[a>>2]|0)+(i<<2)>>2]=c;c=f[e>>2]|0;if(!c)return;else{j=i;k=e;l=c;m=e}a:while(1){b:do if(h){e=k;c=l;i=m;while(1){d=c;while(1){n=f[d+4>>2]&g;if((n|0)==(j|0))break;o=(f[a>>2]|0)+(n<<2)|0;if(!(f[o>>2]|0)){p=d;q=i;r=n;s=o;break b}o=d+8|0;t=d;while(1){u=f[t>>2]|0;if(!u)break;if((f[o>>2]|0)==(f[u+8>>2]|0))t=u;else break}f[i>>2]=u;f[t>>2]=f[f[(f[a>>2]|0)+(n<<2)>>2]>>2];f[f[(f[a>>2]|0)+(n<<2)>>2]>>2]=d;o=f[e>>2]|0;if(!o){v=37;break a}else d=o}c=f[d>>2]|0;if(!c){v=37;break a}else{e=d;i=d}}}else{i=k;e=l;c=m;while(1){o=e;while(1){w=f[o+4>>2]|0;if(w>>>0>>0)x=w;else x=(w>>>0)%(b>>>0)|0;if((x|0)==(j|0))break;w=(f[a>>2]|0)+(x<<2)|0;if(!(f[w>>2]|0)){p=o;q=c;r=x;s=w;break b}w=o+8|0;y=o;while(1){z=f[y>>2]|0;if(!z)break;if((f[w>>2]|0)==(f[z+8>>2]|0))y=z;else break}f[c>>2]=z;f[y>>2]=f[f[(f[a>>2]|0)+(x<<2)>>2]>>2];f[f[(f[a>>2]|0)+(x<<2)>>2]>>2]=o;w=f[i>>2]|0;if(!w){v=37;break a}else o=w}e=f[o>>2]|0;if(!e){v=37;break a}else{i=o;c=o}}}while(0);f[s>>2]=q;l=f[p>>2]|0;if(!l){v=37;break}else{j=r;k=p;m=p}}if((v|0)==37)return}function Td(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;d=a+4|0;if(!c){e=f[a>>2]|0;f[a>>2]=0;if(e|0)Oq(e);f[d>>2]=0;return}if(c>>>0>1073741823){e=ra(8)|0;Oo(e,16035);f[e>>2]=7256;va(e|0,1112,110)}e=ln(c<<2)|0;g=f[a>>2]|0;f[a>>2]=e;if(g|0)Oq(g);f[d>>2]=c;d=0;do{f[(f[a>>2]|0)+(d<<2)>>2]=0;d=d+1|0}while((d|0)!=(c|0));d=a+8|0;g=f[d>>2]|0;if(!g)return;e=f[g+4>>2]|0;h=c+-1|0;i=(h&c|0)==0;if(!i)if(e>>>0>>0)j=e;else j=(e>>>0)%(c>>>0)|0;else j=e&h;f[(f[a>>2]|0)+(j<<2)>>2]=d;d=f[g>>2]|0;if(!d)return;e=a+24|0;k=j;j=g;l=d;d=g;a:while(1){g=j;m=l;n=d;b:while(1){o=m;while(1){p=f[o+4>>2]|0;if(!i)if(p>>>0>>0)q=p;else q=(p>>>0)%(c>>>0)|0;else q=p&h;if((q|0)==(k|0))break;r=(f[a>>2]|0)+(q<<2)|0;if(!(f[r>>2]|0))break b;p=f[o>>2]|0;c:do if(!p)s=o;else{t=f[o+8>>2]|0;u=f[e>>2]|0;v=f[u+8>>2]|0;w=(f[u+12>>2]|0)-v|0;u=v;v=w>>>2;if((w|0)>0){x=o;y=p}else{w=p;while(1){z=f[w>>2]|0;if(!z){s=w;break c}else w=z}}while(1){w=f[y+8>>2]|0;z=0;do{A=f[u+(z<<2)>>2]|0;if(!(b[A+84>>0]|0)){B=f[A+68>>2]|0;C=f[B+(w<<2)>>2]|0;D=f[B+(t<<2)>>2]|0}else{C=w;D=t}z=z+1|0;if((D|0)!=(C|0)){s=x;break c}}while((z|0)<(v|0));z=f[y>>2]|0;if(!z){s=y;break}else{w=y;y=z;x=w}}}while(0);f[n>>2]=f[s>>2];f[s>>2]=f[f[(f[a>>2]|0)+(q<<2)>>2]>>2];f[f[(f[a>>2]|0)+(q<<2)>>2]>>2]=o;p=f[g>>2]|0;if(!p){E=38;break a}else o=p}m=f[o>>2]|0;if(!m){E=38;break a}else{g=o;n=o}}f[r>>2]=n;l=f[o>>2]|0;if(!l){E=38;break}else{k=q;j=o;d=o}}if((E|0)==38)return}function Ud(a,c){a=a|0;c=c|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0;e=u;u=u+16|0;g=e+4|0;h=e;i=e+12|0;j=e+11|0;k=e+10|0;l=e+8|0;m=c+44|0;n=f[m>>2]|0;o=n+16|0;p=f[o+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0)){f[h>>2]=f[n+4>>2];f[g>>2]=f[h>>2];Me(n,g,15886,15891)|0}n=Qa[f[(f[c>>2]|0)+8>>2]&127](c)|0;b[i>>0]=n;b[j>>0]=2;b[k>>0]=(n&255|0)==0?3:2;n=f[m>>2]|0;o=n+16|0;p=f[o+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0)){f[h>>2]=f[n+4>>2];f[g>>2]=f[h>>2];Me(n,g,j,j+1|0)|0;j=f[m>>2]|0;o=j+16|0;p=f[o+4>>2]|0;if(!((p|0)>0|(p|0)==0&(f[o>>2]|0)>>>0>0)){f[h>>2]=f[j+4>>2];f[g>>2]=f[h>>2];Me(j,g,k,k+1|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if(w>y){n[m>>2]=y;z=$(n[x>>2])}else z=y;x=s+(v<<2)|0;if($(n[x>>2])>2]=z;v=v+1|0}while((v|0)!=(h|0));t=t+1|0}while(t>>>0

>>0)}while(0);if(d<<24>>24>0){d=f[k>>2]|0;k=0;z=$(n[j>>2]);while(1){y=$(n[s+(k<<2)>>2]);w=$(y-$(n[d+(k<<2)>>2]));if(w>z){n[j>>2]=w;A=w}else A=z;k=k+1|0;if((k|0)==(h|0))break;else z=A}}Mq(q);Mq(s);i=1;u=e;return i|0}function Xd(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;g=a+8|0;Mh(g,b,d,e);h=d-e|0;if((h|0)>0){d=0-e|0;i=a+16|0;j=a+32|0;k=a+12|0;l=a+28|0;m=a+20|0;n=a+24|0;o=h;h=f[g>>2]|0;while(1){p=b+(o<<2)|0;q=c+(o<<2)|0;if((h|0)>0){r=0;s=p+(d<<2)|0;t=h;while(1){if((t|0)>0){u=0;do{v=f[s+(u<<2)>>2]|0;w=f[i>>2]|0;if((v|0)>(w|0)){x=f[j>>2]|0;f[x+(u<<2)>>2]=w;y=x}else{x=f[k>>2]|0;w=f[j>>2]|0;f[w+(u<<2)>>2]=(v|0)<(x|0)?x:v;y=w}u=u+1|0}while((u|0)<(f[g>>2]|0));z=y}else z=f[j>>2]|0;u=(f[p+(r<<2)>>2]|0)-(f[z+(r<<2)>>2]|0)|0;w=q+(r<<2)|0;f[w>>2]=u;if((u|0)>=(f[l>>2]|0)){if((u|0)>(f[n>>2]|0)){A=u-(f[m>>2]|0)|0;B=31}}else{A=(f[m>>2]|0)+u|0;B=31}if((B|0)==31){B=0;f[w>>2]=A}r=r+1|0;w=f[g>>2]|0;if((r|0)>=(w|0)){C=w;break}else{s=z;t=w}}}else C=h;o=o-e|0;if((o|0)<=0){D=C;break}else h=C}}else D=f[g>>2]|0;C=e>>>0>1073741823?-1:e<<2;e=Lq(C)|0;sj(e|0,0,C|0)|0;if((D|0)<=0){Mq(e);return 1}C=a+16|0;h=a+32|0;o=a+12|0;z=a+28|0;A=a+20|0;m=a+24|0;a=0;n=e;l=D;while(1){if((l|0)>0){D=0;do{j=f[n+(D<<2)>>2]|0;y=f[C>>2]|0;if((j|0)>(y|0)){k=f[h>>2]|0;f[k+(D<<2)>>2]=y;E=k}else{k=f[o>>2]|0;y=f[h>>2]|0;f[y+(D<<2)>>2]=(j|0)<(k|0)?k:j;E=y}D=D+1|0}while((D|0)<(f[g>>2]|0));F=E}else F=f[h>>2]|0;D=(f[b+(a<<2)>>2]|0)-(f[F+(a<<2)>>2]|0)|0;y=c+(a<<2)|0;f[y>>2]=D;if((D|0)>=(f[z>>2]|0)){if((D|0)>(f[m>>2]|0)){G=D-(f[A>>2]|0)|0;B=16}}else{G=(f[A>>2]|0)+D|0;B=16}if((B|0)==16){B=0;f[y>>2]=G}a=a+1|0;l=f[g>>2]|0;if((a|0)>=(l|0))break;else n=F}Mq(e);return 1}function Yd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;e=f[a>>2]|0;g=e;h=(f[b>>2]|0)-g|0;b=e+(h>>2<<2)|0;i=f[c>>2]|0;c=f[d>>2]|0;d=c-i|0;j=d>>2;k=i;l=c;if((d|0)<=0){m=b;return m|0}d=a+8|0;n=f[d>>2]|0;o=a+4|0;p=f[o>>2]|0;q=p;if((j|0)<=(n-q>>2|0)){r=b;s=q-r|0;t=s>>2;if((j|0)>(t|0)){u=k+(t<<2)|0;t=u;if((u|0)==(l|0))v=p;else{w=l+-4-t|0;x=u;u=p;while(1){f[u>>2]=f[x>>2];x=x+4|0;if((x|0)==(l|0))break;else u=u+4|0}u=p+((w>>>2)+1<<2)|0;f[o>>2]=u;v=u}if((s|0)>0){y=t;z=v}else{m=b;return m|0}}else{y=c;z=p}c=z-(b+(j<<2))>>2;v=b+(c<<2)|0;if(v>>>0

>>0){t=(p+(0-c<<2)+~r|0)>>>2;r=v;s=z;while(1){f[s>>2]=f[r>>2];r=r+4|0;if(r>>>0>=p>>>0)break;else s=s+4|0}f[o>>2]=z+(t+1<<2)}if(c|0){c=v;v=z;do{c=c+-4|0;v=v+-4|0;f[v>>2]=f[c>>2]}while((c|0)!=(b|0))}c=y;if((k|0)==(c|0)){m=b;return m|0}else{A=b;B=k}while(1){f[A>>2]=f[B>>2];B=B+4|0;if((B|0)==(c|0)){m=b;break}else A=A+4|0}return m|0}A=(q-g>>2)+j|0;if(A>>>0>1073741823)aq(a);j=n-g|0;g=j>>1;n=j>>2>>>0<536870911?(g>>>0>>0?A:g):1073741823;g=b;A=h>>2;do if(n)if(n>>>0>1073741823){j=ra(8)|0;Oo(j,16035);f[j>>2]=7256;va(j|0,1112,110)}else{j=ln(n<<2)|0;C=j;D=j;break}else{C=0;D=0}while(0);j=D+(A<<2)|0;A=D+(n<<2)|0;if((l|0)==(k|0))E=j;else{n=((l+-4-i|0)>>>2)+1|0;i=k;k=j;while(1){f[k>>2]=f[i>>2];i=i+4|0;if((i|0)==(l|0))break;else k=k+4|0}E=j+(n<<2)|0}if((h|0)>0)kh(C|0,e|0,h|0)|0;h=q-g|0;if((h|0)>0){kh(E|0,b|0,h|0)|0;F=E+(h>>>2<<2)|0}else F=E;f[a>>2]=D;f[o>>2]=F;f[d>>2]=A;if(!e){m=j;return m|0}Oq(e);m=j;return m|0}function Zd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+48|0;d=c+40|0;e=c+36|0;g=c+32|0;h=c;i=a+60|0;ci(f[i>>2]|0,b)|0;wn(h);tk(h);j=f[a+56>>2]|0;k=f[i>>2]|0;i=k>>>5;l=j+(i<<2)|0;m=k&31;k=(i|0)!=0;a:do if(i|m|0){if(!m){n=1;o=j;p=k;while(1){if(p){q=n;r=0;while(1){s=(f[o>>2]&1<>2]&1<>2]&1<>2]&1<>2]=f[a+12>>2];m=b+16|0;w=m;v=f[w>>2]|0;j=f[w+4>>2]|0;if((j|0)>0|(j|0)==0&v>>>0>0){x=j;y=v}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;v=m;x=f[v+4>>2]|0;y=f[v>>2]|0}f[g>>2]=f[a+20>>2];if((x|0)>0|(x|0)==0&y>>>0>0){Fj(h);u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;Fj(h);u=c;return 1}function _d(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;switch(b-a>>2|0){case 2:{d=b+-4|0;e=f[d>>2]|0;g=f[a>>2]|0;h=f[c>>2]|0;i=f[h>>2]|0;j=(f[h+4>>2]|0)-i>>3;if(j>>>0<=e>>>0)aq(h);k=i;if(j>>>0<=g>>>0)aq(h);if((f[k+(e<<3)>>2]|0)>>>0>=(f[k+(g<<3)>>2]|0)>>>0){l=1;return l|0}f[a>>2]=e;f[d>>2]=g;l=1;return l|0}case 3:{Vg(a,a+4|0,b+-4|0,c)|0;l=1;return l|0}case 4:{jh(a,a+4|0,a+8|0,b+-4|0,c)|0;l=1;return l|0}case 5:{ig(a,a+4|0,a+8|0,a+12|0,b+-4|0,c)|0;l=1;return l|0}case 1:case 0:{l=1;return l|0}default:{g=a+8|0;Vg(a,a+4|0,g,c)|0;d=a+12|0;a:do if((d|0)!=(b|0)){e=f[c>>2]|0;k=f[e>>2]|0;h=(f[e+4>>2]|0)-k>>3;j=k;k=d;i=0;m=g;b:while(1){n=f[k>>2]|0;o=f[m>>2]|0;if(h>>>0<=n>>>0){p=14;break}if(h>>>0<=o>>>0){p=16;break}q=j+(n<<3)|0;if((f[q>>2]|0)>>>0<(f[j+(o<<3)>>2]|0)>>>0){r=m;s=k;t=o;while(1){f[s>>2]=t;if((r|0)==(a|0)){u=a;break}o=r+-4|0;t=f[o>>2]|0;if(h>>>0<=t>>>0){p=20;break b}if((f[q>>2]|0)>>>0>=(f[j+(t<<3)>>2]|0)>>>0){u=r;break}else{v=r;r=o;s=v}}f[u>>2]=n;s=i+1|0;if((s|0)==8){w=0;x=(k+4|0)==(b|0);break a}else y=s}else y=i;s=k+4|0;if((s|0)==(b|0)){w=1;x=0;break a}else{r=k;k=s;i=y;m=r}}if((p|0)==14)aq(e);else if((p|0)==16)aq(e);else if((p|0)==20)aq(e)}else{w=1;x=0}while(0);l=x|w;return l|0}}return 0}function $d(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0;c=u;u=u+48|0;d=c+40|0;e=c+36|0;g=c+32|0;h=c;i=a+80|0;ci(f[i>>2]|0,b)|0;wn(h);tk(h);j=f[a+76>>2]|0;k=f[i>>2]|0;i=k>>>5;l=j+(i<<2)|0;m=k&31;k=(i|0)!=0;a:do if(i|m|0){if(!m){n=1;o=j;p=k;while(1){if(p){q=n;r=0;while(1){s=(f[o>>2]&1<>2]&1<>2]&1<>2]&1<>2]=f[a+12>>2];m=b+16|0;w=m;v=f[w>>2]|0;j=f[w+4>>2]|0;if((j|0)>0|(j|0)==0&v>>>0>0){x=j;y=v}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;v=m;x=f[v+4>>2]|0;y=f[v>>2]|0}f[g>>2]=f[a+16>>2];if((x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21}}else{G=(f[t>>2]|0)+g|0;H=21}if((H|0)==21){H=0;f[C>>2]=G}m=m+1|0;A=f[l>>2]|0;if((m|0)>=(A|0))break;else z=F}}w=w+-1|0;if((w|0)<=-1){H=5;break}z=f[d>>2]|0;x=f[z>>2]|0;if((f[z+4>>2]|0)-x>>2>>>0<=w>>>0){y=z;H=6;break}}if((H|0)==5){u=h;return 1}else if((H|0)==6)aq(y);return 0} -function $a(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0;b=u;u=u+16|0;c=b;do if(a>>>0<245){d=a>>>0<11?16:a+11&-8;e=d>>>3;g=f[4784]|0;h=g>>>e;if(h&3|0){i=(h&1^1)+e|0;j=19176+(i<<1<<2)|0;k=j+8|0;l=f[k>>2]|0;m=l+8|0;n=f[m>>2]|0;if((n|0)==(j|0))f[4784]=g&~(1<>2]=j;f[k>>2]=n}n=i<<3;f[l+4>>2]=n|3;i=l+n+4|0;f[i>>2]=f[i>>2]|1;o=m;u=b;return o|0}m=f[4786]|0;if(d>>>0>m>>>0){if(h|0){i=2<>>12&16;e=i>>>n;i=e>>>5&8;h=e>>>i;e=h>>>2&4;l=h>>>e;h=l>>>1&2;k=l>>>h;l=k>>>1&1;j=(i|n|e|h|l)+(k>>>l)|0;l=19176+(j<<1<<2)|0;k=l+8|0;h=f[k>>2]|0;e=h+8|0;n=f[e>>2]|0;if((n|0)==(l|0)){i=g&~(1<>2]=l;f[k>>2]=n;p=g}n=j<<3;j=n-d|0;f[h+4>>2]=d|3;k=h+d|0;f[k+4>>2]=j|1;f[h+n>>2]=j;if(m|0){n=f[4789]|0;h=m>>>3;l=19176+(h<<1<<2)|0;i=1<>2]|0;r=i}f[r>>2]=n;f[q+12>>2]=n;f[n+8>>2]=q;f[n+12>>2]=l}f[4786]=j;f[4789]=k;o=e;u=b;return o|0}e=f[4785]|0;if(e){k=(e&0-e)+-1|0;j=k>>>12&16;l=k>>>j;k=l>>>5&8;n=l>>>k;l=n>>>2&4;i=n>>>l;n=i>>>1&2;h=i>>>n;i=h>>>1&1;s=f[19440+((k|j|l|n|i)+(h>>>i)<<2)>>2]|0;i=(f[s+4>>2]&-8)-d|0;h=f[s+16+(((f[s+16>>2]|0)==0&1)<<2)>>2]|0;if(!h){t=s;v=i}else{n=s;s=i;i=h;while(1){h=(f[i+4>>2]&-8)-d|0;l=h>>>0>>0;j=l?h:s;h=l?i:n;i=f[i+16+(((f[i+16>>2]|0)==0&1)<<2)>>2]|0;if(!i){t=h;v=j;break}else{n=h;s=j}}}s=t+d|0;if(s>>>0>t>>>0){n=f[t+24>>2]|0;i=f[t+12>>2]|0;do if((i|0)==(t|0)){j=t+20|0;h=f[j>>2]|0;if(!h){l=t+16|0;k=f[l>>2]|0;if(!k){w=0;break}else{x=k;y=l}}else{x=h;y=j}while(1){j=x+20|0;h=f[j>>2]|0;if(h|0){x=h;y=j;continue}j=x+16|0;h=f[j>>2]|0;if(!h)break;else{x=h;y=j}}f[y>>2]=0;w=x}else{j=f[t+8>>2]|0;f[j+12>>2]=i;f[i+8>>2]=j;w=i}while(0);do if(n|0){i=f[t+28>>2]|0;j=19440+(i<<2)|0;if((t|0)==(f[j>>2]|0)){f[j>>2]=w;if(!w){f[4785]=e&~(1<>2]|0)!=(t|0)&1)<<2)>>2]=w;if(!w)break}f[w+24>>2]=n;i=f[t+16>>2]|0;if(i|0){f[w+16>>2]=i;f[i+24>>2]=w}i=f[t+20>>2]|0;if(i|0){f[w+20>>2]=i;f[i+24>>2]=w}}while(0);if(v>>>0<16){n=v+d|0;f[t+4>>2]=n|3;e=t+n+4|0;f[e>>2]=f[e>>2]|1}else{f[t+4>>2]=d|3;f[s+4>>2]=v|1;f[s+v>>2]=v;if(m|0){e=f[4789]|0;n=m>>>3;i=19176+(n<<1<<2)|0;j=1<>2]|0;A=j}f[A>>2]=e;f[z+12>>2]=e;f[e+8>>2]=z;f[e+12>>2]=i}f[4786]=v;f[4789]=s}o=t+8|0;u=b;return o|0}else B=d}else B=d}else B=d}else if(a>>>0<=4294967231){i=a+11|0;e=i&-8;j=f[4785]|0;if(j){n=0-e|0;h=i>>>8;if(h)if(e>>>0>16777215)C=31;else{i=(h+1048320|0)>>>16&8;l=h<>>16&4;k=l<>>16&2;D=14-(h|i|l)+(k<>>15)|0;C=e>>>(D+7|0)&1|D<<1}else C=0;D=f[19440+(C<<2)>>2]|0;a:do if(!D){E=0;F=0;G=n;H=57}else{l=0;k=n;i=D;h=e<<((C|0)==31?0:25-(C>>>1)|0);I=0;while(1){J=(f[i+4>>2]&-8)-e|0;if(J>>>0>>0)if(!J){K=0;L=i;M=i;H=61;break a}else{N=i;O=J}else{N=l;O=k}J=f[i+20>>2]|0;i=f[i+16+(h>>>31<<2)>>2]|0;P=(J|0)==0|(J|0)==(i|0)?I:J;J=(i|0)==0;if(J){E=P;F=N;G=O;H=57;break}else{l=N;k=O;h=h<<((J^1)&1);I=P}}}while(0);if((H|0)==57){if((E|0)==0&(F|0)==0){D=2<>>12&16;d=D>>>n;D=d>>>5&8;s=d>>>D;d=s>>>2&4;g=s>>>d;s=g>>>1&2;m=g>>>s;g=m>>>1&1;Q=0;R=f[19440+((D|n|d|s|g)+(m>>>g)<<2)>>2]|0}else{Q=F;R=E}if(!R){S=Q;T=G}else{K=G;L=R;M=Q;H=61}}if((H|0)==61)while(1){H=0;g=(f[L+4>>2]&-8)-e|0;m=g>>>0>>0;s=m?g:K;g=m?L:M;L=f[L+16+(((f[L+16>>2]|0)==0&1)<<2)>>2]|0;if(!L){S=g;T=s;break}else{K=s;M=g;H=61}}if((S|0)!=0?T>>>0<((f[4786]|0)-e|0)>>>0:0){g=S+e|0;if(g>>>0<=S>>>0){o=0;u=b;return o|0}s=f[S+24>>2]|0;m=f[S+12>>2]|0;do if((m|0)==(S|0)){d=S+20|0;n=f[d>>2]|0;if(!n){D=S+16|0;I=f[D>>2]|0;if(!I){U=0;break}else{V=I;W=D}}else{V=n;W=d}while(1){d=V+20|0;n=f[d>>2]|0;if(n|0){V=n;W=d;continue}d=V+16|0;n=f[d>>2]|0;if(!n)break;else{V=n;W=d}}f[W>>2]=0;U=V}else{d=f[S+8>>2]|0;f[d+12>>2]=m;f[m+8>>2]=d;U=m}while(0);do if(s){m=f[S+28>>2]|0;d=19440+(m<<2)|0;if((S|0)==(f[d>>2]|0)){f[d>>2]=U;if(!U){d=j&~(1<>2]|0)!=(S|0)&1)<<2)>>2]=U;if(!U){X=j;break}}f[U+24>>2]=s;d=f[S+16>>2]|0;if(d|0){f[U+16>>2]=d;f[d+24>>2]=U}d=f[S+20>>2]|0;if(d){f[U+20>>2]=d;f[d+24>>2]=U;X=j}else X=j}else X=j;while(0);do if(T>>>0>=16){f[S+4>>2]=e|3;f[g+4>>2]=T|1;f[g+T>>2]=T;j=T>>>3;if(T>>>0<256){s=19176+(j<<1<<2)|0;d=f[4784]|0;m=1<>2]|0;Z=m}f[Z>>2]=g;f[Y+12>>2]=g;f[g+8>>2]=Y;f[g+12>>2]=s;break}s=T>>>8;if(s)if(T>>>0>16777215)_=31;else{m=(s+1048320|0)>>>16&8;d=s<>>16&4;j=d<>>16&2;n=14-(s|m|d)+(j<>>15)|0;_=T>>>(n+7|0)&1|n<<1}else _=0;n=19440+(_<<2)|0;f[g+28>>2]=_;d=g+16|0;f[d+4>>2]=0;f[d>>2]=0;d=1<<_;if(!(X&d)){f[4785]=X|d;f[n>>2]=g;f[g+24>>2]=n;f[g+12>>2]=g;f[g+8>>2]=g;break}d=T<<((_|0)==31?0:25-(_>>>1)|0);j=f[n>>2]|0;while(1){if((f[j+4>>2]&-8|0)==(T|0)){H=97;break}$=j+16+(d>>>31<<2)|0;n=f[$>>2]|0;if(!n){H=96;break}else{d=d<<1;j=n}}if((H|0)==96){f[$>>2]=g;f[g+24>>2]=j;f[g+12>>2]=g;f[g+8>>2]=g;break}else if((H|0)==97){d=j+8|0;n=f[d>>2]|0;f[n+12>>2]=g;f[d>>2]=g;f[g+8>>2]=n;f[g+12>>2]=j;f[g+24>>2]=0;break}}else{n=T+e|0;f[S+4>>2]=n|3;d=S+n+4|0;f[d>>2]=f[d>>2]|1}while(0);o=S+8|0;u=b;return o|0}else B=e}else B=e}else B=-1;while(0);S=f[4786]|0;if(S>>>0>=B>>>0){T=S-B|0;$=f[4789]|0;if(T>>>0>15){_=$+B|0;f[4789]=_;f[4786]=T;f[_+4>>2]=T|1;f[$+S>>2]=T;f[$+4>>2]=B|3}else{f[4786]=0;f[4789]=0;f[$+4>>2]=S|3;T=$+S+4|0;f[T>>2]=f[T>>2]|1}o=$+8|0;u=b;return o|0}$=f[4787]|0;if($>>>0>B>>>0){T=$-B|0;f[4787]=T;S=f[4790]|0;_=S+B|0;f[4790]=_;f[_+4>>2]=T|1;f[S+4>>2]=B|3;o=S+8|0;u=b;return o|0}if(!(f[4902]|0)){f[4904]=4096;f[4903]=4096;f[4905]=-1;f[4906]=-1;f[4907]=0;f[4895]=0;f[4902]=c&-16^1431655768;aa=4096}else aa=f[4904]|0;c=B+48|0;S=B+47|0;T=aa+S|0;_=0-aa|0;aa=T&_;if(aa>>>0<=B>>>0){o=0;u=b;return o|0}X=f[4894]|0;if(X|0?(Y=f[4892]|0,Z=Y+aa|0,Z>>>0<=Y>>>0|Z>>>0>X>>>0):0){o=0;u=b;return o|0}b:do if(!(f[4895]&4)){X=f[4790]|0;c:do if(X){Z=19584;while(1){Y=f[Z>>2]|0;if(Y>>>0<=X>>>0?(ba=Z+4|0,(Y+(f[ba>>2]|0)|0)>>>0>X>>>0):0)break;Y=f[Z+8>>2]|0;if(!Y){H=118;break c}else Z=Y}j=T-$&_;if(j>>>0<2147483647){Y=Nl(j|0)|0;if((Y|0)==((f[Z>>2]|0)+(f[ba>>2]|0)|0))if((Y|0)==(-1|0))ca=j;else{da=j;ea=Y;H=135;break b}else{fa=Y;ga=j;H=126}}else ca=0}else H=118;while(0);do if((H|0)==118){X=Nl(0)|0;if((X|0)!=(-1|0)?(e=X,j=f[4903]|0,Y=j+-1|0,U=((Y&e|0)==0?0:(Y+e&0-j)-e|0)+aa|0,e=f[4892]|0,j=U+e|0,U>>>0>B>>>0&U>>>0<2147483647):0){Y=f[4894]|0;if(Y|0?j>>>0<=e>>>0|j>>>0>Y>>>0:0){ca=0;break}Y=Nl(U|0)|0;if((Y|0)==(X|0)){da=U;ea=X;H=135;break b}else{fa=Y;ga=U;H=126}}else ca=0}while(0);do if((H|0)==126){U=0-ga|0;if(!(c>>>0>ga>>>0&(ga>>>0<2147483647&(fa|0)!=(-1|0))))if((fa|0)==(-1|0)){ca=0;break}else{da=ga;ea=fa;H=135;break b}Y=f[4904]|0;X=S-ga+Y&0-Y;if(X>>>0>=2147483647){da=ga;ea=fa;H=135;break b}if((Nl(X|0)|0)==(-1|0)){Nl(U|0)|0;ca=0;break}else{da=X+ga|0;ea=fa;H=135;break b}}while(0);f[4895]=f[4895]|4;ha=ca;H=133}else{ha=0;H=133}while(0);if(((H|0)==133?aa>>>0<2147483647:0)?(ca=Nl(aa|0)|0,aa=Nl(0)|0,fa=aa-ca|0,ga=fa>>>0>(B+40|0)>>>0,!((ca|0)==(-1|0)|ga^1|ca>>>0>>0&((ca|0)!=(-1|0)&(aa|0)!=(-1|0))^1)):0){da=ga?fa:ha;ea=ca;H=135}if((H|0)==135){ca=(f[4892]|0)+da|0;f[4892]=ca;if(ca>>>0>(f[4893]|0)>>>0)f[4893]=ca;ca=f[4790]|0;do if(ca){ha=19584;while(1){ia=f[ha>>2]|0;ja=ha+4|0;ka=f[ja>>2]|0;if((ea|0)==(ia+ka|0)){H=143;break}fa=f[ha+8>>2]|0;if(!fa)break;else ha=fa}if(((H|0)==143?(f[ha+12>>2]&8|0)==0:0)?ea>>>0>ca>>>0&ia>>>0<=ca>>>0:0){f[ja>>2]=ka+da;fa=(f[4787]|0)+da|0;ga=ca+8|0;aa=(ga&7|0)==0?0:0-ga&7;ga=ca+aa|0;S=fa-aa|0;f[4790]=ga;f[4787]=S;f[ga+4>>2]=S|1;f[ca+fa+4>>2]=40;f[4791]=f[4906];break}if(ea>>>0<(f[4788]|0)>>>0)f[4788]=ea;fa=ea+da|0;S=19584;while(1){if((f[S>>2]|0)==(fa|0)){H=151;break}ga=f[S+8>>2]|0;if(!ga){la=19584;break}else S=ga}if((H|0)==151)if(!(f[S+12>>2]&8)){f[S>>2]=ea;ha=S+4|0;f[ha>>2]=(f[ha>>2]|0)+da;ha=ea+8|0;ga=ea+((ha&7|0)==0?0:0-ha&7)|0;ha=fa+8|0;aa=fa+((ha&7|0)==0?0:0-ha&7)|0;ha=ga+B|0;c=aa-ga-B|0;f[ga+4>>2]=B|3;do if((ca|0)!=(aa|0)){if((f[4789]|0)==(aa|0)){ba=(f[4786]|0)+c|0;f[4786]=ba;f[4789]=ha;f[ha+4>>2]=ba|1;f[ha+ba>>2]=ba;break}ba=f[aa+4>>2]|0;if((ba&3|0)==1){_=ba&-8;$=ba>>>3;d:do if(ba>>>0<256){T=f[aa+8>>2]|0;X=f[aa+12>>2]|0;if((X|0)==(T|0)){f[4784]=f[4784]&~(1<<$);break}else{f[T+12>>2]=X;f[X+8>>2]=T;break}}else{T=f[aa+24>>2]|0;X=f[aa+12>>2]|0;do if((X|0)==(aa|0)){U=aa+16|0;Y=U+4|0;j=f[Y>>2]|0;if(!j){e=f[U>>2]|0;if(!e){ma=0;break}else{na=e;oa=U}}else{na=j;oa=Y}while(1){Y=na+20|0;j=f[Y>>2]|0;if(j|0){na=j;oa=Y;continue}Y=na+16|0;j=f[Y>>2]|0;if(!j)break;else{na=j;oa=Y}}f[oa>>2]=0;ma=na}else{Y=f[aa+8>>2]|0;f[Y+12>>2]=X;f[X+8>>2]=Y;ma=X}while(0);if(!T)break;X=f[aa+28>>2]|0;Y=19440+(X<<2)|0;do if((f[Y>>2]|0)!=(aa|0)){f[T+16+(((f[T+16>>2]|0)!=(aa|0)&1)<<2)>>2]=ma;if(!ma)break d}else{f[Y>>2]=ma;if(ma|0)break;f[4785]=f[4785]&~(1<>2]=T;X=aa+16|0;Y=f[X>>2]|0;if(Y|0){f[ma+16>>2]=Y;f[Y+24>>2]=ma}Y=f[X+4>>2]|0;if(!Y)break;f[ma+20>>2]=Y;f[Y+24>>2]=ma}while(0);pa=aa+_|0;qa=_+c|0}else{pa=aa;qa=c}$=pa+4|0;f[$>>2]=f[$>>2]&-2;f[ha+4>>2]=qa|1;f[ha+qa>>2]=qa;$=qa>>>3;if(qa>>>0<256){ba=19176+($<<1<<2)|0;Z=f[4784]|0;Y=1<<$;if(!(Z&Y)){f[4784]=Z|Y;ra=ba;sa=ba+8|0}else{Y=ba+8|0;ra=f[Y>>2]|0;sa=Y}f[sa>>2]=ha;f[ra+12>>2]=ha;f[ha+8>>2]=ra;f[ha+12>>2]=ba;break}ba=qa>>>8;do if(!ba)ta=0;else{if(qa>>>0>16777215){ta=31;break}Y=(ba+1048320|0)>>>16&8;Z=ba<>>16&4;X=Z<<$;Z=(X+245760|0)>>>16&2;j=14-($|Y|Z)+(X<>>15)|0;ta=qa>>>(j+7|0)&1|j<<1}while(0);ba=19440+(ta<<2)|0;f[ha+28>>2]=ta;_=ha+16|0;f[_+4>>2]=0;f[_>>2]=0;_=f[4785]|0;j=1<>2]=ha;f[ha+24>>2]=ba;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}j=qa<<((ta|0)==31?0:25-(ta>>>1)|0);_=f[ba>>2]|0;while(1){if((f[_+4>>2]&-8|0)==(qa|0)){H=192;break}ua=_+16+(j>>>31<<2)|0;ba=f[ua>>2]|0;if(!ba){H=191;break}else{j=j<<1;_=ba}}if((H|0)==191){f[ua>>2]=ha;f[ha+24>>2]=_;f[ha+12>>2]=ha;f[ha+8>>2]=ha;break}else if((H|0)==192){j=_+8|0;ba=f[j>>2]|0;f[ba+12>>2]=ha;f[j>>2]=ha;f[ha+8>>2]=ba;f[ha+12>>2]=_;f[ha+24>>2]=0;break}}else{ba=(f[4787]|0)+c|0;f[4787]=ba;f[4790]=ha;f[ha+4>>2]=ba|1}while(0);o=ga+8|0;u=b;return o|0}else la=19584;while(1){ha=f[la>>2]|0;if(ha>>>0<=ca>>>0?(va=ha+(f[la+4>>2]|0)|0,va>>>0>ca>>>0):0)break;la=f[la+8>>2]|0}ga=va+-47|0;ha=ga+8|0;c=ga+((ha&7|0)==0?0:0-ha&7)|0;ha=ca+16|0;ga=c>>>0>>0?ca:c;c=ga+8|0;aa=da+-40|0;fa=ea+8|0;S=(fa&7|0)==0?0:0-fa&7;fa=ea+S|0;ba=aa-S|0;f[4790]=fa;f[4787]=ba;f[fa+4>>2]=ba|1;f[ea+aa+4>>2]=40;f[4791]=f[4906];aa=ga+4|0;f[aa>>2]=27;f[c>>2]=f[4896];f[c+4>>2]=f[4897];f[c+8>>2]=f[4898];f[c+12>>2]=f[4899];f[4896]=ea;f[4897]=da;f[4899]=0;f[4898]=c;c=ga+24|0;do{ba=c;c=c+4|0;f[c>>2]=7}while((ba+8|0)>>>0>>0);if((ga|0)!=(ca|0)){c=ga-ca|0;f[aa>>2]=f[aa>>2]&-2;f[ca+4>>2]=c|1;f[ga>>2]=c;ba=c>>>3;if(c>>>0<256){fa=19176+(ba<<1<<2)|0;S=f[4784]|0;j=1<>2]|0;xa=j}f[xa>>2]=ca;f[wa+12>>2]=ca;f[ca+8>>2]=wa;f[ca+12>>2]=fa;break}fa=c>>>8;if(fa)if(c>>>0>16777215)ya=31;else{j=(fa+1048320|0)>>>16&8;S=fa<>>16&4;ba=S<>>16&2;Z=14-(fa|j|S)+(ba<>>15)|0;ya=c>>>(Z+7|0)&1|Z<<1}else ya=0;Z=19440+(ya<<2)|0;f[ca+28>>2]=ya;f[ca+20>>2]=0;f[ha>>2]=0;S=f[4785]|0;ba=1<>2]=ca;f[ca+24>>2]=Z;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}ba=c<<((ya|0)==31?0:25-(ya>>>1)|0);S=f[Z>>2]|0;while(1){if((f[S+4>>2]&-8|0)==(c|0)){H=213;break}za=S+16+(ba>>>31<<2)|0;Z=f[za>>2]|0;if(!Z){H=212;break}else{ba=ba<<1;S=Z}}if((H|0)==212){f[za>>2]=ca;f[ca+24>>2]=S;f[ca+12>>2]=ca;f[ca+8>>2]=ca;break}else if((H|0)==213){ba=S+8|0;c=f[ba>>2]|0;f[c+12>>2]=ca;f[ba>>2]=ca;f[ca+8>>2]=c;f[ca+12>>2]=S;f[ca+24>>2]=0;break}}}else{c=f[4788]|0;if((c|0)==0|ea>>>0>>0)f[4788]=ea;f[4896]=ea;f[4897]=da;f[4899]=0;f[4793]=f[4902];f[4792]=-1;f[4797]=19176;f[4796]=19176;f[4799]=19184;f[4798]=19184;f[4801]=19192;f[4800]=19192;f[4803]=19200;f[4802]=19200;f[4805]=19208;f[4804]=19208;f[4807]=19216;f[4806]=19216;f[4809]=19224;f[4808]=19224;f[4811]=19232;f[4810]=19232;f[4813]=19240;f[4812]=19240;f[4815]=19248;f[4814]=19248;f[4817]=19256;f[4816]=19256;f[4819]=19264;f[4818]=19264;f[4821]=19272;f[4820]=19272;f[4823]=19280;f[4822]=19280;f[4825]=19288;f[4824]=19288;f[4827]=19296;f[4826]=19296;f[4829]=19304;f[4828]=19304;f[4831]=19312;f[4830]=19312;f[4833]=19320;f[4832]=19320;f[4835]=19328;f[4834]=19328;f[4837]=19336;f[4836]=19336;f[4839]=19344;f[4838]=19344;f[4841]=19352;f[4840]=19352;f[4843]=19360;f[4842]=19360;f[4845]=19368;f[4844]=19368;f[4847]=19376;f[4846]=19376;f[4849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[kb+(lb<<2)>>2]|0)-(f[Ea+(lb<<2)>>2]|0)|0;mb=((nb|0)>-1?nb:0-nb|0)+jb|0;f[pa+(lb<<2)>>2]=nb;f[sb+(lb<<2)>>2]=nb<<1^nb>>31;lb=lb+1|0;if((lb|0)==(g|0)){tb=mb;ub=sb;break}else jb=mb}}else{tb=0;ub=f[_>>2]|0}while(0);mo(j,$,ub,g);kb=Zk(j)|0;jb=I;lb=Bm(j)|0;mb=I;Xa=+wm(Ca,ib);nb=Vn(lb|0,mb|0,kb|0,jb|0)|0;Va=+W(+(Xa*Wa));jb=Vn(nb|0,I|0,~~Va>>>0|0,(+K(Va)>=1.0?(Va>0.0?~~+Y(+J(Va/4294967296.0),4294967295.0)>>>0:~~+W((Va-+(~~Va>>>0))/4294967296.0)>>>0):0)|0)|0;nb=f[r>>2]|0;if(!((nb|0)<=(jb|0)?!((nb|0)>=(jb|0)?(tb|0)<(f[U>>2]|0):0):0)){nb=r;f[nb>>2]=jb;f[nb+4>>2]=tb;b[V>>0]=qb;f[Z>>2]=hb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[k>>2]=f[v>>2];f[j>>2]=f[w>>2];Jf(aa,k,j);f[x>>2]=Ja;f[y>>2]=Ia;f[k>>2]=f[x>>2];f[j>>2]=f[y>>2];Jf(ba,k,j)}if(La)break;vb=b[Ha>>0]|0;nb=-1;jb=vb;while(1){kb=nb+-1|0;wb=Ma+kb|0;mb=jb;jb=b[wb>>0]|0;if((jb&255)<(mb&255))break;if((wb|0)==(n|0)){xb=84;break d}else nb=kb}kb=Ma+nb|0;if((jb&255)<(vb&255)){yb=Ha;zb=vb}else{mb=Ma;lb=Ha;while(1){ob=lb+-1|0;if((jb&255)<(h[mb+-2>>0]|0)){yb=ob;zb=1;break}else{Ab=lb;lb=ob;mb=Ab}}}b[wb>>0]=zb;b[yb>>0]=jb;if((nb|0)<-1){Bb=kb;Cb=Ha}else continue;while(1){mb=b[Bb>>0]|0;b[Bb>>0]=b[Cb>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b=0,Mb=0,Nb=0,Ob=0,Pb=0,Qb=0;i=u;u=u+240|0;j=i+104|0;k=i+224|0;l=i+176|0;m=i+160|0;n=i+228|0;o=i+72|0;p=i+40|0;q=i+132|0;r=i;s=i+172|0;t=i+156|0;v=i+152|0;w=i+148|0;x=i+144|0;y=i+128|0;z=a+8|0;Mh(z,c,e,g);e=f[a+48>>2]|0;A=f[a+52>>2]|0;B=l;C=B+48|0;do{f[B>>2]=0;B=B+4|0}while((B|0)<(C|0));if(!g){D=0;E=0}else{Ci(l,g);D=f[l+12>>2]|0;E=f[l+16>>2]|0}B=l+16|0;C=E-D>>2;F=D;D=E;if(C>>>0>=g>>>0){if(C>>>0>g>>>0?(E=F+(g<<2)|0,(E|0)!=(D|0)):0)f[B>>2]=D+(~((D+-4-E|0)>>>2)<<2)}else Ci(l+12|0,g-C|0);C=l+24|0;E=l+28|0;D=f[E>>2]|0;B=f[C>>2]|0;F=D-B>>2;G=B;B=D;if(F>>>0>=g>>>0){if(F>>>0>g>>>0?(D=G+(g<<2)|0,(D|0)!=(B|0)):0)f[E>>2]=B+(~((B+-4-D|0)>>>2)<<2)}else Ci(C,g-F|0);F=l+36|0;C=l+40|0;D=f[C>>2]|0;B=f[F>>2]|0;E=D-B>>2;G=B;B=D;if(E>>>0>=g>>>0){if(E>>>0>g>>>0?(D=G+(g<<2)|0,(D|0)!=(B|0)):0)f[C>>2]=B+(~((B+-4-D|0)>>>2)<<2)}else Ci(F,g-E|0);f[m>>2]=0;E=m+4|0;f[E>>2]=0;f[m+8>>2]=0;F=(g|0)==0;do if(!F)if(g>>>0>1073741823)aq(m);else{D=g<<2;B=ln(D)|0;f[m>>2]=B;C=B+(g<<2)|0;f[m+8>>2]=C;sj(B|0,0,D|0)|0;f[E>>2]=C;break}while(0);C=a+152|0;D=a+156|0;B=f[D>>2]|0;G=f[C>>2]|0;H=B-G>>2;L=G;G=B;if(H>>>0>=g>>>0){if(H>>>0>g>>>0?(B=L+(g<<2)|0,(B|0)!=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(+(Xa*Wa));lb=Vn(pb|0,I|0,~~Va>>>0|0,(+K(Va)>=1.0?(Va>0.0?~~+Y(+J(Va/4294967296.0),4294967295.0)>>>0:~~+W((Va-+(~~Va>>>0))/4294967296.0)>>>0):0)|0)|0;pb=f[r>>2]|0;if(!((pb|0)<=(lb|0)?!((pb|0)>=(lb|0)?(vb|0)<(f[T>>2]|0):0):0)){pb=r;f[pb>>2]=lb;f[pb+4>>2]=vb;b[U>>0]=sb;f[V>>2]=jb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[k>>2]=f[v>>2];f[j>>2]=f[w>>2];Jf($,k,j);f[x>>2]=Ea;f[y>>2]=Oa;f[k>>2]=f[x>>2];f[j>>2]=f[y>>2];Jf(aa,k,j)}if(Ka)break;xb=b[Ma>>0]|0;pb=-1;lb=xb;while(1){mb=pb+-1|0;yb=Pa+mb|0;ob=lb;lb=b[yb>>0]|0;if((lb&255)<(ob&255))break;if((yb|0)==(n|0)){zb=84;break d}else pb=mb}mb=Pa+pb|0;if((lb&255)<(xb&255)){Ab=Ma;Bb=xb}else{ob=Pa;nb=Ma;while(1){qb=nb+-1|0;if((lb&255)<(h[ob+-2>>0]|0)){Ab=qb;Bb=1;break}else{Cb=nb;nb=qb;ob=Cb}}}b[yb>>0]=Bb;b[Ab>>0]=lb;if((pb|0)<-1){Db=mb;Eb=Ma}else continue;while(1){ob=b[Db>>0]|0;b[Db>>0]=b[Eb>>0]|0;b[Eb>>0]=ob;ob=Db+1|0;nb=Eb+-1|0;if(ob>>>0>>0){Db=ob;Eb=nb}else continue d}}if(((zb|0)==84?(zb=0,hb):0)?(kb=b[n>>0]|0,b[n>>0]=xb,b[Ma>>0]=kb,eb):0){kb=db;mb=la;do{pb=b[mb>>0]|0;b[mb>>0]=b[kb>>0]|0;b[kb>>0]=pb;mb=mb+1|0;kb=kb+-1|0}while(mb>>>0>>0)}if((jb|0)>=(Ha|0)){Ya=fb;Za=Fa;_a=fb;$a=Fa;ab=Oa;bb=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Mb);u=i;return 1}function cb(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;b=u;u=u+16|0;c=b;d=b+8|0;e=b+4|0;f[d>>2]=a;do if(a>>>0>=212){g=(a>>>0)/210|0;h=g*210|0;f[e>>2]=a-h;i=0;j=g;g=(Hl(6952,7144,e,c)|0)-6952>>2;k=h;a:while(1){l=(f[6952+(g<<2)>>2]|0)+k|0;h=5;while(1){if(h>>>0>=47){m=211;n=i;o=8;break}p=f[6760+(h<<2)>>2]|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0

>>0){o=106;break a}if((l|0)==(X(q,p)|0)){r=i;break}else h=h+1|0}b:do if((o|0)==8){c:while(1){o=0;h=(l>>>0)/(m>>>0)|0;do if(h>>>0>=m>>>0)if((l|0)!=(X(h,m)|0)){p=m+10|0;q=(l>>>0)/(p>>>0)|0;if(q>>>0>=p>>>0)if((l|0)!=(X(q,p)|0)){q=m+12|0;s=(l>>>0)/(q>>>0)|0;if(s>>>0>=q>>>0)if((l|0)!=(X(s,q)|0)){s=m+16|0;t=(l>>>0)/(s>>>0)|0;if(t>>>0>=s>>>0)if((l|0)!=(X(t,s)|0)){t=m+18|0;v=(l>>>0)/(t>>>0)|0;if(v>>>0>=t>>>0)if((l|0)!=(X(v,t)|0)){v=m+22|0;w=(l>>>0)/(v>>>0)|0;if(w>>>0>=v>>>0)if((l|0)!=(X(w,v)|0)){w=m+28|0;x=(l>>>0)/(w>>>0)|0;if(x>>>0>=w>>>0)if((l|0)==(X(x,w)|0)){y=w;z=9;A=n}else{x=m+30|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+36|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+40|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+42|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+46|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+52|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+58|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+60|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+66|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+70|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+72|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+78|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+82|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+88|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+96|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+100|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+102|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+106|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+108|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+112|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+120|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+126|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+130|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+136|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+138|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+142|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+148|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+150|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+156|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+162|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+166|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+168|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+172|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+178|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+180|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+186|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+190|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+192|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+196|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+198|0;B=(l>>>0)/(x>>>0)|0;if(B>>>0>>0){y=x;z=1;A=l;break}if((l|0)==(X(B,x)|0)){y=x;z=9;A=n;break}x=m+208|0;B=(l>>>0)/(x>>>0)|0;C=B>>>0>>0;D=(l|0)==(X(B,x)|0);y=C|D?x:m+210|0;z=C?1:D?9:0;A=C?l:n}else{y=w;z=1;A=l}}else{y=v;z=9;A=n}else{y=v;z=1;A=l}}else{y=t;z=9;A=n}else{y=t;z=1;A=l}}else{y=s;z=9;A=n}else{y=s;z=1;A=l}}else{y=q;z=9;A=n}else{y=q;z=1;A=l}}else{y=p;z=9;A=n}else{y=p;z=1;A=l}}else{y=m;z=9;A=n}else{y=m;z=1;A=l}while(0);switch(z&15){case 9:{r=A;break b;break}case 0:{m=y;n=A;o=8;break}default:break c}}if(!z)r=A;else{o=107;break a}}while(0);h=g+1|0;p=(h|0)==48;q=j+(p&1)|0;i=r;j=q;g=p?0:h;k=q*210|0}if((o|0)==106){f[d>>2]=l;E=l;break}else if((o|0)==107){f[d>>2]=l;E=A;break}}else{k=Hl(6760,6952,d,c)|0;E=f[k>>2]|0}while(0);u=b;return E|0}function db(a,c,d,e,g,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,A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>2]|0)/(fb|0)|0;if(!ma){jb=1;do{hb=ib+(jb<<2)|0;f[hb>>2]=(f[hb>>2]|0)/(fb|0)|0;jb=jb+1|0}while((jb|0)!=(g|0));jb=f[_>>2]|0;if(T)qb=jb;else{rb=0;sb=jb;break}}else qb=f[_>>2]|0;jb=0;hb=0;while(1){lb=(f[ib+(jb<<2)>>2]|0)-(f[Ca+(jb<<2)>>2]|0)|0;kb=((lb|0)>-1?lb:0-lb|0)+hb|0;f[na+(jb<<2)>>2]=lb;f[qb+(jb<<2)>>2]=lb<<1^lb>>31;jb=jb+1|0;if((jb|0)==(g|0)){rb=kb;sb=qb;break}else hb=kb}}else{rb=0;sb=f[_>>2]|0}while(0);mo(e,$,sb,g);ib=Zk(e)|0;hb=I;jb=Bm(e)|0;kb=I;Va=+wm(Aa,gb);lb=Vn(jb|0,kb|0,ib|0,hb|0)|0;Ta=+W(+(Va*Ua));hb=Vn(lb|0,I|0,~~Ta>>>0|0,(+K(Ta)>=1.0?(Ta>0.0?~~+Y(+J(Ta/4294967296.0),4294967295.0)>>>0:~~+W((Ta-+(~~Ta>>>0))/4294967296.0)>>>0):0)|0)|0;lb=f[r>>2]|0;if(!((lb|0)<=(hb|0)?!((lb|0)>=(hb|0)?(rb|0)<(f[U>>2]|0):0):0)){lb=r;f[lb>>2]=hb;f[lb+4>>2]=rb;b[V>>0]=ob;f[Z>>2]=fb;f[v>>2]=f[m>>2];f[w>>2]=f[E>>2];f[j>>2]=f[v>>2];f[e>>2]=f[w>>2];Jf(aa,j,e);f[x>>2]=Ha;f[y>>2]=Ga;f[j>>2]=f[x>>2];f[e>>2]=f[y>>2];Jf(ba,j,e)}if(Ja)break;tb=b[Fa>>0]|0;lb=-1;hb=tb;while(1){ib=lb+-1|0;ub=Ka+ib|0;kb=hb;hb=b[ub>>0]|0;if((hb&255)<(kb&255))break;if((ub|0)==(n|0)){vb=84;break d}else lb=ib}ib=Ka+lb|0;if((hb&255)<(tb&255)){wb=Fa;xb=tb}else{k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|0)|0;x=o&31;y=w+(v<<2)|0;if(x|0)f[y>>2]=f[y>>2]&~(-1>>>(32-x|0));if(o>>>0>2){x=a+12|0;y=a+32|0;v=a+52|0;w=a+56|0;z=a+48|0;A=b;B=k;C=0;D=q;E=r;a:while(1){F=B;G=C*3|0;if((G|0)!=-1){H=f[F+(G<<2)>>2]|0;I=G+1|0;J=((I>>>0)%3|0|0)==0?G+-2|0:I;if((J|0)==-1)K=-1;else K=f[F+(J<<2)>>2]|0;J=(((G>>>0)%3|0|0)==0?2:-1)+G|0;if((J|0)==-1)L=-1;else L=f[F+(J<<2)>>2]|0;if((H|0)!=(K|0)?!((H|0)==(L|0)|(K|0)==(L|0)):0){H=0;J=A;F=E;I=D;while(1){M=H+G|0;if(!(f[(f[e>>2]|0)+(M>>>5<<2)>>2]&1<<(M&31))){N=f[(f[a>>2]|0)+(M<<2)>>2]|0;f[g>>2]=N;if(!(f[F+(N>>>5<<2)>>2]&1<<(N&31))){O=0;P=J;Q=N}else{N=f[i>>2]|0;if((N|0)==(f[y>>2]|0))Ri(h,6140);else{f[N>>2]=-1;f[i>>2]=N+4}N=f[v>>2]|0;if((N|0)==(f[w>>2]|0))Ri(z,g);else{f[N>>2]=f[g>>2];f[v>>2]=N+4}N=f[l>>2]|0;R=f[j>>2]|0;if((N|0)==(R<<5|0)){if((N+1|0)<0){S=50;break a}T=R<<6;R=N+32&-32;vi(d,N>>>0<1073741823?(T>>>0>>0?R:T):2147483647);U=f[l>>2]|0}else U=N;f[l>>2]=U+1;N=(f[d>>2]|0)+(U>>>5<<2)|0;f[N>>2]=f[N>>2]&~(1<<(U&31));f[g>>2]=J;O=1;P=J+1|0;Q=J}N=f[d>>2]|0;T=N+(Q>>>5<<2)|0;f[T>>2]=f[T>>2]|1<<(Q&31);T=N;b:do if(O){R=M;while(1){if((R|0)==-1){S=64;break b}V=(f[e>>2]|0)+(R>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(R&31);V=f[g>>2]|0;f[(f[h>>2]|0)+(V<<2)>>2]=R;f[(f[a>>2]|0)+(R<<2)>>2]=V;V=R+1|0;W=((V>>>0)%3|0|0)==0?R+-2|0:V;do if((W|0)==-1)X=-1;else{V=f[(f[x>>2]|0)+(W<<2)>>2]|0;Y=V+1|0;if((V|0)==-1){X=-1;break}X=((Y>>>0)%3|0|0)==0?V+-2|0:Y}while(0);if((X|0)==(M|0))break;else R=X}}else{R=M;while(1){if((R|0)==-1){S=64;break b}W=(f[e>>2]|0)+(R>>>5<<2)|0;f[W>>2]=f[W>>2]|1<<(R&31);f[(f[h>>2]|0)+(f[g>>2]<<2)>>2]=R;W=R+1|0;Y=((W>>>0)%3|0|0)==0?R+-2|0:W;do if((Y|0)==-1)Z=-1;else{W=f[(f[x>>2]|0)+(Y<<2)>>2]|0;V=W+1|0;if((W|0)==-1){Z=-1;break}Z=((V>>>0)%3|0|0)==0?W+-2|0:V}while(0);if((Z|0)==(M|0))break;else R=Z}}while(0);c:do if((S|0)==64){S=0;if((M|0)==-1)break;R=(((M>>>0)%3|0|0)==0?2:-1)+M|0;if((R|0)==-1)break;Y=f[(f[x>>2]|0)+(R<<2)>>2]|0;if((Y|0)==-1)break;R=Y+(((Y>>>0)%3|0|0)==0?2:-1)|0;if((R|0)==-1)break;if(!O){Y=R;while(1){V=(f[e>>2]|0)+(Y>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(Y&31);V=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((V|0)==-1)break c;W=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((W|0)==-1)break c;Y=W+(((W>>>0)%3|0|0)==0?2:-1)|0;if((Y|0)==-1)break c}}Y=f[a>>2]|0;W=R;do{V=(f[e>>2]|0)+(W>>>5<<2)|0;f[V>>2]=f[V>>2]|1<<(W&31);f[Y+(W<<2)>>2]=f[g>>2];V=(((W>>>0)%3|0|0)==0?2:-1)+W|0;if((V|0)==-1)break c;_=f[(f[x>>2]|0)+(V<<2)>>2]|0;if((_|0)==-1)break c;W=_+(((_>>>0)%3|0|0)==0?2:-1)|0}while((W|0)!=-1)}while(0);$=P;aa=T;ba=N}else{$=J;aa=I;ba=F}if((H|0)<2){H=H+1|0;J=$;F=ba;I=aa}else{ca=$;da=aa;ea=ba;break}}}else{ca=A;da=D;ea=E}}else{ca=A;da=D;ea=E}C=C+1|0;B=f[a>>2]|0;if(C>>>0>=(((f[m>>2]|0)-B>>2>>>0)/3|0)>>>0){S=18;break}else{A=ca;D=da;E=ea}}if((S|0)==18){fa=da;ga=f[l>>2]|0;break}else if((S|0)==50)aq(d)}else{fa=q;ga=p}}else{fa=q;ga=p}while(0);p=a+44|0;f[p>>2]=0;a=fa;fa=ga>>>5;q=a+(fa<<2)|0;S=ga&31;ga=(fa|0)!=0;d:do if(fa|S|0)if(!S){l=a;da=0;ea=ga;while(1){e:do if(ea){if(!(f[l>>2]&1)){ca=da+1|0;f[p>>2]=ca;ha=ca}else ha=da;if(!(f[l>>2]&2)){ca=ha+1|0;f[p>>2]=ca;ia=ca}else ia=ha;if(!(f[l>>2]&4)){ca=ia+1|0;f[p>>2]=ca;ja=ca}else ja=ia;if(!(f[l>>2]&8)){ca=ja+1|0;f[p>>2]=ca;ka=ca}else ka=ja;if(!(f[l>>2]&16)){ca=ka+1|0;f[p>>2]=ca;la=ca}else la=ka;if(!(f[l>>2]&32)){ca=la+1|0;f[p>>2]=ca;ma=ca}else ma=la;if(!(f[l>>2]&64)){ca=ma+1|0;f[p>>2]=ca;na=ca}else na=ma;if(!(f[l>>2]&128)){ca=na+1|0;f[p>>2]=ca;oa=ca}else oa=na;if(!(f[l>>2]&256)){ca=oa+1|0;f[p>>2]=ca;pa=ca}else pa=oa;if(!(f[l>>2]&512)){ca=pa+1|0;f[p>>2]=ca;qa=ca}else qa=pa;if(!(f[l>>2]&1024)){ca=qa+1|0;f[p>>2]=ca;ra=ca}else ra=qa;if(!(f[l>>2]&2048)){ca=ra+1|0;f[p>>2]=ca;sa=ca}else sa=ra;if(!(f[l>>2]&4096)){ca=sa+1|0;f[p>>2]=ca;ta=ca}else ta=sa;if(!(f[l>>2]&8192)){ca=ta+1|0;f[p>>2]=ca;ua=ca}else ua=ta;if(!(f[l>>2]&16384)){ca=ua+1|0;f[p>>2]=ca;va=ca}else va=ua;if(!(f[l>>2]&32768)){ca=va+1|0;f[p>>2]=ca;wa=ca}else wa=va;if(!(f[l>>2]&65536)){ca=wa+1|0;f[p>>2]=ca;xa=ca}else xa=wa;if(!(f[l>>2]&131072)){ca=xa+1|0;f[p>>2]=ca;ya=ca}else ya=xa;if(!(f[l>>2]&262144)){ca=ya+1|0;f[p>>2]=ca;za=ca}else za=ya;if(!(f[l>>2]&524288)){ca=za+1|0;f[p>>2]=ca;Aa=ca}else Aa=za;if(!(f[l>>2]&1048576)){ca=Aa+1|0;f[p>>2]=ca;Ba=ca}else Ba=Aa;if(!(f[l>>2]&2097152)){ca=Ba+1|0;f[p>>2]=ca;Ca=ca}else Ca=Ba;if(!(f[l>>2]&4194304)){ca=Ca+1|0;f[p>>2]=ca;Da=ca}else Da=Ca;if(!(f[l>>2]&8388608)){ca=Da+1|0;f[p>>2]=ca;Ea=ca}else Ea=Da;if(!(f[l>>2]&16777216)){ca=Ea+1|0;f[p>>2]=ca;Fa=ca}else Fa=Ea;if(!(f[l>>2]&33554432)){ca=Fa+1|0;f[p>>2]=ca;Ga=ca}else Ga=Fa;if(!(f[l>>2]&67108864)){ca=Ga+1|0;f[p>>2]=ca;Ha=ca}else Ha=Ga;if(!(f[l>>2]&134217728)){ca=Ha+1|0;f[p>>2]=ca;Ia=ca}else Ia=Ha;if(!(f[l>>2]&268435456)){ca=Ia+1|0;f[p>>2]=ca;Ja=ca}else Ja=Ia;if(!(f[l>>2]&536870912)){ca=Ja+1|0;f[p>>2]=ca;Ka=ca}else Ka=Ja;if(!(f[l>>2]&1073741824)){ca=Ka+1|0;f[p>>2]=ca;La=ca}else La=Ka;if((f[l>>2]|0)<=-1){Ma=La;break}ca=La+1|0;f[p>>2]=ca;Ma=ca}else{ca=0;m=da;while(1){if(!(f[l>>2]&1<>2]=ba;Na=ba}else Na=m;if((ca|0)==31){Ma=Na;break e}ca=ca+1|0;if(!ca)break d;else m=Na}}while(0);l=l+4|0;if((q|0)==(l|0))break;else{da=Ma;ea=1}}}else{if(ga){ea=0;da=a;l=0;while(1){if(!(f[da>>2]&1)){m=l+1|0;f[p>>2]=m;Oa=m;Pa=m}else{Oa=l;Pa=ea}if(!(f[da>>2]&2)){m=Oa+1|0;f[p>>2]=m;Qa=m;Ra=m}else{Qa=Oa;Ra=Pa}if(!(f[da>>2]&4)){m=Qa+1|0;f[p>>2]=m;Sa=m;Ta=m}else{Sa=Qa;Ta=Ra}if(!(f[da>>2]&8)){m=Sa+1|0;f[p>>2]=m;Ua=m;Va=m}else{Ua=Sa;Va=Ta}if(!(f[da>>2]&16)){m=Ua+1|0;f[p>>2]=m;Wa=m;Xa=m}else{Wa=Ua;Xa=Va}if(!(f[da>>2]&32)){m=Wa+1|0;f[p>>2]=m;Ya=m;Za=m}else{Ya=Wa;Za=Xa}if(!(f[da>>2]&64)){m=Ya+1|0;f[p>>2]=m;_a=m;$a=m}else{_a=Ya;$a=Za}if(!(f[da>>2]&128)){m=_a+1|0;f[p>>2]=m;ab=m;bb=m}else{ab=_a;bb=$a}if(!(f[da>>2]&256)){m=ab+1|0;f[p>>2]=m;cb=m;db=m}else{cb=ab;db=bb}if(!(f[da>>2]&512)){m=cb+1|0;f[p>>2]=m;eb=m;fb=m}else{eb=cb;fb=db}if(!(f[da>>2]&1024)){m=eb+1|0;f[p>>2]=m;gb=m;hb=m}else{gb=eb;hb=fb}if(!(f[da>>2]&2048)){m=gb+1|0;f[p>>2]=m;ib=m;jb=m}else{ib=gb;jb=hb}if(!(f[da>>2]&4096)){m=ib+1|0;f[p>>2]=m;kb=m;lb=m}else{kb=ib;lb=jb}if(!(f[da>>2]&8192)){m=kb+1|0;f[p>>2]=m;mb=m;nb=m}else{mb=kb;nb=lb}if(!(f[da>>2]&16384)){m=mb+1|0;f[p>>2]=m;ob=m;pb=m}else{ob=mb;pb=nb}if(!(f[da>>2]&32768)){m=ob+1|0;f[p>>2]=m;qb=m;rb=m}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=i+220|0;v=i+216|0;w=i+212|0;x=i+208|0;y=i+152|0;z=f[a+28>>2]|0;A=f[a+32>>2]|0;B=l;C=B+48|0;do{f[B>>2]=0;B=B+4|0}while((B|0)<(C|0));if(!g){D=0;E=0}else{Ci(l,g);D=f[l+12>>2]|0;E=f[l+16>>2]|0}B=l+16|0;C=E-D>>2;F=D;D=E;if(C>>>0>=g>>>0){if(C>>>0>g>>>0?(E=F+(g<<2)|0,(E|0)!=(D|0)):0)f[B>>2]=D+(~((D+-4-E|0)>>>2)<<2)}else Ci(l+12|0,g-C|0);C=l+24|0;E=l+28|0;D=f[E>>2]|0;B=f[C>>2]|0;F=D-B>>2;G=B;B=D;if(F>>>0>=g>>>0){if(F>>>0>g>>>0?(D=G+(g<<2)|0,(D|0)!=(B|0)):0)f[E>>2]=B+(~((B+-4-D|0)>>>2)<<2)}else Ci(C,g-F|0);F=l+36|0;C=l+40|0;D=f[C>>2]|0;B=f[F>>2]|0;E=D-B>>2;G=B;B=D;if(E>>>0>=g>>>0){if(E>>>0>g>>>0?(D=G+(g<<2)|0,(D|0)!=(B|0)):0)f[C>>2]=B+(~((B+-4-D|0)>>>2)<<2)}else Ci(F,g-E|0);f[m>>2]=0;E=m+4|0;f[E>>2]=0;f[m+8>>2]=0;F=(g|0)==0;do if(!F)if(g>>>0>1073741823)aq(m);else{D=g<<2;B=ln(D)|0;f[m>>2]=B;C=B+(g<<2)|0;f[m+8>>2]=C;sj(B|0,0,D|0)|0;f[E>>2]=C;break}while(0);C=a+136|0;D=a+140|0;B=f[D>>2]|0;G=f[C>>2]|0;H=B-G>>2;L=G;G=B;if(H>>>0>=g>>>0){if(H>>>0>g>>>0?(B=L+(g<<2)|0,(B|0)!=(G|0)):0)f[D>>2]=G+(~((G+-4-B|0)>>>2)<<2)}else Ci(C,g-H|0);f[o>>2]=0;f[o+4>>2]=0;f[o+8>>2]=0;f[o+12>>2]=0;f[o+16>>2]=0;f[o+20>>2]=0;f[o+24>>2]=0;f[o+28>>2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)!=(g|0));Db=Da}else Db=f[C>>2]|0;lo(e,_,Db,g);if((Fa|0)>0){Eb=a+40+(Aa*12|0)|0;Da=a+40+(Aa*12|0)+4|0;Ca=a+40+(Aa*12|0)+8|0;hb=0;do{La=f[Da>>2]|0;Ja=f[Ca>>2]|0;Ga=(La|0)==(Ja<<5|0);if(!(1<>0])){if(Ga){if((La+1|0)<0){xb=95;break b}Ma=Ja<<6;db=La+32&-32;vi(Eb,La>>>0<1073741823?(Ma>>>0>>0?db:Ma):2147483647);Fb=f[Da>>2]|0}else Fb=La;f[Da>>2]=Fb+1;Ma=(f[Eb>>2]|0)+(Fb>>>5<<2)|0;f[Ma>>2]=f[Ma>>2]|1<<(Fb&31)}else{if(Ga){if((La+1|0)<0){xb=100;break b}Ga=Ja<<6;Ja=La+32&-32;vi(Eb,La>>>0<1073741823?(Ga>>>0>>0?Ja:Ga):2147483647);Gb=f[Da>>2]|0}else Gb=La;f[Da>>2]=Gb+1;La=(f[Eb>>2]|0)+(Gb>>>5<<2)|0;f[La>>2]=f[La>>2]&~(1<<(Gb&31))}hb=hb+1|0}while((hb|0)<(Fa|0))}hb=f[$>>2]|0;Da=d+(Ba<<2)|0;Ca=f[za+4>>2]|0;Aa=f[hb>>2]|0;La=f[hb+4>>2]|0;f[j>>2]=f[za>>2];f[ca>>2]=Ca;f[k>>2]=Aa;f[da>>2]=La;Od(e,ba,j,k);f[Da>>2]=f[e>>2];f[Da+4>>2]=f[ea>>2];Da=f[fa>>2]|0;if(Da|0){La=f[ia>>2]|0;if((La|0)!=(Da|0))f[ia>>2]=La+(~((La+-4-Da|0)>>>2)<<2);Oq(Da)}Da=f[ga>>2]|0;if(Da|0){La=f[ha>>2]|0;if((La|0)!=(Da|0))f[ha>>2]=La+(~((La+-4-Da|0)>>>2)<<2);Oq(Da)}if((na|0)<=2){Hb=Za;Ib=Ya;break a}Da=f[B>>2]|0;wa=f[Da>>2]|0;La=oa+-1|0;if((f[Da+4>>2]|0)-wa>>2>>>0<=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;l=k;a:while(1){k=f[ia+(ha<<2)>>2]|0;ja=f[(f[t+8>>2]|0)+(k<<2)>>2]|0;switch(f[ja+28>>2]|0){case 9:{f[g>>2]=1196;f[s>>2]=-1;f[r>>2]=0;f[r+4>>2]=0;f[r+8>>2]=0;f[r+12>>2]=0;ka=f[l+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;la=ln(32)|0;f[d>>2]=la;f[x>>2]=-2147483616;f[q>>2]=17;ma=la;na=14495;oa=ma+17|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[la+17>>0]=0;pa=ka+16|0;qa=f[pa>>2]|0;if(qa){ra=pa;sa=qa;b:while(1){qa=sa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;ta=f[qa+4>>2]|0;if(!ta){ua=ra;break b}else qa=ta}sa=f[qa>>2]|0;if(!sa){ua=qa;break}else ra=qa}if(((ua|0)!=(pa|0)?(k|0)>=(f[ua+16>>2]|0):0)?(ra=ua+20|0,(Jh(ra,d)|0)!=0):0)va=Hk(ra,d,-1)|0;else wa=17}else wa=17;if((wa|0)==17){wa=0;va=Hk(ka,d,-1)|0}if((b[w>>0]|0)<0)Oq(f[d>>2]|0);if((va|0)<1)xa=1;else{ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;sa=ln(32)|0;f[d>>2]=sa;f[z>>2]=-2147483616;f[A>>2]=19;ma=sa;na=14438;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[sa+19>>0]=0;ka=ra+16|0;pa=f[ka>>2]|0;if(pa){la=ka;ta=pa;c:while(1){pa=ta;while(1){if((f[pa+16>>2]|0)>=(k|0))break;ya=f[pa+4>>2]|0;if(!ya){za=la;break c}else pa=ya}ta=f[pa>>2]|0;if(!ta){za=pa;break}else la=pa}if((za|0)!=(ka|0)?(k|0)>=(f[za+16>>2]|0):0)Aa=za+20|0;else wa=29}else wa=29;if((wa|0)==29){wa=0;Aa=ra}if(!(Jh(Aa,d)|0))Ba=0;else{la=f[(f[j>>2]|0)+48>>2]|0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;ta=ln(32)|0;f[e>>2]=ta;f[X>>2]=-2147483616;f[Y>>2]=18;ma=ta;na=14458;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ta+18>>0]=0;ra=la+16|0;ka=f[ra>>2]|0;if(ka){sa=ra;qa=ka;d:while(1){ka=qa;while(1){if((f[ka+16>>2]|0)>=(k|0))break;ya=f[ka+4>>2]|0;if(!ya){Ca=sa;break d}else ka=ya}qa=f[ka>>2]|0;if(!qa){Ca=ka;break}else sa=ka}if((Ca|0)!=(ra|0)?(k|0)>=(f[Ca+16>>2]|0):0)Da=Ca+20|0;else wa=39}else wa=39;if((wa|0)==39){wa=0;Da=la}sa=(Jh(Da,e)|0)!=0;if((b[Z>>0]|0)<0)Oq(f[e>>2]|0);Ba=sa}if((b[B>>0]|0)<0)Oq(f[d>>2]|0);if(Ba){sa=ja+24|0;qa=b[sa>>0]|0;ta=qa<<24>>24;f[h>>2]=0;f[C>>2]=0;f[D>>2]=0;if(!(qa<<24>>24))Ea=0;else{if(qa<<24>>24<0){wa=48;break a}qa=ta<<2;pa=ln(qa)|0;f[h>>2]=pa;ya=pa+(ta<<2)|0;f[O>>2]=ya;sj(pa|0,0,qa|0)|0;f[C>>2]=ya;Ea=pa}pa=f[(f[j>>2]|0)+48>>2]|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;ya=ln(32)|0;f[i>>2]=ya;f[E>>2]=-2147483616;f[F>>2]=19;ma=ya;na=14438;oa=ma+19|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+19>>0]=0;la=b[sa>>0]|0;ra=la<<24>>24;qa=pa+16|0;ta=f[qa>>2]|0;if(ta){Fa=qa;Ga=ta;e:while(1){ta=Ga;while(1){if((f[ta+16>>2]|0)>=(k|0))break;Ha=f[ta+4>>2]|0;if(!Ha){Ia=Fa;break e}else ta=Ha}Ga=f[ta>>2]|0;if(!Ga){Ia=ta;break}else Fa=ta}if(((Ia|0)!=(qa|0)?(k|0)>=(f[Ia+16>>2]|0):0)?(Fa=Ia+20|0,(Jh(Fa,i)|0)!=0):0){Ga=Rg(Fa,i)|0;if((Ga|0)!=(Ia+24|0)){pj(d,Ga+28|0);Ga=b[M>>0]|0;Fa=Ga<<24>>24<0;if(!((Fa?f[N>>2]|0:Ga&255)|0))Ja=Ga;else{if(la<<24>>24>0){ya=Fa?f[d>>2]|0:d;Fa=0;do{Ka=$(bq(ya,e));ka=ya;ya=f[e>>2]|0;if((ka|0)==(ya|0))break;n[Ea+(Fa<<2)>>2]=Ka;Fa=Fa+1|0}while((Fa|0)<(ra|0));La=b[M>>0]|0}else La=Ga;Ja=La}if(Ja<<24>>24<0)Oq(f[d>>2]|0)}}else wa=69}else wa=69;if((wa|0)==69?(wa=0,Fa=Rg(pa,i)|0,(Fa|0)!=(pa+4|0)):0){pj(d,Fa+28|0);Fa=b[G>>0]|0;ya=Fa<<24>>24<0;if(!((ya?f[H>>2]|0:Fa&255)|0))Ma=Fa;else{if(la<<24>>24>0){qa=ya?f[d>>2]|0:d;ya=0;do{Ka=$(bq(qa,e));ka=qa;qa=f[e>>2]|0;if((ka|0)==(qa|0))break;n[Ea+(ya<<2)>>2]=Ka;ya=ya+1|0}while((ya|0)<(ra|0));Na=b[G>>0]|0}else Na=Fa;Ma=Na}if(Ma<<24>>24<0)Oq(f[d>>2]|0)}if((b[I>>0]|0)<0)Oq(f[i>>2]|0);ra=f[(f[j>>2]|0)+48>>2]|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;ya=ln(32)|0;f[d>>2]=ya;f[J>>2]=-2147483616;f[K>>2]=18;ma=ya;na=14458;oa=ma+18|0;do{b[ma>>0]=b[na>>0]|0;ma=ma+1|0;na=na+1|0}while((ma|0)<(oa|0));b[ya+18>>0]=0;na=ra+16|0;ma=f[na>>2]|0;do if(ma){oa=na;Fa=ma;f:while(1){qa=Fa;while(1){if((f[qa+16>>2]|0)>=(k|0))break;la=f[qa+4>>2]|0;if(!la){Pa=oa;break f}else qa=la}Fa=f[qa>>2]|0;if(!Fa){Pa=qa;break}else oa=qa}if((Pa|0)!=(na|0)?(k|0)>=(f[Pa+16>>2]|0):0){oa=Pa+20|0;if(!(Jh(oa,d)|0)){wa=91;break}Qa=$(sk(oa,d,$(1.0)))}else wa=91}else wa=91;while(0);if((wa|0)==91){wa=0;Qa=$(sk(ra,d,$(1.0)))}if((b[L>>0]|0)<0)Oq(f[d>>2]|0);Dl(g,va,f[h>>2]|0,b[sa>>0]|0,Qa);k=f[h>>2]|0;if(k|0){na=f[C>>2]|0;if((na|0)!=(k|0))f[C>>2]=na+(~((na+-4-k|0)>>>2)<<2);Oq(k)}}else Wd(g,ja,va)|0;k=f[P>>2]|0;if((k|0)==(f[Q>>2]|0))Cf(R,g);else{f[k>>2]=1196;f[k+4>>2]=f[s>>2];Ra=k+8|0;f[Ra>>2]=0;na=k+12|0;f[na>>2]=0;f[k+16>>2]=0;ma=(f[y>>2]|0)-(f[V>>2]|0)|0;ya=ma>>2;if(ya|0){if(ya>>>0>1073741823){wa=103;break a}oa=ln(ma)|0;f[na>>2]=oa;f[Ra>>2]=oa;f[k+16>>2]=oa+(ya<<2);ya=f[V>>2]|0;ma=(f[y>>2]|0)-ya|0;if((ma|0)>0){kh(oa|0,ya|0,ma|0)|0;f[na>>2]=oa+(ma>>>2<<2)}}f[k+20>>2]=f[W>>2];f[P>>2]=(f[P>>2]|0)+24}Qe(d,g,ja,m);k=f[S>>2]|0;if(k>>>0<(f[T>>2]|0)>>>0){ma=f[d>>2]|0;f[d>>2]=0;f[k>>2]=ma;f[S>>2]=k+4}else Ze(U,d);k=f[d>>2]|0;f[d>>2]=0;if(k|0){ma=k+88|0;oa=f[ma>>2]|0;f[ma>>2]=0;if(oa|0){ma=f[oa+8>>2]|0;if(ma|0){na=oa+12|0;if((f[na>>2]|0)!=(ma|0))f[na>>2]=ma;Oq(ma)}Oq(oa)}oa=f[k+68>>2]|0;if(oa|0){ma=k+72|0;na=f[ma>>2]|0;if((na|0)!=(oa|0))f[ma>>2]=na+(~((na+-4-oa|0)>>>2)<<2);Oq(oa)}oa=k+64|0;na=f[oa>>2]|0;f[oa>>2]=0;if(na|0){oa=f[na>>2]|0;if(oa|0){ma=na+4|0;if((f[ma>>2]|0)!=(oa|0))f[ma>>2]=oa;Oq(oa)}Oq(na)}Oq(k)}xa=0}f[g>>2]=1196;k=f[r>>2]|0;if(k|0){na=f[y>>2]|0;if((na|0)!=(k|0))f[y>>2]=na+(~((na+-4-k|0)>>>2)<<2);Oq(k)}if(xa|0){v=0;wa=169;break a}break}case 1:case 3:case 5:{k=ja+24|0;na=b[k>>0]|0;oa=na<<24>>24;f[g>>2]=0;f[_>>2]=0;f[aa>>2]=0;if(!(na<<24>>24))Sa=0;else{if(na<<24>>24<0){wa=137;break a}na=ln(oa<<2)|0;f[_>>2]=na;f[g>>2]=na;ma=na+(oa<<2)|0;f[a>>2]=ma;ya=oa;oa=na;while(1){f[oa>>2]=2147483647;ya=ya+-1|0;if(!ya)break;else oa=oa+4|0}f[_>>2]=ma;Sa=b[k>>0]|0}oa=Sa<<24>>24;f[h>>2]=0;f[ba>>2]=0;f[ca>>2]=0;if(!(Sa<<24>>24))Ta=0;else{if(Sa<<24>>24<0){wa=144;break a}ya=oa<<2;sa=ln(ya)|0;f[h>>2]=sa;ra=sa+(oa<<2)|0;f[da>>2]=ra;sj(sa|0,0,ya|0)|0;f[ba>>2]=ra;Ta=sa}sa=ja+80|0;ra=b[k>>0]|0;g:do if(!(f[sa>>2]|0))Ua=ra;else{ya=0;oa=ra;na=Ta;while(1){f[e>>2]=ya;f[d>>2]=f[e>>2];Qb(ja,d,oa,na)|0;Fa=b[k>>0]|0;if(Fa<<24>>24>0){ta=f[g>>2]|0;la=f[h>>2]|0;pa=Fa<<24>>24;Ga=0;do{ka=ta+(Ga<<2)|0;Ha=f[la+(Ga<<2)>>2]|0;if((f[ka>>2]|0)>(Ha|0))f[ka>>2]=Ha;Ga=Ga+1|0}while((Ga|0)<(pa|0))}pa=ya+1|0;if(pa>>>0>=(f[sa>>2]|0)>>>0){Ua=Fa;break g}ya=pa;oa=Fa;na=f[h>>2]|0}}while(0);if(Ua<<24>>24>0){sa=0;ja=Ua;while(1){ra=(f[g>>2]|0)+(sa<<2)|0;ma=f[ea>>2]|0;if((ma|0)==(f[fa>>2]|0)){Ri(ga,ra);Va=b[k>>0]|0}else{f[ma>>2]=f[ra>>2];f[ea>>2]=ma+4;Va=ja}sa=sa+1|0;if((sa|0)>=(Va<<24>>24|0))break;else ja=Va}}ja=f[h>>2]|0;if(ja|0){sa=f[ba>>2]|0;if((sa|0)!=(ja|0))f[ba>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);Oq(ja)}ja=f[g>>2]|0;if(ja|0){sa=f[_>>2]|0;if((sa|0)!=(ja|0))f[_>>2]=sa+(~((sa+-4-ja|0)>>>2)<<2);Oq(ja)}break}default:{}}ja=ha+1|0;sa=f[o>>2]|0;if(ja>>>0>=(f[p>>2]|0)-sa>>2>>>0){v=1;wa=169;break}k=f[j>>2]|0;ha=ja;ia=sa;t=f[k+4>>2]|0;l=k}if((wa|0)==48)aq(h);else if((wa|0)==103)aq(Ra);else if((wa|0)==137)aq(g);else if((wa|0)==144)aq(h);else if((wa|0)==169){u=c;return v|0}return 0}function hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O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>2]=(f[o>>2]|0)+-4}f[b>>2]=S;f[c>>2]=W;R=f[k>>2]|0;V=((f[g>>2]|0)+-1|0)==(Y|0)?0:Y+1|0;Y=(f[s>>2]|0)+(Z*12|0)|0;z=W-S|0;T=(f[a>>2]|0)-(f[(f[Y>>2]|0)+(V<<2)>>2]|0)|0;a:do if(T){if(z>>>0<3){U=f[w>>2]|0;f[U>>2]=V;$=f[g>>2]|0;if($>>>0>1){aa=1;ba=$;ca=V;while(1){ca=(ca|0)==(ba+-1|0)?0:ca+1|0;f[U+(aa<<2)>>2]=ca;aa=aa+1|0;da=f[g>>2]|0;if(aa>>>0>=da>>>0){ea=da;break}else ba=da}}else ea=$;if(!z){fa=99;break}else{ga=0;ha=ea}while(1){ba=(f[N>>2]|0)+((X(f[M>>2]|0,S+ga|0)|0)<<2)|0;if(!ha)ia=0;else{aa=0;do{ca=f[(f[w>>2]|0)+(aa<<2)>>2]|0;U=(f[a>>2]|0)-(f[(f[Y>>2]|0)+(ca<<2)>>2]|0)|0;do if(U|0){da=f[y>>2]|0;ja=32-da|0;ka=32-U|0;la=f[ba+(ca<<2)>>2]<(ja|0)){ma=la>>>ka;ka=U-ja|0;f[y>>2]=ka;ja=f[h>>2]|ma>>>ka;f[h>>2]=ja;ka=f[j>>2]|0;if((ka|0)==(f[m>>2]|0))Ri(n,h);else{f[ka>>2]=ja;f[j>>2]=ka+4}f[h>>2]=ma<<32-(f[y>>2]|0);break}ma=f[h>>2]|la>>>da;f[h>>2]=ma;la=da+U|0;f[y>>2]=la;if((la|0)!=32)break;la=f[j>>2]|0;if((la|0)==(f[m>>2]|0))Ri(n,h);else{f[la>>2]=ma;f[j>>2]=la+4}f[h>>2]=0;f[y>>2]=0}while(0);aa=aa+1|0;U=f[g>>2]|0}while(aa>>>0>>0);ia=U}ga=ga+1|0;if(ga>>>0>=z>>>0){fa=99;break a}else ha=ia}}$=Z+1|0;Ig(R+($*12|0)|0,f[R+(Z*12|0)>>2]|0,f[R+(Z*12|0)+4>>2]|0);aa=(f[(f[k>>2]|0)+($*12|0)>>2]|0)+(V<<2)|0;ba=(f[aa>>2]|0)+(1<>2]=ba;aa=f[A>>2]|0;U=f[B>>2]|0;b:do if((W|0)==(S|0))na=S;else{ca=f[O>>2]|0;if(!aa){if((f[ca+(V<<2)>>2]|0)>>>0>>0){na=W;break}else{oa=W;pa=S}while(1){la=oa;do{la=la+-1|0;if((pa|0)==(la|0)){na=pa;break b}ma=(f[P>>2]|0)+((X(la,U)|0)<<2)+(V<<2)|0}while((f[ma>>2]|0)>>>0>=ba>>>0);pa=pa+1|0;if((pa|0)==(la|0)){na=la;break b}else oa=la}}else{qa=W;ra=S}while(1){ma=ra;while(1){sa=ca+((X(ma,aa)|0)<<2)|0;if((f[sa+(V<<2)>>2]|0)>>>0>=ba>>>0){ta=qa;break}da=ma+1|0;if((da|0)==(qa|0)){na=qa;break b}else ma=da}while(1){ta=ta+-1|0;if((ma|0)==(ta|0)){na=ma;break b}ua=(f[P>>2]|0)+((X(ta,U)|0)<<2)|0;if((f[ua+(V<<2)>>2]|0)>>>0>>0){va=0;break}}do{la=sa+(va<<2)|0;da=ua+(va<<2)|0;ka=f[la>>2]|0;f[la>>2]=f[da>>2];f[da>>2]=ka;va=va+1|0}while((va|0)!=(aa|0));ra=ma+1|0;if((ra|0)==(ta|0)){na=ta;break}else qa=ta}}while(0);ba=(_(z|0)|0)^31;U=na-S|0;ca=W-na|0;ka=U>>>0>>0;if((U|0)!=(ca|0)){da=f[H>>2]|0;if(ka)f[I>>2]=f[I>>2]|1<<31-da;la=da+1|0;f[H>>2]=la;if((la|0)==32){la=f[J>>2]|0;if((la|0)==(f[K>>2]|0))Ri(L,I);else{f[la>>2]=f[I>>2];f[J>>2]=la+4}f[H>>2]=0;f[I>>2]=0}}la=z>>>1;do if(ka){da=f[C>>2]|0;ja=32-da|0;wa=32-ba|0;xa=la-U<(ja|0)){ya=xa>>>wa;wa=ba-ja|0;f[C>>2]=wa;ja=f[D>>2]|ya>>>wa;f[D>>2]=ja;wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ri(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=ya<<32-(f[C>>2]|0);break}ya=f[D>>2]|xa>>>da;f[D>>2]=ya;xa=da+ba|0;f[C>>2]=xa;if((xa|0)==32){xa=f[E>>2]|0;if((xa|0)==(f[F>>2]|0))Ri(G,D);else{f[xa>>2]=ya;f[E>>2]=xa+4}f[D>>2]=0;f[C>>2]=0}}else{xa=f[C>>2]|0;ya=32-xa|0;da=32-ba|0;wa=la-ca<(ya|0)){ja=wa>>>da;da=ba-ya|0;f[C>>2]=da;ya=f[D>>2]|ja>>>da;f[D>>2]=ya;da=f[E>>2]|0;if((da|0)==(f[F>>2]|0))Ri(G,D);else{f[da>>2]=ya;f[E>>2]=da+4}f[D>>2]=ja<<32-(f[C>>2]|0);break}ja=f[D>>2]|wa>>>xa;f[D>>2]=ja;wa=xa+ba|0;f[C>>2]=wa;if((wa|0)==32){wa=f[E>>2]|0;if((wa|0)==(f[F>>2]|0))Ri(G,D);else{f[wa>>2]=ja;f[E>>2]=wa+4}f[D>>2]=0;f[C>>2]=0}}while(0);ba=f[s>>2]|0;la=f[ba+(Z*12|0)>>2]|0;ka=la+(V<<2)|0;f[ka>>2]=(f[ka>>2]|0)+1;Ig(ba+($*12|0)|0,la,f[ba+(Z*12|0)+4>>2]|0);if((na|0)!=(S|0)){ba=f[o>>2]|0;la=f[t>>2]|0;ka=ba-la>>2;wa=f[v>>2]|0;ja=f[l>>2]|0;if((((ka|0)==0?0:(ka*113|0)+-1|0)|0)==(ja+wa|0)){Pc(e);za=f[v>>2]|0;Aa=f[l>>2]|0;Ba=f[o>>2]|0;Ca=f[t>>2]|0}else{za=wa;Aa=ja;Ba=ba;Ca=la}la=Aa+za|0;if((Ba|0)==(Ca|0))Da=0;else Da=(f[Ca+(((la>>>0)/113|0)<<2)>>2]|0)+(((la>>>0)%113|0)*36|0)|0;f[Da>>2]=S;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2]|0)+(Z<<2)>>2]|0;W=(f[a>>2]|0)-(f[(f[B>>2]|0)+(aa<<2)>>2]|0)|0;do if(W|0){ba=f[A>>2]|0;ha=32-ba|0;ia=32-W|0;ja=f[$+(aa<<2)>>2]<(ha|0)){ka=ja>>>ia;ia=W-ha|0;f[A>>2]=ia;ha=f[j>>2]|ka>>>ia;f[j>>2]=ha;ia=f[l>>2]|0;if((ia|0)==(f[o>>2]|0))Ri(p,j);else{f[ia>>2]=ha;f[l>>2]=ia+4}f[j>>2]=ka<<32-(f[A>>2]|0);break}ka=f[j>>2]|ja>>>ba;f[j>>2]=ka;ja=ba+W|0;f[A>>2]=ja;if((ja|0)!=32)break;ja=f[l>>2]|0;if((ja|0)==(f[o>>2]|0))Ri(p,j);else{f[ja>>2]=ka;f[l>>2]=ja+4}f[j>>2]=0;f[A>>2]=0}while(0);Z=Z+1|0;W=f[i>>2]|0}while(Z>>>0>>0);ga=W}ea=ea+1|0;if(ea>>>0>=U>>>0){da=87;break a}else fa=ga}}Y=V+1|0;Z=f[m>>2]|0;$=Z+(Y*12|0)|0;if(($|0)==(S|0))la=Z;else{Ig($,f[S>>2]|0,f[O+(V*12|0)+4>>2]|0);la=f[m>>2]|0}$=(f[la+(Y*12|0)>>2]|0)+(Q<<2)|0;Z=(f[$>>2]|0)+(1<>2]=Z;$=f[C>>2]|0;W=f[D>>2]|0;b:do if((T|0)==(P|0))ma=P;else{aa=f[L>>2]|0;if(!$){if((f[aa+(Q<<2)>>2]|0)>>>0>>0){ma=T;break}else{na=T;oa=P}while(1){ja=na;do{ja=ja+-1|0;if((oa|0)==(ja|0)){ma=oa;break b}ka=(f[M>>2]|0)+((X(ja,W)|0)<<2)+(Q<<2)|0}while((f[ka>>2]|0)>>>0>=Z>>>0);oa=oa+1|0;if((oa|0)==(ja|0)){ma=ja;break b}else na=ja}}else{pa=T;qa=P}while(1){ka=qa;while(1){ra=aa+((X(ka,$)|0)<<2)|0;if((f[ra+(Q<<2)>>2]|0)>>>0>=Z>>>0){sa=pa;break}ba=ka+1|0;if((ba|0)==(pa|0)){ma=pa;break b}else ka=ba}while(1){sa=sa+-1|0;if((ka|0)==(sa|0)){ma=ka;break b}ta=(f[M>>2]|0)+((X(sa,W)|0)<<2)|0;if((f[ta+(Q<<2)>>2]|0)>>>0>>0){ua=0;break}}do{ja=ra+(ua<<2)|0;ba=ta+(ua<<2)|0;ia=f[ja>>2]|0;f[ja>>2]=f[ba>>2];f[ba>>2]=ia;ua=ua+1|0}while((ua|0)!=($|0));qa=ka+1|0;if((qa|0)==(sa|0)){ma=sa;break}else pa=sa}}while(0);Z=(_(U|0)|0)^31;W=ma-P|0;aa=T-ma|0;ia=W>>>0>>0;if((W|0)!=(aa|0)){ba=f[E>>2]|0;if(ia)f[F>>2]=f[F>>2]|1<<31-ba;ja=ba+1|0;f[E>>2]=ja;if((ja|0)==32){ja=f[G>>2]|0;if((ja|0)==(f[H>>2]|0))Ri(I,F);else{f[ja>>2]=f[F>>2];f[G>>2]=ja+4}f[E>>2]=0;f[F>>2]=0}}ja=U>>>1;if(ia){ia=ja-W|0;if(Z|0){ba=0;ha=1<>>1}}}else{ha=ja-aa|0;if(Z|0){ba=0;ia=1<>>1}}}ia=f[v>>2]|0;Z=f[ia+(V*12|0)>>2]|0;ba=Z+(Q<<2)|0;f[ba>>2]=(f[ba>>2]|0)+1;Ig(ia+(Y*12|0)|0,Z,f[ia+(V*12|0)+4>>2]|0);if((ma|0)!=(P|0)){ia=f[q>>2]|0;Z=f[w>>2]|0;ba=ia-Z>>2;ha=f[x>>2]|0;ja=f[n>>2]|0;if((((ba|0)==0?0:(ba*113|0)+-1|0)|0)==(ja+ha|0)){Pc(h);va=f[x>>2]|0;wa=f[n>>2]|0;xa=f[q>>2]|0;ya=f[w>>2]|0}else{va=ha;wa=ja;xa=ia;ya=Z}Z=wa+va|0;if((xa|0)==(ya|0))za=0;else za=(f[ya+(((Z>>>0)/113|0)<<2)>>2]|0)+(((Z>>>0)%113|0)*36|0)|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f[w>>2]=k;Ia=f[q>>2]|0;Ja=Ia-k>>2}while(Ja>>>0>2);Ka=Ja;La=k;Ma=Ia}else{Ka=n;La=Fa;Ma=s}switch(Ka|0){case 1:{Na=56;da=101;break}case 2:{Na=113;da=101;break}default:{}}if((da|0)==101)f[x>>2]=Na;if((La|0)!=(Ma|0)){Na=La;do{Oq(f[Na>>2]|0);Na=Na+4|0}while((Na|0)!=(Ma|0));Ma=f[w>>2]|0;w=f[q>>2]|0;if((w|0)!=(Ma|0))f[q>>2]=w+(~((w+-4-Ma|0)>>>2)<<2)}Ma=f[h>>2]|0;if(!Ma){u=d;return}Oq(Ma);u=d;return}function jb(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;d=u;u=u+1424|0;e=d+1408|0;g=d+1396|0;h=d+1420|0;i=d+1200|0;j=d+12|0;k=d;l=d+1384|0;m=d+1372|0;n=d+1360|0;o=d+1348|0;p=d+1336|0;q=d+1324|0;r=d+1312|0;s=d+1300|0;t=d+1288|0;v=d+1276|0;w=d+1264|0;x=d+1252|0;y=d+1240|0;z=d+1228|0;A=a+28|0;B=10-(mi(f[(f[A>>2]|0)+48>>2]|0)|0)|0;C=(B|0)<6?B:6;b[h>>0]=C;if((C&255|0)==6?(f[a+72>>2]|0)>15:0)b[h>>0]=5;C=c+16|0;B=f[C+4>>2]|0;if(!((B|0)>0|(B|0)==0&(f[C>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}C=f[A>>2]|0;B=f[(f[C+4>>2]|0)+80>>2]|0;D=a+72|0;E=f[D>>2]|0;f[i>>2]=B;F=i+4|0;f[F>>2]=E;f[i+8>>2]=E<<2;G=i+12|0;H=X(E,B)|0;f[G>>2]=0;J=i+16|0;f[J>>2]=0;f[i+20>>2]=0;do if(H)if(H>>>0>1073741823)aq(G);else{K=H<<2;L=ln(K)|0;f[G>>2]=L;M=L+(H<<2)|0;f[i+20>>2]=M;sj(L|0,0,K|0)|0;f[J>>2]=M;N=L;break}else N=0;while(0);H=i+24|0;f[H>>2]=N;G=a+4|0;L=a+8|0;M=f[G>>2]|0;a:do if((f[L>>2]|0)!=(M|0)){K=j+4|0;O=j+8|0;P=j+8|0;Q=(B|0)==0;R=j+4|0;S=j+8|0;T=k+4|0;U=k+8|0;V=k+8|0;W=a+48|0;Y=j+8|0;Z=a+60|0;$=0;aa=0;ba=0;ca=0;da=M;ea=C;b:while(1){fa=f[(f[(f[ea+4>>2]|0)+8>>2]|0)+(f[da+(ca<<2)>>2]<<2)>>2]|0;switch(f[fa+28>>2]|0){case 1:case 3:case 5:case 2:case 4:case 6:{ga=fa;ha=aa;break}case 9:{ga=f[(f[Z>>2]|0)+(aa<<2)>>2]|0;ha=aa+1|0;break}default:{ia=0;break a}}if(!ga){ia=0;break a}c:do switch(f[ga+28>>2]|0){case 6:{if(Q){ja=ba;ka=ga+24|0;break c}fa=ga+84|0;la=ga+68|0;ma=ga+48|0;na=ga+40|0;oa=ga+24|0;pa=0;do{if(!(b[fa>>0]|0))qa=f[(f[la>>2]|0)+(pa<<2)>>2]|0;else qa=pa;ra=ma;sa=f[ra>>2]|0;ta=f[ra+4>>2]|0;ra=na;ua=un(f[ra>>2]|0,f[ra+4>>2]|0,qa|0,0)|0;ra=Vn(ua|0,I|0,sa|0,ta|0)|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,(f[f[ga>>2]>>2]|0)+ra|0,b[oa>>0]<<2|0)|0;pa=pa+1|0}while((pa|0)!=(B|0));ja=ba;ka=oa;break}case 1:case 3:case 5:{oa=ga+24|0;pa=b[oa>>0]|0;na=pa<<24>>24;f[j>>2]=0;f[R>>2]=0;f[S>>2]=0;if(!(pa<<24>>24))va=0;else{if(pa<<24>>24<0){wa=24;break b}pa=na<<2;ma=ln(pa)|0;f[j>>2]=ma;la=ma+(na<<2)|0;f[Y>>2]=la;sj(ma|0,0,pa|0)|0;f[R>>2]=la;va=b[oa>>0]|0}la=va<<24>>24;f[k>>2]=0;f[T>>2]=0;f[U>>2]=0;if(!(va<<24>>24)){xa=0;ya=0}else{if(va<<24>>24<0){wa=30;break b}pa=la<<2;ma=ln(pa)|0;f[k>>2]=ma;na=ma+(la<<2)|0;f[V>>2]=na;sj(ma|0,0,pa|0)|0;f[T>>2]=na;xa=ma;ya=ma}if(Q){za=ya;Aa=xa}else{ma=ga+84|0;na=ga+68|0;pa=0;do{if(!(b[ma>>0]|0))Ba=f[(f[na>>2]|0)+(pa<<2)>>2]|0;else Ba=pa;la=f[j>>2]|0;f[g>>2]=Ba;fa=b[oa>>0]|0;f[e>>2]=f[g>>2];Qb(ga,e,fa,la)|0;la=b[oa>>0]|0;fa=la<<24>>24;if(la<<24>>24>0){la=f[j>>2]|0;ra=f[W>>2]|0;ta=f[k>>2]|0;sa=0;do{f[ta+(sa<<2)>>2]=(f[la+(sa<<2)>>2]|0)-(f[ra+(sa+ba<<2)>>2]|0);sa=sa+1|0}while((sa|0)<(fa|0));Ca=ta}else Ca=f[k>>2]|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,pa)|0)<<2)+($<<2)|0,Ca|0,fa<<2|0)|0;pa=pa+1|0}while(pa>>>0>>0);pa=f[k>>2]|0;za=pa;Aa=pa}pa=ba+(b[oa>>0]|0)|0;if(za|0){na=f[T>>2]|0;if((na|0)!=(za|0))f[T>>2]=na+(~((na+-4-za|0)>>>2)<<2);Oq(Aa)}na=f[j>>2]|0;if(na|0){ma=f[R>>2]|0;if((ma|0)!=(na|0))f[R>>2]=ma+(~((ma+-4-na|0)>>>2)<<2);Oq(na)}ja=pa;ka=oa;break}default:{pa=ga+24|0;na=b[pa>>0]|0;ma=na<<24>>24;f[j>>2]=0;f[K>>2]=0;f[O>>2]=0;if(!(na<<24>>24)){Da=0;Ea=0}else{if(na<<24>>24<0){wa=53;break b}na=ma<<2;ta=ln(na)|0;f[j>>2]=ta;sa=ta+(ma<<2)|0;f[P>>2]=sa;sj(ta|0,0,na|0)|0;f[K>>2]=sa;Da=ta;Ea=ta}if(Q){Fa=Ea;Ga=Da}else{ta=ga+84|0;sa=ga+68|0;na=0;do{if(!(b[ta>>0]|0))Ha=f[(f[sa>>2]|0)+(na<<2)>>2]|0;else Ha=na;ma=f[j>>2]|0;f[g>>2]=Ha;ra=b[pa>>0]|0;f[e>>2]=f[g>>2];Pb(ga,e,ra,ma)|0;kh((f[H>>2]|0)+((X(f[F>>2]|0,na)|0)<<2)+($<<2)|0,f[j>>2]|0,b[pa>>0]<<2|0)|0;na=na+1|0}while(na>>>0>>0);na=f[j>>2]|0;Fa=na;Ga=na}if(Fa|0){na=f[K>>2]|0;if((na|0)!=(Fa|0))f[K>>2]=na+(~((na+-4-Fa|0)>>>2)<<2);Oq(Ga)}ja=ba;ka=pa}}while(0);na=ca+1|0;sa=f[G>>2]|0;if(na>>>0>=(f[L>>2]|0)-sa>>2>>>0){wa=66;break}$=$+(b[ka>>0]|0)|0;aa=ha;ba=ja;ca=na;da=sa;ea=f[A>>2]|0}if((wa|0)==24)aq(j);else if((wa|0)==30)aq(k);else if((wa|0)==53)aq(j);else if((wa|0)==66){Ia=f[D>>2]|0;Ja=f[H>>2]|0;wa=67;break}}else{Ia=E;Ja=N;wa=67}while(0);d:do if((wa|0)==67){N=X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>>2]=La;f[g>>2]=f[r>>2];f[g+4>>2]=f[r+4>>2];f[g+8>>2]=f[r+8>>2];f[e>>2]=f[s>>2];f[e+4>>2]=f[s+4>>2];f[e+8>>2]=f[s+8>>2];H=Af(j,g,e,k,c)|0;ef(j);if(!H){ia=0;break d}break}case 2:{$e(j,Ia);f[t>>2]=0;f[t+4>>2]=i;H=f[F>>2]|0;f[t+8>>2]=H;f[v>>2]=f[i>>2];f[v+4>>2]=i;f[v+8>>2]=H;f[k>>2]=La;f[g>>2]=f[t>>2];f[g+4>>2]=f[t+4>>2];f[g+8>>2]=f[t+8>>2];f[e>>2]=f[v>>2];f[e+4>>2]=f[v+4>>2];f[e+8>>2]=f[v+8>>2];H=Af(j,g,e,k,c)|0;ef(j);if(!H){ia=0;break d}break}case 1:{af(j,Ia);f[w>>2]=0;f[w+4>>2]=i;H=f[F>>2]|0;f[w+8>>2]=H;f[x>>2]=f[i>>2];f[x+4>>2]=i;f[x+8>>2]=H;f[k>>2]=La;f[g>>2]=f[w>>2];f[g+4>>2]=f[w+4>>2];f[g+8>>2]=f[w+8>>2];f[e>>2]=f[x>>2];f[e+4>>2]=f[x+4>>2];f[e+8>>2]=f[x+8>>2];H=zf(j,g,e,k,c)|0;df(j);if(!H){ia=0;break d}break}case 0:{af(j,Ia);f[y>>2]=0;f[y+4>>2]=i;H=f[F>>2]|0;f[y+8>>2]=H;f[z>>2]=f[i>>2];f[z+4>>2]=i;f[z+8>>2]=H;f[k>>2]=La;f[g>>2]=f[y>>2];f[g+4>>2]=f[y+4>>2];f[g+8>>2]=f[y+8>>2];f[e>>2]=f[z>>2];f[e+4>>2]=f[z+4>>2];f[e+8>>2]=f[z+8>>2];H=zf(j,g,e,k,c)|0;df(j);if(!H){ia=0;break d}break}default:{ia=0;break d}}ia=1}while(0);j=f[i+12>>2]|0;if(!j){u=d;return ia|0}i=f[J>>2]|0;if((i|0)!=(j|0))f[J>>2]=i+(~((i+-4-j|0)>>>2)<<2);Oq(j);u=d;return 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);da=P}ba=ba+1|0;if(ba>>>0>=z>>>0){aa=85;break a}else ca=da}}U=T+1|0;Ig(M+(U*12|0)|0,f[M+(T*12|0)>>2]|0,f[M+(T*12|0)+4>>2]|0);V=(f[(f[k>>2]|0)+(U*12|0)>>2]|0)+(Q<<2)|0;W=(f[V>>2]|0)+(1<>2]=W;V=f[A>>2]|0;P=f[B>>2]|0;b:do if((R|0)==(N|0))ia=N;else{Y=f[J>>2]|0;if(!V){if((f[Y+(Q<<2)>>2]|0)>>>0>>0){ia=R;break}else{ja=R;ka=N}while(1){ga=ja;do{ga=ga+-1|0;if((ka|0)==(ga|0)){ia=ka;break b}ha=(f[K>>2]|0)+((X(ga,P)|0)<<2)+(Q<<2)|0}while((f[ha>>2]|0)>>>0>=W>>>0);ka=ka+1|0;if((ka|0)==(ga|0)){ia=ga;break b}else ja=ga}}else{la=R;ma=N}while(1){ha=ma;while(1){na=Y+((X(ha,V)|0)<<2)|0;if((f[na+(Q<<2)>>2]|0)>>>0>=W>>>0){oa=la;break}Z=ha+1|0;if((Z|0)==(la|0)){ia=la;break b}else ha=Z}while(1){oa=oa+-1|0;if((ha|0)==(oa|0)){ia=ha;break b}pa=(f[K>>2]|0)+((X(oa,P)|0)<<2)|0;if((f[pa+(Q<<2)>>2]|0)>>>0>>0){qa=0;break}}do{ga=na+(qa<<2)|0;Z=pa+(qa<<2)|0;fa=f[ga>>2]|0;f[ga>>2]=f[Z>>2];f[Z>>2]=fa;qa=qa+1|0}while((qa|0)!=(V|0));ma=ha+1|0;if((ma|0)==(oa|0)){ia=oa;break}else la=oa}}while(0);W=(_(z|0)|0)^31;P=ia-N|0;Y=R-ia|0;fa=P>>>0>>0;if((P|0)!=(Y|0)){Z=f[C>>2]|0;if(fa)f[D>>2]=f[D>>2]|1<<31-Z;ga=Z+1|0;f[C>>2]=ga;if((ga|0)==32){ga=f[E>>2]|0;if((ga|0)==(f[F>>2]|0))Ri(G,D);else{f[ga>>2]=f[D>>2];f[E>>2]=ga+4}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:do if((S|0)==(O|0))ja=O;else{Z=f[K>>2]|0;if(!W){if((f[Z+(R<<2)>>2]|0)>>>0>>0){ja=S;break}else{ka=S;la=O}while(1){ha=ka;do{ha=ha+-1|0;if((la|0)==(ha|0)){ja=la;break b}ia=(f[L>>2]|0)+((X(ha,Q)|0)<<2)+(R<<2)|0}while((f[ia>>2]|0)>>>0>=Y>>>0);la=la+1|0;if((la|0)==(ha|0)){ja=ha;break b}else ka=ha}}else{ma=S;na=O}while(1){ia=na;while(1){oa=Z+((X(ia,W)|0)<<2)|0;if((f[oa+(R<<2)>>2]|0)>>>0>=Y>>>0){pa=ma;break}$=ia+1|0;if(($|0)==(ma|0)){ja=ma;break b}else ia=$}while(1){pa=pa+-1|0;if((ia|0)==(pa|0)){ja=ia;break b}qa=(f[L>>2]|0)+((X(pa,Q)|0)<<2)|0;if((f[qa+(R<<2)>>2]|0)>>>0>>0){ra=0;break}}do{ha=oa+(ra<<2)|0;$=qa+(ra<<2)|0;ga=f[ha>>2]|0;f[ha>>2]=f[$>>2];f[$>>2]=ga;ra=ra+1|0}while((ra|0)!=(W|0));na=ia+1|0;if((na|0)==(pa|0)){ja=pa;break}else ma=pa}}while(0);Y=(_(z|0)|0)^31;Q=ja-O|0;Z=S-ja|0;ga=Q>>>0>>0;if((Q|0)!=(Z|0)){$=f[D>>2]|0;if(ga)f[E>>2]=f[E>>2]|1<<31-$;ha=$+1|0;f[D>>2]=ha;if((ha|0)==32){ha=f[F>>2]|0;if((ha|0)==(f[G>>2]|0))Ri(H,E);else{f[ha>>2]=f[E>>2];f[F>>2]=ha+4}f[D>>2]=0;f[E>>2]=0}}ha=z>>>1;if(ga)sg(C,Y,ha-Q|0);else sg(C,Y,ha-Z|0);ha=f[s>>2]|0;Y=f[ha+(U*12|0)>>2]|0;ga=Y+(R<<2)|0;f[ga>>2]=(f[ga>>2]|0)+1;Ig(ha+(V*12|0)|0,Y,f[ha+(U*12|0)+4>>2]|0);if((ja|0)!=(O|0)){ha=f[o>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Da=0;Ea=0}else{ja=(f[Ba>>2]|0)+(((M>>>0)%113|0)*36|0)|0;Da=ja;Ea=ja}ja=Ba;Ba=Ea;c:while(1){Ea=Ba;do{M=Ea;if((Da|0)==(M|0))break c;Ea=M+36|0}while((Ea-(f[ja>>2]|0)|0)!=4068);Ea=ja+4|0;ja=Ea;Ba=f[Ea>>2]|0}f[l>>2]=0;l=p-i>>2;if(l>>>0>2){i=Ca;do{Oq(f[i>>2]|0);i=(f[t>>2]|0)+4|0;f[t>>2]=i;Fa=f[o>>2]|0;Ga=Fa-i>>2}while(Ga>>>0>2);Ha=Ga;Ia=i;Ja=Fa}else{Ha=l;Ia=Ca;Ja=q}switch(Ha|0){case 1:{Ka=56;ba=95;break}case 2:{Ka=113;ba=95;break}default:{}}if((ba|0)==95)f[v>>2]=Ka;if((Ia|0)!=(Ja|0)){Ka=Ia;do{Oq(f[Ka>>2]|0);Ka=Ka+4|0}while((Ka|0)!=(Ja|0));Ja=f[t>>2]|0;t=f[o>>2]|0;if((t|0)!=(Ja|0))f[o>>2]=t+(~((t+-4-Ja|0)>>>2)<<2)}Ja=f[e>>2]|0;if(!Ja){u=d;return}Oq(Ja);u=d;return}function mb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=Oa,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;if(!(b[a+32>>0]|0)){r=o;m=0;while(1){s=$(b[r>>0]|0);n[g+(m<<2)>>2]=s;m=m+1|0;q=b[k>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){t=q;break}else r=r+1|0}}else{r=o;m=0;while(1){s=$($(b[r>>0]|0)/$(127.0));n[g+(m<<2)>>2]=s;m=m+1|0;q=b[k>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){t=q;break}else r=r+1|0}}}else t=l;r=t<<24>>24;if(t<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 2:{r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){k=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;u=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=k+u|0;if(!(b[a+32>>0]|0)){u=o;k=0;while(1){s=$(h[u>>0]|0);n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){v=q;break}else u=u+1|0}}else{u=o;k=0;while(1){s=$($(h[u>>0]|0)/$(255.0));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){v=l;break}else u=u+1|0}}}else v=m;u=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 3:{u=a+48|0;k=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,k|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;l=0;while(1){s=$(d[u>>1]|0);n[g+(l<<2)>>2]=s;l=l+1|0;q=b[r>>0]|0;if((l|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){w=q;break}else u=u+2|0}}else{u=o;l=0;while(1){s=$($(d[u>>1]|0)/$(32767.0));n[g+(l<<2)>>2]=s;l=l+1|0;m=b[r>>0]|0;if((l|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else u=u+2|0}}else w=k;u=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 4:{u=a+48|0;l=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,l|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;l=b[r>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;m=0;while(1){s=$(j[u>>1]|0);n[g+(m<<2)>>2]=s;m=m+1|0;q=b[r>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){x=q;break}else u=u+2|0}}else{u=o;m=0;while(1){s=$($(j[u>>1]|0)/$(65535.0));n[g+(m<<2)>>2]=s;m=m+1|0;k=b[r>>0]|0;if((m|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){x=k;break}else u=u+2|0}}else x=l;u=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 5:{u=a+48|0;m=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,m|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;k=0;while(1){s=$(f[u>>2]|0);n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){y=q;break}else u=u+4|0}}else{u=o;k=0;while(1){s=$($(f[u>>2]|0)*$(4.65661287e-10));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){y=l;break}else u=u+4|0}}else y=m;u=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 6:{u=a+48|0;k=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,k|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;l=0;while(1){s=$((f[u>>2]|0)>>>0);n[g+(l<<2)>>2]=s;l=l+1|0;q=b[r>>0]|0;if((l|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){z=q;break}else u=u+4|0}}else{u=o;l=0;while(1){s=$($((f[u>>2]|0)>>>0)*$(2.32830644e-10));n[g+(l<<2)>>2]=s;l=l+1|0;m=b[r>>0]|0;if((l|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){z=m;break}else u=u+4|0}}else z=k;u=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 7:{u=a+48|0;l=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,l|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;l=b[r>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;m=0;while(1){q=u;s=$(+((f[q>>2]|0)>>>0)+4294967296.0*+(f[q+4>>2]|0));n[g+(m<<2)>>2]=s;m=m+1|0;q=b[r>>0]|0;if((m|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else u=u+8|0}}else{u=o;m=0;while(1){k=u;s=$($(+((f[k>>2]|0)>>>0)+4294967296.0*+(f[k+4>>2]|0))*$(1.08420217e-19));n[g+(m<<2)>>2]=s;m=m+1|0;k=b[r>>0]|0;if((m|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){A=k;break}else u=u+8|0}}else A=l;u=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 8:{u=a+48|0;m=f[u>>2]|0;r=f[u+4>>2]|0;u=a+40|0;o=(Vn(un(f[u>>2]|0,f[u+4>>2]|0,f[c>>2]|0,0)|0,I|0,m|0,r|0)|0)+(f[f[a>>2]>>2]|0)|0;r=a+24|0;m=b[r>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0)if(!(b[a+32>>0]|0)){u=o;k=0;while(1){q=u;s=$(+((f[q>>2]|0)>>>0)+4294967296.0*+((f[q+4>>2]|0)>>>0));n[g+(k<<2)>>2]=s;k=k+1|0;q=b[r>>0]|0;if((k|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){B=q;break}else u=u+8|0}}else{u=o;k=0;while(1){l=u;s=$($(+((f[l>>2]|0)>>>0)+4294967296.0*+((f[l+4>>2]|0)>>>0))*$(5.42101086e-20));n[g+(k<<2)>>2]=s;k=k+1|0;l=b[r>>0]|0;if((k|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){B=l;break}else u=u+8|0}}else B=m;u=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(u<<2)|0,0,(e<<24>>24)-u<<2|0)|0;i=1;return i|0}case 9:{u=a+24|0;k=b[u>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){r=f[f[a>>2]>>2]|0;o=a+40|0;l=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;q=Vn(l|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=r+q|0;q=0;while(1){f[g+(q<<2)>>2]=f[o>>2];q=q+1|0;r=b[u>>0]|0;if((q|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){C=r;break}else o=o+4|0}}else C=k;o=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 10:{o=a+24|0;q=b[o>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){u=f[f[a>>2]>>2]|0;m=a+40|0;r=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;l=Vn(r|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=u+l|0;l=0;while(1){s=$(+p[m>>3]);n[g+(l<<2)>>2]=s;l=l+1|0;u=b[o>>0]|0;if((l|0)>=((u<<24>>24>e<<24>>24?e:u)<<24>>24|0)){D=u;break}else m=m+8|0}}else D=q;m=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 11:{m=a+24|0;l=b[m>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){o=f[f[a>>2]>>2]|0;k=a+40|0;u=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;r=Vn(u|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=o+r|0;r=0;while(1){s=$((b[k>>0]|0)!=0&1);n[g+(r<<2)>>2]=s;r=r+1|0;o=b[m>>0]|0;if((r|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){E=o;break}else k=k+1|0}}else E=l;k=E<<24>>24;if(E<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function nb(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0.0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0.0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0.0,kb=0.0,lb=0.0,mb=0.0,nb=0.0,ob=0.0,pb=0.0,qb=0.0,rb=0.0,sb=0.0,tb=0;i=u;u=u+512|0;j=i;k=d+c|0;l=0-k|0;m=a+4|0;n=a+100|0;o=b;b=0;a:while(1){switch(o|0){case 46:{p=6;break a;break}case 48:break;default:{q=0;r=o;s=b;t=0;v=0;break a}}w=f[m>>2]|0;if(w>>>0<(f[n>>2]|0)>>>0){f[m>>2]=w+1;o=h[w>>0]|0;b=1;continue}else{o=Si(a)|0;b=1;continue}}if((p|0)==6){o=f[m>>2]|0;if(o>>>0<(f[n>>2]|0)>>>0){f[m>>2]=o+1;x=h[o>>0]|0}else x=Si(a)|0;if((x|0)==48){o=0;w=0;while(1){y=Vn(o|0,w|0,-1,-1)|0;z=I;A=f[m>>2]|0;if(A>>>0<(f[n>>2]|0)>>>0){f[m>>2]=A+1;B=h[A>>0]|0}else B=Si(a)|0;if((B|0)==48){o=y;w=z}else{q=1;r=B;s=1;t=y;v=z;break}}}else{q=1;r=x;s=b;t=0;v=0}}f[j>>2]=0;b=r+-48|0;x=(r|0)==46;b:do if(x|b>>>0<10){B=j+496|0;w=0;o=0;z=0;y=q;A=s;C=r;D=x;E=b;F=t;G=v;H=0;J=0;c:while(1){do if(D)if(!y){L=w;M=o;N=1;O=z;P=A;Q=H;R=J;S=H;T=J}else break c;else{U=Vn(H|0,J|0,1,0)|0;V=I;W=(C|0)!=48;if((o|0)>=125){if(!W){L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}f[B>>2]=f[B>>2]|1;L=w;M=o;N=y;O=z;P=A;Q=F;R=G;S=U;T=V;break}Y=j+(o<<2)|0;if(!w)Z=E;else Z=C+-48+((f[Y>>2]|0)*10|0)|0;f[Y>>2]=Z;Y=w+1|0;_=(Y|0)==9;L=_?0:Y;M=o+(_&1)|0;N=y;O=W?U:z;P=1;Q=F;R=G;S=U;T=V}while(0);V=f[m>>2]|0;if(V>>>0<(f[n>>2]|0)>>>0){f[m>>2]=V+1;$=h[V>>0]|0}else $=Si(a)|0;E=$+-48|0;D=($|0)==46;if(!(D|E>>>0<10)){aa=L;ba=M;ca=O;da=N;ea=$;fa=P;ga=S;ha=Q;ia=T;ja=R;p=29;break b}else{w=L;o=M;z=O;y=N;A=P;C=$;F=Q;G=R;H=S;J=T}}ka=w;la=o;ma=z;na=H;oa=J;pa=F;qa=G;ra=(A|0)!=0;p=37}else{aa=0;ba=0;ca=0;da=q;ea=r;fa=s;ga=0;ha=t;ia=0;ja=v;p=29}while(0);do if((p|0)==29){v=(da|0)==0;t=v?ga:ha;s=v?ia:ja;v=(fa|0)!=0;if(!(v&(ea|32|0)==101))if((ea|0)>-1){ka=aa;la=ba;ma=ca;na=ga;oa=ia;pa=t;qa=s;ra=v;p=37;break}else{sa=aa;ta=ba;ua=ca;va=ga;wa=ia;xa=v;ya=t;za=s;p=39;break}v=Re(a,g)|0;r=I;if((v|0)==0&(r|0)==-2147483648){if(!g){Ym(a,0);Aa=0.0;break}if(!(f[n>>2]|0)){Ba=0;Ca=0}else{f[m>>2]=(f[m>>2]|0)+-1;Ba=0;Ca=0}}else{Ba=v;Ca=r}r=Vn(Ba|0,Ca|0,t|0,s|0)|0;Da=aa;Ea=ba;Fa=ca;Ga=r;Ha=ga;Ia=I;Ja=ia;p=41}while(0);if((p|0)==37)if(f[n>>2]|0){f[m>>2]=(f[m>>2]|0)+-1;if(ra){Da=ka;Ea=la;Fa=ma;Ga=pa;Ha=na;Ia=qa;Ja=oa;p=41}else p=40}else{sa=ka;ta=la;ua=ma;va=na;wa=oa;xa=ra;ya=pa;za=qa;p=39}if((p|0)==39)if(xa){Da=sa;Ea=ta;Fa=ua;Ga=ya;Ha=va;Ia=za;Ja=wa;p=41}else p=40;do if((p|0)==40){wa=Vq()|0;f[wa>>2]=22;Ym(a,0);Aa=0.0}else if((p|0)==41){wa=f[j>>2]|0;if(!wa){Aa=+(e|0)*0.0;break}if(((Ja|0)<0|(Ja|0)==0&Ha>>>0<10)&((Ga|0)==(Ha|0)&(Ia|0)==(Ja|0))?(c|0)>30|(wa>>>c|0)==0:0){Aa=+(e|0)*+(wa>>>0);break}wa=(d|0)/-2|0;za=((wa|0)<0)<<31>>31;if((Ia|0)>(za|0)|(Ia|0)==(za|0)&Ga>>>0>wa>>>0){wa=Vq()|0;f[wa>>2]=34;Aa=+(e|0)*1797693134862315708145274.0e284*1797693134862315708145274.0e284;break}wa=d+-106|0;za=((wa|0)<0)<<31>>31;if((Ia|0)<(za|0)|(Ia|0)==(za|0)&Ga>>>0>>0){wa=Vq()|0;f[wa>>2]=34;Aa=+(e|0)*2.2250738585072014e-308*2.2250738585072014e-308;break}if(!Da)Ka=Ea;else{if((Da|0)<9){wa=j+(Ea<<2)|0;za=Da;va=f[wa>>2]|0;while(1){va=va*10|0;if((za|0)>=8)break;else za=za+1|0}f[wa>>2]=va}Ka=Ea+1|0}if((Fa|0)<9?(Fa|0)<=(Ga|0)&(Ga|0)<18:0){if((Ga|0)==9){Aa=+(e|0)*+((f[j>>2]|0)>>>0);break}if((Ga|0)<9){Aa=+(e|0)*+((f[j>>2]|0)>>>0)/+(f[6720+(8-Ga<<2)>>2]|0);break}za=c+27+(X(Ga,-3)|0)|0;A=f[j>>2]|0;if((za|0)>30|(A>>>za|0)==0){Aa=+(e|0)*+(A>>>0)*+(f[6720+(Ga+-10<<2)>>2]|0);break}}A=(Ga|0)%9|0;if(!A){La=0;Ma=Ka;Na=0;Oa=Ga}else{za=(Ga|0)>-1?A:A+9|0;A=f[6720+(8-za<<2)>>2]|0;if(Ka){G=1e9/(A|0)|0;F=0;J=0;H=Ga;z=0;do{o=j+(z<<2)|0;w=f[o>>2]|0;ya=((w>>>0)/(A>>>0)|0)+F|0;f[o>>2]=ya;F=X(G,(w>>>0)%(A>>>0)|0)|0;w=(z|0)==(J|0)&(ya|0)==0;H=w?H+-9|0:H;J=w?J+1&127:J;z=z+1|0}while((z|0)!=(Ka|0));if(!F){Pa=J;Qa=Ka;Ra=H}else{f[j+(Ka<<2)>>2]=F;Pa=J;Qa=Ka+1|0;Ra=H}}else{Pa=0;Qa=0;Ra=Ga}La=0;Ma=Qa;Na=Pa;Oa=9-za+Ra|0}d:while(1){z=(Oa|0)<18;A=(Oa|0)==18;G=j+(Na<<2)|0;va=La;wa=Ma;while(1){if(!z){if(!A){Sa=va;Ta=Na;Ua=Oa;Va=wa;break d}if((f[G>>2]|0)>>>0>=9007199){Sa=va;Ta=Na;Ua=18;Va=wa;break d}}w=0;Wa=wa;ya=wa+127|0;while(1){o=ya&127;ua=j+(o<<2)|0;ta=Tn(f[ua>>2]|0,0,29)|0;sa=Vn(ta|0,I|0,w|0,0)|0;ta=I;if(ta>>>0>0|(ta|0)==0&sa>>>0>1e9){xa=jp(sa|0,ta|0,1e9,0)|0;qa=hn(sa|0,ta|0,1e9,0)|0;Xa=xa;Ya=qa}else{Xa=0;Ya=sa}f[ua>>2]=Ya;ua=(o|0)==(Na|0);Wa=(Ya|0)==0&(((o|0)!=(Wa+127&127|0)|ua)^1)?o:Wa;if(ua)break;else{w=Xa;ya=o+-1|0}}va=va+-29|0;if(Xa|0)break;else wa=Wa}wa=Na+127&127;G=Wa+127&127;A=j+((Wa+126&127)<<2)|0;if((wa|0)==(Wa|0)){f[A>>2]=f[A>>2]|f[j+(G<<2)>>2];Za=G}else Za=Wa;f[j+(wa<<2)>>2]=Xa;La=va;Ma=Za;Na=wa;Oa=Oa+9|0}e:while(1){za=Va+1&127;H=j+((Va+127&127)<<2)|0;J=Sa;F=Ta;wa=Ua;while(1){G=(wa|0)==18;A=(wa|0)>27?9:1;_a=J;$a=F;while(1){z=0;while(1){ya=z+$a&127;if((ya|0)==(Va|0)){ab=2;p=88;break}w=f[j+(ya<<2)>>2]|0;ya=f[6752+(z<<2)>>2]|0;if(w>>>0>>0){ab=2;p=88;break}if(w>>>0>ya>>>0)break;ya=z+1|0;if((z|0)<1)z=ya;else{ab=ya;p=88;break}}if((p|0)==88?(p=0,G&(ab|0)==2):0){bb=0.0;cb=0;db=Va;break e}eb=A+_a|0;if(($a|0)==(Va|0)){_a=eb;$a=Va}else break}G=(1<>>A;fb=0;gb=$a;hb=wa;ya=$a;do{w=j+(ya<<2)|0;o=f[w>>2]|0;ua=(o>>>A)+fb|0;f[w>>2]=ua;fb=X(o&G,z)|0;o=(ya|0)==(gb|0)&(ua|0)==0;hb=o?hb+-9|0:hb;gb=o?gb+1&127:gb;ya=ya+1&127}while((ya|0)!=(Va|0));if(!fb){J=eb;F=gb;wa=hb;continue}if((za|0)!=(gb|0))break;f[H>>2]=f[H>>2]|1;J=eb;F=gb;wa=hb}f[j+(Va<<2)>>2]=fb;Sa=eb;Ta=gb;Ua=hb;Va=za}while(1){wa=cb+$a&127;F=db+1&127;if((wa|0)==(db|0)){f[j+(F+-1<<2)>>2]=0;ib=F}else ib=db;bb=bb*1.0e9+ +((f[j+(wa<<2)>>2]|0)>>>0);cb=cb+1|0;if((cb|0)==2)break;else db=ib}jb=+(e|0);kb=bb*jb;wa=_a+53|0;F=wa-d|0;J=(F|0)<(c|0);H=J?((F|0)>0?F:0):c;if((H|0)<53){lb=+rq(+bk(1.0,105-H|0),kb);mb=+Dq(kb,+bk(1.0,53-H|0));nb=lb;ob=mb;pb=lb+(kb-mb)}else{nb=0.0;ob=0.0;pb=kb}va=$a+2&127;if((va|0)!=(ib|0)){ya=f[j+(va<<2)>>2]|0;do if(ya>>>0>=5e8){if((ya|0)!=5e8){qb=jb*.75+ob;break}if(($a+3&127|0)==(ib|0)){qb=jb*.5+ob;break}else{qb=jb*.75+ob;break}}else{if((ya|0)==0?($a+3&127|0)==(ib|0):0){qb=ob;break}qb=jb*.25+ob}while(0);if((53-H|0)>1?!(+Dq(qb,1.0)!=0.0):0)rb=qb+1.0;else rb=qb}else rb=ob;jb=pb+rb-nb;do if((wa&2147483647|0)>(-2-k|0)){ya=!(+K(+jb)>=9007199254740992.0);va=_a+((ya^1)&1)|0;kb=ya?jb:jb*.5;if((va+50|0)<=(l|0)?!(rb!=0.0&(J&((H|0)!=(F|0)|ya))):0){sb=kb;tb=va;break}ya=Vq()|0;f[ya>>2]=34;sb=kb;tb=va}else{sb=jb;tb=_a}while(0);Aa=+sq(sb,tb)}while(0);u=i;return +Aa}function ob(a,c,d,e,g,i){a=a|0;c=+c;d=d|0;e=e|0;g=g|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0.0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0,D=0.0,E=0,F=0,G=0,H=0.0,J=0,K=0,L=0,M=0,N=0,O=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0.0,ga=0.0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0;j=u;u=u+560|0;k=j+8|0;l=j;m=j+524|0;n=m;o=j+512|0;f[l>>2]=0;p=o+12|0;yo(c)|0;if((I|0)<0){q=-c;r=1;s=16605}else{q=c;r=(g&2049|0)!=0&1;s=(g&2048|0)==0?((g&1|0)==0?16606:16611):16608}yo(q)|0;do if(0==0&(I&2146435072|0)==2146435072){t=(i&32|0)!=0;v=r+3|0;Qk(a,32,d,v,g&-65537);Xo(a,s,r);Xo(a,q!=q|0.0!=0.0?(t?18555:16632):t?16624:16628,3);Qk(a,32,d,v,g^8192);w=v}else{c=+tq(q,l)*2.0;v=c!=0.0;if(v)f[l>>2]=(f[l>>2]|0)+-1;t=i|32;if((t|0)==97){x=i&32;y=(x|0)==0?s:s+9|0;z=r|2;A=12-e|0;do if(!(e>>>0>11|(A|0)==0)){B=8.0;C=A;do{C=C+-1|0;B=B*16.0}while((C|0)!=0);if((b[y>>0]|0)==45){D=-(B+(-c-B));break}else{D=c+B-B;break}}else D=c;while(0);A=f[l>>2]|0;C=(A|0)<0?0-A|0:A;E=Rj(C,((C|0)<0)<<31>>31,p)|0;if((E|0)==(p|0)){C=o+11|0;b[C>>0]=48;F=C}else F=E;b[F+-1>>0]=(A>>31&2)+43;A=F+-2|0;b[A>>0]=i+15;E=(e|0)<1;C=(g&8|0)==0;G=m;H=D;while(1){J=~~H;K=G+1|0;b[G>>0]=x|h[16636+J>>0];H=(H-+(J|0))*16.0;if((K-n|0)==1?!(C&(E&H==0.0)):0){b[K>>0]=46;L=G+2|0}else L=K;if(!(H!=0.0))break;else G=L}G=L;if((e|0)!=0?(-2-n+G|0)<(e|0):0){M=G-n|0;N=e+2|0}else{E=G-n|0;M=E;N=E}E=p-A|0;G=E+z+N|0;Qk(a,32,d,G,g);Xo(a,y,z);Qk(a,48,d,G,g^65536);Xo(a,m,M);Qk(a,48,N-M|0,0,0);Xo(a,A,E);Qk(a,32,d,G,g^8192);w=G;break}G=(e|0)<0?6:e;if(v){E=(f[l>>2]|0)+-28|0;f[l>>2]=E;O=c*268435456.0;P=E}else{O=c;P=f[l>>2]|0}E=(P|0)<0?k:k+288|0;C=E;H=O;do{x=~~H>>>0;f[C>>2]=x;C=C+4|0;H=(H-+(x>>>0))*1.0e9}while(H!=0.0);if((P|0)>0){v=E;A=C;z=P;while(1){y=(z|0)<29?z:29;x=A+-4|0;if(x>>>0>=v>>>0){K=x;x=0;do{J=Tn(f[K>>2]|0,0,y|0)|0;Q=Vn(J|0,I|0,x|0,0)|0;J=I;R=hn(Q|0,J|0,1e9,0)|0;f[K>>2]=R;x=jp(Q|0,J|0,1e9,0)|0;K=K+-4|0}while(K>>>0>=v>>>0);if(x){K=v+-4|0;f[K>>2]=x;S=K}else S=v}else S=v;K=A;while(1){if(K>>>0<=S>>>0)break;J=K+-4|0;if(!(f[J>>2]|0))K=J;else break}x=(f[l>>2]|0)-y|0;f[l>>2]=x;if((x|0)>0){v=S;A=K;z=x}else{T=S;U=K;V=x;break}}}else{T=E;U=C;V=P}if((V|0)<0){z=((G+25|0)/9|0)+1|0;A=(t|0)==102;v=T;x=U;J=V;while(1){Q=0-J|0;R=(Q|0)<9?Q:9;if(v>>>0>>0){Q=(1<>>R;Y=0;Z=v;do{_=f[Z>>2]|0;f[Z>>2]=(_>>>R)+Y;Y=X(_&Q,W)|0;Z=Z+4|0}while(Z>>>0>>0);Z=(f[v>>2]|0)==0?v+4|0:v;if(!Y){$=Z;aa=x}else{f[x>>2]=Y;$=Z;aa=x+4|0}}else{$=(f[v>>2]|0)==0?v+4|0:v;aa=x}Z=A?E:$;W=(aa-Z>>2|0)>(z|0)?Z+(z<<2)|0:aa;J=(f[l>>2]|0)+R|0;f[l>>2]=J;if((J|0)>=0){ba=$;ca=W;break}else{v=$;x=W}}}else{ba=T;ca=U}x=E;if(ba>>>0>>0){v=(x-ba>>2)*9|0;J=f[ba>>2]|0;if(J>>>0<10)da=v;else{z=v;v=10;while(1){v=v*10|0;A=z+1|0;if(J>>>0>>0){da=A;break}else z=A}}}else da=0;z=(t|0)==103;v=(G|0)!=0;J=G-((t|0)!=102?da:0)+((v&z)<<31>>31)|0;if((J|0)<(((ca-x>>2)*9|0)+-9|0)){A=J+9216|0;J=E+4+(((A|0)/9|0)+-1024<<2)|0;C=(A|0)%9|0;if((C|0)<8){A=C;C=10;while(1){W=C*10|0;if((A|0)<7){A=A+1|0;C=W}else{ea=W;break}}}else ea=10;C=f[J>>2]|0;A=(C>>>0)%(ea>>>0)|0;t=(J+4|0)==(ca|0);if(!(t&(A|0)==0)){B=(((C>>>0)/(ea>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;W=(ea|0)/2|0;H=A>>>0>>0?.5:t&(A|0)==(W|0)?1.0:1.5;if(!r){fa=H;ga=B}else{W=(b[s>>0]|0)==45;fa=W?-H:H;ga=W?-B:B}W=C-A|0;f[J>>2]=W;if(ga+fa!=ga){A=W+ea|0;f[J>>2]=A;if(A>>>0>999999999){A=ba;W=J;while(1){C=W+-4|0;f[W>>2]=0;if(C>>>0>>0){t=A+-4|0;f[t>>2]=0;ha=t}else ha=A;t=(f[C>>2]|0)+1|0;f[C>>2]=t;if(t>>>0>999999999){A=ha;W=C}else{ia=ha;ja=C;break}}}else{ia=ba;ja=J}W=(x-ia>>2)*9|0;A=f[ia>>2]|0;if(A>>>0<10){ka=ja;la=W;ma=ia}else{C=W;W=10;while(1){W=W*10|0;t=C+1|0;if(A>>>0>>0){ka=ja;la=t;ma=ia;break}else C=t}}}else{ka=J;la=da;ma=ba}}else{ka=J;la=da;ma=ba}C=ka+4|0;na=la;oa=ca>>>0>C>>>0?C:ca;pa=ma}else{na=da;oa=ca;pa=ba}C=oa;while(1){if(C>>>0<=pa>>>0){qa=0;break}W=C+-4|0;if(!(f[W>>2]|0))C=W;else{qa=1;break}}J=0-na|0;do if(z){W=G+((v^1)&1)|0;if((W|0)>(na|0)&(na|0)>-5){ra=i+-1|0;sa=W+-1-na|0}else{ra=i+-2|0;sa=W+-1|0}W=g&8;if(!W){if(qa?(A=f[C+-4>>2]|0,(A|0)!=0):0)if(!((A>>>0)%10|0)){t=0;Z=10;while(1){Z=Z*10|0;Q=t+1|0;if((A>>>0)%(Z>>>0)|0|0){ta=Q;break}else t=Q}}else ta=0;else ta=9;t=((C-x>>2)*9|0)+-9|0;if((ra|32|0)==102){Z=t-ta|0;A=(Z|0)>0?Z:0;ua=ra;va=(sa|0)<(A|0)?sa:A;wa=0;break}else{A=t+na-ta|0;t=(A|0)>0?A:0;ua=ra;va=(sa|0)<(t|0)?sa:t;wa=0;break}}else{ua=ra;va=sa;wa=W}}else{ua=i;va=G;wa=g&8}while(0);G=va|wa;x=(G|0)!=0&1;v=(ua|32|0)==102;if(v){xa=0;ya=(na|0)>0?na:0}else{z=(na|0)<0?J:na;t=Rj(z,((z|0)<0)<<31>>31,p)|0;z=p;if((z-t|0)<2){A=t;while(1){Z=A+-1|0;b[Z>>0]=48;if((z-Z|0)<2)A=Z;else{za=Z;break}}}else za=t;b[za+-1>>0]=(na>>31&2)+43;A=za+-2|0;b[A>>0]=ua;xa=A;ya=z-A|0}A=r+1+va+x+ya|0;Qk(a,32,d,A,g);Xo(a,s,r);Qk(a,48,d,A,g^65536);if(v){J=pa>>>0>E>>>0?E:pa;Z=m+9|0;R=Z;Y=m+8|0;Q=J;do{K=Rj(f[Q>>2]|0,0,Z)|0;if((Q|0)==(J|0))if((K|0)==(Z|0)){b[Y>>0]=48;Aa=Y}else Aa=K;else if(K>>>0>m>>>0){sj(m|0,48,K-n|0)|0;y=K;while(1){_=y+-1|0;if(_>>>0>m>>>0)y=_;else{Aa=_;break}}}else Aa=K;Xo(a,Aa,R-Aa|0);Q=Q+4|0}while(Q>>>0<=E>>>0);if(G|0)Xo(a,16652,1);if(Q>>>0>>0&(va|0)>0){E=va;R=Q;while(1){Y=Rj(f[R>>2]|0,0,Z)|0;if(Y>>>0>m>>>0){sj(m|0,48,Y-n|0)|0;J=Y;while(1){v=J+-1|0;if(v>>>0>m>>>0)J=v;else{Ba=v;break}}}else Ba=Y;Xo(a,Ba,(E|0)<9?E:9);R=R+4|0;J=E+-9|0;if(!(R>>>0>>0&(E|0)>9)){Ca=J;break}else E=J}}else Ca=va;Qk(a,48,Ca+9|0,9,0)}else{E=qa?C:pa+4|0;if((va|0)>-1){R=m+9|0;Z=(wa|0)==0;Q=R;G=0-n|0;J=m+8|0;K=va;v=pa;while(1){x=Rj(f[v>>2]|0,0,R)|0;if((x|0)==(R|0)){b[J>>0]=48;Da=J}else Da=x;do if((v|0)==(pa|0)){x=Da+1|0;Xo(a,Da,1);if(Z&(K|0)<1){Ea=x;break}Xo(a,16652,1);Ea=x}else{if(Da>>>0<=m>>>0){Ea=Da;break}sj(m|0,48,Da+G|0)|0;x=Da;while(1){z=x+-1|0;if(z>>>0>m>>>0)x=z;else{Ea=z;break}}}while(0);Y=Q-Ea|0;Xo(a,Ea,(K|0)>(Y|0)?Y:K);x=K-Y|0;v=v+4|0;if(!(v>>>0>>0&(x|0)>-1)){Fa=x;break}else K=x}}else Fa=va;Qk(a,48,Fa+18|0,18,0);Xo(a,xa,p-xa|0)}Qk(a,32,d,A,g^8192);w=A}while(0);u=j;return ((w|0)<(d|0)?d:w)|0}function pb(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R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0;C=(f[A+4>>2]|0)-(f[A>>2]|0)>>2;gk(z,C-((C>>>0)%3|0)|0);C=a+84|0;z=f[s>>2]|0;A=(f[z+28>>2]|0)-(f[z+24>>2]|0)>>2;b[d>>0]=0;qh(C,A,d);A=a+96|0;z=f[A>>2]|0;B=a+100|0;D=f[B>>2]|0;if((D|0)!=(z|0))f[B>>2]=D+(~((D+-4-z|0)>>>2)<<2);f[a+164>>2]=-1;z=a+168|0;f[z>>2]=0;D=f[a+108>>2]|0;E=a+112|0;F=f[E>>2]|0;if((F|0)!=(D|0))f[E>>2]=F+(~(((F+-12-D|0)>>>0)/12|0)*12|0);D=a+132|0;if(f[D>>2]|0){F=a+128|0;E=f[F>>2]|0;if(E|0){G=E;do{E=G;G=f[G>>2]|0;Oq(E)}while((G|0)!=0)}f[F>>2]=0;F=f[a+124>>2]|0;if(F|0){G=a+120|0;E=0;do{f[(f[G>>2]|0)+(E<<2)>>2]=0;E=E+1|0}while((E|0)!=(F|0))}f[D>>2]=0}f[a+144>>2]=0;D=f[s>>2]|0;F=(f[D+28>>2]|0)-(f[D+24>>2]|0)>>2;f[d>>2]=-1;hg(a+152|0,F,d);F=a+72|0;D=f[F>>2]|0;E=a+76|0;G=f[E>>2]|0;if((G|0)!=(D|0))f[E>>2]=G+(~((G+-4-D|0)>>>2)<<2);D=f[s>>2]|0;gk(F,((f[D+4>>2]|0)-(f[D>>2]|0)>>2>>>0)/3|0);f[a+64>>2]=0;if(!(Be(a)|0)){w=0;u=c;return w|0}if(!(Hg(a)|0)){w=0;u=c;return w|0}D=a+172|0;G=a+176|0;H=(((f[G>>2]|0)-(f[D>>2]|0)|0)/136|0)&255;b[h>>0]=H;I=f[(f[x>>2]|0)+44>>2]|0;J=I+16|0;K=f[J+4>>2]|0;if((K|0)>0|(K|0)==0&(f[J>>2]|0)>>>0>0)L=H;else{f[e>>2]=f[I+4>>2];f[d>>2]=f[e>>2];Me(I,d,h,h+1|0)|0;L=b[h>>0]|0}h=a+284|0;f[h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s>>2]|0)+12>>2]|0)+(Y<<2)>>2]|0;Y=(V|0)==-1;W=Y?-1:(V>>>0)/3|0;if(Y)break;if(f[(f[t>>2]|0)+(W>>>5<<2)>>2]&1<<(W&31)|0)break;f[l>>2]=V;f[d>>2]=f[l>>2];if(!(kc(a,d)|0))break b}else{V=Q+1|0;if(R)$=-1;else $=((V>>>0)%3|0|0)==0?Q+-2|0:V;f[m>>2]=$;f[d>>2]=f[m>>2];Pe(a,d,1)|0;f[n>>2]=f[e>>2];f[d>>2]=f[n>>2];if(!(kc(a,d)|0))break b}while(0)}M=M+1|0;if((M|0)>=(L|0)){aa=62;break a}}ba=0}else aa=62;while(0);if((aa|0)==62){aa=f[F>>2]|0;L=f[E>>2]|0;n=L;if((aa|0)!=(L|0)?(m=L+-4|0,aa>>>0>>0):0){L=aa;aa=m;do{m=f[L>>2]|0;f[L>>2]=f[aa>>2];f[aa>>2]=m;L=L+4|0;aa=aa+-4|0}while(L>>>0>>0)}f[o>>2]=n;f[p>>2]=f[i>>2];f[q>>2]=f[H>>2];f[g>>2]=f[o>>2];f[e>>2]=f[p>>2];f[d>>2]=f[q>>2];Yd(F,g,e,d)|0;if((f[G>>2]|0)!=(f[D>>2]|0)?(D=f[y>>2]|0,y=((f[D+100>>2]|0)-(f[D+96>>2]|0)|0)/12|0,b[d>>0]=0,qh(t,y,d),y=f[F>>2]|0,F=f[E>>2]|0,(y|0)!=(F|0)):0){E=y;do{f[r>>2]=f[E>>2];f[d>>2]=f[r>>2];He(a,d)|0;E=E+4|0}while((E|0)!=(F|0))}th(v);F=a+232|0;ld(v,F);v=a+280|0;E=f[v>>2]|0;if((E|0?(f[h>>2]|0)>0:0)?(ld(E,F),(f[h>>2]|0)>1):0){E=1;do{ld((f[v>>2]|0)+(E<<5)|0,F);E=E+1|0}while((E|0)<(f[h>>2]|0))}ci((f[a+272>>2]|0)-(f[a+268>>2]|0)>>2,f[(f[x>>2]|0)+44>>2]|0)|0;ci(f[z>>2]|0,f[(f[x>>2]|0)+44>>2]|0)|0;if(bh(a)|0){z=f[(f[x>>2]|0)+44>>2]|0;x=f[F>>2]|0;F=z+16|0;h=f[F+4>>2]|0;if(!((h|0)>0|(h|0)==0&(f[F>>2]|0)>>>0>0)){F=(f[a+236>>2]|0)-x|0;f[e>>2]=f[z+4>>2];f[d>>2]=f[e>>2];Me(z,d,x,x+F|0)|0}ba=1}else ba=0}F=f[i>>2]|0;if(F|0){i=f[H>>2]|0;if((i|0)!=(F|0))f[H>>2]=i+(~((i+-4-F|0)>>>2)<<2);Oq(F)}w=ba;u=c;return w|0}function qb(a,c,e,g,h){a=a|0;c=c|0;e=e|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0,o=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0;i=u;u=u+64|0;j=i+16|0;k=i;l=i+24|0;m=i+8|0;n=i+20|0;f[j>>2]=c;c=(a|0)!=0;o=l+40|0;q=o;r=l+39|0;l=m+4|0;s=0;t=0;v=0;a:while(1){do if((t|0)>-1)if((s|0)>(2147483647-t|0)){w=Vq()|0;f[w>>2]=75;x=-1;break}else{x=s+t|0;break}else x=t;while(0);w=f[j>>2]|0;y=b[w>>0]|0;if(!(y<<24>>24)){z=88;break}else{A=y;B=w}b:while(1){switch(A<<24>>24){case 37:{C=B;D=B;z=9;break b;break}case 0:{E=B;break b;break}default:{}}y=B+1|0;f[j>>2]=y;A=b[y>>0]|0;B=y}c:do if((z|0)==9)while(1){z=0;if((b[D+1>>0]|0)!=37){E=C;break c}y=C+1|0;D=D+2|0;f[j>>2]=D;if((b[D>>0]|0)!=37){E=y;break}else{C=y;z=9}}while(0);y=E-w|0;if(c)Xo(a,w,y);if(y|0){s=y;t=x;continue}y=(Aq(b[(f[j>>2]|0)+1>>0]|0)|0)==0;F=f[j>>2]|0;if(!y?(b[F+2>>0]|0)==36:0){G=(b[F+1>>0]|0)+-48|0;H=1;J=3}else{G=-1;H=v;J=1}y=F+J|0;f[j>>2]=y;F=b[y>>0]|0;K=(F<<24>>24)+-32|0;if(K>>>0>31|(1<>24)+-32|K;P=F+1|0;f[j>>2]=P;Q=b[P>>0]|0;R=(Q<<24>>24)+-32|0;if(R>>>0>31|(1<>24==42){if((Aq(b[N+1>>0]|0)|0)!=0?(F=f[j>>2]|0,(b[F+2>>0]|0)==36):0){O=F+1|0;f[h+((b[O>>0]|0)+-48<<2)>>2]=10;S=f[g+((b[O>>0]|0)+-48<<3)>>2]|0;T=1;U=F+3|0}else{if(H|0){V=-1;break}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);O=f[F>>2]|0;f[e>>2]=F+4;W=O}else W=0;S=W;T=0;U=(f[j>>2]|0)+1|0}f[j>>2]=U;O=(S|0)<0;X=O?0-S|0:S;Y=O?L|8192:L;Z=T;_=U}else{O=Ll(j)|0;if((O|0)<0){V=-1;break}X=O;Y=L;Z=H;_=f[j>>2]|0}do if((b[_>>0]|0)==46){if((b[_+1>>0]|0)!=42){f[j>>2]=_+1;O=Ll(j)|0;$=O;aa=f[j>>2]|0;break}if(Aq(b[_+2>>0]|0)|0?(O=f[j>>2]|0,(b[O+3>>0]|0)==36):0){F=O+2|0;f[h+((b[F>>0]|0)+-48<<2)>>2]=10;K=f[g+((b[F>>0]|0)+-48<<3)>>2]|0;F=O+4|0;f[j>>2]=F;$=K;aa=F;break}if(Z|0){V=-1;break a}if(c){F=(f[e>>2]|0)+(4-1)&~(4-1);K=f[F>>2]|0;f[e>>2]=F+4;ba=K}else ba=0;K=(f[j>>2]|0)+2|0;f[j>>2]=K;$=ba;aa=K}else{$=-1;aa=_}while(0);K=0;F=aa;while(1){if(((b[F>>0]|0)+-65|0)>>>0>57){V=-1;break a}O=F;F=F+1|0;f[j>>2]=F;ca=b[(b[O>>0]|0)+-65+(16124+(K*58|0))>>0]|0;da=ca&255;if((da+-1|0)>>>0>=8)break;else K=da}if(!(ca<<24>>24)){V=-1;break}O=(G|0)>-1;do if(ca<<24>>24==19)if(O){V=-1;break a}else z=50;else{if(O){f[h+(G<<2)>>2]=da;P=g+(G<<3)|0;Q=f[P+4>>2]|0;y=k;f[y>>2]=f[P>>2];f[y+4>>2]=Q;z=50;break}if(!c){V=0;break a}We(k,da,e);ea=f[j>>2]|0}while(0);if((z|0)==50){z=0;if(c)ea=F;else{s=0;t=x;v=Z;continue}}O=b[ea+-1>>0]|0;Q=(K|0)!=0&(O&15|0)==3?O&-33:O;O=Y&-65537;y=(Y&8192|0)==0?Y:O;d:do switch(Q|0){case 110:{switch((K&255)<<24>>24){case 0:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 1:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 2:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}case 3:{d[f[k>>2]>>1]=x;s=0;t=x;v=Z;continue a;break}case 4:{b[f[k>>2]>>0]=x;s=0;t=x;v=Z;continue a;break}case 6:{f[f[k>>2]>>2]=x;s=0;t=x;v=Z;continue a;break}case 7:{P=f[k>>2]|0;f[P>>2]=x;f[P+4>>2]=((x|0)<0)<<31>>31;s=0;t=x;v=Z;continue a;break}default:{s=0;t=x;v=Z;continue a}}break}case 112:{fa=120;ga=$>>>0>8?$:8;ha=y|8;z=62;break}case 88:case 120:{fa=Q;ga=$;ha=y;z=62;break}case 111:{P=k;R=f[P>>2]|0;ia=f[P+4>>2]|0;P=Ol(R,ia,o)|0;ja=q-P|0;ka=P;la=0;ma=16588;na=(y&8|0)==0|($|0)>(ja|0)?$:ja+1|0;oa=y;pa=R;qa=ia;z=68;break}case 105:case 100:{ia=k;R=f[ia>>2]|0;ja=f[ia+4>>2]|0;if((ja|0)<0){ia=Xn(0,0,R|0,ja|0)|0;P=I;ra=k;f[ra>>2]=ia;f[ra+4>>2]=P;sa=1;ta=16588;ua=ia;va=P;z=67;break d}else{sa=(y&2049|0)!=0&1;ta=(y&2048|0)==0?((y&1|0)==0?16588:16590):16589;ua=R;va=ja;z=67;break d}break}case 117:{ja=k;sa=0;ta=16588;ua=f[ja>>2]|0;va=f[ja+4>>2]|0;z=67;break}case 99:{b[r>>0]=f[k>>2];wa=r;xa=0;ya=16588;za=o;Aa=1;Ba=O;break}case 109:{ja=Vq()|0;Ca=$o(f[ja>>2]|0)|0;z=72;break}case 115:{ja=f[k>>2]|0;Ca=ja|0?ja:16598;z=72;break}case 67:{f[m>>2]=f[k>>2];f[l>>2]=0;f[k>>2]=m;Da=-1;Ea=m;z=76;break}case 83:{ja=f[k>>2]|0;if(!$){Qk(a,32,X,0,y);Fa=0;z=85}else{Da=$;Ea=ja;z=76}break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{s=ob(a,+p[k>>3],X,$,y,Q)|0;t=x;v=Z;continue a;break}default:{wa=w;xa=0;ya=16588;za=o;Aa=$;Ba=y}}while(0);e:do if((z|0)==62){z=0;w=k;Q=f[w>>2]|0;K=f[w+4>>2]|0;w=ul(Q,K,o,fa&32)|0;F=(ha&8|0)==0|(Q|0)==0&(K|0)==0;ka=w;la=F?0:2;ma=F?16588:16588+(fa>>4)|0;na=ga;oa=ha;pa=Q;qa=K;z=68}else if((z|0)==67){z=0;ka=Rj(ua,va,o)|0;la=sa;ma=ta;na=$;oa=y;pa=ua;qa=va;z=68}else if((z|0)==72){z=0;K=tg(Ca,0,$)|0;Q=(K|0)==0;wa=Ca;xa=0;ya=16588;za=Q?Ca+$|0:K;Aa=Q?$:K-Ca|0;Ba=O}else if((z|0)==76){z=0;K=Ea;Q=0;F=0;while(1){w=f[K>>2]|0;if(!w){Ga=Q;Ha=F;break}ja=Po(n,w)|0;if((ja|0)<0|ja>>>0>(Da-Q|0)>>>0){Ga=Q;Ha=ja;break}w=ja+Q|0;if(Da>>>0>w>>>0){K=K+4|0;Q=w;F=ja}else{Ga=w;Ha=ja;break}}if((Ha|0)<0){V=-1;break a}Qk(a,32,X,Ga,y);if(!Ga){Fa=0;z=85}else{F=Ea;Q=0;while(1){K=f[F>>2]|0;if(!K){Fa=Ga;z=85;break e}ja=Po(n,K)|0;Q=ja+Q|0;if((Q|0)>(Ga|0)){Fa=Ga;z=85;break e}Xo(a,n,ja);if(Q>>>0>=Ga>>>0){Fa=Ga;z=85;break}else F=F+4|0}}}while(0);if((z|0)==68){z=0;O=(pa|0)!=0|(qa|0)!=0;F=(na|0)!=0|O;Q=q-ka+((O^1)&1)|0;wa=F?ka:o;xa=la;ya=ma;za=o;Aa=F?((na|0)>(Q|0)?na:Q):na;Ba=(na|0)>-1?oa&-65537:oa}else if((z|0)==85){z=0;Qk(a,32,X,Fa,y^8192);s=(X|0)>(Fa|0)?X:Fa;t=x;v=Z;continue}Q=za-wa|0;F=(Aa|0)<(Q|0)?Q:Aa;O=F+xa|0;ja=(X|0)<(O|0)?O:X;Qk(a,32,ja,O,Ba);Xo(a,ya,xa);Qk(a,48,ja,O,Ba^65536);Qk(a,48,F,Q,0);Xo(a,wa,Q);Qk(a,32,ja,O,Ba^8192);s=ja;t=x;v=Z}f:do if((z|0)==88)if(!a)if(v){Z=1;while(1){t=f[h+(Z<<2)>>2]|0;if(!t){Ia=Z;break}We(g+(Z<<3)|0,t,e);t=Z+1|0;if((Z|0)<9)Z=t;else{Ia=t;break}}if((Ia|0)<10){Z=Ia;while(1){if(f[h+(Z<<2)>>2]|0){V=-1;break f}if((Z|0)<9)Z=Z+1|0;else{V=1;break}}}else V=1}else V=0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2]|0)|0)/12|0;b[d>>0]=0;qh(v,A,d);A=f[s>>2]|0;z=(f[A+28>>2]|0)-(f[A+24>>2]|0)>>2;f[d>>2]=-1;hg(a+52|0,z,d);z=a+40|0;A=f[z>>2]|0;B=a+44|0;C=f[B>>2]|0;if((C|0)!=(A|0))f[B>>2]=C+(~((C+-4-A|0)>>>2)<<2);A=f[s>>2]|0;C=(f[A+4>>2]|0)-(f[A>>2]|0)>>2;gk(z,C-((C>>>0)%3|0)|0);C=a+84|0;z=f[s>>2]|0;A=(f[z+28>>2]|0)-(f[z+24>>2]|0)>>2;b[d>>0]=0;qh(C,A,d);A=a+96|0;z=f[A>>2]|0;B=a+100|0;D=f[B>>2]|0;if((D|0)!=(z|0))f[B>>2]=D+(~((D+-4-z|0)>>>2)<<2);f[a+164>>2]=-1;z=a+168|0;f[z>>2]=0;D=f[a+108>>2]|0;E=a+112|0;F=f[E>>2]|0;if((F|0)!=(D|0))f[E>>2]=F+(~(((F+-12-D|0)>>>0)/12|0)*12|0);D=a+132|0;if(f[D>>2]|0){F=a+128|0;E=f[F>>2]|0;if(E|0){G=E;do{E=G;G=f[G>>2]|0;Oq(E)}while((G|0)!=0)}f[F>>2]=0;F=f[a+124>>2]|0;if(F|0){G=a+120|0;E=0;do{f[(f[G>>2]|0)+(E<<2)>>2]=0;E=E+1|0}while((E|0)!=(F|0))}f[D>>2]=0}f[a+144>>2]=0;D=f[s>>2]|0;F=(f[D+28>>2]|0)-(f[D+24>>2]|0)>>2;f[d>>2]=-1;hg(a+152|0,F,d);F=a+72|0;D=f[F>>2]|0;E=a+76|0;G=f[E>>2]|0;if((G|0)!=(D|0))f[E>>2]=G+(~((G+-4-D|0)>>>2)<<2);D=f[s>>2]|0;gk(F,((f[D+4>>2]|0)-(f[D>>2]|0)>>2>>>0)/3|0);f[a+64>>2]=0;if(!(Be(a)|0)){w=0;u=c;return w|0}if(!(Dg(a)|0)){w=0;u=c;return w|0}D=a+172|0;G=a+176|0;H=(((f[G>>2]|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-1;else Z=((X>>>0)%3|0|0)==0?P+-2|0:X;f[d>>2]=Z;V=f[I>>2]|0;if(V>>>0<(f[J>>2]|0)>>>0){f[V>>2]=Z;f[I>>2]=V+4}else Ri(i,d);if(Q)break;V=((X>>>0)%3|0|0)==0?P+-2|0:X;if((V|0)==-1)break;X=f[(f[(f[s>>2]|0)+12>>2]|0)+(V<<2)>>2]|0;V=(X|0)==-1;U=V?-1:(X>>>0)/3|0;if(V)break;if(f[(f[v>>2]|0)+(U>>>5<<2)>>2]&1<<(U&31)|0)break;f[l>>2]=X;f[d>>2]=f[l>>2];if(!(Yb(a,d)|0))break b}else{X=P+1|0;if(Q)_=-1;else _=((X>>>0)%3|0|0)==0?P+-2|0:X;f[m>>2]=_;f[d>>2]=f[m>>2];Pe(a,d,1)|0;f[n>>2]=f[e>>2];f[d>>2]=f[n>>2];if(!(Yb(a,d)|0))break b}while(0)}K=K+1|0;if((K|0)>=(L|0)){$=62;break a}}aa=0}else $=62;while(0);if(($|0)==62){$=f[F>>2]|0;L=f[E>>2]|0;n=L;if(($|0)!=(L|0)?(m=L+-4|0,$>>>0>>0):0){L=$;$=m;do{m=f[L>>2]|0;f[L>>2]=f[$>>2];f[$>>2]=m;L=L+4|0;$=$+-4|0}while(L>>>0<$>>>0)}f[o>>2]=n;f[p>>2]=f[i>>2];f[q>>2]=f[I>>2];f[g>>2]=f[o>>2];f[e>>2]=f[p>>2];f[d>>2]=f[q>>2];Yd(F,g,e,d)|0;if((f[G>>2]|0)!=(f[D>>2]|0)?(D=f[y>>2]|0,y=((f[D+100>>2]|0)-(f[D+96>>2]|0)|0)/12|0,b[d>>0]=0,qh(v,y,d),y=f[F>>2]|0,F=f[E>>2]|0,(y|0)!=(F|0)):0){E=y;do{f[r>>2]=f[E>>2];f[d>>2]=f[r>>2];He(a,d)|0;E=E+4|0}while((E|0)!=(F|0))}pi(t);ci(f[a+324>>2]|0,f[(f[x>>2]|0)+44>>2]|0)|0;ci(f[z>>2]|0,f[(f[x>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|0;r=g+8|0;s=d+24|0;t=0;v=0;while(1){w=f[m>>2]|0;x=f[w+8>>2]|0;y=(f[w+12>>2]|0)-x|0;w=(y|0)>0;z=x;if(w){x=y>>>2;A=0;B=0;while(1){C=f[z+(A<<2)>>2]|0;if(!(b[C+84>>0]|0))D=f[(f[C+68>>2]|0)+(v<<2)>>2]|0;else D=v;C=D+239^B;A=A+1|0;if((A|0)>=(x|0)){E=C;break}else B=C}}else E=0;B=f[q>>2]|0;x=(B|0)==0;a:do if(!x){A=B+-1|0;C=(A&B|0)==0;if(!C)if(E>>>0>>0)F=E;else F=(E>>>0)%(B>>>0)|0;else F=A&E;G=f[(f[d>>2]|0)+(F<<2)>>2]|0;if((G|0)!=0?(H=f[G>>2]|0,(H|0)!=0):0){G=f[s>>2]|0;I=G+8|0;J=G+12|0;b:do if(C){G=H;while(1){K=f[G+4>>2]|0;L=(K|0)==(E|0);if(!(L|(K&A|0)==(F|0))){M=44;break a}c:do if(L){K=f[G+8>>2]|0;N=f[I>>2]|0;O=(f[J>>2]|0)-N|0;P=N;if((O|0)<=0){Q=G;break b}N=O>>>2;O=0;while(1){R=f[P+(O<<2)>>2]|0;if(!(b[R+84>>0]|0)){S=f[R+68>>2]|0;T=f[S+(v<<2)>>2]|0;U=f[S+(K<<2)>>2]|0}else{T=v;U=K}O=O+1|0;if((U|0)!=(T|0))break c;if((O|0)>=(N|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}else{G=H;while(1){L=f[G+4>>2]|0;d:do if((L|0)!=(E|0)){if(L>>>0>>0)X=L;else X=(L>>>0)%(B>>>0)|0;if((X|0)!=(F|0)){M=44;break a}}else{N=f[G+8>>2]|0;O=f[I>>2]|0;K=(f[J>>2]|0)-O|0;P=O;if((K|0)<=0){Q=G;break b}O=K>>>2;K=0;while(1){S=f[P+(K<<2)>>2]|0;if(!(b[S+84>>0]|0)){R=f[S+68>>2]|0;Y=f[R+(v<<2)>>2]|0;Z=f[R+(N<<2)>>2]|0}else{Y=v;Z=N}K=K+1|0;if((Z|0)!=(Y|0))break d;if((K|0)>=(O|0)){V=G;M=42;break b}}}while(0);G=f[G>>2]|0;if(!G){M=44;break a}}}while(0);if((M|0)==42){M=0;if(!V){M=44;break}else Q=V}f[(f[e>>2]|0)+(v<<2)>>2]=f[Q+12>>2];_=t}else M=44}else M=44;while(0);do if((M|0)==44){M=0;if(w){J=y>>>2;I=0;H=0;while(1){A=f[z+(I<<2)>>2]|0;if(!(b[A+84>>0]|0))aa=f[(f[A+68>>2]|0)+(v<<2)>>2]|0;else aa=v;A=aa+239^H;I=I+1|0;if((I|0)>=(J|0)){ba=A;break}else H=A}}else ba=0;e:do if(!x){H=B+-1|0;J=(H&B|0)==0;if(!J)if(ba>>>0>>0)ca=ba;else ca=(ba>>>0)%(B>>>0)|0;else ca=H&ba;I=f[(f[d>>2]|0)+(ca<<2)>>2]|0;if((I|0)!=0?(A=f[I>>2]|0,(A|0)!=0):0){I=f[s>>2]|0;C=I+8|0;G=I+12|0;if(J){J=A;while(1){I=f[J+4>>2]|0;if(!((I|0)==(ba|0)|(I&H|0)==(ca|0))){da=ca;M=76;break e}I=f[J+8>>2]|0;L=f[C>>2]|0;O=(f[G>>2]|0)-L|0;K=L;if((O|0)<=0){ea=v;break e}L=O>>>2;O=0;while(1){N=f[K+(O<<2)>>2]|0;if(!(b[N+84>>0]|0)){P=f[N+68>>2]|0;fa=f[P+(v<<2)>>2]|0;ga=f[P+(I<<2)>>2]|0}else{fa=v;ga=I}O=O+1|0;if((ga|0)!=(fa|0))break;if((O|0)>=(L|0)){ea=v;break e}}J=f[J>>2]|0;if(!J){da=ca;M=76;break e}}}else ha=A;while(1){J=f[ha+4>>2]|0;if((J|0)!=(ba|0)){if(J>>>0>>0)ia=J;else ia=(J>>>0)%(B>>>0)|0;if((ia|0)!=(ca|0)){da=ca;M=76;break e}}J=f[ha+8>>2]|0;H=f[C>>2]|0;L=(f[G>>2]|0)-H|0;O=H;if((L|0)<=0){ea=v;break e}H=L>>>2;L=0;while(1){I=f[O+(L<<2)>>2]|0;if(!(b[I+84>>0]|0)){K=f[I+68>>2]|0;ja=f[K+(v<<2)>>2]|0;ka=f[K+(J<<2)>>2]|0}else{ja=v;ka=J}L=L+1|0;if((ka|0)!=(ja|0))break;if((L|0)>=(H|0)){ea=v;break e}}ha=f[ha>>2]|0;if(!ha){da=ca;M=76;break}}}else{da=ca;M=76}}else{da=0;M=76}while(0);if((M|0)==76){M=0;G=ln(16)|0;f[G+8>>2]=v;f[G+12>>2]=t;f[G+4>>2]=ba;f[G>>2]=0;la=$(((f[o>>2]|0)+1|0)>>>0);ma=$(B>>>0);na=$(n[l>>2]);do if(x|$(na*ma)>>0<3|(B+-1&B|0)!=0)&1;A=~~$(W($(la/na)))>>>0;Ih(d,C>>>0>>0?A:C);C=f[q>>2]|0;A=C+-1|0;if(!(A&C)){oa=C;pa=A&ba;break}if(ba>>>0>>0){oa=C;pa=ba}else{oa=C;pa=(ba>>>0)%(C>>>0)|0}}else{oa=B;pa=da}while(0);C=(f[d>>2]|0)+(pa<<2)|0;A=f[C>>2]|0;if(!A){f[G>>2]=f[p>>2];f[p>>2]=G;f[C>>2]=p;C=f[G>>2]|0;if(C|0){H=f[C+4>>2]|0;C=oa+-1|0;if(C&oa)if(H>>>0>>0)qa=H;else qa=(H>>>0)%(oa>>>0)|0;else qa=H&C;ra=(f[d>>2]|0)+(qa<<2)|0;M=89}}else{f[G>>2]=f[A>>2];ra=A;M=89}if((M|0)==89){M=0;f[ra>>2]=G}f[o>>2]=(f[o>>2]|0)+1;ea=f[h>>2]|0}A=t+1|0;f[(f[e>>2]|0)+(ea<<2)>>2]=t;C=f[k>>2]|0;if((C|0)==(f[r>>2]|0)){Ri(g,h);_=A;break}else{f[C>>2]=f[h>>2];f[k>>2]=C+4;_=A;break}}while(0);v=(f[h>>2]|0)+1|0;f[h>>2]=v;sa=f[j>>2]|0;if(v>>>0>=sa>>>0)break;else t=_}if((_|0)!=(sa|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K|0)|0;U=I;T=un(O|0,J|0,O|0,J|0)|0;J=I;O=un(P|0,U|0,P|0,U|0)|0;U=Vn(O|0,I|0,T|0,J|0)|0;J=I;T=Xn(F|0,M|0,G|0,s|0)|0;M=I;F=Xn(B|0,E|0,H|0,C|0)|0;E=I;B=un(T|0,M|0,T|0,M|0)|0;M=I;T=un(F|0,E|0,F|0,E|0)|0;E=Vn(T|0,I|0,B|0,M|0)|0;M=I;B=a+16|0;T=a+20|0;F=f[T>>2]|0;O=f[a+24>>2]|0;P=(F|0)==(O<<5|0);if(J>>>0>>0|(J|0)==(M|0)&U>>>0>>0){do if(P)if((F+1|0)<0)aq(B);else{E=O<<6;U=F+32&-32;vi(B,F>>>0<1073741823?(E>>>0>>0?U:E):2147483647);da=f[T>>2]|0;break}else da=F;while(0);f[T>>2]=da+1;L=(f[B>>2]|0)+(da>>>5<<2)|0;f[L>>2]=f[L>>2]|1<<(da&31);ea=x;fa=p;ga=K;ha=D}else{do if(P)if((F+1|0)<0)aq(B);else{L=O<<6;N=F+32&-32;vi(B,F>>>0<1073741823?(L>>>0>>0?N:L):2147483647);ia=f[T>>2]|0;break}else ia=F;while(0);f[T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return}while(0);do if(r)ja=m<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return}function ub(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0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if(P)if((F+1|0)<0)aq(B);else{L=O<<6;N=F+32&-32;vi(B,F>>>0<1073741823?(L>>>0>>0?N:L):2147483647);ia=f[T>>2]|0;break}else ia=F;while(0);f[T>>2]=ia+1;F=(f[B>>2]|0)+(ia>>>5<<2)|0;f[F>>2]=f[F>>2]&~(1<<(ia&31));ea=G;fa=H;ga=C;ha=s}f[a+8>>2]=ea;f[a+12>>2]=fa;u=g;return}while(0);do if(q)ja=n<<1;else{if((e|0)>0){ja=(e<<1)+-2|0;break}fa=a+8|0;f[fa>>2]=0;f[fa+4>>2]=0;u=g;return}while(0);f[a+8>>2]=f[d+(ja<<2)>>2];f[a+12>>2]=f[d+(ja+1<<2)>>2];u=g;return}function vb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=Oa,D=0,E=0.0,F=0,G=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){m=b[o>>0]|0;q=g+(r<<3)|0;f[q>>2]=m;f[q+4>>2]=((m|0)<0)<<31>>31;r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=g+(t<<3)|0;f[k>>2]=h[m>>0];f[k+4>>2]=0;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){o=d[l>>1]|0;k=g+(q<<3)|0;f[k>>2]=o;f[k+4>>2]=((o|0)<0)<<31>>31;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=j[r>>1];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<3)|0,0,(e<<24>>24)-r<<3|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){l=f[t>>2]|0;m=g+(o<<3)|0;f[m>>2]=l;f[m+4>>2]=((l|0)<0)<<31>>31;o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<3)|0,0,(e<<24>>24)-t<<3|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){r=g+(m<<3)|0;f[r>>2]=f[q>>2];f[r+4>>2]=0;m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<3)|0,0,(e<<24>>24)-q<<3|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){t=k;r=f[t+4>>2]|0;z=g+(l<<3)|0;f[z>>2]=f[t>>2];f[z+4>>2]=r;l=l+1|0;r=b[q>>0]|0;if((l|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){A=r;break}else k=k+8|0}}else A=m;k=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<3)|0,0,(e<<24>>24)-k<<3|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;r=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;z=Vn(r|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+z|0;z=0;while(1){q=o;r=f[q+4>>2]|0;t=g+(z<<3)|0;f[t>>2]=f[q>>2];f[t+4>>2]=r;z=z+1|0;r=b[k>>0]|0;if((z|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){B=r;break}else o=o+8|0}}else B=l;o=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<3)|0,0,(e<<24>>24)-o<<3|0)|0;i=1;return i|0}case 9:{o=a+24|0;z=b[o>>0]|0;if((z<<24>>24>e<<24>>24?e:z)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;r=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(r|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){C=$(n[m>>2]);k=+K(+C)>=1.0?(+C>0.0?~~+Y(+J(+C/4294967296.0),4294967295.0)>>>0:~~+W((+C-+(~~+C>>>0))/4294967296.0)>>>0):0;r=g+(t<<3)|0;f[r>>2]=~~+C>>>0;f[r+4>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){D=k;break}else m=m+4|0}}else D=z;m=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<3)|0,0,(e<<24>>24)-m<<3|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;r=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+r|0;r=0;while(1){E=+p[l>>3];o=+K(E)>=1.0?(E>0.0?~~+Y(+J(E/4294967296.0),4294967295.0)>>>0:~~+W((E-+(~~E>>>0))/4294967296.0)>>>0):0;k=g+(r<<3)|0;f[k>>2]=~~E>>>0;f[k+4>>2]=o;r=r+1|0;o=b[m>>0]|0;if((r|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){F=o;break}else l=l+8|0}}else F=t;l=F<<24>>24;if(F<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<3)|0,0,(e<<24>>24)-l<<3|0)|0;i=1;return i|0}case 11:{l=a+24|0;r=b[l>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){m=f[f[a>>2]>>2]|0;z=a+40|0;o=un(f[z>>2]|0,f[z+4>>2]|0,f[c>>2]|0,0)|0;z=a+48|0;k=Vn(o|0,I|0,f[z>>2]|0,f[z+4>>2]|0)|0;z=m+k|0;k=0;while(1){m=g+(k<<3)|0;f[m>>2]=h[z>>0];f[m+4>>2]=0;k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){G=m;break}else z=z+1|0}}else G=r;z=G<<24>>24;if(G<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(z<<3)|0,0,(e<<24>>24)-z<<3|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function wb(a,b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[(f[v+12>>2]|0)+(t<<2)>>2]=f[n>>2];f[n>>2]=(f[n>>2]|0)+1}n=f[b>>2]|0;a:do if((n|0)<3){t=a+12|0;v=a+44|0;r=a+48|0;s=a+40|0;o=a+92|0;q=n;while(1){h=q;while(1){w=a+52+(h*12|0)+4|0;x=f[w>>2]|0;if((f[a+52+(h*12|0)>>2]|0)!=(x|0))break;if((h|0)<2)h=h+1|0;else break a}m=x+-4|0;p=f[m>>2]|0;f[w>>2]=m;f[b>>2]=h;f[i>>2]=p;if((p|0)==-1)break;m=(p>>>0)/3|0;g=f[t>>2]|0;do if(!(f[g+(m>>>5<<2)>>2]&1<<(m&31))){j=p;l=g;b:while(1){y=(j>>>0)/3|0;z=l+(y>>>5<<2)|0;f[z>>2]=1<<(y&31)|f[z>>2];z=f[i>>2]|0;if((z|0)==-1)A=-1;else A=f[(f[f[a>>2]>>2]|0)+(z<<2)>>2]|0;y=(f[k>>2]|0)+(A>>>5<<2)|0;B=1<<(A&31);C=f[y>>2]|0;if(!(B&C)){f[y>>2]=C|B;B=f[i>>2]|0;f[e>>2]=B;C=f[(f[(f[v>>2]|0)+96>>2]|0)+(((B>>>0)/3|0)*12|0)+(((B>>>0)%3|0)<<2)>>2]|0;B=f[r>>2]|0;f[d>>2]=C;y=f[B+4>>2]|0;B=y+4|0;D=f[B>>2]|0;if((D|0)==(f[y+8>>2]|0))Ri(y,d);else{f[D>>2]=C;f[B>>2]=D+4}D=f[s>>2]|0;B=D+4|0;C=f[B>>2]|0;if((C|0)==(f[D+8>>2]|0)){Ri(D,e);E=f[s>>2]|0}else{f[C>>2]=f[e>>2];f[B>>2]=C+4;E=D}D=E+24|0;f[(f[E+12>>2]|0)+(A<<2)>>2]=f[D>>2];f[D>>2]=(f[D>>2]|0)+1;F=f[i>>2]|0}else F=z;z=f[a>>2]|0;if((F|0)==-1){G=93;break}D=F+1|0;C=((D>>>0)%3|0|0)==0?F+-2|0:D;if((C|0)==-1)H=-1;else H=f[(f[z+12>>2]|0)+(C<<2)>>2]|0;C=(((F>>>0)%3|0|0)==0?2:-1)+F|0;if((C|0)==-1)I=-1;else I=f[(f[z+12>>2]|0)+(C<<2)>>2]|0;C=(H|0)==-1;D=C?-1:(H>>>0)/3|0;B=(I|0)==-1;y=B?-1:(I>>>0)/3|0;if(C)J=1;else J=(f[(f[t>>2]|0)+(D>>>5<<2)>>2]&1<<(D&31)|0)!=0;do if(B)if(J){G=93;break b}else G=82;else{if(f[(f[t>>2]|0)+(y>>>5<<2)>>2]&1<<(y&31)|0)if(J){G=93;break b}else{G=82;break}D=f[(f[z>>2]|0)+(I<<2)>>2]|0;if(!(1<<(D&31)&f[(f[k>>2]|0)+(D>>>5<<2)>>2])){K=(f[o>>2]|0)+(D<<2)|0;D=f[K>>2]|0;f[K>>2]=D+1;L=(D|0)>0?1:2}else L=0;if(J?(L|0)<=(f[b>>2]|0):0){M=I;break}f[d>>2]=I;D=a+52+(L*12|0)+4|0;K=f[D>>2]|0;if((K|0)==(f[a+52+(L*12|0)+8>>2]|0))Ri(a+52+(L*12|0)|0,d);else{f[K>>2]=I;f[D>>2]=K+4}if((f[b>>2]|0)>(L|0))f[b>>2]=L;if(J){G=93;break b}else G=82}while(0);if((G|0)==82){G=0;if(C)N=-1;else N=f[(f[f[a>>2]>>2]|0)+(H<<2)>>2]|0;if(!(1<<(N&31)&f[(f[k>>2]|0)+(N>>>5<<2)>>2])){z=(f[o>>2]|0)+(N<<2)|0;y=f[z>>2]|0;f[z>>2]=y+1;O=(y|0)>0?1:2}else O=0;if((O|0)>(f[b>>2]|0))break;else M=H}f[i>>2]=M;j=M;l=f[t>>2]|0}if((G|0)==93){G=0;P=f[b>>2]|0;break}f[d>>2]=H;l=a+52+(O*12|0)+4|0;j=f[l>>2]|0;if((j|0)==(f[a+52+(O*12|0)+8>>2]|0))Ri(a+52+(O*12|0)|0,d);else{f[j>>2]=H;f[l>>2]=j+4}j=f[b>>2]|0;if((j|0)>(O|0)){f[b>>2]=O;Q=O}else Q=j;P=Q}else P=h;while(0);if((P|0)<3)q=P;else break a}u=c;return}while(0);f[i>>2]=-1;u=c;return}function xb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}xb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;xb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function yb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}yb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;yb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function zb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}zb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;zb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ab(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ab(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ab(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}} -function Bb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Bb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Bb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Cb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Cb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Cb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Db(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Db(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Db(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Eb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Eb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Eb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Fb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Fb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Fb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Gb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Gb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Gb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Hb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Hb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Hb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ib(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ib(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ib(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Jb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Jb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Jb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Kb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Kb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Kb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Lb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Lb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Lb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Mb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Mb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Mb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Nb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Nb(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Nb(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Ob(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0;d=a;a=b;a:while(1){b=a;e=a+-4|0;g=d;while(1){h=g;b:while(1){i=h;j=b-i|0;k=j>>2;switch(k|0){case 2:{l=5;break a;break}case 3:{l=11;break a;break}case 4:{l=12;break a;break}case 5:{l=13;break a;break}case 1:case 0:{l=84;break a;break}default:{}}if((j|0)<124){l=15;break a}m=h+(((k|0)/2|0)<<2)|0;if((j|0)>3996){j=(k|0)/4|0;n=ig(h,h+(j<<2)|0,m,m+(j<<2)|0,e,c)|0}else n=Vg(h,m,e,c)|0;o=f[h>>2]|0;j=f[m>>2]|0;p=f[c>>2]|0;k=f[p>>2]|0;q=(f[p+4>>2]|0)-k>>3;if(q>>>0<=o>>>0){l=20;break a}r=k;if(q>>>0<=j>>>0){l=22;break a}k=f[r+(o<<3)>>2]|0;s=f[r+(j<<3)>>2]|0;if(k>>>0>>0){t=e;u=n;break}else v=e;while(1){v=v+-4|0;if((h|0)==(v|0))break;w=f[v>>2]|0;if(q>>>0<=w>>>0){l=51;break a}if((f[r+(w<<3)>>2]|0)>>>0>>0){l=53;break b}}s=h+4|0;j=f[e>>2]|0;if(q>>>0<=j>>>0){l=26;break a}if(k>>>0<(f[r+(j<<3)>>2]|0)>>>0)x=s;else{if((s|0)==(e|0)){l=84;break a}else y=s;while(1){z=f[y>>2]|0;if(q>>>0<=z>>>0){l=32;break a}if(k>>>0<(f[r+(z<<3)>>2]|0)>>>0)break;s=y+4|0;if((s|0)==(e|0)){l=84;break a}else y=s}f[y>>2]=j;f[e>>2]=z;x=y+4|0}if((x|0)==(e|0)){l=84;break a}r=f[h>>2]|0;A=f[c>>2]|0;k=f[A>>2]|0;q=(f[A+4>>2]|0)-k>>3;if(q>>>0<=r>>>0){l=38;break a}s=k;k=e;B=x;C=r;while(1){r=s+(C<<3)|0;D=q>>>0>C>>>0;E=B;while(1){F=f[E>>2]|0;if(q>>>0<=F>>>0){l=40;break a}G=f[r>>2]|0;if(G>>>0<(f[s+(F<<3)>>2]|0)>>>0)break;if(D)E=E+4|0;else{l=38;break a}}if(q>>>0>C>>>0)H=k;else{l=46;break a}do{H=H+-4|0;I=f[H>>2]|0;if(q>>>0<=I>>>0){l=47;break a}}while(G>>>0<(f[s+(I<<3)>>2]|0)>>>0);if(E>>>0>=H>>>0){h=E;continue b}D=f[E>>2]|0;f[E>>2]=I;f[H>>2]=D;C=f[h>>2]|0;if(q>>>0<=C>>>0){l=38;break a}else{k=H;B=E+4|0}}}if((l|0)==53){l=0;f[h>>2]=w;f[v>>2]=o;t=v;u=n+1|0}B=h+4|0;c:do if(B>>>0>>0){k=f[B>>2]|0;C=f[c>>2]|0;q=f[C>>2]|0;s=(f[C+4>>2]|0)-q>>3;if(s>>>0>k>>>0){J=t;K=B;L=u;M=m;N=s;O=q;P=C;Q=k}else{R=C;l=57;break a}while(1){C=f[c>>2]|0;k=C+4|0;q=f[M>>2]|0;s=K;j=O;D=N;S=P;r=Q;while(1){F=j;if(D>>>0<=q>>>0){l=59;break a}if((f[F+(r<<3)>>2]|0)>>>0>=(f[F+(q<<3)>>2]|0)>>>0)break;F=s+4|0;T=f[F>>2]|0;j=f[C>>2]|0;D=(f[k>>2]|0)-j>>3;if(D>>>0<=T>>>0){R=C;l=57;break a}else{s=F;S=C;r=T}}C=f[M>>2]|0;O=f[S>>2]|0;N=(f[S+4>>2]|0)-O>>3;D=O;j=D+(C<<3)|0;if(N>>>0>C>>>0)U=J;else{l=65;break a}do{U=U+-4|0;V=f[U>>2]|0;if(N>>>0<=V>>>0){l=66;break a}}while((f[D+(V<<3)>>2]|0)>>>0>=(f[j>>2]|0)>>>0);if(s>>>0>U>>>0){W=M;X=L;Y=s;break c}f[s>>2]=V;f[U>>2]=r;K=s+4|0;Q=f[K>>2]|0;if(N>>>0<=Q>>>0){R=S;l=57;break a}else{J=U;L=L+1|0;M=(M|0)==(s|0)?U:M;P=S}}}else{W=m;X=u;Y=B}while(0);if((Y|0)!=(W|0)){B=f[W>>2]|0;j=f[Y>>2]|0;Z=f[c>>2]|0;D=f[Z>>2]|0;C=(f[Z+4>>2]|0)-D>>3;if(C>>>0<=B>>>0){l=72;break a}k=D;if(C>>>0<=j>>>0){l=74;break a}if((f[k+(B<<3)>>2]|0)>>>0<(f[k+(j<<3)>>2]|0)>>>0){f[Y>>2]=B;f[W>>2]=j;_=X+1|0}else _=X}else _=X;if(!_){$=_d(h,Y,c)|0;j=Y+4|0;if(_d(j,a,c)|0){l=83;break}if($){g=j;continue}}j=Y;if((j-i|0)>=(b-j|0)){l=82;break}Ob(h,Y,c);g=Y+4|0}if((l|0)==82){l=0;Ob(Y+4|0,a,c);d=h;a=Y;continue}else if((l|0)==83){l=0;if($){l=84;break}else{d=h;a=Y;continue}}}switch(l|0){case 5:{l=f[e>>2]|0;Y=f[h>>2]|0;d=f[c>>2]|0;$=f[d>>2]|0;i=(f[d+4>>2]|0)-$>>3;if(i>>>0<=l>>>0)aq(d);_=$;if(i>>>0<=Y>>>0)aq(d);if((f[_+(l<<3)>>2]|0)>>>0>=(f[_+(Y<<3)>>2]|0)>>>0)return;f[h>>2]=l;f[e>>2]=Y;return}case 11:{Vg(h,h+4|0,e,c)|0;return}case 12:{jh(h,h+4|0,h+8|0,e,c)|0;return}case 13:{ig(h,h+4|0,h+8|0,h+12|0,e,c)|0;return}case 15:{ih(h,a,c);return}case 20:{aq(p);break}case 22:{aq(p);break}case 26:{aq(p);break}case 32:{aq(p);break}case 38:{aq(A);break}case 40:{aq(A);break}case 46:{aq(A);break}case 47:{aq(A);break}case 51:{aq(p);break}case 57:{aq(R);break}case 59:{aq(S);break}case 65:{if(N>>>0>(f[J+-4>>2]|0)>>>0)aq(S);else aq(S);break}case 66:{aq(S);break}case 72:{aq(Z);break}case 74:{aq(Z);break}case 84:return}}function Pb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2])>>>0;f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3]>>>0;q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Qb(a,c,e,g){a=a|0;c=c|0;e=e|0;g=g|0;var i=0,k=0,l=0,m=0,o=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0;if(!g){i=0;return i|0}do switch(f[a+28>>2]|0){case 1:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){m=f[f[a>>2]>>2]|0;o=a+40|0;q=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(q|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=m+r|0;r=0;while(1){f[g+(r<<2)>>2]=b[o>>0];r=r+1|0;m=b[k>>0]|0;if((r|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){s=m;break}else o=o+1|0}}else s=l;o=s<<24>>24;if(s<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 2:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){f[g+(t<<2)>>2]=h[m>>0];t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){u=k;break}else m=m+1|0}}else u=r;m=u<<24>>24;if(u<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 3:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=d[l>>1];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){v=o;break}else l=l+2|0}}else v=t;l=v<<24>>24;if(v<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 4:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=j[r>>1];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){w=m;break}else r=r+2|0}}else w=q;r=w<<24>>24;if(w<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}case 5:{r=a+24|0;k=b[r>>0]|0;if((k<<24>>24>e<<24>>24?e:k)<<24>>24>0){l=f[f[a>>2]>>2]|0;t=a+40|0;m=un(f[t>>2]|0,f[t+4>>2]|0,f[c>>2]|0,0)|0;t=a+48|0;o=Vn(m|0,I|0,f[t>>2]|0,f[t+4>>2]|0)|0;t=l+o|0;o=0;while(1){f[g+(o<<2)>>2]=f[t>>2];o=o+1|0;l=b[r>>0]|0;if((o|0)>=((l<<24>>24>e<<24>>24?e:l)<<24>>24|0)){x=l;break}else t=t+4|0}}else x=k;t=x<<24>>24;if(x<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(t<<2)|0,0,(e<<24>>24)-t<<2|0)|0;i=1;return i|0}case 6:{t=a+24|0;o=b[t>>0]|0;if((o<<24>>24>e<<24>>24?e:o)<<24>>24>0){r=f[f[a>>2]>>2]|0;q=a+40|0;l=un(f[q>>2]|0,f[q+4>>2]|0,f[c>>2]|0,0)|0;q=a+48|0;m=Vn(l|0,I|0,f[q>>2]|0,f[q+4>>2]|0)|0;q=r+m|0;m=0;while(1){f[g+(m<<2)>>2]=f[q>>2];m=m+1|0;r=b[t>>0]|0;if((m|0)>=((r<<24>>24>e<<24>>24?e:r)<<24>>24|0)){y=r;break}else q=q+4|0}}else y=o;q=y<<24>>24;if(y<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(q<<2)|0,0,(e<<24>>24)-q<<2|0)|0;i=1;return i|0}case 7:{q=a+24|0;m=b[q>>0]|0;if((m<<24>>24>e<<24>>24?e:m)<<24>>24>0){t=f[f[a>>2]>>2]|0;k=a+40|0;r=un(f[k>>2]|0,f[k+4>>2]|0,f[c>>2]|0,0)|0;k=a+48|0;l=Vn(r|0,I|0,f[k>>2]|0,f[k+4>>2]|0)|0;k=t+l|0;l=0;while(1){f[g+(l<<2)>>2]=f[k>>2];l=l+1|0;t=b[q>>0]|0;if((l|0)>=((t<<24>>24>e<<24>>24?e:t)<<24>>24|0)){z=t;break}else k=k+8|0}}else z=m;k=z<<24>>24;if(z<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(k<<2)|0,0,(e<<24>>24)-k<<2|0)|0;i=1;return i|0}case 8:{k=a+24|0;l=b[k>>0]|0;if((l<<24>>24>e<<24>>24?e:l)<<24>>24>0){q=f[f[a>>2]>>2]|0;o=a+40|0;t=un(f[o>>2]|0,f[o+4>>2]|0,f[c>>2]|0,0)|0;o=a+48|0;r=Vn(t|0,I|0,f[o>>2]|0,f[o+4>>2]|0)|0;o=q+r|0;r=0;while(1){f[g+(r<<2)>>2]=f[o>>2];r=r+1|0;q=b[k>>0]|0;if((r|0)>=((q<<24>>24>e<<24>>24?e:q)<<24>>24|0)){A=q;break}else o=o+8|0}}else A=l;o=A<<24>>24;if(A<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(o<<2)|0,0,(e<<24>>24)-o<<2|0)|0;i=1;return i|0}case 9:{o=a+24|0;r=b[o>>0]|0;if((r<<24>>24>e<<24>>24?e:r)<<24>>24>0){k=f[f[a>>2]>>2]|0;m=a+40|0;q=un(f[m>>2]|0,f[m+4>>2]|0,f[c>>2]|0,0)|0;m=a+48|0;t=Vn(q|0,I|0,f[m>>2]|0,f[m+4>>2]|0)|0;m=k+t|0;t=0;while(1){k=~~$(n[m>>2]);f[g+(t<<2)>>2]=k;t=t+1|0;k=b[o>>0]|0;if((t|0)>=((k<<24>>24>e<<24>>24?e:k)<<24>>24|0)){B=k;break}else m=m+4|0}}else B=r;m=B<<24>>24;if(B<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(m<<2)|0,0,(e<<24>>24)-m<<2|0)|0;i=1;return i|0}case 10:{m=a+24|0;t=b[m>>0]|0;if((t<<24>>24>e<<24>>24?e:t)<<24>>24>0){o=f[f[a>>2]>>2]|0;l=a+40|0;k=un(f[l>>2]|0,f[l+4>>2]|0,f[c>>2]|0,0)|0;l=a+48|0;q=Vn(k|0,I|0,f[l>>2]|0,f[l+4>>2]|0)|0;l=o+q|0;q=0;while(1){f[g+(q<<2)>>2]=~~+p[l>>3];q=q+1|0;o=b[m>>0]|0;if((q|0)>=((o<<24>>24>e<<24>>24?e:o)<<24>>24|0)){C=o;break}else l=l+8|0}}else C=t;l=C<<24>>24;if(C<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(l<<2)|0,0,(e<<24>>24)-l<<2|0)|0;i=1;return i|0}case 11:{l=a+24|0;q=b[l>>0]|0;if((q<<24>>24>e<<24>>24?e:q)<<24>>24>0){m=f[f[a>>2]>>2]|0;r=a+40|0;o=un(f[r>>2]|0,f[r+4>>2]|0,f[c>>2]|0,0)|0;r=a+48|0;k=Vn(o|0,I|0,f[r>>2]|0,f[r+4>>2]|0)|0;r=m+k|0;k=0;while(1){f[g+(k<<2)>>2]=h[r>>0];k=k+1|0;m=b[l>>0]|0;if((k|0)>=((m<<24>>24>e<<24>>24?e:m)<<24>>24|0)){D=m;break}else r=r+1|0}}else D=q;r=D<<24>>24;if(D<<24>>24>=e<<24>>24){i=1;return i|0}sj(g+(r<<2)|0,0,(e<<24>>24)-r<<2|0)|0;i=1;return i|0}default:{i=0;return i|0}}while(0);return 0}function Rb(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=Oa,J=0,K=0,L=0,M=0,N=Oa;e=u;u=u+48|0;g=e+36|0;h=e+24|0;i=e+12|0;j=e;if(!(xh(a,c,d)|0)){k=0;u=e;return k|0}l=f[(f[(f[c+4>>2]|0)+8>>2]|0)+(d<<2)>>2]|0;if((f[l+28>>2]|0)!=9){k=0;u=e;return k|0}m=c+48|0;c=f[m>>2]|0;o=ln(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=17;p=o;q=14495;r=p+17|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+17>>0]=0;o=c+16|0;s=f[o>>2]|0;if(s){t=o;v=s;a:while(1){s=v;while(1){if((f[s+16>>2]|0)>=(d|0))break;w=f[s+4>>2]|0;if(!w){x=t;break a}else s=w}v=f[s>>2]|0;if(!v){x=s;break}else t=s}if(((x|0)!=(o|0)?(f[x+16>>2]|0)<=(d|0):0)?(o=x+20|0,(Jh(o,g)|0)!=0):0)y=Hk(o,g,-1)|0;else z=12}else z=12;if((z|0)==12)y=Hk(c,g,-1)|0;if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if((y|0)<1){k=0;u=e;return k|0}c=f[m>>2]|0;o=ln(32)|0;f[g>>2]=o;f[g+8>>2]=-2147483616;f[g+4>>2]=19;p=o;q=14438;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[o+19>>0]=0;o=c+16|0;x=f[o>>2]|0;if(x){t=o;v=x;b:while(1){x=v;while(1){if((f[x+16>>2]|0)>=(d|0))break;w=f[x+4>>2]|0;if(!w){A=t;break b}else x=w}v=f[x>>2]|0;if(!v){A=x;break}else t=x}if((A|0)!=(o|0)?(f[A+16>>2]|0)<=(d|0):0)B=A+20|0;else z=24}else z=24;if((z|0)==24)B=c;if(!(Jh(B,g)|0))C=0;else{B=f[m>>2]|0;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;c=ln(32)|0;f[h>>2]=c;f[h+8>>2]=-2147483616;f[h+4>>2]=18;p=c;q=14458;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[c+18>>0]=0;c=B+16|0;A=f[c>>2]|0;if(A){o=c;t=A;c:while(1){A=t;while(1){if((f[A+16>>2]|0)>=(d|0))break;v=f[A+4>>2]|0;if(!v){D=o;break c}else A=v}t=f[A>>2]|0;if(!t){D=A;break}else o=A}if((D|0)!=(c|0)?(f[D+16>>2]|0)<=(d|0):0)E=D+20|0;else z=34}else z=34;if((z|0)==34)E=B;B=(Jh(E,h)|0)!=0;if((b[h+11>>0]|0)<0)Oq(f[h>>2]|0);C=B}if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);if(!C){Wd(a+40|0,l,y)|0;k=1;u=e;return k|0}C=l+24|0;l=b[C>>0]|0;B=l<<24>>24;f[i>>2]=0;E=i+4|0;f[E>>2]=0;f[i+8>>2]=0;do if(l<<24>>24)if(l<<24>>24<0)aq(i);else{D=B<<2;c=ln(D)|0;f[i>>2]=c;o=c+(B<<2)|0;f[i+8>>2]=o;sj(c|0,0,D|0)|0;f[E>>2]=o;F=c;break}else F=0;while(0);B=f[m>>2]|0;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;l=ln(32)|0;f[j>>2]=l;f[j+8>>2]=-2147483616;f[j+4>>2]=19;p=l;q=14438;r=p+19|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[l+19>>0]=0;l=b[C>>0]|0;c=l<<24>>24;o=B+16|0;D=f[o>>2]|0;if(D){t=o;x=D;d:while(1){D=x;while(1){if((f[D+16>>2]|0)>=(d|0))break;v=f[D+4>>2]|0;if(!v){G=t;break d}else D=v}x=f[D>>2]|0;if(!x){G=D;break}else t=D}if(((G|0)!=(o|0)?(f[G+16>>2]|0)<=(d|0):0)?(o=G+20|0,(Jh(o,j)|0)!=0):0){t=Rg(o,j)|0;if((t|0)!=(G+24|0)){pj(g,t+28|0);t=g+11|0;G=b[t>>0]|0;o=G<<24>>24<0;if(!((o?f[g+4>>2]|0:G&255)|0))H=G;else{if(l<<24>>24>0){x=o?f[g>>2]|0:g;o=0;do{I=$(bq(x,h));A=x;x=f[h>>2]|0;if((A|0)==(x|0))break;n[F+(o<<2)>>2]=I;o=o+1|0}while((o|0)<(c|0));J=b[t>>0]|0}else J=G;H=J}if(H<<24>>24<0)Oq(f[g>>2]|0)}}else z=64}else z=64;if((z|0)==64?(H=Rg(B,j)|0,(H|0)!=(B+4|0)):0){pj(g,H+28|0);H=g+11|0;B=b[H>>0]|0;J=B<<24>>24<0;if(!((J?f[g+4>>2]|0:B&255)|0))K=B;else{if(l<<24>>24>0){l=J?f[g>>2]|0:g;J=0;do{I=$(bq(l,h));G=l;l=f[h>>2]|0;if((G|0)==(l|0))break;n[F+(J<<2)>>2]=I;J=J+1|0}while((J|0)<(c|0));L=b[H>>0]|0}else L=B;K=L}if(K<<24>>24<0)Oq(f[g>>2]|0)}if((b[j+11>>0]|0)<0)Oq(f[j>>2]|0);j=f[m>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;m=ln(32)|0;f[g>>2]=m;f[g+8>>2]=-2147483616;f[g+4>>2]=18;p=m;q=14458;r=p+18|0;do{b[p>>0]=b[q>>0]|0;p=p+1|0;q=q+1|0}while((p|0)<(r|0));b[m+18>>0]=0;m=j+16|0;q=f[m>>2]|0;if(q){p=m;r=q;e:while(1){q=r;while(1){if((f[q+16>>2]|0)>=(d|0))break;K=f[q+4>>2]|0;if(!K){M=p;break e}else q=K}r=f[q>>2]|0;if(!r){M=q;break}else p=q}if(((M|0)!=(m|0)?(f[M+16>>2]|0)<=(d|0):0)?(d=M+20|0,(Jh(d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aa=Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);f[i>>2]=$;f[v>>2]=aa;P=0-S|0;M=0-_|0;f[h>>2]=0-O;f[q>>2]=P;f[s>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(p=(N|0)==(ca|0),!(M&p)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(p&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){fj(g,0);ua=k}else{fj(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U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Y;break}if(P){$=(T|0)<(Z|0)?(T<<1)-Z|0:Z;aa=0}else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);f[i>>2]=$;f[v>>2]=aa;P=0-S|0;M=0-_|0;f[h>>2]=0-O;f[q>>2]=P;f[s>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(p=(N|0)==(ca|0),!(M&p)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(p&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);f[j>>2]=da;f[x>>2]=ea;N=K<<1;M=b+(N<<2)|0;H=f[y>>2]|0;if((H|0)>0){O=0;P=i;p=H;while(1){if((p|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;U=f[z>>2]|0;if((V|0)>(U|0)){fa=f[A>>2]|0;f[fa+(H<<2)>>2]=U;ga=fa}else{fa=f[B>>2]|0;U=f[A>>2]|0;f[U+(H<<2)>>2]=(V|0)<(fa|0)?fa:V;ga=U}H=H+1|0;U=f[y>>2]|0}while((H|0)<(U|0));ha=ga;ia=U}else{ha=f[A>>2]|0;ia=p}H=(f[M+(O<<2)>>2]|0)-(f[ha+(O<<2)>>2]|0)|0;U=k+(O<<2)|0;f[U>>2]=H;ja=f[C>>2]|0;if((H|0)>=(ja|0)){if((H|0)>(f[E>>2]|0)){ka=H-(f[D>>2]|0)|0;la=52}}else{ka=(f[D>>2]|0)+H|0;la=52}if((la|0)==52){la=0;f[U>>2]=ka}O=O+1|0;if((O|0)>=(ia|0))break;else{P=ha;p=ia}}if((ia|0)>0){p=0;P=j;O=ia;U=ja;while(1){if((O|0)>0){H=0;do{V=f[P+(H<<2)>>2]|0;fa=f[z>>2]|0;if((V|0)>(fa|0))f[ha+(H<<2)>>2]=fa;else{fa=f[B>>2]|0;f[ha+(H<<2)>>2]=(V|0)<(fa|0)?fa:V}H=H+1|0;ma=f[y>>2]|0}while((H|0)<(ma|0));na=f[C>>2]|0;oa=ma}else{na=U;oa=O}H=(f[M+(p<<2)>>2]|0)-(f[ha+(p<<2)>>2]|0)|0;V=l+(p<<2)|0;f[V>>2]=H;if((H|0)>=(na|0)){if((H|0)>(f[E>>2]|0)){pa=H-(f[D>>2]|0)|0;la=65}}else{pa=(f[D>>2]|0)+H|0;la=65}if((la|0)==65){la=0;f[V>>2]=pa}p=p+1|0;if((p|0)>=(oa|0))break;else{P=ha;O=oa;U=na}}}}U=f[k>>2]|0;O=f[t>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))qa=(f[F>>2]|0)+U|0;else qa=U;else qa=U-(f[F>>2]|0)|0;f[k>>2]=qa;U=f[a>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ra=(f[F>>2]|0)+U|0;else ra=U;else ra=U-(f[F>>2]|0)|0;f[a>>2]=ra;U=f[l>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))sa=(f[F>>2]|0)+U|0;else sa=U;else sa=U-(f[F>>2]|0)|0;f[l>>2]=sa;U=f[G>>2]|0;if((O|0)>=(U|0))if((U|0)<(0-O|0))ta=(f[F>>2]|0)+U|0;else ta=U;else ta=U-(f[F>>2]|0)|0;f[G>>2]=ta;if((((ra|0)>-1?ra:0-ra|0)+((qa|0)>-1?qa:0-qa|0)|0)<(((sa|0)>-1?sa:0-sa|0)+((ta|0)>-1?ta:0-ta|0)|0)){fj(g,0);ua=k}else{fj(g,1);ua=l}U=f[ua>>2]|0;if((U|0)<0)va=(f[F>>2]|0)+U|0;else va=U;U=c+(N<<2)|0;f[U>>2]=va;O=f[ua+4>>2]|0;if((O|0)<0)wa=(f[F>>2]|0)+O|0;else wa=O;f[U+4>>2]=wa;K=K+1|0;if((K|0)>=(r|0)){la=3;break}U=f[o>>2]|0;L=f[U>>2]|0;if((f[U+4>>2]|0)-L>>2>>>0<=K>>>0){J=U;la=4;break}}if((la|0)==3){u=e;return 1}else if((la|0)==4)aq(J);return 0}function Ub(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=Oa,V=Oa,Y=Oa,Z=0,_=0,aa=0,ba=0;d=u;u=u+16|0;e=d;g=a+16|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[g>>2]=$(1.0);i=a+20|0;f[i>>2]=0;f[i+4>>2]=0;f[i+8>>2]=0;f[i+12>>2]=0;n[a+36>>2]=$(1.0);j=f[c+8>>2]|0;a:do if(j|0){k=a+4|0;l=a+12|0;m=a+8|0;o=j;p=j;while(1){q=o+8|0;r=b[q+11>>0]|0;s=r<<24>>24<0;t=s?f[q>>2]|0:q;v=s?f[o+12>>2]|0:r&255;if(v>>>0>3){r=t;s=v;w=v;while(1){x=X(h[r>>0]|h[r+1>>0]<<8|h[r+2>>0]<<16|h[r+3>>0]<<24,1540483477)|0;s=(X(x>>>24^x,1540483477)|0)^(X(s,1540483477)|0);w=w+-4|0;if(w>>>0<=3)break;else r=r+4|0}r=v+-4|0;w=r&-4;y=r-w|0;z=t+(w+4)|0;A=s}else{y=v;z=t;A=v}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=8;break}case 2:{B=A;C=8;break}case 1:{D=A;C=9;break}default:E=A}if((C|0)==8){C=0;D=h[z+1>>0]<<8^B;C=9}if((C|0)==9){C=0;E=X(D^h[z>>0],1540483477)|0}w=X(E>>>13^E,1540483477)|0;r=w>>>15^w;w=f[k>>2]|0;x=(w|0)==0;b:do if(!x){F=w+-1|0;G=(F&w|0)==0;if(!G)if(r>>>0>>0)H=r;else H=(r>>>0)%(w>>>0)|0;else H=r&F;I=f[(f[a>>2]|0)+(H<<2)>>2]|0;if((I|0)!=0?(J=f[I>>2]|0,(J|0)!=0):0){I=(v|0)==0;if(G){if(I){G=J;while(1){K=f[G+4>>2]|0;if(!((K|0)==(r|0)|(K&F|0)==(H|0))){L=H;C=50;break b}K=b[G+8+11>>0]|0;if(!((K<<24>>24<0?f[G+12>>2]|0:K&255)|0))break b;G=f[G>>2]|0;if(!G){L=H;C=50;break b}}}else M=J;while(1){G=f[M+4>>2]|0;if(!((G|0)==(r|0)|(G&F|0)==(H|0))){L=H;C=50;break b}G=M+8|0;K=b[G+11>>0]|0;N=K<<24>>24<0;O=K&255;do if(((N?f[M+12>>2]|0:O)|0)==(v|0)){K=f[G>>2]|0;if(N)if(!(Vk(K,t,v)|0))break b;else break;if((b[t>>0]|0)==(K&255)<<24>>24){K=G;P=O;Q=t;do{P=P+-1|0;K=K+1|0;if(!P)break b;Q=Q+1|0}while((b[K>>0]|0)==(b[Q>>0]|0))}}while(0);M=f[M>>2]|0;if(!M){L=H;C=50;break b}}}if(I){F=J;while(1){O=f[F+4>>2]|0;if((O|0)!=(r|0)){if(O>>>0>>0)R=O;else R=(O>>>0)%(w>>>0)|0;if((R|0)!=(H|0)){L=H;C=50;break b}}O=b[F+8+11>>0]|0;if(!((O<<24>>24<0?f[F+12>>2]|0:O&255)|0))break b;F=f[F>>2]|0;if(!F){L=H;C=50;break b}}}else S=J;while(1){F=f[S+4>>2]|0;if((F|0)!=(r|0)){if(F>>>0>>0)T=F;else T=(F>>>0)%(w>>>0)|0;if((T|0)!=(H|0)){L=H;C=50;break b}}F=S+8|0;I=b[F+11>>0]|0;O=I<<24>>24<0;G=I&255;do if(((O?f[S+12>>2]|0:G)|0)==(v|0)){I=f[F>>2]|0;if(O)if(!(Vk(I,t,v)|0))break b;else break;if((b[t>>0]|0)==(I&255)<<24>>24){I=F;N=G;Q=t;do{N=N+-1|0;I=I+1|0;if(!N)break b;Q=Q+1|0}while((b[I>>0]|0)==(b[Q>>0]|0))}}while(0);S=f[S>>2]|0;if(!S){L=H;C=50;break}}}else{L=H;C=50}}else{L=0;C=50}while(0);if((C|0)==50){C=0;Di(e,a,r,q);U=$(((f[l>>2]|0)+1|0)>>>0);V=$(w>>>0);Y=$(n[g>>2]);do if(x|$(Y*V)>>0<3|(w+-1&w|0)!=0)&1;v=~~$(W($(U/Y)))>>>0;ei(a,t>>>0>>0?v:t);t=f[k>>2]|0;v=t+-1|0;if(!(v&t)){Z=t;_=v&r;break}if(r>>>0>>0){Z=t;_=r}else{Z=t;_=(r>>>0)%(t>>>0)|0}}else{Z=w;_=L}while(0);w=f[(f[a>>2]|0)+(_<<2)>>2]|0;if(!w){f[f[e>>2]>>2]=f[m>>2];f[m>>2]=f[e>>2];f[(f[a>>2]|0)+(_<<2)>>2]=m;r=f[e>>2]|0;x=f[r>>2]|0;if(x|0){q=f[x+4>>2]|0;x=Z+-1|0;if(x&Z)if(q>>>0>>0)aa=q;else aa=(q>>>0)%(Z>>>0)|0;else aa=q&x;f[(f[a>>2]|0)+(aa<<2)>>2]=r}}else{f[f[e>>2]>>2]=f[w>>2];f[w>>2]=f[e>>2]}f[l>>2]=(f[l>>2]|0)+1}w=f[p>>2]|0;if(!w)break a;else{o=w;p=w}}}while(0);e=f[c+28>>2]|0;if(!e){u=d;return}else ba=e;do{e=ba;c=ln(40)|0;Ub(c,f[e+20>>2]|0);aa=Ec(i,e+8|0)|0;e=f[aa>>2]|0;f[aa>>2]=c;if(e|0){c=f[e+28>>2]|0;if(c|0){aa=c;do{c=aa;aa=f[aa>>2]|0;ri(c+8|0);Oq(c)}while((aa|0)!=0)}aa=e+20|0;c=f[aa>>2]|0;f[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]|0)+r|0;r=h[G>>0]|h[G+1>>0]<<8|h[G+2>>0]<<16|h[G+3>>0]<<24;f[j>>2]=r;G=r&65535;F=r>>>16;H=F&65535;J=(r&65535^318)+239^F;F=(D|0)==0;a:do if(!F){K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=J&K;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(d[R>>1]|0)==G<<16>>16):0)?(d[R+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((d[Q>>1]|0)==G<<16>>16?(d[Q+2>>1]|0)==H<<16>>16:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(J>>>0>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((d[N>>1]|0)==G<<16>>16?(d[N+2>>1]|0)==H<<16>>16:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((d[L>>1]|0)==G<<16>>16?(d[L+2>>1]|0)==H<<16>>16:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=ln(16)|0;G=H+8|0;d[G>>1]=r;d[G+2>>1]=r>>>16;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;Uh(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(J>>>0>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=un(J|0,f[F+4>>2]|0,A|0,0)|0;kh((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)|0;f[_>>2]=f[Y+(f[_>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=V}}else{b[Z>>0]=0;Z=a+68|0;V=a+72|0;D=f[V>>2]|0;E=f[Z>>2]|0;Y=D-E>>2;o=E;E=D;if(la>>>0<=Y>>>0)if(la>>>0>>0?(D=o+(la<<2)|0,(D|0)!=(E|0)):0){f[V>>2]=E+(~((E+-4-D|0)>>>2)<<2);oa=la}else oa=la;else{Ch(Z,la-Y|0,1220);oa=f[m>>2]|0}Y=f[k>>2]|0;if(!oa)na=Y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[Y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=Y}}f[m>>2]=X;ma=na}if(!ma)pa=X;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);Oq(ma);pa=X}}else pa=0;X=f[i+8>>2]|0;if(X|0){ma=X;do{X=ma;ma=f[ma>>2]|0;Oq(X)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}Oq(ma);u=g;return pa|0}function Wb(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,X=0,Y=0,Z=0,_=0,aa=0,ba=0,ca=Oa,da=Oa,ea=Oa,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0;e=u;u=u+48|0;g=e+20|0;i=e;j=e+8|0;k=g+16|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;f[g+12>>2]=0;n[k>>2]=$(1.0);l=a+80|0;m=f[l>>2]|0;f[j>>2]=0;o=j+4|0;f[o>>2]=0;f[j+8>>2]=0;if(m){if(m>>>0>1073741823)aq(j);p=m<<2;q=ln(p)|0;f[j>>2]=q;r=q+(m<<2)|0;f[j+8>>2]=r;sj(q|0,0,p|0)|0;f[o>>2]=r;r=c+48|0;p=c+40|0;m=g+4|0;s=g+12|0;t=g+8|0;v=a+40|0;w=a+64|0;x=f[d>>2]|0;d=q;y=0;z=0;A=q;B=q;C=q;q=0;while(1){D=r;E=f[D>>2]|0;F=f[D+4>>2]|0;D=p;G=un(f[D>>2]|0,f[D+4>>2]|0,x+y|0,0)|0;D=Vn(G|0,I|0,E|0,F|0)|0;F=(f[f[c>>2]>>2]|0)+D|0;D=F;E=h[D>>0]|h[D+1>>0]<<8|h[D+2>>0]<<16|h[D+3>>0]<<24;D=F+4|0;F=h[D>>0]|h[D+1>>0]<<8|h[D+2>>0]<<16|h[D+3>>0]<<24;D=i;f[D>>2]=E;f[D+4>>2]=F;D=(E^318)+239^F;G=(q|0)==0;a:do if(!G){H=q+-1|0;J=(H&q|0)==0;if(!J)if(D>>>0>>0)K=D;else K=(D>>>0)%(q>>>0)|0;else K=D&H;L=f[(f[g>>2]|0)+(K<<2)>>2]|0;do if(L|0?(M=f[L>>2]|0,M|0):0){b:do if(J){N=M;while(1){O=f[N+4>>2]|0;P=(O|0)==(D|0);if(!(P|(O&H|0)==(K|0))){Q=27;break b}if((P?(f[N+8>>2]|0)==(E|0):0)?(f[N+12>>2]|0)==(F|0):0){R=N;Q=26;break b}N=f[N>>2]|0;if(!N){Q=27;break}}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(D|0)){if((f[N+8>>2]|0)==(E|0)?(f[N+12>>2]|0)==(F|0):0){R=N;Q=26;break b}}else{if(P>>>0>>0)S=P;else S=(P>>>0)%(q>>>0)|0;if((S|0)!=(K|0)){Q=27;break b}}N=f[N>>2]|0;if(!N){Q=27;break}}}while(0);if((Q|0)==26){Q=0;f[A+(y<<2)>>2]=f[R+16>>2];T=d;U=z;V=C;X=B;Y=A;break a}else if((Q|0)==27){Q=0;if(G){Z=0;Q=46;break a}else break}}while(0);H=q+-1|0;J=(H&q|0)==0;if(!J)if(D>>>0>>0)_=D;else _=(D>>>0)%(q>>>0)|0;else _=H&D;L=f[(f[g>>2]|0)+(_<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(D|0)|(L&H|0)==(_|0))){Z=_;Q=46;break a}if((f[J+8>>2]|0)==(E|0)?(f[J+12>>2]|0)==(F|0):0){Q=61;break a}J=f[J>>2]|0;if(!J){Z=_;Q=46;break a}}}else aa=M;while(1){J=f[aa+4>>2]|0;if((J|0)!=(D|0)){if(J>>>0>>0)ba=J;else ba=(J>>>0)%(q>>>0)|0;if((ba|0)!=(_|0)){Z=_;Q=46;break a}}if((f[aa+8>>2]|0)==(E|0)?(f[aa+12>>2]|0)==(F|0):0){Q=61;break a}aa=f[aa>>2]|0;if(!aa){Z=_;Q=46;break}}}else{Z=_;Q=46}}else{Z=0;Q=46}while(0);if((Q|0)==46){Q=0;M=ln(20)|0;J=M+8|0;f[J>>2]=E;f[J+4>>2]=F;f[M+16>>2]=z;f[M+4>>2]=D;f[M>>2]=0;ca=$(((f[s>>2]|0)+1|0)>>>0);da=$(q>>>0);ea=$(n[k>>2]);do if(G|$(ea*da)>>0<3|(q+-1&q|0)!=0)&1;H=~~$(W($(ca/ea)))>>>0;Yh(g,J>>>0>>0?H:J);J=f[m>>2]|0;H=J+-1|0;if(!(H&J)){fa=J;ga=H&D;break}if(D>>>0>>0){fa=J;ga=D}else{fa=J;ga=(D>>>0)%(J>>>0)|0}}else{fa=q;ga=Z}while(0);D=(f[g>>2]|0)+(ga<<2)|0;G=f[D>>2]|0;if(!G){f[M>>2]=f[t>>2];f[t>>2]=M;f[D>>2]=t;D=f[M>>2]|0;if(D|0){F=f[D+4>>2]|0;D=fa+-1|0;if(D&fa)if(F>>>0>>0)ha=F;else ha=(F>>>0)%(fa>>>0)|0;else ha=F&D;ia=(f[g>>2]|0)+(ha<<2)|0;Q=59}}else{f[M>>2]=f[G>>2];ia=G;Q=59}if((Q|0)==59){Q=0;f[ia>>2]=M}f[s>>2]=(f[s>>2]|0)+1;Q=61}if((Q|0)==61){Q=0;G=v;D=f[G>>2]|0;F=un(D|0,f[G+4>>2]|0,z|0,0)|0;kh((f[f[w>>2]>>2]|0)+F|0,i|0,D|0)|0;D=f[j>>2]|0;f[D+(y<<2)>>2]=z;T=D;U=z+1|0;V=D;X=D;Y=D}D=y+1|0;ja=f[l>>2]|0;if(D>>>0>=ja>>>0)break;d=T;y=D;z=U;A=Y;B=X;C=V;q=f[m>>2]|0}if((U|0)==(ja|0))ka=X;else{X=a+84|0;if(!(b[X>>0]|0)){m=f[a+72>>2]|0;q=f[a+68>>2]|0;C=q;if((m|0)==(q|0))la=T;else{B=m-q>>2;q=0;do{m=C+(q<<2)|0;f[m>>2]=f[V+(f[m>>2]<<2)>>2];q=q+1|0}while(q>>>0>>0);la=T}}else{b[X>>0]=0;X=a+68|0;T=a+72|0;B=f[T>>2]|0;q=f[X>>2]|0;V=B-q>>2;C=q;q=B;if(ja>>>0<=V>>>0)if(ja>>>0>>0?(B=C+(ja<<2)|0,(B|0)!=(q|0)):0){f[T>>2]=q+(~((q+-4-B|0)>>>2)<<2);ma=ja}else ma=ja;else{Ch(X,ja-V|0,1220);ma=f[l>>2]|0}V=f[j>>2]|0;if(!ma)la=V;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[V+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);la=V}}f[l>>2]=U;ka=la}if(!ka)na=U;else{la=f[o>>2]|0;if((la|0)!=(ka|0))f[o>>2]=la+(~((la+-4-ka|0)>>>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==0;if(!L)if(D>>>0>J>>>0)M=J;else M=(J>>>0)%(D>>>0)|0;else M=K&J;N=f[(f[i>>2]|0)+(M<<2)>>2]|0;do if(N|0?(O=f[N>>2]|0,O|0):0){b:do if(L){P=O;while(1){Q=f[P+4>>2]|0;R=(Q|0)==(J|0);if(!(R|(Q&K|0)==(M|0))){S=27;break b}if((R?(R=P+8|0,(b[R>>0]|0)==G<<24>>24):0)?(b[R+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}P=f[P>>2]|0;if(!P){S=27;break}}}else{P=O;while(1){R=f[P+4>>2]|0;if((R|0)==(J|0)){Q=P+8|0;if((b[Q>>0]|0)==G<<24>>24?(b[Q+1>>0]|0)==H<<24>>24:0){T=P;S=26;break b}}else{if(R>>>0>>0)U=R;else U=(R>>>0)%(D>>>0)|0;if((U|0)!=(M|0)){S=27;break b}}P=f[P>>2]|0;if(!P){S=27;break}}}while(0);if((S|0)==26){S=0;f[E+(z<<2)>>2]=f[T+12>>2];V=e;X=A;Y=C;Z=B;_=E;break a}else if((S|0)==27){S=0;if(F){aa=0;S=46;break a}else break}}while(0);K=D+-1|0;L=(K&D|0)==0;if(!L)if(D>>>0>J>>>0)ba=J;else ba=(J>>>0)%(D>>>0)|0;else ba=K&J;N=f[(f[i>>2]|0)+(ba<<2)>>2]|0;if((N|0)!=0?(O=f[N>>2]|0,(O|0)!=0):0){if(L){L=O;while(1){N=f[L+4>>2]|0;if(!((N|0)==(J|0)|(N&K|0)==(ba|0))){aa=ba;S=46;break a}N=L+8|0;if((b[N>>0]|0)==G<<24>>24?(b[N+1>>0]|0)==H<<24>>24:0){S=61;break a}L=f[L>>2]|0;if(!L){aa=ba;S=46;break a}}}else ca=O;while(1){L=f[ca+4>>2]|0;if((L|0)!=(J|0)){if(L>>>0>>0)da=L;else da=(L>>>0)%(D>>>0)|0;if((da|0)!=(ba|0)){aa=ba;S=46;break a}}L=ca+8|0;if((b[L>>0]|0)==G<<24>>24?(b[L+1>>0]|0)==H<<24>>24:0){S=61;break a}ca=f[ca>>2]|0;if(!ca){aa=ba;S=46;break}}}else{aa=ba;S=46}}else{aa=0;S=46}while(0);if((S|0)==46){S=0;H=ln(16)|0;G=H+8|0;b[G>>0]=r;b[G+1>>0]=r>>8;f[H+12>>2]=A;f[H+4>>2]=J;f[H>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(D>>>0);ga=$(n[l>>2]);do if(F|$(ga*fa)>>0<3|(D+-1&D|0)!=0)&1;O=~~$(W($(ea/ga)))>>>0;$h(i,G>>>0>>0?O:G);G=f[o>>2]|0;O=G+-1|0;if(!(O&G)){ha=G;ia=O&J;break}if(G>>>0>J>>>0){ha=G;ia=J}else{ha=G;ia=(J>>>0)%(G>>>0)|0}}else{ha=D;ia=aa}while(0);J=(f[i>>2]|0)+(ia<<2)|0;F=f[J>>2]|0;if(!F){f[H>>2]=f[v>>2];f[v>>2]=H;f[J>>2]=v;J=f[H>>2]|0;if(J|0){r=f[J+4>>2]|0;J=ha+-1|0;if(J&ha)if(r>>>0>>0)ja=r;else ja=(r>>>0)%(ha>>>0)|0;else ja=r&J;ka=(f[i>>2]|0)+(ja<<2)|0;S=59}}else{f[H>>2]=f[F>>2];ka=F;S=59}if((S|0)==59){S=0;f[ka>>2]=H}f[t>>2]=(f[t>>2]|0)+1;S=61}if((S|0)==61){S=0;F=w;J=f[F>>2]|0;r=un(J|0,f[F+4>>2]|0,A|0,0)|0;kh((f[f[x>>2]>>2]|0)+r|0,j|0,J|0)|0;J=f[k>>2]|0;f[J+(z<<2)>>2]=A;V=J;X=A+1|0;Y=J;Z=J;_=J}J=z+1|0;la=f[m>>2]|0;if(J>>>0>=la>>>0)break;e=V;z=J;A=X;B=Z;C=Y;D=f[o>>2]|0;E=_}if((X|0)==(la|0))ma=Z;else{Z=a+84|0;if(!(b[Z>>0]|0)){_=f[a+72>>2]|0;E=f[a+68>>2]|0;o=E;if((_|0)==(E|0))na=V;else{D=_-E>>2;E=0;do{_=o+(E<<2)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2]|0;o=f[j>>2]|0}else{f[l>>2]=f[b>>2];k=l+4|0;f[j>>2]=k;n=i;o=k}k=f[a+8>>2]|0;i=(f[k+100>>2]|0)-(f[k+96>>2]|0)|0;k=(i|0)/12|0;if((n|0)==(o|0)){u=c;return 1}n=a+28|0;l=(i|0)>0;i=a+164|0;p=a+12|0;q=a+76|0;r=a+80|0;s=a+72|0;t=a+200|0;v=a+320|0;w=a+152|0;x=a+84|0;y=a+324|0;z=a+292|0;A=a+304|0;B=a+316|0;C=a+328|0;D=a+336|0;E=a+332|0;F=a+168|0;G=a+140|0;H=a+120|0;I=o;do{o=f[I+-4>>2]|0;f[b>>2]=o;a:do if((o|0)!=-1?(J=(o>>>0)/3|0,K=f[n>>2]|0,(f[K+(J>>>5<<2)>>2]&1<<(J&31)|0)==0):0){if(l){J=0;L=K;b:while(1){K=J+1|0;f[i>>2]=(f[i>>2]|0)+1;M=f[b>>2]|0;N=(M|0)==-1?-1:(M>>>0)/3|0;M=L+(N>>>5<<2)|0;f[M>>2]=1<<(N&31)|f[M>>2];M=f[q>>2]|0;if((M|0)==(f[r>>2]|0))Ri(s,b);else{f[M>>2]=f[b>>2];f[q>>2]=M+4}f[v>>2]=f[b>>2];M=f[b>>2]|0;if((M|0)==-1)O=-1;else O=f[(f[f[p>>2]>>2]|0)+(M<<2)>>2]|0;P=(f[(f[w>>2]|0)+(O<<2)>>2]|0)!=-1;Q=(f[x>>2]|0)+(O>>>5<<2)|0;R=1<<(O&31);S=f[Q>>2]|0;do if(!(S&R)){f[Q>>2]=S|R;if(P){T=f[b>>2]|0;U=38;break}f[y>>2]=(f[y>>2]|0)+1;V=f[v>>2]|0;W=V+1|0;do if((V|0)!=-1){X=((W>>>0)%3|0|0)==0?V+-2|0:W;if(!((V>>>0)%3|0)){Y=V+2|0;Z=X;break}else{Y=V+-1|0;Z=X;break}}else{Y=-1;Z=-1}while(0);V=f[z>>2]|0;W=f[A>>2]|0;X=W+(f[V+(Z<<2)>>2]<<2)|0;_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!(f[aa+(_>>>5<<2)>>2]&1<<(_&31))){U=62;break b}}while(0);if(!ea)xf(a,f[i>>2]|0,N,0,fa);nd(t,3);ga=f[e>>2]|0}else{if(!R){xf(a,f[i>>2]|0,N,1,S);aa=f[b>>2]|0;if((aa|0)==-1){U=52;break}else ha=aa}else ha=T;aa=(((ha>>>0)%3|0|0)==0?2:-1)+ha|0;if((aa|0)==-1){U=52;break}Q=f[(f[(f[p>>2]|0)+12>>2]|0)+(aa<<2)>>2]|0;if((Q|0)==-1){U=52;break}aa=(Q>>>0)/3|0;if(f[(f[n>>2]|0)+(aa>>>5<<2)>>2]&1<<(aa&31)|0){U=52;break}nd(t,5);ga=da}f[b>>2]=ga}if((K|0)>=(k|0))break a;J=K;L=f[n>>2]|0}do if((U|0)==43){U=0;f[e>>2]=-1;U=54}else if((U|0)==52){U=0;if(ea)U=54;else{xf(a,f[i>>2]|0,N,0,fa);U=54}}else if((U|0)==62){U=0;nd(t,1);f[F>>2]=(f[F>>2]|0)+1;if(P?(L=f[(f[w>>2]|0)+(O<<2)>>2]|0,(1<<(L&31)&f[(f[G>>2]|0)+(L>>>5<<2)>>2]|0)==0):0){f[g>>2]=f[b>>2];f[d>>2]=f[g>>2];Pe(a,d,0)|0}L=f[i>>2]|0;f[d>>2]=N;J=je(H,d)|0;f[J>>2]=L;L=f[j>>2]|0;f[L+-4>>2]=da;if((L|0)==(f[m>>2]|0)){Ri(h,e);break}else{f[L>>2]=f[e>>2];f[j>>2]=L+4;break}}while(0);if((U|0)==54){U=0;nd(t,7);f[j>>2]=(f[j>>2]|0)+-4}}}else U=11;while(0);if((U|0)==11){U=0;f[j>>2]=I+-4}I=f[j>>2]|0}while((f[h>>2]|0)!=(I|0));u=c;return 1}function Zb(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;c=u;u=u+16|0;d=c+8|0;e=c;g=f[b>>2]|0;if((g|0)==-1){u=c;return}h=(g>>>0)/3|0;i=a+12|0;if(f[(f[i>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0){u=c;return}h=a+56|0;j=f[h>>2]|0;k=a+60|0;l=f[k>>2]|0;if((l|0)==(j|0))m=j;else{n=l+(~((l+-4-j|0)>>>2)<<2)|0;f[k>>2]=n;m=n}n=a+64|0;if((m|0)==(f[n>>2]|0))Ri(h,b);else{f[m>>2]=g;f[k>>2]=m+4}m=f[a>>2]|0;g=f[b>>2]|0;j=g+1|0;do if((g|0)!=-1){l=f[m+28>>2]|0;o=f[l+((((j>>>0)%3|0|0)==0?g+-2|0:j)<<2)>>2]|0;if(!((g>>>0)%3|0)){p=o;q=g+2|0;r=l;break}else{p=o;q=g+-1|0;r=l;break}}else{l=f[m+28>>2]|0;p=f[l+-4>>2]|0;q=-1;r=l}while(0);m=f[r+(q<<2)>>2]|0;q=a+24|0;r=f[q>>2]|0;g=r+(p>>>5<<2)|0;j=1<<(p&31);l=f[g>>2]|0;if(!(l&j)){f[g>>2]=l|j;j=f[b>>2]|0;l=j+1|0;if((j|0)==-1)s=-1;else s=((l>>>0)%3|0|0)==0?j+-2|0:l;f[e>>2]=s;l=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((s>>>0)/3|0)*12|0)+(((s>>>0)%3|0)<<2)>>2]|0;s=f[a+48>>2]|0;f[d>>2]=l;j=f[s+4>>2]|0;s=j+4|0;g=f[s>>2]|0;if((g|0)==(f[j+8>>2]|0))Ri(j,d);else{f[g>>2]=l;f[s>>2]=g+4}g=a+40|0;s=f[g>>2]|0;l=s+4|0;j=f[l>>2]|0;if((j|0)==(f[s+8>>2]|0)){Ri(s,e);t=f[g>>2]|0}else{f[j>>2]=f[e>>2];f[l>>2]=j+4;t=s}s=t+24|0;f[(f[t+12>>2]|0)+(p<<2)>>2]=f[s>>2];f[s>>2]=(f[s>>2]|0)+1;v=f[q>>2]|0}else v=r;r=v+(m>>>5<<2)|0;v=1<<(m&31);s=f[r>>2]|0;if(!(s&v)){f[r>>2]=s|v;v=f[b>>2]|0;do if((v|0)!=-1)if(!((v>>>0)%3|0)){w=v+2|0;break}else{w=v+-1|0;break}else w=-1;while(0);f[e>>2]=w;v=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((w>>>0)/3|0)*12|0)+(((w>>>0)%3|0)<<2)>>2]|0;w=f[a+48>>2]|0;f[d>>2]=v;s=f[w+4>>2]|0;w=s+4|0;r=f[w>>2]|0;if((r|0)==(f[s+8>>2]|0))Ri(s,d);else{f[r>>2]=v;f[w>>2]=r+4}r=a+40|0;w=f[r>>2]|0;v=w+4|0;s=f[v>>2]|0;if((s|0)==(f[w+8>>2]|0)){Ri(w,e);x=f[r>>2]|0}else{f[s>>2]=f[e>>2];f[v>>2]=s+4;x=w}w=x+24|0;f[(f[x+12>>2]|0)+(m<<2)>>2]=f[w>>2];f[w>>2]=(f[w>>2]|0)+1}w=f[h>>2]|0;m=f[k>>2]|0;if((w|0)==(m|0)){u=c;return}x=a+44|0;s=a+48|0;v=a+40|0;r=m;m=w;while(1){w=f[r+-4>>2]|0;f[b>>2]=w;p=(w>>>0)/3|0;if((w|0)!=-1?(w=f[i>>2]|0,(f[w+(p>>>5<<2)>>2]&1<<(p&31)|0)==0):0){t=p;p=w;w=f[a>>2]|0;a:while(1){j=p+(t>>>5<<2)|0;f[j>>2]=f[j>>2]|1<<(t&31);j=f[b>>2]|0;l=f[(f[w+28>>2]|0)+(j<<2)>>2]|0;g=(f[q>>2]|0)+(l>>>5<<2)|0;o=1<<(l&31);y=f[g>>2]|0;if(!(o&y)){z=f[(f[w+40>>2]|0)+(l<<2)>>2]|0;if((z|0)==-1)A=1;else{B=f[(f[f[w+64>>2]>>2]|0)+(z<<2)>>2]|0;A=(1<<(B&31)&f[(f[w+12>>2]|0)+(B>>>5<<2)>>2]|0)!=0}f[g>>2]=y|o;o=f[b>>2]|0;f[e>>2]=o;y=f[(f[(f[x>>2]|0)+96>>2]|0)+(((o>>>0)/3|0)*12|0)+(((o>>>0)%3|0)<<2)>>2]|0;o=f[s>>2]|0;f[d>>2]=y;g=f[o+4>>2]|0;o=g+4|0;B=f[o>>2]|0;if((B|0)==(f[g+8>>2]|0))Ri(g,d);else{f[B>>2]=y;f[o>>2]=B+4}B=f[v>>2]|0;o=B+4|0;y=f[o>>2]|0;if((y|0)==(f[B+8>>2]|0)){Ri(B,e);C=f[v>>2]|0}else{f[y>>2]=f[e>>2];f[o>>2]=y+4;C=B}B=C+24|0;f[(f[C+12>>2]|0)+(l<<2)>>2]=f[B>>2];f[B>>2]=(f[B>>2]|0)+1;B=f[a>>2]|0;l=f[b>>2]|0;if(A){D=l;E=B;F=57}else{y=l+1|0;do if((l|0)==-1)G=-1;else{o=((y>>>0)%3|0|0)==0?l+-2|0:y;if((o|0)==-1){G=-1;break}if(f[(f[B>>2]|0)+(o>>>5<<2)>>2]&1<<(o&31)|0){G=-1;break}G=f[(f[(f[B+64>>2]|0)+12>>2]|0)+(o<<2)>>2]|0}while(0);f[b>>2]=G;H=(G>>>0)/3|0;I=B}}else{D=j;E=w;F=57}if((F|0)==57){F=0;y=D+1|0;if((D|0)==-1){F=58;break}l=((y>>>0)%3|0|0)==0?D+-2|0:y;if((l|0)!=-1?(f[(f[E>>2]|0)+(l>>>5<<2)>>2]&1<<(l&31)|0)==0:0)J=f[(f[(f[E+64>>2]|0)+12>>2]|0)+(l<<2)>>2]|0;else J=-1;f[d>>2]=J;l=(((D>>>0)%3|0|0)==0?2:-1)+D|0;if((l|0)!=-1?(f[(f[E>>2]|0)+(l>>>5<<2)>>2]&1<<(l&31)|0)==0:0)K=f[(f[(f[E+64>>2]|0)+12>>2]|0)+(l<<2)>>2]|0;else K=-1;l=(J|0)==-1;y=(J>>>0)/3|0;o=l?-1:y;g=(K|0)==-1;z=(K>>>0)/3|0;L=g?-1:z;do if(!l){M=f[i>>2]|0;if(f[M+(o>>>5<<2)>>2]&1<<(o&31)|0){F=67;break}if(g){N=J;O=y;break}if(!(f[M+(L>>>5<<2)>>2]&1<<(L&31))){F=72;break a}else{N=J;O=y}}else F=67;while(0);if((F|0)==67){F=0;if(g){F=69;break}if(!(f[(f[i>>2]|0)+(L>>>5<<2)>>2]&1<<(L&31))){N=K;O=z}else{F=69;break}}f[b>>2]=N;H=O;I=E}t=H;p=f[i>>2]|0;w=I}do if((F|0)==58){F=0;f[d>>2]=-1;F=69}else if((F|0)==72){F=0;w=f[k>>2]|0;f[w+-4>>2]=K;if((w|0)==(f[n>>2]|0)){Ri(h,d);P=f[k>>2]|0;break}else{f[w>>2]=f[d>>2];p=w+4|0;f[k>>2]=p;P=p;break}}while(0);if((F|0)==69){F=0;p=(f[k>>2]|0)+-4|0;f[k>>2]=p;P=p}Q=f[h>>2]|0;R=P}else{p=r+-4|0;f[k>>2]=p;Q=m;R=p}if((Q|0)==(R|0))break;else{r=R;m=Q}}u=c;return}function _b(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=Oa,K=Oa,L=Oa,M=0,N=0,O=0,P=0;e=u;u=u+64|0;g=e+40|0;i=e+16|0;j=e;k=Id(a,c)|0;if(k|0){f[i>>2]=k;f[g>>2]=f[i>>2];lf(a,g)|0}f[j>>2]=0;k=j+4|0;f[k>>2]=0;f[j+8>>2]=0;Fi(j,8);l=d;d=l;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;d=l+4|0;l=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;d=f[j>>2]|0;o=d;b[o>>0]=m;b[o+1>>0]=m>>8;b[o+2>>0]=m>>16;b[o+3>>0]=m>>24;m=d+4|0;b[m>>0]=l;b[m+1>>0]=l>>8;b[m+2>>0]=l>>16;b[m+3>>0]=l>>24;pj(i,c);c=i+12|0;f[c>>2]=0;l=i+16|0;f[l>>2]=0;f[i+20>>2]=0;m=f[k>>2]|0;d=f[j>>2]|0;o=m-d|0;if(!o){p=d;q=m;r=0}else{Fi(c,o);p=f[j>>2]|0;q=f[k>>2]|0;r=f[c>>2]|0}kh(r|0,p|0,q-p|0)|0;p=i+11|0;q=b[p>>0]|0;r=q<<24>>24<0;c=r?f[i>>2]|0:i;o=r?f[i+4>>2]|0:q&255;if(o>>>0>3){q=c;r=o;m=o;while(1){d=X(h[q>>0]|h[q+1>>0]<<8|h[q+2>>0]<<16|h[q+3>>0]<<24,1540483477)|0;r=(X(d>>>24^d,1540483477)|0)^(X(r,1540483477)|0);m=m+-4|0;if(m>>>0<=3)break;else q=q+4|0}q=o+-4|0;m=q&-4;s=q-m|0;t=c+(m+4)|0;v=r}else{s=o;t=c;v=o}switch(s|0){case 3:{w=h[t+2>>0]<<16^v;x=10;break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(m=f[r>>2]|0,(m|0)!=0):0){r=(o|0)==0;if(s){if(r){s=m;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=m;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Vk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=m;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=m;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Vk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){oi(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[a+16>>2]);do if(w|$(L*K)>>0<3|(y+-1&y|0)!=0)&1;H=~~$(W($(J/L)))>>>0;ei(a,A>>>0>>0?H:A);A=f[t>>2]|0;H=A+-1|0;if(!(H&A)){M=A;N=H&z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1;if(p)q=-1;else q=f[(f[n>>2]|0)+(o<<2)>>2]|0;n=a+20|0;r=f[n>>2]|0;s=f[r>>2]|0;if((f[r+4>>2]|0)-s>>2>>>0<=q>>>0)aq(r);r=a+8|0;t=f[(f[r>>2]|0)+(f[s+(q<<2)>>2]<<2)>>2]|0;q=a+4|0;s=f[q>>2]|0;if(!(b[s+84>>0]|0))v=f[(f[s+68>>2]|0)+(t<<2)>>2]|0;else v=t;f[j>>2]=0;f[j+4>>2]=0;f[j+8>>2]=0;f[j+12>>2]=0;f[j+16>>2]=0;f[j+20>>2]=0;f[h>>2]=v;v=b[s+24>>0]|0;f[g>>2]=f[h>>2];vb(s,g,v,j)|0;v=a+28|0;a=(f[v>>2]|0)==0;a:do if(!p){s=k+8|0;t=j+8|0;w=k+16|0;x=j+16|0;y=l+8|0;z=l+16|0;A=o;B=o;C=0;D=0;E=0;F=0;G=0;H=0;J=a;K=o;while(1){do if(J){L=K+1|0;if((K|0)==-1){M=A;N=-1;O=-1;P=-1;break}Q=((L>>>0)%3|0|0)==0?K+-2|0:L;if((A|0)!=-1)if(!((A>>>0)%3|0)){R=A;S=A+2|0;T=Q;U=A;V=19;break}else{R=A;S=A+-1|0;T=Q;U=A;V=19;break}else{R=-1;S=-1;T=Q;U=-1;V=19}}else{Q=B+1|0;L=((Q>>>0)%3|0|0)==0?B+-2|0:Q;if(!((B>>>0)%3|0)){R=A;S=B+2|0;T=L;U=K;V=19;break}else{R=A;S=B+-1|0;T=L;U=K;V=19;break}}while(0);if((V|0)==19){V=0;if((T|0)==-1){M=R;N=-1;O=S;P=U}else{M=R;N=f[(f[f[m>>2]>>2]|0)+(T<<2)>>2]|0;O=S;P=U}}W=f[n>>2]|0;L=f[W>>2]|0;if((f[W+4>>2]|0)-L>>2>>>0<=N>>>0){V=22;break}Q=f[(f[r>>2]|0)+(f[L+(N<<2)>>2]<<2)>>2]|0;L=f[q>>2]|0;if(!(b[L+84>>0]|0))X=f[(f[L+68>>2]|0)+(Q<<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>0]<<16|h[w+3>>0]<<24,1540483477)|0;x=(X(o>>>24^o,1540483477)|0)^(X(x,1540483477)|0);s=s+-4|0;if(s>>>0<=3)break;else w=w+4|0}w=d+-4|0;s=w&-4;y=w-s|0;z=c+(s+4)|0;A=x}else{y=d;z=c;A=d}switch(y|0){case 3:{B=h[z+2>>0]<<16^A;C=12;break}case 2:{B=A;C=12;break}case 1:{D=A;C=13;break}default:E=A}if((C|0)==12){D=h[z+1>>0]<<8^B;C=13}if((C|0)==13)E=X(D^h[z>>0],1540483477)|0;z=X(E>>>13^E,1540483477)|0;E=z>>>15^z;z=a+4|0;D=f[z>>2]|0;B=(D|0)==0;a:do if(!B){A=D+-1|0;y=(A&D|0)==0;if(!y)if(E>>>0>>0)F=E;else F=(E>>>0)%(D>>>0)|0;else F=E&A;x=f[(f[a>>2]|0)+(F<<2)>>2]|0;if((x|0)!=0?(s=f[x>>2]|0,(s|0)!=0):0){x=(d|0)==0;if(y){if(x){y=s;while(1){w=f[y+4>>2]|0;if(!((w|0)==(E|0)|(w&A|0)==(F|0))){G=F;C=54;break a}w=b[y+8+11>>0]|0;if(!((w<<24>>24<0?f[y+12>>2]|0:w&255)|0))break a;y=f[y>>2]|0;if(!y){G=F;C=54;break a}}}else H=s;while(1){y=f[H+4>>2]|0;if(!((y|0)==(E|0)|(y&A|0)==(F|0))){G=F;C=54;break a}y=H+8|0;w=b[y+11>>0]|0;o=w<<24>>24<0;t=w&255;do if(((o?f[H+12>>2]|0:t)|0)==(d|0)){w=f[y>>2]|0;if(o)if(!(Vk(w,c,d)|0))break a;else break;if((b[c>>0]|0)==(w&255)<<24>>24){w=y;l=t;q=c;do{l=l+-1|0;w=w+1|0;if(!l)break a;q=q+1|0}while((b[w>>0]|0)==(b[q>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){G=F;C=54;break a}}}if(x){A=s;while(1){t=f[A+4>>2]|0;if((t|0)!=(E|0)){if(t>>>0>>0)I=t;else I=(t>>>0)%(D>>>0)|0;if((I|0)!=(F|0)){G=F;C=54;break a}}t=b[A+8+11>>0]|0;if(!((t<<24>>24<0?f[A+12>>2]|0:t&255)|0))break a;A=f[A>>2]|0;if(!A){G=F;C=54;break a}}}else J=s;while(1){A=f[J+4>>2]|0;if((A|0)!=(E|0)){if(A>>>0>>0)K=A;else K=(A>>>0)%(D>>>0)|0;if((K|0)!=(F|0)){G=F;C=54;break a}}A=J+8|0;x=b[A+11>>0]|0;t=x<<24>>24<0;y=x&255;do if(((t?f[J+12>>2]|0:y)|0)==(d|0)){x=f[A>>2]|0;if(t)if(!(Vk(x,c,d)|0))break a;else break;if((b[c>>0]|0)==(x&255)<<24>>24){x=A;o=y;q=c;do{o=o+-1|0;x=x+1|0;if(!o)break a;q=q+1|0}while((b[x>>0]|0)==(b[q>>0]|0))}}while(0);J=f[J>>2]|0;if(!J){G=F;C=54;break}}}else{G=F;C=54}}else{G=0;C=54}while(0);if((C|0)==54){oi(g,a,E,i);C=a+12|0;L=$(((f[C>>2]|0)+1|0)>>>0);M=$(D>>>0);N=$(n[a+16>>2]);do if(B|$(N*M)>>0<3|(D+-1&D|0)!=0)&1;J=~~$(W($(L/N)))>>>0;ei(a,F>>>0>>0?J:F);F=f[z>>2]|0;J=F+-1|0;if(!(J&F)){O=F;P=J&E;break}if(E>>>0>>0){O=F;P=E}else{O=F;P=(E>>>0)%(F>>>0)|0}}else{O=D;P=G}while(0);G=f[(f[a>>2]|0)+(P<<2)>>2]|0;if(!G){D=a+8|0;f[f[g>>2]>>2]=f[D>>2];f[D>>2]=f[g>>2];f[(f[a>>2]|0)+(P<<2)>>2]=D;D=f[g>>2]|0;P=f[D>>2]|0;if(!P)Q=g;else{E=f[P+4>>2]|0;P=O+-1|0;if(P&O)if(E>>>0>>0)R=E;else R=(E>>>0)%(O>>>0)|0;else R=E&P;f[(f[a>>2]|0)+(R<<2)>>2]=D;Q=g}}else{f[f[g>>2]>>2]=f[G>>2];f[G>>2]=f[g>>2];Q=g}f[C>>2]=(f[C>>2]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n>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;y=f[(f[(f[n>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;n=a+172|0;x=f[a+176>>2]|0;A=f[n>>2]|0;B=A;a:do if((x|0)==(A|0))D=-1;else{r=(x-A|0)/136|0;v=0;while(1){if((f[B+(v*136|0)>>2]|0)==(c|0))break;t=v+1|0;if(t>>>0>>0)v=t;else{D=-1;break a}}f[g>>2]=v;D=v}while(0);b:do if(!(b[m>>0]|0)){A=(f[y+56>>2]|0)==0;do if(!((p|0)==0|A)){if((p|0)==1?b[B+(D*136|0)+28>>0]|0:0)break;x=ln(88)|0;r=f[a+8>>2]|0;t=B+(D*136|0)+104|0;f[x+4>>2]=0;f[x>>2]=3564;w=x+12|0;f[w>>2]=3588;q=x+64|0;f[q>>2]=0;f[x+68>>2]=0;f[x+72>>2]=0;o=x+16|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[x+76>>2]=r;f[x+80>>2]=t;s=x+84|0;f[s>>2]=0;f[h>>2]=3588;E=h+4|0;F=E+4|0;f[F>>2]=0;f[F+4>>2]=0;f[F+8>>2]=0;f[F+12>>2]=0;f[F+16>>2]=0;f[F+20>>2]=0;F=B+(D*136|0)+4|0;G=i+4|0;f[G>>2]=3588;H=i+56|0;f[H>>2]=0;I=i+60|0;f[I>>2]=0;f[i+64>>2]=0;o=i+8|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[E>>2]=F;o=f[B+(D*136|0)+68>>2]|0;z=((f[o+4>>2]|0)-(f[o>>2]|0)>>2>>>0)/3|0;b[e>>0]=0;qh(h+8|0,z,e);Va[f[(f[h>>2]|0)+8>>2]&127](h);Df(j,h);Df(e,j);f[i>>2]=f[e+4>>2];z=i+4|0;fg(z,e)|0;f[e>>2]=3588;o=f[e+20>>2]|0;if(o|0)Oq(o);o=f[e+8>>2]|0;if(o|0)Oq(o);f[i+36>>2]=F;f[i+40>>2]=t;f[i+44>>2]=r;f[i+48>>2]=x;f[j>>2]=3588;o=f[j+20>>2]|0;if(o|0)Oq(o);o=f[j+8>>2]|0;if(o|0)Oq(o);f[s>>2]=a+72;f[x+8>>2]=f[i>>2];fg(w,z)|0;z=x+44|0;o=i+36|0;f[z>>2]=f[o>>2];f[z+4>>2]=f[o+4>>2];f[z+8>>2]=f[o+8>>2];f[z+12>>2]=f[o+12>>2];b[z+16>>0]=b[o+16>>0]|0;ng(q,f[H>>2]|0,f[I>>2]|0);o=x;z=f[H>>2]|0;if(z|0){J=f[I>>2]|0;if((J|0)!=(z|0))f[I>>2]=J+(~((J+-4-z|0)>>>2)<<2);Oq(z)}f[G>>2]=3588;z=f[i+24>>2]|0;if(z|0)Oq(z);z=f[i+12>>2]|0;if(z|0)Oq(z);f[h>>2]=3588;z=f[h+20>>2]|0;if(z|0)Oq(z);z=f[h+8>>2]|0;if(z|0)Oq(z);K=0;L=o;M=54;break b}while(0);if(!A){b[B+(D*136|0)+100>>0]=0;N=B+(D*136|0)+104|0;M=26}else M=24}else M=24;while(0);if((M|0)==24){N=a+40|0;M=26}if((M|0)==26){D=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((mi(f[D>>2]|0)|0)==0?(f[y+56>>2]|0)==0:0){if(b[m>>0]|0?(B=f[a+8>>2]|0,((f[B+12>>2]|0)-(f[B+8>>2]|0)|0)>4):0){M=31;break}gf(e,a,N);O=1;P=f[e>>2]|0}else M=31;while(0);if((M|0)==31){Vd(e,a,N);O=0;P=f[e>>2]|0}if(!P)Q=0;else{K=O;L=P;M=54}}if((M|0)==54){M=f[g>>2]|0;if((M|0)==-1)R=a+68|0;else R=(f[n>>2]|0)+(M*136|0)+132|0;f[R>>2]=K;K=ln(76)|0;f[k>>2]=L;rl(K,k,c);c=K;K=f[k>>2]|0;f[k>>2]=0;if(K|0)Va[f[(f[K>>2]|0)+4>>2]&127](K);K=a+188|0;k=f[K>>2]|0;if((k|0)==(f[a+192>>2]|0))Ri(a+184|0,g);else{f[k>>2]=f[g>>2];f[K>>2]=k+4}k=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0;f[l>>2]=c;a=k+12|0;K=f[a>>2]|0;if(K>>>0<(f[k+16>>2]|0)>>>0){f[l>>2]=0;f[K>>2]=c;f[a>>2]=K+4;S=l}else{Qg(k+8|0,l);S=l}l=f[S>>2]|0;f[S>>2]=0;if(!l)Q=1;else{Va[f[(f[l>>2]|0)+4>>2]&127](l);Q=1}}C=Q;u=d;return C|0}function cc(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;d=u;u=u+192|0;e=d+152|0;g=d+144|0;h=d+72|0;i=d;j=d+112|0;k=d+108|0;l=d+104|0;m=a+288|0;if(b[m>>0]|0?(n=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0,((f[n+12>>2]|0)-(f[n+8>>2]|0)|0)>0):0){n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+8|0;o=f[f[n>>2]>>2]|0;f[e>>2]=c;n=o+4|0;p=o+8|0;q=f[p>>2]|0;if((q|0)==(f[o+12>>2]|0))Ri(n,e);else{f[q>>2]=c;f[p>>2]=q+4}q=f[e>>2]|0;r=o+16|0;s=o+20|0;o=f[s>>2]|0;t=f[r>>2]|0;v=o-t>>2;w=t;if((q|0)<(v|0)){x=w;y=q}else{t=q+1|0;f[g>>2]=-1;z=o;if(t>>>0<=v>>>0)if(t>>>0>>0?(o=w+(t<<2)|0,(o|0)!=(z|0)):0){f[s>>2]=z+(~((z+-4-o|0)>>>2)<<2);A=q;B=w}else{A=q;B=w}else{Ch(r,t-v|0,g);A=f[e>>2]|0;B=f[r>>2]|0}x=B;y=A}f[x+(y<<2)>>2]=((f[p>>2]|0)-(f[n>>2]|0)>>2)+-1;C=1;u=d;return C|0}n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+52|0;p=f[(f[(f[n>>2]|0)+84>>2]|0)+(c<<2)>>2]|0;n=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+4|0;y=f[(f[(f[n>>2]|0)+8>>2]|0)+(c<<2)>>2]|0;f[g>>2]=-1;n=a+172|0;x=f[a+176>>2]|0;A=f[n>>2]|0;B=A;a:do if((x|0)==(A|0))D=-1;else{r=(x-A|0)/136|0;v=0;while(1){if((f[B+(v*136|0)>>2]|0)==(c|0))break;t=v+1|0;if(t>>>0>>0)v=t;else{D=-1;break a}}f[g>>2]=v;D=v}while(0);b:do if(!(b[m>>0]|0)){A=(f[y+56>>2]|0)==0;do if(!((p|0)==0|A)){if((p|0)==1?b[B+(D*136|0)+28>>0]|0:0)break;x=ln(88)|0;r=f[a+8>>2]|0;t=B+(D*136|0)+104|0;f[x+4>>2]=0;f[x>>2]=3564;w=x+12|0;f[w>>2]=3588;q=x+64|0;f[q>>2]=0;f[x+68>>2]=0;f[x+72>>2]=0;o=x+16|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[x+76>>2]=r;f[x+80>>2]=t;s=x+84|0;f[s>>2]=0;f[h>>2]=3588;E=h+4|0;F=E+4|0;f[F>>2]=0;f[F+4>>2]=0;f[F+8>>2]=0;f[F+12>>2]=0;f[F+16>>2]=0;f[F+20>>2]=0;F=B+(D*136|0)+4|0;G=i+4|0;f[G>>2]=3588;H=i+56|0;f[H>>2]=0;I=i+60|0;f[I>>2]=0;f[i+64>>2]=0;o=i+8|0;z=o+44|0;do{f[o>>2]=0;o=o+4|0}while((o|0)<(z|0));f[E>>2]=F;o=f[B+(D*136|0)+68>>2]|0;z=((f[o+4>>2]|0)-(f[o>>2]|0)>>2>>>0)/3|0;b[e>>0]=0;qh(h+8|0,z,e);Va[f[(f[h>>2]|0)+8>>2]&127](h);Df(j,h);Df(e,j);f[i>>2]=f[e+4>>2];z=i+4|0;fg(z,e)|0;f[e>>2]=3588;o=f[e+20>>2]|0;if(o|0)Oq(o);o=f[e+8>>2]|0;if(o|0)Oq(o);f[i+36>>2]=F;f[i+40>>2]=t;f[i+44>>2]=r;f[i+48>>2]=x;f[j>>2]=3588;o=f[j+20>>2]|0;if(o|0)Oq(o);o=f[j+8>>2]|0;if(o|0)Oq(o);f[s>>2]=a+72;f[x+8>>2]=f[i>>2];fg(w,z)|0;z=x+44|0;o=i+36|0;f[z>>2]=f[o>>2];f[z+4>>2]=f[o+4>>2];f[z+8>>2]=f[o+8>>2];f[z+12>>2]=f[o+12>>2];b[z+16>>0]=b[o+16>>0]|0;ng(q,f[H>>2]|0,f[I>>2]|0);o=x;z=f[H>>2]|0;if(z|0){J=f[I>>2]|0;if((J|0)!=(z|0))f[I>>2]=J+(~((J+-4-z|0)>>>2)<<2);Oq(z)}f[G>>2]=3588;z=f[i+24>>2]|0;if(z|0)Oq(z);z=f[i+12>>2]|0;if(z|0)Oq(z);f[h>>2]=3588;z=f[h+20>>2]|0;if(z|0)Oq(z);z=f[h+8>>2]|0;if(z|0)Oq(z);K=0;L=o;M=54;break b}while(0);if(!A){b[B+(D*136|0)+100>>0]=0;N=B+(D*136|0)+104|0;M=26}else M=24}else M=24;while(0);if((M|0)==24){N=a+40|0;M=26}if((M|0)==26){D=(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)+48|0;do if((mi(f[D>>2]|0)|0)==0?(f[y+56>>2]|0)==0:0){if(b[m>>0]|0?(B=f[a+8>>2]|0,((f[B+12>>2]|0)-(f[B+8>>2]|0)|0)>4):0){M=31;break}gf(e,a,N);O=1;P=f[e>>2]|0}else M=31;while(0);if((M|0)==31){Vd(e,a,N);O=0;P=f[e>>2]|0}if(!P)Q=0;else{K=O;L=P;M=54}}if((M|0)==54){M=f[g>>2]|0;if((M|0)==-1)R=a+68|0;else R=(f[n>>2]|0)+(M*136|0)+132|0;f[R>>2]=K;K=ln(76)|0;f[k>>2]=L;rl(K,k,c);c=K;K=f[k>>2]|0;f[k>>2]=0;if(K|0)Va[f[(f[K>>2]|0)+4>>2]&127](K);K=a+188|0;k=f[K>>2]|0;if((k|0)==(f[a+192>>2]|0))Ri(a+184|0,g);else{f[k>>2]=f[g>>2];f[K>>2]=k+4}k=Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0;f[l>>2]=c;a=k+12|0;K=f[a>>2]|0;if(K>>>0<(f[k+16>>2]|0)>>>0){f[l>>2]=0;f[K>>2]=c;f[a>>2]=K+4;S=l}else{Qg(k+8|0,l);S=l}l=f[S>>2]|0;f[S>>2]=0;if(!l)Q=1;else{Va[f[(f[l>>2]|0)+4>>2]&127](l);Q=1}}C=Q;u=d;return C|0}function dc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0;c=u;u=u+16|0;d=c+8|0;e=c;g=f[b>>2]|0;if((g|0)==-1){u=c;return}h=(g>>>0)/3|0;i=a+12|0;if(f[(f[i>>2]|0)+(h>>>5<<2)>>2]&1<<(h&31)|0){u=c;return}h=a+56|0;j=f[h>>2]|0;k=a+60|0;l=f[k>>2]|0;if((l|0)==(j|0))m=j;else{n=l+(~((l+-4-j|0)>>>2)<<2)|0;f[k>>2]=n;m=n}n=a+64|0;if((m|0)==(f[n>>2]|0))Ri(h,b);else{f[m>>2]=g;f[k>>2]=m+4}m=f[a>>2]|0;g=f[b>>2]|0;j=g+1|0;if((g|0)!=-1){l=((j>>>0)%3|0|0)==0?g+-2|0:j;if((l|0)==-1)o=-1;else o=f[(f[m>>2]|0)+(l<<2)>>2]|0;l=(((g>>>0)%3|0|0)==0?2:-1)+g|0;if((l|0)==-1){p=o;q=-1}else{p=o;q=f[(f[m>>2]|0)+(l<<2)>>2]|0}}else{p=-1;q=-1}l=a+24|0;m=f[l>>2]|0;o=m+(p>>>5<<2)|0;g=1<<(p&31);j=f[o>>2]|0;if(!(j&g)){f[o>>2]=j|g;g=f[b>>2]|0;j=g+1|0;if((g|0)==-1)r=-1;else r=((j>>>0)%3|0|0)==0?g+-2|0:j;f[e>>2]=r;j=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((r>>>0)/3|0)*12|0)+(((r>>>0)%3|0)<<2)>>2]|0;r=f[a+48>>2]|0;f[d>>2]=j;g=f[r+4>>2]|0;r=g+4|0;o=f[r>>2]|0;if((o|0)==(f[g+8>>2]|0))Ri(g,d);else{f[o>>2]=j;f[r>>2]=o+4}o=a+40|0;r=f[o>>2]|0;j=r+4|0;g=f[j>>2]|0;if((g|0)==(f[r+8>>2]|0)){Ri(r,e);s=f[o>>2]|0}else{f[g>>2]=f[e>>2];f[j>>2]=g+4;s=r}r=s+24|0;f[(f[s+12>>2]|0)+(p<<2)>>2]=f[r>>2];f[r>>2]=(f[r>>2]|0)+1;t=f[l>>2]|0}else t=m;m=t+(q>>>5<<2)|0;t=1<<(q&31);r=f[m>>2]|0;if(!(r&t)){f[m>>2]=r|t;t=f[b>>2]|0;do if((t|0)!=-1)if(!((t>>>0)%3|0)){v=t+2|0;break}else{v=t+-1|0;break}else v=-1;while(0);f[e>>2]=v;t=f[(f[(f[a+44>>2]|0)+96>>2]|0)+(((v>>>0)/3|0)*12|0)+(((v>>>0)%3|0)<<2)>>2]|0;v=f[a+48>>2]|0;f[d>>2]=t;r=f[v+4>>2]|0;v=r+4|0;m=f[v>>2]|0;if((m|0)==(f[r+8>>2]|0))Ri(r,d);else{f[m>>2]=t;f[v>>2]=m+4}m=a+40|0;v=f[m>>2]|0;t=v+4|0;r=f[t>>2]|0;if((r|0)==(f[v+8>>2]|0)){Ri(v,e);w=f[m>>2]|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z>>2]|0)+1;if(C){E=f[b>>2]|0;F=60;break}z=f[a>>2]|0;A=f[b>>2]|0;do if((A|0)==-1)G=-1;else{B=A+1|0;y=((B>>>0)%3|0|0)==0?A+-2|0:B;if((y|0)==-1){G=-1;break}G=f[(f[z+12>>2]|0)+(y<<2)>>2]|0}while(0);f[b>>2]=G;H=(G>>>0)/3|0}else{E=v;F=60}while(0);if((F|0)==60){F=0;v=f[a>>2]|0;if((E|0)==-1){F=61;break}j=E+1|0;o=((j>>>0)%3|0|0)==0?E+-2|0:j;if((o|0)==-1)I=-1;else I=f[(f[v+12>>2]|0)+(o<<2)>>2]|0;f[d>>2]=I;o=(((E>>>0)%3|0|0)==0?2:-1)+E|0;if((o|0)==-1)J=-1;else J=f[(f[v+12>>2]|0)+(o<<2)>>2]|0;o=(I|0)==-1;v=(I>>>0)/3|0;j=o?-1:v;g=(J|0)==-1;z=(J>>>0)/3|0;A=g?-1:z;do if(!o){y=f[i>>2]|0;if(f[y+(j>>>5<<2)>>2]&1<<(j&31)|0){F=68;break}if(g){K=I;L=v;break}if(!(f[y+(A>>>5<<2)>>2]&1<<(A&31))){F=73;break a}else{K=I;L=v}}else F=68;while(0);if((F|0)==68){F=0;if(g){F=70;break}if(!(f[(f[i>>2]|0)+(A>>>5<<2)>>2]&1<<(A&31))){K=J;L=z}else{F=70;break}}f[b>>2]=K;H=L}s=H;p=f[i>>2]|0}do if((F|0)==61){F=0;f[d>>2]=-1;F=70}else if((F|0)==73){F=0;p=f[k>>2]|0;f[p+-4>>2]=J;if((p|0)==(f[n>>2]|0)){Ri(h,d);M=f[k>>2]|0;break}else{f[p>>2]=f[d>>2];s=p+4|0;f[k>>2]=s;M=s;break}}while(0);if((F|0)==70){F=0;s=(f[k>>2]|0)+-4|0;f[k>>2]=s;M=s}N=f[h>>2]|0;O=M}else{s=m+-4|0;f[k>>2]=s;N=q;O=s}if((N|0)==(O|0))break;else{m=O;q=N}}u=c;return}function ec(a,c,e){a=a|0;c=c|0;e=e|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N>>2]|0;if(!N)break b}}else{N=M;while(1){P=f[N+4>>2]|0;if((P|0)==(G|0)){if((d[N+8>>1]|0)==r<<16>>16){Q=N;break c}}else{if(P>>>0>>0)R=P;else R=(P>>>0)%(e>>>0)|0;if((R|0)!=(J|0))break b}N=f[N>>2]|0;if(!N)break b}}while(0);f[E+(A<<2)>>2]=f[Q+12>>2];S=z;T=B;U=D;V=C;X=E;break a}while(0);if(!H)if(e>>>0>G>>>0)Y=G;else Y=(G>>>0)%(e>>>0)|0;else Y=F&G;L=f[K+(Y<<2)>>2]|0;if(!L){Z=Y;_=e;aa=0;ba=40}else{if(H){M=L;while(1){M=f[M>>2]|0;if(!M){Z=Y;_=e;aa=0;ba=40;break a}N=f[M+4>>2]|0;if(!((N|0)==(G|0)|(N&F|0)==(Y|0))){Z=Y;_=e;aa=0;ba=40;break a}if((d[M+8>>1]|0)==r<<16>>16){ba=55;break a}}}else ca=L;while(1){ca=f[ca>>2]|0;if(!ca){Z=Y;_=e;aa=0;ba=40;break a}M=f[ca+4>>2]|0;if((M|0)!=(G|0)){if(M>>>0>>0)da=M;else da=(M>>>0)%(e>>>0)|0;if((da|0)!=(Y|0)){Z=Y;_=e;aa=0;ba=40;break a}}if((d[ca+8>>1]|0)==r<<16>>16){ba=55;break}}}}else{Z=0;_=0;aa=1;ba=40}while(0);if((ba|0)==40){ba=0;L=ln(16)|0;d[L+8>>1]=r;f[L+12>>2]=B;f[L+4>>2]=G;f[L>>2]=0;ea=$(((f[t>>2]|0)+1|0)>>>0);fa=$(_>>>0);ga=$(n[l>>2]);do if(aa|$(ga*fa)>>0<3|(_+-1&_|0)!=0)&1;F=~~$(W($(ea/ga)))>>>0;Vh(i,M>>>0>>0?F:M);M=f[o>>2]|0;F=M+-1|0;if(!(F&M)){ha=M;ia=F&G;break}if(M>>>0>G>>>0){ha=M;ia=G}else{ha=M;ia=(G>>>0)%(M>>>0)|0}}else{ha=_;ia=Z}while(0);G=(f[i>>2]|0)+(ia<<2)|0;r=f[G>>2]|0;if(!r){f[L>>2]=f[v>>2];f[v>>2]=L;f[G>>2]=v;G=f[L>>2]|0;if(G|0){M=f[G+4>>2]|0;G=ha+-1|0;if(G&ha)if(M>>>0>>0)ja=M;else ja=(M>>>0)%(ha>>>0)|0;else ja=M&G;ka=(f[i>>2]|0)+(ja<<2)|0;ba=53}}else{f[L>>2]=f[r>>2];ka=r;ba=53}if((ba|0)==53){ba=0;f[ka>>2]=L}f[t>>2]=(f[t>>2]|0)+1;ba=55}if((ba|0)==55){ba=0;r=w;G=f[r>>2]|0;M=un(G|0,f[r+4>>2]|0,B|0,0)|0;kh((f[f[x>>2]>>2]|0)+M|0,j|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=B;S=G;T=B+1|0;U=G;V=G;X=G}G=A+1|0;la=f[m>>2]|0;if(G>>>0>=la>>>0)break;e=f[o>>2]|0;z=S;A=G;B=T;C=V;D=U;E=X}if((T|0)==(la|0))ma=V;else{V=a+84|0;if(!(b[V>>0]|0)){X=f[a+72>>2]|0;E=f[a+68>>2]|0;D=E;if((X|0)==(E|0))na=S;else{C=X-E>>2;E=0;do{X=D+(E<<2)|0;f[X>>2]=f[U+(f[X>>2]<<2)>>2];E=E+1|0}while(E>>>0>>0);na=S}}else{b[V>>0]=0;V=a+68|0;S=a+72|0;C=f[S>>2]|0;E=f[V>>2]|0;U=C-E>>2;D=E;E=C;if(la>>>0<=U>>>0)if(la>>>0>>0?(C=D+(la<<2)|0,(C|0)!=(E|0)):0){f[S>>2]=E+(~((E+-4-C|0)>>>2)<<2);oa=la}else oa=la;else{Ch(V,la-U|0,1220);oa=f[m>>2]|0}U=f[k>>2]|0;if(!oa)na=U;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[U+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);na=U}}f[m>>2]=T;ma=na}if(!ma)pa=T;else{na=f[p>>2]|0;if((na|0)!=(ma|0))f[p>>2]=na+(~((na+-4-ma|0)>>>2)<<2);Oq(ma);pa=T}}else pa=0;T=f[i+8>>2]|0;if(T|0){ma=T;do{T=ma;ma=f[ma>>2]|0;Oq(T)}while((ma|0)!=0)}ma=f[i>>2]|0;f[i>>2]=0;if(!ma){u=g;return pa|0}Oq(ma);u=g;return pa|0}function fc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=Oa,K=Oa,L=Oa,M=0,N=0,O=0,P=0;e=u;u=u+64|0;g=e+40|0;i=e+16|0;j=e;k=Id(a,c)|0;if(k|0){f[i>>2]=k;f[g>>2]=f[i>>2];lf(a,g)|0}f[j>>2]=0;k=j+4|0;f[k>>2]=0;f[j+8>>2]=0;Fi(j,4);l=f[j>>2]|0;m=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[l>>0]=m;b[l+1>>0]=m>>8;b[l+2>>0]=m>>16;b[l+3>>0]=m>>24;pj(i,c);c=i+12|0;f[c>>2]=0;m=i+16|0;f[m>>2]=0;f[i+20>>2]=0;l=f[k>>2]|0;d=f[j>>2]|0;o=l-d|0;if(!o){p=d;q=l;r=0}else{Fi(c,o);p=f[j>>2]|0;q=f[k>>2]|0;r=f[c>>2]|0}kh(r|0,p|0,q-p|0)|0;p=i+11|0;q=b[p>>0]|0;r=q<<24>>24<0;c=r?f[i>>2]|0:i;o=r?f[i+4>>2]|0:q&255;if(o>>>0>3){q=c;r=o;l=o;while(1){d=X(h[q>>0]|h[q+1>>0]<<8|h[q+2>>0]<<16|h[q+3>>0]<<24,1540483477)|0;r=(X(d>>>24^d,1540483477)|0)^(X(r,1540483477)|0);l=l+-4|0;if(l>>>0<=3)break;else q=q+4|0}q=o+-4|0;l=q&-4;s=q-l|0;t=c+(l+4)|0;v=r}else{s=o;t=c;v=o}switch(s|0){case 3:{w=h[t+2>>0]<<16^v;x=10;break}case 2:{w=v;x=10;break}case 1:{y=v;x=11;break}default:z=v}if((x|0)==10){y=h[t+1>>0]<<8^w;x=11}if((x|0)==11)z=X(y^h[t>>0],1540483477)|0;t=X(z>>>13^z,1540483477)|0;z=t>>>15^t;t=a+4|0;y=f[t>>2]|0;w=(y|0)==0;a:do if(!w){v=y+-1|0;s=(v&y|0)==0;if(!s)if(z>>>0>>0)A=z;else A=(z>>>0)%(y>>>0)|0;else A=z&v;r=f[(f[a>>2]|0)+(A<<2)>>2]|0;if((r|0)!=0?(l=f[r>>2]|0,(l|0)!=0):0){r=(o|0)==0;if(s){if(r){s=l;while(1){q=f[s+4>>2]|0;if(!((q|0)==(z|0)|(q&v|0)==(A|0))){B=A;x=52;break a}q=b[s+8+11>>0]|0;if(!((q<<24>>24<0?f[s+12>>2]|0:q&255)|0))break a;s=f[s>>2]|0;if(!s){B=A;x=52;break a}}}else C=l;while(1){s=f[C+4>>2]|0;if(!((s|0)==(z|0)|(s&v|0)==(A|0))){B=A;x=52;break a}s=C+8|0;q=b[s+11>>0]|0;d=q<<24>>24<0;D=q&255;do if(((d?f[C+12>>2]|0:D)|0)==(o|0)){q=f[s>>2]|0;if(d)if(!(Vk(q,c,o)|0))break a;else break;if((b[c>>0]|0)==(q&255)<<24>>24){q=s;E=D;F=c;do{E=E+-1|0;q=q+1|0;if(!E)break a;F=F+1|0}while((b[q>>0]|0)==(b[F>>0]|0))}}while(0);C=f[C>>2]|0;if(!C){B=A;x=52;break a}}}if(r){v=l;while(1){D=f[v+4>>2]|0;if((D|0)!=(z|0)){if(D>>>0>>0)G=D;else G=(D>>>0)%(y>>>0)|0;if((G|0)!=(A|0)){B=A;x=52;break a}}D=b[v+8+11>>0]|0;if(!((D<<24>>24<0?f[v+12>>2]|0:D&255)|0))break a;v=f[v>>2]|0;if(!v){B=A;x=52;break a}}}else H=l;while(1){v=f[H+4>>2]|0;if((v|0)!=(z|0)){if(v>>>0>>0)I=v;else I=(v>>>0)%(y>>>0)|0;if((I|0)!=(A|0)){B=A;x=52;break a}}v=H+8|0;r=b[v+11>>0]|0;D=r<<24>>24<0;s=r&255;do if(((D?f[H+12>>2]|0:s)|0)==(o|0)){r=f[v>>2]|0;if(D)if(!(Vk(r,c,o)|0))break a;else break;if((b[c>>0]|0)==(r&255)<<24>>24){r=v;d=s;F=c;do{d=d+-1|0;r=r+1|0;if(!d)break a;F=F+1|0}while((b[r>>0]|0)==(b[F>>0]|0))}}while(0);H=f[H>>2]|0;if(!H){B=A;x=52;break}}}else{B=A;x=52}}else{B=0;x=52}while(0);if((x|0)==52){oi(g,a,z,i);x=a+12|0;J=$(((f[x>>2]|0)+1|0)>>>0);K=$(y>>>0);L=$(n[a+16>>2]);do if(w|$(L*K)>>0<3|(y+-1&y|0)!=0)&1;H=~~$(W($(J/L)))>>>0;ei(a,A>>>0>>0?H:A);A=f[t>>2]|0;H=A+-1|0;if(!(H&A)){M=A;N=H&z;break}if(z>>>0>>0){M=A;N=z}else{M=A;N=(z>>>0)%(A>>>0)|0}}else{M=y;N=B}while(0);B=f[(f[a>>2]|0)+(N<<2)>>2]|0;if(!B){y=a+8|0;f[f[g>>2]>>2]=f[y>>2];f[y>>2]=f[g>>2];f[(f[a>>2]|0)+(N<<2)>>2]=y;y=f[g>>2]|0;N=f[y>>2]|0;if(!N)O=g;else{z=f[N+4>>2]|0;N=M+-1|0;if(N&M)if(z>>>0>>0)P=z;else P=(z>>>0)%(M>>>0)|0;else P=z&N;f[(f[a>>2]|0)+(P<<2)>>2]=y;O=g}}else{f[f[g>>2]>>2]=f[B>>2];f[B>>2]=f[g>>2];O=g}f[x>>2]=(f[x>>2]|0)+1;f[O>>2]=0}O=f[i+12>>2]|0;if(O|0){if((f[m>>2]|0)!=(O|0))f[m>>2]=O;Oq(O)}if((b[p>>0]|0)<0)Oq(f[i>>2]|0);i=f[j>>2]|0;if(!i){u=e;return}if((f[k>>2]|0)!=(i|0))f[k>>2]=i;Oq(i);u=e;return}function g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>2]|0;if(!L)break b}}else{L=K;while(1){N=f[L+4>>2]|0;if((N|0)==(p|0)){if((b[L+8>>0]|0)==E<<24>>24){O=L;break c}}else{if(N>>>0>>0)P=N;else P=(N>>>0)%(d>>>0)|0;if((P|0)!=(G|0))break b}L=f[L>>2]|0;if(!L)break b}}while(0);f[C+(y<<2)>>2]=f[O+12>>2];Q=x;R=z;S=B;T=A;U=C;break a}while(0);if(!F)if(p>>>0>>0)V=p;else V=(p>>>0)%(d>>>0)|0;else V=D&p;J=f[H+(V<<2)>>2]|0;if(!J){X=V;Y=d;Z=0;_=40}else{if(F){K=J;while(1){K=f[K>>2]|0;if(!K){X=V;Y=d;Z=0;_=40;break a}L=f[K+4>>2]|0;if(!((L|0)==(p|0)|(L&D|0)==(V|0))){X=V;Y=d;Z=0;_=40;break a}if((b[K+8>>0]|0)==E<<24>>24){_=55;break a}}}else aa=J;while(1){aa=f[aa>>2]|0;if(!aa){X=V;Y=d;Z=0;_=40;break a}K=f[aa+4>>2]|0;if((K|0)!=(p|0)){if(K>>>0>>0)ba=K;else ba=(K>>>0)%(d>>>0)|0;if((ba|0)!=(V|0)){X=V;Y=d;Z=0;_=40;break a}}if((b[aa+8>>0]|0)==E<<24>>24){_=55;break}}}}else{X=0;Y=0;Z=1;_=40}while(0);if((_|0)==40){_=0;J=ln(16)|0;b[J+8>>0]=E;f[J+12>>2]=z;f[J+4>>2]=p;f[J>>2]=0;ca=$(((f[r>>2]|0)+1|0)>>>0);da=$(Y>>>0);ea=$(n[j>>2]);do if(Z|$(ea*da)>>0<3|(Y+-1&Y|0)!=0)&1;D=~~$(W($(ca/ea)))>>>0;ai(g,K>>>0>>0?D:K);K=f[l>>2]|0;D=K+-1|0;if(!(D&K)){fa=K;ga=D&p;break}if(p>>>0>>0){fa=K;ga=p}else{fa=K;ga=(p>>>0)%(K>>>0)|0}}else{fa=Y;ga=X}while(0);p=(f[g>>2]|0)+(ga<<2)|0;E=f[p>>2]|0;if(!E){f[J>>2]=f[s>>2];f[s>>2]=J;f[p>>2]=s;p=f[J>>2]|0;if(p|0){K=f[p+4>>2]|0;p=fa+-1|0;if(p&fa)if(K>>>0>>0)ha=K;else ha=(K>>>0)%(fa>>>0)|0;else ha=K&p;ia=(f[g>>2]|0)+(ha<<2)|0;_=53}}else{f[J>>2]=f[E>>2];ia=E;_=53}if((_|0)==53){_=0;f[ia>>2]=J}f[r>>2]=(f[r>>2]|0)+1;_=55}if((_|0)==55){_=0;E=t;p=f[E>>2]|0;K=un(p|0,f[E+4>>2]|0,z|0,0)|0;kh((f[f[v>>2]>>2]|0)+K|0,h|0,p|0)|0;p=f[i>>2]|0;f[p+(y<<2)>>2]=z;Q=p;R=z+1|0;S=p;T=p;U=p}p=y+1|0;ja=f[k>>2]|0;if(p>>>0>=ja>>>0)break;d=f[l>>2]|0;x=Q;y=p;z=R;A=T;B=S;C=U}if((R|0)==(ja|0))ka=T;else{T=a+84|0;if(!(b[T>>0]|0)){U=f[a+72>>2]|0;C=f[a+68>>2]|0;B=C;if((U|0)==(C|0))la=Q;else{A=U-C>>2;C=0;do{U=B+(C<<2)|0;f[U>>2]=f[S+(f[U>>2]<<2)>>2];C=C+1|0}while(C>>>0>>0);la=Q}}else{b[T>>0]=0;T=a+68|0;Q=a+72|0;A=f[Q>>2]|0;C=f[T>>2]|0;S=A-C>>2;B=C;C=A;if(ja>>>0<=S>>>0)if(ja>>>0>>0?(A=B+(ja<<2)|0,(A|0)!=(C|0)):0){f[Q>>2]=C+(~((C+-4-A|0)>>>2)<<2);ma=ja}else ma=ja;else{Ch(T,ja-S|0,1220);ma=f[k>>2]|0}S=f[i>>2]|0;if(!ma)la=S;else{i=f[a+68>>2]|0;a=0;do{f[i+(a<<2)>>2]=f[S+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);la=S}}f[k>>2]=R;ka=la}if(!ka)na=R;else{la=f[m>>2]|0;if((la|0)!=(ka|0))f[m>>2]=la+(~((la+-4-ka|0)>>>2)<<2);Oq(ka);na=R}}else na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;J=f[g>>2]|0;K=f[J+(H<<2)>>2]|0;b:do if(K|0?(L=f[K>>2]|0,L|0):0){c:do if(G){M=L;while(1){N=f[M+4>>2]|0;O=(N|0)==(F|0);if(!(O|(N&E|0)==(H|0)))break b;if(O?(f[M+8>>2]|0)==(q|0):0){P=M;break c}M=f[M>>2]|0;if(!M)break b}}else{M=L;while(1){O=f[M+4>>2]|0;if((O|0)==(F|0)){if((f[M+8>>2]|0)==(q|0)){P=M;break c}}else{if(O>>>0>>0)Q=O;else Q=(O>>>0)%(d>>>0)|0;if((Q|0)!=(H|0))break b}M=f[M>>2]|0;if(!M)break b}}while(0);f[D+(z<<2)>>2]=f[P+12>>2];R=y;S=A;T=C;U=B;V=D;break a}while(0);if(!G)if(F>>>0>>0)X=F;else X=(F>>>0)%(d>>>0)|0;else X=E&F;K=f[J+(X<<2)>>2]|0;if(!K){Y=X;Z=d;_=0;aa=40}else{if(G){L=K;while(1){L=f[L>>2]|0;if(!L){Y=X;Z=d;_=0;aa=40;break a}M=f[L+4>>2]|0;if(!((M|0)==(F|0)|(M&E|0)==(X|0))){Y=X;Z=d;_=0;aa=40;break a}if((f[L+8>>2]|0)==(q|0)){aa=55;break a}}}else ba=K;while(1){ba=f[ba>>2]|0;if(!ba){Y=X;Z=d;_=0;aa=40;break a}L=f[ba+4>>2]|0;if((L|0)!=(F|0)){if(L>>>0>>0)ca=L;else ca=(L>>>0)%(d>>>0)|0;if((ca|0)!=(X|0)){Y=X;Z=d;_=0;aa=40;break a}}if((f[ba+8>>2]|0)==(q|0)){aa=55;break}}}}else{Y=0;Z=0;_=1;aa=40}while(0);if((aa|0)==40){aa=0;K=ln(16)|0;f[K+8>>2]=q;f[K+12>>2]=A;f[K+4>>2]=F;f[K>>2]=0;da=$(((f[s>>2]|0)+1|0)>>>0);ea=$(Z>>>0);fa=$(n[k>>2]);do if(_|$(fa*ea)>>0<3|(Z+-1&Z|0)!=0)&1;E=~~$(W($(da/fa)))>>>0;Hi(g,L>>>0>>0?E:L);L=f[m>>2]|0;E=L+-1|0;if(!(E&L)){ga=L;ha=E&F;break}if(F>>>0>>0){ga=L;ha=F}else{ga=L;ha=(F>>>0)%(L>>>0)|0}}else{ga=Z;ha=Y}while(0);F=(f[g>>2]|0)+(ha<<2)|0;q=f[F>>2]|0;if(!q){f[K>>2]=f[t>>2];f[t>>2]=K;f[F>>2]=t;F=f[K>>2]|0;if(F|0){L=f[F+4>>2]|0;F=ga+-1|0;if(F&ga)if(L>>>0>>0)ia=L;else ia=(L>>>0)%(ga>>>0)|0;else ia=L&F;ja=(f[g>>2]|0)+(ia<<2)|0;aa=53}}else{f[K>>2]=f[q>>2];ja=q;aa=53}if((aa|0)==53){aa=0;f[ja>>2]=K}f[s>>2]=(f[s>>2]|0)+1;aa=55}if((aa|0)==55){aa=0;q=v;F=f[q>>2]|0;L=un(F|0,f[q+4>>2]|0,A|0,0)|0;kh((f[f[w>>2]>>2]|0)+L|0,i|0,F|0)|0;F=f[j>>2]|0;f[F+(z<<2)>>2]=A;R=F;S=A+1|0;T=F;U=F;V=F}F=z+1|0;ka=f[l>>2]|0;if(F>>>0>=ka>>>0)break;d=f[m>>2]|0;y=R;z=F;A=S;B=U;C=T;D=V}if((S|0)==(ka|0))la=U;else{U=a+84|0;if(!(b[U>>0]|0)){V=f[a+72>>2]|0;D=f[a+68>>2]|0;C=D;if((V|0)==(D|0))ma=R;else{B=V-D>>2;D=0;do{V=C+(D<<2)|0;f[V>>2]=f[T+(f[V>>2]<<2)>>2];D=D+1|0}while(D>>>0>>0);ma=R}}else{b[U>>0]=0;U=a+68|0;R=a+72|0;B=f[R>>2]|0;D=f[U>>2]|0;T=B-D>>2;C=D;D=B;if(ka>>>0<=T>>>0)if(ka>>>0>>0?(B=C+(ka<<2)|0,(B|0)!=(D|0)):0){f[R>>2]=D+(~((D+-4-B|0)>>>2)<<2);na=ka}else na=ka;else{Ch(U,ka-T|0,1220);na=f[l>>2]|0}T=f[j>>2]|0;if(!na)ma=T;else{j=f[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f[j+20>>2]=0;f[h>>2]=t;t=b[r+24>>0]|0;f[g>>2]=f[h>>2];vb(r,g,t,j)|0;t=a+28|0;a=(f[t>>2]|0)==0;a:do if((o|0)!=-1){r=k+8|0;s=j+8|0;v=k+16|0;w=j+16|0;x=l+8|0;y=l+16|0;z=o;A=o;B=0;C=0;D=0;E=0;F=0;G=0;H=a;J=o;while(1){do if(H){K=J+1|0;if((J|0)!=-1){L=((K>>>0)%3|0|0)==0?J+-2|0:K;if((z|0)!=-1)if(!((z>>>0)%3|0)){M=z;N=z+2|0;O=L;P=z;break}else{M=z;N=z+-1|0;O=L;P=z;break}else{M=-1;N=-1;O=L;P=-1}}else{M=z;N=-1;O=-1;P=-1}}else{L=A+1|0;K=((L>>>0)%3|0|0)==0?A+-2|0:L;if(!((A>>>0)%3|0)){M=z;N=A+2|0;O=K;P=J;break}else{M=z;N=A+-1|0;O=K;P=J;break}}while(0);K=f[(f[(f[m>>2]|0)+28>>2]|0)+(O<<2)>>2]|0;Q=f[n>>2]|0;L=f[Q>>2]|0;if((f[Q+4>>2]|0)-L>>2>>>0<=K>>>0){R=17;break}S=f[(f[q>>2]|0)+(f[L+(K<<2)>>2]<<2)>>2]|0;K=f[p>>2]|0;if(!(b[K+84>>0]|0))T=f[(f[K+68>>2]|0)+(S<<2)>>2]|0;else T=S;f[k>>2]=0;f[k+4>>2]=0;f[k+8>>2]=0;f[k+12>>2]=0;f[k+16>>2]=0;f[k+20>>2]=0;f[h>>2]=T;S=b[K+24>>0]|0;f[g>>2]=f[h>>2];vb(K,g,S,k)|0;S=f[(f[(f[m>>2]|0)+28>>2]|0)+(N<<2)>>2]|0;U=f[n>>2]|0;K=f[U>>2]|0;if((f[U+4>>2]|0)-K>>2>>>0<=S>>>0){R=21;break}L=f[(f[q>>2]|0)+(f[K+(S<<2)>>2]<<2)>>2]|0;S=f[p>>2]|0;if(!(b[S+84>>0]|0))V=f[(f[S+68>>2]|0)+(L<<2)>>2]|0;else V=L;f[l>>2]=0;f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;while(1){O=f[M+4>>2]|0;if(!((O|0)==(K|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((d[O>>1]|0)==A<<16>>16?(d[O+2>>1]|0)==F<<16>>16:0)?(d[M+12>>1]|0)==G<<16>>16:0)?(d[O+6>>1]|0)==J<<16>>16:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(K|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(H>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((d[M>>1]|0)==A<<16>>16?(d[M+2>>1]|0)==F<<16>>16:0)?(d[S+12>>1]|0)==G<<16>>16:0)?(d[M+6>>1]|0)==J<<16>>16:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;J=ln(20)|0;G=J+8|0;F=G;d[F>>1]=B;d[F+2>>1]=B>>>16;F=G+4|0;d[F>>1]=D;d[F+2>>1]=D>>>16;f[J+16>>2]=z;f[J+4>>2]=K;f[J>>2]=0;U=$(((f[p>>2]|0)+1|0)>>>0);V=$(H>>>0);X=$(n[m>>2]);do if(E|$(X*V)>>0<3|(H+-1&H|0)!=0)&1;G=~~$(W($(U/X)))>>>0;Sh(i,F>>>0>>0?G:F);F=f[s>>2]|0;G=F+-1|0;if(!(G&F)){Y=F;Z=G&K;break}if(K>>>0>>0){Y=F;Z=K}else{Y=F;Z=(K>>>0)%(F>>>0)|0}}else{Y=H;Z=Q}while(0);H=(f[i>>2]|0)+(Z<<2)|0;K=f[H>>2]|0;if(!K){f[J>>2]=f[v>>2];f[v>>2]=J;f[H>>2]=v;H=f[J>>2]|0;if(H|0){E=f[H+4>>2]|0;H=Y+-1|0;if(H&Y)if(E>>>0>>0)_=E;else _=(E>>>0)%(Y>>>0)|0;else _=E&H;aa=(f[i>>2]|0)+(_<<2)|0;R=44}}else{f[J>>2]=f[K>>2];aa=K;R=44}if((R|0)==44){R=0;f[aa>>2]=J}f[p>>2]=(f[p>>2]|0)+1}K=w;H=f[K>>2]|0;E=un(H|0,f[K+4>>2]|0,z|0,0)|0;kh((f[f[x>>2]>>2]|0)+E|0,j|0,H|0)|0;H=f[l>>2]|0;f[H+(y<<2)>>2]=z;ba=z+1|0;ca=H}else{H=f[l>>2]|0;f[H+(y<<2)>>2]=f[C+16>>2];ba=z;ca=H}y=y+1|0;da=f[o>>2]|0;if(y>>>0>=da>>>0)break;else z=ba}if((ba|0)==(da|0))ea=ca;else{z=a+84|0;if(!(b[z>>0]|0)){y=f[a+72>>2]|0;j=f[a+68>>2]|0;x=j;if((y|0)==(j|0))fa=ca;else{w=y-j>>2;j=0;do{y=x+(j<<2)|0;f[y>>2]=f[ca+(f[y>>2]<<2)>>2];j=j+1|0}while(j>>>0>>0);fa=ca}}else{b[z>>0]=0;z=a+68|0;ca=a+72|0;w=f[ca>>2]|0;j=f[z>>2]|0;x=w-j>>2;y=j;j=w;if(da>>>0<=x>>>0)if(da>>>0>>0?(w=y+(da<<2)|0,(w|0)!=(j|0)):0){f[ca>>2]=j+(~((j+-4-w|0)>>>2)<<2);ga=da}else ga=da;else{Ch(z,da-x|0,1220);ga=f[o>>2]|0}x=f[l>>2]|0;if(!ga)fa=x;else{l=f[a+68>>2]|0;a=0;do{f[l+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=x}}f[o>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[q>>2]|0;if((fa|0)!=(ea|0))f[q>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);Oq(ea);ha=ba}}else ha=0;ba=f[i+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;Oq(ba)}while((ea|0)!=0)}ea=f[i>>2]|0;f[i>>2]=0;if(!ea){u=g;return ha|0}Oq(ea);u=g;return ha|0}function kc(a,b){a=a|0;b=b|0;var c=0,d=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v>>2]|0)+(I>>>5<<2)|0;L=1<<(I&31);M=f[K>>2]|0;do if(!(M&L)){f[K>>2]=M|L;if(J){N=f[b>>2]|0;O=30;break}f[d>>2]=0;P=f[w>>2]|0;if((P|0)==(f[x>>2]|0))Ri(y,d);else{f[P>>2]=0;f[w>>2]=P+4}P=f[b>>2]|0;Q=P+1|0;if((P|0)!=-1?(R=((Q>>>0)%3|0|0)==0?P+-2|0:Q,(R|0)!=-1):0)S=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;else S=-1;f[b>>2]=S}else{N=G;O=30}while(0);if((O|0)==30){O=0;G=N+1|0;if((N|0)==-1){O=35;break}L=((G>>>0)%3|0|0)==0?N+-2|0:G;if((L|0)==-1)T=-1;else T=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;f[e>>2]=T;L=(((N>>>0)%3|0|0)==0?2:-1)+N|0;if((L|0)==-1)U=-1;else U=f[(f[(f[p>>2]|0)+12>>2]|0)+(L<<2)>>2]|0;L=(T|0)==-1;M=L?-1:(T>>>0)/3|0;V=(U|0)==-1;W=V?-1:(U>>>0)/3|0;K=((G>>>0)%3|0|0)==0?N+-2|0:G;if(((K|0)!=-1?(G=f[(f[p>>2]|0)+12>>2]|0,R=f[G+(K<<2)>>2]|0,(R|0)!=-1):0)?(K=(R>>>0)/3|0,R=f[n>>2]|0,(f[R+(K>>>5<<2)>>2]&1<<(K&31)|0)==0):0){K=(((N>>>0)%3|0|0)==0?2:-1)+N|0;do if((K|0)!=-1){Q=f[G+(K<<2)>>2]|0;if((Q|0)==-1)break;P=(Q>>>0)/3|0;if(!(f[R+(P>>>5<<2)>>2]&1<<(P&31))){O=63;break b}}while(0);if(!V)xf(a,f[i>>2]|0,H,0,W);f[d>>2]=3;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ri(y,d);else{f[R>>2]=3;f[w>>2]=R+4}X=f[e>>2]|0}else{if(!L){xf(a,f[i>>2]|0,H,1,M);R=f[b>>2]|0;if((R|0)==-1){O=44;break}else Y=R}else Y=N;R=(((Y>>>0)%3|0|0)==0?2:-1)+Y|0;if((R|0)==-1){O=44;break}K=f[(f[(f[p>>2]|0)+12>>2]|0)+(R<<2)>>2]|0;if((K|0)==-1){O=44;break}R=(K>>>0)/3|0;if(f[(f[n>>2]|0)+(R>>>5<<2)>>2]&1<<(R&31)|0){O=44;break}f[d>>2]=5;R=f[w>>2]|0;if((R|0)==(f[x>>2]|0))Ri(y,d);else{f[R>>2]=5;f[w>>2]=R+4}X=U}f[b>>2]=X}if((E|0)>=(k|0))break a;D=E;F=f[n>>2]|0}do if((O|0)==35){O=0;f[e>>2]=-1;O=46}else if((O|0)==44){O=0;if(V)O=46;else{xf(a,f[i>>2]|0,H,0,W);O=46}}else if((O|0)==63){O=0;f[d>>2]=1;F=f[w>>2]|0;if((F|0)==(f[x>>2]|0))Ri(y,d);else{f[F>>2]=1;f[w>>2]=F+4}f[z>>2]=(f[z>>2]|0)+1;if(J?(F=f[(f[t>>2]|0)+(I<<2)>>2]|0,(1<<(F&31)&f[(f[A>>2]|0)+(F>>>5<<2)>>2]|0)==0):0){f[g>>2]=f[b>>2];f[d>>2]=f[g>>2];Pe(a,d,0)|0}F=f[i>>2]|0;f[d>>2]=H;D=je(B,d)|0;f[D>>2]=F;F=f[j>>2]|0;f[F+-4>>2]=U;if((F|0)==(f[m>>2]|0)){Ri(h,e);break}else{f[F>>2]=f[e>>2];f[j>>2]=F+4;break}}while(0);if((O|0)==46){O=0;f[d>>2]=7;F=f[w>>2]|0;if((F|0)==(f[x>>2]|0))Ri(y,d);else{f[F>>2]=7;f[w>>2]=F+4}f[j>>2]=(f[j>>2]|0)+-4}}}else O=11;while(0);if((O|0)==11){O=0;f[j>>2]=C+-4}C=f[j>>2]|0}while((f[h>>2]|0)!=(C|0));u=c;return 1}function lc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0,t=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|(O&L|0)==(N|0))){Q=N;R=31;break a}O=M+8|0;if((((b[O>>0]|0)==A<<24>>24?(b[O+1>>0]|0)==D<<24>>24:0)?(b[O+2>>0]|0)==F<<24>>24:0)?(b[O+3>>0]|0)==H<<24>>24:0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(E|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(G>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}M=S+8|0;if((((b[M>>0]|0)==A<<24>>24?(b[M+1>>0]|0)==D<<24>>24:0)?(b[M+2>>0]|0)==F<<24>>24:0)?(b[M+3>>0]|0)==H<<24>>24:0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;H=ln(16)|0;F=H+8|0;D=B&-16776961|C<<16|J<<8;b[F>>0]=D;b[F+1>>0]=D>>8;b[F+2>>0]=D>>16;b[F+3>>0]=D>>24;f[H+12>>2]=y;f[H+4>>2]=E;f[H>>2]=0;U=$(((f[o>>2]|0)+1|0)>>>0);V=$(G>>>0);X=$(n[l>>2]);do if(K|$(X*V)>>0<3|(G+-1&G|0)!=0)&1;F=~~$(W($(U/X)))>>>0;Zh(g,D>>>0>>0?F:D);D=f[r>>2]|0;F=D+-1|0;if(!(F&D)){Y=D;Z=F&E;break}if(E>>>0>>0){Y=D;Z=E}else{Y=D;Z=(E>>>0)%(D>>>0)|0}}else{Y=G;Z=Q}while(0);G=(f[g>>2]|0)+(Z<<2)|0;E=f[G>>2]|0;if(!E){f[H>>2]=f[t>>2];f[t>>2]=H;f[G>>2]=t;G=f[H>>2]|0;if(G|0){K=f[G+4>>2]|0;G=Y+-1|0;if(G&Y)if(K>>>0>>0)_=K;else _=(K>>>0)%(Y>>>0)|0;else _=K&G;aa=(f[g>>2]|0)+(_<<2)|0;R=44}}else{f[H>>2]=f[E>>2];aa=E;R=44}if((R|0)==44){R=0;f[aa>>2]=H}f[o>>2]=(f[o>>2]|0)+1}E=v;G=f[E>>2]|0;K=un(G|0,f[E+4>>2]|0,y|0,0)|0;kh((f[f[w>>2]>>2]|0)+K|0,i|0,G|0)|0;G=f[k>>2]|0;f[G+(x<<2)>>2]=y;ba=y+1|0;ca=G}else{G=f[k>>2]|0;f[G+(x<<2)>>2]=f[z+12>>2];ba=y;ca=G}x=x+1|0;da=f[m>>2]|0;if(x>>>0>=da>>>0)break;else y=ba}if((ba|0)==(da|0))ea=ca;else{y=a+84|0;if(!(b[y>>0]|0)){x=f[a+72>>2]|0;i=f[a+68>>2]|0;w=i;if((x|0)==(i|0))fa=ca;else{v=x-i>>2;i=0;do{x=w+(i<<2)|0;f[x>>2]=f[ca+(f[x>>2]<<2)>>2];i=i+1|0}while(i>>>0>>0);fa=ca}}else{b[y>>0]=0;y=a+68|0;ca=a+72|0;v=f[ca>>2]|0;i=f[y>>2]|0;w=v-i>>2;x=i;i=v;if(da>>>0<=w>>>0)if(da>>>0>>0?(v=x+(da<<2)|0,(v|0)!=(i|0)):0){f[ca>>2]=i+(~((i+-4-v|0)>>>2)<<2);ga=da}else ga=da;else{Ch(y,da-w|0,1220);ga=f[m>>2]|0}w=f[k>>2]|0;if(!ga)fa=w;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[w+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=w}}f[m>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[p>>2]|0;if((fa|0)!=(ea|0))f[p>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);Oq(ea);ha=ba}}else ha=0;ba=f[g+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;Oq(ba)}while((ea|0)!=0)}ea=f[g>>2]|0;f[g>>2]=0;if(!ea){u=e;return ha|0}Oq(ea);u=e;return ha|0}function mc(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k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){if(M){M=P;while(1){O=f[M+4>>2]|0;if(!((O|0)==(H|0)|(O&L|0)==(N|0))){Q=N;R=31;break a}if((((f[M+8>>2]|0)==(B|0)?(f[M+12>>2]|0)==(E|0):0)?(f[M+16>>2]|0)==(F|0):0)?(f[M+20>>2]|0)==(G|0):0)break a;M=f[M>>2]|0;if(!M){Q=N;R=31;break a}}}else S=P;while(1){M=f[S+4>>2]|0;if((M|0)!=(H|0)){if(M>>>0>>0)T=M;else T=(M>>>0)%(J>>>0)|0;if((T|0)!=(N|0)){Q=N;R=31;break a}}if((((f[S+8>>2]|0)==(B|0)?(f[S+12>>2]|0)==(E|0):0)?(f[S+16>>2]|0)==(F|0):0)?(f[S+20>>2]|0)==(G|0):0)break a;S=f[S>>2]|0;if(!S){Q=N;R=31;break}}}else{Q=N;R=31}}else{Q=0;R=31}while(0);if((R|0)==31){R=0;D=ln(28)|0;f[D+8>>2]=B;f[D+12>>2]=E;f[D+16>>2]=F;f[D+20>>2]=G;f[D+24>>2]=z;f[D+4>>2]=H;f[D>>2]=0;U=$(((f[v>>2]|0)+1|0)>>>0);V=$(J>>>0);X=$(n[k>>2]);do if(K|$(X*V)>>0<3|(J+-1&J|0)!=0)&1;M=~~$(W($(U/X)))>>>0;Wh(g,P>>>0>>0?M:P);P=f[t>>2]|0;M=P+-1|0;if(!(M&P)){Y=P;Z=M&H;break}if(H>>>0

>>0){Y=P;Z=H}else{Y=P;Z=(H>>>0)%(P>>>0)|0}}else{Y=J;Z=Q}while(0);J=(f[g>>2]|0)+(Z<<2)|0;H=f[J>>2]|0;if(!H){f[D>>2]=f[w>>2];f[w>>2]=D;f[J>>2]=w;J=f[D>>2]|0;if(J|0){K=f[J+4>>2]|0;J=Y+-1|0;if(J&Y)if(K>>>0>>0)_=K;else _=(K>>>0)%(Y>>>0)|0;else _=K&J;aa=(f[g>>2]|0)+(_<<2)|0;R=44}}else{f[D>>2]=f[H>>2];aa=H;R=44}if((R|0)==44){R=0;f[aa>>2]=D}f[v>>2]=(f[v>>2]|0)+1}H=x;J=f[H>>2]|0;K=un(J|0,f[H+4>>2]|0,z|0,0)|0;kh((f[f[y>>2]>>2]|0)+K|0,h|0,J|0)|0;J=f[j>>2]|0;f[J+(A<<2)>>2]=z;ba=z+1|0;ca=J}else{J=f[j>>2]|0;f[J+(A<<2)>>2]=f[C+24>>2];ba=z;ca=J}A=A+1|0;da=f[l>>2]|0;if(A>>>0>=da>>>0)break;else z=ba}if((ba|0)==(da|0))ea=ca;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;h=f[a+68>>2]|0;y=h;if((A|0)==(h|0))fa=ca;else{x=A-h>>2;h=0;do{A=y+(h<<2)|0;f[A>>2]=f[ca+(f[A>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);fa=ca}}else{b[z>>0]=0;z=a+68|0;ca=a+72|0;x=f[ca>>2]|0;h=f[z>>2]|0;y=x-h>>2;A=h;h=x;if(da>>>0<=y>>>0)if(da>>>0>>0?(x=A+(da<<2)|0,(x|0)!=(h|0)):0){f[ca>>2]=h+(~((h+-4-x|0)>>>2)<<2);ga=da}else ga=da;else{Ch(z,da-y|0,1220);ga=f[l>>2]|0}y=f[j>>2]|0;if(!ga)fa=y;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);fa=y}}f[l>>2]=ba;ea=fa}if(!ea)ha=ba;else{fa=f[o>>2]|0;if((fa|0)!=(ea|0))f[o>>2]=fa+(~((fa+-4-ea|0)>>>2)<<2);Oq(ea);ha=ba}}else ha=0;ba=f[g+8>>2]|0;if(ba|0){ea=ba;do{ba=ea;ea=f[ea>>2]|0;Oq(ba)}while((ea|0)!=0)}ea=f[g>>2]|0;f[g>>2]=0;if(!ea){u=e;return ha|0}Oq(ea);u=e;return ha|0}function nc(a,c,e){a=a|0;c=c|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0,p=0,q=0,r=0,s=0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|0)!=0):0){if(K){K=N;while(1){M=f[K+4>>2]|0;if(!((M|0)==(F|0)|(M&J|0)==(L|0))){O=L;P=29;break a}M=K+8|0;if(((d[M>>1]|0)==B<<16>>16?(d[M+2>>1]|0)==C<<16>>16:0)?(d[K+12>>1]|0)==E<<16>>16:0)break a;K=f[K>>2]|0;if(!K){O=L;P=29;break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}K=Q+8|0;if(((d[K>>1]|0)==B<<16>>16?(d[K+2>>1]|0)==C<<16>>16:0)?(d[Q+12>>1]|0)==E<<16>>16:0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;N=ln(20)|0;d[N+8>>1]=B;d[N+10>>1]=C;d[N+12>>1]=E;f[N+16>>2]=z;f[N+4>>2]=F;f[N>>2]=0;S=$(((f[v>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[l>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;J=~~$(W($(S/U)))>>>0;Th(h,K>>>0>>0?J:K);K=f[t>>2]|0;J=K+-1|0;if(!(J&K)){V=K;X=J&F;break}if(F>>>0>>0){V=K;X=F}else{V=K;X=(F>>>0)%(K>>>0)|0}}else{V=G;X=O}while(0);G=(f[h>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[N>>2]=f[w>>2];f[w>>2]=N;f[G>>2]=w;G=f[N>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[h>>2]|0)+(Y<<2)|0;P=42}}else{f[N>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=N}f[v>>2]=(f[v>>2]|0)+1}F=x;G=f[F>>2]|0;H=un(G|0,f[F+4>>2]|0,z|0,0)|0;kh((f[f[y>>2]>>2]|0)+H|0,i|0,G|0)|0;G=f[k>>2]|0;f[G+(A<<2)>>2]=z;_=z+1|0;aa=G}else{G=f[k>>2]|0;f[G+(A<<2)>>2]=f[D+16>>2];_=z;aa=G}A=A+1|0;ba=f[m>>2]|0;if(A>>>0>=ba>>>0)break;else z=_}if((_|0)==(ba|0))ca=aa;else{z=a+84|0;if(!(b[z>>0]|0)){A=f[a+72>>2]|0;i=f[a+68>>2]|0;y=i;if((A|0)==(i|0))da=aa;else{x=A-i>>2;i=0;do{A=y+(i<<2)|0;f[A>>2]=f[aa+(f[A>>2]<<2)>>2];i=i+1|0}while(i>>>0>>0);da=aa}}else{b[z>>0]=0;z=a+68|0;aa=a+72|0;x=f[aa>>2]|0;i=f[z>>2]|0;y=x-i>>2;A=i;i=x;if(ba>>>0<=y>>>0)if(ba>>>0>>0?(x=A+(ba<<2)|0,(x|0)!=(i|0)):0){f[aa>>2]=i+(~((i+-4-x|0)>>>2)<<2);ea=ba}else ea=ba;else{Ch(z,ba-y|0,1220);ea=f[m>>2]|0}y=f[k>>2]|0;if(!ea)da=y;else{k=f[a+68>>2]|0;a=0;do{f[k+(a<<2)>>2]=f[y+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=y}}f[m>>2]=_;ca=da}if(!ca)fa=_;else{da=f[p>>2]|0;if((da|0)!=(ca|0))f[p>>2]=da+(~((da+-4-ca|0)>>>2)<<2);Oq(ca);fa=_}}else fa=0;_=f[h+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;Oq(_)}while((ca|0)!=0)}ca=f[h>>2]|0;f[h>>2]=0;if(!ca){u=g;return fa|0}Oq(ca);u=g;return fa|0}function oc(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x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!=(e|0))}}N=D+1|0}else N=D}else N=D;J=(((E>>>0)%3|0|0)==0?2:-1)+E|0;do if((J|0)!=-1?(H=f[p+(J<<2)>>2]|0,(H|0)!=-1):0)if(!((H>>>0)%3|0)){O=H+2|0;break}else{O=H+-1|0;break}else O=-1;while(0);E=(O|0)==(z|0)?-1:O;if((E|0)==-1)break;else D=N}D=X(B,e)|0;if(N){if(q){E=0;do{z=j+(E<<2)|0;f[z>>2]=(f[z>>2]|0)/(N|0)|0;E=E+1|0}while((E|0)!=(e|0))}E=b+(D<<2)|0;z=c+(D<<2)|0;p=f[g>>2]|0;if((p|0)>0){J=0;H=j;I=p;while(1){if((I|0)>0){p=0;do{K=f[H+(p<<2)>>2]|0;G=f[r>>2]|0;if((K|0)>(G|0)){F=f[s>>2]|0;f[F+(p<<2)>>2]=G;P=F}else{F=f[t>>2]|0;G=f[s>>2]|0;f[G+(p<<2)>>2]=(K|0)<(F|0)?F:K;P=G}p=p+1|0}while((p|0)<(f[g>>2]|0));Q=P}else Q=f[s>>2]|0;p=(f[E+(J<<2)>>2]|0)-(f[Q+(J<<2)>>2]|0)|0;G=z+(J<<2)|0;f[G>>2]=p;if((p|0)>=(f[u>>2]|0)){if((p|0)>(f[w>>2]|0)){R=p-(f[v>>2]|0)|0;S=57}}else{R=(f[v>>2]|0)+p|0;S=57}if((S|0)==57){S=0;f[G>>2]=R}J=J+1|0;I=f[g>>2]|0;if((J|0)>=(I|0))break;else H=Q}}}else{T=D;S=30}}else{T=X(B,e)|0;S=30}if((S|0)==30?(S=0,H=b+(T<<2)|0,I=c+(T<<2)|0,J=f[g>>2]|0,(J|0)>0):0){z=0;E=b+((X(A+-2|0,e)|0)<<2)|0;G=J;while(1){if((G|0)>0){J=0;do{p=f[E+(J<<2)>>2]|0;K=f[r>>2]|0;if((p|0)>(K|0)){F=f[s>>2]|0;f[F+(J<<2)>>2]=K;U=F}else{F=f[t>>2]|0;K=f[s>>2]|0;f[K+(J<<2)>>2]=(p|0)<(F|0)?F:p;U=K}J=J+1|0}while((J|0)<(f[g>>2]|0));V=U}else V=f[s>>2]|0;J=(f[H+(z<<2)>>2]|0)-(f[V+(z<<2)>>2]|0)|0;K=I+(z<<2)|0;f[K>>2]=J;if((J|0)>=(f[u>>2]|0)){if((J|0)>(f[w>>2]|0)){W=J-(f[v>>2]|0)|0;S=42}}else{W=(f[v>>2]|0)+J|0;S=42}if((S|0)==42){S=0;f[K>>2]=W}z=z+1|0;G=f[g>>2]|0;if((z|0)>=(G|0))break;else E=V}}if((A|0)<=2)break a;C=f[i>>2]|0;E=B+-1|0;if((f[l>>2]|0)-C>>2>>>0<=E>>>0)break;else{G=B;B=E;A=G}}aq(i)}while(0);if((e|0)>0)sj(j|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(k);Mq(j);return 1}i=a+16|0;A=a+32|0;B=a+12|0;C=a+28|0;l=a+20|0;V=a+24|0;a=0;W=j;U=e;while(1){if((U|0)>0){e=0;do{T=f[W+(e<<2)>>2]|0;Q=f[i>>2]|0;if((T|0)>(Q|0)){R=f[A>>2]|0;f[R+(e<<2)>>2]=Q;Y=R}else{R=f[B>>2]|0;Q=f[A>>2]|0;f[Q+(e<<2)>>2]=(T|0)<(R|0)?R:T;Y=Q}e=e+1|0}while((e|0)<(f[g>>2]|0));Z=Y}else Z=f[A>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[Z+(a<<2)>>2]|0)|0;Q=c+(a<<2)|0;f[Q>>2]=e;if((e|0)>=(f[C>>2]|0)){if((e|0)>(f[V>>2]|0)){_=e-(f[l>>2]|0)|0;S=72}}else{_=(f[l>>2]|0)+e|0;S=72}if((S|0)==72){S=0;f[Q>>2]=_}a=a+1|0;U=f[g>>2]|0;if((a|0)>=(U|0))break;else W=Z}Mq(k);Mq(j);return 1}function pc(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r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]|0)+(f[k+(K<<2)>>2]|0);K=K+1|0}while((K|0)!=(e|0))}}M=E+1|0}else M=E;K=(((F>>>0)%3|0|0)==0?2:-1)+F|0;do if(((K|0)!=-1?(f[p+(K>>>5<<2)>>2]&1<<(K&31)|0)==0:0)?(G=f[(f[(f[x>>2]|0)+12>>2]|0)+(K<<2)>>2]|0,(G|0)!=-1):0)if(!((G>>>0)%3|0)){N=G+2|0;break}else{N=G+-1|0;break}else N=-1;while(0);F=(N|0)==(A|0)?-1:N;if((F|0)==-1)break;else E=M}E=X(C,e)|0;if(M){if(q){F=0;do{A=j+(F<<2)|0;f[A>>2]=(f[A>>2]|0)/(M|0)|0;F=F+1|0}while((F|0)!=(e|0))}F=b+(E<<2)|0;A=c+(E<<2)|0;p=f[g>>2]|0;if((p|0)>0){K=0;G=j;J=p;while(1){if((J|0)>0){p=0;do{L=f[G+(p<<2)>>2]|0;H=f[r>>2]|0;if((L|0)>(H|0)){I=f[s>>2]|0;f[I+(p<<2)>>2]=H;O=I}else{I=f[t>>2]|0;H=f[s>>2]|0;f[H+(p<<2)>>2]=(L|0)<(I|0)?I:L;O=H}p=p+1|0}while((p|0)<(f[g>>2]|0));P=O}else P=f[s>>2]|0;p=(f[F+(K<<2)>>2]|0)-(f[P+(K<<2)>>2]|0)|0;H=A+(K<<2)|0;f[H>>2]=p;if((p|0)>=(f[u>>2]|0)){if((p|0)>(f[w>>2]|0)){Q=p-(f[v>>2]|0)|0;R=55}}else{Q=(f[v>>2]|0)+p|0;R=55}if((R|0)==55){R=0;f[H>>2]=Q}K=K+1|0;J=f[g>>2]|0;if((K|0)>=(J|0))break;else G=P}}}else{S=E;R=28}}else{S=X(C,e)|0;R=28}if((R|0)==28?(R=0,G=b+(S<<2)|0,J=c+(S<<2)|0,K=f[g>>2]|0,(K|0)>0):0){A=0;F=b+((X(B+-2|0,e)|0)<<2)|0;H=K;while(1){if((H|0)>0){K=0;do{p=f[F+(K<<2)>>2]|0;L=f[r>>2]|0;if((p|0)>(L|0)){I=f[s>>2]|0;f[I+(K<<2)>>2]=L;T=I}else{I=f[t>>2]|0;L=f[s>>2]|0;f[L+(K<<2)>>2]=(p|0)<(I|0)?I:p;T=L}K=K+1|0}while((K|0)<(f[g>>2]|0));U=T}else U=f[s>>2]|0;K=(f[G+(A<<2)>>2]|0)-(f[U+(A<<2)>>2]|0)|0;L=J+(A<<2)|0;f[L>>2]=K;if((K|0)>=(f[u>>2]|0)){if((K|0)>(f[w>>2]|0)){V=K-(f[v>>2]|0)|0;R=40}}else{V=(f[v>>2]|0)+K|0;R=40}if((R|0)==40){R=0;f[L>>2]=V}A=A+1|0;H=f[g>>2]|0;if((A|0)>=(H|0))break;else F=U}}if((B|0)<=2)break a;D=f[i>>2]|0;F=C+-1|0;if((f[l>>2]|0)-D>>2>>>0<=F>>>0)break;else{H=C;C=F;B=H}}aq(i)}while(0);if((e|0)>0)sj(j|0,0,e<<2|0)|0;e=f[g>>2]|0;if((e|0)<=0){Mq(k);Mq(j);return 1}i=a+16|0;B=a+32|0;C=a+12|0;D=a+28|0;l=a+20|0;U=a+24|0;a=0;V=j;T=e;while(1){if((T|0)>0){e=0;do{S=f[V+(e<<2)>>2]|0;P=f[i>>2]|0;if((S|0)>(P|0)){Q=f[B>>2]|0;f[Q+(e<<2)>>2]=P;W=Q}else{Q=f[C>>2]|0;P=f[B>>2]|0;f[P+(e<<2)>>2]=(S|0)<(Q|0)?Q:S;W=P}e=e+1|0}while((e|0)<(f[g>>2]|0));Y=W}else Y=f[B>>2]|0;e=(f[b+(a<<2)>>2]|0)-(f[Y+(a<<2)>>2]|0)|0;P=c+(a<<2)|0;f[P>>2]=e;if((e|0)>=(f[D>>2]|0)){if((e|0)>(f[U>>2]|0)){Z=e-(f[l>>2]|0)|0;R=70}}else{Z=(f[l>>2]|0)+e|0;R=70}if((R|0)==70){R=0;f[P>>2]=Z}a=a+1|0;T=f[g>>2]|0;if((a|0)>=(T|0))break;else V=Y}Mq(k);Mq(j);return 1}function qc(a,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?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(q=(N|0)==(ca|0),!(M&q)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(q&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);N=K<<1;M=b+(N<<2)|0;H=M+4|0;O=f[H>>2]|0;f[h>>2]=f[M>>2];f[x>>2]=O;f[i>>2]=$;f[y>>2]=aa;Od(d,n,h,i);O=f[d>>2]|0;f[k>>2]=O;P=f[z>>2]|0;f[A>>2]=P;q=f[H>>2]|0;f[h>>2]=f[M>>2];f[B>>2]=q;f[i>>2]=da;f[C>>2]=ea;Od(d,n,h,i);q=f[d>>2]|0;f[l>>2]=q;M=f[D>>2]|0;f[E>>2]=M;H=f[v>>2]|0;if((H|0)>=(O|0))if((O|0)<(0-H|0))fa=(f[F>>2]|0)+O|0;else fa=O;else fa=O-(f[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0)+M|0;else ia=M;else ia=M-(f[F>>2]|0)|0;f[G>>2]=ia;if((((ga|0)>-1?ga:0-ga|0)+((fa|0)>-1?fa:0-fa|0)|0)<(((ha|0)>-1?ha:0-ha|0)+((ia|0)>-1?ia:0-ia|0)|0)){fj(g,0);ja=k}else{fj(g,1);ja=l}M=f[ja>>2]|0;if((M|0)<0)ka=(f[F>>2]|0)+M|0;else ka=M;M=c+(N<<2)|0;f[M>>2]=ka;N=f[ja+4>>2]|0;if((N|0)<0)la=(f[F>>2]|0)+N|0;else la=N;f[M+4>>2]=la;K=K+1|0;if((K|0)>=(s|0)){ma=5;break}M=f[p>>2]|0;L=f[M>>2]|0;if((f[M+4>>2]|0)-L>>2>>>0<=K>>>0){J=M;ma=6;break}}if((ma|0)==5){u=e;return 1}else if((ma|0)==6)aq(J);return 0}function rc(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0;c=u;u=u+48|0;d=c+24|0;e=c+12|0;g=c;if(!b){h=0;u=c;return h|0}i=a+12|0;j=a+4|0;k=f[j>>2]|0;l=f[a>>2]|0;m=k-l>>2;n=a+16|0;o=f[n>>2]|0;p=f[i>>2]|0;q=o-p>>2;r=p;p=o;if(m>>>0<=q>>>0)if(m>>>0>>0?(o=r+(m<<2)|0,(o|0)!=(p|0)):0){f[n>>2]=p+(~((p+-4-o|0)>>>2)<<2);s=l;t=k}else{s=l;t=k}else{Ch(i,m-q|0,6140);s=f[a>>2]|0;t=f[j>>2]|0}f[d>>2]=0;q=d+4|0;f[q>>2]=0;f[d+8>>2]=0;gk(d,t-s>>2);s=f[j>>2]|0;t=f[a>>2]|0;if((s|0)==(t|0)){v=s;w=s}else{m=f[d>>2]|0;k=m;l=k;o=0;p=s;s=k;k=t;t=m;while(1){m=f[k+(o<<2)>>2]|0;n=f[q>>2]|0;if(m>>>0>2>>>0){x=l;y=s;z=k;A=p}else{r=m+1|0;f[e>>2]=0;B=n-t>>2;C=t;D=n;if(r>>>0<=B>>>0)if(r>>>0>>0?(n=C+(r<<2)|0,(n|0)!=(D|0)):0){f[q>>2]=D+(~((D+-4-n|0)>>>2)<<2);E=l;F=p;G=k}else{E=l;F=p;G=k}else{Ch(d,r-B|0,e);E=f[d>>2]|0;F=f[j>>2]|0;G=f[a>>2]|0}x=E;y=E;z=G;A=F}B=y+(m<<2)|0;f[B>>2]=(f[B>>2]|0)+1;o=o+1|0;if(o>>>0>=A-z>>2>>>0){v=z;w=A;break}else{l=x;p=A;s=y;k=z;t=y}}}y=w-v|0;v=y>>2;f[e>>2]=0;w=e+4|0;f[w>>2]=0;f[e+8>>2]=0;if(!v){H=0;I=0}else{if(v>>>0>536870911)aq(e);t=ln(y<<1)|0;f[w>>2]=t;f[e>>2]=t;y=t+(v<<3)|0;f[e+8>>2]=y;z=v;v=t;k=t;while(1){s=v;f[s>>2]=-1;f[s+4>>2]=-1;s=k+8|0;A=z+-1|0;if(!A)break;else{z=A;v=s;k=s}}f[w>>2]=y;H=t;I=t}t=f[q>>2]|0;y=f[d>>2]|0;k=t-y|0;v=k>>2;f[g>>2]=0;z=g+4|0;f[z>>2]=0;f[g+8>>2]=0;s=y;do if(v)if(v>>>0>1073741823)aq(g);else{A=ln(k)|0;f[g>>2]=A;p=A+(v<<2)|0;f[g+8>>2]=p;sj(A|0,0,k|0)|0;f[z>>2]=p;J=A;K=p;L=A;break}else{J=0;K=0;L=0}while(0);if((t|0)!=(y|0)){y=0;t=0;while(1){f[J+(t<<2)>>2]=y;k=t+1|0;if(k>>>0>>0){y=(f[s+(t<<2)>>2]|0)+y|0;t=k}else break}}t=f[j>>2]|0;j=f[a>>2]|0;y=j;if((t|0)!=(j|0)){k=a+40|0;a=t-j>>2;j=H;t=H;g=H;A=H;p=H;x=H;l=0;o=J;while(1){F=f[y+(l<<2)>>2]|0;G=l+1|0;E=((G>>>0)%3|0|0)==0?l+-2|0:G;if((E|0)==-1)M=-1;else M=f[y+(E<<2)>>2]|0;E=((l>>>0)%3|0|0)==0;G=(E?2:-1)+l|0;if((G|0)==-1)N=-1;else N=f[y+(G<<2)>>2]|0;if(E?(M|0)==(N|0)|((F|0)==(M|0)|(F|0)==(N|0)):0){f[k>>2]=(f[k>>2]|0)+1;O=j;P=t;Q=g;R=A;S=p;T=x;U=l+2|0;V=o}else W=51;a:do if((W|0)==51){W=0;E=f[s+(N<<2)>>2]|0;b:do if((E|0)>0){G=0;B=f[o+(N<<2)>>2]|0;while(1){m=f[p+(B<<3)>>2]|0;if((m|0)==-1){X=j;Y=t;Z=A;_=p;break b}if((m|0)==(M|0)){m=f[p+(B<<3)+4>>2]|0;if((m|0)==-1)$=-1;else $=f[y+(m<<2)>>2]|0;if((F|0)!=($|0))break}m=G+1|0;if((m|0)<(E|0)){G=m;B=B+1|0}else{X=j;Y=t;Z=A;_=p;break b}}m=f[A+(B<<3)+4>>2]|0;r=G;n=B;D=t;while(1){r=r+1|0;if((r|0)>=(E|0))break;C=n+1|0;f[D+(n<<3)>>2]=f[D+(C<<3)>>2];f[D+(n<<3)+4>>2]=f[D+(C<<3)+4>>2];if((f[j+(n<<3)>>2]|0)==-1)break;else{n=C;D=j}}f[g+(n<<3)>>2]=-1;if((m|0)==-1){X=g;Y=g;Z=g;_=g}else{D=f[i>>2]|0;f[D+(l<<2)>>2]=m;f[D+(m<<2)>>2]=l;O=g;P=g;Q=g;R=g;S=g;T=x;U=l;V=o;break a}}else{X=j;Y=t;Z=A;_=p}while(0);E=f[s+(M<<2)>>2]|0;if((E|0)>0){D=0;r=f[J+(M<<2)>>2]|0;while(1){aa=x+(r<<3)|0;if((f[aa>>2]|0)==-1)break;D=D+1|0;if((D|0)>=(E|0)){O=x;P=x;Q=x;R=x;S=x;T=x;U=l;V=J;break a}else r=r+1|0}f[aa>>2]=N;f[H+(r<<3)+4>>2]=l;O=H;P=H;Q=H;R=H;S=H;T=H;U=l;V=J}else{O=X;P=Y;Q=g;R=Z;S=_;T=x;U=l;V=o}}while(0);l=U+1|0;if(l>>>0>=a>>>0)break;else{j=O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>>0]=b[C>>0]|0;b[h+1>>0]=b[C+1>>0]|0;b[h+2>>0]=b[C+2>>0]|0;im(i|0,C|0,3)|0;C=jg(g,i)|0;if(!C){A=b[i>>0]|0;B=b[q>>0]|0;D=b[m>>0]|0;E=((A&255^318)+239^B&255)+239^D&255;F=f[s>>2]|0;G=(F|0)==0;a:do if(!G){H=F+-1|0;J=(H&F|0)==0;if(!J)if(E>>>0>>0)K=E;else K=(E>>>0)%(F>>>0)|0;else K=E&H;L=f[(f[g>>2]|0)+(K<<2)>>2]|0;if((L|0)!=0?(M=f[L>>2]|0,(M|0)!=0):0){if(J){J=M;while(1){L=f[J+4>>2]|0;if(!((L|0)==(E|0)|(L&H|0)==(K|0))){N=K;O=29;break a}L=J+8|0;if(((b[L>>0]|0)==A<<24>>24?(b[L+1>>0]|0)==B<<24>>24:0)?(b[L+2>>0]|0)==D<<24>>24:0)break a;J=f[J>>2]|0;if(!J){N=K;O=29;break a}}}else P=M;while(1){J=f[P+4>>2]|0;if((J|0)!=(E|0)){if(J>>>0>>0)Q=J;else Q=(J>>>0)%(F>>>0)|0;if((Q|0)!=(K|0)){N=K;O=29;break a}}J=P+8|0;if(((b[J>>0]|0)==A<<24>>24?(b[J+1>>0]|0)==B<<24>>24:0)?(b[J+2>>0]|0)==D<<24>>24:0)break a;P=f[P>>2]|0;if(!P){N=K;O=29;break}}}else{N=K;O=29}}else{N=0;O=29}while(0);if((O|0)==29){O=0;M=ln(16)|0;b[M+8>>0]=A;b[M+9>>0]=B;b[M+10>>0]=D;f[M+12>>2]=z;f[M+4>>2]=E;f[M>>2]=0;R=$(((f[t>>2]|0)+1|0)>>>0);S=$(F>>>0);T=$(n[k>>2]);do if(G|$(T*S)>>0<3|(F+-1&F|0)!=0)&1;H=~~$(W($(R/T)))>>>0;_h(g,J>>>0>>0?H:J);J=f[s>>2]|0;H=J+-1|0;if(!(H&J)){U=J;V=H&E;break}if(E>>>0>>0){U=J;V=E}else{U=J;V=(E>>>0)%(J>>>0)|0}}else{U=F;V=N}while(0);F=(f[g>>2]|0)+(V<<2)|0;E=f[F>>2]|0;if(!E){f[M>>2]=f[v>>2];f[v>>2]=M;f[F>>2]=v;F=f[M>>2]|0;if(F|0){G=f[F+4>>2]|0;F=U+-1|0;if(F&U)if(G>>>0>>0)X=G;else X=(G>>>0)%(U>>>0)|0;else X=G&F;Y=(f[g>>2]|0)+(X<<2)|0;O=42}}else{f[M>>2]=f[E>>2];Y=E;O=42}if((O|0)==42){O=0;f[Y>>2]=M}f[t>>2]=(f[t>>2]|0)+1}E=w;F=f[E>>2]|0;G=un(F|0,f[E+4>>2]|0,z|0,0)|0;kh((f[f[x>>2]>>2]|0)+G|0,h|0,F|0)|0;F=f[j>>2]|0;f[F+(y<<2)>>2]=z;Z=z+1|0;_=F}else{F=f[j>>2]|0;f[F+(y<<2)>>2]=f[C+12>>2];Z=z;_=F}y=y+1|0;aa=f[l>>2]|0;if(y>>>0>=aa>>>0)break;else z=Z}if((Z|0)==(aa|0))ba=_;else{z=a+84|0;if(!(b[z>>0]|0)){y=f[a+72>>2]|0;h=f[a+68>>2]|0;x=h;if((y|0)==(h|0))ca=_;else{w=y-h>>2;h=0;do{y=x+(h<<2)|0;f[y>>2]=f[_+(f[y>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);ca=_}}else{b[z>>0]=0;z=a+68|0;_=a+72|0;w=f[_>>2]|0;h=f[z>>2]|0;x=w-h>>2;y=h;h=w;if(aa>>>0<=x>>>0)if(aa>>>0>>0?(w=y+(aa<<2)|0,(w|0)!=(h|0)):0){f[_>>2]=h+(~((h+-4-w|0)>>>2)<<2);da=aa}else da=aa;else{Ch(z,aa-x|0,1220);da=f[l>>2]|0}x=f[j>>2]|0;if(!da)ca=x;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);ca=x}}f[l>>2]=Z;ba=ca}if(!ba)ea=Z;else{ca=f[o>>2]|0;if((ca|0)!=(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else{$=Z;aa=Y}}else{$=Z;aa=Z}}else{$=Y;aa=Y}}else{$=N;aa=N}while(0);P=0-S|0;M=0-_|0;f[j>>2]=0-O;f[r>>2]=P;f[t>>2]=M;if((O|0)<1){ba=T-_|0;ca=T-S|0}else{H=(_|0)<1?M:_;M=(S|0)<1?P:S;ba=(_|0)>0?M:N-M|0;ca=(S|0)>0?H:N-H|0}H=(ca|0)==0;M=(ba|0)==0;do if(((ba|ca|0)!=0?(P=(N|0)==(ba|0),!(H&P)):0)?(q=(N|0)==(ca|0),!(M&q)):0){if(H&(T|0)<(ba|0)){da=0;ea=(T<<1)-ba|0;break}if(q&(T|0)>(ba|0)){da=N;ea=(T<<1)-ba|0;break}if(P&(T|0)>(ca|0)){da=(T<<1)-ca|0;ea=N;break}if(M){da=(T|0)<(ca|0)?(T<<1)-ca|0:ca;ea=0}else{da=ca;ea=ba}}else{da=N;ea=N}while(0);N=K<<1;M=b+(N<<2)|0;H=M+4|0;O=f[H>>2]|0;f[h>>2]=f[M>>2];f[x>>2]=O;f[i>>2]=$;f[y>>2]=aa;Od(d,n,h,i);O=f[d>>2]|0;f[k>>2]=O;P=f[z>>2]|0;f[A>>2]=P;q=f[H>>2]|0;f[h>>2]=f[M>>2];f[B>>2]=q;f[i>>2]=da;f[C>>2]=ea;Od(d,n,h,i);q=f[d>>2]|0;f[l>>2]=q;M=f[D>>2]|0;f[E>>2]=M;H=f[v>>2]|0;if((H|0)>=(O|0))if((O|0)<(0-H|0))fa=(f[F>>2]|0)+O|0;else fa=O;else fa=O-(f[F>>2]|0)|0;f[k>>2]=fa;if((H|0)>=(P|0))if((P|0)<(0-H|0))ga=(f[F>>2]|0)+P|0;else ga=P;else ga=P-(f[F>>2]|0)|0;f[a>>2]=ga;if((H|0)>=(q|0))if((q|0)<(0-H|0))ha=(f[F>>2]|0)+q|0;else ha=q;else ha=q-(f[F>>2]|0)|0;f[l>>2]=ha;if((H|0)>=(M|0))if((M|0)<(0-H|0))ia=(f[F>>2]|0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;z=0;while(1){A=d;B=f[A>>2]|0;C=f[A+4>>2]|0;A=p;D=un(f[A>>2]|0,f[A+4>>2]|0,r+z|0,0)|0;A=Vn(D|0,I|0,B|0,C|0)|0;C=(f[f[c>>2]>>2]|0)+A|0;A=h;B=C;D=A+12|0;do{b[A>>0]=b[B>>0]|0;A=A+1|0;B=B+1|0}while((A|0)<(D|0));im(i|0,C|0,12)|0;B=qg(g,i)|0;if(!B){A=f[i>>2]|0;D=f[q>>2]|0;E=f[m>>2]|0;F=((A^318)+239^D)+239^E;G=f[s>>2]|0;H=(G|0)==0;a:do if(!H){J=G+-1|0;K=(J&G|0)==0;if(!K)if(F>>>0>>0)L=F;else L=(F>>>0)%(G>>>0)|0;else L=F&J;M=f[(f[g>>2]|0)+(L<<2)>>2]|0;if((M|0)!=0?(N=f[M>>2]|0,(N|0)!=0):0){if(K){K=N;while(1){M=f[K+4>>2]|0;if(!((M|0)==(F|0)|(M&J|0)==(L|0))){O=L;P=29;break a}if(((f[K+8>>2]|0)==(A|0)?(f[K+12>>2]|0)==(D|0):0)?(f[K+16>>2]|0)==(E|0):0)break a;K=f[K>>2]|0;if(!K){O=L;P=29;break a}}}else Q=N;while(1){K=f[Q+4>>2]|0;if((K|0)!=(F|0)){if(K>>>0>>0)R=K;else R=(K>>>0)%(G>>>0)|0;if((R|0)!=(L|0)){O=L;P=29;break a}}if(((f[Q+8>>2]|0)==(A|0)?(f[Q+12>>2]|0)==(D|0):0)?(f[Q+16>>2]|0)==(E|0):0)break a;Q=f[Q>>2]|0;if(!Q){O=L;P=29;break}}}else{O=L;P=29}}else{O=0;P=29}while(0);if((P|0)==29){P=0;C=ln(24)|0;f[C+8>>2]=A;f[C+12>>2]=D;f[C+16>>2]=E;f[C+20>>2]=y;f[C+4>>2]=F;f[C>>2]=0;S=$(((f[t>>2]|0)+1|0)>>>0);T=$(G>>>0);U=$(n[k>>2]);do if(H|$(U*T)>>0<3|(G+-1&G|0)!=0)&1;K=~~$(W($(S/U)))>>>0;Xh(g,N>>>0>>0?K:N);N=f[s>>2]|0;K=N+-1|0;if(!(K&N)){V=N;X=K&F;break}if(F>>>0>>0){V=N;X=F}else{V=N;X=(F>>>0)%(N>>>0)|0}}else{V=G;X=O}while(0);G=(f[g>>2]|0)+(X<<2)|0;F=f[G>>2]|0;if(!F){f[C>>2]=f[v>>2];f[v>>2]=C;f[G>>2]=v;G=f[C>>2]|0;if(G|0){H=f[G+4>>2]|0;G=V+-1|0;if(G&V)if(H>>>0>>0)Y=H;else Y=(H>>>0)%(V>>>0)|0;else Y=H&G;Z=(f[g>>2]|0)+(Y<<2)|0;P=42}}else{f[C>>2]=f[F>>2];Z=F;P=42}if((P|0)==42){P=0;f[Z>>2]=C}f[t>>2]=(f[t>>2]|0)+1}F=w;G=f[F>>2]|0;H=un(G|0,f[F+4>>2]|0,y|0,0)|0;kh((f[f[x>>2]>>2]|0)+H|0,h|0,G|0)|0;G=f[j>>2]|0;f[G+(z<<2)>>2]=y;_=y+1|0;aa=G}else{G=f[j>>2]|0;f[G+(z<<2)>>2]=f[B+20>>2];_=y;aa=G}z=z+1|0;ba=f[l>>2]|0;if(z>>>0>=ba>>>0)break;else y=_}if((_|0)==(ba|0))ca=aa;else{y=a+84|0;if(!(b[y>>0]|0)){z=f[a+72>>2]|0;h=f[a+68>>2]|0;x=h;if((z|0)==(h|0))da=aa;else{w=z-h>>2;h=0;do{z=x+(h<<2)|0;f[z>>2]=f[aa+(f[z>>2]<<2)>>2];h=h+1|0}while(h>>>0>>0);da=aa}}else{b[y>>0]=0;y=a+68|0;aa=a+72|0;w=f[aa>>2]|0;h=f[y>>2]|0;x=w-h>>2;z=h;h=w;if(ba>>>0<=x>>>0)if(ba>>>0>>0?(w=z+(ba<<2)|0,(w|0)!=(h|0)):0){f[aa>>2]=h+(~((h+-4-w|0)>>>2)<<2);ea=ba}else ea=ba;else{Ch(y,ba-x|0,1220);ea=f[l>>2]|0}x=f[j>>2]|0;if(!ea)da=x;else{j=f[a+68>>2]|0;a=0;do{f[j+(a<<2)>>2]=f[x+(a<<2)>>2];a=a+1|0}while(a>>>0>>0);da=x}}f[l>>2]=_;ca=da}if(!ca)fa=_;else{da=f[o>>2]|0;if((da|0)!=(ca|0))f[o>>2]=da+(~((da+-4-ca|0)>>>2)<<2);Oq(ca);fa=_}}else fa=0;_=f[g+8>>2]|0;if(_|0){ca=_;do{_=ca;ca=f[ca>>2]|0;Oq(_)}while((ca|0)!=0)}ca=f[g>>2]|0;f[g>>2]=0;if(!ca){u=e;return fa|0}Oq(ca);u=e;return fa|0} -function di(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;Je(e,a+40|0,f[a+8>>2]|0,b,c);gj(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(b)}Oq(a);u=d;return 1}function ei(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Bd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Bd(a,e);return}function fi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0;e=u;u=u+48|0;g=e;h=e+32|0;if(!c){i=0;u=e;return i|0}Gn(g);if((dm(c,0)|0)!=-1?Qa[f[(f[c>>2]|0)+16>>2]&127](c)|0:0){Va[f[(f[c>>2]|0)+20>>2]&127](c);ch(h,a,c,g);c=(f[h>>2]|0)==0;a=h+4|0;if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);if(c){c=f[g>>2]|0;a=g+4|0;rg(d,c,c+((f[a>>2]|0)-c)|0);j=(f[a>>2]|0)-(f[g>>2]|0)|0}else j=0}else j=0;a=g+12|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0)Oq(c);c=f[g>>2]|0;if(c|0){a=g+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;Oq(c)}i=j;u=e;return i|0}function gi(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;Fe(e,a+40|0,f[a+8>>2]|0,b,c);gj(a,e);a=f[e>>2]|0;f[e>>2]=0;if(!a){u=d;return 1}e=a+88|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0){e=f[c+8>>2]|0;if(e|0){b=c+12|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e)}Oq(c)}c=f[a+68>>2]|0;if(c|0){e=a+72|0;b=f[e>>2]|0;if((b|0)!=(c|0))f[e>>2]=b+(~((b+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;b=f[c>>2]|0;f[c>>2]=0;if(b|0){c=f[b>>2]|0;if(c|0){e=b+4|0;if((f[e>>2]|0)!=(c|0))f[e>>2]=c;Oq(c)}Oq(b)}Oq(a);u=d;return 1}function hi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{d=g+-4|0;f[c>>2]=d;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=h+88|0;i=f[d>>2]|0;f[d>>2]=0;if(i|0){d=f[i+8>>2]|0;if(d|0){j=i+12|0;if((f[j>>2]|0)!=(d|0))f[j>>2]=d;Oq(d)}Oq(i)}i=f[h+68>>2]|0;if(i|0){d=h+72|0;j=f[d>>2]|0;if((j|0)!=(i|0))f[d>>2]=j+(~((j+-4-i|0)>>>2)<<2);Oq(i)}i=h+64|0;j=f[i>>2]|0;f[i>>2]=0;if(j|0){i=f[j>>2]|0;if(i|0){d=j+4|0;if((f[d>>2]|0)!=(i|0))f[d>>2]=i;Oq(i)}Oq(j)}Oq(h)}g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}Oq(e);return}function ii(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;if(!(Ie(a,c)|0)){i=0;u=d;return i|0}j=a+36|0;k=a+40|0;a=f[j>>2]|0;if((f[k>>2]|0)==(a|0)){i=1;u=d;return i|0}l=c+16|0;m=c+4|0;n=h+1|0;o=0;p=a;do{a=f[p+(o<<2)>>2]|0;q=Qa[f[(f[a>>2]|0)+32>>2]&127](a)|0;b[h>>0]=q;q=l;a=f[q+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[q>>2]|0)>>>0>0)){f[g>>2]=f[m>>2];f[e>>2]=f[g>>2];Me(c,e,h,n)|0}o=o+1|0;p=f[j>>2]|0}while(o>>>0<(f[k>>2]|0)-p>>2>>>0);i=1;u=d;return i|0}function ji(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=u;u=u+16|0;d=c;lp(a);f[a+16>>2]=0;f[a+20>>2]=0;f[a+12>>2]=a+16;e=a+24|0;lp(e);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=ln(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=20;g=a;h=14538;i=g+20|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+20>>0]=0;Vj(e,d,1);if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;a=ln(32)|0;f[d>>2]=a;f[d+8>>2]=-2147483616;f[d+4>>2]=22;g=a;h=14559;i=g+22|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[a+22>>0]=0;Vj(e,d,1);if((b[d+11>>0]|0)>=0){u=c;return}Oq(f[d>>2]|0);u=c;return}function ki(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a+4>>2]|0;c=a+8|0;d=f[c>>2]|0;if((d|0)!=(b|0)){e=d;do{d=e+-4|0;f[c>>2]=d;g=f[d>>2]|0;f[d>>2]=0;if(g|0){d=g+88|0;h=f[d>>2]|0;f[d>>2]=0;if(h|0){d=f[h+8>>2]|0;if(d|0){i=h+12|0;if((f[i>>2]|0)!=(d|0))f[i>>2]=d;Oq(d)}Oq(h)}h=f[g+68>>2]|0;if(h|0){d=g+72|0;i=f[d>>2]|0;if((i|0)!=(h|0))f[d>>2]=i+(~((i+-4-h|0)>>>2)<<2);Oq(h)}h=g+64|0;i=f[h>>2]|0;f[h>>2]=0;if(i|0){h=f[i>>2]|0;if(h|0){d=i+4|0;if((f[d>>2]|0)!=(h|0))f[d>>2]=h;Oq(h)}Oq(i)}Oq(g)}e=f[c>>2]|0}while((e|0)!=(b|0))}b=f[a>>2]|0;if(!b)return;Oq(b);return}function li(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+20>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;u=c;return 1}function mi(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=u;u=u+16|0;d=c;e=ln(16)|0;f[d>>2]=e;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=e;h=14408;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[e+14>>0]=0;e=Hk(a,d,-1)|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);j=ln(16)|0;f[d>>2]=j;f[d+8>>2]=-2147483632;f[d+4>>2]=14;g=j;h=14423;i=g+14|0;do{b[g>>0]=b[h>>0]|0;g=g+1|0;h=h+1|0}while((g|0)<(i|0));b[j+14>>0]=0;j=Hk(a,d,-1)|0;if((b[d+11>>0]|0)>=0){k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}Oq(f[d>>2]|0);k=(e|0)<(j|0);l=k?j:e;m=(l|0)==-1;n=m?5:l;u=c;return n|0}function ni(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c+8|0;e=c+4|0;g=c;f[g>>2]=f[a+12>>2];h=b+16|0;i=h;j=f[i>>2]|0;k=f[i+4>>2]|0;if((k|0)>0|(k|0)==0&j>>>0>0){l=k;m=j}else{f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;j=h;l=f[j+4>>2]|0;m=f[j>>2]|0}f[g>>2]=f[a+16>>2];if((l|0)>0|(l|0)==0&m>>>0>0){u=c;return 1}f[e>>2]=f[b+4>>2];f[d>>2]=f[e>>2];Me(b,d,g,g+4|0)|0;u=c;return 1}function oi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=ln(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;h=g+8|0;f[h>>2]=f[e>>2];f[h+4>>2]=f[e+4>>2];f[h+8>>2]=f[e+8>>2];f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{Fi(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}kh(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function pi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0;b=a+32|0;ld(a,b);c=a+80|0;d=f[c>>2]|0;if((d|0?(e=a+84|0,(f[e>>2]|0)>0):0)?(ld(d,b),(f[e>>2]|0)>1):0){d=1;do{ld((f[c>>2]|0)+(d<<5)|0,b);d=d+1|0}while((d|0)<(f[e>>2]|0))}e=a+136|0;d=a+140|0;a=f[e>>2]|0;if((f[d>>2]|0)==(a|0))return;c=0;g=a;while(1){a=g;ci((f[a+(c*12|0)+4>>2]|0)-(f[a+(c*12|0)>>2]|0)>>2,b)|0;a=f[e>>2]|0;h=f[a+(c*12|0)>>2]|0;i=(f[a+(c*12|0)+4>>2]|0)-h>>2;if(!i)j=a;else{Mc(h,i,1,0,b)|0;j=f[e>>2]|0}c=c+1|0;if(c>>>0>=(((f[d>>2]|0)-j|0)/12|0)>>>0)break;else g=j}return}function qi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;e=d+16|0;g=f[e>>2]|0;if(!g)if(!(vl(d)|0)){h=f[e>>2]|0;i=5}else j=0;else{h=g;i=5}a:do if((i|0)==5){g=d+20|0;e=f[g>>2]|0;k=e;if((h-e|0)>>>0>>0){j=Sa[f[d+36>>2]&31](d,a,c)|0;break}b:do if((b[d+75>>0]|0)>-1){e=c;while(1){if(!e){l=0;m=a;n=c;o=k;break b}p=e+-1|0;if((b[a+p>>0]|0)==10)break;else e=p}p=Sa[f[d+36>>2]&31](d,a,e)|0;if(p>>>0>>0){j=p;break a}l=e;m=a+e|0;n=c-e|0;o=f[g>>2]|0}else{l=0;m=a;n=c;o=k}while(0);kh(o|0,m|0,n|0)|0;f[g>>2]=(f[g>>2]|0)+n;j=l+n|0}while(0);return j|0}function ri(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+12|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d+28>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;ri(c+8|0);Oq(c)}while((e|0)!=0)}e=d+20|0;c=f[e>>2]|0;f[e>>2]=0;if(c|0)Oq(c);c=f[d+8>>2]|0;if(c|0){e=c;do{c=e;e=f[e>>2]|0;g=c+8|0;h=f[c+20>>2]|0;if(h|0){i=c+24|0;if((f[i>>2]|0)!=(h|0))f[i>>2]=h;Oq(h)}if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);Oq(c)}while((e|0)!=0)}e=f[d>>2]|0;f[d>>2]=0;if(e|0)Oq(e);Oq(d)}if((b[a+11>>0]|0)>=0)return;Oq(f[a>>2]|0);return}function si(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,o=0;g=u;u=u+32|0;h=g+12|0;i=g;f[h>>2]=0;f[h+4>>2]=0;f[h+8>>2]=0;if((e|0)>0){j=i+11|0;k=i+4|0;l=0;do{if((l|0)>0)An(h,14477)|0;il(i,$(n[d+(l<<2)>>2]));m=b[j>>0]|0;o=m<<24>>24<0;lj(h,o?f[i>>2]|0:i,o?f[k>>2]|0:m&255)|0;if((b[j>>0]|0)<0)Oq(f[i>>2]|0);l=l+1|0}while((l|0)<(e|0))}am(Ai(a,c)|0,h)|0;if((b[h+11>>0]|0)>=0){u=g;return}Oq(f[h>>2]|0);u=g;return}function ti(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=u;u=u+16|0;d=c;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){e=1;u=c;return e|0}g=a+4|0;h=a+20|0;i=a+24|0;j=a+16|0;a=0;while(1){k=f[(f[g>>2]|0)+4>>2]|0;l=dm(k,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;f[d>>2]=l;if((l|0)==-1)break;k=f[h>>2]|0;if((k|0)==(f[i>>2]|0))Ri(j,d);else{f[k>>2]=l;f[h>>2]=k+4}gl(f[g>>2]|0,f[d>>2]|0)|0;a=a+1|0;if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){e=1;m=9;break}}if((m|0)==9){u=c;return e|0}e=0;u=c;return e|0}function ui(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=1292;hi(a+60|0);b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=a+36|0;d=f[b>>2]|0;if(d|0){c=a+40|0;e=f[c>>2]|0;if((e|0)==(d|0))g=d;else{h=e;do{e=h+-24|0;f[c>>2]=e;Va[f[f[e>>2]>>2]&127](e);h=f[c>>2]|0}while((h|0)!=(d|0));g=f[b>>2]|0}Oq(g)}f[a>>2]=1232;g=f[a+16>>2]|0;if(g|0){b=a+20|0;d=f[b>>2]|0;if((d|0)!=(g|0))f[b>>2]=d+(~((d+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+4>>2]|0;if(!g)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(g|0))f[d>>2]=a+(~((a+-4-g|0)>>>2)<<2);Oq(g);return}function vi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=u;u=u+32|0;d=c+16|0;e=c+8|0;g=c;h=a+8|0;if(f[h>>2]<<5>>>0>=b>>>0){u=c;return}f[d>>2]=0;i=d+4|0;f[i>>2]=0;j=d+8|0;f[j>>2]=0;if((b|0)<0)aq(d);k=((b+-1|0)>>>5)+1|0;b=ln(k<<2)|0;f[d>>2]=b;f[i>>2]=0;f[j>>2]=k;k=f[a>>2]|0;f[e>>2]=k;f[e+4>>2]=0;b=a+4|0;l=f[b>>2]|0;f[g>>2]=k+(l>>>5<<2);f[g+4>>2]=l&31;zg(d,e,g);g=f[a>>2]|0;f[a>>2]=f[d>>2];f[d>>2]=g;d=f[b>>2]|0;f[b>>2]=f[i>>2];f[i>>2]=d;d=f[h>>2]|0;f[h>>2]=f[j>>2];f[j>>2]=d;if(g|0)Oq(g);u=c;return}function wi(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;b=a+136|0;c=f[b>>2]|0;if(c|0){d=a+140|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e;while(1){e=h+-12|0;f[d>>2]=e;i=f[e>>2]|0;if(!i)j=e;else{e=h+-8|0;k=f[e>>2]|0;if((k|0)!=(i|0))f[e>>2]=k+(~((k+-4-i|0)>>>2)<<2);Oq(i);j=f[d>>2]|0}if((j|0)==(c|0))break;else h=j}g=f[b>>2]|0}Oq(g)}g=f[a+104>>2]|0;if(g|0){b=a+108|0;j=f[b>>2]|0;if((j|0)!=(g|0))f[b>>2]=j+(~((j+-4-g|0)>>>2)<<2);Oq(g)}g=f[a+92>>2]|0;if(!g){uj(a);return}j=a+96|0;b=f[j>>2]|0;if((b|0)!=(g|0))f[j>>2]=b+(~((b+-4-g|0)>>>2)<<2);Oq(g);uj(a);return}function xi(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3680;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;wn(a+200|0);Gn(a+232|0);d=a+316|0;e=a+264|0;g=e+52|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=-1;f[a+320>>2]=-1;f[a+324>>2]=0;f[a+328>>2]=2;f[a+332>>2]=7;f[a+336>>2]=0;f[a+340>>2]=0;f[a+344>>2]=0;b[a+352>>0]=0;return}function yi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=(e|0)/12|0;h=g+1|0;if(h>>>0>357913941)aq(a);i=a+8|0;j=((f[i>>2]|0)-d|0)/12|0;k=j<<1;l=j>>>0<178956970?(k>>>0>>0?h:k):357913941;do if(l)if(l>>>0>357913941){k=ra(8)|0;Oo(k,16035);f[k>>2]=7256;va(k|0,1112,110)}else{m=ln(l*12|0)|0;break}else m=0;while(0);k=m+(g*12|0)|0;f[k>>2]=f[b>>2];f[k+4>>2]=f[b+4>>2];f[k+8>>2]=f[b+8>>2];b=k+(((e|0)/-12|0)*12|0)|0;if((e|0)>0)kh(b|0,d|0,e|0)|0;f[a>>2]=b;f[c>>2]=k+12;f[i>>2]=m+(l*12|0);if(!d)return;Oq(d);return}function zi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=a+16|0;h=g;i=f[h+4>>2]|0;if((d|0)<0|(d|0)==0&c>>>0<1|((i|0)>0|(i|0)==0&(f[h>>2]|0)>>>0>0)){j=0;return j|0}b[a+24>>0]=e&1;h=Vn(c|0,d|0,7,0)|0;d=Ik(h|0,I|0,8,0)|0;h=I;c=g;f[c>>2]=d;f[c+4>>2]=h;c=a+4|0;g=f[c>>2]|0;i=f[a>>2]|0;k=g-i|0;l=Vn(k|0,0,8,0)|0;m=e?l:k;l=Vn(m|0,(e?I:0)|0,d|0,h|0)|0;h=i;i=g;if(k>>>0>=l>>>0)if(k>>>0>l>>>0?(g=h+l|0,(g|0)!=(i|0)):0){f[c>>2]=g;n=h}else n=h;else{Fi(a,l-k|0);n=f[a>>2]|0}k=ln(8)|0;f[k>>2]=n+m;f[k+4>>2]=0;m=a+12|0;a=f[m>>2]|0;f[m>>2]=k;if(!a){j=1;return j|0}Oq(a);j=1;return j|0}function Ai(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=u;u=u+16|0;d=c;e=yg(a,d,b)|0;g=f[e>>2]|0;if(g|0){h=g;i=h+28|0;u=c;return i|0}g=ln(40)|0;pj(g+16|0,b);b=g+28|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;b=f[d>>2]|0;f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=b;f[e>>2]=g;b=f[f[a>>2]>>2]|0;if(!b)j=g;else{f[a>>2]=b;j=f[e>>2]|0}Oe(f[a+4>>2]|0,j);j=a+8|0;f[j>>2]=(f[j>>2]|0)+1;h=g;i=h+28|0;u=c;return i|0}function Bi(a,c,d,e,g,h,i,j){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0;k=u;u=u+16|0;l=k;if((-18-c|0)>>>0>>0)aq(a);if((b[a+11>>0]|0)<0)m=f[a>>2]|0;else m=a;if(c>>>0<2147483623){n=d+c|0;d=c<<1;o=n>>>0>>0?d:n;p=o>>>0<11?11:o+16&-16}else p=-17;o=ln(p)|0;if(g|0)Fo(o,m,g)|0;if(i|0)Fo(o+g|0,j,i)|0;j=e-h|0;e=j-g|0;if(e|0)Fo(o+g+i|0,m+g+h|0,e)|0;if((c|0)!=10)Oq(m);f[a>>2]=o;f[a+8>>2]=p|-2147483648;p=j+i|0;f[a+4>>2]=p;b[l>>0]=0;up(o+p|0,l);u=k;return}function Ci(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+8|0;d=f[c>>2]|0;e=a+4|0;g=f[e>>2]|0;if(d-g>>2>>>0>=b>>>0){sj(g|0,0,b<<2|0)|0;f[e>>2]=g+(b<<2);return}h=f[a>>2]|0;i=g-h|0;g=i>>2;j=g+b|0;if(j>>>0>1073741823)aq(a);k=d-h|0;d=k>>1;l=k>>2>>>0<536870911?(d>>>0>>0?j:d):1073741823;do if(l)if(l>>>0>1073741823){d=ra(8)|0;Oo(d,16035);f[d>>2]=7256;va(d|0,1112,110)}else{d=ln(l<<2)|0;m=d;n=d;break}else{m=0;n=0}while(0);d=m+(g<<2)|0;sj(d|0,0,b<<2|0)|0;if((i|0)>0)kh(n|0,h|0,i|0)|0;f[a>>2]=m;f[e>>2]=d+(b<<2);f[c>>2]=m+(l<<2);if(!h)return;Oq(h);return}function Di(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=ln(32)|0;f[a>>2]=g;f[a+4>>2]=c+8;c=a+8|0;b[c>>0]=0;pj(g+8|0,e);h=g+20|0;i=e+12|0;f[h>>2]=0;f[g+24>>2]=0;f[g+28>>2]=0;g=e+16|0;e=f[g>>2]|0;j=f[i>>2]|0;k=e-j|0;if(!k){l=j;m=e;n=0}else{Fi(h,k);l=f[i>>2]|0;m=f[g>>2]|0;n=f[h>>2]|0}kh(n|0,l|0,m-l|0)|0;b[c>>0]=1;c=f[a>>2]|0;f[c+4>>2]=d;f[c>>2]=0;return}function Ei(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0,i=0,j=0,k=0.0,l=0,m=0,n=0,o=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=+d;l=j;j=i;while(1){if(j<<24>>24<0)m=f[c>>2]|0;else m=c;p[g>>3]=k;n=Bn(m,l+1|0,18562,g)|0;if((n|0)>-1)if(n>>>0>l>>>0)o=n;else break;else o=l<<1|1;Hj(c,o,0);l=o;j=b[h>>0]|0}Hj(c,n,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function Fi(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;d=a+8|0;e=f[d>>2]|0;g=a+4|0;h=f[g>>2]|0;if((e-h|0)>>>0>=c>>>0){i=c;j=h;do{b[j>>0]=0;j=(f[g>>2]|0)+1|0;f[g>>2]=j;i=i+-1|0}while((i|0)!=0);return}i=f[a>>2]|0;j=h-i|0;h=j+c|0;if((h|0)<0)aq(a);k=e-i|0;i=k<<1;e=k>>>0<1073741823?(i>>>0>>0?h:i):2147483647;if(!e)l=0;else l=ln(e)|0;i=l+j|0;j=l+e|0;e=c;c=i;l=i;do{b[l>>0]=0;l=c+1|0;c=l;e=e+-1|0}while((e|0)!=0);e=f[a>>2]|0;l=(f[g>>2]|0)-e|0;h=i+(0-l)|0;if((l|0)>0)kh(h|0,e|0,l|0)|0;f[a>>2]=h;f[g>>2]=c;f[d>>2]=j;if(!e)return;Oq(e);return}function Gi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=(d-e|0)/136|0;h=d;if(g>>>0>>0){Ge(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+(b*136|0)|0;if((g|0)==(h|0))return;else i=h;do{f[c>>2]=i+-136;h=f[i+-20>>2]|0;if(h|0){b=i+-16|0;e=f[b>>2]|0;if((e|0)!=(h|0))f[b>>2]=e+(~((e+-4-h|0)>>>2)<<2);Oq(h)}h=f[i+-32>>2]|0;if(h|0){e=i+-28|0;b=f[e>>2]|0;if((b|0)!=(h|0))f[e>>2]=b+(~((b+-4-h|0)>>>2)<<2);Oq(h)}Mi(i+-132|0);i=f[c>>2]|0}while((i|0)!=(g|0));return}function Hi(a,b){a=a|0;b=b|0;var c=0,d=Oa,e=0,g=0;if((b|0)!=1)if(!(b+-1&b))c=b;else c=cb(b)|0;else c=2;b=f[a+4>>2]|0;if(c>>>0>b>>>0){Sd(a,c);return}if(c>>>0>=b>>>0)return;d=$((f[a+12>>2]|0)>>>0);e=~~$(W($(d/$(n[a+16>>2]))))>>>0;if(b>>>0>2&(b+-1&b|0)==0)g=1<<32-(_(e+-1|0)|0);else g=cb(e)|0;e=c>>>0>>0?g:c;if(e>>>0>=b>>>0)return;Sd(a,e);return}function Ii(a){a=a|0;var b=0,c=0,d=0;b=f[a+76>>2]|0;if(b|0){c=a+80|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+64>>2]|0;if(b|0){d=a+68|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}b=f[a+48>>2]|0;if(b|0){d=a+52|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+24>>2]|0;if(b|0){c=a+28|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+12>>2]|0;if(b|0){d=a+16|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Ji(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=u;u=u+16|0;g=e;h=c+11|0;i=b[h>>0]|0;if(i<<24>>24<0)j=f[c+4>>2]|0;else j=i&255;k=j;j=i;while(1){if(j<<24>>24<0)l=f[c>>2]|0;else l=c;f[g>>2]=d;m=Bn(l,k+1|0,18559,g)|0;if((m|0)>-1)if(m>>>0>k>>>0)n=m;else break;else n=k<<1|1;Hj(c,n,0);k=n;j=b[h>>0]|0}Hj(c,m,0);f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2];a=0;while(1){if((a|0)==3)break;f[c+(a<<2)>>2]=0;a=a+1|0}u=e;return}function Ki(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;b=a+8|0;c=f[b>>2]|0;if((c|0)<0){d=0;return d|0}e=a+4|0;a=f[e>>2]|0;g=a+4|0;h=f[g>>2]|0;i=f[a>>2]|0;j=h-i>>2;k=i;i=h;if(c>>>0<=j>>>0)if(c>>>0>>0?(h=k+(c<<2)|0,(h|0)!=(i|0)):0){f[g>>2]=i+(~((i+-4-h|0)>>>2)<<2);l=c}else l=c;else{Ci(a,c-j|0);l=f[b>>2]|0}if((l|0)<=0){d=1;return d|0}b=f[e>>2]|0;e=f[b>>2]|0;j=(f[b+4>>2]|0)-e>>2;c=e;e=0;while(1){if(j>>>0<=e>>>0){m=10;break}f[c+(e<<2)>>2]=e;e=e+1|0;if((e|0)>=(l|0)){d=1;m=12;break}}if((m|0)==10)aq(b);else if((m|0)==12)return d|0;return 0}function Li(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=ln(16)|0;f[g>>2]=h;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=h;j=14408;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+14>>0]=0;Xj(a,g,c);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);c=ln(16)|0;f[g>>2]=c;f[g+8>>2]=-2147483632;f[g+4>>2]=14;i=c;j=14423;k=i+14|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[c+14>>0]=0;Xj(a,g,d);if((b[g+11>>0]|0)>=0){u=e;return}Oq(f[g>>2]|0);u=e;return}function Mi(a){a=a|0;var b=0,c=0,d=0;b=f[a+84>>2]|0;if(b|0){c=a+88|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+72>>2]|0;if(b|0){d=a+76|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+40>>2]|0;if(b|0){c=a+44|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+28>>2]|0;if(b|0){d=a+32|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+12>>2]|0;if(b|0)Oq(b);b=f[a>>2]|0;if(!b)return;Oq(b);return}function Ni(a){a=a|0;var b=0,c=0,d=0,e=0;f[a>>2]=1352;b=a+32|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+88|0;d=f[b>>2]|0;f[b>>2]=0;if(d|0){b=f[d+8>>2]|0;if(b|0){e=d+12|0;if((f[e>>2]|0)!=(b|0))f[e>>2]=b;Oq(b)}Oq(d)}d=f[c+68>>2]|0;if(d|0){b=c+72|0;e=f[b>>2]|0;if((e|0)!=(d|0))f[b>>2]=e+(~((e+-4-d|0)>>>2)<<2);Oq(d)}d=c+64|0;e=f[d>>2]|0;f[d>>2]=0;if(e|0){d=f[e>>2]|0;if(d|0){b=e+4|0;if((f[b>>2]|0)!=(d|0))f[b>>2]=d;Oq(d)}Oq(e)}Oq(c)}c=f[a+16>>2]|0;if(!c)return;e=a+20|0;a=f[e>>2]|0;if((a|0)!=(c|0))f[e>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Oi(){var a=0,b=0,c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0;a=u;u=u+48|0;b=a+32|0;c=a+24|0;d=a+16|0;e=a;g=a+36|0;a=sn()|0;if(a|0?(h=f[a>>2]|0,h|0):0){a=h+48|0;i=f[a>>2]|0;j=f[a+4>>2]|0;if(!((i&-256|0)==1126902528&(j|0)==1129074247)){f[c>>2]=18701;Hn(18651,c)}if((i|0)==1126902529&(j|0)==1129074247)k=f[h+44>>2]|0;else k=h+80|0;f[g>>2]=k;k=f[h>>2]|0;h=f[k+4>>2]|0;if(Sa[f[(f[258]|0)+16>>2]&31](1032,k,g)|0){k=f[g>>2]|0;g=Qa[f[(f[k>>2]|0)+8>>2]&127](k)|0;f[e>>2]=18701;f[e+4>>2]=h;f[e+8>>2]=g;Hn(18565,e)}else{f[d>>2]=18701;f[d+4>>2]=h;Hn(18610,d)}}Hn(18689,b)}function Pi(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;do if(a){if(c>>>0<128){b[a>>0]=c;e=1;break}d=(Jq()|0)+188|0;if(!(f[f[d>>2]>>2]|0))if((c&-128|0)==57216){b[a>>0]=c;e=1;break}else{d=Vq()|0;f[d>>2]=84;e=-1;break}if(c>>>0<2048){b[a>>0]=c>>>6|192;b[a+1>>0]=c&63|128;e=2;break}if(c>>>0<55296|(c&-8192|0)==57344){b[a>>0]=c>>>12|224;b[a+1>>0]=c>>>6&63|128;b[a+2>>0]=c&63|128;e=3;break}if((c+-65536|0)>>>0<1048576){b[a>>0]=c>>>18|240;b[a+1>>0]=c>>>12&63|128;b[a+2>>0]=c>>>6&63|128;b[a+3>>0]=c&63|128;e=4;break}else{d=Vq()|0;f[d>>2]=84;e=-1;break}}else e=1;while(0);return e|0}function Qi(a){a=a|0;var b=0,c=0,d=0;b=f[a+92>>2]|0;if(b|0){c=a+96|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0){d=a+80|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+52>>2]|0;if(b|0){d=a+56|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}f[a+4>>2]=3636;b=f[a+24>>2]|0;if(b|0)Oq(b);b=f[a+12>>2]|0;if(!b)return;Oq(b);return}function Ri(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;c=a+4|0;d=f[a>>2]|0;e=(f[c>>2]|0)-d|0;g=e>>2;h=g+1|0;if(h>>>0>1073741823)aq(a);i=a+8|0;j=(f[i>>2]|0)-d|0;k=j>>1;l=j>>2>>>0<536870911?(k>>>0>>0?h:k):1073741823;do if(l)if(l>>>0>1073741823){k=ra(8)|0;Oo(k,16035);f[k>>2]=7256;va(k|0,1112,110)}else{k=ln(l<<2)|0;m=k;n=k;break}else{m=0;n=0}while(0);k=m+(g<<2)|0;f[k>>2]=f[b>>2];if((e|0)>0)kh(n|0,d|0,e|0)|0;f[a>>2]=m;f[c>>2]=k+4;f[i>>2]=m+(l<<2);if(!d)return;Oq(d);return}function Si(a){a=a|0;var c=0,d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;c=a+104|0;d=f[c>>2]|0;if((d|0)!=0?(f[a+108>>2]|0)>=(d|0):0)e=4;else{d=Wm(a)|0;if((d|0)>=0){g=f[c>>2]|0;c=a+8|0;if(g){i=f[c>>2]|0;j=f[a+4>>2]|0;k=g-(f[a+108>>2]|0)|0;g=i;if((i-j|0)<(k|0)){l=g;m=g}else{l=j+(k+-1)|0;m=g}}else{g=f[c>>2]|0;l=g;m=g}f[a+100>>2]=l;l=a+4|0;if(!m)n=f[l>>2]|0;else{g=f[l>>2]|0;l=a+108|0;f[l>>2]=m+1-g+(f[l>>2]|0);n=g}g=n+-1|0;if((d|0)==(h[g>>0]|0|0))o=d;else{b[g>>0]=d;o=d}}else e=4}if((e|0)==4){f[a+100>>2]=0;o=-1}return o|0}function Ti(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1544;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];fk(a+32|0,c+24|0);f[a>>2]=2384;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=2440;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Zm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Ui(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;f[a>>2]=1544;f[a+4>>2]=b;b=a+8|0;f[b>>2]=f[c>>2];f[b+4>>2]=f[c+4>>2];f[b+8>>2]=f[c+8>>2];f[b+12>>2]=f[c+12>>2];f[b+16>>2]=f[c+16>>2];f[b+20>>2]=f[c+20>>2];fk(a+32|0,c+24|0);f[a>>2]=1964;c=a+44|0;f[c>>2]=f[d>>2];f[c+4>>2]=f[d+4>>2];f[c+8>>2]=f[d+8>>2];f[c+12>>2]=f[d+12>>2];f[a>>2]=2020;d=a+112|0;c=a+60|0;b=c+52|0;do{f[c>>2]=0;c=c+4|0}while((c|0)<(b|0));Zm(d);f[a+152>>2]=0;f[a+156>>2]=0;f[a+160>>2]=0;return}function Vi(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2440;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0)Oq(b);b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0)Oq(b);b=f[a+60>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Wi(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0;d=u;u=u+16|0;e=d;g=f[(f[c+4>>2]|0)+4>>2]|0;if(!g){f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;u=d;return}if(!(Dj(d+12|0,f[c+44>>2]|0,g)|0)){g=ln(32)|0;f[e>>2]=g;f[e+8>>2]=-2147483616;f[e+4>>2]=26;c=g;h=15859;i=c+26|0;do{b[c>>0]=b[h>>0]|0;c=c+1|0;h=h+1|0}while((c|0)<(i|0));b[g+26>>0]=0;f[a>>2]=-1;pj(a+4|0,e);if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0)}else{f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0}u=d;return}function Xi(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=b+48|0;if((mi(f[c>>2]|0)|0)>9){d=0;return d|0}if((Qa[f[(f[b>>2]|0)+8>>2]&127](b)|0)!=1){d=0;return d|0}e=b+4|0;b=(f[(f[(f[e>>2]|0)+8>>2]|0)+(a<<2)>>2]|0)+56|0;a=f[b>>2]|0;do if((a|0)==3)if((mi(f[c>>2]|0)|0)<4){d=5;return d|0}else{g=f[b>>2]|0;break}else g=a;while(0);a=mi(f[c>>2]|0)|0;if((g|0)==1){d=(a|0)<4?6:0;return d|0}if((a|0)>7){d=0;return d|0}if((mi(f[c>>2]|0)|0)>1){d=1;return d|0}else return ((f[(f[e>>2]|0)+80>>2]|0)>>>0<40?1:4)|0;return 0}function Yi(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2020;b=f[a+152>>2]|0;if(b|0){c=a+156|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+112>>2]|0;if(b|0){d=a+116|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0)Oq(b);b=f[a+84>>2]|0;if(b|0)Oq(b);b=f[a+72>>2]|0;if(b|0)Oq(b);b=f[a+60>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Zi(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=u;u=u+128|0;h=g+124|0;i=g;j=i;k=6596;l=j+124|0;do{f[j>>2]=f[k>>2];j=j+4|0;k=k+4|0}while((j|0)<(l|0));if((c+-1|0)>>>0>2147483646)if(!c){m=h;n=1;o=4}else{h=Vq()|0;f[h>>2]=75;p=-1}else{m=a;n=c;o=4}if((o|0)==4){o=-2-m|0;c=n>>>0>o>>>0?o:n;f[i+48>>2]=c;n=i+20|0;f[n>>2]=m;f[i+44>>2]=m;o=m+c|0;m=i+16|0;f[m>>2]=o;f[i+28>>2]=o;o=Ah(i,d,e)|0;if(!c)p=o;else{c=f[n>>2]|0;b[c+(((c|0)==(f[m>>2]|0))<<31>>31)>>0]=0;p=o}}u=g;return p|0}function _i(a){a=a|0;var c=0,d=0,e=0,g=0;f[a>>2]=3480;c=a+72|0;d=a+136|0;e=a+4|0;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));e=c;g=e+64|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));n[d>>2]=$(1.0);d=a+140|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[a+164>>2]=-1;d=a+168|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;f[d+24>>2]=0;wn(a+200|0);Gn(a+232|0);d=a+264|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;b[d+24>>0]=0;return}function $i(a,c,d,e){a=a|0;c=c|0;d=d|0;e=+e;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=Gj(d)|0;if(i>>>0>4294967279)aq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=ln(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){kh(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;Zl(c,g,e);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);h=1;u=a;return h|0}function aj(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;a=u;u=u+16|0;g=a;if(!c){h=0;u=a;return h|0}f[g>>2]=0;f[g+4>>2]=0;f[g+8>>2]=0;i=Gj(d)|0;if(i>>>0>4294967279)aq(g);if(i>>>0<11){b[g+11>>0]=i;if(!i)j=g;else{k=g;l=7}}else{m=i+16&-16;n=ln(m)|0;f[g>>2]=n;f[g+8>>2]=m|-2147483648;f[g+4>>2]=i;k=n;l=7}if((l|0)==7){kh(k|0,d|0,i|0)|0;j=k}b[j+i>>0]=0;$l(c,g,e);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);h=1;u=a;return h|0}function bj(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;c=f[a+28>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;g=c+20|0;h=f[g>>2]|0;f[g>>2]=0;if(h|0){bj(h);Oq(h)}if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);Oq(c)}while((d|0)!=0)}d=a+20|0;c=f[d>>2]|0;f[d>>2]=0;if(c|0)Oq(c);c=f[a+8>>2]|0;if(c|0){d=c;do{c=d;d=f[d>>2]|0;e=c+8|0;h=f[c+20>>2]|0;if(h|0){g=c+24|0;if((f[g>>2]|0)!=(h|0))f[g>>2]=h;Oq(h)}if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);Oq(c)}while((d|0)!=0)}d=f[a>>2]|0;f[a>>2]=0;if(!d)return;Oq(d);return}function cj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0;e=u;u=u+16|0;g=e;h=f[c+36>>2]|0;if(!h){i=ln(32)|0;f[g>>2]=i;f[g+8>>2]=-2147483616;f[g+4>>2]=23;j=i;k=15706;l=j+23|0;do{b[j>>0]=b[k>>0]|0;j=j+1|0;k=k+1|0}while((j|0)<(l|0));b[i+23>>0]=0;f[a>>2]=-1;pj(a+4|0,g);if((b[g+11>>0]|0)<0)Oq(f[g>>2]|0);u=e;return}g=f[c+40>>2]|0;if(!g){Sc(a,c,h,d);u=e;return}else{bi(a,c,g,d);u=e;return}}function dj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;tk(a);b=a+84|0;c=f[b>>2]|0;if((c|0)<=0)return;d=c<<5;e=Lq(c>>>0>134217727|d>>>0>4294967291?-1:d+4|0)|0;f[e>>2]=c;d=e+4|0;e=d+(c<<5)|0;c=d;do{wn(c);c=c+32|0}while((c|0)!=(e|0));e=a+80|0;a=f[e>>2]|0;f[e>>2]=d;if(a|0){d=a+-4|0;c=f[d>>2]|0;if(c|0){g=a+(c<<5)|0;do{g=g+-32|0;Fj(g)}while((g|0)!=(a|0))}Mq(d)}if((f[b>>2]|0)>0)h=0;else return;do{tk((f[e>>2]|0)+(h<<5)|0);h=h+1|0}while((h|0)<(f[b>>2]|0));return}function ej(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!b){d=0;return d|0}if(f[b+4>>2]|0){d=0;return d|0}a=ln(52)|0;Ub(a,c);f[a+40>>2]=0;f[a+44>>2]=0;f[a+48>>2]=0;c=b+4|0;b=f[c>>2]|0;f[c>>2]=a;if(!b){d=1;return d|0}a=b+40|0;c=f[a>>2]|0;if(c|0){e=b+44|0;g=f[e>>2]|0;if((g|0)==(c|0))h=c;else{i=g;do{g=i+-4|0;f[e>>2]=g;j=f[g>>2]|0;f[g>>2]=0;if(j|0){bj(j);Oq(j)}i=f[e>>2]|0}while((i|0)!=(c|0));h=f[a>>2]|0}Oq(h)}bj(b);Oq(b);d=1;return d|0}function fj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[a>>2]|0;if(b){b=c+8|0;d=b;e=Vn(f[d>>2]|0,f[d+4>>2]|0,1,0)|0;d=b;f[d>>2]=e;f[d+4>>2]=I;d=a+28|0;e=f[d>>2]|0;b=a+24|0;f[b>>2]=f[b>>2]|1<>2]|0,f[e+4>>2]|0,1,0)|0;e=c;f[e>>2]=d;f[e+4>>2]=I;e=a+28|0;g=e;h=f[e>>2]|0}e=h+1|0;f[g>>2]=e;if((e|0)!=32)return;e=a+24|0;h=a+16|0;d=f[h>>2]|0;if((d|0)==(f[a+20>>2]|0))Ri(a+12|0,e);else{f[d>>2]=f[e>>2];f[h>>2]=d+4}f[g>>2]=0;f[e>>2]=0;return}function gj(a,b){a=a|0;b=b|0;var c=0,d=0;c=a+32|0;a=f[b>>2]|0;f[b>>2]=0;b=f[c>>2]|0;f[c>>2]=a;if(!b)return;a=b+88|0;c=f[a>>2]|0;f[a>>2]=0;if(c|0){a=f[c+8>>2]|0;if(a|0){d=c+12|0;if((f[d>>2]|0)!=(a|0))f[d>>2]=a;Oq(a)}Oq(c)}c=f[b+68>>2]|0;if(c|0){a=b+72|0;d=f[a>>2]|0;if((d|0)!=(c|0))f[a>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=b+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){a=d+4|0;if((f[a>>2]|0)!=(c|0))f[a>>2]=c;Oq(c)}Oq(d)}Oq(b);return}function hj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;if(c|0){h=a+11|0;i=b[h>>0]|0;if(i<<24>>24<0){j=f[a+4>>2]|0;k=(f[a+8>>2]&2147483647)+-1|0}else{j=i&255;k=10}if((k-j|0)>>>0>>0){xj(a,k,c-k+j|0,j,j,0,0);l=b[h>>0]|0}else l=i;if(l<<24>>24<0)m=f[a>>2]|0;else m=a;Qn(m+j|0,c,d)|0;d=j+c|0;if((b[h>>0]|0)<0)f[a+4>>2]=d;else b[h>>0]=d;b[g>>0]=0;up(m+d|0,g)}u=e;return a|0}function ij(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+48|0;e=d+4|0;g=d;h=f[b+12>>2]|0;i=f[b+4>>2]|0;b=e;j=b+36|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(j|0));zh(g,c,h,i,e);i=f[e+24>>2]|0;if(!i){k=f[g>>2]|0;f[a>>2]=k;u=d;return}h=e+28|0;e=f[h>>2]|0;if((e|0)!=(i|0))f[h>>2]=e+(~((e+-4-i|0)>>>2)<<2);Oq(i);k=f[g>>2]|0;f[a>>2]=k;u=d;return}function jj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=(f[a+8>>2]&2147483647)+-1|0;else k=10;do if(k>>>0>=d>>>0){if(j)l=f[a>>2]|0;else l=a;Eo(l,c,d)|0;b[g>>0]=0;up(l+d|0,g);if((b[h>>0]|0)<0){f[a+4>>2]=d;break}else{b[h>>0]=d;break}}else{if(j)m=f[a+4>>2]|0;else m=i&255;Bi(a,k,d-k|0,m,0,m,d,c)}while(0);u=e;return a|0}function kj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d;do{f[c>>2]=g+-136;d=f[g+-20>>2]|0;if(d|0){h=g+-16|0;i=f[h>>2]|0;if((i|0)!=(d|0))f[h>>2]=i+(~((i+-4-d|0)>>>2)<<2);Oq(d)}d=f[g+-32>>2]|0;if(d|0){i=g+-28|0;h=f[i>>2]|0;if((h|0)!=(d|0))f[i>>2]=h+(~((h+-4-d|0)>>>2)<<2);Oq(d)}Mi(g+-132|0);g=f[c>>2]|0}while((g|0)!=(b|0));e=f[a>>2]|0}Oq(e);return}function lj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j){k=f[a+4>>2]|0;l=(f[a+8>>2]&2147483647)+-1|0}else{k=i&255;l=10}if((l-k|0)>>>0>=d>>>0){if(d|0){if(j)m=f[a>>2]|0;else m=a;Fo(m+k|0,c,d)|0;j=k+d|0;if((b[h>>0]|0)<0)f[a+4>>2]=j;else b[h>>0]=j;b[g>>0]=0;up(m+j|0,g)}}else Bi(a,l,d-l+k|0,k,k,0,d,c);u=e;return a|0}function mj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;f[a>>2]=3932;b=f[a+32>>2]|0;if(b|0){c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+20>>2]|0;if(b|0){d=a+24|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=a+8|0;c=f[b>>2]|0;if(!c)return;d=a+12|0;a=f[d>>2]|0;if((a|0)==(c|0))e=c;else{g=a;do{a=g+-4|0;f[d>>2]=a;h=f[a>>2]|0;f[a>>2]=0;if(h|0)Va[f[(f[h>>2]|0)+4>>2]&127](h);g=f[d>>2]|0}while((g|0)!=(c|0));e=f[b>>2]|0}Oq(e);return}function nj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+4|0;if((Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)<=0){d=1;return d|0}a=0;while(1){e=f[(f[c>>2]|0)+4>>2]|0;g=dm(e,Ra[f[(f[b>>2]|0)+24>>2]&127](b,a)|0)|0;if((g|0)==-1){d=0;h=6;break}e=f[(f[b>>2]|0)+28>>2]|0;i=fl(f[c>>2]|0,g)|0;a=a+1|0;if(!(Ra[e&127](b,i)|0)){d=0;h=6;break}if((a|0)>=(Qa[f[(f[b>>2]|0)+20>>2]&127](b)|0)){d=1;h=6;break}}if((h|0)==6)return d|0;return 0}function oj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;if(!(ho(a,b,c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+52>>2]&127](a)|0)){d=0;return d|0}c=a+4|0;e=a+8|0;g=f[c>>2]|0;if((f[e>>2]|0)==(g|0)){d=1;return d|0}h=a+36|0;a=0;i=g;while(1){g=f[(f[h>>2]|0)+(a<<2)>>2]|0;if(!(Sa[f[(f[g>>2]|0)+8>>2]&31](g,b,f[i+(a<<2)>>2]|0)|0)){d=0;j=7;break}a=a+1|0;i=f[c>>2]|0;if(a>>>0>=(f[e>>2]|0)-i>>2>>>0){d=1;j=7;break}}if((j|0)==7)return d|0;return 0}function pj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;if((b[c+11>>0]|0)<0){g=f[c>>2]|0;h=f[c+4>>2]|0;if(h>>>0>4294967279)aq(a);if(h>>>0<11){b[a+11>>0]=h;i=a}else{j=h+16&-16;k=ln(j)|0;f[a>>2]=k;f[a+8>>2]=j|-2147483648;f[a+4>>2]=h;i=k}Fo(i,g,h)|0;b[e>>0]=0;up(i+h|0,e)}else{f[a>>2]=f[c>>2];f[a+4>>2]=f[c+4>>2];f[a+8>>2]=f[c+8>>2]}u=d;return}function qj(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0;b[c+53>>0]=1;do if((f[c+4>>2]|0)==(e|0)){b[c+52>>0]=1;a=c+16|0;h=f[a>>2]|0;if(!h){f[a>>2]=d;f[c+24>>2]=g;f[c+36>>2]=1;if(!((g|0)==1?(f[c+48>>2]|0)==1:0))break;b[c+54>>0]=1;break}if((h|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;b[c+54>>0]=1;break}h=c+24|0;a=f[h>>2]|0;if((a|0)==2){f[h>>2]=g;i=g}else i=a;if((i|0)==1?(f[c+48>>2]|0)==1:0)b[c+54>>0]=1}while(0);return}function rj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)!=(e|0)){g=0;h=e;do{vg(h+(g*24|0)|0,b)|0;g=g+1|0;h=f[c>>2]|0}while(g>>>0<(((f[d>>2]|0)-h|0)/24|0)>>>0)}h=a+48|0;d=a+52|0;a=f[h>>2]|0;if((f[d>>2]|0)==(a|0))return 1;else{i=0;j=a}do{a=f[j+(i<<2)>>2]|0;ci(a<<1^a>>31,b)|0;i=i+1|0;j=f[h>>2]|0}while(i>>>0<(f[d>>2]|0)-j>>2>>>0);return 1}function sj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;e=a+d|0;c=c&255;if((d|0)>=67){while(a&3){b[a>>0]=c;a=a+1|0}g=e&-4|0;h=g-64|0;i=c|c<<8|c<<16|c<<24;while((a|0)<=(h|0)){f[a>>2]=i;f[a+4>>2]=i;f[a+8>>2]=i;f[a+12>>2]=i;f[a+16>>2]=i;f[a+20>>2]=i;f[a+24>>2]=i;f[a+28>>2]=i;f[a+32>>2]=i;f[a+36>>2]=i;f[a+40>>2]=i;f[a+44>>2]=i;f[a+48>>2]=i;f[a+52>>2]=i;f[a+56>>2]=i;f[a+60>>2]=i;a=a+64|0}while((a|0)<(g|0)){f[a>>2]=i;a=a+4|0}}while((a|0)<(e|0)){b[a>>0]=c;a=a+1|0}return e-d|0}function tj(a,c,d,e,g){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;do if(!(fp(a,f[c+8>>2]|0,g)|0)){if(fp(a,f[c>>2]|0,g)|0){if((f[c+16>>2]|0)!=(d|0)?(h=c+20|0,(f[h>>2]|0)!=(d|0)):0){f[c+32>>2]=e;f[h>>2]=d;h=c+40|0;f[h>>2]=(f[h>>2]|0)+1;if((f[c+36>>2]|0)==1?(f[c+24>>2]|0)==2:0)b[c+54>>0]=1;f[c+44>>2]=4;break}if((e|0)==1)f[c+32>>2]=1}}else Vm(0,c,d,e);while(0);return}function uj(a){a=a|0;var b=0,c=0,d=0,e=0;b=a+80|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=c+-4|0;d=f[b>>2]|0;if(d|0){e=c+(d<<5)|0;do{e=e+-32|0;Fj(e)}while((e|0)!=(c|0))}Mq(b)}b=f[a+68>>2]|0;if(b|0){c=a+72|0;e=f[c>>2]|0;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);Oq(b)}b=a+44|0;e=f[b>>2]|0;f[b>>2]=0;if(e|0)Oq(e);e=f[a+32>>2]|0;if(!e){Fj(a);return}b=a+36|0;if((f[b>>2]|0)!=(e|0))f[b>>2]=e;Oq(e);Fj(a);return}function vj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3092;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0)Oq(b);b=f[a+64>>2]|0;if(b|0)Oq(b);b=f[a+52>>2]|0;if(b|0)Oq(b);b=f[a+40>>2]|0;if(!b)return;Oq(b);return}function wj(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0;if((d|0)<0){e=0;return e|0}do if(!b){d=a+4|0;g=f[d>>2]|0;h=f[a>>2]|0;i=g-h|0;if(i>>>0>>0){Fi(a,c-i|0);break}if(i>>>0>c>>>0?(i=h+c|0,(i|0)!=(g|0)):0)f[d>>2]=i}else Cg(a,b,b+c|0);while(0);c=a+24|0;a=c;b=Vn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=c;f[a>>2]=b;f[a+4>>2]=I;e=1;return e|0}function xj(a,c,d,e,g,h,i){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0;if((-17-c|0)>>>0>>0)aq(a);if((b[a+11>>0]|0)<0)j=f[a>>2]|0;else j=a;if(c>>>0<2147483623){k=d+c|0;d=c<<1;l=k>>>0>>0?d:k;m=l>>>0<11?11:l+16&-16}else m=-17;l=ln(m)|0;if(g|0)Fo(l,j,g)|0;k=e-h-g|0;if(k|0)Fo(l+g+i|0,j+g+h|0,k)|0;if((c|0)!=10)Oq(j);f[a>>2]=l;f[a+8>>2]=m|-2147483648;return}function yj(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2728;b=f[a+136>>2]|0;if(b|0){c=a+140|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+96>>2]|0;if(b|0){d=a+100|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+76>>2]|0;if(b|0)Oq(b);b=f[a+64>>2]|0;if(b|0)Oq(b);b=f[a+52>>2]|0;if(b|0)Oq(b);b=f[a+40>>2]|0;if(!b)return;Oq(b);return}function zj(a,b){a=a|0;b=b|0;if(!b)return;else{zj(a,f[b>>2]|0);zj(a,f[b+4>>2]|0);Ej(b+20|0,f[b+24>>2]|0);Oq(b);return}}function Aj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;Yf(a,b,c);c=f[a+100>>2]|0;d=f[a+96>>2]|0;a=d;if((c|0)==(d|0))return;e=f[b>>2]|0;b=(c-d|0)/12|0;d=0;do{c=a+(d*12|0)|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+4|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];c=a+(d*12|0)+8|0;f[c>>2]=f[e+(f[c>>2]<<2)>>2];d=d+1|0}while(d>>>0>>0);return}function Bj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=a+64|0;if((f[d>>2]|0)==0?(e=ln(32)|0,yn(e),g=f[d>>2]|0,f[d>>2]=e,g|0):0){e=f[g>>2]|0;if(e|0){h=g+4|0;if((f[h>>2]|0)!=(e|0))f[h>>2]=e;Oq(e)}Oq(g)}g=Vl(f[a+28>>2]|0)|0;e=X(g,b[a+24>>0]|0)|0;g=((e|0)<0)<<31>>31;h=f[d>>2]|0;i=un(e|0,g|0,c|0,0)|0;if(!(wj(h,0,i,I)|0)){j=0;return j|0}Kk(a,f[d>>2]|0,e,g,0,0);f[a+80>>2]=c;j=1;return j|0}function Cj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+64|0;e=d;if(!(fp(a,b,0)|0))if((b|0)!=0?(g=Eh(b,1056,1040,0)|0,(g|0)!=0):0){b=e+4|0;h=b+52|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(h|0));f[e>>2]=g;f[e+8>>2]=a;f[e+12>>2]=-1;f[e+48>>2]=1;Ya[f[(f[g>>2]|0)+28>>2]&3](g,e,f[c>>2]|0,1);if((f[e+24>>2]|0)==1){f[c>>2]=f[e+16>>2];i=1}else i=0;j=i}else j=0;else j=1;u=d;return j|0}function Dj(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;if(!c){d=0;return d|0}e=c+40|0;g=c+44|0;ci((f[g>>2]|0)-(f[e>>2]|0)>>2,b)|0;h=f[e>>2]|0;e=f[g>>2]|0;if((h|0)!=(e|0)){g=h;do{h=f[g>>2]|0;if(h|0){ci(f[h+40>>2]|0,b)|0;lg(a,b,h)|0}g=g+4|0}while((g|0)!=(e|0))}lg(a,b,c)|0;d=1;return d|0}function Ej(a,c){a=a|0;c=c|0;var d=0;if(!c)return;Ej(a,f[c>>2]|0);Ej(a,f[c+4>>2]|0);a=c+16|0;d=c+28|0;if((b[d+11>>0]|0)<0)Oq(f[d>>2]|0);if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);Oq(c);return}function Fj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;qf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0))g=c;else{h=e+(~((e+-4-c|0)>>>2)<<2)|0;f[d>>2]=h;g=h}f[a+24>>2]=0;f[a+28>>2]=0;if(c|0){if((g|0)!=(c|0))f[d>>2]=g+(~((g+-4-c|0)>>>2)<<2);Oq(c)}c=f[a>>2]|0;if(!c){u=b;return}g=a+4|0;a=f[g>>2]|0;if((a|0)!=(c|0))f[g>>2]=a+(~((a+-8-c|0)>>>3)<<3);Oq(c);u=b;return}function Gj(a){a=a|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0,k=0,l=0;c=a;a:do if(!(c&3)){d=a;e=4}else{g=a;h=c;while(1){if(!(b[g>>0]|0)){i=h;break a}j=g+1|0;h=j;if(!(h&3)){d=j;e=4;break}else g=j}}while(0);if((e|0)==4){e=d;while(1){k=f[e>>2]|0;if(!((k&-2139062144^-2139062144)&k+-16843009))e=e+4|0;else break}if(!((k&255)<<24>>24))l=e;else{k=e;while(1){e=k+1|0;if(!(b[e>>0]|0)){l=e;break}else k=e}}i=l}return i-c|0}function Hj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=a+11|0;i=b[h>>0]|0;j=i<<24>>24<0;if(j)k=f[a+4>>2]|0;else k=i&255;do if(k>>>0>=c>>>0)if(j){i=(f[a>>2]|0)+c|0;b[g>>0]=0;up(i,g);f[a+4>>2]=c;break}else{b[g>>0]=0;up(a+c|0,g);b[h>>0]=c;break}else hj(a,c-k|0,d)|0;while(0);u=e;return}function Ij(a){a=a|0;var b=0,c=0,d=0;if(!a)return;b=a+88|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0){b=f[c+8>>2]|0;if(b|0){d=c+12|0;if((f[d>>2]|0)!=(b|0))f[d>>2]=b;Oq(b)}Oq(c)}c=f[a+68>>2]|0;if(c|0){b=a+72|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c)}c=a+64|0;d=f[c>>2]|0;f[c>>2]=0;if(d|0){c=f[d>>2]|0;if(c|0){b=d+4|0;if((f[b>>2]|0)!=(c|0))f[b>>2]=c;Oq(c)}Oq(d)}Oq(a);return}function Jj(a,c,d,e,g,h,i,j,k,l){a=a|0;c=c|0;d=d|0;e=e|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0;f[a>>2]=d;if(d|0){m=d+16|0;n=f[m+4>>2]|0;o=a+8|0;f[o>>2]=f[m>>2];f[o+4>>2]=n;n=d+24|0;d=f[n+4>>2]|0;o=a+16|0;f[o>>2]=f[n>>2];f[o+4>>2]=d}b[a+24>>0]=e;f[a+28>>2]=g;b[a+32>>0]=h&1;h=a+40|0;f[h>>2]=i;f[h+4>>2]=j;j=a+48|0;f[j>>2]=k;f[j+4>>2]=l;f[a+56>>2]=c;return}function Kj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=ln(88)|0;d=c+60|0;e=c;g=e+60|0;do{f[e>>2]=0;e=e+4|0}while((e|0)<(g|0));f[d>>2]=c;d=c+64|0;f[d>>2]=0;f[d+4>>2]=0;f[d+8>>2]=0;f[d+12>>2]=0;f[d+16>>2]=0;f[d+20>>2]=0;d=cg(c,b)|0;f[a>>2]=d?c:0;a=d?0:c;if(d)return;Ii(a);Oq(a);return}function Lj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;if((f[c+76>>2]|0)>=0?(Tq(c)|0)!=0:0){d=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(g=c+20|0,h=f[g>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[g>>2]=h+1;b[h>>0]=d;i=e}else i=Nj(c,a)|0;Sq(c);j=i}else k=3;do if((k|0)==3){i=a&255;e=a&255;if((e|0)!=(b[c+75>>0]|0)?(d=c+20|0,h=f[d>>2]|0,h>>>0<(f[c+16>>2]|0)>>>0):0){f[d>>2]=h+1;b[h>>0]=i;j=e;break}j=Nj(c,a)|0}while(0);return j|0}function Mj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d+4|0;g=d;h=d+8|0;i=f[a+4>>2]|0;if((i|0)==-1){j=0;u=d;return j|0}b[h>>0]=i;i=c+16|0;a=f[i+4>>2]|0;if(!((a|0)>0|(a|0)==0&(f[i>>2]|0)>>>0>0)){f[g>>2]=f[c+4>>2];f[e>>2]=f[g>>2];Me(c,e,h,h+1|0)|0}j=1;u=d;return j|0}function Nj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0,l=0,m=0,n=0;d=u;u=u+16|0;e=d;g=c&255;b[e>>0]=g;i=a+16|0;j=f[i>>2]|0;if(!j)if(!(vl(a)|0)){k=f[i>>2]|0;l=4}else m=-1;else{k=j;l=4}do if((l|0)==4){j=a+20|0;i=f[j>>2]|0;if(i>>>0>>0?(n=c&255,(n|0)!=(b[a+75>>0]|0)):0){f[j>>2]=i+1;b[i>>0]=g;m=n;break}if((Sa[f[a+36>>2]&31](a,e,1)|0)==1)m=h[e>>0]|0;else m=-1}while(0);u=d;return m|0}function Oj(a,b){a=a|0;b=b|0;if(!b)return;else{Oj(a,f[b>>2]|0);Oj(a,f[b+4>>2]|0);Ej(b+20|0,f[b+24>>2]|0);Oq(b);return}}function Pj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=u;u=u+16|0;g=e;h=e+4|0;f[g>>2]=c;c=ln(32)|0;f[h>>2]=c;f[h+8>>2]=-2147483616;f[h+4>>2]=17;i=c;j=14495;k=i+17|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[c+17>>0]=0;Xj(Hd(a,g)|0,h,d);if((b[h+11>>0]|0)>=0){u=e;return}Oq(f[h>>2]|0);u=e;return}function Qj(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=a+48|0;if((f[a+52>>2]|0)>>>0<=e>>>0)Ce(b,e+1|0,0);c=(f[b>>2]|0)+(e>>>5<<2)|0;f[c>>2]=f[c>>2]|1<<(e&31);c=f[a+36>>2]|0;if((f[a+40>>2]|0)-c>>2>>>0<=e>>>0){d=1;return d|0}Bp(f[c+(e<<2)>>2]|0);d=1;return d|0}function Rj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;if(c>>>0>0|(c|0)==0&a>>>0>4294967295){e=d;f=a;g=c;while(1){c=hn(f|0,g|0,10,0)|0;e=e+-1|0;b[e>>0]=c&255|48;c=f;f=jp(f|0,g|0,10,0)|0;if(!(g>>>0>9|(g|0)==9&c>>>0>4294967295))break;else g=I}h=f;i=e}else{h=a;i=d}if(!h)j=i;else{d=h;h=i;while(1){i=h+-1|0;b[i>>0]=(d>>>0)%10|0|48;if(d>>>0<10){j=i;break}else{d=(d>>>0)/10|0;h=i}}}return j|0}function Sj(a){a=a|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;c=a;while(1){d=c+1|0;if(!(eq(b[c>>0]|0)|0))break;else c=d}a=b[c>>0]|0;switch(a<<24>>24|0){case 45:{e=1;f=5;break}case 43:{e=0;f=5;break}default:{g=0;h=c;i=a}}if((f|0)==5){g=e;h=d;i=b[d>>0]|0}if(!(Aq(i<<24>>24)|0))j=0;else{i=0;d=h;while(1){h=(i*10|0)+48-(b[d>>0]|0)|0;d=d+1|0;if(!(Aq(b[d>>0]|0)|0)){j=h;break}else i=h}}return (g|0?j:0-j|0)|0}function Tj(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=0,h=0;e=u;u=u+16|0;g=e;il(g,d);h=Ai(a,c)|0;c=h+11|0;if((b[c>>0]|0)<0){b[f[h>>2]>>0]=0;f[h+4>>2]=0}else{b[h>>0]=0;b[c>>0]=0}gh(h,0);f[h>>2]=f[g>>2];f[h+4>>2]=f[g+4>>2];f[h+8>>2]=f[g+8>>2];u=e;return}function Uj(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b+8|0;d=b+4|0;e=b;f[e>>2]=f[(f[a+4>>2]|0)+80>>2];g=f[a+44>>2]|0;a=g+16|0;h=f[a+4>>2]|0;if((h|0)>0|(h|0)==0&(f[a>>2]|0)>>>0>0){u=b;return 1}f[d>>2]=f[g+4>>2];f[c>>2]=f[d>>2];Me(g,c,e,e+4|0)|0;u=b;return 1}function Vj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;ll(g,d&1);d=Ai(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}gh(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Wj(a){a=a|0;if(!a)return;Ej(a+24|0,f[a+28>>2]|0);zj(a+12|0,f[a+16>>2]|0);Ej(a,f[a+4>>2]|0);Oq(a);return}function Xj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;ll(g,d);d=Ai(a,c)|0;c=d+11|0;if((b[c>>0]|0)<0){b[f[d>>2]>>0]=0;f[d+4>>2]=0}else{b[d>>0]=0;b[c>>0]=0}gh(d,0);f[d>>2]=f[g>>2];f[d+4>>2]=f[g+4>>2];f[d+8>>2]=f[g+8>>2];u=e;return}function Yj(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0,i=0,j=0,k=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=-1;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}a=e+28|0;if((b[a+11>>0]|0)<0)k=f[a>>2]|0;else k=a;g=Sj(k)|0;h=(g|0)==-1;i=(g|0)!=0;j=h?d:i;return j|0}function Zj(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0,k=0;d=u;u=u+16|0;e=d;if(c>>>0>10){g=0;u=d;return g|0}h=ln(48)|0;f[e>>2]=h;f[e+8>>2]=-2147483600;f[e+4>>2]=33;i=h;j=15987;k=i+33|0;do{b[i>>0]=b[j>>0]|0;i=i+1|0;j=j+1|0}while((i|0)<(k|0));b[h+33>>0]=0;Xj(a,e,c);if((b[e+11>>0]|0)<0)Oq(f[e>>2]|0);g=1;u=d;return g|0}function _j(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=f[b>>2]|0;if((c|0)==-1)return 1;b=c*3|0;if((b|0)==-1)return 1;c=f[a>>2]|0;a=f[c+(b<<2)>>2]|0;d=b+1|0;e=((d>>>0)%3|0|0)==0?b+-2|0:d;if((e|0)==-1)g=-1;else g=f[c+(e<<2)>>2]|0;e=(((b>>>0)%3|0|0)==0?2:-1)+b|0;if((e|0)==-1)h=-1;else h=f[c+(e<<2)>>2]|0;if((a|0)==(g|0))return 1;else return (a|0)==(h|0)|(g|0)==(h|0)|0;return 0}function $j(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0,j=0,k=0;d=0;while(1){if((h[16654+d>>0]|0)==(a|0)){e=2;break}g=d+1|0;if((g|0)==87){i=16742;j=87;e=5;break}else d=g}if((e|0)==2)if(!d)k=16742;else{i=16742;j=d;e=5}if((e|0)==5)while(1){e=0;d=i;do{a=d;d=d+1|0}while((b[a>>0]|0)!=0);j=j+-1|0;if(!j){k=d;break}else{i=d;e=5}}return jq(k,f[c+20>>2]|0)|0}function ak(a,b){a=+a;b=b|0;var c=0,d=0,e=0,g=0.0,h=0.0,i=0,j=0.0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;e=Yn(c|0,d|0,52)|0;switch(e&2047){case 0:{if(a!=0.0){g=+ak(a*18446744073709551616.0,b);h=g;i=(f[b>>2]|0)+-64|0}else{h=a;i=0}f[b>>2]=i;j=h;break}case 2047:{j=a;break}default:{f[b>>2]=(e&2047)+-1022;f[s>>2]=c;f[s+4>>2]=d&-2146435073|1071644672;j=+p[s>>3]}}return +j}function bk(a,b){a=+a;b=b|0;var c=0.0,d=0,e=0,g=0.0,h=0;if((b|0)<=1023)if((b|0)<-1022){c=a*2.2250738585072014e-308;d=(b|0)<-2044;e=b+2044|0;g=d?c*2.2250738585072014e-308:c;h=d?((e|0)>-1022?e:-1022):b+1022|0}else{g=a;h=b}else{c=a*8988465674311579538646525.0e283;e=(b|0)>2046;d=b+-2046|0;g=e?c*8988465674311579538646525.0e283:c;h=e?((d|0)<1023?d:1023):b+-1023|0}b=Tn(h+1023|0,0,52)|0;h=I;f[s>>2]=b;f[s+4>>2]=h;return +(g*+p[s>>3])}function ck(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;if(!(f[a+80>>2]|0)){b=0;return b|0}c=a+8|0;d=a+12|0;a=f[c>>2]|0;if(((f[d>>2]|0)-a|0)>0){e=0;g=a}else{b=1;return b|0}while(1){a=f[g+(e<<2)>>2]|0;e=e+1|0;if(!(Gl(a,a)|0)){b=0;h=5;break}g=f[c>>2]|0;if((e|0)>=((f[d>>2]|0)-g>>2|0)){b=1;h=5;break}}if((h|0)==5)return b|0;return 0}function dk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=a+36|0;d=a+40|0;e=f[c>>2]|0;if((f[d>>2]|0)==(e|0)){g=1;return g|0}h=a+60|0;a=0;i=e;while(1){e=f[i+(a<<2)>>2]|0;a=a+1|0;if(!(Sa[f[(f[e>>2]|0)+20>>2]&31](e,h,b)|0)){g=0;j=5;break}i=f[c>>2]|0;if(a>>>0>=(f[d>>2]|0)-i>>2>>>0){g=1;j=5;break}}if((j|0)==5)return g|0;return 0}function ek(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0;c=a+36|0;d=a+40|0;a=f[c>>2]|0;if((f[d>>2]|0)==(a|0)){e=1;return e|0}else{g=0;h=a}while(1){a=f[h+(g<<2)>>2]|0;g=g+1|0;if(!(Ra[f[(f[a>>2]|0)+24>>2]&127](a,b)|0)){e=0;i=4;break}h=f[c>>2]|0;if(g>>>0>=(f[d>>2]|0)-h>>2>>>0){e=1;i=4;break}}if((i|0)==4)return e|0;return 0}function fk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;f[a>>2]=0;c=a+4|0;f[c>>2]=0;f[a+8>>2]=0;d=b+4|0;e=(f[d>>2]|0)-(f[b>>2]|0)|0;g=e>>2;if(!g)return;if(g>>>0>1073741823)aq(a);h=ln(e)|0;f[c>>2]=h;f[a>>2]=h;f[a+8>>2]=h+(g<<2);g=f[b>>2]|0;b=(f[d>>2]|0)-g|0;if((b|0)<=0)return;kh(h|0,g|0,b|0)|0;f[c>>2]=h+(b>>>2<<2);return}function gk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;c=a+8|0;d=f[a>>2]|0;if((f[c>>2]|0)-d>>2>>>0>=b>>>0)return;e=a+4|0;if(b>>>0>1073741823){g=ra(8)|0;Oo(g,16035);f[g>>2]=7256;va(g|0,1112,110)}g=(f[e>>2]|0)-d|0;h=ln(b<<2)|0;if((g|0)>0)kh(h|0,d|0,g|0)|0;f[a>>2]=h;f[e>>2]=h+(g>>2<<2);f[c>>2]=h+(b<<2);if(!d)return;Oq(d);return}function hk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0,i=0;b=a+36|0;c=a+40|0;d=f[b>>2]|0;if((f[c>>2]|0)==(d|0)){e=1;return e|0}g=a+60|0;a=0;h=d;while(1){d=f[h+(a<<2)>>2]|0;a=a+1|0;if(!(Ra[f[(f[d>>2]|0)+16>>2]&127](d,g)|0)){e=0;i=5;break}h=f[b>>2]|0;if(a>>>0>=(f[c>>2]|0)-h>>2>>>0){e=1;i=5;break}}if((i|0)==5)return e|0;return 0}function ik(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0;d=f[a+176>>2]|0;e=f[a+172>>2]|0;a=e;if((d|0)==(e|0))return 0;g=(d-e|0)/136|0;e=0;while(1){if((f[a+(e*136|0)>>2]|0)==(c|0)){h=4;break}d=e+1|0;if(d>>>0>>0)e=d;else{h=6;break}}if((h|0)==4)return ((b[a+(e*136|0)+100>>0]|0)==0?0:a+(e*136|0)+4|0)|0;else if((h|0)==6)return 0;return 0}function jk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,h=0,i=0,j=0;d=u;u=u+16|0;e=d;g=ln(16)|0;f[e>>2]=g;f[e+8>>2]=-2147483632;f[e+4>>2]=15;h=g;i=14479;j=h+15|0;do{b[h>>0]=b[i>>0]|0;h=h+1|0;i=i+1|0}while((h|0)<(j|0));b[g+15>>0]=0;Xj(a,e,c);if((b[e+11>>0]|0)>=0){u=d;return}Oq(f[e>>2]|0);u=d;return}function kk(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[a+72>>2]|0;if(!c){d=0;return d|0}f[c+4>>2]=a+60;if(!(Qa[f[(f[c>>2]|0)+12>>2]&127](c)|0)){d=0;return d|0}if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){d=0;return d|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){d=0;return d|0}d=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return d|0}function lk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;f[a>>2]=0;d=a+4|0;f[d>>2]=0;f[a+8>>2]=0;if(!b)return;if(b>>>0>357913941)aq(a);e=ln(b*12|0)|0;f[d>>2]=e;f[a>>2]=e;f[a+8>>2]=e+(b*12|0);a=b;b=e;do{fk(b,c);b=(f[d>>2]|0)+12|0;f[d>>2]=b;a=a+-1|0}while((a|0)!=0);return}function mk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0;c=f[b>>2]|0;if(!c){d=0;return d|0}e=a+44|0;g=f[e>>2]|0;if(g>>>0<(f[a+48>>2]|0)>>>0){f[b>>2]=0;f[g>>2]=c;f[e>>2]=(f[e>>2]|0)+4;d=1;return d|0}else{Ug(a+40|0,b);d=1;return d|0}return 0}function nk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3564;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3588;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function ok(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3344;f[a+40>>2]=1196;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a>>2]=1476;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){Ni(a);Oq(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);Ni(a);Oq(a);return}function pk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0,i=0;f[c>>2]=2;d=a+4|0;a=c+8|0;e=f[a>>2]|0;g=(f[c+12>>2]|0)-e|0;if(g>>>0<4294967292){Lk(a,g+4|0,0);i=f[a>>2]|0}else i=e;e=i+g|0;g=h[d>>0]|h[d+1>>0]<<8|h[d+2>>0]<<16|h[d+3>>0]<<24;b[e>>0]=g;b[e+1>>0]=g>>8;b[e+2>>0]=g>>16;b[e+3>>0]=g>>24;return}function qk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3612;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3636;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function rk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2188;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c){Oq(a);return}b=a+36|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c);Oq(a);return}function sk(a,c,d){a=a|0;c=c|0;d=$(d);var e=0,g=Oa,h=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=d;return $(g)}a=e+28|0;if((b[a+11>>0]|0)<0)h=f[a>>2]|0;else h=a;g=$(+Iq(h));return $(g)}function tk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=u;u=u+16|0;c=b;d=c;f[d>>2]=0;f[d+4>>2]=0;qf(a,2,c);c=f[a+12>>2]|0;d=a+16|0;e=f[d>>2]|0;if((e|0)==(c|0)){g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}f[d>>2]=e+(~((e+-4-c|0)>>>2)<<2);g=a+24|0;f[g>>2]=0;h=a+28|0;f[h>>2]=0;u=b;return}function uk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0,i=0,j=0;c=f[a+176>>2]|0;d=f[a+172>>2]|0;e=d;a:do if((c|0)!=(d|0)){g=(c-d|0)/136|0;h=0;while(1){if((f[e+(h*136|0)>>2]|0)==(b|0))break;i=h+1|0;if(i>>>0>>0)h=i;else break a}j=e+(h*136|0)+104|0;return j|0}while(0);j=a+40|0;return j|0}function vk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3564;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3588;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b)return;Oq(b);return}function wk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1768;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c){Oq(a);return}b=a+36|0;d=f[b>>2]|0;if((d|0)!=(c|0))f[b>>2]=d+(~((d+-4-c|0)>>>2)<<2);Oq(c);Oq(a);return}function xk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3344;f[a+40>>2]=1196;b=f[a+48>>2]|0;if(b|0){c=a+52|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a>>2]=1476;b=a+36|0;d=f[b>>2]|0;f[b>>2]=0;if(!d){Ni(a);return}Va[f[(f[d>>2]|0)+4>>2]&127](d);Ni(a);return}function yk(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,g=0,h=0;Nc(a,b);if((b|0)<=-1)return;c=a+88|0;d=f[c>>2]|0;e=f[a+84>>2]|0;if((d-e>>2|0)<=(b|0))return;a=e+(b<<2)|0;b=a+4|0;e=d-b|0;g=e>>2;if(!g)h=d;else{im(a|0,b|0,e|0)|0;h=f[c>>2]|0}e=a+(g<<2)|0;if((h|0)==(e|0))return;f[c>>2]=h+(~((h+-4-e|0)>>>2)<<2);return}function zk(a){a=a|0;var b=0,c=0,d=0,e=0,g=0,h=0;b=f[a+32>>2]|0;c=f[a+36>>2]|0;if((b|0)==(c|0)){d=1;return d|0}e=a+8|0;g=a+44|0;a=b;while(1){b=f[(f[e>>2]|0)+(f[a>>2]<<2)>>2]|0;a=a+4|0;if(!(Ra[f[(f[b>>2]|0)+20>>2]&127](b,f[g>>2]|0)|0)){d=0;h=5;break}if((a|0)==(c|0)){d=1;h=5;break}}if((h|0)==5)return d|0;return 0}function Ak(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=3612;b=f[a+64>>2]|0;if(b|0){c=a+68|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}f[a+12>>2]=3636;b=f[a+32>>2]|0;if(b|0)Oq(b);b=f[a+20>>2]|0;if(!b)return;Oq(b);return}function Bk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0,i=0.0;d=u;u=u+128|0;e=d;g=e;h=g+124|0;do{f[g>>2]=0;g=g+4|0}while((g|0)<(h|0));g=e+4|0;f[g>>2]=a;h=e+8|0;f[h>>2]=-1;f[e+44>>2]=a;f[e+76>>2]=-1;Ym(e,0);i=+Rc(e,c,1);c=(f[g>>2]|0)-(f[h>>2]|0)+(f[e+108>>2]|0)|0;if(b|0)f[b>>2]=c|0?a+c|0:a;u=d;return +i}function Ck(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var g=0,h=0;a=c+16|0;g=f[a>>2]|0;do if(g){if((g|0)!=(d|0)){h=c+36|0;f[h>>2]=(f[h>>2]|0)+1;f[c+24>>2]=2;b[c+54>>0]=1;break}h=c+24|0;if((f[h>>2]|0)==2)f[h>>2]=e}else{f[a>>2]=d;f[c+24>>2]=e;f[c+36>>2]=1}while(0);return}function Dk(a){a=a|0;var b=0,c=0;f[a>>2]=2188;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c)return;b=a+36|0;a=f[b>>2]|0;if((a|0)!=(c|0))f[b>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Ek(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=a+20|0;c=a+28|0;if((f[d>>2]|0)>>>0>(f[c>>2]|0)>>>0)Sa[f[a+36>>2]&31](a,0,0)|0;f[a+16>>2]=0;f[c>>2]=0;f[d>>2]=0;d=f[a>>2]|0;if(!(d&4)){c=(f[a+44>>2]|0)+(f[a+48>>2]|0)|0;f[a+8>>2]=c;f[a+4>>2]=c;e=d<<27>>31}else{f[a>>2]=d|32;e=-1}return e|0}function Fk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=Rg(a,c)|0;if((d|0)==(a+4|0)){e=0;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=((Sj(g)|0)+1|0)>>>0>1;return e|0}function Gk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=6152;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+84>>2]|0;if(!b){Og(a);Oq(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b);Og(a);Oq(a);return}function Hk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,g=0,h=0;e=Rg(a,c)|0;if((e|0)==(a+4|0)){g=d;return g|0}d=e+28|0;if((b[d+11>>0]|0)<0)h=f[d>>2]|0;else h=d;g=Sj(h)|0;return g|0}function Ik(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=b>>31|((b|0)<0?-1:0)<<1;f=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;g=d>>31|((d|0)<0?-1:0)<<1;h=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;i=Xn(e^a|0,f^b|0,e|0,f|0)|0;b=I;a=g^e;e=h^f;return Xn((Ld(i,b,Xn(g^c|0,h^d|0,g|0,h|0)|0,I,0)|0)^a|0,I^e|0,a|0,e|0)|0}function Jk(a){a=a|0;var b=0,c=0;f[a>>2]=1768;b=f[a+76>>2]|0;if(b|0)Oq(b);b=a+68|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Mq(c);f[a>>2]=1544;c=f[a+32>>2]|0;if(!c)return;b=a+36|0;a=f[b>>2]|0;if((a|0)!=(c|0))f[b>>2]=a+(~((a+-4-c|0)>>>2)<<2);Oq(c);return}function Kk(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0,i=0,j=0;f[a>>2]=b;h=b+16|0;i=f[h+4>>2]|0;j=a+8|0;f[j>>2]=f[h>>2];f[j+4>>2]=i;i=b+24|0;b=f[i+4>>2]|0;j=a+16|0;f[j>>2]=f[i>>2];f[j+4>>2]=b;b=a+40|0;f[b>>2]=c;f[b+4>>2]=d;d=a+48|0;f[d>>2]=e;f[d+4>>2]=g;return}function Lk(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;h=e;e=d;if(g>>>0>=b>>>0){if(g>>>0>b>>>0?(d=h+b|0,(d|0)!=(e|0)):0)f[c>>2]=d}else Fi(a,b-g|0);g=a+24|0;a=g;b=Vn(f[a>>2]|0,f[a+4>>2]|0,1,0)|0;a=g;f[a>>2]=b;f[a+4>>2]=I;return}function Mk(a,c){a=a|0;c=c|0;var d=0,e=0,g=0;d=Rg(a,c)|0;if((d|0)==(a+4|0)){e=-1;return e|0}a=d+28|0;if((b[a+11>>0]|0)<0)g=f[a>>2]|0;else g=a;e=Sj(g)|0;return e|0}function Nk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=6152;b=f[a+96>>2]|0;if(b|0){c=a+100|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~(((d+-12-b|0)>>>0)/12|0)*12|0);Oq(b)}b=f[a+84>>2]|0;if(!b){Og(a);return}d=a+88|0;c=f[d>>2]|0;if((c|0)!=(b|0))f[d>>2]=c+(~((c+-4-b|0)>>>2)<<2);Oq(b);Og(a);return}function Ok(a){a=a|0;var c=0,d=0,e=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=1;c=a+68|0;d=a+28|0;e=d+40|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(e|0));f[c>>2]=a;c=a+72|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;f[c+20>>2]=0;return}function Pk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2244;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Qk(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0;f=u;u=u+256|0;g=f;if((c|0)>(d|0)&(e&73728|0)==0){e=c-d|0;sj(g|0,b<<24>>24|0,(e>>>0<256?e:256)|0)|0;if(e>>>0>255){b=c-d|0;d=e;do{Xo(a,g,256);d=d+-256|0}while(d>>>0>255);h=b&255}else h=e;Xo(a,g,h)}u=f;return}function Rk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1824;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Sk(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;var h=0;if(fp(a,f[b+8>>2]|0,g)|0)qj(0,b,c,d,e);else{h=f[a+8>>2]|0;_a[f[(f[h>>2]|0)+20>>2]&3](h,b,c,d,e,g)}return}function Tk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=2300;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Uk(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1880;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Vk(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;a:do if(!d)e=0;else{f=a;g=d;h=c;while(1){i=b[f>>0]|0;j=b[h>>0]|0;if(i<<24>>24!=j<<24>>24)break;g=g+-1|0;if(!g){e=0;break a}else{f=f+1|0;h=h+1|0}}e=(i&255)-(j&255)|0}while(0);return e|0}function Wk(a){a=a|0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function Xk(a){a=a|0;var b=0,c=0;f[a>>2]=2244;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Yk(a){a=a|0;var c=0,d=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;c=0;while(1){if((c|0)==3)break;f[a+(c<<2)>>2]=0;c=c+1|0}if((b[a+11>>0]|0)<0)d=(f[a+8>>2]&2147483647)+-1|0;else d=10;Hj(a,d,0);return}function Zk(a){a=a|0;var b=0,c=0,d=0,e=0.0,g=0.0;b=f[a+8>>2]|0;if((b|0)<2){c=0;d=0;I=c;return d|0}e=+(b|0);g=+Zg(e)*e;e=+W(+(g-+p[a>>3]));c=+K(e)>=1.0?(e>0.0?~~+Y(+J(e/4294967296.0),4294967295.0)>>>0:~~+W((e-+(~~e>>>0))/4294967296.0)>>>0):0;d=~~e>>>0;I=c;return d|0}function _k(a){a=a|0;var b=0,c=0;f[a>>2]=1824;b=f[a+76>>2]|0;if(b|0)Oq(b);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function $k(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;e=f[b+32>>2]|0;if(e|0){d=e;return d|0}d=f[b+8>>2]|0;return d|0}function al(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1232;b=f[a+16>>2]|0;if(b|0){c=a+20|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b)}b=f[a+4>>2]|0;if(!b)return;d=a+8|0;a=f[d>>2]|0;if((a|0)!=(b|0))f[d>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function bl(a){a=a|0;var b=0,c=0;f[a>>2]=2300;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function cl(a){a=a|0;if(!(f[a+64>>2]|0))return 0;if(!(f[a+68>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function dl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;if(fp(a,f[b+8>>2]|0,0)|0)Ck(0,b,c,d);else{e=f[a+8>>2]|0;Ya[f[(f[e>>2]|0)+28>>2]&3](e,b,c,d)}return}function el(a){a=a|0;var b=0,c=0;f[a>>2]=1880;Fj(a+108|0);f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function fl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+36>>2]&127](d,b)|0;return c|0}function gl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)<0){c=0;return c|0}d=f[a+4>>2]|0;if(((f[d+12>>2]|0)-(f[d+8>>2]|0)>>2|0)<=(b|0)){c=0;return c|0}d=f[(f[a+8>>2]|0)+(f[(f[a+20>>2]|0)+(b<<2)>>2]<<2)>>2]|0;c=Ra[f[(f[d>>2]|0)+32>>2]&127](d,b)|0;return c|0}function hl(a,c){a=a|0;c=c|0;var d=0,e=0,f=0,g=0;d=b[a>>0]|0;e=b[c>>0]|0;if(d<<24>>24==0?1:d<<24>>24!=e<<24>>24){f=e;g=d}else{d=c;c=a;do{c=c+1|0;d=d+1|0;a=b[c>>0]|0;e=b[d>>0]|0}while(!(a<<24>>24==0?1:a<<24>>24!=e<<24>>24));f=e;g=a}return (g&255)-(f&255)|0}function il(a,b){a=a|0;b=$(b);var c=0,d=0;c=u;u=u+16|0;d=c;Yk(d);Ei(a,d,b);Bo(d);u=c;return}function jl(a){a=a|0;var b=0,c=0,d=0,e=0,g=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)==(b|0))e=b;else{g=d+(~((d+-4-b|0)>>>2)<<2)|0;f[c>>2]=g;e=g}f[a+12>>2]=0;f[a+16>>2]=0;if(!b)return;if((e|0)!=(b|0))f[c>>2]=e+(~((e+-4-b|0)>>>2)<<2);Oq(b);return}function kl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=f[a+16>>2]|0;if(((f[a+20>>2]|0)-d>>2|0)<=(b|0)){e=-1;return e|0}g=f[d+(b<<2)>>2]|0;if((g|0)<0){e=-1;return e|0}e=f[(f[(f[(f[a+36>>2]|0)+(g<<2)>>2]|0)+16>>2]|0)+(c<<2)>>2]|0;return e|0}function ll(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;Yk(d);Ji(a,d,b);Bo(d);u=c;return}function ml(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0,h=0;d=u;u=u+32|0;e=d;g=d+20|0;f[e>>2]=f[a+60>>2];f[e+4>>2]=0;f[e+8>>2]=b;f[e+12>>2]=g;f[e+16>>2]=c;if((to(za(140,e|0)|0)|0)<0){f[g>>2]=-1;h=-1}else h=f[g>>2]|0;u=d;return h|0}function nl(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=0;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=0;return c|0}b=f[d>>2]|0;if((b|0)==-1){c=0;return c|0}c=f[(f[a+8>>2]|0)+(b<<2)>>2]|0;return c|0}function ol(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=f[a+16>>2]|0;if(((f[a+20>>2]|0)-c>>2|0)<=(b|0)){d=0;return d|0}e=f[c+(b<<2)>>2]|0;if((e|0)<0){d=0;return d|0}b=f[(f[a+36>>2]|0)+(e<<2)>>2]|0;d=(f[b+20>>2]|0)-(f[b+16>>2]|0)>>2;return d|0}function pl(a){a=a|0;if(!(f[a+40>>2]|0))return 0;if(!(f[a+24>>2]|0))return 0;if(!(f[a+28>>2]|0))return 0;if(!(f[a+32>>2]|0))return 0;else return (f[a+36>>2]|0)!=0|0;return 0}function ql(a){a=a|0;var b=0;if(!(f[a+24>>2]|0)){b=0;return b|0}if(!(f[a+28>>2]|0)){b=0;return b|0}if(!(f[a+32>>2]|0)){b=0;return b|0}b=(f[a+36>>2]|0)!=0;return b|0}function rl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0;lh(a,c);f[a>>2]=1408;c=a+72|0;d=a+36|0;a=d+36|0;do{f[d>>2]=0;d=d+4|0}while((d|0)<(a|0));d=f[b>>2]|0;f[b>>2]=0;f[c>>2]=d;return}function sl(a){a=a|0;var b=0,c=0;f[a>>2]=3148;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){Oq(a);return}Mq(c);Oq(a);return}function tl(a,c){a=a|0;c=c|0;var d=0,e=0;d=a;e=c;c=d+64|0;do{f[d>>2]=f[e>>2];d=d+4|0;e=e+4|0}while((d|0)<(c|0));e=a+64|0;f[a+88>>2]=0;f[e>>2]=0;f[e+4>>2]=0;f[e+8>>2]=0;f[e+12>>2]=0;f[e+16>>2]=0;b[e+20>>0]=0;return}function ul(a,c,d,e){a=a|0;c=c|0;d=d|0;e=e|0;var f=0,g=0;if((a|0)==0&(c|0)==0)f=d;else{g=d;d=c;c=a;while(1){a=g+-1|0;b[a>>0]=h[16636+(c&15)>>0]|0|e;c=Yn(c|0,d|0,4)|0;d=I;if((c|0)==0&(d|0)==0){f=a;break}else g=a}}return f|0}function vl(a){a=a|0;var c=0,d=0,e=0;c=a+74|0;d=b[c>>0]|0;b[c>>0]=d+255|d;d=f[a>>2]|0;if(!(d&8)){f[a+8>>2]=0;f[a+4>>2]=0;c=f[a+44>>2]|0;f[a+28>>2]=c;f[a+20>>2]=c;f[a+16>>2]=c+(f[a+48>>2]|0);e=0}else{f[a>>2]=d|32;e=-1}return e|0}function wl(a){a=a|0;if(!(f[a+60>>2]|0))return 0;if(!(f[a+44>>2]|0))return 0;if(!(f[a+48>>2]|0))return 0;if(!(f[a+52>>2]|0))return 0;else return (f[a+56>>2]|0)!=0|0;return 0}function xl(a,b){a=a|0;b=b|0;var c=0,d=0;c=f[b+88>>2]|0;if(!c){d=0;return d|0}if((f[c>>2]|0)!=2){d=0;return d|0}b=f[c+8>>2]|0;f[a+4>>2]=h[b>>0]|h[b+1>>0]<<8|h[b+2>>0]<<16|h[b+3>>0]<<24;d=1;return d|0}function yl(a){a=a|0;var b=0;if(!(f[a+44>>2]|0)){b=0;return b|0}if(!(f[a+48>>2]|0)){b=0;return b|0}if(!(f[a+52>>2]|0)){b=0;return b|0}b=(f[a+56>>2]|0)!=0;return b|0}function zl(a){a=a|0;vj(a);Oq(a);return}function Al(a){a=a|0;var b=0,c=0;f[a>>2]=2784;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){Oq(a);return}Mq(c);Oq(a);return}function Bl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+44>>2]=c;d=1;return d|0}function Cl(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;c=a+4|0;d=f[c>>2]|0;e=f[a>>2]|0;g=d-e|0;if(g>>>0>>0){Fi(a,b-g|0);return}if(g>>>0<=b>>>0)return;g=e+b|0;if((g|0)==(d|0))return;f[c>>2]=g;return}function Dl(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=$(e);f[a+4>>2]=b;Zf(a+8|0,c,c+(d<<2)|0);n[a+20>>2]=e;return}function El(a,b){a=a|0;b=b|0;var c=0;if(!(Qa[f[(f[a>>2]|0)+40>>2]&127](a)|0)){c=0;return c|0}if(!(Ra[f[(f[a>>2]|0)+44>>2]&127](a,b)|0)){c=0;return c|0}c=Ra[f[(f[a>>2]|0)+48>>2]&127](a,b)|0;return c|0}function Fl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+40>>2]=c;d=1;return d|0}function Gl(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=u;u=u+16|0;d=c+4|0;e=c;f[e>>2]=0;f[d>>2]=f[e>>2];e=vc(a,b,d)|0;u=c;return e|0}function Hl(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;d=f[c>>2]|0;c=a;e=b-a>>2;while(1){if(!e)break;a=(e|0)/2|0;b=c+(a<<2)|0;g=(f[b>>2]|0)>>>0>>0;c=g?b+4|0:c;e=g?e+-1-a|0:a}return c|0}function Il(a){a=a|0;var c=0;f[a>>2]=0;c=a+8|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;b[a+24>>0]=1;f[a+28>>2]=9;c=a+40|0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[a+56>>2]=-1;f[a+60>>2]=0;return}function Jl(a){a=a|0;yj(a);Oq(a);return}function Kl(a){a=a|0;var b=0;f[a>>2]=3148;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Mq(a);return}function Ll(a){a=a|0;var c=0,d=0,e=0,g=0,h=0;if(!(Aq(b[f[a>>2]>>0]|0)|0))c=0;else{d=0;while(1){e=f[a>>2]|0;g=(d*10|0)+-48+(b[e>>0]|0)|0;h=e+1|0;f[a>>2]=h;if(!(Aq(b[h>>0]|0)|0)){c=g;break}else d=g}}return c|0}function Ml(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+64>>2]=c;d=1;return d|0}function Nl(a){a=a|0;var b=0,c=0;b=f[r>>2]|0;c=b+a|0;if((a|0)>0&(c|0)<(b|0)|(c|0)<0){ea()|0;ya(12);return -1}f[r>>2]=c;if((c|0)>(da()|0)?(ca()|0)==0:0){f[r>>2]=b;ya(12);return -1}return b|0}function Ol(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0;if((a|0)==0&(c|0)==0)e=d;else{f=d;d=c;c=a;while(1){a=f+-1|0;b[a>>0]=c&7|48;c=Yn(c|0,d|0,3)|0;d=I;if((c|0)==0&(d|0)==0){e=a;break}else f=a}}return e|0}function Pl(a,c){a=a|0;c=c|0;var d=0;if(f[c+56>>2]|0){d=0;return d|0}if((b[c+24>>0]|0)!=3){d=0;return d|0}f[a+60>>2]=c;d=1;return d|0}function Ql(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1544;b=f[a+32>>2]|0;if(!b){Oq(a);return}c=a+36|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function Rl(a,b,c,d,e,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;g=g|0;if(fp(a,f[b+8>>2]|0,g)|0)qj(0,b,c,d,e);return}function Sl(a){a=a|0;var b=0;f[a>>2]=2784;b=f[a+56>>2]|0;if(b|0)Oq(b);b=a+48|0;a=f[b>>2]|0;f[b>>2]=0;if(!a)return;Mq(a);return}function Tl(a){a=a|0;var c=0,d=0,e=0,g=0;c=u;u=u+16|0;d=c;e=f[a+4>>2]|0;g=(f[e+56>>2]|0)-(f[e+52>>2]|0)>>2;b[d>>0]=0;qh(a+20|0,g,d);u=c;return}function Ul(a){a=a|0;Vi(a);Oq(a);return}function Vl(a){a=a|0;var b=0;switch(a|0){case 11:case 2:case 1:{b=1;break}case 4:case 3:{b=2;break}case 6:case 5:{b=4;break}case 8:case 7:{b=8;break}case 9:{b=4;break}case 10:{b=8;break}default:b=-1}return b|0}function Wl(a){a=a|0;var c=0,d=0,e=0,g=0;c=u;u=u+16|0;d=c;e=f[a+4>>2]|0;g=(f[e+28>>2]|0)-(f[e+24>>2]|0)>>2;b[d>>0]=0;qh(a+20|0,g,d);u=c;return}function Xl(){var a=0,b=0;a=ln(40)|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;n[a+16>>2]=$(1.0);b=a+20|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;n[a+36>>2]=$(1.0);return a|0}function Yl(a,b){a=+a;b=+b;var c=0,d=0,e=0;p[s>>3]=a;c=f[s>>2]|0;d=f[s+4>>2]|0;p[s>>3]=b;e=f[s+4>>2]&-2147483648|d&2147483647;f[s>>2]=c;f[s+4>>2]=e;return +(+p[s>>3])}function Zl(a,b,c){a=a|0;b=b|0;c=+c;var d=0,e=0;d=u;u=u+16|0;e=d;p[e>>3]=c;_b(a,b,e);u=d;return}function _l(a){a=a|0;f[a>>2]=3656;Qi(a+8|0);Oq(a);return}function $l(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=u;u=u+16|0;e=d;f[e>>2]=c;fc(a,b,e);u=d;return}function am(a,c){a=a|0;c=c|0;var d=0,e=0;if((a|0)!=(c|0)){d=b[c+11>>0]|0;e=d<<24>>24<0;jj(a,e?f[c>>2]|0:c,e?f[c+4>>2]|0:d&255)|0}return a|0}function bm(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;c=a&65535;d=b&65535;e=X(d,c)|0;f=a>>>16;a=(e>>>16)+(X(d,f)|0)|0;d=b>>>16;b=X(d,c)|0;return (I=(a>>>16)+(X(d,f)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|e&65535|0)|0}function cm(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;c=Gj(b)|0;d=ln(c+13|0)|0;f[d>>2]=c;f[d+4>>2]=c;f[d+8>>2]=0;e=Fp(d)|0;kh(e|0,b|0,c+1|0)|0;f[a>>2]=e;return}function dm(a,b){a=a|0;b=b|0;var c=0,d=0;if((b|0)==-1|(b|0)>4){c=-1;return c|0}d=f[a+20+(b*12|0)>>2]|0;if(((f[a+20+(b*12|0)+4>>2]|0)-d|0)<=0){c=-1;return c|0}c=f[d>>2]|0;return c|0}function em(a){a=a|0;Yi(a);Oq(a);return}function fm(a){a=a|0;f[a>>2]=3656;Qi(a+8|0);return}function gm(a){a=a|0;var b=0,c=0;f[a>>2]=1544;b=f[a+32>>2]|0;if(!b)return;c=a+36|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function hm(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(fp(a,f[b+8>>2]|0,0)|0)Ck(0,b,c,d);return}function im(a,c,d){a=a|0;c=c|0;d=d|0;var e=0;if((c|0)<(a|0)&(a|0)<(c+d|0)){e=a;c=c+d|0;a=a+d|0;while((d|0)>0){a=a-1|0;c=c-1|0;d=d-1|0;b[a>>0]=b[c>>0]|0}a=e}else kh(a,c,d)|0;return a|0}function jm(a){a=a|0;var b=0,c=0,d=0;f[a>>2]=1196;b=f[a+8>>2]|0;if(!b){Oq(a);return}c=a+12|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);Oq(b);Oq(a);return}function km(a){a=a|0;var b=0;f[a>>2]=3204;b=f[a+56>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function lm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=u;u=u+16|0;e=d;f[e>>2]=f[c>>2];g=Sa[f[(f[a>>2]|0)+16>>2]&31](a,b,e)|0;if(g)f[c>>2]=f[e>>2];u=d;return g&1|0}function mm(a,b){a=a|0;b=b|0;var c=0;if(b>>>0>=2){c=0;return c|0}f[a+28>>2]=b;c=1;return c|0}function nm(a){a=a|0;var b=0,c=0;f[a>>2]=3408;b=a+56|0;c=f[b>>2]|0;f[b>>2]=0;if(!c){mj(a);return}Va[f[(f[c>>2]|0)+4>>2]&127](c);mj(a);return}function om(){var a=0,b=0;a=sn()|0;if((a|0?(b=f[a>>2]|0,b|0):0)?(a=b+48|0,(f[a>>2]&-256|0)==1126902528?(f[a+4>>2]|0)==1129074247:0):0)Ho(f[b+12>>2]|0);Ho(Qp()|0)}function pm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,6)|0}function qm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Pf(a,b,c,d,e,f,4)|0}function rm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Wf(a,b,c,d,e,f,2)|0}function sm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Pf(a,b,c,d,e,f,3)|0}function tm(a){a=a|0;var b=0;f[a>>2]=2840;b=f[a+56>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function um(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Wf(a,b,c,d,e,f,1)|0}function vm(a){a=a|0;var c=0;c=b[w+(a&255)>>0]|0;if((c|0)<8)return c|0;c=b[w+(a>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=b[w+(a>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (b[w+(a>>>24)>>0]|0)+24|0}function wm(a,b){a=a|0;b=b|0;var c=0.0,d=0.0,e=0.0,f=0.0;if(!a){c=0.0;return +c}if((b|0)==0|(a|0)==(b|0)){c=0.0;return +c}d=+(b>>>0)/+(a>>>0);e=1.0-d;f=d*+Zg(d);c=-(f+e*+Zg(e));return +c}function xm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;if((b|0)>0)d=0;else return;do{e=f[a+(d<<2)>>2]|0;f[c+(d<<2)>>2]=e<<1^e>>31;d=d+1|0}while((d|0)!=(b|0));return}function ym(a){a=a|0;var b=0;zo(a);f[a>>2]=3344;f[a+40>>2]=1196;f[a+44>>2]=-1;b=a+48|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function zm(a,c){a=a|0;c=c|0;var d=0;b[c+84>>0]=1;a=f[c+68>>2]|0;d=c+72|0;c=f[d>>2]|0;if((c|0)==(a|0))return 1;f[d>>2]=c+(~((c+-4-a|0)>>>2)<<2);return 1}function Am(a){a=a|0;var b=0,c=0;if(pq(a)|0?(b=Mp(f[a>>2]|0)|0,a=b+8|0,c=f[a>>2]|0,f[a>>2]=c+-1,(c+-1|0)<0):0)Oq(b);return}function Bm(a){a=a|0;var b=0,c=0;b=f[a+16>>2]|0;c=(((f[a+12>>2]|0)+1-b|0)/64|0)+b<<3;a=b<<3;b=Vn(c|0,((c|0)<0)<<31>>31|0,a|0,((a|0)<0)<<31>>31|0)|0;return b|0}function Cm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,5)|0}function Dm(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Qf(a,b,c,d,e,f,9)|0}function Em(a){a=a|0;var b=0;f[a>>2]=3204;b=f[a+56>>2]|0;if(!b)return;Oq(b);return}function Fm(a){a=a|0;var b=0,c=0;f[a>>2]=1476;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);Ni(a);Oq(a);return}function Gm(a){a=a|0;var b=0,c=0;f[a>>2]=1196;b=f[a+8>>2]|0;if(!b)return;c=a+12|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Hm(a){a=a|0;var c=0;f[a>>2]=1352;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=-1;c=a+16|0;f[a+32>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;b[c+12>>0]=0;return}function Im(a){a=a|0;var b=0;f[a>>2]=2840;b=f[a+56>>2]|0;if(!b)return;Oq(b);return}function Jm(a){a=a|0;var b=0,c=0;f[a>>2]=1476;b=a+36|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);Ni(a);return}function Km(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Fg(a,b,c,d,e,f);return}function Lm(a){a=a|0;var b=0,c=0;f[a>>2]=3408;b=a+56|0;c=f[b>>2]|0;f[b>>2]=0;if(c|0)Va[f[(f[c>>2]|0)+4>>2]&127](c);mj(a);Oq(a);return}function Mm(a){a=a|0;var b=0,c=0,d=0;b=f[a>>2]|0;c=a+4|0;d=f[c>>2]|0;if((d|0)!=(b|0))f[c>>2]=d+(~((d+-4-b|0)>>>2)<<2);f[a+12>>2]=0;f[a+16>>2]=0;return}function Nm(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,g=0;d=a+20|0;e=f[d>>2]|0;g=(f[a+16>>2]|0)-e|0;a=g>>>0>c>>>0?c:g;kh(e|0,b|0,a|0)|0;f[d>>2]=(f[d>>2]|0)+a;return c|0}function Om(a){a=a|0;var b=0;f[a>>2]=3588;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function Pm(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-8-b|0)>>>3)<<3);Oq(b);return}function Qm(a){a=a|0;var b=0,c=0;b=f[a>>2]|0;if(!b)return;c=a+4|0;a=f[c>>2]|0;if((a|0)!=(b|0))f[c>>2]=a+(~((a+-4-b|0)>>>2)<<2);Oq(b);return}function Rm(a,b){a=a|0;b=b|0;var c=0;c=f[b>>2]|0;return (1<<(c&31)&f[(f[a+28>>2]|0)+(c>>>5<<2)>>2]|0)!=0|0}function Sm(a,b,c){a=a|0;b=b|0;c=c|0;return Sa[f[(f[a>>2]|0)+44>>2]&31](a,b,c)|0}function Tm(a){a=a|0;var c=0;Il(a);c=a+64|0;f[a+88>>2]=0;f[c>>2]=0;f[c+4>>2]=0;f[c+8>>2]=0;f[c+12>>2]=0;f[c+16>>2]=0;b[c+20>>0]=0;return}function Um(a){a=a|0;f[a>>2]=3260;Fj(a+88|0);Oq(a);return}function Vm(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if((f[b+4>>2]|0)==(c|0)?(c=b+28|0,(f[c>>2]|0)!=1):0)f[c>>2]=d;return}function Wm(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;if((Ek(a)|0)==0?(Sa[f[a+32>>2]&31](a,c,1)|0)==1:0)d=h[c>>0]|0;else d=-1;u=b;return d|0}function Xm(a){a=a|0;var b=0;f[a>>2]=3636;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b){Oq(a);return}Oq(b);Oq(a);return}function Ym(a,b){a=a|0;b=b|0;var c=0,d=0,e=0;f[a+104>>2]=b;c=f[a+8>>2]|0;d=f[a+4>>2]|0;e=c-d|0;f[a+108>>2]=e;f[a+100>>2]=(b|0)!=0&(e|0)>(b|0)?d+b|0:c;return}function Zm(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;return}function _m(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=$(f);Km(a,b,c,d,e,f);return}function $m(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return pm(a,b,c,d,e,f)|0}function an(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return qm(a,b,c,d,e,f)|0}function bn(a,b,c){a=a|0;b=b|0;c=c|0;f[a+4>>2]=b;f[a+8>>2]=f[(f[(f[b+4>>2]|0)+8>>2]|0)+(c<<2)>>2];f[a+12>>2]=c;return 1}function cn(a){a=a|0;var b=0,c=0;if(!a)return;b=f[a>>2]|0;if(b|0){c=a+4|0;if((f[c>>2]|0)!=(b|0))f[c>>2]=b;Oq(b)}Oq(a);return}function dn(a){a=a|0;f[a>>2]=2896;Fj(a+88|0);Oq(a);return}function en(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return rm(a,b,c,d,e,f)|0}function fn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return sm(a,b,c,d,e,f)|0}function gn(a){a=a|0;f[a>>2]=3260;Fj(a+88|0);return}function hn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e|0;Ld(a,b,c,d,g)|0;u=e;return (I=f[g+4>>2]|0,f[g>>2]|0)|0}function jn(a){a=a|0;var b=0;eo(a);f[a>>2]=6152;b=a+84|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;f[b+16>>2]=0;f[b+20>>2]=0;return}function kn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return um(a,b,c,d,e,f)|0}function ln(a){a=a|0;var b=0,c=0;b=(a|0)==0?1:a;while(1){a=$a(b)|0;if(a|0){c=a;break}a=Op()|0;if(!a){c=0;break}Ua[a&3]()}return c|0}function mn(a,b,c){a=a|0;b=b|0;c=c|0;ac(a,b,c);return}function nn(a){a=a|0;var b=0;f[a>>2]=3588;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b)return;Oq(b);return}function on(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Cm(a,b,c,d,e,f)|0}function pn(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return Dm(a,b,c,d,e,f)|0}function qn(a){a=a|0;f[a>>2]=2896;Fj(a+88|0);return}function rn(a){a=a|0;var b=0,c=0,d=0;b=u;u=u+16|0;c=b;d=Qq(f[a+60>>2]|0)|0;f[c>>2]=d;d=to(Ba(6,c|0)|0)|0;u=b;return d|0}function sn(){var a=0,b=0;a=u;u=u+16|0;if(!(Ka(19700,3)|0)){b=Ia(f[4926]|0)|0;u=a;return b|0}else Hn(18840,a);return 0}function tn(a){a=a|0;var b=0;f[a>>2]=3636;b=f[a+20>>2]|0;if(b|0)Oq(b);b=f[a+8>>2]|0;if(!b)return;Oq(b);return}function un(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;a=c;c=bm(e,a)|0;f=I;return (I=(X(b,a)|0)+(X(d,e)|0)+f|f&0,c|0|0)|0}function vn(a,b){a=a|0;b=b|0;lh(a,b);f[a>>2]=1292;b=a+36|0;a=b+40|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function wn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;f[a+24>>2]=0;f[a+28>>2]=0;return}function xn(a){a=a|0;var b=0;b=u;u=u+16|0;yc(a);if(!(La(f[4926]|0,0)|0)){u=b;return}else Hn(18939,b)}function yn(a){a=a|0;var b=0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;b=a+16|0;f[b>>2]=0;f[b+4>>2]=0;f[b+8>>2]=0;f[b+12>>2]=0;return}function zn(a,b){a=a|0;b=b|0;return vg(a+40|0,b)|0}function An(a,b){a=a|0;b=b|0;return lj(a,b,lq(b)|0)|0}function Bn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,g=0;e=u;u=u+16|0;g=e;f[g>>2]=d;d=Zi(a,b,c,g)|0;u=e;return d|0}function Cn(a,b){a=a|0;b=b|0;return Mj(a+40|0,b)|0}function Dn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Qh(a,b,c,d)|0}function En(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return uh(a,b,c,d)|0}function Fn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+24>>2]&127](c,b)|0}function Gn(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;f[a+20>>2]=0;b[a+24>>0]=0;return}function Hn(a,b){a=a|0;b=b|0;var c=0,d=0;c=u;u=u+16|0;d=c;f[d>>2]=b;b=f[1556]|0;Ah(b,a,d)|0;Lj(10,b)|0;Ca()}function In(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Ta[a&31](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Jn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+16>>2]&127](c,b)|0}function Kn(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+20>>2]&127](c,b)|0}function Ln(a,b){a=a|0;b=b|0;var c=0;c=f[a+56>>2]|0;return Ra[f[(f[c>>2]|0)+12>>2]&127](c,b)|0}function Mn(){var a=0;a=u;u=u+16|0;if(!(Ja(19704,113)|0)){u=a;return}else Hn(18889,a)}function Nn(a,b,c){a=a|0;b=b|0;c=c|0;Pj(a,b,c);return}function On(a){a=a|0;cf(a);Oq(a);return}function Pn(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;_a[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function Qn(a,b,c){a=a|0;b=b|0;c=c|0;if(b|0)sj(a|0,(kq(c)|0)&255|0,b|0)|0;return a|0}function Rn(a){a=a|0;return 4}function Sn(a,b,c){a=a|0;b=b|0;c=c|0;return ej(0,b,c)|0}function Tn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b<>>32-c;return a<>>0;return (I=b+d+(e>>>0>>0|0)>>>0,e|0)|0}function Wn(a,b){a=a|0;b=b|0;var c=0;if(!b)c=0;else c=Dh(f[b>>2]|0,f[b+4>>2]|0,a)|0;return (c|0?c:a)|0}function Xn(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=b-d>>>0;e=b-d-(c>>>0>a>>>0|0)>>>0;return (I=e,a-c>>>0|0)|0}function Yn(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){I=b>>>c;return a>>>c|(b&(1<>>c-32|0}function Zn(a){a=a|0;var b=0;f[a>>2]=3932;b=a+4|0;a=b+44|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function _n(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return De(a,b,c,d)|0}function $n(a){a=a|0;ff(a);Oq(a);return}function ao(a,b){a=a|0;b=b|0;ji(a);f[a+36>>2]=b;f[a+40>>2]=0;return}function bo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=+d;return $i(a,b,c,d)|0}function co(a){a=a|0;return 5}function eo(a){a=a|0;var b=0;f[a>>2]=6192;b=a+4|0;a=b+80|0;do{f[b>>2]=0;b=b+4|0}while((b|0)<(a|0));return}function fo(a){a=a|0;return 6}function go(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return aj(a,b,c,d)|0}function ho(a,b,c){a=a|0;b=b|0;c=c|0;f[a+28>>2]=b;f[a+32>>2]=c;return 1}function io(a,b){a=a|0;b=b|0;ji(a);f[a+36>>2]=b;f[a+40>>2]=b;return}function jo(a,b,c){a=a|0;b=b|0;c=c|0;Nn(a,b,c);return}function ko(a){a=a|0;var b=0;b=f[a+56>>2]|0;return Qa[f[(f[b>>2]|0)+28>>2]&127](b)|0}function lo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Ve(a,b,c,d,1);return}function mo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Ve(a,b,c,d,0);return}function no(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Xg(a,b,c,d)|0}function oo(a,b,c){a=a|0;b=b|0;c=c|0;return fi(a,b,c)|0}function po(a){a=a|0;var b=0;b=f[a+56>>2]|0;return Qa[f[(f[b>>2]|0)+32>>2]&127](b)|0}function qo(a,b,c){a=a|0;b=b|0;c=c|0;return ej(a,b,c)|0}function ro(a,b,c){a=a|0;b=b|0;c=c|0;return Sn(a,b,c)|0}function so(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Za[a&3](b|0,c|0,d|0,e|0,f|0)}function to(a){a=a|0;var b=0,c=0;if(a>>>0>4294963200){b=Vq()|0;f[b>>2]=0-a;c=-1}else c=a;return c|0}function uo(a,b,c){a=a|0;b=b|0;c=c|0;Li(a,b,c);return}function vo(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;f[a+12>>2]=0;f[a+16>>2]=0;return}function wo(a,b){a=a|0;b=b|0;f[a+8>>2]=b;f[a+12>>2]=-1;return 1}function xo(a,b){a=a|0;b=b|0;f[a+52>>2]=b;ip(a,b);return}function yo(a){a=+a;var b=0;p[s>>3]=a;b=f[s>>2]|0;I=f[s+4>>2]|0;return b|0}function zo(a){a=a|0;Hm(a);f[a>>2]=1476;f[a+36>>2]=0;return}function Ao(a){a=a|0;var b=0;if(!a)b=0;else b=(Eh(a,1056,1144,0)|0)!=0&1;return b|0}function Bo(a){a=a|0;if((b[a+11>>0]|0)<0)Oq(f[a>>2]|0);return}function Co(a){a=a|0;if(!a)return;Va[f[(f[a>>2]|0)+4>>2]&127](a);return}function Do(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;Ya[a&3](b|0,c|0,d|0,e|0)}function Eo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)im(a|0,b|0,c|0)|0;return a|0}function Fo(a,b,c){a=a|0;b=b|0;c=c|0;if(c|0)kh(a|0,b|0,c|0)|0;return a|0}function Go(a,b){a=a|0;b=b|0;return -1}function Ho(a){a=a|0;var b=0;b=u;u=u+16|0;Ua[a&3]();Hn(18992,b)}function Io(a){a=a|0;Lh(a);Oq(a);return}function Jo(a,b,c){a=a|0;b=b|0;c=c|0;Ro(a,b,c);return}function Ko(a,b,c){a=a|0;b=$(b);c=c|0;f[a+4>>2]=c;n[a>>2]=b;return}function Lo(a){a=a|0;To(a);f[a>>2]=3408;f[a+56>>2]=0;return}function Mo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Sa[a&31](b|0,c|0,d|0)|0}function No(a,b){a=a|0;b=b|0;return (wp(a,b)|0)<<24>>24|0}function Oo(a,b){a=a|0;b=b|0;f[a>>2]=7236;cm(a+4|0,b);return}function Po(a,b){a=a|0;b=b|0;var c=0;if(!a)c=0;else c=Pi(a,b,0)|0;return c|0}function Qo(a){a=a|0;return f[a+12>>2]|0}function Ro(a,b,c){a=a|0;b=b|0;c=c|0;uo(a,b,c);return}function So(){var a=0;a=ln(64)|0;Il(a);return a|0}function To(a){a=a|0;Zn(a);f[a>>2]=3764;f[a+52>>2]=0;return}function Uo(a){a=a|0;if(!a)return;bj(a);Oq(a);return}function Vo(a){a=a|0;return Qa[f[(f[a>>2]|0)+60>>2]&127](a)|0}function Wo(a){a=a|0;return f[a+4>>2]|0}function Xo(a,b,c){a=a|0;b=b|0;c=c|0;if(!(f[a>>2]&32))qi(b,c,a)|0;return}function Yo(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;Xa[a&15](b|0,c|0,d|0)}function Zo(){var a=0;a=ln(96)|0;Tm(a);return a|0}function _o(a){a=a|0;var b=0;b=u;u=u+a|0;u=u+15&-16;return b|0}function $o(a){a=a|0;var b=0;b=(Jq()|0)+188|0;return $j(a,f[b>>2]|0)|0}function ap(a){a=a|0;return ((f[a+100>>2]|0)-(f[a+96>>2]|0)|0)/12|0|0}function bp(a,b){a=a|0;b=b|0;kp(a,b);return}function cp(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(3);return 0}function dp(){var a=0;a=ln(12)|0;op(a);return a|0}function ep(a){a=a|0;Ni(a);Oq(a);return}function fp(a,b,c){a=a|0;b=b|0;c=c|0;return (a|0)==(b|0)|0}function gp(a,b){a=a|0;b=b|0;var c=0;c=sp(a|0)|0;return ((b|0)==0?a:c)|0}function hp(a){a=a|0;return (f[a+12>>2]|0)-(f[a+8>>2]|0)>>2|0}function ip(a,b){a=a|0;b=b|0;f[a+4>>2]=b;return}function jp(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Ld(a,b,c,d,0)|0}function kp(a,b){a=a|0;b=b|0;jk(a,b);return}function lp(a){a=a|0;f[a+4>>2]=0;f[a+8>>2]=0;f[a>>2]=a+4;return}function mp(){var a=0;a=ln(84)|0;eo(a);return a|0}function np(a){a=a|0;ui(a);Oq(a);return}function op(a){a=a|0;f[a>>2]=0;f[a+4>>2]=0;f[a+8>>2]=0;return}function pp(a){a=a|0;f[a>>2]=7236;Am(a+4|0);return}function qp(a,b,c){a=a|0;b=b|0;c=c|0;return Ra[a&127](b|0,c|0)|0}function rp(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;aa(10)}function sp(a){a=a|0;return (a&255)<<24|(a>>8&255)<<16|(a>>16&255)<<8|a>>>24|0}function tp(a){a=a|0;To(a);f[a>>2]=3836;return}function up(a,c){a=a|0;c=c|0;b[a>>0]=b[c>>0]|0;return}function vp(a,b,c){a=a|0;b=b|0;c=c|0;return -1}function wp(a,c){a=a|0;c=c|0;return b[(f[a>>2]|0)+c>>0]|0}function xp(a){a=a|0;return (f[a+4>>2]|0)-(f[a>>2]|0)|0}function yp(a){a=a|0;mj(a);Oq(a);return}function zp(a){a=a|0;if(!a)return;Oq(a);return}function Ap(a){a=a|0;n[a>>2]=$(1.0);f[a+4>>2]=1;return}function Bp(a){a=a|0;b[a+28>>0]=1;return}function Cp(a,b){a=a|0;b=b|0;if(!x){x=a;y=b}}function Dp(a){a=a|0;ji(a);return}function Ep(a,b){a=a|0;b=b|0;return 1}function Fp(a){a=a|0;return a+12|0}function Gp(a,b){a=a|0;b=b|0;f[a+80>>2]=b;return}function Hp(a,b,c){a=a|0;b=b|0;c=c|0;Wa[a&7](b|0,c|0)}function Ip(){var a=0;a=ln(36)|0;qq(a);return a|0}function Jp(a){a=a|0;return gq(a+4|0)|0}function Kp(){var a=0;a=ln(108)|0;jn(a);return a|0}function Lp(a){a=a|0;return (b[a+32>>0]|0)!=0|0}function Mp(a){a=a|0;return a+-12|0}function Np(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;aa(9)}function Op(){var a=0;a=f[4927]|0;f[4927]=a+0;return a|0}function Pp(a){a=a|0;return f[a+56>>2]|0}function Qp(){var a=0;a=f[1786]|0;f[1786]=a+0;return a|0}function Rp(a){a=a|0;Og(a);Oq(a);return}function Sp(a){a=a|0;Sq(a);Oq(a);return}function Tp(a){a=a|0;return b[a+24>>0]|0}function Up(a,b){a=a|0;b=b|0;return 0}function Vp(a){a=a|0;return f[a+40>>2]|0}function Wp(a){a=a|0;return f[a+48>>2]|0}function Xp(a,b){a=a|0;b=b|0;return Qa[a&127](b|0)|0}function Yp(a){a=a|0;return f[a+60>>2]|0}function Zp(a){a=a|0;return f[a+28>>2]|0}function _p(a){a=a|0;sa(a|0)|0;om()}function $p(a){a=a|0;pp(a);Oq(a);return}function aq(a){a=a|0;Ca()}function bq(a,b){a=a|0;b=b|0;return $(+Bk(a,b,0))}function cq(a){a=a|0;return 3}function dq(a,b){a=a|0;b=b|0;u=a;v=b}function eq(a){a=a|0;return ((a|0)==32|(a+-9|0)>>>0<5)&1|0}function fq(a){a=a|0;return f[a+80>>2]|0}function gq(a){a=a|0;return f[a>>2]|0}function hq(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;aa(8)}function iq(a,b){a=a|0;b=b|0;Va[a&127](b|0)}function jq(a,b){a=a|0;b=b|0;return Wn(a,b)|0}function kq(a){a=a|0;return a&255|0}function lq(a){a=a|0;return Gj(a)|0}function mq(a,b){a=a|0;b=b|0;return +(+Bk(a,b,1))}function nq(a,b,c){a=a|0;b=b|0;c=c|0;aa(2);return 0}function oq(a){a=a|0;return 2}function pq(a){a=a|0;return 1}function qq(a){a=a|0;Dp(a);return}function rq(a,b){a=+a;b=+b;return +(+Yl(a,b))}function sq(a,b){a=+a;b=b|0;return +(+bk(a,b))}function tq(a,b){a=+a;b=b|0;return +(+ak(a,b))}function uq(){return 3}function vq(a,b,c){a=a|0;b=b|0;c=c|0;aa(7)}function wq(){return 0}function xq(){return -1}function yq(){return ln(1)|0}function zq(){return 4}function Aq(a){a=a|0;return (a+-48|0)>>>0<10|0}function Bq(){return 1}function Cq(){return 2}function Dq(a,b){a=+a;b=+b;return +(+xd(a,b))}function Eq(a,b){a=a|0;b=b|0;aa(1);return 0}function Fq(a){a=a|0;Ha()}function Gq(a){a=a|0;Ua[a&3]()}function Hq(){ua()}function Iq(a){a=a|0;return +(+mq(a,0))}function Jq(){return Yq()|0}function Kq(a,b){a=a|0;b=b|0;aa(6)}function Lq(a){a=a|0;return ln(a)|0}function Mq(a){a=a|0;Oq(a);return}function Nq(a){a=a|0;u=a}function Oq(a){a=a|0;yc(a);return}function Pq(a){a=a|0;I=a}function Qq(a){a=a|0;return a|0}function Rq(a){a=a|0;aa(0);return 0}function Sq(a){a=a|0;return}function Tq(a){a=a|0;return 0}function Uq(){return I|0}function Vq(){return 19632}function Wq(){return u|0}function Xq(a){a=a|0;aa(5)}function Yq(){return 6352}function Zq(){aa(4)} - -// EMSCRIPTEN_END_FUNCS -var Qa=[Rq,oq,pq,pq,oq,gb,Tq,Tq,Tq,hk,kg,pq,Wo,Tq,Tq,pq,Tq,pq,pq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Hq,Oi,Mn];var Va=[Xq,Sq,Mq,Gm,jm,al,Fq,ui,np,Ni,ep,Lh,Io,Jm,Fm,gm,Fq,Ql,Ql,Ql,Jk,wk,_k,Rk,el,Uk,Sq,Mq,Fq,Yi,em,Ql,Ql,Dk,rk,Xk,Pk,bl,Tk,Sq,Mq,Fq,Vi,Ul,Jm,Fm,Sq,Mq,Mq,Mq,yj,Jl,Sl,Al,Im,tm,qn,dn,Sq,Mq,Mq,Mq,vj,zl,Kl,sl,Em,km,gn,Um,Sq,Mq,xk,ok,nm,Lm,ff,$n,vk,nk,nn,Om,Tl,Ak,qk,tn,Xm,Wl,fm,_l,cf,On,mj,Fq,yp,Sq,Mq,Fq,yp,yp,Nk,Gk,sb,Og,Rp,Sq,Sp,Sq,Sq,Sp,pp,$p,$p,xn,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq,Xq];var Wa=[Kq,pk,gg,yk,Nc,Kq,Kq,Kq];var Xa=[vq,Ne,ij,$b,ic,yd,$b,ic,$g,Aj,Lg,Yf,vq,vq,vq,vq];var Ya=[hq,hm,dl,hq];var Za=[Np,tj,oh,Np];var _a=[rp,Rl,Sk,rp];return{___cxa_can_catch:lm,___cxa_is_pointer_type:Ao,___divdi3:Ik,___muldi3:un,___udivdi3:jp,___uremdi3:hn,_bitshift64Lshr:Yn,_bitshift64Shl:Tn,_emscripten_bind_DracoInt8Array_DracoInt8Array_0:dp,_emscripten_bind_DracoInt8Array_GetValue_1:No,_emscripten_bind_DracoInt8Array___destroy___0:cn,_emscripten_bind_DracoInt8Array_size_0:xp,_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2:oo,_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3:En,_emscripten_bind_Encoder_Encoder_0:Ip,_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5:_m,_emscripten_bind_Encoder_SetAttributeQuantization_2:jo,_emscripten_bind_Encoder_SetEncodingMethod_1:bp,_emscripten_bind_Encoder_SetSpeedOptions_2:Jo,_emscripten_bind_Encoder___destroy___0:Wj,_emscripten_bind_GeometryAttribute_GeometryAttribute_0:So,_emscripten_bind_GeometryAttribute___destroy___0:zp,_emscripten_bind_MeshBuilder_AddFacesToMesh_3:no,_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5:pn,_emscripten_bind_MeshBuilder_AddFloatAttribute_5:pn,_emscripten_bind_MeshBuilder_AddInt16Attribute_5:fn,_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5:on,_emscripten_bind_MeshBuilder_AddInt32Attribute_5:on,_emscripten_bind_MeshBuilder_AddInt8Attribute_5:kn,_emscripten_bind_MeshBuilder_AddMetadataToMesh_2:ro,_emscripten_bind_MeshBuilder_AddMetadata_2:qo,_emscripten_bind_MeshBuilder_AddUInt16Attribute_5:an,_emscripten_bind_MeshBuilder_AddUInt32Attribute_5:$m,_emscripten_bind_MeshBuilder_AddUInt8Attribute_5:en,_emscripten_bind_MeshBuilder_MeshBuilder_0:yq,_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3:Dn,_emscripten_bind_MeshBuilder___destroy___0:zp,_emscripten_bind_Mesh_Mesh_0:Kp,_emscripten_bind_Mesh___destroy___0:Co,_emscripten_bind_Mesh_num_attributes_0:hp,_emscripten_bind_Mesh_num_faces_0:ap,_emscripten_bind_Mesh_num_points_0:fq,_emscripten_bind_Mesh_set_num_points_1:Gp,_emscripten_bind_MetadataBuilder_AddDoubleEntry_3:bo,_emscripten_bind_MetadataBuilder_AddIntEntry_3:go,_emscripten_bind_MetadataBuilder_AddStringEntry_3:_n,_emscripten_bind_MetadataBuilder_MetadataBuilder_0:yq,_emscripten_bind_MetadataBuilder___destroy___0:zp,_emscripten_bind_Metadata_Metadata_0:Xl,_emscripten_bind_Metadata___destroy___0:Uo,_emscripten_bind_PointAttribute_PointAttribute_0:Zo,_emscripten_bind_PointAttribute___destroy___0:Ij,_emscripten_bind_PointAttribute_attribute_type_0:Pp,_emscripten_bind_PointAttribute_byte_offset_0:Wp,_emscripten_bind_PointAttribute_byte_stride_0:Vp,_emscripten_bind_PointAttribute_data_type_0:Zp,_emscripten_bind_PointAttribute_normalized_0:Lp,_emscripten_bind_PointAttribute_num_components_0:Tp,_emscripten_bind_PointAttribute_size_0:fq,_emscripten_bind_PointAttribute_unique_id_0:Yp,_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5:pn,_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5:fn,_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5:on,_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5:kn,_emscripten_bind_PointCloudBuilder_AddMetadata_2:qo,_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5:an,_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5:$m,_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5:en,_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0:yq,_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3:Dn,_emscripten_bind_PointCloudBuilder___destroy___0:zp,_emscripten_bind_PointCloud_PointCloud_0:mp,_emscripten_bind_PointCloud___destroy___0:Co,_emscripten_bind_PointCloud_num_attributes_0:hp,_emscripten_bind_PointCloud_num_points_0:fq,_emscripten_bind_VoidPtr___destroy___0:zp,_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE:xq,_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD:wq,_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH:Bq,_emscripten_enum_draco_GeometryAttribute_Type_COLOR:Cq,_emscripten_enum_draco_GeometryAttribute_Type_GENERIC:zq,_emscripten_enum_draco_GeometryAttribute_Type_INVALID:xq,_emscripten_enum_draco_GeometryAttribute_Type_NORMAL:Bq,_emscripten_enum_draco_GeometryAttribute_Type_POSITION:wq,_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD:uq,_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING:Bq,_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING:wq,_emscripten_replace_memory:Pa,_free:yc,_i64Add:Vn,_i64Subtract:Xn,_llvm_bswap_i32:sp,_malloc:$a,_memcpy:kh,_memmove:im,_memset:sj,_sbrk:Nl,dynCall_ii:Xp,dynCall_iii:qp,dynCall_iiii:Mo,dynCall_iiiiiii:In,dynCall_v:Gq,dynCall_vi:iq,dynCall_vii:Hp,dynCall_viii:Yo,dynCall_viiii:Do,dynCall_viiiii:so,dynCall_viiiiii:Pn,establishStackSpace:dq,getTempRet0:Uq,runPostSets:Un,setTempRet0:Pq,setThrew:Cp,stackAlloc:_o,stackRestore:Nq,stackSave:Wq}}) - - -// EMSCRIPTEN_END_ASM -(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var ___divdi3=Module["___divdi3"]=asm["___divdi3"];var ___muldi3=Module["___muldi3"]=asm["___muldi3"];var ___udivdi3=Module["___udivdi3"]=asm["___udivdi3"];var ___uremdi3=Module["___uremdi3"]=asm["___uremdi3"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _bitshift64Shl=Module["_bitshift64Shl"]=asm["_bitshift64Shl"];var _emscripten_bind_DracoInt8Array_DracoInt8Array_0=Module["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"]=asm["_emscripten_bind_DracoInt8Array_DracoInt8Array_0"];var _emscripten_bind_DracoInt8Array_GetValue_1=Module["_emscripten_bind_DracoInt8Array_GetValue_1"]=asm["_emscripten_bind_DracoInt8Array_GetValue_1"];var _emscripten_bind_DracoInt8Array___destroy___0=Module["_emscripten_bind_DracoInt8Array___destroy___0"]=asm["_emscripten_bind_DracoInt8Array___destroy___0"];var _emscripten_bind_DracoInt8Array_size_0=Module["_emscripten_bind_DracoInt8Array_size_0"]=asm["_emscripten_bind_DracoInt8Array_size_0"];var _emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2=Module["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"]=asm["_emscripten_bind_Encoder_EncodeMeshToDracoBuffer_2"];var _emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3=Module["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"]=asm["_emscripten_bind_Encoder_EncodePointCloudToDracoBuffer_3"];var _emscripten_bind_Encoder_Encoder_0=Module["_emscripten_bind_Encoder_Encoder_0"]=asm["_emscripten_bind_Encoder_Encoder_0"];var _emscripten_bind_Encoder_SetAttributeExplicitQuantization_5=Module["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"]=asm["_emscripten_bind_Encoder_SetAttributeExplicitQuantization_5"];var _emscripten_bind_Encoder_SetAttributeQuantization_2=Module["_emscripten_bind_Encoder_SetAttributeQuantization_2"]=asm["_emscripten_bind_Encoder_SetAttributeQuantization_2"];var _emscripten_bind_Encoder_SetEncodingMethod_1=Module["_emscripten_bind_Encoder_SetEncodingMethod_1"]=asm["_emscripten_bind_Encoder_SetEncodingMethod_1"];var _emscripten_bind_Encoder_SetSpeedOptions_2=Module["_emscripten_bind_Encoder_SetSpeedOptions_2"]=asm["_emscripten_bind_Encoder_SetSpeedOptions_2"];var _emscripten_bind_Encoder___destroy___0=Module["_emscripten_bind_Encoder___destroy___0"]=asm["_emscripten_bind_Encoder___destroy___0"];var _emscripten_bind_GeometryAttribute_GeometryAttribute_0=Module["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"]=asm["_emscripten_bind_GeometryAttribute_GeometryAttribute_0"];var _emscripten_bind_GeometryAttribute___destroy___0=Module["_emscripten_bind_GeometryAttribute___destroy___0"]=asm["_emscripten_bind_GeometryAttribute___destroy___0"];var _emscripten_bind_MeshBuilder_AddFacesToMesh_3=Module["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"]=asm["_emscripten_bind_MeshBuilder_AddFacesToMesh_3"];var _emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddFloatAttribute_5=Module["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_MeshBuilder_AddFloatAttribute_5"];var _emscripten_bind_MeshBuilder_AddInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5=Module["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32AttributeToMesh_5"];var _emscripten_bind_MeshBuilder_AddInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddInt8Attribute_5"];var _emscripten_bind_MeshBuilder_AddMetadataToMesh_2=Module["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadataToMesh_2"];var _emscripten_bind_MeshBuilder_AddMetadata_2=Module["_emscripten_bind_MeshBuilder_AddMetadata_2"]=asm["_emscripten_bind_MeshBuilder_AddMetadata_2"];var _emscripten_bind_MeshBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt16Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt32Attribute_5"];var _emscripten_bind_MeshBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_MeshBuilder_AddUInt8Attribute_5"];var _emscripten_bind_MeshBuilder_MeshBuilder_0=Module["_emscripten_bind_MeshBuilder_MeshBuilder_0"]=asm["_emscripten_bind_MeshBuilder_MeshBuilder_0"];var _emscripten_bind_MeshBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_MeshBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_MeshBuilder___destroy___0=Module["_emscripten_bind_MeshBuilder___destroy___0"]=asm["_emscripten_bind_MeshBuilder___destroy___0"];var _emscripten_bind_Mesh_Mesh_0=Module["_emscripten_bind_Mesh_Mesh_0"]=asm["_emscripten_bind_Mesh_Mesh_0"];var _emscripten_bind_Mesh___destroy___0=Module["_emscripten_bind_Mesh___destroy___0"]=asm["_emscripten_bind_Mesh___destroy___0"];var _emscripten_bind_Mesh_num_attributes_0=Module["_emscripten_bind_Mesh_num_attributes_0"]=asm["_emscripten_bind_Mesh_num_attributes_0"];var _emscripten_bind_Mesh_num_faces_0=Module["_emscripten_bind_Mesh_num_faces_0"]=asm["_emscripten_bind_Mesh_num_faces_0"];var _emscripten_bind_Mesh_num_points_0=Module["_emscripten_bind_Mesh_num_points_0"]=asm["_emscripten_bind_Mesh_num_points_0"];var _emscripten_bind_Mesh_set_num_points_1=Module["_emscripten_bind_Mesh_set_num_points_1"]=asm["_emscripten_bind_Mesh_set_num_points_1"];var _emscripten_bind_MetadataBuilder_AddDoubleEntry_3=Module["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddDoubleEntry_3"];var _emscripten_bind_MetadataBuilder_AddIntEntry_3=Module["_emscripten_bind_MetadataBuilder_AddIntEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddIntEntry_3"];var _emscripten_bind_MetadataBuilder_AddStringEntry_3=Module["_emscripten_bind_MetadataBuilder_AddStringEntry_3"]=asm["_emscripten_bind_MetadataBuilder_AddStringEntry_3"];var _emscripten_bind_MetadataBuilder_MetadataBuilder_0=Module["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"]=asm["_emscripten_bind_MetadataBuilder_MetadataBuilder_0"];var _emscripten_bind_MetadataBuilder___destroy___0=Module["_emscripten_bind_MetadataBuilder___destroy___0"]=asm["_emscripten_bind_MetadataBuilder___destroy___0"];var _emscripten_bind_Metadata_Metadata_0=Module["_emscripten_bind_Metadata_Metadata_0"]=asm["_emscripten_bind_Metadata_Metadata_0"];var _emscripten_bind_Metadata___destroy___0=Module["_emscripten_bind_Metadata___destroy___0"]=asm["_emscripten_bind_Metadata___destroy___0"];var _emscripten_bind_PointAttribute_PointAttribute_0=Module["_emscripten_bind_PointAttribute_PointAttribute_0"]=asm["_emscripten_bind_PointAttribute_PointAttribute_0"];var _emscripten_bind_PointAttribute___destroy___0=Module["_emscripten_bind_PointAttribute___destroy___0"]=asm["_emscripten_bind_PointAttribute___destroy___0"];var _emscripten_bind_PointAttribute_attribute_type_0=Module["_emscripten_bind_PointAttribute_attribute_type_0"]=asm["_emscripten_bind_PointAttribute_attribute_type_0"];var _emscripten_bind_PointAttribute_byte_offset_0=Module["_emscripten_bind_PointAttribute_byte_offset_0"]=asm["_emscripten_bind_PointAttribute_byte_offset_0"];var _emscripten_bind_PointAttribute_byte_stride_0=Module["_emscripten_bind_PointAttribute_byte_stride_0"]=asm["_emscripten_bind_PointAttribute_byte_stride_0"];var _emscripten_bind_PointAttribute_data_type_0=Module["_emscripten_bind_PointAttribute_data_type_0"]=asm["_emscripten_bind_PointAttribute_data_type_0"];var _emscripten_bind_PointAttribute_normalized_0=Module["_emscripten_bind_PointAttribute_normalized_0"]=asm["_emscripten_bind_PointAttribute_normalized_0"];var _emscripten_bind_PointAttribute_num_components_0=Module["_emscripten_bind_PointAttribute_num_components_0"]=asm["_emscripten_bind_PointAttribute_num_components_0"];var _emscripten_bind_PointAttribute_size_0=Module["_emscripten_bind_PointAttribute_size_0"]=asm["_emscripten_bind_PointAttribute_size_0"];var _emscripten_bind_PointAttribute_unique_id_0=Module["_emscripten_bind_PointAttribute_unique_id_0"]=asm["_emscripten_bind_PointAttribute_unique_id_0"];var _emscripten_bind_PointCloudBuilder_AddFloatAttribute_5=Module["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddFloatAttribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddMetadata_2=Module["_emscripten_bind_PointCloudBuilder_AddMetadata_2"]=asm["_emscripten_bind_PointCloudBuilder_AddMetadata_2"];var _emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt16Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt32Attribute_5"];var _emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5=Module["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"]=asm["_emscripten_bind_PointCloudBuilder_AddUInt8Attribute_5"];var _emscripten_bind_PointCloudBuilder_PointCloudBuilder_0=Module["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"]=asm["_emscripten_bind_PointCloudBuilder_PointCloudBuilder_0"];var _emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3=Module["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"]=asm["_emscripten_bind_PointCloudBuilder_SetMetadataForAttribute_3"];var _emscripten_bind_PointCloudBuilder___destroy___0=Module["_emscripten_bind_PointCloudBuilder___destroy___0"]=asm["_emscripten_bind_PointCloudBuilder___destroy___0"];var _emscripten_bind_PointCloud_PointCloud_0=Module["_emscripten_bind_PointCloud_PointCloud_0"]=asm["_emscripten_bind_PointCloud_PointCloud_0"];var _emscripten_bind_PointCloud___destroy___0=Module["_emscripten_bind_PointCloud___destroy___0"]=asm["_emscripten_bind_PointCloud___destroy___0"];var _emscripten_bind_PointCloud_num_attributes_0=Module["_emscripten_bind_PointCloud_num_attributes_0"]=asm["_emscripten_bind_PointCloud_num_attributes_0"];var _emscripten_bind_PointCloud_num_points_0=Module["_emscripten_bind_PointCloud_num_points_0"]=asm["_emscripten_bind_PointCloud_num_points_0"];var _emscripten_bind_VoidPtr___destroy___0=Module["_emscripten_bind_VoidPtr___destroy___0"]=asm["_emscripten_bind_VoidPtr___destroy___0"];var _emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=Module["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"]=asm["_emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE"];var _emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=Module["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"]=asm["_emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD"];var _emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=Module["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"]=asm["_emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH"];var _emscripten_enum_draco_GeometryAttribute_Type_COLOR=Module["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_COLOR"];var _emscripten_enum_draco_GeometryAttribute_Type_GENERIC=Module["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_GENERIC"];var _emscripten_enum_draco_GeometryAttribute_Type_INVALID=Module["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_INVALID"];var _emscripten_enum_draco_GeometryAttribute_Type_NORMAL=Module["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_NORMAL"];var _emscripten_enum_draco_GeometryAttribute_Type_POSITION=Module["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_POSITION"];var _emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=Module["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"]=asm["_emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_EDGEBREAKER_ENCODING"];var _emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING=Module["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"]=asm["_emscripten_enum_draco_MeshEncoderMethod_MESH_SEQUENTIAL_ENCODING"];var _emscripten_replace_memory=Module["_emscripten_replace_memory"]=asm["_emscripten_replace_memory"];var _free=Module["_free"]=asm["_free"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _i64Subtract=Module["_i64Subtract"]=asm["_i64Subtract"];var _llvm_bswap_i32=Module["_llvm_bswap_i32"]=asm["_llvm_bswap_i32"];var _malloc=Module["_malloc"]=asm["_malloc"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var _memmove=Module["_memmove"]=asm["_memmove"];var _memset=Module["_memset"]=asm["_memset"];var _sbrk=Module["_sbrk"]=asm["_sbrk"];var establishStackSpace=Module["establishStackSpace"]=asm["establishStackSpace"];var getTempRet0=Module["getTempRet0"]=asm["getTempRet0"];var runPostSets=Module["runPostSets"]=asm["runPostSets"];var setTempRet0=Module["setTempRet0"]=asm["setTempRet0"];var setThrew=Module["setThrew"]=asm["setThrew"];var stackAlloc=Module["stackAlloc"]=asm["stackAlloc"];var stackRestore=Module["stackRestore"]=asm["stackRestore"];var stackSave=Module["stackSave"]=asm["stackSave"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_iii=Module["dynCall_iii"]=asm["dynCall_iii"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_vii=Module["dynCall_vii"]=asm["dynCall_vii"];var dynCall_viii=Module["dynCall_viii"]=asm["dynCall_viii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];Module["asm"]=asm;if(memoryInitializer){if(!isDataURI(memoryInitializer)){if(typeof Module["locateFile"]==="function"){memoryInitializer=Module["locateFile"](memoryInitializer)}else if(Module["memoryInitializerPrefixURL"]){memoryInitializer=Module["memoryInitializerPrefixURL"]+memoryInitializer}}if(ENVIRONMENT_IS_NODE||ENVIRONMENT_IS_SHELL){var data=Module["readBinary"](memoryInitializer);HEAPU8.set(data,GLOBAL_BASE)}else{addRunDependency("memory initializer");var applyMemoryInitializer=(function(data){if(data.byteLength)data=new Uint8Array(data);HEAPU8.set(data,GLOBAL_BASE);if(Module["memoryInitializerRequest"])delete Module["memoryInitializerRequest"].response;removeRunDependency("memory initializer")});function doBrowserLoad(){Module["readAsync"](memoryInitializer,applyMemoryInitializer,(function(){throw"could not load memory initializer "+memoryInitializer}))}var memoryInitializerBytes=tryParseAsDataURI(memoryInitializer);if(memoryInitializerBytes){applyMemoryInitializer(memoryInitializerBytes.buffer)}else if(Module["memoryInitializerRequest"]){function useRequest(){var request=Module["memoryInitializerRequest"];var response=request.response;if(request.status!==200&&request.status!==0){var data=tryParseAsDataURI(Module["memoryInitializerRequestURL"]);if(data){response=data.buffer}else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+request.status+", retrying "+memoryInitializer);doBrowserLoad();return}}applyMemoryInitializer(response)}if(Module["memoryInitializerRequest"].response){setTimeout(useRequest,0)}else{Module["memoryInitializerRequest"].addEventListener("load",useRequest)}}else{doBrowserLoad()}}}Module["then"]=(function(func){if(Module["calledRun"]){func(Module)}else{var old=Module["onRuntimeInitialized"];Module["onRuntimeInitialized"]=(function(){if(old)old();func(Module)})}return Module});function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};function run(args){args=args||Module["arguments"];if(runDependencies>0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();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&&Module["noExitRuntime"]&&status===0){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}Module["quit"](status,new ExitStatus(status))}Module["exit"]=exit;function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;throw"abort("+what+"). Build with -s ASSERTIONS=1 for more info."}Module["abort"]=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}Module["noExitRuntime"]=true;run();function WrapperObject(){}WrapperObject.prototype=Object.create(WrapperObject.prototype);WrapperObject.prototype.constructor=WrapperObject;WrapperObject.prototype.__class__=WrapperObject;WrapperObject.__cache__={};Module["WrapperObject"]=WrapperObject;function getCache(__class__){return(__class__||WrapperObject).__cache__}Module["getCache"]=getCache;function wrapPointer(ptr,__class__){var cache=getCache(__class__);var ret=cache[ptr];if(ret)return ret;ret=Object.create((__class__||WrapperObject).prototype);ret.ptr=ptr;return cache[ptr]=ret}Module["wrapPointer"]=wrapPointer;function castObject(obj,__class__){return wrapPointer(obj.ptr,__class__)}Module["castObject"]=castObject;Module["NULL"]=wrapPointer(0);function destroy(obj){if(!obj["__destroy__"])throw"Error: Cannot destroy object. (Did you create it yourself?)";obj["__destroy__"]();delete getCache(obj.__class__)[obj.ptr]}Module["destroy"]=destroy;function compare(obj1,obj2){return obj1.ptr===obj2.ptr}Module["compare"]=compare;function getPointer(obj){return obj.ptr}Module["getPointer"]=getPointer;function getClass(obj){return obj.__class__}Module["getClass"]=getClass;var ensureCache={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:(function(){if(ensureCache.needed){for(var i=0;i=ensureCache.size){assert(len>0);ensureCache.needed+=len;ret=Module["_malloc"](len);ensureCache.temps.push(ret)}else{ret=ensureCache.buffer+ensureCache.pos;ensureCache.pos+=len}return ret}),copy:(function(array,view,offset){var offsetShifted=offset;var bytes=view.BYTES_PER_ELEMENT;switch(bytes){case 2:offsetShifted>>=1;break;case 4:offsetShifted>>=2;break;case 8:offsetShifted>>=3;break}for(var i=0;i>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE? -$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+k+"$"+l),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:n})))}; -$jscomp.polyfill("Promise",function(h){function n(){this.batch_=null}function k(f){return f instanceof l?f:new l(function(q,u){q(f)})}if(h&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return h;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)}; -var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q=y}},"es6","es3"); -$jscomp.polyfill("Array.prototype.copyWithin",function(h){function n(k){k=Number(k);return Infinity===k||-Infinity===k?k:k|0}return h?h:function(k,p,l){var y=this.length;k=n(k);p=n(p);l=void 0===l?y:n(l);k=0>k?Math.max(y+k,0):Math.min(k,y);p=0>p?Math.max(y+p,0):Math.min(p,y);l=0>l?Math.max(y+l,0):Math.min(l,y);if(kp;)--l in this?this[--k]=this[l]:delete this[--k];return this}},"es6","es3"); -$jscomp.typedArrayCopyWithin=function(h){return h?h:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); -$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); -var DracoDecoderModule=function(){var h="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(h=h||__filename);return function(n){function k(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b){if(e){var c=ia;var d=e+b;for(b=e;c[b]&&!(b>=d);)++b;if(16g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}c=d}}else c="";return c}function l(){var e=ja.buffer;a.HEAP8=W=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ia=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=Y=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function y(e){if(a.onAbort)a.onAbort(e); -e="Aborted("+e+")";da(e);sa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function f(e){try{if(e==P&&ea)return new Uint8Array(ea);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){y(b)}}function q(){if(!ea&&(ta||fa)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return f(P)}); -if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return f(P)})}function u(e){for(;0>2]=b};this.get_type=function(){return Y[this.ptr+4>>2]};this.set_destructor=function(b){Y[this.ptr+8>>2]=b};this.get_destructor=function(){return Y[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){W[this.ptr+ -12>>0]=b?1:0};this.get_caught=function(){return 0!=W[this.ptr+12>>0]};this.set_rethrown=function(b){W[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=W[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){Y[this.ptr+ -16>>2]=b};this.get_adjusted_ptr=function(){return Y[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ua(this.get_type()))return Y[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function F(){function e(){if(!la&&(la=!0,a.calledRun=!0,!sa)){va=!0;u(oa);wa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)xa.unshift(a.postRun.shift());u(xa)}}if(!(0=d?b++:2047>=d?b+=2:55296<=d&&57343>= -d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0=t){var aa=e.charCodeAt(++g);t=65536+((t&1023)<<10)|aa&1023}if(127>=t){if(c>=d)break;b[c++]=t}else{if(2047>=t){if(c+1>=d)break;b[c++]=192|t>>6}else{if(65535>=t){if(c+2>=d)break;b[c++]=224|t>>12}else{if(c+3>=d)break;b[c++]=240|t>>18;b[c++]=128|t>>12&63}b[c++]=128|t>>6&63}b[c++]=128|t&63}}b[c]=0}e=r.alloc(b,W);r.copy(b,W,e);return e}return e}function Z(e){if("object"=== -typeof e){var b=r.alloc(e,W);r.copy(e,W,b);return b}return e}function X(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=za();w(S)[this.ptr]=this}function Q(){this.ptr=Aa();w(Q)[this.ptr]=this}function V(){this.ptr=Ba();w(V)[this.ptr]=this}function x(){this.ptr=Ca();w(x)[this.ptr]=this}function D(){this.ptr=Da();w(D)[this.ptr]=this}function G(){this.ptr=Ea();w(G)[this.ptr]=this}function H(){this.ptr=Fa();w(H)[this.ptr]=this}function E(){this.ptr=Ga();w(E)[this.ptr]= -this}function T(){this.ptr=Ha();w(T)[this.ptr]=this}function C(){throw"cannot construct a Status, no constructor in IDL";}function I(){this.ptr=Ia();w(I)[this.ptr]=this}function J(){this.ptr=Ja();w(J)[this.ptr]=this}function K(){this.ptr=Ka();w(K)[this.ptr]=this}function L(){this.ptr=La();w(L)[this.ptr]=this}function M(){this.ptr=Ma();w(M)[this.ptr]=this}function N(){this.ptr=Na();w(N)[this.ptr]=this}function O(){this.ptr=Oa();w(O)[this.ptr]=this}function z(){this.ptr=Pa();w(z)[this.ptr]=this}function m(){this.ptr= -Qa();w(m)[this.ptr]=this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},wa,ka;a.ready=new Promise(function(e,b){wa=e;ka=b});var Ra=!1,Sa=!1;a.onRuntimeInitialized=function(){Ra=!0;if(Sa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Sa=!0;if(Ra&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3=e[1]?!0:0!=e[0]||10< -e[1]?!1:!0};var Ta=Object.assign({},a),ta="object"==typeof window,fa="function"==typeof importScripts,Ua="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,U="";if(Ua){var Va=require("fs"),pa=require("path");U=fa?pa.dirname(U)+"/":__dirname+"/";var Wa=function(e,b){e=e.startsWith("file://")?new URL(e):pa.normalize(e);return Va.readFileSync(e,b?void 0:"utf8")};var ma=function(e){e=Wa(e,!0);e.buffer||(e=new Uint8Array(e));return e};var na=function(e, -b,c){e=e.startsWith("file://")?new URL(e):pa.normalize(e);Va.readFile(e,function(d,g){d?c(d):b(g.buffer)})};1>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);l();var t=1;break a}catch(aa){}t=void 0}if(t)return!0}return!1}};(function(){function e(g,t){a.asm=g.exports;ja=a.asm.e;l();oa.unshift(a.asm.f);ba--;a.monitorRunDependencies&&a.monitorRunDependencies(ba);0==ba&&(null!==qa&&(clearInterval(qa),qa=null),ha&&(g=ha,ha=null,g()))}function b(g){e(g.instance)} -function c(g){return q().then(function(t){return WebAssembly.instantiate(t,d)}).then(function(t){return t}).then(g,function(t){da("failed to asynchronously prepare wasm: "+t);y(t)})}var d={a:qd};ba++;a.monitorRunDependencies&&a.monitorRunDependencies(ba);if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return ea||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")|| -P.startsWith("file://")||Ua||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(t){da("wasm streaming compile failed: "+t);da("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ka);return{}})();var Xa=a._emscripten_bind_VoidPtr___destroy___0=function(){return(Xa=a._emscripten_bind_VoidPtr___destroy___0=a.asm.h).apply(null,arguments)},za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0= -function(){return(za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.i).apply(null,arguments)},Ya=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(Ya=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.j).apply(null,arguments)},Za=a._emscripten_bind_DecoderBuffer___destroy___0=function(){return(Za=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.k).apply(null,arguments)},Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0= -a.asm.l).apply(null,arguments)},$a=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return($a=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.m).apply(null,arguments)},ab=a._emscripten_bind_AttributeTransformData___destroy___0=function(){return(ab=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.n).apply(null,arguments)},Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0= -a.asm.o).apply(null,arguments)},bb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(bb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.p).apply(null,arguments)},Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.q).apply(null,arguments)},cb=a._emscripten_bind_PointAttribute_size_0=function(){return(cb=a._emscripten_bind_PointAttribute_size_0=a.asm.r).apply(null,arguments)},db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0= -function(){return(db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.s).apply(null,arguments)},eb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(eb=a._emscripten_bind_PointAttribute_attribute_type_0=a.asm.t).apply(null,arguments)},fb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(fb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.u).apply(null,arguments)},gb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(gb=a._emscripten_bind_PointAttribute_num_components_0= -a.asm.v).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(hb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.w).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_byte_stride_0=function(){return(ib=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.x).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(jb=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.y).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_unique_id_0= -function(){return(kb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.z).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(lb=a._emscripten_bind_PointAttribute___destroy___0=a.asm.A).apply(null,arguments)},Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.B).apply(null,arguments)},mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1= -function(){return(mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.C).apply(null,arguments)},nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return(nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.D).apply(null,arguments)},ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.E).apply(null,arguments)},pb= -a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(pb=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.F).apply(null,arguments)},qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return(qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.G).apply(null,arguments)},Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0= -a.asm.H).apply(null,arguments)},rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.I).apply(null,arguments)},sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.J).apply(null,arguments)},tb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(tb= -a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.K).apply(null,arguments)},Fa=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Fa=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.L).apply(null,arguments)},ub=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(ub=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.M).apply(null,arguments)},vb=a._emscripten_bind_PointCloud_num_points_0=function(){return(vb=a._emscripten_bind_PointCloud_num_points_0=a.asm.N).apply(null, -arguments)},wb=a._emscripten_bind_PointCloud___destroy___0=function(){return(wb=a._emscripten_bind_PointCloud___destroy___0=a.asm.O).apply(null,arguments)},Ga=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ga=a._emscripten_bind_Mesh_Mesh_0=a.asm.P).apply(null,arguments)},xb=a._emscripten_bind_Mesh_num_faces_0=function(){return(xb=a._emscripten_bind_Mesh_num_faces_0=a.asm.Q).apply(null,arguments)},yb=a._emscripten_bind_Mesh_num_attributes_0=function(){return(yb=a._emscripten_bind_Mesh_num_attributes_0= -a.asm.R).apply(null,arguments)},zb=a._emscripten_bind_Mesh_num_points_0=function(){return(zb=a._emscripten_bind_Mesh_num_points_0=a.asm.S).apply(null,arguments)},Ab=a._emscripten_bind_Mesh___destroy___0=function(){return(Ab=a._emscripten_bind_Mesh___destroy___0=a.asm.T).apply(null,arguments)},Ha=a._emscripten_bind_Metadata_Metadata_0=function(){return(Ha=a._emscripten_bind_Metadata_Metadata_0=a.asm.U).apply(null,arguments)},Bb=a._emscripten_bind_Metadata___destroy___0=function(){return(Bb=a._emscripten_bind_Metadata___destroy___0= -a.asm.V).apply(null,arguments)},Cb=a._emscripten_bind_Status_code_0=function(){return(Cb=a._emscripten_bind_Status_code_0=a.asm.W).apply(null,arguments)},Db=a._emscripten_bind_Status_ok_0=function(){return(Db=a._emscripten_bind_Status_ok_0=a.asm.X).apply(null,arguments)},Eb=a._emscripten_bind_Status_error_msg_0=function(){return(Eb=a._emscripten_bind_Status_error_msg_0=a.asm.Y).apply(null,arguments)},Fb=a._emscripten_bind_Status___destroy___0=function(){return(Fb=a._emscripten_bind_Status___destroy___0= -a.asm.Z).apply(null,arguments)},Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm._).apply(null,arguments)},Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.$).apply(null,arguments)},Hb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Hb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.aa).apply(null,arguments)},Ib= -a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Ib=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ba).apply(null,arguments)},Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return(Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.ca).apply(null,arguments)},Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.da).apply(null,arguments)},Kb=a._emscripten_bind_DracoInt8Array_size_0= -function(){return(Kb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ea).apply(null,arguments)},Lb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Lb=a._emscripten_bind_DracoInt8Array___destroy___0=a.asm.fa).apply(null,arguments)},Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ga).apply(null,arguments)},Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1= -a.asm.ha).apply(null,arguments)},Nb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Nb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.ia).apply(null,arguments)},Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=function(){return(Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ja).apply(null,arguments)},La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.ka).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt16Array_GetValue_1= -function(){return(Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.la).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Qb=a._emscripten_bind_DracoInt16Array_size_0=a.asm.ma).apply(null,arguments)},Rb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Rb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.na).apply(null,arguments)},Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0= -a.asm.oa).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.pa).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Tb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.qa).apply(null,arguments)},Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ra).apply(null,arguments)},Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0= -function(){return(Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.sa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=function(){return(Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.ta).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt32Array_size_0=function(){return(Wb=a._emscripten_bind_DracoInt32Array_size_0=a.asm.ua).apply(null,arguments)},Xb=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(Xb=a._emscripten_bind_DracoInt32Array___destroy___0= -a.asm.va).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=a.asm.wa).apply(null,arguments)},Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.xa).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(Zb=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.ya).apply(null,arguments)},$b=a._emscripten_bind_DracoUInt32Array___destroy___0= -function(){return($b=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.za).apply(null,arguments)},Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return(Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Aa).apply(null,arguments)},ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ba).apply(null,arguments)},bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2= -a.asm.Ca).apply(null,arguments)},cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=a.asm.Da).apply(null,arguments)},dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ea).apply(null,arguments)},ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Fa).apply(null, -arguments)},fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ga).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ha).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(hc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.Ia).apply(null,arguments)},Qa=a._emscripten_bind_Decoder_Decoder_0= -function(){return(Qa=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ja).apply(null,arguments)},ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Ka).apply(null,arguments)},jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.La).apply(null,arguments)},kc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(kc=a._emscripten_bind_Decoder_GetAttributeId_2= -a.asm.Ma).apply(null,arguments)},lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=a.asm.Na).apply(null,arguments)},mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Oa).apply(null,arguments)},nc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(nc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Pa).apply(null,arguments)}, -oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Qa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(pc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ra).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Sa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3= -function(){return(rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Ta).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return(sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Ua).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Va).apply(null,arguments)},uc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(uc= -a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Wa).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm.Xa).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.Ya).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3= -a.asm.Za).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm._a).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.$a).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3= -a.asm.ab).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.bb).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.cb).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3= -a.asm.db).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.eb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.fb).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1= -a.asm.gb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return(Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.hb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.ib).apply(null,arguments)},Jc=a._emscripten_bind_Decoder___destroy___0=function(){return(Jc=a._emscripten_bind_Decoder___destroy___0=a.asm.jb).apply(null,arguments)},Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM= -function(){return(Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=a.asm.kb).apply(null,arguments)},Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.lb).apply(null,arguments)},Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM= -a.asm.mb).apply(null,arguments)},Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return(Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.nb).apply(null,arguments)},Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.ob).apply(null,arguments)},Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION= -a.asm.pb).apply(null,arguments)},Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return(Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.qb).apply(null,arguments)},Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.rb).apply(null,arguments)},Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD= -a.asm.sb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.tb).apply(null,arguments)},Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.ub).apply(null,arguments)},Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return(Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD= -a.asm.vb).apply(null,arguments)},Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return(Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.wb).apply(null,arguments)},Xc=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(Xc=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.xb).apply(null,arguments)},Yc=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(Yc=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.yb).apply(null,arguments)},Zc= -a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(Zc=a._emscripten_enum_draco_DataType_DT_UINT8=a.asm.zb).apply(null,arguments)},$c=a._emscripten_enum_draco_DataType_DT_INT16=function(){return($c=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Ab).apply(null,arguments)},ad=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(ad=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Bb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INT32= -a.asm.Cb).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_UINT32=function(){return(cd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Db).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(dd=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Eb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(ed=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Fb).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_FLOAT32= -function(){return(fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Gb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Hb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(hd=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Ib).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT= -a.asm.Jb).apply(null,arguments)},jd=a._emscripten_enum_draco_StatusCode_OK=function(){return(jd=a._emscripten_enum_draco_StatusCode_OK=a.asm.Kb).apply(null,arguments)},kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Lb).apply(null,arguments)},ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Mb).apply(null,arguments)},md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER= -function(){return(md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=a.asm.Nb).apply(null,arguments)},nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Ob).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Pb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Qb).apply(null,arguments)}; -a._free=function(){return(a._free=a.asm.Rb).apply(null,arguments)};var ua=function(){return(ua=a.asm.Sb).apply(null,arguments)};a.___start_em_js=11660;a.___stop_em_js=11758;var la;ha=function b(){la||F();la||(ha=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0=r.size?(0>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;gb.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule); diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ecsy.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ecsy.module.js deleted file mode 100644 index 6f67599..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ecsy.module.js +++ /dev/null @@ -1,1792 +0,0 @@ -/** - * Return the name of a component - * @param {Component} Component - * @private - */ - -/** - * Get a key from a list of components - * @param {Array(Component)} Components Array of components to generate the key - * @private - */ -function queryKey(Components) { - var ids = []; - for (var n = 0; n < Components.length; n++) { - var T = Components[n]; - - if (!componentRegistered(T)) { - throw new Error(`Tried to create a query with an unregistered component`); - } - - if (typeof T === "object") { - var operator = T.operator === "not" ? "!" : T.operator; - ids.push(operator + T.Component._typeId); - } else { - ids.push(T._typeId); - } - } - - return ids.sort().join("-"); -} - -// Detector for browser's "window" -const hasWindow = typeof window !== "undefined"; - -// performance.now() "polyfill" -const now = - hasWindow && typeof window.performance !== "undefined" - ? performance.now.bind(performance) - : Date.now.bind(Date); - -function componentRegistered(T) { - return ( - (typeof T === "object" && T.Component._typeId !== undefined) || - (T.isComponent && T._typeId !== undefined) - ); -} - -class SystemManager { - constructor(world) { - this._systems = []; - this._executeSystems = []; // Systems that have `execute` method - this.world = world; - this.lastExecutedSystem = null; - } - - registerSystem(SystemClass, attributes) { - if (!SystemClass.isSystem) { - throw new Error( - `System '${SystemClass.name}' does not extend 'System' class` - ); - } - - if (this.getSystem(SystemClass) !== undefined) { - console.warn(`System '${SystemClass.getName()}' already registered.`); - return this; - } - - var system = new SystemClass(this.world, attributes); - if (system.init) system.init(attributes); - system.order = this._systems.length; - this._systems.push(system); - if (system.execute) { - this._executeSystems.push(system); - this.sortSystems(); - } - return this; - } - - unregisterSystem(SystemClass) { - let system = this.getSystem(SystemClass); - if (system === undefined) { - console.warn( - `Can unregister system '${SystemClass.getName()}'. It doesn't exist.` - ); - return this; - } - - this._systems.splice(this._systems.indexOf(system), 1); - - if (system.execute) { - this._executeSystems.splice(this._executeSystems.indexOf(system), 1); - } - - // @todo Add system.unregister() call to free resources - return this; - } - - sortSystems() { - this._executeSystems.sort((a, b) => { - return a.priority - b.priority || a.order - b.order; - }); - } - - getSystem(SystemClass) { - return this._systems.find((s) => s instanceof SystemClass); - } - - getSystems() { - return this._systems; - } - - removeSystem(SystemClass) { - var index = this._systems.indexOf(SystemClass); - if (!~index) return; - - this._systems.splice(index, 1); - } - - executeSystem(system, delta, time) { - if (system.initialized) { - if (system.canExecute()) { - let startTime = now(); - system.execute(delta, time); - system.executeTime = now() - startTime; - this.lastExecutedSystem = system; - system.clearEvents(); - } - } - } - - stop() { - this._executeSystems.forEach((system) => system.stop()); - } - - execute(delta, time, forcePlay) { - this._executeSystems.forEach( - (system) => - (forcePlay || system.enabled) && this.executeSystem(system, delta, time) - ); - } - - stats() { - var stats = { - numSystems: this._systems.length, - systems: {}, - }; - - for (var i = 0; i < this._systems.length; i++) { - var system = this._systems[i]; - var systemStats = (stats.systems[system.getName()] = { - queries: {}, - executeTime: system.executeTime, - }); - for (var name in system.ctx) { - systemStats.queries[name] = system.ctx[name].stats(); - } - } - - return stats; - } -} - -class ObjectPool { - // @todo Add initial size - constructor(T, initialSize) { - this.freeList = []; - this.count = 0; - this.T = T; - this.isObjectPool = true; - - if (typeof initialSize !== "undefined") { - this.expand(initialSize); - } - } - - acquire() { - // Grow the list by 20%ish if we're out - if (this.freeList.length <= 0) { - this.expand(Math.round(this.count * 0.2) + 1); - } - - var item = this.freeList.pop(); - - return item; - } - - release(item) { - item.reset(); - this.freeList.push(item); - } - - expand(count) { - for (var n = 0; n < count; n++) { - var clone = new this.T(); - clone._pool = this; - this.freeList.push(clone); - } - this.count += count; - } - - totalSize() { - return this.count; - } - - totalFree() { - return this.freeList.length; - } - - totalUsed() { - return this.count - this.freeList.length; - } -} - -/** - * @private - * @class EventDispatcher - */ -class EventDispatcher { - constructor() { - this._listeners = {}; - this.stats = { - fired: 0, - handled: 0, - }; - } - - /** - * Add an event listener - * @param {String} eventName Name of the event to listen - * @param {Function} listener Callback to trigger when the event is fired - */ - addEventListener(eventName, listener) { - let listeners = this._listeners; - if (listeners[eventName] === undefined) { - listeners[eventName] = []; - } - - if (listeners[eventName].indexOf(listener) === -1) { - listeners[eventName].push(listener); - } - } - - /** - * Check if an event listener is already added to the list of listeners - * @param {String} eventName Name of the event to check - * @param {Function} listener Callback for the specified event - */ - hasEventListener(eventName, listener) { - return ( - this._listeners[eventName] !== undefined && - this._listeners[eventName].indexOf(listener) !== -1 - ); - } - - /** - * Remove an event listener - * @param {String} eventName Name of the event to remove - * @param {Function} listener Callback for the specified event - */ - removeEventListener(eventName, listener) { - var listenerArray = this._listeners[eventName]; - if (listenerArray !== undefined) { - var index = listenerArray.indexOf(listener); - if (index !== -1) { - listenerArray.splice(index, 1); - } - } - } - - /** - * Dispatch an event - * @param {String} eventName Name of the event to dispatch - * @param {Entity} entity (Optional) Entity to emit - * @param {Component} component - */ - dispatchEvent(eventName, entity, component) { - this.stats.fired++; - - var listenerArray = this._listeners[eventName]; - if (listenerArray !== undefined) { - var array = listenerArray.slice(0); - - for (var i = 0; i < array.length; i++) { - array[i].call(this, entity, component); - } - } - } - - /** - * Reset stats counters - */ - resetCounters() { - this.stats.fired = this.stats.handled = 0; - } -} - -class Query { - /** - * @param {Array(Component)} Components List of types of components to query - */ - constructor(Components, manager) { - this.Components = []; - this.NotComponents = []; - - Components.forEach((component) => { - if (typeof component === "object") { - this.NotComponents.push(component.Component); - } else { - this.Components.push(component); - } - }); - - if (this.Components.length === 0) { - throw new Error("Can't create a query without components"); - } - - this.entities = []; - - this.eventDispatcher = new EventDispatcher(); - - // This query is being used by a reactive system - this.reactive = false; - - this.key = queryKey(Components); - - // Fill the query with the existing entities - for (var i = 0; i < manager._entities.length; i++) { - var entity = manager._entities[i]; - if (this.match(entity)) { - // @todo ??? this.addEntity(entity); => preventing the event to be generated - entity.queries.push(this); - this.entities.push(entity); - } - } - } - - /** - * Add entity to this query - * @param {Entity} entity - */ - addEntity(entity) { - entity.queries.push(this); - this.entities.push(entity); - - this.eventDispatcher.dispatchEvent(Query.prototype.ENTITY_ADDED, entity); - } - - /** - * Remove entity from this query - * @param {Entity} entity - */ - removeEntity(entity) { - let index = this.entities.indexOf(entity); - if (~index) { - this.entities.splice(index, 1); - - index = entity.queries.indexOf(this); - entity.queries.splice(index, 1); - - this.eventDispatcher.dispatchEvent( - Query.prototype.ENTITY_REMOVED, - entity - ); - } - } - - match(entity) { - return ( - entity.hasAllComponents(this.Components) && - !entity.hasAnyComponents(this.NotComponents) - ); - } - - toJSON() { - return { - key: this.key, - reactive: this.reactive, - components: { - included: this.Components.map((C) => C.name), - not: this.NotComponents.map((C) => C.name), - }, - numEntities: this.entities.length, - }; - } - - /** - * Return stats for this query - */ - stats() { - return { - numComponents: this.Components.length, - numEntities: this.entities.length, - }; - } -} - -Query.prototype.ENTITY_ADDED = "Query#ENTITY_ADDED"; -Query.prototype.ENTITY_REMOVED = "Query#ENTITY_REMOVED"; -Query.prototype.COMPONENT_CHANGED = "Query#COMPONENT_CHANGED"; - -/** - * @private - * @class QueryManager - */ -class QueryManager { - constructor(world) { - this._world = world; - - // Queries indexed by a unique identifier for the components it has - this._queries = {}; - } - - onEntityRemoved(entity) { - for (var queryName in this._queries) { - var query = this._queries[queryName]; - if (entity.queries.indexOf(query) !== -1) { - query.removeEntity(entity); - } - } - } - - /** - * Callback when a component is added to an entity - * @param {Entity} entity Entity that just got the new component - * @param {Component} Component Component added to the entity - */ - onEntityComponentAdded(entity, Component) { - // @todo Use bitmask for checking components? - - // Check each indexed query to see if we need to add this entity to the list - for (var queryName in this._queries) { - var query = this._queries[queryName]; - - if ( - !!~query.NotComponents.indexOf(Component) && - ~query.entities.indexOf(entity) - ) { - query.removeEntity(entity); - continue; - } - - // Add the entity only if: - // Component is in the query - // and Entity has ALL the components of the query - // and Entity is not already in the query - if ( - !~query.Components.indexOf(Component) || - !query.match(entity) || - ~query.entities.indexOf(entity) - ) - continue; - - query.addEntity(entity); - } - } - - /** - * Callback when a component is removed from an entity - * @param {Entity} entity Entity to remove the component from - * @param {Component} Component Component to remove from the entity - */ - onEntityComponentRemoved(entity, Component) { - for (var queryName in this._queries) { - var query = this._queries[queryName]; - - if ( - !!~query.NotComponents.indexOf(Component) && - !~query.entities.indexOf(entity) && - query.match(entity) - ) { - query.addEntity(entity); - continue; - } - - if ( - !!~query.Components.indexOf(Component) && - !!~query.entities.indexOf(entity) && - !query.match(entity) - ) { - query.removeEntity(entity); - continue; - } - } - } - - /** - * Get a query for the specified components - * @param {Component} Components Components that the query should have - */ - getQuery(Components) { - var key = queryKey(Components); - var query = this._queries[key]; - if (!query) { - this._queries[key] = query = new Query(Components, this._world); - } - return query; - } - - /** - * Return some stats from this class - */ - stats() { - var stats = {}; - for (var queryName in this._queries) { - stats[queryName] = this._queries[queryName].stats(); - } - return stats; - } -} - -class Component { - constructor(props) { - if (props !== false) { - const schema = this.constructor.schema; - - for (const key in schema) { - if (props && props.hasOwnProperty(key)) { - this[key] = props[key]; - } else { - const schemaProp = schema[key]; - if (schemaProp.hasOwnProperty("default")) { - this[key] = schemaProp.type.clone(schemaProp.default); - } else { - const type = schemaProp.type; - this[key] = type.clone(type.default); - } - } - } - - if ( props !== undefined) { - this.checkUndefinedAttributes(props); - } - } - - this._pool = null; - } - - copy(source) { - const schema = this.constructor.schema; - - for (const key in schema) { - const prop = schema[key]; - - if (source.hasOwnProperty(key)) { - this[key] = prop.type.copy(source[key], this[key]); - } - } - - // @DEBUG - { - this.checkUndefinedAttributes(source); - } - - return this; - } - - clone() { - return new this.constructor().copy(this); - } - - reset() { - const schema = this.constructor.schema; - - for (const key in schema) { - const schemaProp = schema[key]; - - if (schemaProp.hasOwnProperty("default")) { - this[key] = schemaProp.type.copy(schemaProp.default, this[key]); - } else { - const type = schemaProp.type; - this[key] = type.copy(type.default, this[key]); - } - } - } - - dispose() { - if (this._pool) { - this._pool.release(this); - } - } - - getName() { - return this.constructor.getName(); - } - - checkUndefinedAttributes(src) { - const schema = this.constructor.schema; - - // Check that the attributes defined in source are also defined in the schema - Object.keys(src).forEach((srcKey) => { - if (!schema.hasOwnProperty(srcKey)) { - console.warn( - `Trying to set attribute '${srcKey}' not defined in the '${this.constructor.name}' schema. Please fix the schema, the attribute value won't be set` - ); - } - }); - } -} - -Component.schema = {}; -Component.isComponent = true; -Component.getName = function () { - return this.displayName || this.name; -}; - -class SystemStateComponent extends Component {} - -SystemStateComponent.isSystemStateComponent = true; - -class EntityPool extends ObjectPool { - constructor(entityManager, entityClass, initialSize) { - super(entityClass, undefined); - this.entityManager = entityManager; - - if (typeof initialSize !== "undefined") { - this.expand(initialSize); - } - } - - expand(count) { - for (var n = 0; n < count; n++) { - var clone = new this.T(this.entityManager); - clone._pool = this; - this.freeList.push(clone); - } - this.count += count; - } -} - -/** - * @private - * @class EntityManager - */ -class EntityManager { - constructor(world) { - this.world = world; - this.componentsManager = world.componentsManager; - - // All the entities in this instance - this._entities = []; - this._nextEntityId = 0; - - this._entitiesByNames = {}; - - this._queryManager = new QueryManager(this); - this.eventDispatcher = new EventDispatcher(); - this._entityPool = new EntityPool( - this, - this.world.options.entityClass, - this.world.options.entityPoolSize - ); - - // Deferred deletion - this.entitiesWithComponentsToRemove = []; - this.entitiesToRemove = []; - this.deferredRemovalEnabled = true; - } - - getEntityByName(name) { - return this._entitiesByNames[name]; - } - - /** - * Create a new entity - */ - createEntity(name) { - var entity = this._entityPool.acquire(); - entity.alive = true; - entity.name = name || ""; - if (name) { - if (this._entitiesByNames[name]) { - console.warn(`Entity name '${name}' already exist`); - } else { - this._entitiesByNames[name] = entity; - } - } - - this._entities.push(entity); - this.eventDispatcher.dispatchEvent(ENTITY_CREATED, entity); - return entity; - } - - // COMPONENTS - - /** - * Add a component to an entity - * @param {Entity} entity Entity where the component will be added - * @param {Component} Component Component to be added to the entity - * @param {Object} values Optional values to replace the default attributes - */ - entityAddComponent(entity, Component, values) { - // @todo Probably define Component._typeId with a default value and avoid using typeof - if ( - typeof Component._typeId === "undefined" && - !this.world.componentsManager._ComponentsMap[Component._typeId] - ) { - throw new Error( - `Attempted to add unregistered component "${Component.getName()}"` - ); - } - - if (~entity._ComponentTypes.indexOf(Component)) { - { - console.warn( - "Component type already exists on entity.", - entity, - Component.getName() - ); - } - return; - } - - entity._ComponentTypes.push(Component); - - if (Component.__proto__ === SystemStateComponent) { - entity.numStateComponents++; - } - - var componentPool = this.world.componentsManager.getComponentsPool( - Component - ); - - var component = componentPool - ? componentPool.acquire() - : new Component(values); - - if (componentPool && values) { - component.copy(values); - } - - entity._components[Component._typeId] = component; - - this._queryManager.onEntityComponentAdded(entity, Component); - this.world.componentsManager.componentAddedToEntity(Component); - - this.eventDispatcher.dispatchEvent(COMPONENT_ADDED, entity, Component); - } - - /** - * Remove a component from an entity - * @param {Entity} entity Entity which will get removed the component - * @param {*} Component Component to remove from the entity - * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) - */ - entityRemoveComponent(entity, Component, immediately) { - var index = entity._ComponentTypes.indexOf(Component); - if (!~index) return; - - this.eventDispatcher.dispatchEvent(COMPONENT_REMOVE, entity, Component); - - if (immediately) { - this._entityRemoveComponentSync(entity, Component, index); - } else { - if (entity._ComponentTypesToRemove.length === 0) - this.entitiesWithComponentsToRemove.push(entity); - - entity._ComponentTypes.splice(index, 1); - entity._ComponentTypesToRemove.push(Component); - - entity._componentsToRemove[Component._typeId] = - entity._components[Component._typeId]; - delete entity._components[Component._typeId]; - } - - // Check each indexed query to see if we need to remove it - this._queryManager.onEntityComponentRemoved(entity, Component); - - if (Component.__proto__ === SystemStateComponent) { - entity.numStateComponents--; - - // Check if the entity was a ghost waiting for the last system state component to be removed - if (entity.numStateComponents === 0 && !entity.alive) { - entity.remove(); - } - } - } - - _entityRemoveComponentSync(entity, Component, index) { - // Remove T listing on entity and property ref, then free the component. - entity._ComponentTypes.splice(index, 1); - var component = entity._components[Component._typeId]; - delete entity._components[Component._typeId]; - component.dispose(); - this.world.componentsManager.componentRemovedFromEntity(Component); - } - - /** - * Remove all the components from an entity - * @param {Entity} entity Entity from which the components will be removed - */ - entityRemoveAllComponents(entity, immediately) { - let Components = entity._ComponentTypes; - - for (let j = Components.length - 1; j >= 0; j--) { - if (Components[j].__proto__ !== SystemStateComponent) - this.entityRemoveComponent(entity, Components[j], immediately); - } - } - - /** - * Remove the entity from this manager. It will clear also its components - * @param {Entity} entity Entity to remove from the manager - * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) - */ - removeEntity(entity, immediately) { - var index = this._entities.indexOf(entity); - - if (!~index) throw new Error("Tried to remove entity not in list"); - - entity.alive = false; - this.entityRemoveAllComponents(entity, immediately); - - if (entity.numStateComponents === 0) { - // Remove from entity list - this.eventDispatcher.dispatchEvent(ENTITY_REMOVED, entity); - this._queryManager.onEntityRemoved(entity); - if (immediately === true) { - this._releaseEntity(entity, index); - } else { - this.entitiesToRemove.push(entity); - } - } - } - - _releaseEntity(entity, index) { - this._entities.splice(index, 1); - - if (this._entitiesByNames[entity.name]) { - delete this._entitiesByNames[entity.name]; - } - entity._pool.release(entity); - } - - /** - * Remove all entities from this manager - */ - removeAllEntities() { - for (var i = this._entities.length - 1; i >= 0; i--) { - this.removeEntity(this._entities[i]); - } - } - - processDeferredRemoval() { - if (!this.deferredRemovalEnabled) { - return; - } - - for (let i = 0; i < this.entitiesToRemove.length; i++) { - let entity = this.entitiesToRemove[i]; - let index = this._entities.indexOf(entity); - this._releaseEntity(entity, index); - } - this.entitiesToRemove.length = 0; - - for (let i = 0; i < this.entitiesWithComponentsToRemove.length; i++) { - let entity = this.entitiesWithComponentsToRemove[i]; - while (entity._ComponentTypesToRemove.length > 0) { - let Component = entity._ComponentTypesToRemove.pop(); - - var component = entity._componentsToRemove[Component._typeId]; - delete entity._componentsToRemove[Component._typeId]; - component.dispose(); - this.world.componentsManager.componentRemovedFromEntity(Component); - - //this._entityRemoveComponentSync(entity, Component, index); - } - } - - this.entitiesWithComponentsToRemove.length = 0; - } - - /** - * Get a query based on a list of components - * @param {Array(Component)} Components List of components that will form the query - */ - queryComponents(Components) { - return this._queryManager.getQuery(Components); - } - - // EXTRAS - - /** - * Return number of entities - */ - count() { - return this._entities.length; - } - - /** - * Return some stats - */ - stats() { - var stats = { - numEntities: this._entities.length, - numQueries: Object.keys(this._queryManager._queries).length, - queries: this._queryManager.stats(), - numComponentPool: Object.keys(this.componentsManager._componentPool) - .length, - componentPool: {}, - eventDispatcher: this.eventDispatcher.stats, - }; - - for (var ecsyComponentId in this.componentsManager._componentPool) { - var pool = this.componentsManager._componentPool[ecsyComponentId]; - stats.componentPool[pool.T.getName()] = { - used: pool.totalUsed(), - size: pool.count, - }; - } - - return stats; - } -} - -const ENTITY_CREATED = "EntityManager#ENTITY_CREATE"; -const ENTITY_REMOVED = "EntityManager#ENTITY_REMOVED"; -const COMPONENT_ADDED = "EntityManager#COMPONENT_ADDED"; -const COMPONENT_REMOVE = "EntityManager#COMPONENT_REMOVE"; - -class ComponentManager { - constructor() { - this.Components = []; - this._ComponentsMap = {}; - - this._componentPool = {}; - this.numComponents = {}; - this.nextComponentId = 0; - } - - hasComponent(Component) { - return this.Components.indexOf(Component) !== -1; - } - - registerComponent(Component, objectPool) { - if (this.Components.indexOf(Component) !== -1) { - console.warn( - `Component type: '${Component.getName()}' already registered.` - ); - return; - } - - const schema = Component.schema; - - if (!schema) { - throw new Error( - `Component "${Component.getName()}" has no schema property.` - ); - } - - for (const propName in schema) { - const prop = schema[propName]; - - if (!prop.type) { - throw new Error( - `Invalid schema for component "${Component.getName()}". Missing type for "${propName}" property.` - ); - } - } - - Component._typeId = this.nextComponentId++; - this.Components.push(Component); - this._ComponentsMap[Component._typeId] = Component; - this.numComponents[Component._typeId] = 0; - - if (objectPool === undefined) { - objectPool = new ObjectPool(Component); - } else if (objectPool === false) { - objectPool = undefined; - } - - this._componentPool[Component._typeId] = objectPool; - } - - componentAddedToEntity(Component) { - this.numComponents[Component._typeId]++; - } - - componentRemovedFromEntity(Component) { - this.numComponents[Component._typeId]--; - } - - getComponentsPool(Component) { - return this._componentPool[Component._typeId]; - } -} - -const Version = "0.3.1"; - -const proxyMap = new WeakMap(); - -const proxyHandler = { - set(target, prop) { - throw new Error( - `Tried to write to "${target.constructor.getName()}#${String( - prop - )}" on immutable component. Use .getMutableComponent() to modify a component.` - ); - }, -}; - -function wrapImmutableComponent(T, component) { - if (component === undefined) { - return undefined; - } - - let wrappedComponent = proxyMap.get(component); - - if (!wrappedComponent) { - wrappedComponent = new Proxy(component, proxyHandler); - proxyMap.set(component, wrappedComponent); - } - - return wrappedComponent; -} - -class Entity { - constructor(entityManager) { - this._entityManager = entityManager || null; - - // Unique ID for this entity - this.id = entityManager._nextEntityId++; - - // List of components types the entity has - this._ComponentTypes = []; - - // Instance of the components - this._components = {}; - - this._componentsToRemove = {}; - - // Queries where the entity is added - this.queries = []; - - // Used for deferred removal - this._ComponentTypesToRemove = []; - - this.alive = false; - - //if there are state components on a entity, it can't be removed completely - this.numStateComponents = 0; - } - - // COMPONENTS - - getComponent(Component, includeRemoved) { - var component = this._components[Component._typeId]; - - if (!component && includeRemoved === true) { - component = this._componentsToRemove[Component._typeId]; - } - - return wrapImmutableComponent(Component, component) - ; - } - - getRemovedComponent(Component) { - const component = this._componentsToRemove[Component._typeId]; - - return wrapImmutableComponent(Component, component) - ; - } - - getComponents() { - return this._components; - } - - getComponentsToRemove() { - return this._componentsToRemove; - } - - getComponentTypes() { - return this._ComponentTypes; - } - - getMutableComponent(Component) { - var component = this._components[Component._typeId]; - - if (!component) { - return; - } - - for (var i = 0; i < this.queries.length; i++) { - var query = this.queries[i]; - // @todo accelerate this check. Maybe having query._Components as an object - // @todo add Not components - if (query.reactive && query.Components.indexOf(Component) !== -1) { - query.eventDispatcher.dispatchEvent( - Query.prototype.COMPONENT_CHANGED, - this, - component - ); - } - } - return component; - } - - addComponent(Component, values) { - this._entityManager.entityAddComponent(this, Component, values); - return this; - } - - removeComponent(Component, forceImmediate) { - this._entityManager.entityRemoveComponent(this, Component, forceImmediate); - return this; - } - - hasComponent(Component, includeRemoved) { - return ( - !!~this._ComponentTypes.indexOf(Component) || - (includeRemoved === true && this.hasRemovedComponent(Component)) - ); - } - - hasRemovedComponent(Component) { - return !!~this._ComponentTypesToRemove.indexOf(Component); - } - - hasAllComponents(Components) { - for (var i = 0; i < Components.length; i++) { - if (!this.hasComponent(Components[i])) return false; - } - return true; - } - - hasAnyComponents(Components) { - for (var i = 0; i < Components.length; i++) { - if (this.hasComponent(Components[i])) return true; - } - return false; - } - - removeAllComponents(forceImmediate) { - return this._entityManager.entityRemoveAllComponents(this, forceImmediate); - } - - copy(src) { - // TODO: This can definitely be optimized - for (var ecsyComponentId in src._components) { - var srcComponent = src._components[ecsyComponentId]; - this.addComponent(srcComponent.constructor); - var component = this.getComponent(srcComponent.constructor); - component.copy(srcComponent); - } - - return this; - } - - clone() { - return new Entity(this._entityManager).copy(this); - } - - reset() { - this.id = this._entityManager._nextEntityId++; - this._ComponentTypes.length = 0; - this.queries.length = 0; - - for (var ecsyComponentId in this._components) { - delete this._components[ecsyComponentId]; - } - } - - remove(forceImmediate) { - return this._entityManager.removeEntity(this, forceImmediate); - } -} - -const DEFAULT_OPTIONS = { - entityPoolSize: 0, - entityClass: Entity, -}; - -class World { - constructor(options = {}) { - this.options = Object.assign({}, DEFAULT_OPTIONS, options); - - this.componentsManager = new ComponentManager(this); - this.entityManager = new EntityManager(this); - this.systemManager = new SystemManager(this); - - this.enabled = true; - - this.eventQueues = {}; - - if (hasWindow && typeof CustomEvent !== "undefined") { - var event = new CustomEvent("ecsy-world-created", { - detail: { world: this, version: Version }, - }); - window.dispatchEvent(event); - } - - this.lastTime = now() / 1000; - } - - registerComponent(Component, objectPool) { - this.componentsManager.registerComponent(Component, objectPool); - return this; - } - - registerSystem(System, attributes) { - this.systemManager.registerSystem(System, attributes); - return this; - } - - hasRegisteredComponent(Component) { - return this.componentsManager.hasComponent(Component); - } - - unregisterSystem(System) { - this.systemManager.unregisterSystem(System); - return this; - } - - getSystem(SystemClass) { - return this.systemManager.getSystem(SystemClass); - } - - getSystems() { - return this.systemManager.getSystems(); - } - - execute(delta, time) { - if (!delta) { - time = now() / 1000; - delta = time - this.lastTime; - this.lastTime = time; - } - - if (this.enabled) { - this.systemManager.execute(delta, time); - this.entityManager.processDeferredRemoval(); - } - } - - stop() { - this.enabled = false; - } - - play() { - this.enabled = true; - } - - createEntity(name) { - return this.entityManager.createEntity(name); - } - - stats() { - var stats = { - entities: this.entityManager.stats(), - system: this.systemManager.stats(), - }; - - return stats; - } -} - -class System { - canExecute() { - if (this._mandatoryQueries.length === 0) return true; - - for (let i = 0; i < this._mandatoryQueries.length; i++) { - var query = this._mandatoryQueries[i]; - if (query.entities.length === 0) { - return false; - } - } - - return true; - } - - getName() { - return this.constructor.getName(); - } - - constructor(world, attributes) { - this.world = world; - this.enabled = true; - - // @todo Better naming :) - this._queries = {}; - this.queries = {}; - - this.priority = 0; - - // Used for stats - this.executeTime = 0; - - if (attributes && attributes.priority) { - this.priority = attributes.priority; - } - - this._mandatoryQueries = []; - - this.initialized = true; - - if (this.constructor.queries) { - for (var queryName in this.constructor.queries) { - var queryConfig = this.constructor.queries[queryName]; - var Components = queryConfig.components; - if (!Components || Components.length === 0) { - throw new Error("'components' attribute can't be empty in a query"); - } - - // Detect if the components have already been registered - let unregisteredComponents = Components.filter( - (Component) => !componentRegistered(Component) - ); - - if (unregisteredComponents.length > 0) { - throw new Error( - `Tried to create a query '${ - this.constructor.name - }.${queryName}' with unregistered components: [${unregisteredComponents - .map((c) => c.getName()) - .join(", ")}]` - ); - } - - var query = this.world.entityManager.queryComponents(Components); - - this._queries[queryName] = query; - if (queryConfig.mandatory === true) { - this._mandatoryQueries.push(query); - } - this.queries[queryName] = { - results: query.entities, - }; - - // Reactive configuration added/removed/changed - var validEvents = ["added", "removed", "changed"]; - - const eventMapping = { - added: Query.prototype.ENTITY_ADDED, - removed: Query.prototype.ENTITY_REMOVED, - changed: Query.prototype.COMPONENT_CHANGED, // Query.prototype.ENTITY_CHANGED - }; - - if (queryConfig.listen) { - validEvents.forEach((eventName) => { - if (!this.execute) { - console.warn( - `System '${this.getName()}' has defined listen events (${validEvents.join( - ", " - )}) for query '${queryName}' but it does not implement the 'execute' method.` - ); - } - - // Is the event enabled on this system's query? - if (queryConfig.listen[eventName]) { - let event = queryConfig.listen[eventName]; - - if (eventName === "changed") { - query.reactive = true; - if (event === true) { - // Any change on the entity from the components in the query - let eventList = (this.queries[queryName][eventName] = []); - query.eventDispatcher.addEventListener( - Query.prototype.COMPONENT_CHANGED, - (entity) => { - // Avoid duplicates - if (eventList.indexOf(entity) === -1) { - eventList.push(entity); - } - } - ); - } else if (Array.isArray(event)) { - let eventList = (this.queries[queryName][eventName] = []); - query.eventDispatcher.addEventListener( - Query.prototype.COMPONENT_CHANGED, - (entity, changedComponent) => { - // Avoid duplicates - if ( - event.indexOf(changedComponent.constructor) !== -1 && - eventList.indexOf(entity) === -1 - ) { - eventList.push(entity); - } - } - ); - } - } else { - let eventList = (this.queries[queryName][eventName] = []); - - query.eventDispatcher.addEventListener( - eventMapping[eventName], - (entity) => { - // @fixme overhead? - if (eventList.indexOf(entity) === -1) - eventList.push(entity); - } - ); - } - } - }); - } - } - } - } - - stop() { - this.executeTime = 0; - this.enabled = false; - } - - play() { - this.enabled = true; - } - - // @question rename to clear queues? - clearEvents() { - for (let queryName in this.queries) { - var query = this.queries[queryName]; - if (query.added) { - query.added.length = 0; - } - if (query.removed) { - query.removed.length = 0; - } - if (query.changed) { - if (Array.isArray(query.changed)) { - query.changed.length = 0; - } else { - for (let name in query.changed) { - query.changed[name].length = 0; - } - } - } - } - } - - toJSON() { - var json = { - name: this.getName(), - enabled: this.enabled, - executeTime: this.executeTime, - priority: this.priority, - queries: {}, - }; - - if (this.constructor.queries) { - var queries = this.constructor.queries; - for (let queryName in queries) { - let query = this.queries[queryName]; - let queryDefinition = queries[queryName]; - let jsonQuery = (json.queries[queryName] = { - key: this._queries[queryName].key, - }); - - jsonQuery.mandatory = queryDefinition.mandatory === true; - jsonQuery.reactive = - queryDefinition.listen && - (queryDefinition.listen.added === true || - queryDefinition.listen.removed === true || - queryDefinition.listen.changed === true || - Array.isArray(queryDefinition.listen.changed)); - - if (jsonQuery.reactive) { - jsonQuery.listen = {}; - - const methods = ["added", "removed", "changed"]; - methods.forEach((method) => { - if (query[method]) { - jsonQuery.listen[method] = { - entities: query[method].length, - }; - } - }); - } - } - } - - return json; - } -} - -System.isSystem = true; -System.getName = function () { - return this.displayName || this.name; -}; - -function Not(Component) { - return { - operator: "not", - Component: Component, - }; -} - -class TagComponent extends Component { - constructor() { - super(false); - } -} - -TagComponent.isTagComponent = true; - -const copyValue = (src) => src; - -const cloneValue = (src) => src; - -const copyArray = (src, dest) => { - if (!src) { - return src; - } - - if (!dest) { - return src.slice(); - } - - dest.length = 0; - - for (let i = 0; i < src.length; i++) { - dest.push(src[i]); - } - - return dest; -}; - -const cloneArray = (src) => src && src.slice(); - -const copyJSON = (src) => JSON.parse(JSON.stringify(src)); - -const cloneJSON = (src) => JSON.parse(JSON.stringify(src)); - -const copyCopyable = (src, dest) => { - if (!src) { - return src; - } - - if (!dest) { - return src.clone(); - } - - return dest.copy(src); -}; - -const cloneClonable = (src) => src && src.clone(); - -function createType(typeDefinition) { - var mandatoryProperties = ["name", "default", "copy", "clone"]; - - var undefinedProperties = mandatoryProperties.filter((p) => { - return !typeDefinition.hasOwnProperty(p); - }); - - if (undefinedProperties.length > 0) { - throw new Error( - `createType expects a type definition with the following properties: ${undefinedProperties.join( - ", " - )}` - ); - } - - typeDefinition.isType = true; - - return typeDefinition; -} - -/** - * Standard types - */ -const Types = { - Number: createType({ - name: "Number", - default: 0, - copy: copyValue, - clone: cloneValue, - }), - - Boolean: createType({ - name: "Boolean", - default: false, - copy: copyValue, - clone: cloneValue, - }), - - String: createType({ - name: "String", - default: "", - copy: copyValue, - clone: cloneValue, - }), - - Array: createType({ - name: "Array", - default: [], - copy: copyArray, - clone: cloneArray, - }), - - Ref: createType({ - name: "Ref", - default: undefined, - copy: copyValue, - clone: cloneValue, - }), - - JSON: createType({ - name: "JSON", - default: null, - copy: copyJSON, - clone: cloneJSON, - }), -}; - -function generateId(length) { - var result = ""; - var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - var charactersLength = characters.length; - for (var i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; -} - -function injectScript(src, onLoad) { - var script = document.createElement("script"); - // @todo Use link to the ecsy-devtools repo? - script.src = src; - script.onload = onLoad; - (document.head || document.documentElement).appendChild(script); -} - -/* global Peer */ - -function hookConsoleAndErrors(connection) { - var wrapFunctions = ["error", "warning", "log"]; - wrapFunctions.forEach((key) => { - if (typeof console[key] === "function") { - var fn = console[key].bind(console); - console[key] = (...args) => { - connection.send({ - method: "console", - type: key, - args: JSON.stringify(args), - }); - return fn.apply(null, args); - }; - } - }); - - window.addEventListener("error", (error) => { - connection.send({ - method: "error", - error: JSON.stringify({ - message: error.error.message, - stack: error.error.stack, - }), - }); - }); -} - -function includeRemoteIdHTML(remoteId) { - let infoDiv = document.createElement("div"); - infoDiv.style.cssText = ` - align-items: center; - background-color: #333; - color: #aaa; - display:flex; - font-family: Arial; - font-size: 1.1em; - height: 40px; - justify-content: center; - left: 0; - opacity: 0.9; - position: absolute; - right: 0; - text-align: center; - top: 0; - `; - - infoDiv.innerHTML = `Open ECSY devtools to connect to this page using the code: ${remoteId} `; - document.body.appendChild(infoDiv); - - return infoDiv; -} - -function enableRemoteDevtools(remoteId) { - if (!hasWindow) { - console.warn("Remote devtools not available outside the browser"); - return; - } - - window.generateNewCode = () => { - window.localStorage.clear(); - remoteId = generateId(6); - window.localStorage.setItem("ecsyRemoteId", remoteId); - window.location.reload(false); - }; - - remoteId = remoteId || window.localStorage.getItem("ecsyRemoteId"); - if (!remoteId) { - remoteId = generateId(6); - window.localStorage.setItem("ecsyRemoteId", remoteId); - } - - let infoDiv = includeRemoteIdHTML(remoteId); - - window.__ECSY_REMOTE_DEVTOOLS_INJECTED = true; - window.__ECSY_REMOTE_DEVTOOLS = {}; - - let Version = ""; - - // This is used to collect the worlds created before the communication is being established - let worldsBeforeLoading = []; - let onWorldCreated = (e) => { - var world = e.detail.world; - Version = e.detail.version; - worldsBeforeLoading.push(world); - }; - window.addEventListener("ecsy-world-created", onWorldCreated); - - let onLoaded = () => { - // var peer = new Peer(remoteId); - var peer = new Peer(remoteId, { - host: "peerjs.ecsy.io", - secure: true, - port: 443, - config: { - iceServers: [ - { url: "stun:stun.l.google.com:19302" }, - { url: "stun:stun1.l.google.com:19302" }, - { url: "stun:stun2.l.google.com:19302" }, - { url: "stun:stun3.l.google.com:19302" }, - { url: "stun:stun4.l.google.com:19302" }, - ], - }, - debug: 3, - }); - - peer.on("open", (/* id */) => { - peer.on("connection", (connection) => { - window.__ECSY_REMOTE_DEVTOOLS.connection = connection; - connection.on("open", function () { - // infoDiv.style.visibility = "hidden"; - infoDiv.innerHTML = "Connected"; - - // Receive messages - connection.on("data", function (data) { - if (data.type === "init") { - var script = document.createElement("script"); - script.setAttribute("type", "text/javascript"); - script.onload = () => { - script.parentNode.removeChild(script); - - // Once the script is injected we don't need to listen - window.removeEventListener( - "ecsy-world-created", - onWorldCreated - ); - worldsBeforeLoading.forEach((world) => { - var event = new CustomEvent("ecsy-world-created", { - detail: { world: world, version: Version }, - }); - window.dispatchEvent(event); - }); - }; - script.innerHTML = data.script; - (document.head || document.documentElement).appendChild(script); - script.onload(); - - hookConsoleAndErrors(connection); - } else if (data.type === "executeScript") { - let value = eval(data.script); - if (data.returnEval) { - connection.send({ - method: "evalReturn", - value: value, - }); - } - } - }); - }); - }); - }); - }; - - // Inject PeerJS script - injectScript( - "https://cdn.jsdelivr.net/npm/peerjs@0.3.20/dist/peer.min.js", - onLoaded - ); -} - -if (hasWindow) { - const urlParams = new URLSearchParams(window.location.search); - - // @todo Provide a way to disable it if needed - if (urlParams.has("enable-remote-devtools")) { - enableRemoteDevtools(); - } -} - -export { Component, Not, ObjectPool, System, SystemStateComponent, TagComponent, Types, Version, World, Entity as _Entity, cloneArray, cloneClonable, cloneJSON, cloneValue, copyArray, copyCopyable, copyJSON, copyValue, createType, enableRemoteDevtools }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AnaglyphEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AnaglyphEffect.js deleted file mode 100644 index 2e40a20..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AnaglyphEffect.js +++ /dev/null @@ -1,154 +0,0 @@ -import { - LinearFilter, - Matrix3, - Mesh, - NearestFilter, - OrthographicCamera, - PlaneGeometry, - RGBAFormat, - Scene, - ShaderMaterial, - StereoCamera, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; - -class AnaglyphEffect { - - constructor( renderer, width = 512, height = 512 ) { - - // Dubois matrices from https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.7.6968&rep=rep1&type=pdf#page=4 - - this.colorMatrixLeft = new Matrix3().fromArray( [ - 0.456100, - 0.0400822, - 0.0152161, - 0.500484, - 0.0378246, - 0.0205971, - 0.176381, - 0.0157589, - 0.00546856 - ] ); - - this.colorMatrixRight = new Matrix3().fromArray( [ - - 0.0434706, 0.378476, - 0.0721527, - - 0.0879388, 0.73364, - 0.112961, - - 0.00155529, - 0.0184503, 1.2264 - ] ); - - const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); - - const _scene = new Scene(); - - const _stereo = new StereoCamera(); - - const _params = { minFilter: LinearFilter, magFilter: NearestFilter, format: RGBAFormat }; - - const _renderTargetL = new WebGLRenderTarget( width, height, _params ); - const _renderTargetR = new WebGLRenderTarget( width, height, _params ); - - const _material = new ShaderMaterial( { - - uniforms: { - - 'mapLeft': { value: _renderTargetL.texture }, - 'mapRight': { value: _renderTargetR.texture }, - - 'colorMatrixLeft': { value: this.colorMatrixLeft }, - 'colorMatrixRight': { value: this.colorMatrixRight } - - }, - - vertexShader: [ - - 'varying vec2 vUv;', - - 'void main() {', - - ' vUv = vec2( uv.x, uv.y );', - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - - '}' - - ].join( '\n' ), - - fragmentShader: [ - - 'uniform sampler2D mapLeft;', - 'uniform sampler2D mapRight;', - 'varying vec2 vUv;', - - 'uniform mat3 colorMatrixLeft;', - 'uniform mat3 colorMatrixRight;', - - 'void main() {', - - ' vec2 uv = vUv;', - - ' vec4 colorL = texture2D( mapLeft, uv );', - ' vec4 colorR = texture2D( mapRight, uv );', - - ' vec3 color = clamp(', - ' colorMatrixLeft * colorL.rgb +', - ' colorMatrixRight * colorR.rgb, 0., 1. );', - - ' gl_FragColor = vec4(', - ' color.r, color.g, color.b,', - ' max( colorL.a, colorR.a ) );', - - ' #include ', - ' #include ', - - '}' - - ].join( '\n' ) - - } ); - - const _mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material ); - _scene.add( _mesh ); - - this.setSize = function ( width, height ) { - - renderer.setSize( width, height ); - - const pixelRatio = renderer.getPixelRatio(); - - _renderTargetL.setSize( width * pixelRatio, height * pixelRatio ); - _renderTargetR.setSize( width * pixelRatio, height * pixelRatio ); - - }; - - this.render = function ( scene, camera ) { - - const currentRenderTarget = renderer.getRenderTarget(); - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - _stereo.update( camera ); - - renderer.setRenderTarget( _renderTargetL ); - renderer.clear(); - renderer.render( scene, _stereo.cameraL ); - - renderer.setRenderTarget( _renderTargetR ); - renderer.clear(); - renderer.render( scene, _stereo.cameraR ); - - renderer.setRenderTarget( null ); - renderer.render( _scene, _camera ); - - renderer.setRenderTarget( currentRenderTarget ); - - }; - - this.dispose = function () { - - _renderTargetL.dispose(); - _renderTargetR.dispose(); - _mesh.geometry.dispose(); - _mesh.material.dispose(); - - }; - - } - -} - -export { AnaglyphEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AsciiEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AsciiEffect.js deleted file mode 100644 index af5eb7f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/AsciiEffect.js +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Ascii generation is based on https://github.com/hassadee/jsascii/blob/master/jsascii.js - * - * 16 April 2012 - @blurspline - */ - -class AsciiEffect { - - constructor( renderer, charSet = ' .:-=+*#%@', options = {} ) { - - // ' .,:;=|iI+hHOE#`$'; - // darker bolder character set from https://github.com/saw/Canvas-ASCII-Art/ - // ' .\'`^",:;Il!i~+_-?][}{1)(|/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$'.split(''); - - // Some ASCII settings - - const fResolution = options[ 'resolution' ] || 0.15; // Higher for more details - const iScale = options[ 'scale' ] || 1; - const bColor = options[ 'color' ] || false; // nice but slows down rendering! - const bAlpha = options[ 'alpha' ] || false; // Transparency - const bBlock = options[ 'block' ] || false; // blocked characters. like good O dos - const bInvert = options[ 'invert' ] || false; // black is white, white is black - const strResolution = options[ 'strResolution' ] || 'low'; - - let width, height; - - const domElement = document.createElement( 'div' ); - domElement.style.cursor = 'default'; - - const oAscii = document.createElement( 'table' ); - domElement.appendChild( oAscii ); - - let iWidth, iHeight; - let oImg; - - this.setSize = function ( w, h ) { - - width = w; - height = h; - - renderer.setSize( w, h ); - - initAsciiSize(); - - }; - - - this.render = function ( scene, camera ) { - - renderer.render( scene, camera ); - asciifyImage( oAscii ); - - }; - - this.domElement = domElement; - - - // Throw in ascii library from https://github.com/hassadee/jsascii/blob/master/jsascii.js (MIT License) - - function initAsciiSize() { - - iWidth = Math.floor( width * fResolution ); - iHeight = Math.floor( height * fResolution ); - - oCanvas.width = iWidth; - oCanvas.height = iHeight; - // oCanvas.style.display = "none"; - // oCanvas.style.width = iWidth; - // oCanvas.style.height = iHeight; - - oImg = renderer.domElement; - - if ( oImg.style.backgroundColor ) { - - oAscii.rows[ 0 ].cells[ 0 ].style.backgroundColor = oImg.style.backgroundColor; - oAscii.rows[ 0 ].cells[ 0 ].style.color = oImg.style.color; - - } - - oAscii.cellSpacing = 0; - oAscii.cellPadding = 0; - - const oStyle = oAscii.style; - oStyle.whiteSpace = 'pre'; - oStyle.margin = '0px'; - oStyle.padding = '0px'; - oStyle.letterSpacing = fLetterSpacing + 'px'; - oStyle.fontFamily = strFont; - oStyle.fontSize = fFontSize + 'px'; - oStyle.lineHeight = fLineHeight + 'px'; - oStyle.textAlign = 'left'; - oStyle.textDecoration = 'none'; - - } - - - const aDefaultCharList = ( ' .,:;i1tfLCG08@' ).split( '' ); - const aDefaultColorCharList = ( ' CGO08@' ).split( '' ); - const strFont = 'courier new, monospace'; - - const oCanvasImg = renderer.domElement; - - const oCanvas = document.createElement( 'canvas' ); - if ( ! oCanvas.getContext ) { - - return; - - } - - const oCtx = oCanvas.getContext( '2d' ); - if ( ! oCtx.getImageData ) { - - return; - - } - - let aCharList = ( bColor ? aDefaultColorCharList : aDefaultCharList ); - - if ( charSet ) aCharList = charSet; - - // Setup dom - - const fFontSize = ( 2 / fResolution ) * iScale; - const fLineHeight = ( 2 / fResolution ) * iScale; - - // adjust letter-spacing for all combinations of scale and resolution to get it to fit the image width. - - let fLetterSpacing = 0; - - if ( strResolution == 'low' ) { - - switch ( iScale ) { - - case 1 : fLetterSpacing = - 1; break; - case 2 : - case 3 : fLetterSpacing = - 2.1; break; - case 4 : fLetterSpacing = - 3.1; break; - case 5 : fLetterSpacing = - 4.15; break; - - } - - } - - if ( strResolution == 'medium' ) { - - switch ( iScale ) { - - case 1 : fLetterSpacing = 0; break; - case 2 : fLetterSpacing = - 1; break; - case 3 : fLetterSpacing = - 1.04; break; - case 4 : - case 5 : fLetterSpacing = - 2.1; break; - - } - - } - - if ( strResolution == 'high' ) { - - switch ( iScale ) { - - case 1 : - case 2 : fLetterSpacing = 0; break; - case 3 : - case 4 : - case 5 : fLetterSpacing = - 1; break; - - } - - } - - - // can't get a span or div to flow like an img element, but a table works? - - - // convert img element to ascii - - function asciifyImage( oAscii ) { - - oCtx.clearRect( 0, 0, iWidth, iHeight ); - oCtx.drawImage( oCanvasImg, 0, 0, iWidth, iHeight ); - const oImgData = oCtx.getImageData( 0, 0, iWidth, iHeight ).data; - - // Coloring loop starts now - let strChars = ''; - - // console.time('rendering'); - - for ( let y = 0; y < iHeight; y += 2 ) { - - for ( let x = 0; x < iWidth; x ++ ) { - - const iOffset = ( y * iWidth + x ) * 4; - - const iRed = oImgData[ iOffset ]; - const iGreen = oImgData[ iOffset + 1 ]; - const iBlue = oImgData[ iOffset + 2 ]; - const iAlpha = oImgData[ iOffset + 3 ]; - let iCharIdx; - - let fBrightness; - - fBrightness = ( 0.3 * iRed + 0.59 * iGreen + 0.11 * iBlue ) / 255; - // fBrightness = (0.3*iRed + 0.5*iGreen + 0.3*iBlue) / 255; - - if ( iAlpha == 0 ) { - - // should calculate alpha instead, but quick hack :) - //fBrightness *= (iAlpha / 255); - fBrightness = 1; - - } - - iCharIdx = Math.floor( ( 1 - fBrightness ) * ( aCharList.length - 1 ) ); - - if ( bInvert ) { - - iCharIdx = aCharList.length - iCharIdx - 1; - - } - - // good for debugging - //fBrightness = Math.floor(fBrightness * 10); - //strThisChar = fBrightness; - - let strThisChar = aCharList[ iCharIdx ]; - - if ( strThisChar === undefined || strThisChar == ' ' ) - strThisChar = ' '; - - if ( bColor ) { - - strChars += '' + strThisChar + ''; - - } else { - - strChars += strThisChar; - - } - - } - - strChars += '
'; - - } - - oAscii.innerHTML = `${strChars}`; - - // console.timeEnd('rendering'); - - // return oAscii; - - } - - } - -} - -export { AsciiEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/OutlineEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/OutlineEffect.js deleted file mode 100644 index 0aea6b4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/OutlineEffect.js +++ /dev/null @@ -1,539 +0,0 @@ -import { - BackSide, - Color, - ShaderMaterial, - UniformsLib, - UniformsUtils -} from '/static/javascript/three/build/three.module.js'; - -/** - * Reference: https://en.wikipedia.org/wiki/Cel_shading - * - * API - * - * 1. Traditional - * - * const effect = new OutlineEffect( renderer ); - * - * function render() { - * - * effect.render( scene, camera ); - * - * } - * - * 2. VR compatible - * - * const effect = new OutlineEffect( renderer ); - * let renderingOutline = false; - * - * scene.onAfterRender = function () { - * - * if ( renderingOutline ) return; - * - * renderingOutline = true; - * - * effect.renderOutline( scene, camera ); - * - * renderingOutline = false; - * - * }; - * - * function render() { - * - * renderer.render( scene, camera ); - * - * } - * - * // How to set default outline parameters - * new OutlineEffect( renderer, { - * defaultThickness: 0.01, - * defaultColor: [ 0, 0, 0 ], - * defaultAlpha: 0.8, - * defaultKeepAlive: true // keeps outline material in cache even if material is removed from scene - * } ); - * - * // How to set outline parameters for each material - * material.userData.outlineParameters = { - * thickness: 0.01, - * color: [ 0, 0, 0 ], - * alpha: 0.8, - * visible: true, - * keepAlive: true - * }; - */ - -class OutlineEffect { - - constructor( renderer, parameters = {} ) { - - this.enabled = true; - - const defaultThickness = parameters.defaultThickness !== undefined ? parameters.defaultThickness : 0.003; - const defaultColor = new Color().fromArray( parameters.defaultColor !== undefined ? parameters.defaultColor : [ 0, 0, 0 ] ); - const defaultAlpha = parameters.defaultAlpha !== undefined ? parameters.defaultAlpha : 1.0; - const defaultKeepAlive = parameters.defaultKeepAlive !== undefined ? parameters.defaultKeepAlive : false; - - // object.material.uuid -> outlineMaterial or - // object.material[ n ].uuid -> outlineMaterial - // save at the outline material creation and release - // if it's unused removeThresholdCount frames - // unless keepAlive is true. - const cache = {}; - - const removeThresholdCount = 60; - - // outlineMaterial.uuid -> object.material or - // outlineMaterial.uuid -> object.material[ n ] - // save before render and release after render. - const originalMaterials = {}; - - // object.uuid -> originalOnBeforeRender - // save before render and release after render. - const originalOnBeforeRenders = {}; - - //this.cache = cache; // for debug - - const uniformsOutline = { - outlineThickness: { value: defaultThickness }, - outlineColor: { value: defaultColor }, - outlineAlpha: { value: defaultAlpha } - }; - - const vertexShader = [ - '#include ', - '#include ', - '#include ', - '#include ', - '#include ', - '#include ', - '#include ', - '#include ', - - 'uniform float outlineThickness;', - - 'vec4 calculateOutline( vec4 pos, vec3 normal, vec4 skinned ) {', - ' float thickness = outlineThickness;', - ' const float ratio = 1.0;', // TODO: support outline thickness ratio for each vertex - ' vec4 pos2 = projectionMatrix * modelViewMatrix * vec4( skinned.xyz + normal, 1.0 );', - // NOTE: subtract pos2 from pos because BackSide objectNormal is negative - ' vec4 norm = normalize( pos - pos2 );', - ' return pos + norm * thickness * pos.w * ratio;', - '}', - - 'void main() {', - - ' #include ', - - ' #include ', - ' #include ', - ' #include ', - ' #include ', - - ' #include ', - ' #include ', - ' #include ', - ' #include ', - ' #include ', - - ' vec3 outlineNormal = - objectNormal;', // the outline material is always rendered with BackSide - - ' gl_Position = calculateOutline( gl_Position, outlineNormal, vec4( transformed, 1.0 ) );', - - ' #include ', - ' #include ', - ' #include ', - - '}', - - ].join( '\n' ); - - const fragmentShader = [ - - '#include ', - '#include ', - '#include ', - '#include ', - - 'uniform vec3 outlineColor;', - 'uniform float outlineAlpha;', - - 'void main() {', - - ' #include ', - ' #include ', - - ' gl_FragColor = vec4( outlineColor, outlineAlpha );', - - ' #include ', - ' #include ', - ' #include ', - ' #include ', - - '}' - - ].join( '\n' ); - - function createMaterial() { - - return new ShaderMaterial( { - type: 'OutlineEffect', - uniforms: UniformsUtils.merge( [ - UniformsLib[ 'fog' ], - UniformsLib[ 'displacementmap' ], - uniformsOutline - ] ), - vertexShader: vertexShader, - fragmentShader: fragmentShader, - side: BackSide - } ); - - } - - function getOutlineMaterialFromCache( originalMaterial ) { - - let data = cache[ originalMaterial.uuid ]; - - if ( data === undefined ) { - - data = { - material: createMaterial(), - used: true, - keepAlive: defaultKeepAlive, - count: 0 - }; - - cache[ originalMaterial.uuid ] = data; - - } - - data.used = true; - - return data.material; - - } - - function getOutlineMaterial( originalMaterial ) { - - const outlineMaterial = getOutlineMaterialFromCache( originalMaterial ); - - originalMaterials[ outlineMaterial.uuid ] = originalMaterial; - - updateOutlineMaterial( outlineMaterial, originalMaterial ); - - return outlineMaterial; - - } - - function isCompatible( object ) { - - const geometry = object.geometry; - const hasNormals = ( geometry !== undefined ) && ( geometry.attributes.normal !== undefined ); - - return ( object.isMesh === true && object.material !== undefined && hasNormals === true ); - - } - - function setOutlineMaterial( object ) { - - if ( isCompatible( object ) === false ) return; - - if ( Array.isArray( object.material ) ) { - - for ( let i = 0, il = object.material.length; i < il; i ++ ) { - - object.material[ i ] = getOutlineMaterial( object.material[ i ] ); - - } - - } else { - - object.material = getOutlineMaterial( object.material ); - - } - - originalOnBeforeRenders[ object.uuid ] = object.onBeforeRender; - object.onBeforeRender = onBeforeRender; - - } - - function restoreOriginalMaterial( object ) { - - if ( isCompatible( object ) === false ) return; - - if ( Array.isArray( object.material ) ) { - - for ( let i = 0, il = object.material.length; i < il; i ++ ) { - - object.material[ i ] = originalMaterials[ object.material[ i ].uuid ]; - - } - - } else { - - object.material = originalMaterials[ object.material.uuid ]; - - } - - object.onBeforeRender = originalOnBeforeRenders[ object.uuid ]; - - } - - function onBeforeRender( renderer, scene, camera, geometry, material ) { - - const originalMaterial = originalMaterials[ material.uuid ]; - - // just in case - if ( originalMaterial === undefined ) return; - - updateUniforms( material, originalMaterial ); - - } - - function updateUniforms( material, originalMaterial ) { - - const outlineParameters = originalMaterial.userData.outlineParameters; - - material.uniforms.outlineAlpha.value = originalMaterial.opacity; - - if ( outlineParameters !== undefined ) { - - if ( outlineParameters.thickness !== undefined ) material.uniforms.outlineThickness.value = outlineParameters.thickness; - if ( outlineParameters.color !== undefined ) material.uniforms.outlineColor.value.fromArray( outlineParameters.color ); - if ( outlineParameters.alpha !== undefined ) material.uniforms.outlineAlpha.value = outlineParameters.alpha; - - } - - if ( originalMaterial.displacementMap ) { - - material.uniforms.displacementMap.value = originalMaterial.displacementMap; - material.uniforms.displacementScale.value = originalMaterial.displacementScale; - material.uniforms.displacementBias.value = originalMaterial.displacementBias; - - } - - } - - function updateOutlineMaterial( material, originalMaterial ) { - - if ( material.name === 'invisible' ) return; - - const outlineParameters = originalMaterial.userData.outlineParameters; - - material.fog = originalMaterial.fog; - material.toneMapped = originalMaterial.toneMapped; - material.premultipliedAlpha = originalMaterial.premultipliedAlpha; - material.displacementMap = originalMaterial.displacementMap; - - if ( outlineParameters !== undefined ) { - - if ( originalMaterial.visible === false ) { - - material.visible = false; - - } else { - - material.visible = ( outlineParameters.visible !== undefined ) ? outlineParameters.visible : true; - - } - - material.transparent = ( outlineParameters.alpha !== undefined && outlineParameters.alpha < 1.0 ) ? true : originalMaterial.transparent; - - if ( outlineParameters.keepAlive !== undefined ) cache[ originalMaterial.uuid ].keepAlive = outlineParameters.keepAlive; - - } else { - - material.transparent = originalMaterial.transparent; - material.visible = originalMaterial.visible; - - } - - if ( originalMaterial.wireframe === true || originalMaterial.depthTest === false ) material.visible = false; - - if ( originalMaterial.clippingPlanes ) { - - material.clipping = true; - - material.clippingPlanes = originalMaterial.clippingPlanes; - material.clipIntersection = originalMaterial.clipIntersection; - material.clipShadows = originalMaterial.clipShadows; - - } - - material.version = originalMaterial.version; // update outline material if necessary - - } - - function cleanupCache() { - - let keys; - - // clear originialMaterials - keys = Object.keys( originalMaterials ); - - for ( let i = 0, il = keys.length; i < il; i ++ ) { - - originalMaterials[ keys[ i ] ] = undefined; - - } - - // clear originalOnBeforeRenders - keys = Object.keys( originalOnBeforeRenders ); - - for ( let i = 0, il = keys.length; i < il; i ++ ) { - - originalOnBeforeRenders[ keys[ i ] ] = undefined; - - } - - // remove unused outlineMaterial from cache - keys = Object.keys( cache ); - - for ( let i = 0, il = keys.length; i < il; i ++ ) { - - const key = keys[ i ]; - - if ( cache[ key ].used === false ) { - - cache[ key ].count ++; - - if ( cache[ key ].keepAlive === false && cache[ key ].count > removeThresholdCount ) { - - delete cache[ key ]; - - } - - } else { - - cache[ key ].used = false; - cache[ key ].count = 0; - - } - - } - - } - - this.render = function ( scene, camera ) { - - if ( this.enabled === false ) { - - renderer.render( scene, camera ); - return; - - } - - const currentAutoClear = renderer.autoClear; - renderer.autoClear = this.autoClear; - - renderer.render( scene, camera ); - - renderer.autoClear = currentAutoClear; - - this.renderOutline( scene, camera ); - - }; - - this.renderOutline = function ( scene, camera ) { - - const currentAutoClear = renderer.autoClear; - const currentSceneAutoUpdate = scene.matrixWorldAutoUpdate; - const currentSceneBackground = scene.background; - const currentShadowMapEnabled = renderer.shadowMap.enabled; - - scene.matrixWorldAutoUpdate = false; - scene.background = null; - renderer.autoClear = false; - renderer.shadowMap.enabled = false; - - scene.traverse( setOutlineMaterial ); - - renderer.render( scene, camera ); - - scene.traverse( restoreOriginalMaterial ); - - cleanupCache(); - - scene.matrixWorldAutoUpdate = currentSceneAutoUpdate; - scene.background = currentSceneBackground; - renderer.autoClear = currentAutoClear; - renderer.shadowMap.enabled = currentShadowMapEnabled; - - }; - - /* - * See #9918 - * - * The following property copies and wrapper methods enable - * OutlineEffect to be called from other *Effect, like - * - * effect = new StereoEffect( new OutlineEffect( renderer ) ); - * - * function render () { - * - * effect.render( scene, camera ); - * - * } - */ - this.autoClear = renderer.autoClear; - this.domElement = renderer.domElement; - this.shadowMap = renderer.shadowMap; - - this.clear = function ( color, depth, stencil ) { - - renderer.clear( color, depth, stencil ); - - }; - - this.getPixelRatio = function () { - - return renderer.getPixelRatio(); - - }; - - this.setPixelRatio = function ( value ) { - - renderer.setPixelRatio( value ); - - }; - - this.getSize = function ( target ) { - - return renderer.getSize( target ); - - }; - - this.setSize = function ( width, height, updateStyle ) { - - renderer.setSize( width, height, updateStyle ); - - }; - - this.setViewport = function ( x, y, width, height ) { - - renderer.setViewport( x, y, width, height ); - - }; - - this.setScissor = function ( x, y, width, height ) { - - renderer.setScissor( x, y, width, height ); - - }; - - this.setScissorTest = function ( boolean ) { - - renderer.setScissorTest( boolean ); - - }; - - this.setRenderTarget = function ( renderTarget ) { - - renderer.setRenderTarget( renderTarget ); - - }; - - } - -} - -export { OutlineEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/ParallaxBarrierEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/ParallaxBarrierEffect.js deleted file mode 100644 index 140d593..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/ParallaxBarrierEffect.js +++ /dev/null @@ -1,119 +0,0 @@ -import { - LinearFilter, - Mesh, - NearestFilter, - OrthographicCamera, - PlaneGeometry, - RGBAFormat, - Scene, - ShaderMaterial, - StereoCamera, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; - -class ParallaxBarrierEffect { - - constructor( renderer ) { - - const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); - - const _scene = new Scene(); - - const _stereo = new StereoCamera(); - - const _params = { minFilter: LinearFilter, magFilter: NearestFilter, format: RGBAFormat }; - - const _renderTargetL = new WebGLRenderTarget( 512, 512, _params ); - const _renderTargetR = new WebGLRenderTarget( 512, 512, _params ); - - const _material = new ShaderMaterial( { - - uniforms: { - - 'mapLeft': { value: _renderTargetL.texture }, - 'mapRight': { value: _renderTargetR.texture } - - }, - - vertexShader: [ - - 'varying vec2 vUv;', - - 'void main() {', - - ' vUv = vec2( uv.x, uv.y );', - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - - '}' - - ].join( '\n' ), - - fragmentShader: [ - - 'uniform sampler2D mapLeft;', - 'uniform sampler2D mapRight;', - 'varying vec2 vUv;', - - 'void main() {', - - ' vec2 uv = vUv;', - - ' if ( ( mod( gl_FragCoord.y, 2.0 ) ) > 1.00 ) {', - - ' gl_FragColor = texture2D( mapLeft, uv );', - - ' } else {', - - ' gl_FragColor = texture2D( mapRight, uv );', - - ' }', - - ' #include ', - ' #include ', - - '}' - - ].join( '\n' ) - - } ); - - const mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material ); - _scene.add( mesh ); - - this.setSize = function ( width, height ) { - - renderer.setSize( width, height ); - - const pixelRatio = renderer.getPixelRatio(); - - _renderTargetL.setSize( width * pixelRatio, height * pixelRatio ); - _renderTargetR.setSize( width * pixelRatio, height * pixelRatio ); - - }; - - this.render = function ( scene, camera ) { - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - _stereo.update( camera ); - - renderer.setRenderTarget( _renderTargetL ); - renderer.clear(); - renderer.render( scene, _stereo.cameraL ); - - renderer.setRenderTarget( _renderTargetR ); - renderer.clear(); - renderer.render( scene, _stereo.cameraR ); - - renderer.setRenderTarget( null ); - renderer.render( _scene, _camera ); - - }; - - } - -} - -export { ParallaxBarrierEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/PeppersGhostEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/PeppersGhostEffect.js deleted file mode 100644 index 2953fc2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/PeppersGhostEffect.js +++ /dev/null @@ -1,153 +0,0 @@ -import { - PerspectiveCamera, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * peppers ghost effect based on http://www.instructables.com/id/Reflective-Prism/?ALLSTEPS - */ - -class PeppersGhostEffect { - - constructor( renderer ) { - - const scope = this; - - scope.cameraDistance = 15; - scope.reflectFromAbove = false; - - // Internals - let _halfWidth, _width, _height; - - const _cameraF = new PerspectiveCamera(); //front - const _cameraB = new PerspectiveCamera(); //back - const _cameraL = new PerspectiveCamera(); //left - const _cameraR = new PerspectiveCamera(); //right - - const _position = new Vector3(); - const _quaternion = new Quaternion(); - const _scale = new Vector3(); - - // Initialization - renderer.autoClear = false; - - this.setSize = function ( width, height ) { - - _halfWidth = width / 2; - if ( width < height ) { - - _width = width / 3; - _height = width / 3; - - } else { - - _width = height / 3; - _height = height / 3; - - } - - renderer.setSize( width, height ); - - }; - - this.render = function ( scene, camera ) { - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - camera.matrixWorld.decompose( _position, _quaternion, _scale ); - - // front - _cameraF.position.copy( _position ); - _cameraF.quaternion.copy( _quaternion ); - _cameraF.translateZ( scope.cameraDistance ); - _cameraF.lookAt( scene.position ); - - // back - _cameraB.position.copy( _position ); - _cameraB.quaternion.copy( _quaternion ); - _cameraB.translateZ( - ( scope.cameraDistance ) ); - _cameraB.lookAt( scene.position ); - _cameraB.rotation.z += 180 * ( Math.PI / 180 ); - - // left - _cameraL.position.copy( _position ); - _cameraL.quaternion.copy( _quaternion ); - _cameraL.translateX( - ( scope.cameraDistance ) ); - _cameraL.lookAt( scene.position ); - _cameraL.rotation.x += 90 * ( Math.PI / 180 ); - - // right - _cameraR.position.copy( _position ); - _cameraR.quaternion.copy( _quaternion ); - _cameraR.translateX( scope.cameraDistance ); - _cameraR.lookAt( scene.position ); - _cameraR.rotation.x += 90 * ( Math.PI / 180 ); - - - renderer.clear(); - renderer.setScissorTest( true ); - - renderer.setScissor( _halfWidth - ( _width / 2 ), ( _height * 2 ), _width, _height ); - renderer.setViewport( _halfWidth - ( _width / 2 ), ( _height * 2 ), _width, _height ); - - if ( scope.reflectFromAbove ) { - - renderer.render( scene, _cameraB ); - - } else { - - renderer.render( scene, _cameraF ); - - } - - renderer.setScissor( _halfWidth - ( _width / 2 ), 0, _width, _height ); - renderer.setViewport( _halfWidth - ( _width / 2 ), 0, _width, _height ); - - if ( scope.reflectFromAbove ) { - - renderer.render( scene, _cameraF ); - - } else { - - renderer.render( scene, _cameraB ); - - } - - renderer.setScissor( _halfWidth - ( _width / 2 ) - _width, _height, _width, _height ); - renderer.setViewport( _halfWidth - ( _width / 2 ) - _width, _height, _width, _height ); - - if ( scope.reflectFromAbove ) { - - renderer.render( scene, _cameraR ); - - } else { - - renderer.render( scene, _cameraL ); - - } - - renderer.setScissor( _halfWidth + ( _width / 2 ), _height, _width, _height ); - renderer.setViewport( _halfWidth + ( _width / 2 ), _height, _width, _height ); - - if ( scope.reflectFromAbove ) { - - renderer.render( scene, _cameraL ); - - } else { - - renderer.render( scene, _cameraR ); - - } - - renderer.setScissorTest( false ); - - }; - - } - -} - -export { PeppersGhostEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/StereoEffect.js b/docker-compose/requirements/nginx/static/javascript/taaaa/effects/StereoEffect.js deleted file mode 100644 index f024e54..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/effects/StereoEffect.js +++ /dev/null @@ -1,55 +0,0 @@ -import { - StereoCamera, - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -class StereoEffect { - - constructor( renderer ) { - - const _stereo = new StereoCamera(); - _stereo.aspect = 0.5; - const size = new Vector2(); - - this.setEyeSeparation = function ( eyeSep ) { - - _stereo.eyeSep = eyeSep; - - }; - - this.setSize = function ( width, height ) { - - renderer.setSize( width, height ); - - }; - - this.render = function ( scene, camera ) { - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - _stereo.update( camera ); - - renderer.getSize( size ); - - if ( renderer.autoClear ) renderer.clear(); - renderer.setScissorTest( true ); - - renderer.setScissor( 0, 0, size.width / 2, size.height ); - renderer.setViewport( 0, 0, size.width / 2, size.height ); - renderer.render( scene, _stereo.cameraL ); - - renderer.setScissor( size.width / 2, 0, size.width / 2, size.height ); - renderer.setViewport( size.width / 2, 0, size.width / 2, size.height ); - renderer.render( scene, _stereo.cameraR ); - - renderer.setScissorTest( false ); - - }; - - } - -} - -export { StereoEffect }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/environments/DebugEnvironment.js b/docker-compose/requirements/nginx/static/javascript/taaaa/environments/DebugEnvironment.js deleted file mode 100644 index 23311da..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/environments/DebugEnvironment.js +++ /dev/null @@ -1,52 +0,0 @@ -import { - BackSide, - BoxGeometry, - Mesh, - MeshLambertMaterial, - MeshStandardMaterial, - PointLight, - Scene, -} from '/static/javascript/three/build/three.module.js'; - -class DebugEnvironment extends Scene { - - constructor() { - - super(); - - const geometry = new BoxGeometry(); - geometry.deleteAttribute( 'uv' ); - const roomMaterial = new MeshStandardMaterial( { metalness: 0, side: BackSide } ); - const room = new Mesh( geometry, roomMaterial ); - room.scale.setScalar( 10 ); - this.add( room ); - - const mainLight = new PointLight( 0xffffff, 50, 0, 2 ); - this.add( mainLight ); - - const material1 = new MeshLambertMaterial( { color: 0xff0000, emissive: 0xffffff, emissiveIntensity: 10 } ); - - const light1 = new Mesh( geometry, material1 ); - light1.position.set( - 5, 2, 0 ); - light1.scale.set( 0.1, 1, 1 ); - this.add( light1 ); - - const material2 = new MeshLambertMaterial( { color: 0x00ff00, emissive: 0xffffff, emissiveIntensity: 10 } ); - - const light2 = new Mesh( geometry, material2 ); - light2.position.set( 0, 5, 0 ); - light2.scale.set( 1, 0.1, 1 ); - this.add( light2 ); - - const material3 = new MeshLambertMaterial( { color: 0x0000ff, emissive: 0xffffff, emissiveIntensity: 10 } ); - - const light3 = new Mesh( geometry, material3 ); - light3.position.set( 2, 1, 5 ); - light3.scale.set( 1.5, 2, 0.1 ); - this.add( light3 ); - - } - -} - -export { DebugEnvironment }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/environments/RoomEnvironment.js b/docker-compose/requirements/nginx/static/javascript/taaaa/environments/RoomEnvironment.js deleted file mode 100644 index 64b8713..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/environments/RoomEnvironment.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts - */ - -import { - BackSide, - BoxGeometry, - Mesh, - MeshBasicMaterial, - MeshStandardMaterial, - PointLight, - Scene, -} from '/static/javascript/three/build/three.module.js'; - -class RoomEnvironment extends Scene { - - constructor( renderer = null ) { - - super(); - - const geometry = new BoxGeometry(); - geometry.deleteAttribute( 'uv' ); - - const roomMaterial = new MeshStandardMaterial( { side: BackSide } ); - const boxMaterial = new MeshStandardMaterial(); - - const mainLight = new PointLight( 0xffffff, 900, 28, 2 ); - mainLight.position.set( 0.418, 16.199, 0.300 ); - this.add( mainLight ); - - const room = new Mesh( geometry, roomMaterial ); - room.position.set( - 0.757, 13.219, 0.717 ); - room.scale.set( 31.713, 28.305, 28.591 ); - this.add( room ); - - const box1 = new Mesh( geometry, boxMaterial ); - box1.position.set( - 10.906, 2.009, 1.846 ); - box1.rotation.set( 0, - 0.195, 0 ); - box1.scale.set( 2.328, 7.905, 4.651 ); - this.add( box1 ); - - const box2 = new Mesh( geometry, boxMaterial ); - box2.position.set( - 5.607, - 0.754, - 0.758 ); - box2.rotation.set( 0, 0.994, 0 ); - box2.scale.set( 1.970, 1.534, 3.955 ); - this.add( box2 ); - - const box3 = new Mesh( geometry, boxMaterial ); - box3.position.set( 6.167, 0.857, 7.803 ); - box3.rotation.set( 0, 0.561, 0 ); - box3.scale.set( 3.927, 6.285, 3.687 ); - this.add( box3 ); - - const box4 = new Mesh( geometry, boxMaterial ); - box4.position.set( - 2.017, 0.018, 6.124 ); - box4.rotation.set( 0, 0.333, 0 ); - box4.scale.set( 2.002, 4.566, 2.064 ); - this.add( box4 ); - - const box5 = new Mesh( geometry, boxMaterial ); - box5.position.set( 2.291, - 0.756, - 2.621 ); - box5.rotation.set( 0, - 0.286, 0 ); - box5.scale.set( 1.546, 1.552, 1.496 ); - this.add( box5 ); - - const box6 = new Mesh( geometry, boxMaterial ); - box6.position.set( - 2.193, - 0.369, - 5.547 ); - box6.rotation.set( 0, 0.516, 0 ); - box6.scale.set( 3.875, 3.487, 2.986 ); - this.add( box6 ); - - - // -x right - const light1 = new Mesh( geometry, createAreaLightMaterial( 50 ) ); - light1.position.set( - 16.116, 14.37, 8.208 ); - light1.scale.set( 0.1, 2.428, 2.739 ); - this.add( light1 ); - - // -x left - const light2 = new Mesh( geometry, createAreaLightMaterial( 50 ) ); - light2.position.set( - 16.109, 18.021, - 8.207 ); - light2.scale.set( 0.1, 2.425, 2.751 ); - this.add( light2 ); - - // +x - const light3 = new Mesh( geometry, createAreaLightMaterial( 17 ) ); - light3.position.set( 14.904, 12.198, - 1.832 ); - light3.scale.set( 0.15, 4.265, 6.331 ); - this.add( light3 ); - - // +z - const light4 = new Mesh( geometry, createAreaLightMaterial( 43 ) ); - light4.position.set( - 0.462, 8.89, 14.520 ); - light4.scale.set( 4.38, 5.441, 0.088 ); - this.add( light4 ); - - // -z - const light5 = new Mesh( geometry, createAreaLightMaterial( 20 ) ); - light5.position.set( 3.235, 11.486, - 12.541 ); - light5.scale.set( 2.5, 2.0, 0.1 ); - this.add( light5 ); - - // +y - const light6 = new Mesh( geometry, createAreaLightMaterial( 100 ) ); - light6.position.set( 0.0, 20.0, 0.0 ); - light6.scale.set( 1.0, 0.1, 1.0 ); - this.add( light6 ); - - } - - dispose() { - - const resources = new Set(); - - this.traverse( ( object ) => { - - if ( object.isMesh ) { - - resources.add( object.geometry ); - resources.add( object.material ); - - } - - } ); - - for ( const resource of resources ) { - - resource.dispose(); - - } - - } - -} - -function createAreaLightMaterial( intensity ) { - - const material = new MeshBasicMaterial(); - material.color.setScalar( intensity ); - return material; - -} - -export { RoomEnvironment }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/DRACOExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/DRACOExporter.js deleted file mode 100644 index d16316a..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/DRACOExporter.js +++ /dev/null @@ -1,267 +0,0 @@ -import { Color } from '/static/javascript/three/build/three.module.js'; - -/** - * Export draco compressed files from threejs geometry objects. - * - * Draco files are compressed and usually are smaller than conventional 3D file formats. - * - * The exporter receives a options object containing - * - decodeSpeed, indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality) - * - encodeSpeed, indicates how to tune the encoder parameters (0 gives better speed but worst quality) - * - encoderMethod - * - quantization, indicates the presision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC) - * - exportUvs - * - exportNormals - * - exportColor - */ - -/* global DracoEncoderModule */ - -class DRACOExporter { - - parse( object, options = {} ) { - - options = Object.assign( { - decodeSpeed: 5, - encodeSpeed: 5, - encoderMethod: DRACOExporter.MESH_EDGEBREAKER_ENCODING, - quantization: [ 16, 8, 8, 8, 8 ], - exportUvs: true, - exportNormals: true, - exportColor: false, - }, options ); - - if ( DracoEncoderModule === undefined ) { - - throw new Error( 'THREE.DRACOExporter: required the draco_encoder to work.' ); - - } - - const geometry = object.geometry; - - const dracoEncoder = DracoEncoderModule(); - const encoder = new dracoEncoder.Encoder(); - let builder; - let dracoObject; - - if ( object.isMesh === true ) { - - builder = new dracoEncoder.MeshBuilder(); - dracoObject = new dracoEncoder.Mesh(); - - const vertices = geometry.getAttribute( 'position' ); - builder.AddFloatAttributeToMesh( dracoObject, dracoEncoder.POSITION, vertices.count, vertices.itemSize, vertices.array ); - - const faces = geometry.getIndex(); - - if ( faces !== null ) { - - builder.AddFacesToMesh( dracoObject, faces.count / 3, faces.array ); - - } else { - - const faces = new ( vertices.count > 65535 ? Uint32Array : Uint16Array )( vertices.count ); - - for ( let i = 0; i < faces.length; i ++ ) { - - faces[ i ] = i; - - } - - builder.AddFacesToMesh( dracoObject, vertices.count, faces ); - - } - - if ( options.exportNormals === true ) { - - const normals = geometry.getAttribute( 'normal' ); - - if ( normals !== undefined ) { - - builder.AddFloatAttributeToMesh( dracoObject, dracoEncoder.NORMAL, normals.count, normals.itemSize, normals.array ); - - } - - } - - if ( options.exportUvs === true ) { - - const uvs = geometry.getAttribute( 'uv' ); - - if ( uvs !== undefined ) { - - builder.AddFloatAttributeToMesh( dracoObject, dracoEncoder.TEX_COORD, uvs.count, uvs.itemSize, uvs.array ); - - } - - } - - if ( options.exportColor === true ) { - - const colors = geometry.getAttribute( 'color' ); - - if ( colors !== undefined ) { - - const array = createVertexColorSRGBArray( colors ); - - builder.AddFloatAttributeToMesh( dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, array ); - - } - - } - - } else if ( object.isPoints === true ) { - - builder = new dracoEncoder.PointCloudBuilder(); - dracoObject = new dracoEncoder.PointCloud(); - - const vertices = geometry.getAttribute( 'position' ); - builder.AddFloatAttribute( dracoObject, dracoEncoder.POSITION, vertices.count, vertices.itemSize, vertices.array ); - - if ( options.exportColor === true ) { - - const colors = geometry.getAttribute( 'color' ); - - if ( colors !== undefined ) { - - const array = createVertexColorSRGBArray( colors ); - - builder.AddFloatAttribute( dracoObject, dracoEncoder.COLOR, colors.count, colors.itemSize, array ); - - } - - } - - } else { - - throw new Error( 'DRACOExporter: Unsupported object type.' ); - - } - - //Compress using draco encoder - - const encodedData = new dracoEncoder.DracoInt8Array(); - - //Sets the desired encoding and decoding speed for the given options from 0 (slowest speed, but the best compression) to 10 (fastest, but the worst compression). - - const encodeSpeed = ( options.encodeSpeed !== undefined ) ? options.encodeSpeed : 5; - const decodeSpeed = ( options.decodeSpeed !== undefined ) ? options.decodeSpeed : 5; - - encoder.SetSpeedOptions( encodeSpeed, decodeSpeed ); - - // Sets the desired encoding method for a given geometry. - - if ( options.encoderMethod !== undefined ) { - - encoder.SetEncodingMethod( options.encoderMethod ); - - } - - // Sets the quantization (number of bits used to represent) compression options for a named attribute. - // The attribute values will be quantized in a box defined by the maximum extent of the attribute values. - if ( options.quantization !== undefined ) { - - for ( let i = 0; i < 5; i ++ ) { - - if ( options.quantization[ i ] !== undefined ) { - - encoder.SetAttributeQuantization( i, options.quantization[ i ] ); - - } - - } - - } - - let length; - - if ( object.isMesh === true ) { - - length = encoder.EncodeMeshToDracoBuffer( dracoObject, encodedData ); - - } else { - - length = encoder.EncodePointCloudToDracoBuffer( dracoObject, true, encodedData ); - - } - - dracoEncoder.destroy( dracoObject ); - - if ( length === 0 ) { - - throw new Error( 'THREE.DRACOExporter: Draco encoding failed.' ); - - } - - //Copy encoded data to buffer. - const outputData = new Int8Array( new ArrayBuffer( length ) ); - - for ( let i = 0; i < length; i ++ ) { - - outputData[ i ] = encodedData.GetValue( i ); - - } - - dracoEncoder.destroy( encodedData ); - dracoEncoder.destroy( encoder ); - dracoEncoder.destroy( builder ); - - return outputData; - - } - -} - -function createVertexColorSRGBArray( attribute ) { - - // While .drc files do not specify colorspace, the only 'official' tooling - // is PLY and OBJ converters, which use sRGB. We'll assume sRGB is expected - // for .drc files, but note that Draco buffers embedded in glTF files will - // be Linear-sRGB instead. - - const _color = new Color(); - - const count = attribute.count; - const itemSize = attribute.itemSize; - const array = new Float32Array( count * itemSize ); - - for ( let i = 0, il = count; i < il; i ++ ) { - - _color.fromBufferAttribute( attribute, i ).convertLinearToSRGB(); - - array[ i * itemSize ] = _color.r; - array[ i * itemSize + 1 ] = _color.g; - array[ i * itemSize + 2 ] = _color.b; - - if ( itemSize === 4 ) { - - array[ i * itemSize + 3 ] = attribute.getW( i ); - - } - - } - - return array; - -} - -// Encoder methods - -DRACOExporter.MESH_EDGEBREAKER_ENCODING = 1; -DRACOExporter.MESH_SEQUENTIAL_ENCODING = 0; - -// Geometry type - -DRACOExporter.POINT_CLOUD = 0; -DRACOExporter.TRIANGULAR_MESH = 1; - -// Attribute type - -DRACOExporter.INVALID = - 1; -DRACOExporter.POSITION = 0; -DRACOExporter.NORMAL = 1; -DRACOExporter.COLOR = 2; -DRACOExporter.TEX_COORD = 3; -DRACOExporter.GENERIC = 4; - -export { DRACOExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/EXRExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/EXRExporter.js deleted file mode 100644 index 17994b6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/EXRExporter.js +++ /dev/null @@ -1,579 +0,0 @@ -/** - * @author sciecode / https://github.com/sciecode - * - * EXR format references: - * https://www.openexr.com/documentation/openexrfilelayout.pdf - */ - -import { - FloatType, - HalfFloatType, - RGBAFormat, - DataUtils, -} from '/static/javascript/three/build/three.module.js'; -import * as fflate from '../libs/fflate.module.js'; - -const textEncoder = new TextEncoder(); - -const NO_COMPRESSION = 0; -const ZIPS_COMPRESSION = 2; -const ZIP_COMPRESSION = 3; - -class EXRExporter { - - parse( arg1, arg2, arg3 ) { - - if ( ! arg1 || ! ( arg1.isWebGLRenderer || arg1.isDataTexture ) ) { - - throw Error( 'EXRExporter.parse: Unsupported first parameter, expected instance of WebGLRenderer or DataTexture.' ); - - } else if ( arg1.isWebGLRenderer ) { - - const renderer = arg1, renderTarget = arg2, options = arg3; - - supportedRTT( renderTarget ); - - const info = buildInfoRTT( renderTarget, options ), - dataBuffer = getPixelData( renderer, renderTarget, info ), - rawContentBuffer = reorganizeDataBuffer( dataBuffer, info ), - chunks = compressData( rawContentBuffer, info ); - - return fillData( chunks, info ); - - } else if ( arg1.isDataTexture ) { - - const texture = arg1, options = arg2; - - supportedDT( texture ); - - const info = buildInfoDT( texture, options ), - dataBuffer = texture.image.data, - rawContentBuffer = reorganizeDataBuffer( dataBuffer, info ), - chunks = compressData( rawContentBuffer, info ); - - return fillData( chunks, info ); - - } - - } - -} - -function supportedRTT( renderTarget ) { - - if ( ! renderTarget || ! renderTarget.isWebGLRenderTarget ) { - - throw Error( 'EXRExporter.parse: Unsupported second parameter, expected instance of WebGLRenderTarget.' ); - - } - - if ( renderTarget.isWebGLCubeRenderTarget || renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) { - - throw Error( 'EXRExporter.parse: Unsupported render target type, expected instance of WebGLRenderTarget.' ); - - } - - if ( renderTarget.texture.type !== FloatType && renderTarget.texture.type !== HalfFloatType ) { - - throw Error( 'EXRExporter.parse: Unsupported WebGLRenderTarget texture type.' ); - - } - - if ( renderTarget.texture.format !== RGBAFormat ) { - - throw Error( 'EXRExporter.parse: Unsupported WebGLRenderTarget texture format, expected RGBAFormat.' ); - - } - -} - -function supportedDT( texture ) { - - if ( texture.type !== FloatType && texture.type !== HalfFloatType ) { - - throw Error( 'EXRExporter.parse: Unsupported DataTexture texture type.' ); - - } - - if ( texture.format !== RGBAFormat ) { - - throw Error( 'EXRExporter.parse: Unsupported DataTexture texture format, expected RGBAFormat.' ); - - } - - if ( ! texture.image.data ) { - - throw Error( 'EXRExporter.parse: Invalid DataTexture image data.' ); - - } - - if ( texture.type === FloatType && texture.image.data.constructor.name !== 'Float32Array' ) { - - throw Error( 'EXRExporter.parse: DataTexture image data doesn\'t match type, expected \'Float32Array\'.' ); - - } - - if ( texture.type === HalfFloatType && texture.image.data.constructor.name !== 'Uint16Array' ) { - - throw Error( 'EXRExporter.parse: DataTexture image data doesn\'t match type, expected \'Uint16Array\'.' ); - - } - -} - -function buildInfoRTT( renderTarget, options = {} ) { - - const compressionSizes = { - 0: 1, - 2: 1, - 3: 16 - }; - - const WIDTH = renderTarget.width, - HEIGHT = renderTarget.height, - TYPE = renderTarget.texture.type, - FORMAT = renderTarget.texture.format, - COMPRESSION = ( options.compression !== undefined ) ? options.compression : ZIP_COMPRESSION, - EXPORTER_TYPE = ( options.type !== undefined ) ? options.type : HalfFloatType, - OUT_TYPE = ( EXPORTER_TYPE === FloatType ) ? 2 : 1, - COMPRESSION_SIZE = compressionSizes[ COMPRESSION ], - NUM_CHANNELS = 4; - - return { - width: WIDTH, - height: HEIGHT, - type: TYPE, - format: FORMAT, - compression: COMPRESSION, - blockLines: COMPRESSION_SIZE, - dataType: OUT_TYPE, - dataSize: 2 * OUT_TYPE, - numBlocks: Math.ceil( HEIGHT / COMPRESSION_SIZE ), - numInputChannels: 4, - numOutputChannels: NUM_CHANNELS, - }; - -} - -function buildInfoDT( texture, options = {} ) { - - const compressionSizes = { - 0: 1, - 2: 1, - 3: 16 - }; - - const WIDTH = texture.image.width, - HEIGHT = texture.image.height, - TYPE = texture.type, - FORMAT = texture.format, - COMPRESSION = ( options.compression !== undefined ) ? options.compression : ZIP_COMPRESSION, - EXPORTER_TYPE = ( options.type !== undefined ) ? options.type : HalfFloatType, - OUT_TYPE = ( EXPORTER_TYPE === FloatType ) ? 2 : 1, - COMPRESSION_SIZE = compressionSizes[ COMPRESSION ], - NUM_CHANNELS = 4; - - return { - width: WIDTH, - height: HEIGHT, - type: TYPE, - format: FORMAT, - compression: COMPRESSION, - blockLines: COMPRESSION_SIZE, - dataType: OUT_TYPE, - dataSize: 2 * OUT_TYPE, - numBlocks: Math.ceil( HEIGHT / COMPRESSION_SIZE ), - numInputChannels: 4, - numOutputChannels: NUM_CHANNELS, - }; - -} - -function getPixelData( renderer, rtt, info ) { - - let dataBuffer; - - if ( info.type === FloatType ) { - - dataBuffer = new Float32Array( info.width * info.height * info.numInputChannels ); - - } else { - - dataBuffer = new Uint16Array( info.width * info.height * info.numInputChannels ); - - } - - renderer.readRenderTargetPixels( rtt, 0, 0, info.width, info.height, dataBuffer ); - - return dataBuffer; - -} - -function reorganizeDataBuffer( inBuffer, info ) { - - const w = info.width, - h = info.height, - dec = { r: 0, g: 0, b: 0, a: 0 }, - offset = { value: 0 }, - cOffset = ( info.numOutputChannels == 4 ) ? 1 : 0, - getValue = ( info.type == FloatType ) ? getFloat32 : getFloat16, - setValue = ( info.dataType == 1 ) ? setFloat16 : setFloat32, - outBuffer = new Uint8Array( info.width * info.height * info.numOutputChannels * info.dataSize ), - dv = new DataView( outBuffer.buffer ); - - for ( let y = 0; y < h; ++ y ) { - - for ( let x = 0; x < w; ++ x ) { - - const i = y * w * 4 + x * 4; - - const r = getValue( inBuffer, i ); - const g = getValue( inBuffer, i + 1 ); - const b = getValue( inBuffer, i + 2 ); - const a = getValue( inBuffer, i + 3 ); - - const line = ( h - y - 1 ) * w * ( 3 + cOffset ) * info.dataSize; - - decodeLinear( dec, r, g, b, a ); - - offset.value = line + x * info.dataSize; - setValue( dv, dec.a, offset ); - - offset.value = line + ( cOffset ) * w * info.dataSize + x * info.dataSize; - setValue( dv, dec.b, offset ); - - offset.value = line + ( 1 + cOffset ) * w * info.dataSize + x * info.dataSize; - setValue( dv, dec.g, offset ); - - offset.value = line + ( 2 + cOffset ) * w * info.dataSize + x * info.dataSize; - setValue( dv, dec.r, offset ); - - } - - } - - return outBuffer; - -} - -function compressData( inBuffer, info ) { - - let compress, - tmpBuffer, - sum = 0; - - const chunks = { data: new Array(), totalSize: 0 }, - size = info.width * info.numOutputChannels * info.blockLines * info.dataSize; - - switch ( info.compression ) { - - case 0: - compress = compressNONE; - break; - - case 2: - case 3: - compress = compressZIP; - break; - - } - - if ( info.compression !== 0 ) { - - tmpBuffer = new Uint8Array( size ); - - } - - for ( let i = 0; i < info.numBlocks; ++ i ) { - - const arr = inBuffer.subarray( size * i, size * ( i + 1 ) ); - - const block = compress( arr, tmpBuffer ); - - sum += block.length; - - chunks.data.push( { dataChunk: block, size: block.length } ); - - } - - chunks.totalSize = sum; - - return chunks; - -} - -function compressNONE( data ) { - - return data; - -} - -function compressZIP( data, tmpBuffer ) { - - // - // Reorder the pixel data. - // - - let t1 = 0, - t2 = Math.floor( ( data.length + 1 ) / 2 ), - s = 0; - - const stop = data.length - 1; - - while ( true ) { - - if ( s > stop ) break; - tmpBuffer[ t1 ++ ] = data[ s ++ ]; - - if ( s > stop ) break; - tmpBuffer[ t2 ++ ] = data[ s ++ ]; - - } - - // - // Predictor. - // - - let p = tmpBuffer[ 0 ]; - - for ( let t = 1; t < tmpBuffer.length; t ++ ) { - - const d = tmpBuffer[ t ] - p + ( 128 + 256 ); - p = tmpBuffer[ t ]; - tmpBuffer[ t ] = d; - - } - - const deflate = fflate.zlibSync( tmpBuffer ); - - return deflate; - -} - -function fillHeader( outBuffer, chunks, info ) { - - const offset = { value: 0 }; - const dv = new DataView( outBuffer.buffer ); - - setUint32( dv, 20000630, offset ); // magic - setUint32( dv, 2, offset ); // mask - - // = HEADER = - - setString( dv, 'compression', offset ); - setString( dv, 'compression', offset ); - setUint32( dv, 1, offset ); - setUint8( dv, info.compression, offset ); - - setString( dv, 'screenWindowCenter', offset ); - setString( dv, 'v2f', offset ); - setUint32( dv, 8, offset ); - setUint32( dv, 0, offset ); - setUint32( dv, 0, offset ); - - setString( dv, 'screenWindowWidth', offset ); - setString( dv, 'float', offset ); - setUint32( dv, 4, offset ); - setFloat32( dv, 1.0, offset ); - - setString( dv, 'pixelAspectRatio', offset ); - setString( dv, 'float', offset ); - setUint32( dv, 4, offset ); - setFloat32( dv, 1.0, offset ); - - setString( dv, 'lineOrder', offset ); - setString( dv, 'lineOrder', offset ); - setUint32( dv, 1, offset ); - setUint8( dv, 0, offset ); - - setString( dv, 'dataWindow', offset ); - setString( dv, 'box2i', offset ); - setUint32( dv, 16, offset ); - setUint32( dv, 0, offset ); - setUint32( dv, 0, offset ); - setUint32( dv, info.width - 1, offset ); - setUint32( dv, info.height - 1, offset ); - - setString( dv, 'displayWindow', offset ); - setString( dv, 'box2i', offset ); - setUint32( dv, 16, offset ); - setUint32( dv, 0, offset ); - setUint32( dv, 0, offset ); - setUint32( dv, info.width - 1, offset ); - setUint32( dv, info.height - 1, offset ); - - setString( dv, 'channels', offset ); - setString( dv, 'chlist', offset ); - setUint32( dv, info.numOutputChannels * 18 + 1, offset ); - - setString( dv, 'A', offset ); - setUint32( dv, info.dataType, offset ); - offset.value += 4; - setUint32( dv, 1, offset ); - setUint32( dv, 1, offset ); - - setString( dv, 'B', offset ); - setUint32( dv, info.dataType, offset ); - offset.value += 4; - setUint32( dv, 1, offset ); - setUint32( dv, 1, offset ); - - setString( dv, 'G', offset ); - setUint32( dv, info.dataType, offset ); - offset.value += 4; - setUint32( dv, 1, offset ); - setUint32( dv, 1, offset ); - - setString( dv, 'R', offset ); - setUint32( dv, info.dataType, offset ); - offset.value += 4; - setUint32( dv, 1, offset ); - setUint32( dv, 1, offset ); - - setUint8( dv, 0, offset ); - - // null-byte - setUint8( dv, 0, offset ); - - // = OFFSET TABLE = - - let sum = offset.value + info.numBlocks * 8; - - for ( let i = 0; i < chunks.data.length; ++ i ) { - - setUint64( dv, sum, offset ); - - sum += chunks.data[ i ].size + 8; - - } - -} - -function fillData( chunks, info ) { - - const TableSize = info.numBlocks * 8, - HeaderSize = 259 + ( 18 * info.numOutputChannels ), // 259 + 18 * chlist - offset = { value: HeaderSize + TableSize }, - outBuffer = new Uint8Array( HeaderSize + TableSize + chunks.totalSize + info.numBlocks * 8 ), - dv = new DataView( outBuffer.buffer ); - - fillHeader( outBuffer, chunks, info ); - - for ( let i = 0; i < chunks.data.length; ++ i ) { - - const data = chunks.data[ i ].dataChunk; - const size = chunks.data[ i ].size; - - setUint32( dv, i * info.blockLines, offset ); - setUint32( dv, size, offset ); - - outBuffer.set( data, offset.value ); - offset.value += size; - - } - - return outBuffer; - -} - -function decodeLinear( dec, r, g, b, a ) { - - dec.r = r; - dec.g = g; - dec.b = b; - dec.a = a; - -} - -// function decodeSRGB( dec, r, g, b, a ) { - -// dec.r = r > 0.04045 ? Math.pow( r * 0.9478672986 + 0.0521327014, 2.4 ) : r * 0.0773993808; -// dec.g = g > 0.04045 ? Math.pow( g * 0.9478672986 + 0.0521327014, 2.4 ) : g * 0.0773993808; -// dec.b = b > 0.04045 ? Math.pow( b * 0.9478672986 + 0.0521327014, 2.4 ) : b * 0.0773993808; -// dec.a = a; - -// } - - -function setUint8( dv, value, offset ) { - - dv.setUint8( offset.value, value ); - - offset.value += 1; - -} - -function setUint32( dv, value, offset ) { - - dv.setUint32( offset.value, value, true ); - - offset.value += 4; - -} - -function setFloat16( dv, value, offset ) { - - dv.setUint16( offset.value, DataUtils.toHalfFloat( value ), true ); - - offset.value += 2; - -} - -function setFloat32( dv, value, offset ) { - - dv.setFloat32( offset.value, value, true ); - - offset.value += 4; - -} - -function setUint64( dv, value, offset ) { - - dv.setBigUint64( offset.value, BigInt( value ), true ); - - offset.value += 8; - -} - -function setString( dv, string, offset ) { - - const tmp = textEncoder.encode( string + '\0' ); - - for ( let i = 0; i < tmp.length; ++ i ) { - - setUint8( dv, tmp[ i ], offset ); - - } - -} - -function decodeFloat16( binary ) { - - const exponent = ( binary & 0x7C00 ) >> 10, - fraction = binary & 0x03FF; - - return ( binary >> 15 ? - 1 : 1 ) * ( - exponent ? - ( - exponent === 0x1F ? - fraction ? NaN : Infinity : - Math.pow( 2, exponent - 15 ) * ( 1 + fraction / 0x400 ) - ) : - 6.103515625e-5 * ( fraction / 0x400 ) - ); - -} - -function getFloat16( arr, i ) { - - return decodeFloat16( arr[ i ] ); - -} - -function getFloat32( arr, i ) { - - return arr[ i ]; - -} - -export { EXRExporter, NO_COMPRESSION, ZIP_COMPRESSION, ZIPS_COMPRESSION }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/GLTFExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/GLTFExporter.js deleted file mode 100644 index 49c3a7f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/GLTFExporter.js +++ /dev/null @@ -1,3384 +0,0 @@ -import { - BufferAttribute, - ClampToEdgeWrapping, - Color, - DoubleSide, - InterpolateDiscrete, - InterpolateLinear, - NoColorSpace, - LinearFilter, - LinearMipmapLinearFilter, - LinearMipmapNearestFilter, - MathUtils, - Matrix4, - MirroredRepeatWrapping, - NearestFilter, - NearestMipmapLinearFilter, - NearestMipmapNearestFilter, - PropertyBinding, - RGBAFormat, - RepeatWrapping, - Scene, - Source, - SRGBColorSpace, - CompressedTexture, - Vector3, - Quaternion, - REVISION -} from '/static/javascript/three/build/three.module.js'; -import { decompress } from './../utils/TextureUtils.js'; - - -/** - * The KHR_mesh_quantization extension allows these extra attribute component types - * - * @see https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md#extending-mesh-attributes - */ -const KHR_mesh_quantization_ExtraAttrTypes = { - POSITION: [ - 'byte', - 'byte normalized', - 'unsigned byte', - 'unsigned byte normalized', - 'short', - 'short normalized', - 'unsigned short', - 'unsigned short normalized', - ], - NORMAL: [ - 'byte normalized', - 'short normalized', - ], - TANGENT: [ - 'byte normalized', - 'short normalized', - ], - TEXCOORD: [ - 'byte', - 'byte normalized', - 'unsigned byte', - 'short', - 'short normalized', - 'unsigned short', - ], -}; - - -class GLTFExporter { - - constructor() { - - this.pluginCallbacks = []; - - this.register( function ( writer ) { - - return new GLTFLightExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsUnlitExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsTransmissionExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsVolumeExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsIorExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsSpecularExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsClearcoatExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsDispersionExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsIridescenceExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsSheenExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsAnisotropyExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsEmissiveStrengthExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMaterialsBumpExtension( writer ); - - } ); - - this.register( function ( writer ) { - - return new GLTFMeshGpuInstancing( writer ); - - } ); - - } - - register( callback ) { - - if ( this.pluginCallbacks.indexOf( callback ) === - 1 ) { - - this.pluginCallbacks.push( callback ); - - } - - return this; - - } - - unregister( callback ) { - - if ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) { - - this.pluginCallbacks.splice( this.pluginCallbacks.indexOf( callback ), 1 ); - - } - - return this; - - } - - /** - * Parse scenes and generate GLTF output - * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes - * @param {Function} onDone Callback on completed - * @param {Function} onError Callback on errors - * @param {Object} options options - */ - parse( input, onDone, onError, options ) { - - const writer = new GLTFWriter(); - const plugins = []; - - for ( let i = 0, il = this.pluginCallbacks.length; i < il; i ++ ) { - - plugins.push( this.pluginCallbacks[ i ]( writer ) ); - - } - - writer.setPlugins( plugins ); - writer.write( input, onDone, options ).catch( onError ); - - } - - parseAsync( input, options ) { - - const scope = this; - - return new Promise( function ( resolve, reject ) { - - scope.parse( input, resolve, reject, options ); - - } ); - - } - -} - -//------------------------------------------------------------------------------ -// Constants -//------------------------------------------------------------------------------ - -const WEBGL_CONSTANTS = { - POINTS: 0x0000, - LINES: 0x0001, - LINE_LOOP: 0x0002, - LINE_STRIP: 0x0003, - TRIANGLES: 0x0004, - TRIANGLE_STRIP: 0x0005, - TRIANGLE_FAN: 0x0006, - - BYTE: 0x1400, - UNSIGNED_BYTE: 0x1401, - SHORT: 0x1402, - UNSIGNED_SHORT: 0x1403, - INT: 0x1404, - UNSIGNED_INT: 0x1405, - FLOAT: 0x1406, - - ARRAY_BUFFER: 0x8892, - ELEMENT_ARRAY_BUFFER: 0x8893, - - NEAREST: 0x2600, - LINEAR: 0x2601, - NEAREST_MIPMAP_NEAREST: 0x2700, - LINEAR_MIPMAP_NEAREST: 0x2701, - NEAREST_MIPMAP_LINEAR: 0x2702, - LINEAR_MIPMAP_LINEAR: 0x2703, - - CLAMP_TO_EDGE: 33071, - MIRRORED_REPEAT: 33648, - REPEAT: 10497 -}; - -const KHR_MESH_QUANTIZATION = 'KHR_mesh_quantization'; - -const THREE_TO_WEBGL = {}; - -THREE_TO_WEBGL[ NearestFilter ] = WEBGL_CONSTANTS.NEAREST; -THREE_TO_WEBGL[ NearestMipmapNearestFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_NEAREST; -THREE_TO_WEBGL[ NearestMipmapLinearFilter ] = WEBGL_CONSTANTS.NEAREST_MIPMAP_LINEAR; -THREE_TO_WEBGL[ LinearFilter ] = WEBGL_CONSTANTS.LINEAR; -THREE_TO_WEBGL[ LinearMipmapNearestFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_NEAREST; -THREE_TO_WEBGL[ LinearMipmapLinearFilter ] = WEBGL_CONSTANTS.LINEAR_MIPMAP_LINEAR; - -THREE_TO_WEBGL[ ClampToEdgeWrapping ] = WEBGL_CONSTANTS.CLAMP_TO_EDGE; -THREE_TO_WEBGL[ RepeatWrapping ] = WEBGL_CONSTANTS.REPEAT; -THREE_TO_WEBGL[ MirroredRepeatWrapping ] = WEBGL_CONSTANTS.MIRRORED_REPEAT; - -const PATH_PROPERTIES = { - scale: 'scale', - position: 'translation', - quaternion: 'rotation', - morphTargetInfluences: 'weights' -}; - -const DEFAULT_SPECULAR_COLOR = new Color(); - -// GLB constants -// https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification - -const GLB_HEADER_BYTES = 12; -const GLB_HEADER_MAGIC = 0x46546C67; -const GLB_VERSION = 2; - -const GLB_CHUNK_PREFIX_BYTES = 8; -const GLB_CHUNK_TYPE_JSON = 0x4E4F534A; -const GLB_CHUNK_TYPE_BIN = 0x004E4942; - -//------------------------------------------------------------------------------ -// Utility functions -//------------------------------------------------------------------------------ - -/** - * Compare two arrays - * @param {Array} array1 Array 1 to compare - * @param {Array} array2 Array 2 to compare - * @return {Boolean} Returns true if both arrays are equal - */ -function equalArray( array1, array2 ) { - - return ( array1.length === array2.length ) && array1.every( function ( element, index ) { - - return element === array2[ index ]; - - } ); - -} - -/** - * Converts a string to an ArrayBuffer. - * @param {string} text - * @return {ArrayBuffer} - */ -function stringToArrayBuffer( text ) { - - return new TextEncoder().encode( text ).buffer; - -} - -/** - * Is identity matrix - * - * @param {Matrix4} matrix - * @returns {Boolean} Returns true, if parameter is identity matrix - */ -function isIdentityMatrix( matrix ) { - - return equalArray( matrix.elements, [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] ); - -} - -/** - * Get the min and max vectors from the given attribute - * @param {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count - * @param {Integer} start - * @param {Integer} count - * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components) - */ -function getMinMax( attribute, start, count ) { - - const output = { - - min: new Array( attribute.itemSize ).fill( Number.POSITIVE_INFINITY ), - max: new Array( attribute.itemSize ).fill( Number.NEGATIVE_INFINITY ) - - }; - - for ( let i = start; i < start + count; i ++ ) { - - for ( let a = 0; a < attribute.itemSize; a ++ ) { - - let value; - - if ( attribute.itemSize > 4 ) { - - // no support for interleaved data for itemSize > 4 - - value = attribute.array[ i * attribute.itemSize + a ]; - - } else { - - if ( a === 0 ) value = attribute.getX( i ); - else if ( a === 1 ) value = attribute.getY( i ); - else if ( a === 2 ) value = attribute.getZ( i ); - else if ( a === 3 ) value = attribute.getW( i ); - - if ( attribute.normalized === true ) { - - value = MathUtils.normalize( value, attribute.array ); - - } - - } - - output.min[ a ] = Math.min( output.min[ a ], value ); - output.max[ a ] = Math.max( output.max[ a ], value ); - - } - - } - - return output; - -} - -/** - * Get the required size + padding for a buffer, rounded to the next 4-byte boundary. - * https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#data-alignment - * - * @param {Integer} bufferSize The size the original buffer. - * @returns {Integer} new buffer size with required padding. - * - */ -function getPaddedBufferSize( bufferSize ) { - - return Math.ceil( bufferSize / 4 ) * 4; - -} - -/** - * Returns a buffer aligned to 4-byte boundary. - * - * @param {ArrayBuffer} arrayBuffer Buffer to pad - * @param {Integer} paddingByte (Optional) - * @returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer - */ -function getPaddedArrayBuffer( arrayBuffer, paddingByte = 0 ) { - - const paddedLength = getPaddedBufferSize( arrayBuffer.byteLength ); - - if ( paddedLength !== arrayBuffer.byteLength ) { - - const array = new Uint8Array( paddedLength ); - array.set( new Uint8Array( arrayBuffer ) ); - - if ( paddingByte !== 0 ) { - - for ( let i = arrayBuffer.byteLength; i < paddedLength; i ++ ) { - - array[ i ] = paddingByte; - - } - - } - - return array.buffer; - - } - - return arrayBuffer; - -} - -function getCanvas() { - - if ( typeof document === 'undefined' && typeof OffscreenCanvas !== 'undefined' ) { - - return new OffscreenCanvas( 1, 1 ); - - } - - return document.createElement( 'canvas' ); - -} - -function getToBlobPromise( canvas, mimeType ) { - - if ( canvas.toBlob !== undefined ) { - - return new Promise( ( resolve ) => canvas.toBlob( resolve, mimeType ) ); - - } - - let quality; - - // Blink's implementation of convertToBlob seems to default to a quality level of 100% - // Use the Blink default quality levels of toBlob instead so that file sizes are comparable. - if ( mimeType === 'image/jpeg' ) { - - quality = 0.92; - - } else if ( mimeType === 'image/webp' ) { - - quality = 0.8; - - } - - return canvas.convertToBlob( { - - type: mimeType, - quality: quality - - } ); - -} - -/** - * Writer - */ -class GLTFWriter { - - constructor() { - - this.plugins = []; - - this.options = {}; - this.pending = []; - this.buffers = []; - - this.byteOffset = 0; - this.buffers = []; - this.nodeMap = new Map(); - this.skins = []; - - this.extensionsUsed = {}; - this.extensionsRequired = {}; - - this.uids = new Map(); - this.uid = 0; - - this.json = { - asset: { - version: '2.0', - generator: 'THREE.GLTFExporter r' + REVISION - } - }; - - this.cache = { - meshes: new Map(), - attributes: new Map(), - attributesNormalized: new Map(), - materials: new Map(), - textures: new Map(), - images: new Map() - }; - - } - - setPlugins( plugins ) { - - this.plugins = plugins; - - } - - /** - * Parse scenes and generate GLTF output - * @param {Scene or [THREE.Scenes]} input Scene or Array of THREE.Scenes - * @param {Function} onDone Callback on completed - * @param {Object} options options - */ - async write( input, onDone, options = {} ) { - - this.options = Object.assign( { - // default options - binary: false, - trs: false, - onlyVisible: true, - maxTextureSize: Infinity, - animations: [], - includeCustomExtensions: false - }, options ); - - if ( this.options.animations.length > 0 ) { - - // Only TRS properties, and not matrices, may be targeted by animation. - this.options.trs = true; - - } - - this.processInput( input ); - - await Promise.all( this.pending ); - - const writer = this; - const buffers = writer.buffers; - const json = writer.json; - options = writer.options; - - const extensionsUsed = writer.extensionsUsed; - const extensionsRequired = writer.extensionsRequired; - - // Merge buffers. - const blob = new Blob( buffers, { type: 'application/octet-stream' } ); - - // Declare extensions. - const extensionsUsedList = Object.keys( extensionsUsed ); - const extensionsRequiredList = Object.keys( extensionsRequired ); - - if ( extensionsUsedList.length > 0 ) json.extensionsUsed = extensionsUsedList; - if ( extensionsRequiredList.length > 0 ) json.extensionsRequired = extensionsRequiredList; - - // Update bytelength of the single buffer. - if ( json.buffers && json.buffers.length > 0 ) json.buffers[ 0 ].byteLength = blob.size; - - if ( options.binary === true ) { - - // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#glb-file-format-specification - - const reader = new FileReader(); - reader.readAsArrayBuffer( blob ); - reader.onloadend = function () { - - // Binary chunk. - const binaryChunk = getPaddedArrayBuffer( reader.result ); - const binaryChunkPrefix = new DataView( new ArrayBuffer( GLB_CHUNK_PREFIX_BYTES ) ); - binaryChunkPrefix.setUint32( 0, binaryChunk.byteLength, true ); - binaryChunkPrefix.setUint32( 4, GLB_CHUNK_TYPE_BIN, true ); - - // JSON chunk. - const jsonChunk = getPaddedArrayBuffer( stringToArrayBuffer( JSON.stringify( json ) ), 0x20 ); - const jsonChunkPrefix = new DataView( new ArrayBuffer( GLB_CHUNK_PREFIX_BYTES ) ); - jsonChunkPrefix.setUint32( 0, jsonChunk.byteLength, true ); - jsonChunkPrefix.setUint32( 4, GLB_CHUNK_TYPE_JSON, true ); - - // GLB header. - const header = new ArrayBuffer( GLB_HEADER_BYTES ); - const headerView = new DataView( header ); - headerView.setUint32( 0, GLB_HEADER_MAGIC, true ); - headerView.setUint32( 4, GLB_VERSION, true ); - const totalByteLength = GLB_HEADER_BYTES - + jsonChunkPrefix.byteLength + jsonChunk.byteLength - + binaryChunkPrefix.byteLength + binaryChunk.byteLength; - headerView.setUint32( 8, totalByteLength, true ); - - const glbBlob = new Blob( [ - header, - jsonChunkPrefix, - jsonChunk, - binaryChunkPrefix, - binaryChunk - ], { type: 'application/octet-stream' } ); - - const glbReader = new FileReader(); - glbReader.readAsArrayBuffer( glbBlob ); - glbReader.onloadend = function () { - - onDone( glbReader.result ); - - }; - - }; - - } else { - - if ( json.buffers && json.buffers.length > 0 ) { - - const reader = new FileReader(); - reader.readAsDataURL( blob ); - reader.onloadend = function () { - - const base64data = reader.result; - json.buffers[ 0 ].uri = base64data; - onDone( json ); - - }; - - } else { - - onDone( json ); - - } - - } - - - } - - /** - * Serializes a userData. - * - * @param {THREE.Object3D|THREE.Material} object - * @param {Object} objectDef - */ - serializeUserData( object, objectDef ) { - - if ( Object.keys( object.userData ).length === 0 ) return; - - const options = this.options; - const extensionsUsed = this.extensionsUsed; - - try { - - const json = JSON.parse( JSON.stringify( object.userData ) ); - - if ( options.includeCustomExtensions && json.gltfExtensions ) { - - if ( objectDef.extensions === undefined ) objectDef.extensions = {}; - - for ( const extensionName in json.gltfExtensions ) { - - objectDef.extensions[ extensionName ] = json.gltfExtensions[ extensionName ]; - extensionsUsed[ extensionName ] = true; - - } - - delete json.gltfExtensions; - - } - - if ( Object.keys( json ).length > 0 ) objectDef.extras = json; - - } catch ( error ) { - - console.warn( 'THREE.GLTFExporter: userData of \'' + object.name + '\' ' + - 'won\'t be serialized because of JSON.stringify error - ' + error.message ); - - } - - } - - /** - * Returns ids for buffer attributes. - * @param {Object} object - * @return {Integer} - */ - getUID( attribute, isRelativeCopy = false ) { - - if ( this.uids.has( attribute ) === false ) { - - const uids = new Map(); - - uids.set( true, this.uid ++ ); - uids.set( false, this.uid ++ ); - - this.uids.set( attribute, uids ); - - } - - const uids = this.uids.get( attribute ); - - return uids.get( isRelativeCopy ); - - } - - /** - * Checks if normal attribute values are normalized. - * - * @param {BufferAttribute} normal - * @returns {Boolean} - */ - isNormalizedNormalAttribute( normal ) { - - const cache = this.cache; - - if ( cache.attributesNormalized.has( normal ) ) return false; - - const v = new Vector3(); - - for ( let i = 0, il = normal.count; i < il; i ++ ) { - - // 0.0005 is from glTF-validator - if ( Math.abs( v.fromBufferAttribute( normal, i ).length() - 1.0 ) > 0.0005 ) return false; - - } - - return true; - - } - - /** - * Creates normalized normal buffer attribute. - * - * @param {BufferAttribute} normal - * @returns {BufferAttribute} - * - */ - createNormalizedNormalAttribute( normal ) { - - const cache = this.cache; - - if ( cache.attributesNormalized.has( normal ) ) return cache.attributesNormalized.get( normal ); - - const attribute = normal.clone(); - const v = new Vector3(); - - for ( let i = 0, il = attribute.count; i < il; i ++ ) { - - v.fromBufferAttribute( attribute, i ); - - if ( v.x === 0 && v.y === 0 && v.z === 0 ) { - - // if values can't be normalized set (1, 0, 0) - v.setX( 1.0 ); - - } else { - - v.normalize(); - - } - - attribute.setXYZ( i, v.x, v.y, v.z ); - - } - - cache.attributesNormalized.set( normal, attribute ); - - return attribute; - - } - - /** - * Applies a texture transform, if present, to the map definition. Requires - * the KHR_texture_transform extension. - * - * @param {Object} mapDef - * @param {THREE.Texture} texture - */ - applyTextureTransform( mapDef, texture ) { - - let didTransform = false; - const transformDef = {}; - - if ( texture.offset.x !== 0 || texture.offset.y !== 0 ) { - - transformDef.offset = texture.offset.toArray(); - didTransform = true; - - } - - if ( texture.rotation !== 0 ) { - - transformDef.rotation = texture.rotation; - didTransform = true; - - } - - if ( texture.repeat.x !== 1 || texture.repeat.y !== 1 ) { - - transformDef.scale = texture.repeat.toArray(); - didTransform = true; - - } - - if ( didTransform ) { - - mapDef.extensions = mapDef.extensions || {}; - mapDef.extensions[ 'KHR_texture_transform' ] = transformDef; - this.extensionsUsed[ 'KHR_texture_transform' ] = true; - - } - - } - - buildMetalRoughTexture( metalnessMap, roughnessMap ) { - - if ( metalnessMap === roughnessMap ) return metalnessMap; - - function getEncodingConversion( map ) { - - if ( map.colorSpace === SRGBColorSpace ) { - - return function SRGBToLinear( c ) { - - return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 ); - - }; - - } - - return function LinearToLinear( c ) { - - return c; - - }; - - } - - console.warn( 'THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.' ); - - if ( metalnessMap instanceof CompressedTexture ) { - - metalnessMap = decompress( metalnessMap ); - - } - - if ( roughnessMap instanceof CompressedTexture ) { - - roughnessMap = decompress( roughnessMap ); - - } - - const metalness = metalnessMap ? metalnessMap.image : null; - const roughness = roughnessMap ? roughnessMap.image : null; - - const width = Math.max( metalness ? metalness.width : 0, roughness ? roughness.width : 0 ); - const height = Math.max( metalness ? metalness.height : 0, roughness ? roughness.height : 0 ); - - const canvas = getCanvas(); - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext( '2d', { - willReadFrequently: true, - } ); - context.fillStyle = '#00ffff'; - context.fillRect( 0, 0, width, height ); - - const composite = context.getImageData( 0, 0, width, height ); - - if ( metalness ) { - - context.drawImage( metalness, 0, 0, width, height ); - - const convert = getEncodingConversion( metalnessMap ); - const data = context.getImageData( 0, 0, width, height ).data; - - for ( let i = 2; i < data.length; i += 4 ) { - - composite.data[ i ] = convert( data[ i ] / 256 ) * 256; - - } - - } - - if ( roughness ) { - - context.drawImage( roughness, 0, 0, width, height ); - - const convert = getEncodingConversion( roughnessMap ); - const data = context.getImageData( 0, 0, width, height ).data; - - for ( let i = 1; i < data.length; i += 4 ) { - - composite.data[ i ] = convert( data[ i ] / 256 ) * 256; - - } - - } - - context.putImageData( composite, 0, 0 ); - - // - - const reference = metalnessMap || roughnessMap; - - const texture = reference.clone(); - - texture.source = new Source( canvas ); - texture.colorSpace = NoColorSpace; - texture.channel = ( metalnessMap || roughnessMap ).channel; - - if ( metalnessMap && roughnessMap && metalnessMap.channel !== roughnessMap.channel ) { - - console.warn( 'THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match.' ); - - } - - return texture; - - } - - /** - * Process a buffer to append to the default one. - * @param {ArrayBuffer} buffer - * @return {Integer} - */ - processBuffer( buffer ) { - - const json = this.json; - const buffers = this.buffers; - - if ( ! json.buffers ) json.buffers = [ { byteLength: 0 } ]; - - // All buffers are merged before export. - buffers.push( buffer ); - - return 0; - - } - - /** - * Process and generate a BufferView - * @param {BufferAttribute} attribute - * @param {number} componentType - * @param {number} start - * @param {number} count - * @param {number} target (Optional) Target usage of the BufferView - * @return {Object} - */ - processBufferView( attribute, componentType, start, count, target ) { - - const json = this.json; - - if ( ! json.bufferViews ) json.bufferViews = []; - - // Create a new dataview and dump the attribute's array into it - - let componentSize; - - switch ( componentType ) { - - case WEBGL_CONSTANTS.BYTE: - case WEBGL_CONSTANTS.UNSIGNED_BYTE: - - componentSize = 1; - - break; - - case WEBGL_CONSTANTS.SHORT: - case WEBGL_CONSTANTS.UNSIGNED_SHORT: - - componentSize = 2; - - break; - - default: - - componentSize = 4; - - } - - let byteStride = attribute.itemSize * componentSize; - - if ( target === WEBGL_CONSTANTS.ARRAY_BUFFER ) { - - // Each element of a vertex attribute MUST be aligned to 4-byte boundaries - // inside a bufferView - byteStride = Math.ceil( byteStride / 4 ) * 4; - - } - - const byteLength = getPaddedBufferSize( count * byteStride ); - const dataView = new DataView( new ArrayBuffer( byteLength ) ); - let offset = 0; - - for ( let i = start; i < start + count; i ++ ) { - - for ( let a = 0; a < attribute.itemSize; a ++ ) { - - let value; - - if ( attribute.itemSize > 4 ) { - - // no support for interleaved data for itemSize > 4 - - value = attribute.array[ i * attribute.itemSize + a ]; - - } else { - - if ( a === 0 ) value = attribute.getX( i ); - else if ( a === 1 ) value = attribute.getY( i ); - else if ( a === 2 ) value = attribute.getZ( i ); - else if ( a === 3 ) value = attribute.getW( i ); - - if ( attribute.normalized === true ) { - - value = MathUtils.normalize( value, attribute.array ); - - } - - } - - if ( componentType === WEBGL_CONSTANTS.FLOAT ) { - - dataView.setFloat32( offset, value, true ); - - } else if ( componentType === WEBGL_CONSTANTS.INT ) { - - dataView.setInt32( offset, value, true ); - - } else if ( componentType === WEBGL_CONSTANTS.UNSIGNED_INT ) { - - dataView.setUint32( offset, value, true ); - - } else if ( componentType === WEBGL_CONSTANTS.SHORT ) { - - dataView.setInt16( offset, value, true ); - - } else if ( componentType === WEBGL_CONSTANTS.UNSIGNED_SHORT ) { - - dataView.setUint16( offset, value, true ); - - } else if ( componentType === WEBGL_CONSTANTS.BYTE ) { - - dataView.setInt8( offset, value ); - - } else if ( componentType === WEBGL_CONSTANTS.UNSIGNED_BYTE ) { - - dataView.setUint8( offset, value ); - - } - - offset += componentSize; - - } - - if ( ( offset % byteStride ) !== 0 ) { - - offset += byteStride - ( offset % byteStride ); - - } - - } - - const bufferViewDef = { - - buffer: this.processBuffer( dataView.buffer ), - byteOffset: this.byteOffset, - byteLength: byteLength - - }; - - if ( target !== undefined ) bufferViewDef.target = target; - - if ( target === WEBGL_CONSTANTS.ARRAY_BUFFER ) { - - // Only define byteStride for vertex attributes. - bufferViewDef.byteStride = byteStride; - - } - - this.byteOffset += byteLength; - - json.bufferViews.push( bufferViewDef ); - - // @TODO Merge bufferViews where possible. - const output = { - - id: json.bufferViews.length - 1, - byteLength: 0 - - }; - - return output; - - } - - /** - * Process and generate a BufferView from an image Blob. - * @param {Blob} blob - * @return {Promise} - */ - processBufferViewImage( blob ) { - - const writer = this; - const json = writer.json; - - if ( ! json.bufferViews ) json.bufferViews = []; - - return new Promise( function ( resolve ) { - - const reader = new FileReader(); - reader.readAsArrayBuffer( blob ); - reader.onloadend = function () { - - const buffer = getPaddedArrayBuffer( reader.result ); - - const bufferViewDef = { - buffer: writer.processBuffer( buffer ), - byteOffset: writer.byteOffset, - byteLength: buffer.byteLength - }; - - writer.byteOffset += buffer.byteLength; - resolve( json.bufferViews.push( bufferViewDef ) - 1 ); - - }; - - } ); - - } - - /** - * Process attribute to generate an accessor - * @param {BufferAttribute} attribute Attribute to process - * @param {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range - * @param {Integer} start (Optional) - * @param {Integer} count (Optional) - * @return {Integer|null} Index of the processed accessor on the "accessors" array - */ - processAccessor( attribute, geometry, start, count ) { - - const json = this.json; - - const types = { - - 1: 'SCALAR', - 2: 'VEC2', - 3: 'VEC3', - 4: 'VEC4', - 9: 'MAT3', - 16: 'MAT4' - - }; - - let componentType; - - // Detect the component type of the attribute array - if ( attribute.array.constructor === Float32Array ) { - - componentType = WEBGL_CONSTANTS.FLOAT; - - } else if ( attribute.array.constructor === Int32Array ) { - - componentType = WEBGL_CONSTANTS.INT; - - } else if ( attribute.array.constructor === Uint32Array ) { - - componentType = WEBGL_CONSTANTS.UNSIGNED_INT; - - } else if ( attribute.array.constructor === Int16Array ) { - - componentType = WEBGL_CONSTANTS.SHORT; - - } else if ( attribute.array.constructor === Uint16Array ) { - - componentType = WEBGL_CONSTANTS.UNSIGNED_SHORT; - - } else if ( attribute.array.constructor === Int8Array ) { - - componentType = WEBGL_CONSTANTS.BYTE; - - } else if ( attribute.array.constructor === Uint8Array ) { - - componentType = WEBGL_CONSTANTS.UNSIGNED_BYTE; - - } else { - - throw new Error( 'THREE.GLTFExporter: Unsupported bufferAttribute component type: ' + attribute.array.constructor.name ); - - } - - if ( start === undefined ) start = 0; - if ( count === undefined || count === Infinity ) count = attribute.count; - - // Skip creating an accessor if the attribute doesn't have data to export - if ( count === 0 ) return null; - - const minMax = getMinMax( attribute, start, count ); - let bufferViewTarget; - - // If geometry isn't provided, don't infer the target usage of the bufferView. For - // animation samplers, target must not be set. - if ( geometry !== undefined ) { - - bufferViewTarget = attribute === geometry.index ? WEBGL_CONSTANTS.ELEMENT_ARRAY_BUFFER : WEBGL_CONSTANTS.ARRAY_BUFFER; - - } - - const bufferView = this.processBufferView( attribute, componentType, start, count, bufferViewTarget ); - - const accessorDef = { - - bufferView: bufferView.id, - byteOffset: bufferView.byteOffset, - componentType: componentType, - count: count, - max: minMax.max, - min: minMax.min, - type: types[ attribute.itemSize ] - - }; - - if ( attribute.normalized === true ) accessorDef.normalized = true; - if ( ! json.accessors ) json.accessors = []; - - return json.accessors.push( accessorDef ) - 1; - - } - - /** - * Process image - * @param {Image} image to process - * @param {Integer} format of the image (RGBAFormat) - * @param {Boolean} flipY before writing out the image - * @param {String} mimeType export format - * @return {Integer} Index of the processed texture in the "images" array - */ - processImage( image, format, flipY, mimeType = 'image/png' ) { - - if ( image !== null ) { - - const writer = this; - const cache = writer.cache; - const json = writer.json; - const options = writer.options; - const pending = writer.pending; - - if ( ! cache.images.has( image ) ) cache.images.set( image, {} ); - - const cachedImages = cache.images.get( image ); - - const key = mimeType + ':flipY/' + flipY.toString(); - - if ( cachedImages[ key ] !== undefined ) return cachedImages[ key ]; - - if ( ! json.images ) json.images = []; - - const imageDef = { mimeType: mimeType }; - - const canvas = getCanvas(); - - canvas.width = Math.min( image.width, options.maxTextureSize ); - canvas.height = Math.min( image.height, options.maxTextureSize ); - - const ctx = canvas.getContext( '2d', { - willReadFrequently: true, - } ); - - if ( flipY === true ) { - - ctx.translate( 0, canvas.height ); - ctx.scale( 1, - 1 ); - - } - - if ( image.data !== undefined ) { // THREE.DataTexture - - if ( format !== RGBAFormat ) { - - console.error( 'GLTFExporter: Only RGBAFormat is supported.', format ); - - } - - if ( image.width > options.maxTextureSize || image.height > options.maxTextureSize ) { - - console.warn( 'GLTFExporter: Image size is bigger than maxTextureSize', image ); - - } - - const data = new Uint8ClampedArray( image.height * image.width * 4 ); - - for ( let i = 0; i < data.length; i += 4 ) { - - data[ i + 0 ] = image.data[ i + 0 ]; - data[ i + 1 ] = image.data[ i + 1 ]; - data[ i + 2 ] = image.data[ i + 2 ]; - data[ i + 3 ] = image.data[ i + 3 ]; - - } - - ctx.putImageData( new ImageData( data, image.width, image.height ), 0, 0 ); - - } else { - - if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || - ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) || - ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) || - ( typeof OffscreenCanvas !== 'undefined' && image instanceof OffscreenCanvas ) ) { - - ctx.drawImage( image, 0, 0, canvas.width, canvas.height ); - - } else { - - throw new Error( 'THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.' ); - - } - - } - - if ( options.binary === true ) { - - pending.push( - - getToBlobPromise( canvas, mimeType ) - .then( blob => writer.processBufferViewImage( blob ) ) - .then( bufferViewIndex => { - - imageDef.bufferView = bufferViewIndex; - - } ) - - ); - - } else { - - if ( canvas.toDataURL !== undefined ) { - - imageDef.uri = canvas.toDataURL( mimeType ); - - } else { - - pending.push( - - getToBlobPromise( canvas, mimeType ) - .then( blob => new FileReader().readAsDataURL( blob ) ) - .then( dataURL => { - - imageDef.uri = dataURL; - - } ) - - ); - - } - - } - - const index = json.images.push( imageDef ) - 1; - cachedImages[ key ] = index; - return index; - - } else { - - throw new Error( 'THREE.GLTFExporter: No valid image data found. Unable to process texture.' ); - - } - - } - - /** - * Process sampler - * @param {Texture} map Texture to process - * @return {Integer} Index of the processed texture in the "samplers" array - */ - processSampler( map ) { - - const json = this.json; - - if ( ! json.samplers ) json.samplers = []; - - const samplerDef = { - magFilter: THREE_TO_WEBGL[ map.magFilter ], - minFilter: THREE_TO_WEBGL[ map.minFilter ], - wrapS: THREE_TO_WEBGL[ map.wrapS ], - wrapT: THREE_TO_WEBGL[ map.wrapT ] - }; - - return json.samplers.push( samplerDef ) - 1; - - } - - /** - * Process texture - * @param {Texture} map Map to process - * @return {Integer} Index of the processed texture in the "textures" array - */ - processTexture( map ) { - - const writer = this; - const options = writer.options; - const cache = this.cache; - const json = this.json; - - if ( cache.textures.has( map ) ) return cache.textures.get( map ); - - if ( ! json.textures ) json.textures = []; - - // make non-readable textures (e.g. CompressedTexture) readable by blitting them into a new texture - if ( map instanceof CompressedTexture ) { - - map = decompress( map, options.maxTextureSize ); - - } - - let mimeType = map.userData.mimeType; - - if ( mimeType === 'image/webp' ) mimeType = 'image/png'; - - const textureDef = { - sampler: this.processSampler( map ), - source: this.processImage( map.image, map.format, map.flipY, mimeType ) - }; - - if ( map.name ) textureDef.name = map.name; - - this._invokeAll( function ( ext ) { - - ext.writeTexture && ext.writeTexture( map, textureDef ); - - } ); - - const index = json.textures.push( textureDef ) - 1; - cache.textures.set( map, index ); - return index; - - } - - /** - * Process material - * @param {THREE.Material} material Material to process - * @return {Integer|null} Index of the processed material in the "materials" array - */ - processMaterial( material ) { - - const cache = this.cache; - const json = this.json; - - if ( cache.materials.has( material ) ) return cache.materials.get( material ); - - if ( material.isShaderMaterial ) { - - console.warn( 'GLTFExporter: THREE.ShaderMaterial not supported.' ); - return null; - - } - - if ( ! json.materials ) json.materials = []; - - // @QUESTION Should we avoid including any attribute that has the default value? - const materialDef = { pbrMetallicRoughness: {} }; - - if ( material.isMeshStandardMaterial !== true && material.isMeshBasicMaterial !== true ) { - - console.warn( 'GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.' ); - - } - - // pbrMetallicRoughness.baseColorFactor - const color = material.color.toArray().concat( [ material.opacity ] ); - - if ( ! equalArray( color, [ 1, 1, 1, 1 ] ) ) { - - materialDef.pbrMetallicRoughness.baseColorFactor = color; - - } - - if ( material.isMeshStandardMaterial ) { - - materialDef.pbrMetallicRoughness.metallicFactor = material.metalness; - materialDef.pbrMetallicRoughness.roughnessFactor = material.roughness; - - } else { - - materialDef.pbrMetallicRoughness.metallicFactor = 0.5; - materialDef.pbrMetallicRoughness.roughnessFactor = 0.5; - - } - - // pbrMetallicRoughness.metallicRoughnessTexture - if ( material.metalnessMap || material.roughnessMap ) { - - const metalRoughTexture = this.buildMetalRoughTexture( material.metalnessMap, material.roughnessMap ); - - const metalRoughMapDef = { - index: this.processTexture( metalRoughTexture ), - channel: metalRoughTexture.channel - }; - this.applyTextureTransform( metalRoughMapDef, metalRoughTexture ); - materialDef.pbrMetallicRoughness.metallicRoughnessTexture = metalRoughMapDef; - - } - - // pbrMetallicRoughness.baseColorTexture - if ( material.map ) { - - const baseColorMapDef = { - index: this.processTexture( material.map ), - texCoord: material.map.channel - }; - this.applyTextureTransform( baseColorMapDef, material.map ); - materialDef.pbrMetallicRoughness.baseColorTexture = baseColorMapDef; - - } - - if ( material.emissive ) { - - const emissive = material.emissive; - const maxEmissiveComponent = Math.max( emissive.r, emissive.g, emissive.b ); - - if ( maxEmissiveComponent > 0 ) { - - materialDef.emissiveFactor = material.emissive.toArray(); - - } - - // emissiveTexture - if ( material.emissiveMap ) { - - const emissiveMapDef = { - index: this.processTexture( material.emissiveMap ), - texCoord: material.emissiveMap.channel - }; - this.applyTextureTransform( emissiveMapDef, material.emissiveMap ); - materialDef.emissiveTexture = emissiveMapDef; - - } - - } - - // normalTexture - if ( material.normalMap ) { - - const normalMapDef = { - index: this.processTexture( material.normalMap ), - texCoord: material.normalMap.channel - }; - - if ( material.normalScale && material.normalScale.x !== 1 ) { - - // glTF normal scale is univariate. Ignore `y`, which may be flipped. - // Context: https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995 - normalMapDef.scale = material.normalScale.x; - - } - - this.applyTextureTransform( normalMapDef, material.normalMap ); - materialDef.normalTexture = normalMapDef; - - } - - // occlusionTexture - if ( material.aoMap ) { - - const occlusionMapDef = { - index: this.processTexture( material.aoMap ), - texCoord: material.aoMap.channel - }; - - if ( material.aoMapIntensity !== 1.0 ) { - - occlusionMapDef.strength = material.aoMapIntensity; - - } - - this.applyTextureTransform( occlusionMapDef, material.aoMap ); - materialDef.occlusionTexture = occlusionMapDef; - - } - - // alphaMode - if ( material.transparent ) { - - materialDef.alphaMode = 'BLEND'; - - } else { - - if ( material.alphaTest > 0.0 ) { - - materialDef.alphaMode = 'MASK'; - materialDef.alphaCutoff = material.alphaTest; - - } - - } - - // doubleSided - if ( material.side === DoubleSide ) materialDef.doubleSided = true; - if ( material.name !== '' ) materialDef.name = material.name; - - this.serializeUserData( material, materialDef ); - - this._invokeAll( function ( ext ) { - - ext.writeMaterial && ext.writeMaterial( material, materialDef ); - - } ); - - const index = json.materials.push( materialDef ) - 1; - cache.materials.set( material, index ); - return index; - - } - - /** - * Process mesh - * @param {THREE.Mesh} mesh Mesh to process - * @return {Integer|null} Index of the processed mesh in the "meshes" array - */ - processMesh( mesh ) { - - const cache = this.cache; - const json = this.json; - - const meshCacheKeyParts = [ mesh.geometry.uuid ]; - - if ( Array.isArray( mesh.material ) ) { - - for ( let i = 0, l = mesh.material.length; i < l; i ++ ) { - - meshCacheKeyParts.push( mesh.material[ i ].uuid ); - - } - - } else { - - meshCacheKeyParts.push( mesh.material.uuid ); - - } - - const meshCacheKey = meshCacheKeyParts.join( ':' ); - - if ( cache.meshes.has( meshCacheKey ) ) return cache.meshes.get( meshCacheKey ); - - const geometry = mesh.geometry; - - let mode; - - // Use the correct mode - if ( mesh.isLineSegments ) { - - mode = WEBGL_CONSTANTS.LINES; - - } else if ( mesh.isLineLoop ) { - - mode = WEBGL_CONSTANTS.LINE_LOOP; - - } else if ( mesh.isLine ) { - - mode = WEBGL_CONSTANTS.LINE_STRIP; - - } else if ( mesh.isPoints ) { - - mode = WEBGL_CONSTANTS.POINTS; - - } else { - - mode = mesh.material.wireframe ? WEBGL_CONSTANTS.LINES : WEBGL_CONSTANTS.TRIANGLES; - - } - - const meshDef = {}; - const attributes = {}; - const primitives = []; - const targets = []; - - // Conversion between attributes names in threejs and gltf spec - const nameConversion = { - uv: 'TEXCOORD_0', - uv1: 'TEXCOORD_1', - uv2: 'TEXCOORD_2', - uv3: 'TEXCOORD_3', - color: 'COLOR_0', - skinWeight: 'WEIGHTS_0', - skinIndex: 'JOINTS_0' - }; - - const originalNormal = geometry.getAttribute( 'normal' ); - - if ( originalNormal !== undefined && ! this.isNormalizedNormalAttribute( originalNormal ) ) { - - console.warn( 'THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.' ); - - geometry.setAttribute( 'normal', this.createNormalizedNormalAttribute( originalNormal ) ); - - } - - // @QUESTION Detect if .vertexColors = true? - // For every attribute create an accessor - let modifiedAttribute = null; - - for ( let attributeName in geometry.attributes ) { - - // Ignore morph target attributes, which are exported later. - if ( attributeName.slice( 0, 5 ) === 'morph' ) continue; - - const attribute = geometry.attributes[ attributeName ]; - attributeName = nameConversion[ attributeName ] || attributeName.toUpperCase(); - - // Prefix all geometry attributes except the ones specifically - // listed in the spec; non-spec attributes are considered custom. - const validVertexAttributes = - /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/; - - if ( ! validVertexAttributes.test( attributeName ) ) attributeName = '_' + attributeName; - - if ( cache.attributes.has( this.getUID( attribute ) ) ) { - - attributes[ attributeName ] = cache.attributes.get( this.getUID( attribute ) ); - continue; - - } - - // JOINTS_0 must be UNSIGNED_BYTE or UNSIGNED_SHORT. - modifiedAttribute = null; - const array = attribute.array; - - if ( attributeName === 'JOINTS_0' && - ! ( array instanceof Uint16Array ) && - ! ( array instanceof Uint8Array ) ) { - - console.warn( 'GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.' ); - modifiedAttribute = new BufferAttribute( new Uint16Array( array ), attribute.itemSize, attribute.normalized ); - - } - - const accessor = this.processAccessor( modifiedAttribute || attribute, geometry ); - - if ( accessor !== null ) { - - if ( ! attributeName.startsWith( '_' ) ) { - - this.detectMeshQuantization( attributeName, attribute ); - - } - - attributes[ attributeName ] = accessor; - cache.attributes.set( this.getUID( attribute ), accessor ); - - } - - } - - if ( originalNormal !== undefined ) geometry.setAttribute( 'normal', originalNormal ); - - // Skip if no exportable attributes found - if ( Object.keys( attributes ).length === 0 ) return null; - - // Morph targets - if ( mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0 ) { - - const weights = []; - const targetNames = []; - const reverseDictionary = {}; - - if ( mesh.morphTargetDictionary !== undefined ) { - - for ( const key in mesh.morphTargetDictionary ) { - - reverseDictionary[ mesh.morphTargetDictionary[ key ] ] = key; - - } - - } - - for ( let i = 0; i < mesh.morphTargetInfluences.length; ++ i ) { - - const target = {}; - let warned = false; - - for ( const attributeName in geometry.morphAttributes ) { - - // glTF 2.0 morph supports only POSITION/NORMAL/TANGENT. - // Three.js doesn't support TANGENT yet. - - if ( attributeName !== 'position' && attributeName !== 'normal' ) { - - if ( ! warned ) { - - console.warn( 'GLTFExporter: Only POSITION and NORMAL morph are supported.' ); - warned = true; - - } - - continue; - - } - - const attribute = geometry.morphAttributes[ attributeName ][ i ]; - const gltfAttributeName = attributeName.toUpperCase(); - - // Three.js morph attribute has absolute values while the one of glTF has relative values. - // - // glTF 2.0 Specification: - // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#morph-targets - - const baseAttribute = geometry.attributes[ attributeName ]; - - if ( cache.attributes.has( this.getUID( attribute, true ) ) ) { - - target[ gltfAttributeName ] = cache.attributes.get( this.getUID( attribute, true ) ); - continue; - - } - - // Clones attribute not to override - const relativeAttribute = attribute.clone(); - - if ( ! geometry.morphTargetsRelative ) { - - for ( let j = 0, jl = attribute.count; j < jl; j ++ ) { - - for ( let a = 0; a < attribute.itemSize; a ++ ) { - - if ( a === 0 ) relativeAttribute.setX( j, attribute.getX( j ) - baseAttribute.getX( j ) ); - if ( a === 1 ) relativeAttribute.setY( j, attribute.getY( j ) - baseAttribute.getY( j ) ); - if ( a === 2 ) relativeAttribute.setZ( j, attribute.getZ( j ) - baseAttribute.getZ( j ) ); - if ( a === 3 ) relativeAttribute.setW( j, attribute.getW( j ) - baseAttribute.getW( j ) ); - - } - - } - - } - - target[ gltfAttributeName ] = this.processAccessor( relativeAttribute, geometry ); - cache.attributes.set( this.getUID( baseAttribute, true ), target[ gltfAttributeName ] ); - - } - - targets.push( target ); - - weights.push( mesh.morphTargetInfluences[ i ] ); - - if ( mesh.morphTargetDictionary !== undefined ) targetNames.push( reverseDictionary[ i ] ); - - } - - meshDef.weights = weights; - - if ( targetNames.length > 0 ) { - - meshDef.extras = {}; - meshDef.extras.targetNames = targetNames; - - } - - } - - const isMultiMaterial = Array.isArray( mesh.material ); - - if ( isMultiMaterial && geometry.groups.length === 0 ) return null; - - let didForceIndices = false; - - if ( isMultiMaterial && geometry.index === null ) { - - const indices = []; - - for ( let i = 0, il = geometry.attributes.position.count; i < il; i ++ ) { - - indices[ i ] = i; - - } - - geometry.setIndex( indices ); - - didForceIndices = true; - - } - - const materials = isMultiMaterial ? mesh.material : [ mesh.material ]; - const groups = isMultiMaterial ? geometry.groups : [ { materialIndex: 0, start: undefined, count: undefined } ]; - - for ( let i = 0, il = groups.length; i < il; i ++ ) { - - const primitive = { - mode: mode, - attributes: attributes, - }; - - this.serializeUserData( geometry, primitive ); - - if ( targets.length > 0 ) primitive.targets = targets; - - if ( geometry.index !== null ) { - - let cacheKey = this.getUID( geometry.index ); - - if ( groups[ i ].start !== undefined || groups[ i ].count !== undefined ) { - - cacheKey += ':' + groups[ i ].start + ':' + groups[ i ].count; - - } - - if ( cache.attributes.has( cacheKey ) ) { - - primitive.indices = cache.attributes.get( cacheKey ); - - } else { - - primitive.indices = this.processAccessor( geometry.index, geometry, groups[ i ].start, groups[ i ].count ); - cache.attributes.set( cacheKey, primitive.indices ); - - } - - if ( primitive.indices === null ) delete primitive.indices; - - } - - const material = this.processMaterial( materials[ groups[ i ].materialIndex ] ); - - if ( material !== null ) primitive.material = material; - - primitives.push( primitive ); - - } - - if ( didForceIndices === true ) { - - geometry.setIndex( null ); - - } - - meshDef.primitives = primitives; - - if ( ! json.meshes ) json.meshes = []; - - this._invokeAll( function ( ext ) { - - ext.writeMesh && ext.writeMesh( mesh, meshDef ); - - } ); - - const index = json.meshes.push( meshDef ) - 1; - cache.meshes.set( meshCacheKey, index ); - return index; - - } - - /** - * If a vertex attribute with a - * [non-standard data type](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview) - * is used, it is checked whether it is a valid data type according to the - * [KHR_mesh_quantization](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md) - * extension. - * In this case the extension is automatically added to the list of used extensions. - * - * @param {string} attributeName - * @param {THREE.BufferAttribute} attribute - */ - detectMeshQuantization( attributeName, attribute ) { - - if ( this.extensionsUsed[ KHR_MESH_QUANTIZATION ] ) return; - - let attrType = undefined; - - switch ( attribute.array.constructor ) { - - case Int8Array: - - attrType = 'byte'; - - break; - - case Uint8Array: - - attrType = 'unsigned byte'; - - break; - - case Int16Array: - - attrType = 'short'; - - break; - - case Uint16Array: - - attrType = 'unsigned short'; - - break; - - default: - - return; - - } - - if ( attribute.normalized ) attrType += ' normalized'; - - const attrNamePrefix = attributeName.split( '_', 1 )[ 0 ]; - - if ( KHR_mesh_quantization_ExtraAttrTypes[ attrNamePrefix ] && KHR_mesh_quantization_ExtraAttrTypes[ attrNamePrefix ].includes( attrType ) ) { - - this.extensionsUsed[ KHR_MESH_QUANTIZATION ] = true; - this.extensionsRequired[ KHR_MESH_QUANTIZATION ] = true; - - } - - } - - /** - * Process camera - * @param {THREE.Camera} camera Camera to process - * @return {Integer} Index of the processed mesh in the "camera" array - */ - processCamera( camera ) { - - const json = this.json; - - if ( ! json.cameras ) json.cameras = []; - - const isOrtho = camera.isOrthographicCamera; - - const cameraDef = { - type: isOrtho ? 'orthographic' : 'perspective' - }; - - if ( isOrtho ) { - - cameraDef.orthographic = { - xmag: camera.right * 2, - ymag: camera.top * 2, - zfar: camera.far <= 0 ? 0.001 : camera.far, - znear: camera.near < 0 ? 0 : camera.near - }; - - } else { - - cameraDef.perspective = { - aspectRatio: camera.aspect, - yfov: MathUtils.degToRad( camera.fov ), - zfar: camera.far <= 0 ? 0.001 : camera.far, - znear: camera.near < 0 ? 0 : camera.near - }; - - } - - // Question: Is saving "type" as name intentional? - if ( camera.name !== '' ) cameraDef.name = camera.type; - - return json.cameras.push( cameraDef ) - 1; - - } - - /** - * Creates glTF animation entry from AnimationClip object. - * - * Status: - * - Only properties listed in PATH_PROPERTIES may be animated. - * - * @param {THREE.AnimationClip} clip - * @param {THREE.Object3D} root - * @return {number|null} - */ - processAnimation( clip, root ) { - - const json = this.json; - const nodeMap = this.nodeMap; - - if ( ! json.animations ) json.animations = []; - - clip = GLTFExporter.Utils.mergeMorphTargetTracks( clip.clone(), root ); - - const tracks = clip.tracks; - const channels = []; - const samplers = []; - - for ( let i = 0; i < tracks.length; ++ i ) { - - const track = tracks[ i ]; - const trackBinding = PropertyBinding.parseTrackName( track.name ); - let trackNode = PropertyBinding.findNode( root, trackBinding.nodeName ); - const trackProperty = PATH_PROPERTIES[ trackBinding.propertyName ]; - - if ( trackBinding.objectName === 'bones' ) { - - if ( trackNode.isSkinnedMesh === true ) { - - trackNode = trackNode.skeleton.getBoneByName( trackBinding.objectIndex ); - - } else { - - trackNode = undefined; - - } - - } - - if ( ! trackNode || ! trackProperty ) { - - console.warn( 'THREE.GLTFExporter: Could not export animation track "%s".', track.name ); - continue; - - } - - const inputItemSize = 1; - let outputItemSize = track.values.length / track.times.length; - - if ( trackProperty === PATH_PROPERTIES.morphTargetInfluences ) { - - outputItemSize /= trackNode.morphTargetInfluences.length; - - } - - let interpolation; - - // @TODO export CubicInterpolant(InterpolateSmooth) as CUBICSPLINE - - // Detecting glTF cubic spline interpolant by checking factory method's special property - // GLTFCubicSplineInterpolant is a custom interpolant and track doesn't return - // valid value from .getInterpolation(). - if ( track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === true ) { - - interpolation = 'CUBICSPLINE'; - - // itemSize of CUBICSPLINE keyframe is 9 - // (VEC3 * 3: inTangent, splineVertex, and outTangent) - // but needs to be stored as VEC3 so dividing by 3 here. - outputItemSize /= 3; - - } else if ( track.getInterpolation() === InterpolateDiscrete ) { - - interpolation = 'STEP'; - - } else { - - interpolation = 'LINEAR'; - - } - - samplers.push( { - input: this.processAccessor( new BufferAttribute( track.times, inputItemSize ) ), - output: this.processAccessor( new BufferAttribute( track.values, outputItemSize ) ), - interpolation: interpolation - } ); - - channels.push( { - sampler: samplers.length - 1, - target: { - node: nodeMap.get( trackNode ), - path: trackProperty - } - } ); - - } - - json.animations.push( { - name: clip.name || 'clip_' + json.animations.length, - samplers: samplers, - channels: channels - } ); - - return json.animations.length - 1; - - } - - /** - * @param {THREE.Object3D} object - * @return {number|null} - */ - processSkin( object ) { - - const json = this.json; - const nodeMap = this.nodeMap; - - const node = json.nodes[ nodeMap.get( object ) ]; - - const skeleton = object.skeleton; - - if ( skeleton === undefined ) return null; - - const rootJoint = object.skeleton.bones[ 0 ]; - - if ( rootJoint === undefined ) return null; - - const joints = []; - const inverseBindMatrices = new Float32Array( skeleton.bones.length * 16 ); - const temporaryBoneInverse = new Matrix4(); - - for ( let i = 0; i < skeleton.bones.length; ++ i ) { - - joints.push( nodeMap.get( skeleton.bones[ i ] ) ); - temporaryBoneInverse.copy( skeleton.boneInverses[ i ] ); - temporaryBoneInverse.multiply( object.bindMatrix ).toArray( inverseBindMatrices, i * 16 ); - - } - - if ( json.skins === undefined ) json.skins = []; - - json.skins.push( { - inverseBindMatrices: this.processAccessor( new BufferAttribute( inverseBindMatrices, 16 ) ), - joints: joints, - skeleton: nodeMap.get( rootJoint ) - } ); - - const skinIndex = node.skin = json.skins.length - 1; - - return skinIndex; - - } - - /** - * Process Object3D node - * @param {THREE.Object3D} node Object3D to processNode - * @return {Integer} Index of the node in the nodes list - */ - processNode( object ) { - - const json = this.json; - const options = this.options; - const nodeMap = this.nodeMap; - - if ( ! json.nodes ) json.nodes = []; - - const nodeDef = {}; - - if ( options.trs ) { - - const rotation = object.quaternion.toArray(); - const position = object.position.toArray(); - const scale = object.scale.toArray(); - - if ( ! equalArray( rotation, [ 0, 0, 0, 1 ] ) ) { - - nodeDef.rotation = rotation; - - } - - if ( ! equalArray( position, [ 0, 0, 0 ] ) ) { - - nodeDef.translation = position; - - } - - if ( ! equalArray( scale, [ 1, 1, 1 ] ) ) { - - nodeDef.scale = scale; - - } - - } else { - - if ( object.matrixAutoUpdate ) { - - object.updateMatrix(); - - } - - if ( isIdentityMatrix( object.matrix ) === false ) { - - nodeDef.matrix = object.matrix.elements; - - } - - } - - // We don't export empty strings name because it represents no-name in Three.js. - if ( object.name !== '' ) nodeDef.name = String( object.name ); - - this.serializeUserData( object, nodeDef ); - - if ( object.isMesh || object.isLine || object.isPoints ) { - - const meshIndex = this.processMesh( object ); - - if ( meshIndex !== null ) nodeDef.mesh = meshIndex; - - } else if ( object.isCamera ) { - - nodeDef.camera = this.processCamera( object ); - - } - - if ( object.isSkinnedMesh ) this.skins.push( object ); - - if ( object.children.length > 0 ) { - - const children = []; - - for ( let i = 0, l = object.children.length; i < l; i ++ ) { - - const child = object.children[ i ]; - - if ( child.visible || options.onlyVisible === false ) { - - const nodeIndex = this.processNode( child ); - - if ( nodeIndex !== null ) children.push( nodeIndex ); - - } - - } - - if ( children.length > 0 ) nodeDef.children = children; - - } - - this._invokeAll( function ( ext ) { - - ext.writeNode && ext.writeNode( object, nodeDef ); - - } ); - - const nodeIndex = json.nodes.push( nodeDef ) - 1; - nodeMap.set( object, nodeIndex ); - return nodeIndex; - - } - - /** - * Process Scene - * @param {Scene} node Scene to process - */ - processScene( scene ) { - - const json = this.json; - const options = this.options; - - if ( ! json.scenes ) { - - json.scenes = []; - json.scene = 0; - - } - - const sceneDef = {}; - - if ( scene.name !== '' ) sceneDef.name = scene.name; - - json.scenes.push( sceneDef ); - - const nodes = []; - - for ( let i = 0, l = scene.children.length; i < l; i ++ ) { - - const child = scene.children[ i ]; - - if ( child.visible || options.onlyVisible === false ) { - - const nodeIndex = this.processNode( child ); - - if ( nodeIndex !== null ) nodes.push( nodeIndex ); - - } - - } - - if ( nodes.length > 0 ) sceneDef.nodes = nodes; - - this.serializeUserData( scene, sceneDef ); - - } - - /** - * Creates a Scene to hold a list of objects and parse it - * @param {Array} objects List of objects to process - */ - processObjects( objects ) { - - const scene = new Scene(); - scene.name = 'AuxScene'; - - for ( let i = 0; i < objects.length; i ++ ) { - - // We push directly to children instead of calling `add` to prevent - // modify the .parent and break its original scene and hierarchy - scene.children.push( objects[ i ] ); - - } - - this.processScene( scene ); - - } - - /** - * @param {THREE.Object3D|Array} input - */ - processInput( input ) { - - const options = this.options; - - input = input instanceof Array ? input : [ input ]; - - this._invokeAll( function ( ext ) { - - ext.beforeParse && ext.beforeParse( input ); - - } ); - - const objectsWithoutScene = []; - - for ( let i = 0; i < input.length; i ++ ) { - - if ( input[ i ] instanceof Scene ) { - - this.processScene( input[ i ] ); - - } else { - - objectsWithoutScene.push( input[ i ] ); - - } - - } - - if ( objectsWithoutScene.length > 0 ) this.processObjects( objectsWithoutScene ); - - for ( let i = 0; i < this.skins.length; ++ i ) { - - this.processSkin( this.skins[ i ] ); - - } - - for ( let i = 0; i < options.animations.length; ++ i ) { - - this.processAnimation( options.animations[ i ], input[ 0 ] ); - - } - - this._invokeAll( function ( ext ) { - - ext.afterParse && ext.afterParse( input ); - - } ); - - } - - _invokeAll( func ) { - - for ( let i = 0, il = this.plugins.length; i < il; i ++ ) { - - func( this.plugins[ i ] ); - - } - - } - -} - -/** - * Punctual Lights Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual - */ -class GLTFLightExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_lights_punctual'; - - } - - writeNode( light, nodeDef ) { - - if ( ! light.isLight ) return; - - if ( ! light.isDirectionalLight && ! light.isPointLight && ! light.isSpotLight ) { - - console.warn( 'THREE.GLTFExporter: Only directional, point, and spot lights are supported.', light ); - return; - - } - - const writer = this.writer; - const json = writer.json; - const extensionsUsed = writer.extensionsUsed; - - const lightDef = {}; - - if ( light.name ) lightDef.name = light.name; - - lightDef.color = light.color.toArray(); - - lightDef.intensity = light.intensity; - - if ( light.isDirectionalLight ) { - - lightDef.type = 'directional'; - - } else if ( light.isPointLight ) { - - lightDef.type = 'point'; - - if ( light.distance > 0 ) lightDef.range = light.distance; - - } else if ( light.isSpotLight ) { - - lightDef.type = 'spot'; - - if ( light.distance > 0 ) lightDef.range = light.distance; - - lightDef.spot = {}; - lightDef.spot.innerConeAngle = ( 1.0 - light.penumbra ) * light.angle; - lightDef.spot.outerConeAngle = light.angle; - - } - - if ( light.decay !== undefined && light.decay !== 2 ) { - - console.warn( 'THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, ' - + 'and expects light.decay=2.' ); - - } - - if ( light.target - && ( light.target.parent !== light - || light.target.position.x !== 0 - || light.target.position.y !== 0 - || light.target.position.z !== - 1 ) ) { - - console.warn( 'THREE.GLTFExporter: Light direction may be lost. For best results, ' - + 'make light.target a child of the light with position 0,0,-1.' ); - - } - - if ( ! extensionsUsed[ this.name ] ) { - - json.extensions = json.extensions || {}; - json.extensions[ this.name ] = { lights: [] }; - extensionsUsed[ this.name ] = true; - - } - - const lights = json.extensions[ this.name ].lights; - lights.push( lightDef ); - - nodeDef.extensions = nodeDef.extensions || {}; - nodeDef.extensions[ this.name ] = { light: lights.length - 1 }; - - } - -} - -/** - * Unlit Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit - */ -class GLTFMaterialsUnlitExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_unlit'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshBasicMaterial ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = {}; - - extensionsUsed[ this.name ] = true; - - materialDef.pbrMetallicRoughness.metallicFactor = 0.0; - materialDef.pbrMetallicRoughness.roughnessFactor = 0.9; - - } - -} - -/** - * Clearcoat Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat - */ -class GLTFMaterialsClearcoatExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_clearcoat'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.clearcoat === 0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.clearcoatFactor = material.clearcoat; - - if ( material.clearcoatMap ) { - - const clearcoatMapDef = { - index: writer.processTexture( material.clearcoatMap ), - texCoord: material.clearcoatMap.channel - }; - writer.applyTextureTransform( clearcoatMapDef, material.clearcoatMap ); - extensionDef.clearcoatTexture = clearcoatMapDef; - - } - - extensionDef.clearcoatRoughnessFactor = material.clearcoatRoughness; - - if ( material.clearcoatRoughnessMap ) { - - const clearcoatRoughnessMapDef = { - index: writer.processTexture( material.clearcoatRoughnessMap ), - texCoord: material.clearcoatRoughnessMap.channel - }; - writer.applyTextureTransform( clearcoatRoughnessMapDef, material.clearcoatRoughnessMap ); - extensionDef.clearcoatRoughnessTexture = clearcoatRoughnessMapDef; - - } - - if ( material.clearcoatNormalMap ) { - - const clearcoatNormalMapDef = { - index: writer.processTexture( material.clearcoatNormalMap ), - texCoord: material.clearcoatNormalMap.channel - }; - - if ( material.clearcoatNormalScale.x !== 1 ) clearcoatNormalMapDef.scale = material.clearcoatNormalScale.x; - - writer.applyTextureTransform( clearcoatNormalMapDef, material.clearcoatNormalMap ); - extensionDef.clearcoatNormalTexture = clearcoatNormalMapDef; - - } - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - - } - -} - -/** - * Materials dispersion Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_dispersion - */ -class GLTFMaterialsDispersionExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_dispersion'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.dispersion === 0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.dispersion = material.dispersion; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Iridescence Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence - */ -class GLTFMaterialsIridescenceExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_iridescence'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.iridescence === 0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.iridescenceFactor = material.iridescence; - - if ( material.iridescenceMap ) { - - const iridescenceMapDef = { - index: writer.processTexture( material.iridescenceMap ), - texCoord: material.iridescenceMap.channel - }; - writer.applyTextureTransform( iridescenceMapDef, material.iridescenceMap ); - extensionDef.iridescenceTexture = iridescenceMapDef; - - } - - extensionDef.iridescenceIor = material.iridescenceIOR; - extensionDef.iridescenceThicknessMinimum = material.iridescenceThicknessRange[ 0 ]; - extensionDef.iridescenceThicknessMaximum = material.iridescenceThicknessRange[ 1 ]; - - if ( material.iridescenceThicknessMap ) { - - const iridescenceThicknessMapDef = { - index: writer.processTexture( material.iridescenceThicknessMap ), - texCoord: material.iridescenceThicknessMap.channel - }; - writer.applyTextureTransform( iridescenceThicknessMapDef, material.iridescenceThicknessMap ); - extensionDef.iridescenceThicknessTexture = iridescenceThicknessMapDef; - - } - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Transmission Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission - */ -class GLTFMaterialsTransmissionExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_transmission'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.transmission === 0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.transmissionFactor = material.transmission; - - if ( material.transmissionMap ) { - - const transmissionMapDef = { - index: writer.processTexture( material.transmissionMap ), - texCoord: material.transmissionMap.channel - }; - writer.applyTextureTransform( transmissionMapDef, material.transmissionMap ); - extensionDef.transmissionTexture = transmissionMapDef; - - } - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Materials Volume Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume - */ -class GLTFMaterialsVolumeExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_volume'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.transmission === 0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.thicknessFactor = material.thickness; - - if ( material.thicknessMap ) { - - const thicknessMapDef = { - index: writer.processTexture( material.thicknessMap ), - texCoord: material.thicknessMap.channel - }; - writer.applyTextureTransform( thicknessMapDef, material.thicknessMap ); - extensionDef.thicknessTexture = thicknessMapDef; - - } - - extensionDef.attenuationDistance = material.attenuationDistance; - extensionDef.attenuationColor = material.attenuationColor.toArray(); - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Materials ior Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior - */ -class GLTFMaterialsIorExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_ior'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.ior === 1.5 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.ior = material.ior; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Materials specular Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular - */ -class GLTFMaterialsSpecularExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_specular'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || ( material.specularIntensity === 1.0 && - material.specularColor.equals( DEFAULT_SPECULAR_COLOR ) && - ! material.specularIntensityMap && ! material.specularColorMap ) ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - if ( material.specularIntensityMap ) { - - const specularIntensityMapDef = { - index: writer.processTexture( material.specularIntensityMap ), - texCoord: material.specularIntensityMap.channel - }; - writer.applyTextureTransform( specularIntensityMapDef, material.specularIntensityMap ); - extensionDef.specularTexture = specularIntensityMapDef; - - } - - if ( material.specularColorMap ) { - - const specularColorMapDef = { - index: writer.processTexture( material.specularColorMap ), - texCoord: material.specularColorMap.channel - }; - writer.applyTextureTransform( specularColorMapDef, material.specularColorMap ); - extensionDef.specularColorTexture = specularColorMapDef; - - } - - extensionDef.specularFactor = material.specularIntensity; - extensionDef.specularColorFactor = material.specularColor.toArray(); - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Sheen Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen - */ -class GLTFMaterialsSheenExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_sheen'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.sheen == 0.0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - if ( material.sheenRoughnessMap ) { - - const sheenRoughnessMapDef = { - index: writer.processTexture( material.sheenRoughnessMap ), - texCoord: material.sheenRoughnessMap.channel - }; - writer.applyTextureTransform( sheenRoughnessMapDef, material.sheenRoughnessMap ); - extensionDef.sheenRoughnessTexture = sheenRoughnessMapDef; - - } - - if ( material.sheenColorMap ) { - - const sheenColorMapDef = { - index: writer.processTexture( material.sheenColorMap ), - texCoord: material.sheenColorMap.channel - }; - writer.applyTextureTransform( sheenColorMapDef, material.sheenColorMap ); - extensionDef.sheenColorTexture = sheenColorMapDef; - - } - - extensionDef.sheenRoughnessFactor = material.sheenRoughness; - extensionDef.sheenColorFactor = material.sheenColor.toArray(); - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Anisotropy Materials Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy - */ -class GLTFMaterialsAnisotropyExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_anisotropy'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshPhysicalMaterial || material.anisotropy == 0.0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - if ( material.anisotropyMap ) { - - const anisotropyMapDef = { index: writer.processTexture( material.anisotropyMap ) }; - writer.applyTextureTransform( anisotropyMapDef, material.anisotropyMap ); - extensionDef.anisotropyTexture = anisotropyMapDef; - - } - - extensionDef.anisotropyStrength = material.anisotropy; - extensionDef.anisotropyRotation = material.anisotropyRotation; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * Materials Emissive Strength Extension - * - * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md - */ -class GLTFMaterialsEmissiveStrengthExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'KHR_materials_emissive_strength'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshStandardMaterial || material.emissiveIntensity === 1.0 ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - extensionDef.emissiveStrength = material.emissiveIntensity; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - - -/** - * Materials bump Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump - */ -class GLTFMaterialsBumpExtension { - - constructor( writer ) { - - this.writer = writer; - this.name = 'EXT_materials_bump'; - - } - - writeMaterial( material, materialDef ) { - - if ( ! material.isMeshStandardMaterial || ( - material.bumpScale === 1 && - ! material.bumpMap ) ) return; - - const writer = this.writer; - const extensionsUsed = writer.extensionsUsed; - - const extensionDef = {}; - - if ( material.bumpMap ) { - - const bumpMapDef = { - index: writer.processTexture( material.bumpMap ), - texCoord: material.bumpMap.channel - }; - writer.applyTextureTransform( bumpMapDef, material.bumpMap ); - extensionDef.bumpTexture = bumpMapDef; - - } - - extensionDef.bumpFactor = material.bumpScale; - - materialDef.extensions = materialDef.extensions || {}; - materialDef.extensions[ this.name ] = extensionDef; - - extensionsUsed[ this.name ] = true; - - } - -} - -/** - * GPU Instancing Extension - * - * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing - */ -class GLTFMeshGpuInstancing { - - constructor( writer ) { - - this.writer = writer; - this.name = 'EXT_mesh_gpu_instancing'; - - } - - writeNode( object, nodeDef ) { - - if ( ! object.isInstancedMesh ) return; - - const writer = this.writer; - - const mesh = object; - - const translationAttr = new Float32Array( mesh.count * 3 ); - const rotationAttr = new Float32Array( mesh.count * 4 ); - const scaleAttr = new Float32Array( mesh.count * 3 ); - - const matrix = new Matrix4(); - const position = new Vector3(); - const quaternion = new Quaternion(); - const scale = new Vector3(); - - for ( let i = 0; i < mesh.count; i ++ ) { - - mesh.getMatrixAt( i, matrix ); - matrix.decompose( position, quaternion, scale ); - - position.toArray( translationAttr, i * 3 ); - quaternion.toArray( rotationAttr, i * 4 ); - scale.toArray( scaleAttr, i * 3 ); - - } - - const attributes = { - TRANSLATION: writer.processAccessor( new BufferAttribute( translationAttr, 3 ) ), - ROTATION: writer.processAccessor( new BufferAttribute( rotationAttr, 4 ) ), - SCALE: writer.processAccessor( new BufferAttribute( scaleAttr, 3 ) ), - }; - - if ( mesh.instanceColor ) - attributes._COLOR_0 = writer.processAccessor( mesh.instanceColor ); - - nodeDef.extensions = nodeDef.extensions || {}; - nodeDef.extensions[ this.name ] = { attributes }; - - writer.extensionsUsed[ this.name ] = true; - writer.extensionsRequired[ this.name ] = true; - - } - -} - -/** - * Static utility functions - */ -GLTFExporter.Utils = { - - insertKeyframe: function ( track, time ) { - - const tolerance = 0.001; // 1ms - const valueSize = track.getValueSize(); - - const times = new track.TimeBufferType( track.times.length + 1 ); - const values = new track.ValueBufferType( track.values.length + valueSize ); - const interpolant = track.createInterpolant( new track.ValueBufferType( valueSize ) ); - - let index; - - if ( track.times.length === 0 ) { - - times[ 0 ] = time; - - for ( let i = 0; i < valueSize; i ++ ) { - - values[ i ] = 0; - - } - - index = 0; - - } else if ( time < track.times[ 0 ] ) { - - if ( Math.abs( track.times[ 0 ] - time ) < tolerance ) return 0; - - times[ 0 ] = time; - times.set( track.times, 1 ); - - values.set( interpolant.evaluate( time ), 0 ); - values.set( track.values, valueSize ); - - index = 0; - - } else if ( time > track.times[ track.times.length - 1 ] ) { - - if ( Math.abs( track.times[ track.times.length - 1 ] - time ) < tolerance ) { - - return track.times.length - 1; - - } - - times[ times.length - 1 ] = time; - times.set( track.times, 0 ); - - values.set( track.values, 0 ); - values.set( interpolant.evaluate( time ), track.values.length ); - - index = times.length - 1; - - } else { - - for ( let i = 0; i < track.times.length; i ++ ) { - - if ( Math.abs( track.times[ i ] - time ) < tolerance ) return i; - - if ( track.times[ i ] < time && track.times[ i + 1 ] > time ) { - - times.set( track.times.slice( 0, i + 1 ), 0 ); - times[ i + 1 ] = time; - times.set( track.times.slice( i + 1 ), i + 2 ); - - values.set( track.values.slice( 0, ( i + 1 ) * valueSize ), 0 ); - values.set( interpolant.evaluate( time ), ( i + 1 ) * valueSize ); - values.set( track.values.slice( ( i + 1 ) * valueSize ), ( i + 2 ) * valueSize ); - - index = i + 1; - - break; - - } - - } - - } - - track.times = times; - track.values = values; - - return index; - - }, - - mergeMorphTargetTracks: function ( clip, root ) { - - const tracks = []; - const mergedTracks = {}; - const sourceTracks = clip.tracks; - - for ( let i = 0; i < sourceTracks.length; ++ i ) { - - let sourceTrack = sourceTracks[ i ]; - const sourceTrackBinding = PropertyBinding.parseTrackName( sourceTrack.name ); - const sourceTrackNode = PropertyBinding.findNode( root, sourceTrackBinding.nodeName ); - - if ( sourceTrackBinding.propertyName !== 'morphTargetInfluences' || sourceTrackBinding.propertyIndex === undefined ) { - - // Tracks that don't affect morph targets, or that affect all morph targets together, can be left as-is. - tracks.push( sourceTrack ); - continue; - - } - - if ( sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodDiscrete - && sourceTrack.createInterpolant !== sourceTrack.InterpolantFactoryMethodLinear ) { - - if ( sourceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline ) { - - // This should never happen, because glTF morph target animations - // affect all targets already. - throw new Error( 'THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.' ); - - } - - console.warn( 'THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead.' ); - - sourceTrack = sourceTrack.clone(); - sourceTrack.setInterpolation( InterpolateLinear ); - - } - - const targetCount = sourceTrackNode.morphTargetInfluences.length; - const targetIndex = sourceTrackNode.morphTargetDictionary[ sourceTrackBinding.propertyIndex ]; - - if ( targetIndex === undefined ) { - - throw new Error( 'THREE.GLTFExporter: Morph target name not found: ' + sourceTrackBinding.propertyIndex ); - - } - - let mergedTrack; - - // If this is the first time we've seen this object, create a new - // track to store merged keyframe data for each morph target. - if ( mergedTracks[ sourceTrackNode.uuid ] === undefined ) { - - mergedTrack = sourceTrack.clone(); - - const values = new mergedTrack.ValueBufferType( targetCount * mergedTrack.times.length ); - - for ( let j = 0; j < mergedTrack.times.length; j ++ ) { - - values[ j * targetCount + targetIndex ] = mergedTrack.values[ j ]; - - } - - // We need to take into consideration the intended target node - // of our original un-merged morphTarget animation. - mergedTrack.name = ( sourceTrackBinding.nodeName || '' ) + '.morphTargetInfluences'; - mergedTrack.values = values; - - mergedTracks[ sourceTrackNode.uuid ] = mergedTrack; - tracks.push( mergedTrack ); - - continue; - - } - - const sourceInterpolant = sourceTrack.createInterpolant( new sourceTrack.ValueBufferType( 1 ) ); - - mergedTrack = mergedTracks[ sourceTrackNode.uuid ]; - - // For every existing keyframe of the merged track, write a (possibly - // interpolated) value from the source track. - for ( let j = 0; j < mergedTrack.times.length; j ++ ) { - - mergedTrack.values[ j * targetCount + targetIndex ] = sourceInterpolant.evaluate( mergedTrack.times[ j ] ); - - } - - // For every existing keyframe of the source track, write a (possibly - // new) keyframe to the merged track. Values from the previous loop may - // be written again, but keyframes are de-duplicated. - for ( let j = 0; j < sourceTrack.times.length; j ++ ) { - - const keyframeIndex = this.insertKeyframe( mergedTrack, sourceTrack.times[ j ] ); - mergedTrack.values[ keyframeIndex * targetCount + targetIndex ] = sourceTrack.values[ j ]; - - } - - } - - clip.tracks = tracks; - - return clip; - - } - -}; - -export { GLTFExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/KTX2Exporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/KTX2Exporter.js deleted file mode 100644 index 487e371..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/KTX2Exporter.js +++ /dev/null @@ -1,292 +0,0 @@ -import { - FloatType, - HalfFloatType, - UnsignedByteType, - RGBAFormat, - RGFormat, - RGIntegerFormat, - RedFormat, - RedIntegerFormat, - NoColorSpace, - LinearSRGBColorSpace, - SRGBColorSpace, - DataTexture, - REVISION, -} from '/static/javascript/three/build/three.module.js'; - -import { - write, - KTX2Container, - KHR_DF_CHANNEL_RGBSDA_ALPHA, - KHR_DF_CHANNEL_RGBSDA_BLUE, - KHR_DF_CHANNEL_RGBSDA_GREEN, - KHR_DF_CHANNEL_RGBSDA_RED, - KHR_DF_MODEL_RGBSDA, - KHR_DF_PRIMARIES_BT709, - KHR_DF_PRIMARIES_UNSPECIFIED, - KHR_DF_SAMPLE_DATATYPE_FLOAT, - KHR_DF_SAMPLE_DATATYPE_LINEAR, - KHR_DF_SAMPLE_DATATYPE_SIGNED, - KHR_DF_TRANSFER_LINEAR, - KHR_DF_TRANSFER_SRGB, - VK_FORMAT_R16_SFLOAT, - VK_FORMAT_R16G16_SFLOAT, - VK_FORMAT_R16G16B16A16_SFLOAT, - VK_FORMAT_R32_SFLOAT, - VK_FORMAT_R32G32_SFLOAT, - VK_FORMAT_R32G32B32A32_SFLOAT, - VK_FORMAT_R8_SRGB, - VK_FORMAT_R8_UNORM, - VK_FORMAT_R8G8_SRGB, - VK_FORMAT_R8G8_UNORM, - VK_FORMAT_R8G8B8A8_SRGB, - VK_FORMAT_R8G8B8A8_UNORM, -} from '../../three/examples/jsm/libs/ktx-parse.module.js'; - -const VK_FORMAT_MAP = { - - [ RGBAFormat ]: { - [ FloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R32G32B32A32_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R32G32B32A32_SFLOAT, - }, - [ HalfFloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R16G16B16A16_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R16G16B16A16_SFLOAT, - }, - [ UnsignedByteType ]: { - [ NoColorSpace ]: VK_FORMAT_R8G8B8A8_UNORM, - [ LinearSRGBColorSpace ]: VK_FORMAT_R8G8B8A8_UNORM, - [ SRGBColorSpace ]: VK_FORMAT_R8G8B8A8_SRGB, - }, - }, - - [ RGFormat ]: { - [ FloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R32G32_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R32G32_SFLOAT, - }, - [ HalfFloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R16G16_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R16G16_SFLOAT, - }, - [ UnsignedByteType ]: { - [ NoColorSpace ]: VK_FORMAT_R8G8_UNORM, - [ LinearSRGBColorSpace ]: VK_FORMAT_R8G8_UNORM, - [ SRGBColorSpace ]: VK_FORMAT_R8G8_SRGB, - }, - }, - - [ RedFormat ]: { - [ FloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R32_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R32_SFLOAT, - }, - [ HalfFloatType ]: { - [ NoColorSpace ]: VK_FORMAT_R16_SFLOAT, - [ LinearSRGBColorSpace ]: VK_FORMAT_R16_SFLOAT, - }, - [ UnsignedByteType ]: { - [ NoColorSpace ]: VK_FORMAT_R8_UNORM, - [ LinearSRGBColorSpace ]: VK_FORMAT_R8_UNORM, - [ SRGBColorSpace ]: VK_FORMAT_R8_SRGB, - }, - }, - -}; - -const KHR_DF_CHANNEL_MAP = { - - 0: KHR_DF_CHANNEL_RGBSDA_RED, - 1: KHR_DF_CHANNEL_RGBSDA_GREEN, - 2: KHR_DF_CHANNEL_RGBSDA_BLUE, - 3: KHR_DF_CHANNEL_RGBSDA_ALPHA, - -}; - -const ERROR_INPUT = 'THREE.KTX2Exporter: Supported inputs are DataTexture, Data3DTexture, or WebGLRenderer and WebGLRenderTarget.'; -const ERROR_FORMAT = 'THREE.KTX2Exporter: Supported formats are RGBAFormat, RGFormat, or RedFormat.'; -const ERROR_TYPE = 'THREE.KTX2Exporter: Supported types are FloatType, HalfFloatType, or UnsignedByteType."'; -const ERROR_COLOR_SPACE = 'THREE.KTX2Exporter: Supported color spaces are SRGBColorSpace (UnsignedByteType only), LinearSRGBColorSpace, or NoColorSpace.'; - -export class KTX2Exporter { - - parse( arg1, arg2 ) { - - let texture; - - if ( arg1.isDataTexture || arg1.isData3DTexture ) { - - texture = arg1; - - } else if ( arg1.isWebGLRenderer && arg2.isWebGLRenderTarget ) { - - texture = toDataTexture( arg1, arg2 ); - - } else { - - throw new Error( ERROR_INPUT ); - - } - - if ( VK_FORMAT_MAP[ texture.format ] === undefined ) { - - throw new Error( ERROR_FORMAT ); - - } - - if ( VK_FORMAT_MAP[ texture.format ][ texture.type ] === undefined ) { - - throw new Error( ERROR_TYPE ); - - } - - if ( VK_FORMAT_MAP[ texture.format ][ texture.type ][ texture.colorSpace ] === undefined ) { - - throw new Error( ERROR_COLOR_SPACE ); - - } - - // - - const array = texture.image.data; - const channelCount = getChannelCount( texture ); - const container = new KTX2Container(); - - container.vkFormat = VK_FORMAT_MAP[ texture.format ][ texture.type ][ texture.colorSpace ]; - container.typeSize = array.BYTES_PER_ELEMENT; - container.pixelWidth = texture.image.width; - container.pixelHeight = texture.image.height; - - if ( texture.isData3DTexture ) { - - container.pixelDepth = texture.image.depth; - - } - - // - - const basicDesc = container.dataFormatDescriptor[ 0 ]; - - basicDesc.colorModel = KHR_DF_MODEL_RGBSDA; - basicDesc.colorPrimaries = texture.colorSpace === NoColorSpace - ? KHR_DF_PRIMARIES_UNSPECIFIED - : KHR_DF_PRIMARIES_BT709; - basicDesc.transferFunction = texture.colorSpace === SRGBColorSpace - ? KHR_DF_TRANSFER_SRGB - : KHR_DF_TRANSFER_LINEAR; - - basicDesc.texelBlockDimension = [ 0, 0, 0, 0 ]; - - basicDesc.bytesPlane = [ - - container.typeSize * channelCount, 0, 0, 0, 0, 0, 0, 0, - - ]; - - for ( let i = 0; i < channelCount; ++ i ) { - - let channelType = KHR_DF_CHANNEL_MAP[ i ]; - - if ( texture.colorSpace === LinearSRGBColorSpace || texture.colorSpace === NoColorSpace ) { - - channelType |= KHR_DF_SAMPLE_DATATYPE_LINEAR; - - } - - if ( texture.type === FloatType || texture.type === HalfFloatType ) { - - channelType |= KHR_DF_SAMPLE_DATATYPE_FLOAT; - channelType |= KHR_DF_SAMPLE_DATATYPE_SIGNED; - - } - - basicDesc.samples.push( { - - channelType: channelType, - bitOffset: i * array.BYTES_PER_ELEMENT, - bitLength: array.BYTES_PER_ELEMENT * 8 - 1, - samplePosition: [ 0, 0, 0, 0 ], - sampleLower: texture.type === UnsignedByteType ? 0 : - 1, - sampleUpper: texture.type === UnsignedByteType ? 255 : 1, - - } ); - - } - - // - - container.levels = [ { - - levelData: new Uint8Array( array.buffer, array.byteOffset, array.byteLength ), - uncompressedByteLength: array.byteLength, - - } ]; - - // - - container.keyValue[ 'KTXwriter' ] = `three.js ${ REVISION }`; - - // - - return write( container, { keepWriter: true } ); - - } - -} - -function toDataTexture( renderer, rtt ) { - - const channelCount = getChannelCount( rtt.texture ); - - let view; - - if ( rtt.texture.type === FloatType ) { - - view = new Float32Array( rtt.width * rtt.height * channelCount ); - - } else if ( rtt.texture.type === HalfFloatType ) { - - view = new Uint16Array( rtt.width * rtt.height * channelCount ); - - } else if ( rtt.texture.type === UnsignedByteType ) { - - view = new Uint8Array( rtt.width * rtt.height * channelCount ); - - } else { - - throw new Error( ERROR_TYPE ); - - } - - renderer.readRenderTargetPixels( rtt, 0, 0, rtt.width, rtt.height, view ); - - return new DataTexture( view, rtt.width, rtt.height, rtt.texture.format, rtt.texture.type ); - -} - -function getChannelCount( texture ) { - - switch ( texture.format ) { - - case RGBAFormat: - - return 4; - - case RGFormat: - case RGIntegerFormat: - - return 2; - - case RedFormat: - case RedIntegerFormat: - - return 1; - - default: - - throw new Error( ERROR_FORMAT ); - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/MMDExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/MMDExporter.js deleted file mode 100644 index 2f27f19..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/MMDExporter.js +++ /dev/null @@ -1,217 +0,0 @@ -import { - Matrix4, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import { MMDParser } from '../libs/mmdparser.module.js'; - -/** - * Dependencies - * - mmd-parser https://github.com/takahirox/mmd-parser - */ - -class MMDExporter { - - /* TODO: implement - // mesh -> pmd - this.parsePmd = function ( object ) { - - }; - */ - - /* TODO: implement - // mesh -> pmx - this.parsePmx = function ( object ) { - - }; - */ - - /* TODO: implement - // animation + skeleton -> vmd - this.parseVmd = function ( object ) { - - }; - */ - - /* - * skeleton -> vpd - * Returns Shift_JIS encoded Uint8Array. Otherwise return strings. - */ - parseVpd( skin, outputShiftJis, useOriginalBones ) { - - if ( skin.isSkinnedMesh !== true ) { - - console.warn( 'THREE.MMDExporter: parseVpd() requires SkinnedMesh instance.' ); - return null; - - } - - function toStringsFromNumber( num ) { - - if ( Math.abs( num ) < 1e-6 ) num = 0; - - let a = num.toString(); - - if ( a.indexOf( '.' ) === - 1 ) { - - a += '.'; - - } - - a += '000000'; - - const index = a.indexOf( '.' ); - - const d = a.slice( 0, index ); - const p = a.slice( index + 1, index + 7 ); - - return d + '.' + p; - - } - - function toStringsFromArray( array ) { - - const a = []; - - for ( let i = 0, il = array.length; i < il; i ++ ) { - - a.push( toStringsFromNumber( array[ i ] ) ); - - } - - return a.join( ',' ); - - } - - skin.updateMatrixWorld( true ); - - const bones = skin.skeleton.bones; - const bones2 = getBindBones( skin ); - - const position = new Vector3(); - const quaternion = new Quaternion(); - const quaternion2 = new Quaternion(); - const matrix = new Matrix4(); - - const array = []; - array.push( 'Vocaloid Pose Data file' ); - array.push( '' ); - array.push( ( skin.name !== '' ? skin.name.replace( /\s/g, '_' ) : 'skin' ) + '.osm;' ); - array.push( bones.length + ';' ); - array.push( '' ); - - for ( let i = 0, il = bones.length; i < il; i ++ ) { - - const bone = bones[ i ]; - const bone2 = bones2[ i ]; - - /* - * use the bone matrix saved before solving IK. - * see CCDIKSolver for the detail. - */ - if ( useOriginalBones === true && - bone.userData.ik !== undefined && - bone.userData.ik.originalMatrix !== undefined ) { - - matrix.fromArray( bone.userData.ik.originalMatrix ); - - } else { - - matrix.copy( bone.matrix ); - - } - - position.setFromMatrixPosition( matrix ); - quaternion.setFromRotationMatrix( matrix ); - - const pArray = position.sub( bone2.position ).toArray(); - const qArray = quaternion2.copy( bone2.quaternion ).conjugate().multiply( quaternion ).toArray(); - - // right to left - pArray[ 2 ] = - pArray[ 2 ]; - qArray[ 0 ] = - qArray[ 0 ]; - qArray[ 1 ] = - qArray[ 1 ]; - - array.push( 'Bone' + i + '{' + bone.name ); - array.push( ' ' + toStringsFromArray( pArray ) + ';' ); - array.push( ' ' + toStringsFromArray( qArray ) + ';' ); - array.push( '}' ); - array.push( '' ); - - } - - array.push( '' ); - - const lines = array.join( '\n' ); - - return ( outputShiftJis === true ) ? unicodeToShiftjis( lines ) : lines; - - } - -} - -// Unicode to Shift_JIS table -let u2sTable; - -function unicodeToShiftjis( str ) { - - if ( u2sTable === undefined ) { - - const encoder = new MMDParser.CharsetEncoder(); - const table = encoder.s2uTable; - u2sTable = {}; - - const keys = Object.keys( table ); - - for ( let i = 0, il = keys.length; i < il; i ++ ) { - - let key = keys[ i ]; - - const value = table[ key ]; - key = parseInt( key ); - - u2sTable[ value ] = key; - - } - - } - - const array = []; - - for ( let i = 0, il = str.length; i < il; i ++ ) { - - const code = str.charCodeAt( i ); - - const value = u2sTable[ code ]; - - if ( value === undefined ) { - - throw new Error( 'cannot convert charcode 0x' + code.toString( 16 ) ); - - } else if ( value > 0xff ) { - - array.push( ( value >> 8 ) & 0xff ); - array.push( value & 0xff ); - - } else { - - array.push( value & 0xff ); - - } - - } - - return new Uint8Array( array ); - -} - -function getBindBones( skin ) { - - // any more efficient ways? - const poseSkin = skin.clone(); - poseSkin.pose(); - return poseSkin.skeleton.bones; - -} - -export { MMDExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/OBJExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/OBJExporter.js deleted file mode 100644 index 0f4fffa..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/OBJExporter.js +++ /dev/null @@ -1,284 +0,0 @@ -import { - Color, - Matrix3, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -class OBJExporter { - - parse( object ) { - - let output = ''; - - let indexVertex = 0; - let indexVertexUvs = 0; - let indexNormals = 0; - - const vertex = new Vector3(); - const color = new Color(); - const normal = new Vector3(); - const uv = new Vector2(); - - const face = []; - - function parseMesh( mesh ) { - - let nbVertex = 0; - let nbNormals = 0; - let nbVertexUvs = 0; - - const geometry = mesh.geometry; - - const normalMatrixWorld = new Matrix3(); - - // shortcuts - const vertices = geometry.getAttribute( 'position' ); - const normals = geometry.getAttribute( 'normal' ); - const uvs = geometry.getAttribute( 'uv' ); - const indices = geometry.getIndex(); - - // name of the mesh object - output += 'o ' + mesh.name + '\n'; - - // name of the mesh material - if ( mesh.material && mesh.material.name ) { - - output += 'usemtl ' + mesh.material.name + '\n'; - - } - - // vertices - - if ( vertices !== undefined ) { - - for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) { - - vertex.fromBufferAttribute( vertices, i ); - - // transform the vertex to world space - vertex.applyMatrix4( mesh.matrixWorld ); - - // transform the vertex to export format - output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n'; - - } - - } - - // uvs - - if ( uvs !== undefined ) { - - for ( let i = 0, l = uvs.count; i < l; i ++, nbVertexUvs ++ ) { - - uv.fromBufferAttribute( uvs, i ); - - // transform the uv to export format - output += 'vt ' + uv.x + ' ' + uv.y + '\n'; - - } - - } - - // normals - - if ( normals !== undefined ) { - - normalMatrixWorld.getNormalMatrix( mesh.matrixWorld ); - - for ( let i = 0, l = normals.count; i < l; i ++, nbNormals ++ ) { - - normal.fromBufferAttribute( normals, i ); - - // transform the normal to world space - normal.applyMatrix3( normalMatrixWorld ).normalize(); - - // transform the normal to export format - output += 'vn ' + normal.x + ' ' + normal.y + ' ' + normal.z + '\n'; - - } - - } - - // faces - - if ( indices !== null ) { - - for ( let i = 0, l = indices.count; i < l; i += 3 ) { - - for ( let m = 0; m < 3; m ++ ) { - - const j = indices.getX( i + m ) + 1; - - face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' ); - - } - - // transform the face to export format - output += 'f ' + face.join( ' ' ) + '\n'; - - } - - } else { - - for ( let i = 0, l = vertices.count; i < l; i += 3 ) { - - for ( let m = 0; m < 3; m ++ ) { - - const j = i + m + 1; - - face[ m ] = ( indexVertex + j ) + ( normals || uvs ? '/' + ( uvs ? ( indexVertexUvs + j ) : '' ) + ( normals ? '/' + ( indexNormals + j ) : '' ) : '' ); - - } - - // transform the face to export format - output += 'f ' + face.join( ' ' ) + '\n'; - - } - - } - - // update index - indexVertex += nbVertex; - indexVertexUvs += nbVertexUvs; - indexNormals += nbNormals; - - } - - function parseLine( line ) { - - let nbVertex = 0; - - const geometry = line.geometry; - const type = line.type; - - // shortcuts - const vertices = geometry.getAttribute( 'position' ); - - // name of the line object - output += 'o ' + line.name + '\n'; - - if ( vertices !== undefined ) { - - for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) { - - vertex.fromBufferAttribute( vertices, i ); - - // transform the vertex to world space - vertex.applyMatrix4( line.matrixWorld ); - - // transform the vertex to export format - output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n'; - - } - - } - - if ( type === 'Line' ) { - - output += 'l '; - - for ( let j = 1, l = vertices.count; j <= l; j ++ ) { - - output += ( indexVertex + j ) + ' '; - - } - - output += '\n'; - - } - - if ( type === 'LineSegments' ) { - - for ( let j = 1, k = j + 1, l = vertices.count; j < l; j += 2, k = j + 1 ) { - - output += 'l ' + ( indexVertex + j ) + ' ' + ( indexVertex + k ) + '\n'; - - } - - } - - // update index - indexVertex += nbVertex; - - } - - function parsePoints( points ) { - - let nbVertex = 0; - - const geometry = points.geometry; - - const vertices = geometry.getAttribute( 'position' ); - const colors = geometry.getAttribute( 'color' ); - - output += 'o ' + points.name + '\n'; - - if ( vertices !== undefined ) { - - for ( let i = 0, l = vertices.count; i < l; i ++, nbVertex ++ ) { - - vertex.fromBufferAttribute( vertices, i ); - vertex.applyMatrix4( points.matrixWorld ); - - output += 'v ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z; - - if ( colors !== undefined ) { - - color.fromBufferAttribute( colors, i ).convertLinearToSRGB(); - - output += ' ' + color.r + ' ' + color.g + ' ' + color.b; - - } - - output += '\n'; - - } - - output += 'p '; - - for ( let j = 1, l = vertices.count; j <= l; j ++ ) { - - output += ( indexVertex + j ) + ' '; - - } - - output += '\n'; - - } - - // update index - indexVertex += nbVertex; - - } - - object.traverse( function ( child ) { - - if ( child.isMesh === true ) { - - parseMesh( child ); - - } - - if ( child.isLine === true ) { - - parseLine( child ); - - } - - if ( child.isPoints === true ) { - - parsePoints( child ); - - } - - } ); - - return output; - - } - -} - -export { OBJExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/PLYExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/PLYExporter.js deleted file mode 100644 index 9dc0539..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/PLYExporter.js +++ /dev/null @@ -1,528 +0,0 @@ -import { - Matrix3, - Vector3, - Color -} from '/static/javascript/three/build/three.module.js'; - -/** - * https://github.com/gkjohnson/ply-exporter-js - * - * Usage: - * const exporter = new PLYExporter(); - * - * // second argument is a list of options - * exporter.parse(mesh, data => console.log(data), { binary: true, excludeAttributes: [ 'color' ], littleEndian: true }); - * - * Format Definition: - * http://paulbourke.net/dataformats/ply/ - */ - -class PLYExporter { - - parse( object, onDone, options = {} ) { - - // Iterate over the valid meshes in the object - function traverseMeshes( cb ) { - - object.traverse( function ( child ) { - - if ( child.isMesh === true || child.isPoints ) { - - const mesh = child; - const geometry = mesh.geometry; - - if ( geometry.hasAttribute( 'position' ) === true ) { - - cb( mesh, geometry ); - - } - - } - - } ); - - } - - // Default options - const defaultOptions = { - binary: false, - excludeAttributes: [], // normal, uv, color, index - littleEndian: false - }; - - options = Object.assign( defaultOptions, options ); - - const excludeAttributes = options.excludeAttributes; - let includeIndices = true; - let includeNormals = false; - let includeColors = false; - let includeUVs = false; - - // count the vertices, check which properties are used, - // and cache the BufferGeometry - let vertexCount = 0; - let faceCount = 0; - - object.traverse( function ( child ) { - - if ( child.isMesh === true ) { - - const mesh = child; - const geometry = mesh.geometry; - - const vertices = geometry.getAttribute( 'position' ); - const normals = geometry.getAttribute( 'normal' ); - const uvs = geometry.getAttribute( 'uv' ); - const colors = geometry.getAttribute( 'color' ); - const indices = geometry.getIndex(); - - if ( vertices === undefined ) { - - return; - - } - - vertexCount += vertices.count; - faceCount += indices ? indices.count / 3 : vertices.count / 3; - - if ( normals !== undefined ) includeNormals = true; - - if ( uvs !== undefined ) includeUVs = true; - - if ( colors !== undefined ) includeColors = true; - - } else if ( child.isPoints ) { - - const mesh = child; - const geometry = mesh.geometry; - - const vertices = geometry.getAttribute( 'position' ); - const normals = geometry.getAttribute( 'normal' ); - const colors = geometry.getAttribute( 'color' ); - - vertexCount += vertices.count; - - if ( normals !== undefined ) includeNormals = true; - - if ( colors !== undefined ) includeColors = true; - - includeIndices = false; - - } - - } ); - - const tempColor = new Color(); - includeIndices = includeIndices && excludeAttributes.indexOf( 'index' ) === - 1; - includeNormals = includeNormals && excludeAttributes.indexOf( 'normal' ) === - 1; - includeColors = includeColors && excludeAttributes.indexOf( 'color' ) === - 1; - includeUVs = includeUVs && excludeAttributes.indexOf( 'uv' ) === - 1; - - - if ( includeIndices && faceCount !== Math.floor( faceCount ) ) { - - // point cloud meshes will not have an index array and may not have a - // number of vertices that is divisble by 3 (and therefore representable - // as triangles) - console.error( - - 'PLYExporter: Failed to generate a valid PLY file with triangle indices because the ' + - 'number of indices is not divisible by 3.' - - ); - - return null; - - } - - const indexByteCount = 4; - - let header = - 'ply\n' + - `format ${ options.binary ? ( options.littleEndian ? 'binary_little_endian' : 'binary_big_endian' ) : 'ascii' } 1.0\n` + - `element vertex ${vertexCount}\n` + - - // position - 'property float x\n' + - 'property float y\n' + - 'property float z\n'; - - if ( includeNormals === true ) { - - // normal - header += - 'property float nx\n' + - 'property float ny\n' + - 'property float nz\n'; - - } - - if ( includeUVs === true ) { - - // uvs - header += - 'property float s\n' + - 'property float t\n'; - - } - - if ( includeColors === true ) { - - // colors - header += - 'property uchar red\n' + - 'property uchar green\n' + - 'property uchar blue\n'; - - } - - if ( includeIndices === true ) { - - // faces - header += - `element face ${faceCount}\n` + - 'property list uchar int vertex_index\n'; - - } - - header += 'end_header\n'; - - - // Generate attribute data - const vertex = new Vector3(); - const normalMatrixWorld = new Matrix3(); - let result = null; - - if ( options.binary === true ) { - - // Binary File Generation - const headerBin = new TextEncoder().encode( header ); - - // 3 position values at 4 bytes - // 3 normal values at 4 bytes - // 3 color channels with 1 byte - // 2 uv values at 4 bytes - const vertexListLength = vertexCount * ( 4 * 3 + ( includeNormals ? 4 * 3 : 0 ) + ( includeColors ? 3 : 0 ) + ( includeUVs ? 4 * 2 : 0 ) ); - - // 1 byte shape desciptor - // 3 vertex indices at ${indexByteCount} bytes - const faceListLength = includeIndices ? faceCount * ( indexByteCount * 3 + 1 ) : 0; - const output = new DataView( new ArrayBuffer( headerBin.length + vertexListLength + faceListLength ) ); - new Uint8Array( output.buffer ).set( headerBin, 0 ); - - - let vOffset = headerBin.length; - let fOffset = headerBin.length + vertexListLength; - let writtenVertices = 0; - traverseMeshes( function ( mesh, geometry ) { - - const vertices = geometry.getAttribute( 'position' ); - const normals = geometry.getAttribute( 'normal' ); - const uvs = geometry.getAttribute( 'uv' ); - const colors = geometry.getAttribute( 'color' ); - const indices = geometry.getIndex(); - - normalMatrixWorld.getNormalMatrix( mesh.matrixWorld ); - - for ( let i = 0, l = vertices.count; i < l; i ++ ) { - - vertex.fromBufferAttribute( vertices, i ); - - vertex.applyMatrix4( mesh.matrixWorld ); - - - // Position information - output.setFloat32( vOffset, vertex.x, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, vertex.y, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, vertex.z, options.littleEndian ); - vOffset += 4; - - // Normal information - if ( includeNormals === true ) { - - if ( normals != null ) { - - vertex.fromBufferAttribute( normals, i ); - - vertex.applyMatrix3( normalMatrixWorld ).normalize(); - - output.setFloat32( vOffset, vertex.x, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, vertex.y, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, vertex.z, options.littleEndian ); - vOffset += 4; - - } else { - - output.setFloat32( vOffset, 0, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, 0, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, 0, options.littleEndian ); - vOffset += 4; - - } - - } - - // UV information - if ( includeUVs === true ) { - - if ( uvs != null ) { - - output.setFloat32( vOffset, uvs.getX( i ), options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, uvs.getY( i ), options.littleEndian ); - vOffset += 4; - - } else { - - output.setFloat32( vOffset, 0, options.littleEndian ); - vOffset += 4; - - output.setFloat32( vOffset, 0, options.littleEndian ); - vOffset += 4; - - } - - } - - // Color information - if ( includeColors === true ) { - - if ( colors != null ) { - - tempColor - .fromBufferAttribute( colors, i ) - .convertLinearToSRGB(); - - output.setUint8( vOffset, Math.floor( tempColor.r * 255 ) ); - vOffset += 1; - - output.setUint8( vOffset, Math.floor( tempColor.g * 255 ) ); - vOffset += 1; - - output.setUint8( vOffset, Math.floor( tempColor.b * 255 ) ); - vOffset += 1; - - } else { - - output.setUint8( vOffset, 255 ); - vOffset += 1; - - output.setUint8( vOffset, 255 ); - vOffset += 1; - - output.setUint8( vOffset, 255 ); - vOffset += 1; - - } - - } - - } - - if ( includeIndices === true ) { - - // Create the face list - - if ( indices !== null ) { - - for ( let i = 0, l = indices.count; i < l; i += 3 ) { - - output.setUint8( fOffset, 3 ); - fOffset += 1; - - output.setUint32( fOffset, indices.getX( i + 0 ) + writtenVertices, options.littleEndian ); - fOffset += indexByteCount; - - output.setUint32( fOffset, indices.getX( i + 1 ) + writtenVertices, options.littleEndian ); - fOffset += indexByteCount; - - output.setUint32( fOffset, indices.getX( i + 2 ) + writtenVertices, options.littleEndian ); - fOffset += indexByteCount; - - } - - } else { - - for ( let i = 0, l = vertices.count; i < l; i += 3 ) { - - output.setUint8( fOffset, 3 ); - fOffset += 1; - - output.setUint32( fOffset, writtenVertices + i, options.littleEndian ); - fOffset += indexByteCount; - - output.setUint32( fOffset, writtenVertices + i + 1, options.littleEndian ); - fOffset += indexByteCount; - - output.setUint32( fOffset, writtenVertices + i + 2, options.littleEndian ); - fOffset += indexByteCount; - - } - - } - - } - - - // Save the amount of verts we've already written so we can offset - // the face index on the next mesh - writtenVertices += vertices.count; - - } ); - - result = output.buffer; - - } else { - - // Ascii File Generation - // count the number of vertices - let writtenVertices = 0; - let vertexList = ''; - let faceList = ''; - - traverseMeshes( function ( mesh, geometry ) { - - const vertices = geometry.getAttribute( 'position' ); - const normals = geometry.getAttribute( 'normal' ); - const uvs = geometry.getAttribute( 'uv' ); - const colors = geometry.getAttribute( 'color' ); - const indices = geometry.getIndex(); - - normalMatrixWorld.getNormalMatrix( mesh.matrixWorld ); - - // form each line - for ( let i = 0, l = vertices.count; i < l; i ++ ) { - - vertex.fromBufferAttribute( vertices, i ); - - vertex.applyMatrix4( mesh.matrixWorld ); - - - // Position information - let line = - vertex.x + ' ' + - vertex.y + ' ' + - vertex.z; - - // Normal information - if ( includeNormals === true ) { - - if ( normals != null ) { - - vertex.fromBufferAttribute( normals, i ); - - vertex.applyMatrix3( normalMatrixWorld ).normalize(); - - line += ' ' + - vertex.x + ' ' + - vertex.y + ' ' + - vertex.z; - - } else { - - line += ' 0 0 0'; - - } - - } - - // UV information - if ( includeUVs === true ) { - - if ( uvs != null ) { - - line += ' ' + - uvs.getX( i ) + ' ' + - uvs.getY( i ); - - } else { - - line += ' 0 0'; - - } - - } - - // Color information - if ( includeColors === true ) { - - if ( colors != null ) { - - tempColor - .fromBufferAttribute( colors, i ) - .convertLinearToSRGB(); - - line += ' ' + - Math.floor( tempColor.r * 255 ) + ' ' + - Math.floor( tempColor.g * 255 ) + ' ' + - Math.floor( tempColor.b * 255 ); - - } else { - - line += ' 255 255 255'; - - } - - } - - vertexList += line + '\n'; - - } - - // Create the face list - if ( includeIndices === true ) { - - if ( indices !== null ) { - - for ( let i = 0, l = indices.count; i < l; i += 3 ) { - - faceList += `3 ${ indices.getX( i + 0 ) + writtenVertices }`; - faceList += ` ${ indices.getX( i + 1 ) + writtenVertices }`; - faceList += ` ${ indices.getX( i + 2 ) + writtenVertices }\n`; - - } - - } else { - - for ( let i = 0, l = vertices.count; i < l; i += 3 ) { - - faceList += `3 ${ writtenVertices + i } ${ writtenVertices + i + 1 } ${ writtenVertices + i + 2 }\n`; - - } - - } - - faceCount += indices ? indices.count / 3 : vertices.count / 3; - - } - - writtenVertices += vertices.count; - - } ); - - result = `${ header }${vertexList}${ includeIndices ? `${faceList}\n` : '\n' }`; - - } - - if ( typeof onDone === 'function' ) requestAnimationFrame( () => onDone( result ) ); - - return result; - - } - -} - -export { PLYExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/STLExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/STLExporter.js deleted file mode 100644 index 9a2b78c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/STLExporter.js +++ /dev/null @@ -1,199 +0,0 @@ -import { Vector3 } from '/static/javascript/three/build/three.module.js'; - -/** - * Usage: - * const exporter = new STLExporter(); - * - * // second argument is a list of options - * const data = exporter.parse( mesh, { binary: true } ); - * - */ - -class STLExporter { - - parse( scene, options = {} ) { - - options = Object.assign( { - binary: false - }, options ); - - const binary = options.binary; - - // - - const objects = []; - let triangles = 0; - - scene.traverse( function ( object ) { - - if ( object.isMesh ) { - - const geometry = object.geometry; - - const index = geometry.index; - const positionAttribute = geometry.getAttribute( 'position' ); - - triangles += ( index !== null ) ? ( index.count / 3 ) : ( positionAttribute.count / 3 ); - - objects.push( { - object3d: object, - geometry: geometry - } ); - - } - - } ); - - let output; - let offset = 80; // skip header - - if ( binary === true ) { - - const bufferLength = triangles * 2 + triangles * 3 * 4 * 4 + 80 + 4; - const arrayBuffer = new ArrayBuffer( bufferLength ); - output = new DataView( arrayBuffer ); - output.setUint32( offset, triangles, true ); offset += 4; - - } else { - - output = ''; - output += 'solid exported\n'; - - } - - const vA = new Vector3(); - const vB = new Vector3(); - const vC = new Vector3(); - const cb = new Vector3(); - const ab = new Vector3(); - const normal = new Vector3(); - - for ( let i = 0, il = objects.length; i < il; i ++ ) { - - const object = objects[ i ].object3d; - const geometry = objects[ i ].geometry; - - const index = geometry.index; - const positionAttribute = geometry.getAttribute( 'position' ); - - if ( index !== null ) { - - // indexed geometry - - for ( let j = 0; j < index.count; j += 3 ) { - - const a = index.getX( j + 0 ); - const b = index.getX( j + 1 ); - const c = index.getX( j + 2 ); - - writeFace( a, b, c, positionAttribute, object ); - - } - - } else { - - // non-indexed geometry - - for ( let j = 0; j < positionAttribute.count; j += 3 ) { - - const a = j + 0; - const b = j + 1; - const c = j + 2; - - writeFace( a, b, c, positionAttribute, object ); - - } - - } - - } - - if ( binary === false ) { - - output += 'endsolid exported\n'; - - } - - return output; - - function writeFace( a, b, c, positionAttribute, object ) { - - vA.fromBufferAttribute( positionAttribute, a ); - vB.fromBufferAttribute( positionAttribute, b ); - vC.fromBufferAttribute( positionAttribute, c ); - - if ( object.isSkinnedMesh === true ) { - - object.applyBoneTransform( a, vA ); - object.applyBoneTransform( b, vB ); - object.applyBoneTransform( c, vC ); - - } - - vA.applyMatrix4( object.matrixWorld ); - vB.applyMatrix4( object.matrixWorld ); - vC.applyMatrix4( object.matrixWorld ); - - writeNormal( vA, vB, vC ); - - writeVertex( vA ); - writeVertex( vB ); - writeVertex( vC ); - - if ( binary === true ) { - - output.setUint16( offset, 0, true ); offset += 2; - - } else { - - output += '\t\tendloop\n'; - output += '\tendfacet\n'; - - } - - } - - function writeNormal( vA, vB, vC ) { - - cb.subVectors( vC, vB ); - ab.subVectors( vA, vB ); - cb.cross( ab ).normalize(); - - normal.copy( cb ).normalize(); - - if ( binary === true ) { - - output.setFloat32( offset, normal.x, true ); offset += 4; - output.setFloat32( offset, normal.y, true ); offset += 4; - output.setFloat32( offset, normal.z, true ); offset += 4; - - } else { - - output += '\tfacet normal ' + normal.x + ' ' + normal.y + ' ' + normal.z + '\n'; - output += '\t\touter loop\n'; - - } - - } - - function writeVertex( vertex ) { - - if ( binary === true ) { - - output.setFloat32( offset, vertex.x, true ); offset += 4; - output.setFloat32( offset, vertex.y, true ); offset += 4; - output.setFloat32( offset, vertex.z, true ); offset += 4; - - } else { - - output += '\t\t\tvertex ' + vertex.x + ' ' + vertex.y + ' ' + vertex.z + '\n'; - - } - - } - - } - -} - -export { STLExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/USDZExporter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/USDZExporter.js deleted file mode 100644 index ae68775..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/exporters/USDZExporter.js +++ /dev/null @@ -1,743 +0,0 @@ -import { - NoColorSpace, - DoubleSide, -} from '/static/javascript/three/build/three.module.js'; - -import { - strToU8, - zipSync, -} from '../libs/fflate.module.js'; - -import { decompress } from './../utils/TextureUtils.js'; - -class USDZExporter { - - parse( scene, onDone, onError, options ) { - - this.parseAsync( scene, options ).then( onDone ).catch( onError ); - - } - - async parseAsync( scene, options = {} ) { - - options = Object.assign( { - ar: { - anchoring: { type: 'plane' }, - planeAnchoring: { alignment: 'horizontal' } - }, - includeAnchoringProperties: true, - quickLookCompatible: false, - maxTextureSize: 1024, - }, options ); - - const files = {}; - const modelFileName = 'model.usda'; - - // model file should be first in USDZ archive so we init it here - files[ modelFileName ] = null; - - let output = buildHeader(); - - output += buildSceneStart( options ); - - const materials = {}; - const textures = {}; - - scene.traverseVisible( ( object ) => { - - if ( object.isMesh ) { - - const geometry = object.geometry; - const material = object.material; - - if ( material.isMeshStandardMaterial ) { - - const geometryFileName = 'geometries/Geometry_' + geometry.id + '.usda'; - - if ( ! ( geometryFileName in files ) ) { - - const meshObject = buildMeshObject( geometry ); - files[ geometryFileName ] = buildUSDFileAsString( meshObject ); - - } - - if ( ! ( material.uuid in materials ) ) { - - materials[ material.uuid ] = material; - - } - - output += buildXform( object, geometry, material ); - - } else { - - console.warn( 'THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)', object ); - - } - - } else if ( object.isCamera ) { - - output += buildCamera( object ); - - } - - } ); - - - output += buildSceneEnd(); - - output += buildMaterials( materials, textures, options.quickLookCompatible ); - - files[ modelFileName ] = strToU8( output ); - output = null; - - for ( const id in textures ) { - - let texture = textures[ id ]; - - if ( texture.isCompressedTexture === true ) { - - texture = decompress( texture ); - - } - - const canvas = imageToCanvas( texture.image, texture.flipY, options.maxTextureSize ); - const blob = await new Promise( resolve => canvas.toBlob( resolve, 'image/png', 1 ) ); - - files[ `textures/Texture_${ id }.png` ] = new Uint8Array( await blob.arrayBuffer() ); - - } - - // 64 byte alignment - // https://github.com/101arrowz/fflate/issues/39#issuecomment-777263109 - - let offset = 0; - - for ( const filename in files ) { - - const file = files[ filename ]; - const headerSize = 34 + filename.length; - - offset += headerSize; - - const offsetMod64 = offset & 63; - - if ( offsetMod64 !== 4 ) { - - const padLength = 64 - offsetMod64; - const padding = new Uint8Array( padLength ); - - files[ filename ] = [ file, { extra: { 12345: padding } } ]; - - } - - offset = file.length; - - } - - return zipSync( files, { level: 0 } ); - - } - -} - -function imageToCanvas( image, flipY, maxTextureSize ) { - - if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) || - ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) || - ( typeof OffscreenCanvas !== 'undefined' && image instanceof OffscreenCanvas ) || - ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) { - - const scale = maxTextureSize / Math.max( image.width, image.height ); - - const canvas = document.createElement( 'canvas' ); - canvas.width = image.width * Math.min( 1, scale ); - canvas.height = image.height * Math.min( 1, scale ); - - const context = canvas.getContext( '2d' ); - - // TODO: We should be able to do this in the UsdTransform2d? - - if ( flipY === true ) { - - context.translate( 0, canvas.height ); - context.scale( 1, - 1 ); - - } - - context.drawImage( image, 0, 0, canvas.width, canvas.height ); - - return canvas; - - } else { - - throw new Error( 'THREE.USDZExporter: No valid image data found. Unable to process texture.' ); - - } - -} - -// - -const PRECISION = 7; - -function buildHeader() { - - return `#usda 1.0 -( - customLayerData = { - string creator = "Three.js USDZExporter" - } - defaultPrim = "Root" - metersPerUnit = 1 - upAxis = "Y" -) - -`; - -} - -function buildSceneStart( options ) { - - const alignment = options.includeAnchoringProperties === true ? ` - token preliminary:anchoring:type = "${options.ar.anchoring.type}" - token preliminary:planeAnchoring:alignment = "${options.ar.planeAnchoring.alignment}" - ` : ''; - return `def Xform "Root" -{ - def Scope "Scenes" ( - kind = "sceneLibrary" - ) - { - def Xform "Scene" ( - customData = { - bool preliminary_collidesWithEnvironment = 0 - string sceneName = "Scene" - } - sceneName = "Scene" - ) - {${alignment} -`; - -} - -function buildSceneEnd() { - - return ` - } - } -} - -`; - -} - -function buildUSDFileAsString( dataToInsert ) { - - let output = buildHeader(); - output += dataToInsert; - return strToU8( output ); - -} - -// Xform - -function buildXform( object, geometry, material ) { - - const name = 'Object_' + object.id; - const transform = buildMatrix( object.matrixWorld ); - - if ( object.matrixWorld.determinant() < 0 ) { - - console.warn( 'THREE.USDZExporter: USDZ does not support negative scales', object ); - - } - - return `def Xform "${ name }" ( - prepend references = @./geometries/Geometry_${ geometry.id }.usda@ - prepend apiSchemas = ["MaterialBindingAPI"] -) -{ - matrix4d xformOp:transform = ${ transform } - uniform token[] xformOpOrder = ["xformOp:transform"] - - rel material:binding = -} - -`; - -} - -function buildMatrix( matrix ) { - - const array = matrix.elements; - - return `( ${ buildMatrixRow( array, 0 ) }, ${ buildMatrixRow( array, 4 ) }, ${ buildMatrixRow( array, 8 ) }, ${ buildMatrixRow( array, 12 ) } )`; - -} - -function buildMatrixRow( array, offset ) { - - return `(${ array[ offset + 0 ] }, ${ array[ offset + 1 ] }, ${ array[ offset + 2 ] }, ${ array[ offset + 3 ] })`; - -} - -// Mesh - -function buildMeshObject( geometry ) { - - const mesh = buildMesh( geometry ); - return ` -def "Geometry" -{ -${mesh} -} -`; - -} - -function buildMesh( geometry ) { - - const name = 'Geometry'; - const attributes = geometry.attributes; - const count = attributes.position.count; - - return ` - def Mesh "${ name }" - { - int[] faceVertexCounts = [${ buildMeshVertexCount( geometry ) }] - int[] faceVertexIndices = [${ buildMeshVertexIndices( geometry ) }] - normal3f[] normals = [${ buildVector3Array( attributes.normal, count )}] ( - interpolation = "vertex" - ) - point3f[] points = [${ buildVector3Array( attributes.position, count )}] -${ buildPrimvars( attributes ) } - uniform token subdivisionScheme = "none" - } -`; - -} - -function buildMeshVertexCount( geometry ) { - - const count = geometry.index !== null ? geometry.index.count : geometry.attributes.position.count; - - return Array( count / 3 ).fill( 3 ).join( ', ' ); - -} - -function buildMeshVertexIndices( geometry ) { - - const index = geometry.index; - const array = []; - - if ( index !== null ) { - - for ( let i = 0; i < index.count; i ++ ) { - - array.push( index.getX( i ) ); - - } - - } else { - - const length = geometry.attributes.position.count; - - for ( let i = 0; i < length; i ++ ) { - - array.push( i ); - - } - - } - - return array.join( ', ' ); - -} - -function buildVector3Array( attribute, count ) { - - if ( attribute === undefined ) { - - console.warn( 'USDZExporter: Normals missing.' ); - return Array( count ).fill( '(0, 0, 0)' ).join( ', ' ); - - } - - const array = []; - - for ( let i = 0; i < attribute.count; i ++ ) { - - const x = attribute.getX( i ); - const y = attribute.getY( i ); - const z = attribute.getZ( i ); - - array.push( `(${ x.toPrecision( PRECISION ) }, ${ y.toPrecision( PRECISION ) }, ${ z.toPrecision( PRECISION ) })` ); - - } - - return array.join( ', ' ); - -} - -function buildVector2Array( attribute ) { - - const array = []; - - for ( let i = 0; i < attribute.count; i ++ ) { - - const x = attribute.getX( i ); - const y = attribute.getY( i ); - - array.push( `(${ x.toPrecision( PRECISION ) }, ${ 1 - y.toPrecision( PRECISION ) })` ); - - } - - return array.join( ', ' ); - -} - -function buildPrimvars( attributes ) { - - let string = ''; - - for ( let i = 0; i < 4; i ++ ) { - - const id = ( i > 0 ? i : '' ); - const attribute = attributes[ 'uv' + id ]; - - if ( attribute !== undefined ) { - - string += ` - texCoord2f[] primvars:st${ id } = [${ buildVector2Array( attribute )}] ( - interpolation = "vertex" - )`; - - } - - } - - // vertex colors - - const colorAttribute = attributes.color; - - if ( colorAttribute !== undefined ) { - - const count = colorAttribute.count; - - string += ` - color3f[] primvars:displayColor = [${buildVector3Array( colorAttribute, count )}] ( - interpolation = "vertex" - )`; - - } - - return string; - -} - -// Materials - -function buildMaterials( materials, textures, quickLookCompatible = false ) { - - const array = []; - - for ( const uuid in materials ) { - - const material = materials[ uuid ]; - - array.push( buildMaterial( material, textures, quickLookCompatible ) ); - - } - - return `def "Materials" -{ -${ array.join( '' ) } -} - -`; - -} - -function buildMaterial( material, textures, quickLookCompatible = false ) { - - // https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html - - const pad = ' '; - const inputs = []; - const samplers = []; - - function buildTexture( texture, mapType, color ) { - - const id = texture.source.id + '_' + texture.flipY; - - textures[ id ] = texture; - - const uv = texture.channel > 0 ? 'st' + texture.channel : 'st'; - - const WRAPPINGS = { - 1000: 'repeat', // RepeatWrapping - 1001: 'clamp', // ClampToEdgeWrapping - 1002: 'mirror' // MirroredRepeatWrapping - }; - - const repeat = texture.repeat.clone(); - const offset = texture.offset.clone(); - const rotation = texture.rotation; - - // rotation is around the wrong point. after rotation we need to shift offset again so that we're rotating around the right spot - const xRotationOffset = Math.sin( rotation ); - const yRotationOffset = Math.cos( rotation ); - - // texture coordinates start in the opposite corner, need to correct - offset.y = 1 - offset.y - repeat.y; - - // turns out QuickLook is buggy and interprets texture repeat inverted/applies operations in a different order. - // Apple Feedback: FB10036297 and FB11442287 - if ( quickLookCompatible ) { - - // This is NOT correct yet in QuickLook, but comes close for a range of models. - // It becomes more incorrect the bigger the offset is - - offset.x = offset.x / repeat.x; - offset.y = offset.y / repeat.y; - - offset.x += xRotationOffset / repeat.x; - offset.y += yRotationOffset - 1; - - } else { - - // results match glTF results exactly. verified correct in usdview. - offset.x += xRotationOffset * repeat.x; - offset.y += ( 1 - yRotationOffset ) * repeat.y; - - } - - return ` - def Shader "PrimvarReader_${ mapType }" - { - uniform token info:id = "UsdPrimvarReader_float2" - float2 inputs:fallback = (0.0, 0.0) - token inputs:varname = "${ uv }" - float2 outputs:result - } - - def Shader "Transform2d_${ mapType }" - { - uniform token info:id = "UsdTransform2d" - token inputs:in.connect = - float inputs:rotation = ${ ( rotation * ( 180 / Math.PI ) ).toFixed( PRECISION ) } - float2 inputs:scale = ${ buildVector2( repeat ) } - float2 inputs:translation = ${ buildVector2( offset ) } - float2 outputs:result - } - - def Shader "Texture_${ texture.id }_${ mapType }" - { - uniform token info:id = "UsdUVTexture" - asset inputs:file = @textures/Texture_${ id }.png@ - float2 inputs:st.connect = - ${ color !== undefined ? 'float4 inputs:scale = ' + buildColor4( color ) : '' } - token inputs:sourceColorSpace = "${ texture.colorSpace === NoColorSpace ? 'raw' : 'sRGB' }" - token inputs:wrapS = "${ WRAPPINGS[ texture.wrapS ] }" - token inputs:wrapT = "${ WRAPPINGS[ texture.wrapT ] }" - float outputs:r - float outputs:g - float outputs:b - float3 outputs:rgb - ${ material.transparent || material.alphaTest > 0.0 ? 'float outputs:a' : '' } - }`; - - } - - - if ( material.side === DoubleSide ) { - - console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material ); - - } - - if ( material.map !== null ) { - - inputs.push( `${ pad }color3f inputs:diffuseColor.connect = ` ); - - if ( material.transparent ) { - - inputs.push( `${ pad }float inputs:opacity.connect = ` ); - - } else if ( material.alphaTest > 0.0 ) { - - inputs.push( `${ pad }float inputs:opacity.connect = ` ); - inputs.push( `${ pad }float inputs:opacityThreshold = ${material.alphaTest}` ); - - } - - samplers.push( buildTexture( material.map, 'diffuse', material.color ) ); - - } else { - - inputs.push( `${ pad }color3f inputs:diffuseColor = ${ buildColor( material.color ) }` ); - - } - - if ( material.emissiveMap !== null ) { - - inputs.push( `${ pad }color3f inputs:emissiveColor.connect = ` ); - - samplers.push( buildTexture( material.emissiveMap, 'emissive' ) ); - - } else if ( material.emissive.getHex() > 0 ) { - - inputs.push( `${ pad }color3f inputs:emissiveColor = ${ buildColor( material.emissive ) }` ); - - } - - if ( material.normalMap !== null ) { - - inputs.push( `${ pad }normal3f inputs:normal.connect = ` ); - - samplers.push( buildTexture( material.normalMap, 'normal' ) ); - - } - - if ( material.aoMap !== null ) { - - inputs.push( `${ pad }float inputs:occlusion.connect = ` ); - - samplers.push( buildTexture( material.aoMap, 'occlusion' ) ); - - } - - if ( material.roughnessMap !== null && material.roughness === 1 ) { - - inputs.push( `${ pad }float inputs:roughness.connect = ` ); - - samplers.push( buildTexture( material.roughnessMap, 'roughness' ) ); - - } else { - - inputs.push( `${ pad }float inputs:roughness = ${ material.roughness }` ); - - } - - if ( material.metalnessMap !== null && material.metalness === 1 ) { - - inputs.push( `${ pad }float inputs:metallic.connect = ` ); - - samplers.push( buildTexture( material.metalnessMap, 'metallic' ) ); - - } else { - - inputs.push( `${ pad }float inputs:metallic = ${ material.metalness }` ); - - } - - if ( material.alphaMap !== null ) { - - inputs.push( `${pad}float inputs:opacity.connect = ` ); - inputs.push( `${pad}float inputs:opacityThreshold = 0.0001` ); - - samplers.push( buildTexture( material.alphaMap, 'opacity' ) ); - - } else { - - inputs.push( `${pad}float inputs:opacity = ${material.opacity}` ); - - } - - if ( material.isMeshPhysicalMaterial ) { - - inputs.push( `${ pad }float inputs:clearcoat = ${ material.clearcoat }` ); - inputs.push( `${ pad }float inputs:clearcoatRoughness = ${ material.clearcoatRoughness }` ); - inputs.push( `${ pad }float inputs:ior = ${ material.ior }` ); - - } - - return ` - def Material "Material_${ material.id }" - { - def Shader "PreviewSurface" - { - uniform token info:id = "UsdPreviewSurface" -${ inputs.join( '\n' ) } - int inputs:useSpecularWorkflow = 0 - token outputs:surface - } - - token outputs:surface.connect = - -${ samplers.join( '\n' ) } - - } -`; - -} - -function buildColor( color ) { - - return `(${ color.r }, ${ color.g }, ${ color.b })`; - -} - -function buildColor4( color ) { - - return `(${ color.r }, ${ color.g }, ${ color.b }, 1.0)`; - -} - -function buildVector2( vector ) { - - return `(${ vector.x }, ${ vector.y })`; - -} - - -function buildCamera( camera ) { - - const name = camera.name ? camera.name : 'Camera_' + camera.id; - - const transform = buildMatrix( camera.matrixWorld ); - - if ( camera.matrixWorld.determinant() < 0 ) { - - console.warn( 'THREE.USDZExporter: USDZ does not support negative scales', camera ); - - } - - if ( camera.isOrthographicCamera ) { - - return `def Camera "${name}" - { - matrix4d xformOp:transform = ${ transform } - uniform token[] xformOpOrder = ["xformOp:transform"] - - float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) }) - float horizontalAperture = ${ ( ( Math.abs( camera.left ) + Math.abs( camera.right ) ) * 10 ).toPrecision( PRECISION ) } - float verticalAperture = ${ ( ( Math.abs( camera.top ) + Math.abs( camera.bottom ) ) * 10 ).toPrecision( PRECISION ) } - token projection = "orthographic" - } - - `; - - } else { - - return `def Camera "${name}" - { - matrix4d xformOp:transform = ${ transform } - uniform token[] xformOpOrder = ["xformOp:transform"] - - float2 clippingRange = (${ camera.near.toPrecision( PRECISION ) }, ${ camera.far.toPrecision( PRECISION ) }) - float focalLength = ${ camera.getFocalLength().toPrecision( PRECISION ) } - float focusDistance = ${ camera.focus.toPrecision( PRECISION ) } - float horizontalAperture = ${ camera.getFilmWidth().toPrecision( PRECISION ) } - token projection = "perspective" - float verticalAperture = ${ camera.getFilmHeight().toPrecision( PRECISION ) } - } - - `; - - } - -} - -export { USDZExporter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/fflate.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/fflate.module.js deleted file mode 100644 index 0638389..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/fflate.module.js +++ /dev/null @@ -1,2672 +0,0 @@ -/*! -fflate - fast JavaScript compression/decompression - -Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE -version 0.8.2 -*/ - -// DEFLATE is a complex format; to read this code, you should probably check the RFC first: -// https://tools.ietf.org/html/rfc1951 -// You may also wish to take a look at the guide I made about this program: -// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad -// Some of the following code is similar to that of UZIP.js: -// https://github.com/photopea/UZIP.js -// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size. -// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint -// is better for memory in most engines (I *think*). -var ch2 = {}; -var wk = (function (c, id, msg, transfer, cb) { - var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([ - c + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})' - ], { type: 'text/javascript' })))); - w.onmessage = function (e) { - var d = e.data, ed = d.$e$; - if (ed) { - var err = new Error(ed[0]); - err['code'] = ed[1]; - err.stack = ed[2]; - cb(err, null); - } - else - cb(null, d); - }; - w.postMessage(msg, transfer); - return w; -}); - -// aliases for shorter compressed code (most minifers don't do this) -var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array; -// fixed length extra bits -var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]); -// fixed distance extra bits -var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]); -// code length index map -var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); -// get base, reverse index map from extra bits -var freb = function (eb, start) { - var b = new u16(31); - for (var i = 0; i < 31; ++i) { - b[i] = start += 1 << eb[i - 1]; - } - // numbers here are at max 18 bits - var r = new i32(b[30]); - for (var i = 1; i < 30; ++i) { - for (var j = b[i]; j < b[i + 1]; ++j) { - r[j] = ((j - b[i]) << 5) | i; - } - } - return { b: b, r: r }; -}; -var _a = freb(fleb, 2), fl = _a.b, revfl = _a.r; -// we can ignore the fact that the other numbers are wrong; they never happen anyway -fl[28] = 258, revfl[258] = 28; -var _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r; -// map of value to reverse (assuming 16 bits) -var rev = new u16(32768); -for (var i = 0; i < 32768; ++i) { - // reverse table algorithm from SO - var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1); - x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2); - x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4); - rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1; -} -// create huffman tree from u8 "map": index -> code length for code index -// mb (max bits) must be at most 15 -// TODO: optimize/split up? -var hMap = (function (cd, mb, r) { - var s = cd.length; - // index - var i = 0; - // u16 "map": index -> # of codes with bit length = index - var l = new u16(mb); - // length of cd must be 288 (total # of codes) - for (; i < s; ++i) { - if (cd[i]) - ++l[cd[i] - 1]; - } - // u16 "map": index -> minimum code for bit length = index - var le = new u16(mb); - for (i = 1; i < mb; ++i) { - le[i] = (le[i - 1] + l[i - 1]) << 1; - } - var co; - if (r) { - // u16 "map": index -> number of actual bits, symbol for code - co = new u16(1 << mb); - // bits to remove for reverser - var rvb = 15 - mb; - for (i = 0; i < s; ++i) { - // ignore 0 lengths - if (cd[i]) { - // num encoding both symbol and bits read - var sv = (i << 4) | cd[i]; - // free bits - var r_1 = mb - cd[i]; - // start value - var v = le[cd[i] - 1]++ << r_1; - // m is end value - for (var m = v | ((1 << r_1) - 1); v <= m; ++v) { - // every 16 bit value starting with the code yields the same result - co[rev[v] >> rvb] = sv; - } - } - } - } - else { - co = new u16(s); - for (i = 0; i < s; ++i) { - if (cd[i]) { - co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]); - } - } - } - return co; -}); -// fixed length tree -var flt = new u8(288); -for (var i = 0; i < 144; ++i) - flt[i] = 8; -for (var i = 144; i < 256; ++i) - flt[i] = 9; -for (var i = 256; i < 280; ++i) - flt[i] = 7; -for (var i = 280; i < 288; ++i) - flt[i] = 8; -// fixed distance tree -var fdt = new u8(32); -for (var i = 0; i < 32; ++i) - fdt[i] = 5; -// fixed length map -var flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1); -// fixed distance map -var fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1); -// find max of array -var max = function (a) { - var m = a[0]; - for (var i = 1; i < a.length; ++i) { - if (a[i] > m) - m = a[i]; - } - return m; -}; -// read d, starting at bit p and mask with m -var bits = function (d, p, m) { - var o = (p / 8) | 0; - return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m; -}; -// read d, starting at bit p continuing for at least 16 bits -var bits16 = function (d, p) { - var o = (p / 8) | 0; - return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7)); -}; -// get end of byte -var shft = function (p) { return ((p + 7) / 8) | 0; }; -// typed array slice - allows garbage collector to free original reference, -// while being more compatible than .slice -var slc = function (v, s, e) { - if (s == null || s < 0) - s = 0; - if (e == null || e > v.length) - e = v.length; - // can't use .constructor in case user-supplied - return new u8(v.subarray(s, e)); -}; -/** - * Codes for errors generated within this library - */ -export var FlateErrorCode = { - UnexpectedEOF: 0, - InvalidBlockType: 1, - InvalidLengthLiteral: 2, - InvalidDistance: 3, - StreamFinished: 4, - NoStreamHandler: 5, - InvalidHeader: 6, - NoCallback: 7, - InvalidUTF8: 8, - ExtraFieldTooLong: 9, - InvalidDate: 10, - FilenameTooLong: 11, - StreamFinishing: 12, - InvalidZipData: 13, - UnknownCompressionMethod: 14 -}; -// error codes -var ec = [ - 'unexpected EOF', - 'invalid block type', - 'invalid length/literal', - 'invalid distance', - 'stream finished', - 'no stream handler', - , - 'no callback', - 'invalid UTF-8 data', - 'extra field too long', - 'date not in range 1980-2099', - 'filename too long', - 'stream finishing', - 'invalid zip data' - // determined by unknown compression method -]; -; -var err = function (ind, msg, nt) { - var e = new Error(msg || ec[ind]); - e.code = ind; - if (Error.captureStackTrace) - Error.captureStackTrace(e, err); - if (!nt) - throw e; - return e; -}; -// expands raw DEFLATE data -var inflt = function (dat, st, buf, dict) { - // source length dict length - var sl = dat.length, dl = dict ? dict.length : 0; - if (!sl || st.f && !st.l) - return buf || new u8(0); - var noBuf = !buf; - // have to estimate size - var resize = noBuf || st.i != 2; - // no state - var noSt = st.i; - // Assumes roughly 33% compression ratio average - if (noBuf) - buf = new u8(sl * 3); - // ensure buffer can fit at least l elements - var cbuf = function (l) { - var bl = buf.length; - // need to increase size to fit - if (l > bl) { - // Double or set to necessary, whichever is greater - var nbuf = new u8(Math.max(bl * 2, l)); - nbuf.set(buf); - buf = nbuf; - } - }; - // last chunk bitpos bytes - var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n; - // total bits - var tbts = sl * 8; - do { - if (!lm) { - // BFINAL - this is only 1 when last chunk is next - final = bits(dat, pos, 1); - // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman - var type = bits(dat, pos + 1, 3); - pos += 3; - if (!type) { - // go to end of byte boundary - var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l; - if (t > sl) { - if (noSt) - err(0); - break; - } - // ensure size - if (resize) - cbuf(bt + l); - // Copy over uncompressed data - buf.set(dat.subarray(s, t), bt); - // Get new bitpos, update byte count - st.b = bt += l, st.p = pos = t * 8, st.f = final; - continue; - } - else if (type == 1) - lm = flrm, dm = fdrm, lbt = 9, dbt = 5; - else if (type == 2) { - // literal lengths - var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4; - var tl = hLit + bits(dat, pos + 5, 31) + 1; - pos += 14; - // length+distance tree - var ldt = new u8(tl); - // code length tree - var clt = new u8(19); - for (var i = 0; i < hcLen; ++i) { - // use index map to get real code - clt[clim[i]] = bits(dat, pos + i * 3, 7); - } - pos += hcLen * 3; - // code lengths bits - var clb = max(clt), clbmsk = (1 << clb) - 1; - // code lengths map - var clm = hMap(clt, clb, 1); - for (var i = 0; i < tl;) { - var r = clm[bits(dat, pos, clbmsk)]; - // bits read - pos += r & 15; - // symbol - var s = r >> 4; - // code length to copy - if (s < 16) { - ldt[i++] = s; - } - else { - // copy count - var c = 0, n = 0; - if (s == 16) - n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1]; - else if (s == 17) - n = 3 + bits(dat, pos, 7), pos += 3; - else if (s == 18) - n = 11 + bits(dat, pos, 127), pos += 7; - while (n--) - ldt[i++] = c; - } - } - // length tree distance tree - var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit); - // max length bits - lbt = max(lt); - // max dist bits - dbt = max(dt); - lm = hMap(lt, lbt, 1); - dm = hMap(dt, dbt, 1); - } - else - err(1); - if (pos > tbts) { - if (noSt) - err(0); - break; - } - } - // Make sure the buffer can hold this + the largest possible addition - // Maximum chunk size (practically, theoretically infinite) is 2^17 - if (resize) - cbuf(bt + 131072); - var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1; - var lpos = pos; - for (;; lpos = pos) { - // bits read, code - var c = lm[bits16(dat, pos) & lms], sym = c >> 4; - pos += c & 15; - if (pos > tbts) { - if (noSt) - err(0); - break; - } - if (!c) - err(2); - if (sym < 256) - buf[bt++] = sym; - else if (sym == 256) { - lpos = pos, lm = null; - break; - } - else { - var add = sym - 254; - // no extra bits needed if less - if (sym > 264) { - // index - var i = sym - 257, b = fleb[i]; - add = bits(dat, pos, (1 << b) - 1) + fl[i]; - pos += b; - } - // dist - var d = dm[bits16(dat, pos) & dms], dsym = d >> 4; - if (!d) - err(3); - pos += d & 15; - var dt = fd[dsym]; - if (dsym > 3) { - var b = fdeb[dsym]; - dt += bits16(dat, pos) & (1 << b) - 1, pos += b; - } - if (pos > tbts) { - if (noSt) - err(0); - break; - } - if (resize) - cbuf(bt + 131072); - var end = bt + add; - if (bt < dt) { - var shift = dl - dt, dend = Math.min(dt, end); - if (shift + bt < 0) - err(3); - for (; bt < dend; ++bt) - buf[bt] = dict[shift + bt]; - } - for (; bt < end; ++bt) - buf[bt] = buf[bt - dt]; - } - } - st.l = lm, st.p = lpos, st.b = bt, st.f = final; - if (lm) - final = 1, st.m = lbt, st.d = dm, st.n = dbt; - } while (!final); - // don't reallocate for streams or user buffers - return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt); -}; -// starting at p, write the minimum number of bits that can hold v to d -var wbits = function (d, p, v) { - v <<= p & 7; - var o = (p / 8) | 0; - d[o] |= v; - d[o + 1] |= v >> 8; -}; -// starting at p, write the minimum number of bits (>8) that can hold v to d -var wbits16 = function (d, p, v) { - v <<= p & 7; - var o = (p / 8) | 0; - d[o] |= v; - d[o + 1] |= v >> 8; - d[o + 2] |= v >> 16; -}; -// creates code lengths from a frequency table -var hTree = function (d, mb) { - // Need extra info to make a tree - var t = []; - for (var i = 0; i < d.length; ++i) { - if (d[i]) - t.push({ s: i, f: d[i] }); - } - var s = t.length; - var t2 = t.slice(); - if (!s) - return { t: et, l: 0 }; - if (s == 1) { - var v = new u8(t[0].s + 1); - v[t[0].s] = 1; - return { t: v, l: 1 }; - } - t.sort(function (a, b) { return a.f - b.f; }); - // after i2 reaches last ind, will be stopped - // freq must be greater than largest possible number of symbols - t.push({ s: -1, f: 25001 }); - var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2; - t[0] = { s: -1, f: l.f + r.f, l: l, r: r }; - // efficient algorithm from UZIP.js - // i0 is lookbehind, i2 is lookahead - after processing two low-freq - // symbols that combined have high freq, will start processing i2 (high-freq, - // non-composite) symbols instead - // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/ - while (i1 != s - 1) { - l = t[t[i0].f < t[i2].f ? i0++ : i2++]; - r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++]; - t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r }; - } - var maxSym = t2[0].s; - for (var i = 1; i < s; ++i) { - if (t2[i].s > maxSym) - maxSym = t2[i].s; - } - // code lengths - var tr = new u16(maxSym + 1); - // max bits in tree - var mbt = ln(t[i1 - 1], tr, 0); - if (mbt > mb) { - // more algorithms from UZIP.js - // TODO: find out how this code works (debt) - // ind debt - var i = 0, dt = 0; - // left cost - var lft = mbt - mb, cst = 1 << lft; - t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; }); - for (; i < s; ++i) { - var i2_1 = t2[i].s; - if (tr[i2_1] > mb) { - dt += cst - (1 << (mbt - tr[i2_1])); - tr[i2_1] = mb; - } - else - break; - } - dt >>= lft; - while (dt > 0) { - var i2_2 = t2[i].s; - if (tr[i2_2] < mb) - dt -= 1 << (mb - tr[i2_2]++ - 1); - else - ++i; - } - for (; i >= 0 && dt; --i) { - var i2_3 = t2[i].s; - if (tr[i2_3] == mb) { - --tr[i2_3]; - ++dt; - } - } - mbt = mb; - } - return { t: new u8(tr), l: mbt }; -}; -// get the max length and assign length codes -var ln = function (n, l, d) { - return n.s == -1 - ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) - : (l[n.s] = d); -}; -// length codes generation -var lc = function (c) { - var s = c.length; - // Note that the semicolon was intentional - while (s && !c[--s]) - ; - var cl = new u16(++s); - // ind num streak - var cli = 0, cln = c[0], cls = 1; - var w = function (v) { cl[cli++] = v; }; - for (var i = 1; i <= s; ++i) { - if (c[i] == cln && i != s) - ++cls; - else { - if (!cln && cls > 2) { - for (; cls > 138; cls -= 138) - w(32754); - if (cls > 2) { - w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305); - cls = 0; - } - } - else if (cls > 3) { - w(cln), --cls; - for (; cls > 6; cls -= 6) - w(8304); - if (cls > 2) - w(((cls - 3) << 5) | 8208), cls = 0; - } - while (cls--) - w(cln); - cls = 1; - cln = c[i]; - } - } - return { c: cl.subarray(0, cli), n: s }; -}; -// calculate the length of output from tree, code lengths -var clen = function (cf, cl) { - var l = 0; - for (var i = 0; i < cl.length; ++i) - l += cf[i] * cl[i]; - return l; -}; -// writes a fixed block -// returns the new bit pos -var wfblk = function (out, pos, dat) { - // no need to write 00 as type: TypedArray defaults to 0 - var s = dat.length; - var o = shft(pos + 2); - out[o] = s & 255; - out[o + 1] = s >> 8; - out[o + 2] = out[o] ^ 255; - out[o + 3] = out[o + 1] ^ 255; - for (var i = 0; i < s; ++i) - out[o + i + 4] = dat[i]; - return (o + 4 + s) * 8; -}; -// writes a block -var wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) { - wbits(out, p++, final); - ++lf[256]; - var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l; - var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l; - var _c = lc(dlt), lclt = _c.c, nlc = _c.n; - var _d = lc(ddt), lcdt = _d.c, ndc = _d.n; - var lcfreq = new u16(19); - for (var i = 0; i < lclt.length; ++i) - ++lcfreq[lclt[i] & 31]; - for (var i = 0; i < lcdt.length; ++i) - ++lcfreq[lcdt[i] & 31]; - var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l; - var nlcc = 19; - for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc) - ; - var flen = (bl + 5) << 3; - var ftlen = clen(lf, flt) + clen(df, fdt) + eb; - var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]; - if (bs >= 0 && flen <= ftlen && flen <= dtlen) - return wfblk(out, p, dat.subarray(bs, bs + bl)); - var lm, ll, dm, dl; - wbits(out, p, 1 + (dtlen < ftlen)), p += 2; - if (dtlen < ftlen) { - lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt; - var llm = hMap(lct, mlcb, 0); - wbits(out, p, nlc - 257); - wbits(out, p + 5, ndc - 1); - wbits(out, p + 10, nlcc - 4); - p += 14; - for (var i = 0; i < nlcc; ++i) - wbits(out, p + 3 * i, lct[clim[i]]); - p += 3 * nlcc; - var lcts = [lclt, lcdt]; - for (var it = 0; it < 2; ++it) { - var clct = lcts[it]; - for (var i = 0; i < clct.length; ++i) { - var len = clct[i] & 31; - wbits(out, p, llm[len]), p += lct[len]; - if (len > 15) - wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12; - } - } - } - else { - lm = flm, ll = flt, dm = fdm, dl = fdt; - } - for (var i = 0; i < li; ++i) { - var sym = syms[i]; - if (sym > 255) { - var len = (sym >> 18) & 31; - wbits16(out, p, lm[len + 257]), p += ll[len + 257]; - if (len > 7) - wbits(out, p, (sym >> 23) & 31), p += fleb[len]; - var dst = sym & 31; - wbits16(out, p, dm[dst]), p += dl[dst]; - if (dst > 3) - wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst]; - } - else { - wbits16(out, p, lm[sym]), p += ll[sym]; - } - } - wbits16(out, p, lm[256]); - return p + ll[256]; -}; -// deflate options (nice << 13) | chain -var deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]); -// empty -var et = /*#__PURE__*/ new u8(0); -// compresses data into a raw DEFLATE buffer -var dflt = function (dat, lvl, plvl, pre, post, st) { - var s = st.z || dat.length; - var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post); - // writing to this writes to the output buffer - var w = o.subarray(pre, o.length - post); - var lst = st.l; - var pos = (st.r || 0) & 7; - if (lvl) { - if (pos) - w[0] = st.r >> 3; - var opt = deo[lvl - 1]; - var n = opt >> 13, c = opt & 8191; - var msk_1 = (1 << plvl) - 1; - // prev 2-byte val map curr 2-byte val map - var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1); - var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1; - var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; }; - // 24576 is an arbitrary number of maximum symbols per block - // 424 buffer for last block - var syms = new i32(25000); - // length/literal freq distance freq - var lf = new u16(288), df = new u16(32); - // l/lcnt exbits index l/lind waitdx blkpos - var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0; - for (; i + 2 < s; ++i) { - // hash value - var hv = hsh(i); - // index mod 32768 previous index mod - var imod = i & 32767, pimod = head[hv]; - prev[imod] = pimod; - head[hv] = imod; - // We always should modify head and prev, but only add symbols if - // this data is not yet processed ("wait" for wait index) - if (wi <= i) { - // bytes remaining - var rem = s - i; - if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) { - pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos); - li = lc_1 = eb = 0, bs = i; - for (var j = 0; j < 286; ++j) - lf[j] = 0; - for (var j = 0; j < 30; ++j) - df[j] = 0; - } - // len dist chain - var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767; - if (rem > 2 && hv == hsh(i - dif)) { - var maxn = Math.min(n, rem) - 1; - var maxd = Math.min(32767, i); - // max possible length - // not capped at dif because decompressors implement "rolling" index population - var ml = Math.min(258, rem); - while (dif <= maxd && --ch_1 && imod != pimod) { - if (dat[i + l] == dat[i + l - dif]) { - var nl = 0; - for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl) - ; - if (nl > l) { - l = nl, d = dif; - // break out early when we reach "nice" (we are satisfied enough) - if (nl > maxn) - break; - // now, find the rarest 2-byte sequence within this - // length of literals and search for that instead. - // Much faster than just using the start - var mmd = Math.min(dif, nl - 2); - var md = 0; - for (var j = 0; j < mmd; ++j) { - var ti = i - dif + j & 32767; - var pti = prev[ti]; - var cd = ti - pti & 32767; - if (cd > md) - md = cd, pimod = ti; - } - } - } - // check the previous match - imod = pimod, pimod = prev[imod]; - dif += imod - pimod & 32767; - } - } - // d will be nonzero only when a match was found - if (d) { - // store both dist and len data in one int32 - // Make sure this is recognized as a len/dist with 28th bit (2^28) - syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d]; - var lin = revfl[l] & 31, din = revfd[d] & 31; - eb += fleb[lin] + fdeb[din]; - ++lf[257 + lin]; - ++df[din]; - wi = i + l; - ++lc_1; - } - else { - syms[li++] = dat[i]; - ++lf[dat[i]]; - } - } - } - for (i = Math.max(i, wi); i < s; ++i) { - syms[li++] = dat[i]; - ++lf[dat[i]]; - } - pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos); - if (!lst) { - st.r = (pos & 7) | w[(pos / 8) | 0] << 3; - // shft(pos) now 1 less if pos & 7 != 0 - pos -= 7; - st.h = head, st.p = prev, st.i = i, st.w = wi; - } - } - else { - for (var i = st.w || 0; i < s + lst; i += 65535) { - // end - var e = i + 65535; - if (e >= s) { - // write final block - w[(pos / 8) | 0] = lst; - e = s; - } - pos = wfblk(w, pos + 1, dat.subarray(i, e)); - } - st.i = s; - } - return slc(o, 0, pre + shft(pos) + post); -}; -// CRC32 table -var crct = /*#__PURE__*/ (function () { - var t = new Int32Array(256); - for (var i = 0; i < 256; ++i) { - var c = i, k = 9; - while (--k) - c = ((c & 1) && -306674912) ^ (c >>> 1); - t[i] = c; - } - return t; -})(); -// CRC32 -var crc = function () { - var c = -1; - return { - p: function (d) { - // closures have awful performance - var cr = c; - for (var i = 0; i < d.length; ++i) - cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8); - c = cr; - }, - d: function () { return ~c; } - }; -}; -// Adler32 -var adler = function () { - var a = 1, b = 0; - return { - p: function (d) { - // closures have awful performance - var n = a, m = b; - var l = d.length | 0; - for (var i = 0; i != l;) { - var e = Math.min(i + 2655, l); - for (; i < e; ++i) - m += n += d[i]; - n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16); - } - a = n, b = m; - }, - d: function () { - a %= 65521, b %= 65521; - return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8); - } - }; -}; -; -// deflate with opts -var dopt = function (dat, opt, pre, post, st) { - if (!st) { - st = { l: 1 }; - if (opt.dictionary) { - var dict = opt.dictionary.subarray(-32768); - var newDat = new u8(dict.length + dat.length); - newDat.set(dict); - newDat.set(dat, dict.length); - dat = newDat; - st.w = dict.length; - } - } - return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st); -}; -// Walmart object spread -var mrg = function (a, b) { - var o = {}; - for (var k in a) - o[k] = a[k]; - for (var k in b) - o[k] = b[k]; - return o; -}; -// worker clone -// This is possibly the craziest part of the entire codebase, despite how simple it may seem. -// The only parameter to this function is a closure that returns an array of variables outside of the function scope. -// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization. -// We will return an object mapping of true variable name to value (basically, the current scope as a JS object). -// The reason we can't just use the original variable names is minifiers mangling the toplevel scope. -// This took me three weeks to figure out how to do. -var wcln = function (fn, fnStr, td) { - var dt = fn(); - var st = fn.toString(); - var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\s+/g, '').split(','); - for (var i = 0; i < dt.length; ++i) { - var v = dt[i], k = ks[i]; - if (typeof v == 'function') { - fnStr += ';' + k + '='; - var st_1 = v.toString(); - if (v.prototype) { - // for global objects - if (st_1.indexOf('[native code]') != -1) { - var spInd = st_1.indexOf(' ', 8) + 1; - fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd)); - } - else { - fnStr += st_1; - for (var t in v.prototype) - fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString(); - } - } - else - fnStr += st_1; - } - else - td[k] = v; - } - return fnStr; -}; -var ch = []; -// clone bufs -var cbfs = function (v) { - var tl = []; - for (var k in v) { - if (v[k].buffer) { - tl.push((v[k] = new v[k].constructor(v[k])).buffer); - } - } - return tl; -}; -// use a worker to execute code -var wrkr = function (fns, init, id, cb) { - if (!ch[id]) { - var fnStr = '', td_1 = {}, m = fns.length - 1; - for (var i = 0; i < m; ++i) - fnStr = wcln(fns[i], fnStr, td_1); - ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 }; - } - var td = mrg({}, ch[id].e); - return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb); -}; -// base async inflate fn -var bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; }; -var bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; }; -// gzip extra -var gze = function () { return [gzh, gzhl, wbytes, crc, crct]; }; -// gunzip extra -var guze = function () { return [gzs, gzl]; }; -// zlib extra -var zle = function () { return [zlh, wbytes, adler]; }; -// unzlib extra -var zule = function () { return [zls]; }; -// post buf -var pbf = function (msg) { return postMessage(msg, [msg.buffer]); }; -// get opts -var gopt = function (o) { return o && { - out: o.size && new u8(o.size), - dictionary: o.dictionary -}; }; -// async helper -var cbify = function (dat, opts, fns, init, id, cb) { - var w = wrkr(fns, init, id, function (err, dat) { - w.terminate(); - cb(err, dat); - }); - w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []); - return function () { w.terminate(); }; -}; -// auto stream -var astrm = function (strm) { - strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); }; - return function (ev) { - if (ev.data.length) { - strm.push(ev.data[0], ev.data[1]); - postMessage([ev.data[0].length]); - } - else - strm.flush(); - }; -}; -// async stream attach -var astrmify = function (fns, strm, opts, init, id, flush, ext) { - var t; - var w = wrkr(fns, init, id, function (err, dat) { - if (err) - w.terminate(), strm.ondata.call(strm, err); - else if (!Array.isArray(dat)) - ext(dat); - else if (dat.length == 1) { - strm.queuedSize -= dat[0]; - if (strm.ondrain) - strm.ondrain(dat[0]); - } - else { - if (dat[1]) - w.terminate(); - strm.ondata.call(strm, err, dat[0], dat[1]); - } - }); - w.postMessage(opts); - strm.queuedSize = 0; - strm.push = function (d, f) { - if (!strm.ondata) - err(5); - if (t) - strm.ondata(err(4, 0, 1), null, !!f); - strm.queuedSize += d.length; - w.postMessage([d, t = f], [d.buffer]); - }; - strm.terminate = function () { w.terminate(); }; - if (flush) { - strm.flush = function () { w.postMessage([]); }; - } -}; -// read 2 bytes -var b2 = function (d, b) { return d[b] | (d[b + 1] << 8); }; -// read 4 bytes -var b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; }; -var b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); }; -// write bytes -var wbytes = function (d, b, v) { - for (; v; ++b) - d[b] = v, v >>>= 8; -}; -// gzip header -var gzh = function (c, o) { - var fn = o.filename; - c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix - if (o.mtime != 0) - wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000)); - if (fn) { - c[3] = 8; - for (var i = 0; i <= fn.length; ++i) - c[i + 10] = fn.charCodeAt(i); - } -}; -// gzip footer: -8 to -4 = CRC, -4 to -0 is length -// gzip start -var gzs = function (d) { - if (d[0] != 31 || d[1] != 139 || d[2] != 8) - err(6, 'invalid gzip data'); - var flg = d[3]; - var st = 10; - if (flg & 4) - st += (d[10] | d[11] << 8) + 2; - for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) - ; - return st + (flg & 2); -}; -// gzip length -var gzl = function (d) { - var l = d.length; - return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0; -}; -// gzip header length -var gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); }; -// zlib header -var zlh = function (c, o) { - var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2; - c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32); - c[1] |= 31 - ((c[0] << 8) | c[1]) % 31; - if (o.dictionary) { - var h = adler(); - h.p(o.dictionary); - wbytes(c, 2, h.d()); - } -}; -// zlib start -var zls = function (d, dict) { - if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31)) - err(6, 'invalid zlib data'); - if ((d[1] >> 5 & 1) == +!dict) - err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary'); - return (d[1] >> 3 & 4) + 2; -}; -function StrmOpt(opts, cb) { - if (typeof opts == 'function') - cb = opts, opts = {}; - this.ondata = cb; - return opts; -} -/** - * Streaming DEFLATE compression - */ -var Deflate = /*#__PURE__*/ (function () { - function Deflate(opts, cb) { - if (typeof opts == 'function') - cb = opts, opts = {}; - this.ondata = cb; - this.o = opts || {}; - this.s = { l: 0, i: 32768, w: 32768, z: 32768 }; - // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev - // 98304 = 32768 (lookback) + 65536 (common chunk size) - this.b = new u8(98304); - if (this.o.dictionary) { - var dict = this.o.dictionary.subarray(-32768); - this.b.set(dict, 32768 - dict.length); - this.s.i = 32768 - dict.length; - } - } - Deflate.prototype.p = function (c, f) { - this.ondata(dopt(c, this.o, 0, 0, this.s), f); - }; - /** - * Pushes a chunk to be deflated - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Deflate.prototype.push = function (chunk, final) { - if (!this.ondata) - err(5); - if (this.s.l) - err(4); - var endLen = chunk.length + this.s.z; - if (endLen > this.b.length) { - if (endLen > 2 * this.b.length - 32768) { - var newBuf = new u8(endLen & -32768); - newBuf.set(this.b.subarray(0, this.s.z)); - this.b = newBuf; - } - var split = this.b.length - this.s.z; - this.b.set(chunk.subarray(0, split), this.s.z); - this.s.z = this.b.length; - this.p(this.b, false); - this.b.set(this.b.subarray(-32768)); - this.b.set(chunk.subarray(split), 32768); - this.s.z = chunk.length - split + 32768; - this.s.i = 32766, this.s.w = 32768; - } - else { - this.b.set(chunk, this.s.z); - this.s.z += chunk.length; - } - this.s.l = final & 1; - if (this.s.z > this.s.w + 8191 || final) { - this.p(this.b, final || false); - this.s.w = this.s.i, this.s.i -= 2; - } - }; - /** - * Flushes buffered uncompressed data. Useful to immediately retrieve the - * deflated output for small inputs. - */ - Deflate.prototype.flush = function () { - if (!this.ondata) - err(5); - if (this.s.l) - err(4); - this.p(this.b, false); - this.s.w = this.s.i, this.s.i -= 2; - }; - return Deflate; -}()); -export { Deflate }; -/** - * Asynchronous streaming DEFLATE compression - */ -var AsyncDeflate = /*#__PURE__*/ (function () { - function AsyncDeflate(opts, cb) { - astrmify([ - bDflt, - function () { return [astrm, Deflate]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Deflate(ev.data); - onmessage = astrm(strm); - }, 6, 1); - } - return AsyncDeflate; -}()); -export { AsyncDeflate }; -export function deflate(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bDflt, - ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb); -} -/** - * Compresses data with DEFLATE without any wrapper - * @param data The data to compress - * @param opts The compression options - * @returns The deflated version of the data - */ -export function deflateSync(data, opts) { - return dopt(data, opts || {}, 0, 0); -} -/** - * Streaming DEFLATE decompression - */ -var Inflate = /*#__PURE__*/ (function () { - function Inflate(opts, cb) { - // no StrmOpt here to avoid adding to workerizer - if (typeof opts == 'function') - cb = opts, opts = {}; - this.ondata = cb; - var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768); - this.s = { i: 0, b: dict ? dict.length : 0 }; - this.o = new u8(32768); - this.p = new u8(0); - if (dict) - this.o.set(dict); - } - Inflate.prototype.e = function (c) { - if (!this.ondata) - err(5); - if (this.d) - err(4); - if (!this.p.length) - this.p = c; - else if (c.length) { - var n = new u8(this.p.length + c.length); - n.set(this.p), n.set(c, this.p.length), this.p = n; - } - }; - Inflate.prototype.c = function (final) { - this.s.i = +(this.d = final || false); - var bts = this.s.b; - var dt = inflt(this.p, this.s, this.o); - this.ondata(slc(dt, bts, this.s.b), this.d); - this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length; - this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7; - }; - /** - * Pushes a chunk to be inflated - * @param chunk The chunk to push - * @param final Whether this is the final chunk - */ - Inflate.prototype.push = function (chunk, final) { - this.e(chunk), this.c(final); - }; - return Inflate; -}()); -export { Inflate }; -/** - * Asynchronous streaming DEFLATE decompression - */ -var AsyncInflate = /*#__PURE__*/ (function () { - function AsyncInflate(opts, cb) { - astrmify([ - bInflt, - function () { return [astrm, Inflate]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Inflate(ev.data); - onmessage = astrm(strm); - }, 7, 0); - } - return AsyncInflate; -}()); -export { AsyncInflate }; -export function inflate(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bInflt - ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb); -} -/** - * Expands DEFLATE data with no wrapper - * @param data The data to decompress - * @param opts The decompression options - * @returns The decompressed version of the data - */ -export function inflateSync(data, opts) { - return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary); -} -// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize. -/** - * Streaming GZIP compression - */ -var Gzip = /*#__PURE__*/ (function () { - function Gzip(opts, cb) { - this.c = crc(); - this.l = 0; - this.v = 1; - Deflate.call(this, opts, cb); - } - /** - * Pushes a chunk to be GZIPped - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Gzip.prototype.push = function (chunk, final) { - this.c.p(chunk); - this.l += chunk.length; - Deflate.prototype.push.call(this, chunk, final); - }; - Gzip.prototype.p = function (c, f) { - var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s); - if (this.v) - gzh(raw, this.o), this.v = 0; - if (f) - wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l); - this.ondata(raw, f); - }; - /** - * Flushes buffered uncompressed data. Useful to immediately retrieve the - * GZIPped output for small inputs. - */ - Gzip.prototype.flush = function () { - Deflate.prototype.flush.call(this); - }; - return Gzip; -}()); -export { Gzip }; -/** - * Asynchronous streaming GZIP compression - */ -var AsyncGzip = /*#__PURE__*/ (function () { - function AsyncGzip(opts, cb) { - astrmify([ - bDflt, - gze, - function () { return [astrm, Deflate, Gzip]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Gzip(ev.data); - onmessage = astrm(strm); - }, 8, 1); - } - return AsyncGzip; -}()); -export { AsyncGzip }; -export function gzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bDflt, - gze, - function () { return [gzipSync]; } - ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb); -} -/** - * Compresses data with GZIP - * @param data The data to compress - * @param opts The compression options - * @returns The gzipped version of the data - */ -export function gzipSync(data, opts) { - if (!opts) - opts = {}; - var c = crc(), l = data.length; - c.p(data); - var d = dopt(data, opts, gzhl(opts), 8), s = d.length; - return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d; -} -/** - * Streaming single or multi-member GZIP decompression - */ -var Gunzip = /*#__PURE__*/ (function () { - function Gunzip(opts, cb) { - this.v = 1; - this.r = 0; - Inflate.call(this, opts, cb); - } - /** - * Pushes a chunk to be GUNZIPped - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Gunzip.prototype.push = function (chunk, final) { - Inflate.prototype.e.call(this, chunk); - this.r += chunk.length; - if (this.v) { - var p = this.p.subarray(this.v - 1); - var s = p.length > 3 ? gzs(p) : 4; - if (s > p.length) { - if (!final) - return; - } - else if (this.v > 1 && this.onmember) { - this.onmember(this.r - p.length); - } - this.p = p.subarray(s), this.v = 0; - } - // necessary to prevent TS from using the closure value - // This allows for workerization to function correctly - Inflate.prototype.c.call(this, final); - // process concatenated GZIP - if (this.s.f && !this.s.l && !final) { - this.v = shft(this.s.p) + 9; - this.s = { i: 0 }; - this.o = new u8(0); - this.push(new u8(0), final); - } - }; - return Gunzip; -}()); -export { Gunzip }; -/** - * Asynchronous streaming single or multi-member GZIP decompression - */ -var AsyncGunzip = /*#__PURE__*/ (function () { - function AsyncGunzip(opts, cb) { - var _this = this; - astrmify([ - bInflt, - guze, - function () { return [astrm, Inflate, Gunzip]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Gunzip(ev.data); - strm.onmember = function (offset) { return postMessage(offset); }; - onmessage = astrm(strm); - }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); }); - } - return AsyncGunzip; -}()); -export { AsyncGunzip }; -export function gunzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bInflt, - guze, - function () { return [gunzipSync]; } - ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb); -} -/** - * Expands GZIP data - * @param data The data to decompress - * @param opts The decompression options - * @returns The decompressed version of the data - */ -export function gunzipSync(data, opts) { - var st = gzs(data); - if (st + 8 > data.length) - err(6, 'invalid gzip data'); - return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary); -} -/** - * Streaming Zlib compression - */ -var Zlib = /*#__PURE__*/ (function () { - function Zlib(opts, cb) { - this.c = adler(); - this.v = 1; - Deflate.call(this, opts, cb); - } - /** - * Pushes a chunk to be zlibbed - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Zlib.prototype.push = function (chunk, final) { - this.c.p(chunk); - Deflate.prototype.push.call(this, chunk, final); - }; - Zlib.prototype.p = function (c, f) { - var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s); - if (this.v) - zlh(raw, this.o), this.v = 0; - if (f) - wbytes(raw, raw.length - 4, this.c.d()); - this.ondata(raw, f); - }; - /** - * Flushes buffered uncompressed data. Useful to immediately retrieve the - * zlibbed output for small inputs. - */ - Zlib.prototype.flush = function () { - Deflate.prototype.flush.call(this); - }; - return Zlib; -}()); -export { Zlib }; -/** - * Asynchronous streaming Zlib compression - */ -var AsyncZlib = /*#__PURE__*/ (function () { - function AsyncZlib(opts, cb) { - astrmify([ - bDflt, - zle, - function () { return [astrm, Deflate, Zlib]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Zlib(ev.data); - onmessage = astrm(strm); - }, 10, 1); - } - return AsyncZlib; -}()); -export { AsyncZlib }; -export function zlib(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bDflt, - zle, - function () { return [zlibSync]; } - ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb); -} -/** - * Compress data with Zlib - * @param data The data to compress - * @param opts The compression options - * @returns The zlib-compressed version of the data - */ -export function zlibSync(data, opts) { - if (!opts) - opts = {}; - var a = adler(); - a.p(data); - var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4); - return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d; -} -/** - * Streaming Zlib decompression - */ -var Unzlib = /*#__PURE__*/ (function () { - function Unzlib(opts, cb) { - Inflate.call(this, opts, cb); - this.v = opts && opts.dictionary ? 2 : 1; - } - /** - * Pushes a chunk to be unzlibbed - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Unzlib.prototype.push = function (chunk, final) { - Inflate.prototype.e.call(this, chunk); - if (this.v) { - if (this.p.length < 6 && !final) - return; - this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0; - } - if (final) { - if (this.p.length < 4) - err(6, 'invalid zlib data'); - this.p = this.p.subarray(0, -4); - } - // necessary to prevent TS from using the closure value - // This allows for workerization to function correctly - Inflate.prototype.c.call(this, final); - }; - return Unzlib; -}()); -export { Unzlib }; -/** - * Asynchronous streaming Zlib decompression - */ -var AsyncUnzlib = /*#__PURE__*/ (function () { - function AsyncUnzlib(opts, cb) { - astrmify([ - bInflt, - zule, - function () { return [astrm, Inflate, Unzlib]; } - ], this, StrmOpt.call(this, opts, cb), function (ev) { - var strm = new Unzlib(ev.data); - onmessage = astrm(strm); - }, 11, 0); - } - return AsyncUnzlib; -}()); -export { AsyncUnzlib }; -export function unzlib(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return cbify(data, opts, [ - bInflt, - zule, - function () { return [unzlibSync]; } - ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb); -} -/** - * Expands Zlib data - * @param data The data to decompress - * @param opts The decompression options - * @returns The decompressed version of the data - */ -export function unzlibSync(data, opts) { - return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary); -} -// Default algorithm for compression (used because having a known output size allows faster decompression) -export { gzip as compress, AsyncGzip as AsyncCompress }; -export { gzipSync as compressSync, Gzip as Compress }; -/** - * Streaming GZIP, Zlib, or raw DEFLATE decompression - */ -var Decompress = /*#__PURE__*/ (function () { - function Decompress(opts, cb) { - this.o = StrmOpt.call(this, opts, cb) || {}; - this.G = Gunzip; - this.I = Inflate; - this.Z = Unzlib; - } - // init substream - // overriden by AsyncDecompress - Decompress.prototype.i = function () { - var _this = this; - this.s.ondata = function (dat, final) { - _this.ondata(dat, final); - }; - }; - /** - * Pushes a chunk to be decompressed - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Decompress.prototype.push = function (chunk, final) { - if (!this.ondata) - err(5); - if (!this.s) { - if (this.p && this.p.length) { - var n = new u8(this.p.length + chunk.length); - n.set(this.p), n.set(chunk, this.p.length); - } - else - this.p = chunk; - if (this.p.length > 2) { - this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8) - ? new this.G(this.o) - : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31)) - ? new this.I(this.o) - : new this.Z(this.o); - this.i(); - this.s.push(this.p, final); - this.p = null; - } - } - else - this.s.push(chunk, final); - }; - return Decompress; -}()); -export { Decompress }; -/** - * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression - */ -var AsyncDecompress = /*#__PURE__*/ (function () { - function AsyncDecompress(opts, cb) { - Decompress.call(this, opts, cb); - this.queuedSize = 0; - this.G = AsyncGunzip; - this.I = AsyncInflate; - this.Z = AsyncUnzlib; - } - AsyncDecompress.prototype.i = function () { - var _this = this; - this.s.ondata = function (err, dat, final) { - _this.ondata(err, dat, final); - }; - this.s.ondrain = function (size) { - _this.queuedSize -= size; - if (_this.ondrain) - _this.ondrain(size); - }; - }; - /** - * Pushes a chunk to be decompressed - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - AsyncDecompress.prototype.push = function (chunk, final) { - this.queuedSize += chunk.length; - Decompress.prototype.push.call(this, chunk, final); - }; - return AsyncDecompress; -}()); -export { AsyncDecompress }; -export function decompress(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - return (data[0] == 31 && data[1] == 139 && data[2] == 8) - ? gunzip(data, opts, cb) - : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31)) - ? inflate(data, opts, cb) - : unzlib(data, opts, cb); -} -/** - * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format - * @param data The data to decompress - * @param opts The decompression options - * @returns The decompressed version of the data - */ -export function decompressSync(data, opts) { - return (data[0] == 31 && data[1] == 139 && data[2] == 8) - ? gunzipSync(data, opts) - : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31)) - ? inflateSync(data, opts) - : unzlibSync(data, opts); -} -// flatten a directory structure -var fltn = function (d, p, t, o) { - for (var k in d) { - var val = d[k], n = p + k, op = o; - if (Array.isArray(val)) - op = mrg(o, val[1]), val = val[0]; - if (val instanceof u8) - t[n] = [val, op]; - else { - t[n += '/'] = [new u8(0), op]; - fltn(val, n, t, o); - } - } -}; -// text encoder -var te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder(); -// text decoder -var td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder(); -// text decoder stream -var tds = 0; -try { - td.decode(et, { stream: true }); - tds = 1; -} -catch (e) { } -// decode UTF8 -var dutf8 = function (d) { - for (var r = '', i = 0;;) { - var c = d[i++]; - var eb = (c > 127) + (c > 223) + (c > 239); - if (i + eb > d.length) - return { s: r, r: slc(d, i - 1) }; - if (!eb) - r += String.fromCharCode(c); - else if (eb == 3) { - c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536, - r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023)); - } - else if (eb & 1) - r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63)); - else - r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)); - } -}; -/** - * Streaming UTF-8 decoding - */ -var DecodeUTF8 = /*#__PURE__*/ (function () { - /** - * Creates a UTF-8 decoding stream - * @param cb The callback to call whenever data is decoded - */ - function DecodeUTF8(cb) { - this.ondata = cb; - if (tds) - this.t = new TextDecoder(); - else - this.p = et; - } - /** - * Pushes a chunk to be decoded from UTF-8 binary - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - DecodeUTF8.prototype.push = function (chunk, final) { - if (!this.ondata) - err(5); - final = !!final; - if (this.t) { - this.ondata(this.t.decode(chunk, { stream: true }), final); - if (final) { - if (this.t.decode().length) - err(8); - this.t = null; - } - return; - } - if (!this.p) - err(4); - var dat = new u8(this.p.length + chunk.length); - dat.set(this.p); - dat.set(chunk, this.p.length); - var _a = dutf8(dat), s = _a.s, r = _a.r; - if (final) { - if (r.length) - err(8); - this.p = null; - } - else - this.p = r; - this.ondata(s, final); - }; - return DecodeUTF8; -}()); -export { DecodeUTF8 }; -/** - * Streaming UTF-8 encoding - */ -var EncodeUTF8 = /*#__PURE__*/ (function () { - /** - * Creates a UTF-8 decoding stream - * @param cb The callback to call whenever data is encoded - */ - function EncodeUTF8(cb) { - this.ondata = cb; - } - /** - * Pushes a chunk to be encoded to UTF-8 - * @param chunk The string data to push - * @param final Whether this is the last chunk - */ - EncodeUTF8.prototype.push = function (chunk, final) { - if (!this.ondata) - err(5); - if (this.d) - err(4); - this.ondata(strToU8(chunk), this.d = final || false); - }; - return EncodeUTF8; -}()); -export { EncodeUTF8 }; -/** - * Converts a string into a Uint8Array for use with compression/decompression methods - * @param str The string to encode - * @param latin1 Whether or not to interpret the data as Latin-1. This should - * not need to be true unless decoding a binary string. - * @returns The string encoded in UTF-8/Latin-1 binary - */ -export function strToU8(str, latin1) { - if (latin1) { - var ar_1 = new u8(str.length); - for (var i = 0; i < str.length; ++i) - ar_1[i] = str.charCodeAt(i); - return ar_1; - } - if (te) - return te.encode(str); - var l = str.length; - var ar = new u8(str.length + (str.length >> 1)); - var ai = 0; - var w = function (v) { ar[ai++] = v; }; - for (var i = 0; i < l; ++i) { - if (ai + 5 > ar.length) { - var n = new u8(ai + 8 + ((l - i) << 1)); - n.set(ar); - ar = n; - } - var c = str.charCodeAt(i); - if (c < 128 || latin1) - w(c); - else if (c < 2048) - w(192 | (c >> 6)), w(128 | (c & 63)); - else if (c > 55295 && c < 57344) - c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023), - w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63)); - else - w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63)); - } - return slc(ar, 0, ai); -} -/** - * Converts a Uint8Array to a string - * @param dat The data to decode to string - * @param latin1 Whether or not to interpret the data as Latin-1. This should - * not need to be true unless encoding to binary string. - * @returns The original UTF-8/Latin-1 string - */ -export function strFromU8(dat, latin1) { - if (latin1) { - var r = ''; - for (var i = 0; i < dat.length; i += 16384) - r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384)); - return r; - } - else if (td) { - return td.decode(dat); - } - else { - var _a = dutf8(dat), s = _a.s, r = _a.r; - if (r.length) - err(8); - return s; - } -} -; -// deflate bit flag -var dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; }; -// skip local zip header -var slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); }; -// read zip header -var zh = function (d, b, z) { - var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20); - var _a = z && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a[0], su = _a[1], off = _a[2]; - return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off]; -}; -// read zip64 extra field -var z64e = function (d, b) { - for (; b2(d, b) != 1; b += 4 + b2(d, b + 2)) - ; - return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)]; -}; -// extra field length -var exfl = function (ex) { - var le = 0; - if (ex) { - for (var k in ex) { - var l = ex[k].length; - if (l > 65535) - err(9); - le += l + 4; - } - } - return le; -}; -// write zip header -var wzh = function (d, b, f, fn, u, c, ce, co) { - var fl = fn.length, ex = f.extra, col = co && co.length; - var exl = exfl(ex); - wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4; - if (ce != null) - d[b++] = 20, d[b++] = f.os; - d[b] = 20, b += 2; // spec compliance? what's that? - d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8; - d[b++] = f.compression & 255, d[b++] = f.compression >> 8; - var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980; - if (y < 0 || y > 119) - err(10); - wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4; - if (c != -1) { - wbytes(d, b, f.crc); - wbytes(d, b + 4, c < 0 ? -c - 2 : c); - wbytes(d, b + 8, f.size); - } - wbytes(d, b + 12, fl); - wbytes(d, b + 14, exl), b += 16; - if (ce != null) { - wbytes(d, b, col); - wbytes(d, b + 6, f.attrs); - wbytes(d, b + 10, ce), b += 14; - } - d.set(fn, b); - b += fl; - if (exl) { - for (var k in ex) { - var exf = ex[k], l = exf.length; - wbytes(d, b, +k); - wbytes(d, b + 2, l); - d.set(exf, b + 4), b += 4 + l; - } - } - if (col) - d.set(co, b), b += col; - return b; -}; -// write zip footer (end of central directory) -var wzf = function (o, b, c, d, e) { - wbytes(o, b, 0x6054B50); // skip disk - wbytes(o, b + 8, c); - wbytes(o, b + 10, c); - wbytes(o, b + 12, d); - wbytes(o, b + 16, e); -}; -/** - * A pass-through stream to keep data uncompressed in a ZIP archive. - */ -var ZipPassThrough = /*#__PURE__*/ (function () { - /** - * Creates a pass-through stream that can be added to ZIP archives - * @param filename The filename to associate with this data stream - */ - function ZipPassThrough(filename) { - this.filename = filename; - this.c = crc(); - this.size = 0; - this.compression = 0; - } - /** - * Processes a chunk and pushes to the output stream. You can override this - * method in a subclass for custom behavior, but by default this passes - * the data through. You must call this.ondata(err, chunk, final) at some - * point in this method. - * @param chunk The chunk to process - * @param final Whether this is the last chunk - */ - ZipPassThrough.prototype.process = function (chunk, final) { - this.ondata(null, chunk, final); - }; - /** - * Pushes a chunk to be added. If you are subclassing this with a custom - * compression algorithm, note that you must push data from the source - * file only, pre-compression. - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - ZipPassThrough.prototype.push = function (chunk, final) { - if (!this.ondata) - err(5); - this.c.p(chunk); - this.size += chunk.length; - if (final) - this.crc = this.c.d(); - this.process(chunk, final || false); - }; - return ZipPassThrough; -}()); -export { ZipPassThrough }; -// I don't extend because TypeScript extension adds 1kB of runtime bloat -/** - * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate - * for better performance - */ -var ZipDeflate = /*#__PURE__*/ (function () { - /** - * Creates a DEFLATE stream that can be added to ZIP archives - * @param filename The filename to associate with this data stream - * @param opts The compression options - */ - function ZipDeflate(filename, opts) { - var _this = this; - if (!opts) - opts = {}; - ZipPassThrough.call(this, filename); - this.d = new Deflate(opts, function (dat, final) { - _this.ondata(null, dat, final); - }); - this.compression = 8; - this.flag = dbf(opts.level); - } - ZipDeflate.prototype.process = function (chunk, final) { - try { - this.d.push(chunk, final); - } - catch (e) { - this.ondata(e, null, final); - } - }; - /** - * Pushes a chunk to be deflated - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - ZipDeflate.prototype.push = function (chunk, final) { - ZipPassThrough.prototype.push.call(this, chunk, final); - }; - return ZipDeflate; -}()); -export { ZipDeflate }; -/** - * Asynchronous streaming DEFLATE compression for ZIP archives - */ -var AsyncZipDeflate = /*#__PURE__*/ (function () { - /** - * Creates an asynchronous DEFLATE stream that can be added to ZIP archives - * @param filename The filename to associate with this data stream - * @param opts The compression options - */ - function AsyncZipDeflate(filename, opts) { - var _this = this; - if (!opts) - opts = {}; - ZipPassThrough.call(this, filename); - this.d = new AsyncDeflate(opts, function (err, dat, final) { - _this.ondata(err, dat, final); - }); - this.compression = 8; - this.flag = dbf(opts.level); - this.terminate = this.d.terminate; - } - AsyncZipDeflate.prototype.process = function (chunk, final) { - this.d.push(chunk, final); - }; - /** - * Pushes a chunk to be deflated - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - AsyncZipDeflate.prototype.push = function (chunk, final) { - ZipPassThrough.prototype.push.call(this, chunk, final); - }; - return AsyncZipDeflate; -}()); -export { AsyncZipDeflate }; -// TODO: Better tree shaking -/** - * A zippable archive to which files can incrementally be added - */ -var Zip = /*#__PURE__*/ (function () { - /** - * Creates an empty ZIP archive to which files can be added - * @param cb The callback to call whenever data for the generated ZIP archive - * is available - */ - function Zip(cb) { - this.ondata = cb; - this.u = []; - this.d = 1; - } - /** - * Adds a file to the ZIP archive - * @param file The file stream to add - */ - Zip.prototype.add = function (file) { - var _this = this; - if (!this.ondata) - err(5); - // finishing or finished - if (this.d & 2) - this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false); - else { - var f = strToU8(file.filename), fl_1 = f.length; - var com = file.comment, o = com && strToU8(com); - var u = fl_1 != file.filename.length || (o && (com.length != o.length)); - var hl_1 = fl_1 + exfl(file.extra) + 30; - if (fl_1 > 65535) - this.ondata(err(11, 0, 1), null, false); - var header = new u8(hl_1); - wzh(header, 0, file, f, u, -1); - var chks_1 = [header]; - var pAll_1 = function () { - for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) { - var chk = chks_2[_i]; - _this.ondata(null, chk, false); - } - chks_1 = []; - }; - var tr_1 = this.d; - this.d = 0; - var ind_1 = this.u.length; - var uf_1 = mrg(file, { - f: f, - u: u, - o: o, - t: function () { - if (file.terminate) - file.terminate(); - }, - r: function () { - pAll_1(); - if (tr_1) { - var nxt = _this.u[ind_1 + 1]; - if (nxt) - nxt.r(); - else - _this.d = 1; - } - tr_1 = 1; - } - }); - var cl_1 = 0; - file.ondata = function (err, dat, final) { - if (err) { - _this.ondata(err, dat, final); - _this.terminate(); - } - else { - cl_1 += dat.length; - chks_1.push(dat); - if (final) { - var dd = new u8(16); - wbytes(dd, 0, 0x8074B50); - wbytes(dd, 4, file.crc); - wbytes(dd, 8, cl_1); - wbytes(dd, 12, file.size); - chks_1.push(dd); - uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size; - if (tr_1) - uf_1.r(); - tr_1 = 1; - } - else if (tr_1) - pAll_1(); - } - }; - this.u.push(uf_1); - } - }; - /** - * Ends the process of adding files and prepares to emit the final chunks. - * This *must* be called after adding all desired files for the resulting - * ZIP file to work properly. - */ - Zip.prototype.end = function () { - var _this = this; - if (this.d & 2) { - this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true); - return; - } - if (this.d) - this.e(); - else - this.u.push({ - r: function () { - if (!(_this.d & 1)) - return; - _this.u.splice(-1, 1); - _this.e(); - }, - t: function () { } - }); - this.d = 3; - }; - Zip.prototype.e = function () { - var bt = 0, l = 0, tl = 0; - for (var _i = 0, _a = this.u; _i < _a.length; _i++) { - var f = _a[_i]; - tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0); - } - var out = new u8(tl + 22); - for (var _b = 0, _c = this.u; _b < _c.length; _b++) { - var f = _c[_b]; - wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o); - bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b; - } - wzf(out, bt, this.u.length, tl, l); - this.ondata(null, out, true); - this.d = 2; - }; - /** - * A method to terminate any internal workers used by the stream. Subsequent - * calls to add() will fail. - */ - Zip.prototype.terminate = function () { - for (var _i = 0, _a = this.u; _i < _a.length; _i++) { - var f = _a[_i]; - f.t(); - } - this.d = 2; - }; - return Zip; -}()); -export { Zip }; -export function zip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - var r = {}; - fltn(data, '', r, opts); - var k = Object.keys(r); - var lft = k.length, o = 0, tot = 0; - var slft = lft, files = new Array(lft); - var term = []; - var tAll = function () { - for (var i = 0; i < term.length; ++i) - term[i](); - }; - var cbd = function (a, b) { - mt(function () { cb(a, b); }); - }; - mt(function () { cbd = cb; }); - var cbf = function () { - var out = new u8(tot + 22), oe = o, cdl = tot - o; - tot = 0; - for (var i = 0; i < slft; ++i) { - var f = files[i]; - try { - var l = f.c.length; - wzh(out, tot, f, f.f, f.u, l); - var badd = 30 + f.f.length + exfl(f.extra); - var loc = tot + badd; - out.set(f.c, loc); - wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l; - } - catch (e) { - return cbd(e, null); - } - } - wzf(out, o, files.length, cdl, oe); - cbd(null, out); - }; - if (!lft) - cbf(); - var _loop_1 = function (i) { - var fn = k[i]; - var _a = r[fn], file = _a[0], p = _a[1]; - var c = crc(), size = file.length; - c.p(file); - var f = strToU8(fn), s = f.length; - var com = p.comment, m = com && strToU8(com), ms = m && m.length; - var exl = exfl(p.extra); - var compression = p.level == 0 ? 0 : 8; - var cbl = function (e, d) { - if (e) { - tAll(); - cbd(e, null); - } - else { - var l = d.length; - files[i] = mrg(p, { - size: size, - crc: c.d(), - c: d, - f: f, - m: m, - u: s != fn.length || (m && (com.length != ms)), - compression: compression - }); - o += 30 + s + exl + l; - tot += 76 + 2 * (s + exl) + (ms || 0) + l; - if (!--lft) - cbf(); - } - }; - if (s > 65535) - cbl(err(11, 0, 1), null); - if (!compression) - cbl(null, file); - else if (size < 160000) { - try { - cbl(null, deflateSync(file, p)); - } - catch (e) { - cbl(e, null); - } - } - else - term.push(deflate(file, p, cbl)); - }; - // Cannot use lft because it can decrease - for (var i = 0; i < slft; ++i) { - _loop_1(i); - } - return tAll; -} -/** - * Synchronously creates a ZIP file. Prefer using `zip` for better performance - * with more than one file. - * @param data The directory structure for the ZIP archive - * @param opts The main options, merged with per-file options - * @returns The generated ZIP archive - */ -export function zipSync(data, opts) { - if (!opts) - opts = {}; - var r = {}; - var files = []; - fltn(data, '', r, opts); - var o = 0; - var tot = 0; - for (var fn in r) { - var _a = r[fn], file = _a[0], p = _a[1]; - var compression = p.level == 0 ? 0 : 8; - var f = strToU8(fn), s = f.length; - var com = p.comment, m = com && strToU8(com), ms = m && m.length; - var exl = exfl(p.extra); - if (s > 65535) - err(11); - var d = compression ? deflateSync(file, p) : file, l = d.length; - var c = crc(); - c.p(file); - files.push(mrg(p, { - size: file.length, - crc: c.d(), - c: d, - f: f, - m: m, - u: s != fn.length || (m && (com.length != ms)), - o: o, - compression: compression - })); - o += 30 + s + exl + l; - tot += 76 + 2 * (s + exl) + (ms || 0) + l; - } - var out = new u8(tot + 22), oe = o, cdl = tot - o; - for (var i = 0; i < files.length; ++i) { - var f = files[i]; - wzh(out, f.o, f, f.f, f.u, f.c.length); - var badd = 30 + f.f.length + exfl(f.extra); - out.set(f.c, f.o + badd); - wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0); - } - wzf(out, o, files.length, cdl, oe); - return out; -} -/** - * Streaming pass-through decompression for ZIP archives - */ -var UnzipPassThrough = /*#__PURE__*/ (function () { - function UnzipPassThrough() { - } - UnzipPassThrough.prototype.push = function (data, final) { - this.ondata(null, data, final); - }; - UnzipPassThrough.compression = 0; - return UnzipPassThrough; -}()); -export { UnzipPassThrough }; -/** - * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for - * better performance. - */ -var UnzipInflate = /*#__PURE__*/ (function () { - /** - * Creates a DEFLATE decompression that can be used in ZIP archives - */ - function UnzipInflate() { - var _this = this; - this.i = new Inflate(function (dat, final) { - _this.ondata(null, dat, final); - }); - } - UnzipInflate.prototype.push = function (data, final) { - try { - this.i.push(data, final); - } - catch (e) { - this.ondata(e, null, final); - } - }; - UnzipInflate.compression = 8; - return UnzipInflate; -}()); -export { UnzipInflate }; -/** - * Asynchronous streaming DEFLATE decompression for ZIP archives - */ -var AsyncUnzipInflate = /*#__PURE__*/ (function () { - /** - * Creates a DEFLATE decompression that can be used in ZIP archives - */ - function AsyncUnzipInflate(_, sz) { - var _this = this; - if (sz < 320000) { - this.i = new Inflate(function (dat, final) { - _this.ondata(null, dat, final); - }); - } - else { - this.i = new AsyncInflate(function (err, dat, final) { - _this.ondata(err, dat, final); - }); - this.terminate = this.i.terminate; - } - } - AsyncUnzipInflate.prototype.push = function (data, final) { - if (this.i.terminate) - data = slc(data, 0); - this.i.push(data, final); - }; - AsyncUnzipInflate.compression = 8; - return AsyncUnzipInflate; -}()); -export { AsyncUnzipInflate }; -/** - * A ZIP archive decompression stream that emits files as they are discovered - */ -var Unzip = /*#__PURE__*/ (function () { - /** - * Creates a ZIP decompression stream - * @param cb The callback to call whenever a file in the ZIP archive is found - */ - function Unzip(cb) { - this.onfile = cb; - this.k = []; - this.o = { - 0: UnzipPassThrough - }; - this.p = et; - } - /** - * Pushes a chunk to be unzipped - * @param chunk The chunk to push - * @param final Whether this is the last chunk - */ - Unzip.prototype.push = function (chunk, final) { - var _this = this; - if (!this.onfile) - err(5); - if (!this.p) - err(4); - if (this.c > 0) { - var len = Math.min(this.c, chunk.length); - var toAdd = chunk.subarray(0, len); - this.c -= len; - if (this.d) - this.d.push(toAdd, !this.c); - else - this.k[0].push(toAdd); - chunk = chunk.subarray(len); - if (chunk.length) - return this.push(chunk, final); - } - else { - var f = 0, i = 0, is = void 0, buf = void 0; - if (!this.p.length) - buf = chunk; - else if (!chunk.length) - buf = this.p; - else { - buf = new u8(this.p.length + chunk.length); - buf.set(this.p), buf.set(chunk, this.p.length); - } - var l = buf.length, oc = this.c, add = oc && this.d; - var _loop_2 = function () { - var _a; - var sig = b4(buf, i); - if (sig == 0x4034B50) { - f = 1, is = i; - this_1.d = null; - this_1.c = 0; - var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28); - if (l > i + 30 + fnl + es) { - var chks_3 = []; - this_1.k.unshift(chks_3); - f = 2; - var sc_1 = b4(buf, i + 18), su_1 = b4(buf, i + 22); - var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u); - if (sc_1 == 4294967295) { - _a = dd ? [-2] : z64e(buf, i), sc_1 = _a[0], su_1 = _a[1]; - } - else if (dd) - sc_1 = -1; - i += es; - this_1.c = sc_1; - var d_1; - var file_1 = { - name: fn_1, - compression: cmp_1, - start: function () { - if (!file_1.ondata) - err(5); - if (!sc_1) - file_1.ondata(null, et, true); - else { - var ctr = _this.o[cmp_1]; - if (!ctr) - file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false); - d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1); - d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); }; - for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) { - var dat = chks_4[_i]; - d_1.push(dat, false); - } - if (_this.k[0] == chks_3 && _this.c) - _this.d = d_1; - else - d_1.push(et, true); - } - }, - terminate: function () { - if (d_1 && d_1.terminate) - d_1.terminate(); - } - }; - if (sc_1 >= 0) - file_1.size = sc_1, file_1.originalSize = su_1; - this_1.onfile(file_1); - } - return "break"; - } - else if (oc) { - if (sig == 0x8074B50) { - is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0; - return "break"; - } - else if (sig == 0x2014B50) { - is = i -= 4, f = 3, this_1.c = 0; - return "break"; - } - } - }; - var this_1 = this; - for (; i < l - 4; ++i) { - var state_1 = _loop_2(); - if (state_1 === "break") - break; - } - this.p = et; - if (oc < 0) { - var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i); - if (add) - add.push(dat, !!f); - else - this.k[+(f == 2)].push(dat); - } - if (f & 2) - return this.push(buf.subarray(i), final); - this.p = buf.subarray(i); - } - if (final) { - if (this.c) - err(13); - this.p = null; - } - }; - /** - * Registers a decoder with the stream, allowing for files compressed with - * the compression type provided to be expanded correctly - * @param decoder The decoder constructor - */ - Unzip.prototype.register = function (decoder) { - this.o[decoder.compression] = decoder; - }; - return Unzip; -}()); -export { Unzip }; -var mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); }; -export function unzip(data, opts, cb) { - if (!cb) - cb = opts, opts = {}; - if (typeof cb != 'function') - err(7); - var term = []; - var tAll = function () { - for (var i = 0; i < term.length; ++i) - term[i](); - }; - var files = {}; - var cbd = function (a, b) { - mt(function () { cb(a, b); }); - }; - mt(function () { cbd = cb; }); - var e = data.length - 22; - for (; b4(data, e) != 0x6054B50; --e) { - if (!e || data.length - e > 65558) { - cbd(err(13, 0, 1), null); - return tAll; - } - } - ; - var lft = b2(data, e + 8); - if (lft) { - var c = lft; - var o = b4(data, e + 16); - var z = o == 4294967295 || c == 65535; - if (z) { - var ze = b4(data, e - 12); - z = b4(data, ze) == 0x6064B50; - if (z) { - c = lft = b4(data, ze + 32); - o = b4(data, ze + 48); - } - } - var fltr = opts && opts.filter; - var _loop_3 = function (i) { - var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off); - o = no; - var cbl = function (e, d) { - if (e) { - tAll(); - cbd(e, null); - } - else { - if (d) - files[fn] = d; - if (!--lft) - cbd(null, files); - } - }; - if (!fltr || fltr({ - name: fn, - size: sc, - originalSize: su, - compression: c_1 - })) { - if (!c_1) - cbl(null, slc(data, b, b + sc)); - else if (c_1 == 8) { - var infl = data.subarray(b, b + sc); - // Synchronously decompress under 512KB, or barely-compressed data - if (su < 524288 || sc > 0.8 * su) { - try { - cbl(null, inflateSync(infl, { out: new u8(su) })); - } - catch (e) { - cbl(e, null); - } - } - else - term.push(inflate(infl, { size: su }, cbl)); - } - else - cbl(err(14, 'unknown compression type ' + c_1, 1), null); - } - else - cbl(null, null); - }; - for (var i = 0; i < c; ++i) { - _loop_3(i); - } - } - else - cbd(null, {}); - return tAll; -} -/** - * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better - * performance with more than one file. - * @param data The raw compressed ZIP file - * @param opts The ZIP extraction options - * @returns The decompressed files - */ -export function unzipSync(data, opts) { - var files = {}; - var e = data.length - 22; - for (; b4(data, e) != 0x6054B50; --e) { - if (!e || data.length - e > 65558) - err(13); - } - ; - var c = b2(data, e + 8); - if (!c) - return {}; - var o = b4(data, e + 16); - var z = o == 4294967295 || c == 65535; - if (z) { - var ze = b4(data, e - 12); - z = b4(data, ze) == 0x6064B50; - if (z) { - c = b4(data, ze + 32); - o = b4(data, ze + 48); - } - } - var fltr = opts && opts.filter; - for (var i = 0; i < c; ++i) { - var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off); - o = no; - if (!fltr || fltr({ - name: fn, - size: sc, - originalSize: su, - compression: c_2 - })) { - if (!c_2) - files[fn] = slc(data, b, b + sc); - else if (c_2 == 8) - files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) }); - else - err(14, 'unknown compression type ' + c_2); - } - } - return files; -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/BoxLineGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/BoxLineGeometry.js deleted file mode 100644 index 89f7165..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/BoxLineGeometry.js +++ /dev/null @@ -1,69 +0,0 @@ -import { - BufferGeometry, - Float32BufferAttribute -} from '/static/javascript/three/build/three.module.js'; - -class BoxLineGeometry extends BufferGeometry { - - constructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) { - - super(); - - widthSegments = Math.floor( widthSegments ); - heightSegments = Math.floor( heightSegments ); - depthSegments = Math.floor( depthSegments ); - - const widthHalf = width / 2; - const heightHalf = height / 2; - const depthHalf = depth / 2; - - const segmentWidth = width / widthSegments; - const segmentHeight = height / heightSegments; - const segmentDepth = depth / depthSegments; - - const vertices = []; - - let x = - widthHalf; - let y = - heightHalf; - let z = - depthHalf; - - for ( let i = 0; i <= widthSegments; i ++ ) { - - vertices.push( x, - heightHalf, - depthHalf, x, heightHalf, - depthHalf ); - vertices.push( x, heightHalf, - depthHalf, x, heightHalf, depthHalf ); - vertices.push( x, heightHalf, depthHalf, x, - heightHalf, depthHalf ); - vertices.push( x, - heightHalf, depthHalf, x, - heightHalf, - depthHalf ); - - x += segmentWidth; - - } - - for ( let i = 0; i <= heightSegments; i ++ ) { - - vertices.push( - widthHalf, y, - depthHalf, widthHalf, y, - depthHalf ); - vertices.push( widthHalf, y, - depthHalf, widthHalf, y, depthHalf ); - vertices.push( widthHalf, y, depthHalf, - widthHalf, y, depthHalf ); - vertices.push( - widthHalf, y, depthHalf, - widthHalf, y, - depthHalf ); - - y += segmentHeight; - - } - - for ( let i = 0; i <= depthSegments; i ++ ) { - - vertices.push( - widthHalf, - heightHalf, z, - widthHalf, heightHalf, z ); - vertices.push( - widthHalf, heightHalf, z, widthHalf, heightHalf, z ); - vertices.push( widthHalf, heightHalf, z, widthHalf, - heightHalf, z ); - vertices.push( widthHalf, - heightHalf, z, - widthHalf, - heightHalf, z ); - - z += segmentDepth; - - } - - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - - } - -} - -export { BoxLineGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ConvexGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ConvexGeometry.js deleted file mode 100644 index 3c70fd0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ConvexGeometry.js +++ /dev/null @@ -1,53 +0,0 @@ -import { - BufferGeometry, - Float32BufferAttribute -} from '/static/javascript/three/build/three.module.js'; -import { ConvexHull } from '../math/ConvexHull.js'; - -class ConvexGeometry extends BufferGeometry { - - constructor( points = [] ) { - - super(); - - // buffers - - const vertices = []; - const normals = []; - - const convexHull = new ConvexHull().setFromPoints( points ); - - // generate vertices and normals - - const faces = convexHull.faces; - - for ( let i = 0; i < faces.length; i ++ ) { - - const face = faces[ i ]; - let edge = face.edge; - - // we move along a doubly-connected edge list to access all face points (see HalfEdge docs) - - do { - - const point = edge.head().point; - - vertices.push( point.x, point.y, point.z ); - normals.push( face.normal.x, face.normal.y, face.normal.z ); - - edge = edge.next; - - } while ( edge !== face.edge ); - - } - - // build geometry - - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - - } - -} - -export { ConvexGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/DecalGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/DecalGeometry.js deleted file mode 100644 index 7990e35..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/DecalGeometry.js +++ /dev/null @@ -1,356 +0,0 @@ -import { - BufferGeometry, - Float32BufferAttribute, - Matrix4, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * You can use this geometry to create a decal mesh, that serves different kinds of purposes. - * e.g. adding unique details to models, performing dynamic visual environmental changes or covering seams. - * - * Constructor parameter: - * - * mesh — Any mesh object - * position — Position of the decal projector - * orientation — Orientation of the decal projector - * size — Size of the decal projector - * - * reference: http://blog.wolfire.com/2009/06/how-to-project-decals/ - * - */ - -class DecalGeometry extends BufferGeometry { - - constructor( mesh, position, orientation, size ) { - - super(); - - // buffers - - const vertices = []; - const normals = []; - const uvs = []; - - // helpers - - const plane = new Vector3(); - - // this matrix represents the transformation of the decal projector - - const projectorMatrix = new Matrix4(); - projectorMatrix.makeRotationFromEuler( orientation ); - projectorMatrix.setPosition( position ); - - const projectorMatrixInverse = new Matrix4(); - projectorMatrixInverse.copy( projectorMatrix ).invert(); - - // generate buffers - - generate(); - - // build geometry - - this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - function generate() { - - let decalVertices = []; - - const vertex = new Vector3(); - const normal = new Vector3(); - - // handle different geometry types - - const geometry = mesh.geometry; - - const positionAttribute = geometry.attributes.position; - const normalAttribute = geometry.attributes.normal; - - // first, create an array of 'DecalVertex' objects - // three consecutive 'DecalVertex' objects represent a single face - // - // this data structure will be later used to perform the clipping - - if ( geometry.index !== null ) { - - // indexed BufferGeometry - - const index = geometry.index; - - for ( let i = 0; i < index.count; i ++ ) { - - vertex.fromBufferAttribute( positionAttribute, index.getX( i ) ); - normal.fromBufferAttribute( normalAttribute, index.getX( i ) ); - - pushDecalVertex( decalVertices, vertex, normal ); - - } - - } else { - - // non-indexed BufferGeometry - - for ( let i = 0; i < positionAttribute.count; i ++ ) { - - vertex.fromBufferAttribute( positionAttribute, i ); - normal.fromBufferAttribute( normalAttribute, i ); - - pushDecalVertex( decalVertices, vertex, normal ); - - } - - } - - // second, clip the geometry so that it doesn't extend out from the projector - - decalVertices = clipGeometry( decalVertices, plane.set( 1, 0, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( - 1, 0, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 1, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, - 1, 0 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, 1 ) ); - decalVertices = clipGeometry( decalVertices, plane.set( 0, 0, - 1 ) ); - - // third, generate final vertices, normals and uvs - - for ( let i = 0; i < decalVertices.length; i ++ ) { - - const decalVertex = decalVertices[ i ]; - - // create texture coordinates (we are still in projector space) - - uvs.push( - 0.5 + ( decalVertex.position.x / size.x ), - 0.5 + ( decalVertex.position.y / size.y ) - ); - - // transform the vertex back to world space - - decalVertex.position.applyMatrix4( projectorMatrix ); - - // now create vertex and normal buffer data - - vertices.push( decalVertex.position.x, decalVertex.position.y, decalVertex.position.z ); - normals.push( decalVertex.normal.x, decalVertex.normal.y, decalVertex.normal.z ); - - } - - } - - function pushDecalVertex( decalVertices, vertex, normal ) { - - // transform the vertex to world space, then to projector space - - vertex.applyMatrix4( mesh.matrixWorld ); - vertex.applyMatrix4( projectorMatrixInverse ); - - normal.transformDirection( mesh.matrixWorld ); - - decalVertices.push( new DecalVertex( vertex.clone(), normal.clone() ) ); - - } - - function clipGeometry( inVertices, plane ) { - - const outVertices = []; - - const s = 0.5 * Math.abs( size.dot( plane ) ); - - // a single iteration clips one face, - // which consists of three consecutive 'DecalVertex' objects - - for ( let i = 0; i < inVertices.length; i += 3 ) { - - let total = 0; - let nV1; - let nV2; - let nV3; - let nV4; - - const d1 = inVertices[ i + 0 ].position.dot( plane ) - s; - const d2 = inVertices[ i + 1 ].position.dot( plane ) - s; - const d3 = inVertices[ i + 2 ].position.dot( plane ) - s; - - const v1Out = d1 > 0; - const v2Out = d2 > 0; - const v3Out = d3 > 0; - - // calculate, how many vertices of the face lie outside of the clipping plane - - total = ( v1Out ? 1 : 0 ) + ( v2Out ? 1 : 0 ) + ( v3Out ? 1 : 0 ); - - switch ( total ) { - - case 0: { - - // the entire face lies inside of the plane, no clipping needed - - outVertices.push( inVertices[ i ] ); - outVertices.push( inVertices[ i + 1 ] ); - outVertices.push( inVertices[ i + 2 ] ); - break; - - } - - case 1: { - - // one vertex lies outside of the plane, perform clipping - - if ( v1Out ) { - - nV1 = inVertices[ i + 1 ]; - nV2 = inVertices[ i + 2 ]; - nV3 = clip( inVertices[ i ], nV1, plane, s ); - nV4 = clip( inVertices[ i ], nV2, plane, s ); - - } - - if ( v2Out ) { - - nV1 = inVertices[ i ]; - nV2 = inVertices[ i + 2 ]; - nV3 = clip( inVertices[ i + 1 ], nV1, plane, s ); - nV4 = clip( inVertices[ i + 1 ], nV2, plane, s ); - - outVertices.push( nV3 ); - outVertices.push( nV2.clone() ); - outVertices.push( nV1.clone() ); - - outVertices.push( nV2.clone() ); - outVertices.push( nV3.clone() ); - outVertices.push( nV4 ); - break; - - } - - if ( v3Out ) { - - nV1 = inVertices[ i ]; - nV2 = inVertices[ i + 1 ]; - nV3 = clip( inVertices[ i + 2 ], nV1, plane, s ); - nV4 = clip( inVertices[ i + 2 ], nV2, plane, s ); - - } - - outVertices.push( nV1.clone() ); - outVertices.push( nV2.clone() ); - outVertices.push( nV3 ); - - outVertices.push( nV4 ); - outVertices.push( nV3.clone() ); - outVertices.push( nV2.clone() ); - - break; - - } - - case 2: { - - // two vertices lies outside of the plane, perform clipping - - if ( ! v1Out ) { - - nV1 = inVertices[ i ].clone(); - nV2 = clip( nV1, inVertices[ i + 1 ], plane, s ); - nV3 = clip( nV1, inVertices[ i + 2 ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); - - } - - if ( ! v2Out ) { - - nV1 = inVertices[ i + 1 ].clone(); - nV2 = clip( nV1, inVertices[ i + 2 ], plane, s ); - nV3 = clip( nV1, inVertices[ i ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); - - } - - if ( ! v3Out ) { - - nV1 = inVertices[ i + 2 ].clone(); - nV2 = clip( nV1, inVertices[ i ], plane, s ); - nV3 = clip( nV1, inVertices[ i + 1 ], plane, s ); - outVertices.push( nV1 ); - outVertices.push( nV2 ); - outVertices.push( nV3 ); - - } - - break; - - } - - case 3: { - - // the entire face lies outside of the plane, so let's discard the corresponding vertices - - break; - - } - - } - - } - - return outVertices; - - } - - function clip( v0, v1, p, s ) { - - const d0 = v0.position.dot( p ) - s; - const d1 = v1.position.dot( p ) - s; - - const s0 = d0 / ( d0 - d1 ); - - const v = new DecalVertex( - new Vector3( - v0.position.x + s0 * ( v1.position.x - v0.position.x ), - v0.position.y + s0 * ( v1.position.y - v0.position.y ), - v0.position.z + s0 * ( v1.position.z - v0.position.z ) - ), - new Vector3( - v0.normal.x + s0 * ( v1.normal.x - v0.normal.x ), - v0.normal.y + s0 * ( v1.normal.y - v0.normal.y ), - v0.normal.z + s0 * ( v1.normal.z - v0.normal.z ) - ) - ); - - // need to clip more values (texture coordinates)? do it this way: - // intersectpoint.value = a.value + s * ( b.value - a.value ); - - return v; - - } - - } - -} - -// helper - -class DecalVertex { - - constructor( position, normal ) { - - this.position = position; - this.normal = normal; - - } - - clone() { - - return new this.constructor( this.position.clone(), this.normal.clone() ); - - } - -} - -export { DecalGeometry, DecalVertex }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/InstancedPointsGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/InstancedPointsGeometry.js deleted file mode 100644 index 43abec5..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/InstancedPointsGeometry.js +++ /dev/null @@ -1,174 +0,0 @@ -import { - Box3, - Float32BufferAttribute, - InstancedBufferGeometry, - InstancedBufferAttribute, - Sphere, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _vector = new Vector3(); - -class InstancedPointsGeometry extends InstancedBufferGeometry { - - constructor() { - - super(); - - this.isInstancedPointsGeometry = true; - - this.type = 'InstancedPointsGeometry'; - - const positions = [ - 1, 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ]; - const uvs = [ - 1, 1, 1, 1, - 1, - 1, 1, - 1 ]; - const index = [ 0, 2, 1, 2, 3, 1 ]; - - this.setIndex( index ); - this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - - applyMatrix4( matrix ) { - - const pos = this.attributes.instancePosition; - - if ( pos !== undefined ) { - - pos.applyMatrix4( matrix ); - - pos.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - return this; - - } - - setPositions( array ) { - - let points; - - if ( array instanceof Float32Array ) { - - points = array; - - } else if ( Array.isArray( array ) ) { - - points = new Float32Array( array ); - - } - - this.setAttribute( 'instancePosition', new InstancedBufferAttribute( points, 3 ) ); // xyz - - // - - this.computeBoundingBox(); - this.computeBoundingSphere(); - - return this; - - } - - setColors( array ) { - - let colors; - - if ( array instanceof Float32Array ) { - - colors = array; - - } else if ( Array.isArray( array ) ) { - - colors = new Float32Array( array ); - - } - - this.setAttribute( 'instanceColor', new InstancedBufferAttribute( colors, 3 ) ); // rgb - - return this; - - } - - computeBoundingBox() { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - const pos = this.attributes.instancePosition; - - if ( pos !== undefined ) { - - this.boundingBox.setFromBufferAttribute( pos ); - - } - - } - - computeBoundingSphere() { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - if ( this.boundingBox === null ) { - - this.computeBoundingBox(); - - } - - const pos = this.attributes.instancePosition; - - if ( pos !== undefined ) { - - const center = this.boundingSphere.center; - - this.boundingBox.getCenter( center ); - - let maxRadiusSq = 0; - - for ( let i = 0, il = pos.count; i < il; i ++ ) { - - _vector.fromBufferAttribute( pos, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - console.error( 'THREE.InstancedPointsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); - - } - - } - - } - - toJSON() { - - // todo - - } - -} - -export default InstancedPointsGeometry; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometries.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometries.js deleted file mode 100644 index c3fcd30..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometries.js +++ /dev/null @@ -1,254 +0,0 @@ -import { - Curve, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -import { ParametricGeometry } from './ParametricGeometry.js'; - -/** - * Experimenting of primitive geometry creation using Surface Parametric equations - */ - -const ParametricGeometries = { - - klein: function ( v, u, target ) { - - u *= Math.PI; - v *= 2 * Math.PI; - - u = u * 2; - let x, z; - if ( u < Math.PI ) { - - x = 3 * Math.cos( u ) * ( 1 + Math.sin( u ) ) + ( 2 * ( 1 - Math.cos( u ) / 2 ) ) * Math.cos( u ) * Math.cos( v ); - z = - 8 * Math.sin( u ) - 2 * ( 1 - Math.cos( u ) / 2 ) * Math.sin( u ) * Math.cos( v ); - - } else { - - x = 3 * Math.cos( u ) * ( 1 + Math.sin( u ) ) + ( 2 * ( 1 - Math.cos( u ) / 2 ) ) * Math.cos( v + Math.PI ); - z = - 8 * Math.sin( u ); - - } - - const y = - 2 * ( 1 - Math.cos( u ) / 2 ) * Math.sin( v ); - - target.set( x, y, z ); - - }, - - plane: function ( width, height ) { - - return function ( u, v, target ) { - - const x = u * width; - const y = 0; - const z = v * height; - - target.set( x, y, z ); - - }; - - }, - - mobius: function ( u, t, target ) { - - // flat mobius strip - // http://www.wolframalpha.com/input/?i=M%C3%B6bius+strip+parametric+equations&lk=1&a=ClashPrefs_*Surface.MoebiusStrip.SurfaceProperty.ParametricEquations- - u = u - 0.5; - const v = 2 * Math.PI * t; - - const a = 2; - - const x = Math.cos( v ) * ( a + u * Math.cos( v / 2 ) ); - const y = Math.sin( v ) * ( a + u * Math.cos( v / 2 ) ); - const z = u * Math.sin( v / 2 ); - - target.set( x, y, z ); - - }, - - mobius3d: function ( u, t, target ) { - - // volumetric mobius strip - - u *= Math.PI; - t *= 2 * Math.PI; - - u = u * 2; - const phi = u / 2; - const major = 2.25, a = 0.125, b = 0.65; - - let x = a * Math.cos( t ) * Math.cos( phi ) - b * Math.sin( t ) * Math.sin( phi ); - const z = a * Math.cos( t ) * Math.sin( phi ) + b * Math.sin( t ) * Math.cos( phi ); - const y = ( major + x ) * Math.sin( u ); - x = ( major + x ) * Math.cos( u ); - - target.set( x, y, z ); - - } - -}; - - -/********************************************* - * - * Parametric Replacement for TubeGeometry - * - *********************************************/ - -ParametricGeometries.TubeGeometry = class TubeGeometry extends ParametricGeometry { - - constructor( path, segments = 64, radius = 1, segmentsRadius = 8, closed = false ) { - - const numpoints = segments + 1; - - const frames = path.computeFrenetFrames( segments, closed ), - tangents = frames.tangents, - normals = frames.normals, - binormals = frames.binormals; - - const position = new Vector3(); - - function ParametricTube( u, v, target ) { - - v *= 2 * Math.PI; - - const i = Math.floor( u * ( numpoints - 1 ) ); - - path.getPointAt( u, position ); - - const normal = normals[ i ]; - const binormal = binormals[ i ]; - - const cx = - radius * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - const cy = radius * Math.sin( v ); - - position.x += cx * normal.x + cy * binormal.x; - position.y += cx * normal.y + cy * binormal.y; - position.z += cx * normal.z + cy * binormal.z; - - target.copy( position ); - - } - - super( ParametricTube, segments, segmentsRadius ); - - // proxy internals - - this.tangents = tangents; - this.normals = normals; - this.binormals = binormals; - - this.path = path; - this.segments = segments; - this.radius = radius; - this.segmentsRadius = segmentsRadius; - this.closed = closed; - - } - -}; - - -/********************************************* - * - * Parametric Replacement for TorusKnotGeometry - * - *********************************************/ -ParametricGeometries.TorusKnotGeometry = class TorusKnotGeometry extends ParametricGeometries.TubeGeometry { - - constructor( radius = 200, tube = 40, segmentsT = 64, segmentsR = 8, p = 2, q = 3 ) { - - class TorusKnotCurve extends Curve { - - getPoint( t, optionalTarget = new Vector3() ) { - - const point = optionalTarget; - - t *= Math.PI * 2; - - const r = 0.5; - - const x = ( 1 + r * Math.cos( q * t ) ) * Math.cos( p * t ); - const y = ( 1 + r * Math.cos( q * t ) ) * Math.sin( p * t ); - const z = r * Math.sin( q * t ); - - return point.set( x, y, z ).multiplyScalar( radius ); - - } - - } - - const segments = segmentsT; - const radiusSegments = segmentsR; - const extrudePath = new TorusKnotCurve(); - - super( extrudePath, segments, tube, radiusSegments, true, false ); - - this.radius = radius; - this.tube = tube; - this.segmentsT = segmentsT; - this.segmentsR = segmentsR; - this.p = p; - this.q = q; - - } - -}; - -/********************************************* - * - * Parametric Replacement for SphereGeometry - * - *********************************************/ -ParametricGeometries.SphereGeometry = class SphereGeometry extends ParametricGeometry { - - constructor( size, u, v ) { - - function sphere( u, v, target ) { - - u *= Math.PI; - v *= 2 * Math.PI; - - const x = size * Math.sin( u ) * Math.cos( v ); - const y = size * Math.sin( u ) * Math.sin( v ); - const z = size * Math.cos( u ); - - target.set( x, y, z ); - - } - - super( sphere, u, v ); - - } - -}; - - -/********************************************* - * - * Parametric Replacement for PlaneGeometry - * - *********************************************/ - -ParametricGeometries.PlaneGeometry = class PlaneGeometry extends ParametricGeometry { - - constructor( width, depth, segmentsWidth, segmentsDepth ) { - - function plane( u, v, target ) { - - const x = u * width; - const y = 0; - const z = v * depth; - - target.set( x, y, z ); - - } - - super( plane, segmentsWidth, segmentsDepth ); - - } - -}; - -export { ParametricGeometries }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometry.js deleted file mode 100644 index b6b0904..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/ParametricGeometry.js +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Parametric Surfaces Geometry - * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html - */ - -import { - BufferGeometry, - Float32BufferAttribute, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -class ParametricGeometry extends BufferGeometry { - - constructor( func = ( u, v, target ) => target.set( u, v, Math.cos( u ) * Math.sin( v ) ), slices = 8, stacks = 8 ) { - - super(); - - 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(); - - // 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 ) ); - - } - - copy( source ) { - - super.copy( source ); - - this.parameters = Object.assign( {}, source.parameters ); - - return this; - - } - -} - -export { ParametricGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/RoundedBoxGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/RoundedBoxGeometry.js deleted file mode 100644 index 280ca35..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/RoundedBoxGeometry.js +++ /dev/null @@ -1,155 +0,0 @@ -import { - BoxGeometry, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _tempNormal = new Vector3(); - -function getUv( faceDirVector, normal, uvAxis, projectionAxis, radius, sideLength ) { - - const totArcLength = 2 * Math.PI * radius / 4; - - // length of the planes between the arcs on each axis - const centerLength = Math.max( sideLength - 2 * radius, 0 ); - const halfArc = Math.PI / 4; - - // Get the vector projected onto the Y plane - _tempNormal.copy( normal ); - _tempNormal[ projectionAxis ] = 0; - _tempNormal.normalize(); - - // total amount of UV space alloted to a single arc - const arcUvRatio = 0.5 * totArcLength / ( totArcLength + centerLength ); - - // the distance along one arc the point is at - const arcAngleRatio = 1.0 - ( _tempNormal.angleTo( faceDirVector ) / halfArc ); - - if ( Math.sign( _tempNormal[ uvAxis ] ) === 1 ) { - - return arcAngleRatio * arcUvRatio; - - } else { - - // total amount of UV space alloted to the plane between the arcs - const lenUv = centerLength / ( totArcLength + centerLength ); - return lenUv + arcUvRatio + arcUvRatio * ( 1.0 - arcAngleRatio ); - - } - -} - -class RoundedBoxGeometry extends BoxGeometry { - - constructor( width = 1, height = 1, depth = 1, segments = 2, radius = 0.1 ) { - - // ensure segments is odd so we have a plane connecting the rounded corners - segments = segments * 2 + 1; - - // ensure radius isn't bigger than shortest side - radius = Math.min( width / 2, height / 2, depth / 2, radius ); - - super( 1, 1, 1, segments, segments, segments ); - - // if we just have one segment we're the same as a regular box - if ( segments === 1 ) return; - - const geometry2 = this.toNonIndexed(); - - this.index = null; - this.attributes.position = geometry2.attributes.position; - this.attributes.normal = geometry2.attributes.normal; - this.attributes.uv = geometry2.attributes.uv; - - // - - const position = new Vector3(); - const normal = new Vector3(); - - const box = new Vector3( width, height, depth ).divideScalar( 2 ).subScalar( radius ); - - const positions = this.attributes.position.array; - const normals = this.attributes.normal.array; - const uvs = this.attributes.uv.array; - - const faceTris = positions.length / 6; - const faceDirVector = new Vector3(); - const halfSegmentSize = 0.5 / segments; - - for ( let i = 0, j = 0; i < positions.length; i += 3, j += 2 ) { - - position.fromArray( positions, i ); - normal.copy( position ); - normal.x -= Math.sign( normal.x ) * halfSegmentSize; - normal.y -= Math.sign( normal.y ) * halfSegmentSize; - normal.z -= Math.sign( normal.z ) * halfSegmentSize; - normal.normalize(); - - positions[ i + 0 ] = box.x * Math.sign( position.x ) + normal.x * radius; - positions[ i + 1 ] = box.y * Math.sign( position.y ) + normal.y * radius; - positions[ i + 2 ] = box.z * Math.sign( position.z ) + normal.z * radius; - - normals[ i + 0 ] = normal.x; - normals[ i + 1 ] = normal.y; - normals[ i + 2 ] = normal.z; - - const side = Math.floor( i / faceTris ); - - switch ( side ) { - - case 0: // right - - // generate UVs along Z then Y - faceDirVector.set( 1, 0, 0 ); - uvs[ j + 0 ] = getUv( faceDirVector, normal, 'z', 'y', radius, depth ); - uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'z', radius, height ); - break; - - case 1: // left - - // generate UVs along Z then Y - faceDirVector.set( - 1, 0, 0 ); - uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'z', 'y', radius, depth ); - uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'z', radius, height ); - break; - - case 2: // top - - // generate UVs along X then Z - faceDirVector.set( 0, 1, 0 ); - uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'z', radius, width ); - uvs[ j + 1 ] = getUv( faceDirVector, normal, 'z', 'x', radius, depth ); - break; - - case 3: // bottom - - // generate UVs along X then Z - faceDirVector.set( 0, - 1, 0 ); - uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'z', radius, width ); - uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'z', 'x', radius, depth ); - break; - - case 4: // front - - // generate UVs along X then Y - faceDirVector.set( 0, 0, 1 ); - uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'y', radius, width ); - uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'x', radius, height ); - break; - - case 5: // back - - // generate UVs along X then Y - faceDirVector.set( 0, 0, - 1 ); - uvs[ j + 0 ] = getUv( faceDirVector, normal, 'x', 'y', radius, width ); - uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'x', radius, height ); - break; - - } - - } - - } - -} - -export { RoundedBoxGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/SDFGeometryGenerator.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/SDFGeometryGenerator.js deleted file mode 100644 index 7d8f5f3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/SDFGeometryGenerator.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * @author santiago / @glitch_life - * wrapper of https://www.npmjs.com/package/isosurface by https://github.com/mikolalysenko - * - * Returns BufferGeometry from SDF - */ - -import { - BufferAttribute, - BufferGeometry, - FloatType, - Mesh, - OrthographicCamera, - PlaneGeometry, - Scene, - ShaderMaterial, - Vector2, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; - -import { surfaceNet } from './../libs/surfaceNet.js'; - -class SDFGeometryGenerator { - - constructor( renderer ) { - - this.renderer = renderer; - - } - - generate( res = 64, distFunc = 'float dist( vec3 p ){ return length(p) - 0.5; }', bounds = 1 ) { - - let w, h; - if ( res == 8 ) [ w, h ] = [ 32, 16 ]; - else if ( res == 16 ) [ w, h ] = [ 64, 64 ]; - else if ( res == 32 ) [ w, h ] = [ 256, 128 ]; - else if ( res == 64 ) [ w, h ] = [ 512, 512 ]; - else if ( res == 128 ) [ w, h ] = [ 2048, 1024 ]; - else if ( res == 256 ) [ w, h ] = [ 4096, 4096 ]; - else if ( res == 512 ) [ w, h ] = [ 16384, 8096 ]; - else if ( res == 1024 ) [ w, h ] = [ 32768, 32768 ]; - else throw new Error( 'THREE.SDFGeometryGenerator: Resolution must be in range 8 < res < 1024 and must be ^2' ); - - const maxTexSize = this.renderer.capabilities.maxTextureSize; - - if ( w > maxTexSize || h > maxTexSize ) throw new Error( 'THREE.SDFGeometryGenerator: Your device does not support this resolution ( ' + res + ' ), decrease [res] param.' ); - - const [ tilesX, tilesY ] = [ ( w / res ), ( h / res ) ]; - - const sdfCompute = ` - varying vec2 vUv; - uniform float tileNum; - uniform float bounds; - [#dist#] - void main() { gl_FragColor=vec4( ( dist( vec3( vUv, tileNum ) * 2.0 * bounds - vec3( bounds ) ) < 0.00001 ) ? 1.0 : 0.0 ); } - `; - - const sdfRT = this.computeSDF( w, h, tilesX, tilesY, bounds, sdfCompute.replace( '[#dist#]', distFunc ) ); - - const read = new Float32Array( w * h * 4 ); - this.renderer.readRenderTargetPixels( sdfRT, 0, 0, w, h, read ); - sdfRT.dispose(); - - // - - const mesh = surfaceNet( [ res, res, res ], ( x, y, z ) => { - - x = ( x + bounds ) * ( res / ( bounds * 2 ) ); - y = ( y + bounds ) * ( res / ( bounds * 2 ) ); - z = ( z + bounds ) * ( res / ( bounds * 2 ) ); - let p = ( x + ( z % tilesX ) * res ) + y * w + ( Math.floor( z / tilesX ) * res * w ); - p *= 4; - return ( read[ p + 3 ] > 0 ) ? - 0.000000001 : 1; - - }, [[ - bounds, - bounds, - bounds ], [ bounds, bounds, bounds ]] ); - - const ps = [], ids = []; - const geometry = new BufferGeometry(); - mesh.positions.forEach( p => { - - ps.push( p[ 0 ], p[ 1 ], p[ 2 ] ); - - } ); - mesh.cells.forEach( p => ids.push( p[ 0 ], p[ 1 ], p[ 2 ] ) ); - geometry.setAttribute( 'position', new BufferAttribute( new Float32Array( ps ), 3 ) ); - geometry.setIndex( ids ); - - return geometry; - - } - - computeSDF( width, height, tilesX, tilesY, bounds, shader ) { - - const rt = new WebGLRenderTarget( width, height, { type: FloatType } ); - const scn = new Scene(); - const cam = new OrthographicCamera(); - const tiles = tilesX * tilesY; - let currentTile = 0; - - Object.assign( cam, { left: width / - 2, right: width / 2, top: height / 2, bottom: height / - 2 } ).updateProjectionMatrix(); - cam.position.z = 2; - - const tileSize = width / tilesX; - const geometry = new PlaneGeometry( tileSize, tileSize ); - - while ( currentTile ++ < tiles ) { - - const c = currentTile - 1; - const [ px, py ] = [ ( tileSize ) / 2 + ( c % tilesX ) * ( tileSize ) - width / 2, ( tileSize ) / 2 + Math.floor( c / tilesX ) * ( tileSize ) - height / 2 ]; - const compPlane = new Mesh( geometry, new ShaderMaterial( { - uniforms: { - res: { value: new Vector2( width, height ) }, - tileNum: { value: c / ( tilesX * tilesY - 1 ) }, - bounds: { value: bounds } - }, - vertexShader: 'varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}', - fragmentShader: shader - } ) ); - compPlane.position.set( px, py, 0 ); - scn.add( compPlane ); - - } - - this.renderer.setRenderTarget( rt ); - this.renderer.render( scn, cam ); - this.renderer.setRenderTarget( null ); - - // - - geometry.dispose(); - - scn.traverse( function ( object ) { - - if ( object.material !== undefined ) object.material.dispose(); - - } ); - - return rt; - - } - -} - -export { SDFGeometryGenerator }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TeapotGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TeapotGeometry.js deleted file mode 100644 index a6e0ff4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TeapotGeometry.js +++ /dev/null @@ -1,704 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Matrix4, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Tessellates the famous Utah teapot database by Martin Newell into triangles. - * - * Parameters: size = 50, segments = 10, bottom = true, lid = true, body = true, - * fitLid = true, blinn = true - * - * size is a relative scale: I've scaled the teapot to fit vertically between -1 and 1. - * Think of it as a "radius". - * segments - number of line segments to subdivide each patch edge; - * 1 is possible but gives degenerates, so two is the real minimum. - * bottom - boolean, if true (default) then the bottom patches are added. Some consider - * adding the bottom heresy, so set this to "false" to adhere to the One True Way. - * lid - to remove the lid and look inside, set to true. - * body - to remove the body and leave the lid, set this and "bottom" to false. - * fitLid - the lid is a tad small in the original. This stretches it a bit so you can't - * see the teapot's insides through the gap. - * blinn - Jim Blinn scaled the original data vertically by dividing by about 1.3 to look - * nicer. If you want to see the original teapot, similar to the real-world model, set - * this to false. True by default. - * See http://en.wikipedia.org/wiki/File:Original_Utah_Teapot.jpg for the original - * real-world teapot (from http://en.wikipedia.org/wiki/Utah_teapot). - * - * Note that the bottom (the last four patches) is not flat - blame Frank Crow, not me. - * - * The teapot should normally be rendered as a double sided object, since for some - * patches both sides can be seen, e.g., the gap around the lid and inside the spout. - * - * Segments 'n' determines the number of triangles output. - * Total triangles = 32*2*n*n - 8*n [degenerates at the top and bottom cusps are deleted] - * - * size_factor # triangles - * 1 56 - * 2 240 - * 3 552 - * 4 992 - * - * 10 6320 - * 20 25440 - * 30 57360 - * - * Code converted from my ancient SPD software, http://tog.acm.org/resources/SPD/ - * Created for the Udacity course "Interactive Rendering", http://bit.ly/ericity - * YouTube video on teapot history: https://www.youtube.com/watch?v=DxMfblPzFNc - * - * See https://en.wikipedia.org/wiki/Utah_teapot for the history of the teapot - * - */ - -class TeapotGeometry extends BufferGeometry { - - constructor( size = 50, segments = 10, bottom = true, lid = true, body = true, fitLid = true, blinn = true ) { - - // 32 * 4 * 4 Bezier spline patches - const teapotPatches = [ - /*rim*/ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 3, 16, 17, 18, 7, 19, 20, 21, 11, 22, 23, 24, 15, 25, 26, 27, - 18, 28, 29, 30, 21, 31, 32, 33, 24, 34, 35, 36, 27, 37, 38, 39, - 30, 40, 41, 0, 33, 42, 43, 4, 36, 44, 45, 8, 39, 46, 47, 12, - /*body*/ - 12, 13, 14, 15, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 15, 25, 26, 27, 51, 60, 61, 62, 55, 63, 64, 65, 59, 66, 67, 68, - 27, 37, 38, 39, 62, 69, 70, 71, 65, 72, 73, 74, 68, 75, 76, 77, - 39, 46, 47, 12, 71, 78, 79, 48, 74, 80, 81, 52, 77, 82, 83, 56, - 56, 57, 58, 59, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 59, 66, 67, 68, 87, 96, 97, 98, 91, 99, 100, 101, 95, 102, 103, 104, - 68, 75, 76, 77, 98, 105, 106, 107, 101, 108, 109, 110, 104, 111, 112, 113, - 77, 82, 83, 56, 107, 114, 115, 84, 110, 116, 117, 88, 113, 118, 119, 92, - /*handle*/ - 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 123, 136, 137, 120, 127, 138, 139, 124, 131, 140, 141, 128, 135, 142, 143, 132, - 132, 133, 134, 135, 144, 145, 146, 147, 148, 149, 150, 151, 68, 152, 153, 154, - 135, 142, 143, 132, 147, 155, 156, 144, 151, 157, 158, 148, 154, 159, 160, 68, - /*spout*/ - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 164, 177, 178, 161, 168, 179, 180, 165, 172, 181, 182, 169, 176, 183, 184, 173, - 173, 174, 175, 176, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 176, 183, 184, 173, 188, 197, 198, 185, 192, 199, 200, 189, 196, 201, 202, 193, - /*lid*/ - 203, 203, 203, 203, 204, 205, 206, 207, 208, 208, 208, 208, 209, 210, 211, 212, - 203, 203, 203, 203, 207, 213, 214, 215, 208, 208, 208, 208, 212, 216, 217, 218, - 203, 203, 203, 203, 215, 219, 220, 221, 208, 208, 208, 208, 218, 222, 223, 224, - 203, 203, 203, 203, 221, 225, 226, 204, 208, 208, 208, 208, 224, 227, 228, 209, - 209, 210, 211, 212, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 212, 216, 217, 218, 232, 241, 242, 243, 236, 244, 245, 246, 240, 247, 248, 249, - 218, 222, 223, 224, 243, 250, 251, 252, 246, 253, 254, 255, 249, 256, 257, 258, - 224, 227, 228, 209, 252, 259, 260, 229, 255, 261, 262, 233, 258, 263, 264, 237, - /*bottom*/ - 265, 265, 265, 265, 266, 267, 268, 269, 270, 271, 272, 273, 92, 119, 118, 113, - 265, 265, 265, 265, 269, 274, 275, 276, 273, 277, 278, 279, 113, 112, 111, 104, - 265, 265, 265, 265, 276, 280, 281, 282, 279, 283, 284, 285, 104, 103, 102, 95, - 265, 265, 265, 265, 282, 286, 287, 266, 285, 288, 289, 270, 95, 94, 93, 92 - ]; - - const teapotVertices = [ - 1.4, 0, 2.4, - 1.4, - 0.784, 2.4, - 0.784, - 1.4, 2.4, - 0, - 1.4, 2.4, - 1.3375, 0, 2.53125, - 1.3375, - 0.749, 2.53125, - 0.749, - 1.3375, 2.53125, - 0, - 1.3375, 2.53125, - 1.4375, 0, 2.53125, - 1.4375, - 0.805, 2.53125, - 0.805, - 1.4375, 2.53125, - 0, - 1.4375, 2.53125, - 1.5, 0, 2.4, - 1.5, - 0.84, 2.4, - 0.84, - 1.5, 2.4, - 0, - 1.5, 2.4, - - 0.784, - 1.4, 2.4, - - 1.4, - 0.784, 2.4, - - 1.4, 0, 2.4, - - 0.749, - 1.3375, 2.53125, - - 1.3375, - 0.749, 2.53125, - - 1.3375, 0, 2.53125, - - 0.805, - 1.4375, 2.53125, - - 1.4375, - 0.805, 2.53125, - - 1.4375, 0, 2.53125, - - 0.84, - 1.5, 2.4, - - 1.5, - 0.84, 2.4, - - 1.5, 0, 2.4, - - 1.4, 0.784, 2.4, - - 0.784, 1.4, 2.4, - 0, 1.4, 2.4, - - 1.3375, 0.749, 2.53125, - - 0.749, 1.3375, 2.53125, - 0, 1.3375, 2.53125, - - 1.4375, 0.805, 2.53125, - - 0.805, 1.4375, 2.53125, - 0, 1.4375, 2.53125, - - 1.5, 0.84, 2.4, - - 0.84, 1.5, 2.4, - 0, 1.5, 2.4, - 0.784, 1.4, 2.4, - 1.4, 0.784, 2.4, - 0.749, 1.3375, 2.53125, - 1.3375, 0.749, 2.53125, - 0.805, 1.4375, 2.53125, - 1.4375, 0.805, 2.53125, - 0.84, 1.5, 2.4, - 1.5, 0.84, 2.4, - 1.75, 0, 1.875, - 1.75, - 0.98, 1.875, - 0.98, - 1.75, 1.875, - 0, - 1.75, 1.875, - 2, 0, 1.35, - 2, - 1.12, 1.35, - 1.12, - 2, 1.35, - 0, - 2, 1.35, - 2, 0, 0.9, - 2, - 1.12, 0.9, - 1.12, - 2, 0.9, - 0, - 2, 0.9, - - 0.98, - 1.75, 1.875, - - 1.75, - 0.98, 1.875, - - 1.75, 0, 1.875, - - 1.12, - 2, 1.35, - - 2, - 1.12, 1.35, - - 2, 0, 1.35, - - 1.12, - 2, 0.9, - - 2, - 1.12, 0.9, - - 2, 0, 0.9, - - 1.75, 0.98, 1.875, - - 0.98, 1.75, 1.875, - 0, 1.75, 1.875, - - 2, 1.12, 1.35, - - 1.12, 2, 1.35, - 0, 2, 1.35, - - 2, 1.12, 0.9, - - 1.12, 2, 0.9, - 0, 2, 0.9, - 0.98, 1.75, 1.875, - 1.75, 0.98, 1.875, - 1.12, 2, 1.35, - 2, 1.12, 1.35, - 1.12, 2, 0.9, - 2, 1.12, 0.9, - 2, 0, 0.45, - 2, - 1.12, 0.45, - 1.12, - 2, 0.45, - 0, - 2, 0.45, - 1.5, 0, 0.225, - 1.5, - 0.84, 0.225, - 0.84, - 1.5, 0.225, - 0, - 1.5, 0.225, - 1.5, 0, 0.15, - 1.5, - 0.84, 0.15, - 0.84, - 1.5, 0.15, - 0, - 1.5, 0.15, - - 1.12, - 2, 0.45, - - 2, - 1.12, 0.45, - - 2, 0, 0.45, - - 0.84, - 1.5, 0.225, - - 1.5, - 0.84, 0.225, - - 1.5, 0, 0.225, - - 0.84, - 1.5, 0.15, - - 1.5, - 0.84, 0.15, - - 1.5, 0, 0.15, - - 2, 1.12, 0.45, - - 1.12, 2, 0.45, - 0, 2, 0.45, - - 1.5, 0.84, 0.225, - - 0.84, 1.5, 0.225, - 0, 1.5, 0.225, - - 1.5, 0.84, 0.15, - - 0.84, 1.5, 0.15, - 0, 1.5, 0.15, - 1.12, 2, 0.45, - 2, 1.12, 0.45, - 0.84, 1.5, 0.225, - 1.5, 0.84, 0.225, - 0.84, 1.5, 0.15, - 1.5, 0.84, 0.15, - - 1.6, 0, 2.025, - - 1.6, - 0.3, 2.025, - - 1.5, - 0.3, 2.25, - - 1.5, 0, 2.25, - - 2.3, 0, 2.025, - - 2.3, - 0.3, 2.025, - - 2.5, - 0.3, 2.25, - - 2.5, 0, 2.25, - - 2.7, 0, 2.025, - - 2.7, - 0.3, 2.025, - - 3, - 0.3, 2.25, - - 3, 0, 2.25, - - 2.7, 0, 1.8, - - 2.7, - 0.3, 1.8, - - 3, - 0.3, 1.8, - - 3, 0, 1.8, - - 1.5, 0.3, 2.25, - - 1.6, 0.3, 2.025, - - 2.5, 0.3, 2.25, - - 2.3, 0.3, 2.025, - - 3, 0.3, 2.25, - - 2.7, 0.3, 2.025, - - 3, 0.3, 1.8, - - 2.7, 0.3, 1.8, - - 2.7, 0, 1.575, - - 2.7, - 0.3, 1.575, - - 3, - 0.3, 1.35, - - 3, 0, 1.35, - - 2.5, 0, 1.125, - - 2.5, - 0.3, 1.125, - - 2.65, - 0.3, 0.9375, - - 2.65, 0, 0.9375, - - 2, - 0.3, 0.9, - - 1.9, - 0.3, 0.6, - - 1.9, 0, 0.6, - - 3, 0.3, 1.35, - - 2.7, 0.3, 1.575, - - 2.65, 0.3, 0.9375, - - 2.5, 0.3, 1.125, - - 1.9, 0.3, 0.6, - - 2, 0.3, 0.9, - 1.7, 0, 1.425, - 1.7, - 0.66, 1.425, - 1.7, - 0.66, 0.6, - 1.7, 0, 0.6, - 2.6, 0, 1.425, - 2.6, - 0.66, 1.425, - 3.1, - 0.66, 0.825, - 3.1, 0, 0.825, - 2.3, 0, 2.1, - 2.3, - 0.25, 2.1, - 2.4, - 0.25, 2.025, - 2.4, 0, 2.025, - 2.7, 0, 2.4, - 2.7, - 0.25, 2.4, - 3.3, - 0.25, 2.4, - 3.3, 0, 2.4, - 1.7, 0.66, 0.6, - 1.7, 0.66, 1.425, - 3.1, 0.66, 0.825, - 2.6, 0.66, 1.425, - 2.4, 0.25, 2.025, - 2.3, 0.25, 2.1, - 3.3, 0.25, 2.4, - 2.7, 0.25, 2.4, - 2.8, 0, 2.475, - 2.8, - 0.25, 2.475, - 3.525, - 0.25, 2.49375, - 3.525, 0, 2.49375, - 2.9, 0, 2.475, - 2.9, - 0.15, 2.475, - 3.45, - 0.15, 2.5125, - 3.45, 0, 2.5125, - 2.8, 0, 2.4, - 2.8, - 0.15, 2.4, - 3.2, - 0.15, 2.4, - 3.2, 0, 2.4, - 3.525, 0.25, 2.49375, - 2.8, 0.25, 2.475, - 3.45, 0.15, 2.5125, - 2.9, 0.15, 2.475, - 3.2, 0.15, 2.4, - 2.8, 0.15, 2.4, - 0, 0, 3.15, - 0.8, 0, 3.15, - 0.8, - 0.45, 3.15, - 0.45, - 0.8, 3.15, - 0, - 0.8, 3.15, - 0, 0, 2.85, - 0.2, 0, 2.7, - 0.2, - 0.112, 2.7, - 0.112, - 0.2, 2.7, - 0, - 0.2, 2.7, - - 0.45, - 0.8, 3.15, - - 0.8, - 0.45, 3.15, - - 0.8, 0, 3.15, - - 0.112, - 0.2, 2.7, - - 0.2, - 0.112, 2.7, - - 0.2, 0, 2.7, - - 0.8, 0.45, 3.15, - - 0.45, 0.8, 3.15, - 0, 0.8, 3.15, - - 0.2, 0.112, 2.7, - - 0.112, 0.2, 2.7, - 0, 0.2, 2.7, - 0.45, 0.8, 3.15, - 0.8, 0.45, 3.15, - 0.112, 0.2, 2.7, - 0.2, 0.112, 2.7, - 0.4, 0, 2.55, - 0.4, - 0.224, 2.55, - 0.224, - 0.4, 2.55, - 0, - 0.4, 2.55, - 1.3, 0, 2.55, - 1.3, - 0.728, 2.55, - 0.728, - 1.3, 2.55, - 0, - 1.3, 2.55, - 1.3, 0, 2.4, - 1.3, - 0.728, 2.4, - 0.728, - 1.3, 2.4, - 0, - 1.3, 2.4, - - 0.224, - 0.4, 2.55, - - 0.4, - 0.224, 2.55, - - 0.4, 0, 2.55, - - 0.728, - 1.3, 2.55, - - 1.3, - 0.728, 2.55, - - 1.3, 0, 2.55, - - 0.728, - 1.3, 2.4, - - 1.3, - 0.728, 2.4, - - 1.3, 0, 2.4, - - 0.4, 0.224, 2.55, - - 0.224, 0.4, 2.55, - 0, 0.4, 2.55, - - 1.3, 0.728, 2.55, - - 0.728, 1.3, 2.55, - 0, 1.3, 2.55, - - 1.3, 0.728, 2.4, - - 0.728, 1.3, 2.4, - 0, 1.3, 2.4, - 0.224, 0.4, 2.55, - 0.4, 0.224, 2.55, - 0.728, 1.3, 2.55, - 1.3, 0.728, 2.55, - 0.728, 1.3, 2.4, - 1.3, 0.728, 2.4, - 0, 0, 0, - 1.425, 0, 0, - 1.425, 0.798, 0, - 0.798, 1.425, 0, - 0, 1.425, 0, - 1.5, 0, 0.075, - 1.5, 0.84, 0.075, - 0.84, 1.5, 0.075, - 0, 1.5, 0.075, - - 0.798, 1.425, 0, - - 1.425, 0.798, 0, - - 1.425, 0, 0, - - 0.84, 1.5, 0.075, - - 1.5, 0.84, 0.075, - - 1.5, 0, 0.075, - - 1.425, - 0.798, 0, - - 0.798, - 1.425, 0, - 0, - 1.425, 0, - - 1.5, - 0.84, 0.075, - - 0.84, - 1.5, 0.075, - 0, - 1.5, 0.075, - 0.798, - 1.425, 0, - 1.425, - 0.798, 0, - 0.84, - 1.5, 0.075, - 1.5, - 0.84, 0.075 - ]; - - super(); - - // number of segments per patch - segments = Math.max( 2, Math.floor( segments ) ); - - // Jim Blinn scaled the teapot down in size by about 1.3 for - // some rendering tests. He liked the new proportions that he kept - // the data in this form. The model was distributed with these new - // proportions and became the norm. Trivia: comparing images of the - // real teapot and the computer model, the ratio for the bowl of the - // real teapot is more like 1.25, but since 1.3 is the traditional - // value given, we use it here. - const blinnScale = 1.3; - - // scale the size to be the real scaling factor - const maxHeight = 3.15 * ( blinn ? 1 : blinnScale ); - - const maxHeight2 = maxHeight / 2; - const trueSize = size / maxHeight2; - - // Number of elements depends on what is needed. Subtract degenerate - // triangles at tip of bottom and lid out in advance. - let numTriangles = bottom ? ( 8 * segments - 4 ) * segments : 0; - numTriangles += lid ? ( 16 * segments - 4 ) * segments : 0; - numTriangles += body ? 40 * segments * segments : 0; - - const indices = new Uint32Array( numTriangles * 3 ); - - let numVertices = bottom ? 4 : 0; - numVertices += lid ? 8 : 0; - numVertices += body ? 20 : 0; - numVertices *= ( segments + 1 ) * ( segments + 1 ); - - const vertices = new Float32Array( numVertices * 3 ); - const normals = new Float32Array( numVertices * 3 ); - const uvs = new Float32Array( numVertices * 2 ); - - // Bezier form - const ms = new Matrix4(); - ms.set( - - 1.0, 3.0, - 3.0, 1.0, - 3.0, - 6.0, 3.0, 0.0, - - 3.0, 3.0, 0.0, 0.0, - 1.0, 0.0, 0.0, 0.0 ); - - const g = []; - - const sp = []; - const tp = []; - const dsp = []; - const dtp = []; - - // M * G * M matrix, sort of see - // http://www.cs.helsinki.fi/group/goa/mallinnus/curves/surfaces.html - const mgm = []; - - const vert = []; - const sdir = []; - const tdir = []; - - const norm = new Vector3(); - - let tcoord; - - let sval; - let tval; - let p; - let dsval = 0; - let dtval = 0; - - const normOut = new Vector3(); - - const gmx = new Matrix4(); - const tmtx = new Matrix4(); - - const vsp = new Vector4(); - const vtp = new Vector4(); - const vdsp = new Vector4(); - const vdtp = new Vector4(); - - const vsdir = new Vector3(); - const vtdir = new Vector3(); - - const mst = ms.clone(); - mst.transpose(); - - // internal function: test if triangle has any matching vertices; - // if so, don't save triangle, since it won't display anything. - const notDegenerate = ( vtx1, vtx2, vtx3 ) => // if any vertex matches, return false - ! ( ( ( vertices[ vtx1 * 3 ] === vertices[ vtx2 * 3 ] ) && - ( vertices[ vtx1 * 3 + 1 ] === vertices[ vtx2 * 3 + 1 ] ) && - ( vertices[ vtx1 * 3 + 2 ] === vertices[ vtx2 * 3 + 2 ] ) ) || - ( ( vertices[ vtx1 * 3 ] === vertices[ vtx3 * 3 ] ) && - ( vertices[ vtx1 * 3 + 1 ] === vertices[ vtx3 * 3 + 1 ] ) && - ( vertices[ vtx1 * 3 + 2 ] === vertices[ vtx3 * 3 + 2 ] ) ) || ( vertices[ vtx2 * 3 ] === vertices[ vtx3 * 3 ] ) && - ( vertices[ vtx2 * 3 + 1 ] === vertices[ vtx3 * 3 + 1 ] ) && - ( vertices[ vtx2 * 3 + 2 ] === vertices[ vtx3 * 3 + 2 ] ) ); - - - for ( let i = 0; i < 3; i ++ ) { - - mgm[ i ] = new Matrix4(); - - } - - const minPatches = body ? 0 : 20; - const maxPatches = bottom ? 32 : 28; - - const vertPerRow = segments + 1; - - let surfCount = 0; - - let vertCount = 0; - let normCount = 0; - let uvCount = 0; - - let indexCount = 0; - - for ( let surf = minPatches; surf < maxPatches; surf ++ ) { - - // lid is in the middle of the data, patches 20-27, - // so ignore it for this part of the loop if the lid is not desired - if ( lid || ( surf < 20 || surf >= 28 ) ) { - - // get M * G * M matrix for x,y,z - for ( let i = 0; i < 3; i ++ ) { - - // get control patches - for ( let r = 0; r < 4; r ++ ) { - - for ( let c = 0; c < 4; c ++ ) { - - // transposed - g[ c * 4 + r ] = teapotVertices[ teapotPatches[ surf * 16 + r * 4 + c ] * 3 + i ]; - - // is the lid to be made larger, and is this a point on the lid - // that is X or Y? - if ( fitLid && ( surf >= 20 && surf < 28 ) && ( i !== 2 ) ) { - - // increase XY size by 7.7%, found empirically. I don't - // increase Z so that the teapot will continue to fit in the - // space -1 to 1 for Y (Y is up for the final model). - g[ c * 4 + r ] *= 1.077; - - } - - // Blinn "fixed" the teapot by dividing Z by blinnScale, and that's the - // data we now use. The original teapot is taller. Fix it: - if ( ! blinn && ( i === 2 ) ) { - - g[ c * 4 + r ] *= blinnScale; - - } - - } - - } - - gmx.set( g[ 0 ], g[ 1 ], g[ 2 ], g[ 3 ], g[ 4 ], g[ 5 ], g[ 6 ], g[ 7 ], g[ 8 ], g[ 9 ], g[ 10 ], g[ 11 ], g[ 12 ], g[ 13 ], g[ 14 ], g[ 15 ] ); - - tmtx.multiplyMatrices( gmx, ms ); - mgm[ i ].multiplyMatrices( mst, tmtx ); - - } - - // step along, get points, and output - for ( let sstep = 0; sstep <= segments; sstep ++ ) { - - const s = sstep / segments; - - for ( let tstep = 0; tstep <= segments; tstep ++ ) { - - const t = tstep / segments; - - // point from basis - // get power vectors and their derivatives - for ( p = 4, sval = tval = 1.0; p --; ) { - - sp[ p ] = sval; - tp[ p ] = tval; - sval *= s; - tval *= t; - - if ( p === 3 ) { - - dsp[ p ] = dtp[ p ] = 0.0; - dsval = dtval = 1.0; - - } else { - - dsp[ p ] = dsval * ( 3 - p ); - dtp[ p ] = dtval * ( 3 - p ); - dsval *= s; - dtval *= t; - - } - - } - - vsp.fromArray( sp ); - vtp.fromArray( tp ); - vdsp.fromArray( dsp ); - vdtp.fromArray( dtp ); - - // do for x,y,z - for ( let i = 0; i < 3; i ++ ) { - - // multiply power vectors times matrix to get value - tcoord = vsp.clone(); - tcoord.applyMatrix4( mgm[ i ] ); - vert[ i ] = tcoord.dot( vtp ); - - // get s and t tangent vectors - tcoord = vdsp.clone(); - tcoord.applyMatrix4( mgm[ i ] ); - sdir[ i ] = tcoord.dot( vtp ); - - tcoord = vsp.clone(); - tcoord.applyMatrix4( mgm[ i ] ); - tdir[ i ] = tcoord.dot( vdtp ); - - } - - // find normal - vsdir.fromArray( sdir ); - vtdir.fromArray( tdir ); - norm.crossVectors( vtdir, vsdir ); - norm.normalize(); - - // if X and Z length is 0, at the cusp, so point the normal up or down, depending on patch number - if ( vert[ 0 ] === 0 && vert[ 1 ] === 0 ) { - - // if above the middle of the teapot, normal points up, else down - normOut.set( 0, vert[ 2 ] > maxHeight2 ? 1 : - 1, 0 ); - - } else { - - // standard output: rotate on X axis - normOut.set( norm.x, norm.z, - norm.y ); - - } - - // store it all - vertices[ vertCount ++ ] = trueSize * vert[ 0 ]; - vertices[ vertCount ++ ] = trueSize * ( vert[ 2 ] - maxHeight2 ); - vertices[ vertCount ++ ] = - trueSize * vert[ 1 ]; - - normals[ normCount ++ ] = normOut.x; - normals[ normCount ++ ] = normOut.y; - normals[ normCount ++ ] = normOut.z; - - uvs[ uvCount ++ ] = 1 - t; - uvs[ uvCount ++ ] = 1 - s; - - } - - } - - // save the faces - for ( let sstep = 0; sstep < segments; sstep ++ ) { - - for ( let tstep = 0; tstep < segments; tstep ++ ) { - - const v1 = surfCount * vertPerRow * vertPerRow + sstep * vertPerRow + tstep; - const v2 = v1 + 1; - const v3 = v2 + vertPerRow; - const v4 = v1 + vertPerRow; - - // Normals and UVs cannot be shared. Without clone(), you can see the consequences - // of sharing if you call geometry.applyMatrix4( matrix ). - if ( notDegenerate( v1, v2, v3 ) ) { - - indices[ indexCount ++ ] = v1; - indices[ indexCount ++ ] = v2; - indices[ indexCount ++ ] = v3; - - } - - if ( notDegenerate( v1, v3, v4 ) ) { - - indices[ indexCount ++ ] = v1; - indices[ indexCount ++ ] = v3; - indices[ indexCount ++ ] = v4; - - } - - } - - } - - // increment only if a surface was used - surfCount ++; - - } - - } - - this.setIndex( new BufferAttribute( indices, 1 ) ); - this.setAttribute( 'position', new BufferAttribute( vertices, 3 ) ); - this.setAttribute( 'normal', new BufferAttribute( normals, 3 ) ); - this.setAttribute( 'uv', new BufferAttribute( uvs, 2 ) ); - - this.computeBoundingSphere(); - - } - -} - -export { TeapotGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TextGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TextGeometry.js deleted file mode 100644 index c80bae7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/geometries/TextGeometry.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Text = 3D Text - * - * parameters = { - * font: , // font - * - * size: , // size of the text - * depth: , // 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 - * } - */ - -import { - ExtrudeGeometry -} from '/static/javascript/three/build/three.module.js'; - -class TextGeometry extends ExtrudeGeometry { - - constructor( text, parameters = {} ) { - - const font = parameters.font; - - if ( font === undefined ) { - - super(); // generate default extrude geometry - - } else { - - const shapes = font.generateShapes( text, parameters.size ); - - // translate parameters to ExtrudeGeometry API - - if ( parameters.depth === undefined && parameters.height !== undefined ) { - - console.warn( 'THREE.TextGeometry: .height is now depreciated. Please use .depth instead' ); // @deprecated, r163 - - } - - parameters.depth = parameters.depth !== undefined ? - 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'; - - } - -} - - -export { TextGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/LightProbeHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/LightProbeHelper.js deleted file mode 100644 index e20033c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/LightProbeHelper.js +++ /dev/null @@ -1,130 +0,0 @@ -import { - Mesh, - ShaderMaterial, - SphereGeometry -} from '/static/javascript/three/build/three.module.js'; - -class LightProbeHelper extends Mesh { - - constructor( lightProbe, size ) { - - const material = new ShaderMaterial( { - - type: 'LightProbeHelperMaterial', - - uniforms: { - - sh: { value: lightProbe.sh.coefficients }, // by reference - - intensity: { value: lightProbe.intensity } - - }, - - vertexShader: [ - - 'varying vec3 vNormal;', - - 'void main() {', - - ' vNormal = normalize( normalMatrix * normal );', - - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - - '}', - - ].join( '\n' ), - - fragmentShader: [ - - '#define RECIPROCAL_PI 0.318309886', - - 'vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {', - - ' // matrix is assumed to be orthogonal', - - ' return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );', - - '}', - - '// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf', - 'vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {', - - ' // normal is assumed to have unit length', - - ' float x = normal.x, y = normal.y, z = normal.z;', - - ' // band 0', - ' vec3 result = shCoefficients[ 0 ] * 0.886227;', - - ' // band 1', - ' result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;', - ' result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;', - ' result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;', - - ' // band 2', - ' 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;', - - '}', - - 'uniform vec3 sh[ 9 ]; // sh coefficients', - - 'uniform float intensity; // light probe intensity', - - 'varying vec3 vNormal;', - - 'void main() {', - - ' vec3 normal = normalize( vNormal );', - - ' vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );', - - ' vec3 irradiance = shGetIrradianceAt( worldNormal, sh );', - - ' vec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;', - - ' gl_FragColor = linearToOutputTexel( vec4( outgoingLight, 1.0 ) );', - - '}' - - ].join( '\n' ) - - } ); - - const geometry = new SphereGeometry( 1, 32, 16 ); - - super( geometry, material ); - - this.lightProbe = lightProbe; - this.size = size; - this.type = 'LightProbeHelper'; - - this.onBeforeRender(); - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - - onBeforeRender() { - - this.position.copy( this.lightProbe.position ); - - this.scale.set( 1, 1, 1 ).multiplyScalar( this.size ); - - this.material.uniforms.intensity.value = this.lightProbe.intensity; - - } - -} - -export { LightProbeHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/OctreeHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/OctreeHelper.js deleted file mode 100644 index b5ee4a6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/OctreeHelper.js +++ /dev/null @@ -1,73 +0,0 @@ -import { - LineSegments, - BufferGeometry, - Float32BufferAttribute, - LineBasicMaterial -} from '/static/javascript/three/build/three.module.js'; - -class OctreeHelper extends LineSegments { - - constructor( octree, color = 0xffff00 ) { - - super( new BufferGeometry(), new LineBasicMaterial( { color: color, toneMapped: false } ) ); - - this.octree = octree; - this.color = color; - - this.type = 'OctreeHelper'; - - this.update(); - - } - - update() { - - const vertices = []; - - function traverse( tree ) { - - for ( let i = 0; i < tree.length; i ++ ) { - - const min = tree[ i ].box.min; - const max = tree[ i ].box.max; - - vertices.push( max.x, max.y, max.z ); vertices.push( min.x, max.y, max.z ); // 0, 1 - vertices.push( min.x, max.y, max.z ); vertices.push( min.x, min.y, max.z ); // 1, 2 - vertices.push( min.x, min.y, max.z ); vertices.push( max.x, min.y, max.z ); // 2, 3 - vertices.push( max.x, min.y, max.z ); vertices.push( max.x, max.y, max.z ); // 3, 0 - - vertices.push( max.x, max.y, min.z ); vertices.push( min.x, max.y, min.z ); // 4, 5 - vertices.push( min.x, max.y, min.z ); vertices.push( min.x, min.y, min.z ); // 5, 6 - vertices.push( min.x, min.y, min.z ); vertices.push( max.x, min.y, min.z ); // 6, 7 - vertices.push( max.x, min.y, min.z ); vertices.push( max.x, max.y, min.z ); // 7, 4 - - vertices.push( max.x, max.y, max.z ); vertices.push( max.x, max.y, min.z ); // 0, 4 - vertices.push( min.x, max.y, max.z ); vertices.push( min.x, max.y, min.z ); // 1, 5 - vertices.push( min.x, min.y, max.z ); vertices.push( min.x, min.y, min.z ); // 2, 6 - vertices.push( max.x, min.y, max.z ); vertices.push( max.x, min.y, min.z ); // 3, 7 - - traverse( tree[ i ].subTrees ); - - } - - } - - traverse( this.octree.subTrees ); - - this.geometry.dispose(); - - this.geometry = new BufferGeometry(); - this.geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - -} - -export { OctreeHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/PositionalAudioHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/PositionalAudioHelper.js deleted file mode 100644 index 13a5e68..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/PositionalAudioHelper.js +++ /dev/null @@ -1,109 +0,0 @@ -import { - BufferGeometry, - BufferAttribute, - LineBasicMaterial, - Line, - MathUtils -} from '/static/javascript/three/build/three.module.js'; - -class PositionalAudioHelper extends Line { - - constructor( audio, range = 1, divisionsInnerAngle = 16, divisionsOuterAngle = 2 ) { - - const geometry = new BufferGeometry(); - const divisions = divisionsInnerAngle + divisionsOuterAngle * 2; - const positions = new Float32Array( ( divisions * 3 + 3 ) * 3 ); - geometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) ); - - const materialInnerAngle = new LineBasicMaterial( { color: 0x00ff00 } ); - const materialOuterAngle = new LineBasicMaterial( { color: 0xffff00 } ); - - super( geometry, [ materialOuterAngle, materialInnerAngle ] ); - - this.audio = audio; - this.range = range; - this.divisionsInnerAngle = divisionsInnerAngle; - this.divisionsOuterAngle = divisionsOuterAngle; - this.type = 'PositionalAudioHelper'; - - this.update(); - - } - - update() { - - const audio = this.audio; - const range = this.range; - const divisionsInnerAngle = this.divisionsInnerAngle; - const divisionsOuterAngle = this.divisionsOuterAngle; - - const coneInnerAngle = MathUtils.degToRad( audio.panner.coneInnerAngle ); - const coneOuterAngle = MathUtils.degToRad( audio.panner.coneOuterAngle ); - - const halfConeInnerAngle = coneInnerAngle / 2; - const halfConeOuterAngle = coneOuterAngle / 2; - - let start = 0; - let count = 0; - let i; - let stride; - - const geometry = this.geometry; - const positionAttribute = geometry.attributes.position; - - geometry.clearGroups(); - - // - - function generateSegment( from, to, divisions, materialIndex ) { - - const step = ( to - from ) / divisions; - - positionAttribute.setXYZ( start, 0, 0, 0 ); - count ++; - - for ( i = from; i < to; i += step ) { - - stride = start + count; - - positionAttribute.setXYZ( stride, Math.sin( i ) * range, 0, Math.cos( i ) * range ); - positionAttribute.setXYZ( stride + 1, Math.sin( Math.min( i + step, to ) ) * range, 0, Math.cos( Math.min( i + step, to ) ) * range ); - positionAttribute.setXYZ( stride + 2, 0, 0, 0 ); - - count += 3; - - } - - geometry.addGroup( start, count, materialIndex ); - - start += count; - count = 0; - - } - - // - - generateSegment( - halfConeOuterAngle, - halfConeInnerAngle, divisionsOuterAngle, 0 ); - generateSegment( - halfConeInnerAngle, halfConeInnerAngle, divisionsInnerAngle, 1 ); - generateSegment( halfConeInnerAngle, halfConeOuterAngle, divisionsOuterAngle, 0 ); - - // - - positionAttribute.needsUpdate = true; - - if ( coneInnerAngle === coneOuterAngle ) this.material[ 0 ].visible = false; - - } - - dispose() { - - this.geometry.dispose(); - this.material[ 0 ].dispose(); - this.material[ 1 ].dispose(); - - } - -} - - -export { PositionalAudioHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/RectAreaLightHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/RectAreaLightHelper.js deleted file mode 100644 index 030581c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/RectAreaLightHelper.js +++ /dev/null @@ -1,85 +0,0 @@ -import { - BackSide, - BufferGeometry, - Float32BufferAttribute, - Line, - LineBasicMaterial, - Mesh, - MeshBasicMaterial -} from '/static/javascript/three/build/three.module.js'; - -/** - * This helper must be added as a child of the light - */ - -class RectAreaLightHelper extends Line { - - constructor( light, color ) { - - const positions = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ]; - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - geometry.computeBoundingSphere(); - - const material = new LineBasicMaterial( { fog: false } ); - - super( geometry, material ); - - this.light = light; - this.color = color; // optional hardwired color for the helper - this.type = 'RectAreaLightHelper'; - - // - - const positions2 = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ]; - - const geometry2 = new BufferGeometry(); - geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) ); - geometry2.computeBoundingSphere(); - - this.add( new Mesh( geometry2, new MeshBasicMaterial( { side: BackSide, fog: false } ) ) ); - - } - - updateMatrixWorld() { - - this.scale.set( 0.5 * this.light.width, 0.5 * this.light.height, 1 ); - - if ( this.color !== undefined ) { - - this.material.color.set( this.color ); - this.children[ 0 ].material.color.set( this.color ); - - } else { - - this.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity ); - - // prevent hue shift - const c = this.material.color; - const max = Math.max( c.r, c.g, c.b ); - if ( max > 1 ) c.multiplyScalar( 1 / max ); - - this.children[ 0 ].material.color.copy( this.material.color ); - - } - - // ignore world scale on light - this.matrixWorld.extractRotation( this.light.matrixWorld ).scale( this.scale ).copyPosition( this.light.matrixWorld ); - - this.children[ 0 ].matrixWorld.copy( this.matrixWorld ); - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - this.children[ 0 ].geometry.dispose(); - this.children[ 0 ].material.dispose(); - - } - -} - -export { RectAreaLightHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/TextureHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/TextureHelper.js deleted file mode 100644 index 8cc88c6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/TextureHelper.js +++ /dev/null @@ -1,237 +0,0 @@ -import { - BoxGeometry, - BufferAttribute, - DoubleSide, - Mesh, - PlaneGeometry, - ShaderMaterial, - Vector3, -} from '/static/javascript/three/build/three.module.js'; -import { mergeGeometries } from '../utils/BufferGeometryUtils.js'; - -class TextureHelper extends Mesh { - - constructor( texture, width = 1, height = 1, depth = 1 ) { - - const material = new ShaderMaterial( { - - type: 'TextureHelperMaterial', - - side: DoubleSide, - transparent: true, - - uniforms: { - - map: { value: texture }, - alpha: { value: getAlpha( texture ) }, - - }, - - vertexShader: [ - - 'attribute vec3 uvw;', - - 'varying vec3 vUvw;', - - 'void main() {', - - ' vUvw = uvw;', - - ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - - '}', - - ].join( '\n' ), - - fragmentShader: [ - - 'precision highp float;', - - 'precision highp sampler2DArray;', - - 'precision highp sampler3D;', - - 'uniform {samplerType} map;', - - 'uniform float alpha;', - - 'varying vec3 vUvw;', - - 'vec4 textureHelper( in sampler2D map ) { return texture( map, vUvw.xy ); }', - - 'vec4 textureHelper( in sampler2DArray map ) { return texture( map, vUvw ); }', - - 'vec4 textureHelper( in sampler3D map ) { return texture( map, vUvw ); }', - - 'vec4 textureHelper( in samplerCube map ) { return texture( map, vUvw ); }', - - 'void main() {', - - ' gl_FragColor = linearToOutputTexel( vec4( textureHelper( map ).xyz, alpha ) );', - - '}' - - ].join( '\n' ).replace( '{samplerType}', getSamplerType( texture ) ) - - } ); - - const geometry = texture.isCubeTexture - ? createCubeGeometry( width, height, depth ) - : createSliceGeometry( texture, width, height, depth ); - - super( geometry, material ); - - this.texture = texture; - this.type = 'TextureHelper'; - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - -} - -function getSamplerType( texture ) { - - if ( texture.isCubeTexture ) { - - return 'samplerCube'; - - } else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) { - - return 'sampler2DArray'; - - } else if ( texture.isData3DTexture || texture.isCompressed3DTexture ) { - - return 'sampler3D'; - - } else { - - return 'sampler2D'; - - } - -} - -function getImageCount( texture ) { - - if ( texture.isCubeTexture ) { - - return 6; - - } else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) { - - return texture.image.depth; - - } else if ( texture.isData3DTexture || texture.isCompressed3DTexture ) { - - return texture.image.depth; - - } else { - - return 1; - - } - -} - -function getAlpha( texture ) { - - if ( texture.isCubeTexture ) { - - return 1; - - } else if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) { - - return Math.max( 1 / texture.image.depth, 0.25 ); - - } else if ( texture.isData3DTexture || texture.isCompressed3DTexture ) { - - return Math.max( 1 / texture.image.depth, 0.25 ); - - } else { - - return 1; - - } - -} - -function createCubeGeometry( width, height, depth ) { - - const geometry = new BoxGeometry( width, height, depth ); - - const position = geometry.attributes.position; - const uv = geometry.attributes.uv; - const uvw = new BufferAttribute( new Float32Array( uv.count * 3 ), 3 ); - - const _direction = new Vector3(); - - for ( let j = 0, jl = uv.count; j < jl; ++ j ) { - - _direction.fromBufferAttribute( position, j ).normalize(); - - const u = _direction.x; - const v = _direction.y; - const w = _direction.z; - - uvw.setXYZ( j, u, v, w ); - - } - - geometry.deleteAttribute( 'uv' ); - geometry.setAttribute( 'uvw', uvw ); - - return geometry; - -} - -function createSliceGeometry( texture, width, height, depth ) { - - const sliceCount = getImageCount( texture ); - - const geometries = []; - - for ( let i = 0; i < sliceCount; ++ i ) { - - const geometry = new PlaneGeometry( width, height ); - - if ( sliceCount > 1 ) { - - geometry.translate( 0, 0, depth * ( i / ( sliceCount - 1 ) - 0.5 ) ); - - } - - const uv = geometry.attributes.uv; - const uvw = new BufferAttribute( new Float32Array( uv.count * 3 ), 3 ); - - for ( let j = 0, jl = uv.count; j < jl; ++ j ) { - - const u = uv.getX( j ); - const v = texture.flipY ? uv.getY( j ) : 1 - uv.getY( j ); - const w = sliceCount === 1 - ? 1 - : texture.isDataArrayTexture || texture.isCompressedArrayTexture - ? i - : i / ( sliceCount - 1 ); - - uvw.setXYZ( j, u, v, w ); - - } - - geometry.deleteAttribute( 'uv' ); - geometry.setAttribute( 'uvw', uvw ); - - geometries.push( geometry ); - - } - - return mergeGeometries( geometries ); - -} - -export { TextureHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexNormalsHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexNormalsHelper.js deleted file mode 100644 index 45f4142..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexNormalsHelper.js +++ /dev/null @@ -1,96 +0,0 @@ -import { - BufferGeometry, - Float32BufferAttribute, - LineSegments, - LineBasicMaterial, - Matrix3, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _v1 = new Vector3(); -const _v2 = new Vector3(); -const _normalMatrix = new Matrix3(); - -class VertexNormalsHelper extends LineSegments { - - constructor( object, size = 1, color = 0xff0000 ) { - - const geometry = new BufferGeometry(); - - const nNormals = object.geometry.attributes.normal.count; - const positions = new Float32BufferAttribute( nNormals * 2 * 3, 3 ); - - geometry.setAttribute( 'position', positions ); - - super( geometry, new LineBasicMaterial( { color, toneMapped: false } ) ); - - this.object = object; - this.size = size; - this.type = 'VertexNormalsHelper'; - - // - - this.matrixAutoUpdate = false; - - this.update(); - - } - - update() { - - this.object.updateMatrixWorld( true ); - - _normalMatrix.getNormalMatrix( this.object.matrixWorld ); - - const matrixWorld = this.object.matrixWorld; - - const position = this.geometry.attributes.position; - - // - - const objGeometry = this.object.geometry; - - if ( objGeometry ) { - - const objPos = objGeometry.attributes.position; - - const objNorm = objGeometry.attributes.normal; - - let idx = 0; - - // for simplicity, ignore index and drawcalls, and render every normal - - for ( let j = 0, jl = objPos.count; j < jl; j ++ ) { - - _v1.fromBufferAttribute( objPos, j ).applyMatrix4( matrixWorld ); - - _v2.fromBufferAttribute( objNorm, j ); - - _v2.applyMatrix3( _normalMatrix ).normalize().multiplyScalar( this.size ).add( _v1 ); - - position.setXYZ( idx, _v1.x, _v1.y, _v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, _v2.x, _v2.y, _v2.z ); - - idx = idx + 1; - - } - - } - - position.needsUpdate = true; - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - -} - -export { VertexNormalsHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexTangentsHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexTangentsHelper.js deleted file mode 100644 index 3a6ae24..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/VertexTangentsHelper.js +++ /dev/null @@ -1,88 +0,0 @@ -import { - BufferGeometry, - Float32BufferAttribute, - LineSegments, - LineBasicMaterial, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _v1 = new Vector3(); -const _v2 = new Vector3(); - -class VertexTangentsHelper extends LineSegments { - - constructor( object, size = 1, color = 0x00ffff ) { - - const geometry = new BufferGeometry(); - - const nTangents = object.geometry.attributes.tangent.count; - const positions = new Float32BufferAttribute( nTangents * 2 * 3, 3 ); - - geometry.setAttribute( 'position', positions ); - - super( geometry, new LineBasicMaterial( { color, toneMapped: false } ) ); - - this.object = object; - this.size = size; - this.type = 'VertexTangentsHelper'; - - // - - this.matrixAutoUpdate = false; - - this.update(); - - } - - update() { - - this.object.updateMatrixWorld( true ); - - const matrixWorld = this.object.matrixWorld; - - const position = this.geometry.attributes.position; - - // - - const objGeometry = this.object.geometry; - - const objPos = objGeometry.attributes.position; - - const objTan = objGeometry.attributes.tangent; - - let idx = 0; - - // for simplicity, ignore index and drawcalls, and render every tangent - - for ( let j = 0, jl = objPos.count; j < jl; j ++ ) { - - _v1.fromBufferAttribute( objPos, j ).applyMatrix4( matrixWorld ); - - _v2.fromBufferAttribute( objTan, j ); - - _v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( _v1 ); - - position.setXYZ( idx, _v1.x, _v1.y, _v1.z ); - - idx = idx + 1; - - position.setXYZ( idx, _v2.x, _v2.y, _v2.z ); - - idx = idx + 1; - - } - - position.needsUpdate = true; - - } - - dispose() { - - this.geometry.dispose(); - this.material.dispose(); - - } - -} - -export { VertexTangentsHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/ViewHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/ViewHelper.js deleted file mode 100644 index a3abd60..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/helpers/ViewHelper.js +++ /dev/null @@ -1,347 +0,0 @@ -import { - CylinderGeometry, - CanvasTexture, - Color, - Euler, - Mesh, - MeshBasicMaterial, - Object3D, - OrthographicCamera, - Quaternion, - Raycaster, - Sprite, - SpriteMaterial, - SRGBColorSpace, - Vector2, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; - -class ViewHelper extends Object3D { - - constructor( camera, domElement ) { - - super(); - - this.isViewHelper = true; - - this.animating = false; - this.center = new Vector3(); - - const color1 = new Color( '#ff4466' ); - const color2 = new Color( '#88ff44' ); - const color3 = new Color( '#4488ff' ); - const color4 = new Color( '#000000' ); - - const options = {}; - - const interactiveObjects = []; - const raycaster = new Raycaster(); - const mouse = new Vector2(); - const dummy = new Object3D(); - - const orthoCamera = new OrthographicCamera( - 2, 2, 2, - 2, 0, 4 ); - orthoCamera.position.set( 0, 0, 2 ); - - const geometry = new CylinderGeometry( 0.04, 0.04, 0.8, 5 ).rotateZ( - Math.PI / 2 ).translate( 0.4, 0, 0 ); - - const xAxis = new Mesh( geometry, getAxisMaterial( color1 ) ); - const yAxis = new Mesh( geometry, getAxisMaterial( color2 ) ); - const zAxis = new Mesh( geometry, getAxisMaterial( color3 ) ); - - yAxis.rotation.z = Math.PI / 2; - zAxis.rotation.y = - Math.PI / 2; - - this.add( xAxis ); - this.add( zAxis ); - this.add( yAxis ); - - const spriteMaterial1 = getSpriteMaterial( color1 ); - const spriteMaterial2 = getSpriteMaterial( color2 ); - const spriteMaterial3 = getSpriteMaterial( color3 ); - const spriteMaterial4 = getSpriteMaterial( color4 ); - - const posXAxisHelper = new Sprite( spriteMaterial1 ); - const posYAxisHelper = new Sprite( spriteMaterial2 ); - const posZAxisHelper = new Sprite( spriteMaterial3 ); - const negXAxisHelper = new Sprite( spriteMaterial4 ); - const negYAxisHelper = new Sprite( spriteMaterial4 ); - const negZAxisHelper = new Sprite( spriteMaterial4 ); - - posXAxisHelper.position.x = 1; - posYAxisHelper.position.y = 1; - posZAxisHelper.position.z = 1; - negXAxisHelper.position.x = - 1; - negYAxisHelper.position.y = - 1; - negZAxisHelper.position.z = - 1; - - negXAxisHelper.material.opacity = 0.2; - negYAxisHelper.material.opacity = 0.2; - negZAxisHelper.material.opacity = 0.2; - - posXAxisHelper.userData.type = 'posX'; - posYAxisHelper.userData.type = 'posY'; - posZAxisHelper.userData.type = 'posZ'; - negXAxisHelper.userData.type = 'negX'; - negYAxisHelper.userData.type = 'negY'; - negZAxisHelper.userData.type = 'negZ'; - - this.add( posXAxisHelper ); - this.add( posYAxisHelper ); - this.add( posZAxisHelper ); - this.add( negXAxisHelper ); - this.add( negYAxisHelper ); - this.add( negZAxisHelper ); - - interactiveObjects.push( posXAxisHelper ); - interactiveObjects.push( posYAxisHelper ); - interactiveObjects.push( posZAxisHelper ); - interactiveObjects.push( negXAxisHelper ); - interactiveObjects.push( negYAxisHelper ); - interactiveObjects.push( negZAxisHelper ); - - const point = new Vector3(); - const dim = 128; - const turnRate = 2 * Math.PI; // turn rate in angles per second - - this.render = function ( renderer ) { - - this.quaternion.copy( camera.quaternion ).invert(); - this.updateMatrixWorld(); - - point.set( 0, 0, 1 ); - point.applyQuaternion( camera.quaternion ); - - // - - const x = domElement.offsetWidth - dim; - - renderer.clearDepth(); - - renderer.getViewport( viewport ); - renderer.setViewport( x, 0, dim, dim ); - - renderer.render( this, orthoCamera ); - - renderer.setViewport( viewport.x, viewport.y, viewport.z, viewport.w ); - - }; - - const targetPosition = new Vector3(); - const targetQuaternion = new Quaternion(); - - const q1 = new Quaternion(); - const q2 = new Quaternion(); - const viewport = new Vector4(); - let radius = 0; - - this.handleClick = function ( event ) { - - if ( this.animating === true ) return false; - - const rect = domElement.getBoundingClientRect(); - const offsetX = rect.left + ( domElement.offsetWidth - dim ); - const offsetY = rect.top + ( domElement.offsetHeight - dim ); - mouse.x = ( ( event.clientX - offsetX ) / ( rect.right - offsetX ) ) * 2 - 1; - mouse.y = - ( ( event.clientY - offsetY ) / ( rect.bottom - offsetY ) ) * 2 + 1; - - raycaster.setFromCamera( mouse, orthoCamera ); - - const intersects = raycaster.intersectObjects( interactiveObjects ); - - if ( intersects.length > 0 ) { - - const intersection = intersects[ 0 ]; - const object = intersection.object; - - prepareAnimationData( object, this.center ); - - this.animating = true; - - return true; - - } else { - - return false; - - } - - }; - - this.setLabels = function ( labelX, labelY, labelZ ) { - - options.labelX = labelX; - options.labelY = labelY; - options.labelZ = labelZ; - - updateLabels(); - - }; - - this.setLabelStyle = function ( font, color, radius ) { - - options.font = font; - options.color = color; - options.radius = radius; - - updateLabels(); - - }; - - this.update = function ( delta ) { - - const step = delta * turnRate; - - // animate position by doing a slerp and then scaling the position on the unit sphere - - q1.rotateTowards( q2, step ); - camera.position.set( 0, 0, 1 ).applyQuaternion( q1 ).multiplyScalar( radius ).add( this.center ); - - // animate orientation - - camera.quaternion.rotateTowards( targetQuaternion, step ); - - if ( q1.angleTo( q2 ) === 0 ) { - - this.animating = false; - - } - - }; - - this.dispose = function () { - - geometry.dispose(); - - xAxis.material.dispose(); - yAxis.material.dispose(); - zAxis.material.dispose(); - - posXAxisHelper.material.map.dispose(); - posYAxisHelper.material.map.dispose(); - posZAxisHelper.material.map.dispose(); - negXAxisHelper.material.map.dispose(); - negYAxisHelper.material.map.dispose(); - negZAxisHelper.material.map.dispose(); - - posXAxisHelper.material.dispose(); - posYAxisHelper.material.dispose(); - posZAxisHelper.material.dispose(); - negXAxisHelper.material.dispose(); - negYAxisHelper.material.dispose(); - negZAxisHelper.material.dispose(); - - }; - - function prepareAnimationData( object, focusPoint ) { - - switch ( object.userData.type ) { - - case 'posX': - targetPosition.set( 1, 0, 0 ); - targetQuaternion.setFromEuler( new Euler( 0, Math.PI * 0.5, 0 ) ); - break; - - case 'posY': - targetPosition.set( 0, 1, 0 ); - targetQuaternion.setFromEuler( new Euler( - Math.PI * 0.5, 0, 0 ) ); - break; - - case 'posZ': - targetPosition.set( 0, 0, 1 ); - targetQuaternion.setFromEuler( new Euler() ); - break; - - case 'negX': - targetPosition.set( - 1, 0, 0 ); - targetQuaternion.setFromEuler( new Euler( 0, - Math.PI * 0.5, 0 ) ); - break; - - case 'negY': - targetPosition.set( 0, - 1, 0 ); - targetQuaternion.setFromEuler( new Euler( Math.PI * 0.5, 0, 0 ) ); - break; - - case 'negZ': - targetPosition.set( 0, 0, - 1 ); - targetQuaternion.setFromEuler( new Euler( 0, Math.PI, 0 ) ); - break; - - default: - console.error( 'ViewHelper: Invalid axis.' ); - - } - - // - - radius = camera.position.distanceTo( focusPoint ); - targetPosition.multiplyScalar( radius ).add( focusPoint ); - - dummy.position.copy( focusPoint ); - - dummy.lookAt( camera.position ); - q1.copy( dummy.quaternion ); - - dummy.lookAt( targetPosition ); - q2.copy( dummy.quaternion ); - - } - - function getAxisMaterial( color ) { - - return new MeshBasicMaterial( { color: color, toneMapped: false } ); - - } - - function getSpriteMaterial( color, text ) { - - const { font = '24px Arial', color: labelColor = '#000000', radius = 14 } = options; - - const canvas = document.createElement( 'canvas' ); - canvas.width = 64; - canvas.height = 64; - - const context = canvas.getContext( '2d' ); - context.beginPath(); - context.arc( 32, 32, radius, 0, 2 * Math.PI ); - context.closePath(); - context.fillStyle = color.getStyle(); - context.fill(); - - if ( text ) { - - context.font = font; - context.textAlign = 'center'; - context.fillStyle = labelColor; - context.fillText( text, 32, 41 ); - - } - - const texture = new CanvasTexture( canvas ); - texture.colorSpace = SRGBColorSpace; - - return new SpriteMaterial( { map: texture, toneMapped: false } ); - - } - - function updateLabels() { - - posXAxisHelper.material.map.dispose(); - posYAxisHelper.material.map.dispose(); - posZAxisHelper.material.map.dispose(); - - posXAxisHelper.material.dispose(); - posYAxisHelper.material.dispose(); - posZAxisHelper.material.dispose(); - - posXAxisHelper.material = getSpriteMaterial( color1, options.labelX ); - posYAxisHelper.material = getSpriteMaterial( color2, options.labelY ); - posZAxisHelper.material = getSpriteMaterial( color3, options.labelZ ); - - } - - } - -} - -export { ViewHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/HTMLMesh.js b/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/HTMLMesh.js deleted file mode 100644 index 8c8ccb1..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/HTMLMesh.js +++ /dev/null @@ -1,570 +0,0 @@ -import { - CanvasTexture, - LinearFilter, - Mesh, - MeshBasicMaterial, - PlaneGeometry, - SRGBColorSpace, - Color -} from '/static/javascript/three/build/three.module.js'; - -class HTMLMesh extends Mesh { - - constructor( dom ) { - - const texture = new HTMLTexture( dom ); - - const geometry = new PlaneGeometry( texture.image.width * 0.001, texture.image.height * 0.001 ); - const material = new MeshBasicMaterial( { map: texture, toneMapped: false, transparent: true } ); - - super( geometry, material ); - - function onEvent( event ) { - - material.map.dispatchDOMEvent( event ); - - } - - this.addEventListener( 'mousedown', onEvent ); - this.addEventListener( 'mousemove', onEvent ); - this.addEventListener( 'mouseup', onEvent ); - this.addEventListener( 'click', onEvent ); - - this.dispose = function () { - - geometry.dispose(); - material.dispose(); - - material.map.dispose(); - - canvases.delete( dom ); - - this.removeEventListener( 'mousedown', onEvent ); - this.removeEventListener( 'mousemove', onEvent ); - this.removeEventListener( 'mouseup', onEvent ); - this.removeEventListener( 'click', onEvent ); - - }; - - } - -} - -class HTMLTexture extends CanvasTexture { - - constructor( dom ) { - - super( html2canvas( dom ) ); - - this.dom = dom; - - this.anisotropy = 16; - this.colorSpace = SRGBColorSpace; - this.minFilter = LinearFilter; - this.magFilter = LinearFilter; - - // Create an observer on the DOM, and run html2canvas update in the next loop - const observer = new MutationObserver( () => { - - if ( ! this.scheduleUpdate ) { - - // ideally should use xr.requestAnimationFrame, here setTimeout to avoid passing the renderer - this.scheduleUpdate = setTimeout( () => this.update(), 16 ); - - } - - } ); - - const config = { attributes: true, childList: true, subtree: true, characterData: true }; - observer.observe( dom, config ); - - this.observer = observer; - - } - - dispatchDOMEvent( event ) { - - if ( event.data ) { - - htmlevent( this.dom, event.type, event.data.x, event.data.y ); - - } - - } - - update() { - - this.image = html2canvas( this.dom ); - this.needsUpdate = true; - - this.scheduleUpdate = null; - - } - - dispose() { - - if ( this.observer ) { - - this.observer.disconnect(); - - } - - this.scheduleUpdate = clearTimeout( this.scheduleUpdate ); - - super.dispose(); - - } - -} - - -// - -const canvases = new WeakMap(); - -function html2canvas( element ) { - - const range = document.createRange(); - const color = new Color(); - - function Clipper( context ) { - - const clips = []; - let isClipping = false; - - function doClip() { - - if ( isClipping ) { - - isClipping = false; - context.restore(); - - } - - if ( clips.length === 0 ) return; - - let minX = - Infinity, minY = - Infinity; - let maxX = Infinity, maxY = Infinity; - - for ( let i = 0; i < clips.length; i ++ ) { - - const clip = clips[ i ]; - - minX = Math.max( minX, clip.x ); - minY = Math.max( minY, clip.y ); - maxX = Math.min( maxX, clip.x + clip.width ); - maxY = Math.min( maxY, clip.y + clip.height ); - - } - - context.save(); - context.beginPath(); - context.rect( minX, minY, maxX - minX, maxY - minY ); - context.clip(); - - isClipping = true; - - } - - return { - - add: function ( clip ) { - - clips.push( clip ); - doClip(); - - }, - - remove: function () { - - clips.pop(); - doClip(); - - } - - }; - - } - - function drawText( style, x, y, string ) { - - if ( string !== '' ) { - - if ( style.textTransform === 'uppercase' ) { - - string = string.toUpperCase(); - - } - - context.font = style.fontWeight + ' ' + style.fontSize + ' ' + style.fontFamily; - context.textBaseline = 'top'; - context.fillStyle = style.color; - context.fillText( string, x, y + parseFloat( style.fontSize ) * 0.1 ); - - } - - } - - function buildRectPath( x, y, w, h, r ) { - - if ( w < 2 * r ) r = w / 2; - if ( h < 2 * r ) r = h / 2; - - context.beginPath(); - context.moveTo( x + r, y ); - context.arcTo( x + w, y, x + w, y + h, r ); - context.arcTo( x + w, y + h, x, y + h, r ); - context.arcTo( x, y + h, x, y, r ); - context.arcTo( x, y, x + w, y, r ); - context.closePath(); - - } - - function drawBorder( style, which, x, y, width, height ) { - - const borderWidth = style[ which + 'Width' ]; - const borderStyle = style[ which + 'Style' ]; - const borderColor = style[ which + 'Color' ]; - - if ( borderWidth !== '0px' && borderStyle !== 'none' && borderColor !== 'transparent' && borderColor !== 'rgba(0, 0, 0, 0)' ) { - - context.strokeStyle = borderColor; - context.lineWidth = parseFloat( borderWidth ); - context.beginPath(); - context.moveTo( x, y ); - context.lineTo( x + width, y + height ); - context.stroke(); - - } - - } - - function drawElement( element, style ) { - - // Do not render invisible elements, comments and scripts. - if ( element.nodeType === Node.COMMENT_NODE || element.nodeName === 'SCRIPT' || ( element.style && element.style.display === 'none' ) ) { - - return; - - } - - let x = 0, y = 0, width = 0, height = 0; - - if ( element.nodeType === Node.TEXT_NODE ) { - - // text - - range.selectNode( element ); - - const rect = range.getBoundingClientRect(); - - x = rect.left - offset.left - 0.5; - y = rect.top - offset.top - 0.5; - width = rect.width; - height = rect.height; - - drawText( style, x, y, element.nodeValue.trim() ); - - } else if ( element instanceof HTMLCanvasElement ) { - - // Canvas element - - const rect = element.getBoundingClientRect(); - - x = rect.left - offset.left - 0.5; - y = rect.top - offset.top - 0.5; - - context.save(); - const dpr = window.devicePixelRatio; - context.scale( 1 / dpr, 1 / dpr ); - context.drawImage( element, x, y ); - context.restore(); - - } else if ( element instanceof HTMLImageElement ) { - - const rect = element.getBoundingClientRect(); - - x = rect.left - offset.left - 0.5; - y = rect.top - offset.top - 0.5; - width = rect.width; - height = rect.height; - - context.drawImage( element, x, y, width, height ); - - } else { - - const rect = element.getBoundingClientRect(); - - x = rect.left - offset.left - 0.5; - y = rect.top - offset.top - 0.5; - width = rect.width; - height = rect.height; - - style = window.getComputedStyle( element ); - - // Get the border of the element used for fill and border - - buildRectPath( x, y, width, height, parseFloat( style.borderRadius ) ); - - const backgroundColor = style.backgroundColor; - - if ( backgroundColor !== 'transparent' && backgroundColor !== 'rgba(0, 0, 0, 0)' ) { - - context.fillStyle = backgroundColor; - context.fill(); - - } - - // If all the borders match then stroke the round rectangle - - const borders = [ 'borderTop', 'borderLeft', 'borderBottom', 'borderRight' ]; - - let match = true; - let prevBorder = null; - - for ( const border of borders ) { - - if ( prevBorder !== null ) { - - match = ( style[ border + 'Width' ] === style[ prevBorder + 'Width' ] ) && - ( style[ border + 'Color' ] === style[ prevBorder + 'Color' ] ) && - ( style[ border + 'Style' ] === style[ prevBorder + 'Style' ] ); - - } - - if ( match === false ) break; - - prevBorder = border; - - } - - if ( match === true ) { - - // They all match so stroke the rectangle from before allows for border-radius - - const width = parseFloat( style.borderTopWidth ); - - if ( style.borderTopWidth !== '0px' && style.borderTopStyle !== 'none' && style.borderTopColor !== 'transparent' && style.borderTopColor !== 'rgba(0, 0, 0, 0)' ) { - - context.strokeStyle = style.borderTopColor; - context.lineWidth = width; - context.stroke(); - - } - - } else { - - // Otherwise draw individual borders - - drawBorder( style, 'borderTop', x, y, width, 0 ); - drawBorder( style, 'borderLeft', x, y, 0, height ); - drawBorder( style, 'borderBottom', x, y + height, width, 0 ); - drawBorder( style, 'borderRight', x + width, y, 0, height ); - - } - - if ( element instanceof HTMLInputElement ) { - - let accentColor = style.accentColor; - - if ( accentColor === undefined || accentColor === 'auto' ) accentColor = style.color; - - color.set( accentColor ); - - const luminance = Math.sqrt( 0.299 * ( color.r ** 2 ) + 0.587 * ( color.g ** 2 ) + 0.114 * ( color.b ** 2 ) ); - const accentTextColor = luminance < 0.5 ? 'white' : '#111111'; - - if ( element.type === 'radio' ) { - - buildRectPath( x, y, width, height, height ); - - context.fillStyle = 'white'; - context.strokeStyle = accentColor; - context.lineWidth = 1; - context.fill(); - context.stroke(); - - if ( element.checked ) { - - buildRectPath( x + 2, y + 2, width - 4, height - 4, height ); - - context.fillStyle = accentColor; - context.strokeStyle = accentTextColor; - context.lineWidth = 2; - context.fill(); - context.stroke(); - - } - - } - - if ( element.type === 'checkbox' ) { - - buildRectPath( x, y, width, height, 2 ); - - context.fillStyle = element.checked ? accentColor : 'white'; - context.strokeStyle = element.checked ? accentTextColor : accentColor; - context.lineWidth = 1; - context.stroke(); - context.fill(); - - if ( element.checked ) { - - const currentTextAlign = context.textAlign; - - context.textAlign = 'center'; - - const properties = { - color: accentTextColor, - fontFamily: style.fontFamily, - fontSize: height + 'px', - fontWeight: 'bold' - }; - - drawText( properties, x + ( width / 2 ), y, '✔' ); - - context.textAlign = currentTextAlign; - - } - - } - - if ( element.type === 'range' ) { - - const [ min, max, value ] = [ 'min', 'max', 'value' ].map( property => parseFloat( element[ property ] ) ); - const position = ( ( value - min ) / ( max - min ) ) * ( width - height ); - - buildRectPath( x, y + ( height / 4 ), width, height / 2, height / 4 ); - context.fillStyle = accentTextColor; - context.strokeStyle = accentColor; - context.lineWidth = 1; - context.fill(); - context.stroke(); - - buildRectPath( x, y + ( height / 4 ), position + ( height / 2 ), height / 2, height / 4 ); - context.fillStyle = accentColor; - context.fill(); - - buildRectPath( x + position, y, height, height, height / 2 ); - context.fillStyle = accentColor; - context.fill(); - - } - - if ( element.type === 'color' || element.type === 'text' || element.type === 'number' ) { - - clipper.add( { x: x, y: y, width: width, height: height } ); - - drawText( style, x + parseInt( style.paddingLeft ), y + parseInt( style.paddingTop ), element.value ); - - clipper.remove(); - - } - - } - - } - - /* - // debug - context.strokeStyle = '#' + Math.random().toString( 16 ).slice( - 3 ); - context.strokeRect( x - 0.5, y - 0.5, width + 1, height + 1 ); - */ - - const isClipping = style.overflow === 'auto' || style.overflow === 'hidden'; - - if ( isClipping ) clipper.add( { x: x, y: y, width: width, height: height } ); - - for ( let i = 0; i < element.childNodes.length; i ++ ) { - - drawElement( element.childNodes[ i ], style ); - - } - - if ( isClipping ) clipper.remove(); - - } - - const offset = element.getBoundingClientRect(); - - let canvas = canvases.get( element ); - - if ( canvas === undefined ) { - - canvas = document.createElement( 'canvas' ); - canvas.width = offset.width; - canvas.height = offset.height; - canvases.set( element, canvas ); - - } - - const context = canvas.getContext( '2d'/*, { alpha: false }*/ ); - - const clipper = new Clipper( context ); - - // console.time( 'drawElement' ); - - context.clearRect( 0, 0, canvas.width, canvas.height ); - - drawElement( element ); - - // console.timeEnd( 'drawElement' ); - - return canvas; - -} - -function htmlevent( element, event, x, y ) { - - const mouseEventInit = { - clientX: ( x * element.offsetWidth ) + element.offsetLeft, - clientY: ( y * element.offsetHeight ) + element.offsetTop, - view: element.ownerDocument.defaultView - }; - - window.dispatchEvent( new MouseEvent( event, mouseEventInit ) ); - - const rect = element.getBoundingClientRect(); - - x = x * rect.width + rect.left; - y = y * rect.height + rect.top; - - function traverse( element ) { - - if ( element.nodeType !== Node.TEXT_NODE && element.nodeType !== Node.COMMENT_NODE ) { - - const rect = element.getBoundingClientRect(); - - if ( x > rect.left && x < rect.right && y > rect.top && y < rect.bottom ) { - - element.dispatchEvent( new MouseEvent( event, mouseEventInit ) ); - - if ( element instanceof HTMLInputElement && element.type === 'range' && ( event === 'mousedown' || event === 'click' ) ) { - - const [ min, max ] = [ 'min', 'max' ].map( property => parseFloat( element[ property ] ) ); - - const width = rect.width; - const offsetX = x - rect.x; - const proportion = offsetX / width; - element.value = min + ( max - min ) * proportion; - element.dispatchEvent( new InputEvent( 'input', { bubbles: true } ) ); - - } - - } - - for ( let i = 0; i < element.childNodes.length; i ++ ) { - - traverse( element.childNodes[ i ] ); - - } - - } - - } - - traverse( element ); - -} - -export { HTMLMesh }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/InteractiveGroup.js b/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/InteractiveGroup.js deleted file mode 100644 index 69b7d50..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/InteractiveGroup.js +++ /dev/null @@ -1,106 +0,0 @@ -import { - Group, - Raycaster, - Vector2 -} from '/static/javascript/three/build/three.module.js'; - -const _pointer = new Vector2(); -const _event = { type: '', data: _pointer }; - -const _raycaster = new Raycaster(); - -class InteractiveGroup extends Group { - - listenToPointerEvents( renderer, camera ) { - - const scope = this; - const raycaster = new Raycaster(); - - const element = renderer.domElement; - - function onPointerEvent( event ) { - - event.stopPropagation(); - - const rect = renderer.domElement.getBoundingClientRect(); - - _pointer.x = ( event.clientX - rect.left ) / rect.width * 2 - 1; - _pointer.y = - ( event.clientY - rect.top ) / rect.height * 2 + 1; - - raycaster.setFromCamera( _pointer, camera ); - - const intersects = raycaster.intersectObjects( scope.children, false ); - - if ( intersects.length > 0 ) { - - const intersection = intersects[ 0 ]; - - const object = intersection.object; - const uv = intersection.uv; - - _event.type = event.type; - _event.data.set( uv.x, 1 - uv.y ); - - object.dispatchEvent( _event ); - - } - - } - - element.addEventListener( 'pointerdown', onPointerEvent ); - element.addEventListener( 'pointerup', onPointerEvent ); - element.addEventListener( 'pointermove', onPointerEvent ); - element.addEventListener( 'mousedown', onPointerEvent ); - element.addEventListener( 'mouseup', onPointerEvent ); - element.addEventListener( 'mousemove', onPointerEvent ); - element.addEventListener( 'click', onPointerEvent ); - - } - - listenToXRControllerEvents( controller ) { - - const scope = this; - - // TODO: Dispatch pointerevents too - - const events = { - 'move': 'mousemove', - 'select': 'click', - 'selectstart': 'mousedown', - 'selectend': 'mouseup' - }; - - function onXRControllerEvent( event ) { - - const controller = event.target; - - _raycaster.setFromXRController( controller ); - - const intersections = _raycaster.intersectObjects( scope.children, false ); - - if ( intersections.length > 0 ) { - - const intersection = intersections[ 0 ]; - - const object = intersection.object; - const uv = intersection.uv; - - _event.type = events[ event.type ]; - _event.data.set( uv.x, 1 - uv.y ); - - object.dispatchEvent( _event ); - - } - - } - - controller.addEventListener( 'move', onXRControllerEvent ); - controller.addEventListener( 'select', onXRControllerEvent ); - controller.addEventListener( 'selectstart', onXRControllerEvent ); - controller.addEventListener( 'selectend', onXRControllerEvent ); - - } - -} - -export { InteractiveGroup }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionBox.js b/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionBox.js deleted file mode 100644 index a5a5693..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionBox.js +++ /dev/null @@ -1,227 +0,0 @@ -import { - Frustum, - Vector3, - Matrix4, - Quaternion, -} from '/static/javascript/three/build/three.module.js'; - -/** - * This is a class to check whether objects are in a selection area in 3D space - */ - -const _frustum = new Frustum(); -const _center = new Vector3(); - -const _tmpPoint = new Vector3(); - -const _vecNear = new Vector3(); -const _vecTopLeft = new Vector3(); -const _vecTopRight = new Vector3(); -const _vecDownRight = new Vector3(); -const _vecDownLeft = new Vector3(); - -const _vecFarTopLeft = new Vector3(); -const _vecFarTopRight = new Vector3(); -const _vecFarDownRight = new Vector3(); -const _vecFarDownLeft = new Vector3(); - -const _vectemp1 = new Vector3(); -const _vectemp2 = new Vector3(); -const _vectemp3 = new Vector3(); - -const _matrix = new Matrix4(); -const _quaternion = new Quaternion(); -const _scale = new Vector3(); - -class SelectionBox { - - constructor( camera, scene, deep = Number.MAX_VALUE ) { - - this.camera = camera; - this.scene = scene; - this.startPoint = new Vector3(); - this.endPoint = new Vector3(); - this.collection = []; - this.instances = {}; - this.deep = deep; - - } - - select( startPoint, endPoint ) { - - this.startPoint = startPoint || this.startPoint; - this.endPoint = endPoint || this.endPoint; - this.collection = []; - - this.updateFrustum( this.startPoint, this.endPoint ); - this.searchChildInFrustum( _frustum, this.scene ); - - return this.collection; - - } - - updateFrustum( startPoint, endPoint ) { - - startPoint = startPoint || this.startPoint; - endPoint = endPoint || this.endPoint; - - // Avoid invalid frustum - - if ( startPoint.x === endPoint.x ) { - - endPoint.x += Number.EPSILON; - - } - - if ( startPoint.y === endPoint.y ) { - - endPoint.y += Number.EPSILON; - - } - - this.camera.updateProjectionMatrix(); - this.camera.updateMatrixWorld(); - - if ( this.camera.isPerspectiveCamera ) { - - _tmpPoint.copy( startPoint ); - _tmpPoint.x = Math.min( startPoint.x, endPoint.x ); - _tmpPoint.y = Math.max( startPoint.y, endPoint.y ); - endPoint.x = Math.max( startPoint.x, endPoint.x ); - endPoint.y = Math.min( startPoint.y, endPoint.y ); - - _vecNear.setFromMatrixPosition( this.camera.matrixWorld ); - _vecTopLeft.copy( _tmpPoint ); - _vecTopRight.set( endPoint.x, _tmpPoint.y, 0 ); - _vecDownRight.copy( endPoint ); - _vecDownLeft.set( _tmpPoint.x, endPoint.y, 0 ); - - _vecTopLeft.unproject( this.camera ); - _vecTopRight.unproject( this.camera ); - _vecDownRight.unproject( this.camera ); - _vecDownLeft.unproject( this.camera ); - - _vectemp1.copy( _vecTopLeft ).sub( _vecNear ); - _vectemp2.copy( _vecTopRight ).sub( _vecNear ); - _vectemp3.copy( _vecDownRight ).sub( _vecNear ); - _vectemp1.normalize(); - _vectemp2.normalize(); - _vectemp3.normalize(); - - _vectemp1.multiplyScalar( this.deep ); - _vectemp2.multiplyScalar( this.deep ); - _vectemp3.multiplyScalar( this.deep ); - _vectemp1.add( _vecNear ); - _vectemp2.add( _vecNear ); - _vectemp3.add( _vecNear ); - - const planes = _frustum.planes; - - planes[ 0 ].setFromCoplanarPoints( _vecNear, _vecTopLeft, _vecTopRight ); - planes[ 1 ].setFromCoplanarPoints( _vecNear, _vecTopRight, _vecDownRight ); - planes[ 2 ].setFromCoplanarPoints( _vecDownRight, _vecDownLeft, _vecNear ); - planes[ 3 ].setFromCoplanarPoints( _vecDownLeft, _vecTopLeft, _vecNear ); - planes[ 4 ].setFromCoplanarPoints( _vecTopRight, _vecDownRight, _vecDownLeft ); - planes[ 5 ].setFromCoplanarPoints( _vectemp3, _vectemp2, _vectemp1 ); - planes[ 5 ].normal.multiplyScalar( - 1 ); - - } else if ( this.camera.isOrthographicCamera ) { - - const left = Math.min( startPoint.x, endPoint.x ); - const top = Math.max( startPoint.y, endPoint.y ); - const right = Math.max( startPoint.x, endPoint.x ); - const down = Math.min( startPoint.y, endPoint.y ); - - _vecTopLeft.set( left, top, - 1 ); - _vecTopRight.set( right, top, - 1 ); - _vecDownRight.set( right, down, - 1 ); - _vecDownLeft.set( left, down, - 1 ); - - _vecFarTopLeft.set( left, top, 1 ); - _vecFarTopRight.set( right, top, 1 ); - _vecFarDownRight.set( right, down, 1 ); - _vecFarDownLeft.set( left, down, 1 ); - - _vecTopLeft.unproject( this.camera ); - _vecTopRight.unproject( this.camera ); - _vecDownRight.unproject( this.camera ); - _vecDownLeft.unproject( this.camera ); - - _vecFarTopLeft.unproject( this.camera ); - _vecFarTopRight.unproject( this.camera ); - _vecFarDownRight.unproject( this.camera ); - _vecFarDownLeft.unproject( this.camera ); - - const planes = _frustum.planes; - - planes[ 0 ].setFromCoplanarPoints( _vecTopLeft, _vecFarTopLeft, _vecFarTopRight ); - planes[ 1 ].setFromCoplanarPoints( _vecTopRight, _vecFarTopRight, _vecFarDownRight ); - planes[ 2 ].setFromCoplanarPoints( _vecFarDownRight, _vecFarDownLeft, _vecDownLeft ); - planes[ 3 ].setFromCoplanarPoints( _vecFarDownLeft, _vecFarTopLeft, _vecTopLeft ); - planes[ 4 ].setFromCoplanarPoints( _vecTopRight, _vecDownRight, _vecDownLeft ); - planes[ 5 ].setFromCoplanarPoints( _vecFarDownRight, _vecFarTopRight, _vecFarTopLeft ); - planes[ 5 ].normal.multiplyScalar( - 1 ); - - } else { - - console.error( 'THREE.SelectionBox: Unsupported camera type.' ); - - } - - } - - searchChildInFrustum( frustum, object ) { - - if ( object.isMesh || object.isLine || object.isPoints ) { - - if ( object.isInstancedMesh ) { - - this.instances[ object.uuid ] = []; - - for ( let instanceId = 0; instanceId < object.count; instanceId ++ ) { - - object.getMatrixAt( instanceId, _matrix ); - _matrix.decompose( _center, _quaternion, _scale ); - _center.applyMatrix4( object.matrixWorld ); - - if ( frustum.containsPoint( _center ) ) { - - this.instances[ object.uuid ].push( instanceId ); - - } - - } - - } else { - - if ( object.geometry.boundingSphere === null ) object.geometry.computeBoundingSphere(); - - _center.copy( object.geometry.boundingSphere.center ); - - _center.applyMatrix4( object.matrixWorld ); - - if ( frustum.containsPoint( _center ) ) { - - this.collection.push( object ); - - } - - } - - } - - if ( object.children.length > 0 ) { - - for ( let x = 0; x < object.children.length; x ++ ) { - - this.searchChildInFrustum( frustum, object.children[ x ] ); - - } - - } - - } - -} - -export { SelectionBox }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionHelper.js b/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionHelper.js deleted file mode 100644 index 313348c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/interactive/SelectionHelper.js +++ /dev/null @@ -1,104 +0,0 @@ -import { Vector2 } from '/static/javascript/three/build/three.module.js'; - -class SelectionHelper { - - constructor( renderer, cssClassName ) { - - this.element = document.createElement( 'div' ); - this.element.classList.add( cssClassName ); - this.element.style.pointerEvents = 'none'; - - this.renderer = renderer; - - this.startPoint = new Vector2(); - this.pointTopLeft = new Vector2(); - this.pointBottomRight = new Vector2(); - - this.isDown = false; - this.enabled = true; - - this.onPointerDown = function ( event ) { - - if ( this.enabled === false ) return; - - this.isDown = true; - this.onSelectStart( event ); - - }.bind( this ); - - this.onPointerMove = function ( event ) { - - if ( this.enabled === false ) return; - - if ( this.isDown ) { - - this.onSelectMove( event ); - - } - - }.bind( this ); - - this.onPointerUp = function ( ) { - - if ( this.enabled === false ) return; - - this.isDown = false; - this.onSelectOver(); - - }.bind( this ); - - this.renderer.domElement.addEventListener( 'pointerdown', this.onPointerDown ); - this.renderer.domElement.addEventListener( 'pointermove', this.onPointerMove ); - this.renderer.domElement.addEventListener( 'pointerup', this.onPointerUp ); - - } - - dispose() { - - this.renderer.domElement.removeEventListener( 'pointerdown', this.onPointerDown ); - this.renderer.domElement.removeEventListener( 'pointermove', this.onPointerMove ); - this.renderer.domElement.removeEventListener( 'pointerup', this.onPointerUp ); - - } - - onSelectStart( event ) { - - this.element.style.display = 'none'; - - this.renderer.domElement.parentElement.appendChild( this.element ); - - this.element.style.left = event.clientX + 'px'; - this.element.style.top = event.clientY + 'px'; - this.element.style.width = '0px'; - this.element.style.height = '0px'; - - this.startPoint.x = event.clientX; - this.startPoint.y = event.clientY; - - } - - onSelectMove( event ) { - - this.element.style.display = 'block'; - - this.pointBottomRight.x = Math.max( this.startPoint.x, event.clientX ); - this.pointBottomRight.y = Math.max( this.startPoint.y, event.clientY ); - this.pointTopLeft.x = Math.min( this.startPoint.x, event.clientX ); - this.pointTopLeft.y = Math.min( this.startPoint.y, event.clientY ); - - this.element.style.left = this.pointTopLeft.x + 'px'; - this.element.style.top = this.pointTopLeft.y + 'px'; - this.element.style.width = ( this.pointBottomRight.x - this.pointTopLeft.x ) + 'px'; - this.element.style.height = ( this.pointBottomRight.y - this.pointTopLeft.y ) + 'px'; - - } - - onSelectOver() { - - this.element.parentElement.removeChild( this.element ); - - } - -} - -export { SelectionHelper }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/ktx-parse.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/ktx-parse.module.js deleted file mode 100644 index c1d66bc..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/ktx-parse.module.js +++ /dev/null @@ -1 +0,0 @@ -const t=0,e=1,n=2,i=3,s=0,a=0,r=2,o=0,l=1,f=160,U=161,c=162,h=163,_=0,p=1,g=0,y=1,x=2,u=3,b=4,d=5,m=6,w=7,D=8,B=9,L=10,A=11,k=12,v=13,S=14,I=15,O=16,T=17,V=18,E=0,F=1,P=2,C=3,z=4,M=5,W=6,N=7,H=8,K=9,X=10,j=11,R=0,Y=1,q=2,G=13,J=14,Q=15,Z=128,$=64,tt=32,et=16,nt=0,it=1,st=2,at=3,rt=4,ot=5,lt=6,ft=7,Ut=8,ct=9,ht=10,_t=13,pt=14,gt=15,yt=16,xt=17,ut=20,bt=21,dt=22,mt=23,wt=24,Dt=27,Bt=28,Lt=29,At=30,kt=31,vt=34,St=35,It=36,Ot=37,Tt=38,Vt=41,Et=42,Ft=43,Pt=44,Ct=45,zt=48,Mt=49,Wt=50,Nt=58,Ht=59,Kt=62,Xt=63,jt=64,Rt=65,Yt=68,qt=69,Gt=70,Jt=71,Qt=74,Zt=75,$t=76,te=77,ee=78,ne=81,ie=82,se=83,ae=84,re=85,oe=88,le=89,fe=90,Ue=91,ce=92,he=95,_e=96,pe=97,ge=98,ye=99,xe=100,ue=101,be=102,de=103,me=104,we=105,De=106,Be=107,Le=108,Ae=109,ke=110,ve=111,Se=112,Ie=113,Oe=114,Te=115,Ve=116,Ee=117,Fe=118,Pe=119,Ce=120,ze=121,Me=122,We=123,Ne=124,He=125,Ke=126,Xe=127,je=128,Re=129,Ye=130,qe=131,Ge=132,Je=133,Qe=134,Ze=135,$e=136,tn=137,en=138,nn=139,sn=140,an=141,rn=142,on=143,ln=144,fn=145,Un=146,cn=147,hn=148,_n=149,pn=150,gn=151,yn=152,xn=153,un=154,bn=155,dn=156,mn=157,wn=158,Dn=159,Bn=160,Ln=161,An=162,kn=163,vn=164,Sn=165,In=166,On=167,Tn=168,Vn=169,En=170,Fn=171,Pn=172,Cn=173,zn=174,Mn=175,Wn=176,Nn=177,Hn=178,Kn=179,Xn=180,jn=181,Rn=182,Yn=183,qn=184,Gn=1000156007,Jn=1000156008,Qn=1000156009,Zn=1000156010,$n=1000156011,ti=1000156017,ei=1000156018,ni=1000156019,ii=1000156020,si=1000156021,ai=1000054e3,ri=1000054001,oi=1000054002,li=1000054003,fi=1000054004,Ui=1000054005,ci=1000054006,hi=1000054007,_i=1000066e3,pi=1000066001,gi=1000066002,yi=1000066003,xi=1000066004,ui=1000066005,bi=1000066006,di=1000066007,mi=1000066008,wi=1000066009,Di=1000066010,Bi=1000066011,Li=1000066012,Ai=1000066013,ki=100034e4,vi=1000340001;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(t,e,n,i){this._dataView=new DataView(t.buffer,t.byteOffset+e,n),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==e&&i0?c+a.byteLength:0;h%8&&(h+=8-h%8);const _=[],p=new DataView(new ArrayBuffer(3*t.levels.length*8));let g=(h||c+a.byteLength)+n.byteLength;for(let e=0;e0?h:0),!0),x.setBigUint64(60,BigInt(n.byteLength),!0),new Uint8Array(Fi([new Uint8Array(Ti).buffer,y,p.buffer,o,a,h>0?new ArrayBuffer(h-(c+a.byteLength)):new ArrayBuffer(0),n,..._]))}export{Q as KHR_DF_CHANNEL_RGBSDA_ALPHA,q as KHR_DF_CHANNEL_RGBSDA_BLUE,J as KHR_DF_CHANNEL_RGBSDA_DEPTH,Y as KHR_DF_CHANNEL_RGBSDA_GREEN,R as KHR_DF_CHANNEL_RGBSDA_RED,G as KHR_DF_CHANNEL_RGBSDA_STENCIL,p as KHR_DF_FLAG_ALPHA_PREMULTIPLIED,_ as KHR_DF_FLAG_ALPHA_STRAIGHT,s as KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,c as KHR_DF_MODEL_ASTC,f as KHR_DF_MODEL_ETC1,h as KHR_DF_MODEL_ETC1S,U as KHR_DF_MODEL_ETC2,l as KHR_DF_MODEL_RGBSDA,o as KHR_DF_MODEL_UNSPECIFIED,W as KHR_DF_PRIMARIES_ACES,N as KHR_DF_PRIMARIES_ACESCC,j as KHR_DF_PRIMARIES_ADOBERGB,z as KHR_DF_PRIMARIES_BT2020,P as KHR_DF_PRIMARIES_BT601_EBU,C as KHR_DF_PRIMARIES_BT601_SMPTE,F as KHR_DF_PRIMARIES_BT709,M as KHR_DF_PRIMARIES_CIEXYZ,X as KHR_DF_PRIMARIES_DISPLAYP3,H as KHR_DF_PRIMARIES_NTSC1953,K as KHR_DF_PRIMARIES_PAL525,E as KHR_DF_PRIMARIES_UNSPECIFIED,tt as KHR_DF_SAMPLE_DATATYPE_EXPONENT,Z as KHR_DF_SAMPLE_DATATYPE_FLOAT,et as KHR_DF_SAMPLE_DATATYPE_LINEAR,$ as KHR_DF_SAMPLE_DATATYPE_SIGNED,O as KHR_DF_TRANSFER_ACESCC,T as KHR_DF_TRANSFER_ACESCCT,V as KHR_DF_TRANSFER_ADOBERGB,w as KHR_DF_TRANSFER_BT1886,k as KHR_DF_TRANSFER_DCIP3,B as KHR_DF_TRANSFER_HLG_EOTF,D as KHR_DF_TRANSFER_HLG_OETF,u as KHR_DF_TRANSFER_ITU,y as KHR_DF_TRANSFER_LINEAR,b as KHR_DF_TRANSFER_NTSC,S as KHR_DF_TRANSFER_PAL625_EOTF,v as KHR_DF_TRANSFER_PAL_OETF,L as KHR_DF_TRANSFER_PQ_EOTF,A as KHR_DF_TRANSFER_PQ_OETF,d as KHR_DF_TRANSFER_SLOG,m as KHR_DF_TRANSFER_SLOG2,x as KHR_DF_TRANSFER_SRGB,I as KHR_DF_TRANSFER_ST240,g as KHR_DF_TRANSFER_UNSPECIFIED,a as KHR_DF_VENDORID_KHRONOS,r as KHR_DF_VERSION,e as KHR_SUPERCOMPRESSION_BASISLZ,t as KHR_SUPERCOMPRESSION_NONE,i as KHR_SUPERCOMPRESSION_ZLIB,n as KHR_SUPERCOMPRESSION_ZSTD,Si as KTX2Container,Ut as VK_FORMAT_A1R5G5B5_UNORM_PACK16,qt as VK_FORMAT_A2B10G10R10_SINT_PACK32,Rt as VK_FORMAT_A2B10G10R10_SNORM_PACK32,Yt as VK_FORMAT_A2B10G10R10_UINT_PACK32,jt as VK_FORMAT_A2B10G10R10_UNORM_PACK32,Xt as VK_FORMAT_A2R10G10B10_SINT_PACK32,Ht as VK_FORMAT_A2R10G10B10_SNORM_PACK32,Kt as VK_FORMAT_A2R10G10B10_UINT_PACK32,Nt as VK_FORMAT_A2R10G10B10_UNORM_PACK32,vi as VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT,ki as VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT,Bi as VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT,Xn as VK_FORMAT_ASTC_10x10_SRGB_BLOCK,Kn as VK_FORMAT_ASTC_10x10_UNORM_BLOCK,mi as VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT,zn as VK_FORMAT_ASTC_10x5_SRGB_BLOCK,Cn as VK_FORMAT_ASTC_10x5_UNORM_BLOCK,wi as VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT,Wn as VK_FORMAT_ASTC_10x6_SRGB_BLOCK,Mn as VK_FORMAT_ASTC_10x6_UNORM_BLOCK,Di as VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT,Hn as VK_FORMAT_ASTC_10x8_SRGB_BLOCK,Nn as VK_FORMAT_ASTC_10x8_UNORM_BLOCK,Li as VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT,Rn as VK_FORMAT_ASTC_12x10_SRGB_BLOCK,jn as VK_FORMAT_ASTC_12x10_UNORM_BLOCK,Ai as VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT,qn as VK_FORMAT_ASTC_12x12_SRGB_BLOCK,Yn as VK_FORMAT_ASTC_12x12_UNORM_BLOCK,_i as VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT,wn as VK_FORMAT_ASTC_4x4_SRGB_BLOCK,mn as VK_FORMAT_ASTC_4x4_UNORM_BLOCK,pi as VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT,Bn as VK_FORMAT_ASTC_5x4_SRGB_BLOCK,Dn as VK_FORMAT_ASTC_5x4_UNORM_BLOCK,gi as VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT,An as VK_FORMAT_ASTC_5x5_SRGB_BLOCK,Ln as VK_FORMAT_ASTC_5x5_UNORM_BLOCK,yi as VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT,vn as VK_FORMAT_ASTC_6x5_SRGB_BLOCK,kn as VK_FORMAT_ASTC_6x5_UNORM_BLOCK,xi as VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT,In as VK_FORMAT_ASTC_6x6_SRGB_BLOCK,Sn as VK_FORMAT_ASTC_6x6_UNORM_BLOCK,ui as VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT,Tn as VK_FORMAT_ASTC_8x5_SRGB_BLOCK,On as VK_FORMAT_ASTC_8x5_UNORM_BLOCK,bi as VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT,En as VK_FORMAT_ASTC_8x6_SRGB_BLOCK,Vn as VK_FORMAT_ASTC_8x6_UNORM_BLOCK,di as VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT,Pn as VK_FORMAT_ASTC_8x8_SRGB_BLOCK,Fn as VK_FORMAT_ASTC_8x8_UNORM_BLOCK,Me as VK_FORMAT_B10G11R11_UFLOAT_PACK32,$n as VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16,si as VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16,at as VK_FORMAT_B4G4R4A4_UNORM_PACK16,ft as VK_FORMAT_B5G5R5A1_UNORM_PACK16,ot as VK_FORMAT_B5G6R5_UNORM_PACK16,Mt as VK_FORMAT_B8G8R8A8_SINT,Ct as VK_FORMAT_B8G8R8A8_SNORM,Wt as VK_FORMAT_B8G8R8A8_SRGB,zt as VK_FORMAT_B8G8R8A8_UINT,Pt as VK_FORMAT_B8G8R8A8_UNORM,St as VK_FORMAT_B8G8R8_SINT,kt as VK_FORMAT_B8G8R8_SNORM,It as VK_FORMAT_B8G8R8_SRGB,vt as VK_FORMAT_B8G8R8_UINT,At as VK_FORMAT_B8G8R8_UNORM,Qe as VK_FORMAT_BC1_RGBA_SRGB_BLOCK,Je as VK_FORMAT_BC1_RGBA_UNORM_BLOCK,Ge as VK_FORMAT_BC1_RGB_SRGB_BLOCK,qe as VK_FORMAT_BC1_RGB_UNORM_BLOCK,$e as VK_FORMAT_BC2_SRGB_BLOCK,Ze as VK_FORMAT_BC2_UNORM_BLOCK,en as VK_FORMAT_BC3_SRGB_BLOCK,tn as VK_FORMAT_BC3_UNORM_BLOCK,sn as VK_FORMAT_BC4_SNORM_BLOCK,nn as VK_FORMAT_BC4_UNORM_BLOCK,rn as VK_FORMAT_BC5_SNORM_BLOCK,an as VK_FORMAT_BC5_UNORM_BLOCK,ln as VK_FORMAT_BC6H_SFLOAT_BLOCK,on as VK_FORMAT_BC6H_UFLOAT_BLOCK,Un as VK_FORMAT_BC7_SRGB_BLOCK,fn as VK_FORMAT_BC7_UNORM_BLOCK,Ne as VK_FORMAT_D16_UNORM,je as VK_FORMAT_D16_UNORM_S8_UINT,Re as VK_FORMAT_D24_UNORM_S8_UINT,Ke as VK_FORMAT_D32_SFLOAT,Ye as VK_FORMAT_D32_SFLOAT_S8_UINT,We as VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,dn as VK_FORMAT_EAC_R11G11_SNORM_BLOCK,bn as VK_FORMAT_EAC_R11G11_UNORM_BLOCK,un as VK_FORMAT_EAC_R11_SNORM_BLOCK,xn as VK_FORMAT_EAC_R11_UNORM_BLOCK,pn as VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,_n as VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,yn as VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,gn as VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,hn as VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK,cn as VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK,Zn as VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16,ii as VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16,fi as VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG,ai as VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG,Ui as VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG,ri as VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG,ci as VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG,oi as VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG,hi as VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG,li as VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG,Qn as VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16,Jn as VK_FORMAT_R10X6G10X6_UNORM_2PACK16,Gn as VK_FORMAT_R10X6_UNORM_PACK16,ni as VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,ei as VK_FORMAT_R12X4G12X4_UNORM_2PACK16,ti as VK_FORMAT_R12X4_UNORM_PACK16,pe as VK_FORMAT_R16G16B16A16_SFLOAT,_e as VK_FORMAT_R16G16B16A16_SINT,ce as VK_FORMAT_R16G16B16A16_SNORM,he as VK_FORMAT_R16G16B16A16_UINT,Ue as VK_FORMAT_R16G16B16A16_UNORM,fe as VK_FORMAT_R16G16B16_SFLOAT,le as VK_FORMAT_R16G16B16_SINT,re as VK_FORMAT_R16G16B16_SNORM,oe as VK_FORMAT_R16G16B16_UINT,ae as VK_FORMAT_R16G16B16_UNORM,se as VK_FORMAT_R16G16_SFLOAT,ie as VK_FORMAT_R16G16_SINT,ee as VK_FORMAT_R16G16_SNORM,ne as VK_FORMAT_R16G16_UINT,te as VK_FORMAT_R16G16_UNORM,$t as VK_FORMAT_R16_SFLOAT,Zt as VK_FORMAT_R16_SINT,Jt as VK_FORMAT_R16_SNORM,Qt as VK_FORMAT_R16_UINT,Gt as VK_FORMAT_R16_UNORM,Ae as VK_FORMAT_R32G32B32A32_SFLOAT,Le as VK_FORMAT_R32G32B32A32_SINT,Be as VK_FORMAT_R32G32B32A32_UINT,De as VK_FORMAT_R32G32B32_SFLOAT,we as VK_FORMAT_R32G32B32_SINT,me as VK_FORMAT_R32G32B32_UINT,de as VK_FORMAT_R32G32_SFLOAT,be as VK_FORMAT_R32G32_SINT,ue as VK_FORMAT_R32G32_UINT,xe as VK_FORMAT_R32_SFLOAT,ye as VK_FORMAT_R32_SINT,ge as VK_FORMAT_R32_UINT,st as VK_FORMAT_R4G4B4A4_UNORM_PACK16,it as VK_FORMAT_R4G4_UNORM_PACK8,lt as VK_FORMAT_R5G5B5A1_UNORM_PACK16,rt as VK_FORMAT_R5G6B5_UNORM_PACK16,ze as VK_FORMAT_R64G64B64A64_SFLOAT,Ce as VK_FORMAT_R64G64B64A64_SINT,Pe as VK_FORMAT_R64G64B64A64_UINT,Fe as VK_FORMAT_R64G64B64_SFLOAT,Ee as VK_FORMAT_R64G64B64_SINT,Ve as VK_FORMAT_R64G64B64_UINT,Te as VK_FORMAT_R64G64_SFLOAT,Oe as VK_FORMAT_R64G64_SINT,Ie as VK_FORMAT_R64G64_UINT,Se as VK_FORMAT_R64_SFLOAT,ve as VK_FORMAT_R64_SINT,ke as VK_FORMAT_R64_UINT,Et as VK_FORMAT_R8G8B8A8_SINT,Tt as VK_FORMAT_R8G8B8A8_SNORM,Ft as VK_FORMAT_R8G8B8A8_SRGB,Vt as VK_FORMAT_R8G8B8A8_UINT,Ot as VK_FORMAT_R8G8B8A8_UNORM,Bt as VK_FORMAT_R8G8B8_SINT,wt as VK_FORMAT_R8G8B8_SNORM,Lt as VK_FORMAT_R8G8B8_SRGB,Dt as VK_FORMAT_R8G8B8_UINT,mt as VK_FORMAT_R8G8B8_UNORM,bt as VK_FORMAT_R8G8_SINT,xt as VK_FORMAT_R8G8_SNORM,dt as VK_FORMAT_R8G8_SRGB,ut as VK_FORMAT_R8G8_UINT,yt as VK_FORMAT_R8G8_UNORM,pt as VK_FORMAT_R8_SINT,ht as VK_FORMAT_R8_SNORM,gt as VK_FORMAT_R8_SRGB,_t as VK_FORMAT_R8_UINT,ct as VK_FORMAT_R8_UNORM,Xe as VK_FORMAT_S8_UINT,nt as VK_FORMAT_UNDEFINED,He as VK_FORMAT_X8_D24_UNORM_PACK32,Pi as read,Mi as write}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/LightProbeGenerator.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lights/LightProbeGenerator.js deleted file mode 100644 index 6ce8d50..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/LightProbeGenerator.js +++ /dev/null @@ -1,286 +0,0 @@ -import { - Color, - LightProbe, - LinearSRGBColorSpace, - SphericalHarmonics3, - Vector3, - SRGBColorSpace, - NoColorSpace, - HalfFloatType, - DataUtils -} from '/static/javascript/three/build/three.module.js'; - -class LightProbeGenerator { - - // https://www.ppsloan.org/publications/StupidSH36.pdf - static fromCubeTexture( cubeTexture ) { - - let totalWeight = 0; - - const coord = new Vector3(); - - const dir = new Vector3(); - - const color = new Color(); - - const shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - - const sh = new SphericalHarmonics3(); - const shCoefficients = sh.coefficients; - - for ( let faceIndex = 0; faceIndex < 6; faceIndex ++ ) { - - const image = cubeTexture.image[ faceIndex ]; - - const width = image.width; - const height = image.height; - - const canvas = document.createElement( 'canvas' ); - - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext( '2d' ); - - context.drawImage( image, 0, 0, width, height ); - - const imageData = context.getImageData( 0, 0, width, height ); - - const data = imageData.data; - - const imageWidth = imageData.width; // assumed to be square - - const pixelSize = 2 / imageWidth; - - for ( let i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed - - // pixel color - color.setRGB( data[ i ] / 255, data[ i + 1 ] / 255, data[ i + 2 ] / 255 ); - - // convert to linear color space - convertColorToLinear( color, cubeTexture.colorSpace ); - - // pixel coordinate on unit cube - - const pixelIndex = i / 4; - - const col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; - - const row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; - - switch ( faceIndex ) { - - case 0: coord.set( - 1, row, - col ); break; - - case 1: coord.set( 1, row, col ); break; - - case 2: coord.set( - col, 1, - row ); break; - - case 3: coord.set( - col, - 1, row ); break; - - case 4: coord.set( - col, row, 1 ); break; - - case 5: coord.set( col, row, - 1 ); break; - - } - - // weight assigned to this pixel - - const lengthSq = coord.lengthSq(); - - const weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); - - totalWeight += weight; - - // direction vector to this pixel - dir.copy( coord ).normalize(); - - // evaluate SH basis functions in direction dir - SphericalHarmonics3.getBasisAt( dir, shBasis ); - - // accummuulate - for ( let j = 0; j < 9; j ++ ) { - - shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; - shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; - shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; - - } - - } - - } - - // normalize - const norm = ( 4 * Math.PI ) / totalWeight; - - for ( let j = 0; j < 9; j ++ ) { - - shCoefficients[ j ].x *= norm; - shCoefficients[ j ].y *= norm; - shCoefficients[ j ].z *= norm; - - } - - return new LightProbe( sh ); - - } - - static fromCubeRenderTarget( renderer, cubeRenderTarget ) { - - // The renderTarget must be set to RGBA in order to make readRenderTargetPixels works - let totalWeight = 0; - - const coord = new Vector3(); - - const dir = new Vector3(); - - const color = new Color(); - - const shBasis = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]; - - const sh = new SphericalHarmonics3(); - const shCoefficients = sh.coefficients; - - const dataType = cubeRenderTarget.texture.type; - - for ( let faceIndex = 0; faceIndex < 6; faceIndex ++ ) { - - const imageWidth = cubeRenderTarget.width; // assumed to be square - - let data; - - if ( dataType === HalfFloatType ) { - - data = new Uint16Array( imageWidth * imageWidth * 4 ); - - } else { - - // assuming UnsignedByteType - - data = new Uint8Array( imageWidth * imageWidth * 4 ); - - } - - renderer.readRenderTargetPixels( cubeRenderTarget, 0, 0, imageWidth, imageWidth, data, faceIndex ); - - const pixelSize = 2 / imageWidth; - - for ( let i = 0, il = data.length; i < il; i += 4 ) { // RGBA assumed - - let r, g, b; - - if ( dataType === HalfFloatType ) { - - r = DataUtils.fromHalfFloat( data[ i ] ); - g = DataUtils.fromHalfFloat( data[ i + 1 ] ); - b = DataUtils.fromHalfFloat( data[ i + 2 ] ); - - } else { - - r = data[ i ] / 255; - g = data[ i + 1 ] / 255; - b = data[ i + 2 ] / 255; - - } - - // pixel color - color.setRGB( r, g, b ); - - // convert to linear color space - convertColorToLinear( color, cubeRenderTarget.texture.colorSpace ); - - // pixel coordinate on unit cube - - const pixelIndex = i / 4; - - const col = - 1 + ( pixelIndex % imageWidth + 0.5 ) * pixelSize; - - const row = 1 - ( Math.floor( pixelIndex / imageWidth ) + 0.5 ) * pixelSize; - - switch ( faceIndex ) { - - case 0: coord.set( 1, row, - col ); break; - - case 1: coord.set( - 1, row, col ); break; - - case 2: coord.set( col, 1, - row ); break; - - case 3: coord.set( col, - 1, row ); break; - - case 4: coord.set( col, row, 1 ); break; - - case 5: coord.set( - col, row, - 1 ); break; - - } - - // weight assigned to this pixel - - const lengthSq = coord.lengthSq(); - - const weight = 4 / ( Math.sqrt( lengthSq ) * lengthSq ); - - totalWeight += weight; - - // direction vector to this pixel - dir.copy( coord ).normalize(); - - // evaluate SH basis functions in direction dir - SphericalHarmonics3.getBasisAt( dir, shBasis ); - - // accummuulate - for ( let j = 0; j < 9; j ++ ) { - - shCoefficients[ j ].x += shBasis[ j ] * color.r * weight; - shCoefficients[ j ].y += shBasis[ j ] * color.g * weight; - shCoefficients[ j ].z += shBasis[ j ] * color.b * weight; - - } - - } - - } - - // normalize - const norm = ( 4 * Math.PI ) / totalWeight; - - for ( let j = 0; j < 9; j ++ ) { - - shCoefficients[ j ].x *= norm; - shCoefficients[ j ].y *= norm; - shCoefficients[ j ].z *= norm; - - } - - return new LightProbe( sh ); - - } - -} - -function convertColorToLinear( color, colorSpace ) { - - switch ( colorSpace ) { - - case SRGBColorSpace: - - color.convertSRGBToLinear(); - break; - - case LinearSRGBColorSpace: - case NoColorSpace: - - break; - - default: - - console.warn( 'WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.' ); - break; - - } - - return color; - -} - -export { LightProbeGenerator }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightTexturesLib.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightTexturesLib.js deleted file mode 100644 index 72aa525..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightTexturesLib.js +++ /dev/null @@ -1,91 +0,0 @@ -import { - ClampToEdgeWrapping, - DataTexture, - DataUtils, - FloatType, - HalfFloatType, - LinearFilter, - NearestFilter, - RGBAFormat, - UVMapping -} from '/static/javascript/three/build/three.module.js'; - -/** - * Uniforms library for RectAreaLight shared webgl shaders - * - * NOTE: This is a temporary location for the BRDF approximation texture data - * based off of Eric Heitz's work (see citation below). BRDF data for - * RectAreaLight is currently approximated using a precomputed texture - * of roughly 80kb in size. The hope is to find a better way to include - * the large texture data before including the full RectAreaLight implementation - * in the main build files. - * - * TODO: figure out a way to compress the LTC BRDF data - */ - -// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines -// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt -// code: https://github.com/selfshadow/ltc_code/ - -class RectAreaLightTexturesLib { - - static init() { - - // source: https://github.com/selfshadow/ltc_code/tree/master/fit/results/ltc.js - - const LTC_MAT_1 = [ 1, 0, 0, 2e-05, 1, 0, 0, 0.000503905, 1, 0, 0, 0.00201562, 1, 0, 0, 0.00453516, 1, 0, 0, 0.00806253, 1, 0, 0, 0.0125978, 1, 0, 0, 0.018141, 1, 0, 0, 0.0246924, 1, 0, 0, 0.0322525, 1, 0, 0, 0.0408213, 1, 0, 0, 0.0503999, 1, 0, 0, 0.0609894, 1, 0, 0, 0.0725906, 1, 0, 0, 0.0852058, 1, 0, 0, 0.0988363, 1, 0, 0, 0.113484, 1, 0, 0, 0.129153, 1, 0, 0, 0.145839, 1, 0, 0, 0.163548, 1, 0, 0, 0.182266, 1, 0, 0, 0.201942, 1, 0, 0, 0.222314, 1, 0, 0, 0.241906, 1, 0, 0, 0.262314, 1, 0, 0, 0.285754, 1, 0, 0, 0.310159, 1, 0, 0, 0.335426, 1, 0, 0, 0.361341, 1, 0, 0, 0.387445, 1, 0, 0, 0.412784, 1, 0, 0, 0.438197, 1, 0, 0, 0.466966, 1, 0, 0, 0.49559, 1, 0, 0, 0.523448, 1, 0, 0, 0.549938, 1, 0, 0, 0.57979, 1, 0, 0, 0.608746, 1, 0, 0, 0.636185, 1, 0, 0, 0.664748, 1, 0, 0, 0.69313, 1, 0, 0, 0.71966, 1, 0, 0, 0.747662, 1, 0, 0, 0.774023, 1, 0, 0, 0.799775, 1, 0, 0, 0.825274, 1, 0, 0, 0.849156, 1, 0, 0, 0.873248, 1, 0, 0, 0.89532, 1, 0, 0, 0.917565, 1, 0, 0, 0.937863, 1, 0, 0, 0.958139, 1, 0, 0, 0.976563, 1, 0, 0, 0.994658, 1, 0, 0, 1.0112, 1, 0, 0, 1.02712, 1, 0, 0, 1.04189, 1, 0, 0, 1.05568, 1, 0, 0, 1.06877, 1, 0, 0, 1.08058, 1, 0, 0, 1.09194, 1, 0, 0, 1.10191, 1, 0, 0, 1.11161, 1, 0, 0, 1.1199, 1, 0, 0, 1.12813, 0.999547, - 4.48815e-07, 0.0224417, 1.99902e-05, 0.999495, - 1.13079e-05, 0.0224406, 0.000503651, 0.999496, - 4.52317e-05, 0.0224406, 0.00201461, 0.999496, - 0.000101772, 0.0224406, 0.00453287, 0.999495, - 0.000180928, 0.0224406, 0.00805845, 0.999497, - 0.000282702, 0.0224406, 0.0125914, 0.999496, - 0.000407096, 0.0224406, 0.0181319, 0.999498, - 0.000554114, 0.0224406, 0.02468, 0.999499, - 0.000723768, 0.0224406, 0.0322363, 0.999495, - 0.000916058, 0.0224405, 0.0408009, 0.999499, - 0.00113101, 0.0224408, 0.050375, 0.999494, - 0.00136863, 0.0224405, 0.0609586, 0.999489, - 0.00162896, 0.0224401, 0.0725537, 0.999489, - 0.00191201, 0.0224414, 0.0851619, 0.999498, - 0.00221787, 0.0224413, 0.0987867, 0.999492, - 0.00254642, 0.0224409, 0.113426, 0.999507, - 0.00289779, 0.0224417, 0.129088, 0.999494, - 0.0032716, 0.0224386, 0.145767, 0.999546, - 0.0036673, 0.0224424, 0.163472, 0.999543, - 0.00408166, 0.0224387, 0.182182, 0.999499, - 0.00450056, 0.0224338, 0.201843, 0.999503, - 0.00483661, 0.0224203, 0.222198, 0.999546, - 0.00452928, 0.022315, 0.241714, 0.999508, - 0.00587403, 0.0224329, 0.262184, 0.999509, - 0.00638806, 0.0224271, 0.285609, 0.999501, - 0.00691028, 0.0224166, 0.309998, 0.999539, - 0.00741979, 0.0223989, 0.335262, 0.999454, - 0.00786282, 0.0223675, 0.361154, 0.999529, - 0.00811928, 0.0222828, 0.387224, 0.999503, - 0.00799941, 0.0221063, 0.41252, 0.999561, - 0.00952753, 0.0223057, 0.438006, 0.999557, - 0.0099134, 0.0222065, 0.466735, 0.999541, - 0.0100935, 0.0220402, 0.495332, 0.999562, - 0.00996821, 0.0218067, 0.523197, 0.999556, - 0.0105031, 0.0217096, 0.550223, 0.999561, - 0.0114191, 0.0217215, 0.579498, 0.999588, - 0.0111818, 0.0213357, 0.608416, 0.999633, - 0.0107725, 0.0208689, 0.635965, 0.999527, - 0.0121671, 0.0210149, 0.664476, 0.999508, - 0.0116005, 0.020431, 0.692786, 0.999568, - 0.0115604, 0.0199791, 0.719709, 0.999671, - 0.0121117, 0.0197415, 0.74737, 0.999688, - 0.0110769, 0.0188846, 0.773692, 0.99962, - 0.0122368, 0.0188452, 0.799534, 0.999823, - 0.0110325, 0.0178001, 0.825046, 0.999599, - 0.0114923, 0.0174221, 0.849075, 0.999619, - 0.0105923, 0.0164345, 0.872999, 0.999613, - 0.0105988, 0.0158227, 0.895371, 0.99964, - 0.00979861, 0.0148131, 0.917364, 0.99977, - 0.00967238, 0.0140721, 0.938002, 0.999726, - 0.00869175, 0.0129543, 0.957917, 0.99973, - 0.00866872, 0.0122329, 0.976557, 0.999773, - 0.00731956, 0.0108958, 0.994459, 0.999811, - 0.00756027, 0.0102715, 1.01118, 0.999862, - 0.00583732, 0.00878781, 1.02701, 0.999835, - 0.00631438, 0.00827529, 1.04186, 0.999871, - 0.00450785, 0.00674583, 1.05569, 0.999867, - 0.00486079, 0.00621041, 1.06861, 0.999939, - 0.00322072, 0.00478301, 1.08064, 0.999918, - 0.00318199, 0.00406395, 1.09181, 1.00003, - 0.00193348, 0.00280682, 1.10207, 0.999928, - 0.00153729, 0.00198741, 1.11152, 0.999933, - 0.000623666, 0.000917714, 1.12009, 1, - 1.02387e-06, 9.07581e-07, 1.12813, 0.997866, - 8.96716e-07, 0.0448334, 1.99584e-05, 0.997987, - 2.25945e-05, 0.0448389, 0.000502891, 0.997987, - 9.03781e-05, 0.0448388, 0.00201156, 0.997985, - 0.000203351, 0.0448388, 0.00452602, 0.997986, - 0.000361514, 0.0448388, 0.00804629, 0.997987, - 0.00056487, 0.0448389, 0.0125724, 0.997988, - 0.000813423, 0.0448389, 0.0181045, 0.997984, - 0.00110718, 0.0448387, 0.0246427, 0.997985, - 0.00144616, 0.0448388, 0.0321875, 0.997987, - 0.00183038, 0.044839, 0.0407392, 0.997983, - 0.00225987, 0.0448387, 0.0502986, 0.997991, - 0.00273467, 0.0448389, 0.0608667, 0.997984, - 0.00325481, 0.0448384, 0.0724444, 0.998002, - 0.00382043, 0.044839, 0.0850348, 0.997997, - 0.00443145, 0.0448396, 0.0986372, 0.998007, - 0.00508796, 0.0448397, 0.113255, 0.998008, - 0.00578985, 0.04484, 0.128891, 0.998003, - 0.00653683, 0.0448384, 0.145548, 0.997983, - 0.00732713, 0.0448358, 0.163221, 0.997985, - 0.00815454, 0.0448358, 0.181899, 0.998005, - 0.00898985, 0.0448286, 0.201533, 0.998026, - 0.00964404, 0.0447934, 0.221821, 0.998055, - 0.00922677, 0.044611, 0.241282, 0.99804, - 0.0117361, 0.0448245, 0.261791, 0.998048, - 0.0127628, 0.0448159, 0.285181, 0.998088, - 0.0138055, 0.0447996, 0.30954, 0.998058, - 0.0148206, 0.0447669, 0.334751, 0.998099, - 0.0156998, 0.044697, 0.36061, 0.998116, - 0.0161976, 0.0445122, 0.386603, 0.998195, - 0.015945, 0.0441711, 0.411844, 0.998168, - 0.0183947, 0.0444255, 0.43773, 0.998184, - 0.0197913, 0.0443809, 0.466009, 0.998251, - 0.0201426, 0.0440689, 0.494574, 0.998305, - 0.0198847, 0.0435632, 0.522405, 0.998273, - 0.0210577, 0.043414, 0.549967, 0.998254, - 0.0227901, 0.0433943, 0.578655, 0.998349, - 0.0223108, 0.0426529, 0.60758, 0.99843, - 0.0223088, 0.042, 0.635524, 0.998373, - 0.0241141, 0.0418987, 0.663621, 0.998425, - 0.0231446, 0.0408118, 0.691906, 0.998504, - 0.0233684, 0.0400565, 0.719339, 0.998443, - 0.0241652, 0.0394634, 0.74643, 0.99848, - 0.0228715, 0.0380002, 0.773086, 0.998569, - 0.023519, 0.0372322, 0.798988, 0.998619, - 0.0223108, 0.0356468, 0.824249, 0.998594, - 0.0223105, 0.034523, 0.848808, 0.998622, - 0.0213426, 0.0328887, 0.87227, 0.998669, - 0.0207912, 0.0314374, 0.895157, 0.998705, - 0.0198416, 0.0296925, 0.916769, 0.998786, - 0.0189168, 0.0279634, 0.937773, 0.998888, - 0.0178811, 0.0261597, 0.957431, 0.99906, - 0.0166845, 0.0242159, 0.976495, 0.999038, - 0.0155464, 0.0222638, 0.994169, 0.999237, - 0.0141349, 0.0201967, 1.01112, 0.999378, - 0.0129324, 0.0181744, 1.02692, 0.999433, - 0.0113192, 0.0159898, 1.04174, 0.999439, - 0.0101244, 0.0140385, 1.05559, 0.999614, - 0.00837456, 0.0117826, 1.06852, 0.999722, - 0.00721769, 0.00983745, 1.08069, 0.999817, - 0.00554067, 0.00769002, 1.09176, 0.99983, - 0.00426961, 0.005782, 1.10211, 0.999964, - 0.00273904, 0.00374503, 1.11152, 1.00001, - 0.00136739, 0.00187176, 1.12031, 0.999946, 3.93227e-05, - 2.8919e-05, 1.12804, 0.995847, - 1.3435e-06, 0.0671785, 1.9916e-05, 0.995464, - 3.38387e-05, 0.0671527, 0.000501622, 0.99547, - 0.000135355, 0.0671531, 0.00200649, 0.995471, - 0.00030455, 0.0671532, 0.00451461, 0.99547, - 0.000541423, 0.0671531, 0.008026, 0.995471, - 0.00084598, 0.0671531, 0.0125407, 0.99547, - 0.00121823, 0.0671531, 0.0180589, 0.99547, - 0.00165817, 0.0671531, 0.0245806, 0.995463, - 0.00216583, 0.0671526, 0.0321062, 0.995468, - 0.00274127, 0.0671527, 0.0406366, 0.995474, - 0.00338447, 0.0671534, 0.0501717, 0.995473, - 0.00409554, 0.0671533, 0.0607131, 0.995478, - 0.00487451, 0.0671531, 0.0722618, 0.995476, - 0.00572148, 0.0671532, 0.0848191, 0.995477, - 0.00663658, 0.0671539, 0.0983882, 0.995498, - 0.00761986, 0.0671541, 0.112972, 0.995509, - 0.00867094, 0.0671542, 0.128568, 0.995509, - 0.00978951, 0.0671531, 0.145183, 0.995503, - 0.0109725, 0.0671491, 0.162808, 0.995501, - 0.012211, 0.0671465, 0.181441, 0.99553, - 0.0134565, 0.0671371, 0.201015, 0.99555, - 0.014391, 0.0670831, 0.221206, 0.99558, - 0.014351, 0.0668883, 0.240813, 0.995577, - 0.0173997, 0.0671055, 0.261257, 0.995602, - 0.0191111, 0.0671178, 0.284467, 0.995623, - 0.0206705, 0.0670946, 0.308765, 0.995658, - 0.022184, 0.0670472, 0.333905, 0.995705, - 0.0234832, 0.0669417, 0.359677, 0.995719, - 0.0241933, 0.0666714, 0.385554, 0.995786, - 0.0243539, 0.066266, 0.410951, 0.995887, - 0.0271866, 0.0664367, 0.437163, 0.995944, - 0.0296012, 0.0664931, 0.464842, 0.996004, - 0.0301045, 0.0660105, 0.49332, 0.996128, - 0.0298311, 0.0652694, 0.521131, 0.996253, - 0.0316426, 0.0650739, 0.549167, 0.996244, - 0.0339043, 0.0649433, 0.57737, 0.996309, - 0.033329, 0.0638926, 0.606073, 0.996417, - 0.0338935, 0.0630849, 0.634527, 0.996372, - 0.0353104, 0.0625083, 0.66256, 0.996542, - 0.0348942, 0.0611986, 0.690516, 0.996568, - 0.0351614, 0.060069, 0.718317, 0.996711, - 0.0354317, 0.0588522, 0.74528, 0.996671, - 0.0349513, 0.0571902, 0.772061, 0.996865, - 0.0345622, 0.0555321, 0.798089, 0.996802, - 0.0342566, 0.0537816, 0.823178, 0.996992, - 0.0330862, 0.0516095, 0.847949, 0.996944, - 0.0324666, 0.0495537, 0.871431, 0.997146, - 0.0309544, 0.0470302, 0.894357, 0.997189, - 0.0299372, 0.0446043, 0.916142, 0.997471, - 0.0281389, 0.0418812, 0.937193, 0.997515, - 0.0268702, 0.0391823, 0.957, 0.997812, - 0.0247166, 0.0361338, 0.975936, 0.998027, - 0.0233525, 0.0333945, 0.99391, 0.998233, - 0.0209839, 0.0301917, 1.01075, 0.998481, - 0.0194309, 0.027271, 1.02669, 0.998859, - 0.0169728, 0.0240162, 1.04173, 0.99894, - 0.0152322, 0.0210517, 1.05551, 0.999132, - 0.0127497, 0.0178632, 1.06856, 0.999369, - 0.0108282, 0.014787, 1.08054, 0.999549, - 0.00845886, 0.0116185, 1.09185, 0.999805, - 0.0063937, 0.00867209, 1.10207, 0.99985, - 0.00414582, 0.00566823, 1.1117, 0.999912, - 0.00207443, 0.00277562, 1.12022, 1.00001, 8.70226e-05, - 5.3766e-05, 1.12832, 0.991943, - 1.78672e-06, 0.0893382, 1.98384e-05, 0.991952, - 4.50183e-05, 0.089339, 0.000499849, 0.991956, - 0.000180074, 0.0893394, 0.0019994, 0.991955, - 0.000405167, 0.0893393, 0.00449867, 0.991953, - 0.000720298, 0.0893391, 0.00799764, 0.991955, - 0.00112548, 0.0893393, 0.0124964, 0.991957, - 0.0016207, 0.0893395, 0.0179951, 0.991958, - 0.00220601, 0.0893396, 0.0244939, 0.991947, - 0.00288137, 0.0893385, 0.0319929, 0.991962, - 0.00364693, 0.0893399, 0.0404933, 0.991965, - 0.00450264, 0.0893399, 0.049995, 0.99198, - 0.00544862, 0.0893411, 0.0604995, 0.99197, - 0.00648491, 0.0893397, 0.0720074, 0.991976, - 0.00761164, 0.089341, 0.0845207, 0.99198, - 0.00882891, 0.0893405, 0.0980413, 0.991982, - 0.0101367, 0.0893396, 0.112571, 0.992008, - 0.011535, 0.0893415, 0.128115, 0.992026, - 0.0130228, 0.0893414, 0.144672, 0.992064, - 0.0145966, 0.0893418, 0.162241, 0.992041, - 0.0162421, 0.0893359, 0.180801, 0.992086, - 0.0178888, 0.0893214, 0.200302, 0.992157, - 0.0190368, 0.0892401, 0.220332, 0.992181, - 0.0195584, 0.0890525, 0.240144, 0.992175, - 0.0227257, 0.0892153, 0.260728, 0.99221, - 0.0254195, 0.089304, 0.283473, 0.99222, - 0.0274883, 0.0892703, 0.307673, 0.992317, - 0.0294905, 0.0892027, 0.332729, 0.992374, - 0.0311861, 0.0890577, 0.358387, 0.992505, - 0.0320656, 0.0886994, 0.384102, 0.992568, - 0.0329715, 0.0883198, 0.409767, 0.992675, - 0.036006, 0.0883602, 0.436145, 0.992746, - 0.0392897, 0.0884591, 0.463217, 0.992873, - 0.0399337, 0.0878287, 0.491557, 0.992934, - 0.040231, 0.0870108, 0.519516, 0.993091, - 0.0422013, 0.0865857, 0.547741, 0.993259, - 0.0443503, 0.0861937, 0.575792, 0.993455, - 0.0446368, 0.0851187, 0.604233, 0.993497, - 0.0454299, 0.0840576, 0.632925, 0.993694, - 0.0463296, 0.0829671, 0.660985, 0.993718, - 0.0470619, 0.0817185, 0.688714, 0.993973, - 0.0468838, 0.0800294, 0.716743, 0.994207, - 0.046705, 0.0781286, 0.74377, 0.994168, - 0.0469698, 0.0763337, 0.77042, 0.9945, - 0.0456816, 0.0738184, 0.796659, 0.994356, - 0.0455518, 0.0715545, 0.821868, 0.994747, - 0.0439488, 0.0686085, 0.846572, 0.994937, - 0.0430056, 0.065869, 0.870435, 0.995142, - 0.0413414, 0.0626446, 0.893272, 0.995451, - 0.0396521, 0.05929, 0.915376, 0.995445, - 0.0378453, 0.0558503, 0.936196, 0.995967, - 0.0355219, 0.0520949, 0.956376, 0.996094, - 0.0335146, 0.048377, 0.975327, 0.996622, - 0.030682, 0.0442575, 0.993471, 0.996938, - 0.0285504, 0.0404693, 1.01052, 0.997383, - 0.0253399, 0.0360903, 1.02637, 0.997714, - 0.0231651, 0.0322176, 1.04139, 0.998249, - 0.0198138, 0.0278433, 1.05542, 0.998596, - 0.0174337, 0.0238759, 1.06846, 0.998946, - 0.0141349, 0.0195944, 1.08056, 0.99928, - 0.0115603, 0.0156279, 1.09181, 0.999507, - 0.00839065, 0.0114607, 1.10213, 0.999697, - 0.005666, 0.00763325, 1.11169, 0.999869, - 0.00269902, 0.00364946, 1.12042, 1.00001, 6.23836e-05, - 3.19288e-05, 1.12832, 0.987221, - 2.22675e-06, 0.111332, 1.97456e-05, 0.98739, - 5.61116e-05, 0.111351, 0.000497563, 0.987448, - 0.000224453, 0.111357, 0.00199031, 0.987441, - 0.000505019, 0.111357, 0.0044782, 0.987442, - 0.000897816, 0.111357, 0.00796129, 0.987442, - 0.00140284, 0.111357, 0.0124396, 0.987444, - 0.00202012, 0.111357, 0.0179132, 0.987442, - 0.00274964, 0.111357, 0.0243824, 0.987446, - 0.00359147, 0.111357, 0.0318474, 0.987435, - 0.00454562, 0.111356, 0.0403086, 0.987461, - 0.00561225, 0.111358, 0.0497678, 0.987458, - 0.00679125, 0.111358, 0.0602239, 0.987443, - 0.0080828, 0.111356, 0.0716792, 0.987476, - 0.0094872, 0.111358, 0.0841364, 0.98749, - 0.0110044, 0.111361, 0.097597, 0.987508, - 0.0126344, 0.111362, 0.112062, 0.987494, - 0.0143767, 0.111357, 0.127533, 0.987526, - 0.0162307, 0.111359, 0.144015, 0.987558, - 0.0181912, 0.111361, 0.161502, 0.987602, - 0.0202393, 0.111355, 0.179979, 0.987692, - 0.022273, 0.111346, 0.199386, 0.987702, - 0.0235306, 0.111215, 0.219183, 0.987789, - 0.0247628, 0.111061, 0.239202, 0.987776, - 0.0280668, 0.111171, 0.259957, 0.987856, - 0.0316751, 0.111327, 0.282198, 0.987912, - 0.0342468, 0.111282, 0.306294, 0.988, - 0.0367205, 0.111198, 0.331219, 0.988055, - 0.0387766, 0.110994, 0.356708, 0.988241, - 0.0397722, 0.110547, 0.382234, 0.988399, - 0.0416076, 0.110198, 0.408227, 0.988539, - 0.0448192, 0.110137, 0.434662, 0.988661, - 0.0483793, 0.110143, 0.461442, 0.988967, - 0.0495895, 0.109453, 0.489318, 0.989073, - 0.0506797, 0.108628, 0.517516, 0.989274, - 0.0526953, 0.108003, 0.545844, 0.989528, - 0.054578, 0.107255, 0.573823, 0.989709, - 0.0561503, 0.106294, 0.601944, 0.989991, - 0.056866, 0.104896, 0.630855, 0.990392, - 0.0572914, 0.103336, 0.658925, 0.990374, - 0.0586224, 0.10189, 0.686661, 0.990747, - 0.0584764, 0.099783, 0.714548, 0.991041, - 0.0582662, 0.0974309, 0.74186, 0.991236, - 0.0584118, 0.0951678, 0.768422, 0.991585, - 0.0573055, 0.0921581, 0.794817, 0.991984, - 0.0564241, 0.0891167, 0.820336, 0.9921, - 0.0553608, 0.085805, 0.84493, 0.992749, - 0.0533816, 0.0820354, 0.868961, 0.99288, - 0.0518661, 0.0782181, 0.891931, 0.993511, - 0.0492492, 0.0738935, 0.914186, 0.993617, - 0.0471956, 0.0696402, 0.93532, 0.99411, - 0.044216, 0.0649659, 0.95543, 0.994595, - 0.0416654, 0.0603177, 0.974685, 0.994976, - 0.0384314, 0.0553493, 0.992807, 0.995579, - 0.0353491, 0.0503942, 1.00996, 0.996069, - 0.0319787, 0.0452123, 1.02606, 0.996718, - 0.028472, 0.0400112, 1.04114, 0.997173, - 0.0250789, 0.0349456, 1.05517, 0.997818, - 0.0213326, 0.029653, 1.0683, 0.998318, - 0.0178509, 0.024549, 1.0805, 0.998853, - 0.0141118, 0.0194197, 1.09177, 0.999218, - 0.0105914, 0.0143869, 1.1022, 0.999594, - 0.00693474, 0.00943517, 1.11175, 0.99975, - 0.00340478, 0.00464051, 1.12056, 1.00001, 0.000109172, - 0.000112821, 1.12853, 0.983383, - 2.66524e-06, 0.133358, 1.96534e-05, 0.981942, - 6.71009e-05, 0.133162, 0.000494804, 0.981946, - 0.000268405, 0.133163, 0.00197923, 0.981944, - 0.000603912, 0.133163, 0.00445326, 0.981941, - 0.00107362, 0.133162, 0.00791693, 0.981946, - 0.00167755, 0.133163, 0.0123703, 0.981944, - 0.00241569, 0.133162, 0.0178135, 0.981945, - 0.00328807, 0.133163, 0.0242466, 0.981945, - 0.00429472, 0.133162, 0.03167, 0.981955, - 0.00543573, 0.133164, 0.0400846, 0.981951, - 0.00671105, 0.133163, 0.0494901, 0.981968, - 0.00812092, 0.133165, 0.0598886, 0.981979, - 0.00966541, 0.133166, 0.0712811, 0.981996, - 0.0113446, 0.133168, 0.083669, 0.982014, - 0.0131585, 0.133169, 0.0970533, 0.982011, - 0.0151073, 0.133167, 0.111438, 0.982062, - 0.0171906, 0.133172, 0.126826, 0.9821, - 0.0194067, 0.133175, 0.143215, 0.982149, - 0.0217502, 0.133176, 0.160609, 0.982163, - 0.0241945, 0.133173, 0.178981, 0.982247, - 0.0265907, 0.133148, 0.198249, 0.982291, - 0.027916, 0.132974, 0.217795, 0.982396, - 0.0299663, 0.132868, 0.238042, 0.982456, - 0.0334544, 0.132934, 0.258901, 0.982499, - 0.0378636, 0.133137, 0.280639, 0.982617, - 0.0409274, 0.133085, 0.304604, 0.98274, - 0.0438523, 0.132985, 0.329376, 0.982944, - 0.0462288, 0.132728, 0.354697, 0.98308, - 0.0475995, 0.132228, 0.380102, 0.983391, - 0.0501901, 0.131924, 0.406256, 0.983514, - 0.0535899, 0.131737, 0.432735, 0.98373, - 0.0571858, 0.131567, 0.459359, 0.984056, - 0.0592353, 0.130932, 0.486637, 0.984234, - 0.0610488, 0.130092, 0.51509, 0.984748, - 0.0630758, 0.12923, 0.543461, 0.985073, - 0.0647398, 0.128174, 0.571376, 0.985195, - 0.0671941, 0.127133, 0.599414, 0.985734, - 0.0681345, 0.125576, 0.628134, 0.986241, - 0.0686089, 0.123639, 0.656399, 0.986356, - 0.0698511, 0.121834, 0.684258, 0.986894, - 0.0700931, 0.119454, 0.711818, 0.987382, - 0.0698321, 0.116718, 0.739511, 0.988109, - 0.0693975, 0.113699, 0.766267, 0.988363, - 0.0689584, 0.110454, 0.792456, 0.989112, - 0.0672353, 0.106602, 0.81813, 0.989241, - 0.0662034, 0.10267, 0.842889, 0.990333, - 0.0638938, 0.0981381, 0.867204, 0.990591, - 0.0618534, 0.0935388, 0.89038, 0.991106, - 0.0593117, 0.088553, 0.912576, 0.991919, - 0.0562676, 0.0832187, 0.934118, 0.992111, - 0.0534085, 0.0778302, 0.954254, 0.992997, - 0.0495459, 0.0720453, 0.973722, 0.993317, - 0.0463707, 0.0663458, 0.991949, 0.994133, - 0.0421245, 0.0601883, 1.00936, 0.994705, - 0.0384977, 0.0542501, 1.02559, 0.995495, - 0.0340956, 0.0479862, 1.04083, 0.996206, - 0.030105, 0.041887, 1.05497, 0.996971, - 0.0256095, 0.0355355, 1.06824, 0.997796, - 0.0213932, 0.0293655, 1.08056, 0.998272, - 0.0169612, 0.0232926, 1.09182, 0.998857, - 0.0126756, 0.0172786, 1.10219, 0.99939, - 0.00832486, 0.0113156, 1.11192, 0.999752, - 0.00410826, 0.00557892, 1.12075, 1, 0.000150957, - 0.000119101, 1.12885, 0.975169, - 3.09397e-06, 0.154669, 1.95073e-05, 0.975439, - 7.79608e-05, 0.154712, 0.000491534, 0.975464, - 0.000311847, 0.154716, 0.00196617, 0.975464, - 0.000701656, 0.154716, 0.00442387, 0.975462, - 0.0012474, 0.154715, 0.0078647, 0.975461, - 0.00194906, 0.154715, 0.0122886, 0.975464, - 0.00280667, 0.154715, 0.0176959, 0.975468, - 0.00382025, 0.154716, 0.0240867, 0.975471, - 0.00498985, 0.154716, 0.0314612, 0.975472, - 0.00631541, 0.154717, 0.0398199, 0.975486, - 0.00779719, 0.154718, 0.0491639, 0.975489, - 0.00943505, 0.154718, 0.0594932, 0.975509, - 0.0112295, 0.154721, 0.0708113, 0.97554, - 0.0131802, 0.154724, 0.0831176, 0.975557, - 0.0152876, 0.154726, 0.096415, 0.975585, - 0.0175512, 0.154728, 0.110705, 0.975605, - 0.0199713, 0.154729, 0.125992, 0.975645, - 0.0225447, 0.154729, 0.142272, 0.975711, - 0.0252649, 0.154735, 0.159549, 0.975788, - 0.0280986, 0.154736, 0.177805, 0.975872, - 0.0308232, 0.154704, 0.196911, 0.975968, - 0.0324841, 0.154525, 0.216324, 0.976063, - 0.0351281, 0.154432, 0.236628, 0.976157, - 0.0388618, 0.15446, 0.257539, 0.976204, - 0.0437704, 0.154665, 0.278975, 0.976358, - 0.047514, 0.154652, 0.302606, 0.976571, - 0.0508638, 0.154535, 0.327204, 0.976725, - 0.0534995, 0.154221, 0.352276, 0.977013, - 0.0555547, 0.153737, 0.377696, 0.977294, - 0.0586728, 0.153403, 0.403855, 0.977602, - 0.0622715, 0.15312, 0.430333, 0.977932, - 0.0658166, 0.152755, 0.456855, 0.978241, - 0.0689877, 0.152233, 0.483668, 0.978602, - 0.0712805, 0.15132, 0.512097, 0.979234, - 0.0732775, 0.150235, 0.540455, 0.97977, - 0.075163, 0.148978, 0.568486, 0.979995, - 0.0778026, 0.147755, 0.596524, 0.98078, - 0.0791854, 0.146019, 0.624825, 0.981628, - 0.0799666, 0.143906, 0.653403, 0.982067, - 0.0808532, 0.141561, 0.681445, 0.98271, - 0.0816024, 0.139025, 0.708918, 0.983734, - 0.0812511, 0.135764, 0.736594, 0.98431, - 0.0806201, 0.132152, 0.763576, 0.985071, - 0.0801605, 0.12846, 0.789797, 0.98618, - 0.0784208, 0.124084, 0.815804, 0.986886, - 0.0766643, 0.1193, 0.840869, 0.987485, - 0.0747744, 0.114236, 0.864952, 0.988431, - 0.0716701, 0.108654, 0.888431, 0.988886, - 0.0691609, 0.102994, 0.910963, 0.990024, - 0.0654048, 0.0967278, 0.932629, 0.990401, - 0.0619765, 0.090384, 0.95313, 0.991093, - 0.0579296, 0.0837885, 0.972587, 0.992018, - 0.0536576, 0.0770171, 0.991184, 0.992536, - 0.0493719, 0.0701486, 1.00863, 0.993421, - 0.0444813, 0.062953, 1.02494, 0.993928, - 0.040008, 0.0560455, 1.04017, 0.994994, - 0.0347982, 0.04856, 1.05463, 0.995866, - 0.0301017, 0.0416152, 1.06807, 0.996916, - 0.0248225, 0.0342597, 1.08039, 0.997766, - 0.0199229, 0.0271668, 1.09177, 0.998479, - 0.0147422, 0.0201387, 1.10235, 0.99921, - 0.00980173, 0.0131944, 1.11206, 0.999652, - 0.0047426, 0.00640712, 1.12104, 0.999998, 8.91673e-05, - 0.00010379, 1.12906, 0.967868, - 3.51885e-06, 0.175947, 1.93569e-05, 0.968001, - 8.86733e-05, 0.175972, 0.000487782, 0.96801, - 0.000354697, 0.175973, 0.00195115, 0.968012, - 0.000798063, 0.175974, 0.00439006, 0.968011, - 0.00141879, 0.175973, 0.00780461, 0.968011, - 0.00221686, 0.175973, 0.0121948, 0.968016, - 0.00319231, 0.175974, 0.0175607, 0.968019, - 0.00434515, 0.175974, 0.0239027, 0.968018, - 0.00567538, 0.175974, 0.0312208, 0.968033, - 0.00718308, 0.175977, 0.0395158, 0.968049, - 0.00886836, 0.175979, 0.0487885, 0.968047, - 0.0107312, 0.175978, 0.0590394, 0.968072, - 0.0127719, 0.175981, 0.0702705, 0.968108, - 0.0149905, 0.175986, 0.0824836, 0.968112, - 0.0173866, 0.175985, 0.0956783, 0.968173, - 0.0199611, 0.175993, 0.109862, 0.96827, - 0.0227128, 0.176008, 0.125033, 0.968292, - 0.025639, 0.17601, 0.141193, 0.968339, - 0.0287299, 0.176007, 0.158336, 0.968389, - 0.0319399, 0.176001, 0.176441, 0.968501, - 0.034941, 0.175962, 0.195359, 0.968646, - 0.0370812, 0.175793, 0.214686, 0.968789, - 0.0402329, 0.175708, 0.234973, 0.96886, - 0.0442601, 0.1757, 0.255871, 0.969013, - 0.049398, 0.175876, 0.277238, 0.969242, - 0.0539932, 0.17594, 0.300326, 0.969419, - 0.0577299, 0.175781, 0.324702, 0.969763, - 0.0605643, 0.175432, 0.349527, 0.970093, - 0.0634488, 0.174992, 0.374976, 0.970361, - 0.0670589, 0.174611, 0.401097, 0.970825, - 0.0708246, 0.174226, 0.427496, 0.971214, - 0.0742871, 0.173684, 0.453858, 0.971622, - 0.0782608, 0.173186, 0.480637, 0.972175, - 0.0813151, 0.172288, 0.508655, 0.972944, - 0.0832678, 0.170979, 0.536973, 0.973595, - 0.0855964, 0.169573, 0.565138, 0.974345, - 0.0882163, 0.168152, 0.593222, 0.975233, - 0.0901671, 0.166314, 0.621201, 0.976239, - 0.0912111, 0.163931, 0.649919, 0.977289, - 0.0916959, 0.161106, 0.678011, 0.978076, - 0.0927061, 0.158272, 0.705717, 0.979533, - 0.0925562, 0.15475, 0.733228, 0.980335, - 0.0918159, 0.150638, 0.760454, 0.981808, - 0.0908508, 0.146201, 0.786918, 0.983061, - 0.0896172, 0.141386, 0.812953, 0.984148, - 0.0871588, 0.135837, 0.838281, 0.985047, - 0.0850624, 0.130135, 0.862594, 0.986219, - 0.0818541, 0.123882, 0.88633, 0.987043, - 0.0784523, 0.117126, 0.908952, 0.988107, - 0.0749601, 0.110341, 0.930744, 0.988955, - 0.0703548, 0.102885, 0.951728, 0.989426, - 0.0662798, 0.0954167, 0.971166, 0.990421, - 0.0610834, 0.0876331, 0.989984, 0.991032, - 0.0562936, 0.0797785, 1.00765, 0.992041, - 0.0508154, 0.0718166, 1.02434, 0.992794, - 0.0454045, 0.0637125, 1.03976, 0.993691, - 0.0398194, 0.0555338, 1.05418, 0.994778, - 0.0341482, 0.0473388, 1.06772, 0.995915, - 0.028428, 0.0391016, 1.08028, 0.997109, - 0.022642, 0.0309953, 1.09185, 0.998095, - 0.0168738, 0.0230288, 1.10247, 0.998985, - 0.0111274, 0.0150722, 1.11229, 0.999581, - 0.00543881, 0.00740605, 1.12131, 1.00003, 0.000162239, - 0.000105549, 1.12946, 0.959505, - 3.93734e-06, 0.196876, 1.91893e-05, 0.959599, - 9.92157e-05, 0.196895, 0.000483544, 0.959641, - 0.000396868, 0.196903, 0.0019342, 0.959599, - 0.000892948, 0.196895, 0.00435193, 0.959603, - 0.00158747, 0.196896, 0.0077368, 0.959604, - 0.00248042, 0.196896, 0.0120888, 0.959605, - 0.00357184, 0.196896, 0.0174082, 0.959605, - 0.00486169, 0.196896, 0.0236949, 0.959613, - 0.00635008, 0.196897, 0.0309497, 0.959619, - 0.00803696, 0.196898, 0.0391725, 0.959636, - 0.00992255, 0.196901, 0.0483649, 0.959634, - 0.0120067, 0.1969, 0.0585266, 0.959675, - 0.0142898, 0.196906, 0.0696609, 0.959712, - 0.0167717, 0.196911, 0.0817678, 0.959752, - 0.0194524, 0.196918, 0.0948494, 0.959807, - 0.0223321, 0.196925, 0.10891, 0.959828, - 0.0254091, 0.196924, 0.123947, 0.959906, - 0.0286815, 0.196934, 0.139968, 0.960005, - 0.0321371, 0.196944, 0.156968, 0.960071, - 0.0357114, 0.196936, 0.17491, 0.960237, - 0.0389064, 0.196882, 0.193597, 0.960367, - 0.041623, 0.196731, 0.21285, 0.960562, - 0.0452655, 0.196654, 0.233075, 0.960735, - 0.0496207, 0.196643, 0.253941, 0.960913, - 0.0549379, 0.196774, 0.275278, 0.961121, - 0.0603414, 0.196893, 0.297733, 0.96139, - 0.0644244, 0.196717, 0.321877, 0.961818, - 0.067556, 0.196314, 0.346476, 0.962175, - 0.0712709, 0.195917, 0.371907, 0.96255, - 0.0752848, 0.1955, 0.397916, 0.963164, - 0.0792073, 0.195026, 0.424229, 0.963782, - 0.0828225, 0.194424, 0.450637, 0.964306, - 0.0873119, 0.193831, 0.477288, 0.964923, - 0.0911051, 0.192973, 0.504716, 0.966048, - 0.093251, 0.19151, 0.533053, 0.967024, - 0.0958983, 0.190013, 0.561366, 0.968038, - 0.09835, 0.188253, 0.589464, 0.969152, - 0.100754, 0.186257, 0.617433, 0.970557, - 0.102239, 0.183775, 0.645801, 0.972104, - 0.102767, 0.180645, 0.674278, 0.973203, - 0.103492, 0.177242, 0.702004, 0.975123, - 0.103793, 0.17345, 0.729529, 0.97641, - 0.102839, 0.168886, 0.756712, 0.978313, - 0.101687, 0.163892, 0.783801, 0.980036, - 0.100314, 0.158439, 0.809671, 0.981339, - 0.097836, 0.152211, 0.835402, 0.982794, - 0.0950006, 0.145679, 0.860081, 0.984123, - 0.0920994, 0.138949, 0.883757, 0.984918, - 0.0878641, 0.131283, 0.90685, 0.985999, - 0.083939, 0.123464, 0.928786, 0.987151, - 0.0791234, 0.115324, 0.94983, 0.987827, - 0.0739332, 0.106854, 0.96962, 0.988806, - 0.0688088, 0.0982691, 0.98861, 0.989588, - 0.0628962, 0.0893456, 1.00667, 0.990438, - 0.0573146, 0.0805392, 1.02344, 0.991506, - 0.0509433, 0.0713725, 1.03933, 0.992492, - 0.0448724, 0.0623732, 1.05378, 0.993663, - 0.0383497, 0.0530838, 1.06747, 0.994956, - 0.0319593, 0.0439512, 1.08007, 0.99634, - 0.025401, 0.0347803, 1.09182, 0.99761, - 0.0189687, 0.0257954, 1.1025, 0.99863, - 0.0124441, 0.0169893, 1.11247, 0.99947, - 0.00614003, 0.00829498, 1.12151, 1.00008, 0.000216624, - 0.000146107, 1.12993, 0.950129, - 4.34955e-06, 0.217413, 1.90081e-05, 0.950264, - 0.00010957, 0.217444, 0.00047884, 0.9503, - 0.000438299, 0.217451, 0.00191543, 0.950246, - 0.000986124, 0.21744, 0.00430951, 0.950246, - 0.00175311, 0.21744, 0.00766137, 0.950245, - 0.00273923, 0.21744, 0.011971, 0.950253, - 0.00394453, 0.217441, 0.0172385, 0.950258, - 0.00536897, 0.217442, 0.0234641, 0.950267, - 0.00701262, 0.217444, 0.030648, 0.950277, - 0.00887551, 0.217446, 0.038791, 0.950284, - 0.0109576, 0.217446, 0.0478931, 0.950312, - 0.0132591, 0.217451, 0.0579568, 0.950334, - 0.01578, 0.217454, 0.0689821, 0.950378, - 0.0185204, 0.217462, 0.0809714, 0.950417, - 0.0214803, 0.217467, 0.0939265, 0.950488, - 0.0246594, 0.217479, 0.10785, 0.950534, - 0.0280565, 0.217483, 0.122743, 0.950633, - 0.0316685, 0.217498, 0.138611, 0.950698, - 0.0354787, 0.217499, 0.155442, 0.950844, - 0.0394003, 0.217507, 0.173208, 0.950999, - 0.0426812, 0.217419, 0.191605, 0.951221, - 0.0461302, 0.217317, 0.21084, 0.951412, - 0.0502131, 0.217238, 0.230945, 0.951623, - 0.0549183, 0.21722, 0.251745, 0.951867, - 0.0604493, 0.217306, 0.273001, 0.952069, - 0.0665189, 0.217466, 0.294874, 0.952459, - 0.0709179, 0.217266, 0.318732, 0.952996, - 0.0746112, 0.216891, 0.34318, 0.953425, - 0.0789252, 0.216503, 0.36849, 0.953885, - 0.0833293, 0.216042, 0.394373, 0.954617, - 0.087371, 0.215469, 0.420505, 0.955429, - 0.0914054, 0.214802, 0.446907, 0.956068, - 0.0961671, 0.214146, 0.473522, 0.957094, - 0.10048, 0.213286, 0.50052, 0.958372, - 0.103248, 0.211796, 0.528715, 0.959654, - 0.106033, 0.21016, 0.557065, 0.961305, - 0.108384, 0.208149, 0.585286, 0.962785, - 0.111122, 0.206024, 0.613334, 0.964848, - 0.112981, 0.203442, 0.641334, 0.966498, - 0.113717, 0.19996, 0.669955, 0.968678, - 0.114121, 0.196105, 0.698094, 0.970489, - 0.114524, 0.191906, 0.725643, 0.972903, - 0.113792, 0.186963, 0.752856, 0.974701, - 0.112406, 0.181343, 0.780013, 0.976718, - 0.110685, 0.175185, 0.806268, 0.978905, - 0.108468, 0.168535, 0.832073, 0.980267, - 0.105061, 0.161106, 0.857149, 0.981967, - 0.101675, 0.153387, 0.881145, 0.983063, - 0.0974492, 0.145199, 0.904255, 0.984432, - 0.0925815, 0.136527, 0.926686, 0.985734, - 0.0877983, 0.127584, 0.947901, 0.986228, - 0.081884, 0.118125, 0.968111, 0.98719, - 0.0761208, 0.108594, 0.98719, 0.988228, - 0.0698196, 0.0989996, 1.00559, 0.989046, - 0.0632739, 0.0890074, 1.02246, 0.990242, - 0.056522, 0.0790832, 1.03841, 0.991252, - 0.0495272, 0.0689182, 1.05347, 0.992542, - 0.0425373, 0.0588592, 1.06724, 0.994096, - 0.0353198, 0.0486833, 1.08009, 0.995593, - 0.028235, 0.0385977, 1.09177, 0.99711, - 0.0209511, 0.0286457, 1.10274, 0.998263, - 0.0139289, 0.0188497, 1.11262, 0.999254, - 0.0067359, 0.009208, 1.12191, 0.999967, 0.000141846, - 6.57764e-05, 1.13024, 0.935608, - 4.74692e-06, 0.236466, 1.87817e-05, 0.93996, - 0.00011971, 0.237568, 0.000473646, 0.939959, - 0.000478845, 0.237567, 0.0018946, 0.939954, - 0.0010774, 0.237566, 0.00426284, 0.939956, - 0.00191538, 0.237566, 0.00757842, 0.939954, - 0.00299277, 0.237566, 0.0118413, 0.93996, - 0.00430961, 0.237567, 0.0170518, 0.939969, - 0.00586589, 0.237569, 0.02321, 0.939982, - 0.00766166, 0.237572, 0.0303164, 0.939987, - 0.00969686, 0.237572, 0.0383711, 0.939997, - 0.0119715, 0.237574, 0.0473751, 0.940031, - 0.0144858, 0.237581, 0.0573298, 0.940073, - 0.0172399, 0.237589, 0.0682366, 0.94012, - 0.0202335, 0.237598, 0.080097, 0.940162, - 0.0234663, 0.237604, 0.0929116, 0.940237, - 0.0269387, 0.237615, 0.106686, 0.940328, - 0.0306489, 0.237632, 0.121421, 0.940419, - 0.0345917, 0.237645, 0.137115, 0.940522, - 0.0387481, 0.237654, 0.153766, 0.940702, - 0.0429906, 0.237661, 0.17133, 0.940871, - 0.0465089, 0.237561, 0.189502, 0.941103, - 0.050531, 0.23748, 0.208616, 0.941369, - 0.0550657, 0.237423, 0.228595, 0.941641, - 0.0601337, 0.237399, 0.249287, 0.941903, - 0.0658804, 0.237443, 0.270467, 0.942224, - 0.0722674, 0.237597, 0.292024, 0.942633, - 0.0771788, 0.237419, 0.315272, 0.943172, - 0.0815623, 0.237068, 0.339579, 0.943691, - 0.0863973, 0.236682, 0.364717, 0.944382, - 0.0911536, 0.236213, 0.390435, 0.945392, - 0.0952967, 0.235562, 0.416425, 0.946185, - 0.0998948, 0.234832, 0.442772, 0.947212, - 0.104796, 0.234114, 0.469347, 0.948778, - 0.10928, 0.233222, 0.496162, 0.950149, - 0.113081, 0.231845, 0.523978, 0.951989, - 0.115893, 0.230005, 0.552295, 0.953921, - 0.11846, 0.227862, 0.580569, 0.955624, - 0.12115, 0.225439, 0.608698, 0.958234, - 0.123373, 0.222635, 0.636696, 0.960593, - 0.124519, 0.219093, 0.665208, 0.963201, - 0.124736, 0.214749, 0.693557, 0.965642, - 0.125012, 0.210059, 0.721334, 0.968765, - 0.124661, 0.204935, 0.748613, 0.971753, - 0.122996, 0.198661, 0.776224, 0.973751, - 0.120998, 0.191823, 0.802461, 0.976709, - 0.118583, 0.184359, 0.828399, 0.977956, - 0.115102, 0.176437, 0.853693, 0.979672, - 0.111077, 0.167681, 0.877962, 0.981816, - 0.10688, 0.158872, 0.901564, 0.98238, - 0.101469, 0.149398, 0.924057, 0.983964, - 0.0960013, 0.139436, 0.945751, 0.984933, - 0.0899626, 0.12943, 0.966272, 0.985694, - 0.0832973, 0.11894, 0.985741, 0.986822, - 0.0767082, 0.108349, 1.00407, 0.987725, - 0.0693614, 0.0976026, 1.02154, 0.98877, - 0.06211, 0.086652, 1.03757, 0.990129, - 0.0544143, 0.0756182, 1.05296, 0.991337, - 0.046744, 0.0645753, 1.06683, 0.992978, - 0.0387931, 0.0534683, 1.0798, 0.994676, - 0.030973, 0.0424137, 1.09181, 0.99645, - 0.0230311, 0.0314035, 1.10286, 0.997967, - 0.0152065, 0.0206869, 1.11291, 0.99922, - 0.00744837, 0.010155, 1.12237, 1.00002, 0.000240209, - 7.52767e-05, 1.13089, 0.922948, - 5.15351e-06, 0.255626, 1.86069e-05, 0.928785, - 0.000129623, 0.257244, 0.000468009, 0.928761, - 0.00051849, 0.257237, 0.00187202, 0.928751, - 0.0011666, 0.257235, 0.00421204, 0.928751, - 0.00207395, 0.257234, 0.0074881, 0.928754, - 0.00324055, 0.257235, 0.0117002, 0.92876, - 0.00466639, 0.257236, 0.0168486, 0.928763, - 0.00635149, 0.257237, 0.0229334, 0.928774, - 0.00829584, 0.257239, 0.029955, 0.928791, - 0.0104995, 0.257243, 0.0379139, 0.928804, - 0.0129623, 0.257245, 0.0468108, 0.928847, - 0.0156846, 0.257255, 0.0566473, 0.92889, - 0.0186661, 0.257263, 0.0674246, 0.928924, - 0.0219067, 0.257268, 0.0791433, 0.928989, - 0.0254066, 0.257282, 0.0918076, 0.92909, - 0.0291651, 0.257301, 0.105419, 0.92918, - 0.0331801, 0.257316, 0.119978, 0.92929, - 0.0374469, 0.257332, 0.135491, 0.929453, - 0.041939, 0.257357, 0.151948, 0.929586, - 0.0464612, 0.257347, 0.169275, 0.929858, - 0.0503426, 0.257269, 0.187257, 0.930125, - 0.0548409, 0.257199, 0.206204, 0.930403, - 0.0598063, 0.257149, 0.22601, 0.930726, - 0.0652437, 0.257122, 0.246561, 0.931098, - 0.0712376, 0.257153, 0.267618, 0.931396, - 0.0777506, 0.257237, 0.288993, 0.931947, - 0.0832374, 0.257124, 0.311527, 0.932579, - 0.0883955, 0.25683, 0.335697, 0.933194, - 0.0937037, 0.256444, 0.360634, 0.934013, - 0.0987292, 0.255939, 0.386126, 0.935307, - 0.103215, 0.255282, 0.412018, 0.936374, - 0.108234, 0.254538, 0.438292, 0.93776, - 0.113234, 0.253728, 0.464805, 0.939599, - 0.118013, 0.25275, 0.491464, 0.941036, - 0.122661, 0.251404, 0.518751, 0.94337, - 0.125477, 0.249435, 0.547133, 0.945318, - 0.128374, 0.247113, 0.575456, 0.947995, - 0.130996, 0.244441, 0.60372, 0.950818, - 0.133438, 0.241352, 0.63174, 0.954378, - 0.135004, 0.237849, 0.659971, 0.957151, - 0.135313, 0.233188, 0.688478, 0.960743, - 0.13521, 0.228001, 0.716767, 0.964352, - 0.135007, 0.222249, 0.744349, 0.967273, - 0.133523, 0.21542, 0.771786, 0.969767, - 0.131155, 0.208039, 0.798639, 0.973195, - 0.128492, 0.200076, 0.824774, 0.975557, - 0.125094, 0.191451, 0.850222, 0.977692, - 0.120578, 0.18184, 0.874761, 0.98026, - 0.115882, 0.172102, 0.898497, 0.981394, - 0.110372, 0.161859, 0.921636, 0.982386, - 0.10415, 0.15108, 0.943467, 0.983783, - 0.0978128, 0.140407, 0.964045, 0.98422, - 0.0906171, 0.129058, 0.98398, 0.985447, - 0.0832921, 0.117614, 1.00276, 0.986682, - 0.0754412, 0.10585, 1.02047, 0.987326, - 0.0673885, 0.0940943, 1.03678, 0.988707, - 0.0592565, 0.0822093, 1.05218, 0.990185, - 0.050717, 0.070192, 1.06652, 0.991866, - 0.0423486, 0.0582081, 1.07965, 0.993897, - 0.0336118, 0.0460985, 1.09188, 0.995841, - 0.0252178, 0.0342737, 1.10307, 0.997605, - 0.0164893, 0.0224829, 1.11324, 0.999037, - 0.00817112, 0.0110647, 1.12262, 1.00003, 0.000291686, - 0.000168673, 1.13139, 0.915304, - 5.52675e-06, 0.275999, 1.83285e-05, 0.91668, - 0.000139285, 0.276414, 0.000461914, 0.916664, - 0.00055713, 0.276409, 0.00184763, 0.916653, - 0.00125354, 0.276406, 0.00415715, 0.916651, - 0.00222851, 0.276405, 0.00739053, 0.916655, - 0.00348205, 0.276406, 0.0115478, 0.916653, - 0.00501414, 0.276405, 0.0166291, 0.916667, - 0.00682478, 0.276409, 0.0226346, 0.91668, - 0.00891398, 0.276412, 0.0295648, 0.91669, - 0.0112817, 0.276413, 0.0374199, 0.916727, - 0.013928, 0.276422, 0.0462016, 0.916759, - 0.0168528, 0.276429, 0.0559101, 0.916793, - 0.0200558, 0.276436, 0.0665466, 0.916849, - 0.0235373, 0.276448, 0.0781139, 0.916964, - 0.0272973, 0.276474, 0.0906156, 0.917047, - 0.0313344, 0.276491, 0.104051, 0.917152, - 0.0356465, 0.276511, 0.118424, 0.917286, - 0.0402271, 0.276533, 0.133736, 0.917469, - 0.0450408, 0.276564, 0.149978, 0.917686, - 0.0497872, 0.276563, 0.167057, 0.917953, - 0.0540937, 0.276493, 0.184846, 0.918228, - 0.0590709, 0.276437, 0.203614, 0.918572, - 0.0644277, 0.276398, 0.223212, 0.918918, - 0.0702326, 0.276362, 0.243584, 0.919356, - 0.076484, 0.276383, 0.264465, 0.919842, - 0.0830808, 0.276434, 0.285701, 0.920451, - 0.0892972, 0.276407, 0.307559, 0.921113, - 0.095016, 0.276128, 0.331501, 0.921881, - 0.100771, 0.275754, 0.356207, 0.923027, - 0.106029, 0.275254, 0.381477, 0.924364, - 0.111029, 0.274595, 0.40722, 0.925818, - 0.116345, 0.273841, 0.433385, 0.92746, - 0.121424, 0.272913, 0.459848, 0.929167, - 0.12657, 0.271837, 0.486493, 0.931426, - 0.131581, 0.270575, 0.513432, 0.934001, - 0.135038, 0.268512, 0.541502, 0.936296, - 0.138039, 0.266135, 0.569658, 0.939985, - 0.140687, 0.263271, 0.598375, 0.943516, - 0.143247, 0.260058, 0.626563, 0.94782, - 0.145135, 0.256138, 0.654711, 0.951023, - 0.145733, 0.251154, 0.683285, 0.955338, - 0.145554, 0.245562, 0.711831, 0.959629, - 0.145008, 0.239265, 0.739573, 0.963123, - 0.144003, 0.232064, 0.767027, 0.966742, - 0.141289, 0.224036, 0.794359, 0.969991, - 0.138247, 0.215305, 0.820361, 0.973403, - 0.134786, 0.206051, 0.846548, 0.975317, - 0.129966, 0.195914, 0.871541, 0.977647, - 0.12471, 0.185184, 0.895313, 0.980137, - 0.119086, 0.174161, 0.918398, 0.981031, - 0.112297, 0.162792, 0.940679, 0.982037, - 0.105372, 0.150952, 0.961991, 0.983164, - 0.097821, 0.138921, 0.981913, 0.983757, - 0.0897245, 0.126611, 1.00109, 0.985036, - 0.0815974, 0.114228, 1.01902, 0.986289, - 0.0727725, 0.101389, 1.03604, 0.987329, - 0.0639323, 0.0886476, 1.05149, 0.989193, - 0.0548109, 0.0756837, 1.06619, 0.990716, - 0.045687, 0.0627581, 1.07948, 0.992769, - 0.0364315, 0.0498337, 1.09172, 0.99524, - 0.0271761, 0.0370305, 1.1033, 0.997154, - 0.0179609, 0.0243959, 1.11353, 0.998845, - 0.00878063, 0.0119567, 1.12319, 1.00002, 0.000259038, - 0.000108146, 1.13177, 0.903945, - 5.91681e-06, 0.295126, 1.81226e-05, 0.903668, - 0.000148672, 0.295037, 0.000455367, 0.903677, - 0.000594683, 0.29504, 0.00182145, 0.903673, - 0.00133805, 0.295039, 0.00409831, 0.903666, - 0.00237872, 0.295036, 0.00728584, 0.903668, - 0.00371676, 0.295037, 0.0113842, 0.903679, - 0.00535212, 0.29504, 0.0163936, 0.903684, - 0.00728479, 0.295041, 0.0223141, 0.903698, - 0.00951473, 0.295044, 0.0291462, 0.903718, - 0.0120419, 0.295049, 0.0368904, 0.903754, - 0.0148664, 0.295058, 0.0455477, 0.903801, - 0.017988, 0.29507, 0.0551194, 0.903851, - 0.0214064, 0.295082, 0.0656058, 0.903921, - 0.0251219, 0.295097, 0.0770109, 0.904002, - 0.0291337, 0.295116, 0.0893354, 0.904111, - 0.033441, 0.29514, 0.102583, 0.904246, - 0.0380415, 0.295169, 0.116755, 0.904408, - 0.0429258, 0.295202, 0.131853, 0.904637, - 0.0480468, 0.295245, 0.147869, 0.904821, - 0.0529208, 0.295214, 0.164658, 0.905163, - 0.0577748, 0.295185, 0.182274, 0.905469, - 0.0631763, 0.295143, 0.200828, 0.905851, - 0.068917, 0.295112, 0.2202, 0.906322, - 0.0750861, 0.295104, 0.240372, 0.906761, - 0.0815855, 0.295086, 0.261082, 0.90735, - 0.0882138, 0.295095, 0.282123, 0.908087, - 0.095082, 0.295139, 0.303563, 0.908826, - 0.101488, 0.29492, 0.327028, 0.909832, - 0.107577, 0.294577, 0.351464, 0.911393, - 0.113033, 0.294115, 0.376497, 0.912804, - 0.118629, 0.293446, 0.402115, 0.914081, - 0.124232, 0.292581, 0.428111, 0.91637, - 0.129399, 0.29166, 0.454442, 0.91814, - 0.134892, 0.290422, 0.481024, 0.921179, - 0.140069, 0.289194, 0.507924, 0.924544, - 0.144431, 0.287421, 0.535557, 0.927995, - 0.147498, 0.284867, 0.563984, 0.931556, - 0.150197, 0.281722, 0.5923, 0.935777, - 0.152711, 0.278207, 0.620832, 0.940869, - 0.154836, 0.274148, 0.649069, 0.945994, - 0.155912, 0.269057, 0.677746, 0.949634, - 0.155641, 0.262799, 0.706293, 0.955032, - 0.154809, 0.256097, 0.734278, 0.95917, - 0.153678, 0.248618, 0.761751, 0.962931, - 0.151253, 0.239794, 0.789032, 0.966045, - 0.147625, 0.230281, 0.815422, 0.96971, - 0.143964, 0.220382, 0.841787, 0.972747, - 0.139464, 0.209846, 0.867446, 0.975545, - 0.133459, 0.198189, 0.892004, 0.978381, - 0.127424, 0.186362, 0.915458, 0.979935, - 0.120506, 0.173964, 0.937948, 0.980948, - 0.11282, 0.161429, 0.959732, 0.982234, - 0.104941, 0.148557, 0.980118, 0.982767, - 0.0962905, 0.135508, 0.999463, 0.983544, - 0.0873625, 0.122338, 1.01756, 0.984965, - 0.0783447, 0.108669, 1.03492, 0.986233, - 0.0684798, 0.0949911, 1.05087, 0.987796, - 0.0590867, 0.0811386, 1.0656, 0.989885, - 0.0489145, 0.0673099, 1.0794, 0.991821, - 0.0391, 0.0535665, 1.09174, 0.99448, - 0.029087, 0.0397529, 1.10341, 0.996769, - 0.019114, 0.0261463, 1.11383, 0.998641, - 0.00947007, 0.0128731, 1.1237, 0.999978, 0.000446316, - 0.000169093, 1.13253, 0.888362, - 6.27064e-06, 0.312578, 1.78215e-05, 0.889988, - 0.000157791, 0.313148, 0.000448451, 0.889825, - 0.000631076, 0.313092, 0.00179356, 0.88984, - 0.00141994, 0.313097, 0.00403554, 0.889828, - 0.0025243, 0.313092, 0.00717429, 0.889831, - 0.00394421, 0.313093, 0.0112099, 0.889831, - 0.00567962, 0.313093, 0.0161425, 0.889844, - 0.00773051, 0.313096, 0.0219724, 0.889858, - 0.0100968, 0.3131, 0.0286999, 0.889882, - 0.0127786, 0.313106, 0.0363256, 0.889918, - 0.0157757, 0.313116, 0.0448509, 0.889967, - 0.0190878, 0.313129, 0.0542758, 0.89003, - 0.022715, 0.313145, 0.0646032, 0.890108, - 0.0266566, 0.313165, 0.0758339, 0.890218, - 0.0309131, 0.313193, 0.0879729, 0.890351, - 0.0354819, 0.313226, 0.101019, 0.89051, - 0.0403613, 0.313263, 0.114979, 0.890672, - 0.0455385, 0.313294, 0.129848, 0.890882, - 0.0509444, 0.313333, 0.145616, 0.891189, - 0.0559657, 0.313324, 0.162122, 0.891457, - 0.0613123, 0.313281, 0.179524, 0.891856, - 0.0671488, 0.313281, 0.197855, 0.892312, - 0.0732732, 0.313268, 0.216991, 0.892819, - 0.0797865, 0.313263, 0.236924, 0.893369, - 0.0865269, 0.313247, 0.257433, 0.894045, - 0.0931592, 0.313205, 0.278215, 0.894884, - 0.100532, 0.313276, 0.299467, 0.895832, - 0.107716, 0.313205, 0.322276, 0.897043, - 0.114099, 0.312873, 0.34642, 0.898515, - 0.119941, 0.312331, 0.371187, 0.900191, - 0.126044, 0.311731, 0.396656, 0.90188, - 0.131808, 0.310859, 0.422488, 0.904359, - 0.137289, 0.309857, 0.448744, 0.906923, - 0.142991, 0.308714, 0.475239, 0.910634, - 0.148253, 0.307465, 0.501983, 0.914502, - 0.153332, 0.305774, 0.529254, 0.919046, - 0.156646, 0.303156, 0.557709, 0.923194, - 0.159612, 0.299928, 0.586267, 0.928858, - 0.162027, 0.296245, 0.614925, 0.934464, - 0.164203, 0.291832, 0.643187, 0.939824, - 0.165602, 0.286565, 0.671601, 0.944582, - 0.165383, 0.280073, 0.700213, 0.949257, - 0.164439, 0.272891, 0.728432, 0.954389, - 0.162953, 0.264771, 0.756082, 0.958595, - 0.161007, 0.255927, 0.78369, 0.962138, - 0.157243, 0.245769, 0.810769, 0.966979, - 0.152872, 0.235127, 0.836999, 0.969566, - 0.148209, 0.22347, 0.862684, 0.972372, - 0.142211, 0.211147, 0.887847, 0.975916, - 0.135458, 0.198606, 0.911843, 0.978026, - 0.128398, 0.185498, 0.934795, 0.979686, - 0.120313, 0.17171, 0.956787, 0.980748, - 0.11166, 0.158159, 0.978046, 0.981622, - 0.103035, 0.144399, 0.997693, 0.982356, - 0.0930328, 0.13001, 1.01642, 0.983308, - 0.0834627, 0.115778, 1.03366, 0.985037, - 0.0732249, 0.101327, 1.05014, 0.986493, - 0.0628145, 0.086554, 1.06507, 0.988484, - 0.0526556, 0.0720413, 1.07907, 0.991051, - 0.0415744, 0.0571151, 1.09189, 0.993523, - 0.0314275, 0.0426643, 1.10369, 0.99628, - 0.0203603, 0.0279325, 1.11423, 0.998344, - 0.0102446, 0.0138182, 1.12421, 0.999997, 0.00042612, - 0.000193628, 1.1333, 0.871555, - 6.60007e-06, 0.329176, 1.74749e-05, 0.875255, - 0.000166579, 0.330571, 0.000441051, 0.875644, - 0.000666394, 0.330718, 0.00176441, 0.875159, - 0.00149903, 0.330536, 0.00396899, 0.87516, - 0.00266493, 0.330536, 0.007056, 0.875158, - 0.00416393, 0.330535, 0.0110251, 0.87516, - 0.00599598, 0.330535, 0.0158764, 0.875163, - 0.00816108, 0.330536, 0.0216101, 0.875174, - 0.0106591, 0.330538, 0.0282266, 0.875199, - 0.0134899, 0.330545, 0.0357266, 0.875257, - 0.0166538, 0.330563, 0.0441117, 0.875304, - 0.0201501, 0.330575, 0.0533821, 0.875373, - 0.0239785, 0.330595, 0.0635395, 0.875464, - 0.0281389, 0.330619, 0.0745872, 0.875565, - 0.0326301, 0.330645, 0.0865255, 0.875691, - 0.0374516, 0.330676, 0.0993599, 0.875897, - 0.0425993, 0.330733, 0.113093, 0.876091, - 0.0480576, 0.330776, 0.127722, 0.876353, - 0.0537216, 0.330826, 0.143227, 0.876649, - 0.0589807, 0.330809, 0.159462, 0.877034, - 0.0647865, 0.330819, 0.176642, 0.877443, - 0.0709789, 0.330817, 0.194702, 0.877956, - 0.0774782, 0.330832, 0.213577, 0.878499, - 0.0843175, 0.330822, 0.233246, 0.879144, - 0.0912714, 0.330804, 0.253512, 0.879982, - 0.0980824, 0.330766, 0.274137, 0.88097, - 0.105823, 0.330864, 0.295209, 0.882051, - 0.113671, 0.330896, 0.317226, 0.883397, - 0.120303, 0.330545, 0.341068, 0.884987, - 0.12667, 0.330068, 0.365613, 0.886789, - 0.133118, 0.329418, 0.390807, 0.889311, - 0.139024, 0.328683, 0.416494, 0.891995, - 0.144971, 0.327729, 0.442618, 0.895106, - 0.150747, 0.326521, 0.469131, 0.899527, - 0.156283, 0.325229, 0.495921, 0.90504, - 0.161707, 0.32378, 0.523162, 0.909875, - 0.165661, 0.32122, 0.55092, 0.91561, - 0.168755, 0.317942, 0.579928, 0.921225, - 0.171193, 0.313983, 0.608539, 0.927308, - 0.17319, 0.309636, 0.636854, 0.933077, - 0.174819, 0.304262, 0.66523, 0.938766, - 0.175002, 0.297563, 0.693609, 0.943667, - 0.173946, 0.289613, 0.722157, 0.949033, - 0.172221, 0.281227, 0.750021, 0.953765, - 0.169869, 0.271545, 0.777466, 0.95804, - 0.166578, 0.261034, 0.804853, 0.962302, - 0.161761, 0.249434, 0.831569, 0.966544, - 0.156636, 0.237484, 0.857779, 0.969372, - 0.150784, 0.224395, 0.883051, 0.972486, - 0.143672, 0.210786, 0.907864, 0.975853, - 0.135772, 0.196556, 0.931223, 0.977975, - 0.127942, 0.182307, 0.954061, 0.979122, - 0.118347, 0.167607, 0.97531, 0.980719, - 0.109112, 0.152739, 0.995666, 0.981223, - 0.0991789, 0.137932, 1.01475, 0.98216, - 0.0883553, 0.122692, 1.03253, 0.983379, - 0.0780825, 0.107493, 1.04917, 0.985434, - 0.0665646, 0.0917791, 1.06464, 0.987332, - 0.0557714, 0.0764949, 1.07896, 0.990004, - 0.0442805, 0.060721, 1.09199, 0.992975, - 0.0331676, 0.0452284, 1.10393, 0.995811, - 0.0219547, 0.0297934, 1.11476, 0.9982, - 0.0107613, 0.0146415, 1.12484, 1.00002, 0.000248678, - 0.00014555, 1.13413, 0.859519, - 6.93595e-06, 0.347264, 1.71673e-05, 0.859843, - 0.00017503, 0.347394, 0.000433219, 0.859656, - 0.000700076, 0.347319, 0.00173277, 0.859671, - 0.00157517, 0.347325, 0.00389875, 0.859669, - 0.00280028, 0.347324, 0.00693112, 0.85967, - 0.0043754, 0.347324, 0.01083, 0.859665, - 0.00630049, 0.347321, 0.0155954, 0.859685, - 0.0085755, 0.347328, 0.0212278, 0.859694, - 0.0112003, 0.347329, 0.0277273, 0.859718, - 0.0141747, 0.347336, 0.0350946, 0.85976, - 0.0174988, 0.347348, 0.0433314, 0.85982, - 0.0211722, 0.347366, 0.0524384, 0.859892, - 0.0251941, 0.347387, 0.0624168, 0.860006, - 0.0295649, 0.347422, 0.0732708, 0.860122, - 0.0342825, 0.347453, 0.0849999, 0.860282, - 0.0393462, 0.347499, 0.0976102, 0.860482, - 0.0447513, 0.347554, 0.111104, 0.860719, - 0.0504775, 0.347614, 0.125479, 0.860998, - 0.0563577, 0.347666, 0.140703, 0.861322, - 0.0619473, 0.347662, 0.156681, 0.861724, - 0.0681277, 0.347684, 0.173597, 0.862198, - 0.0746567, 0.347709, 0.191371, 0.862733, - 0.0815234, 0.347727, 0.209976, 0.863371, - 0.0886643, 0.347744, 0.229351, 0.86414, - 0.0957908, 0.347734, 0.24934, 0.865138, - 0.102912, 0.34772, 0.269797, 0.866182, - 0.110924, 0.3478, 0.290654, 0.867436, - 0.119223, 0.347911, 0.312074, 0.869087, - 0.126197, 0.347649, 0.335438, 0.870859, - 0.133145, 0.347222, 0.359732, 0.872997, - 0.139869, 0.346645, 0.38467, 0.875939, - 0.146089, 0.345935, 0.41019, 0.879012, - 0.152334, 0.345012, 0.436218, 0.883353, - 0.15821, 0.343924, 0.462641, 0.888362, - 0.164097, 0.342636, 0.489449, 0.895026, - 0.169528, 0.341351, 0.516629, 0.900753, - 0.174408, 0.339115, 0.544109, 0.906814, - 0.17751, 0.335809, 0.572857, 0.912855, - 0.180101, 0.331597, 0.601554, 0.919438, - 0.182116, 0.32698, 0.630198, 0.925962, - 0.183494, 0.321449, 0.658404, 0.931734, - 0.184159, 0.314595, 0.686625, 0.93762, - 0.18304, 0.306462, 0.71531, 0.943858, - 0.181323, 0.297514, 0.744272, 0.948662, - 0.178683, 0.287447, 0.771462, 0.953299, - 0.175379, 0.276166, 0.798593, 0.957346, - 0.170395, 0.263758, 0.8256, 0.962565, - 0.165042, 0.251019, 0.852575, 0.966075, - 0.158655, 0.237011, 0.878316, 0.969048, - 0.151707, 0.222518, 0.90329, 0.972423, - 0.143271, 0.207848, 0.927745, 0.975833, - 0.134824, 0.192463, 0.950859, 0.977629, - 0.125444, 0.1768, 0.972947, 0.978995, - 0.114949, 0.161033, 0.993263, 0.980533, - 0.104936, 0.145523, 1.01337, 0.980745, - 0.0935577, 0.129799, 1.03128, 0.981814, - 0.0822956, 0.113486, 1.04825, 0.983943, - 0.0710082, 0.0972925, 1.06405, 0.986141, - 0.0587931, 0.0808138, 1.0785, 0.988878, - 0.0472755, 0.0644915, 1.09204, 0.992132, - 0.0349128, 0.0478128, 1.10413, 0.9953, - 0.0232407, 0.031621, 1.11527, 0.998117, - 0.0112713, 0.0154935, 1.12551, 1.00003, 0.000339743, - 0.000195763, 1.13504, 0.845441, - 7.29126e-06, 0.364305, 1.69208e-05, 0.843588, - 0.000183164, 0.363506, 0.000425067, 0.843412, - 0.00073253, 0.36343, 0.00169999, 0.843401, - 0.00164818, 0.363426, 0.00382495, 0.843399, - 0.00293008, 0.363425, 0.00679993, 0.843401, - 0.00457822, 0.363425, 0.010625, 0.843394, - 0.00659249, 0.363421, 0.0153002, 0.843398, - 0.00897282, 0.363421, 0.0208258, 0.843415, - 0.0117191, 0.363426, 0.0272024, 0.843438, - 0.0148312, 0.363432, 0.0344305, 0.843483, - 0.018309, 0.363447, 0.0425116, 0.84356, - 0.0221521, 0.363472, 0.0514471, 0.843646, - 0.0263597, 0.363499, 0.061238, 0.843743, - 0.0309315, 0.363527, 0.0718873, 0.84388, - 0.0358658, 0.363569, 0.0833969, 0.844079, - 0.0411624, 0.363631, 0.0957742, 0.844279, - 0.0468128, 0.363688, 0.109015, 0.844549, - 0.0527923, 0.363761, 0.123124, 0.844858, - 0.0588204, 0.363817, 0.138044, 0.84522, - 0.0647573, 0.36383, 0.153755, 0.845669, - 0.0713181, 0.363879, 0.170394, 0.846155, - 0.0781697, 0.363908, 0.187861, 0.846789, - 0.0853913, 0.363969, 0.206176, 0.847502, - 0.0928086, 0.363999, 0.225244, 0.8484, - 0.10005, 0.363997, 0.244926, 0.849461, - 0.107615, 0.364008, 0.265188, 0.850562, - 0.115814, 0.364055, 0.28587, 0.851962, - 0.124334, 0.364179, 0.306926, 0.854326, - 0.131995, 0.364233, 0.329605, 0.856295, - 0.139338, 0.363856, 0.35359, 0.858857, - 0.146346, 0.363347, 0.37831, 0.862428, - 0.152994, 0.362807, 0.403722, 0.866203, - 0.159463, 0.361963, 0.429537, 0.871629, - 0.165623, 0.36112, 0.456, 0.877365, - 0.171649, 0.359917, 0.482773, 0.883744, - 0.177151, 0.35848, 0.509705, 0.890693, - 0.182381, 0.356523, 0.537215, 0.897278, - 0.186076, 0.3533, 0.565493, 0.903958, - 0.188602, 0.349095, 0.594293, 0.910908, - 0.190755, 0.344215, 0.623165, 0.918117, - 0.192063, 0.338606, 0.651573, 0.924644, - 0.192758, 0.331544, 0.679869, 0.931054, - 0.192238, 0.323163, 0.708668, 0.937303, - 0.190035, 0.313529, 0.737201, 0.943387, - 0.187162, 0.303152, 0.764977, 0.948494, - 0.183876, 0.29146, 0.792683, 0.952546, - 0.178901, 0.277917, 0.819228, 0.958077, - 0.173173, 0.264753, 0.846559, 0.962462, - 0.16645, 0.25002, 0.872962, 0.966569, - 0.159452, 0.234873, 0.898729, 0.969108, - 0.15074, 0.218752, 0.923126, 0.973072, - 0.141523, 0.202673, 0.947278, 0.975452, - 0.132075, 0.186326, 0.969938, 0.977784, - 0.121257, 0.169396, 0.991325, 0.97899, - 0.110182, 0.153044, 1.01123, 0.979777, - 0.0989634, 0.136485, 1.0299, 0.980865, - 0.0865894, 0.119343, 1.04727, 0.982432, - 0.0746115, 0.102452, 1.06341, 0.984935, - 0.0621822, 0.0852423, 1.07834, 0.987776, - 0.0495694, 0.0678546, 1.092, 0.99103, - 0.0372386, 0.0506917, 1.1043, 0.99474, - 0.0244353, 0.0333316, 1.11576, 0.997768, - 0.0121448, 0.0164348, 1.12617, 1.00003, 0.00031774, - 0.000169504, 1.13598, 0.825551, - 7.56799e-06, 0.378425, 1.65099e-05, 0.82664, - 0.000190922, 0.378923, 0.000416504, 0.826323, - 0.000763495, 0.378779, 0.0016656, 0.826359, - 0.00171789, 0.378795, 0.00374768, 0.82636, - 0.00305402, 0.378795, 0.00666259, 0.826368, - 0.00477185, 0.378798, 0.0104104, 0.826364, - 0.00687131, 0.378795, 0.0149912, 0.826368, - 0.00935232, 0.378795, 0.0204054, 0.826376, - 0.0122146, 0.378797, 0.0266532, 0.826399, - 0.0154581, 0.378803, 0.0337355, 0.82646, - 0.0190825, 0.378824, 0.0416537, 0.826525, - 0.0230873, 0.378846, 0.0504091, 0.826614, - 0.0274719, 0.378876, 0.0600032, 0.82674, - 0.0322355, 0.378917, 0.0704393, 0.826888, - 0.0373766, 0.378964, 0.0817195, 0.827078, - 0.0428936, 0.379024, 0.0938492, 0.827318, - 0.0487778, 0.379099, 0.106828, 0.82764, - 0.0549935, 0.379199, 0.120659, 0.827926, - 0.0611058, 0.379227, 0.13526, 0.828325, - 0.0675054, 0.379275, 0.150713, 0.828801, - 0.0743455, 0.379332, 0.167034, 0.8294, - 0.0815523, 0.379415, 0.184209, 0.830094, - 0.0890779, 0.379495, 0.202203, 0.8309, - 0.096736, 0.379555, 0.220945, 0.831943, - 0.104135, 0.379577, 0.240306, 0.833037, - 0.112106, 0.379604, 0.260317, 0.834278, - 0.120554, 0.379668, 0.2808, 0.836192, - 0.129128, 0.3799, 0.301654, 0.838671, - 0.137541, 0.380109, 0.323502, 0.840939, - 0.14523, 0.379809, 0.347176, 0.844575, - 0.15248, 0.379593, 0.371706, 0.848379, - 0.159607, 0.37909, 0.39688, 0.853616, - 0.166267, 0.378617, 0.422702, 0.858921, - 0.172698, 0.377746, 0.448919, 0.865324, - 0.178823, 0.376749, 0.475661, 0.872207, - 0.184542, 0.375363, 0.502599, 0.880018, - 0.189836, 0.373657, 0.529914, 0.88694, - 0.194294, 0.370673, 0.557683, 0.894779, - 0.197022, 0.36662, 0.586848, 0.902242, - 0.199108, 0.36138, 0.615831, 0.909914, - 0.200398, 0.355434, 0.644478, 0.917088, - 0.20094, 0.348173, 0.672905, 0.923888, - 0.200671, 0.339482, 0.701327, 0.930495, - 0.198773, 0.32956, 0.730101, 0.937247, - 0.195394, 0.318363, 0.758383, 0.943108, - 0.191956, 0.306323, 0.786539, 0.948296, - 0.187227, 0.292576, 0.813637, 0.953472, - 0.181165, 0.278234, 0.840793, 0.958485, - 0.174119, 0.263054, 0.867712, 0.962714, - 0.166564, 0.246756, 0.893635, 0.966185, - 0.158181, 0.229945, 0.919028, 0.970146, - 0.148275, 0.212633, 0.943413, 0.973491, - 0.138157, 0.195229, 0.966627, 0.975741, - 0.127574, 0.178048, 0.988817, 0.977238, - 0.11554, 0.160312, 1.00924, 0.978411, - 0.10364, 0.142857, 1.02845, 0.979811, - 0.0913122, 0.125317, 1.04648, 0.98116, - 0.0782558, 0.107627, 1.06284, 0.983543, - 0.0655957, 0.0895862, 1.07798, 0.986789, - 0.0520411, 0.0713756, 1.092, 0.990292, - 0.0389727, 0.053228, 1.10484, 0.994187, - 0.025808, 0.0351945, 1.11642, 0.997499, - 0.0126071, 0.0173198, 1.12703, 0.999999, 0.000275604, - 0.000148602, 1.13674, 0.81075, - 7.8735e-06, 0.394456, 1.61829e-05, 0.808692, - 0.000198293, 0.393453, 0.000407564, 0.80846, - 0.000792877, 0.39334, 0.00162965, 0.808595, - 0.00178416, 0.393407, 0.00366711, 0.808597, - 0.00317182, 0.393408, 0.00651934, 0.808598, - 0.00495589, 0.393408, 0.0101866, 0.808591, - 0.00713627, 0.393403, 0.0146689, 0.808592, - 0.00971285, 0.393402, 0.0199667, 0.80861, - 0.0126855, 0.393407, 0.0260803, 0.808633, - 0.0160538, 0.393413, 0.0330107, 0.80868, - 0.0198175, 0.393429, 0.0407589, 0.808748, - 0.0239758, 0.393453, 0.0493264, 0.808854, - 0.0285286, 0.39349, 0.0587161, 0.808992, - 0.0334748, 0.39354, 0.0689304, 0.809141, - 0.0388116, 0.393588, 0.0799707, 0.809352, - 0.0445375, 0.39366, 0.0918432, 0.809608, - 0.0506427, 0.393742, 0.104549, 0.809915, - 0.0570708, 0.393834, 0.118085, 0.810253, - 0.0633526, 0.393885, 0.132377, 0.810687, - 0.0700966, 0.393953, 0.147537, 0.811233, - 0.0772274, 0.394047, 0.163543, 0.811865, - 0.0847629, 0.394148, 0.180394, 0.812648, - 0.0925663, 0.394265, 0.198051, 0.813583, - 0.100416, 0.394363, 0.216443, 0.814683, - 0.108119, 0.394402, 0.235502, 0.815948, - 0.11644, 0.394489, 0.255242, 0.817278, - 0.125036, 0.394542, 0.275441, 0.819605, - 0.133655, 0.39486, 0.296094, 0.822256, - 0.142682, 0.395248, 0.317309, 0.825349, - 0.150756, 0.395241, 0.340516, 0.829605, - 0.158392, 0.395285, 0.364819, 0.83391, - 0.165801, 0.394922, 0.389736, 0.839808, - 0.172677, 0.394691, 0.415409, 0.845708, - 0.179448, 0.394006, 0.441546, 0.853025, - 0.185746, 0.393279, 0.46832, 0.859666, - 0.191684, 0.391655, 0.495302, 0.86789, - 0.197146, 0.390068, 0.52262, 0.875845, - 0.201904, 0.38727, 0.550336, 0.882634, - 0.205023, 0.382688, 0.578825, 0.891076, - 0.207098, 0.377543, 0.608103, 0.900589, - 0.208474, 0.371752, 0.63723, 0.90791, - 0.209068, 0.364016, 0.665769, 0.915971, - 0.208655, 0.355593, 0.694428, 0.923455, - 0.20729, 0.345439, 0.723224, 0.931514, - 0.203821, 0.334099, 0.751925, 0.937885, - 0.19986, 0.321069, 0.780249, 0.943136, - 0.194993, 0.306571, 0.8077, 0.948818, - 0.189132, 0.291556, 0.83497, 0.954433, - 0.181617, 0.275745, 0.86188, 0.959078, - 0.173595, 0.258695, 0.888562, 0.962705, - 0.164855, 0.240825, 0.914008, 0.966753, - 0.155129, 0.22268, 0.939145, 0.970704, - 0.144241, 0.204542, 0.963393, 0.973367, - 0.133188, 0.185927, 0.985983, 0.975984, - 0.121146, 0.167743, 1.00704, 0.976994, - 0.108366, 0.149218, 1.02715, 0.978485, - 0.0956746, 0.13131, 1.0455, 0.980074, - 0.0820733, 0.112513, 1.06221, 0.98225, - 0.0684061, 0.0938323, 1.07782, 0.98553, - 0.0549503, 0.0749508, 1.09199, 0.989529, - 0.0407857, 0.055848, 1.10508, 0.993536, - 0.0271978, 0.0368581, 1.11684, 0.997247, - 0.0132716, 0.0181845, 1.12789, 1, 0.000431817, - 0.000198809, 1.13792, 0.785886, - 8.12608e-06, 0.405036, 1.57669e-05, 0.790388, - 0.000205278, 0.407355, 0.000398297, 0.790145, - 0.000820824, 0.407231, 0.00159263, 0.790135, - 0.00184681, 0.407226, 0.00358336, 0.790119, - 0.00328316, 0.407218, 0.00637039, 0.790126, - 0.00512988, 0.40722, 0.0099539, 0.79013, - 0.00738684, 0.407221, 0.0143339, 0.790135, - 0.0100538, 0.407221, 0.0195107, 0.790134, - 0.0131306, 0.407217, 0.0254848, 0.79016, - 0.0166169, 0.407224, 0.0322572, 0.790197, - 0.020512, 0.407236, 0.0398284, 0.790273, - 0.0248157, 0.407263, 0.0482014, 0.790381, - 0.029527, 0.407304, 0.0573777, 0.790521, - 0.0346446, 0.407355, 0.0673602, 0.790704, - 0.0401665, 0.40742, 0.0781522, 0.790925, - 0.0460896, 0.407499, 0.0897582, 0.791195, - 0.0524017, 0.407589, 0.10218, 0.791522, - 0.0590121, 0.407691, 0.11541, 0.791878, - 0.0654876, 0.407748, 0.12939, 0.792361, - 0.0725207, 0.407849, 0.144237, 0.792942, - 0.0799844, 0.407963, 0.159924, 0.79362, - 0.0877896, 0.408087, 0.176425, 0.794529, - 0.0958451, 0.408259, 0.193733, 0.795521, - 0.103827, 0.408362, 0.211756, 0.796778, - 0.111937, 0.408482, 0.230524, 0.798027, - 0.120521, 0.408547, 0.249967, 0.799813, - 0.129242, 0.408721, 0.269926, 0.802387, - 0.138048, 0.409148, 0.290338, 0.805279, - 0.147301, 0.409641, 0.311193, 0.809251, - 0.155895, 0.410154, 0.333611, 0.813733, - 0.163942, 0.410297, 0.357615, 0.819081, - 0.171666, 0.410373, 0.382339, 0.825427, - 0.178905, 0.410348, 0.407828, 0.83172, - 0.185812, 0.409486, 0.434034, 0.83877, - 0.192318, 0.408776, 0.460493, 0.845817, - 0.198249, 0.407176, 0.487346, 0.854664, - 0.204034, 0.405719, 0.514832, 0.863495, - 0.208908, 0.403282, 0.542401, 0.871883, - 0.212765, 0.399293, 0.570683, 0.88065, - 0.214911, 0.393803, 0.599947, 0.89004, - 0.216214, 0.387536, 0.62932, 0.898476, - 0.216745, 0.379846, 0.658319, 0.906738, - 0.216387, 0.370625, 0.687138, 0.914844, - 0.215053, 0.360139, 0.71601, 0.923877, - 0.212007, 0.348849, 0.745124, 0.931925, - 0.207481, 0.335639, 0.773366, 0.938054, - 0.202418, 0.320798, 0.801636, 0.943895, - 0.196507, 0.304772, 0.829055, 0.949468, - 0.189009, 0.288033, 0.856097, 0.955152, - 0.180539, 0.270532, 0.88301, 0.959403, - 0.171437, 0.251639, 0.909296, 0.963309, - 0.161661, 0.232563, 0.934868, 0.967399, - 0.150425, 0.213231, 0.959662, 0.972009, - 0.138659, 0.194247, 0.98302, 0.97433, - 0.126595, 0.174718, 1.00517, 0.975823, - 0.113205, 0.155518, 1.02566, 0.976371, - 0.0996096, 0.136709, 1.04418, 0.978705, - 0.0860754, 0.117571, 1.06146, 0.981477, - 0.0714438, 0.0980046, 1.07777, 0.984263, - 0.0572304, 0.0782181, 1.09214, 0.988423, - 0.0428875, 0.0584052, 1.10553, 0.993, - 0.0282442, 0.038522, 1.11758, 0.99704, - 0.0140183, 0.0190148, 1.12864, 0.999913, 0.000369494, - 0.000145203, 1.13901, 0.777662, - 8.4153e-06, 0.423844, 1.54403e-05, 0.770458, - 0.000211714, 0.419915, 0.00038845, 0.770716, - 0.000846888, 0.420055, 0.00155386, 0.770982, - 0.00190567, 0.420202, 0.00349653, 0.770981, - 0.00338782, 0.420201, 0.00621606, 0.77098, - 0.00529338, 0.4202, 0.00971274, 0.770983, - 0.00762223, 0.4202, 0.0139867, 0.770985, - 0.0103741, 0.420198, 0.0190381, 0.770996, - 0.0135489, 0.4202, 0.0248677, 0.771029, - 0.0171461, 0.420212, 0.0314764, 0.771052, - 0.0211647, 0.420215, 0.0388648, 0.771131, - 0.0256048, 0.420245, 0.047036, 0.771235, - 0.0304647, 0.420284, 0.0559911, 0.771383, - 0.0357436, 0.420341, 0.0657346, 0.771591, - 0.0414392, 0.420423, 0.0762694, 0.771819, - 0.0475462, 0.420506, 0.0875984, 0.772123, - 0.0540506, 0.420617, 0.099727, 0.772464, - 0.060797, 0.42072, 0.112637, 0.772855, - 0.0675393, 0.420799, 0.126313, 0.773317, - 0.0748323, 0.420893, 0.140824, 0.773981, - 0.0825681, 0.421058, 0.15617, 0.774746, - 0.0906307, 0.421226, 0.172322, 0.77566, - 0.0988982, 0.421397, 0.189253, 0.776837, - 0.106994, 0.421569, 0.206912, 0.778097, - 0.115528, 0.421704, 0.225359, 0.779588, - 0.124317, 0.421849, 0.24447, 0.781574, - 0.133139, 0.422097, 0.264156, 0.784451, - 0.142179, 0.422615, 0.284318, 0.787682, - 0.15165, 0.423269, 0.304902, 0.792433, - 0.160771, 0.424396, 0.3265, 0.797359, - 0.169166, 0.424772, 0.35014, 0.803986, - 0.177149, 0.425475, 0.374768, 0.809504, - 0.184745, 0.424996, 0.399928, 0.815885, - 0.19173, 0.424247, 0.425796, 0.823513, - 0.198525, 0.423515, 0.452287, 0.832549, - 0.204709, 0.422787, 0.479321, 0.841653, - 0.210447, 0.421187, 0.506718, 0.850401, - 0.215501, 0.418519, 0.53432, 0.859854, - 0.219752, 0.414715, 0.56242, 0.869364, - 0.222305, 0.409462, 0.591558, 0.878837, - 0.223744, 0.402926, 0.621074, 0.888636, - 0.224065, 0.395043, 0.650538, 0.898132, - 0.223742, 0.38564, 0.679538, 0.907181, - 0.222308, 0.375378, 0.708674, 0.915621, - 0.219837, 0.363212, 0.737714, 0.9239, - 0.215233, 0.349313, 0.767014, 0.931644, - 0.209592, 0.334162, 0.795133, 0.938887, - 0.203644, 0.317943, 0.823228, 0.945282, - 0.196349, 0.300581, 0.850822, 0.950758, - 0.18742, 0.282195, 0.877594, 0.956146, - 0.177879, 0.262481, 0.904564, 0.960355, - 0.167643, 0.242487, 0.930741, 0.965256, - 0.156671, 0.222668, 0.955868, 0.968029, - 0.144123, 0.201907, 0.979869, 0.97251, - 0.131305, 0.18202, 1.00291, 0.974925, - 0.118335, 0.161909, 1.02392, 0.975402, - 0.103714, 0.142129, 1.0433, 0.976987, - 0.089415, 0.122447, 1.06089, 0.979677, - 0.0748858, 0.102248, 1.07713, 0.983184, - 0.0596086, 0.0814851, 1.09218, 0.987466, - 0.0447671, 0.0609484, 1.10585, 0.992348, - 0.0295217, 0.0401835, 1.11829, 0.996674, - 0.0143917, 0.0198163, 1.12966, 1.00003, 0.000321364, - 0.000149983, 1.1402, 0.757901, - 8.69074e-06, 0.436176, 1.51011e-05, 0.751195, - 0.000217848, 0.432317, 0.000378533, 0.751178, - 0.000871373, 0.432307, 0.0015141, 0.751195, - 0.00196061, 0.432317, 0.0034068, 0.751198, - 0.00348552, 0.432318, 0.00605659, 0.751195, - 0.00544599, 0.432315, 0.00946353, 0.751207, - 0.00784203, 0.43232, 0.013628, 0.751213, - 0.0106732, 0.43232, 0.0185499, 0.751221, - 0.0139393, 0.432319, 0.0242302, 0.751244, - 0.0176398, 0.432325, 0.0306694, 0.7513, - 0.0217743, 0.432348, 0.0378698, 0.751358, - 0.0263412, 0.432367, 0.0458321, 0.751458, - 0.0313396, 0.432404, 0.0545587, 0.751608, - 0.0367682, 0.432464, 0.0640543, 0.7518, - 0.0426246, 0.43254, 0.0743222, 0.752065, - 0.0489031, 0.432645, 0.0853668, 0.752376, - 0.0555828, 0.432762, 0.0971911, 0.752715, - 0.0623861, 0.432859, 0.109768, 0.753137, - 0.069415, 0.432958, 0.123126, 0.753676, - 0.0770039, 0.433099, 0.137308, 0.754345, - 0.084971, 0.433272, 0.15229, 0.755235, - 0.0932681, 0.433504, 0.168075, 0.756186, - 0.10171, 0.433693, 0.184625, 0.757363, - 0.110019, 0.433857, 0.201897, 0.75884, - 0.11887, 0.434102, 0.220014, 0.760467, - 0.127881, 0.434306, 0.238778, 0.762969, - 0.136766, 0.434751, 0.258172, 0.765823, - 0.14612, 0.43529, 0.278062, 0.769676, - 0.15566, 0.436236, 0.298437, 0.774909, - 0.165177, 0.437754, 0.319532, 0.77994, - 0.17402, 0.438343, 0.342505, 0.785757, - 0.182201, 0.438609, 0.366693, 0.792487, - 0.190104, 0.438762, 0.391668, 0.80038, - 0.197438, 0.438795, 0.417494, 0.808494, - 0.204365, 0.438226, 0.443933, 0.817695, - 0.210714, 0.437283, 0.470929, 0.828111, - 0.216651, 0.436087, 0.498569, 0.837901, - 0.221804, 0.433717, 0.526165, 0.847813, - 0.226318, 0.430133, 0.554155, 0.858314, - 0.229297, 0.425213, 0.582822, 0.868891, - 0.230999, 0.418576, 0.612847, 0.878941, - 0.231155, 0.410405, 0.642445, 0.888809, - 0.230935, 0.400544, 0.672024, 0.898089, - 0.229343, 0.389613, 0.701366, 0.908081, - 0.226886, 0.377197, 0.730763, 0.916819, - 0.222676, 0.363397, 0.759642, 0.924968, - 0.216835, 0.347437, 0.788775, 0.932906, - 0.210245, 0.32995, 0.817135, 0.940025, - 0.202992, 0.312262, 0.844912, 0.946101, - 0.19436, 0.293313, 0.872164, 0.952835, - 0.184125, 0.273638, 0.899443, 0.957347, - 0.173657, 0.252385, 0.926389, 0.961434, - 0.162204, 0.231038, 0.951947, 0.965522, - 0.14979, 0.209834, 0.976751, 0.969412, - 0.136307, 0.188821, 1.00022, 0.973902, - 0.122527, 0.168013, 1.02229, 0.974045, - 0.108213, 0.147634, 1.04199, 0.975775, - 0.0927397, 0.12705, 1.06019, 0.978383, - 0.0778212, 0.106309, 1.07711, 0.98211, - 0.0621216, 0.0849279, 1.09245, 0.986517, - 0.0463847, 0.0633519, 1.10651, 0.991696, - 0.0309353, 0.0419698, 1.11903, 0.996349, - 0.0150914, 0.0206272, 1.13073, 1.00003, 0.000442449, - 0.000231396, 1.14146, 0.727498, - 8.85074e-06, 0.441528, 1.45832e-05, 0.730897, - 0.000223525, 0.443589, 0.000368298, 0.730796, - 0.000893996, 0.443528, 0.00147303, 0.730805, - 0.00201149, 0.443533, 0.00331433, 0.730814, - 0.00357596, 0.443538, 0.00589222, 0.730815, - 0.00558734, 0.443538, 0.00920678, 0.730822, - 0.00804544, 0.44354, 0.0132582, 0.730836, - 0.0109501, 0.443545, 0.0180468, 0.730848, - 0.0143008, 0.443546, 0.0235732, 0.730871, - 0.0180969, 0.443552, 0.0298382, 0.730915, - 0.022338, 0.443567, 0.0368438, 0.730982, - 0.0270225, 0.443591, 0.044591, 0.731076, - 0.0321491, 0.443627, 0.0530831, 0.731245, - 0.0377166, 0.443699, 0.0623243, 0.73144, - 0.0437216, 0.443777, 0.0723181, 0.7317, - 0.0501576, 0.443881, 0.0830691, 0.732034, - 0.0569942, 0.444014, 0.0945809, 0.732388, - 0.0638756, 0.444113, 0.106825, 0.732853, - 0.071203, 0.444247, 0.119859, 0.733473, - 0.0790076, 0.444442, 0.13369, 0.734195, - 0.0871937, 0.444645, 0.148304, 0.735069, - 0.095696, 0.444877, 0.163702, 0.736169, - 0.10426, 0.445133, 0.179861, 0.73747, - 0.112853, 0.44537, 0.196778, 0.738991, - 0.12199, 0.445651, 0.214496, 0.740865, - 0.131153, 0.445958, 0.232913, 0.743637, - 0.140245, 0.446548, 0.251977, 0.746797, - 0.149722, 0.447246, 0.271551, 0.751517, - 0.159341, 0.448656, 0.291774, 0.756156, - 0.169106, 0.449866, 0.312455, 0.761519, - 0.178436, 0.450919, 0.334552, 0.768295, - 0.186904, 0.451776, 0.358491, 0.776613, - 0.195117, 0.452832, 0.383446, 0.783966, - 0.202695, 0.45249, 0.408945, 0.793542, - 0.20985, 0.452587, 0.435364, 0.803192, - 0.216403, 0.451852, 0.462336, 0.813892, - 0.22251, 0.450708, 0.48987, 0.824968, - 0.227676, 0.4486, 0.517697, 0.835859, - 0.232443, 0.445156, 0.545975, 0.846825, - 0.235775, 0.440351, 0.574483, 0.858085, - 0.237897, 0.433641, 0.604246, 0.868825, - 0.238074, 0.425354, 0.634101, 0.879638, - 0.237661, 0.415383, 0.664201, 0.889966, - 0.236186, 0.404136, 0.693918, 0.899479, - 0.233599, 0.390917, 0.723481, 0.908769, - 0.229737, 0.376352, 0.75258, 0.917966, - 0.223836, 0.360372, 0.781764, 0.926304, - 0.217067, 0.342551, 0.811139, 0.934626, - 0.209309, 0.324238, 0.839585, 0.941841, - 0.20071, 0.304484, 0.867044, 0.94789, - 0.190602, 0.283607, 0.894579, 0.954196, - 0.179253, 0.262205, 0.921743, 0.958383, - 0.167646, 0.239847, 0.948026, 0.963119, - 0.155073, 0.218078, 0.973296, 0.966941, - 0.141426, 0.195899, 0.998135, 0.970836, - 0.126849, 0.174121, 1.02021, 0.973301, - 0.112296, 0.153052, 1.04085, 0.97448, - 0.0964965, 0.131733, 1.05946, 0.977045, - 0.080489, 0.10997, 1.07693, 0.980751, - 0.064844, 0.0881657, 1.09254, 0.985475, - 0.0481938, 0.0657987, 1.10697, 0.991089, - 0.0319185, 0.0435215, 1.12004, 0.996122, - 0.0158088, 0.0214779, 1.13173, 1.00001, 0.000372455, - 0.000200295, 1.14291, 0.708622, - 9.07597e-06, 0.45304, 1.41962e-05, 0.711162, - 0.000228911, 0.454662, 0.000358052, 0.709812, - 0.000914446, 0.453797, 0.00143034, 0.709865, - 0.00205819, 0.453834, 0.00321935, 0.709864, - 0.00365894, 0.453833, 0.00572331, 0.709855, - 0.00571692, 0.453826, 0.00894278, 0.709862, - 0.00823201, 0.453828, 0.012878, 0.709875, - 0.011204, 0.453832, 0.0175295, 0.709896, - 0.0146323, 0.453839, 0.0228978, 0.709925, - 0.0185163, 0.453847, 0.0289839, 0.709974, - 0.0228551, 0.453866, 0.0357894, 0.710045, - 0.0276473, 0.453892, 0.0433161, 0.710133, - 0.032891, 0.453924, 0.0515665, 0.710292, - 0.0385851, 0.453992, 0.0605458, 0.710485, - 0.0447254, 0.45407, 0.0702574, 0.710769, - 0.0513051, 0.454192, 0.0807077, 0.711106, - 0.0582733, 0.454329, 0.091896, 0.711516, - 0.0652866, 0.45446, 0.103814, 0.712071, - 0.0728426, 0.454653, 0.116508, 0.712676, - 0.0808307, 0.45484, 0.129968, 0.713476, - 0.0892216, 0.455096, 0.144206, 0.714377, - 0.0979047, 0.455346, 0.159212, 0.715579, - 0.106531, 0.455647, 0.174973, 0.716977, - 0.115492, 0.455961, 0.191504, 0.71862, - 0.124821, 0.456315, 0.208835, 0.72084, - 0.134079, 0.4568, 0.226869, 0.723786, - 0.143427, 0.457521, 0.245582, 0.727464, - 0.153061, 0.458475, 0.264957, 0.732771, - 0.162768, 0.460239, 0.284948, 0.736515, - 0.172627, 0.460899, 0.30522, 0.743519, - 0.182487, 0.463225, 0.326717, 0.750041, - 0.191295, 0.464027, 0.350113, 0.758589, - 0.199746, 0.465227, 0.374782, 0.767703, - 0.207584, 0.465877, 0.400226, 0.777484, - 0.214973, 0.465996, 0.426442, 0.788792, - 0.221796, 0.466019, 0.453688, 0.800194, - 0.228038, 0.465083, 0.481246, 0.811234, - 0.233346, 0.462506, 0.509086, 0.822859, - 0.238073, 0.459257, 0.537338, 0.835082, - 0.241764, 0.454863, 0.566108, 0.846332, - 0.244241, 0.448163, 0.595126, 0.858355, - 0.244736, 0.439709, 0.625574, 0.87034, - 0.244278, 0.429837, 0.65617, 0.881027, - 0.24255, 0.418002, 0.686029, 0.891007, - 0.239912, 0.404325, 0.716039, 0.900874, - 0.236133, 0.389222, 0.745518, 0.911072, - 0.230672, 0.373269, 0.775026, 0.920359, - 0.22356, 0.355083, 0.804521, 0.928604, - 0.215591, 0.335533, 0.834045, 0.937175, - 0.206503, 0.315278, 0.861612, 0.942825, - 0.196684, 0.293653, 0.889131, 0.949805, - 0.185116, 0.271503, 0.916853, 0.955535, - 0.172703, 0.248821, 0.943541, 0.959843, - 0.159978, 0.225591, 0.970132, 0.964393, - 0.146375, 0.202719, 0.994709, 0.968008, - 0.131269, 0.179928, 1.0186, 0.971013, - 0.11569, 0.158007, 1.03928, 0.973334, - 0.1003, 0.13624, 1.05887, 0.975775, - 0.0833352, 0.1138, 1.07652, 0.979579, - 0.0668981, 0.0913141, 1.09297, 0.984323, - 0.0500902, 0.0683051, 1.10734, 0.990351, - 0.0332377, 0.0451771, 1.12084, 0.995823, - 0.0161491, 0.0221705, 1.13296, 1.0001, 0.000234083, - 0.000108712, 1.14441, 0.683895, - 9.24677e-06, 0.46015, 1.37429e-05, 0.68833, - 0.000233383, 0.463134, 0.000346865, 0.688368, - 0.000933547, 0.463159, 0.00138748, 0.688367, - 0.00210049, 0.463159, 0.00312187, 0.688369, - 0.00373415, 0.463159, 0.00555004, 0.688377, - 0.00583449, 0.463163, 0.00867216, 0.688386, - 0.00840128, 0.463166, 0.0124884, 0.688398, - 0.0114343, 0.463169, 0.0169993, 0.688418, - 0.0149329, 0.463175, 0.0222054, 0.688453, - 0.0188964, 0.463188, 0.028108, 0.688515, - 0.0233239, 0.463214, 0.0347085, 0.68857, - 0.0282136, 0.463231, 0.0420091, 0.688679, - 0.033564, 0.463276, 0.0500132, 0.688854, - 0.0393733, 0.463356, 0.0587255, 0.689038, - 0.0456354, 0.46343, 0.0681476, 0.689321, - 0.0523433, 0.463553, 0.0782897, 0.689662, - 0.059412, 0.463693, 0.0891501, 0.690188, - 0.0665736, 0.4639, 0.100735, 0.690755, - 0.0743106, 0.464107, 0.113074, 0.691405, - 0.0824722, 0.464329, 0.126161, 0.692198, - 0.0910484, 0.464585, 0.140007, 0.693196, - 0.0998778, 0.464893, 0.154612, 0.69454, - 0.108651, 0.465285, 0.169984, 0.695921, - 0.117855, 0.465596, 0.186106, 0.697749, - 0.12734, 0.466056, 0.203034, 0.700375, - 0.136714, 0.466771, 0.220703, 0.703395, - 0.146386, 0.467579, 0.239062, 0.707904, - 0.156096, 0.469067, 0.258188, 0.711673, - 0.165904, 0.469851, 0.277759, 0.717489, - 0.175812, 0.471815, 0.297935, 0.724051, - 0.185931, 0.47389, 0.318916, 0.731965, - 0.195238, 0.47587, 0.341591, 0.741151, - 0.204021, 0.477523, 0.366062, 0.751416, - 0.212113, 0.478881, 0.391396, 0.761848, - 0.21979, 0.479226, 0.417599, 0.771886, - 0.2267, 0.478495, 0.444401, 0.783998, - 0.232991, 0.477622, 0.472084, 0.796523, - 0.238645, 0.475833, 0.500193, 0.808851, - 0.243396, 0.472568, 0.52865, 0.821191, - 0.247226, 0.467857, 0.557362, 0.834261, - 0.250102, 0.461871, 0.586768, 0.846762, - 0.251056, 0.453543, 0.617085, 0.859867, - 0.250604, 0.443494, 0.647659, 0.871948, - 0.248783, 0.431711, 0.678119, 0.882967, - 0.245855, 0.417911, 0.708399, 0.892826, - 0.242168, 0.401993, 0.738256, 0.90332, - 0.237062, 0.385371, 0.767999, 0.913633, - 0.22997, 0.366837, 0.798191, 0.922774, - 0.221687, 0.346372, 0.827756, 0.931371, - 0.212345, 0.325682, 0.856425, 0.938929, - 0.20206, 0.303665, 0.884299, 0.944821, - 0.190981, 0.280786, 0.912023, 0.951792, - 0.178065, 0.2573, 0.939669, 0.957712, - 0.164634, 0.233448, 0.96655, 0.961912, - 0.150863, 0.209504, 0.992366, 0.966382, - 0.13577, 0.18597, 1.01633, 0.969588, - 0.119593, 0.162905, 1.03843, 0.971777, - 0.103203, 0.14053, 1.05841, 0.97433, - 0.0865888, 0.117909, 1.07632, 0.978686, - 0.0690829, 0.0944101, 1.09326, 0.983281, - 0.0516568, 0.0705671, 1.10796, 0.989562, - 0.034558, 0.0468592, 1.12182, 0.995465, - 0.0167808, 0.0229846, 1.1342, 0.999991, 0.000373016, - 0.000235606, 1.1459, 0.662251, - 9.39016e-06, 0.468575, 1.32714e-05, 0.666634, - 0.000237624, 0.471675, 0.000335842, 0.666411, - 0.000950385, 0.471516, 0.00134321, 0.666399, - 0.00213833, 0.471509, 0.00302221, 0.666386, - 0.0038014, 0.471499, 0.00537283, 0.666405, - 0.00593958, 0.471511, 0.00839533, 0.666406, - 0.00855253, 0.471508, 0.0120898, 0.666428, - 0.0116401, 0.471519, 0.0164569, 0.666444, - 0.0152015, 0.471522, 0.0214971, 0.66649, - 0.0192362, 0.471543, 0.027212, 0.666537, - 0.0237428, 0.471558, 0.033603, 0.666617, - 0.0287198, 0.471591, 0.0406728, 0.666718, - 0.0341647, 0.471631, 0.0484238, 0.666889, - 0.0400759, 0.47171, 0.0568621, 0.667104, - 0.0464479, 0.471805, 0.0659915, 0.667374, - 0.0532677, 0.471923, 0.0758178, 0.667772, - 0.0603805, 0.472098, 0.0863425, 0.668371, - 0.0677392, 0.472363, 0.0975917, 0.668971, - 0.0756028, 0.472596, 0.109567, 0.669696, - 0.0839293, 0.472869, 0.122272, 0.670481, - 0.0926683, 0.473126, 0.135718, 0.6715, - 0.1016, 0.473442, 0.149914, 0.672911, - 0.110566, 0.47389, 0.164882, 0.674512, - 0.119984, 0.474354, 0.180602, 0.67651, - 0.129574, 0.474922, 0.19711, 0.679292, - 0.139106, 0.475764, 0.214371, 0.682798, - 0.148993, 0.476886, 0.232405, 0.686955, - 0.158737, 0.478179, 0.251153, 0.691406, - 0.168754, 0.479432, 0.270436, 0.697438, - 0.178703, 0.481481, 0.290374, 0.704761, - 0.188955, 0.484143, 0.311044, 0.713599, - 0.198814, 0.487007, 0.333003, 0.723194, - 0.207869, 0.488962, 0.357144, 0.732601, - 0.216189, 0.489815, 0.382169, 0.744193, - 0.22398, 0.490888, 0.408227, 0.754907, - 0.231156, 0.490355, 0.434928, 0.767403, - 0.23747, 0.489548, 0.462599, 0.78107, - 0.243503, 0.488274, 0.490908, 0.793893, - 0.248114, 0.484843, 0.519421, 0.807296, - 0.25222, 0.4803, 0.548561, 0.820529, - 0.255265, 0.474097, 0.577772, 0.833716, - 0.256741, 0.466041, 0.607782, 0.848403, - 0.25637, 0.456547, 0.638807, 0.860755, - 0.254804, 0.443946, 0.670058, 0.874012, - 0.251834, 0.430852, 0.700749, 0.885619, - 0.247867, 0.414903, 0.731446, 0.896069, - 0.242634, 0.397276, 0.761191, 0.906266, - 0.236093, 0.378535, 0.791053, 0.916759, - 0.227543, 0.358038, 0.821298, 0.92523, - 0.21783, 0.335705, 0.850747, 0.93436, - 0.207534, 0.313797, 0.879258, 0.941631, - 0.195983, 0.289671, 0.907734, 0.947564, - 0.183567, 0.265319, 0.935206, 0.953681, - 0.169345, 0.240815, 0.962739, 0.960008, - 0.154909, 0.216119, 0.989227, 0.964145, - 0.140161, 0.192096, 1.01465, 0.968171, - 0.123411, 0.167855, 1.03737, 0.969859, - 0.106525, 0.144817, 1.05767, 0.972666, - 0.0891023, 0.12149, 1.0761, 0.977055, - 0.0718094, 0.0975306, 1.09336, 0.982527, - 0.0534213, 0.0730217, 1.10878, 0.989001, - 0.0355579, 0.0483366, 1.12285, 0.99512, - 0.0176383, 0.023938, 1.13548, 1.00007, 0.000368831, - 0.000211581, 1.14744, 0.651047, - 9.60845e-06, 0.484101, 1.2922e-05, 0.644145, - 0.000241347, 0.478968, 0.000324578, 0.64396, - 0.000965142, 0.478831, 0.00129798, 0.64396, - 0.00217154, 0.47883, 0.00292046, 0.643968, - 0.00386049, 0.478835, 0.00519202, 0.643974, - 0.00603186, 0.478838, 0.0081128, 0.643977, - 0.0086854, 0.478836, 0.011683, 0.643982, - 0.0118207, 0.478834, 0.0159031, 0.644024, - 0.0154374, 0.478856, 0.0207743, 0.644059, - 0.0195343, 0.478868, 0.0262975, 0.644122, - 0.0241103, 0.478896, 0.0324747, 0.644207, - 0.0291638, 0.478933, 0.039309, 0.64432, - 0.0346919, 0.478981, 0.0468029, 0.644481, - 0.0406919, 0.479053, 0.0549614, 0.644722, - 0.047159, 0.479169, 0.0637909, 0.645013, - 0.0540748, 0.479302, 0.0732974, 0.645503, - 0.0612001, 0.479541, 0.0834898, 0.646117, - 0.0687303, 0.479829, 0.0943873, 0.646707, - 0.0767846, 0.480061, 0.105991, 0.647431, - 0.0852465, 0.480343, 0.11831, 0.64831, - 0.0940719, 0.48066, 0.131348, 0.649486, - 0.103056, 0.481083, 0.14514, 0.650864, - 0.112261, 0.481528, 0.159676, 0.652604, - 0.121852, 0.482102, 0.174979, 0.654825, - 0.131505, 0.482813, 0.191079, 0.657876, - 0.141189, 0.483876, 0.207927, 0.661339, - 0.151239, 0.48499, 0.225586, 0.665463, - 0.161091, 0.486279, 0.243947, 0.670542, - 0.171235, 0.487968, 0.262957, 0.677361, - 0.181347, 0.49053, 0.282781, 0.685672, - 0.191679, 0.493862, 0.303311, 0.694551, - 0.201781, 0.49699, 0.324607, 0.703753, - 0.211164, 0.498884, 0.347916, 0.713703, - 0.219675, 0.500086, 0.372628, 0.725911, - 0.227836, 0.501554, 0.398694, 0.73862, - 0.23533, 0.502193, 0.425529, 0.752118, - 0.241786, 0.501811, 0.453209, 0.76579, - 0.247865, 0.500185, 0.481381, 0.779568, - 0.252696, 0.497159, 0.51011, 0.793991, - 0.256802, 0.492765, 0.539322, 0.808182, - 0.259942, 0.486827, 0.569078, 0.821698, - 0.261703, 0.478386, 0.598818, 0.836009, - 0.262006, 0.468772, 0.629762, 0.849824, - 0.260333, 0.456352, 0.661366, 0.863888, - 0.257398, 0.442533, 0.69295, 0.876585, - 0.253264, 0.426573, 0.723608, 0.888665, - 0.248026, 0.408964, 0.754378, 0.899537, - 0.241487, 0.389677, 0.784761, 0.9094, - 0.233463, 0.368516, 0.814688, 0.920166, - 0.223397, 0.346624, 0.845009, 0.928899, - 0.21255, 0.322717, 0.874431, 0.937156, - 0.200869, 0.298698, 0.902922, 0.943861, - 0.188387, 0.273491, 0.931356, 0.949557, - 0.174341, 0.247866, 0.958854, 0.955862, - 0.158994, 0.222496, 0.986098, 0.961721, - 0.143664, 0.197522, 1.01229, 0.965976, - 0.127412, 0.17302, 1.03571, 0.968652, - 0.109798, 0.148954, 1.05699, 0.971084, - 0.0916787, 0.125044, 1.07587, 0.975584, - 0.0739634, 0.100577, 1.09372, 0.98122, - 0.055322, 0.0753666, 1.10948, 0.988253, - 0.0366825, 0.0498899, 1.12394, 0.99482, - 0.0180389, 0.024611, 1.13694, 1.00001, 0.000229839, - 0.000188283, 1.14919, 0.613867, - 9.64198e-06, 0.479449, 1.23452e-05, 0.621485, - 0.000244534, 0.485399, 0.000313091, 0.621429, - 0.000978202, 0.485353, 0.00125245, 0.62112, - 0.00220004, 0.485114, 0.00281687, 0.621119, - 0.0039111, 0.485112, 0.00500783, 0.621122, - 0.00611091, 0.485112, 0.00782498, 0.621133, - 0.00879922, 0.485117, 0.0112687, 0.621152, - 0.0119756, 0.485125, 0.0153394, 0.621183, - 0.0156396, 0.485139, 0.0200382, 0.621227, - 0.0197898, 0.485158, 0.0253663, 0.621298, - 0.0244253, 0.485192, 0.0313261, 0.621388, - 0.0295441, 0.485233, 0.0379204, 0.621507, - 0.0351432, 0.485286, 0.0451523, 0.621693, - 0.0412198, 0.485378, 0.0530277, 0.621933, - 0.0477673, 0.485495, 0.0615522, 0.622232, - 0.0547574, 0.485635, 0.0707316, 0.622809, - 0.0619417, 0.485943, 0.0805883, 0.623407, - 0.069625, 0.486232, 0.0911267, 0.62406, - 0.077796, 0.486516, 0.102354, 0.624835, - 0.0863731, 0.486838, 0.114279, 0.625758, - 0.095251, 0.487188, 0.126902, 0.627043, - 0.104299, 0.487695, 0.140285, 0.628438, - 0.113724, 0.488163, 0.154397, 0.630325, - 0.123417, 0.488858, 0.169267, 0.632801, - 0.133137, 0.489754, 0.184941, 0.635784, - 0.143052, 0.490815, 0.20136, 0.639406, - 0.153132, 0.492048, 0.218643, 0.643872, - 0.163143, 0.49363, 0.236615, 0.6499, - 0.17333, 0.496009, 0.255449, 0.657201, - 0.183622, 0.498994, 0.275006, 0.666221, - 0.194019, 0.502888, 0.295354, 0.674419, - 0.204192, 0.505459, 0.316244, 0.683729, - 0.21406, 0.507771, 0.33849, 0.695584, - 0.222854, 0.510245, 0.363166, 0.708583, - 0.231315, 0.512293, 0.389071, 0.721233, - 0.238911, 0.512747, 0.415737, 0.735134, - 0.245657, 0.512482, 0.443331, 0.750179, - 0.251879, 0.511526, 0.471891, 0.765073, - 0.256911, 0.508935, 0.500892, 0.779794, - 0.261144, 0.504341, 0.530294, 0.794801, - 0.264316, 0.498515, 0.560144, 0.810339, - 0.266276, 0.491015, 0.590213, 0.824818, - 0.266981, 0.481126, 0.620865, 0.839375, - 0.265778, 0.468685, 0.652687, 0.853043, - 0.262748, 0.453925, 0.684759, 0.867335, - 0.258474, 0.437912, 0.716209, 0.88037, - 0.253187, 0.419648, 0.747508, 0.891711, - 0.246476, 0.39982, 0.77797, 0.902896, - 0.238735, 0.37879, 0.808586, 0.913601, - 0.22885, 0.355891, 0.838843, 0.923019, - 0.217656, 0.331773, 0.869014, 0.933432, - 0.205539, 0.307356, 0.898512, 0.939691, - 0.192595, 0.281321, 0.9269, 0.946938, - 0.178945, 0.255441, 0.955297, 0.952372, - 0.163587, 0.229013, 0.983231, 0.95909, - 0.147214, 0.203179, 1.00971, 0.963675, - 0.13064, 0.17792, 1.03438, 0.968247, - 0.113121, 0.152898, 1.05625, 0.97001, - 0.0945824, 0.128712, 1.07598, 0.974458, - 0.0755648, 0.103349, 1.094, 0.980168, - 0.0571998, 0.0776731, 1.1104, 0.987295, - 0.0377994, 0.0514445, 1.12491, 0.994432, - 0.0186417, 0.025429, 1.13851, 0.999975, 0.000542714, - 0.000282356, 1.15108, 0.592656, - 9.80249e-06, 0.486018, 1.19532e-05, 0.598467, - 0.000247275, 0.490781, 0.000301531, 0.597934, - 0.000988317, 0.490343, 0.00120517, 0.597903, - 0.00222366, 0.490319, 0.0027116, 0.597913, - 0.00395315, 0.490327, 0.00482077, 0.597919, - 0.00617653, 0.490329, 0.00753264, 0.597936, - 0.00889375, 0.490339, 0.0108478, 0.597956, - 0.0121043, 0.490347, 0.0147668, 0.597992, - 0.0158073, 0.490365, 0.0192905, 0.598032, - 0.0200017, 0.490382, 0.0244204, 0.598109, - 0.0246865, 0.49042, 0.0301593, 0.598215, - 0.0298594, 0.490474, 0.03651, 0.59833, - 0.0355167, 0.490524, 0.0434757, 0.598525, - 0.0416559, 0.490624, 0.0510629, 0.598778, - 0.0482692, 0.490753, 0.0592781, 0.599135, - 0.0553114, 0.49094, 0.0681304, 0.599802, - 0.062542, 0.491328, 0.0776467, 0.600361, - 0.0703638, 0.491598, 0.0878184, 0.60101, - 0.0786256, 0.491882, 0.0986573, 0.601811, - 0.0872962, 0.492232, 0.11018, 0.602861, - 0.0962284, 0.492684, 0.1224, 0.604167, - 0.10538, 0.493213, 0.135354, 0.605693, - 0.114896, 0.493799, 0.149034, 0.607682, - 0.124654, 0.494576, 0.163469, 0.610672, - 0.13456, 0.4959, 0.178747, 0.613313, - 0.144581, 0.496713, 0.194723, 0.617603, - 0.154703, 0.498499, 0.211617, 0.622174, - 0.16489, 0.500188, 0.229183, 0.628855, - 0.175164, 0.503072, 0.247786, 0.636963, - 0.185565, 0.506798, 0.267116, 0.644866, - 0.195911, 0.509719, 0.28702, 0.653741, - 0.206104, 0.512776, 0.307763, 0.664942, - 0.216447, 0.516812, 0.329631, 0.67633, - 0.22552, 0.519181, 0.353515, 0.690012, - 0.234316, 0.521681, 0.379226, 0.704243, - 0.242032, 0.523129, 0.405901, 0.719396, - 0.249172, 0.523768, 0.433585, 0.734471, - 0.255543, 0.522541, 0.462085, 0.750539, - 0.260697, 0.520217, 0.491233, 0.766365, - 0.26501, 0.516293, 0.521094, 0.781677, - 0.268409, 0.509708, 0.551014, 0.797132, - 0.270399, 0.501944, 0.581463, 0.812655, - 0.271247, 0.492025, 0.612402, 0.828592, - 0.270708, 0.480424, 0.643798, 0.844044, - 0.268085, 0.465955, 0.67682, 0.857305, - 0.263459, 0.448425, 0.708496, 0.87114, - 0.258151, 0.430243, 0.74046, 0.884936, - 0.251171, 0.410578, 0.771583, 0.895772, - 0.243305, 0.38862, 0.802234, 0.906961, - 0.234037, 0.365214, 0.833179, 0.917775, - 0.222714, 0.34116, 0.86353, 0.927883, - 0.210175, 0.31572, 0.893557, 0.936617, - 0.196925, 0.289159, 0.922976, 0.943384, - 0.182788, 0.261996, 0.951606, 0.949713, - 0.167965, 0.235324, 0.979958, 0.955818, - 0.151109, 0.208408, 1.00765, 0.961344, - 0.133834, 0.182591, 1.03329, 0.965469, - 0.115987, 0.156958, 1.0557, 0.968693, - 0.09746, 0.132239, 1.07583, 0.973165, - 0.0778514, 0.106195, 1.09451, 0.979387, - 0.0585067, 0.0797669, 1.11137, 0.98671, - 0.0390409, 0.0530263, 1.12643, 0.994093, - 0.019408, 0.0263163, 1.14016, 1.00002, 0.000540029, - 0.000194487, 1.15299, 0.574483, - 9.89066e-06, 0.494533, 1.14896e-05, 0.574478, - 0.000249127, 0.494528, 0.000289403, 0.574607, - 0.000996811, 0.494637, 0.00115797, 0.574396, - 0.00224241, 0.494458, 0.00260498, 0.574377, - 0.00398632, 0.49444, 0.00463102, 0.574386, - 0.00622836, 0.494445, 0.00723623, 0.574401, - 0.0089683, 0.494453, 0.010421, 0.574419, - 0.0122056, 0.49446, 0.0141859, 0.574459, - 0.0159396, 0.494481, 0.0185322, 0.574525, - 0.0201692, 0.49452, 0.0234617, 0.574587, - 0.0248924, 0.494547, 0.0289762, 0.574697, - 0.0301074, 0.494604, 0.0350797, 0.574853, - 0.0358114, 0.494688, 0.0417767, 0.575027, - 0.041999, 0.494772, 0.0490718, 0.575294, - 0.0486618, 0.494915, 0.0569728, 0.575733, - 0.0557148, 0.495173, 0.0654955, 0.576356, - 0.0630489, 0.495537, 0.0746612, 0.576944, - 0.0709285, 0.495836, 0.0844615, 0.57765, - 0.0792723, 0.496177, 0.0949142, 0.578491, - 0.0880167, 0.496563, 0.10603, 0.579639, - 0.0969462, 0.497096, 0.117841, 0.580989, - 0.10622, 0.497684, 0.130367, 0.582587, - 0.115861, 0.498337, 0.143609, 0.584951, - 0.125605, 0.499414, 0.157625, 0.587602, - 0.135608, 0.500518, 0.172413, 0.59076, - 0.145742, 0.501767, 0.187999, 0.594992, - 0.155934, 0.503542, 0.20445, 0.600656, - 0.166303, 0.506135, 0.221764, 0.607816, - 0.176681, 0.509542, 0.24002, 0.61522, - 0.187071, 0.51263, 0.258992, 0.623702, - 0.197465, 0.516021, 0.278773, 0.634192, - 0.207816, 0.520422, 0.299377, 0.644936, - 0.218183, 0.524073, 0.320802, 0.657888, - 0.2278, 0.528049, 0.34384, 0.670666, - 0.236747, 0.52986, 0.36916, 0.685626, - 0.24484, 0.531892, 0.395867, 0.701304, - 0.252071, 0.532727, 0.423488, 0.717727, - 0.258714, 0.532146, 0.452201, 0.733914, - 0.264211, 0.529883, 0.481579, 0.750529, - 0.26859, 0.5259, 0.511558, 0.76747, - 0.272046, 0.51999, 0.542042, 0.785189, - 0.274225, 0.513083, 0.572799, 0.800954, - 0.275189, 0.502936, 0.603816, 0.816962, - 0.274946, 0.490921, 0.635461, 0.83336, - 0.272695, 0.47684, 0.6676, 0.848143, - 0.268223, 0.459405, 0.70051, 0.861818, - 0.262768, 0.440319, 0.732902, 0.876828, - 0.255872, 0.420123, 0.765084, 0.889312, - 0.247703, 0.398379, 0.796391, 0.900412, - 0.238381, 0.374496, 0.827333, 0.912251, - 0.227783, 0.349874, 0.858385, 0.921792, - 0.214832, 0.323181, 0.888652, 0.931273, - 0.200949, 0.296624, 0.917763, 0.940295, - 0.186537, 0.269211, 0.947878, 0.946812, - 0.171538, 0.241447, 0.977016, 0.953588, - 0.155254, 0.213829, 1.00501, 0.958841, - 0.137156, 0.186807, 1.03179, 0.963746, - 0.118699, 0.160706, 1.05502, 0.966468, - 0.0998358, 0.135504, 1.07568, 0.971178, - 0.0805186, 0.109131, 1.09479, 0.97831, - 0.0599348, 0.0818293, 1.1123, 0.985886, - 0.0399661, 0.0545872, 1.12771, 0.994021, - 0.0198682, 0.0269405, 1.14186, 1.00009, 0.000271022, - 0.00012989, 1.15514, 0.538716, - 9.90918e-06, 0.486732, 1.09675e-05, 0.550656, - 0.000250642, 0.497518, 0.000277412, 0.55057, - 0.00100265, 0.497441, 0.00110974, 0.550903, - 0.00225672, 0.497733, 0.00249779, 0.550568, - 0.00401046, 0.497438, 0.00443906, 0.550574, - 0.00626613, 0.49744, 0.00693637, 0.550591, - 0.0090226, 0.497449, 0.00998921, 0.550623, - 0.0122795, 0.497469, 0.0135984, 0.550667, - 0.0160361, 0.497495, 0.0177654, 0.550724, - 0.0202908, 0.497526, 0.0224915, 0.550792, - 0.0250421, 0.497557, 0.0277795, 0.550918, - 0.0302878, 0.49763, 0.0336334, 0.551058, - 0.0360241, 0.497701, 0.0400573, 0.551276, - 0.0422473, 0.497824, 0.0470585, 0.551551, - 0.0489441, 0.497977, 0.0546433, 0.552074, - 0.0559596, 0.498312, 0.0628367, 0.552681, - 0.0633978, 0.498679, 0.071646, 0.553324, - 0.0713176, 0.499031, 0.0810746, 0.554011, - 0.0797268, 0.499365, 0.091129, 0.55488, - 0.0885238, 0.499779, 0.101837, 0.556171, - 0.0974417, 0.500444, 0.113239, 0.557498, - 0.106841, 0.501025, 0.125316, 0.559299, - 0.116533, 0.501864, 0.138128, 0.561647, - 0.126298, 0.502967, 0.151695, 0.564347, - 0.136388, 0.504129, 0.16604, 0.567863, - 0.146576, 0.505713, 0.181207, 0.572569, - 0.156832, 0.507953, 0.197259, 0.578919, - 0.167323, 0.511186, 0.214258, 0.585387, - 0.177712, 0.514042, 0.232038, 0.593134, - 0.188184, 0.517484, 0.250733, 0.603295, - 0.198717, 0.522345, 0.270454, 0.613854, - 0.209177, 0.526751, 0.290807, 0.626092, - 0.219644, 0.531595, 0.312202, 0.637868, - 0.229494, 0.534721, 0.334435, 0.652458, - 0.238718, 0.538304, 0.359184, 0.666985, - 0.247061, 0.539875, 0.385637, 0.683301, - 0.254652, 0.541042, 0.41328, 0.69998, - 0.261376, 0.540735, 0.441903, 0.717824, - 0.267085, 0.539139, 0.471609, 0.734617, - 0.271465, 0.534958, 0.501446, 0.753663, - 0.27528, 0.53032, 0.532571, 0.770512, - 0.277617, 0.522134, 0.563641, 0.787356, - 0.278525, 0.51206, 0.595067, 0.806252, - 0.278512, 0.50119, 0.627226, 0.822061, - 0.277023, 0.486791, 0.659402, 0.838959, - 0.273175, 0.470467, 0.692874, 0.85379, - 0.267238, 0.450688, 0.725702, 0.868268, - 0.260327, 0.429741, 0.75832, 0.881994, - 0.251946, 0.407223, 0.790189, 0.893885, - 0.242432, 0.383214, 0.821625, 0.905118, - 0.231904, 0.357297, 0.853011, 0.916045, - 0.219545, 0.330733, 0.883773, 0.927614, - 0.205378, 0.303916, 0.914435, 0.936005, - 0.190388, 0.275941, 0.944502, 0.944533, - 0.1749, 0.247493, 0.974439, 0.950758, - 0.158588, 0.218996, 1.00286, 0.957078, - 0.141027, 0.191559, 1.0304, 0.962448, - 0.121507, 0.164457, 1.05466, 0.964993, - 0.102068, 0.138636, 1.0761, 0.970017, - 0.0822598, 0.111861, 1.09541, 0.97661, - 0.062033, 0.0843438, 1.11317, 0.985073, - 0.0409832, 0.0558496, 1.12911, 0.993515, - 0.020146, 0.0275331, 1.1438, 1.00006, 0.00027329, - 0.000107883, 1.15736, 0.525324, - 9.99341e-06, 0.498153, 1.05385e-05, 0.526513, - 0.000251605, 0.499277, 0.000265329, 0.526517, - 0.00100641, 0.499282, 0.0010613, 0.526588, - 0.00226466, 0.499337, 0.00238823, 0.526539, - 0.0040255, 0.499302, 0.00424535, 0.526547, - 0.00628954, 0.499306, 0.00663364, 0.526561, - 0.00905628, 0.499313, 0.00955337, 0.526593, - 0.0123253, 0.499334, 0.0130054, 0.526642, - 0.0160957, 0.499365, 0.0169911, 0.5267, - 0.0203661, 0.499396, 0.0215122, 0.526792, - 0.0251347, 0.499451, 0.0265718, 0.526904, - 0.0303985, 0.499511, 0.0321732, 0.527079, - 0.0361554, 0.499617, 0.0383231, 0.527285, - 0.0423982, 0.499731, 0.045026, 0.527602, - 0.0491121, 0.499924, 0.0522936, 0.528166, - 0.0561127, 0.500306, 0.0601528, 0.52879, - 0.0635988, 0.5007, 0.0686059, 0.529421, - 0.071581, 0.501048, 0.0776518, 0.530144, - 0.0799854, 0.501421, 0.0873148, 0.531062, - 0.0888032, 0.501884, 0.0976084, 0.532374, - 0.0977643, 0.50259, 0.108588, 0.533828, - 0.107197, 0.50329, 0.120234, 0.53581, - 0.116887, 0.504312, 0.132602, 0.538063, - 0.126755, 0.505365, 0.145721, 0.5409, - 0.136819, 0.506668, 0.159617, 0.544882, - 0.147117, 0.508731, 0.174369, 0.550238, - 0.157446, 0.511601, 0.190028, 0.556038, - 0.167988, 0.514431, 0.206587, 0.563031, - 0.178364, 0.517808, 0.224046, 0.571543, - 0.189007, 0.521937, 0.242503, 0.582255, - 0.199546, 0.527415, 0.261977, 0.59272, - 0.210084, 0.531682, 0.282162, 0.605648, - 0.220448, 0.537123, 0.303426, 0.61785, - 0.230593, 0.540664, 0.325323, 0.632223, - 0.240238, 0.544467, 0.348993, 0.648819, - 0.24887, 0.547594, 0.375462, 0.665825, - 0.256657, 0.54912, 0.403024, 0.683389, - 0.263711, 0.549294, 0.431773, 0.701495, - 0.269666, 0.547649, 0.461494, 0.719197, - 0.274169, 0.543786, 0.491623, 0.737906, - 0.278124, 0.538644, 0.522994, 0.756652, - 0.280632, 0.531057, 0.554775, 0.775279, - 0.281741, 0.521972, 0.586441, 0.792688, - 0.281652, 0.509613, 0.618596, 0.811894, - 0.280345, 0.496497, 0.651462, 0.827938, - 0.277128, 0.47968, 0.684023, 0.844837, - 0.271646, 0.460688, 0.718024, 0.859239, - 0.264397, 0.438872, 0.751207, 0.874088, - 0.256144, 0.41577, 0.784232, 0.887693, - 0.246311, 0.391369, 0.816191, 0.899402, - 0.235497, 0.365872, 0.847828, 0.910973, - 0.223631, 0.338618, 0.87934, 0.92204, - 0.209874, 0.310803, 0.910325, 0.930987, - 0.194265, 0.281802, 0.940695, 0.94, - 0.178125, 0.252836, 0.970958, 0.948018, - 0.161479, 0.224239, 1.00078, 0.955141, - 0.144038, 0.195857, 1.0288, 0.960513, - 0.124915, 0.168487, 1.05371, 0.963964, - 0.104284, 0.141495, 1.07596, 0.968713, - 0.0838732, 0.114437, 1.09628, 0.975524, - 0.0635579, 0.0863105, 1.11448, 0.98431, - 0.042291, 0.0574774, 1.13069, 0.992916, - 0.0209131, 0.0284343, 1.14568, 0.999926, 0.000743097, - 0.000379265, 1.15955, 0.501042, - 9.98428e-06, 0.498726, 1.00306e-05, 0.502992, - 0.000252112, 0.500665, 0.000253283, 0.502417, - 0.00100791, 0.500092, 0.00101259, 0.502965, - 0.00226919, 0.500621, 0.00227978, 0.502318, - 0.00403109, 0.499994, 0.00405011, 0.502333, - 0.00629832, 0.500005, 0.00632868, 0.502362, - 0.00906907, 0.500027, 0.00911446, 0.502369, - 0.0123423, 0.500023, 0.0124078, 0.50243, - 0.0161178, 0.500066, 0.016211, 0.502493, - 0.0203937, 0.500103, 0.0205256, 0.502592, - 0.0251684, 0.500166, 0.0253548, 0.502707, - 0.0304389, 0.50023, 0.0307029, 0.502881, - 0.0362015, 0.500335, 0.0365753, 0.503124, - 0.0424507, 0.500488, 0.0429798, 0.503443, - 0.0491582, 0.500686, 0.0499268, 0.504083, - 0.0561476, 0.501155, 0.0574541, 0.504668, - 0.0636846, 0.501524, 0.0655408, 0.505319, - 0.0716834, 0.501904, 0.0742072, 0.50609, - 0.0800925, 0.502321, 0.0834699, 0.507122, - 0.0888425, 0.502896, 0.0933603, 0.508414, - 0.097855, 0.503603, 0.10391, 0.509955, - 0.107304, 0.504416, 0.115113, 0.512061, - 0.116921, 0.505565, 0.127054, 0.514419, - 0.12689, 0.506732, 0.139709, 0.517529, - 0.136934, 0.508338, 0.153173, 0.522085, - 0.147327, 0.510987, 0.167528, 0.526986, - 0.157612, 0.513527, 0.182708, 0.533122, - 0.168213, 0.516717, 0.198881, 0.540807, - 0.178688, 0.520832, 0.215986, 0.550687, - 0.189511, 0.52632, 0.234335, 0.560567, - 0.199998, 0.531009, 0.253375, 0.571698, - 0.210652, 0.535839, 0.273499, 0.584364, - 0.220917, 0.541091, 0.294355, 0.599066, - 0.23137, 0.546875, 0.316525, 0.614148, - 0.241206, 0.551306, 0.339671, 0.631157, - 0.250379, 0.555187, 0.36531, 0.647919, - 0.258397, 0.556595, 0.392767, 0.666112, - 0.265528, 0.556949, 0.421397, 0.686158, - 0.271827, 0.556617, 0.451433, 0.704838, - 0.27674, 0.552975, 0.482131, 0.723957, - 0.280733, 0.547814, 0.513458, 0.74262, - 0.283359, 0.53997, 0.545446, 0.762009, - 0.284541, 0.530422, 0.57775, 0.781314, - 0.284507, 0.518546, 0.610434, 0.799116, - 0.283309, 0.504178, 0.643178, 0.817604, - 0.280378, 0.48843, 0.676248, 0.83459, - 0.275619, 0.469457, 0.709698, 0.850974, - 0.26856, 0.447698, 0.744245, 0.866747, - 0.260094, 0.424791, 0.777695, 0.881412, - 0.249929, 0.399913, 0.810392, 0.8936, - 0.239137, 0.37308, 0.842872, 0.905943, - 0.226818, 0.345705, 0.874677, 0.916408, - 0.213699, 0.31706, 0.906257, 0.927215, - 0.198428, 0.288444, 0.936881, 0.935625, - 0.181643, 0.258329, 0.96795, 0.944076, - 0.164386, 0.228488, 0.998216, 0.951229, - 0.146339, 0.199763, 1.02689, 0.958793, - 0.127709, 0.172153, 1.0535, 0.963219, - 0.107244, 0.144989, 1.07646, 0.967562, - 0.0857764, 0.11685, 1.09675, 0.974866, - 0.0645377, 0.0880571, 1.11576, 0.983353, - 0.0431732, 0.0587352, 1.13227, 0.992503, - 0.0218356, 0.0294181, 1.1478, 1.00003, 0.000605203, - 0.000231013, 1.16207, 0.482935, - 1.01177e-05, 0.504695, 9.68142e-06, 0.477554, - 0.000251521, 0.499071, 0.000240676, 0.477904, - 0.00100683, 0.499436, 0.00096342, 0.478368, - 0.00226636, 0.499899, 0.0021687, 0.477977, - 0.00402719, 0.499513, 0.00385384, 0.477993, - 0.00629226, 0.499525, 0.0060221, 0.478011, - 0.00906011, 0.499536, 0.00867289, 0.478051, - 0.0123305, 0.499566, 0.0118074, 0.478089, - 0.016102, 0.499587, 0.0154269, 0.478171, - 0.0203736, 0.499645, 0.0195341, 0.478254, - 0.025143, 0.499692, 0.0241318, 0.47839, - 0.0304071, 0.499779, 0.0292247, 0.478588, - 0.0361631, 0.499911, 0.0348196, 0.478812, - 0.0424023, 0.500046, 0.0409231, 0.479208, - 0.0490724, 0.500326, 0.047552, 0.479841, - 0.0560722, 0.500805, 0.0547377, 0.480392, - 0.0636125, 0.501152, 0.0624607, 0.481068, - 0.0716134, 0.501561, 0.0707473, 0.481898, - 0.0800062, 0.502054, 0.0796118, 0.483022, - 0.0886568, 0.502728, 0.0890974, 0.484332, - 0.0977553, 0.503479, 0.0992099, 0.486126, - 0.107173, 0.504546, 0.10999, 0.488066, - 0.11677, 0.50557, 0.121476, 0.490521, - 0.126725, 0.506849, 0.133672, 0.494232, - 0.136793, 0.50911, 0.146731, 0.498302, - 0.147116, 0.511345, 0.160577, 0.503565, - 0.157446, 0.514344, 0.175335, 0.510902, - 0.168121, 0.518824, 0.191207, 0.519263, - 0.178799, 0.523666, 0.208058, 0.528204, - 0.189407, 0.528296, 0.225875, 0.538854, - 0.200145, 0.533724, 0.244782, 0.551278, - 0.210701, 0.539833, 0.264753, 0.565222, - 0.221303, 0.546131, 0.285745, 0.579403, - 0.231688, 0.551496, 0.307592, 0.595469, - 0.241718, 0.556809, 0.330582, 0.610929, - 0.250992, 0.559641, 0.354995, 0.629433, - 0.259602, 0.562379, 0.382471, 0.648504, - 0.267038, 0.563676, 0.411126, 0.66756, - 0.273388, 0.562092, 0.440924, 0.689143, - 0.278788, 0.560807, 0.472118, 0.709056, - 0.282783, 0.555701, 0.503774, 0.729855, - 0.285836, 0.548698, 0.536364, 0.748954, - 0.287078, 0.538544, 0.56895, 0.768373, - 0.287133, 0.526711, 0.601991, 0.78827, - 0.285839, 0.512511, 0.635403, 0.807465, - 0.283238, 0.496323, 0.668797, 0.825194, - 0.27906, 0.477638, 0.702584, 0.842203, - 0.272286, 0.456253, 0.736393, 0.857749, - 0.263854, 0.432412, 0.77096, 0.874799, - 0.253943, 0.407806, 0.80489, 0.887497, - 0.24237, 0.38033, 0.83771, 0.89966, - 0.230278, 0.352446, 0.870376, 0.911753, - 0.21646, 0.323268, 0.902256, 0.923011, - 0.202071, 0.294314, 0.933306, 0.932375, - 0.185519, 0.264104, 0.965177, 0.940537, - 0.167604, 0.234035, 0.996303, 0.948904, - 0.149068, 0.20412, 1.0261, 0.955263, - 0.129539, 0.175431, 1.05304, 0.960303, - 0.109932, 0.148116, 1.07617, 0.965512, - 0.0880572, 0.119693, 1.09742, 0.973466, - 0.0660548, 0.0901619, 1.11721, 0.98284, - 0.0439228, 0.0599875, 1.13436, 0.992216, - 0.0219588, 0.0298975, 1.15006, 0.999946, 0.000119402, - 2.08547e-05, 1.16471, 0.447827, - 1.00414e-05, 0.491543, 9.14833e-06, 0.454778, - 0.000251257, 0.499172, 0.00022891, 0.453519, - 0.00100342, 0.497787, 0.000914184, 0.45357, - 0.00225776, 0.497847, 0.00205701, 0.453578, - 0.00401371, 0.497855, 0.00365705, 0.45357, - 0.00627107, 0.497841, 0.00571453, 0.453598, - 0.00902968, 0.497864, 0.00823019, 0.453627, - 0.0122888, 0.497882, 0.0112049, 0.453684, - 0.0160475, 0.497923, 0.0146405, 0.453764, - 0.0203044, 0.49798, 0.0185394, 0.453866, - 0.0250576, 0.498049, 0.0229054, 0.453996, - 0.0303028, 0.49813, 0.0277424, 0.454196, - 0.0360379, 0.498267, 0.0330587, 0.454457, - 0.0422521, 0.498445, 0.0388613, 0.454926, - 0.0488393, 0.498812, 0.0451767, 0.455525, - 0.0558653, 0.499272, 0.0520153, 0.456074, - 0.0633772, 0.499625, 0.0593754, 0.456752, - 0.0713606, 0.500049, 0.0672751, 0.457648, - 0.07971, 0.500615, 0.0757447, 0.458849, - 0.0883032, 0.501399, 0.0848231, 0.46029, - 0.0974095, 0.502293, 0.0945135, 0.462, - 0.106729, 0.503301, 0.104848, 0.464121, - 0.116354, 0.504533, 0.115884, 0.466889, - 0.126214, 0.506172, 0.127652, 0.470744, - 0.136324, 0.508667, 0.14024, 0.47488, - 0.146595, 0.510995, 0.153673, 0.480845, - 0.157027, 0.514832, 0.168053, 0.488262, - 0.167658, 0.519506, 0.183508, 0.496547, - 0.178343, 0.524347, 0.199948, 0.506254, - 0.188916, 0.52983, 0.217503, 0.517961, - 0.199975, 0.536357, 0.236272, 0.531484, - 0.210624, 0.543641, 0.256096, 0.545496, - 0.221227, 0.550048, 0.277085, 0.559497, - 0.231568, 0.555076, 0.298615, 0.575752, - 0.241698, 0.560541, 0.321547, 0.591999, - 0.251172, 0.564156, 0.345602, 0.610654, - 0.260178, 0.567607, 0.371851, 0.630484, - 0.268094, 0.56923, 0.40076, 0.651807, - 0.274661, 0.569779, 0.430801, 0.67239, - 0.280331, 0.566791, 0.461939, 0.693024, - 0.284501, 0.562007, 0.493854, 0.715473, - 0.287852, 0.555791, 0.526992, 0.736323, - 0.28929, 0.546345, 0.560102, 0.755771, - 0.289405, 0.534, 0.593543, 0.775424, - 0.2881, 0.519114, 0.627256, 0.795447, - 0.285562, 0.502543, 0.661464, 0.815319, - 0.281416, 0.484773, 0.695206, 0.831769, - 0.275523, 0.463445, 0.729044, 0.849464, - 0.267516, 0.440269, 0.764069, 0.866775, - 0.257584, 0.415049, 0.799089, 0.881252, - 0.245817, 0.388049, 0.831948, 0.894209, - 0.233127, 0.35889, 0.865526, 0.906922, - 0.219579, 0.329915, 0.89818, 0.919686, - 0.204491, 0.300441, 0.930013, 0.929044, - 0.188962, 0.269445, 0.962061, 0.938393, - 0.171079, 0.238402, 0.994214, 0.94661, - 0.15199, 0.208204, 1.02533, 0.953095, - 0.131953, 0.178653, 1.0529, 0.958644, - 0.111233, 0.150684, 1.0771, 0.963925, - 0.0903098, 0.122359, 1.09855, 0.971995, - 0.0680505, 0.0923342, 1.11874, 0.981658, - 0.0448512, 0.0614195, 1.13635, 0.991649, - 0.0221931, 0.0303582, 1.15238, 0.999985, 0.000393403, - 0.000111086, 1.16772, 0.396806, - 9.71563e-06, 0.457671, 8.42355e-06, 0.429186, - 0.000249421, 0.495017, 0.00021625, 0.429324, - 0.000998052, 0.495173, 0.000865322, 0.429175, - 0.00224487, 0.494999, 0.00194637, 0.429129, - 0.00399041, 0.494952, 0.00346004, 0.429153, - 0.00623476, 0.494974, 0.00540684, 0.429168, - 0.0089773, 0.494983, 0.00778714, 0.429207, - 0.0122175, 0.495012, 0.0106022, 0.429257, - 0.0159542, 0.495047, 0.0138535, 0.429338, - 0.0201864, 0.495106, 0.0175443, 0.429431, - 0.0249104, 0.495165, 0.0216774, 0.429587, - 0.0301252, 0.495279, 0.0262594, 0.429796, - 0.0358249, 0.495432, 0.0312968, 0.430065, - 0.0419972, 0.495621, 0.0367985, 0.430588, - 0.0485144, 0.496061, 0.042798, 0.43113, - 0.0555028, 0.496472, 0.0492914, 0.431743, - 0.0629852, 0.496904, 0.0562907, 0.432448, - 0.0709256, 0.497369, 0.0638056, 0.433414, - 0.0791942, 0.498032, 0.071885, 0.434638, - 0.0877346, 0.498854, 0.0805517, 0.43611, - 0.0968056, 0.499812, 0.0898047, 0.437859, - 0.106002, 0.500891, 0.0997142, 0.440017, - 0.115648, 0.502198, 0.110289, 0.443236, - 0.125427, 0.504389, 0.121644, 0.44697, - 0.135492, 0.506809, 0.133769, 0.451689, - 0.145746, 0.509858, 0.146787, 0.45811, - 0.156219, 0.514247, 0.160793, 0.465305, - 0.166834, 0.518816, 0.175791, 0.474085, - 0.177546, 0.524331, 0.191906, 0.484808, - 0.188262, 0.53104, 0.209199, 0.49732, - 0.199346, 0.538511, 0.227825, 0.509693, - 0.209951, 0.544554, 0.247269, 0.524367, - 0.220533, 0.551616, 0.267978, 0.539228, - 0.231082, 0.557368, 0.289672, 0.55644, - 0.241342, 0.563782, 0.31268, 0.574204, - 0.250964, 0.568851, 0.33651, 0.593388, - 0.260306, 0.57312, 0.362219, 0.613358, - 0.268667, 0.574916, 0.390322, 0.634512, - 0.275591, 0.575053, 0.420478, 0.65563, - 0.281328, 0.572404, 0.451614, 0.678265, - 0.285948, 0.568893, 0.484112, 0.70011, - 0.289408, 0.561878, 0.517348, 0.723005, - 0.291328, 0.55359, 0.551355, 0.743744, - 0.291418, 0.541099, 0.585109, 0.763949, - 0.290252, 0.526489, 0.619487, 0.784186, - 0.287648, 0.509496, 0.65404, 0.804304, - 0.283782, 0.491484, 0.688649, 0.823629, - 0.278067, 0.470517, 0.723133, 0.84094, - 0.270588, 0.44705, 0.757163, 0.857852, - 0.261188, 0.421252, 0.792816, 0.874934, - 0.249313, 0.394191, 0.827248, 0.888709, - 0.236492, 0.365359, 0.861074, 0.902589, - 0.222185, 0.336016, 0.894417, 0.914201, - 0.207314, 0.30527, 0.926825, 0.925978, - 0.191146, 0.274532, 0.9595, 0.93512, - 0.174135, 0.243393, 0.991583, 0.943656, - 0.155231, 0.212414, 1.02356, 0.951719, - 0.134403, 0.182005, 1.05239, 0.957164, - 0.113023, 0.153043, 1.07754, 0.962656, - 0.0914493, 0.124186, 1.09984, 0.970695, - 0.0694179, 0.0941654, 1.12, 0.980749, - 0.0466199, 0.0629671, 1.13849, 0.991205, - 0.0227032, 0.0311146, 1.15494, 0.999884, 0.000632388, - 0.000254483, 1.1706, 0.379821, - 9.57289e-06, 0.460637, 7.89337e-06, 0.405188, - 0.000247483, 0.491396, 0.000204064, 0.404796, - 0.000989434, 0.490914, 0.000815853, 0.40483, - 0.00222607, 0.490949, 0.00183559, 0.40473, - 0.00395723, 0.49084, 0.00326332, 0.404731, - 0.00618287, 0.490836, 0.00509945, 0.404768, - 0.00890258, 0.490871, 0.00734463, 0.404791, - 0.0121156, 0.490883, 0.00999992, 0.404857, - 0.0158214, 0.490938, 0.0130676, 0.404943, - 0.0200178, 0.491004, 0.0165503, 0.405059, - 0.0247027, 0.491093, 0.0204521, 0.405213, - 0.0298729, 0.491205, 0.0247788, 0.405399, - 0.0355226, 0.491333, 0.0295373, 0.405731, - 0.0416352, 0.491604, 0.034741, 0.406303, - 0.0480807, 0.492116, 0.0404255, 0.406814, - 0.0550458, 0.492506, 0.0465732, 0.407404, - 0.0624652, 0.492926, 0.0532058, 0.408149, - 0.0702958, 0.493442, 0.0603442, 0.409128, - 0.0784623, 0.494136, 0.0680297, 0.410408, - 0.087007, 0.495054, 0.0762786, 0.411813, - 0.0959639, 0.495962, 0.0851046, 0.413735, - 0.105075, 0.497257, 0.0945878, 0.416137, - 0.114646, 0.498882, 0.104725, 0.41934, - 0.124394, 0.501132, 0.11563, 0.423326, - 0.134328, 0.503883, 0.127325, 0.428419, - 0.14458, 0.50747, 0.139911, 0.43484, - 0.154979, 0.511964, 0.153481, 0.442641, - 0.165628, 0.517328, 0.168114, 0.452511, - 0.176365, 0.524258, 0.183995, 0.463473, - 0.187298, 0.531248, 0.200953, 0.475564, - 0.198244, 0.538367, 0.219176, 0.488664, - 0.208938, 0.545175, 0.238514, 0.504073, - 0.219599, 0.553227, 0.259129, 0.520832, - 0.230378, 0.560653, 0.280997, 0.538455, - 0.240703, 0.567523, 0.303821, 0.55709, - 0.250548, 0.573287, 0.327948, 0.576646, - 0.259964, 0.577795, 0.353362, 0.596705, - 0.268721, 0.580077, 0.380336, 0.618053, - 0.276054, 0.58018, 0.4101, 0.640303, - 0.282176, 0.578747, 0.44161, 0.662365, - 0.286931, 0.574294, 0.474106, 0.684542, - 0.290521, 0.567035, 0.507549, 0.707984, - 0.292672, 0.558687, 0.541853, 0.730913, - 0.293189, 0.547606, 0.576581, 0.752948, - 0.292199, 0.533471, 0.61172, 0.773452, - 0.289508, 0.516395, 0.646339, 0.794715, - 0.285716, 0.497873, 0.682131, 0.814251, - 0.280051, 0.476845, 0.716396, 0.833057, - 0.272873, 0.453449, 0.751503, 0.84959, - 0.263982, 0.427857, 0.786085, 0.867022, - 0.252745, 0.400335, 0.821355, 0.882277, - 0.239655, 0.371304, 0.85646, 0.895375, - 0.225386, 0.340397, 0.890828, 0.909347, - 0.209587, 0.310005, 0.923532, 0.921885, - 0.193433, 0.2796, 0.956419, 0.932127, - 0.176135, 0.247276, 0.989445, 0.941869, - 0.157872, 0.216186, 1.02221, 0.949735, - 0.137577, 0.185602, 1.05195, 0.956617, - 0.115285, 0.155767, 1.07822, 0.961974, - 0.0928418, 0.126103, 1.10149, 0.96972, - 0.0700592, 0.0956758, 1.12207, 0.98012, - 0.0474671, 0.0643269, 1.1408, 0.990825, - 0.0238113, 0.0320863, 1.1577, 0.999876, 0.000381574, - 8.12203e-05, 1.17403, 0.367636, - 9.61342e-06, 0.469176, 7.53287e-06, 0.380377, - 0.000244772, 0.485434, 0.000191797, 0.380416, - 0.000978857, 0.485475, 0.000767015, 0.380376, - 0.00220165, 0.485435, 0.00172522, 0.380419, - 0.00391408, 0.485487, 0.00306734, 0.380438, - 0.00611549, 0.485505, 0.00479332, 0.380462, - 0.00880558, 0.485525, 0.00690391, 0.380496, - 0.0119837, 0.485551, 0.00940039, 0.38056, - 0.0156487, 0.485605, 0.0122848, 0.38064, - 0.0197988, 0.485666, 0.0155601, 0.380767, - 0.0244324, 0.48577, 0.0192313, 0.380909, - 0.0295444, 0.485871, 0.0233032, 0.381142, - 0.0351321, 0.48606, 0.0277861, 0.381472, - 0.0411535, 0.486336, 0.0326939, 0.382015, - 0.0475408, 0.486833, 0.0380565, 0.382523, - 0.0544395, 0.487231, 0.0438615, 0.383129, - 0.061784, 0.487683, 0.0501332, 0.383952, - 0.0695085, 0.488313, 0.0568996, 0.38498, - 0.0775819, 0.489077, 0.0641952, 0.386331, - 0.0860443, 0.490113, 0.0720324, 0.387788, - 0.0948406, 0.491099, 0.0804379, 0.389808, - 0.103899, 0.492566, 0.0894899, 0.39252, - 0.113313, 0.494601, 0.0992098, 0.395493, - 0.123007, 0.496619, 0.109641, 0.399826, - 0.132859, 0.499912, 0.120919, 0.405341, - 0.143077, 0.504061, 0.133107, 0.411932, - 0.153465, 0.508905, 0.146263, 0.420591, - 0.164108, 0.515482, 0.160544, 0.43101, - 0.174893, 0.523191, 0.176123, 0.441881, - 0.185839, 0.53026, 0.192757, 0.453919, - 0.196633, 0.537295, 0.210535, 0.468715, - 0.207611, 0.546156, 0.229886, 0.485182, - 0.218517, 0.555173, 0.250543, 0.501926, - 0.229249, 0.562728, 0.27221, 0.51785, - 0.239481, 0.567494, 0.294892, 0.536947, - 0.249395, 0.573889, 0.318987, 0.557115, - 0.259, 0.578831, 0.344348, 0.577966, - 0.268075, 0.582055, 0.371223, 0.599489, - 0.276115, 0.583307, 0.399834, 0.62479, - 0.282523, 0.583902, 0.431415, 0.647504, - 0.287663, 0.57953, 0.464301, 0.670601, - 0.291538, 0.573103, 0.498123, 0.693539, - 0.293842, 0.563731, 0.532662, 0.717385, - 0.294681, 0.553169, 0.567925, 0.741533, - 0.293717, 0.539908, 0.603502, 0.762142, - 0.291156, 0.521902, 0.639074, 0.783014, - 0.28719, 0.502815, 0.674439, 0.805158, - 0.281773, 0.482598, 0.710497, 0.823646, - 0.274682, 0.458949, 0.7456, 0.841879, - 0.266184, 0.433129, 0.781085, 0.859515, - 0.255682, 0.406064, 0.816, 0.875335, - 0.242849, 0.376509, 0.851074, 0.890147, - 0.228329, 0.345502, 0.886473, 0.903144, - 0.212491, 0.31428, 0.920751, 0.916618, - 0.195695, 0.282994, 0.954606, 0.927953, - 0.178267, 0.251091, 0.988402, 0.937414, - 0.159549, 0.219107, 1.02141, 0.946823, - 0.140022, 0.18896, 1.05167, 0.954651, - 0.118154, 0.158667, 1.07819, 0.959955, - 0.0946636, 0.128808, 1.1025, 0.96858, - 0.0711792, 0.0973787, 1.12391, 0.97938, - 0.0475046, 0.0650965, 1.14322, 0.990498, - 0.024059, 0.0326267, 1.16077, 0.999844, - 5.12408e-05, 0.000112444, 1.17727, 0.316912, - 9.34977e-06, 0.425996, 6.95559e-06, 0.356423, - 0.000241372, 0.479108, 0.000179562, 0.356272, - 0.000965292, 0.478897, 0.00071811, 0.356262, - 0.00217182, 0.478894, 0.00161574, 0.356265, - 0.00386092, 0.478895, 0.00287261, 0.356278, - 0.0060324, 0.478905, 0.00448907, 0.356293, - 0.00868565, 0.478914, 0.00646572, 0.356346, - 0.0118207, 0.478965, 0.00880438, 0.356395, - 0.0154355, 0.479001, 0.0115066, 0.356484, - 0.019529, 0.479075, 0.0145762, 0.356609, - 0.0240991, 0.47918, 0.018018, 0.356766, - 0.0291413, 0.479305, 0.0218379, 0.357009, - 0.0346498, 0.479512, 0.0260454, 0.357424, - 0.0405462, 0.479909, 0.0306657, 0.357899, - 0.0468825, 0.480337, 0.0357054, 0.358424, - 0.0536887, 0.480771, 0.0411728, 0.359041, - 0.0609416, 0.481242, 0.0470841, 0.359903, - 0.0685239, 0.481943, 0.0534831, 0.360932, - 0.0764883, 0.482741, 0.0603795, 0.362196, - 0.0848364, 0.483688, 0.0678028, 0.363847, - 0.0935002, 0.484947, 0.0758086, 0.365972, - 0.102471, 0.486588, 0.0844173, 0.368741, - 0.111751, 0.488787, 0.0937199, 0.372146, - 0.121334, 0.491405, 0.103732, 0.377114, - 0.131147, 0.495604, 0.114608, 0.38226, - 0.141213, 0.499436, 0.126345, 0.389609, - 0.151632, 0.505334, 0.139116, 0.397925, - 0.162073, 0.51168, 0.152995, 0.407824, - 0.172819, 0.518876, 0.168071, 0.420014, - 0.183929, 0.527639, 0.184495, 0.434266, - 0.195032, 0.537588, 0.20232, 0.447352, - 0.205792, 0.544379, 0.221189, 0.463726, - 0.216704, 0.553422, 0.241616, 0.481406, - 0.227531, 0.562074, 0.263298, 0.498707, - 0.238017, 0.568227, 0.286116, 0.518039, - 0.247936, 0.574473, 0.3101, 0.538277, - 0.257437, 0.579191, 0.335401, 0.561166, - 0.266829, 0.584807, 0.362246, 0.583189, - 0.275329, 0.586476, 0.390609, 0.606024, - 0.28234, 0.585578, 0.420998, 0.632419, - 0.287924, 0.584496, 0.454357, 0.656128, - 0.291972, 0.577766, 0.488233, 0.679953, - 0.29456, 0.56875, 0.523248, 0.704654, - 0.295816, 0.558388, 0.559168, 0.729016, - 0.295157, 0.544826, 0.595326, 0.752062, - 0.292779, 0.528273, 0.631864, 0.773138, - 0.288681, 0.508482, 0.667793, 0.794869, - 0.283358, 0.487341, 0.704035, 0.815101, - 0.27608, 0.46354, 0.739925, 0.834212, - 0.26767, 0.438672, 0.775539, 0.852368, - 0.257397, 0.411239, 0.810895, 0.870207, - 0.245689, 0.3829, 0.846472, 0.884063, - 0.231452, 0.351496, 0.881788, 0.898284, - 0.215561, 0.31895, 0.917438, 0.912964, - 0.198208, 0.287367, 0.952422, 0.924666, - 0.180426, 0.254487, 0.987551, 0.934429, - 0.161525, 0.222226, 1.02142, 0.943485, - 0.141197, 0.191143, 1.05218, 0.9521, - 0.120085, 0.161112, 1.07937, 0.957876, - 0.0975881, 0.130982, 1.10403, 0.966943, - 0.0726842, 0.0990553, 1.12616, 0.978313, - 0.0483705, 0.0662818, 1.14619, 0.990048, - 0.0239072, 0.0329243, 1.16413, 0.999984, 0.000461885, - 7.72859e-05, 1.18099, 0.321287, - 9.35049e-06, 0.455413, 6.59662e-06, 0.332595, - 0.000237513, 0.471437, 0.000167562, 0.332729, - 0.000949964, 0.471618, 0.000670192, 0.332305, - 0.00213618, 0.471028, 0.00150712, 0.332326, - 0.00379765, 0.471055, 0.00267959, 0.332344, - 0.00593353, 0.471072, 0.00418751, 0.332356, - 0.00854349, 0.471077, 0.00603172, 0.332403, - 0.0116268, 0.471121, 0.00821362, 0.332461, - 0.0151824, 0.47117, 0.0107357, 0.332552, - 0.0192088, 0.471251, 0.0136014, 0.332657, - 0.0237024, 0.47133, 0.0168152, 0.332835, - 0.0286615, 0.471487, 0.0203853, 0.333083, - 0.0340765, 0.471708, 0.0243212, 0.333547, - 0.0398563, 0.47219, 0.0286518, 0.333989, - 0.0460916, 0.472587, 0.0333763, 0.334532, - 0.0527897, 0.473054, 0.0385084, 0.335167, - 0.0599284, 0.473568, 0.0440638, 0.33608, - 0.0673514, 0.474362, 0.0500962, 0.337146, - 0.0752237, 0.475231, 0.0566022, 0.338462, - 0.083418, 0.476282, 0.0636272, 0.34014, - 0.0919382, 0.477615, 0.0712153, 0.342341, - 0.100741, 0.479404, 0.079417, 0.345088, - 0.109905, 0.481618, 0.0882631, 0.349049, - 0.119369, 0.485081, 0.0978851, 0.353939, - 0.129033, 0.489317, 0.108336, 0.359893, - 0.139038, 0.494309, 0.119698, 0.366945, - 0.149411, 0.499983, 0.132024, 0.375814, - 0.159843, 0.507185, 0.145558, 0.387112, - 0.170664, 0.516392, 0.160433, 0.40023, - 0.181897, 0.526519, 0.176648, 0.412555, - 0.192785, 0.53423, 0.193922, 0.427023, - 0.203663, 0.542741, 0.212662, 0.443685, - 0.214695, 0.552066, 0.232944, 0.461499, - 0.225561, 0.560762, 0.254495, 0.480975, - 0.236257, 0.569421, 0.277531, 0.501, - 0.24639, 0.576101, 0.301724, 0.521691, - 0.256101, 0.581493, 0.327112, 0.543478, - 0.265289, 0.585221, 0.353917, 0.566094, - 0.273938, 0.587614, 0.381941, 0.589578, - 0.281679, 0.587991, 0.41172, 0.614583, - 0.287655, 0.585928, 0.444148, 0.641813, - 0.292228, 0.582092, 0.478617, 0.666189, - 0.295172, 0.57398, 0.51397, 0.690475, - 0.29648, 0.561676, 0.550118, 0.715543, - 0.296203, 0.548758, 0.586933, 0.740405, - 0.293999, 0.532792, 0.62384, 0.762183, - 0.28998, 0.512735, 0.660723, 0.786069, - 0.28478, 0.492402, 0.69807, 0.806812, - 0.277568, 0.469058, 0.734422, 0.826987, - 0.268951, 0.443017, 0.770946, 0.844588, - 0.259049, 0.415501, 0.80699, 0.863725, - 0.2471, 0.387328, 0.842107, 0.879137, - 0.234157, 0.356108, 0.878078, 0.894634, - 0.218719, 0.324315, 0.914058, 0.909162, - 0.201293, 0.291813, 0.949922, 0.92072, - 0.18267, 0.258474, 0.985337, 0.93158, - 0.163212, 0.225593, 1.0205, 0.941238, - 0.142771, 0.193986, 1.05273, 0.949293, - 0.120956, 0.163392, 1.08075, 0.956226, - 0.0985743, 0.132934, 1.10559, 0.96546, - 0.075118, 0.101255, 1.12823, 0.977403, - 0.0497921, 0.0675441, 1.149, 0.989648, - 0.0241574, 0.0334681, 1.16765, 1.00001, 0.0005762, - 0.000184807, 1.18519, 0.303474, - 9.16603e-06, 0.4542, 6.1243e-06, 0.308894, - 0.000232869, 0.462306, 0.000155592, 0.309426, - 0.000931661, 0.463093, 0.000622499, 0.308643, - 0.0020949, 0.461933, 0.00139979, 0.308651, - 0.0037242, 0.461941, 0.00248874, 0.308662, - 0.00581873, 0.46195, 0.00388933, 0.308687, - 0.00837818, 0.461974, 0.00560247, 0.308728, - 0.0114016, 0.462011, 0.00762948, 0.308789, - 0.0148884, 0.462067, 0.00997326, 0.308882, - 0.0188369, 0.462151, 0.0126375, 0.309007, - 0.0232436, 0.462263, 0.0156271, 0.30918, - 0.0281054, 0.462417, 0.0189498, 0.309442, - 0.0334065, 0.462667, 0.0226167, 0.309901, - 0.0390589, 0.463162, 0.0266614, 0.310331, - 0.0452042, 0.463555, 0.0310715, 0.310858, - 0.0517735, 0.464019, 0.0358698, 0.311576, - 0.0587359, 0.464669, 0.0410848, 0.312436, - 0.0660383, 0.465406, 0.0467453, 0.313526, - 0.0737266, 0.466339, 0.0528718, 0.314903, - 0.0817574, 0.467504, 0.0595039, 0.316814, - 0.090167, 0.469226, 0.0666888, 0.318965, - 0.0987555, 0.470981, 0.0744658, 0.322077, - 0.107792, 0.473814, 0.082912, 0.325947, - 0.117098, 0.477241, 0.0920846, 0.331008, - 0.126602, 0.48184, 0.102137, 0.337893, - 0.136619, 0.488334, 0.113135, 0.345106, - 0.146838, 0.494415, 0.12511, 0.355111, - 0.157357, 0.503275, 0.138356, 0.365095, - 0.167955, 0.510966, 0.152686, 0.378344, - 0.179157, 0.521508, 0.16856, 0.391599, - 0.190143, 0.530455, 0.18561, 0.407786, - 0.20123, 0.541275, 0.204308, 0.425294, - 0.212456, 0.551784, 0.224623, 0.444021, - 0.223568, 0.561493, 0.246172, 0.463418, - 0.234154, 0.569886, 0.268979, 0.484077, - 0.244546, 0.577116, 0.293411, 0.505513, - 0.254301, 0.582914, 0.318936, 0.527672, - 0.263564, 0.587208, 0.345856, 0.550565, - 0.272332, 0.589277, 0.374054, 0.573656, - 0.280011, 0.588426, 0.403276, 0.59827, - 0.286924, 0.587504, 0.43474, 0.624731, - 0.291994, 0.583401, 0.468767, 0.652396, - 0.295159, 0.576997, 0.504411, 0.67732, - 0.296954, 0.565863, 0.54114, 0.703147, - 0.296877, 0.552316, 0.57816, 0.728715, - 0.295147, 0.536773, 0.616124, 0.752448, - 0.291275, 0.51771, 0.653885, 0.775169, - 0.285905, 0.496087, 0.691537, 0.799307, - 0.279064, 0.474232, 0.729251, 0.819482, - 0.270294, 0.447676, 0.766267, 0.837659, - 0.260032, 0.419656, 0.802616, 0.856903, - 0.248497, 0.391328, 0.838583, 0.873325, - 0.235252, 0.360285, 0.874711, 0.889788, - 0.221126, 0.329215, 0.91077, 0.904486, - 0.204304, 0.296392, 0.94653, 0.917711, - 0.185562, 0.262159, 0.983828, 0.928969, - 0.165635, 0.229142, 1.01955, 0.939707, - 0.14442, 0.19673, 1.05317, 0.948167, - 0.122147, 0.165095, 1.0823, 0.955222, - 0.099098, 0.13451, 1.10791, 0.964401, - 0.0755332, 0.102476, 1.1312, 0.976605, - 0.0513817, 0.0689667, 1.15218, 0.989085, - 0.0258499, 0.034506, 1.17129, 0.999908, 0.000617773, - 0.000271268, 1.18961, 0.285803, - 9.05752e-06, 0.452348, 5.72272e-06, 0.284689, - 0.00022732, 0.450581, 0.000143626, 0.285263, - 0.000910214, 0.451482, 0.000575099, 0.285302, - 0.00204784, 0.451553, 0.00129395, 0.285318, - 0.00364057, 0.451574, 0.0023006, 0.28533, - 0.00568813, 0.451585, 0.00359547, 0.285361, - 0.00819001, 0.451618, 0.00517934, 0.285397, - 0.0111458, 0.45165, 0.007054, 0.285447, - 0.0145536, 0.451688, 0.00922167, 0.285527, - 0.0184127, 0.451758, 0.0116869, 0.285688, - 0.0227207, 0.451929, 0.0144555, 0.28584, - 0.0274712, 0.452055, 0.0175341, 0.286136, - 0.0326278, 0.452369, 0.0209406, 0.286574, - 0.0381792, 0.452853, 0.0246965, 0.287012, - 0.0441879, 0.453272, 0.0287996, 0.287542, - 0.0506096, 0.453752, 0.033268, 0.288299, - 0.0573634, 0.454488, 0.0381504, 0.289186, - 0.0645458, 0.455294, 0.0434447, 0.290302, - 0.0720405, 0.456301, 0.0491973, 0.291776, - 0.0799046, 0.457648, 0.0554453, 0.29372, - 0.088117, 0.459483, 0.0622311, 0.296052, - 0.0965328, 0.461571, 0.0695992, 0.299563, - 0.105409, 0.465085, 0.077658, 0.30335, - 0.114553, 0.468506, 0.0864176, 0.309167, - 0.123917, 0.474423, 0.0961078, 0.31529, - 0.13381, 0.47995, 0.106643, 0.324163, - 0.144021, 0.488592, 0.118322, 0.333272, - 0.154382, 0.496461, 0.131133, 0.344224, - 0.165015, 0.50562, 0.145208, 0.357733, - 0.176168, 0.516719, 0.16073, 0.373046, - 0.187468, 0.528513, 0.177807, 0.38788, - 0.198488, 0.537713, 0.196072, 0.405133, - 0.209545, 0.547999, 0.21605, 0.423845, - 0.220724, 0.55759, 0.237484, 0.443777, - 0.231518, 0.566246, 0.26039, 0.464824, - 0.242035, 0.574326, 0.284835, 0.486635, - 0.251898, 0.58037, 0.310518, 0.51012, - 0.261304, 0.58568, 0.337678, 0.535301, - 0.270384, 0.590197, 0.366242, 0.559193, - 0.27841, 0.590569, 0.395873, 0.583544, - 0.285325, 0.588161, 0.426857, 0.608834, - 0.291113, 0.584249, 0.459477, 0.635753, - 0.294882, 0.57763, 0.494734, 0.664367, - 0.297088, 0.569479, 0.532023, 0.689688, - 0.297364, 0.555064, 0.569629, 0.715732, - 0.295949, 0.539522, 0.608124, 0.741307, - 0.292259, 0.521613, 0.646231, 0.764949, - 0.287063, 0.49969, 0.684938, 0.788599, - 0.28012, 0.476747, 0.723548, 0.81048, - 0.27153, 0.45116, 0.761135, 0.831372, - 0.261289, 0.424101, 0.798916, 0.850092, - 0.249559, 0.39443, 0.835952, 0.867777, - 0.236348, 0.363849, 0.871606, 0.884632, - 0.221569, 0.332477, 0.907843, 0.90047, - 0.20618, 0.300667, 0.944187, 0.914524, - 0.188771, 0.266552, 0.981371, 0.926892, - 0.168362, 0.232349, 1.01841, 0.937951, - 0.146761, 0.199359, 1.05308, 0.947236, - 0.123813, 0.1675, 1.0839, 0.954367, - 0.099984, 0.136166, 1.11047, 0.963907, - 0.0759278, 0.103808, 1.13414, 0.976218, - 0.0511367, 0.0697061, 1.15575, 0.988772, - 0.0267415, 0.0352529, 1.17531, 0.999888, - 0.000520778, 0.000289926, 1.19389, 0.263546, - 8.83274e-06, 0.441896, 5.26783e-06, 0.262352, - 0.000221849, 0.439889, 0.000132311, 0.262325, - 0.000886683, 0.439848, 0.000528824, 0.26228, - 0.00199476, 0.439765, 0.00118975, 0.262372, - 0.00354671, 0.439922, 0.00211568, 0.26239, - 0.00554141, 0.439941, 0.00330652, 0.262412, - 0.00797888, 0.439961, 0.00476346, 0.262453, - 0.0108584, 0.440002, 0.00648818, 0.262528, - 0.0141788, 0.440085, 0.0084835, 0.262615, - 0.017938, 0.440166, 0.0107533, 0.262744, - 0.0221346, 0.440291, 0.0133044, 0.262939, - 0.026762, 0.440493, 0.0161445, 0.263277, - 0.0317573, 0.440889, 0.0192974, 0.26368, - 0.0371832, 0.441338, 0.0227699, 0.264106, - 0.0430371, 0.441753, 0.0265698, 0.264624, - 0.0493035, 0.442227, 0.0307178, 0.265378, - 0.0558669, 0.442985, 0.0352616, 0.266253, - 0.0628718, 0.443795, 0.0401968, 0.267478, - 0.0701569, 0.445008, 0.04559, 0.269062, - 0.077845, 0.446599, 0.0514539, 0.270926, - 0.0857941, 0.448349, 0.0578382, 0.273693, - 0.0940773, 0.451221, 0.0648363, 0.276746, - 0.102704, 0.454097, 0.0724389, 0.281693, - 0.111735, 0.459517, 0.0808744, 0.287335, - 0.121004, 0.46531, 0.0901551, 0.29448, - 0.130734, 0.472605, 0.100371, 0.30257, - 0.140777, 0.480251, 0.111644, 0.312465, - 0.15111, 0.489444, 0.124111, 0.324856, - 0.16189, 0.500919, 0.137979, 0.33774, - 0.172946, 0.511317, 0.153163, 0.35255, - 0.184152, 0.522684, 0.169817, 0.367786, - 0.19522, 0.53248, 0.187886, 0.385474, - 0.20632, 0.543326, 0.207634, 0.404976, - 0.217744, 0.554109, 0.229165, 0.425203, - 0.228691, 0.563395, 0.252068, 0.446704, - 0.239299, 0.571565, 0.276471, 0.468951, - 0.249348, 0.577935, 0.302323, 0.493487, - 0.258933, 0.584309, 0.329882, 0.517861, - 0.268009, 0.58773, 0.358525, 0.543309, - 0.276238, 0.589612, 0.388585, 0.569704, - 0.28356, 0.589294, 0.419787, 0.594871, - 0.289497, 0.585137, 0.452114, 0.622555, - 0.294452, 0.580356, 0.486466, 0.651167, - 0.296918, 0.57185, 0.523079, 0.677332, - 0.297647, 0.558428, 0.5611, 0.703718, - 0.296321, 0.542232, 0.599592, 0.730262, - 0.293339, 0.524541, 0.639138, 0.754304, - 0.288036, 0.502691, 0.677978, 0.778051, - 0.281018, 0.479212, 0.716537, 0.801557, - 0.272414, 0.454071, 0.75586, 0.822559, - 0.262419, 0.425952, 0.794477, 0.843051, - 0.250702, 0.397313, 0.832664, 0.86232, - 0.237264, 0.366534, 0.869876, 0.879044, - 0.222716, 0.334816, 0.906973, 0.896362, - 0.206827, 0.303143, 0.943558, 0.910342, - 0.189659, 0.269699, 0.979759, 0.924119, - 0.171108, 0.236411, 1.01718, 0.935374, - 0.149579, 0.202224, 1.05289, 0.944295, - 0.126295, 0.16989, 1.08496, 0.952227, - 0.101511, 0.138089, 1.11256, 0.962041, - 0.0766392, 0.105053, 1.1375, 0.97528, - 0.0511967, 0.070329, 1.15983, 0.988476, - 0.025463, 0.0351268, 1.17987, 0.999962, 2.86808e-05, 1.45564e-05, 1.19901, 0.227089, - 8.41413e-06, 0.404216, 4.72707e-06, 0.239725, - 0.000215083, 0.426708, 0.000120833, 0.239904, - 0.000860718, 0.427028, 0.000483555, 0.239911, - 0.00193661, 0.427039, 0.00108806, 0.239914, - 0.00344276, 0.42704, 0.00193457, 0.239933, - 0.00537907, 0.427064, 0.00302363, 0.239944, - 0.00774482, 0.427065, 0.00435604, 0.239993, - 0.01054, 0.427122, 0.00593398, 0.240052, - 0.0137626, 0.427179, 0.00775987, 0.240148, - 0.0174115, 0.427279, 0.00983854, 0.240278, - 0.021484, 0.42741, 0.0121763, 0.240472, - 0.0259729, 0.427618, 0.0147827, 0.240839, - 0.0308131, 0.428086, 0.0176837, 0.241201, - 0.0360893, 0.428482, 0.0208775, 0.241626, - 0.0417723, 0.428907, 0.0243821, 0.242207, - 0.0478337, 0.42952, 0.0282228, 0.24298, - 0.0542199, 0.430332, 0.0324333, 0.243881, - 0.0610015, 0.431222, 0.0370252, 0.245123, - 0.0680874, 0.432512, 0.0420535, 0.24667, - 0.0755482, 0.434088, 0.0475414, 0.248779, - 0.0832873, 0.436323, 0.0535542, 0.251665, - 0.0913546, 0.439509, 0.0601716, 0.255305, - 0.0998489, 0.443478, 0.0674282, 0.260049, - 0.108576, 0.448713, 0.0754673, 0.266192, - 0.117754, 0.455524, 0.084339, 0.273158, - 0.127294, 0.4627, 0.0941683, 0.282131, - 0.137311, 0.472068, 0.10515, 0.293332, - 0.147736, 0.483565, 0.117402, 0.304667, - 0.158357, 0.493702, 0.130824, 0.317785, - 0.169274, 0.504708, 0.145724, 0.333245, - 0.180595, 0.517107, 0.16215, 0.349843, - 0.191892, 0.528849, 0.180149, 0.367944, - 0.203168, 0.540301, 0.199746, 0.387579, - 0.214443, 0.551514, 0.221047, 0.408247, - 0.225624, 0.560906, 0.243981, 0.43014, - 0.236422, 0.56959, 0.268513, 0.452669, - 0.24654, 0.576098, 0.294409, 0.476196, - 0.256157, 0.580925, 0.322002, 0.501157, - 0.265289, 0.584839, 0.351052, 0.527632, - 0.273671, 0.587614, 0.3812, 0.555754, - 0.281254, 0.589119, 0.412994, 0.581682, - 0.287448, 0.585204, 0.445498, 0.608196, - 0.292614, 0.579006, 0.479505, 0.635661, - 0.296068, 0.571297, 0.514643, 0.664999, - 0.297395, 0.560855, 0.552213, 0.691039, - 0.296645, 0.544525, 0.591365, 0.7179, - 0.293785, 0.526535, 0.630883, 0.744059, - 0.289089, 0.50545, 0.670932, 0.76863, - 0.282239, 0.482514, 0.710904, 0.793273, - 0.273688, 0.457246, 0.750259, 0.814731, - 0.26328, 0.428872, 0.78948, 0.835603, - 0.251526, 0.399384, 0.828597, 0.85489, - 0.238339, 0.368811, 0.866892, 0.872828, - 0.223607, 0.336617, 0.90563, 0.889462, - 0.207538, 0.303997, 0.943538, 0.904929, - 0.190297, 0.270812, 0.980591, 0.919101, - 0.172034, 0.237453, 1.01935, 0.930536, - 0.152058, 0.204431, 1.05498, 0.941223, - 0.129515, 0.172495, 1.08717, 0.94982, - 0.104263, 0.140175, 1.11551, 0.960592, - 0.0781944, 0.106465, 1.14098, 0.974629, - 0.051688, 0.0711592, 1.16418, 0.98811, - 0.0253929, 0.0354432, 1.18465, 1.00004, 0.000804378, - 0.000330876, 1.20462, 0.214668, - 8.21282e-06, 0.406619, 4.33582e-06, 0.218053, - 0.000208144, 0.413025, 0.000109887, 0.217987, - 0.000832212, 0.412901, 0.000439362, 0.217971, - 0.00187246, 0.412876, 0.000988623, 0.217968, - 0.00332855, 0.41286, 0.00175772, 0.217985, - 0.00520055, 0.412882, 0.00274729, 0.218014, - 0.00748814, 0.412916, 0.00395842, 0.218054, - 0.0101901, 0.412957, 0.00539274, 0.218106, - 0.0133057, 0.413005, 0.00705348, 0.218217, - 0.0168342, 0.413139, 0.00894581, 0.218338, - 0.0207707, 0.413258, 0.0110754, 0.21855, - 0.0251001, 0.413509, 0.0134551, 0.218913, - 0.0297861, 0.413992, 0.0161081, 0.219265, - 0.0348956, 0.414383, 0.0190307, 0.219696, - 0.0403909, 0.414839, 0.0222458, 0.220329, - 0.0462003, 0.415567, 0.025792, 0.220989, - 0.0524208, 0.41621, 0.0296637, 0.222027, - 0.058948, 0.417385, 0.0339323, 0.223301, - 0.0658208, 0.418779, 0.0386055, 0.224988, - 0.0730347, 0.420665, 0.0437355, 0.227211, - 0.0805274, 0.423198, 0.0493844, 0.230131, - 0.088395, 0.426566, 0.0556135, 0.233908, - 0.0966208, 0.43091, 0.0624829, 0.239092, - 0.105223, 0.437148, 0.0701636, 0.245315, - 0.11424, 0.444302, 0.0786949, 0.253166, - 0.12368, 0.453262, 0.0882382, 0.262374, - 0.133569, 0.463211, 0.0988682, 0.273145, - 0.143836, 0.474271, 0.110727, 0.285512, - 0.154577, 0.4863, 0.123945, 0.299512, - 0.165501, 0.498817, 0.138581, 0.314287, - 0.176698, 0.510341, 0.154676, 0.331083, - 0.188066, 0.522583, 0.172459, 0.349615, - 0.199597, 0.534879, 0.191979, 0.369318, - 0.210843, 0.546083, 0.21309, 0.390377, - 0.222068, 0.5562, 0.235998, 0.412411, - 0.233059, 0.564704, 0.260518, 0.435715, - 0.24357, 0.572314, 0.286795, 0.461196, - 0.253356, 0.579395, 0.314559, 0.485587, - 0.262362, 0.581985, 0.343581, 0.511908, - 0.270895, 0.584347, 0.374367, 0.539798, - 0.278452, 0.58505, 0.406015, 0.567974, - 0.284877, 0.583344, 0.439168, 0.594303, - 0.290124, 0.577348, 0.473005, 0.622951, - 0.294183, 0.570751, 0.508534, 0.652404, - 0.296389, 0.561541, 0.544764, 0.679291, - 0.296605, 0.546426, 0.582927, 0.706437, - 0.294095, 0.528599, 0.622681, 0.734485, - 0.28978, 0.508676, 0.663567, 0.758841, - 0.283363, 0.484768, 0.704092, 0.78537, - 0.275015, 0.460434, 0.745101, 0.807315, - 0.264689, 0.432166, 0.784712, 0.8271, - 0.252597, 0.401807, 0.824241, 0.849191, - 0.239154, 0.371458, 0.863803, 0.867046, - 0.224451, 0.338873, 0.903063, 0.8852, - 0.208342, 0.306175, 0.942763, 0.901771, - 0.190684, 0.272759, 0.981559, 0.915958, - 0.172105, 0.239306, 1.02048, 0.928046, - 0.152214, 0.206071, 1.05765, 0.939961, - 0.130247, 0.17367, 1.08999, 0.948711, - 0.10672, 0.142201, 1.11829, 0.959305, - 0.0808688, 0.108454, 1.14467, 0.973009, - 0.0539145, 0.0728109, 1.16839, 0.987631, - 0.0262947, 0.0360625, 1.19004, 0.999978, 0.00132758, - 0.000559424, 1.21058, 0.193925, - 7.93421e-06, 0.391974, 3.92537e-06, 0.196746, - 0.000200315, 0.397675, 9.91033e-05, 0.19667, - 0.000801099, 0.397521, 0.000396342, 0.196633, - 0.00180246, 0.397445, 0.000891829, 0.196654, - 0.00320443, 0.397482, 0.00158582, 0.196659, - 0.00500647, 0.39748, 0.00247867, 0.196683, - 0.0072086, 0.397506, 0.00357167, 0.196728, - 0.00981001, 0.397562, 0.00486675, 0.196792, - 0.0128096, 0.397633, 0.00636707, 0.19689, - 0.0162055, 0.397746, 0.00807752, 0.197017, - 0.0199943, 0.397884, 0.0100052, 0.19729, - 0.024139, 0.39827, 0.0121691, 0.197583, - 0.0286671, 0.398639, 0.0145755, 0.197927, - 0.0335858, 0.399034, 0.0172355, 0.198383, - 0.0388806, 0.399554, 0.0201718, 0.199002, - 0.0444736, 0.400289, 0.0234194, 0.199739, - 0.0504583, 0.401111, 0.026984, 0.200784, - 0.056729, 0.402349, 0.0309217, 0.202075, - 0.0633643, 0.403841, 0.0352496, 0.203898, - 0.0703247, 0.406076, 0.0400313, 0.206199, - 0.0775565, 0.408841, 0.0453282, 0.209252, - 0.085184, 0.41259, 0.0511794, 0.213638, - 0.0931994, 0.418288, 0.0577459, 0.21881, - 0.101617, 0.424681, 0.0650508, 0.225642, - 0.11052, 0.433429, 0.0732759, 0.233717, - 0.119772, 0.442897, 0.0824683, 0.242823, - 0.129505, 0.452888, 0.0927484, 0.254772, - 0.139906, 0.466407, 0.104417, 0.266603, - 0.150402, 0.477413, 0.117211, 0.28073, - 0.161395, 0.490519, 0.131598, 0.295399, - 0.172465, 0.50201, 0.147407, 0.312705, - 0.183982, 0.515311, 0.165031, 0.331335, - 0.195532, 0.52786, 0.184336, 0.351037, - 0.206971, 0.5392, 0.205361, 0.372175, - 0.218117, 0.54941, 0.228043, 0.394548, - 0.229327, 0.558642, 0.25267, 0.419598, - 0.240052, 0.567861, 0.279071, 0.443922, - 0.249937, 0.573332, 0.306882, 0.471495, - 0.259407, 0.58013, 0.33661, 0.496769, - 0.267749, 0.580564, 0.367328, 0.524951, - 0.275524, 0.581696, 0.399753, 0.55318, - 0.282148, 0.579885, 0.433134, 0.581577, - 0.287533, 0.575471, 0.467534, 0.609231, - 0.291612, 0.567445, 0.502943, 0.637478, - 0.293911, 0.557657, 0.53871, 0.667795, - 0.295096, 0.546535, 0.576568, 0.694272, - 0.294073, 0.529561, 0.614929, 0.722937, - 0.290386, 0.510561, 0.655909, 0.749682, - 0.284481, 0.487846, 0.697663, 0.774754, - 0.276188, 0.462487, 0.738515, 0.799301, - 0.266215, 0.43481, 0.779802, 0.820762, - 0.254116, 0.404879, 0.820045, 0.843231, - 0.240393, 0.374559, 0.860294, 0.861857, - 0.225503, 0.341582, 0.900965, 0.880815, - 0.209382, 0.308778, 0.941727, 0.89766, - 0.19155, 0.275232, 0.980916, 0.912926, - 0.172346, 0.240938, 1.02162, 0.926391, - 0.151799, 0.207223, 1.0597, 0.938429, - 0.129968, 0.17484, 1.09291, 0.947834, - 0.10651, 0.142984, 1.12248, 0.958432, - 0.0824098, 0.109902, 1.149, 0.972402, - 0.0565242, 0.0744454, 1.1733, 0.987191, - 0.028427, 0.0373794, 1.19538, 0.999975, 3.85685e-05, - 4.203e-05, 1.21676, 0.178114, - 7.66075e-06, 0.385418, 3.54027e-06, 0.176074, - 0.000191966, 0.381002, 8.87135e-05, 0.17601, - 0.000767549, 0.380861, 0.000354715, 0.17598, - 0.00172696, 0.380798, 0.000798168, 0.175994, - 0.00307012, 0.380824, 0.00141928, 0.176017, - 0.00479684, 0.380858, 0.00221859, 0.176019, - 0.00690648, 0.380839, 0.00319714, 0.176072, - 0.00939888, 0.380913, 0.0043572, 0.176131, - 0.0122726, 0.380979, 0.005702, 0.176239, - 0.0155264, 0.38112, 0.00723689, 0.176371, - 0.0191551, 0.381272, 0.00896907, 0.176638, - 0.023117, 0.381669, 0.0109194, 0.176912, - 0.0274633, 0.382015, 0.0130903, 0.177279, - 0.032173, 0.382476, 0.0154949, 0.17774, - 0.0372219, 0.383041, 0.0181669, 0.178344, - 0.0426132, 0.38378, 0.0211209, 0.179153, - 0.0483309, 0.384773, 0.0243899, 0.180197, - 0.0543447, 0.386076, 0.0280062, 0.181581, - 0.0607122, 0.387809, 0.032004, 0.18344, - 0.0673855, 0.390205, 0.036453, 0.186139, - 0.0743989, 0.393944, 0.0414162, 0.189432, - 0.0817731, 0.39832, 0.0469394, 0.193795, - 0.0895464, 0.404188, 0.0531442, 0.199641, - 0.0978264, 0.4121, 0.0601374, 0.206679, - 0.106499, 0.421425, 0.0680078, 0.214865, - 0.115654, 0.431504, 0.076919, 0.224406, - 0.125268, 0.442526, 0.0868835, 0.235876, - 0.135475, 0.455465, 0.0981875, 0.248335, - 0.146023, 0.4681, 0.110759, 0.262868, - 0.157016, 0.482069, 0.124885, 0.278962, - 0.168245, 0.496182, 0.140645, 0.295082, - 0.17958, 0.507401, 0.157838, 0.313738, - 0.191227, 0.520252, 0.17695, 0.333573, - 0.202718, 0.531708, 0.197817, 0.356433, - 0.214424, 0.544509, 0.220785, 0.378853, - 0.225492, 0.55373, 0.245306, 0.402717, - 0.236236, 0.561348, 0.271593, 0.428375, - 0.246568, 0.568538, 0.299776, 0.454724, - 0.255941, 0.573462, 0.329433, 0.482291, - 0.264511, 0.576356, 0.360598, 0.509706, - 0.272129, 0.576446, 0.393204, 0.538805, - 0.278979, 0.575298, 0.427227, 0.568919, - 0.284528, 0.572154, 0.462157, 0.596804, - 0.288801, 0.564691, 0.497997, 0.625987, - 0.291334, 0.555134, 0.534467, 0.656414, - 0.292722, 0.545051, 0.571736, 0.683916, - 0.292185, 0.528813, 0.610158, 0.711809, - 0.290043, 0.51106, 0.649061, 0.739547, - 0.285246, 0.490103, 0.690081, 0.766914, - 0.277647, 0.465523, 0.732554, 0.791375, - 0.267603, 0.437718, 0.773982, 0.814772, - 0.256109, 0.40882, 0.81609, 0.836691, - 0.242281, 0.377823, 0.856849, 0.856984, - 0.227155, 0.34496, 0.898363, 0.876332, - 0.210395, 0.311335, 0.939471, 0.894988, - 0.192612, 0.277703, 0.980799, 0.911113, - 0.173236, 0.243019, 1.02215, 0.924092, - 0.152258, 0.209037, 1.06139, 0.936828, - 0.129575, 0.175909, 1.09635, 0.946869, - 0.10594, 0.143852, 1.12707, 0.958284, - 0.081318, 0.110289, 1.15419, 0.972325, - 0.0556133, 0.0747232, 1.17909, 0.986878, - 0.0297899, 0.0383149, 1.20163, 0.999936, - 0.00197169, 0.000912402, 1.22338, 0.151174, - 7.20365e-06, 0.351531, 3.09789e-06, 0.155594, - 0.00018279, 0.361806, 7.8608e-05, 0.156099, - 0.000731569, 0.362982, 0.000314615, 0.156053, - 0.00164578, 0.362869, 0.000707845, 0.156093, - 0.0029261, 0.362961, 0.00125884, 0.156099, - 0.00457155, 0.362959, 0.00196783, 0.15612, - 0.00658224, 0.362982, 0.00283622, 0.156168, - 0.00895774, 0.363048, 0.00386625, 0.156221, - 0.0116962, 0.363101, 0.00506109, 0.156324, - 0.0147973, 0.363241, 0.00642675, 0.156476, - 0.0182503, 0.363448, 0.00797175, 0.156731, - 0.0220266, 0.36384, 0.00971484, 0.156994, - 0.026176, 0.364179, 0.0116575, 0.157341, - 0.0306701, 0.36462, 0.0138207, 0.157867, - 0.0354591, 0.365364, 0.0162356, 0.15846, - 0.0406141, 0.366111, 0.0189092, 0.159308, - 0.0460519, 0.367248, 0.021885, 0.160426, - 0.0518096, 0.368767, 0.0252004, 0.161877, - 0.0578906, 0.370745, 0.0288825, 0.163995, - 0.0642812, 0.373831, 0.0330139, 0.16655, - 0.0710067, 0.377366, 0.0376283, 0.170237, - 0.0781522, 0.382799, 0.0428493, 0.175096, - 0.0857172, 0.389915, 0.0487324, 0.181069, - 0.0938025, 0.398487, 0.0554214, 0.188487, - 0.102363, 0.408799, 0.0630189, 0.197029, - 0.111343, 0.419991, 0.071634, 0.206684, - 0.120812, 0.431455, 0.0812797, 0.218698, - 0.131033, 0.445746, 0.0923651, 0.230726, - 0.141373, 0.457471, 0.104545, 0.245516, - 0.152387, 0.472388, 0.118449, 0.261551, - 0.163628, 0.486671, 0.133923, 0.277437, - 0.174814, 0.49762, 0.150849, 0.296662, - 0.186713, 0.51162, 0.169924, 0.31795, - 0.198513, 0.525435, 0.190848, 0.339422, - 0.210119, 0.536267, 0.213504, 0.362143, - 0.221354, 0.545982, 0.237947, 0.387198, - 0.23224, 0.555364, 0.264427, 0.412349, - 0.24257, 0.561489, 0.292519, 0.439274, - 0.252284, 0.566903, 0.322561, 0.466779, - 0.261023, 0.569614, 0.353952, 0.496011, - 0.26899, 0.571589, 0.387278, 0.524964, - 0.275498, 0.570325, 0.421356, 0.556518, - 0.281449, 0.568792, 0.457314, 0.584363, - 0.285526, 0.560268, 0.493199, 0.614214, - 0.28844, 0.55205, 0.530276, 0.645684, - 0.289777, 0.541906, 0.56855, 0.673446, - 0.289722, 0.526464, 0.606927, 0.701924, - 0.287792, 0.509872, 0.645945, 0.73037, - 0.284315, 0.490649, 0.685564, 0.757405, - 0.278804, 0.467964, 0.726511, 0.784025, - 0.269543, 0.441468, 0.768601, 0.808255, - 0.258117, 0.41216, 0.811321, 0.830739, - 0.244728, 0.380606, 0.853496, 0.851914, - 0.229428, 0.348111, 0.895374, 0.872586, - 0.212508, 0.314732, 0.937674, 0.891581, - 0.194025, 0.280338, 0.979869, 0.907641, - 0.174711, 0.245203, 1.02253, 0.922233, - 0.153509, 0.21077, 1.06371, 0.935878, - 0.130418, 0.177399, 1.09972, 0.946338, - 0.105558, 0.144507, 1.13124, 0.957265, - 0.080059, 0.110508, 1.15973, 0.971668, - 0.0539766, 0.0742311, 1.18515, 0.9866, - 0.0277101, 0.0375224, 1.20858, 1.00021, - 0.000515531, 0.000135226, 1.23135, 0.137468, - 6.86011e-06, 0.345041, 2.73315e-06, 0.13703, - 0.000173378, 0.343936, 6.90761e-05, 0.136986, - 0.000693048, 0.34383, 0.000276126, 0.136964, - 0.00155931, 0.343761, 0.000621337, 0.137003, - 0.00277211, 0.343863, 0.00110494, 0.137012, - 0.00433103, 0.343868, 0.00172744, 0.137043, - 0.00623606, 0.343916, 0.00249022, 0.13709, - 0.0084868, 0.343986, 0.00339559, 0.137145, - 0.0110814, 0.344045, 0.00444687, 0.137242, - 0.0140187, 0.344177, 0.00565007, 0.137431, - 0.0172713, 0.344491, 0.00701868, 0.137644, - 0.0208605, 0.344805, 0.00856042, 0.13791, - 0.024792, 0.345172, 0.0102863, 0.138295, - 0.0290461, 0.345734, 0.0122185, 0.138764, - 0.0335957, 0.346371, 0.0143771, 0.139415, - 0.038467, 0.347298, 0.0167894, 0.140272, - 0.0436176, 0.348527, 0.0194895, 0.141457, - 0.0491016, 0.350276, 0.0225043, 0.14303, - 0.0548764, 0.352646, 0.0258962, 0.145289, - 0.0610096, 0.356206, 0.0297168, 0.148502, - 0.0674777, 0.361488, 0.0340562, 0.152188, - 0.074345, 0.367103, 0.0389534, 0.157359, - 0.0817442, 0.375247, 0.0445541, 0.16379, - 0.0896334, 0.385064, 0.0509535, 0.171376, - 0.098005, 0.396082, 0.0582611, 0.179901, - 0.106817, 0.407418, 0.06654, 0.189892, - 0.116239, 0.420031, 0.075994, 0.201838, - 0.12627, 0.434321, 0.0867239, 0.214311, - 0.136701, 0.447631, 0.0987517, 0.228902, - 0.147616, 0.462046, 0.112353, 0.245107, - 0.158871, 0.476942, 0.127605, 0.262292, - 0.170261, 0.490285, 0.144469, 0.281215, - 0.182017, 0.503783, 0.163282, 0.301058, - 0.193729, 0.515505, 0.183873, 0.322752, - 0.205512, 0.52682, 0.206466, 0.347547, - 0.217214, 0.539473, 0.231194, 0.370969, - 0.227966, 0.546625, 0.257288, 0.397533, - 0.238555, 0.55472, 0.285789, 0.42398, - 0.248278, 0.559468, 0.315746, 0.452928, - 0.257422, 0.564095, 0.347724, 0.482121, - 0.265306, 0.565426, 0.380922, 0.510438, - 0.272043, 0.563205, 0.415639, 0.541188, - 0.277614, 0.561087, 0.451702, 0.571667, - 0.281927, 0.554922, 0.48845, 0.602432, - 0.285015, 0.546838, 0.526442, 0.634126, - 0.286512, 0.537415, 0.564896, 0.662816, - 0.286388, 0.522906, 0.604037, 0.692411, - 0.284734, 0.507003, 0.643795, 0.720946, - 0.281297, 0.488398, 0.68298, 0.748293, - 0.276262, 0.466353, 0.723466, 0.776931, - 0.269978, 0.443573, 0.764565, 0.801065, - 0.260305, 0.415279, 0.805838, 0.825843, - 0.247426, 0.384773, 0.849985, 0.84807, - 0.232437, 0.352555, 0.893174, 0.869122, - 0.215806, 0.318642, 0.936564, 0.888963, - 0.197307, 0.28381, 0.980253, 0.905547, - 0.177203, 0.247888, 1.02463, 0.918554, - 0.155542, 0.212904, 1.06714, 0.931395, - 0.131948, 0.1787, 1.10451, 0.941749, - 0.106723, 0.145902, 1.13694, 0.954551, - 0.0804939, 0.111193, 1.1666, 0.970279, - 0.0534239, 0.0744697, 1.19249, 0.986117, - 0.0257452, 0.0368788, 1.21665, 0.999938, 0.00190634, - 0.0010291, 1.23981, 0.118493, - 6.47439e-06, 0.32272, 2.3772e-06, 0.118765, - 0.000163023, 0.323456, 5.98573e-05, 0.118772, - 0.00065212, 0.323477, 0.000239447, 0.118843, - 0.00146741, 0.323657, 0.000538881, 0.118804, - 0.00260846, 0.323553, 0.00095826, 0.118826, - 0.00407576, 0.323595, 0.00149845, 0.118846, - 0.00586826, 0.323617, 0.00216047, 0.118886, - 0.00798578, 0.32367, 0.00294679, 0.118947, - 0.0104273, 0.323753, 0.00386124, 0.119055, - 0.0131909, 0.323922, 0.00490999, 0.119241, - 0.0162444, 0.324251, 0.00610804, 0.11944, - 0.0196339, 0.324544, 0.00745805, 0.119739, - 0.0233378, 0.325026, 0.00897805, 0.12011, - 0.0273179, 0.325586, 0.0106895, 0.120571, - 0.0316143, 0.326231, 0.0126073, 0.12124, - 0.0361939, 0.327264, 0.0147654, 0.122162, - 0.0410511, 0.328733, 0.0172001, 0.123378, - 0.0462233, 0.330659, 0.0199375, 0.125183, - 0.0517109, 0.333754, 0.0230498, 0.127832, - 0.0575652, 0.338507, 0.026597, 0.130909, - 0.0637441, 0.343666, 0.0306345, 0.135221, - 0.0704302, 0.351063, 0.035273, 0.14082, - 0.0776364, 0.360604, 0.0406137, 0.146781, - 0.0852293, 0.369638, 0.0466788, 0.155121, - 0.0935351, 0.3827, 0.0537628, 0.16398, - 0.102234, 0.39522, 0.0617985, 0.173926, - 0.111465, 0.40793, 0.07097, 0.185137, - 0.121296, 0.42105, 0.0813426, 0.19826, - 0.13169, 0.435735, 0.0931596, 0.212938, - 0.142614, 0.450932, 0.106547, 0.229046, - 0.153884, 0.465726, 0.121575, 0.246246, - 0.165382, 0.479461, 0.138286, 0.264637, - 0.176806, 0.492106, 0.15666, 0.284959, - 0.188793, 0.504774, 0.17728, 0.308157, - 0.200763, 0.518805, 0.19988, 0.330951, - 0.21239, 0.528231, 0.224293, 0.3549, - 0.223521, 0.536376, 0.250541, 0.381502, - 0.234169, 0.544846, 0.278902, 0.409529, - 0.244077, 0.551717, 0.309227, 0.437523, - 0.253363, 0.55517, 0.341426, 0.467624, - 0.261659, 0.557772, 0.37518, 0.497268, - 0.268498, 0.556442, 0.41007, 0.528294, - 0.274018, 0.553915, 0.446445, 0.559053, - 0.278169, 0.549153, 0.483779, 0.589329, - 0.281229, 0.539878, 0.522249, 0.622503, - 0.282902, 0.53162, 0.561754, 0.652382, - 0.282815, 0.518119, 0.601544, 0.681847, - 0.281247, 0.502187, 0.641574, 0.712285, - 0.277986, 0.484824, 0.682633, 0.740094, - 0.273017, 0.463483, 0.723426, 0.768478, - 0.266692, 0.441299, 0.763747, 0.794556, - 0.258358, 0.415238, 0.805565, 0.819408, - 0.248807, 0.386912, 0.847254, 0.843411, - 0.236214, 0.356165, 0.891091, 0.862397, - 0.219794, 0.320562, 0.936174, 0.883113, - 0.201768, 0.285322, 0.982562, 0.90023, - 0.181672, 0.249713, 1.02862, 0.915192, - 0.159279, 0.214546, 1.07163, 0.928458, - 0.134725, 0.180285, 1.10995, 0.94069, - 0.10913, 0.147119, 1.14354, 0.953409, - 0.0821315, 0.112492, 1.17372, 0.969537, - 0.0542677, 0.0752014, 1.20043, 0.985612, - 0.0259096, 0.0370361, 1.22528, 0.999835, 0.00298198, - 0.00151801, 1.24959, 0.10097, - 6.02574e-06, 0.300277, 2.02619e-06, 0.101577, - 0.000152164, 0.302077, 5.11662e-05, 0.101572, - 0.000608889, 0.302066, 0.000204751, 0.101566, - 0.00136997, 0.302047, 0.000460753, 0.101592, - 0.00243557, 0.302114, 0.000819497, 0.101608, - 0.0038053, 0.30214, 0.00128154, 0.101627, - 0.00547906, 0.30216, 0.0018483, 0.101669, - 0.00745647, 0.302224, 0.00252223, 0.101732, - 0.00973615, 0.302318, 0.00330716, 0.101844, - 0.0123097, 0.302513, 0.00421061, 0.102025, - 0.0151681, 0.30285, 0.00524481, 0.102224, - 0.0183334, 0.303166, 0.0064154, 0.102515, - 0.0217819, 0.303654, 0.00774063, 0.102886, - 0.0255067, 0.304243, 0.0092398, 0.103395, - 0.029514, 0.305089, 0.0109339, 0.104109, - 0.0337912, 0.306301, 0.0128561, 0.105074, - 0.0383565, 0.30798, 0.0150338, 0.10654, - 0.0432132, 0.310726, 0.0175228, 0.108478, - 0.0484244, 0.314351, 0.0203648, 0.111015, - 0.0539339, 0.319032, 0.0236325, 0.114682, - 0.0598885, 0.32605, 0.0274188, 0.11911, - 0.0663375, 0.334109, 0.0317905, 0.124736, - 0.0733011, 0.344013, 0.0368502, 0.131479, - 0.0807744, 0.355358, 0.0427104, 0.139283, - 0.0888204, 0.367614, 0.0494788, 0.148054, - 0.0973394, 0.380072, 0.0572367, 0.159037, - 0.10665, 0.395678, 0.0662704, 0.169794, - 0.116221, 0.40795, 0.0763192, 0.18314, - 0.126632, 0.423546, 0.087956, 0.197515, - 0.137383, 0.438213, 0.101042, 0.213514, - 0.148641, 0.453248, 0.115827, 0.23065, - 0.160117, 0.46688, 0.132283, 0.249148, - 0.171807, 0.479962, 0.150644, 0.270219, - 0.183695, 0.494618, 0.171073, 0.292338, - 0.195574, 0.506937, 0.193378, 0.314999, - 0.207205, 0.516463, 0.217585, 0.340991, - 0.218955, 0.528123, 0.24428, 0.367982, - 0.229917, 0.537025, 0.272784, 0.39432, - 0.239737, 0.541627, 0.302742, 0.423364, - 0.249048, 0.546466, 0.335112, 0.453751, - 0.257329, 0.549466, 0.369032, 0.48416, - 0.264623, 0.549503, 0.404577, 0.515262, - 0.270411, 0.547008, 0.441337, 0.547036, - 0.274581, 0.542249, 0.479162, 0.576614, - 0.277266, 0.533015, 0.517904, 0.611143, - 0.279144, 0.525512, 0.558508, 0.640989, - 0.279001, 0.51154, 0.598995, 0.671182, - 0.277324, 0.495641, 0.639935, 0.700848, - 0.273908, 0.477526, 0.681017, 0.729862, - 0.269063, 0.457955, 0.722764, 0.758273, - 0.262282, 0.434846, 0.764349, 0.784121, - 0.254281, 0.409203, 0.806206, 0.809798, - 0.24505, 0.382694, 0.848617, 0.834953, - 0.233861, 0.354034, 0.892445, 0.856817, - 0.221308, 0.321764, 0.936263, 0.877609, - 0.205996, 0.288118, 0.982401, 0.897489, - 0.186702, 0.253277, 1.02975, 0.913792, - 0.164618, 0.217963, 1.07488, 0.92785, - 0.140023, 0.183221, 1.11487, 0.940378, - 0.11328, 0.149385, 1.14947, 0.95273, - 0.0853958, 0.114152, 1.1807, 0.969059, - 0.0568698, 0.0769845, 1.20912, 0.985574, - 0.0276502, 0.0381186, 1.23498, 0.999943, 0.00239052, - 0.00126861, 1.25987, 0.0852715, - 5.60067e-06, 0.279021, 1.71162e-06, 0.0854143, - 0.000140871, 0.279483, 4.30516e-05, 0.0854191, - 0.000563385, 0.2795, 0.000172184, 0.0854188, - 0.00126753, 0.279493, 0.000387464, 0.0854229, - 0.00225337, 0.279501, 0.00068918, 0.0854443, - 0.00352086, 0.279549, 0.00107803, 0.0854697, - 0.00506962, 0.279591, 0.00155536, 0.0855093, - 0.00689873, 0.279652, 0.00212354, 0.0855724, - 0.00900821, 0.279752, 0.00278703, 0.0856991, - 0.0113799, 0.280011, 0.0035551, 0.085855, - 0.0140314, 0.280297, 0.00443449, 0.0860682, - 0.016963, 0.280682, 0.00543636, 0.086344, - 0.0201438, 0.281159, 0.0065788, 0.0867426, - 0.0235999, 0.281886, 0.00787977, 0.087239, - 0.0273069, 0.282745, 0.0093606, 0.0879815, - 0.031269, 0.284139, 0.011056, 0.0891258, - 0.035531, 0.28647, 0.0130065, 0.0906909, - 0.0400947, 0.289708, 0.0152495, 0.0927624, - 0.0449638, 0.293904, 0.0178454, 0.0958376, - 0.0502427, 0.300471, 0.0208915, 0.0995827, - 0.0559514, 0.30806, 0.0244247, 0.104526, - 0.0622152, 0.317874, 0.0285721, 0.110532, - 0.0690046, 0.329332, 0.0334227, 0.117385, - 0.0763068, 0.341217, 0.0390466, 0.12522, - 0.084184, 0.353968, 0.0455786, 0.134037, - 0.0925248, 0.366797, 0.0530773, 0.144014, - 0.101487, 0.380209, 0.0617424, 0.156013, - 0.111273, 0.395956, 0.071777, 0.168872, - 0.121431, 0.41053, 0.0830905, 0.183089, - 0.132105, 0.425073, 0.0959341, 0.198763, - 0.143286, 0.439833, 0.110448, 0.216159, - 0.154841, 0.454507, 0.126769, 0.234859, - 0.166588, 0.468368, 0.14495, 0.255879, - 0.178626, 0.482846, 0.165233, 0.27677, - 0.190218, 0.493489, 0.187217, 0.301184, - 0.202227, 0.506549, 0.211659, 0.325852, - 0.213764, 0.5158, 0.237922, 0.352824, - 0.22487, 0.525442, 0.26632, 0.380882, - 0.235246, 0.532487, 0.296691, 0.410137, - 0.244847, 0.537703, 0.329179, 0.439787, - 0.253122, 0.540361, 0.363135, 0.472291, - 0.260517, 0.542734, 0.399222, 0.501856, - 0.266519, 0.538826, 0.436352, 0.534816, - 0.270905, 0.535152, 0.474505, 0.565069, - 0.273826, 0.525979, 0.513988, 0.597154, - 0.275333, 0.516394, 0.554852, 0.630473, - 0.275314, 0.506206, 0.596592, 0.660574, - 0.273323, 0.489769, 0.638117, 0.692015, - 0.270008, 0.472578, 0.680457, 0.720647, - 0.265001, 0.452134, 0.723008, 0.750528, - 0.258311, 0.430344, 0.765954, 0.777568, - 0.250046, 0.405624, 0.809012, 0.80387, - 0.240114, 0.378339, 0.852425, 0.828439, - 0.228737, 0.349877, 0.895346, 0.851472, - 0.216632, 0.318968, 0.940695, 0.873906, - 0.202782, 0.287489, 0.987235, 0.89467, - 0.187059, 0.254394, 1.03348, 0.912281, - 0.168818, 0.221294, 1.07812, 0.927358, - 0.146494, 0.18675, 1.11928, 0.940385, - 0.120009, 0.152322, 1.15609, 0.952672, - 0.0917183, 0.117514, 1.18875, 0.968496, - 0.0620321, 0.0797405, 1.21821, 0.985236, - 0.0314945, 0.0402383, 1.24523, 0.99998, - 0.000575153, 0.000110644, 1.27133, 0.0702429, - 5.12222e-06, 0.255273, 1.40947e-06, 0.0702981, - 0.000128826, 0.255469, 3.54488e-05, 0.0703691, - 0.000515562, 0.255727, 0.000141874, 0.0703805, - 0.00116, 0.255754, 0.00031929, 0.0703961, - 0.00206224, 0.255813, 0.000567999, 0.0704102, - 0.00322223, 0.255839, 0.00088871, 0.0704298, - 0.00463928, 0.255863, 0.00128272, 0.0704759, - 0.00631375, 0.255953, 0.00175283, 0.0705434, - 0.00824317, 0.256079, 0.00230342, 0.0706693, - 0.010412, 0.25636, 0.0029443, 0.0708189, - 0.0128439, 0.256647, 0.00368031, 0.0710364, - 0.0155177, 0.257084, 0.00452614, 0.0713223, - 0.0184374, 0.257637, 0.00549706, 0.0717182, - 0.0216002, 0.258416, 0.00661246, 0.072321, - 0.0249966, 0.259699, 0.00790147, 0.0731446, - 0.0286566, 0.261475, 0.0093884, 0.0743352, - 0.0325888, 0.264132, 0.0111186, 0.0760676, - 0.036843, 0.26815, 0.013145, 0.078454, - 0.0414292, 0.273636, 0.0155251, 0.0818618, - 0.0464634, 0.281653, 0.0183525, 0.0857382, - 0.0519478, 0.289992, 0.0216642, 0.0908131, - 0.0579836, 0.30066, 0.0255956, 0.0967512, - 0.0645124, 0.312204, 0.0301954, 0.103717, - 0.0716505, 0.325001, 0.0356017, 0.111596, - 0.0793232, 0.338129, 0.041896, 0.120933, - 0.087645, 0.352853, 0.0492447, 0.130787, - 0.096492, 0.366192, 0.0576749, 0.142311, - 0.105973, 0.380864, 0.0673969, 0.155344, - 0.116182, 0.396575, 0.0785899, 0.169535, - 0.126815, 0.411443, 0.0912377, 0.185173, - 0.138015, 0.426256, 0.105607, 0.201755, - 0.149325, 0.439607, 0.121551, 0.221334, - 0.161207, 0.455467, 0.139608, 0.241461, - 0.173162, 0.469096, 0.159591, 0.26294, - 0.18504, 0.481014, 0.18156, 0.286776, - 0.196881, 0.493291, 0.205781, 0.311596, - 0.208311, 0.503556, 0.231819, 0.338667, - 0.219671, 0.513268, 0.260274, 0.366021, - 0.230451, 0.519414, 0.290862, 0.395875, - 0.240131, 0.526766, 0.323196, 0.425564, - 0.248566, 0.52905, 0.357071, 0.457094, - 0.256195, 0.530796, 0.393262, 0.488286, - 0.262331, 0.528703, 0.430797, 0.522291, - 0.267141, 0.52727, 0.470231, 0.554172, - 0.270411, 0.519848, 0.510477, 0.586427, - 0.271986, 0.510307, 0.551594, 0.619638, - 0.27192, 0.499158, 0.593849, 0.650656, - 0.269817, 0.483852, 0.636314, 0.68284, - 0.266267, 0.467515, 0.679679, 0.714356, - 0.26113, 0.44931, 0.723884, 0.742717, - 0.254067, 0.425789, 0.767245, 0.770894, - 0.245652, 0.401144, 0.811819, 0.797358, - 0.235554, 0.374224, 0.856315, 0.823377, - 0.223896, 0.346167, 0.901077, 0.847456, - 0.210865, 0.316056, 0.946502, 0.870697, - 0.196574, 0.284503, 0.993711, 0.891068, - 0.180814, 0.251628, 1.04134, 0.909267, - 0.163314, 0.219065, 1.08609, 0.925653, - 0.143304, 0.186446, 1.12702, 0.940017, - 0.121322, 0.153416, 1.16371, 0.952398, - 0.0973872, 0.120334, 1.19712, 0.967568, - 0.0698785, 0.08352, 1.22791, 0.984772, - 0.0390031, 0.0439209, 1.25672, 1.00026, - 0.0070087, 0.00315668, 1.28428, 0.0556653, - 4.59654e-06, 0.227325, 1.12556e-06, 0.0565238, - 0.000116382, 0.230826, 2.84985e-05, 0.0565717, - 0.000465666, 0.231026, 0.000114036, 0.0565859, - 0.00104773, 0.231079, 0.000256656, 0.0565761, - 0.00186255, 0.231025, 0.00045663, 0.0565913, - 0.00291002, 0.231058, 0.000714664, 0.0566108, - 0.00418998, 0.231085, 0.00103224, 0.0566532, - 0.00570206, 0.231169, 0.00141202, 0.0567473, - 0.00743666, 0.231417, 0.00186018, 0.0568567, - 0.00940298, 0.231661, 0.00238264, 0.0569859, - 0.0115991, 0.231895, 0.00298699, 0.0572221, - 0.0140096, 0.232456, 0.00368957, 0.057519, - 0.0166508, 0.233096, 0.00450303, 0.0579534, - 0.01951, 0.234094, 0.00544945, 0.0585922, - 0.0225991, 0.235629, 0.00655564, 0.0595647, - 0.0259416, 0.238106, 0.00785724, 0.0609109, - 0.0295661, 0.241557, 0.00939127, 0.0628751, - 0.0335126, 0.246652, 0.0112198, 0.0656908, - 0.0378604, 0.254091, 0.0134168, 0.0691347, - 0.0426543, 0.262666, 0.0160374, 0.0732165, - 0.0478967, 0.272029, 0.0191514, 0.0782863, - 0.0536716, 0.283007, 0.0228597, 0.0843973, - 0.0600683, 0.295732, 0.0272829, 0.0913598, - 0.0670095, 0.308779, 0.032484, 0.0994407, - 0.0745516, 0.322886, 0.0385886, 0.108189, - 0.082712, 0.336408, 0.0457133, 0.118574, - 0.0914927, 0.351692, 0.0539832, 0.129989, - 0.100854, 0.366502, 0.0635162, 0.142722, - 0.110837, 0.381675, 0.0744386, 0.156654, - 0.121353, 0.3963, 0.0868483, 0.172151, - 0.132414, 0.411477, 0.100963, 0.188712, - 0.143809, 0.42508, 0.116795, 0.208093, - 0.155765, 0.441328, 0.134715, 0.227936, - 0.167608, 0.454328, 0.154396, 0.249495, - 0.179579, 0.467235, 0.176179, 0.27362, - 0.191488, 0.480248, 0.200193, 0.296371, - 0.202618, 0.487886, 0.225775, 0.324234, - 0.214133, 0.499632, 0.25441, 0.353049, - 0.225212, 0.509532, 0.285077, 0.381785, - 0.234875, 0.514265, 0.317047, 0.414038, - 0.244205, 0.521282, 0.351874, 0.445251, - 0.252145, 0.522931, 0.388279, 0.476819, - 0.258433, 0.520947, 0.425825, 0.509209, - 0.263411, 0.517669, 0.465104, 0.542759, - 0.266732, 0.512841, 0.505741, 0.574822, - 0.268263, 0.503317, 0.547611, 0.609324, - 0.268489, 0.493035, 0.590953, 0.641772, - 0.266941, 0.478816, 0.63488, 0.674049, - 0.263297, 0.462863, 0.679072, 0.705071, - 0.257618, 0.442931, 0.723487, 0.734709, - 0.250625, 0.421299, 0.768708, 0.763704, - 0.24179, 0.397085, 0.814375, 0.791818, - 0.231115, 0.370577, 0.859907, 0.817439, - 0.21922, 0.34232, 0.906715, 0.843202, - 0.205658, 0.312627, 0.953943, 0.866639, - 0.190563, 0.280933, 1.00185, 0.888129, - 0.173978, 0.248393, 1.05105, 0.907239, - 0.155485, 0.216007, 1.09704, 0.923893, - 0.134782, 0.183233, 1.13857, 0.938882, - 0.11249, 0.150376, 1.17539, 0.952464, - 0.0890706, 0.117177, 1.20924, 0.968529, - 0.0646523, 0.0813095, 1.24055, 0.984763, - 0.038606, 0.0439378, 1.27018, 1.00053, - 0.01238, 0.00598668, 1.29873, 0.0437928, - 4.09594e-06, 0.204012, 8.79224e-07, 0.0440166, - 0.000103395, 0.205049, 2.21946e-05, 0.0440529, - 0.000413633, 0.205225, 8.87981e-05, 0.0440493, - 0.000930594, 0.2052, 0.000199858, 0.0439884, - 0.00165352, 0.204901, 0.000355495, 0.0440716, - 0.0025849, 0.205255, 0.000556983, 0.0440968, - 0.00372222, 0.205311, 0.000805326, 0.0441359, - 0.00506478, 0.205391, 0.00110333, 0.0442231, - 0.00660384, 0.205638, 0.00145768, 0.0443254, - 0.00835246, 0.205877, 0.00187275, 0.0444832, - 0.0102992, 0.20627, 0.00235938, 0.0447001, - 0.0124449, 0.206796, 0.0029299, 0.0450168, - 0.0147935, 0.207593, 0.0036005, 0.0454816, - 0.017336, 0.208819, 0.00439246, 0.0462446, - 0.0201156, 0.211036, 0.00533864, 0.0473694, - 0.0231568, 0.214388, 0.00646984, 0.0490191, - 0.0264941, 0.219357, 0.00783856, 0.0512776, - 0.030184, 0.226061, 0.00950182, 0.0541279, - 0.0342661, 0.234094, 0.0115156, 0.0578989, - 0.0388539, 0.244297, 0.0139687, 0.0620835, - 0.0438735, 0.254457, 0.0169015, 0.0673497, - 0.04951, 0.266706, 0.0204554, 0.0731759, - 0.0556263, 0.278753, 0.0246606, 0.0803937, - 0.0624585, 0.29309, 0.0297126, 0.0879287, - 0.0697556, 0.305856, 0.0355868, 0.0970669, - 0.0778795, 0.321059, 0.0425768, 0.106508, - 0.0863541, 0.333873, 0.05056, 0.11776, - 0.0955935, 0.349008, 0.0598972, 0.130081, - 0.105438, 0.363776, 0.0706314, 0.144454, - 0.115899, 0.380112, 0.0828822, 0.1596, - 0.126827, 0.394843, 0.0967611, 0.176097, - 0.138161, 0.409033, 0.112381, 0.194726, - 0.149904, 0.424257, 0.129952, 0.213944, - 0.161675, 0.436945, 0.149333, 0.235516, - 0.173659, 0.450176, 0.170892, 0.260564, - 0.185963, 0.466305, 0.194984, 0.285183, - 0.197582, 0.477328, 0.220805, 0.311095, - 0.208697, 0.486566, 0.248694, 0.338924, - 0.219519, 0.494811, 0.279015, 0.369757, - 0.229766, 0.504065, 0.311725, 0.3996, - 0.238879, 0.507909, 0.345844, 0.430484, - 0.246802, 0.509805, 0.381749, 0.46413, - 0.253924, 0.511436, 0.420251, 0.497077, - 0.259319, 0.508787, 0.459957, 0.530434, - 0.263297, 0.50394, 0.501356, 0.565725, - 0.265619, 0.49804, 0.544252, 0.599254, - 0.265842, 0.487346, 0.587856, 0.631251, - 0.263978, 0.472975, 0.631969, 0.663972, - 0.26043, 0.457135, 0.677471, 0.697724, - 0.255358, 0.439844, 0.723744, 0.727725, - 0.248308, 0.417872, 0.770653, 0.756417, - 0.239181, 0.39273, 0.817357, 0.785419, - 0.22814, 0.367839, 0.864221, 0.81266, - 0.215681, 0.339449, 0.912701, 0.839391, - 0.201623, 0.309279, 0.962419, 0.86366, - 0.185624, 0.278029, 1.0122, 0.885028, - 0.16797, 0.245294, 1.06186, 0.904639, - 0.148336, 0.212689, 1.10934, 0.922048, - 0.12637, 0.179616, 1.15063, 0.936952, - 0.102928, 0.146749, 1.18885, 0.951895, - 0.0785268, 0.112733, 1.22352, 0.967198, - 0.0530153, 0.0760056, 1.25681, 0.984405, - 0.02649, 0.0383183, 1.28762, 1.00021, 0.00070019, - 0.00020039, 1.31656, 0.0325964, - 3.55447e-06, 0.176706, 6.55682e-07, 0.0329333, - 8.99174e-05, 0.178527, 1.65869e-05, 0.0329181, - 0.000359637, 0.178453, 6.63498e-05, 0.0329085, - 0.000808991, 0.178383, 0.000149332, 0.0329181, - 0.00143826, 0.178394, 0.000265873, 0.0329425, - 0.00224678, 0.178517, 0.000416597, 0.0329511, - 0.00323575, 0.17849, 0.000603299, 0.033011, - 0.00439875, 0.178695, 0.000829422, 0.0330733, - 0.00574059, 0.178843, 0.00109908, 0.0331857, - 0.00725896, 0.179176, 0.00141933, 0.0333445, - 0.00895289, 0.179618, 0.0017999, 0.0335674, - 0.0108219, 0.180238, 0.00225316, 0.033939, - 0.0128687, 0.181417, 0.00279765, 0.0345239, - 0.015114, 0.183395, 0.0034564, 0.0354458, - 0.017596, 0.186616, 0.00425864, 0.0368313, - 0.0203524, 0.191547, 0.00524936, 0.0386115, - 0.0234105, 0.197508, 0.00647033, 0.0410303, - 0.0268509, 0.205395, 0.00798121, 0.0442245, - 0.0307481, 0.215365, 0.0098557, 0.0478659, - 0.0350863, 0.225595, 0.0121417, 0.0522416, - 0.0399506, 0.236946, 0.0149385, 0.0574513, - 0.045357, 0.249442, 0.0183189, 0.0631208, - 0.0512863, 0.261222, 0.0223644, 0.0701124, - 0.0579273, 0.275418, 0.0272418, 0.0777331, - 0.0650652, 0.288989, 0.0329458, 0.0862709, - 0.0728813, 0.302546, 0.0396819, 0.096103, - 0.081363, 0.317164, 0.04757, 0.106976, - 0.0904463, 0.331733, 0.0567012, 0.119175, - 0.100105, 0.34661, 0.067202, 0.132919, - 0.110375, 0.362249, 0.0792588, 0.147727, - 0.121115, 0.376978, 0.0928672, 0.163618, - 0.132299, 0.390681, 0.108228, 0.182234, - 0.143887, 0.406571, 0.125502, 0.201809, - 0.155827, 0.42042, 0.144836, 0.225041, - 0.168357, 0.438411, 0.166706, 0.247621, - 0.18004, 0.450368, 0.189909, 0.27097, - 0.191536, 0.460083, 0.215251, 0.296658, - 0.203024, 0.469765, 0.243164, 0.325892, - 0.214056, 0.481837, 0.273388, 0.35406, - 0.224104, 0.487474, 0.305344, 0.384372, - 0.233489, 0.492773, 0.339741, 0.41749, - 0.241874, 0.498451, 0.376287, 0.45013, - 0.248834, 0.499632, 0.414195, 0.481285, - 0.254658, 0.495233, 0.454077, 0.519183, - 0.259367, 0.496401, 0.496352, 0.551544, - 0.261818, 0.487686, 0.538798, 0.587349, - 0.262964, 0.479453, 0.583626, 0.621679, - 0.262128, 0.467709, 0.629451, 0.654991, - 0.258998, 0.452123, 0.67566, 0.686873, - 0.254119, 0.433495, 0.723248, 0.719801, - 0.246946, 0.413657, 0.771156, 0.750355, - 0.237709, 0.390366, 0.81989, 0.780033, - 0.226549, 0.364947, 0.868601, 0.809254, - 0.214186, 0.337256, 0.920034, 0.836576, - 0.199639, 0.307395, 0.971706, 0.861774, - 0.183169, 0.275431, 1.02479, 0.885707, - 0.165111, 0.243431, 1.07837, 0.904742, - 0.144363, 0.210921, 1.12783, 0.915604, - 0.121305, 0.17647, 1.17254, 0.930959, - 0.0962119, 0.143106, 1.21012, 0.948404, - 0.069969, 0.108112, 1.24474, 0.967012, - 0.0427586, 0.0708478, 1.27718, 0.984183, - 0.0147043, 0.032335, 1.3083, 0.999577, 0.0142165, - 0.00726867, 1.3382, 0.0229227, - 2.99799e-06, 0.148623, 4.62391e-07, 0.0232194, - 7.58796e-05, 0.15054, 1.17033e-05, 0.0232315, - 0.000303636, 0.15063, 4.68397e-05, 0.0232354, - 0.000683189, 0.150624, 0.000105472, 0.0232092, - 0.0012136, 0.150445, 0.000187744, 0.0232523, - 0.00189765, 0.150679, 0.000294847, 0.0232828, - 0.00273247, 0.150789, 0.000428013, 0.0233371, - 0.00371287, 0.150995, 0.000591134, 0.0234015, - 0.00484794, 0.15118, 0.000787642, 0.023514, - 0.00612877, 0.151562, 0.00102547, 0.023679, - 0.00756125, 0.152116, 0.00131351, 0.0239559, - 0.00914651, 0.153162, 0.00166594, 0.0244334, - 0.010904, 0.155133, 0.00210182, 0.025139, - 0.0128615, 0.158035, 0.00264406, 0.0262598, - 0.0150628, 0.162751, 0.00332923, 0.0277875, - 0.0175532, 0.168944, 0.00419773, 0.0298472, - 0.0203981, 0.176835, 0.00530034, 0.0325444, - 0.023655, 0.186686, 0.00669777, 0.0355581, - 0.0272982, 0.196248, 0.00842661, 0.0392841, - 0.0314457, 0.207352, 0.0105854, 0.0436815, - 0.0361157, 0.219279, 0.0132458, 0.0485272, - 0.0412932, 0.230728, 0.0164736, 0.0541574, - 0.0470337, 0.242994, 0.0203715, 0.0609479, - 0.0535002, 0.257042, 0.0250953, 0.0685228, - 0.0605409, 0.27102, 0.0306856, 0.0768042, - 0.0680553, 0.28406, 0.037193, 0.0864844, - 0.0765011, 0.299186, 0.0449795, 0.0969415, - 0.0852674, 0.3132, 0.0538316, 0.108478, - 0.0947333, 0.327138, 0.0641149, 0.121705, - 0.10481, 0.342345, 0.0759185, 0.136743, - 0.115474, 0.358472, 0.0894116, 0.152986, - 0.126536, 0.374067, 0.104562, 0.170397, - 0.138061, 0.388267, 0.121632, 0.191392, - 0.150203, 0.406467, 0.140996, 0.211566, - 0.161751, 0.418641, 0.161696, 0.233567, - 0.173407, 0.430418, 0.184557, 0.257769, - 0.185397, 0.44277, 0.210092, 0.28531, - 0.197048, 0.457191, 0.237827, 0.311726, - 0.20784, 0.464712, 0.267253, 0.340537, - 0.218345, 0.472539, 0.299332, 0.372921, - 0.228306, 0.482331, 0.333988, 0.402924, - 0.236665, 0.484378, 0.369722, 0.434475, - 0.244097, 0.484717, 0.407836, 0.469736, - 0.250547, 0.487093, 0.448465, 0.505045, - 0.25511, 0.485575, 0.490263, 0.540262, - 0.258444, 0.481225, 0.534495, 0.576347, - 0.259903, 0.473481, 0.579451, 0.608656, - 0.259572, 0.4603, 0.625604, 0.646679, - 0.257908, 0.450341, 0.674511, 0.679902, - 0.253663, 0.431561, 0.723269, 0.714159, - 0.247419, 0.412684, 0.773263, 0.745345, - 0.239122, 0.389388, 0.824182, 0.778248, - 0.228837, 0.365361, 0.876634, 0.807208, - 0.216197, 0.337667, 0.92945, 0.835019, - 0.201772, 0.307197, 0.985261, 0.860261, - 0.185291, 0.274205, 1.04299, 0.877601, - 0.165809, 0.240178, 1.09816, 0.898211, - 0.143897, 0.207571, 1.14694, 0.915789, - 0.119513, 0.174904, 1.19008, 0.931831, - 0.0932919, 0.141423, 1.2297, 0.949244, - 0.0656528, 0.105603, 1.26553, 0.967527, - 0.0370262, 0.0679551, 1.29986, 0.984139, - 0.00730117, 0.0283133, 1.33252, 0.999713, 0.0234648, - 0.0121785, 1.36397, 0.0152135, - 2.45447e-06, 0.122795, 3.04092e-07, 0.0151652, - 6.15778e-05, 0.122399, 7.6292e-06, 0.0151181, - 0.000245948, 0.122023, 3.04802e-05, 0.0151203, - 0.000553394, 0.12203, 6.86634e-05, 0.015125, - 0.000983841, 0.122037, 0.000122463, 0.0151427, - 0.00153774, 0.12214, 0.000192706, 0.0151708, - 0.0022103, 0.122237, 0.000281219, 0.0152115, - 0.00300741, 0.12238, 0.000390804, 0.0152877, - 0.00392494, 0.1227, 0.000526317, 0.015412, - 0.00496597, 0.123244, 0.00069443, 0.0156201, - 0.00613314, 0.124228, 0.00090547, 0.0159658, - 0.00744113, 0.125945, 0.0011732, 0.0165674, - 0.00892546, 0.129098, 0.00151888, 0.017487, - 0.010627, 0.133865, 0.00197007, 0.018839, - 0.0126043, 0.140682, 0.0025637, 0.020554, - 0.0148814, 0.148534, 0.00333637, 0.0226727, - 0.0175123, 0.157381, 0.00433738, 0.0251879, - 0.0205266, 0.166685, 0.00561664, 0.0283635, - 0.0240319, 0.177796, 0.00725563, 0.0318694, - 0.0279432, 0.188251, 0.00928811, 0.0361044, - 0.0324313, 0.200038, 0.011835, 0.0406656, - 0.0373527, 0.210685, 0.0149146, 0.0463846, - 0.0430132, 0.224182, 0.0187254, 0.0525696, - 0.0491013, 0.23634, 0.0232283, 0.0598083, - 0.0559175, 0.250013, 0.0286521, 0.0679437, - 0.0633657, 0.263981, 0.0350634, 0.0771181, - 0.0714602, 0.278072, 0.0425882, 0.0881273, - 0.0803502, 0.29511, 0.0514487, 0.0996628, - 0.0896903, 0.309976, 0.0615766, 0.112702, - 0.099644, 0.325611, 0.0732139, 0.126488, - 0.109829, 0.339321, 0.0862324, 0.142625, - 0.120859, 0.35574, 0.101275, 0.15953, - 0.131956, 0.369845, 0.117892, 0.176991, - 0.143145, 0.38146, 0.136205, 0.199715, - 0.155292, 0.40052, 0.157252, 0.220787, - 0.167066, 0.412055, 0.179966, 0.243697, - 0.178396, 0.423133, 0.204418, 0.272106, - 0.190433, 0.439524, 0.232141, 0.297637, - 0.201265, 0.447041, 0.261109, 0.325273, - 0.211834, 0.454488, 0.292627, 0.357219, - 0.221889, 0.465004, 0.326669, 0.387362, - 0.230729, 0.468527, 0.362426, 0.423131, - 0.23924, 0.475836, 0.401533, 0.45543, - 0.246067, 0.475017, 0.441902, 0.493393, - 0.251557, 0.478017, 0.484239, 0.526253, - 0.255571, 0.4709, 0.528586, 0.560554, - 0.257752, 0.463167, 0.574346, 0.599306, - 0.258076, 0.456452, 0.621655, 0.634541, - 0.256471, 0.443725, 0.670492, 0.668907, - 0.253283, 0.428719, 0.721943, 0.705619, - 0.247562, 0.411348, 0.772477, 0.739034, - 0.240626, 0.388939, 0.8264, 0.771408, - 0.231493, 0.36425, 0.881702, 0.803312, - 0.220125, 0.337321, 0.9385, 0.828457, - 0.206645, 0.305364, 0.997437, 0.854819, - 0.190664, 0.273715, 1.05693, 0.878666, - 0.171429, 0.242218, 1.11251, 0.898404, - 0.149235, 0.209556, 1.16398, 0.917416, - 0.12435, 0.176863, 1.21014, 0.933133, - 0.0972703, 0.142775, 1.25178, 0.95066, - 0.0683607, 0.106735, 1.29028, 0.968589, - 0.0378724, 0.0681609, 1.32703, 0.984776, - 0.00605712, 0.0273966, 1.36158, 0.99994, 0.0263276, - 0.0138124, 1.3943, 0.00867437, - 1.86005e-06, 0.0928979, 1.73682e-07, 0.00864003, - 4.66389e-05, 0.0925237, 4.35505e-06, 0.00864593, - 0.000186594, 0.0925806, 1.74322e-05, 0.00864095, - 0.000419639, 0.0924903, 3.92862e-05, 0.00863851, - 0.000746272, 0.0924589, 7.02598e-05, 0.00868531, - 0.00116456, 0.0929, 0.000111188, 0.00869667, - 0.00167711, 0.0928529, 0.000163867, 0.00874332, - 0.00228051, 0.0930914, 0.00023104, 0.00882709, - 0.00297864, 0.0935679, 0.00031741, 0.00898874, - 0.00377557, 0.0946165, 0.000430186, 0.00929346, - 0.00469247, 0.0967406, 0.000580383, 0.00978271, - 0.00575491, 0.100084, 0.000783529, 0.0105746, - 0.00701514, 0.105447, 0.00106304, 0.0116949, - 0.00851797, 0.112494, 0.00144685, 0.0130419, - 0.0102757, 0.119876, 0.00196439, 0.0148375, - 0.012381, 0.129034, 0.00266433, 0.0168725, - 0.01482, 0.137812, 0.00358364, 0.0193689, - 0.0176563, 0.147696, 0.00478132, 0.0222691, - 0.0209211, 0.157795, 0.00631721, 0.0256891, - 0.0246655, 0.168431, 0.00826346, 0.0294686, - 0.0288597, 0.178587, 0.0106714, 0.0340412, - 0.0336441, 0.190251, 0.0136629, 0.0393918, - 0.039033, 0.202999, 0.0173272, 0.0453947, - 0.0450087, 0.215655, 0.0217448, 0.0521936, - 0.0515461, 0.228686, 0.0269941, 0.0600279, - 0.058817, 0.242838, 0.033272, 0.0692398, - 0.0667228, 0.258145, 0.0406457, 0.0793832, - 0.0752401, 0.273565, 0.0492239, 0.0902297, - 0.0841851, 0.287735, 0.0590105, 0.102014, - 0.0936479, 0.301161, 0.0702021, 0.116054, - 0.103967, 0.317438, 0.0832001, 0.13191, - 0.114622, 0.334166, 0.0977951, 0.148239, - 0.125452, 0.348192, 0.113985, 0.165809, - 0.136453, 0.361094, 0.131928, 0.184616, - 0.147648, 0.373534, 0.151811, 0.207491, - 0.159607, 0.39101, 0.174476, 0.230106, - 0.171119, 0.402504, 0.198798, 0.257036, - 0.182906, 0.418032, 0.225796, 0.281172, - 0.193605, 0.425468, 0.254027, 0.312034, - 0.204771, 0.440379, 0.285713, 0.340402, - 0.214988, 0.445406, 0.319196, 0.370231, - 0.224711, 0.44968, 0.35537, 0.407105, - 0.233516, 0.460747, 0.393838, 0.439037, - 0.240801, 0.460624, 0.433747, 0.47781, - 0.24762, 0.465957, 0.477234, 0.510655, - 0.251823, 0.460054, 0.52044, 0.550584, - 0.255552, 0.459172, 0.567853, 0.585872, - 0.257036, 0.450311, 0.615943, 0.620466, - 0.257535, 0.437763, 0.667693, 0.660496, - 0.255248, 0.426639, 0.718988, 0.695578, - 0.251141, 0.409185, 0.772503, 0.732176, - 0.244718, 0.39015, 0.827023, 0.760782, - 0.236782, 0.362594, 0.885651, 0.79422, - 0.225923, 0.33711, 0.943756, 0.824521, - 0.213855, 0.308272, 1.00874, 0.854964, - 0.197723, 0.278529, 1.06764, 0.878065, - 0.179209, 0.246208, 1.12836, 0.899834, - 0.157569, 0.21329, 1.18318, 0.918815, - 0.133206, 0.181038, 1.23161, 0.934934, - 0.106545, 0.146993, 1.27644, 0.952115, - 0.0780574, 0.111175, 1.31842, 0.96906, - 0.0478279, 0.0728553, 1.35839, 0.985178, - 0.0160014, 0.032579, 1.39697, 1.00039, 0.0173126, - 0.0095256, 1.43312, 0.00384146, - 1.24311e-06, 0.0613583, 7.78271e-08, 0.00390023, - 3.14043e-05, 0.0622919, 1.96626e-06, 0.00389971, - 0.000125622, 0.0622632, 7.87379e-06, 0.00389491, - 0.000282352, 0.0620659, 1.778e-05, 0.00391618, - 0.000502512, 0.0624687, 3.20918e-05, 0.00392662, - 0.000784458, 0.0625113, 5.15573e-05, 0.00396053, - 0.00112907, 0.0628175, 7.78668e-05, 0.00401911, - 0.00153821, 0.0633286, 0.000113811, 0.00414994, - 0.0020208, 0.0646443, 0.00016445, 0.00441223, - 0.00260007, 0.0673886, 0.000237734, 0.00484427, - 0.0033097, 0.0716528, 0.000345929, 0.00549109, - 0.00418966, 0.0774998, 0.000505987, 0.00636293, - 0.00527331, 0.0844758, 0.000739208, 0.00746566, - 0.00660428, 0.0921325, 0.00107347, 0.00876625, - 0.00818826, 0.0997067, 0.00153691, 0.0103125, - 0.0100811, 0.107433, 0.00217153, 0.0123309, - 0.0123643, 0.117088, 0.00303427, 0.0146274, - 0.0150007, 0.126438, 0.00416018, 0.0172295, - 0.0180531, 0.135672, 0.00561513, 0.0204248, - 0.0215962, 0.146244, 0.007478, 0.0241597, - 0.0256234, 0.157481, 0.00981046, 0.0284693, - 0.0302209, 0.169125, 0.0127148, 0.033445, - 0.0353333, 0.181659, 0.0162453, 0.0391251, - 0.0410845, 0.1944, 0.0205417, 0.0454721, - 0.0473451, 0.207082, 0.0256333, 0.0530983, - 0.0542858, 0.221656, 0.0317036, 0.0615356, - 0.0618384, 0.236036, 0.0388319, 0.0703363, - 0.0697631, 0.248398, 0.046974, 0.0810391, - 0.0784757, 0.263611, 0.0565246, 0.0920144, - 0.0873488, 0.275857, 0.0671724, 0.105584, - 0.0973652, 0.292555, 0.0798105, 0.119506, - 0.107271, 0.306333, 0.0935945, 0.134434, - 0.117608, 0.318888, 0.109106, 0.153399, - 0.128938, 0.337552, 0.127074, 0.171258, - 0.139944, 0.349955, 0.14643, 0.191059, - 0.151288, 0.361545, 0.168, 0.215069, - 0.163018, 0.378421, 0.192082, 0.237838, - 0.174226, 0.38879, 0.217838, 0.266965, - 0.186063, 0.405857, 0.246931, 0.292827, - 0.196909, 0.414146, 0.277505, 0.324352, - 0.207473, 0.426955, 0.310711, 0.354427, - 0.217713, 0.433429, 0.346794, 0.389854, - 0.227183, 0.443966, 0.385237, 0.420749, - 0.235131, 0.44471, 0.424955, 0.459597, - 0.242786, 0.451729, 0.468446, 0.495316, - 0.248767, 0.45072, 0.513422, 0.534903, - 0.253351, 0.450924, 0.560618, 0.572369, - 0.256277, 0.445266, 0.609677, 0.612383, - 0.2576, 0.438798, 0.660995, 0.644037, - 0.256931, 0.421693, 0.713807, 0.686749, - 0.254036, 0.4109, 0.767616, 0.719814, - 0.249785, 0.390151, 0.82533, 0.754719, - 0.244283, 0.367847, 0.888311, 0.792022, - 0.235076, 0.345013, 0.948177, 0.822404, - 0.225061, 0.316193, 1.01661, 0.853084, - 0.211113, 0.287013, 1.08075, 0.879871, - 0.19449, 0.255424, 1.14501, 0.901655, - 0.174023, 0.222879, 1.20203, 0.919957, - 0.1509, 0.18989, 1.25698, 0.938412, - 0.124923, 0.15606, 1.30588, 0.953471, - 0.0968139, 0.120512, 1.3529, 0.970451, - 0.066734, 0.0828515, 1.3986, 0.985522, - 0.034734, 0.0424458, 1.44148, 1.00099, - 0.00102222, 0.000678929, 1.48398, 0.000965494, - 6.27338e-07, 0.0306409, 1.97672e-08, 0.00099168, - 1.58573e-05, 0.0314638, 4.99803e-07, 0.000991068, - 6.34012e-05, 0.031363, 2.00682e-06, 0.000974567, - 0.00014144, 0.03036, 4.57312e-06, 0.000998079, - 0.000252812, 0.031496, 8.60131e-06, 0.00102243, - 0.000396506, 0.0319955, 1.48288e-05, 0.00107877, - 0.000577593, 0.0331376, 2.49141e-05, 0.00121622, - 0.000816816, 0.0359396, 4.23011e-05, 0.0014455, - 0.00113761, 0.0399652, 7.24613e-05, 0.00178791, - 0.00156959, 0.0450556, 0.000123929, 0.00225668, - 0.00214064, 0.0508025, 0.000208531, 0.00285627, - 0.00287655, 0.0568443, 0.000341969, 0.0035991, - 0.00380271, 0.0630892, 0.000544158, 0.00455524, - 0.00496264, 0.0702204, 0.000842423, 0.00569143, - 0.0063793, 0.0773426, 0.00126704, 0.00716928, - 0.00813531, 0.0860839, 0.00186642, 0.00885307, - 0.0101946, 0.0944079, 0.00267014, 0.0109316, - 0.0126386, 0.103951, 0.00374033, 0.0133704, - 0.0154876, 0.113786, 0.0051304, 0.0161525, - 0.0187317, 0.123477, 0.00688858, 0.0194267, - 0.0224652, 0.133986, 0.00910557, 0.0230967, - 0.0265976, 0.143979, 0.0118074, 0.0273627, - 0.0312848, 0.154645, 0.0151266, 0.0323898, - 0.0365949, 0.166765, 0.0191791, 0.0379225, - 0.0422914, 0.177932, 0.0239236, 0.0447501, - 0.0487469, 0.19167, 0.0296568, 0.0519391, - 0.0556398, 0.203224, 0.0362924, 0.0599464, - 0.0631646, 0.215652, 0.0440585, 0.0702427, - 0.0714308, 0.232089, 0.0531619, 0.0806902, - 0.0800605, 0.245258, 0.0634564, 0.0923194, - 0.0892815, 0.258609, 0.0752481, 0.106938, - 0.09931, 0.276654, 0.0888914, 0.121238, - 0.109575, 0.289847, 0.104055, 0.138817, - 0.120461, 0.307566, 0.121266, 0.15595, - 0.131209, 0.320117, 0.139944, 0.178418, - 0.143049, 0.339677, 0.161591, 0.197875, - 0.154074, 0.349886, 0.184303, 0.224368, - 0.166307, 0.369352, 0.210669, 0.252213, - 0.178051, 0.386242, 0.238895, 0.277321, - 0.189335, 0.395294, 0.269182, 0.310332, - 0.200683, 0.412148, 0.302508, 0.338809, - 0.210856, 0.418266, 0.337264, 0.372678, - 0.220655, 0.428723, 0.374881, 0.405632, - 0.230053, 0.433887, 0.415656, 0.442293, - 0.237993, 0.439911, 0.457982, 0.477256, - 0.244897, 0.440175, 0.502831, 0.515592, - 0.250657, 0.441079, 0.550277, 0.550969, - 0.255459, 0.435219, 0.601102, 0.592883, - 0.257696, 0.432882, 0.651785, 0.629092, - 0.259894, 0.421054, 0.708961, 0.672033, - 0.258592, 0.41177, 0.763806, 0.709147, - 0.256525, 0.395267, 0.824249, 0.745367, - 0.254677, 0.375013, 0.8951, 0.784715, - 0.247892, 0.353906, 0.959317, 0.818107, - 0.240162, 0.327801, 1.03153, 0.847895, - 0.229741, 0.298821, 1.10601, 0.879603, - 0.213084, 0.269115, 1.164, 0.902605, - 0.195242, 0.236606, 1.22854, 0.922788, - 0.174505, 0.203442, 1.29017, 0.944831, - 0.150169, 0.169594, 1.34157, 0.959656, - 0.124099, 0.135909, 1.3956, 0.972399, - 0.0960626, 0.0990563, 1.45128, 0.986549, - 0.0657097, 0.0602348, 1.50312, 1.00013, - 0.0333558, 0.0186694, 1.55364, 6.19747e-06, - 1e-07, 0.00778326, 7.96756e-11, 2.37499e-08, - 9.99999e-08, 2.82592e-05, 1.14596e-10, 1.00292e-06, - 1.66369e-06, 0.000250354, 6.77492e-09, 3.50752e-06, - 6.37769e-06, 0.000357289, 6.31655e-08, 8.26445e-06, - 1.74689e-05, 0.000516179, 3.1851e-07, 2.42481e-05, - 4.50868e-05, 0.0010223, 1.30577e-06, 4.55631e-05, - 8.9044e-05, 0.00144302, 3.74587e-06, 9.71222e-05, - 0.000178311, 0.00241912, 1.02584e-05, 0.000171403, - 0.000313976, 0.00354938, 2.36481e-05, 0.000292747, - 0.000520026, 0.00513765, 4.96014e-05, 0.000789827, - 0.00118187, 0.0238621, 0.000139056, 0.00114093, - 0.00171827, 0.0286691, 0.000244093, 0.00176119, - 0.00249667, 0.0368565, 0.000420623, 0.0022233, - 0.00333742, 0.0400469, 0.00065673, 0.00343382, - 0.00481976, 0.0535751, 0.00109323, 0.00427602, - 0.00600755, 0.057099, 0.00155268, 0.00461435, - 0.00737637, 0.0551084, 0.00215031, 0.00695698, - 0.00971401, 0.0715767, 0.00316529, 0.00867619, - 0.0120943, 0.0793314, 0.00436995, 0.0106694, - 0.0148202, 0.0869391, 0.0058959, 0.0140351, - 0.0183501, 0.101572, 0.00798757, 0.0168939, - 0.022006, 0.11018, 0.0104233, 0.020197, - 0.0261568, 0.119041, 0.0134167, 0.0254702, - 0.0312778, 0.135404, 0.0173009, 0.0298384, - 0.0362469, 0.1437, 0.0215428, 0.035159, - 0.042237, 0.15512, 0.0268882, 0.0427685, - 0.0488711, 0.17128, 0.033235, 0.0494848, - 0.0557997, 0.181813, 0.0404443, 0.0592394, - 0.0635578, 0.198745, 0.0490043, 0.0681463, - 0.071838, 0.210497, 0.0588239, 0.0804753, - 0.0809297, 0.228864, 0.0702835, 0.0942205, - 0.0906488, 0.247008, 0.0834012, 0.106777, - 0.100216, 0.258812, 0.0975952, 0.124471, - 0.110827, 0.278617, 0.114162, 0.138389, - 0.121193, 0.287049, 0.131983, 0.159543, - 0.13253, 0.307151, 0.152541, 0.176432, - 0.143611, 0.31564, 0.174673, 0.201723, - 0.15548, 0.33538, 0.199842, 0.229721, - 0.167166, 0.355256, 0.227097, 0.250206, - 0.178238, 0.360047, 0.256014, 0.282118, - 0.189905, 0.378761, 0.28855, 0.312821, - 0.201033, 0.39181, 0.323348, 0.341482, - 0.211584, 0.397716, 0.360564, 0.377368, - 0.221314, 0.410141, 0.400004, 0.418229, - 0.230474, 0.423485, 0.442371, 0.444881, - 0.239443, 0.418874, 0.488796, 0.488899, - 0.245987, 0.427545, 0.535012, 0.520317, - 0.253948, 0.422147, 0.589678, 0.568566, - 0.256616, 0.42719, 0.637683, 0.599607, - 0.26376, 0.415114, 0.703363, 0.64222, - 0.268687, 0.408715, 0.771363, 0.685698, - 0.2694, 0.399722, 0.83574, 0.732327, - 0.266642, 0.388651, 0.897764, 0.769873, - 0.267712, 0.369198, 0.983312, 0.806733, - 0.263479, 0.346802, 1.06222, 0.843466, - 0.254575, 0.321368, 1.13477, 0.873008, - 0.242749, 0.29211, 1.20712, 0.908438, - 0.22725, 0.262143, 1.27465, 0.936321, - 0.207621, 0.228876, 1.33203, 0.950353, - 0.187932, 0.19484, 1.40439, 0.96442, - 0.165154, 0.163178, 1.4732, 0.979856, - 0.139302, 0.127531, 1.53574, 0.982561, - 0.11134, 0.0903457, 1.59982, 0.996389, - 0.0808124, 0.0489007, 1.6577 ]; - - const LTC_MAT_2 = [ 1, 0, 0, 0, 1, 7.91421e-31, 0, 0, 1, 1.04392e-24, 0, 0, 1, 3.49405e-21, 0, 0, 1, 1.09923e-18, 0, 0, 1, 9.47414e-17, 0, 0, 1, 3.59627e-15, 0, 0, 1, 7.72053e-14, 0, 0, 1, 1.08799e-12, 0, 0, 1, 1.10655e-11, 0, 0, 1, 8.65818e-11, 0, 0, 0.999998, 5.45037e-10, 0, 0, 0.999994, 2.85095e-09, 0, 0, 0.999989, 1.26931e-08, 0, 0, 0.999973, 4.89938e-08, 0, 0, 0.999947, 1.66347e-07, 0, 0, 0.999894, 5.02694e-07, 0, 0, 0.999798, 1.36532e-06, 0, 0, 0.999617, 3.35898e-06, 0, 0, 0.999234, 7.52126e-06, 0, 0, 0.998258, 1.52586e-05, 0, 0, 0.99504, 2.66207e-05, 0, 0, 0.980816, 2.36802e-05, 0, 0, 0.967553, 2.07684e-06, 0, 0, 0.966877, 4.03733e-06, 0, 0, 0.965752, 7.41174e-06, 0, 0, 0.96382, 1.27746e-05, 0, 0, 0.960306, 2.02792e-05, 0, 0, 0.953619, 2.80232e-05, 0, 0, 0.941103, 2.78816e-05, 0, 0, 0.926619, 1.60221e-05, 0, 0, 0.920983, 2.35164e-05, 0, 0, 0.912293, 3.11924e-05, 0, 0.0158731, 0.899277, 3.48118e-05, 0, 0.0476191, 0.880884, 2.6041e-05, 0, 0.0793651, 0.870399, 3.38726e-05, 0, 0.111111, 0.856138, 3.92906e-05, 0, 0.142857, 0.837436, 3.72874e-05, 0, 0.174603, 0.820973, 3.92558e-05, 0, 0.206349, 0.803583, 4.34658e-05, 0, 0.238095, 0.782168, 4.0256e-05, 0, 0.269841, 0.764107, 4.48159e-05, 0, 0.301587, 0.743092, 4.57627e-05, 0, 0.333333, 0.721626, 4.55314e-05, 0, 0.365079, 0.700375, 4.77335e-05, 0, 0.396825, 0.677334, 4.61072e-05, 0, 0.428571, 0.655702, 4.84393e-05, 0, 0.460317, 0.632059, 4.64583e-05, 0, 0.492064, 0.610125, 4.83923e-05, 0, 0.52381, 0.58653, 4.64342e-05, 0, 0.555556, 0.564508, 4.77033e-05, 0, 0.587302, 0.541405, 4.59263e-05, 0, 0.619048, 0.519556, 4.6412e-05, 0, 0.650794, 0.497292, 4.48913e-05, 0, 0.68254, 0.475898, 4.45789e-05, 0, 0.714286, 0.454722, 4.33496e-05, 0, 0.746032, 0.434042, 4.23054e-05, 0, 0.777778, 0.414126, 4.13737e-05, 0, 0.809524, 0.394387, 3.97265e-05, 0, 0.84127, 0.375841, 3.90709e-05, 0, 0.873016, 0.357219, 3.69938e-05, 0, 0.904762, 0.340084, 3.65618e-05, 0, 0.936508, 0.322714, 3.42533e-05, 0, 0.968254, 0.306974, 3.39596e-05, 0, 1, 1, 1.01524e-18, 0, 0, 1, 1.0292e-18, 0, 0, 1, 1.30908e-18, 0, 0, 1, 4.73331e-18, 0, 0, 1, 6.25319e-17, 0, 0, 1, 1.07932e-15, 0, 0, 1, 1.63779e-14, 0, 0, 1, 2.03198e-13, 0, 0, 1, 2.04717e-12, 0, 0, 0.999999, 1.68995e-11, 0, 0, 0.999998, 1.15855e-10, 0, 0, 0.999996, 6.6947e-10, 0, 0, 0.999991, 3.30863e-09, 0, 0, 0.999983, 1.41737e-08, 0, 0, 0.999968, 5.32626e-08, 0, 0, 0.99994, 1.77431e-07, 0, 0, 0.999891, 5.28835e-07, 0, 0, 0.999797, 1.42169e-06, 0, 0, 0.999617, 3.47057e-06, 0, 0, 0.999227, 7.7231e-06, 0, 0, 0.998239, 1.55753e-05, 0, 0, 0.994937, 2.68495e-05, 0, 0, 0.980225, 2.13742e-05, 0, 0, 0.967549, 2.1631e-06, 0, 0, 0.966865, 4.17989e-06, 0, 0, 0.965739, 7.63341e-06, 0, 0, 0.963794, 1.30892e-05, 0, 0, 0.960244, 2.06456e-05, 0, 0, 0.953495, 2.82016e-05, 0, 0.000148105, 0.940876, 2.71581e-05, 0, 0.002454, 0.926569, 1.64159e-05, 0, 0.00867491, 0.920905, 2.39521e-05, 0, 0.01956, 0.912169, 3.15127e-05, 0, 0.035433, 0.899095, 3.46626e-05, 0, 0.056294, 0.882209, 2.90223e-05, 0, 0.0818191, 0.870272, 3.42992e-05, 0, 0.111259, 0.855977, 3.94164e-05, 0, 0.142857, 0.837431, 3.72343e-05, 0, 0.174603, 0.820826, 3.96691e-05, 0, 0.206349, 0.803408, 4.35395e-05, 0, 0.238095, 0.782838, 4.19579e-05, 0, 0.269841, 0.763941, 4.50953e-05, 0, 0.301587, 0.742904, 4.55847e-05, 0, 0.333333, 0.721463, 4.58833e-05, 0, 0.365079, 0.700197, 4.77159e-05, 0, 0.396825, 0.677501, 4.70641e-05, 0, 0.428571, 0.655527, 4.84732e-05, 0, 0.460317, 0.6324, 4.76834e-05, 0, 0.492064, 0.609964, 4.84213e-05, 0, 0.52381, 0.586839, 4.75541e-05, 0, 0.555556, 0.564353, 4.76951e-05, 0, 0.587302, 0.541589, 4.67611e-05, 0, 0.619048, 0.519413, 4.63493e-05, 0, 0.650794, 0.497337, 4.53994e-05, 0, 0.68254, 0.475797, 4.45308e-05, 0, 0.714286, 0.454659, 4.35787e-05, 0, 0.746032, 0.434065, 4.24839e-05, 0, 0.777778, 0.414018, 4.1436e-05, 0, 0.809524, 0.39455, 4.01902e-05, 0, 0.84127, 0.375742, 3.90813e-05, 0, 0.873016, 0.357501, 3.77116e-05, 0, 0.904762, 0.339996, 3.6535e-05, 0, 0.936508, 0.323069, 3.51265e-05, 0, 0.968254, 0.306897, 3.39112e-05, 0, 1, 1, 1.0396e-15, 0, 0, 1, 1.04326e-15, 0, 0, 1, 1.10153e-15, 0, 0, 1, 1.44668e-15, 0, 0, 1, 3.4528e-15, 0, 0, 1, 1.75958e-14, 0, 0, 1, 1.2627e-13, 0, 0, 1, 9.36074e-13, 0, 0, 1, 6.45742e-12, 0, 0, 0.999998, 4.01228e-11, 0, 0, 0.999997, 2.22338e-10, 0, 0, 0.999995, 1.0967e-09, 0, 0, 0.999991, 4.82132e-09, 0, 0, 0.999981, 1.89434e-08, 0, 0, 0.999967, 6.67716e-08, 0, 0, 0.999938, 2.12066e-07, 0, 0, 0.999886, 6.0977e-07, 0, 0, 0.999792, 1.59504e-06, 0, 0, 0.999608, 3.81191e-06, 0, 0, 0.999209, 8.33727e-06, 0, 0, 0.998179, 1.65288e-05, 0, 0, 0.994605, 2.74387e-05, 0, 0, 0.979468, 1.67316e-05, 0, 0, 0.967529, 2.42877e-06, 0, 0, 0.966836, 4.61696e-06, 0, 0, 0.96569, 8.30977e-06, 0, 0, 0.963706, 1.40427e-05, 0, 2.44659e-06, 0.960063, 2.17353e-05, 0, 0.000760774, 0.953113, 2.86606e-05, 0, 0.00367261, 0.940192, 2.47691e-05, 0, 0.00940263, 0.927731, 1.95814e-05, 0, 0.018333, 0.920669, 2.52531e-05, 0, 0.0306825, 0.911799, 3.24277e-05, 0, 0.0465556, 0.89857, 3.40982e-05, 0, 0.0659521, 0.883283, 3.19622e-05, 0, 0.0887677, 0.86989, 3.5548e-05, 0, 0.114784, 0.855483, 3.97143e-05, 0, 0.143618, 0.837987, 3.91665e-05, 0, 0.174606, 0.820546, 4.11306e-05, 0, 0.206349, 0.802878, 4.36753e-05, 0, 0.238095, 0.783402, 4.44e-05, 0, 0.269841, 0.763439, 4.58726e-05, 0, 0.301587, 0.742925, 4.67097e-05, 0, 0.333333, 0.721633, 4.78887e-05, 0, 0.365079, 0.69985, 4.81251e-05, 0, 0.396825, 0.67783, 4.91811e-05, 0, 0.428571, 0.655126, 4.88199e-05, 0, 0.460318, 0.632697, 4.96025e-05, 0, 0.492064, 0.609613, 4.8829e-05, 0, 0.52381, 0.587098, 4.92754e-05, 0, 0.555556, 0.564119, 4.82625e-05, 0, 0.587302, 0.541813, 4.82807e-05, 0, 0.619048, 0.519342, 4.71552e-05, 0, 0.650794, 0.497514, 4.66765e-05, 0, 0.68254, 0.475879, 4.55582e-05, 0, 0.714286, 0.454789, 4.46007e-05, 0, 0.746032, 0.434217, 4.35382e-05, 0, 0.777778, 0.414086, 4.21753e-05, 0, 0.809524, 0.394744, 4.12093e-05, 0, 0.84127, 0.375782, 3.96634e-05, 0, 0.873016, 0.357707, 3.86419e-05, 0, 0.904762, 0.340038, 3.70345e-05, 0, 0.936508, 0.323284, 3.59725e-05, 0, 0.968254, 0.306954, 3.436e-05, 0, 1, 1, 5.99567e-14, 0, 0, 1, 6.00497e-14, 0, 0, 1, 6.14839e-14, 0, 0, 1, 6.86641e-14, 0, 0, 1, 9.72658e-14, 0, 0, 1, 2.21271e-13, 0, 0, 1, 8.33195e-13, 0, 0, 1, 4.03601e-12, 0, 0, 0.999999, 2.06001e-11, 0, 0, 0.999998, 1.01739e-10, 0, 0, 0.999997, 4.70132e-10, 0, 0, 0.999993, 2.00436e-09, 0, 0, 0.999988, 7.83682e-09, 0, 0, 0.999979, 2.80338e-08, 0, 0, 0.999962, 9.17033e-08, 0, 0, 0.999933, 2.74514e-07, 0, 0, 0.999881, 7.53201e-07, 0, 0, 0.999783, 1.89826e-06, 0, 0, 0.999594, 4.40279e-06, 0, 0, 0.999178, 9.3898e-06, 0, 0, 0.998073, 1.81265e-05, 0, 0, 0.993993, 2.80487e-05, 0, 0, 0.979982, 1.49422e-05, 0, 0, 0.968145, 3.78481e-06, 0, 0, 0.966786, 5.3771e-06, 0, 0, 0.965611, 9.47508e-06, 0, 3.88934e-05, 0.963557, 1.56616e-05, 0, 0.0009693, 0.959752, 2.35144e-05, 0, 0.00370329, 0.952461, 2.91568e-05, 0, 0.00868428, 0.940193, 2.40102e-05, 0, 0.0161889, 0.929042, 2.31235e-05, 0, 0.0263948, 0.920266, 2.73968e-05, 0, 0.0394088, 0.911178, 3.37915e-05, 0, 0.0552818, 0.897873, 3.33629e-05, 0, 0.0740138, 0.884053, 3.51405e-05, 0, 0.0955539, 0.869455, 3.78034e-05, 0, 0.119795, 0.854655, 3.99378e-05, 0, 0.14656, 0.838347, 4.19108e-05, 0, 0.175573, 0.820693, 4.40831e-05, 0, 0.206388, 0.802277, 4.45599e-05, 0, 0.238095, 0.783634, 4.72691e-05, 0, 0.269841, 0.763159, 4.76984e-05, 0, 0.301587, 0.742914, 4.91487e-05, 0, 0.333333, 0.721662, 5.02312e-05, 0, 0.365079, 0.699668, 5.02817e-05, 0, 0.396825, 0.677839, 5.1406e-05, 0, 0.428571, 0.655091, 5.11095e-05, 0, 0.460317, 0.632665, 5.16067e-05, 0, 0.492064, 0.609734, 5.12255e-05, 0, 0.52381, 0.587043, 5.10263e-05, 0, 0.555556, 0.564298, 5.0565e-05, 0, 0.587302, 0.541769, 4.97951e-05, 0, 0.619048, 0.519529, 4.92698e-05, 0, 0.650794, 0.497574, 4.82066e-05, 0, 0.68254, 0.476028, 4.73689e-05, 0, 0.714286, 0.454961, 4.61941e-05, 0, 0.746032, 0.434341, 4.50618e-05, 0, 0.777778, 0.414364, 4.38355e-05, 0, 0.809524, 0.394832, 4.24196e-05, 0, 0.84127, 0.376109, 4.12563e-05, 0, 0.873016, 0.35779, 3.96226e-05, 0, 0.904762, 0.340379, 3.84886e-05, 0, 0.936508, 0.323385, 3.68214e-05, 0, 0.968254, 0.307295, 3.56636e-05, 0, 1, 1, 1.06465e-12, 0, 0, 1, 1.06555e-12, 0, 0, 1, 1.07966e-12, 0, 0, 1, 1.14601e-12, 0, 0, 1, 1.37123e-12, 0, 0, 1, 2.1243e-12, 0, 0, 0.999999, 4.89653e-12, 0, 0, 0.999999, 1.60283e-11, 0, 0, 0.999998, 6.2269e-11, 0, 0, 0.999997, 2.51859e-10, 0, 0, 0.999996, 9.96192e-10, 0, 0, 0.999992, 3.74531e-09, 0, 0, 0.999986, 1.32022e-08, 0, 0, 0.999975, 4.33315e-08, 0, 0, 0.999959, 1.31956e-07, 0, 0, 0.999927, 3.72249e-07, 0, 0, 0.999871, 9.72461e-07, 0, 0, 0.999771, 2.35343e-06, 0, 0, 0.999572, 5.2768e-06, 0, 0, 0.999133, 1.09237e-05, 0, 0, 0.997912, 2.03675e-05, 0, 0, 0.993008, 2.79396e-05, 0, 0, 0.980645, 1.39604e-05, 0, 0, 0.970057, 6.46596e-06, 0, 0, 0.966717, 6.5089e-06, 0, 4.74145e-05, 0.965497, 1.11863e-05, 0, 0.00089544, 0.96334, 1.79857e-05, 0, 0.0032647, 0.959294, 2.59045e-05, 0, 0.0075144, 0.951519, 2.92327e-05, 0, 0.0138734, 0.940517, 2.49769e-05, 0, 0.0224952, 0.93014, 2.6803e-05, 0, 0.0334828, 0.91972, 3.03656e-05, 0, 0.0468973, 0.910294, 3.53323e-05, 0, 0.0627703, 0.897701, 3.51002e-05, 0, 0.0811019, 0.884522, 3.88104e-05, 0, 0.10186, 0.869489, 4.12932e-05, 0, 0.124985, 0.853983, 4.15781e-05, 0, 0.150372, 0.838425, 4.54066e-05, 0, 0.177868, 0.820656, 4.71624e-05, 0, 0.207245, 0.801875, 4.75243e-05, 0, 0.238143, 0.783521, 5.05621e-05, 0, 0.269841, 0.763131, 5.0721e-05, 0, 0.301587, 0.74261, 5.23293e-05, 0, 0.333333, 0.72148, 5.28699e-05, 0, 0.365079, 0.699696, 5.38677e-05, 0, 0.396825, 0.677592, 5.39255e-05, 0, 0.428571, 0.65525, 5.46367e-05, 0, 0.460317, 0.632452, 5.41348e-05, 0, 0.492064, 0.609903, 5.44976e-05, 0, 0.52381, 0.586928, 5.36201e-05, 0, 0.555556, 0.564464, 5.35185e-05, 0, 0.587302, 0.541801, 5.24949e-05, 0, 0.619048, 0.519681, 5.1812e-05, 0, 0.650794, 0.497685, 5.07687e-05, 0, 0.68254, 0.47622, 4.96243e-05, 0, 0.714286, 0.455135, 4.85714e-05, 0, 0.746032, 0.4346, 4.71847e-05, 0, 0.777778, 0.414564, 4.59294e-05, 0, 0.809524, 0.395165, 4.44705e-05, 0, 0.84127, 0.376333, 4.30772e-05, 0, 0.873016, 0.358197, 4.16229e-05, 0, 0.904762, 0.34064, 4.01019e-05, 0, 0.936508, 0.323816, 3.86623e-05, 0, 0.968254, 0.307581, 3.70933e-05, 0, 1, 1, 9.91541e-12, 0, 0, 1, 9.92077e-12, 0, 0, 1, 1.00041e-11, 0, 0, 1, 1.0385e-11, 0, 0, 1, 1.15777e-11, 0, 0, 1, 1.50215e-11, 0, 0, 0.999999, 2.54738e-11, 0, 0, 0.999999, 5.98822e-11, 0, 0, 0.999998, 1.79597e-10, 0, 0, 0.999997, 6.02367e-10, 0, 0, 0.999994, 2.06835e-09, 0, 0, 0.99999, 6.94952e-09, 0, 0, 0.999984, 2.23363e-08, 0, 0, 0.999972, 6.78578e-08, 0, 0, 0.999952, 1.93571e-07, 0, 0, 0.999919, 5.16594e-07, 0, 0, 0.99986, 1.28739e-06, 0, 0, 0.999753, 2.99298e-06, 0, 0, 0.999546, 6.48258e-06, 0, 0, 0.999074, 1.29985e-05, 0, 0, 0.997671, 2.32176e-05, 0, 0, 0.991504, 2.56701e-05, 0, 0, 0.981148, 1.31141e-05, 0, 0, 0.971965, 8.69048e-06, 0, 2.80182e-05, 0.966624, 8.08301e-06, 0, 0.000695475, 0.965344, 1.35235e-05, 0, 0.00265522, 0.963048, 2.10592e-05, 0, 0.00622975, 0.958673, 2.87473e-05, 0, 0.0116234, 0.950262, 2.81379e-05, 0, 0.018976, 0.940836, 2.71089e-05, 0, 0.0283844, 0.930996, 3.0926e-05, 0, 0.0399151, 0.919848, 3.48359e-05, 0, 0.0536063, 0.909136, 3.66092e-05, 0, 0.0694793, 0.897554, 3.84162e-05, 0, 0.0875342, 0.884691, 4.30971e-05, 0, 0.107749, 0.869414, 4.47803e-05, 0, 0.130087, 0.853462, 4.52858e-05, 0, 0.154481, 0.838187, 4.95769e-05, 0, 0.180833, 0.820381, 5.02709e-05, 0, 0.209005, 0.801844, 5.22713e-05, 0, 0.238791, 0.783061, 5.41505e-05, 0, 0.269869, 0.763205, 5.53712e-05, 0, 0.301587, 0.742362, 5.64909e-05, 0, 0.333333, 0.721393, 5.72646e-05, 0, 0.365079, 0.699676, 5.81012e-05, 0, 0.396825, 0.677395, 5.8096e-05, 0, 0.428571, 0.655208, 5.85766e-05, 0, 0.460317, 0.632451, 5.83602e-05, 0, 0.492064, 0.609839, 5.80234e-05, 0, 0.52381, 0.587093, 5.77161e-05, 0, 0.555556, 0.564467, 5.68447e-05, 0, 0.587302, 0.542043, 5.63166e-05, 0, 0.619048, 0.519826, 5.5156e-05, 0, 0.650794, 0.497952, 5.41682e-05, 0, 0.68254, 0.476477, 5.28971e-05, 0, 0.714286, 0.455412, 5.14952e-05, 0, 0.746032, 0.434926, 5.02222e-05, 0, 0.777778, 0.4149, 4.85779e-05, 0, 0.809524, 0.395552, 4.72242e-05, 0, 0.84127, 0.376712, 4.54891e-05, 0, 0.873016, 0.358622, 4.40924e-05, 0, 0.904762, 0.341048, 4.22984e-05, 0, 0.936508, 0.324262, 4.08582e-05, 0, 0.968254, 0.308013, 3.90839e-05, 0, 1, 1, 6.13913e-11, 0, 0, 1, 6.14145e-11, 0, 0, 1, 6.17708e-11, 0, 0, 1, 6.33717e-11, 0, 0, 1, 6.81648e-11, 0, 0, 1, 8.08291e-11, 0, 0, 1, 1.14608e-10, 0, 0, 0.999998, 2.10507e-10, 0, 0, 0.999997, 4.99595e-10, 0, 0, 0.999995, 1.39897e-09, 0, 0, 0.999994, 4.19818e-09, 0, 0, 0.999988, 1.27042e-08, 0, 0, 0.999979, 3.75153e-08, 0, 0, 0.999965, 1.06206e-07, 0, 0, 0.999945, 2.85381e-07, 0, 0, 0.999908, 7.23611e-07, 0, 0, 0.999846, 1.7255e-06, 0, 0, 0.999733, 3.86104e-06, 0, 0, 0.999511, 8.08493e-06, 0, 0, 0.998993, 1.56884e-05, 0, 0, 0.997326, 2.65538e-05, 0, 0, 0.989706, 2.06466e-05, 0, 0, 0.981713, 1.30756e-05, 0, 7.0005e-06, 0.973636, 1.06473e-05, 0, 0.000464797, 0.966509, 1.0194e-05, 0, 0.00201743, 0.965149, 1.65881e-05, 0, 0.00497549, 0.962669, 2.49147e-05, 0, 0.00953262, 0.95786, 3.17449e-05, 0, 0.0158211, 0.949334, 2.81045e-05, 0, 0.0239343, 0.941041, 3.03263e-05, 0, 0.0339372, 0.931575, 3.56754e-05, 0, 0.0458738, 0.920102, 3.97075e-05, 0, 0.059772, 0.908002, 3.84886e-05, 0, 0.075645, 0.897269, 4.3027e-05, 0, 0.0934929, 0.884559, 4.79925e-05, 0, 0.113302, 0.869161, 4.8246e-05, 0, 0.135045, 0.853342, 5.09505e-05, 0, 0.158678, 0.837633, 5.42846e-05, 0, 0.184136, 0.820252, 5.54139e-05, 0, 0.211325, 0.801872, 5.81412e-05, 0, 0.240113, 0.782418, 5.85535e-05, 0, 0.270306, 0.7631, 6.10923e-05, 0, 0.301594, 0.742183, 6.13678e-05, 0, 0.333333, 0.721098, 6.27275e-05, 0, 0.365079, 0.699512, 6.29413e-05, 0, 0.396825, 0.677372, 6.36351e-05, 0, 0.428571, 0.655059, 6.33555e-05, 0, 0.460317, 0.632567, 6.36513e-05, 0, 0.492064, 0.609784, 6.28965e-05, 0, 0.52381, 0.587237, 6.25546e-05, 0, 0.555556, 0.564525, 6.15825e-05, 0, 0.587302, 0.542181, 6.05048e-05, 0, 0.619048, 0.520017, 5.96329e-05, 0, 0.650794, 0.498204, 5.81516e-05, 0, 0.68254, 0.476742, 5.69186e-05, 0, 0.714286, 0.455803, 5.53833e-05, 0, 0.746032, 0.435251, 5.37807e-05, 0, 0.777778, 0.415374, 5.22025e-05, 0, 0.809524, 0.395921, 5.03421e-05, 0, 0.84127, 0.377253, 4.88211e-05, 0, 0.873016, 0.359021, 4.68234e-05, 0, 0.904762, 0.341637, 4.53269e-05, 0, 0.936508, 0.3247, 4.33014e-05, 0, 0.968254, 0.308625, 4.18007e-05, 0, 1, 1, 2.86798e-10, 0, 0, 1, 2.86877e-10, 0, 0, 1, 2.88094e-10, 0, 0, 1, 2.93506e-10, 0, 0, 1, 3.09262e-10, 0, 0, 0.999999, 3.48593e-10, 0, 0, 0.999999, 4.44582e-10, 0, 0, 0.999998, 6.88591e-10, 0, 0, 0.999996, 1.34391e-09, 0, 0, 0.999993, 3.17438e-09, 0, 0, 0.999989, 8.35609e-09, 0, 0, 0.999983, 2.28677e-08, 0, 0, 0.999974, 6.23361e-08, 0, 0, 0.999959, 1.65225e-07, 0, 0, 0.999936, 4.19983e-07, 0, 0, 0.999896, 1.01546e-06, 0, 0, 0.99983, 2.32376e-06, 0, 0, 0.999709, 5.0156e-06, 0, 0, 0.999469, 1.0167e-05, 0, 0, 0.998886, 1.90775e-05, 0, 0, 0.996819, 3.00511e-05, 0, 0, 0.988837, 1.85092e-05, 0, 1.68222e-07, 0.982178, 1.34622e-05, 0, 0.000259622, 0.975017, 1.25961e-05, 0, 0.00142595, 0.967101, 1.3507e-05, 0, 0.00382273, 0.964905, 2.05003e-05, 0, 0.00764164, 0.96218, 2.9546e-05, 0, 0.0130121, 0.956821, 3.43738e-05, 0, 0.0200253, 0.948829, 3.05063e-05, 0, 0.0287452, 0.941092, 3.46487e-05, 0, 0.039218, 0.931883, 4.12061e-05, 0, 0.0514748, 0.920211, 4.44651e-05, 0, 0.0655351, 0.907307, 4.31252e-05, 0, 0.0814082, 0.89684, 4.90382e-05, 0, 0.0990939, 0.884119, 5.3334e-05, 0, 0.118583, 0.869148, 5.4114e-05, 0, 0.139856, 0.853377, 5.78536e-05, 0, 0.162882, 0.836753, 5.92285e-05, 0, 0.187615, 0.820063, 6.22787e-05, 0, 0.213991, 0.801694, 6.45492e-05, 0, 0.241918, 0.782116, 6.5353e-05, 0, 0.271267, 0.762673, 6.74344e-05, 0, 0.301847, 0.742133, 6.82788e-05, 0, 0.333333, 0.720779, 6.91959e-05, 0, 0.365079, 0.699386, 6.96817e-05, 0, 0.396826, 0.67732, 6.99583e-05, 0, 0.428572, 0.654888, 6.98447e-05, 0, 0.460318, 0.632499, 6.94063e-05, 0, 0.492064, 0.609825, 6.91612e-05, 0, 0.52381, 0.587287, 6.81576e-05, 0, 0.555556, 0.564743, 6.74138e-05, 0, 0.587302, 0.542409, 6.61617e-05, 0, 0.619048, 0.520282, 6.47785e-05, 0, 0.650794, 0.498506, 6.33836e-05, 0, 0.68254, 0.477102, 6.15905e-05, 0, 0.714286, 0.456167, 6.01013e-05, 0, 0.746032, 0.435728, 5.81457e-05, 0, 0.777778, 0.415809, 5.64215e-05, 0, 0.809524, 0.396517, 5.44997e-05, 0, 0.84127, 0.377737, 5.25061e-05, 0, 0.873016, 0.359698, 5.06831e-05, 0, 0.904762, 0.342164, 4.8568e-05, 0, 0.936508, 0.325417, 4.67826e-05, 0, 0.968254, 0.309186, 4.46736e-05, 0, 1, 1, 1.09018e-09, 0, 0, 1, 1.0904e-09, 0, 0, 1, 1.09393e-09, 0, 0, 1, 1.1095e-09, 0, 0, 1, 1.154e-09, 0, 0, 1, 1.26089e-09, 0, 0, 0.999999, 1.5059e-09, 0, 0, 0.999997, 2.07899e-09, 0, 0, 0.999994, 3.48164e-09, 0, 0, 0.999993, 7.05728e-09, 0, 0, 0.999987, 1.63692e-08, 0, 0, 0.999981, 4.06033e-08, 0, 0, 0.999969, 1.0245e-07, 0, 0, 0.999953, 2.55023e-07, 0, 0, 0.999925, 6.1511e-07, 0, 0, 0.999881, 1.42218e-06, 0, 0, 0.99981, 3.13086e-06, 0, 0, 0.99968, 6.53119e-06, 0, 0, 0.999418, 1.2832e-05, 0, 0, 0.998748, 2.32497e-05, 0, 0, 0.996066, 3.29522e-05, 0, 0, 0.988379, 1.79613e-05, 0, 0.000108799, 0.982567, 1.43715e-05, 0, 0.000921302, 0.976097, 1.48096e-05, 0, 0.00280738, 0.968475, 1.78905e-05, 0, 0.00596622, 0.964606, 2.53921e-05, 0, 0.0105284, 0.961564, 3.48623e-05, 0, 0.0165848, 0.955517, 3.57612e-05, 0, 0.0242, 0.948381, 3.43493e-05, 0, 0.03342, 0.941095, 4.05849e-05, 0, 0.0442777, 0.931923, 4.75394e-05, 0, 0.0567958, 0.91996, 4.84328e-05, 0, 0.0709879, 0.907419, 5.02146e-05, 0, 0.086861, 0.89618, 5.61654e-05, 0, 0.104415, 0.88337, 5.87612e-05, 0, 0.123643, 0.869046, 6.18057e-05, 0, 0.144531, 0.853278, 6.57392e-05, 0, 0.167057, 0.836091, 6.6303e-05, 0, 0.191188, 0.819644, 7.04445e-05, 0, 0.216878, 0.801246, 7.14071e-05, 0, 0.244062, 0.782031, 7.40093e-05, 0, 0.272649, 0.762066, 7.4685e-05, 0, 0.302509, 0.741964, 7.66647e-05, 0, 0.333442, 0.720554, 7.66328e-05, 0, 0.365079, 0.699098, 7.77857e-05, 0, 0.396826, 0.677189, 7.74633e-05, 0, 0.428572, 0.65484, 7.76235e-05, 0, 0.460318, 0.632496, 7.70316e-05, 0, 0.492064, 0.609908, 7.62669e-05, 0, 0.52381, 0.587312, 7.53972e-05, 0, 0.555556, 0.564938, 7.39994e-05, 0, 0.587302, 0.542577, 7.28382e-05, 0, 0.619048, 0.52062, 7.1112e-05, 0, 0.650794, 0.498819, 6.94004e-05, 0, 0.68254, 0.477555, 6.75575e-05, 0, 0.714286, 0.456568, 6.53449e-05, 0, 0.746032, 0.436278, 6.36068e-05, 0, 0.777778, 0.41637, 6.13466e-05, 0, 0.809524, 0.397144, 5.94177e-05, 0, 0.84127, 0.378412, 5.70987e-05, 0, 0.873016, 0.360376, 5.50419e-05, 0, 0.904762, 0.342906, 5.27422e-05, 0, 0.936508, 0.326136, 5.06544e-05, 0, 0.968254, 0.30997, 4.84307e-05, 0, 1, 1, 3.54014e-09, 0, 0, 1, 3.54073e-09, 0, 0, 1, 3.54972e-09, 0, 0, 1, 3.58929e-09, 0, 0, 1, 3.70093e-09, 0, 0, 0.999999, 3.96194e-09, 0, 0, 0.999998, 4.53352e-09, 0, 0, 0.999997, 5.78828e-09, 0, 0, 0.999994, 8.63812e-09, 0, 0, 0.999991, 1.53622e-08, 0, 0, 0.999985, 3.16356e-08, 0, 0, 0.999977, 7.12781e-08, 0, 0, 0.999964, 1.66725e-07, 0, 0, 0.999945, 3.90501e-07, 0, 0, 0.999912, 8.95622e-07, 0, 0, 0.999866, 1.98428e-06, 0, 0, 0.999786, 4.21038e-06, 0, 0, 0.999647, 8.50239e-06, 0, 0, 0.999356, 1.62059e-05, 0, 0, 0.998563, 2.82652e-05, 0, 0, 0.994928, 3.36309e-05, 0, 2.44244e-05, 0.987999, 1.78458e-05, 0, 0.000523891, 0.982893, 1.59162e-05, 0, 0.00194729, 0.977044, 1.78056e-05, 0, 0.00451099, 0.969972, 2.30624e-05, 0, 0.00835132, 0.964237, 3.13922e-05, 0, 0.013561, 0.960791, 4.06145e-05, 0, 0.0202056, 0.954292, 3.72796e-05, 0, 0.0283321, 0.948052, 4.03199e-05, 0, 0.0379739, 0.940938, 4.79537e-05, 0, 0.0491551, 0.931689, 5.45292e-05, 0, 0.0618918, 0.91987, 5.4038e-05, 0, 0.0761941, 0.907665, 5.89909e-05, 0, 0.0920672, 0.895281, 6.42651e-05, 0, 0.109511, 0.882621, 6.59707e-05, 0, 0.12852, 0.86873, 7.09973e-05, 0, 0.149085, 0.853008, 7.42221e-05, 0, 0.171189, 0.835944, 7.61754e-05, 0, 0.194809, 0.818949, 7.97052e-05, 0, 0.21991, 0.800951, 8.12434e-05, 0, 0.246447, 0.781847, 8.38075e-05, 0, 0.274352, 0.761649, 8.4501e-05, 0, 0.303535, 0.74152, 8.60258e-05, 0, 0.333857, 0.720495, 8.66233e-05, 0, 0.365104, 0.698742, 8.68326e-05, 0, 0.396826, 0.677096, 8.7133e-05, 0, 0.428572, 0.654782, 8.63497e-05, 0, 0.460318, 0.632335, 8.60206e-05, 0, 0.492064, 0.610031, 8.49337e-05, 0, 0.52381, 0.587457, 8.38279e-05, 0, 0.555556, 0.56513, 8.2309e-05, 0, 0.587302, 0.542877, 8.03542e-05, 0, 0.619048, 0.5209, 7.86928e-05, 0, 0.650794, 0.499291, 7.65171e-05, 0, 0.68254, 0.477971, 7.44753e-05, 0, 0.714286, 0.457221, 7.2209e-05, 0, 0.746032, 0.436803, 6.97448e-05, 0, 0.777778, 0.417083, 6.75333e-05, 0, 0.809524, 0.397749, 6.48058e-05, 0, 0.84127, 0.379177, 6.25759e-05, 0, 0.873016, 0.361061, 5.98584e-05, 0, 0.904762, 0.343713, 5.75797e-05, 0, 0.936508, 0.326894, 5.49999e-05, 0, 0.968254, 0.310816, 5.27482e-05, 0, 1, 1, 1.0153e-08, 0, 0, 1, 1.01544e-08, 0, 0, 1, 1.01751e-08, 0, 0, 1, 1.02662e-08, 0, 0, 1, 1.0521e-08, 0, 0, 0.999999, 1.11049e-08, 0, 0, 0.999999, 1.23408e-08, 0, 0, 0.999996, 1.4924e-08, 0, 0, 0.999992, 2.04471e-08, 0, 0, 0.999989, 3.26539e-08, 0, 0, 0.99998, 6.03559e-08, 0, 0, 0.999971, 1.23936e-07, 0, 0, 0.999955, 2.69058e-07, 0, 0, 0.999933, 5.93604e-07, 0, 0, 0.999901, 1.29633e-06, 0, 0, 0.999847, 2.75621e-06, 0, 0, 0.999761, 5.64494e-06, 0, 0, 0.999607, 1.10485e-05, 0, 0, 0.999282, 2.04388e-05, 0, 0, 0.99831, 3.41084e-05, 0, 2.2038e-07, 0.993288, 2.94949e-05, 0, 0.000242388, 0.987855, 1.92736e-05, 0, 0.0012503, 0.983167, 1.82383e-05, 0, 0.0032745, 0.977908, 2.18633e-05, 0, 0.00646321, 0.971194, 2.90662e-05, 0, 0.0109133, 0.963867, 3.86401e-05, 0, 0.0166927, 0.95982, 4.62827e-05, 0, 0.0238494, 0.953497, 4.20705e-05, 0, 0.0324178, 0.947621, 4.77743e-05, 0, 0.0424225, 0.940611, 5.68258e-05, 0, 0.0538808, 0.931174, 6.18061e-05, 0, 0.0668047, 0.919919, 6.27098e-05, 0, 0.0812014, 0.907856, 6.94714e-05, 0, 0.0970745, 0.894509, 7.35008e-05, 0, 0.114424, 0.881954, 7.63369e-05, 0, 0.133246, 0.868309, 8.21896e-05, 0, 0.153534, 0.852511, 8.3769e-05, 0, 0.175275, 0.835821, 8.81615e-05, 0, 0.198453, 0.817981, 8.96368e-05, 0, 0.223042, 0.800504, 9.30906e-05, 0, 0.249009, 0.78141, 9.45056e-05, 0, 0.276304, 0.761427, 9.63605e-05, 0, 0.304862, 0.74094, 9.68088e-05, 0, 0.334584, 0.720233, 9.81481e-05, 0, 0.365322, 0.698592, 9.79122e-05, 0, 0.396826, 0.676763, 9.81057e-05, 0, 0.428571, 0.654808, 9.73956e-05, 0, 0.460318, 0.632326, 9.62619e-05, 0, 0.492064, 0.610049, 9.52996e-05, 0, 0.52381, 0.58763, 9.33334e-05, 0, 0.555556, 0.565261, 9.17573e-05, 0, 0.587302, 0.543244, 8.96636e-05, 0, 0.619048, 0.521273, 8.73304e-05, 0, 0.650794, 0.499818, 8.52648e-05, 0, 0.68254, 0.478536, 8.23961e-05, 0, 0.714286, 0.457826, 7.9939e-05, 0, 0.746032, 0.437549, 7.7126e-05, 0, 0.777778, 0.41776, 7.43043e-05, 0, 0.809524, 0.39863, 7.16426e-05, 0, 0.84127, 0.379954, 6.86456e-05, 0, 0.873016, 0.362025, 6.60514e-05, 0, 0.904762, 0.344581, 6.30755e-05, 0, 0.936508, 0.327909, 6.05439e-05, 0, 0.968254, 0.311736, 5.76345e-05, 0, 1, 1, 2.63344e-08, 0, 0, 1, 2.63373e-08, 0, 0, 1, 2.63815e-08, 0, 0, 1, 2.65753e-08, 0, 0, 1, 2.71132e-08, 0, 0, 0.999999, 2.83279e-08, 0, 0, 0.999997, 3.0833e-08, 0, 0, 0.999995, 3.58711e-08, 0, 0, 0.999992, 4.61266e-08, 0, 0, 0.999985, 6.7574e-08, 0, 0, 0.999977, 1.1358e-07, 0, 0, 0.999966, 2.13657e-07, 0, 0, 0.999948, 4.31151e-07, 0, 0, 0.999923, 8.96656e-07, 0, 0, 0.999884, 1.86603e-06, 0, 0, 0.999826, 3.81115e-06, 0, 0, 0.999732, 7.54184e-06, 0, 0, 0.999561, 1.43192e-05, 0, 0, 0.999191, 2.57061e-05, 0, 0, 0.997955, 4.05724e-05, 0, 7.44132e-05, 0.992228, 2.76537e-05, 0, 0.000716477, 0.987638, 2.08885e-05, 0, 0.0022524, 0.983395, 2.15226e-05, 0, 0.00484816, 0.978614, 2.70795e-05, 0, 0.00860962, 0.972389, 3.65282e-05, 0, 0.0136083, 0.964392, 4.74747e-05, 0, 0.0198941, 0.95861, 5.09141e-05, 0, 0.0275023, 0.952806, 4.8963e-05, 0, 0.0364584, 0.94712, 5.71119e-05, 0, 0.04678, 0.940104, 6.71704e-05, 0, 0.0584799, 0.930398, 6.87586e-05, 0, 0.0715665, 0.919866, 7.38161e-05, 0, 0.086045, 0.907853, 8.13235e-05, 0, 0.101918, 0.894078, 8.34582e-05, 0, 0.119186, 0.881177, 8.92093e-05, 0, 0.137845, 0.867575, 9.44548e-05, 0, 0.157891, 0.852107, 9.69607e-05, 0, 0.179316, 0.835502, 0.000101456, 0, 0.202106, 0.81756, 0.000103256, 0, 0.226243, 0.79984, 0.000106954, 0, 0.251704, 0.780998, 0.000108066, 0, 0.278451, 0.761132, 0.000110111, 0, 0.306436, 0.740429, 0.000110459, 0, 0.335586, 0.719836, 0.000111219, 0, 0.365796, 0.698467, 0.00011145, 0, 0.3969, 0.676446, 0.000110393, 0, 0.428571, 0.654635, 0.000110035, 0, 0.460318, 0.632411, 0.000108548, 0, 0.492064, 0.609986, 0.000106963, 0, 0.52381, 0.587872, 0.000105238, 0, 0.555556, 0.565528, 0.000102665, 0, 0.587302, 0.543563, 0.000100543, 0, 0.619048, 0.52176, 9.76182e-05, 0, 0.650794, 0.500188, 9.47099e-05, 0, 0.68254, 0.479204, 9.19929e-05, 0, 0.714286, 0.458413, 8.86139e-05, 0, 0.746032, 0.438314, 8.57839e-05, 0, 0.777778, 0.418573, 8.2411e-05, 0, 0.809524, 0.39947, 7.92211e-05, 0, 0.84127, 0.380892, 7.59546e-05, 0, 0.873016, 0.362953, 7.27571e-05, 0, 0.904762, 0.345601, 6.95738e-05, 0, 0.936508, 0.328895, 6.64907e-05, 0, 0.968254, 0.312808, 6.34277e-05, 0, 1, 1, 6.28647e-08, 0, 0, 1, 6.28705e-08, 0, 0, 1, 6.29587e-08, 0, 0, 1, 6.33441e-08, 0, 0, 0.999999, 6.44087e-08, 0, 0, 0.999998, 6.67856e-08, 0, 0, 0.999997, 7.15889e-08, 0, 0, 0.999995, 8.09577e-08, 0, 0, 0.999989, 9.92764e-08, 0, 0, 0.999983, 1.35834e-07, 0, 0, 0.999974, 2.10482e-07, 0, 0, 0.999959, 3.65215e-07, 0, 0, 0.999939, 6.86693e-07, 0, 0, 0.999911, 1.3472e-06, 0, 0, 0.999868, 2.6731e-06, 0, 0, 0.999804, 5.24756e-06, 0, 0, 0.9997, 1.00403e-05, 0, 0, 0.99951, 1.85019e-05, 0, 0, 0.999078, 3.22036e-05, 0, 6.20676e-06, 0.997428, 4.70002e-05, 0, 0.000341552, 0.99162, 2.87123e-05, 0, 0.00143727, 0.987479, 2.34706e-05, 0, 0.00349201, 0.983582, 2.60083e-05, 0, 0.0066242, 0.979186, 3.37927e-05, 0, 0.0109113, 0.97325, 4.54689e-05, 0, 0.0164064, 0.965221, 5.73759e-05, 0, 0.0231463, 0.957262, 5.44114e-05, 0, 0.0311571, 0.952211, 5.87006e-05, 0, 0.0404572, 0.946631, 6.92256e-05, 0, 0.0510592, 0.939391, 7.87819e-05, 0, 0.0629723, 0.929795, 7.92368e-05, 0, 0.0762025, 0.91965, 8.75075e-05, 0, 0.090753, 0.907737, 9.50903e-05, 0, 0.106626, 0.893899, 9.72963e-05, 0, 0.123822, 0.880239, 0.00010459, 0, 0.142337, 0.866562, 0.000107689, 0, 0.16217, 0.85164, 0.000113081, 0, 0.183314, 0.835021, 0.000116636, 0, 0.20576, 0.817311, 0.000120074, 0, 0.229496, 0.798845, 0.000121921, 0, 0.254502, 0.780479, 0.00012475, 0, 0.280753, 0.760694, 0.000125255, 0, 0.308212, 0.740142, 0.000126719, 0, 0.336825, 0.719248, 0.00012636, 0, 0.366517, 0.698209, 0.000126712, 0, 0.397167, 0.676398, 0.000125769, 0, 0.428578, 0.654378, 0.000124432, 0, 0.460318, 0.632484, 0.000123272, 0, 0.492064, 0.610113, 0.00012085, 0, 0.52381, 0.587931, 0.000118411, 0, 0.555556, 0.565872, 0.00011569, 0, 0.587302, 0.543814, 0.000112521, 0, 0.619048, 0.522265, 0.000109737, 0, 0.650794, 0.500835, 0.000106228, 0, 0.68254, 0.479818, 0.000102591, 0, 0.714286, 0.459258, 9.91288e-05, 0, 0.746032, 0.439061, 9.52325e-05, 0, 0.777778, 0.419552, 9.1895e-05, 0, 0.809524, 0.400399, 8.79051e-05, 0, 0.84127, 0.381976, 8.44775e-05, 0, 0.873016, 0.364009, 8.06316e-05, 0, 0.904762, 0.346761, 7.71848e-05, 0, 0.936508, 0.330049, 7.35429e-05, 0, 0.968254, 0.314018, 7.02103e-05, 0, 1, 1, 1.39968e-07, 0, 0, 1, 1.39979e-07, 0, 0, 1, 1.40145e-07, 0, 0, 1, 1.4087e-07, 0, 0, 0.999999, 1.42865e-07, 0, 0, 0.999998, 1.47279e-07, 0, 0, 0.999997, 1.56057e-07, 0, 0, 0.999992, 1.7276e-07, 0, 0, 0.999989, 2.04352e-07, 0, 0, 0.99998, 2.6494e-07, 0, 0, 0.999969, 3.83435e-07, 0, 0, 0.999953, 6.18641e-07, 0, 0, 0.999929, 1.08755e-06, 0, 0, 0.999898, 2.01497e-06, 0, 0, 0.999849, 3.81346e-06, 0, 0, 0.999778, 7.19815e-06, 0, 0, 0.999661, 1.33215e-05, 0, 0, 0.999451, 2.38313e-05, 0, 0, 0.998936, 4.01343e-05, 0, 0.000113724, 0.99662, 5.17346e-05, 0, 0.000820171, 0.991094, 3.04323e-05, 0, 0.00238143, 0.987487, 2.81757e-05, 0, 0.00493527, 0.983731, 3.20048e-05, 0, 0.00856859, 0.979647, 4.23905e-05, 0, 0.0133393, 0.973837, 5.62935e-05, 0, 0.0192863, 0.96584, 6.77442e-05, 0, 0.0264369, 0.956309, 6.23073e-05, 0, 0.03481, 0.951523, 7.04131e-05, 0, 0.0444184, 0.946003, 8.36594e-05, 0, 0.0552713, 0.938454, 9.11736e-05, 0, 0.0673749, 0.929279, 9.38264e-05, 0, 0.0807329, 0.919239, 0.000103754, 0, 0.0953479, 0.907293, 0.000109928, 0, 0.111221, 0.893936, 0.000115257, 0, 0.128352, 0.879674, 0.000122265, 0, 0.14674, 0.865668, 0.000125733, 0, 0.166382, 0.850998, 0.000132305, 0, 0.187276, 0.834498, 0.000134844, 0, 0.209413, 0.816903, 0.000139276, 0, 0.232786, 0.798235, 0.000140984, 0, 0.257382, 0.779724, 0.00014378, 0, 0.283181, 0.760251, 0.000144623, 0, 0.310156, 0.739808, 0.000145228, 0, 0.338269, 0.718762, 0.00014539, 0, 0.367461, 0.697815, 0.000144432, 0, 0.397646, 0.67631, 0.000143893, 0, 0.428685, 0.654278, 0.000141846, 0, 0.460318, 0.632347, 0.00013935, 0, 0.492064, 0.610296, 0.000137138, 0, 0.52381, 0.588039, 0.000133806, 0, 0.555556, 0.566218, 0.000130755, 0, 0.587302, 0.544346, 0.000127128, 0, 0.619048, 0.522701, 0.000123002, 0, 0.650794, 0.501542, 0.000119443, 0, 0.68254, 0.480508, 0.000115055, 0, 0.714286, 0.460092, 0.000111032, 0, 0.746032, 0.440021, 0.000106635, 0, 0.777778, 0.420446, 0.000102162, 0, 0.809524, 0.401512, 9.8184e-05, 0, 0.84127, 0.38299, 9.36497e-05, 0, 0.873016, 0.365232, 8.9813e-05, 0, 0.904762, 0.347865, 8.53073e-05, 0, 0.936508, 0.331342, 8.17068e-05, 0, 0.968254, 0.315202, 7.73818e-05, 0, 1, 1, 2.9368e-07, 0, 0, 1, 2.937e-07, 0, 0, 1, 2.93998e-07, 0, 0, 1, 2.95298e-07, 0, 0, 0.999999, 2.98865e-07, 0, 0, 0.999998, 3.067e-07, 0, 0, 0.999995, 3.22082e-07, 0, 0, 0.999992, 3.50767e-07, 0, 0, 0.999986, 4.03538e-07, 0, 0, 0.999976, 5.01372e-07, 0, 0, 0.999964, 6.8562e-07, 0, 0, 0.999945, 1.0374e-06, 0, 0, 0.999919, 1.71269e-06, 0, 0, 0.999882, 3.00175e-06, 0, 0, 0.999829, 5.42144e-06, 0, 0, 0.999749, 9.84182e-06, 0, 0, 0.99962, 1.76213e-05, 0, 0, 0.999382, 3.05995e-05, 0, 1.38418e-05, 0.998751, 4.96686e-05, 0, 0.000389844, 0.995344, 5.10733e-05, 0, 0.00150343, 0.990768, 3.45829e-05, 0, 0.00352451, 0.987464, 3.42841e-05, 0, 0.00655379, 0.983846, 3.99072e-05, 0, 0.0106554, 0.980007, 5.33219e-05, 0, 0.0158723, 0.974494, 6.96992e-05, 0, 0.0222333, 0.96622, 7.76754e-05, 0, 0.029758, 0.956273, 7.47718e-05, 0, 0.0384596, 0.950952, 8.64611e-05, 0, 0.0483473, 0.945215, 0.000100464, 0, 0.0594266, 0.937287, 0.000103729, 0, 0.0717019, 0.928649, 0.000111665, 0, 0.0851752, 0.918791, 0.00012353, 0, 0.0998479, 0.906685, 0.000127115, 0, 0.115721, 0.893706, 0.00013628, 0, 0.132794, 0.879248, 0.000142427, 0, 0.151067, 0.864685, 0.000148091, 0, 0.170538, 0.850032, 0.000153517, 0, 0.191204, 0.833853, 0.000157322, 0, 0.213063, 0.816353, 0.000161086, 0, 0.236107, 0.797834, 0.000164111, 0, 0.260329, 0.778831, 0.000165446, 0, 0.285714, 0.759756, 0.000167492, 0, 0.312243, 0.739419, 0.000166928, 0, 0.339887, 0.718491, 0.000167, 0, 0.368604, 0.697392, 0.000165674, 0, 0.398329, 0.676102, 0.000163815, 0, 0.428961, 0.654243, 0.000162003, 0, 0.460331, 0.632176, 0.000158831, 0, 0.492064, 0.610407, 0.000155463, 0, 0.52381, 0.588394, 0.000152062, 0, 0.555556, 0.56645, 0.000147665, 0, 0.587302, 0.5449, 0.00014375, 0, 0.619048, 0.523276, 0.000138905, 0, 0.650794, 0.502179, 0.000134189, 0, 0.68254, 0.481359, 0.000129392, 0, 0.714286, 0.46092, 0.000124556, 0, 0.746032, 0.441084, 0.00011957, 0, 0.777778, 0.421517, 0.000114652, 0, 0.809524, 0.402721, 0.000109688, 0, 0.84127, 0.384222, 0.000104667, 0, 0.873016, 0.366534, 9.99633e-05, 0, 0.904762, 0.349205, 9.50177e-05, 0, 0.936508, 0.332702, 9.07301e-05, 0, 0.968254, 0.316599, 8.59769e-05, 0, 1, 1, 5.85473e-07, 0, 0, 1, 5.85507e-07, 0, 0, 1, 5.8602e-07, 0, 0, 0.999999, 5.88259e-07, 0, 0, 0.999999, 5.94381e-07, 0, 0, 0.999998, 6.07754e-07, 0, 0, 0.999995, 6.33729e-07, 0, 0, 0.99999, 6.8137e-07, 0, 0, 0.999984, 7.67003e-07, 0, 0, 0.999973, 9.21212e-07, 0, 0, 0.999959, 1.20218e-06, 0, 0, 0.999936, 1.72024e-06, 0, 0, 0.999907, 2.68088e-06, 0, 0, 0.999866, 4.45512e-06, 0, 0, 0.999806, 7.68481e-06, 0, 0, 0.999716, 1.342e-05, 0, 0, 0.999576, 2.32473e-05, 0, 0, 0.9993, 3.91694e-05, 0, 0.000129917, 0.998498, 6.08429e-05, 0, 0.000845035, 0.994132, 4.89743e-05, 0, 0.00237616, 0.99031, 3.84644e-05, 0, 0.00484456, 0.987409, 4.21768e-05, 0, 0.00832472, 0.983981, 5.04854e-05, 0, 0.0128643, 0.980268, 6.71028e-05, 0, 0.0184947, 0.974875, 8.52749e-05, 0, 0.025237, 0.966063, 8.5531e-05, 0, 0.0331046, 0.956779, 9.00588e-05, 0, 0.0421067, 0.950259, 0.00010577, 0, 0.0522487, 0.944239, 0.000119458, 0, 0.0635343, 0.936341, 0.000122164, 0, 0.0759654, 0.928047, 0.000134929, 0, 0.0895434, 0.918065, 0.000145544, 0, 0.104269, 0.906267, 0.000150531, 0, 0.120142, 0.893419, 0.000161652, 0, 0.137163, 0.878758, 0.00016593, 0, 0.15533, 0.863699, 0.000174014, 0, 0.174645, 0.848876, 0.000177877, 0, 0.195106, 0.833032, 0.000184049, 0, 0.21671, 0.815557, 0.000186088, 0, 0.239454, 0.797323, 0.00019054, 0, 0.263332, 0.778124, 0.000191765, 0, 0.288336, 0.758929, 0.000192535, 0, 0.314451, 0.738979, 0.000192688, 0, 0.341658, 0.718213, 0.000191522, 0, 0.369924, 0.696947, 0.000190491, 0, 0.399202, 0.675807, 0.000187913, 0, 0.429416, 0.654147, 0.000184451, 0, 0.460447, 0.63229, 0.000181442, 0, 0.492064, 0.610499, 0.000177139, 0, 0.523809, 0.588747, 0.000172596, 0, 0.555555, 0.566783, 0.000167457, 0, 0.587301, 0.545359, 0.000162518, 0, 0.619048, 0.523984, 0.000156818, 0, 0.650794, 0.502917, 0.000151884, 0, 0.68254, 0.482294, 0.000145514, 0, 0.714286, 0.461945, 0.000140199, 0, 0.746032, 0.442133, 0.000134101, 0, 0.777778, 0.422705, 0.000128374, 0, 0.809524, 0.403916, 0.000122996, 0, 0.84127, 0.38554, 0.000116808, 0, 0.873016, 0.367909, 0.000111973, 0, 0.904762, 0.350651, 0.000105938, 0, 0.936508, 0.334208, 0.000101355, 0, 0.968254, 0.318123, 9.57629e-05, 0, 1, 1, 1.11633e-06, 0, 0, 1, 1.11639e-06, 0, 0, 1, 1.11725e-06, 0, 0, 1, 1.12096e-06, 0, 0, 0.999999, 1.1311e-06, 0, 0, 0.999997, 1.15315e-06, 0, 0, 0.999995, 1.1956e-06, 0, 0, 0.999989, 1.27239e-06, 0, 0, 0.999981, 1.40772e-06, 0, 0, 0.999969, 1.64541e-06, 0, 0, 0.999952, 2.06607e-06, 0, 0, 0.999928, 2.81783e-06, 0, 0, 0.999895, 4.16835e-06, 0, 0, 0.999848, 6.58728e-06, 0, 0, 0.999781, 1.08648e-05, 0, 0, 0.999682, 1.82579e-05, 0, 0, 0.999523, 3.06003e-05, 0, 1.59122e-05, 0.999205, 4.99862e-05, 0, 0.000391184, 0.998131, 7.3306e-05, 0, 0.00147534, 0.993334, 5.13229e-05, 0, 0.0034227, 0.99016, 4.67783e-05, 0, 0.00632232, 0.987321, 5.23413e-05, 0, 0.0102295, 0.984099, 6.4267e-05, 0, 0.0151794, 0.980432, 8.43042e-05, 0, 0.0211947, 0.974976, 0.000102819, 0, 0.0282899, 0.966429, 9.96234e-05, 0, 0.0364739, 0.957633, 0.000111074, 0, 0.0457522, 0.949422, 0.000128644, 0, 0.0561278, 0.943045, 0.000140076, 0, 0.0676023, 0.935448, 0.000146349, 0, 0.0801762, 0.927225, 0.000161854, 0, 0.0938499, 0.917033, 0.000169135, 0, 0.108623, 0.905762, 0.000179987, 0, 0.124496, 0.892879, 0.000189832, 0, 0.141469, 0.878435, 0.000195881, 0, 0.159541, 0.863114, 0.00020466, 0, 0.178713, 0.84776, 0.000209473, 0, 0.198985, 0.832084, 0.000214861, 0, 0.220355, 0.814915, 0.000217695, 0, 0.242823, 0.796711, 0.000220313, 0, 0.266385, 0.777603, 0.00022313, 0, 0.291036, 0.757991, 0.000222471, 0, 0.316767, 0.738371, 0.000222869, 0, 0.343563, 0.717872, 0.000221243, 0, 0.371402, 0.696619, 0.000218089, 0, 0.400248, 0.675379, 0.00021562, 0, 0.430047, 0.65411, 0.00021169, 0, 0.460709, 0.63241, 0.000206947, 0, 0.492079, 0.61046, 0.000201709, 0, 0.52381, 0.58903, 0.000196753, 0, 0.555556, 0.567267, 0.000189637, 0, 0.587302, 0.545886, 0.000184735, 0, 0.619048, 0.524714, 0.000177257, 0, 0.650794, 0.503789, 0.000171424, 0, 0.68254, 0.483204, 0.000164688, 0, 0.714286, 0.462976, 0.000157172, 0, 0.746032, 0.443294, 0.000151341, 0, 0.777778, 0.423988, 0.000143737, 0, 0.809524, 0.405325, 0.000138098, 0, 0.84127, 0.386981, 0.000130698, 0, 0.873016, 0.369436, 0.000125276, 0, 0.904762, 0.35219, 0.000118349, 0, 0.936508, 0.335804, 0.00011312, 0, 0.968254, 0.319749, 0.000106687, 0, 1, 1, 2.04685e-06, 0, 0, 1, 2.04694e-06, 0, 0, 1, 2.04831e-06, 0, 0, 0.999999, 2.05428e-06, 0, 0, 0.999999, 2.07056e-06, 0, 0, 0.999997, 2.10581e-06, 0, 0, 0.999993, 2.1732e-06, 0, 0, 0.999987, 2.29365e-06, 0, 0, 0.999979, 2.50243e-06, 0, 0, 0.999965, 2.86127e-06, 0, 0, 0.999947, 3.48028e-06, 0, 0, 0.999918, 4.55588e-06, 0, 0, 0.999881, 6.43303e-06, 0, 0, 0.999828, 9.70064e-06, 0, 0, 0.999753, 1.53233e-05, 0, 0, 0.999642, 2.4793e-05, 0, 0, 0.999464, 4.02032e-05, 0, 0.000122947, 0.999089, 6.35852e-05, 0, 0.000807414, 0.997567, 8.57026e-05, 0, 0.00227206, 0.992903, 5.94912e-05, 0, 0.00462812, 0.990011, 5.78515e-05, 0, 0.00794162, 0.987192, 6.5399e-05, 0, 0.0122534, 0.98418, 8.19675e-05, 0, 0.0175888, 0.980491, 0.000105514, 0, 0.0239635, 0.974779, 0.000121532, 0, 0.031387, 0.96675, 0.000119144, 0, 0.0398644, 0.958248, 0.000136125, 0, 0.0493982, 0.948884, 0.000155408, 0, 0.0599896, 0.941673, 0.000162281, 0, 0.0716382, 0.934521, 0.000176754, 0, 0.0843437, 0.926205, 0.000192873, 0, 0.0981056, 0.916089, 0.000200038, 0, 0.112923, 0.904963, 0.000213624, 0, 0.128796, 0.892089, 0.000221834, 0, 0.145725, 0.878028, 0.000232619, 0, 0.163709, 0.86249, 0.000238632, 0, 0.182749, 0.846587, 0.000247002, 0, 0.202847, 0.830988, 0.000250702, 0, 0.224001, 0.814165, 0.000255562, 0, 0.246214, 0.796135, 0.000257505, 0, 0.269482, 0.777052, 0.000258625, 0, 0.293805, 0.757201, 0.000258398, 0, 0.319176, 0.737655, 0.000256714, 0, 0.345587, 0.717477, 0.000255187, 0, 0.373021, 0.696433, 0.000251792, 0, 0.401454, 0.675084, 0.000247223, 0, 0.430844, 0.653907, 0.000242213, 0, 0.461125, 0.632561, 0.000237397, 0, 0.492187, 0.610658, 0.000229313, 0, 0.52381, 0.589322, 0.000224402, 0, 0.555556, 0.567857, 0.000216116, 0, 0.587302, 0.54652, 0.000209124, 0, 0.619048, 0.525433, 0.000201601, 0, 0.650794, 0.504679, 0.000192957, 0, 0.68254, 0.484203, 0.000186052, 0, 0.714286, 0.464203, 0.000177672, 0, 0.746032, 0.444549, 0.000170005, 0, 0.777778, 0.425346, 0.000162401, 0, 0.809524, 0.406706, 0.0001544, 0, 0.84127, 0.388576, 0.000147437, 0, 0.873016, 0.37094, 0.000139493, 0, 0.904762, 0.353996, 0.000133219, 0, 0.936508, 0.337391, 0.000125573, 0, 0.968254, 0.321648, 0.000119867, 0, 1, 1, 3.62511e-06, 0, 0, 1, 3.62525e-06, 0, 0, 1, 3.62739e-06, 0, 0, 0.999999, 3.63673e-06, 0, 0, 0.999998, 3.66214e-06, 0, 0, 0.999996, 3.71698e-06, 0, 0, 0.999992, 3.82116e-06, 0, 0, 0.999986, 4.00554e-06, 0, 0, 0.999976, 4.32058e-06, 0, 0, 0.999961, 4.85194e-06, 0, 0, 0.999938, 5.74808e-06, 0, 0, 0.999908, 7.26643e-06, 0, 0, 0.999865, 9.84707e-06, 0, 0, 0.999807, 1.42217e-05, 0, 0, 0.999723, 2.15581e-05, 0, 0, 0.999602, 3.36114e-05, 0, 1.19113e-05, 0.999398, 5.27353e-05, 0, 0.000355813, 0.998946, 8.05809e-05, 0, 0.00137768, 0.996647, 9.42908e-05, 0, 0.00322469, 0.992298, 6.68733e-05, 0, 0.00597897, 0.989802, 7.16564e-05, 0, 0.00968903, 0.987019, 8.21355e-05, 0, 0.0143845, 0.984219, 0.000104555, 0, 0.0200831, 0.980425, 0.000131245, 0, 0.0267948, 0.974241, 0.000139613, 0, 0.034525, 0.967006, 0.000145931, 0, 0.0432757, 0.95893, 0.000167153, 0, 0.0530471, 0.949157, 0.000188146, 0, 0.0638386, 0.94062, 0.000194625, 0, 0.0756487, 0.933509, 0.000213721, 0, 0.0884762, 0.925088, 0.000229616, 0, 0.10232, 0.915178, 0.000239638, 0, 0.117178, 0.904093, 0.000254814, 0, 0.133051, 0.891337, 0.000263685, 0, 0.149939, 0.877326, 0.000274789, 0, 0.167841, 0.861794, 0.000280534, 0, 0.18676, 0.845758, 0.000289534, 0, 0.206696, 0.829792, 0.000294446, 0, 0.22765, 0.813037, 0.000296877, 0, 0.249625, 0.795285, 0.000300217, 0, 0.27262, 0.776323, 0.000299826, 0, 0.296636, 0.756673, 0.000299787, 0, 0.321671, 0.736856, 0.000297867, 0, 0.347718, 0.716883, 0.000294052, 0, 0.374768, 0.696089, 0.000289462, 0, 0.402804, 0.67505, 0.000285212, 0, 0.431796, 0.653509, 0.00027653, 0, 0.461695, 0.63258, 0.000271759, 0, 0.49242, 0.61104, 0.000262811, 0, 0.523822, 0.589567, 0.000255151, 0, 0.555556, 0.568322, 0.000246434, 0, 0.587302, 0.547235, 0.000237061, 0, 0.619048, 0.52616, 0.000228343, 0, 0.650794, 0.505716, 0.000219236, 0, 0.68254, 0.485274, 0.000209595, 0, 0.714286, 0.465411, 0.000201011, 0, 0.746032, 0.445854, 0.00019109, 0, 0.777778, 0.426911, 0.000182897, 0, 0.809524, 0.408222, 0.000173569, 0, 0.84127, 0.390307, 0.000165496, 0, 0.873016, 0.372624, 0.000156799, 0, 0.904762, 0.355804, 0.00014917, 0, 0.936508, 0.33924, 0.000140907, 0, 0.968254, 0.323534, 0.000134062, 0, 1, 1, 6.22487e-06, 0, 0, 1, 6.2251e-06, 0, 0, 1, 6.22837e-06, 0, 0, 0.999999, 6.24259e-06, 0, 0, 0.999998, 6.28127e-06, 0, 0, 0.999996, 6.36451e-06, 0, 0, 0.999991, 6.5218e-06, 0, 0, 0.999984, 6.79782e-06, 0, 0, 0.999973, 7.26361e-06, 0, 0, 0.999955, 8.03644e-06, 0, 0, 0.999931, 9.31397e-06, 0, 0, 0.999896, 1.14299e-05, 0, 0, 0.999847, 1.49402e-05, 0, 0, 0.999784, 2.07461e-05, 0, 0, 0.999692, 3.02493e-05, 0, 0, 0.999554, 4.54957e-05, 0, 9.97275e-05, 0.999326, 6.90762e-05, 0, 0.000724813, 0.998757, 0.000101605, 0, 0.0020972, 0.995367, 9.58745e-05, 0, 0.00432324, 0.99209, 8.32808e-05, 0, 0.00746347, 0.989517, 8.87601e-05, 0, 0.0115534, 0.987008, 0.00010564, 0, 0.0166134, 0.98421, 0.000133179, 0, 0.0226552, 0.98021, 0.000161746, 0, 0.0296838, 0.973676, 0.000161821, 0, 0.0377016, 0.967052, 0.000178635, 0, 0.0467079, 0.959385, 0.000206765, 0, 0.0567013, 0.949461, 0.00022476, 0, 0.0676796, 0.939578, 0.00023574, 0, 0.0796403, 0.932416, 0.00025893, 0, 0.0925812, 0.923759, 0.000271228, 0, 0.106501, 0.914223, 0.000289165, 0, 0.121397, 0.902942, 0.000301156, 0, 0.13727, 0.890419, 0.000313852, 0, 0.15412, 0.876639, 0.000324408, 0, 0.171946, 0.861316, 0.00033249, 0, 0.190751, 0.84496, 0.000338497, 0, 0.210537, 0.828427, 0.000345861, 0, 0.231305, 0.811871, 0.000347863, 0, 0.253057, 0.794397, 0.000350225, 0, 0.275797, 0.775726, 0.000349915, 0, 0.299525, 0.75617, 0.000347297, 0, 0.324242, 0.736091, 0.000344232, 0, 0.349947, 0.716213, 0.000340835, 0, 0.376633, 0.695736, 0.000332369, 0, 0.404289, 0.674961, 0.000327943, 0, 0.432895, 0.653518, 0.000318533, 0, 0.462415, 0.632574, 0.000310391, 0, 0.492788, 0.61134, 0.000300755, 0, 0.523909, 0.590017, 0.000290506, 0, 0.555556, 0.568752, 0.000280446, 0, 0.587302, 0.548061, 0.000269902, 0, 0.619048, 0.52711, 0.000258815, 0, 0.650794, 0.506682, 0.000248481, 0, 0.68254, 0.486524, 0.000237141, 0, 0.714286, 0.466812, 0.000226872, 0, 0.746032, 0.44732, 0.000216037, 0, 0.777778, 0.428473, 0.000205629, 0, 0.809524, 0.409921, 0.000195691, 0, 0.84127, 0.392028, 0.000185457, 0, 0.873016, 0.374606, 0.000176436, 0, 0.904762, 0.357601, 0.000166508, 0, 0.936508, 0.341348, 0.000158385, 0, 0.968254, 0.32542, 0.000149203, 0, 1, 1, 1.03967e-05, 0, 0, 1, 1.0397e-05, 0, 0, 1, 1.04019e-05, 0, 0, 0.999999, 1.04231e-05, 0, 0, 0.999998, 1.04806e-05, 0, 0, 0.999995, 1.06042e-05, 0, 0, 0.999991, 1.08366e-05, 0, 0, 0.999982, 1.12415e-05, 0, 0, 0.999968, 1.19174e-05, 0, 0, 0.99995, 1.30227e-05, 0, 0, 0.999922, 1.48176e-05, 0, 0, 0.999884, 1.77303e-05, 0, 0, 0.99983, 2.24564e-05, 0, 0, 0.999758, 3.00966e-05, 0, 0, 0.999654, 4.23193e-05, 0, 5.49083e-06, 0.999503, 6.14848e-05, 0, 0.000296087, 0.999237, 9.03576e-05, 0, 0.00123144, 0.998491, 0.0001271, 0, 0.00295954, 0.994594, 0.000107754, 0, 0.00555829, 0.99178, 0.000103025, 0, 0.00907209, 0.989265, 0.00011154, 0, 0.0135257, 0.986998, 0.000136296, 0, 0.0189327, 0.984137, 0.000169154, 0, 0.0252993, 0.979798, 0.000196671, 0, 0.0326272, 0.97337, 0.000196678, 0, 0.0409157, 0.967239, 0.000223121, 0, 0.0501623, 0.959543, 0.000253809, 0, 0.0603638, 0.949466, 0.000265972, 0, 0.0715171, 0.939074, 0.000288372, 0, 0.0836187, 0.931118, 0.000310983, 0, 0.0966657, 0.922525, 0.000325561, 0, 0.110656, 0.912983, 0.000345725, 0, 0.125588, 0.901617, 0.0003556, 0, 0.141461, 0.889487, 0.000374012, 0, 0.158275, 0.875787, 0.000383445, 0, 0.176031, 0.860654, 0.000393972, 0, 0.19473, 0.844417, 0.000400311, 0, 0.214374, 0.82741, 0.000405004, 0, 0.234967, 0.810545, 0.000407378, 0, 0.256512, 0.793312, 0.000407351, 0, 0.279011, 0.774847, 0.000406563, 0, 0.302468, 0.755621, 0.000404903, 0, 0.326887, 0.735511, 0.000397486, 0, 0.352266, 0.715435, 0.00039357, 0, 0.378605, 0.695403, 0.000384739, 0, 0.405897, 0.674681, 0.000376108, 0, 0.43413, 0.65359, 0.000365997, 0, 0.463277, 0.632471, 0.000354957, 0, 0.493295, 0.61151, 0.000343593, 0, 0.524106, 0.59064, 0.000331841, 0, 0.555561, 0.569386, 0.000318891, 0, 0.587302, 0.548785, 0.0003072, 0, 0.619048, 0.528146, 0.00029361, 0, 0.650794, 0.507872, 0.000281709, 0, 0.68254, 0.487805, 0.000268627, 0, 0.714286, 0.468196, 0.000255887, 0, 0.746032, 0.448922, 0.000243997, 0, 0.777778, 0.430093, 0.000231662, 0, 0.809524, 0.411845, 0.000220339, 0, 0.84127, 0.393808, 0.000208694, 0, 0.873016, 0.376615, 0.000198045, 0, 0.904762, 0.359655, 0.000187375, 0, 0.936508, 0.343452, 0.000177371, 0, 0.968254, 0.32765, 0.000167525, 0, 1, 1, 1.69351e-05, 0, 0, 1, 1.69356e-05, 0, 0, 1, 1.69427e-05, 0, 0, 0.999999, 1.69736e-05, 0, 0, 0.999998, 1.70575e-05, 0, 0, 0.999995, 1.72372e-05, 0, 0, 0.99999, 1.75739e-05, 0, 0, 0.999979, 1.81568e-05, 0, 0, 0.999966, 1.91206e-05, 0, 0, 0.999944, 2.0677e-05, 0, 0, 0.999912, 2.31644e-05, 0, 0, 0.999869, 2.71268e-05, 0, 0, 0.999811, 3.34272e-05, 0, 0, 0.99973, 4.33979e-05, 0, 0, 0.999617, 5.90083e-05, 0, 6.80315e-05, 0.999445, 8.29497e-05, 0, 0.000612796, 0.999138, 0.000118019, 0, 0.00187408, 0.998095, 0.000156712, 0, 0.00395791, 0.993919, 0.000125054, 0, 0.00692144, 0.991333, 0.000126091, 0, 0.0107962, 0.989226, 0.000144912, 0, 0.0155986, 0.986954, 0.000175737, 0, 0.0213364, 0.983982, 0.000213883, 0, 0.0280114, 0.979128, 0.000234526, 0, 0.0356226, 0.973327, 0.000243725, 0, 0.0441668, 0.967416, 0.0002773, 0, 0.0536399, 0.959729, 0.000308799, 0, 0.0640376, 0.949758, 0.000322447, 0, 0.0753554, 0.939173, 0.000350021, 0, 0.0875893, 0.9296, 0.000370089, 0, 0.100736, 0.921181, 0.000391365, 0, 0.114793, 0.91164, 0.000413636, 0, 0.129759, 0.900435, 0.000427068, 0, 0.145632, 0.888183, 0.000441046, 0, 0.162412, 0.874772, 0.000454968, 0, 0.180101, 0.859566, 0.000461882, 0, 0.1987, 0.843579, 0.000471556, 0, 0.218213, 0.826453, 0.000474335, 0, 0.238641, 0.809164, 0.000477078, 0, 0.259989, 0.792179, 0.00047755, 0, 0.282262, 0.773866, 0.000472573, 0, 0.305464, 0.754944, 0.000469765, 0, 0.329599, 0.735133, 0.000462371, 0, 0.35467, 0.714858, 0.000453674, 0, 0.380678, 0.694829, 0.000443888, 0, 0.407622, 0.674453, 0.000432052, 0, 0.435493, 0.653685, 0.000420315, 0, 0.464275, 0.632666, 0.000406829, 0, 0.493938, 0.611676, 0.000392234, 0, 0.524422, 0.591193, 0.000379208, 0, 0.555624, 0.570145, 0.00036319, 0, 0.587302, 0.549566, 0.000349111, 0, 0.619048, 0.529278, 0.000334166, 0, 0.650794, 0.509026, 0.000318456, 0, 0.68254, 0.489186, 0.00030449, 0, 0.714286, 0.469662, 0.000289051, 0, 0.746032, 0.450691, 0.000275494, 0, 0.777778, 0.431841, 0.000261437, 0, 0.809524, 0.413752, 0.000247846, 0, 0.84127, 0.395951, 0.000235085, 0, 0.873016, 0.378633, 0.000222245, 0, 0.904762, 0.36194, 0.000210533, 0, 0.936508, 0.345599, 0.000198494, 0, 0.968254, 0.329999, 0.000188133, 0, 1, 1, 2.69663e-05, 0, 0, 1, 2.6967e-05, 0, 0, 1, 2.69772e-05, 0, 0, 0.999999, 2.70214e-05, 0, 0, 0.999998, 2.71415e-05, 0, 0, 0.999994, 2.7398e-05, 0, 0, 0.999988, 2.78771e-05, 0, 0, 0.999977, 2.87019e-05, 0, 0, 0.999961, 3.00544e-05, 0, 0, 0.999937, 3.22138e-05, 0, 0, 0.999904, 3.56163e-05, 0, 0, 0.999854, 4.09465e-05, 0, 0, 0.99979, 4.92651e-05, 0, 0, 0.999699, 6.21722e-05, 0, 8.8288e-07, 0.999572, 8.19715e-05, 0, 0.000223369, 0.999381, 0.000111689, 0, 0.00105414, 0.999016, 0.000153862, 0, 0.0026493, 0.997437, 0.000187667, 0, 0.00508608, 0.993545, 0.000155672, 0, 0.00840554, 0.991135, 0.000161455, 0, 0.012629, 0.989157, 0.000188241, 0, 0.0177661, 0.986874, 0.000226229, 0, 0.0238198, 0.983714, 0.000268668, 0, 0.0307887, 0.978301, 0.000277109, 0, 0.0386688, 0.973227, 0.000303446, 0, 0.0474554, 0.967317, 0.000341851, 0, 0.0571428, 0.959477, 0.000370885, 0, 0.0677256, 0.950012, 0.000392753, 0, 0.0791988, 0.939484, 0.00042781, 0, 0.0915576, 0.928135, 0.000443866, 0, 0.104798, 0.919819, 0.000472959, 0, 0.118918, 0.910049, 0.000491551, 0, 0.133915, 0.899181, 0.000512616, 0, 0.149788, 0.886881, 0.000523563, 0, 0.166537, 0.87359, 0.000540183, 0, 0.184164, 0.858613, 0.000547386, 0, 0.202669, 0.842809, 0.000554809, 0, 0.222056, 0.825727, 0.000558316, 0, 0.242329, 0.808086, 0.000557824, 0, 0.263492, 0.790728, 0.000556346, 0, 0.285551, 0.772987, 0.000552672, 0, 0.30851, 0.7541, 0.000543738, 0, 0.332376, 0.734669, 0.000536107, 0, 0.357153, 0.714411, 0.000523342, 0, 0.382845, 0.694196, 0.000512238, 0, 0.409454, 0.674252, 0.000497465, 0, 0.436977, 0.65357, 0.000481096, 0, 0.465404, 0.632999, 0.000467054, 0, 0.494713, 0.611994, 0.000448771, 0, 0.524864, 0.591604, 0.000431889, 0, 0.555779, 0.571134, 0.000415238, 0, 0.587302, 0.550528, 0.000396369, 0, 0.619048, 0.530292, 0.000379477, 0, 0.650794, 0.510364, 0.000361488, 0, 0.68254, 0.490749, 0.000343787, 0, 0.714286, 0.471266, 0.000327822, 0, 0.746032, 0.452462, 0.000310626, 0, 0.777778, 0.433907, 0.000295352, 0, 0.809524, 0.415659, 0.000279179, 0, 0.84127, 0.398138, 0.000264685, 0, 0.873016, 0.380833, 0.000249905, 0, 0.904762, 0.364247, 0.000236282, 0, 0.936508, 0.348041, 0.000222905, 0, 0.968254, 0.332389, 0.000210522, 0, 1, 1, 4.20604e-05, 0, 0, 1, 4.20614e-05, 0, 0, 1, 4.20757e-05, 0, 0, 0.999999, 4.2138e-05, 0, 0, 0.999997, 4.23067e-05, 0, 0, 0.999993, 4.26668e-05, 0, 0, 0.999986, 4.33372e-05, 0, 0, 0.999974, 4.44857e-05, 0, 0, 0.999956, 4.63554e-05, 0, 0, 0.99993, 4.93105e-05, 0, 0, 0.999892, 5.39077e-05, 0, 0, 0.999838, 6.10005e-05, 0, 0, 0.999767, 7.18822e-05, 0, 0, 0.999666, 8.84581e-05, 0, 3.65471e-05, 0.999525, 0.000113398, 0, 0.000485623, 0.999311, 0.000150043, 0, 0.00162096, 0.998865, 0.000200063, 0, 0.00355319, 0.996278, 0.000211014, 0, 0.00633818, 0.992956, 0.000189672, 0, 0.0100043, 0.991017, 0.000210262, 0, 0.0145648, 0.989055, 0.000244292, 0, 0.0200237, 0.986741, 0.000290481, 0, 0.0263798, 0.983288, 0.000334303, 0, 0.033629, 0.977784, 0.000340307, 0, 0.0417652, 0.973037, 0.000377864, 0, 0.0507821, 0.967181, 0.0004239, 0, 0.060673, 0.958971, 0.000443854, 0, 0.0714314, 0.950093, 0.000483039, 0, 0.0830518, 0.939552, 0.000517934, 0, 0.0955288, 0.927678, 0.000539449, 0, 0.108859, 0.918278, 0.000568604, 0, 0.123038, 0.908449, 0.000588505, 0, 0.138065, 0.897713, 0.000612473, 0, 0.153938, 0.885533, 0.000625575, 0, 0.170657, 0.872131, 0.00063854, 0, 0.188224, 0.857517, 0.000647034, 0, 0.20664, 0.841796, 0.00065209, 0, 0.225909, 0.824726, 0.0006544, 0, 0.246035, 0.807297, 0.000655744, 0, 0.267022, 0.789058, 0.000646716, 0, 0.288878, 0.77189, 0.000643898, 0, 0.311607, 0.753082, 0.000629973, 0, 0.335216, 0.7341, 0.000621564, 0, 0.359713, 0.714094, 0.000605171, 0, 0.385103, 0.693839, 0.000588752, 0, 0.41139, 0.673891, 0.000573294, 0, 0.438576, 0.653565, 0.000552682, 0, 0.466656, 0.633326, 0.000533446, 0, 0.495617, 0.612582, 0.000514635, 0, 0.525431, 0.59205, 0.00049303, 0, 0.556041, 0.571918, 0.000471842, 0, 0.587338, 0.551572, 0.000451713, 0, 0.619048, 0.531553, 0.000430049, 0, 0.650794, 0.51175, 0.000410445, 0, 0.68254, 0.49238, 0.000390098, 0, 0.714286, 0.473143, 0.000370033, 0, 0.746032, 0.45423, 0.000351205, 0, 0.777778, 0.435963, 0.000332049, 0, 0.809524, 0.41787, 0.000315021, 0, 0.84127, 0.400387, 0.000297315, 0, 0.873016, 0.383332, 0.000281385, 0, 0.904762, 0.366665, 0.000265397, 0, 0.936508, 0.350633, 0.000250601, 0, 0.968254, 0.334964, 0.00023589, 0, 1, 1, 6.43736e-05, 0, 0, 1, 6.4375e-05, 0, 0, 1, 6.43947e-05, 0, 0, 0.999999, 6.4481e-05, 0, 0, 0.999997, 6.47143e-05, 0, 0, 0.999994, 6.52119e-05, 0, 0, 0.999985, 6.61359e-05, 0, 0, 0.999972, 6.77116e-05, 0, 0, 0.999952, 7.02599e-05, 0, 0, 0.999922, 7.42517e-05, 0, 0, 0.99988, 8.03906e-05, 0, 0, 0.99982, 8.97315e-05, 0, 0, 0.999741, 0.000103838, 0, 0, 0.999629, 0.00012496, 0, 0.000149024, 0.999474, 0.000156161, 0, 0.000861027, 0.999229, 0.000201034, 0, 0.00231198, 0.998662, 0.000259069, 0, 0.00458147, 0.995299, 0.000245439, 0, 0.00770895, 0.992732, 0.00024498, 0, 0.0117126, 0.990847, 0.000273211, 0, 0.0165989, 0.988911, 0.000316492, 0, 0.0223674, 0.98654, 0.00037161, 0, 0.0290135, 0.982636, 0.000410352, 0, 0.0365309, 0.977346, 0.000421756, 0, 0.0449117, 0.972909, 0.000475578, 0, 0.0541481, 0.966821, 0.000522482, 0, 0.0642326, 0.958686, 0.000545008, 0, 0.075158, 0.949754, 0.000589286, 0, 0.0869181, 0.939184, 0.000619995, 0, 0.0995074, 0.927505, 0.000654266, 0, 0.112922, 0.916606, 0.000682362, 0, 0.127157, 0.906707, 0.000704286, 0, 0.142212, 0.895937, 0.000725909, 0, 0.158085, 0.883913, 0.000743939, 0, 0.174776, 0.870642, 0.000755157, 0, 0.192287, 0.856241, 0.000764387, 0, 0.210619, 0.84069, 0.000771032, 0, 0.229775, 0.823728, 0.000765906, 0, 0.249761, 0.806481, 0.000767604, 0, 0.270582, 0.787924, 0.000754385, 0, 0.292243, 0.770588, 0.000749668, 0, 0.314753, 0.751991, 0.000731613, 0, 0.338118, 0.733407, 0.000717655, 0, 0.362347, 0.713688, 0.000700604, 0, 0.387447, 0.693595, 0.000678765, 0, 0.413424, 0.673426, 0.000657042, 0, 0.440284, 0.65359, 0.000635892, 0, 0.468027, 0.633576, 0.000611569, 0, 0.496645, 0.613144, 0.000586011, 0, 0.526122, 0.592711, 0.000563111, 0, 0.556417, 0.572722, 0.000537699, 0, 0.587451, 0.552762, 0.000512556, 0, 0.619048, 0.532985, 0.000489757, 0, 0.650794, 0.513219, 0.000464139, 0, 0.68254, 0.493992, 0.000442193, 0, 0.714286, 0.47509, 0.000418629, 0, 0.746032, 0.456287, 0.000397045, 0, 0.777778, 0.438152, 0.000375504, 0, 0.809524, 0.420294, 0.00035492, 0, 0.84127, 0.402749, 0.000335327, 0, 0.873016, 0.385879, 0.000316422, 0, 0.904762, 0.369352, 0.000298333, 0, 0.936508, 0.353301, 0.000281417, 0, 0.968254, 0.337781, 0.000265203, 0, 1, 1, 9.68267e-05, 0, 0, 1, 9.68284e-05, 0, 0, 1, 9.68556e-05, 0, 0, 0.999999, 9.69733e-05, 0, 0, 0.999997, 9.72913e-05, 0, 0, 0.999993, 9.79688e-05, 0, 0, 0.999984, 9.92239e-05, 0, 0, 0.999969, 0.000101356, 0, 0, 0.999946, 0.000104784, 0, 0, 0.999913, 0.000110111, 0, 0, 0.999868, 0.000118217, 0, 0, 0.999801, 0.000130396, 0, 0, 0.999712, 0.000148523, 0, 1.24907e-05, 0.999589, 0.000175233, 0, 0.000355405, 0.999416, 0.000213999, 0, 0.0013528, 0.999136, 0.000268529, 0, 0.00312557, 0.998367, 0.000333088, 0, 0.00573045, 0.994701, 0.000304757, 0, 0.00919397, 0.992497, 0.000318031, 0, 0.0135261, 0.990608, 0.000353863, 0, 0.0187278, 0.988715, 0.000409044, 0, 0.0247947, 0.986241, 0.000472967, 0, 0.0317196, 0.981696, 0.000495104, 0, 0.039494, 0.977097, 0.000532873, 0, 0.0481087, 0.972583, 0.000594447, 0, 0.0575549, 0.966142, 0.000636867, 0, 0.0678242, 0.95823, 0.000669899, 0, 0.0789089, 0.949677, 0.000719499, 0, 0.0908023, 0.939226, 0.000750584, 0, 0.103499, 0.927501, 0.000793183, 0, 0.116993, 0.915199, 0.00081995, 0, 0.131282, 0.90498, 0.000847654, 0, 0.146364, 0.894243, 0.000868929, 0, 0.162237, 0.882154, 0.000884278, 0, 0.178902, 0.869161, 0.000898108, 0, 0.196358, 0.854751, 0.000901254, 0, 0.21461, 0.839368, 0.00090679, 0, 0.23366, 0.822874, 0.000901541, 0, 0.253512, 0.805514, 0.000897297, 0, 0.274174, 0.78716, 0.000881856, 0, 0.29565, 0.769061, 0.000870032, 0, 0.31795, 0.751, 0.000851719, 0, 0.341081, 0.732614, 0.000830671, 0, 0.365053, 0.713171, 0.000806569, 0, 0.389874, 0.693472, 0.00078338, 0, 0.415553, 0.673528, 0.000756404, 0, 0.442098, 0.653397, 0.000726872, 0, 0.469512, 0.633781, 0.000700494, 0, 0.497794, 0.613877, 0.00067105, 0, 0.526935, 0.593506, 0.000640361, 0, 0.556908, 0.573667, 0.000613502, 0, 0.587657, 0.553932, 0.000583177, 0, 0.61906, 0.534345, 0.000554375, 0, 0.650794, 0.515042, 0.000527811, 0, 0.68254, 0.495674, 0.000499367, 0, 0.714286, 0.477132, 0.00047429, 0, 0.746032, 0.458609, 0.000447726, 0, 0.777778, 0.440354, 0.000424205, 0, 0.809524, 0.422765, 0.000399549, 0, 0.84127, 0.405472, 0.000378315, 0, 0.873016, 0.388482, 0.000355327, 0, 0.904762, 0.372191, 0.000336122, 0, 0.936508, 0.356099, 0.000315247, 0, 0.968254, 0.340737, 0.00029794, 0, 1, 1, 0.000143327, 0, 0, 1, 0.00014333, 0, 0, 1, 0.000143366, 0, 0, 0.999999, 0.000143524, 0, 0, 0.999996, 0.000143952, 0, 0, 0.999991, 0.000144862, 0, 0, 0.999981, 0.000146544, 0, 0, 0.999966, 0.000149391, 0, 0, 0.999941, 0.000153946, 0, 0, 0.999905, 0.000160971, 0, 0, 0.999852, 0.000171562, 0, 0, 0.99978, 0.00018729, 0, 0, 0.999681, 0.000210386, 0, 8.26239e-05, 0.999546, 0.000243906, 0, 0.000664807, 0.999352, 0.000291739, 0, 0.00196192, 0.999027, 0.000357419, 0, 0.00405941, 0.997886, 0.000422349, 0, 0.00699664, 0.99419, 0.000385008, 0, 0.0107896, 0.99214, 0.000409775, 0, 0.0154415, 0.990274, 0.000456418, 0, 0.0209488, 0.988455, 0.000527008, 0, 0.0273037, 0.985804, 0.000597685, 0, 0.0344969, 0.98103, 0.000613124, 0, 0.0425183, 0.976674, 0.000668321, 0, 0.0513575, 0.972021, 0.000736985, 0, 0.0610046, 0.965274, 0.000773789, 0, 0.0714508, 0.958046, 0.000830852, 0, 0.0826877, 0.949333, 0.000875766, 0, 0.0947085, 0.939135, 0.000917088, 0, 0.107507, 0.927119, 0.000952244, 0, 0.121078, 0.91469, 0.000990626, 0, 0.135419, 0.903006, 0.00101304, 0, 0.150526, 0.892368, 0.00103834, 0, 0.166399, 0.880231, 0.00105002, 0, 0.183038, 0.867432, 0.00106331, 0, 0.200443, 0.853208, 0.00106783, 0, 0.218618, 0.837956, 0.00106458, 0, 0.237566, 0.821772, 0.00105945, 0, 0.257291, 0.804328, 0.00104685, 0, 0.2778, 0.786465, 0.00103178, 0, 0.2991, 0.768004, 0.00101077, 0, 0.321199, 0.74972, 0.000985504, 0, 0.344106, 0.731682, 0.000962893, 0, 0.36783, 0.712813, 0.000932146, 0, 0.392383, 0.693139, 0.00089871, 0, 0.417774, 0.673566, 0.000869678, 0, 0.444013, 0.653483, 0.000835525, 0, 0.471107, 0.633891, 0.000799853, 0, 0.49906, 0.614433, 0.000766838, 0, 0.527869, 0.594586, 0.000732227, 0, 0.557517, 0.574769, 0.000696442, 0, 0.587966, 0.555149, 0.000663935, 0, 0.61913, 0.535898, 0.000629826, 0, 0.650794, 0.516753, 0.000596486, 0, 0.68254, 0.497816, 0.000567078, 0, 0.714286, 0.479034, 0.000534399, 0, 0.746032, 0.460975, 0.000507013, 0, 0.777778, 0.442935, 0.000477421, 0, 0.809524, 0.425263, 0.000451101, 0, 0.84127, 0.408248, 0.000424964, 0, 0.873016, 0.391339, 0.00039993, 0, 0.904762, 0.37513, 0.000377619, 0, 0.936508, 0.359172, 0.000354418, 0, 0.968254, 0.343876, 0.000334823, 0, 1, 1, 0.000209042, 0, 0, 1, 0.000209045, 0, 0, 1, 0.000209093, 0, 0, 0.999999, 0.000209304, 0, 0, 0.999996, 0.000209871, 0, 0, 0.999991, 0.000211078, 0, 0, 0.999979, 0.000213304, 0, 0, 0.999963, 0.000217061, 0, 0, 0.999933, 0.000223042, 0, 0, 0.999894, 0.000232206, 0, 0, 0.999837, 0.000245901, 0, 0, 0.999756, 0.000266023, 0, 1.02927e-06, 0.999648, 0.000295204, 0, 0.000233468, 0.999499, 0.000336958, 0, 0.00108237, 0.999283, 0.000395563, 0, 0.00268832, 0.998896, 0.000473785, 0, 0.00511138, 0.997006, 0.000520008, 0, 0.00837705, 0.993819, 0.000497261, 0, 0.0124928, 0.991632, 0.000523722, 0, 0.0174561, 0.989875, 0.000587258, 0, 0.0232596, 0.988109, 0.000676329, 0, 0.0298932, 0.985155, 0.000747701, 0, 0.0373453, 0.980479, 0.000768803, 0, 0.0456045, 0.976271, 0.000841054, 0, 0.0546593, 0.971347, 0.000911469, 0, 0.0644994, 0.964528, 0.000953057, 0, 0.0751152, 0.957632, 0.00102221, 0, 0.0864981, 0.948681, 0.00106122, 0, 0.0986407, 0.938716, 0.00111857, 0, 0.111537, 0.926629, 0.00114762, 0, 0.125182, 0.914025, 0.00118995, 0, 0.139571, 0.901026, 0.00121228, 0, 0.154703, 0.890358, 0.00123946, 0, 0.170576, 0.878283, 0.0012527, 0, 0.18719, 0.865459, 0.00125536, 0, 0.204547, 0.851407, 0.00126134, 0, 0.222648, 0.836276, 0.00124759, 0, 0.241498, 0.820436, 0.00124443, 0, 0.261101, 0.803253, 0.00122071, 0, 0.281465, 0.785562, 0.00120107, 0, 0.302595, 0.76718, 0.00117762, 0, 0.324501, 0.748551, 0.00114289, 0, 0.347192, 0.730564, 0.00110872, 0, 0.370679, 0.712253, 0.00107636, 0, 0.394973, 0.692867, 0.00103646, 0, 0.420085, 0.673695, 0.000996793, 0, 0.446027, 0.653912, 0.00095675, 0, 0.47281, 0.634129, 0.000916739, 0, 0.500441, 0.615004, 0.000874401, 0, 0.528921, 0.595587, 0.000833411, 0, 0.558244, 0.575965, 0.000794556, 0, 0.588384, 0.5566, 0.00075196, 0, 0.619281, 0.537428, 0.000716381, 0, 0.650795, 0.518623, 0.000676558, 0, 0.68254, 0.499964, 0.00064074, 0, 0.714286, 0.481356, 0.000605984, 0, 0.746032, 0.463279, 0.000570256, 0, 0.777778, 0.445673, 0.000540138, 0, 0.809524, 0.428032, 0.000507299, 0, 0.84127, 0.411112, 0.000479553, 0, 0.873016, 0.394444, 0.000450737, 0, 0.904762, 0.378247, 0.000424269, 0, 0.936508, 0.362415, 0.000399111, 0, 0.968254, 0.347103, 0.000375274, 0, 1, 1, 0.000300729, 0, 0, 1, 0.000300733, 0, 0, 1, 0.000300797, 0, 0, 0.999998, 0.000301072, 0, 0, 0.999996, 0.000301817, 0, 0, 0.999989, 0.000303398, 0, 0, 0.999977, 0.000306309, 0, 0, 0.999958, 0.000311209, 0, 0, 0.999927, 0.000318975, 0, 0, 0.999884, 0.000330804, 0, 0, 0.99982, 0.00034834, 0, 0, 0.999733, 0.000373854, 0, 3.26995e-05, 0.999613, 0.000410424, 0, 0.000477174, 0.999447, 0.000462047, 0, 0.00161099, 0.999204, 0.000533322, 0, 0.00353153, 0.998725, 0.000624964, 0, 0.00627965, 0.995871, 0.000631786, 0, 0.0098693, 0.993194, 0.000632017, 0, 0.0143011, 0.991541, 0.00068923, 0, 0.019568, 0.989773, 0.000766892, 0, 0.0256593, 0.987647, 0.000863668, 0, 0.0325625, 0.984193, 0.000922089, 0, 0.0402647, 0.980016, 0.000970749, 0, 0.0487532, 0.975859, 0.00106027, 0, 0.058016, 0.970514, 0.00112239, 0, 0.0680419, 0.963625, 0.00117212, 0, 0.0788208, 0.956959, 0.00125211, 0, 0.0903439, 0.947956, 0.00129411, 0, 0.102604, 0.93809, 0.00135879, 0, 0.115594, 0.92659, 0.00139309, 0, 0.129309, 0.913829, 0.00143253, 0, 0.143745, 0.90005, 0.00145809, 0, 0.158901, 0.888129, 0.0014748, 0, 0.174774, 0.87607, 0.00148756, 0, 0.191365, 0.863461, 0.00148714, 0, 0.208674, 0.849594, 0.00148892, 0, 0.226705, 0.834531, 0.00146496, 0, 0.245461, 0.81903, 0.0014579, 0, 0.264947, 0.802122, 0.00143039, 0, 0.28517, 0.78445, 0.00139717, 0, 0.306137, 0.766434, 0.00136312, 0, 0.327857, 0.747816, 0.00132597, 0, 0.350341, 0.729519, 0.00128323, 0, 0.373598, 0.711454, 0.00123803, 0, 0.397642, 0.692699, 0.00119097, 0, 0.422485, 0.673723, 0.00114565, 0, 0.448139, 0.654386, 0.00109552, 0, 0.474619, 0.634673, 0.00104553, 0, 0.501933, 0.615554, 0.00099985, 0, 0.530089, 0.596462, 0.000948207, 0, 0.559087, 0.577385, 0.000902299, 0, 0.588913, 0.558257, 0.000856448, 0, 0.619525, 0.5392, 0.000810395, 0, 0.650826, 0.520543, 0.000768558, 0, 0.68254, 0.502206, 0.0007239, 0, 0.714286, 0.48402, 0.000685794, 0, 0.746032, 0.465779, 0.00064471, 0, 0.777778, 0.448455, 0.000609583, 0, 0.809524, 0.431091, 0.00057227, 0, 0.84127, 0.414147, 0.00054042, 0, 0.873016, 0.39765, 0.000506545, 0, 0.904762, 0.381576, 0.000477635, 0, 0.936508, 0.365881, 0.000448446, 0, 0.968254, 0.350582, 0.000421424, 0, 1, 1, 0.000427144, 0, 0, 1, 0.000427151, 0, 0, 1, 0.000427232, 0, 0, 0.999998, 0.00042759, 0, 0, 0.999995, 0.000428555, 0, 0, 0.999988, 0.000430603, 0, 0, 0.999976, 0.000434368, 0, 0, 0.999952, 0.000440688, 0, 0, 0.999919, 0.000450667, 0, 0, 0.999871, 0.00046578, 0, 0, 0.999801, 0.000488024, 0, 0, 0.999704, 0.000520092, 0, 0.000129791, 0.999572, 0.000565553, 0, 0.000821056, 0.999389, 0.000628906, 0, 0.00225241, 0.999114, 0.000714911, 0, 0.00449109, 0.998488, 0.000819218, 0, 0.00756249, 0.995234, 0.00080415, 0, 0.0114716, 0.993021, 0.000830181, 0, 0.0162131, 0.991407, 0.000902645, 0, 0.021776, 0.989625, 0.000996934, 0, 0.0281471, 0.987064, 0.00109707, 0, 0.0353118, 0.983265, 0.00114353, 0, 0.0432562, 0.979535, 0.0012272, 0, 0.0519665, 0.975224, 0.00132642, 0, 0.0614298, 0.969574, 0.00138092, 0, 0.0716348, 0.963021, 0.00145896, 0, 0.0825709, 0.956046, 0.00152834, 0, 0.094229, 0.947136, 0.00158217, 0, 0.106602, 0.937313, 0.0016347, 0, 0.119682, 0.926073, 0.00168383, 0, 0.133465, 0.913121, 0.00171627, 0, 0.147947, 0.899165, 0.00174229, 0, 0.163125, 0.885891, 0.00176137, 0, 0.178998, 0.873783, 0.00176406, 0, 0.195566, 0.861331, 0.00176156, 0, 0.21283, 0.847569, 0.00175346, 0, 0.230793, 0.832785, 0.00172753, 0, 0.249459, 0.817442, 0.00170204, 0, 0.268832, 0.800613, 0.00166576, 0, 0.28892, 0.783597, 0.00162909, 0, 0.30973, 0.76571, 0.0015826, 0, 0.331271, 0.747021, 0.00153106, 0, 0.353554, 0.728593, 0.00148036, 0, 0.37659, 0.710661, 0.00142808, 0, 0.400391, 0.692426, 0.00136906, 0, 0.424973, 0.673623, 0.00131066, 0, 0.450347, 0.65494, 0.00125569, 0, 0.476531, 0.635448, 0.00119517, 0, 0.503535, 0.616221, 0.00113828, 0, 0.531372, 0.597531, 0.0010816, 0, 0.560047, 0.578795, 0.00102673, 0, 0.589554, 0.559892, 0.000970985, 0, 0.619869, 0.541307, 0.000919773, 0, 0.650923, 0.522608, 0.000868479, 0, 0.68254, 0.504484, 0.00082137, 0, 0.714286, 0.486603, 0.000772916, 0, 0.746032, 0.468802, 0.000730353, 0, 0.777778, 0.451172, 0.000684955, 0, 0.809524, 0.434348, 0.000647565, 0, 0.84127, 0.417445, 0.000605863, 0, 0.873016, 0.401077, 0.000571885, 0, 0.904762, 0.385039, 0.000536034, 0, 0.936508, 0.369483, 0.000504227, 0, 0.968254, 0.354272, 0.000473165, 0, 1, 1, 0.000599525, 0, 0, 1, 0.000599533, 0, 0, 1, 0.000599639, 0, 0, 0.999998, 0.000600097, 0, 0, 0.999994, 0.000601336, 0, 0, 0.999987, 0.000603958, 0, 0, 0.999972, 0.000608775, 0, 0, 0.999949, 0.000616842, 0, 0, 0.999912, 0.000629534, 0, 0, 0.999857, 0.000648658, 0, 0, 0.999781, 0.000676615, 0, 5.38873e-06, 0.999674, 0.000716574, 0, 0.000308602, 0.999528, 0.000772641, 0, 0.00127003, 0.999326, 0.000849806, 0, 0.00300783, 0.999009, 0.000952682, 0, 0.00556637, 0.998112, 0.00106394, 0, 0.00895889, 0.994496, 0.00102228, 0, 0.0131827, 0.992806, 0.00108586, 0, 0.0182277, 0.991211, 0.0011759, 0, 0.0240795, 0.989415, 0.00128955, 0, 0.030723, 0.986499, 0.00139038, 0, 0.0381418, 0.982679, 0.00144539, 0, 0.046321, 0.978839, 0.00153954, 0, 0.0552459, 0.974295, 0.00164417, 0, 0.0649034, 0.968784, 0.00171517, 0, 0.0752814, 0.962324, 0.00180282, 0, 0.0863693, 0.954956, 0.00186387, 0, 0.0981578, 0.94624, 0.00193817, 0, 0.110639, 0.936517, 0.00198156, 0, 0.123806, 0.925186, 0.00203042, 0, 0.137655, 0.91252, 0.0020664, 0, 0.15218, 0.898441, 0.00207822, 0, 0.16738, 0.884394, 0.0020992, 0, 0.183253, 0.871273, 0.00208748, 0, 0.199799, 0.859057, 0.00208686, 0, 0.21702, 0.845243, 0.00205519, 0, 0.234918, 0.830723, 0.00202868, 0, 0.253496, 0.815801, 0.00199501, 0, 0.272761, 0.79914, 0.00194193, 0, 0.292719, 0.782372, 0.00188824, 0, 0.313377, 0.76482, 0.00183695, 0, 0.334745, 0.746586, 0.00177418, 0, 0.356833, 0.7281, 0.00170628, 0, 0.379654, 0.709842, 0.00164063, 0, 0.403221, 0.692019, 0.00157355, 0, 0.427548, 0.67364, 0.00150262, 0, 0.452651, 0.655277, 0.00143473, 0, 0.478545, 0.636438, 0.00136371, 0, 0.505246, 0.617364, 0.00129911, 0, 0.532768, 0.598603, 0.00123014, 0, 0.561122, 0.580195, 0.00116587, 0, 0.590309, 0.561786, 0.00110398, 0, 0.620318, 0.543377, 0.00104148, 0, 0.651102, 0.525093, 0.000983984, 0, 0.682545, 0.506791, 0.00092667, 0, 0.714286, 0.489291, 0.000874326, 0, 0.746032, 0.471811, 0.000821734, 0, 0.777778, 0.454435, 0.000774698, 0, 0.809524, 0.437493, 0.000727302, 0, 0.84127, 0.420977, 0.000684039, 0, 0.873016, 0.404729, 0.00064373, 0, 0.904762, 0.388756, 0.00060285, 0, 0.936508, 0.373344, 0.00056765, 0, 0.968254, 0.358191, 0.000531929, 0, 1, 1, 0.000832169, 0, 0, 1, 0.000832178, 0, 0, 1, 0.00083231, 0, 0, 0.999998, 0.000832893, 0, 0, 0.999995, 0.000834465, 0, 0, 0.999985, 0.000837791, 0, 0, 0.999969, 0.000843893, 0, 0, 0.999944, 0.000854086, 0, 0, 0.999903, 0.000870071, 0, 0, 0.999843, 0.000894042, 0, 0, 0.999759, 0.000928865, 0, 5.31805e-05, 0.999643, 0.000978242, 0, 0.000579365, 0.99948, 0.00104684, 0, 0.00182774, 0.999255, 0.00114012, 0, 0.00387804, 0.998885, 0.00126188, 0, 0.00675709, 0.997405, 0.00135888, 0, 0.010468, 0.99424, 0.00133626, 0, 0.0150018, 0.992458, 0.00140905, 0, 0.0203443, 0.990929, 0.00152305, 0, 0.0264786, 0.989116, 0.00165882, 0, 0.0333875, 0.985624, 0.00174128, 0, 0.0410536, 0.982003, 0.00182108, 0, 0.0494609, 0.978336, 0.00194498, 0, 0.0585941, 0.973184, 0.00202708, 0, 0.0684396, 0.9678, 0.00212166, 0, 0.0789851, 0.961348, 0.00221366, 0, 0.0902199, 0.953841, 0.00228219, 0, 0.102134, 0.94534, 0.00235662, 0, 0.114721, 0.935552, 0.00240572, 0, 0.127972, 0.924064, 0.00244405, 0, 0.141884, 0.911827, 0.00247557, 0, 0.156451, 0.897731, 0.00248374, 0, 0.171672, 0.883409, 0.00249863, 0, 0.187545, 0.868625, 0.00246688, 0, 0.20407, 0.856529, 0.00246523, 0, 0.221249, 0.842999, 0.00242368, 0, 0.239083, 0.828505, 0.00237354, 0, 0.257578, 0.813825, 0.00232588, 0, 0.276738, 0.797813, 0.00226731, 0, 0.296569, 0.781097, 0.00219704, 0, 0.31708, 0.764038, 0.00212394, 0, 0.338281, 0.746067, 0.00204786, 0, 0.360181, 0.727687, 0.00196728, 0, 0.382794, 0.709571, 0.00188779, 0, 0.406133, 0.691503, 0.00180532, 0, 0.430213, 0.673673, 0.00171849, 0, 0.45505, 0.655732, 0.00164147, 0, 0.480662, 0.637399, 0.00155858, 0, 0.507065, 0.618616, 0.00147641, 0, 0.534278, 0.60005, 0.00140125, 0, 0.562313, 0.581713, 0.00132441, 0, 0.59118, 0.563546, 0.00125014, 0, 0.620875, 0.545605, 0.00118249, 0, 0.651373, 0.527559, 0.0011116, 0, 0.682593, 0.509764, 0.00104979, 0, 0.714286, 0.49193, 0.000985977, 0, 0.746032, 0.475011, 0.000928592, 0, 0.777778, 0.457878, 0.000873466, 0, 0.809524, 0.440979, 0.000819585, 0, 0.84127, 0.424613, 0.000772365, 0, 0.873016, 0.408549, 0.000722195, 0, 0.904762, 0.392771, 0.000680014, 0, 0.936508, 0.377317, 0.000636797, 0, 0.968254, 0.362352, 0.000598318, 0, 1, 1, 0.00114313, 0, 0, 1, 0.00114314, 0, 0, 0.999999, 0.00114331, 0, 0, 0.999998, 0.00114404, 0, 0, 0.999994, 0.00114601, 0, 0, 0.999984, 0.00115019, 0, 0, 0.999967, 0.00115784, 0, 0, 0.999937, 0.0011706, 0, 0, 0.999894, 0.00119054, 0, 0, 0.999828, 0.00122031, 0, 0, 0.999735, 0.00126331, 0, 0.000169263, 0.999606, 0.00132382, 0, 0.000949167, 0.999426, 0.0014071, 0, 0.00249668, 0.999173, 0.00151895, 0, 0.00486392, 0.99873, 0.00166102, 0, 0.00806323, 0.996243, 0.0017023, 0, 0.0120895, 0.993779, 0.00172782, 0, 0.0169288, 0.9919, 0.0018108, 0, 0.0225633, 0.990524, 0.00196028, 0, 0.028974, 0.98868, 0.00212014, 0, 0.036142, 0.984663, 0.00217598, 0, 0.044049, 0.981457, 0.00230563, 0, 0.0526781, 0.977608, 0.00243966, 0, 0.0620137, 0.972215, 0.00251336, 0, 0.0720418, 0.966798, 0.0026285, 0, 0.0827499, 0.960241, 0.00271409, 0, 0.0941271, 0.952489, 0.00278381, 0, 0.106164, 0.944127, 0.00285399, 0, 0.118852, 0.934282, 0.00290994, 0, 0.132185, 0.923271, 0.00294558, 0, 0.146157, 0.910803, 0.00296269, 0, 0.160766, 0.896705, 0.00296803, 0, 0.176007, 0.88238, 0.00296637, 0, 0.19188, 0.867116, 0.00293163, 0, 0.208385, 0.853636, 0.00289418, 0, 0.225523, 0.840469, 0.00284663, 0, 0.243296, 0.82639, 0.00278594, 0, 0.261709, 0.811759, 0.00271618, 0, 0.280767, 0.796113, 0.00263187, 0, 0.300476, 0.779518, 0.00254589, 0, 0.320845, 0.763142, 0.00246003, 0, 0.341883, 0.745464, 0.00236529, 0, 0.363601, 0.727491, 0.00226536, 0, 0.386011, 0.709414, 0.00216375, 0, 0.409128, 0.691396, 0.00207127, 0, 0.432967, 0.67368, 0.00197106, 0, 0.457545, 0.656049, 0.00187022, 0, 0.482881, 0.638188, 0.00177605, 0, 0.508992, 0.620177, 0.00168482, 0, 0.535899, 0.601506, 0.00158909, 0, 0.563619, 0.58362, 0.00150583, 0, 0.592165, 0.565496, 0.00141791, 0, 0.621544, 0.54789, 0.00133693, 0, 0.651743, 0.530323, 0.00126038, 0, 0.682709, 0.512795, 0.00118556, 0, 0.714286, 0.495199, 0.00111527, 0, 0.746032, 0.478101, 0.0010489, 0, 0.777778, 0.461511, 0.000984264, 0, 0.809524, 0.444879, 0.00092591, 0, 0.84127, 0.428424, 0.000866582, 0, 0.873016, 0.412495, 0.000814463, 0, 0.904762, 0.396975, 0.000764498, 0, 0.936508, 0.381614, 0.000715967, 0, 0.968254, 0.366732, 0.000672483, 0, 1, 1, 0.00155501, 0, 0, 1, 0.00155503, 0, 0, 1, 0.00155524, 0, 0, 0.999998, 0.00155615, 0, 0, 0.999994, 0.0015586, 0, 0, 0.999983, 0.00156379, 0, 0, 0.999963, 0.0015733, 0, 0, 0.999932, 0.00158911, 0, 0, 0.999882, 0.00161376, 0, 0, 0.99981, 0.00165041, 0, 1.00875e-05, 0.999708, 0.00170304, 0, 0.000367658, 0.999565, 0.00177658, 0, 0.0014234, 0.999368, 0.00187688, 0, 0.00327939, 0.999081, 0.00200989, 0, 0.00596629, 0.99852, 0.00217177, 0, 0.0094852, 0.99549, 0.0021745, 0, 0.013824, 0.993252, 0.00222357, 0, 0.0189642, 0.991727, 0.00235022, 0, 0.0248856, 0.989951, 0.00250561, 0, 0.0315669, 0.988029, 0.00268829, 0, 0.0389882, 0.984029, 0.0027496, 0, 0.0471302, 0.980683, 0.00289793, 0, 0.0559754, 0.976554, 0.00303315, 0, 0.0655081, 0.97139, 0.00313257, 0, 0.0757138, 0.965544, 0.00323656, 0, 0.08658, 0.95912, 0.00333432, 0, 0.0980954, 0.951183, 0.0034039, 0, 0.110251, 0.942974, 0.00347515, 0, 0.123038, 0.932642, 0.00350381, 0, 0.13645, 0.922158, 0.00354519, 0, 0.150482, 0.909404, 0.00353851, 0, 0.165129, 0.896071, 0.0035435, 0, 0.18039, 0.881206, 0.00349936, 0, 0.196263, 0.866077, 0.00347256, 0, 0.212748, 0.85093, 0.003415, 0, 0.229847, 0.837703, 0.00333367, 0, 0.247561, 0.823878, 0.003249, 0, 0.265895, 0.809449, 0.00316347, 0, 0.284854, 0.794379, 0.00306351, 0, 0.304445, 0.778138, 0.0029499, 0, 0.324675, 0.761997, 0.00284099, 0, 0.345555, 0.744938, 0.00272104, 0, 0.367095, 0.727212, 0.00260715, 0, 0.389309, 0.709549, 0.00248855, 0, 0.41221, 0.691704, 0.00236783, 0, 0.435814, 0.673689, 0.00225178, 0, 0.460138, 0.656453, 0.00213765, 0, 0.485203, 0.639128, 0.00202178, 0, 0.511028, 0.621512, 0.00191443, 0, 0.537634, 0.603598, 0.00180977, 0, 0.565041, 0.58559, 0.00170456, 0, 0.593268, 0.567852, 0.00160927, 0, 0.622327, 0.5503, 0.00151395, 0, 0.652217, 0.533033, 0.00142499, 0, 0.682907, 0.515942, 0.00133955, 0, 0.714296, 0.498814, 0.0012602, 0, 0.746032, 0.481595, 0.00118188, 0, 0.777778, 0.465117, 0.00111171, 0, 0.809524, 0.448865, 0.00104091, 0, 0.84127, 0.432711, 0.000976618, 0, 0.873016, 0.416822, 0.00091859, 0, 0.904762, 0.401272, 0.000857704, 0, 0.936508, 0.386226, 0.000807172, 0, 0.968254, 0.371321, 0.00075464, 0, 1, 1, 0.00209596, 0, 0, 1, 0.00209598, 0, 0, 1, 0.00209624, 0, 0, 0.999997, 0.00209736, 0, 0, 0.999991, 0.00210039, 0, 0, 0.999979, 0.00210678, 0, 0, 0.999959, 0.00211847, 0, 0, 0.999925, 0.0021379, 0, 0, 0.99987, 0.00216809, 0, 0, 0.999791, 0.00221281, 0, 6.81487e-05, 0.999677, 0.00227669, 0, 0.000658161, 0.999521, 0.00236533, 0, 0.00200635, 0.999301, 0.00248514, 0, 0.0041779, 0.998977, 0.00264185, 0, 0.00718648, 0.998191, 0.00281695, 0, 0.0110239, 0.994801, 0.00278518, 0, 0.015672, 0.993091, 0.00288774, 0, 0.0211091, 0.991571, 0.00303931, 0, 0.0273123, 0.9897, 0.00321643, 0, 0.034259, 0.987023, 0.00337332, 0, 0.0419282, 0.983289, 0.00346146, 0, 0.0502998, 0.979892, 0.00363704, 0, 0.0593562, 0.975111, 0.00373601, 0, 0.069081, 0.970351, 0.0038842, 0, 0.0794598, 0.964131, 0.00397053, 0, 0.0904798, 0.957747, 0.00408078, 0, 0.10213, 0.949536, 0.00413533, 0, 0.1144, 0.941372, 0.00420305, 0, 0.127284, 0.931049, 0.00422815, 0, 0.140772, 0.920647, 0.00425048, 0, 0.154862, 0.908033, 0.0042281, 0, 0.169548, 0.895028, 0.00422026, 0, 0.184828, 0.879968, 0.00415042, 0, 0.200701, 0.864875, 0.00408821, 0, 0.217167, 0.84918, 0.00400909, 0, 0.234227, 0.834934, 0.00391178, 0, 0.251884, 0.821397, 0.00380066, 0, 0.270141, 0.807135, 0.00367974, 0, 0.289004, 0.792363, 0.00355172, 0, 0.308479, 0.776661, 0.003411, 0, 0.328575, 0.760705, 0.00328123, 0, 0.349301, 0.744408, 0.00314003, 0, 0.370668, 0.726994, 0.0029906, 0, 0.392689, 0.709598, 0.00285034, 0, 0.415379, 0.692112, 0.00271179, 0, 0.438754, 0.674435, 0.00257185, 0, 0.46283, 0.65676, 0.00243425, 0, 0.48763, 0.639982, 0.00230351, 0, 0.513173, 0.622983, 0.0021777, 0, 0.539482, 0.605471, 0.00204991, 0, 0.566579, 0.58796, 0.00193759, 0, 0.594488, 0.570463, 0.00181976, 0, 0.623226, 0.553058, 0.00171497, 0, 0.6528, 0.535894, 0.00161109, 0, 0.683198, 0.519089, 0.00151394, 0, 0.714354, 0.502454, 0.00142122, 0, 0.746032, 0.485681, 0.00133488, 0, 0.777778, 0.468935, 0.00124975, 0, 0.809524, 0.452951, 0.00117309, 0, 0.84127, 0.437139, 0.00110155, 0, 0.873016, 0.421446, 0.00103124, 0, 0.904762, 0.405951, 0.000966387, 0, 0.936508, 0.391003, 0.000908119, 0, 0.968254, 0.376198, 0.000848057, 0, 1, 1, 0.00280076, 0, 0, 1, 0.00280078, 0, 0, 0.999999, 0.00280109, 0, 0, 0.999997, 0.00280246, 0, 0, 0.999992, 0.00280616, 0, 0, 0.999979, 0.00281396, 0, 0, 0.999956, 0.00282822, 0, 0, 0.999916, 0.00285186, 0, 0, 0.999857, 0.0028885, 0, 0, 0.999768, 0.00294259, 0, 0.000196026, 0.999645, 0.00301946, 0, 0.00104842, 0.99947, 0.00312541, 0, 0.00270199, 0.999229, 0.00326733, 0, 0.00519449, 0.998852, 0.00344992, 0, 0.00852602, 0.997558, 0.00361052, 0, 0.0126804, 0.994417, 0.0035898, 0, 0.017635, 0.992824, 0.00372393, 0, 0.023365, 0.991344, 0.00390695, 0, 0.0298456, 0.989337, 0.00410392, 0, 0.0370529, 0.985811, 0.00420987, 0, 0.0449651, 0.982772, 0.00437488, 0, 0.0535615, 0.979001, 0.00455069, 0, 0.0628243, 0.974102, 0.00464462, 0, 0.0727368, 0.969197, 0.00480577, 0, 0.0832844, 0.962759, 0.00487818, 0, 0.0944545, 0.956207, 0.00498176, 0, 0.106236, 0.947909, 0.00503392, 0, 0.118619, 0.939596, 0.00507474, 0, 0.131595, 0.929642, 0.00509798, 0, 0.145159, 0.918807, 0.00508476, 0, 0.159305, 0.906921, 0.00505634, 0, 0.174028, 0.893312, 0.00498845, 0, 0.189327, 0.878933, 0.0049133, 0, 0.2052, 0.863986, 0.0048259, 0, 0.221647, 0.847936, 0.00470848, 0, 0.23867, 0.832253, 0.00456889, 0, 0.25627, 0.818619, 0.00442726, 0, 0.274453, 0.804788, 0.00427677, 0, 0.293222, 0.790241, 0.00411906, 0, 0.312585, 0.775162, 0.00394833, 0, 0.33255, 0.759463, 0.00377366, 0, 0.353126, 0.743598, 0.00361026, 0, 0.374324, 0.72697, 0.00343627, 0, 0.396158, 0.709646, 0.00326422, 0, 0.418641, 0.69277, 0.00309717, 0, 0.44179, 0.675371, 0.0029356, 0, 0.465624, 0.657863, 0.00277712, 0, 0.490163, 0.640772, 0.00261738, 0, 0.515429, 0.624441, 0.0024737, 0, 0.541445, 0.607497, 0.00233125, 0, 0.568236, 0.590438, 0.00218994, 0, 0.595828, 0.573224, 0.0020664, 0, 0.624242, 0.556168, 0.00193526, 0, 0.653496, 0.539232, 0.00182463, 0, 0.683588, 0.522352, 0.00170735, 0, 0.714482, 0.506172, 0.00160555, 0, 0.746032, 0.489842, 0.00150451, 0, 0.777778, 0.473463, 0.00140938, 0, 0.809524, 0.457266, 0.00132568, 0, 0.84127, 0.441609, 0.0012376, 0, 0.873016, 0.426348, 0.00116265, 0, 0.904762, 0.411002, 0.00108935, 0, 0.936508, 0.396045, 0.00101946, 0, 0.968254, 0.381448, 0.000955665, 0, 1, 1, 0.0037121, 0, 0, 1, 0.00371213, 0, 0, 1, 0.00371251, 0, 0, 0.999997, 0.00371417, 0, 0, 0.99999, 0.00371863, 0, 0, 0.999977, 0.00372807, 0, 0, 0.99995, 0.00374529, 0, 0, 0.999908, 0.0037738, 0, 0, 0.999843, 0.00381789, 0, 1.23596e-05, 0.999745, 0.00388273, 0, 0.000407442, 0.999608, 0.00397443, 0, 0.0015447, 0.999415, 0.00409998, 0, 0.00351385, 0.999143, 0.00426662, 0, 0.0063316, 0.9987, 0.00447625, 0, 0.00998679, 0.996363, 0.00455323, 0, 0.0144569, 0.994021, 0.00461052, 0, 0.0197151, 0.992372, 0.00476359, 0, 0.0257344, 0.991007, 0.00499101, 0, 0.0324882, 0.988767, 0.0051972, 0, 0.0399517, 0.984872, 0.00528407, 0, 0.0481022, 0.982004, 0.00548926, 0, 0.0569191, 0.977714, 0.00564385, 0, 0.0663839, 0.973076, 0.0057693, 0, 0.0764801, 0.967565, 0.0058924, 0, 0.0871928, 0.961384, 0.00599629, 0, 0.0985095, 0.954435, 0.00605998, 0, 0.110419, 0.946303, 0.0061133, 0, 0.122912, 0.937662, 0.00612028, 0, 0.13598, 0.927867, 0.00612209, 0, 0.149617, 0.916475, 0.00604813, 0, 0.163817, 0.90541, 0.00603088, 0, 0.178577, 0.891591, 0.00592218, 0, 0.193894, 0.877573, 0.00578854, 0, 0.209767, 0.862511, 0.00566648, 0, 0.226196, 0.846861, 0.00551481, 0, 0.243182, 0.83068, 0.00533754, 0, 0.260728, 0.815725, 0.00515487, 0, 0.278837, 0.802321, 0.0049655, 0, 0.297515, 0.787826, 0.00475421, 0, 0.316768, 0.773454, 0.00456002, 0, 0.336605, 0.758224, 0.00434727, 0, 0.357034, 0.74265, 0.00414444, 0, 0.378067, 0.726729, 0.00393738, 0, 0.399717, 0.710155, 0.00373575, 0, 0.421998, 0.693312, 0.00353736, 0, 0.444928, 0.67653, 0.00334368, 0, 0.468523, 0.659444, 0.00315981, 0, 0.492806, 0.642051, 0.00297809, 0, 0.517798, 0.625758, 0.00280592, 0, 0.543525, 0.609615, 0.00264254, 0, 0.570012, 0.592919, 0.00248459, 0, 0.597288, 0.576298, 0.00233327, 0, 0.625379, 0.559489, 0.00219519, 0, 0.654307, 0.542891, 0.00205441, 0, 0.684084, 0.526255, 0.00193385, 0, 0.714693, 0.509853, 0.00180745, 0, 0.746044, 0.494131, 0.00169817, 0, 0.777778, 0.478114, 0.0015913, 0, 0.809524, 0.462274, 0.00148981, 0, 0.84127, 0.446412, 0.00139537, 0, 0.873016, 0.431274, 0.00130984, 0, 0.904762, 0.41635, 0.00122403, 0, 0.936508, 0.401476, 0.00114809, 0, 0.968254, 0.386993, 0.00107563, 0, 1, 1, 0.00488216, 0, 0, 1, 0.0048822, 0, 0, 1, 0.00488265, 0, 0, 0.999997, 0.00488463, 0, 0, 0.999988, 0.00488999, 0, 0, 0.999974, 0.00490129, 0, 0, 0.999946, 0.00492191, 0, 0, 0.999897, 0.00495598, 0, 0, 0.999825, 0.00500855, 0, 7.44791e-05, 0.999718, 0.00508559, 0, 0.000712744, 0.999565, 0.005194, 0, 0.00215249, 0.999352, 0.00534147, 0, 0.00444576, 0.999046, 0.00553523, 0, 0.00759218, 0.998492, 0.00577016, 0, 0.0115714, 0.995564, 0.00578487, 0, 0.0163557, 0.993339, 0.00586414, 0, 0.021915, 0.991834, 0.00606002, 0, 0.0282201, 0.990496, 0.00633312, 0, 0.0352433, 0.987826, 0.00651941, 0, 0.042959, 0.98383, 0.00660842, 0, 0.0513439, 0.98109, 0.00685523, 0, 0.0603772, 0.976131, 0.00695778, 0, 0.0700402, 0.971922, 0.00714236, 0, 0.0803163, 0.965901, 0.00721437, 0, 0.0911908, 0.959606, 0.00732017, 0, 0.102651, 0.952504, 0.00735788, 0, 0.114686, 0.944365, 0.00738493, 0, 0.127286, 0.935652, 0.00737969, 0, 0.140443, 0.925813, 0.00733612, 0, 0.154151, 0.914397, 0.00723094, 0, 0.168405, 0.903257, 0.00714002, 0, 0.183201, 0.890015, 0.00700149, 0, 0.198536, 0.876014, 0.00682813, 0, 0.214409, 0.861436, 0.00665567, 0, 0.23082, 0.845752, 0.00644526, 0, 0.24777, 0.829169, 0.00621635, 0, 0.265263, 0.813435, 0.00597789, 0, 0.283301, 0.799701, 0.00575694, 0, 0.301889, 0.785726, 0.00549866, 0, 0.321035, 0.77152, 0.0052503, 0, 0.340746, 0.75683, 0.00499619, 0, 0.361032, 0.741951, 0.0047543, 0, 0.381904, 0.726367, 0.0045084, 0, 0.403374, 0.710537, 0.00426784, 0, 0.425457, 0.693965, 0.00403487, 0, 0.448169, 0.677724, 0.0038075, 0, 0.47153, 0.66117, 0.00359431, 0, 0.495561, 0.644274, 0.00338354, 0, 0.520284, 0.627449, 0.00318163, 0, 0.545725, 0.611645, 0.00299672, 0, 0.571911, 0.595614, 0.00281016, 0, 0.598873, 0.579426, 0.00264252, 0, 0.62664, 0.563016, 0.00247509, 0, 0.655239, 0.546728, 0.00232647, 0, 0.684692, 0.530539, 0.00217803, 0, 0.714999, 0.514164, 0.00204216, 0, 0.746106, 0.498344, 0.00191403, 0, 0.777778, 0.482957, 0.00179203, 0, 0.809524, 0.467336, 0.00167695, 0, 0.84127, 0.451994, 0.00157567, 0, 0.873016, 0.436514, 0.00147113, 0, 0.904762, 0.42178, 0.00138034, 0, 0.936508, 0.407271, 0.00129219, 0, 0.968254, 0.392822, 0.0012098, 0, 1, 1, 0.00637427, 0, 0, 1, 0.00637431, 0, 0, 0.999999, 0.00637485, 0, 0, 0.999996, 0.00637721, 0, 0, 0.999987, 0.00638357, 0, 0, 0.999971, 0.006397, 0, 0, 0.999939, 0.00642142, 0, 0, 0.999888, 0.00646177, 0, 0, 0.999807, 0.00652387, 0, 0.000207916, 0.999689, 0.00661454, 0, 0.00112051, 0.99952, 0.00674155, 0, 0.00287719, 0.999283, 0.00691313, 0, 0.00550145, 0.998936, 0.00713598, 0, 0.00897928, 0.998165, 0.00738501, 0, 0.0132829, 0.994847, 0.00734388, 0, 0.01838, 0.993182, 0.00749991, 0, 0.0242381, 0.991665, 0.0077246, 0, 0.030826, 0.989708, 0.00797579, 0, 0.0381152, 0.986663, 0.00813011, 0, 0.0460794, 0.983288, 0.00830365, 0, 0.0546951, 0.980104, 0.00853496, 0, 0.0639411, 0.974855, 0.00861045, 0, 0.0737988, 0.97045, 0.00879133, 0, 0.0842516, 0.964509, 0.00886377, 0, 0.0952848, 0.957594, 0.00890346, 0, 0.106886, 0.950546, 0.00893289, 0, 0.119044, 0.942225, 0.00890074, 0, 0.131749, 0.933365, 0.00886826, 0, 0.144994, 0.923202, 0.0087316, 0, 0.158772, 0.912605, 0.00863082, 0, 0.173078, 0.901099, 0.00847403, 0, 0.187908, 0.888177, 0.00825838, 0, 0.203261, 0.873955, 0.00801834, 0, 0.219134, 0.860091, 0.00779026, 0, 0.235527, 0.84434, 0.00752478, 0, 0.252443, 0.828517, 0.00724074, 0, 0.269883, 0.81239, 0.00693769, 0, 0.287851, 0.79721, 0.00664817, 0, 0.306352, 0.783489, 0.00634763, 0, 0.325393, 0.769514, 0.00604221, 0, 0.344981, 0.755419, 0.00573568, 0, 0.365126, 0.741083, 0.00544359, 0, 0.385839, 0.726059, 0.00515515, 0, 0.407132, 0.710809, 0.00487139, 0, 0.42902, 0.695052, 0.00459846, 0, 0.45152, 0.678886, 0.00433412, 0, 0.474651, 0.663042, 0.00407981, 0, 0.498433, 0.646634, 0.00384264, 0, 0.52289, 0.630117, 0.00360897, 0, 0.548048, 0.613804, 0.00338863, 0, 0.573936, 0.598338, 0.00318486, 0, 0.600584, 0.582687, 0.00298377, 0, 0.628027, 0.566809, 0.00280082, 0, 0.656295, 0.550817, 0.00262255, 0, 0.685417, 0.534937, 0.00245835, 0, 0.715406, 0.519151, 0.00230574, 0, 0.74624, 0.503118, 0.0021549, 0, 0.777778, 0.487723, 0.00202008, 0, 0.809524, 0.472725, 0.00189355, 0, 0.84127, 0.457599, 0.00177108, 0, 0.873016, 0.442558, 0.00165843, 0, 0.904762, 0.427624, 0.00155494, 0, 0.936508, 0.413171, 0.00145273, 0, 0.968254, 0.399122, 0.00136454, 0, 1, 1, 0.00826496, 0, 0, 1, 0.00826499, 0, 0, 1, 0.00826564, 0, 0, 0.999996, 0.00826842, 0, 0, 0.999987, 0.00827589, 0, 0, 0.999967, 0.00829167, 0, 0, 0.999933, 0.00832037, 0, 0, 0.999876, 0.00836768, 0, 1.09338e-05, 0.999786, 0.00844031, 0, 0.000427145, 0.999655, 0.00854603, 0, 0.0016384, 0.999468, 0.00869337, 0, 0.00372392, 0.999203, 0.008891, 0, 0.00668513, 0.998803, 0.00914387, 0, 0.0104968, 0.99748, 0.00935838, 0, 0.015125, 0.994446, 0.00933309, 0, 0.0205338, 0.99292, 0.00953084, 0, 0.0266884, 0.991414, 0.0097893, 0, 0.0335565, 0.989049, 0.0100228, 0, 0.0411086, 0.98582, 0.0101664, 0, 0.0493181, 0.982441, 0.0103582, 0, 0.0581613, 0.978595, 0.0105292, 0, 0.0676169, 0.973495, 0.0106274, 0, 0.0776661, 0.968405, 0.0107261, 0, 0.0882926, 0.962717, 0.0108234, 0, 0.0994817, 0.955478, 0.0108102, 0, 0.111221, 0.948275, 0.0107914, 0, 0.123499, 0.940006, 0.0107161, 0, 0.136308, 0.930831, 0.0106309, 0, 0.149639, 0.920648, 0.0104083, 0, 0.163485, 0.910205, 0.0102312, 0, 0.177843, 0.898445, 0.0100051, 0, 0.192707, 0.885986, 0.00971928, 0, 0.208077, 0.872204, 0.00940747, 0, 0.22395, 0.858436, 0.0091085, 0, 0.240326, 0.843454, 0.00876595, 0, 0.257208, 0.827437, 0.00839794, 0, 0.274596, 0.811488, 0.00803692, 0, 0.292496, 0.796039, 0.00767352, 0, 0.310911, 0.781083, 0.0073097, 0, 0.329849, 0.767642, 0.00694032, 0, 0.349316, 0.753901, 0.00657476, 0, 0.369323, 0.740131, 0.00622699, 0, 0.38988, 0.725845, 0.0058838, 0, 0.410999, 0.710991, 0.00555586, 0, 0.432696, 0.696002, 0.00523089, 0, 0.454987, 0.680461, 0.00492494, 0, 0.47789, 0.664875, 0.00463464, 0, 0.501426, 0.649273, 0.00435422, 0, 0.52562, 0.63302, 0.0040875, 0, 0.550498, 0.61705, 0.00384075, 0, 0.576089, 0.601154, 0.00359557, 0, 0.602427, 0.586008, 0.00337636, 0, 0.629544, 0.570699, 0.00316019, 0, 0.657479, 0.555166, 0.00296033, 0, 0.686264, 0.539645, 0.00277552, 0, 0.715924, 0.524159, 0.00259499, 0, 0.746459, 0.508682, 0.00243257, 0, 0.777789, 0.493163, 0.00227851, 0, 0.809524, 0.478004, 0.00213083, 0, 0.84127, 0.46347, 0.00199502, 0, 0.873016, 0.448778, 0.00186967, 0, 0.904762, 0.434105, 0.00174732, 0, 0.936508, 0.419576, 0.00163861, 0, 0.968254, 0.405541, 0.00153341, 0, 1, 1, 0.0106462, 0, 0, 1, 0.0106462, 0, 0, 0.999999, 0.010647, 0, 0, 0.999995, 0.0106502, 0, 0, 0.999985, 0.0106589, 0, 0, 0.999964, 0.0106773, 0, 0, 0.999925, 0.0107106, 0, 0, 0.999861, 0.0107655, 0, 7.12986e-05, 0.999763, 0.0108497, 0, 0.000743959, 0.999616, 0.0109716, 0, 0.00227361, 0.999408, 0.0111408, 0, 0.0046983, 0.999112, 0.0113659, 0, 0.00800158, 0.998637, 0.0116475, 0, 0.0121493, 0.996223, 0.0117231, 0, 0.0171023, 0.994006, 0.0118064, 0, 0.0228218, 0.992444, 0.0120254, 0, 0.0292711, 0.991028, 0.0123314, 0, 0.036417, 0.98803, 0.0124954, 0, 0.0442295, 0.984816, 0.0126538, 0, 0.0526815, 0.981399, 0.0128537, 0, 0.0617492, 0.977085, 0.0129694, 0, 0.0714114, 0.972154, 0.013091, 0, 0.0816495, 0.966617, 0.0131166, 0, 0.0924472, 0.960628, 0.0131583, 0, 0.10379, 0.953295, 0.0131094, 0, 0.115665, 0.94575, 0.0129966, 0, 0.128062, 0.937654, 0.0128796, 0, 0.140972, 0.927716, 0.0126477, 0, 0.154387, 0.917932, 0.0123889, 0, 0.168301, 0.907719, 0.012131, 0, 0.182709, 0.89584, 0.0118013, 0, 0.197608, 0.883526, 0.0114145, 0, 0.212994, 0.870301, 0.0110075, 0, 0.228867, 0.856272, 0.0106019, 0, 0.245227, 0.842251, 0.0101938, 0, 0.262074, 0.826466, 0.00973254, 0, 0.279412, 0.810859, 0.0092846, 0, 0.297244, 0.795051, 0.00883304, 0, 0.315575, 0.780053, 0.00840272, 0, 0.334412, 0.76575, 0.00796438, 0, 0.35376, 0.752298, 0.00752526, 0, 0.373631, 0.739153, 0.00711486, 0, 0.394034, 0.725514, 0.00670361, 0, 0.414983, 0.711473, 0.00632656, 0, 0.436491, 0.696936, 0.00595206, 0, 0.458575, 0.682126, 0.00559191, 0, 0.481253, 0.667027, 0.00525362, 0, 0.504547, 0.651875, 0.00493805, 0, 0.528481, 0.636463, 0.00462848, 0, 0.553081, 0.620641, 0.00433936, 0, 0.578377, 0.604931, 0.00407, 0, 0.604404, 0.589549, 0.00380864, 0, 0.631197, 0.574712, 0.00357049, 0, 0.658795, 0.559775, 0.00334466, 0, 0.687238, 0.544514, 0.00312505, 0, 0.716559, 0.529555, 0.00293199, 0, 0.746776, 0.514402, 0.00274204, 0, 0.777849, 0.499302, 0.00256647, 0, 0.809524, 0.484114, 0.00239901, 0, 0.84127, 0.469308, 0.00225148, 0, 0.873016, 0.455133, 0.00210178, 0, 0.904762, 0.440939, 0.0019727, 0, 0.936508, 0.426627, 0.00184382, 0, 0.968254, 0.412509, 0.00172548, 0, 1, 1, 0.013628, 0, 0, 1, 0.0136281, 0, 0, 0.999999, 0.0136289, 0, 0, 0.999995, 0.0136327, 0, 0, 0.999983, 0.0136427, 0, 0, 0.99996, 0.0136638, 0, 0, 0.999917, 0.0137022, 0, 0, 0.999846, 0.0137652, 0, 0.000204597, 0.999736, 0.0138615, 0, 0.00116837, 0.999573, 0.0140007, 0, 0.00303325, 0.99934, 0.0141927, 0, 0.00580613, 0.999004, 0.0144457, 0, 0.00945626, 0.998407, 0.0147489, 0, 0.0139421, 0.995464, 0.014731, 0, 0.0192202, 0.993328, 0.0148283, 0, 0.0252495, 0.991799, 0.0150797, 0, 0.0319921, 0.990397, 0.0154316, 0, 0.0394138, 0.986835, 0.0155005, 0, 0.0474843, 0.983938, 0.0157308, 0, 0.0561763, 0.980154, 0.0158753, 0, 0.0654661, 0.975659, 0.0159581, 0, 0.0753326, 0.970171, 0.0159832, 0, 0.0857571, 0.964803, 0.0160084, 0, 0.0967236, 0.958366, 0.0159484, 0, 0.108218, 0.950613, 0.0158001, 0, 0.120227, 0.942874, 0.0155845, 0, 0.132741, 0.935005, 0.0154292, 0, 0.145751, 0.924991, 0.0150742, 0, 0.159249, 0.914814, 0.0146757, 0, 0.17323, 0.904743, 0.0143097, 0, 0.187687, 0.893216, 0.0138695, 0, 0.202619, 0.880769, 0.0133706, 0, 0.218021, 0.868136, 0.0128606, 0, 0.233894, 0.85469, 0.0123403, 0, 0.250238, 0.840593, 0.0118091, 0, 0.267052, 0.825808, 0.011253, 0, 0.284341, 0.81009, 0.0107099, 0, 0.302106, 0.79504, 0.0101636, 0, 0.320354, 0.779757, 0.00964041, 0, 0.33909, 0.764697, 0.00911896, 0, 0.358322, 0.750913, 0.00859533, 0, 0.378059, 0.738175, 0.00811592, 0, 0.398311, 0.725242, 0.00764504, 0, 0.41909, 0.711864, 0.00718885, 0, 0.440412, 0.698009, 0.00675843, 0, 0.462292, 0.683841, 0.00634984, 0, 0.484748, 0.669391, 0.00595502, 0, 0.507802, 0.654731, 0.00558671, 0, 0.531477, 0.639805, 0.00523578, 0, 0.555802, 0.624789, 0.00490834, 0, 0.580805, 0.609325, 0.00459448, 0, 0.606522, 0.593975, 0.00430342, 0, 0.63299, 0.578983, 0.00403019, 0, 0.66025, 0.564442, 0.0037707, 0, 0.688346, 0.549835, 0.0035316, 0, 0.717319, 0.535039, 0.00330255, 0, 0.7472, 0.520403, 0.00308932, 0, 0.777982, 0.505687, 0.00289335, 0, 0.809524, 0.490939, 0.00270818, 0, 0.84127, 0.476233, 0.0025343, 0, 0.873016, 0.461624, 0.00237097, 0, 0.904762, 0.447833, 0.00222065, 0, 0.936508, 0.433992, 0.00207561, 0, 0.968254, 0.420147, 0.00194955, 0, 1, 1, 0.0173415, 0, 0, 1, 0.0173416, 0, 0, 0.999999, 0.0173426, 0, 0, 0.999995, 0.0173468, 0, 0, 0.999983, 0.0173582, 0, 0, 0.999954, 0.0173822, 0, 0, 0.999908, 0.0174258, 0, 6.69501e-06, 0.999828, 0.0174973, 0, 0.000427399, 0.999705, 0.0176063, 0, 0.00171019, 0.999524, 0.0177631, 0, 0.0039248, 0.999263, 0.0179781, 0, 0.00705382, 0.998878, 0.018258, 0, 0.0110552, 0.998012, 0.0185551, 0, 0.0158812, 0.994614, 0.0184264, 0, 0.0214852, 0.993132, 0.0186385, 0, 0.0278239, 0.991563, 0.0189067, 0, 0.0348585, 0.989298, 0.0191577, 0, 0.0425544, 0.986036, 0.0192522, 0, 0.050881, 0.982558, 0.0194063, 0, 0.059811, 0.978531, 0.019486, 0, 0.0693209, 0.974198, 0.0195847, 0, 0.0793895, 0.968148, 0.0194749, 0, 0.0899984, 0.962565, 0.0194277, 0, 0.101132, 0.956041, 0.0192991, 0, 0.112775, 0.947749, 0.0189893, 0, 0.124917, 0.94018, 0.018704, 0, 0.137547, 0.93165, 0.0183458, 0, 0.150655, 0.921798, 0.0178775, 0, 0.164236, 0.911573, 0.0173618, 0, 0.178281, 0.901569, 0.0168482, 0, 0.192788, 0.890341, 0.016265, 0, 0.207752, 0.877835, 0.0156199, 0, 0.223171, 0.865472, 0.0149516, 0, 0.239044, 0.852905, 0.0143274, 0, 0.255371, 0.838906, 0.0136643, 0, 0.272153, 0.824888, 0.0129903, 0, 0.289393, 0.809977, 0.0123218, 0, 0.307093, 0.794697, 0.0116572, 0, 0.325259, 0.780028, 0.0110307, 0, 0.343896, 0.765124, 0.0104236, 0, 0.363012, 0.750411, 0.0098219, 0, 0.382617, 0.737264, 0.00924397, 0, 0.402719, 0.724799, 0.00868719, 0, 0.423332, 0.712253, 0.00816476, 0, 0.444469, 0.699267, 0.00767262, 0, 0.466146, 0.685618, 0.00719746, 0, 0.488383, 0.671736, 0.00673916, 0, 0.511199, 0.657777, 0.00631937, 0, 0.534618, 0.643497, 0.00592411, 0, 0.558668, 0.62889, 0.00553928, 0, 0.58338, 0.614299, 0.0051934, 0, 0.608787, 0.599197, 0.00485985, 0, 0.634929, 0.584175, 0.00454357, 0, 0.661849, 0.569541, 0.00425787, 0, 0.689594, 0.555193, 0.00397905, 0, 0.718211, 0.540947, 0.00372364, 0, 0.747742, 0.526593, 0.00348599, 0, 0.778205, 0.512335, 0.00326103, 0, 0.80953, 0.498017, 0.00305137, 0, 0.84127, 0.483609, 0.00285485, 0, 0.873016, 0.469368, 0.00267472, 0, 0.904762, 0.455037, 0.00249945, 0, 0.936508, 0.441493, 0.00234792, 0, 0.968254, 0.428147, 0.00219936, 0, 1, 1, 0.0219422, 0, 0, 1, 0.0219423, 0, 0, 0.999998, 0.0219434, 0, 0, 0.999993, 0.0219481, 0, 0, 0.999981, 0.021961, 0, 0, 0.999949, 0.0219879, 0, 0, 0.999896, 0.0220367, 0, 5.93194e-05, 0.999808, 0.0221167, 0, 0.00075364, 0.99967, 0.0222383, 0, 0.00237884, 0.999466, 0.0224125, 0, 0.00495612, 0.999174, 0.0226495, 0, 0.00844887, 0.998725, 0.0229525, 0, 0.0128058, 0.996979, 0.0231123, 0, 0.0179742, 0.994317, 0.0230742, 0, 0.0239047, 0.992781, 0.0232895, 0, 0.0305526, 0.991191, 0.0235734, 0, 0.0378786, 0.987787, 0.0236152, 0, 0.0458475, 0.985092, 0.0237994, 0, 0.0544287, 0.981121, 0.0238553, 0, 0.0635952, 0.976924, 0.0238706, 0, 0.0733233, 0.97218, 0.0238704, 0, 0.0835922, 0.965956, 0.0236598, 0, 0.0943839, 0.959998, 0.0234735, 0, 0.105682, 0.953245, 0.0232277, 0, 0.117474, 0.944445, 0.0226973, 0, 0.129747, 0.937087, 0.0223527, 0, 0.142491, 0.928341, 0.0218144, 0, 0.155697, 0.9184, 0.0211516, 0, 0.169358, 0.907959, 0.0204553, 0, 0.183469, 0.89808, 0.0197673, 0, 0.198024, 0.887047, 0.0189915, 0, 0.21302, 0.875221, 0.0182082, 0, 0.228455, 0.86269, 0.0173584, 0, 0.244329, 0.850735, 0.0165718, 0, 0.260639, 0.837545, 0.0157524, 0, 0.277389, 0.823639, 0.0149482, 0, 0.29458, 0.809699, 0.0141431, 0, 0.312216, 0.794797, 0.0133527, 0, 0.3303, 0.780578, 0.0126193, 0, 0.34884, 0.766019, 0.0118914, 0, 0.367842, 0.751447, 0.0111839, 0, 0.387315, 0.737275, 0.010514, 0, 0.40727, 0.724545, 0.00987277, 0, 0.427717, 0.712644, 0.00926569, 0, 0.448671, 0.700432, 0.00869029, 0, 0.470149, 0.687664, 0.00814691, 0, 0.492167, 0.674288, 0.00763012, 0, 0.514746, 0.660966, 0.00714437, 0, 0.537911, 0.647264, 0.00668457, 0, 0.561688, 0.633431, 0.00626581, 0, 0.586108, 0.619133, 0.00585593, 0, 0.611206, 0.604935, 0.00548188, 0, 0.637022, 0.590236, 0.00513288, 0, 0.663599, 0.575473, 0.0047906, 0, 0.690989, 0.561228, 0.00448895, 0, 0.719242, 0.547054, 0.00420233, 0, 0.748411, 0.533175, 0.00392869, 0, 0.778531, 0.519163, 0.00367445, 0, 0.809583, 0.505328, 0.00344097, 0, 0.84127, 0.491446, 0.00322003, 0, 0.873016, 0.477356, 0.00301283, 0, 0.904762, 0.46356, 0.00282592, 0, 0.936508, 0.449623, 0.00264956, 0, 0.968254, 0.436068, 0.00246956, 0, 1, 1, 0.0276135, 0, 0, 1, 0.0276136, 0, 0, 0.999998, 0.0276148, 0, 0, 0.999993, 0.0276201, 0, 0, 0.999976, 0.0276342, 0, 0, 0.999945, 0.027664, 0, 0, 0.999884, 0.0277179, 0, 0.00018679, 0.999784, 0.027806, 0, 0.00119607, 0.99963, 0.0279394, 0, 0.00318407, 0.999401, 0.0281295, 0, 0.00613601, 0.999066, 0.0283858, 0, 0.00999963, 0.998524, 0.0287027, 0, 0.0147164, 0.995702, 0.0286256, 0, 0.0202295, 0.993593, 0.0286733, 0, 0.0264876, 0.992067, 0.0288989, 0, 0.0334452, 0.990548, 0.0292135, 0, 0.0410621, 0.986775, 0.0291296, 0, 0.0493032, 0.984054, 0.0293099, 0, 0.0581381, 0.979481, 0.0291881, 0, 0.0675397, 0.975297, 0.0291598, 0, 0.0774848, 0.96981, 0.028954, 0, 0.0879528, 0.963524, 0.028628, 0, 0.0989258, 0.957398, 0.0283135, 0, 0.110388, 0.950088, 0.0278469, 0, 0.122327, 0.941538, 0.0271798, 0, 0.134729, 0.933332, 0.0265388, 0, 0.147587, 0.924392, 0.0257776, 0, 0.160889, 0.914581, 0.024916, 0, 0.174631, 0.904347, 0.0240242, 0, 0.188806, 0.894324, 0.0231229, 0, 0.203409, 0.883724, 0.022153, 0, 0.218437, 0.872207, 0.0211355, 0, 0.233888, 0.859927, 0.0201048, 0, 0.249761, 0.848373, 0.0191263, 0, 0.266056, 0.836023, 0.0181306, 0, 0.282774, 0.82289, 0.0171718, 0, 0.299917, 0.809324, 0.0162196, 0, 0.317488, 0.795361, 0.0152622, 0, 0.335493, 0.781253, 0.01439, 0, 0.353936, 0.767338, 0.013533, 0, 0.372825, 0.753156, 0.0127244, 0, 0.392168, 0.739122, 0.0119454, 0, 0.411976, 0.725358, 0.0112054, 0, 0.432259, 0.712949, 0.010487, 0, 0.453032, 0.701621, 0.00984032, 0, 0.47431, 0.689703, 0.00921495, 0, 0.496111, 0.677216, 0.00862492, 0, 0.518456, 0.664217, 0.00806882, 0, 0.541367, 0.65137, 0.00755922, 0, 0.564872, 0.638, 0.00705705, 0, 0.589001, 0.62453, 0.00661266, 0, 0.613789, 0.610601, 0.00618432, 0, 0.639277, 0.59676, 0.00578033, 0, 0.66551, 0.582433, 0.00540927, 0, 0.692539, 0.568026, 0.00506104, 0, 0.720422, 0.55414, 0.0047353, 0, 0.749216, 0.540178, 0.00442889, 0, 0.778974, 0.526513, 0.00414363, 0, 0.809711, 0.512954, 0.00388237, 0, 0.84127, 0.499403, 0.00362875, 0, 0.873016, 0.486026, 0.00340827, 0, 0.904762, 0.472345, 0.00318598, 0, 0.936508, 0.458828, 0.00297635, 0, 0.968254, 0.445379, 0.00279447, 0, 1, 1, 0.0345716, 0, 0, 1, 0.0345717, 0, 0, 0.999999, 0.034573, 0, 0, 0.999991, 0.0345787, 0, 0, 0.999974, 0.0345941, 0, 0, 0.999937, 0.0346263, 0, 1.88589e-06, 0.999869, 0.0346847, 0, 0.000409238, 0.999757, 0.0347798, 0, 0.0017674, 0.999582, 0.0349233, 0, 0.00413658, 0.999322, 0.0351265, 0, 0.00747408, 0.998939, 0.0353967, 0, 0.0117157, 0.998219, 0.0357018, 0, 0.0167966, 0.994974, 0.0354726, 0, 0.0226572, 0.993201, 0.0355621, 0, 0.0292445, 0.991573, 0.0357641, 0, 0.0365123, 0.989301, 0.0359252, 0, 0.0444203, 0.985712, 0.0358017, 0, 0.0529334, 0.982411, 0.0358353, 0, 0.0620214, 0.977827, 0.035617, 0, 0.0716574, 0.973278, 0.0354398, 0, 0.0818186, 0.967397, 0.0350483, 0, 0.0924846, 0.960696, 0.0344795, 0, 0.103638, 0.954349, 0.0339861, 0, 0.115263, 0.946066, 0.0331323, 0, 0.127348, 0.938012, 0.032359, 0, 0.13988, 0.929413, 0.0314413, 0, 0.152849, 0.920355, 0.0304103, 0, 0.166248, 0.910586, 0.0292785, 0, 0.18007, 0.900609, 0.0281391, 0, 0.194308, 0.890093, 0.0269103, 0, 0.208958, 0.880013, 0.0257269, 0, 0.224018, 0.869001, 0.0244671, 0, 0.239485, 0.85751, 0.0232252, 0, 0.255359, 0.84582, 0.0220117, 0, 0.271638, 0.834383, 0.0208274, 0, 0.288324, 0.822158, 0.0196628, 0, 0.305419, 0.809056, 0.0185306, 0, 0.322927, 0.795832, 0.0174174, 0, 0.340851, 0.782547, 0.0163758, 0, 0.359199, 0.7689, 0.015391, 0, 0.377975, 0.755526, 0.0144488, 0, 0.397189, 0.741681, 0.0135372, 0, 0.416851, 0.728178, 0.0126957, 0, 0.436971, 0.714642, 0.0118812, 0, 0.457564, 0.702756, 0.0111165, 0, 0.478644, 0.69175, 0.0104145, 0, 0.500229, 0.680159, 0.00974439, 0, 0.522339, 0.668073, 0.00911926, 0, 0.544997, 0.655405, 0.00851393, 0, 0.56823, 0.642921, 0.00797637, 0, 0.592068, 0.629993, 0.00745119, 0, 0.616546, 0.616828, 0.00696972, 0, 0.641705, 0.603305, 0.00652425, 0, 0.66759, 0.589833, 0.00610188, 0, 0.694255, 0.575945, 0.00570834, 0, 0.72176, 0.561745, 0.00533384, 0, 0.750168, 0.548277, 0.00500001, 0, 0.779545, 0.534467, 0.00467582, 0, 0.809933, 0.521032, 0.00438092, 0, 0.841272, 0.507877, 0.00410348, 0, 0.873016, 0.494654, 0.00383618, 0, 0.904762, 0.481592, 0.00358699, 0, 0.936508, 0.468509, 0.00337281, 0, 0.968254, 0.455293, 0.00316196, 0, 1, 1, 0.0430698, 0, 0, 1, 0.0430699, 0, 0, 0.999998, 0.0430713, 0, 0, 0.999991, 0.0430773, 0, 0, 0.99997, 0.0430936, 0, 0, 0.999928, 0.0431277, 0, 4.06396e-05, 0.999852, 0.0431893, 0, 0.000744376, 0.999724, 0.0432895, 0, 0.0024806, 0.999527, 0.0434397, 0, 0.00524779, 0.99923, 0.0436507, 0, 0.00898164, 0.998783, 0.0439255, 0, 0.0136083, 0.997507, 0.0441104, 0, 0.0190582, 0.994418, 0.0438225, 0, 0.0252694, 0.992864, 0.0439396, 0, 0.0321879, 0.991127, 0.0440962, 0, 0.039767, 0.987331, 0.0438408, 0, 0.0479667, 0.984819, 0.0438991, 0, 0.056752, 0.980384, 0.0435906, 0, 0.0660929, 0.975846, 0.0432543, 0, 0.075963, 0.970748, 0.0428293, 0, 0.0863398, 0.964303, 0.042153, 0, 0.0972035, 0.95772, 0.0414111, 0, 0.108537, 0.950747, 0.0405893, 0, 0.120325, 0.942533, 0.0394887, 0, 0.132554, 0.934045, 0.0383544, 0, 0.145215, 0.924942, 0.037057, 0, 0.158296, 0.915811, 0.0356993, 0, 0.17179, 0.90612, 0.0342401, 0, 0.185691, 0.896434, 0.0328078, 0, 0.199993, 0.886021, 0.031288, 0, 0.214691, 0.876081, 0.0297776, 0, 0.229782, 0.865608, 0.0282334, 0, 0.245265, 0.854924, 0.026749, 0, 0.261138, 0.843607, 0.02526, 0, 0.277401, 0.832456, 0.0238214, 0, 0.294056, 0.821342, 0.0224682, 0, 0.311104, 0.809303, 0.0211297, 0, 0.328548, 0.796468, 0.0198387, 0, 0.346394, 0.784046, 0.0186227, 0, 0.364645, 0.771262, 0.0174561, 0, 0.38331, 0.758118, 0.0163806, 0, 0.402396, 0.745075, 0.0153287, 0, 0.421912, 0.731926, 0.0143647, 0, 0.44187, 0.71863, 0.0134363, 0, 0.462283, 0.705414, 0.0125603, 0, 0.483165, 0.693792, 0.0117508, 0, 0.504535, 0.683108, 0.0110016, 0, 0.52641, 0.67183, 0.0102757, 0, 0.548816, 0.66015, 0.00962044, 0, 0.571776, 0.647907, 0.00898031, 0, 0.595323, 0.635734, 0.00840811, 0, 0.619489, 0.623208, 0.00786211, 0, 0.644317, 0.610438, 0.00734953, 0, 0.669852, 0.597345, 0.00687688, 0, 0.696148, 0.584138, 0.00643469, 0, 0.723267, 0.5707, 0.00602236, 0, 0.75128, 0.556966, 0.0056324, 0, 0.780258, 0.543607, 0.00528277, 0, 0.810268, 0.530213, 0.00493999, 0, 0.841311, 0.516912, 0.00462265, 0, 0.873016, 0.503916, 0.0043307, 0, 0.904762, 0.491146, 0.00406858, 0, 0.936508, 0.478439, 0.00381436, 0, 0.968254, 0.465834, 0.00358003, 0, 1, 1, 0.0534039, 0, 0, 1, 0.053404, 0, 0, 0.999998, 0.0534055, 0, 0, 0.999989, 0.0534116, 0, 0, 0.999968, 0.0534283, 0, 0, 0.999918, 0.0534633, 0, 0.000155895, 0.99983, 0.0535262, 0, 0.00120914, 0.999685, 0.0536281, 0, 0.00334944, 0.999461, 0.0537799, 0, 0.00653077, 0.999119, 0.0539902, 0, 0.0106718, 0.998582, 0.0542524, 0, 0.0156907, 0.995919, 0.0540318, 0, 0.0215147, 0.993735, 0.0538914, 0, 0.0280801, 0.992126, 0.0539557, 0, 0.0353323, 0.990266, 0.0540401, 0, 0.0432247, 0.986317, 0.0536064, 0, 0.0517172, 0.983213, 0.0534425, 0, 0.0607754, 0.978303, 0.0528622, 0, 0.0703698, 0.973665, 0.0523363, 0, 0.0804742, 0.968091, 0.0516165, 0, 0.0910667, 0.961026, 0.0505434, 0, 0.102128, 0.954333, 0.049523, 0, 0.113641, 0.946372, 0.0481698, 0, 0.125591, 0.938254, 0.0467674, 0, 0.137965, 0.929516, 0.0452341, 0, 0.150754, 0.920106, 0.0435083, 0, 0.163947, 0.910899, 0.0417399, 0, 0.177537, 0.901532, 0.0399389, 0, 0.191516, 0.891919, 0.0380901, 0, 0.205881, 0.882006, 0.0362341, 0, 0.220626, 0.871965, 0.0343444, 0, 0.235749, 0.862145, 0.0324832, 0, 0.251248, 0.852058, 0.0306681, 0, 0.267121, 0.84161, 0.0289097, 0, 0.283368, 0.830806, 0.0272079, 0, 0.299992, 0.820476, 0.0256089, 0, 0.316992, 0.809514, 0.0240394, 0, 0.334374, 0.797865, 0.0225379, 0, 0.35214, 0.785621, 0.0211235, 0, 0.370296, 0.773765, 0.0197908, 0, 0.388849, 0.761629, 0.0185235, 0, 0.407807, 0.748891, 0.0173358, 0, 0.427178, 0.736437, 0.0162305, 0, 0.446974, 0.723707, 0.0151778, 0, 0.467207, 0.710606, 0.0141791, 0, 0.487892, 0.698019, 0.0132592, 0, 0.509046, 0.686203, 0.0123887, 0, 0.530687, 0.675692, 0.0115976, 0, 0.552839, 0.664826, 0.0108325, 0, 0.575527, 0.65349, 0.0101348, 0, 0.59878, 0.641774, 0.00947756, 0, 0.622634, 0.629794, 0.00886058, 0, 0.647128, 0.617647, 0.00828526, 0, 0.672308, 0.60534, 0.00775312, 0, 0.698231, 0.592718, 0.00726033, 0, 0.724958, 0.579746, 0.00679731, 0, 0.752563, 0.566763, 0.00636111, 0, 0.781127, 0.553515, 0.00595228, 0, 0.810733, 0.540118, 0.00556876, 0, 0.841426, 0.527325, 0.00523051, 0, 0.873016, 0.514265, 0.00490712, 0, 0.904762, 0.501406, 0.00460297, 0, 0.936508, 0.488922, 0.00431247, 0, 0.968254, 0.476541, 0.0040472, 0, 1, 1, 0.0659184, 0, 0, 1, 0.0659185, 0, 0, 0.999998, 0.06592, 0, 0, 0.999988, 0.0659259, 0, 0, 0.999963, 0.0659423, 0, 0, 0.999907, 0.0659764, 0, 0.000374198, 0.999806, 0.0660376, 0, 0.00182071, 0.999639, 0.0661361, 0, 0.0043894, 0.999378, 0.0662814, 0, 0.00800055, 0.998985, 0.0664779, 0, 0.0125594, 0.998285, 0.0666914, 0, 0.0179786, 0.995071, 0.0661989, 0, 0.0241822, 0.993172, 0.0660454, 0, 0.031106, 0.991438, 0.0660105, 0, 0.0386952, 0.988428, 0.0656875, 0, 0.0469032, 0.985218, 0.0652913, 0, 0.0556905, 0.981128, 0.0647107, 0, 0.065023, 0.976015, 0.0638491, 0, 0.0748717, 0.97097, 0.062993, 0, 0.0852112, 0.964582, 0.0617927, 0, 0.0960199, 0.957383, 0.0603626, 0, 0.107279, 0.949969, 0.0588128, 0, 0.118971, 0.941843, 0.0570274, 0, 0.131084, 0.933624, 0.0551885, 0, 0.143604, 0.924543, 0.053122, 0, 0.156521, 0.914919, 0.0508897, 0, 0.169825, 0.905773, 0.0486418, 0, 0.18351, 0.896434, 0.0463364, 0, 0.197569, 0.887195, 0.0440623, 0, 0.211997, 0.877706, 0.0417799, 0, 0.226789, 0.867719, 0.03945, 0, 0.241944, 0.858587, 0.037243, 0, 0.257458, 0.849317, 0.0350956, 0, 0.273331, 0.839585, 0.0329852, 0, 0.289563, 0.829856, 0.0310028, 0, 0.306154, 0.819589, 0.0290953, 0, 0.323108, 0.809714, 0.0272738, 0, 0.340426, 0.79934, 0.0255631, 0, 0.358113, 0.788224, 0.0239175, 0, 0.376175, 0.776619, 0.0223831, 0, 0.394616, 0.76521, 0.0209298, 0, 0.413445, 0.753716, 0.0195786, 0, 0.432671, 0.741564, 0.0183001, 0, 0.452305, 0.729413, 0.0171259, 0, 0.472358, 0.717146, 0.0159933, 0, 0.492845, 0.70436, 0.0149495, 0, 0.513783, 0.69219, 0.0139681, 0, 0.535189, 0.680289, 0.0130577, 0, 0.557087, 0.669611, 0.0122198, 0, 0.5795, 0.659113, 0.0114174, 0, 0.602459, 0.648148, 0.0106729, 0, 0.625997, 0.636905, 0.00998997, 0, 0.650154, 0.625154, 0.00934313, 0, 0.674976, 0.613481, 0.00874839, 0, 0.700518, 0.60154, 0.00818265, 0, 0.726845, 0.58943, 0.00766889, 0, 0.754032, 0.576828, 0.00717153, 0, 0.782167, 0.564194, 0.00672696, 0, 0.811344, 0.551501, 0.00630863, 0, 0.841644, 0.538635, 0.00592177, 0, 0.873016, 0.525724, 0.00554888, 0, 0.904762, 0.513209, 0.00520225, 0, 0.936508, 0.500457, 0.00488231, 0, 0.968254, 0.48799, 0.00457153, 0, 1, 1, 0.0810131, 0, 0, 1, 0.0810133, 0, 0, 0.999997, 0.0810145, 0, 0, 0.999985, 0.08102, 0, 0, 0.999956, 0.0810347, 0, 1.95026e-05, 0.999893, 0.0810656, 0, 0.000719316, 0.999777, 0.0811205, 0, 0.00259774, 0.999583, 0.081208, 0, 0.00561807, 0.999281, 0.0813343, 0, 0.00967472, 0.998813, 0.0814969, 0, 0.0146627, 0.997597, 0.0815217, 0, 0.0204902, 0.994379, 0.0808502, 0, 0.0270802, 0.992744, 0.0806792, 0, 0.0343674, 0.990745, 0.0804589, 0, 0.0422974, 0.986646, 0.0796107, 0, 0.0508242, 0.983611, 0.0790913, 0, 0.0599087, 0.978869, 0.0780746, 0, 0.0695175, 0.973475, 0.0768218, 0, 0.0796223, 0.967845, 0.0754926, 0, 0.0901983, 0.960778, 0.0737063, 0, 0.101224, 0.953333, 0.0718052, 0, 0.112682, 0.945274, 0.0695946, 0, 0.124555, 0.936955, 0.0672492, 0, 0.136831, 0.928319, 0.0647732, 0, 0.149496, 0.919075, 0.0620947, 0, 0.162542, 0.909114, 0.0591816, 0, 0.175958, 0.900137, 0.0563917, 0, 0.189739, 0.891069, 0.0535392, 0, 0.203877, 0.882262, 0.0507642, 0, 0.218368, 0.873232, 0.0479793, 0, 0.233208, 0.864042, 0.045226, 0, 0.248393, 0.855002, 0.0425413, 0, 0.263923, 0.846569, 0.0400126, 0, 0.279796, 0.837714, 0.0375269, 0, 0.296012, 0.828918, 0.0352027, 0, 0.312573, 0.819783, 0.0330011, 0, 0.329479, 0.810129, 0.0308908, 0, 0.346734, 0.800866, 0.0289112, 0, 0.364342, 0.79093, 0.0270255, 0, 0.382307, 0.780593, 0.0252758, 0, 0.400637, 0.769511, 0.0236178, 0, 0.419337, 0.758558, 0.0220652, 0, 0.438418, 0.747632, 0.0206289, 0, 0.457889, 0.736146, 0.0192873, 0, 0.477761, 0.724093, 0.0180333, 0, 0.49805, 0.71234, 0.0168264, 0, 0.51877, 0.700201, 0.015746, 0, 0.53994, 0.687949, 0.0147027, 0, 0.561581, 0.676163, 0.0137512, 0, 0.583718, 0.665001, 0.0128655, 0, 0.60638, 0.65472, 0.0120366, 0, 0.629599, 0.644213, 0.0112604, 0, 0.653415, 0.633382, 0.0105413, 0, 0.677874, 0.62212, 0.00986498, 0, 0.70303, 0.610631, 0.00923308, 0, 0.728948, 0.599078, 0.00864206, 0, 0.755706, 0.587519, 0.00811784, 0, 0.783396, 0.575505, 0.00761237, 0, 0.812121, 0.563148, 0.00713949, 0, 0.841989, 0.550828, 0.00668379, 0, 0.873035, 0.538458, 0.00627715, 0, 0.904762, 0.525905, 0.00588336, 0, 0.936508, 0.513517, 0.00552687, 0, 0.968254, 0.501395, 0.00519681, 0, 1, 1, 0.0991506, 0, 0, 1, 0.0991504, 0, 0, 0.999996, 0.0991515, 0, 0, 0.999984, 0.0991558, 0, 0, 0.999947, 0.0991672, 0, 0.000114389, 0.999874, 0.0991912, 0, 0.00121503, 0.999739, 0.0992331, 0, 0.00356108, 0.999514, 0.0992983, 0, 0.00705578, 0.999159, 0.0993877, 0, 0.011574, 0.998586, 0.0994837, 0, 0.017003, 0.995731, 0.0988425, 0, 0.0232484, 0.993384, 0.098276, 0, 0.0302318, 0.991615, 0.0979269, 0, 0.0378884, 0.989029, 0.0973432, 0, 0.0461641, 0.985373, 0.0963539, 0, 0.0550136, 0.981278, 0.0952306, 0, 0.0643988, 0.975777, 0.0936233, 0, 0.0742868, 0.970526, 0.0920219, 0, 0.0846501, 0.963755, 0.0898912, 0, 0.0954644, 0.956676, 0.0876064, 0, 0.106709, 0.948099, 0.0847751, 0, 0.118367, 0.939718, 0.0818638, 0, 0.130423, 0.931305, 0.078857, 0, 0.142862, 0.922342, 0.0756127, 0, 0.155674, 0.912842, 0.0721473, 0, 0.168849, 0.903304, 0.0686195, 0, 0.182378, 0.89411, 0.0650589, 0, 0.196255, 0.885512, 0.0616022, 0, 0.210473, 0.877193, 0.0582434, 0, 0.225027, 0.86877, 0.0548979, 0, 0.239915, 0.860267, 0.0516095, 0, 0.255132, 0.851915, 0.048468, 0, 0.270678, 0.843912, 0.0454447, 0, 0.286551, 0.83604, 0.0425612, 0, 0.302751, 0.828245, 0.0398752, 0, 0.31928, 0.820159, 0.0373198, 0, 0.336138, 0.81167, 0.034916, 0, 0.35333, 0.802659, 0.0326402, 0, 0.370858, 0.793921, 0.0304901, 0, 0.388728, 0.784713, 0.0284857, 0, 0.406944, 0.774946, 0.0266186, 0, 0.425515, 0.76448, 0.0248593, 0, 0.444449, 0.753793, 0.0232114, 0, 0.463756, 0.743506, 0.0217039, 0, 0.483447, 0.732555, 0.0202841, 0, 0.503535, 0.720965, 0.0189648, 0, 0.524036, 0.709422, 0.0177189, 0, 0.544968, 0.697756, 0.0165626, 0, 0.56635, 0.685565, 0.015483, 0, 0.588208, 0.673987, 0.0144892, 0, 0.610569, 0.66244, 0.0135607, 0, 0.633466, 0.651675, 0.0126956, 0, 0.656936, 0.641598, 0.0118788, 0, 0.681025, 0.63121, 0.0111261, 0, 0.705788, 0.620514, 0.010437, 0, 0.731289, 0.609366, 0.00978747, 0, 0.757606, 0.598137, 0.00917257, 0, 0.784834, 0.586966, 0.00859778, 0, 0.813085, 0.575549, 0.00806803, 0, 0.842485, 0.563797, 0.00757294, 0, 0.87313, 0.551758, 0.00710592, 0, 0.904762, 0.539894, 0.0066841, 0, 0.936508, 0.527901, 0.00627901, 0, 0.968254, 0.515819, 0.00590506, 0, 1, 1, 0.120864, 0, 0, 1, 0.120864, 0, 0, 0.999996, 0.120864, 0, 0, 0.99998, 0.120867, 0, 0, 0.99994, 0.120872, 0, 0.000323781, 0.999852, 0.120884, 0, 0.00188693, 0.999693, 0.120903, 0, 0.00473489, 0.999426, 0.120929, 0, 0.00872704, 0.999002, 0.120955, 0, 0.0137237, 0.998235, 0.120918, 0, 0.0196068, 0.994608, 0.119764, 0, 0.0262803, 0.992997, 0.119265, 0, 0.0336657, 0.990968, 0.11863, 0, 0.0416987, 0.987002, 0.117261, 0, 0.0503261, 0.983524, 0.116009, 0, 0.0595035, 0.97875, 0.114252, 0, 0.0691935, 0.972652, 0.11193, 0, 0.0793645, 0.966613, 0.109555, 0, 0.0899894, 0.959275, 0.106612, 0, 0.101045, 0.951272, 0.103375, 0, 0.112512, 0.942323, 0.0996594, 0, 0.124372, 0.933679, 0.0958841, 0, 0.136611, 0.924822, 0.0919265, 0, 0.149216, 0.915742, 0.0878061, 0, 0.162176, 0.906348, 0.0834894, 0, 0.175482, 0.896883, 0.079085, 0, 0.189125, 0.88774, 0.0746745, 0, 0.203098, 0.87986, 0.0705773, 0, 0.217396, 0.871998, 0.0665005, 0, 0.232015, 0.864325, 0.0625413, 0, 0.24695, 0.856685, 0.0586781, 0, 0.2622, 0.84925, 0.0550063, 0, 0.277761, 0.841719, 0.0514727, 0, 0.293634, 0.834755, 0.0481398, 0, 0.309819, 0.827853, 0.0450172, 0, 0.326315, 0.820888, 0.0420969, 0, 0.343126, 0.813616, 0.0393702, 0, 0.360254, 0.805767, 0.0367771, 0, 0.377701, 0.797338, 0.0343274, 0, 0.395474, 0.789122, 0.0320529, 0, 0.413577, 0.780601, 0.0299485, 0, 0.432018, 0.771424, 0.0279812, 0, 0.450804, 0.761502, 0.0261054, 0, 0.469944, 0.751166, 0.0243942, 0, 0.489451, 0.741276, 0.0228087, 0, 0.509337, 0.730898, 0.0213265, 0, 0.529617, 0.719878, 0.0199307, 0, 0.550307, 0.708379, 0.0186574, 0, 0.571428, 0.697165, 0.0174446, 0, 0.593003, 0.685554, 0.0163144, 0, 0.615059, 0.673631, 0.015276, 0, 0.637628, 0.662385, 0.0143003, 0, 0.660746, 0.651059, 0.0134112, 0, 0.68446, 0.640451, 0.0125794, 0, 0.70882, 0.630536, 0.011793, 0, 0.733893, 0.620316, 0.0110547, 0, 0.759756, 0.609722, 0.0103668, 0, 0.786505, 0.598804, 0.00973009, 0, 0.814259, 0.587871, 0.00912812, 0, 0.843157, 0.577121, 0.00858916, 0, 0.87334, 0.566019, 0.00807333, 0, 0.904762, 0.554664, 0.00759687, 0, 0.936508, 0.543101, 0.00714759, 0, 0.968254, 0.531558, 0.00673418, 0, 1, 1, 0.146767, 0, 0, 1, 0.146767, 0, 0, 0.999997, 0.146767, 0, 0, 0.999977, 0.146765, 0, 3.20658e-06, 0.999929, 0.146762, 0, 0.000682576, 0.999823, 0.146753, 0, 0.00276402, 0.999633, 0.146735, 0, 0.00614771, 0.999314, 0.146699, 0, 0.0106613, 0.998796, 0.14662, 0, 0.0161546, 0.997124, 0.146107, 0, 0.0225063, 0.994062, 0.144857, 0, 0.0296198, 0.992154, 0.144011, 0, 0.037417, 0.989186, 0.142712, 0, 0.0458348, 0.985279, 0.140926, 0, 0.0548211, 0.980826, 0.13885, 0, 0.0643326, 0.975056, 0.136168, 0, 0.074333, 0.969005, 0.133217, 0, 0.0847917, 0.961554, 0.12959, 0, 0.0956828, 0.954206, 0.125886, 0, 0.106984, 0.945046, 0.121335, 0, 0.118675, 0.935678, 0.116492, 0, 0.130741, 0.926748, 0.111635, 0, 0.143166, 0.917764, 0.106625, 0, 0.155939, 0.908358, 0.101325, 0, 0.169049, 0.899219, 0.0960249, 0, 0.182487, 0.890089, 0.0906527, 0, 0.196245, 0.881488, 0.0853905, 0, 0.210317, 0.874031, 0.0804177, 0, 0.224697, 0.866932, 0.0756005, 0, 0.23938, 0.859976, 0.0709019, 0, 0.254364, 0.853375, 0.0664391, 0, 0.269646, 0.846971, 0.0622012, 0, 0.285223, 0.840483, 0.058129, 0, 0.301096, 0.833969, 0.0542762, 0, 0.317265, 0.82806, 0.0507042, 0, 0.333729, 0.822128, 0.047368, 0, 0.350491, 0.815989, 0.044272, 0, 0.367554, 0.809336, 0.0413444, 0, 0.38492, 0.802177, 0.038601, 0, 0.402594, 0.79441, 0.0360227, 0, 0.420582, 0.786573, 0.0336383, 0, 0.438891, 0.778619, 0.0314321, 0, 0.457527, 0.77, 0.029362, 0, 0.476499, 0.760698, 0.0274102, 0, 0.49582, 0.750932, 0.0256146, 0, 0.5155, 0.740993, 0.023974, 0, 0.535555, 0.731159, 0.0224182, 0, 0.556, 0.720836, 0.0209889, 0, 0.576855, 0.709913, 0.0196411, 0, 0.598143, 0.698415, 0.0183824, 0, 0.619888, 0.68745, 0.0172222, 0, 0.642123, 0.676154, 0.0161509, 0, 0.664883, 0.664383, 0.0151397, 0, 0.688211, 0.6533, 0.0141873, 0, 0.71216, 0.642072, 0.0133105, 0, 0.736792, 0.631412, 0.0124932, 0, 0.762186, 0.621622, 0.0117408, 0, 0.788439, 0.611681, 0.0110358, 0, 0.815672, 0.60142, 0.0103775, 0, 0.844034, 0.59083, 0.00975623, 0, 0.873699, 0.580254, 0.00918084, 0, 0.904765, 0.569841, 0.00864721, 0, 0.936508, 0.559224, 0.00815731, 0, 0.968254, 0.548315, 0.00767924, 0, 1, 1, 0.177563, 0, 0, 1, 0.177563, 0, 0, 0.999994, 0.177562, 0, 0, 0.999972, 0.177555, 0, 6.64171e-05, 0.999914, 0.177536, 0, 0.0012276, 0.999787, 0.177496, 0, 0.00388025, 0.999556, 0.17742, 0, 0.00783463, 0.999165, 0.177285, 0, 0.0128953, 0.9985, 0.177037, 0, 0.0189053, 0.995388, 0.175634, 0, 0.025742, 0.993102, 0.174375, 0, 0.033309, 0.990992, 0.173121, 0, 0.0415298, 0.986932, 0.170896, 0, 0.0503425, 0.982786, 0.16847, 0, 0.0596964, 0.977592, 0.165455, 0, 0.0695498, 0.971075, 0.161676, 0, 0.0798676, 0.963967, 0.157458, 0, 0.0906201, 0.956397, 0.152836, 0, 0.101783, 0.947489, 0.147467, 0, 0.113333, 0.937564, 0.14145, 0, 0.125254, 0.928182, 0.135383, 0, 0.137529, 0.919027, 0.129212, 0, 0.150144, 0.909618, 0.12276, 0, 0.163088, 0.900492, 0.116273, 0, 0.176351, 0.891671, 0.1098, 0, 0.189924, 0.883146, 0.103362, 0, 0.203799, 0.875151, 0.0970799, 0, 0.21797, 0.868338, 0.0911732, 0, 0.232433, 0.862033, 0.0854966, 0, 0.247182, 0.856107, 0.0800691, 0, 0.262216, 0.850644, 0.0749618, 0, 0.27753, 0.845261, 0.070079, 0, 0.293124, 0.839885, 0.0654321, 0, 0.308997, 0.834609, 0.0610975, 0, 0.325149, 0.829083, 0.0569741, 0, 0.341581, 0.82404, 0.0531736, 0, 0.358294, 0.818968, 0.049665, 0, 0.37529, 0.813496, 0.0463856, 0, 0.392573, 0.807533, 0.0433217, 0, 0.410148, 0.80099, 0.0404402, 0, 0.428019, 0.793891, 0.0377578, 0, 0.446192, 0.786281, 0.0352616, 0, 0.464676, 0.778773, 0.0329577, 0, 0.483478, 0.770737, 0.030808, 0, 0.502608, 0.762094, 0.0287964, 0, 0.522079, 0.752898, 0.0269254, 0, 0.541905, 0.743306, 0.0251926, 0, 0.5621, 0.733416, 0.023595, 0, 0.582684, 0.723742, 0.0221155, 0, 0.603677, 0.713542, 0.0207435, 0, 0.625106, 0.702755, 0.019434, 0, 0.646998, 0.691484, 0.0182046, 0, 0.66939, 0.680531, 0.0170771, 0, 0.692324, 0.66953, 0.0160339, 0, 0.715849, 0.658126, 0.0150677, 0, 0.740028, 0.646933, 0.0141551, 0, 0.764937, 0.636107, 0.0133179, 0, 0.790673, 0.625271, 0.0125284, 0, 0.817358, 0.615225, 0.0117937, 0, 0.84515, 0.605678, 0.0111181, 0, 0.874244, 0.59583, 0.0104759, 0, 0.904828, 0.585704, 0.00986672, 0, 0.936508, 0.575413, 0.00929712, 0, 0.968254, 0.565373, 0.00876713, 0, 1, 1, 0.214058, 0, 0, 0.999999, 0.214058, 0, 0, 0.999994, 0.214055, 0, 0, 0.999966, 0.214039, 0, 0.000259642, 0.999893, 0.213998, 0, 0.00200075, 0.999737, 0.21391, 0, 0.00527775, 0.999449, 0.213745, 0, 0.00983959, 0.99896, 0.213458, 0, 0.0154755, 0.9979, 0.212855, 0, 0.0220249, 0.994278, 0.210779, 0, 0.0293654, 0.992254, 0.20926, 0, 0.0374021, 0.98881, 0.206908, 0, 0.0460604, 0.984715, 0.204009, 0, 0.0552802, 0.979738, 0.200471, 0, 0.0650127, 0.972884, 0.195813, 0, 0.0752175, 0.965996, 0.190856, 0, 0.0858612, 0.957974, 0.185077, 0, 0.0969155, 0.949155, 0.17868, 0, 0.108356, 0.939288, 0.171513, 0, 0.120163, 0.928996, 0.163838, 0, 0.132319, 0.919563, 0.156246, 0, 0.144808, 0.910004, 0.148359, 0, 0.157618, 0.900791, 0.140417, 0, 0.170737, 0.892135, 0.132569, 0, 0.184155, 0.883803, 0.124741, 0, 0.197866, 0.876034, 0.117091, 0, 0.211861, 0.869219, 0.109835, 0, 0.226134, 0.863062, 0.102859, 0, 0.240682, 0.857795, 0.0962928, 0, 0.255499, 0.853009, 0.0900725, 0, 0.270583, 0.848603, 0.0842101, 0, 0.285931, 0.844335, 0.0786527, 0, 0.301542, 0.840208, 0.0734397, 0, 0.317415, 0.836035, 0.0685334, 0, 0.33355, 0.83172, 0.0639275, 0, 0.349948, 0.827135, 0.0595909, 0, 0.36661, 0.822797, 0.0556204, 0, 0.383539, 0.818387, 0.0519394, 0, 0.400738, 0.813565, 0.0485317, 0, 0.41821, 0.808142, 0.0453138, 0, 0.435961, 0.802212, 0.0423354, 0, 0.453997, 0.79573, 0.0395553, 0, 0.472324, 0.788741, 0.036988, 0, 0.490951, 0.781093, 0.0345688, 0, 0.509887, 0.773597, 0.0323297, 0, 0.529144, 0.765622, 0.0302719, 0, 0.548735, 0.757083, 0.0283477, 0, 0.568674, 0.747992, 0.0265562, 0, 0.588979, 0.738591, 0.0248844, 0, 0.609671, 0.728719, 0.0233342, 0, 0.630773, 0.719146, 0.0219081, 0, 0.652314, 0.709165, 0.0205711, 0, 0.674328, 0.69875, 0.0193248, 0, 0.696854, 0.687884, 0.0181582, 0, 0.719942, 0.676818, 0.0170746, 0, 0.743651, 0.666247, 0.0160718, 0, 0.768057, 0.655284, 0.0151262, 0, 0.793253, 0.64401, 0.0142561, 0, 0.819363, 0.633353, 0.0134327, 0, 0.846547, 0.622674, 0.012653, 0, 0.875017, 0.612265, 0.0119354, 0, 0.905021, 0.602455, 0.0112533, 0, 0.936508, 0.593147, 0.0106234, 0, 0.968254, 0.583592, 0.0100213, 0, 1, 1, 0.25717, 0, 0, 1, 0.25717, 0, 0, 0.999992, 0.257164, 0, 0, 0.999958, 0.257135, 0, 0.000641715, 0.999864, 0.25706, 0, 0.00305314, 0.999666, 0.256897, 0, 0.00700975, 0.999302, 0.256596, 0, 0.0122194, 0.998663, 0.25607, 0, 0.0184622, 0.995607, 0.254123, 0, 0.0255773, 0.993094, 0.252081, 0, 0.0334439, 0.9907, 0.249867, 0, 0.0419696, 0.98594, 0.246118, 0, 0.0510823, 0.981214, 0.242049, 0, 0.0607242, 0.974966, 0.236869, 0, 0.0708486, 0.967589, 0.230724, 0, 0.081417, 0.95915, 0.223635, 0, 0.0923974, 0.950257, 0.21596, 0, 0.103763, 0.940165, 0.207296, 0, 0.115491, 0.929396, 0.197901, 0, 0.127562, 0.919288, 0.188437, 0, 0.13996, 0.909428, 0.178762, 0, 0.15267, 0.900105, 0.169072, 0, 0.165679, 0.891418, 0.159478, 0, 0.178979, 0.883347, 0.15002, 0, 0.192558, 0.875992, 0.140813, 0, 0.20641, 0.869466, 0.13196, 0, 0.220529, 0.863699, 0.123501, 0, 0.234907, 0.858553, 0.115436, 0, 0.249542, 0.854379, 0.107901, 0, 0.264428, 0.850894, 0.10088, 0, 0.279564, 0.847632, 0.0942296, 0, 0.294947, 0.844571, 0.0879861, 0, 0.310575, 0.84163, 0.0821534, 0, 0.326448, 0.838542, 0.0766409, 0, 0.342566, 0.835412, 0.0715322, 0, 0.358929, 0.831899, 0.0666883, 0, 0.37554, 0.828177, 0.0622175, 0, 0.392399, 0.82416, 0.0580452, 0, 0.409511, 0.820393, 0.054267, 0, 0.426878, 0.816068, 0.0507172, 0, 0.444506, 0.811201, 0.0474041, 0, 0.4624, 0.805785, 0.0443174, 0, 0.480566, 0.799878, 0.0414562, 0, 0.499013, 0.793469, 0.0388147, 0, 0.517749, 0.786473, 0.0363453, 0, 0.536785, 0.778874, 0.0340225, 0, 0.556134, 0.771277, 0.0318599, 0, 0.575809, 0.763426, 0.0298859, 0, 0.595827, 0.755044, 0.0280357, 0, 0.616207, 0.746161, 0.0262979, 0, 0.636973, 0.737124, 0.0247295, 0, 0.65815, 0.72761, 0.0232514, 0, 0.679772, 0.717822, 0.0218755, 0, 0.701876, 0.708279, 0.0205942, 0, 0.724509, 0.698333, 0.0193947, 0, 0.74773, 0.68802, 0.0182717, 0, 0.771609, 0.677321, 0.0172044, 0, 0.79624, 0.666504, 0.0162122, 0, 0.821743, 0.656184, 0.0152924, 0, 0.84828, 0.64556, 0.0144326, 0, 0.876069, 0.634636, 0.0136157, 0, 0.905404, 0.624124, 0.0128612, 0, 0.936508, 0.613914, 0.0121435, 0, 0.968254, 0.603589, 0.0114887, 0, 1, 1, 0.307946, 0, 0, 0.999999, 0.307945, 0, 0, 0.999988, 0.307934, 0, 2.04479e-05, 0.999944, 0.307886, 0, 0.00127833, 0.999824, 0.307756, 0, 0.00445047, 0.999565, 0.30748, 0, 0.00914673, 0.999085, 0.306966, 0, 0.0150498, 0.998103, 0.306004, 0, 0.0219367, 0.994249, 0.303028, 0, 0.0296485, 0.991807, 0.300435, 0, 0.038068, 0.987773, 0.296554, 0, 0.0471062, 0.982673, 0.2916, 0, 0.0566942, 0.976623, 0.285641, 0, 0.0667768, 0.968757, 0.27815, 0, 0.0773099, 0.959849, 0.269529, 0, 0.088257, 0.950663, 0.260248, 0, 0.0995879, 0.940129, 0.249704, 0, 0.111277, 0.92895, 0.238291, 0, 0.123304, 0.917996, 0.226501, 0, 0.13565, 0.907813, 0.214669, 0, 0.148299, 0.898305, 0.202835, 0, 0.161237, 0.889626, 0.191158, 0, 0.174455, 0.88175, 0.179695, 0, 0.187941, 0.874715, 0.168548, 0, 0.201687, 0.868746, 0.15792, 0, 0.215687, 0.863703, 0.147807, 0, 0.229933, 0.859315, 0.138149, 0, 0.24442, 0.855538, 0.128993, 0, 0.259145, 0.852428, 0.120414, 0, 0.274103, 0.850168, 0.112498, 0, 0.289293, 0.848132, 0.105054, 0, 0.304711, 0.846291, 0.0981087, 0, 0.320357, 0.844431, 0.0915942, 0, 0.33623, 0.842493, 0.0855056, 0, 0.35233, 0.840368, 0.0798204, 0, 0.368658, 0.83798, 0.0745097, 0, 0.385214, 0.83523, 0.0695424, 0, 0.402002, 0.832091, 0.0649092, 0, 0.419023, 0.828667, 0.0606291, 0, 0.436282, 0.824805, 0.0566523, 0, 0.453782, 0.820988, 0.0530229, 0, 0.471529, 0.816635, 0.0496364, 0, 0.489528, 0.811725, 0.0464658, 0, 0.507788, 0.806316, 0.0435082, 0, 0.526317, 0.800469, 0.0407873, 0, 0.545124, 0.794107, 0.038255, 0, 0.564221, 0.787218, 0.0358825, 0, 0.583621, 0.779872, 0.0336785, 0, 0.603341, 0.772097, 0.0316379, 0, 0.623397, 0.764484, 0.0297379, 0, 0.643812, 0.756428, 0.0279581, 0, 0.664611, 0.748022, 0.0263153, 0, 0.685824, 0.739268, 0.0247799, 0, 0.707488, 0.73024, 0.0233385, 0, 0.729646, 0.720893, 0.0220035, 0, 0.752354, 0.71119, 0.0207555, 0, 0.77568, 0.701791, 0.0195843, 0, 0.799715, 0.692184, 0.0184891, 0, 0.824574, 0.682258, 0.0174541, 0, 0.850417, 0.67206, 0.0164873, 0, 0.877466, 0.661717, 0.0155959, 0, 0.90604, 0.651462, 0.0147519, 0, 0.936528, 0.641467, 0.0139727, 0, 0.968254, 0.631229, 0.0132363, 0, 1, 1, 0.367573, 0, 0, 0.999999, 0.367571, 0, 0, 0.999984, 0.367553, 0, 0.000183382, 0.999925, 0.367473, 0, 0.00225254, 0.999759, 0.367259, 0, 0.00628165, 0.99941, 0.366801, 0, 0.0117858, 0.998739, 0.365946, 0, 0.0184359, 0.995529, 0.363191, 0, 0.0260114, 0.992875, 0.360171, 0, 0.0343581, 0.989135, 0.355981, 0, 0.0433637, 0.984166, 0.350401, 0, 0.0529438, 0.977871, 0.343348, 0, 0.0630334, 0.96951, 0.334341, 0, 0.0735805, 0.959964, 0.323862, 0, 0.0845437, 0.950162, 0.312521, 0, 0.095889, 0.938882, 0.299577, 0, 0.107588, 0.926992, 0.285573, 0, 0.119617, 0.915589, 0.271212, 0, 0.131957, 0.904791, 0.256611, 0, 0.144591, 0.895177, 0.242224, 0, 0.157503, 0.886403, 0.227952, 0, 0.170682, 0.878957, 0.214192, 0, 0.184117, 0.872418, 0.200795, 0, 0.197799, 0.867029, 0.188015, 0, 0.21172, 0.862835, 0.175975, 0, 0.225873, 0.859411, 0.164526, 0, 0.240253, 0.856655, 0.153693, 0, 0.254854, 0.854519, 0.14352, 0, 0.269673, 0.852828, 0.13397, 0, 0.284707, 0.851412, 0.124984, 0, 0.299953, 0.850609, 0.116748, 0, 0.315408, 0.849855, 0.10905, 0, 0.331073, 0.849017, 0.101839, 0, 0.346946, 0.848079, 0.0951359, 0, 0.363028, 0.846911, 0.0888774, 0, 0.379318, 0.845445, 0.0830375, 0, 0.395818, 0.84362, 0.0775844, 0, 0.41253, 0.841411, 0.0725054, 0, 0.429457, 0.838768, 0.0677691, 0, 0.446602, 0.835801, 0.0634016, 0, 0.463968, 0.832341, 0.0593095, 0, 0.481561, 0.828424, 0.0555121, 0, 0.499386, 0.824312, 0.052024, 0, 0.51745, 0.819918, 0.0487865, 0, 0.535761, 0.815072, 0.0457801, 0, 0.554328, 0.809863, 0.0430184, 0, 0.573162, 0.804164, 0.0404245, 0, 0.592275, 0.798034, 0.0380146, 0, 0.611681, 0.791436, 0.0357436, 0, 0.631398, 0.784498, 0.0336475, 0, 0.651445, 0.777125, 0.0316666, 0, 0.671845, 0.769365, 0.0298122, 0, 0.692628, 0.761579, 0.0281001, 0, 0.713827, 0.753746, 0.0265049, 0, 0.735484, 0.745573, 0.0250067, 0, 0.75765, 0.737083, 0.0236026, 0, 0.78039, 0.728545, 0.0223302, 0, 0.803789, 0.719691, 0.0211243, 0, 0.82796, 0.710569, 0.0199983, 0, 0.853056, 0.701216, 0.0189569, 0, 0.879298, 0.692094, 0.0179702, 0, 0.907014, 0.682909, 0.0170418, 0, 0.936691, 0.673509, 0.0161732, 0, 0.968254, 0.663863, 0.0153406, 0, 1, 1, 0.437395, 0, 0, 0.999998, 0.437394, 0, 0, 0.99998, 0.437363, 0, 0.000616704, 0.999891, 0.437232, 0, 0.00367925, 0.999656, 0.436877, 0, 0.00867446, 0.999148, 0.436121, 0, 0.0150679, 0.997959, 0.434564, 0, 0.022531, 0.993464, 0.430134, 0, 0.0308507, 0.990606, 0.426077, 0, 0.0398805, 0.985027, 0.419397, 0, 0.0495148, 0.978491, 0.41118, 0, 0.0596749, 0.969643, 0.40048, 0, 0.0703001, 0.959189, 0.38769, 0, 0.0813427, 0.948223, 0.373575, 0, 0.0927641, 0.935955, 0.357622, 0, 0.104533, 0.923237, 0.34043, 0, 0.116624, 0.911074, 0.322735, 0, 0.129015, 0.899724, 0.30479, 0, 0.141687, 0.890189, 0.287392, 0, 0.154626, 0.881796, 0.270248, 0, 0.167818, 0.874781, 0.253659, 0, 0.181252, 0.869166, 0.237786, 0, 0.194918, 0.864725, 0.222618, 0, 0.208807, 0.861565, 0.208356, 0, 0.222913, 0.859284, 0.194867, 0, 0.237229, 0.857677, 0.18212, 0, 0.25175, 0.856714, 0.17018, 0, 0.266473, 0.856155, 0.158969, 0, 0.281392, 0.8558, 0.148413, 0, 0.296505, 0.855672, 0.138578, 0, 0.311811, 0.855538, 0.129345, 0, 0.327306, 0.855689, 0.120861, 0, 0.342991, 0.855767, 0.112969, 0, 0.358864, 0.855618, 0.105593, 0, 0.374925, 0.85525, 0.0987451, 0, 0.391176, 0.854583, 0.0923727, 0, 0.407616, 0.853534, 0.0864143, 0, 0.424249, 0.852061, 0.0808338, 0, 0.441076, 0.850253, 0.0756771, 0, 0.4581, 0.848004, 0.0708612, 0, 0.475324, 0.845333, 0.0663784, 0, 0.492754, 0.842376, 0.0622631, 0, 0.510394, 0.838956, 0.0584112, 0, 0.528251, 0.835121, 0.0548328, 0, 0.546331, 0.830842, 0.0514838, 0, 0.564644, 0.826212, 0.048355, 0, 0.583198, 0.821522, 0.0454714, 0, 0.602005, 0.816551, 0.0428263, 0, 0.621078, 0.811211, 0.0403612, 0, 0.640434, 0.805479, 0.038039, 0, 0.660089, 0.799409, 0.0358739, 0, 0.680066, 0.79306, 0.0338727, 0, 0.70039, 0.786395, 0.0319985, 0, 0.721094, 0.779416, 0.030241, 0, 0.742215, 0.77214, 0.0285951, 0, 0.7638, 0.764636, 0.0270747, 0, 0.785912, 0.756836, 0.0256354, 0, 0.808628, 0.749315, 0.0243027, 0, 0.832055, 0.741561, 0.0230497, 0, 0.856338, 0.733589, 0.0218801, 0, 0.88169, 0.725479, 0.020784, 0, 0.908441, 0.717255, 0.0197702, 0, 0.937125, 0.708829, 0.0188168, 0, 0.968254, 0.700191, 0.0179113, 0, 1, 1, 0.518937, 0, 0, 0.999998, 0.518933, 0, 0, 0.999967, 0.518883, 0, 0.00147741, 0.999832, 0.51866, 0, 0.00573221, 0.999466, 0.518057, 0, 0.011826, 0.998644, 0.516752, 0, 0.0192116, 0.994458, 0.512347, 0, 0.027573, 0.991223, 0.507675, 0, 0.0367099, 0.985515, 0.500188, 0, 0.046487, 0.978308, 0.490408, 0, 0.0568071, 0.968359, 0.477357, 0, 0.0675984, 0.95682, 0.461752, 0, 0.0788059, 0.943929, 0.443796, 0, 0.090386, 0.930224, 0.423893, 0, 0.102304, 0.916514, 0.402682, 0, 0.114532, 0.903653, 0.380914, 0, 0.127047, 0.892315, 0.359212, 0, 0.139828, 0.882942, 0.338102, 0, 0.152861, 0.875438, 0.31773, 0, 0.16613, 0.869642, 0.298186, 0, 0.179624, 0.865304, 0.279491, 0, 0.193332, 0.862382, 0.261804, 0, 0.207247, 0.860666, 0.245146, 0, 0.22136, 0.859788, 0.229406, 0, 0.235666, 0.859608, 0.214605, 0, 0.250158, 0.859912, 0.200691, 0, 0.264832, 0.86053, 0.187623, 0, 0.279684, 0.861368, 0.17539, 0, 0.294711, 0.862237, 0.163901, 0, 0.309911, 0.863127, 0.153175, 0, 0.32528, 0.863923, 0.143147, 0, 0.340819, 0.864567, 0.133781, 0, 0.356524, 0.865013, 0.125042, 0, 0.372397, 0.86539, 0.116952, 0, 0.388438, 0.865591, 0.109476, 0, 0.404645, 0.865517, 0.102542, 0, 0.421022, 0.865084, 0.0960688, 0, 0.437569, 0.864309, 0.0900499, 0, 0.454287, 0.863151, 0.0844328, 0, 0.471181, 0.861649, 0.0792218, 0, 0.488253, 0.859742, 0.0743482, 0, 0.505507, 0.857446, 0.0697963, 0, 0.522947, 0.854757, 0.0655364, 0, 0.54058, 0.851783, 0.061608, 0, 0.558412, 0.848516, 0.0579701, 0, 0.576449, 0.844897, 0.0545742, 0, 0.594701, 0.840956, 0.0514167, 0, 0.613178, 0.836676, 0.0484598, 0, 0.631892, 0.832075, 0.0456934, 0, 0.650856, 0.827191, 0.0431178, 0, 0.670088, 0.822295, 0.0407718, 0, 0.689606, 0.817294, 0.0386032, 0, 0.709434, 0.812013, 0.0365675, 0, 0.7296, 0.806465, 0.0346547, 0, 0.750138, 0.800691, 0.0328717, 0, 0.771093, 0.794709, 0.031211, 0, 0.792519, 0.788493, 0.0296504, 0, 0.814488, 0.782049, 0.0281782, 0, 0.837097, 0.775403, 0.0267965, 0, 0.860481, 0.76857, 0.0255002, 0, 0.884842, 0.761536, 0.0242759, 0, 0.910494, 0.754303, 0.0231142, 0, 0.937985, 0.74692, 0.0220305, 0, 0.968254, 0.739745, 0.0210192, 0, 1, 1, 0.613914, 0, 0, 0.999996, 0.613907, 0, 9.63597e-05, 0.999942, 0.613814, 0, 0.00301247, 0.999704, 0.613407, 0, 0.00870385, 0.999046, 0.612302, 0, 0.0160714, 0.995516, 0.608266, 0, 0.0245899, 0.991726, 0.602863, 0, 0.0339681, 0.985157, 0.593956, 0, 0.0440254, 0.97642, 0.581748, 0, 0.0546409, 0.964404, 0.565183, 0, 0.0657284, 0.950601, 0.545273, 0, 0.0772246, 0.935158, 0.522129, 0, 0.0890812, 0.919364, 0.496782, 0, 0.10126, 0.904754, 0.470571, 0, 0.113731, 0.89176, 0.444037, 0, 0.126469, 0.881492, 0.418322, 0, 0.139454, 0.873656, 0.393522, 0, 0.15267, 0.868053, 0.369795, 0, 0.166101, 0.864336, 0.347171, 0, 0.179736, 0.862259, 0.325737, 0, 0.193565, 0.861556, 0.305532, 0, 0.207578, 0.861776, 0.286416, 0, 0.221769, 0.862661, 0.268355, 0, 0.23613, 0.864015, 0.251334, 0, 0.250656, 0.865711, 0.235352, 0, 0.265343, 0.867519, 0.220302, 0, 0.280187, 0.869351, 0.206161, 0, 0.295183, 0.871144, 0.192908, 0, 0.31033, 0.872839, 0.180505, 0, 0.325624, 0.874307, 0.168848, 0, 0.341065, 0.875667, 0.158021, 0, 0.35665, 0.876758, 0.147877, 0, 0.37238, 0.87764, 0.138441, 0, 0.388253, 0.878237, 0.129627, 0, 0.404269, 0.878563, 0.121415, 0, 0.42043, 0.878572, 0.113741, 0, 0.436735, 0.87842, 0.106652, 0, 0.453187, 0.878057, 0.100097, 0, 0.469786, 0.877413, 0.0940128, 0, 0.486536, 0.87646, 0.0883462, 0, 0.503439, 0.875233, 0.0830924, 0, 0.520498, 0.8737, 0.0781975, 0, 0.537717, 0.871873, 0.07364, 0, 0.555102, 0.86978, 0.0694103, 0, 0.572657, 0.867405, 0.0654696, 0, 0.59039, 0.864751, 0.0617914, 0, 0.608307, 0.861818, 0.0583491, 0, 0.626419, 0.858645, 0.0551443, 0, 0.644733, 0.855307, 0.0521894, 0, 0.663264, 0.851736, 0.0494334, 0, 0.682025, 0.847927, 0.0468504, 0, 0.701032, 0.843888, 0.0444261, 0, 0.720308, 0.839629, 0.0421497, 0, 0.739875, 0.835158, 0.0400082, 0, 0.759764, 0.830509, 0.0380076, 0, 0.780014, 0.825714, 0.0361488, 0, 0.800673, 0.820729, 0.0343956, 0, 0.821803, 0.815751, 0.0327781, 0, 0.843492, 0.810752, 0.031275, 0, 0.86586, 0.805587, 0.0298542, 0, 0.889087, 0.800317, 0.0285397, 0, 0.913466, 0.79489, 0.0272948, 0, 0.93952, 0.789314, 0.0261139, 0, 0.96835, 0.783593, 0.0249938, 0, 1, 1, 0.724258, 0, 0, 0.999992, 0.724243, 0, 0.000726889, 0.99987, 0.724044, 0, 0.00569574, 0.999336, 0.72317, 0, 0.0131702, 0.996271, 0.719432, 0, 0.0220738, 0.991159, 0.712576, 0, 0.0319405, 0.982465, 0.700927, 0, 0.0425202, 0.97049, 0.684297, 0, 0.0536599, 0.953973, 0.661244, 0, 0.065258, 0.935546, 0.633804, 0, 0.0772427, 0.916596, 0.603071, 0, 0.0895616, 0.899353, 0.57105, 0, 0.102175, 0.885216, 0.539206, 0, 0.11505, 0.875076, 0.508714, 0, 0.128164, 0.868334, 0.479571, 0, 0.141495, 0.864414, 0.451796, 0, 0.155026, 0.862678, 0.425328, 0, 0.168745, 0.862835, 0.400352, 0, 0.182639, 0.864067, 0.376532, 0, 0.196699, 0.866086, 0.35391, 0, 0.210915, 0.868557, 0.332424, 0, 0.225282, 0.871271, 0.312053, 0, 0.239792, 0.874058, 0.292764, 0, 0.25444, 0.8768, 0.27453, 0, 0.269223, 0.87939, 0.257297, 0, 0.284135, 0.8819, 0.24114, 0, 0.299174, 0.884187, 0.225934, 0, 0.314337, 0.886262, 0.211669, 0, 0.329622, 0.888119, 0.198311, 0, 0.345026, 0.889709, 0.185783, 0, 0.360549, 0.891054, 0.174063, 0, 0.376189, 0.892196, 0.163143, 0, 0.391946, 0.893101, 0.152952, 0, 0.407819, 0.893803, 0.143475, 0, 0.423808, 0.894277, 0.134647, 0, 0.439914, 0.894532, 0.126434, 0, 0.456137, 0.894576, 0.1188, 0, 0.472479, 0.894393, 0.111694, 0, 0.48894, 0.893976, 0.105069, 0, 0.505523, 0.893346, 0.0989077, 0, 0.52223, 0.892502, 0.0931724, 0, 0.539064, 0.891441, 0.0878276, 0, 0.556028, 0.890276, 0.082903, 0, 0.573125, 0.888972, 0.0783505, 0, 0.590361, 0.887469, 0.0741083, 0, 0.607741, 0.885785, 0.0701633, 0, 0.62527, 0.883914, 0.0664835, 0, 0.642957, 0.881872, 0.0630567, 0, 0.660809, 0.879651, 0.0598527, 0, 0.678836, 0.877267, 0.0568615, 0, 0.69705, 0.874717, 0.05406, 0, 0.715465, 0.872012, 0.0514378, 0, 0.734098, 0.869157, 0.0489805, 0, 0.752968, 0.866155, 0.0466727, 0, 0.772101, 0.863014, 0.0445056, 0, 0.791529, 0.859748, 0.0424733, 0, 0.81129, 0.856416, 0.0405957, 0, 0.831438, 0.852958, 0.0388273, 0, 0.852044, 0.849382, 0.0371619, 0, 0.87321, 0.845694, 0.0355959, 0, 0.89509, 0.841893, 0.0341155, 0, 0.917932, 0.837981, 0.0327141, 0, 0.942204, 0.833963, 0.0313856, 0, 0.968981, 0.829847, 0.0301275, 0, 1, 1, 0.85214, 0, 0, 0.999969, 0.852095, 0, 0.00279627, 0.999483, 0.851408, 0, 0.0107635, 0.994545, 0.84579, 0, 0.0206454, 0.986188, 0.835231, 0, 0.0315756, 0.969847, 0.814687, 0, 0.0432021, 0.945951, 0.783735, 0, 0.0553396, 0.91917, 0.746074, 0, 0.0678766, 0.895488, 0.706938, 0, 0.0807395, 0.878232, 0.669534, 0, 0.0938767, 0.868252, 0.635168, 0, 0.10725, 0.863873, 0.603069, 0, 0.120832, 0.863369, 0.572514, 0, 0.134598, 0.86545, 0.543169, 0, 0.148533, 0.868803, 0.514578, 0, 0.16262, 0.872794, 0.486762, 0, 0.176849, 0.87702, 0.459811, 0, 0.19121, 0.881054, 0.433654, 0, 0.205694, 0.884974, 0.408574, 0, 0.220294, 0.888587, 0.384525, 0, 0.235005, 0.891877, 0.36156, 0, 0.24982, 0.894793, 0.339661, 0, 0.264737, 0.89743, 0.318913, 0, 0.279751, 0.899796, 0.299302, 0, 0.294859, 0.901943, 0.280843, 0, 0.310058, 0.903858, 0.263481, 0, 0.325346, 0.905574, 0.247197, 0, 0.340721, 0.907069, 0.231915, 0, 0.356181, 0.908379, 0.217614, 0, 0.371725, 0.90952, 0.20425, 0, 0.387353, 0.910483, 0.191758, 0, 0.403063, 0.91128, 0.180092, 0, 0.418854, 0.911936, 0.169222, 0, 0.434727, 0.912454, 0.159098, 0, 0.450682, 0.912835, 0.149668, 0, 0.466718, 0.913078, 0.140884, 0, 0.482837, 0.913192, 0.132709, 0, 0.499038, 0.913175, 0.125095, 0, 0.515324, 0.91304, 0.118012, 0, 0.531695, 0.912781, 0.111417, 0, 0.548153, 0.91241, 0.105281, 0, 0.5647, 0.911924, 0.0995691, 0, 0.581338, 0.911331, 0.0942531, 0, 0.59807, 0.910637, 0.0893076, 0, 0.6149, 0.90984, 0.0846998, 0, 0.63183, 0.908941, 0.0804044, 0, 0.648865, 0.907944, 0.0763984, 0, 0.666011, 0.906857, 0.0726638, 0, 0.683273, 0.90568, 0.0691783, 0, 0.700659, 0.904416, 0.0659222, 0, 0.718176, 0.903067, 0.0628782, 0, 0.735834, 0.901637, 0.0600307, 0, 0.753646, 0.900128, 0.0573647, 0, 0.771625, 0.898544, 0.0548668, 0, 0.78979, 0.89689, 0.052527, 0, 0.808162, 0.895165, 0.0503306, 0, 0.826771, 0.893371, 0.0482668, 0, 0.845654, 0.891572, 0.0463605, 0, 0.864863, 0.889763, 0.0445998, 0, 0.884472, 0.887894, 0.0429451, 0, 0.904592, 0.885967, 0.0413884, 0, 0.925407, 0.883984, 0.0399225, 0, 0.947271, 0.881945, 0.0385405, 0, 0.97105, 0.879854, 0.0372362, 0, 1, 0.999804, 0.995833, 0, 0, 0.938155, 0.933611, 0, 0.0158731, 0.864755, 0.854311, 0, 0.0317461, 0.888594, 0.865264, 0, 0.0476191, 0.905575, 0.863922, 0, 0.0634921, 0.915125, 0.850558, 0, 0.0793651, 0.920665, 0.829254, 0, 0.0952381, 0.924073, 0.802578, 0, 0.111111, 0.926304, 0.772211, 0, 0.126984, 0.927829, 0.739366, 0, 0.142857, 0.928924, 0.705033, 0, 0.15873, 0.92973, 0.670019, 0, 0.174603, 0.930339, 0.634993, 0, 0.190476, 0.930811, 0.600485, 0, 0.206349, 0.931191, 0.566897, 0, 0.222222, 0.93149, 0.534485, 0, 0.238095, 0.931737, 0.503429, 0, 0.253968, 0.931939, 0.473811, 0, 0.269841, 0.932108, 0.445668, 0, 0.285714, 0.93225, 0.418993, 0, 0.301587, 0.932371, 0.393762, 0, 0.31746, 0.932474, 0.369939, 0, 0.333333, 0.932562, 0.347479, 0, 0.349206, 0.932638, 0.326336, 0, 0.365079, 0.932703, 0.306462, 0, 0.380952, 0.93276, 0.287805, 0, 0.396825, 0.932809, 0.270313, 0, 0.412698, 0.932851, 0.253933, 0, 0.428571, 0.932887, 0.23861, 0, 0.444444, 0.932917, 0.224289, 0, 0.460317, 0.932943, 0.210917, 0, 0.47619, 0.932965, 0.19844, 0, 0.492063, 0.932982, 0.186807, 0, 0.507937, 0.932995, 0.175966, 0, 0.52381, 0.933005, 0.165869, 0, 0.539683, 0.933011, 0.156468, 0, 0.555556, 0.933013, 0.147719, 0, 0.571429, 0.933013, 0.139579, 0, 0.587302, 0.93301, 0.132007, 0, 0.603175, 0.933004, 0.124965, 0, 0.619048, 0.932994, 0.118416, 0, 0.634921, 0.932982, 0.112326, 0, 0.650794, 0.932968, 0.106663, 0, 0.666667, 0.93295, 0.101397, 0, 0.68254, 0.932931, 0.0964993, 0, 0.698413, 0.932908, 0.0919438, 0, 0.714286, 0.932883, 0.0877057, 0, 0.730159, 0.932856, 0.0837623, 0, 0.746032, 0.932827, 0.0800921, 0, 0.761905, 0.932796, 0.0766754, 0, 0.777778, 0.932762, 0.0734936, 0, 0.793651, 0.932727, 0.0705296, 0, 0.809524, 0.932689, 0.0677676, 0, 0.825397, 0.93265, 0.0651929, 0, 0.84127, 0.932609, 0.0627917, 0, 0.857143, 0.932565, 0.0605515, 0, 0.873016, 0.932521, 0.0584606, 0, 0.888889, 0.932474, 0.0565082, 0, 0.904762, 0.932427, 0.0546841, 0, 0.920635, 0.932377, 0.0529793, 0, 0.936508, 0.932326, 0.0513851, 0, 0.952381, 0.932274, 0.0498936, 0, 0.968254, 0.93222, 0.0484975, 0, 0.984127, 0.932164, 0.0471899, 0, 1 ]; - - // data textures - - const ltc_float_1 = new Float32Array( LTC_MAT_1 ); - const ltc_float_2 = new Float32Array( LTC_MAT_2 ); - - const LTC_FLOAT_1 = new DataTexture( ltc_float_1, 64, 64, RGBAFormat, FloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 ); - const LTC_FLOAT_2 = new DataTexture( ltc_float_2, 64, 64, RGBAFormat, FloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 ); - - LTC_FLOAT_1.needsUpdate = true; - LTC_FLOAT_2.needsUpdate = true; - - const ltc_half_1 = new Uint16Array( LTC_MAT_1.length ); - - LTC_MAT_1.forEach( function ( x, index ) { - - ltc_half_1[ index ] = DataUtils.toHalfFloat( x ); - - } ); - - const ltc_half_2 = new Uint16Array( LTC_MAT_2.length ); - - LTC_MAT_2.forEach( function ( x, index ) { - - ltc_half_2[ index ] = DataUtils.toHalfFloat( x ); - - } ); - - const LTC_HALF_1 = new DataTexture( ltc_half_1, 64, 64, RGBAFormat, HalfFloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 ); - const LTC_HALF_2 = new DataTexture( ltc_half_2, 64, 64, RGBAFormat, HalfFloatType, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, NearestFilter, 1 ); - - LTC_HALF_1.needsUpdate = true; - LTC_HALF_2.needsUpdate = true; - - this.LTC_HALF_1 = LTC_HALF_1; - this.LTC_HALF_1 = LTC_HALF_2; - - this.LTC_FLOAT_1 = LTC_FLOAT_1; - this.LTC_FLOAT_2 = LTC_FLOAT_2; - - return this; - - } - -} - -RectAreaLightTexturesLib.LTC_HALF_1 = null; -RectAreaLightTexturesLib.LTC_HALF_1 = null; - -RectAreaLightTexturesLib.LTC_FLOAT_1 = null; -RectAreaLightTexturesLib.LTC_FLOAT_2 = null; - -export { RectAreaLightTexturesLib }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightUniformsLib.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightUniformsLib.js deleted file mode 100644 index 2373c87..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lights/RectAreaLightUniformsLib.js +++ /dev/null @@ -1,24 +0,0 @@ -import { UniformsLib } from '/static/javascript/three/build/three.module.js'; -import { RectAreaLightTexturesLib } from './RectAreaLightTexturesLib.js'; - -class RectAreaLightUniformsLib { - - static init() { - - RectAreaLightTexturesLib.init(); - - const { LTC_FLOAT_1, LTC_FLOAT_2, LTC_HALF_1, LTC_HALF_2 } = RectAreaLightTexturesLib; - - // data textures - - UniformsLib.LTC_FLOAT_1 = LTC_FLOAT_1; - UniformsLib.LTC_FLOAT_2 = LTC_FLOAT_2; - - UniformsLib.LTC_HALF_1 = LTC_HALF_1; - UniformsLib.LTC_HALF_2 = LTC_HALF_2; - - } - -} - -export { RectAreaLightUniformsLib }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lil-gui.module.min.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lil-gui.module.min.js deleted file mode 100644 index c76a5ef..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lil-gui.module.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * lil-gui - * https://lil-gui.georgealways.com - * @version 0.17.0 - * @author George Michael Brower - * @license MIT - */ -class t{constructor(i,e,s,n,l="div"){this.parent=i,this.object=e,this.property=s,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement("div"),this.domElement.classList.add("controller"),this.domElement.classList.add(n),this.$name=document.createElement("div"),this.$name.classList.add("name"),t.nextNameID=t.nextNameID||0,this.$name.id="lil-gui-name-"+ ++t.nextNameID,this.$widget=document.createElement(l),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(s)}name(t){return this._name=t,this.$name.innerHTML=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),void 0!==this._onChange&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),void 0!==this._onFinishChange&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled||(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t)),this}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){const i=this.parent.add(this.object,this.property,t);return i.name(this._name),this.destroy(),i}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,void 0!==this._listenCallbackID&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);const t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.object[this.property]=t,this._callOnChange(),this.updateDisplay(),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}}class i extends t{constructor(t,i,e){super(t,i,e,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}}function e(t){let i,e;return(i=t.match(/(#|0x)?([a-f0-9]{6})/i))?e=i[2]:(i=t.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?e=parseInt(i[1]).toString(16).padStart(2,0)+parseInt(i[2]).toString(16).padStart(2,0)+parseInt(i[3]).toString(16).padStart(2,0):(i=t.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(e=i[1]+i[1]+i[2]+i[2]+i[3]+i[3]),!!e&&"#"+e}const s={isPrimitive:!0,match:t=>"string"==typeof t,fromHexString:e,toHexString:e},n={isPrimitive:!0,match:t=>"number"==typeof t,fromHexString:t=>parseInt(t.substring(1),16),toHexString:t=>"#"+t.toString(16).padStart(6,0)},l={isPrimitive:!1,match:Array.isArray,fromHexString(t,i,e=1){const s=n.fromHexString(t);i[0]=(s>>16&255)/255*e,i[1]=(s>>8&255)/255*e,i[2]=(255&s)/255*e},toHexString:([t,i,e],s=1)=>n.toHexString(t*(s=255/s)<<16^i*s<<8^e*s<<0)},r={isPrimitive:!1,match:t=>Object(t)===t,fromHexString(t,i,e=1){const s=n.fromHexString(t);i.r=(s>>16&255)/255*e,i.g=(s>>8&255)/255*e,i.b=(255&s)/255*e},toHexString:({r:t,g:i,b:e},s=1)=>n.toHexString(t*(s=255/s)<<16^i*s<<8^e*s<<0)},o=[s,n,l,r];class a extends t{constructor(t,i,s,n){var l;super(t,i,s,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=(l=this.initialValue,o.find(t=>t.match(l))),this._rgbScale=n,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{const t=e(this.$text.value);t&&this._setValueFromHexString(t)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){const i=this._format.fromHexString(t);this.setValue(i)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}}class h extends t{constructor(t,i,e){super(t,i,e,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",t=>{t.preventDefault(),this.getValue().call(this.object)}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}}class d extends t{constructor(t,i,e,s,n,l){super(t,i,e,"number"),this._initInput(),this.min(s),this.max(n);const r=void 0!==l;this.step(r?l:this._getImplicitStep(),r),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,i=!0){return this._step=t,this._stepExplicit=i,this}updateDisplay(){const t=this.getValue();if(this._hasSlider){let i=(t-this._min)/(this._max-this._min);i=Math.max(0,Math.min(i,1)),this.$fill.style.width=100*i+"%"}return this._inputFocused||(this.$input.value=void 0===this._decimals?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$disable=this.$input;const t=t=>{const i=parseFloat(this.$input.value);isNaN(i)||(this._snapClampSetValue(i+t),this.$input.value=this.getValue())};let i,e,s,n,l,r=!1;const o=t=>{if(r){const s=t.clientX-i,n=t.clientY-e;Math.abs(n)>5?(t.preventDefault(),this.$input.blur(),r=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(s)>5&&a()}if(!r){const i=t.clientY-s;l-=i*this._step*this._arrowKeyMultiplier(t),n+l>this._max?l=this._max-n:n+l{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",a)};this.$input.addEventListener("input",()=>{let t=parseFloat(this.$input.value);isNaN(t)||(this._stepExplicit&&(t=this._snap(t)),this.setValue(this._clamp(t)))}),this.$input.addEventListener("keydown",i=>{"Enter"===i.code&&this.$input.blur(),"ArrowUp"===i.code&&(i.preventDefault(),t(this._step*this._arrowKeyMultiplier(i))),"ArrowDown"===i.code&&(i.preventDefault(),t(this._step*this._arrowKeyMultiplier(i)*-1))}),this.$input.addEventListener("wheel",i=>{this._inputFocused&&(i.preventDefault(),t(this._step*this._normalizeMouseWheel(i)))},{passive:!1}),this.$input.addEventListener("mousedown",t=>{i=t.clientX,e=s=t.clientY,r=!0,n=this.getValue(),l=0,window.addEventListener("mousemove",o),window.addEventListener("mouseup",a)}),this.$input.addEventListener("focus",()=>{this._inputFocused=!0}),this.$input.addEventListener("blur",()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()})}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");const t=t=>{const i=this.$slider.getBoundingClientRect();let e=(s=t,n=i.left,l=i.right,r=this._min,o=this._max,(s-n)/(l-n)*(o-r)+r);var s,n,l,r,o;this._snapClampSetValue(e)},i=i=>{t(i.clientX)},e=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",i),window.removeEventListener("mouseup",e)};let s,n,l=!1;const r=i=>{i.preventDefault(),this._setDraggingStyle(!0),t(i.touches[0].clientX),l=!1},o=i=>{if(l){const t=i.touches[0].clientX-s,e=i.touches[0].clientY-n;Math.abs(t)>Math.abs(e)?r(i):(window.removeEventListener("touchmove",o),window.removeEventListener("touchend",a))}else i.preventDefault(),t(i.touches[0].clientX)},a=()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",o),window.removeEventListener("touchend",a)},h=this._callOnFinishChange.bind(this);let d;this.$slider.addEventListener("mousedown",s=>{this._setDraggingStyle(!0),t(s.clientX),window.addEventListener("mousemove",i),window.addEventListener("mouseup",e)}),this.$slider.addEventListener("touchstart",t=>{t.touches.length>1||(this._hasScrollBar?(s=t.touches[0].clientX,n=t.touches[0].clientY,l=!0):r(t),window.addEventListener("touchmove",o,{passive:!1}),window.addEventListener("touchend",a))},{passive:!1}),this.$slider.addEventListener("wheel",t=>{if(Math.abs(t.deltaX)this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){const t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return void 0!==this._min}get _hasMax(){return void 0!==this._max}}class c extends t{constructor(t,i,e,s){super(t,i,e,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this._values=Array.isArray(s)?s:Object.values(s),this._names=Array.isArray(s)?s:Object.keys(s),this._names.forEach(t=>{const i=document.createElement("option");i.innerHTML=t,this.$select.appendChild(i)}),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.updateDisplay()}updateDisplay(){const t=this.getValue(),i=this._values.indexOf(t);return this.$select.selectedIndex=i,this.$display.innerHTML=-1===i?t:this._names[i],this}}class u extends t{constructor(t,i,e){super(t,i,e,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",t=>{"Enter"===t.code&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}}let p=!1;class g{constructor({parent:t,autoPlace:i=void 0===t,container:e,width:s,title:n="Controls",injectStyles:l=!0,touchStyles:r=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",t=>{"Enter"!==t.code&&"Space"!==t.code||(t.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(n),r&&this.domElement.classList.add("allow-touch-styles"),this.parent)return this.parent.children.push(this),this.parent.folders.push(this),void this.parent.$children.appendChild(this.domElement);this.domElement.classList.add("root"),!p&&l&&(!function(t){const i=document.createElement("style");i.innerHTML=t;const e=document.querySelector("head link[rel=stylesheet], head style");e?document.head.insertBefore(i,e):document.head.appendChild(i)}('.lil-gui{--background-color:#1f1f1f;--text-color:#ebebeb;--title-background-color:#111;--title-text-color:#ebebeb;--widget-color:#424242;--hover-color:#4f4f4f;--focus-color:#595959;--number-color:#2cc9ff;--string-color:#a2db3c;--font-size:11px;--input-font-size:11px;--font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;--font-family-mono:Menlo,Monaco,Consolas,"Droid Sans Mono",monospace;--padding:4px;--spacing:4px;--widget-height:20px;--name-width:45%;--slider-knob-width:2px;--slider-input-width:27%;--color-input-width:27%;--slider-input-min-width:45px;--color-input-min-width:45px;--folder-indent:7px;--widget-padding:0 0 0 3px;--widget-border-radius:2px;--checkbox-size:calc(var(--widget-height)*0.75);--scrollbar-width:5px;background-color:var(--background-color);color:var(--text-color);font-family:var(--font-family);font-size:var(--font-size);font-style:normal;font-weight:400;line-height:1;text-align:left;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lil-gui,.lil-gui *{box-sizing:border-box;margin:0;padding:0}.lil-gui.root{display:flex;flex-direction:column;width:var(--width,245px)}.lil-gui.root>.title{background:var(--title-background-color);color:var(--title-text-color)}.lil-gui.root>.children{overflow-x:hidden;overflow-y:auto}.lil-gui.root>.children::-webkit-scrollbar{background:var(--background-color);height:var(--scrollbar-width);width:var(--scrollbar-width)}.lil-gui.root>.children::-webkit-scrollbar-thumb{background:var(--focus-color);border-radius:var(--scrollbar-width)}.lil-gui.force-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}.lil-gui.autoPlace{max-height:100%;position:fixed;right:15px;top:0;z-index:1001}.lil-gui .controller{align-items:center;display:flex;margin:var(--spacing) 0;padding:0 var(--padding)}.lil-gui .controller.disabled{opacity:.5}.lil-gui .controller.disabled,.lil-gui .controller.disabled *{pointer-events:none!important}.lil-gui .controller>.name{flex-shrink:0;line-height:var(--widget-height);min-width:var(--name-width);padding-right:var(--spacing);white-space:pre}.lil-gui .controller .widget{align-items:center;display:flex;min-height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.string input{color:var(--string-color)}.lil-gui .controller.boolean .widget{cursor:pointer}.lil-gui .controller.color .display{border-radius:var(--widget-border-radius);height:var(--widget-height);position:relative;width:100%}.lil-gui .controller.color input[type=color]{cursor:pointer;height:100%;opacity:0;width:100%}.lil-gui .controller.color input[type=text]{flex-shrink:0;font-family:var(--font-family-mono);margin-left:var(--spacing);min-width:var(--color-input-min-width);width:var(--color-input-width)}.lil-gui .controller.option select{max-width:100%;opacity:0;position:absolute;width:100%}.lil-gui .controller.option .display{background:var(--widget-color);border-radius:var(--widget-border-radius);height:var(--widget-height);line-height:var(--widget-height);max-width:100%;overflow:hidden;padding-left:.55em;padding-right:1.75em;pointer-events:none;position:relative;word-break:break-all}.lil-gui .controller.option .display.active{background:var(--focus-color)}.lil-gui .controller.option .display:after{bottom:0;content:"↕";font-family:lil-gui;padding-right:.375em;position:absolute;right:0;top:0}.lil-gui .controller.option .widget,.lil-gui .controller.option select{cursor:pointer}.lil-gui .controller.number input{color:var(--number-color)}.lil-gui .controller.number.hasSlider input{flex-shrink:0;margin-left:var(--spacing);min-width:var(--slider-input-min-width);width:var(--slider-input-width)}.lil-gui .controller.number .slider{background-color:var(--widget-color);border-radius:var(--widget-border-radius);cursor:ew-resize;height:var(--widget-height);overflow:hidden;padding-right:var(--slider-knob-width);touch-action:pan-y;width:100%}.lil-gui .controller.number .slider.active{background-color:var(--focus-color)}.lil-gui .controller.number .slider.active .fill{opacity:.95}.lil-gui .controller.number .fill{border-right:var(--slider-knob-width) solid var(--number-color);box-sizing:content-box;height:100%}.lil-gui-dragging .lil-gui{--hover-color:var(--widget-color)}.lil-gui-dragging *{cursor:ew-resize!important}.lil-gui-dragging.lil-gui-vertical *{cursor:ns-resize!important}.lil-gui .title{--title-height:calc(var(--widget-height) + var(--spacing)*1.25);-webkit-tap-highlight-color:transparent;text-decoration-skip:objects;cursor:pointer;font-weight:600;height:var(--title-height);line-height:calc(var(--title-height) - 4px);outline:none;padding:0 var(--padding)}.lil-gui .title:before{content:"▾";display:inline-block;font-family:lil-gui;padding-right:2px}.lil-gui .title:active{background:var(--title-background-color);opacity:.75}.lil-gui.root>.title:focus{text-decoration:none!important}.lil-gui.closed>.title:before{content:"▸"}.lil-gui.closed>.children{opacity:0;transform:translateY(-7px)}.lil-gui.closed:not(.transition)>.children{display:none}.lil-gui.transition>.children{overflow:hidden;pointer-events:none;transition-duration:.3s;transition-property:height,opacity,transform;transition-timing-function:cubic-bezier(.2,.6,.35,1)}.lil-gui .children:empty:before{content:"Empty";display:block;font-style:italic;height:var(--widget-height);line-height:var(--widget-height);margin:var(--spacing) 0;opacity:.5;padding:0 var(--padding)}.lil-gui.root>.children>.lil-gui>.title{border-width:0;border-bottom:1px solid var(--widget-color);border-left:0 solid var(--widget-color);border-right:0 solid var(--widget-color);border-top:1px solid var(--widget-color);transition:border-color .3s}.lil-gui.root>.children>.lil-gui.closed>.title{border-bottom-color:transparent}.lil-gui+.controller{border-top:1px solid var(--widget-color);margin-top:0;padding-top:var(--spacing)}.lil-gui .lil-gui .lil-gui>.title{border:none}.lil-gui .lil-gui .lil-gui>.children{border:none;border-left:2px solid var(--widget-color);margin-left:var(--folder-indent)}.lil-gui .lil-gui .controller{border:none}.lil-gui input{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:0;border-radius:var(--widget-border-radius);color:var(--text-color);font-family:var(--font-family);font-size:var(--input-font-size);height:var(--widget-height);outline:none;width:100%}.lil-gui input:disabled{opacity:1}.lil-gui input[type=number],.lil-gui input[type=text]{padding:var(--widget-padding)}.lil-gui input[type=number]:focus,.lil-gui input[type=text]:focus{background:var(--focus-color)}.lil-gui input::-webkit-inner-spin-button,.lil-gui input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.lil-gui input[type=number]{-moz-appearance:textfield}.lil-gui input[type=checkbox]{appearance:none;-webkit-appearance:none;border-radius:var(--widget-border-radius);cursor:pointer;height:var(--checkbox-size);text-align:center;width:var(--checkbox-size)}.lil-gui input[type=checkbox]:checked:before{content:"✓";font-family:lil-gui;font-size:var(--checkbox-size);line-height:var(--checkbox-size)}.lil-gui button{-webkit-tap-highlight-color:transparent;background:var(--widget-color);border:1px solid var(--widget-color);border-radius:var(--widget-border-radius);color:var(--text-color);cursor:pointer;font-family:var(--font-family);font-size:var(--font-size);height:var(--widget-height);line-height:calc(var(--widget-height) - 4px);outline:none;text-align:center;text-transform:none;width:100%}.lil-gui button:active{background:var(--focus-color)}@font-face{font-family:lil-gui;src:url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJm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GnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff")}@media (pointer:coarse){.lil-gui.allow-touch-styles{--widget-height:28px;--padding:6px;--spacing:6px;--font-size:13px;--input-font-size:16px;--folder-indent:10px;--scrollbar-width:7px;--slider-input-min-width:50px;--color-input-min-width:65px}}@media (hover:hover){.lil-gui .controller.color .display:hover:before{border:1px solid #fff9;border-radius:var(--widget-border-radius);bottom:0;content:" ";display:block;left:0;position:absolute;right:0;top:0}.lil-gui .controller.option .display.focus{background:var(--focus-color)}.lil-gui .controller.option .widget:hover .display{background:var(--hover-color)}.lil-gui .controller.number .slider:hover{background-color:var(--hover-color)}body:not(.lil-gui-dragging) .lil-gui .title:hover{background:var(--title-background-color);opacity:.85}.lil-gui .title:focus{text-decoration:underline var(--focus-color)}.lil-gui input:hover{background:var(--hover-color)}.lil-gui input:active{background:var(--focus-color)}.lil-gui input[type=checkbox]:focus{box-shadow:inset 0 0 0 1px var(--focus-color)}.lil-gui button:hover{background:var(--hover-color);border-color:var(--hover-color)}.lil-gui button:focus{border-color:var(--focus-color)}}'),p=!0),e?e.appendChild(this.domElement):i&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),s&&this.domElement.style.setProperty("--width",s+"px"),this.domElement.addEventListener("keydown",t=>t.stopPropagation()),this.domElement.addEventListener("keyup",t=>t.stopPropagation())}add(t,e,s,n,l){if(Object(s)===s)return new c(this,t,e,s);const r=t[e];switch(typeof r){case"number":return new d(this,t,e,s,n,l);case"boolean":return new i(this,t,e);case"string":return new u(this,t,e);case"function":return new h(this,t,e)}console.error("gui.add failed\n\tproperty:",e,"\n\tobject:",t,"\n\tvalue:",r)}addColor(t,i,e=1){return new a(this,t,i,e)}addFolder(t){return new g({parent:this,title:t})}load(t,i=!0){return t.controllers&&this.controllers.forEach(i=>{i instanceof h||i._name in t.controllers&&i.load(t.controllers[i._name])}),i&&t.folders&&this.folders.forEach(i=>{i._title in t.folders&&i.load(t.folders[i._title])}),this}save(t=!0){const i={controllers:{},folders:{}};return this.controllers.forEach(t=>{if(!(t instanceof h)){if(t._name in i.controllers)throw new Error(`Cannot save GUI with duplicate property "${t._name}"`);i.controllers[t._name]=t.save()}}),t&&this.folders.forEach(t=>{if(t._title in i.folders)throw new Error(`Cannot save GUI with duplicate folder "${t._title}"`);i.folders[t._title]=t.save()}),i}open(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._closed=!t,this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{const i=this.$children.clientHeight;this.$children.style.height=i+"px",this.domElement.classList.add("transition");const e=t=>{t.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",e))};this.$children.addEventListener("transitionend",e);const s=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=s+"px"})}),this}title(t){return this._title=t,this.$title.innerHTML=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(t=>t.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),void 0!==this._onChange&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),void 0!==this._onFinishChange&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(i=>{t=t.concat(i.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(i=>{t=t.concat(i.foldersRecursive())}),t}}export default g;export{i as BooleanController,a as ColorController,t as Controller,h as FunctionController,g as GUI,d as NumberController,c as OptionController,u as StringController}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Line2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Line2.js deleted file mode 100644 index cdd1ddf..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Line2.js +++ /dev/null @@ -1,19 +0,0 @@ -import { LineSegments2 } from '../lines/LineSegments2.js'; -import { LineGeometry } from '../lines/LineGeometry.js'; -import { LineMaterial } from '../lines/LineMaterial.js'; - -class Line2 extends LineSegments2 { - - constructor( geometry = new LineGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) { - - super( geometry, material ); - - this.isLine2 = true; - - this.type = 'Line2'; - - } - -} - -export { Line2 }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineGeometry.js deleted file mode 100644 index 1fde929..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineGeometry.js +++ /dev/null @@ -1,79 +0,0 @@ -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; - -class LineGeometry extends LineSegmentsGeometry { - - constructor() { - - super(); - - this.isLineGeometry = true; - - this.type = 'LineGeometry'; - - } - - setPositions( array ) { - - // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format - - const length = array.length - 3; - const points = new Float32Array( 2 * length ); - - for ( let i = 0; i < length; i += 3 ) { - - points[ 2 * i ] = array[ i ]; - points[ 2 * i + 1 ] = array[ i + 1 ]; - points[ 2 * i + 2 ] = array[ i + 2 ]; - - points[ 2 * i + 3 ] = array[ i + 3 ]; - points[ 2 * i + 4 ] = array[ i + 4 ]; - points[ 2 * i + 5 ] = array[ i + 5 ]; - - } - - super.setPositions( points ); - - return this; - - } - - setColors( array ) { - - // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format - - const length = array.length - 3; - const colors = new Float32Array( 2 * length ); - - for ( let i = 0; i < length; i += 3 ) { - - colors[ 2 * i ] = array[ i ]; - colors[ 2 * i + 1 ] = array[ i + 1 ]; - colors[ 2 * i + 2 ] = array[ i + 2 ]; - - colors[ 2 * i + 3 ] = array[ i + 3 ]; - colors[ 2 * i + 4 ] = array[ i + 4 ]; - colors[ 2 * i + 5 ] = array[ i + 5 ]; - - } - - super.setColors( colors ); - - return this; - - } - - fromLine( line ) { - - const geometry = line.geometry; - - this.setPositions( geometry.attributes.position.array ); // assumes non-indexed - - // set colors, maybe - - return this; - - } - -} - -export { LineGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineMaterial.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineMaterial.js deleted file mode 100644 index 1416fb9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineMaterial.js +++ /dev/null @@ -1,603 +0,0 @@ -import { - ShaderLib, - ShaderMaterial, - UniformsLib, - UniformsUtils, - Vector2, -} from '/static/javascript/three/build/three.module.js'; - -UniformsLib.line = { - - worldUnits: { value: 1 }, - linewidth: { value: 1 }, - resolution: { value: new Vector2( 1, 1 ) }, - dashOffset: { value: 0 }, - dashScale: { value: 1 }, - dashSize: { value: 1 }, - gapSize: { value: 1 } // todo FIX - maybe change to totalSize - -}; - -ShaderLib[ 'line' ] = { - - uniforms: UniformsUtils.merge( [ - UniformsLib.common, - UniformsLib.fog, - UniformsLib.line - ] ), - - vertexShader: - /* glsl */` - #include - #include - #include - #include - #include - - uniform float linewidth; - uniform vec2 resolution; - - attribute vec3 instanceStart; - attribute vec3 instanceEnd; - - attribute vec3 instanceColorStart; - attribute vec3 instanceColorEnd; - - #ifdef WORLD_UNITS - - varying vec4 worldPos; - varying vec3 worldStart; - varying vec3 worldEnd; - - #ifdef USE_DASH - - varying vec2 vUv; - - #endif - - #else - - varying vec2 vUv; - - #endif - - #ifdef USE_DASH - - uniform float dashScale; - attribute float instanceDistanceStart; - attribute float instanceDistanceEnd; - varying float vLineDistance; - - #endif - - void trimSegment( const in vec4 start, inout vec4 end ) { - - // trim end segment so it terminates between the camera plane and the near plane - - // conservative estimate of the near plane - float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column - float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column - float nearEstimate = - 0.5 * b / a; - - float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); - - end.xyz = mix( start.xyz, end.xyz, alpha ); - - } - - void main() { - - #ifdef USE_COLOR - - vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; - - #endif - - #ifdef USE_DASH - - vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; - vUv = uv; - - #endif - - float aspect = resolution.x / resolution.y; - - // camera space - vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); - vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); - - #ifdef WORLD_UNITS - - worldStart = start.xyz; - worldEnd = end.xyz; - - #else - - vUv = uv; - - #endif - - // special case for perspective projection, and segments that terminate either in, or behind, the camera plane - // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space - // but we need to perform ndc-space calculations in the shader, so we must address this issue directly - // perhaps there is a more elegant solution -- WestLangley - - bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column - - if ( perspective ) { - - if ( start.z < 0.0 && end.z >= 0.0 ) { - - trimSegment( start, end ); - - } else if ( end.z < 0.0 && start.z >= 0.0 ) { - - trimSegment( end, start ); - - } - - } - - // clip space - vec4 clipStart = projectionMatrix * start; - vec4 clipEnd = projectionMatrix * end; - - // ndc space - vec3 ndcStart = clipStart.xyz / clipStart.w; - vec3 ndcEnd = clipEnd.xyz / clipEnd.w; - - // direction - vec2 dir = ndcEnd.xy - ndcStart.xy; - - // account for clip-space aspect ratio - dir.x *= aspect; - dir = normalize( dir ); - - #ifdef WORLD_UNITS - - vec3 worldDir = normalize( end.xyz - start.xyz ); - vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); - vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); - vec3 worldFwd = cross( worldDir, worldUp ); - worldPos = position.y < 0.5 ? start: end; - - // height offset - float hw = linewidth * 0.5; - worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; - - // don't extend the line if we're rendering dashes because we - // won't be rendering the endcaps - #ifndef USE_DASH - - // cap extension - worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; - - // add width to the box - worldPos.xyz += worldFwd * hw; - - // endcaps - if ( position.y > 1.0 || position.y < 0.0 ) { - - worldPos.xyz -= worldFwd * 2.0 * hw; - - } - - #endif - - // project the worldpos - vec4 clip = projectionMatrix * worldPos; - - // shift the depth of the projected points so the line - // segments overlap neatly - vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; - clip.z = clipPose.z * clip.w; - - #else - - vec2 offset = vec2( dir.y, - dir.x ); - // undo aspect ratio adjustment - dir.x /= aspect; - offset.x /= aspect; - - // sign flip - if ( position.x < 0.0 ) offset *= - 1.0; - - // endcaps - if ( position.y < 0.0 ) { - - offset += - dir; - - } else if ( position.y > 1.0 ) { - - offset += dir; - - } - - // adjust for linewidth - offset *= linewidth; - - // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... - offset /= resolution.y; - - // select end - vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; - - // back to clip space - offset *= clip.w; - - clip.xy += offset; - - #endif - - gl_Position = clip; - - vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation - - #include - #include - #include - - } - `, - - fragmentShader: - /* glsl */` - uniform vec3 diffuse; - uniform float opacity; - uniform float linewidth; - - #ifdef USE_DASH - - uniform float dashOffset; - uniform float dashSize; - uniform float gapSize; - - #endif - - varying float vLineDistance; - - #ifdef WORLD_UNITS - - varying vec4 worldPos; - varying vec3 worldStart; - varying vec3 worldEnd; - - #ifdef USE_DASH - - varying vec2 vUv; - - #endif - - #else - - varying vec2 vUv; - - #endif - - #include - #include - #include - #include - #include - - vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { - - float mua; - float mub; - - vec3 p13 = p1 - p3; - vec3 p43 = p4 - p3; - - vec3 p21 = p2 - p1; - - float d1343 = dot( p13, p43 ); - float d4321 = dot( p43, p21 ); - float d1321 = dot( p13, p21 ); - float d4343 = dot( p43, p43 ); - float d2121 = dot( p21, p21 ); - - float denom = d2121 * d4343 - d4321 * d4321; - - float numer = d1343 * d4321 - d1321 * d4343; - - mua = numer / denom; - mua = clamp( mua, 0.0, 1.0 ); - mub = ( d1343 + d4321 * ( mua ) ) / d4343; - mub = clamp( mub, 0.0, 1.0 ); - - return vec2( mua, mub ); - - } - - void main() { - - #include - - #ifdef USE_DASH - - if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps - - if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX - - #endif - - float alpha = opacity; - - #ifdef WORLD_UNITS - - // Find the closest points on the view ray and the line segment - vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; - vec3 lineDir = worldEnd - worldStart; - vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); - - vec3 p1 = worldStart + lineDir * params.x; - vec3 p2 = rayEnd * params.y; - vec3 delta = p1 - p2; - float len = length( delta ); - float norm = len / linewidth; - - #ifndef USE_DASH - - #ifdef USE_ALPHA_TO_COVERAGE - - float dnorm = fwidth( norm ); - alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); - - #else - - if ( norm > 0.5 ) { - - discard; - - } - - #endif - - #endif - - #else - - #ifdef USE_ALPHA_TO_COVERAGE - - // artifacts appear on some hardware if a derivative is taken within a conditional - float a = vUv.x; - float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; - float len2 = a * a + b * b; - float dlen = fwidth( len2 ); - - if ( abs( vUv.y ) > 1.0 ) { - - alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); - - } - - #else - - if ( abs( vUv.y ) > 1.0 ) { - - float a = vUv.x; - float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; - float len2 = a * a + b * b; - - if ( len2 > 1.0 ) discard; - - } - - #endif - - #endif - - vec4 diffuseColor = vec4( diffuse, alpha ); - - #include - #include - - gl_FragColor = vec4( diffuseColor.rgb, alpha ); - - #include - #include - #include - #include - - } - ` -}; - -class LineMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super( { - - type: 'LineMaterial', - - uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ), - - vertexShader: ShaderLib[ 'line' ].vertexShader, - fragmentShader: ShaderLib[ 'line' ].fragmentShader, - - clipping: true // required for clipping support - - } ); - - this.isLineMaterial = true; - - this.setValues( parameters ); - - } - - get color() { - - return this.uniforms.diffuse.value; - - } - - set color( value ) { - - this.uniforms.diffuse.value = value; - - } - - get worldUnits() { - - return 'WORLD_UNITS' in this.defines; - - } - - set worldUnits( value ) { - - if ( value === true ) { - - this.defines.WORLD_UNITS = ''; - - } else { - - delete this.defines.WORLD_UNITS; - - } - - } - - get linewidth() { - - return this.uniforms.linewidth.value; - - } - - set linewidth( value ) { - - if ( ! this.uniforms.linewidth ) return; - this.uniforms.linewidth.value = value; - - } - - get dashed() { - - return 'USE_DASH' in this.defines; - - } - - set dashed( value ) { - - if ( ( value === true ) !== this.dashed ) { - - this.needsUpdate = true; - - } - - if ( value === true ) { - - this.defines.USE_DASH = ''; - - } else { - - delete this.defines.USE_DASH; - - } - - } - - get dashScale() { - - return this.uniforms.dashScale.value; - - } - - set dashScale( value ) { - - this.uniforms.dashScale.value = value; - - } - - get dashSize() { - - return this.uniforms.dashSize.value; - - } - - set dashSize( value ) { - - this.uniforms.dashSize.value = value; - - } - - get dashOffset() { - - return this.uniforms.dashOffset.value; - - } - - set dashOffset( value ) { - - this.uniforms.dashOffset.value = value; - - } - - get gapSize() { - - return this.uniforms.gapSize.value; - - } - - set gapSize( value ) { - - this.uniforms.gapSize.value = value; - - } - - get opacity() { - - return this.uniforms.opacity.value; - - } - - set opacity( value ) { - - if ( ! this.uniforms ) return; - this.uniforms.opacity.value = value; - - } - - get resolution() { - - return this.uniforms.resolution.value; - - } - - set resolution( value ) { - - this.uniforms.resolution.value.copy( value ); - - } - - get alphaToCoverage() { - - return 'USE_ALPHA_TO_COVERAGE' in this.defines; - - } - - set alphaToCoverage( value ) { - - if ( ! this.defines ) return; - - if ( ( value === true ) !== this.alphaToCoverage ) { - - this.needsUpdate = true; - - } - - if ( value === true ) { - - this.defines.USE_ALPHA_TO_COVERAGE = ''; - - } else { - - delete this.defines.USE_ALPHA_TO_COVERAGE; - - } - - } - -} - -export { LineMaterial }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegments2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegments2.js deleted file mode 100644 index a9932de..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegments2.js +++ /dev/null @@ -1,376 +0,0 @@ -import { - Box3, - InstancedInterleavedBuffer, - InterleavedBufferAttribute, - Line3, - MathUtils, - Matrix4, - Mesh, - Sphere, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; -import { LineMaterial } from './LineMaterial.js'; - -const _viewport = new Vector4(); - -const _start = new Vector3(); -const _end = new Vector3(); - -const _start4 = new Vector4(); -const _end4 = new Vector4(); - -const _ssOrigin = new Vector4(); -const _ssOrigin3 = new Vector3(); -const _mvMatrix = new Matrix4(); -const _line = new Line3(); -const _closestPoint = new Vector3(); - -const _box = new Box3(); -const _sphere = new Sphere(); -const _clipToWorldVector = new Vector4(); - -let _ray, _lineWidth; - -// Returns the margin required to expand by in world space given the distance from the camera, -// line width, resolution, and camera projection -function getWorldSpaceHalfWidth( camera, distance, resolution ) { - - // transform into clip space, adjust the x and y values by the pixel width offset, then - // transform back into world space to get world offset. Note clip space is [-1, 1] so full - // width does not need to be halved. - _clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix ); - _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); - _clipToWorldVector.x = _lineWidth / resolution.width; - _clipToWorldVector.y = _lineWidth / resolution.height; - _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); - _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); - - return Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) ); - -} - -function raycastWorldUnits( lineSegments, intersects ) { - - const matrixWorld = lineSegments.matrixWorld; - const geometry = lineSegments.geometry; - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const segmentCount = Math.min( geometry.instanceCount, instanceStart.count ); - - for ( let i = 0, l = segmentCount; i < l; i ++ ) { - - _line.start.fromBufferAttribute( instanceStart, i ); - _line.end.fromBufferAttribute( instanceEnd, i ); - - _line.applyMatrix4( matrixWorld ); - - const pointOnLine = new Vector3(); - const point = new Vector3(); - - _ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine ); - const isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5; - - if ( isInside ) { - - intersects.push( { - point, - pointOnLine, - distance: _ray.origin.distanceTo( point ), - object: lineSegments, - face: null, - faceIndex: i, - uv: null, - uv1: null, - } ); - - } - - } - -} - -function raycastScreenSpace( lineSegments, camera, intersects ) { - - const projectionMatrix = camera.projectionMatrix; - const material = lineSegments.material; - const resolution = material.resolution; - const matrixWorld = lineSegments.matrixWorld; - - const geometry = lineSegments.geometry; - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const segmentCount = Math.min( geometry.instanceCount, instanceStart.count ); - - const near = - camera.near; - - // - - // pick a point 1 unit out along the ray to avoid the ray origin - // sitting at the camera origin which will cause "w" to be 0 when - // applying the projection matrix. - _ray.at( 1, _ssOrigin ); - - // ndc space [ - 1.0, 1.0 ] - _ssOrigin.w = 1; - _ssOrigin.applyMatrix4( camera.matrixWorldInverse ); - _ssOrigin.applyMatrix4( projectionMatrix ); - _ssOrigin.multiplyScalar( 1 / _ssOrigin.w ); - - // screen space - _ssOrigin.x *= resolution.x / 2; - _ssOrigin.y *= resolution.y / 2; - _ssOrigin.z = 0; - - _ssOrigin3.copy( _ssOrigin ); - - _mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld ); - - for ( let i = 0, l = segmentCount; i < l; i ++ ) { - - _start4.fromBufferAttribute( instanceStart, i ); - _end4.fromBufferAttribute( instanceEnd, i ); - - _start4.w = 1; - _end4.w = 1; - - // camera space - _start4.applyMatrix4( _mvMatrix ); - _end4.applyMatrix4( _mvMatrix ); - - // skip the segment if it's entirely behind the camera - const isBehindCameraNear = _start4.z > near && _end4.z > near; - if ( isBehindCameraNear ) { - - continue; - - } - - // trim the segment if it extends behind camera near - if ( _start4.z > near ) { - - const deltaDist = _start4.z - _end4.z; - const t = ( _start4.z - near ) / deltaDist; - _start4.lerp( _end4, t ); - - } else if ( _end4.z > near ) { - - const deltaDist = _end4.z - _start4.z; - const t = ( _end4.z - near ) / deltaDist; - _end4.lerp( _start4, t ); - - } - - // clip space - _start4.applyMatrix4( projectionMatrix ); - _end4.applyMatrix4( projectionMatrix ); - - // ndc space [ - 1.0, 1.0 ] - _start4.multiplyScalar( 1 / _start4.w ); - _end4.multiplyScalar( 1 / _end4.w ); - - // screen space - _start4.x *= resolution.x / 2; - _start4.y *= resolution.y / 2; - - _end4.x *= resolution.x / 2; - _end4.y *= resolution.y / 2; - - // create 2d segment - _line.start.copy( _start4 ); - _line.start.z = 0; - - _line.end.copy( _end4 ); - _line.end.z = 0; - - // get closest point on ray to segment - const param = _line.closestPointToPointParameter( _ssOrigin3, true ); - _line.at( param, _closestPoint ); - - // check if the intersection point is within clip space - const zPos = MathUtils.lerp( _start4.z, _end4.z, param ); - const isInClipSpace = zPos >= - 1 && zPos <= 1; - - const isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5; - - if ( isInClipSpace && isInside ) { - - _line.start.fromBufferAttribute( instanceStart, i ); - _line.end.fromBufferAttribute( instanceEnd, i ); - - _line.start.applyMatrix4( matrixWorld ); - _line.end.applyMatrix4( matrixWorld ); - - const pointOnLine = new Vector3(); - const point = new Vector3(); - - _ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine ); - - intersects.push( { - point: point, - pointOnLine: pointOnLine, - distance: _ray.origin.distanceTo( point ), - object: lineSegments, - face: null, - faceIndex: i, - uv: null, - uv1: null, - } ); - - } - - } - -} - -class LineSegments2 extends Mesh { - - constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) { - - super( geometry, material ); - - this.isLineSegments2 = true; - - this.type = 'LineSegments2'; - - } - - // for backwards-compatibility, but could be a method of LineSegmentsGeometry... - - computeLineDistances() { - - const geometry = this.geometry; - - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const lineDistances = new Float32Array( 2 * instanceStart.count ); - - for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) { - - _start.fromBufferAttribute( instanceStart, i ); - _end.fromBufferAttribute( instanceEnd, i ); - - lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; - lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end ); - - } - - const instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 - - geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 - geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 - - return this; - - } - - raycast( raycaster, intersects ) { - - const worldUnits = this.material.worldUnits; - const camera = raycaster.camera; - - if ( camera === null && ! worldUnits ) { - - console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.' ); - - } - - const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0; - - _ray = raycaster.ray; - - const matrixWorld = this.matrixWorld; - const geometry = this.geometry; - const material = this.material; - - _lineWidth = material.linewidth + threshold; - - // check if we intersect the sphere bounds - if ( geometry.boundingSphere === null ) { - - geometry.computeBoundingSphere(); - - } - - _sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld ); - - // increase the sphere bounds by the worst case line screen space width - let sphereMargin; - if ( worldUnits ) { - - sphereMargin = _lineWidth * 0.5; - - } else { - - const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) ); - sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, material.resolution ); - - } - - _sphere.radius += sphereMargin; - - if ( _ray.intersectsSphere( _sphere ) === false ) { - - return; - - } - - // check if we intersect the box bounds - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); - - } - - _box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld ); - - // increase the box bounds by the worst case line width - let boxMargin; - if ( worldUnits ) { - - boxMargin = _lineWidth * 0.5; - - } else { - - const distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) ); - boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, material.resolution ); - - } - - _box.expandByScalar( boxMargin ); - - if ( _ray.intersectsBox( _box ) === false ) { - - return; - - } - - if ( worldUnits ) { - - raycastWorldUnits( this, intersects ); - - } else { - - raycastScreenSpace( this, camera, intersects ); - - } - - } - - onBeforeRender( renderer ) { - - const uniforms = this.material.uniforms; - - if ( uniforms && uniforms.resolution ) { - - renderer.getViewport( _viewport ); - this.material.uniforms.resolution.value.set( _viewport.z, _viewport.w ); - - } - - } - -} - -export { LineSegments2 }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegmentsGeometry.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegmentsGeometry.js deleted file mode 100644 index 7bc0d64..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/LineSegmentsGeometry.js +++ /dev/null @@ -1,241 +0,0 @@ -import { - Box3, - Float32BufferAttribute, - InstancedBufferGeometry, - InstancedInterleavedBuffer, - InterleavedBufferAttribute, - Sphere, - Vector3, - WireframeGeometry -} from '/static/javascript/three/build/three.module.js'; - -const _box = new Box3(); -const _vector = new Vector3(); - -class LineSegmentsGeometry extends InstancedBufferGeometry { - - constructor() { - - super(); - - this.isLineSegmentsGeometry = true; - - this.type = 'LineSegmentsGeometry'; - - const positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; - const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ]; - const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; - - this.setIndex( index ); - this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) ); - this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); - - } - - applyMatrix4( matrix ) { - - const start = this.attributes.instanceStart; - const end = this.attributes.instanceEnd; - - if ( start !== undefined ) { - - start.applyMatrix4( matrix ); - - end.applyMatrix4( matrix ); - - start.needsUpdate = true; - - } - - if ( this.boundingBox !== null ) { - - this.computeBoundingBox(); - - } - - if ( this.boundingSphere !== null ) { - - this.computeBoundingSphere(); - - } - - return this; - - } - - setPositions( array ) { - - let lineSegments; - - if ( array instanceof Float32Array ) { - - lineSegments = array; - - } else if ( Array.isArray( array ) ) { - - lineSegments = new Float32Array( array ); - - } - - const instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz - - this.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz - this.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz - - // - - this.computeBoundingBox(); - this.computeBoundingSphere(); - - return this; - - } - - setColors( array ) { - - let colors; - - if ( array instanceof Float32Array ) { - - colors = array; - - } else if ( Array.isArray( array ) ) { - - colors = new Float32Array( array ); - - } - - const instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb - - this.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb - this.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb - - return this; - - } - - fromWireframeGeometry( geometry ) { - - this.setPositions( geometry.attributes.position.array ); - - return this; - - } - - fromEdgesGeometry( geometry ) { - - this.setPositions( geometry.attributes.position.array ); - - return this; - - } - - fromMesh( mesh ) { - - this.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) ); - - // set colors, maybe - - return this; - - } - - fromLineSegments( lineSegments ) { - - const geometry = lineSegments.geometry; - - this.setPositions( geometry.attributes.position.array ); // assumes non-indexed - - // set colors, maybe - - return this; - - } - - computeBoundingBox() { - - if ( this.boundingBox === null ) { - - this.boundingBox = new Box3(); - - } - - const start = this.attributes.instanceStart; - const end = this.attributes.instanceEnd; - - if ( start !== undefined && end !== undefined ) { - - this.boundingBox.setFromBufferAttribute( start ); - - _box.setFromBufferAttribute( end ); - - this.boundingBox.union( _box ); - - } - - } - - computeBoundingSphere() { - - if ( this.boundingSphere === null ) { - - this.boundingSphere = new Sphere(); - - } - - if ( this.boundingBox === null ) { - - this.computeBoundingBox(); - - } - - const start = this.attributes.instanceStart; - const end = this.attributes.instanceEnd; - - if ( start !== undefined && end !== undefined ) { - - const center = this.boundingSphere.center; - - this.boundingBox.getCenter( center ); - - let maxRadiusSq = 0; - - for ( let i = 0, il = start.count; i < il; i ++ ) { - - _vector.fromBufferAttribute( start, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); - - _vector.fromBufferAttribute( end, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) ); - - } - - this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); - - if ( isNaN( this.boundingSphere.radius ) ) { - - console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); - - } - - } - - } - - toJSON() { - - // todo - - } - - applyMatrix( matrix ) { - - console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' ); - - return this.applyMatrix4( matrix ); - - } - -} - -export { LineSegmentsGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Wireframe.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Wireframe.js deleted file mode 100644 index 18a3f07..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/Wireframe.js +++ /dev/null @@ -1,71 +0,0 @@ -import { - InstancedInterleavedBuffer, - InterleavedBufferAttribute, - Mesh, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js'; -import { LineMaterial } from '../lines/LineMaterial.js'; - -const _start = new Vector3(); -const _end = new Vector3(); -const _viewport = new Vector4(); - -class Wireframe extends Mesh { - - constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) { - - super( geometry, material ); - - this.isWireframe = true; - - this.type = 'Wireframe'; - - } - - // for backwards-compatibility, but could be a method of LineSegmentsGeometry... - - computeLineDistances() { - - const geometry = this.geometry; - - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const lineDistances = new Float32Array( 2 * instanceStart.count ); - - for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) { - - _start.fromBufferAttribute( instanceStart, i ); - _end.fromBufferAttribute( instanceEnd, i ); - - lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; - lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end ); - - } - - const instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 - - geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 - geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 - - return this; - - } - - onBeforeRender( renderer ) { - - const uniforms = this.material.uniforms; - - if ( uniforms && uniforms.resolution ) { - - renderer.getViewport( _viewport ); - this.material.uniforms.resolution.value.set( _viewport.z, _viewport.w ); - - } - - } - -} - -export { Wireframe }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/WireframeGeometry2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/WireframeGeometry2.js deleted file mode 100644 index 0ea3fc0..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/WireframeGeometry2.js +++ /dev/null @@ -1,24 +0,0 @@ -import { - WireframeGeometry -} from '/static/javascript/three/build/three.module.js'; -import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js'; - -class WireframeGeometry2 extends LineSegmentsGeometry { - - constructor( geometry ) { - - super(); - - this.isWireframeGeometry2 = true; - - this.type = 'WireframeGeometry2'; - - this.fromWireframeGeometry( new WireframeGeometry( geometry ) ); - - // set colors, maybe - - } - -} - -export { WireframeGeometry2 }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/Line2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/Line2.js deleted file mode 100644 index 56c1bb8..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/Line2.js +++ /dev/null @@ -1,20 +0,0 @@ -import { LineSegments2 } from './LineSegments2.js'; -import { LineGeometry } from '../LineGeometry.js'; - -import { Line2NodeMaterial } from '/static/javascript/three/build/three.module.js'; - -class Line2 extends LineSegments2 { - - constructor( geometry = new LineGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) { - - super( geometry, material ); - - this.isLine2 = true; - - this.type = 'Line2'; - - } - -} - -export { Line2 }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/LineSegments2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/LineSegments2.js deleted file mode 100644 index 51ce630..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lines/webgpu/LineSegments2.js +++ /dev/null @@ -1,376 +0,0 @@ -import { - Box3, - InstancedInterleavedBuffer, - InterleavedBufferAttribute, - Line3, - MathUtils, - Matrix4, - Mesh, - Sphere, - Vector3, - Vector4, - Line2NodeMaterial -} from '/static/javascript/three/build/three.module.js'; -import { LineSegmentsGeometry } from '../../lines/LineSegmentsGeometry.js'; - -const _viewport = new Vector4(); - -const _start = new Vector3(); -const _end = new Vector3(); - -const _start4 = new Vector4(); -const _end4 = new Vector4(); - -const _ssOrigin = new Vector4(); -const _ssOrigin3 = new Vector3(); -const _mvMatrix = new Matrix4(); -const _line = new Line3(); -const _closestPoint = new Vector3(); - -const _box = new Box3(); -const _sphere = new Sphere(); -const _clipToWorldVector = new Vector4(); - -let _ray, _lineWidth; - -// Returns the margin required to expand by in world space given the distance from the camera, -// line width, resolution, and camera projection -function getWorldSpaceHalfWidth( camera, distance, resolution ) { - - // transform into clip space, adjust the x and y values by the pixel width offset, then - // transform back into world space to get world offset. Note clip space is [-1, 1] so full - // width does not need to be halved. - _clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix ); - _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); - _clipToWorldVector.x = _lineWidth / resolution.width; - _clipToWorldVector.y = _lineWidth / resolution.height; - _clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse ); - _clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w ); - - return Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) ); - -} - -function raycastWorldUnits( lineSegments, intersects ) { - - const matrixWorld = lineSegments.matrixWorld; - const geometry = lineSegments.geometry; - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const segmentCount = Math.min( geometry.instanceCount, instanceStart.count ); - - for ( let i = 0, l = segmentCount; i < l; i ++ ) { - - _line.start.fromBufferAttribute( instanceStart, i ); - _line.end.fromBufferAttribute( instanceEnd, i ); - - _line.applyMatrix4( matrixWorld ); - - const pointOnLine = new Vector3(); - const point = new Vector3(); - - _ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine ); - const isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5; - - if ( isInside ) { - - intersects.push( { - point, - pointOnLine, - distance: _ray.origin.distanceTo( point ), - object: lineSegments, - face: null, - faceIndex: i, - uv: null, - uv1: null, - } ); - - } - - } - -} - -function raycastScreenSpace( lineSegments, camera, intersects ) { - - const projectionMatrix = camera.projectionMatrix; - const material = lineSegments.material; - const resolution = material.resolution; - const matrixWorld = lineSegments.matrixWorld; - - const geometry = lineSegments.geometry; - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const segmentCount = Math.min( geometry.instanceCount, instanceStart.count ); - - const near = - camera.near; - - // - - // pick a point 1 unit out along the ray to avoid the ray origin - // sitting at the camera origin which will cause "w" to be 0 when - // applying the projection matrix. - _ray.at( 1, _ssOrigin ); - - // ndc space [ - 1.0, 1.0 ] - _ssOrigin.w = 1; - _ssOrigin.applyMatrix4( camera.matrixWorldInverse ); - _ssOrigin.applyMatrix4( projectionMatrix ); - _ssOrigin.multiplyScalar( 1 / _ssOrigin.w ); - - // screen space - _ssOrigin.x *= resolution.x / 2; - _ssOrigin.y *= resolution.y / 2; - _ssOrigin.z = 0; - - _ssOrigin3.copy( _ssOrigin ); - - _mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld ); - - for ( let i = 0, l = segmentCount; i < l; i ++ ) { - - _start4.fromBufferAttribute( instanceStart, i ); - _end4.fromBufferAttribute( instanceEnd, i ); - - _start4.w = 1; - _end4.w = 1; - - // camera space - _start4.applyMatrix4( _mvMatrix ); - _end4.applyMatrix4( _mvMatrix ); - - // skip the segment if it's entirely behind the camera - const isBehindCameraNear = _start4.z > near && _end4.z > near; - if ( isBehindCameraNear ) { - - continue; - - } - - // trim the segment if it extends behind camera near - if ( _start4.z > near ) { - - const deltaDist = _start4.z - _end4.z; - const t = ( _start4.z - near ) / deltaDist; - _start4.lerp( _end4, t ); - - } else if ( _end4.z > near ) { - - const deltaDist = _end4.z - _start4.z; - const t = ( _end4.z - near ) / deltaDist; - _end4.lerp( _start4, t ); - - } - - // clip space - _start4.applyMatrix4( projectionMatrix ); - _end4.applyMatrix4( projectionMatrix ); - - // ndc space [ - 1.0, 1.0 ] - _start4.multiplyScalar( 1 / _start4.w ); - _end4.multiplyScalar( 1 / _end4.w ); - - // screen space - _start4.x *= resolution.x / 2; - _start4.y *= resolution.y / 2; - - _end4.x *= resolution.x / 2; - _end4.y *= resolution.y / 2; - - // create 2d segment - _line.start.copy( _start4 ); - _line.start.z = 0; - - _line.end.copy( _end4 ); - _line.end.z = 0; - - // get closest point on ray to segment - const param = _line.closestPointToPointParameter( _ssOrigin3, true ); - _line.at( param, _closestPoint ); - - // check if the intersection point is within clip space - const zPos = MathUtils.lerp( _start4.z, _end4.z, param ); - const isInClipSpace = zPos >= - 1 && zPos <= 1; - - const isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5; - - if ( isInClipSpace && isInside ) { - - _line.start.fromBufferAttribute( instanceStart, i ); - _line.end.fromBufferAttribute( instanceEnd, i ); - - _line.start.applyMatrix4( matrixWorld ); - _line.end.applyMatrix4( matrixWorld ); - - const pointOnLine = new Vector3(); - const point = new Vector3(); - - _ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine ); - - intersects.push( { - point: point, - pointOnLine: pointOnLine, - distance: _ray.origin.distanceTo( point ), - object: lineSegments, - face: null, - faceIndex: i, - uv: null, - uv1: null, - } ); - - } - - } - -} - -class LineSegments2 extends Mesh { - - constructor( geometry = new LineSegmentsGeometry(), material = new Line2NodeMaterial( { color: Math.random() * 0xffffff } ) ) { - - super( geometry, material ); - - this.isLineSegments2 = true; - - this.type = 'LineSegments2'; - - } - - // for backwards-compatibility, but could be a method of LineSegmentsGeometry... - - computeLineDistances() { - - const geometry = this.geometry; - - const instanceStart = geometry.attributes.instanceStart; - const instanceEnd = geometry.attributes.instanceEnd; - const lineDistances = new Float32Array( 2 * instanceStart.count ); - - for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) { - - _start.fromBufferAttribute( instanceStart, i ); - _end.fromBufferAttribute( instanceEnd, i ); - - lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; - lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end ); - - } - - const instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 - - geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 - geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 - - return this; - - } - - raycast( raycaster, intersects ) { - - const worldUnits = this.material.worldUnits; - const camera = raycaster.camera; - - if ( camera === null && ! worldUnits ) { - - console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.' ); - - } - - const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0; - - _ray = raycaster.ray; - - const matrixWorld = this.matrixWorld; - const geometry = this.geometry; - const material = this.material; - - _lineWidth = material.linewidth + threshold; - - // check if we intersect the sphere bounds - if ( geometry.boundingSphere === null ) { - - geometry.computeBoundingSphere(); - - } - - _sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld ); - - // increase the sphere bounds by the worst case line screen space width - let sphereMargin; - if ( worldUnits ) { - - sphereMargin = _lineWidth * 0.5; - - } else { - - const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) ); - sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, material.resolution ); - - } - - _sphere.radius += sphereMargin; - - if ( _ray.intersectsSphere( _sphere ) === false ) { - - return; - - } - - // check if we intersect the box bounds - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); - - } - - _box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld ); - - // increase the box bounds by the worst case line width - let boxMargin; - if ( worldUnits ) { - - boxMargin = _lineWidth * 0.5; - - } else { - - const distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) ); - boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, material.resolution ); - - } - - _box.expandByScalar( boxMargin ); - - if ( _ray.intersectsBox( _box ) === false ) { - - return; - - } - - if ( worldUnits ) { - - raycastWorldUnits( this, intersects ); - - } else { - - raycastScreenSpace( this, camera, intersects ); - - } - - } - - onBeforeRender( renderer ) { - - const uniforms = this.material.uniforms; - - if ( uniforms && uniforms.resolution ) { - - renderer.getViewport( _viewport ); - this.material.uniforms.resolution.value.set( _viewport.z, _viewport.w ); - - } - - } - -} - -export { LineSegments2 }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lottie_canvas.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lottie_canvas.module.js deleted file mode 100644 index 512a84c..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lottie_canvas.module.js +++ /dev/null @@ -1,14849 +0,0 @@ -const lottie = {}; - -if (typeof document !== 'undefined') { - -const svgNS = 'http://www.w3.org/2000/svg'; - -let locationHref = ''; -let _useWebWorker = false; - -const initialDefaultFrame = -999999; - -const setWebWorker = (flag) => { _useWebWorker = !!flag; }; -const getWebWorker = () => _useWebWorker; - -const setLocationHref = (value) => { locationHref = value; }; -const getLocationHref = () => locationHref; - -function createTag(type) { - // return {appendChild:function(){},setAttribute:function(){},style:{}} - return document.createElement(type); -} - -function extendPrototype(sources, destination) { - var i; - var len = sources.length; - var sourcePrototype; - for (i = 0; i < len; i += 1) { - sourcePrototype = sources[i].prototype; - for (var attr in sourcePrototype) { - if (Object.prototype.hasOwnProperty.call(sourcePrototype, attr)) destination.prototype[attr] = sourcePrototype[attr]; - } - } -} - -function getDescriptor(object, prop) { - return Object.getOwnPropertyDescriptor(object, prop); -} - -function createProxyFunction(prototype) { - function ProxyFunction() {} - ProxyFunction.prototype = prototype; - return ProxyFunction; -} - -// import Howl from '../../3rd_party/howler'; - -const audioControllerFactory = (function () { - function AudioController(audioFactory) { - this.audios = []; - this.audioFactory = audioFactory; - this._volume = 1; - this._isMuted = false; - } - - AudioController.prototype = { - addAudio: function (audio) { - this.audios.push(audio); - }, - pause: function () { - var i; - var len = this.audios.length; - for (i = 0; i < len; i += 1) { - this.audios[i].pause(); - } - }, - resume: function () { - var i; - var len = this.audios.length; - for (i = 0; i < len; i += 1) { - this.audios[i].resume(); - } - }, - setRate: function (rateValue) { - var i; - var len = this.audios.length; - for (i = 0; i < len; i += 1) { - this.audios[i].setRate(rateValue); - } - }, - createAudio: function (assetPath) { - if (this.audioFactory) { - return this.audioFactory(assetPath); - } if (window.Howl) { - return new window.Howl({ - src: [assetPath], - }); - } - return { - isPlaying: false, - play: function () { this.isPlaying = true; }, - seek: function () { this.isPlaying = false; }, - playing: function () {}, - rate: function () {}, - setVolume: function () {}, - }; - }, - setAudioFactory: function (audioFactory) { - this.audioFactory = audioFactory; - }, - setVolume: function (value) { - this._volume = value; - this._updateVolume(); - }, - mute: function () { - this._isMuted = true; - this._updateVolume(); - }, - unmute: function () { - this._isMuted = false; - this._updateVolume(); - }, - getVolume: function () { - return this._volume; - }, - _updateVolume: function () { - var i; - var len = this.audios.length; - for (i = 0; i < len; i += 1) { - this.audios[i].volume(this._volume * (this._isMuted ? 0 : 1)); - } - }, - }; - - return function () { - return new AudioController(); - }; -}()); - -const createTypedArray = (function () { - function createRegularArray(type, len) { - var i = 0; - var arr = []; - var value; - switch (type) { - case 'int16': - case 'uint8c': - value = 1; - break; - default: - value = 1.1; - break; - } - for (i = 0; i < len; i += 1) { - arr.push(value); - } - return arr; - } - function createTypedArrayFactory(type, len) { - if (type === 'float32') { - return new Float32Array(len); - } if (type === 'int16') { - return new Int16Array(len); - } if (type === 'uint8c') { - return new Uint8ClampedArray(len); - } - return createRegularArray(type, len); - } - if (typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') { - return createTypedArrayFactory; - } - return createRegularArray; -}()); - -function createSizedArray(len) { - return Array.apply(null, { length: len }); -} - -let subframeEnabled = true; -let expressionsPlugin = null; -let idPrefix$1 = ''; -const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); -let _shouldRoundValues = false; -const bmPow = Math.pow; -const bmSqrt = Math.sqrt; -const bmFloor = Math.floor; -const bmMax = Math.max; -const bmMin = Math.min; - -const BMMath = {}; -(function () { - var propertyNames = ['abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atanh', 'atan2', 'ceil', 'cbrt', 'expm1', 'clz32', 'cos', 'cosh', 'exp', 'floor', 'fround', 'hypot', 'imul', 'log', 'log1p', 'log2', 'log10', 'max', 'min', 'pow', 'random', 'round', 'sign', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc', 'E', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'PI', 'SQRT1_2', 'SQRT2']; - var i; - var len = propertyNames.length; - for (i = 0; i < len; i += 1) { - BMMath[propertyNames[i]] = Math[propertyNames[i]]; - } -}()); - -function ProjectInterface$1() { return {}; } -BMMath.random = Math.random; -BMMath.abs = function (val) { - var tOfVal = typeof val; - if (tOfVal === 'object' && val.length) { - var absArr = createSizedArray(val.length); - var i; - var len = val.length; - for (i = 0; i < len; i += 1) { - absArr[i] = Math.abs(val[i]); - } - return absArr; - } - return Math.abs(val); -}; -let defaultCurveSegments = 150; -const degToRads = Math.PI / 180; -const roundCorner = 0.5519; - -function roundValues(flag) { - _shouldRoundValues = !!flag; -} - -function bmRnd(value) { - if (_shouldRoundValues) { - return Math.round(value); - } - return value; -} - -function styleDiv(element) { - element.style.position = 'absolute'; - element.style.top = 0; - element.style.left = 0; - element.style.display = 'block'; - element.style.transformOrigin = '0 0'; - element.style.webkitTransformOrigin = '0 0'; - element.style.backfaceVisibility = 'visible'; - element.style.webkitBackfaceVisibility = 'visible'; - element.style.transformStyle = 'preserve-3d'; - element.style.webkitTransformStyle = 'preserve-3d'; - element.style.mozTransformStyle = 'preserve-3d'; -} - -function BMEnterFrameEvent(type, currentTime, totalTime, frameMultiplier) { - this.type = type; - this.currentTime = currentTime; - this.totalTime = totalTime; - this.direction = frameMultiplier < 0 ? -1 : 1; -} - -function BMCompleteEvent(type, frameMultiplier) { - this.type = type; - this.direction = frameMultiplier < 0 ? -1 : 1; -} - -function BMCompleteLoopEvent(type, totalLoops, currentLoop, frameMultiplier) { - this.type = type; - this.currentLoop = currentLoop; - this.totalLoops = totalLoops; - this.direction = frameMultiplier < 0 ? -1 : 1; -} - -function BMSegmentStartEvent(type, firstFrame, totalFrames) { - this.type = type; - this.firstFrame = firstFrame; - this.totalFrames = totalFrames; -} - -function BMDestroyEvent(type, target) { - this.type = type; - this.target = target; -} - -function BMRenderFrameErrorEvent(nativeError, currentTime) { - this.type = 'renderFrameError'; - this.nativeError = nativeError; - this.currentTime = currentTime; -} - -function BMConfigErrorEvent(nativeError) { - this.type = 'configError'; - this.nativeError = nativeError; -} - -function BMAnimationConfigErrorEvent(type, nativeError) { - this.type = type; - this.nativeError = nativeError; -} - -const createElementID = (function () { - var _count = 0; - return function createID() { - _count += 1; - return idPrefix$1 + '__lottie_element_' + _count; - }; -}()); - -function HSVtoRGB(h, s, v) { - var r; - var g; - var b; - var i; - var f; - var p; - var q; - var t; - i = Math.floor(h * 6); - f = h * 6 - i; - p = v * (1 - s); - q = v * (1 - f * s); - t = v * (1 - (1 - f) * s); - switch (i % 6) { - case 0: r = v; g = t; b = p; break; - case 1: r = q; g = v; b = p; break; - case 2: r = p; g = v; b = t; break; - case 3: r = p; g = q; b = v; break; - case 4: r = t; g = p; b = v; break; - case 5: r = v; g = p; b = q; break; - default: break; - } - return [r, - g, - b]; -} - -function RGBtoHSV(r, g, b) { - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var d = max - min; - var h; - var s = (max === 0 ? 0 : d / max); - var v = max / 255; - - switch (max) { - case min: h = 0; break; - case r: h = (g - b) + d * (g < b ? 6 : 0); h /= 6 * d; break; - case g: h = (b - r) + d * 2; h /= 6 * d; break; - case b: h = (r - g) + d * 4; h /= 6 * d; break; - default: break; - } - - return [ - h, - s, - v, - ]; -} - -function addSaturationToRGB(color, offset) { - var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255); - hsv[1] += offset; - if (hsv[1] > 1) { - hsv[1] = 1; - } else if (hsv[1] <= 0) { - hsv[1] = 0; - } - return HSVtoRGB(hsv[0], hsv[1], hsv[2]); -} - -function addBrightnessToRGB(color, offset) { - var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255); - hsv[2] += offset; - if (hsv[2] > 1) { - hsv[2] = 1; - } else if (hsv[2] < 0) { - hsv[2] = 0; - } - return HSVtoRGB(hsv[0], hsv[1], hsv[2]); -} - -function addHueToRGB(color, offset) { - var hsv = RGBtoHSV(color[0] * 255, color[1] * 255, color[2] * 255); - hsv[0] += offset / 360; - if (hsv[0] > 1) { - hsv[0] -= 1; - } else if (hsv[0] < 0) { - hsv[0] += 1; - } - return HSVtoRGB(hsv[0], hsv[1], hsv[2]); -} - -const rgbToHex = (function () { - var colorMap = []; - var i; - var hex; - for (i = 0; i < 256; i += 1) { - hex = i.toString(16); - colorMap[i] = hex.length === 1 ? '0' + hex : hex; - } - - return function (r, g, b) { - if (r < 0) { - r = 0; - } - if (g < 0) { - g = 0; - } - if (b < 0) { - b = 0; - } - return '#' + colorMap[r] + colorMap[g] + colorMap[b]; - }; -}()); - -const setSubframeEnabled = (flag) => { subframeEnabled = !!flag; }; -const getSubframeEnabled = () => subframeEnabled; -const setExpressionsPlugin = (value) => { expressionsPlugin = value; }; -const getExpressionsPlugin = () => expressionsPlugin; -const setDefaultCurveSegments = (value) => { defaultCurveSegments = value; }; -const getDefaultCurveSegments = () => defaultCurveSegments; -const setIdPrefix = (value) => { idPrefix$1 = value; }; -const getIdPrefix = () => idPrefix$1; - -function createNS(type) { - // return {appendChild:function(){},setAttribute:function(){},style:{}} - return document.createElementNS(svgNS, type); -} - -const dataManager = (function () { - var _counterId = 1; - var processes = []; - var workerFn; - var workerInstance; - var workerProxy = { - onmessage: function () { - - }, - postMessage: function (path) { - workerFn({ - data: path, - }); - }, - }; - var _workerSelf = { - postMessage: function (data) { - workerProxy.onmessage({ - data: data, - }); - }, - }; - function createWorker(fn) { - if (window.Worker && window.Blob && getWebWorker()) { - var blob = new Blob(['var _workerSelf = self; self.onmessage = ', fn.toString()], { type: 'text/javascript' }); - // var blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' }); - var url = URL.createObjectURL(blob); - return new Worker(url); - } - workerFn = fn; - return workerProxy; - } - - function setupWorker() { - if (!workerInstance) { - workerInstance = createWorker(function workerStart(e) { - function dataFunctionManager() { - function completeLayers(layers, comps) { - var layerData; - var i; - var len = layers.length; - var j; - var jLen; - var k; - var kLen; - for (i = 0; i < len; i += 1) { - layerData = layers[i]; - if (('ks' in layerData) && !layerData.completed) { - layerData.completed = true; - if (layerData.tt) { - layers[i - 1].td = layerData.tt; - } - if (layerData.hasMask) { - var maskProps = layerData.masksProperties; - jLen = maskProps.length; - for (j = 0; j < jLen; j += 1) { - if (maskProps[j].pt.k.i) { - convertPathsToAbsoluteValues(maskProps[j].pt.k); - } else { - kLen = maskProps[j].pt.k.length; - for (k = 0; k < kLen; k += 1) { - if (maskProps[j].pt.k[k].s) { - convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]); - } - if (maskProps[j].pt.k[k].e) { - convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]); - } - } - } - } - } - if (layerData.ty === 0) { - layerData.layers = findCompLayers(layerData.refId, comps); - completeLayers(layerData.layers, comps); - } else if (layerData.ty === 4) { - completeShapes(layerData.shapes); - } else if (layerData.ty === 5) { - completeText(layerData); - } - } - } - } - - function completeChars(chars, assets) { - if (chars) { - var i = 0; - var len = chars.length; - for (i = 0; i < len; i += 1) { - if (chars[i].t === 1) { - // var compData = findComp(chars[i].data.refId, assets); - chars[i].data.layers = findCompLayers(chars[i].data.refId, assets); - // chars[i].data.ip = 0; - // chars[i].data.op = 99999; - // chars[i].data.st = 0; - // chars[i].data.sr = 1; - // chars[i].w = compData.w; - // chars[i].data.ks = { - // a: { k: [0, 0, 0], a: 0 }, - // p: { k: [0, -compData.h, 0], a: 0 }, - // r: { k: 0, a: 0 }, - // s: { k: [100, 100], a: 0 }, - // o: { k: 100, a: 0 }, - // }; - completeLayers(chars[i].data.layers, assets); - } - } - } - } - - function findComp(id, comps) { - var i = 0; - var len = comps.length; - while (i < len) { - if (comps[i].id === id) { - return comps[i]; - } - i += 1; - } - return null; - } - - function findCompLayers(id, comps) { - var comp = findComp(id, comps); - if (comp) { - if (!comp.layers.__used) { - comp.layers.__used = true; - return comp.layers; - } - return JSON.parse(JSON.stringify(comp.layers)); - } - return null; - } - - function completeShapes(arr) { - var i; - var len = arr.length; - var j; - var jLen; - for (i = len - 1; i >= 0; i -= 1) { - if (arr[i].ty === 'sh') { - if (arr[i].ks.k.i) { - convertPathsToAbsoluteValues(arr[i].ks.k); - } else { - jLen = arr[i].ks.k.length; - for (j = 0; j < jLen; j += 1) { - if (arr[i].ks.k[j].s) { - convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]); - } - if (arr[i].ks.k[j].e) { - convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]); - } - } - } - } else if (arr[i].ty === 'gr') { - completeShapes(arr[i].it); - } - } - } - - function convertPathsToAbsoluteValues(path) { - var i; - var len = path.i.length; - for (i = 0; i < len; i += 1) { - path.i[i][0] += path.v[i][0]; - path.i[i][1] += path.v[i][1]; - path.o[i][0] += path.v[i][0]; - path.o[i][1] += path.v[i][1]; - } - } - - function checkVersion(minimum, animVersionString) { - var animVersion = animVersionString ? animVersionString.split('.') : [100, 100, 100]; - if (minimum[0] > animVersion[0]) { - return true; - } if (animVersion[0] > minimum[0]) { - return false; - } - if (minimum[1] > animVersion[1]) { - return true; - } if (animVersion[1] > minimum[1]) { - return false; - } - if (minimum[2] > animVersion[2]) { - return true; - } if (animVersion[2] > minimum[2]) { - return false; - } - return null; - } - - var checkText = (function () { - var minimumVersion = [4, 4, 14]; - - function updateTextLayer(textLayer) { - var documentData = textLayer.t.d; - textLayer.t.d = { - k: [ - { - s: documentData, - t: 0, - }, - ], - }; - } - - function iterateLayers(layers) { - var i; - var len = layers.length; - for (i = 0; i < len; i += 1) { - if (layers[i].ty === 5) { - updateTextLayer(layers[i]); - } - } - } - - return function (animationData) { - if (checkVersion(minimumVersion, animationData.v)) { - iterateLayers(animationData.layers); - if (animationData.assets) { - var i; - var len = animationData.assets.length; - for (i = 0; i < len; i += 1) { - if (animationData.assets[i].layers) { - iterateLayers(animationData.assets[i].layers); - } - } - } - } - }; - }()); - - var checkChars = (function () { - var minimumVersion = [4, 7, 99]; - return function (animationData) { - if (animationData.chars && !checkVersion(minimumVersion, animationData.v)) { - var i; - var len = animationData.chars.length; - for (i = 0; i < len; i += 1) { - var charData = animationData.chars[i]; - if (charData.data && charData.data.shapes) { - completeShapes(charData.data.shapes); - charData.data.ip = 0; - charData.data.op = 99999; - charData.data.st = 0; - charData.data.sr = 1; - charData.data.ks = { - p: { k: [0, 0], a: 0 }, - s: { k: [100, 100], a: 0 }, - a: { k: [0, 0], a: 0 }, - r: { k: 0, a: 0 }, - o: { k: 100, a: 0 }, - }; - if (!animationData.chars[i].t) { - charData.data.shapes.push( - { - ty: 'no', - } - ); - charData.data.shapes[0].it.push( - { - p: { k: [0, 0], a: 0 }, - s: { k: [100, 100], a: 0 }, - a: { k: [0, 0], a: 0 }, - r: { k: 0, a: 0 }, - o: { k: 100, a: 0 }, - sk: { k: 0, a: 0 }, - sa: { k: 0, a: 0 }, - ty: 'tr', - } - ); - } - } - } - } - }; - }()); - - var checkPathProperties = (function () { - var minimumVersion = [5, 7, 15]; - - function updateTextLayer(textLayer) { - var pathData = textLayer.t.p; - if (typeof pathData.a === 'number') { - pathData.a = { - a: 0, - k: pathData.a, - }; - } - if (typeof pathData.p === 'number') { - pathData.p = { - a: 0, - k: pathData.p, - }; - } - if (typeof pathData.r === 'number') { - pathData.r = { - a: 0, - k: pathData.r, - }; - } - } - - function iterateLayers(layers) { - var i; - var len = layers.length; - for (i = 0; i < len; i += 1) { - if (layers[i].ty === 5) { - updateTextLayer(layers[i]); - } - } - } - - return function (animationData) { - if (checkVersion(minimumVersion, animationData.v)) { - iterateLayers(animationData.layers); - if (animationData.assets) { - var i; - var len = animationData.assets.length; - for (i = 0; i < len; i += 1) { - if (animationData.assets[i].layers) { - iterateLayers(animationData.assets[i].layers); - } - } - } - } - }; - }()); - - var checkColors = (function () { - var minimumVersion = [4, 1, 9]; - - function iterateShapes(shapes) { - var i; - var len = shapes.length; - var j; - var jLen; - for (i = 0; i < len; i += 1) { - if (shapes[i].ty === 'gr') { - iterateShapes(shapes[i].it); - } else if (shapes[i].ty === 'fl' || shapes[i].ty === 'st') { - if (shapes[i].c.k && shapes[i].c.k[0].i) { - jLen = shapes[i].c.k.length; - for (j = 0; j < jLen; j += 1) { - if (shapes[i].c.k[j].s) { - shapes[i].c.k[j].s[0] /= 255; - shapes[i].c.k[j].s[1] /= 255; - shapes[i].c.k[j].s[2] /= 255; - shapes[i].c.k[j].s[3] /= 255; - } - if (shapes[i].c.k[j].e) { - shapes[i].c.k[j].e[0] /= 255; - shapes[i].c.k[j].e[1] /= 255; - shapes[i].c.k[j].e[2] /= 255; - shapes[i].c.k[j].e[3] /= 255; - } - } - } else { - shapes[i].c.k[0] /= 255; - shapes[i].c.k[1] /= 255; - shapes[i].c.k[2] /= 255; - shapes[i].c.k[3] /= 255; - } - } - } - } - - function iterateLayers(layers) { - var i; - var len = layers.length; - for (i = 0; i < len; i += 1) { - if (layers[i].ty === 4) { - iterateShapes(layers[i].shapes); - } - } - } - - return function (animationData) { - if (checkVersion(minimumVersion, animationData.v)) { - iterateLayers(animationData.layers); - if (animationData.assets) { - var i; - var len = animationData.assets.length; - for (i = 0; i < len; i += 1) { - if (animationData.assets[i].layers) { - iterateLayers(animationData.assets[i].layers); - } - } - } - } - }; - }()); - - var checkShapes = (function () { - var minimumVersion = [4, 4, 18]; - - function completeClosingShapes(arr) { - var i; - var len = arr.length; - var j; - var jLen; - for (i = len - 1; i >= 0; i -= 1) { - if (arr[i].ty === 'sh') { - if (arr[i].ks.k.i) { - arr[i].ks.k.c = arr[i].closed; - } else { - jLen = arr[i].ks.k.length; - for (j = 0; j < jLen; j += 1) { - if (arr[i].ks.k[j].s) { - arr[i].ks.k[j].s[0].c = arr[i].closed; - } - if (arr[i].ks.k[j].e) { - arr[i].ks.k[j].e[0].c = arr[i].closed; - } - } - } - } else if (arr[i].ty === 'gr') { - completeClosingShapes(arr[i].it); - } - } - } - - function iterateLayers(layers) { - var layerData; - var i; - var len = layers.length; - var j; - var jLen; - var k; - var kLen; - for (i = 0; i < len; i += 1) { - layerData = layers[i]; - if (layerData.hasMask) { - var maskProps = layerData.masksProperties; - jLen = maskProps.length; - for (j = 0; j < jLen; j += 1) { - if (maskProps[j].pt.k.i) { - maskProps[j].pt.k.c = maskProps[j].cl; - } else { - kLen = maskProps[j].pt.k.length; - for (k = 0; k < kLen; k += 1) { - if (maskProps[j].pt.k[k].s) { - maskProps[j].pt.k[k].s[0].c = maskProps[j].cl; - } - if (maskProps[j].pt.k[k].e) { - maskProps[j].pt.k[k].e[0].c = maskProps[j].cl; - } - } - } - } - } - if (layerData.ty === 4) { - completeClosingShapes(layerData.shapes); - } - } - } - - return function (animationData) { - if (checkVersion(minimumVersion, animationData.v)) { - iterateLayers(animationData.layers); - if (animationData.assets) { - var i; - var len = animationData.assets.length; - for (i = 0; i < len; i += 1) { - if (animationData.assets[i].layers) { - iterateLayers(animationData.assets[i].layers); - } - } - } - } - }; - }()); - - function completeData(animationData) { - if (animationData.__complete) { - return; - } - checkColors(animationData); - checkText(animationData); - checkChars(animationData); - checkPathProperties(animationData); - checkShapes(animationData); - completeLayers(animationData.layers, animationData.assets); - completeChars(animationData.chars, animationData.assets); - animationData.__complete = true; - } - - function completeText(data) { - if (data.t.a.length === 0 && !('m' in data.t.p)) { - // data.singleShape = true; - } - } - - var moduleOb = {}; - moduleOb.completeData = completeData; - moduleOb.checkColors = checkColors; - moduleOb.checkChars = checkChars; - moduleOb.checkPathProperties = checkPathProperties; - moduleOb.checkShapes = checkShapes; - moduleOb.completeLayers = completeLayers; - - return moduleOb; - } - if (!_workerSelf.dataManager) { - _workerSelf.dataManager = dataFunctionManager(); - } - - if (!_workerSelf.assetLoader) { - _workerSelf.assetLoader = (function () { - function formatResponse(xhr) { - // using typeof doubles the time of execution of this method, - // so if available, it's better to use the header to validate the type - var contentTypeHeader = xhr.getResponseHeader('content-type'); - if (contentTypeHeader && xhr.responseType === 'json' && contentTypeHeader.indexOf('json') !== -1) { - return xhr.response; - } - if (xhr.response && typeof xhr.response === 'object') { - return xhr.response; - } if (xhr.response && typeof xhr.response === 'string') { - return JSON.parse(xhr.response); - } if (xhr.responseText) { - return JSON.parse(xhr.responseText); - } - return null; - } - - function loadAsset(path, fullPath, callback, errorCallback) { - var response; - var xhr = new XMLHttpRequest(); - // set responseType after calling open or IE will break. - try { - // This crashes on Android WebView prior to KitKat - xhr.responseType = 'json'; - } catch (err) {} // eslint-disable-line no-empty - xhr.onreadystatechange = function () { - if (xhr.readyState === 4) { - if (xhr.status === 200) { - response = formatResponse(xhr); - callback(response); - } else { - try { - response = formatResponse(xhr); - callback(response); - } catch (err) { - if (errorCallback) { - errorCallback(err); - } - } - } - } - }; - try { - xhr.open('GET', path, true); - } catch (error) { - xhr.open('GET', fullPath + '/' + path, true); - } - xhr.send(); - } - return { - load: loadAsset, - }; - }()); - } - - if (e.data.type === 'loadAnimation') { - _workerSelf.assetLoader.load( - e.data.path, - e.data.fullPath, - function (data) { - _workerSelf.dataManager.completeData(data); - _workerSelf.postMessage({ - id: e.data.id, - payload: data, - status: 'success', - }); - }, - function () { - _workerSelf.postMessage({ - id: e.data.id, - status: 'error', - }); - } - ); - } else if (e.data.type === 'complete') { - var animation = e.data.animation; - _workerSelf.dataManager.completeData(animation); - _workerSelf.postMessage({ - id: e.data.id, - payload: animation, - status: 'success', - }); - } else if (e.data.type === 'loadData') { - _workerSelf.assetLoader.load( - e.data.path, - e.data.fullPath, - function (data) { - _workerSelf.postMessage({ - id: e.data.id, - payload: data, - status: 'success', - }); - }, - function () { - _workerSelf.postMessage({ - id: e.data.id, - status: 'error', - }); - } - ); - } - }); - - workerInstance.onmessage = function (event) { - var data = event.data; - var id = data.id; - var process = processes[id]; - processes[id] = null; - if (data.status === 'success') { - process.onComplete(data.payload); - } else if (process.onError) { - process.onError(); - } - }; - } - } - - function createProcess(onComplete, onError) { - _counterId += 1; - var id = 'processId_' + _counterId; - processes[id] = { - onComplete: onComplete, - onError: onError, - }; - return id; - } - - function loadAnimation(path, onComplete, onError) { - setupWorker(); - var processId = createProcess(onComplete, onError); - workerInstance.postMessage({ - type: 'loadAnimation', - path: path, - fullPath: window.location.origin + window.location.pathname, - id: processId, - }); - } - - function loadData(path, onComplete, onError) { - setupWorker(); - var processId = createProcess(onComplete, onError); - workerInstance.postMessage({ - type: 'loadData', - path: path, - fullPath: window.location.origin + window.location.pathname, - id: processId, - }); - } - - function completeAnimation(anim, onComplete, onError) { - setupWorker(); - var processId = createProcess(onComplete, onError); - workerInstance.postMessage({ - type: 'complete', - animation: anim, - id: processId, - }); - } - - return { - loadAnimation: loadAnimation, - loadData: loadData, - completeAnimation: completeAnimation, - }; -}()); - -const ImagePreloader = (function () { - var proxyImage = (function () { - var canvas = createTag('canvas'); - canvas.width = 1; - canvas.height = 1; - var ctx = canvas.getContext('2d'); - ctx.fillStyle = 'rgba(0,0,0,0)'; - ctx.fillRect(0, 0, 1, 1); - return canvas; - }()); - - function imageLoaded() { - this.loadedAssets += 1; - if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) { - if (this.imagesLoadedCb) { - this.imagesLoadedCb(null); - } - } - } - function footageLoaded() { - this.loadedFootagesCount += 1; - if (this.loadedAssets === this.totalImages && this.loadedFootagesCount === this.totalFootages) { - if (this.imagesLoadedCb) { - this.imagesLoadedCb(null); - } - } - } - - function getAssetsPath(assetData, assetsPath, originalPath) { - var path = ''; - if (assetData.e) { - path = assetData.p; - } else if (assetsPath) { - var imagePath = assetData.p; - if (imagePath.indexOf('images/') !== -1) { - imagePath = imagePath.split('/')[1]; - } - path = assetsPath + imagePath; - } else { - path = originalPath; - path += assetData.u ? assetData.u : ''; - path += assetData.p; - } - return path; - } - - function testImageLoaded(img) { - var _count = 0; - var intervalId = setInterval(function () { - var box = img.getBBox(); - if (box.width || _count > 500) { - this._imageLoaded(); - clearInterval(intervalId); - } - _count += 1; - }.bind(this), 50); - } - - function createImageData(assetData) { - var path = getAssetsPath(assetData, this.assetsPath, this.path); - var img = createNS('image'); - if (isSafari) { - this.testImageLoaded(img); - } else { - img.addEventListener('load', this._imageLoaded, false); - } - img.addEventListener('error', function () { - ob.img = proxyImage; - this._imageLoaded(); - }.bind(this), false); - img.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path); - if (this._elementHelper.append) { - this._elementHelper.append(img); - } else { - this._elementHelper.appendChild(img); - } - var ob = { - img: img, - assetData: assetData, - }; - return ob; - } - - function createImgData(assetData) { - var path = getAssetsPath(assetData, this.assetsPath, this.path); - var img = createTag('img'); - img.crossOrigin = 'anonymous'; - img.addEventListener('load', this._imageLoaded, false); - img.addEventListener('error', function () { - ob.img = proxyImage; - this._imageLoaded(); - }.bind(this), false); - img.src = path; - var ob = { - img: img, - assetData: assetData, - }; - return ob; - } - - function createFootageData(data) { - var ob = { - assetData: data, - }; - var path = getAssetsPath(data, this.assetsPath, this.path); - dataManager.loadData(path, function (footageData) { - ob.img = footageData; - this._footageLoaded(); - }.bind(this), function () { - ob.img = {}; - this._footageLoaded(); - }.bind(this)); - return ob; - } - - function loadAssets(assets, cb) { - this.imagesLoadedCb = cb; - var i; - var len = assets.length; - for (i = 0; i < len; i += 1) { - if (!assets[i].layers) { - if (!assets[i].t || assets[i].t === 'seq') { - this.totalImages += 1; - this.images.push(this._createImageData(assets[i])); - } else if (assets[i].t === 3) { - this.totalFootages += 1; - this.images.push(this.createFootageData(assets[i])); - } - } - } - } - - function setPath(path) { - this.path = path || ''; - } - - function setAssetsPath(path) { - this.assetsPath = path || ''; - } - - function getAsset(assetData) { - var i = 0; - var len = this.images.length; - while (i < len) { - if (this.images[i].assetData === assetData) { - return this.images[i].img; - } - i += 1; - } - return null; - } - - function destroy() { - this.imagesLoadedCb = null; - this.images.length = 0; - } - - function loadedImages() { - return this.totalImages === this.loadedAssets; - } - - function loadedFootages() { - return this.totalFootages === this.loadedFootagesCount; - } - - function setCacheType(type, elementHelper) { - if (type === 'svg') { - this._elementHelper = elementHelper; - this._createImageData = this.createImageData.bind(this); - } else { - this._createImageData = this.createImgData.bind(this); - } - } - - function ImagePreloaderFactory() { - this._imageLoaded = imageLoaded.bind(this); - this._footageLoaded = footageLoaded.bind(this); - this.testImageLoaded = testImageLoaded.bind(this); - this.createFootageData = createFootageData.bind(this); - this.assetsPath = ''; - this.path = ''; - this.totalImages = 0; - this.totalFootages = 0; - this.loadedAssets = 0; - this.loadedFootagesCount = 0; - this.imagesLoadedCb = null; - this.images = []; - } - - ImagePreloaderFactory.prototype = { - loadAssets: loadAssets, - setAssetsPath: setAssetsPath, - setPath: setPath, - loadedImages: loadedImages, - loadedFootages: loadedFootages, - destroy: destroy, - getAsset: getAsset, - createImgData: createImgData, - createImageData: createImageData, - imageLoaded: imageLoaded, - footageLoaded: footageLoaded, - setCacheType: setCacheType, - }; - - return ImagePreloaderFactory; -}()); - -function BaseEvent() {} -BaseEvent.prototype = { - triggerEvent: function (eventName, args) { - if (this._cbs[eventName]) { - var callbacks = this._cbs[eventName]; - for (var i = 0; i < callbacks.length; i += 1) { - callbacks[i](args); - } - } - }, - addEventListener: function (eventName, callback) { - if (!this._cbs[eventName]) { - this._cbs[eventName] = []; - } - this._cbs[eventName].push(callback); - - return function () { - this.removeEventListener(eventName, callback); - }.bind(this); - }, - removeEventListener: function (eventName, callback) { - if (!callback) { - this._cbs[eventName] = null; - } else if (this._cbs[eventName]) { - var i = 0; - var len = this._cbs[eventName].length; - while (i < len) { - if (this._cbs[eventName][i] === callback) { - this._cbs[eventName].splice(i, 1); - i -= 1; - len -= 1; - } - i += 1; - } - if (!this._cbs[eventName].length) { - this._cbs[eventName] = null; - } - } - }, -}; - -const markerParser = ( - - function () { - function parsePayloadLines(payload) { - var lines = payload.split('\r\n'); - var keys = {}; - var line; - var keysCount = 0; - for (var i = 0; i < lines.length; i += 1) { - line = lines[i].split(':'); - if (line.length === 2) { - keys[line[0]] = line[1].trim(); - keysCount += 1; - } - } - if (keysCount === 0) { - throw new Error(); - } - return keys; - } - - return function (_markers) { - var markers = []; - for (var i = 0; i < _markers.length; i += 1) { - var _marker = _markers[i]; - var markerData = { - time: _marker.tm, - duration: _marker.dr, - }; - try { - markerData.payload = JSON.parse(_markers[i].cm); - } catch (_) { - try { - markerData.payload = parsePayloadLines(_markers[i].cm); - } catch (__) { - markerData.payload = { - name: _markers[i].cm, - }; - } - } - markers.push(markerData); - } - return markers; - }; - }()); - -const ProjectInterface = (function () { - function registerComposition(comp) { - this.compositions.push(comp); - } - - return function () { - function _thisProjectFunction(name) { - var i = 0; - var len = this.compositions.length; - while (i < len) { - if (this.compositions[i].data && this.compositions[i].data.nm === name) { - if (this.compositions[i].prepareFrame && this.compositions[i].data.xt) { - this.compositions[i].prepareFrame(this.currentFrame); - } - return this.compositions[i].compInterface; - } - i += 1; - } - return null; - } - - _thisProjectFunction.compositions = []; - _thisProjectFunction.currentFrame = 0; - - _thisProjectFunction.registerComposition = registerComposition; - - return _thisProjectFunction; - }; -}()); - -const renderers = {}; - -const registerRenderer = (key, value) => { - renderers[key] = value; -}; - -function getRenderer(key) { - return renderers[key]; -} - -const AnimationItem = function () { - this._cbs = []; - this.name = ''; - this.path = ''; - this.isLoaded = false; - this.currentFrame = 0; - this.currentRawFrame = 0; - this.firstFrame = 0; - this.totalFrames = 0; - this.frameRate = 0; - this.frameMult = 0; - this.playSpeed = 1; - this.playDirection = 1; - this.playCount = 0; - this.animationData = {}; - this.assets = []; - this.isPaused = true; - this.autoplay = false; - this.loop = true; - this.renderer = null; - this.animationID = createElementID(); - this.assetsPath = ''; - this.timeCompleted = 0; - this.segmentPos = 0; - this.isSubframeEnabled = getSubframeEnabled(); - this.segments = []; - this._idle = true; - this._completedLoop = false; - this.projectInterface = ProjectInterface(); - this.imagePreloader = new ImagePreloader(); - this.audioController = audioControllerFactory(); - this.markers = []; - this.configAnimation = this.configAnimation.bind(this); - this.onSetupError = this.onSetupError.bind(this); - this.onSegmentComplete = this.onSegmentComplete.bind(this); - this.drawnFrameEvent = new BMEnterFrameEvent('drawnFrame', 0, 0, 0); -}; - -extendPrototype([BaseEvent], AnimationItem); - -AnimationItem.prototype.setParams = function (params) { - if (params.wrapper || params.container) { - this.wrapper = params.wrapper || params.container; - } - var animType = 'svg'; - if (params.animType) { - animType = params.animType; - } else if (params.renderer) { - animType = params.renderer; - } - const RendererClass = getRenderer(animType); - this.renderer = new RendererClass(this, params.rendererSettings); - this.imagePreloader.setCacheType(animType, this.renderer.globalData.defs); - this.renderer.setProjectInterface(this.projectInterface); - this.animType = animType; - if (params.loop === '' - || params.loop === null - || params.loop === undefined - || params.loop === true) { - this.loop = true; - } else if (params.loop === false) { - this.loop = false; - } else { - this.loop = parseInt(params.loop, 10); - } - this.autoplay = 'autoplay' in params ? params.autoplay : true; - this.name = params.name ? params.name : ''; - this.autoloadSegments = Object.prototype.hasOwnProperty.call(params, 'autoloadSegments') ? params.autoloadSegments : true; - this.assetsPath = params.assetsPath; - this.initialSegment = params.initialSegment; - if (params.audioFactory) { - this.audioController.setAudioFactory(params.audioFactory); - } - if (params.animationData) { - this.setupAnimation(params.animationData); - } else if (params.path) { - if (params.path.lastIndexOf('\\') !== -1) { - this.path = params.path.substr(0, params.path.lastIndexOf('\\') + 1); - } else { - this.path = params.path.substr(0, params.path.lastIndexOf('/') + 1); - } - this.fileName = params.path.substr(params.path.lastIndexOf('/') + 1); - this.fileName = this.fileName.substr(0, this.fileName.lastIndexOf('.json')); - dataManager.loadAnimation( - params.path, - this.configAnimation, - this.onSetupError - ); - } -}; - -AnimationItem.prototype.onSetupError = function () { - this.trigger('data_failed'); -}; - -AnimationItem.prototype.setupAnimation = function (data) { - dataManager.completeAnimation( - data, - this.configAnimation - ); -}; - -AnimationItem.prototype.setData = function (wrapper, animationData) { - if (animationData) { - if (typeof animationData !== 'object') { - animationData = JSON.parse(animationData); - } - } - var params = { - wrapper: wrapper, - animationData: animationData, - }; - var wrapperAttributes = wrapper.attributes; - - params.path = wrapperAttributes.getNamedItem('data-animation-path') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-animation-path').value - : wrapperAttributes.getNamedItem('data-bm-path') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-path').value - : wrapperAttributes.getNamedItem('bm-path') - ? wrapperAttributes.getNamedItem('bm-path').value - : ''; - params.animType = wrapperAttributes.getNamedItem('data-anim-type') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-anim-type').value - : wrapperAttributes.getNamedItem('data-bm-type') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-type').value - : wrapperAttributes.getNamedItem('bm-type') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('bm-type').value - : wrapperAttributes.getNamedItem('data-bm-renderer') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-renderer').value - : wrapperAttributes.getNamedItem('bm-renderer') - ? wrapperAttributes.getNamedItem('bm-renderer').value - : 'canvas'; - - var loop = wrapperAttributes.getNamedItem('data-anim-loop') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-anim-loop').value - : wrapperAttributes.getNamedItem('data-bm-loop') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-loop').value - : wrapperAttributes.getNamedItem('bm-loop') - ? wrapperAttributes.getNamedItem('bm-loop').value - : ''; - if (loop === 'false') { - params.loop = false; - } else if (loop === 'true') { - params.loop = true; - } else if (loop !== '') { - params.loop = parseInt(loop, 10); - } - var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-anim-autoplay').value - : wrapperAttributes.getNamedItem('data-bm-autoplay') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-autoplay').value - : wrapperAttributes.getNamedItem('bm-autoplay') - ? wrapperAttributes.getNamedItem('bm-autoplay').value - : true; - params.autoplay = autoplay !== 'false'; - - params.name = wrapperAttributes.getNamedItem('data-name') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-name').value - : wrapperAttributes.getNamedItem('data-bm-name') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-name').value - : wrapperAttributes.getNamedItem('bm-name') - ? wrapperAttributes.getNamedItem('bm-name').value - : ''; - var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-anim-prerender').value - : wrapperAttributes.getNamedItem('data-bm-prerender') // eslint-disable-line no-nested-ternary - ? wrapperAttributes.getNamedItem('data-bm-prerender').value - : wrapperAttributes.getNamedItem('bm-prerender') - ? wrapperAttributes.getNamedItem('bm-prerender').value - : ''; - - if (prerender === 'false') { - params.prerender = false; - } - this.setParams(params); -}; - -AnimationItem.prototype.includeLayers = function (data) { - if (data.op > this.animationData.op) { - this.animationData.op = data.op; - this.totalFrames = Math.floor(data.op - this.animationData.ip); - } - var layers = this.animationData.layers; - var i; - var len = layers.length; - var newLayers = data.layers; - var j; - var jLen = newLayers.length; - for (j = 0; j < jLen; j += 1) { - i = 0; - while (i < len) { - if (layers[i].id === newLayers[j].id) { - layers[i] = newLayers[j]; - break; - } - i += 1; - } - } - if (data.chars || data.fonts) { - this.renderer.globalData.fontManager.addChars(data.chars); - this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs); - } - if (data.assets) { - len = data.assets.length; - for (i = 0; i < len; i += 1) { - this.animationData.assets.push(data.assets[i]); - } - } - this.animationData.__complete = false; - dataManager.completeAnimation( - this.animationData, - this.onSegmentComplete - ); -}; - -AnimationItem.prototype.onSegmentComplete = function (data) { - this.animationData = data; - var expressionsPlugin = getExpressionsPlugin(); - if (expressionsPlugin) { - expressionsPlugin.initExpressions(this); - } - this.loadNextSegment(); -}; - -AnimationItem.prototype.loadNextSegment = function () { - var segments = this.animationData.segments; - if (!segments || segments.length === 0 || !this.autoloadSegments) { - this.trigger('data_ready'); - this.timeCompleted = this.totalFrames; - return; - } - var segment = segments.shift(); - this.timeCompleted = segment.time * this.frameRate; - var segmentPath = this.path + this.fileName + '_' + this.segmentPos + '.json'; - this.segmentPos += 1; - dataManager.loadData(segmentPath, this.includeLayers.bind(this), function () { - this.trigger('data_failed'); - }.bind(this)); -}; - -AnimationItem.prototype.loadSegments = function () { - var segments = this.animationData.segments; - if (!segments) { - this.timeCompleted = this.totalFrames; - } - this.loadNextSegment(); -}; - -AnimationItem.prototype.imagesLoaded = function () { - this.trigger('loaded_images'); - this.checkLoaded(); -}; - -AnimationItem.prototype.preloadImages = function () { - this.imagePreloader.setAssetsPath(this.assetsPath); - this.imagePreloader.setPath(this.path); - this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this)); -}; - -AnimationItem.prototype.configAnimation = function (animData) { - if (!this.renderer) { - return; - } - try { - this.animationData = animData; - if (this.initialSegment) { - this.totalFrames = Math.floor(this.initialSegment[1] - this.initialSegment[0]); - this.firstFrame = Math.round(this.initialSegment[0]); - } else { - this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip); - this.firstFrame = Math.round(this.animationData.ip); - } - this.renderer.configAnimation(animData); - if (!animData.assets) { - animData.assets = []; - } - - this.assets = this.animationData.assets; - this.frameRate = this.animationData.fr; - this.frameMult = this.animationData.fr / 1000; - this.renderer.searchExtraCompositions(animData.assets); - this.markers = markerParser(animData.markers || []); - this.trigger('config_ready'); - this.preloadImages(); - this.loadSegments(); - this.updaFrameModifier(); - this.waitForFontsLoaded(); - if (this.isPaused) { - this.audioController.pause(); - } - } catch (error) { - this.triggerConfigError(error); - } -}; - -AnimationItem.prototype.waitForFontsLoaded = function () { - if (!this.renderer) { - return; - } - if (this.renderer.globalData.fontManager.isLoaded) { - this.checkLoaded(); - } else { - setTimeout(this.waitForFontsLoaded.bind(this), 20); - } -}; - -AnimationItem.prototype.checkLoaded = function () { - if (!this.isLoaded - && this.renderer.globalData.fontManager.isLoaded - && (this.imagePreloader.loadedImages() || this.renderer.rendererType !== 'canvas') - && (this.imagePreloader.loadedFootages()) - ) { - this.isLoaded = true; - var expressionsPlugin = getExpressionsPlugin(); - if (expressionsPlugin) { - expressionsPlugin.initExpressions(this); - } - this.renderer.initItems(); - setTimeout(function () { - this.trigger('DOMLoaded'); - }.bind(this), 0); - this.gotoFrame(); - if (this.autoplay) { - this.play(); - } - } -}; - -AnimationItem.prototype.resize = function () { - this.renderer.updateContainerSize(); -}; - -AnimationItem.prototype.setSubframe = function (flag) { - this.isSubframeEnabled = !!flag; -}; - -AnimationItem.prototype.gotoFrame = function () { - this.currentFrame = this.isSubframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame; // eslint-disable-line no-bitwise - - if (this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted) { - this.currentFrame = this.timeCompleted; - } - this.trigger('enterFrame'); - this.renderFrame(); - this.trigger('drawnFrame'); -}; - -AnimationItem.prototype.renderFrame = function () { - if (this.isLoaded === false || !this.renderer) { - return; - } - try { - this.renderer.renderFrame(this.currentFrame + this.firstFrame); - } catch (error) { - this.triggerRenderFrameError(error); - } -}; - -AnimationItem.prototype.play = function (name) { - if (name && this.name !== name) { - return; - } - if (this.isPaused === true) { - this.isPaused = false; - this.trigger('_pause'); - this.audioController.resume(); - if (this._idle) { - this._idle = false; - this.trigger('_active'); - } - } -}; - -AnimationItem.prototype.pause = function (name) { - if (name && this.name !== name) { - return; - } - if (this.isPaused === false) { - this.isPaused = true; - this.trigger('_play'); - this._idle = true; - this.trigger('_idle'); - this.audioController.pause(); - } -}; - -AnimationItem.prototype.togglePause = function (name) { - if (name && this.name !== name) { - return; - } - if (this.isPaused === true) { - this.play(); - } else { - this.pause(); - } -}; - -AnimationItem.prototype.stop = function (name) { - if (name && this.name !== name) { - return; - } - this.pause(); - this.playCount = 0; - this._completedLoop = false; - this.setCurrentRawFrameValue(0); -}; - -AnimationItem.prototype.getMarkerData = function (markerName) { - var marker; - for (var i = 0; i < this.markers.length; i += 1) { - marker = this.markers[i]; - if (marker.payload && marker.payload.name === markerName) { - return marker; - } - } - return null; -}; - -AnimationItem.prototype.goToAndStop = function (value, isFrame, name) { - if (name && this.name !== name) { - return; - } - var numValue = Number(value); - if (isNaN(numValue)) { - var marker = this.getMarkerData(value); - if (marker) { - this.goToAndStop(marker.time, true); - } - } else if (isFrame) { - this.setCurrentRawFrameValue(value); - } else { - this.setCurrentRawFrameValue(value * this.frameModifier); - } - this.pause(); -}; - -AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) { - if (name && this.name !== name) { - return; - } - var numValue = Number(value); - if (isNaN(numValue)) { - var marker = this.getMarkerData(value); - if (marker) { - if (!marker.duration) { - this.goToAndStop(marker.time, true); - } else { - this.playSegments([marker.time, marker.time + marker.duration], true); - } - } - } else { - this.goToAndStop(numValue, isFrame, name); - } - this.play(); -}; - -AnimationItem.prototype.advanceTime = function (value) { - if (this.isPaused === true || this.isLoaded === false) { - return; - } - var nextValue = this.currentRawFrame + value * this.frameModifier; - var _isComplete = false; - // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations. - // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop. - if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) { - if (!this.loop || this.playCount === this.loop) { - if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) { - _isComplete = true; - nextValue = this.totalFrames - 1; - } - } else if (nextValue >= this.totalFrames) { - this.playCount += 1; - if (!this.checkSegments(nextValue % this.totalFrames)) { - this.setCurrentRawFrameValue(nextValue % this.totalFrames); - this._completedLoop = true; - this.trigger('loopComplete'); - } - } else { - this.setCurrentRawFrameValue(nextValue); - } - } else if (nextValue < 0) { - if (!this.checkSegments(nextValue % this.totalFrames)) { - if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) { // eslint-disable-line no-plusplus - this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames)); - if (!this._completedLoop) { - this._completedLoop = true; - } else { - this.trigger('loopComplete'); - } - } else { - _isComplete = true; - nextValue = 0; - } - } - } else { - this.setCurrentRawFrameValue(nextValue); - } - if (_isComplete) { - this.setCurrentRawFrameValue(nextValue); - this.pause(); - this.trigger('complete'); - } -}; - -AnimationItem.prototype.adjustSegment = function (arr, offset) { - this.playCount = 0; - if (arr[1] < arr[0]) { - if (this.frameModifier > 0) { - if (this.playSpeed < 0) { - this.setSpeed(-this.playSpeed); - } else { - this.setDirection(-1); - } - } - this.totalFrames = arr[0] - arr[1]; - this.timeCompleted = this.totalFrames; - this.firstFrame = arr[1]; - this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset); - } else if (arr[1] > arr[0]) { - if (this.frameModifier < 0) { - if (this.playSpeed < 0) { - this.setSpeed(-this.playSpeed); - } else { - this.setDirection(1); - } - } - this.totalFrames = arr[1] - arr[0]; - this.timeCompleted = this.totalFrames; - this.firstFrame = arr[0]; - this.setCurrentRawFrameValue(0.001 + offset); - } - this.trigger('segmentStart'); -}; -AnimationItem.prototype.setSegment = function (init, end) { - var pendingFrame = -1; - if (this.isPaused) { - if (this.currentRawFrame + this.firstFrame < init) { - pendingFrame = init; - } else if (this.currentRawFrame + this.firstFrame > end) { - pendingFrame = end - init; - } - } - - this.firstFrame = init; - this.totalFrames = end - init; - this.timeCompleted = this.totalFrames; - if (pendingFrame !== -1) { - this.goToAndStop(pendingFrame, true); - } -}; - -AnimationItem.prototype.playSegments = function (arr, forceFlag) { - if (forceFlag) { - this.segments.length = 0; - } - if (typeof arr[0] === 'object') { - var i; - var len = arr.length; - for (i = 0; i < len; i += 1) { - this.segments.push(arr[i]); - } - } else { - this.segments.push(arr); - } - if (this.segments.length && forceFlag) { - this.adjustSegment(this.segments.shift(), 0); - } - if (this.isPaused) { - this.play(); - } -}; - -AnimationItem.prototype.resetSegments = function (forceFlag) { - this.segments.length = 0; - this.segments.push([this.animationData.ip, this.animationData.op]); - if (forceFlag) { - this.checkSegments(0); - } -}; -AnimationItem.prototype.checkSegments = function (offset) { - if (this.segments.length) { - this.adjustSegment(this.segments.shift(), offset); - return true; - } - return false; -}; - -AnimationItem.prototype.destroy = function (name) { - if ((name && this.name !== name) || !this.renderer) { - return; - } - this.renderer.destroy(); - this.imagePreloader.destroy(); - this.trigger('destroy'); - this._cbs = null; - this.onEnterFrame = null; - this.onLoopComplete = null; - this.onComplete = null; - this.onSegmentStart = null; - this.onDestroy = null; - this.renderer = null; - this.renderer = null; - this.imagePreloader = null; - this.projectInterface = null; -}; - -AnimationItem.prototype.setCurrentRawFrameValue = function (value) { - this.currentRawFrame = value; - this.gotoFrame(); -}; - -AnimationItem.prototype.setSpeed = function (val) { - this.playSpeed = val; - this.updaFrameModifier(); -}; - -AnimationItem.prototype.setDirection = function (val) { - this.playDirection = val < 0 ? -1 : 1; - this.updaFrameModifier(); -}; - -AnimationItem.prototype.setVolume = function (val, name) { - if (name && this.name !== name) { - return; - } - this.audioController.setVolume(val); -}; - -AnimationItem.prototype.getVolume = function () { - return this.audioController.getVolume(); -}; - -AnimationItem.prototype.mute = function (name) { - if (name && this.name !== name) { - return; - } - this.audioController.mute(); -}; - -AnimationItem.prototype.unmute = function (name) { - if (name && this.name !== name) { - return; - } - this.audioController.unmute(); -}; - -AnimationItem.prototype.updaFrameModifier = function () { - this.frameModifier = this.frameMult * this.playSpeed * this.playDirection; - this.audioController.setRate(this.playSpeed * this.playDirection); -}; - -AnimationItem.prototype.getPath = function () { - return this.path; -}; - -AnimationItem.prototype.getAssetsPath = function (assetData) { - var path = ''; - if (assetData.e) { - path = assetData.p; - } else if (this.assetsPath) { - var imagePath = assetData.p; - if (imagePath.indexOf('images/') !== -1) { - imagePath = imagePath.split('/')[1]; - } - path = this.assetsPath + imagePath; - } else { - path = this.path; - path += assetData.u ? assetData.u : ''; - path += assetData.p; - } - return path; -}; - -AnimationItem.prototype.getAssetData = function (id) { - var i = 0; - var len = this.assets.length; - while (i < len) { - if (id === this.assets[i].id) { - return this.assets[i]; - } - i += 1; - } - return null; -}; - -AnimationItem.prototype.hide = function () { - this.renderer.hide(); -}; - -AnimationItem.prototype.show = function () { - this.renderer.show(); -}; - -AnimationItem.prototype.getDuration = function (isFrame) { - return isFrame ? this.totalFrames : this.totalFrames / this.frameRate; -}; - -AnimationItem.prototype.updateDocumentData = function (path, documentData, index) { - try { - var element = this.renderer.getElementByPath(path); - element.updateDocumentData(documentData, index); - } catch (error) { - // TODO: decide how to handle catch case - } -}; - -AnimationItem.prototype.trigger = function (name) { - if (this._cbs && this._cbs[name]) { - switch (name) { - case 'enterFrame': - this.triggerEvent(name, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameModifier)); - break; - case 'drawnFrame': - this.drawnFrameEvent.currentTime = this.currentFrame; - this.drawnFrameEvent.totalTime = this.totalFrames; - this.drawnFrameEvent.direction = this.frameModifier; - this.triggerEvent(name, this.drawnFrameEvent); - break; - case 'loopComplete': - this.triggerEvent(name, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult)); - break; - case 'complete': - this.triggerEvent(name, new BMCompleteEvent(name, this.frameMult)); - break; - case 'segmentStart': - this.triggerEvent(name, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames)); - break; - case 'destroy': - this.triggerEvent(name, new BMDestroyEvent(name, this)); - break; - default: - this.triggerEvent(name); - } - } - if (name === 'enterFrame' && this.onEnterFrame) { - this.onEnterFrame.call(this, new BMEnterFrameEvent(name, this.currentFrame, this.totalFrames, this.frameMult)); - } - if (name === 'loopComplete' && this.onLoopComplete) { - this.onLoopComplete.call(this, new BMCompleteLoopEvent(name, this.loop, this.playCount, this.frameMult)); - } - if (name === 'complete' && this.onComplete) { - this.onComplete.call(this, new BMCompleteEvent(name, this.frameMult)); - } - if (name === 'segmentStart' && this.onSegmentStart) { - this.onSegmentStart.call(this, new BMSegmentStartEvent(name, this.firstFrame, this.totalFrames)); - } - if (name === 'destroy' && this.onDestroy) { - this.onDestroy.call(this, new BMDestroyEvent(name, this)); - } -}; - -AnimationItem.prototype.triggerRenderFrameError = function (nativeError) { - var error = new BMRenderFrameErrorEvent(nativeError, this.currentFrame); - this.triggerEvent('error', error); - - if (this.onError) { - this.onError.call(this, error); - } -}; - -AnimationItem.prototype.triggerConfigError = function (nativeError) { - var error = new BMConfigErrorEvent(nativeError, this.currentFrame); - this.triggerEvent('error', error); - - if (this.onError) { - this.onError.call(this, error); - } -}; - -const animationManager = (function () { - var moduleOb = {}; - var registeredAnimations = []; - var initTime = 0; - var len = 0; - var playingAnimationsNum = 0; - var _stopped = true; - var _isFrozen = false; - - function removeElement(ev) { - var i = 0; - var animItem = ev.target; - while (i < len) { - if (registeredAnimations[i].animation === animItem) { - registeredAnimations.splice(i, 1); - i -= 1; - len -= 1; - if (!animItem.isPaused) { - subtractPlayingCount(); - } - } - i += 1; - } - } - - function registerAnimation(element, animationData) { - if (!element) { - return null; - } - var i = 0; - while (i < len) { - if (registeredAnimations[i].elem === element && registeredAnimations[i].elem !== null) { - return registeredAnimations[i].animation; - } - i += 1; - } - var animItem = new AnimationItem(); - setupAnimation(animItem, element); - animItem.setData(element, animationData); - return animItem; - } - - function getRegisteredAnimations() { - var i; - var lenAnims = registeredAnimations.length; - var animations = []; - for (i = 0; i < lenAnims; i += 1) { - animations.push(registeredAnimations[i].animation); - } - return animations; - } - - function addPlayingCount() { - playingAnimationsNum += 1; - activate(); - } - - function subtractPlayingCount() { - playingAnimationsNum -= 1; - } - - function setupAnimation(animItem, element) { - animItem.addEventListener('destroy', removeElement); - animItem.addEventListener('_active', addPlayingCount); - animItem.addEventListener('_idle', subtractPlayingCount); - registeredAnimations.push({ elem: element, animation: animItem }); - len += 1; - } - - function loadAnimation(params) { - var animItem = new AnimationItem(); - setupAnimation(animItem, null); - animItem.setParams(params); - return animItem; - } - - function setSpeed(val, animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.setSpeed(val, animation); - } - } - - function setDirection(val, animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.setDirection(val, animation); - } - } - - function play(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.play(animation); - } - } - function resume(nowTime) { - var elapsedTime = nowTime - initTime; - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.advanceTime(elapsedTime); - } - initTime = nowTime; - if (playingAnimationsNum && !_isFrozen) { - window.requestAnimationFrame(resume); - } else { - _stopped = true; - } - } - - function first(nowTime) { - initTime = nowTime; - window.requestAnimationFrame(resume); - } - - function pause(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.pause(animation); - } - } - - function goToAndStop(value, isFrame, animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.goToAndStop(value, isFrame, animation); - } - } - - function stop(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.stop(animation); - } - } - - function togglePause(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.togglePause(animation); - } - } - - function destroy(animation) { - var i; - for (i = (len - 1); i >= 0; i -= 1) { - registeredAnimations[i].animation.destroy(animation); - } - } - - function searchAnimations(animationData, standalone, renderer) { - var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')), - [].slice.call(document.getElementsByClassName('bodymovin'))); - var i; - var lenAnims = animElements.length; - for (i = 0; i < lenAnims; i += 1) { - if (renderer) { - animElements[i].setAttribute('data-bm-type', renderer); - } - registerAnimation(animElements[i], animationData); - } - if (standalone && lenAnims === 0) { - if (!renderer) { - renderer = 'svg'; - } - var body = document.getElementsByTagName('body')[0]; - body.innerText = ''; - var div = createTag('div'); - div.style.width = '100%'; - div.style.height = '100%'; - div.setAttribute('data-bm-type', renderer); - body.appendChild(div); - registerAnimation(div, animationData); - } - } - - function resize() { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.resize(); - } - } - - function activate() { - if (!_isFrozen && playingAnimationsNum) { - if (_stopped) { - window.requestAnimationFrame(first); - _stopped = false; - } - } - } - - function freeze() { - _isFrozen = true; - } - - function unfreeze() { - _isFrozen = false; - activate(); - } - - function setVolume(val, animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.setVolume(val, animation); - } - } - - function mute(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.mute(animation); - } - } - - function unmute(animation) { - var i; - for (i = 0; i < len; i += 1) { - registeredAnimations[i].animation.unmute(animation); - } - } - - moduleOb.registerAnimation = registerAnimation; - moduleOb.loadAnimation = loadAnimation; - moduleOb.setSpeed = setSpeed; - moduleOb.setDirection = setDirection; - moduleOb.play = play; - moduleOb.pause = pause; - moduleOb.stop = stop; - moduleOb.togglePause = togglePause; - moduleOb.searchAnimations = searchAnimations; - moduleOb.resize = resize; - // moduleOb.start = start; - moduleOb.goToAndStop = goToAndStop; - moduleOb.destroy = destroy; - moduleOb.freeze = freeze; - moduleOb.unfreeze = unfreeze; - moduleOb.setVolume = setVolume; - moduleOb.mute = mute; - moduleOb.unmute = unmute; - moduleOb.getRegisteredAnimations = getRegisteredAnimations; - return moduleOb; -}()); - -/* eslint-disable */ -const BezierFactory = (function () { - /** - * BezierEasing - use bezier curve for transition easing function - * by Gaëtan Renaudeau 2014 - 2015 – MIT License - * - * Credits: is based on Firefox's nsSMILKeySpline.cpp - * Usage: - * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ]) - * spline.get(x) => returns the easing value | x must be in [0, 1] range - * - */ - - var ob = {}; - ob.getBezierEasing = getBezierEasing; - var beziers = {}; - - function getBezierEasing(a, b, c, d, nm) { - var str = nm || ('bez_' + a + '_' + b + '_' + c + '_' + d).replace(/\./g, 'p'); - if (beziers[str]) { - return beziers[str]; - } - var bezEasing = new BezierEasing([a, b, c, d]); - beziers[str] = bezEasing; - return bezEasing; - } - - // These values are established by empiricism with tests (tradeoff: performance VS precision) - var NEWTON_ITERATIONS = 4; - var NEWTON_MIN_SLOPE = 0.001; - var SUBDIVISION_PRECISION = 0.0000001; - var SUBDIVISION_MAX_ITERATIONS = 10; - - var kSplineTableSize = 11; - var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); - - var float32ArraySupported = typeof Float32Array === 'function'; - - function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } - function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } - function C(aA1) { return 3.0 * aA1; } - - // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. - function calcBezier(aT, aA1, aA2) { - return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; - } - - // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2. - function getSlope(aT, aA1, aA2) { - return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); - } - - function binarySubdivide(aX, aA, aB, mX1, mX2) { - var currentX, - currentT, - i = 0; - do { - currentT = aA + (aB - aA) / 2.0; - currentX = calcBezier(currentT, mX1, mX2) - aX; - if (currentX > 0.0) { - aB = currentT; - } else { - aA = currentT; - } - } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); - return currentT; - } - - function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) { - for (var i = 0; i < NEWTON_ITERATIONS; ++i) { - var currentSlope = getSlope(aGuessT, mX1, mX2); - if (currentSlope === 0.0) return aGuessT; - var currentX = calcBezier(aGuessT, mX1, mX2) - aX; - aGuessT -= currentX / currentSlope; - } - return aGuessT; - } - - /** - * points is an array of [ mX1, mY1, mX2, mY2 ] - */ - function BezierEasing(points) { - this._p = points; - this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); - this._precomputed = false; - - this.get = this.get.bind(this); - } - - BezierEasing.prototype = { - - get: function (x) { - var mX1 = this._p[0], - mY1 = this._p[1], - mX2 = this._p[2], - mY2 = this._p[3]; - if (!this._precomputed) this._precompute(); - if (mX1 === mY1 && mX2 === mY2) return x; // linear - // Because JavaScript number are imprecise, we should guarantee the extremes are right. - if (x === 0) return 0; - if (x === 1) return 1; - return calcBezier(this._getTForX(x), mY1, mY2); - }, - - // Private part - - _precompute: function () { - var mX1 = this._p[0], - mY1 = this._p[1], - mX2 = this._p[2], - mY2 = this._p[3]; - this._precomputed = true; - if (mX1 !== mY1 || mX2 !== mY2) { this._calcSampleValues(); } - }, - - _calcSampleValues: function () { - var mX1 = this._p[0], - mX2 = this._p[2]; - for (var i = 0; i < kSplineTableSize; ++i) { - this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); - } - }, - - /** - * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection. - */ - _getTForX: function (aX) { - var mX1 = this._p[0], - mX2 = this._p[2], - mSampleValues = this._mSampleValues; - - var intervalStart = 0.0; - var currentSample = 1; - var lastSample = kSplineTableSize - 1; - - for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { - intervalStart += kSampleStepSize; - } - --currentSample; - - // Interpolate to provide an initial guess for t - var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]); - var guessForT = intervalStart + dist * kSampleStepSize; - - var initialSlope = getSlope(guessForT, mX1, mX2); - if (initialSlope >= NEWTON_MIN_SLOPE) { - return newtonRaphsonIterate(aX, guessForT, mX1, mX2); - } if (initialSlope === 0.0) { - return guessForT; - } - return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); - }, - }; - - return ob; -}()); - -const pooling = (function () { - function double(arr) { - return arr.concat(createSizedArray(arr.length)); - } - - return { - double: double, - }; -}()); - -const poolFactory = (function () { - return function (initialLength, _create, _release) { - var _length = 0; - var _maxLength = initialLength; - var pool = createSizedArray(_maxLength); - - var ob = { - newElement: newElement, - release: release, - }; - - function newElement() { - var element; - if (_length) { - _length -= 1; - element = pool[_length]; - } else { - element = _create(); - } - return element; - } - - function release(element) { - if (_length === _maxLength) { - pool = pooling.double(pool); - _maxLength *= 2; - } - if (_release) { - _release(element); - } - pool[_length] = element; - _length += 1; - } - - return ob; - }; -}()); - -const bezierLengthPool = (function () { - function create() { - return { - addedLength: 0, - percents: createTypedArray('float32', getDefaultCurveSegments()), - lengths: createTypedArray('float32', getDefaultCurveSegments()), - }; - } - return poolFactory(8, create); -}()); - -const segmentsLengthPool = (function () { - function create() { - return { - lengths: [], - totalLength: 0, - }; - } - - function release(element) { - var i; - var len = element.lengths.length; - for (i = 0; i < len; i += 1) { - bezierLengthPool.release(element.lengths[i]); - } - element.lengths.length = 0; - } - - return poolFactory(8, create, release); -}()); - -function bezFunction() { - var math = Math; - - function pointOnLine2D(x1, y1, x2, y2, x3, y3) { - var det1 = (x1 * y2) + (y1 * x3) + (x2 * y3) - (x3 * y2) - (y3 * x1) - (x2 * y1); - return det1 > -0.001 && det1 < 0.001; - } - - function pointOnLine3D(x1, y1, z1, x2, y2, z2, x3, y3, z3) { - if (z1 === 0 && z2 === 0 && z3 === 0) { - return pointOnLine2D(x1, y1, x2, y2, x3, y3); - } - var dist1 = math.sqrt(math.pow(x2 - x1, 2) + math.pow(y2 - y1, 2) + math.pow(z2 - z1, 2)); - var dist2 = math.sqrt(math.pow(x3 - x1, 2) + math.pow(y3 - y1, 2) + math.pow(z3 - z1, 2)); - var dist3 = math.sqrt(math.pow(x3 - x2, 2) + math.pow(y3 - y2, 2) + math.pow(z3 - z2, 2)); - var diffDist; - if (dist1 > dist2) { - if (dist1 > dist3) { - diffDist = dist1 - dist2 - dist3; - } else { - diffDist = dist3 - dist2 - dist1; - } - } else if (dist3 > dist2) { - diffDist = dist3 - dist2 - dist1; - } else { - diffDist = dist2 - dist1 - dist3; - } - return diffDist > -0.0001 && diffDist < 0.0001; - } - - var getBezierLength = (function () { - return function (pt1, pt2, pt3, pt4) { - var curveSegments = getDefaultCurveSegments(); - var k; - var i; - var len; - var ptCoord; - var perc; - var addedLength = 0; - var ptDistance; - var point = []; - var lastPoint = []; - var lengthData = bezierLengthPool.newElement(); - len = pt3.length; - for (k = 0; k < curveSegments; k += 1) { - perc = k / (curveSegments - 1); - ptDistance = 0; - for (i = 0; i < len; i += 1) { - ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * pt3[i] + 3 * (1 - perc) * bmPow(perc, 2) * pt4[i] + bmPow(perc, 3) * pt2[i]; - point[i] = ptCoord; - if (lastPoint[i] !== null) { - ptDistance += bmPow(point[i] - lastPoint[i], 2); - } - lastPoint[i] = point[i]; - } - if (ptDistance) { - ptDistance = bmSqrt(ptDistance); - addedLength += ptDistance; - } - lengthData.percents[k] = perc; - lengthData.lengths[k] = addedLength; - } - lengthData.addedLength = addedLength; - return lengthData; - }; - }()); - - function getSegmentsLength(shapeData) { - var segmentsLength = segmentsLengthPool.newElement(); - var closed = shapeData.c; - var pathV = shapeData.v; - var pathO = shapeData.o; - var pathI = shapeData.i; - var i; - var len = shapeData._length; - var lengths = segmentsLength.lengths; - var totalLength = 0; - for (i = 0; i < len - 1; i += 1) { - lengths[i] = getBezierLength(pathV[i], pathV[i + 1], pathO[i], pathI[i + 1]); - totalLength += lengths[i].addedLength; - } - if (closed && len) { - lengths[i] = getBezierLength(pathV[i], pathV[0], pathO[i], pathI[0]); - totalLength += lengths[i].addedLength; - } - segmentsLength.totalLength = totalLength; - return segmentsLength; - } - - function BezierData(length) { - this.segmentLength = 0; - this.points = new Array(length); - } - - function PointData(partial, point) { - this.partialLength = partial; - this.point = point; - } - - var buildBezierData = (function () { - var storedData = {}; - - return function (pt1, pt2, pt3, pt4) { - var bezierName = (pt1[0] + '_' + pt1[1] + '_' + pt2[0] + '_' + pt2[1] + '_' + pt3[0] + '_' + pt3[1] + '_' + pt4[0] + '_' + pt4[1]).replace(/\./g, 'p'); - if (!storedData[bezierName]) { - var curveSegments = getDefaultCurveSegments(); - var k; - var i; - var len; - var ptCoord; - var perc; - var addedLength = 0; - var ptDistance; - var point; - var lastPoint = null; - if (pt1.length === 2 && (pt1[0] !== pt2[0] || pt1[1] !== pt2[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt1[0] + pt3[0], pt1[1] + pt3[1]) && pointOnLine2D(pt1[0], pt1[1], pt2[0], pt2[1], pt2[0] + pt4[0], pt2[1] + pt4[1])) { - curveSegments = 2; - } - var bezierData = new BezierData(curveSegments); - len = pt3.length; - for (k = 0; k < curveSegments; k += 1) { - point = createSizedArray(len); - perc = k / (curveSegments - 1); - ptDistance = 0; - for (i = 0; i < len; i += 1) { - ptCoord = bmPow(1 - perc, 3) * pt1[i] + 3 * bmPow(1 - perc, 2) * perc * (pt1[i] + pt3[i]) + 3 * (1 - perc) * bmPow(perc, 2) * (pt2[i] + pt4[i]) + bmPow(perc, 3) * pt2[i]; - point[i] = ptCoord; - if (lastPoint !== null) { - ptDistance += bmPow(point[i] - lastPoint[i], 2); - } - } - ptDistance = bmSqrt(ptDistance); - addedLength += ptDistance; - bezierData.points[k] = new PointData(ptDistance, point); - lastPoint = point; - } - bezierData.segmentLength = addedLength; - storedData[bezierName] = bezierData; - } - return storedData[bezierName]; - }; - }()); - - function getDistancePerc(perc, bezierData) { - var percents = bezierData.percents; - var lengths = bezierData.lengths; - var len = percents.length; - var initPos = bmFloor((len - 1) * perc); - var lengthPos = perc * bezierData.addedLength; - var lPerc = 0; - if (initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]) { - return percents[initPos]; - } - var dir = lengths[initPos] > lengthPos ? -1 : 1; - var flag = true; - while (flag) { - if (lengths[initPos] <= lengthPos && lengths[initPos + 1] > lengthPos) { - lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos + 1] - lengths[initPos]); - flag = false; - } else { - initPos += dir; - } - if (initPos < 0 || initPos >= len - 1) { - // FIX for TypedArrays that don't store floating point values with enough accuracy - if (initPos === len - 1) { - return percents[initPos]; - } - flag = false; - } - } - return percents[initPos] + (percents[initPos + 1] - percents[initPos]) * lPerc; - } - - function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) { - var t1 = getDistancePerc(percent, bezierData); - var u1 = 1 - t1; - var ptX = math.round((u1 * u1 * u1 * pt1[0] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[0] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[0] + t1 * t1 * t1 * pt2[0]) * 1000) / 1000; - var ptY = math.round((u1 * u1 * u1 * pt1[1] + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * pt3[1] + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * pt4[1] + t1 * t1 * t1 * pt2[1]) * 1000) / 1000; - return [ptX, ptY]; - } - - var bezierSegmentPoints = createTypedArray('float32', 8); - - function getNewSegment(pt1, pt2, pt3, pt4, startPerc, endPerc, bezierData) { - if (startPerc < 0) { - startPerc = 0; - } else if (startPerc > 1) { - startPerc = 1; - } - var t0 = getDistancePerc(startPerc, bezierData); - endPerc = endPerc > 1 ? 1 : endPerc; - var t1 = getDistancePerc(endPerc, bezierData); - var i; - var len = pt1.length; - var u0 = 1 - t0; - var u1 = 1 - t1; - var u0u0u0 = u0 * u0 * u0; - var t0u0u0_3 = t0 * u0 * u0 * 3; // eslint-disable-line camelcase - var t0t0u0_3 = t0 * t0 * u0 * 3; // eslint-disable-line camelcase - var t0t0t0 = t0 * t0 * t0; - // - var u0u0u1 = u0 * u0 * u1; - var t0u0u1_3 = t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1; // eslint-disable-line camelcase - var t0t0u1_3 = t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1; // eslint-disable-line camelcase - var t0t0t1 = t0 * t0 * t1; - // - var u0u1u1 = u0 * u1 * u1; - var t0u1u1_3 = t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1; // eslint-disable-line camelcase - var t0t1u1_3 = t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1; // eslint-disable-line camelcase - var t0t1t1 = t0 * t1 * t1; - // - var u1u1u1 = u1 * u1 * u1; - var t1u1u1_3 = t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1; // eslint-disable-line camelcase - var t1t1u1_3 = t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1; // eslint-disable-line camelcase - var t1t1t1 = t1 * t1 * t1; - for (i = 0; i < len; i += 1) { - bezierSegmentPoints[i * 4] = math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase - bezierSegmentPoints[i * 4 + 1] = math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase - bezierSegmentPoints[i * 4 + 2] = math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase - bezierSegmentPoints[i * 4 + 3] = math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000; // eslint-disable-line camelcase - } - - return bezierSegmentPoints; - } - - return { - getSegmentsLength: getSegmentsLength, - getNewSegment: getNewSegment, - getPointInSegment: getPointInSegment, - buildBezierData: buildBezierData, - pointOnLine2D: pointOnLine2D, - pointOnLine3D: pointOnLine3D, - }; -} - -const bez = bezFunction(); - -const PropertyFactory = (function () { - var initFrame = initialDefaultFrame; - var mathAbs = Math.abs; - - function interpolateValue(frameNum, caching) { - var offsetTime = this.offsetTime; - var newValue; - if (this.propType === 'multidimensional') { - newValue = createTypedArray('float32', this.pv.length); - } - var iterationIndex = caching.lastIndex; - var i = iterationIndex; - var len = this.keyframes.length - 1; - var flag = true; - var keyData; - var nextKeyData; - var keyframeMetadata; - - while (flag) { - keyData = this.keyframes[i]; - nextKeyData = this.keyframes[i + 1]; - if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime) { - if (keyData.h) { - keyData = nextKeyData; - } - iterationIndex = 0; - break; - } - if ((nextKeyData.t - offsetTime) > frameNum) { - iterationIndex = i; - break; - } - if (i < len - 1) { - i += 1; - } else { - iterationIndex = 0; - flag = false; - } - } - keyframeMetadata = this.keyframesMetadata[i] || {}; - - var k; - var kLen; - var perc; - var jLen; - var j; - var fnc; - var nextKeyTime = nextKeyData.t - offsetTime; - var keyTime = keyData.t - offsetTime; - var endValue; - if (keyData.to) { - if (!keyframeMetadata.bezierData) { - keyframeMetadata.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti); - } - var bezierData = keyframeMetadata.bezierData; - if (frameNum >= nextKeyTime || frameNum < keyTime) { - var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0; - kLen = bezierData.points[ind].point.length; - for (k = 0; k < kLen; k += 1) { - newValue[k] = bezierData.points[ind].point[k]; - } - // caching._lastKeyframeIndex = -1; - } else { - if (keyframeMetadata.__fnct) { - fnc = keyframeMetadata.__fnct; - } else { - fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get; - keyframeMetadata.__fnct = fnc; - } - perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime)); - var distanceInLine = bezierData.segmentLength * perc; - - var segmentPerc; - var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0; - j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0; - flag = true; - jLen = bezierData.points.length; - while (flag) { - addedLength += bezierData.points[j].partialLength; - if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) { - kLen = bezierData.points[j].point.length; - for (k = 0; k < kLen; k += 1) { - newValue[k] = bezierData.points[j].point[k]; - } - break; - } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) { - segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength; - kLen = bezierData.points[j].point.length; - for (k = 0; k < kLen; k += 1) { - newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc; - } - break; - } - if (j < jLen - 1) { - j += 1; - } else { - flag = false; - } - } - caching._lastPoint = j; - caching._lastAddedLength = addedLength - bezierData.points[j].partialLength; - caching._lastKeyframeIndex = i; - } - } else { - var outX; - var outY; - var inX; - var inY; - var keyValue; - len = keyData.s.length; - endValue = nextKeyData.s || keyData.e; - if (this.sh && keyData.h !== 1) { - if (frameNum >= nextKeyTime) { - newValue[0] = endValue[0]; - newValue[1] = endValue[1]; - newValue[2] = endValue[2]; - } else if (frameNum <= keyTime) { - newValue[0] = keyData.s[0]; - newValue[1] = keyData.s[1]; - newValue[2] = keyData.s[2]; - } else { - var quatStart = createQuaternion(keyData.s); - var quatEnd = createQuaternion(endValue); - var time = (frameNum - keyTime) / (nextKeyTime - keyTime); - quaternionToEuler(newValue, slerp(quatStart, quatEnd, time)); - } - } else { - for (i = 0; i < len; i += 1) { - if (keyData.h !== 1) { - if (frameNum >= nextKeyTime) { - perc = 1; - } else if (frameNum < keyTime) { - perc = 0; - } else { - if (keyData.o.x.constructor === Array) { - if (!keyframeMetadata.__fnct) { - keyframeMetadata.__fnct = []; - } - if (!keyframeMetadata.__fnct[i]) { - outX = keyData.o.x[i] === undefined ? keyData.o.x[0] : keyData.o.x[i]; - outY = keyData.o.y[i] === undefined ? keyData.o.y[0] : keyData.o.y[i]; - inX = keyData.i.x[i] === undefined ? keyData.i.x[0] : keyData.i.x[i]; - inY = keyData.i.y[i] === undefined ? keyData.i.y[0] : keyData.i.y[i]; - fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get; - keyframeMetadata.__fnct[i] = fnc; - } else { - fnc = keyframeMetadata.__fnct[i]; - } - } else if (!keyframeMetadata.__fnct) { - outX = keyData.o.x; - outY = keyData.o.y; - inX = keyData.i.x; - inY = keyData.i.y; - fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get; - keyData.keyframeMetadata = fnc; - } else { - fnc = keyframeMetadata.__fnct; - } - perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime)); - } - } - - endValue = nextKeyData.s || keyData.e; - keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc; - - if (this.propType === 'multidimensional') { - newValue[i] = keyValue; - } else { - newValue = keyValue; - } - } - } - } - caching.lastIndex = iterationIndex; - return newValue; - } - - // based on @Toji's https://github.com/toji/gl-matrix/ - function slerp(a, b, t) { - var out = []; - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - var bx = b[0]; - var by = b[1]; - var bz = b[2]; - var bw = b[3]; - - var omega; - var cosom; - var sinom; - var scale0; - var scale1; - - cosom = ax * bx + ay * by + az * bz + aw * bw; - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } - if ((1.0 - cosom) > 0.000001) { - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - scale0 = 1.0 - t; - scale1 = t; - } - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - - return out; - } - - function quaternionToEuler(out, quat) { - var qx = quat[0]; - var qy = quat[1]; - var qz = quat[2]; - var qw = quat[3]; - var heading = Math.atan2(2 * qy * qw - 2 * qx * qz, 1 - 2 * qy * qy - 2 * qz * qz); - var attitude = Math.asin(2 * qx * qy + 2 * qz * qw); - var bank = Math.atan2(2 * qx * qw - 2 * qy * qz, 1 - 2 * qx * qx - 2 * qz * qz); - out[0] = heading / degToRads; - out[1] = attitude / degToRads; - out[2] = bank / degToRads; - } - - function createQuaternion(values) { - var heading = values[0] * degToRads; - var attitude = values[1] * degToRads; - var bank = values[2] * degToRads; - var c1 = Math.cos(heading / 2); - var c2 = Math.cos(attitude / 2); - var c3 = Math.cos(bank / 2); - var s1 = Math.sin(heading / 2); - var s2 = Math.sin(attitude / 2); - var s3 = Math.sin(bank / 2); - var w = c1 * c2 * c3 - s1 * s2 * s3; - var x = s1 * s2 * c3 + c1 * c2 * s3; - var y = s1 * c2 * c3 + c1 * s2 * s3; - var z = c1 * s2 * c3 - s1 * c2 * s3; - - return [x, y, z, w]; - } - - function getValueAtCurrentTime() { - var frameNum = this.comp.renderedFrame - this.offsetTime; - var initTime = this.keyframes[0].t - this.offsetTime; - var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime; - if (!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))) { - if (this._caching.lastFrame >= frameNum) { - this._caching._lastKeyframeIndex = -1; - this._caching.lastIndex = 0; - } - - var renderResult = this.interpolateValue(frameNum, this._caching); - this.pv = renderResult; - } - this._caching.lastFrame = frameNum; - return this.pv; - } - - function setVValue(val) { - var multipliedValue; - if (this.propType === 'unidimensional') { - multipliedValue = val * this.mult; - if (mathAbs(this.v - multipliedValue) > 0.00001) { - this.v = multipliedValue; - this._mdf = true; - } - } else { - var i = 0; - var len = this.v.length; - while (i < len) { - multipliedValue = val[i] * this.mult; - if (mathAbs(this.v[i] - multipliedValue) > 0.00001) { - this.v[i] = multipliedValue; - this._mdf = true; - } - i += 1; - } - } - } - - function processEffectsSequence() { - if (this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) { - return; - } - if (this.lock) { - this.setVValue(this.pv); - return; - } - this.lock = true; - this._mdf = this._isFirstFrame; - var i; - var len = this.effectsSequence.length; - var finalValue = this.kf ? this.pv : this.data.k; - for (i = 0; i < len; i += 1) { - finalValue = this.effectsSequence[i](finalValue); - } - this.setVValue(finalValue); - this._isFirstFrame = false; - this.lock = false; - this.frameId = this.elem.globalData.frameId; - } - - function addEffect(effectFunction) { - this.effectsSequence.push(effectFunction); - this.container.addDynamicProperty(this); - } - - function ValueProperty(elem, data, mult, container) { - this.propType = 'unidimensional'; - this.mult = mult || 1; - this.data = data; - this.v = mult ? data.k * mult : data.k; - this.pv = data.k; - this._mdf = false; - this.elem = elem; - this.container = container; - this.comp = elem.comp; - this.k = false; - this.kf = false; - this.vel = 0; - this.effectsSequence = []; - this._isFirstFrame = true; - this.getValue = processEffectsSequence; - this.setVValue = setVValue; - this.addEffect = addEffect; - } - - function MultiDimensionalProperty(elem, data, mult, container) { - this.propType = 'multidimensional'; - this.mult = mult || 1; - this.data = data; - this._mdf = false; - this.elem = elem; - this.container = container; - this.comp = elem.comp; - this.k = false; - this.kf = false; - this.frameId = -1; - var i; - var len = data.k.length; - this.v = createTypedArray('float32', len); - this.pv = createTypedArray('float32', len); - this.vel = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - this.v[i] = data.k[i] * this.mult; - this.pv[i] = data.k[i]; - } - this._isFirstFrame = true; - this.effectsSequence = []; - this.getValue = processEffectsSequence; - this.setVValue = setVValue; - this.addEffect = addEffect; - } - - function KeyframedValueProperty(elem, data, mult, container) { - this.propType = 'unidimensional'; - this.keyframes = data.k; - this.keyframesMetadata = []; - this.offsetTime = elem.data.st; - this.frameId = -1; - this._caching = { - lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1, - }; - this.k = true; - this.kf = true; - this.data = data; - this.mult = mult || 1; - this.elem = elem; - this.container = container; - this.comp = elem.comp; - this.v = initFrame; - this.pv = initFrame; - this._isFirstFrame = true; - this.getValue = processEffectsSequence; - this.setVValue = setVValue; - this.interpolateValue = interpolateValue; - this.effectsSequence = [getValueAtCurrentTime.bind(this)]; - this.addEffect = addEffect; - } - - function KeyframedMultidimensionalProperty(elem, data, mult, container) { - this.propType = 'multidimensional'; - var i; - var len = data.k.length; - var s; - var e; - var to; - var ti; - for (i = 0; i < len - 1; i += 1) { - if (data.k[i].to && data.k[i].s && data.k[i + 1] && data.k[i + 1].s) { - s = data.k[i].s; - e = data.k[i + 1].s; - to = data.k[i].to; - ti = data.k[i].ti; - if ((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], s[0] + to[0], s[1] + to[1]) && bez.pointOnLine2D(s[0], s[1], e[0], e[1], e[0] + ti[0], e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], s[0] + to[0], s[1] + to[1], s[2] + to[2]) && bez.pointOnLine3D(s[0], s[1], s[2], e[0], e[1], e[2], e[0] + ti[0], e[1] + ti[1], e[2] + ti[2]))) { - data.k[i].to = null; - data.k[i].ti = null; - } - if (s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) { - if (s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) { - data.k[i].to = null; - data.k[i].ti = null; - } - } - } - } - this.effectsSequence = [getValueAtCurrentTime.bind(this)]; - this.data = data; - this.keyframes = data.k; - this.keyframesMetadata = []; - this.offsetTime = elem.data.st; - this.k = true; - this.kf = true; - this._isFirstFrame = true; - this.mult = mult || 1; - this.elem = elem; - this.container = container; - this.comp = elem.comp; - this.getValue = processEffectsSequence; - this.setVValue = setVValue; - this.interpolateValue = interpolateValue; - this.frameId = -1; - var arrLen = data.k[0].s.length; - this.v = createTypedArray('float32', arrLen); - this.pv = createTypedArray('float32', arrLen); - for (i = 0; i < arrLen; i += 1) { - this.v[i] = initFrame; - this.pv[i] = initFrame; - } - this._caching = { lastFrame: initFrame, lastIndex: 0, value: createTypedArray('float32', arrLen) }; - this.addEffect = addEffect; - } - - function getProp(elem, data, type, mult, container) { - var p; - if (!data.k.length) { - p = new ValueProperty(elem, data, mult, container); - } else if (typeof (data.k[0]) === 'number') { - p = new MultiDimensionalProperty(elem, data, mult, container); - } else { - switch (type) { - case 0: - p = new KeyframedValueProperty(elem, data, mult, container); - break; - case 1: - p = new KeyframedMultidimensionalProperty(elem, data, mult, container); - break; - default: - break; - } - } - if (p.effectsSequence.length) { - container.addDynamicProperty(p); - } - return p; - } - - var ob = { - getProp: getProp, - }; - return ob; -}()); - -function DynamicPropertyContainer() {} -DynamicPropertyContainer.prototype = { - addDynamicProperty: function (prop) { - if (this.dynamicProperties.indexOf(prop) === -1) { - this.dynamicProperties.push(prop); - this.container.addDynamicProperty(this); - this._isAnimated = true; - } - }, - iterateDynamicProperties: function () { - this._mdf = false; - var i; - var len = this.dynamicProperties.length; - for (i = 0; i < len; i += 1) { - this.dynamicProperties[i].getValue(); - if (this.dynamicProperties[i]._mdf) { - this._mdf = true; - } - } - }, - initDynamicPropertyContainer: function (container) { - this.container = container; - this.dynamicProperties = []; - this._mdf = false; - this._isAnimated = false; - }, -}; - -const pointPool = (function () { - function create() { - return createTypedArray('float32', 2); - } - return poolFactory(8, create); -}()); - -function ShapePath() { - this.c = false; - this._length = 0; - this._maxLength = 8; - this.v = createSizedArray(this._maxLength); - this.o = createSizedArray(this._maxLength); - this.i = createSizedArray(this._maxLength); -} - -ShapePath.prototype.setPathData = function (closed, len) { - this.c = closed; - this.setLength(len); - var i = 0; - while (i < len) { - this.v[i] = pointPool.newElement(); - this.o[i] = pointPool.newElement(); - this.i[i] = pointPool.newElement(); - i += 1; - } -}; - -ShapePath.prototype.setLength = function (len) { - while (this._maxLength < len) { - this.doubleArrayLength(); - } - this._length = len; -}; - -ShapePath.prototype.doubleArrayLength = function () { - this.v = this.v.concat(createSizedArray(this._maxLength)); - this.i = this.i.concat(createSizedArray(this._maxLength)); - this.o = this.o.concat(createSizedArray(this._maxLength)); - this._maxLength *= 2; -}; - -ShapePath.prototype.setXYAt = function (x, y, type, pos, replace) { - var arr; - this._length = Math.max(this._length, pos + 1); - if (this._length >= this._maxLength) { - this.doubleArrayLength(); - } - switch (type) { - case 'v': - arr = this.v; - break; - case 'i': - arr = this.i; - break; - case 'o': - arr = this.o; - break; - default: - arr = []; - break; - } - if (!arr[pos] || (arr[pos] && !replace)) { - arr[pos] = pointPool.newElement(); - } - arr[pos][0] = x; - arr[pos][1] = y; -}; - -ShapePath.prototype.setTripleAt = function (vX, vY, oX, oY, iX, iY, pos, replace) { - this.setXYAt(vX, vY, 'v', pos, replace); - this.setXYAt(oX, oY, 'o', pos, replace); - this.setXYAt(iX, iY, 'i', pos, replace); -}; - -ShapePath.prototype.reverse = function () { - var newPath = new ShapePath(); - newPath.setPathData(this.c, this._length); - var vertices = this.v; - var outPoints = this.o; - var inPoints = this.i; - var init = 0; - if (this.c) { - newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false); - init = 1; - } - var cnt = this._length - 1; - var len = this._length; - - var i; - for (i = init; i < len; i += 1) { - newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false); - cnt -= 1; - } - return newPath; -}; - -const shapePool = (function () { - function create() { - return new ShapePath(); - } - - function release(shapePath) { - var len = shapePath._length; - var i; - for (i = 0; i < len; i += 1) { - pointPool.release(shapePath.v[i]); - pointPool.release(shapePath.i[i]); - pointPool.release(shapePath.o[i]); - shapePath.v[i] = null; - shapePath.i[i] = null; - shapePath.o[i] = null; - } - shapePath._length = 0; - shapePath.c = false; - } - - function clone(shape) { - var cloned = factory.newElement(); - var i; - var len = shape._length === undefined ? shape.v.length : shape._length; - cloned.setLength(len); - cloned.c = shape.c; - - for (i = 0; i < len; i += 1) { - cloned.setTripleAt(shape.v[i][0], shape.v[i][1], shape.o[i][0], shape.o[i][1], shape.i[i][0], shape.i[i][1], i); - } - return cloned; - } - - var factory = poolFactory(4, create, release); - factory.clone = clone; - - return factory; -}()); - -function ShapeCollection() { - this._length = 0; - this._maxLength = 4; - this.shapes = createSizedArray(this._maxLength); -} - -ShapeCollection.prototype.addShape = function (shapeData) { - if (this._length === this._maxLength) { - this.shapes = this.shapes.concat(createSizedArray(this._maxLength)); - this._maxLength *= 2; - } - this.shapes[this._length] = shapeData; - this._length += 1; -}; - -ShapeCollection.prototype.releaseShapes = function () { - var i; - for (i = 0; i < this._length; i += 1) { - shapePool.release(this.shapes[i]); - } - this._length = 0; -}; - -const shapeCollectionPool = (function () { - var ob = { - newShapeCollection: newShapeCollection, - release: release, - }; - - var _length = 0; - var _maxLength = 4; - var pool = createSizedArray(_maxLength); - - function newShapeCollection() { - var shapeCollection; - if (_length) { - _length -= 1; - shapeCollection = pool[_length]; - } else { - shapeCollection = new ShapeCollection(); - } - return shapeCollection; - } - - function release(shapeCollection) { - var i; - var len = shapeCollection._length; - for (i = 0; i < len; i += 1) { - shapePool.release(shapeCollection.shapes[i]); - } - shapeCollection._length = 0; - - if (_length === _maxLength) { - pool = pooling.double(pool); - _maxLength *= 2; - } - pool[_length] = shapeCollection; - _length += 1; - } - - return ob; -}()); - -const ShapePropertyFactory = (function () { - var initFrame = -999999; - - function interpolateShape(frameNum, previousValue, caching) { - var iterationIndex = caching.lastIndex; - var keyPropS; - var keyPropE; - var isHold; - var j; - var k; - var jLen; - var kLen; - var perc; - var vertexValue; - var kf = this.keyframes; - if (frameNum < kf[0].t - this.offsetTime) { - keyPropS = kf[0].s[0]; - isHold = true; - iterationIndex = 0; - } else if (frameNum >= kf[kf.length - 1].t - this.offsetTime) { - keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0]; - /* if(kf[kf.length - 1].s){ - keyPropS = kf[kf.length - 1].s[0]; - }else{ - keyPropS = kf[kf.length - 2].e[0]; - } */ - isHold = true; - } else { - var i = iterationIndex; - var len = kf.length - 1; - var flag = true; - var keyData; - var nextKeyData; - var keyframeMetadata; - while (flag) { - keyData = kf[i]; - nextKeyData = kf[i + 1]; - if ((nextKeyData.t - this.offsetTime) > frameNum) { - break; - } - if (i < len - 1) { - i += 1; - } else { - flag = false; - } - } - keyframeMetadata = this.keyframesMetadata[i] || {}; - isHold = keyData.h === 1; - iterationIndex = i; - if (!isHold) { - if (frameNum >= nextKeyData.t - this.offsetTime) { - perc = 1; - } else if (frameNum < keyData.t - this.offsetTime) { - perc = 0; - } else { - var fnc; - if (keyframeMetadata.__fnct) { - fnc = keyframeMetadata.__fnct; - } else { - fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y).get; - keyframeMetadata.__fnct = fnc; - } - perc = fnc((frameNum - (keyData.t - this.offsetTime)) / ((nextKeyData.t - this.offsetTime) - (keyData.t - this.offsetTime))); - } - keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0]; - } - keyPropS = keyData.s[0]; - } - jLen = previousValue._length; - kLen = keyPropS.i[0].length; - caching.lastIndex = iterationIndex; - - for (j = 0; j < jLen; j += 1) { - for (k = 0; k < kLen; k += 1) { - vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k] + (keyPropE.i[j][k] - keyPropS.i[j][k]) * perc; - previousValue.i[j][k] = vertexValue; - vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k] + (keyPropE.o[j][k] - keyPropS.o[j][k]) * perc; - previousValue.o[j][k] = vertexValue; - vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k] + (keyPropE.v[j][k] - keyPropS.v[j][k]) * perc; - previousValue.v[j][k] = vertexValue; - } - } - } - - function interpolateShapeCurrentTime() { - var frameNum = this.comp.renderedFrame - this.offsetTime; - var initTime = this.keyframes[0].t - this.offsetTime; - var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime; - var lastFrame = this._caching.lastFrame; - if (!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))) { - /// / - this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0; - this.interpolateShape(frameNum, this.pv, this._caching); - /// / - } - this._caching.lastFrame = frameNum; - return this.pv; - } - - function resetShape() { - this.paths = this.localShapeCollection; - } - - function shapesEqual(shape1, shape2) { - if (shape1._length !== shape2._length || shape1.c !== shape2.c) { - return false; - } - var i; - var len = shape1._length; - for (i = 0; i < len; i += 1) { - if (shape1.v[i][0] !== shape2.v[i][0] - || shape1.v[i][1] !== shape2.v[i][1] - || shape1.o[i][0] !== shape2.o[i][0] - || shape1.o[i][1] !== shape2.o[i][1] - || shape1.i[i][0] !== shape2.i[i][0] - || shape1.i[i][1] !== shape2.i[i][1]) { - return false; - } - } - return true; - } - - function setVValue(newPath) { - if (!shapesEqual(this.v, newPath)) { - this.v = shapePool.clone(newPath); - this.localShapeCollection.releaseShapes(); - this.localShapeCollection.addShape(this.v); - this._mdf = true; - this.paths = this.localShapeCollection; - } - } - - function processEffectsSequence() { - if (this.elem.globalData.frameId === this.frameId) { - return; - } if (!this.effectsSequence.length) { - this._mdf = false; - return; - } - if (this.lock) { - this.setVValue(this.pv); - return; - } - this.lock = true; - this._mdf = false; - var finalValue; - if (this.kf) { - finalValue = this.pv; - } else if (this.data.ks) { - finalValue = this.data.ks.k; - } else { - finalValue = this.data.pt.k; - } - var i; - var len = this.effectsSequence.length; - for (i = 0; i < len; i += 1) { - finalValue = this.effectsSequence[i](finalValue); - } - this.setVValue(finalValue); - this.lock = false; - this.frameId = this.elem.globalData.frameId; - } - - function ShapeProperty(elem, data, type) { - this.propType = 'shape'; - this.comp = elem.comp; - this.container = elem; - this.elem = elem; - this.data = data; - this.k = false; - this.kf = false; - this._mdf = false; - var pathData = type === 3 ? data.pt.k : data.ks.k; - this.v = shapePool.clone(pathData); - this.pv = shapePool.clone(this.v); - this.localShapeCollection = shapeCollectionPool.newShapeCollection(); - this.paths = this.localShapeCollection; - this.paths.addShape(this.v); - this.reset = resetShape; - this.effectsSequence = []; - } - - function addEffect(effectFunction) { - this.effectsSequence.push(effectFunction); - this.container.addDynamicProperty(this); - } - - ShapeProperty.prototype.interpolateShape = interpolateShape; - ShapeProperty.prototype.getValue = processEffectsSequence; - ShapeProperty.prototype.setVValue = setVValue; - ShapeProperty.prototype.addEffect = addEffect; - - function KeyframedShapeProperty(elem, data, type) { - this.propType = 'shape'; - this.comp = elem.comp; - this.elem = elem; - this.container = elem; - this.offsetTime = elem.data.st; - this.keyframes = type === 3 ? data.pt.k : data.ks.k; - this.keyframesMetadata = []; - this.k = true; - this.kf = true; - var len = this.keyframes[0].s[0].i.length; - this.v = shapePool.newElement(); - this.v.setPathData(this.keyframes[0].s[0].c, len); - this.pv = shapePool.clone(this.v); - this.localShapeCollection = shapeCollectionPool.newShapeCollection(); - this.paths = this.localShapeCollection; - this.paths.addShape(this.v); - this.lastFrame = initFrame; - this.reset = resetShape; - this._caching = { lastFrame: initFrame, lastIndex: 0 }; - this.effectsSequence = [interpolateShapeCurrentTime.bind(this)]; - } - KeyframedShapeProperty.prototype.getValue = processEffectsSequence; - KeyframedShapeProperty.prototype.interpolateShape = interpolateShape; - KeyframedShapeProperty.prototype.setVValue = setVValue; - KeyframedShapeProperty.prototype.addEffect = addEffect; - - var EllShapeProperty = (function () { - var cPoint = roundCorner; - - function EllShapePropertyFactory(elem, data) { - this.v = shapePool.newElement(); - this.v.setPathData(true, 4); - this.localShapeCollection = shapeCollectionPool.newShapeCollection(); - this.paths = this.localShapeCollection; - this.localShapeCollection.addShape(this.v); - this.d = data.d; - this.elem = elem; - this.comp = elem.comp; - this.frameId = -1; - this.initDynamicPropertyContainer(elem); - this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); - this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this); - if (this.dynamicProperties.length) { - this.k = true; - } else { - this.k = false; - this.convertEllToPath(); - } - } - - EllShapePropertyFactory.prototype = { - reset: resetShape, - getValue: function () { - if (this.elem.globalData.frameId === this.frameId) { - return; - } - this.frameId = this.elem.globalData.frameId; - this.iterateDynamicProperties(); - - if (this._mdf) { - this.convertEllToPath(); - } - }, - convertEllToPath: function () { - var p0 = this.p.v[0]; - var p1 = this.p.v[1]; - var s0 = this.s.v[0] / 2; - var s1 = this.s.v[1] / 2; - var _cw = this.d !== 3; - var _v = this.v; - _v.v[0][0] = p0; - _v.v[0][1] = p1 - s1; - _v.v[1][0] = _cw ? p0 + s0 : p0 - s0; - _v.v[1][1] = p1; - _v.v[2][0] = p0; - _v.v[2][1] = p1 + s1; - _v.v[3][0] = _cw ? p0 - s0 : p0 + s0; - _v.v[3][1] = p1; - _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint; - _v.i[0][1] = p1 - s1; - _v.i[1][0] = _cw ? p0 + s0 : p0 - s0; - _v.i[1][1] = p1 - s1 * cPoint; - _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint; - _v.i[2][1] = p1 + s1; - _v.i[3][0] = _cw ? p0 - s0 : p0 + s0; - _v.i[3][1] = p1 + s1 * cPoint; - _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint; - _v.o[0][1] = p1 - s1; - _v.o[1][0] = _cw ? p0 + s0 : p0 - s0; - _v.o[1][1] = p1 + s1 * cPoint; - _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint; - _v.o[2][1] = p1 + s1; - _v.o[3][0] = _cw ? p0 - s0 : p0 + s0; - _v.o[3][1] = p1 - s1 * cPoint; - }, - }; - - extendPrototype([DynamicPropertyContainer], EllShapePropertyFactory); - - return EllShapePropertyFactory; - }()); - - var StarShapeProperty = (function () { - function StarShapePropertyFactory(elem, data) { - this.v = shapePool.newElement(); - this.v.setPathData(true, 0); - this.elem = elem; - this.comp = elem.comp; - this.data = data; - this.frameId = -1; - this.d = data.d; - this.initDynamicPropertyContainer(elem); - if (data.sy === 1) { - this.ir = PropertyFactory.getProp(elem, data.ir, 0, 0, this); - this.is = PropertyFactory.getProp(elem, data.is, 0, 0.01, this); - this.convertToPath = this.convertStarToPath; - } else { - this.convertToPath = this.convertPolygonToPath; - } - this.pt = PropertyFactory.getProp(elem, data.pt, 0, 0, this); - this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); - this.r = PropertyFactory.getProp(elem, data.r, 0, degToRads, this); - this.or = PropertyFactory.getProp(elem, data.or, 0, 0, this); - this.os = PropertyFactory.getProp(elem, data.os, 0, 0.01, this); - this.localShapeCollection = shapeCollectionPool.newShapeCollection(); - this.localShapeCollection.addShape(this.v); - this.paths = this.localShapeCollection; - if (this.dynamicProperties.length) { - this.k = true; - } else { - this.k = false; - this.convertToPath(); - } - } - - StarShapePropertyFactory.prototype = { - reset: resetShape, - getValue: function () { - if (this.elem.globalData.frameId === this.frameId) { - return; - } - this.frameId = this.elem.globalData.frameId; - this.iterateDynamicProperties(); - if (this._mdf) { - this.convertToPath(); - } - }, - convertStarToPath: function () { - var numPts = Math.floor(this.pt.v) * 2; - var angle = (Math.PI * 2) / numPts; - /* this.v.v.length = numPts; - this.v.i.length = numPts; - this.v.o.length = numPts; */ - var longFlag = true; - var longRad = this.or.v; - var shortRad = this.ir.v; - var longRound = this.os.v; - var shortRound = this.is.v; - var longPerimSegment = (2 * Math.PI * longRad) / (numPts * 2); - var shortPerimSegment = (2 * Math.PI * shortRad) / (numPts * 2); - var i; - var rad; - var roundness; - var perimSegment; - var currentAng = -Math.PI / 2; - currentAng += this.r.v; - var dir = this.data.d === 3 ? -1 : 1; - this.v._length = 0; - for (i = 0; i < numPts; i += 1) { - rad = longFlag ? longRad : shortRad; - roundness = longFlag ? longRound : shortRound; - perimSegment = longFlag ? longPerimSegment : shortPerimSegment; - var x = rad * Math.cos(currentAng); - var y = rad * Math.sin(currentAng); - var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y); - var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y); - x += +this.p.v[0]; - y += +this.p.v[1]; - this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true); - - /* this.v.v[i] = [x,y]; - this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir]; - this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir]; - this.v._length = numPts; */ - longFlag = !longFlag; - currentAng += angle * dir; - } - }, - convertPolygonToPath: function () { - var numPts = Math.floor(this.pt.v); - var angle = (Math.PI * 2) / numPts; - var rad = this.or.v; - var roundness = this.os.v; - var perimSegment = (2 * Math.PI * rad) / (numPts * 4); - var i; - var currentAng = -Math.PI * 0.5; - var dir = this.data.d === 3 ? -1 : 1; - currentAng += this.r.v; - this.v._length = 0; - for (i = 0; i < numPts; i += 1) { - var x = rad * Math.cos(currentAng); - var y = rad * Math.sin(currentAng); - var ox = x === 0 && y === 0 ? 0 : y / Math.sqrt(x * x + y * y); - var oy = x === 0 && y === 0 ? 0 : -x / Math.sqrt(x * x + y * y); - x += +this.p.v[0]; - y += +this.p.v[1]; - this.v.setTripleAt(x, y, x - ox * perimSegment * roundness * dir, y - oy * perimSegment * roundness * dir, x + ox * perimSegment * roundness * dir, y + oy * perimSegment * roundness * dir, i, true); - currentAng += angle * dir; - } - this.paths.length = 0; - this.paths[0] = this.v; - }, - - }; - extendPrototype([DynamicPropertyContainer], StarShapePropertyFactory); - - return StarShapePropertyFactory; - }()); - - var RectShapeProperty = (function () { - function RectShapePropertyFactory(elem, data) { - this.v = shapePool.newElement(); - this.v.c = true; - this.localShapeCollection = shapeCollectionPool.newShapeCollection(); - this.localShapeCollection.addShape(this.v); - this.paths = this.localShapeCollection; - this.elem = elem; - this.comp = elem.comp; - this.frameId = -1; - this.d = data.d; - this.initDynamicPropertyContainer(elem); - this.p = PropertyFactory.getProp(elem, data.p, 1, 0, this); - this.s = PropertyFactory.getProp(elem, data.s, 1, 0, this); - this.r = PropertyFactory.getProp(elem, data.r, 0, 0, this); - if (this.dynamicProperties.length) { - this.k = true; - } else { - this.k = false; - this.convertRectToPath(); - } - } - - RectShapePropertyFactory.prototype = { - convertRectToPath: function () { - var p0 = this.p.v[0]; - var p1 = this.p.v[1]; - var v0 = this.s.v[0] / 2; - var v1 = this.s.v[1] / 2; - var round = bmMin(v0, v1, this.r.v); - var cPoint = round * (1 - roundCorner); - this.v._length = 0; - - if (this.d === 2 || this.d === 1) { - this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, 0, true); - this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, p0 + v0, p1 + v1 - round, 1, true); - if (round !== 0) { - this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, 2, true); - this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0 + round, p1 + v1, 3, true); - this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, 4, true); - this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1 + round, 5, true); - this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, 6, true); - this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, p0 + v0 - round, p1 - v1, 7, true); - } else { - this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0 + cPoint, p1 + v1, p0 - v0, p1 + v1, 2); - this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0, p1 - v1 + cPoint, p0 - v0, p1 - v1, 3); - } - } else { - this.v.setTripleAt(p0 + v0, p1 - v1 + round, p0 + v0, p1 - v1 + cPoint, p0 + v0, p1 - v1 + round, 0, true); - if (round !== 0) { - this.v.setTripleAt(p0 + v0 - round, p1 - v1, p0 + v0 - round, p1 - v1, p0 + v0 - cPoint, p1 - v1, 1, true); - this.v.setTripleAt(p0 - v0 + round, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0 + round, p1 - v1, 2, true); - this.v.setTripleAt(p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + round, p0 - v0, p1 - v1 + cPoint, 3, true); - this.v.setTripleAt(p0 - v0, p1 + v1 - round, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1 - round, 4, true); - this.v.setTripleAt(p0 - v0 + round, p1 + v1, p0 - v0 + round, p1 + v1, p0 - v0 + cPoint, p1 + v1, 5, true); - this.v.setTripleAt(p0 + v0 - round, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0 - round, p1 + v1, 6, true); - this.v.setTripleAt(p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - round, p0 + v0, p1 + v1 - cPoint, 7, true); - } else { - this.v.setTripleAt(p0 - v0, p1 - v1, p0 - v0 + cPoint, p1 - v1, p0 - v0, p1 - v1, 1, true); - this.v.setTripleAt(p0 - v0, p1 + v1, p0 - v0, p1 + v1 - cPoint, p0 - v0, p1 + v1, 2, true); - this.v.setTripleAt(p0 + v0, p1 + v1, p0 + v0 - cPoint, p1 + v1, p0 + v0, p1 + v1, 3, true); - } - } - }, - getValue: function () { - if (this.elem.globalData.frameId === this.frameId) { - return; - } - this.frameId = this.elem.globalData.frameId; - this.iterateDynamicProperties(); - if (this._mdf) { - this.convertRectToPath(); - } - }, - reset: resetShape, - }; - extendPrototype([DynamicPropertyContainer], RectShapePropertyFactory); - - return RectShapePropertyFactory; - }()); - - function getShapeProp(elem, data, type) { - var prop; - if (type === 3 || type === 4) { - var dataProp = type === 3 ? data.pt : data.ks; - var keys = dataProp.k; - if (keys.length) { - prop = new KeyframedShapeProperty(elem, data, type); - } else { - prop = new ShapeProperty(elem, data, type); - } - } else if (type === 5) { - prop = new RectShapeProperty(elem, data); - } else if (type === 6) { - prop = new EllShapeProperty(elem, data); - } else if (type === 7) { - prop = new StarShapeProperty(elem, data); - } - if (prop.k) { - elem.addDynamicProperty(prop); - } - return prop; - } - - function getConstructorFunction() { - return ShapeProperty; - } - - function getKeyframedConstructorFunction() { - return KeyframedShapeProperty; - } - - var ob = {}; - ob.getShapeProp = getShapeProp; - ob.getConstructorFunction = getConstructorFunction; - ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction; - return ob; -}()); - -/*! - Transformation Matrix v2.0 - (c) Epistemex 2014-2015 - www.epistemex.com - By Ken Fyrstenberg - Contributions by leeoniya. - License: MIT, header required. - */ - -/** - * 2D transformation matrix object initialized with identity matrix. - * - * The matrix can synchronize a canvas context by supplying the context - * as an argument, or later apply current absolute transform to an - * existing context. - * - * All values are handled as floating point values. - * - * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix - * @prop {number} a - scale x - * @prop {number} b - shear y - * @prop {number} c - shear x - * @prop {number} d - scale y - * @prop {number} e - translate x - * @prop {number} f - translate y - * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context - * @constructor - */ - -const Matrix = (function () { - var _cos = Math.cos; - var _sin = Math.sin; - var _tan = Math.tan; - var _rnd = Math.round; - - function reset() { - this.props[0] = 1; - this.props[1] = 0; - this.props[2] = 0; - this.props[3] = 0; - this.props[4] = 0; - this.props[5] = 1; - this.props[6] = 0; - this.props[7] = 0; - this.props[8] = 0; - this.props[9] = 0; - this.props[10] = 1; - this.props[11] = 0; - this.props[12] = 0; - this.props[13] = 0; - this.props[14] = 0; - this.props[15] = 1; - return this; - } - - function rotate(angle) { - if (angle === 0) { - return this; - } - var mCos = _cos(angle); - var mSin = _sin(angle); - return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - } - - function rotateX(angle) { - if (angle === 0) { - return this; - } - var mCos = _cos(angle); - var mSin = _sin(angle); - return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1); - } - - function rotateY(angle) { - if (angle === 0) { - return this; - } - var mCos = _cos(angle); - var mSin = _sin(angle); - return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1); - } - - function rotateZ(angle) { - if (angle === 0) { - return this; - } - var mCos = _cos(angle); - var mSin = _sin(angle); - return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - } - - function shear(sx, sy) { - return this._t(1, sy, sx, 1, 0, 0); - } - - function skew(ax, ay) { - return this.shear(_tan(ax), _tan(ay)); - } - - function skewFromAxis(ax, angle) { - var mCos = _cos(angle); - var mSin = _sin(angle); - return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) - ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) - ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - // return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0); - } - - function scale(sx, sy, sz) { - if (!sz && sz !== 0) { - sz = 1; - } - if (sx === 1 && sy === 1 && sz === 1) { - return this; - } - return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1); - } - - function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) { - this.props[0] = a; - this.props[1] = b; - this.props[2] = c; - this.props[3] = d; - this.props[4] = e; - this.props[5] = f; - this.props[6] = g; - this.props[7] = h; - this.props[8] = i; - this.props[9] = j; - this.props[10] = k; - this.props[11] = l; - this.props[12] = m; - this.props[13] = n; - this.props[14] = o; - this.props[15] = p; - return this; - } - - function translate(tx, ty, tz) { - tz = tz || 0; - if (tx !== 0 || ty !== 0 || tz !== 0) { - return this._t(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1); - } - return this; - } - - function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) { - var _p = this.props; - - if (a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0) { - // NOTE: commenting this condition because TurboFan deoptimizes code when present - // if(m2 !== 0 || n2 !== 0 || o2 !== 0){ - _p[12] = _p[12] * a2 + _p[15] * m2; - _p[13] = _p[13] * f2 + _p[15] * n2; - _p[14] = _p[14] * k2 + _p[15] * o2; - _p[15] *= p2; - // } - this._identityCalculated = false; - return this; - } - - var a1 = _p[0]; - var b1 = _p[1]; - var c1 = _p[2]; - var d1 = _p[3]; - var e1 = _p[4]; - var f1 = _p[5]; - var g1 = _p[6]; - var h1 = _p[7]; - var i1 = _p[8]; - var j1 = _p[9]; - var k1 = _p[10]; - var l1 = _p[11]; - var m1 = _p[12]; - var n1 = _p[13]; - var o1 = _p[14]; - var p1 = _p[15]; - - /* matrix order (canvas compatible): - * ace - * bdf - * 001 - */ - _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2; - _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2; - _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2; - _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2; - - _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2; - _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2; - _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2; - _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2; - - _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2; - _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2; - _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2; - _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2; - - _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2; - _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2; - _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2; - _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2; - - this._identityCalculated = false; - return this; - } - - function isIdentity() { - if (!this._identityCalculated) { - this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1); - this._identityCalculated = true; - } - return this._identity; - } - - function equals(matr) { - var i = 0; - while (i < 16) { - if (matr.props[i] !== this.props[i]) { - return false; - } - i += 1; - } - return true; - } - - function clone(matr) { - var i; - for (i = 0; i < 16; i += 1) { - matr.props[i] = this.props[i]; - } - return matr; - } - - function cloneFromProps(props) { - var i; - for (i = 0; i < 16; i += 1) { - this.props[i] = props[i]; - } - } - - function applyToPoint(x, y, z) { - return { - x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], - y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], - z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14], - }; - /* return { - x: x * me.a + y * me.c + me.e, - y: x * me.b + y * me.d + me.f - }; */ - } - function applyToX(x, y, z) { - return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12]; - } - function applyToY(x, y, z) { - return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13]; - } - function applyToZ(x, y, z) { - return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]; - } - - function getInverseMatrix() { - var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4]; - var a = this.props[5] / determinant; - var b = -this.props[1] / determinant; - var c = -this.props[4] / determinant; - var d = this.props[0] / determinant; - var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12]) / determinant; - var f = -(this.props[0] * this.props[13] - this.props[1] * this.props[12]) / determinant; - var inverseMatrix = new Matrix(); - inverseMatrix.props[0] = a; - inverseMatrix.props[1] = b; - inverseMatrix.props[4] = c; - inverseMatrix.props[5] = d; - inverseMatrix.props[12] = e; - inverseMatrix.props[13] = f; - return inverseMatrix; - } - - function inversePoint(pt) { - var inverseMatrix = this.getInverseMatrix(); - return inverseMatrix.applyToPointArray(pt[0], pt[1], pt[2] || 0); - } - - function inversePoints(pts) { - var i; - var len = pts.length; - var retPts = []; - for (i = 0; i < len; i += 1) { - retPts[i] = inversePoint(pts[i]); - } - return retPts; - } - - function applyToTriplePoints(pt1, pt2, pt3) { - var arr = createTypedArray('float32', 6); - if (this.isIdentity()) { - arr[0] = pt1[0]; - arr[1] = pt1[1]; - arr[2] = pt2[0]; - arr[3] = pt2[1]; - arr[4] = pt3[0]; - arr[5] = pt3[1]; - } else { - var p0 = this.props[0]; - var p1 = this.props[1]; - var p4 = this.props[4]; - var p5 = this.props[5]; - var p12 = this.props[12]; - var p13 = this.props[13]; - arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12; - arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13; - arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12; - arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13; - arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12; - arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13; - } - return arr; - } - - function applyToPointArray(x, y, z) { - var arr; - if (this.isIdentity()) { - arr = [x, y, z]; - } else { - arr = [ - x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12], - x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13], - x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14], - ]; - } - return arr; - } - - function applyToPointStringified(x, y) { - if (this.isIdentity()) { - return x + ',' + y; - } - var _p = this.props; - return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100 + ',' + Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100; - } - - function toCSS() { - // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed. - /* if(this.isIdentity()) { - return ''; - } */ - var i = 0; - var props = this.props; - var cssValue = 'matrix3d('; - var v = 10000; - while (i < 16) { - cssValue += _rnd(props[i] * v) / v; - cssValue += i === 15 ? ')' : ','; - i += 1; - } - return cssValue; - } - - function roundMatrixProperty(val) { - var v = 10000; - if ((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) { - return _rnd(val * v) / v; - } - return val; - } - - function to2dCSS() { - // Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed. - /* if(this.isIdentity()) { - return ''; - } */ - var props = this.props; - var _a = roundMatrixProperty(props[0]); - var _b = roundMatrixProperty(props[1]); - var _c = roundMatrixProperty(props[4]); - var _d = roundMatrixProperty(props[5]); - var _e = roundMatrixProperty(props[12]); - var _f = roundMatrixProperty(props[13]); - return 'matrix(' + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ')'; - } - - return function () { - this.reset = reset; - this.rotate = rotate; - this.rotateX = rotateX; - this.rotateY = rotateY; - this.rotateZ = rotateZ; - this.skew = skew; - this.skewFromAxis = skewFromAxis; - this.shear = shear; - this.scale = scale; - this.setTransform = setTransform; - this.translate = translate; - this.transform = transform; - this.applyToPoint = applyToPoint; - this.applyToX = applyToX; - this.applyToY = applyToY; - this.applyToZ = applyToZ; - this.applyToPointArray = applyToPointArray; - this.applyToTriplePoints = applyToTriplePoints; - this.applyToPointStringified = applyToPointStringified; - this.toCSS = toCSS; - this.to2dCSS = to2dCSS; - this.clone = clone; - this.cloneFromProps = cloneFromProps; - this.equals = equals; - this.inversePoints = inversePoints; - this.inversePoint = inversePoint; - this.getInverseMatrix = getInverseMatrix; - this._t = this.transform; - this.isIdentity = isIdentity; - this._identity = true; - this._identityCalculated = false; - - this.props = createTypedArray('float32', 16); - this.reset(); - }; -}()); - -var standalone = '__[STANDALONE]__'; -var animationData = '__[ANIMATIONDATA]__'; -var renderer = ''; - -function setLocation(href) { - setLocationHref(href); -} - -function searchAnimations() { - if (standalone === true) { - animationManager.searchAnimations(animationData, standalone, renderer); - } else { - animationManager.searchAnimations(); - } -} - -function setSubframeRendering(flag) { - setSubframeEnabled(flag); -} - -function setPrefix(prefix) { - setIdPrefix(prefix); -} - -function loadAnimation(params) { - if (standalone === true) { - params.animationData = JSON.parse(animationData); - } - return animationManager.loadAnimation(params); -} - -function setQuality(value) { - if (typeof value === 'string') { - switch (value) { - case 'high': - setDefaultCurveSegments(200); - break; - default: - case 'medium': - setDefaultCurveSegments(50); - break; - case 'low': - setDefaultCurveSegments(10); - break; - } - } else if (!isNaN(value) && value > 1) { - setDefaultCurveSegments(value); - } - if (getDefaultCurveSegments() >= 50) { - roundValues(false); - } else { - roundValues(true); - } -} - -function inBrowser() { - return typeof navigator !== 'undefined'; -} - -function installPlugin(type, plugin) { - if (type === 'expressions') { - setExpressionsPlugin(plugin); - } -} - -function getFactory(name) { - switch (name) { - case 'propertyFactory': - return PropertyFactory; - case 'shapePropertyFactory': - return ShapePropertyFactory; - case 'matrix': - return Matrix; - default: - return null; - } -} - -lottie.play = animationManager.play; -lottie.pause = animationManager.pause; -lottie.setLocationHref = setLocation; -lottie.togglePause = animationManager.togglePause; -lottie.setSpeed = animationManager.setSpeed; -lottie.setDirection = animationManager.setDirection; -lottie.stop = animationManager.stop; -lottie.searchAnimations = searchAnimations; -lottie.registerAnimation = animationManager.registerAnimation; -lottie.loadAnimation = loadAnimation; -lottie.setSubframeRendering = setSubframeRendering; -lottie.resize = animationManager.resize; -// lottie.start = start; -lottie.goToAndStop = animationManager.goToAndStop; -lottie.destroy = animationManager.destroy; -lottie.setQuality = setQuality; -lottie.inBrowser = inBrowser; -lottie.installPlugin = installPlugin; -lottie.freeze = animationManager.freeze; -lottie.unfreeze = animationManager.unfreeze; -lottie.setVolume = animationManager.setVolume; -lottie.mute = animationManager.mute; -lottie.unmute = animationManager.unmute; -lottie.getRegisteredAnimations = animationManager.getRegisteredAnimations; -lottie.useWebWorker = setWebWorker; -lottie.setIDPrefix = setPrefix; -lottie.__getFactory = getFactory; -lottie.version = '[[BM_VERSION]]'; - -function checkReady() { - if (document.readyState === 'complete') { - clearInterval(readyStateCheckInterval); - searchAnimations(); - } -} - -function getQueryVariable(variable) { - var vars = queryString.split('&'); - for (var i = 0; i < vars.length; i += 1) { - var pair = vars[i].split('='); - if (decodeURIComponent(pair[0]) == variable) { // eslint-disable-line eqeqeq - return decodeURIComponent(pair[1]); - } - } - return null; -} -var queryString = ''; -if (standalone) { - var scripts = document.getElementsByTagName('script'); - var index = scripts.length - 1; - var myScript = scripts[index] || { - src: '', - }; - queryString = myScript.src ? myScript.src.replace(/^[^\?]+\??/, '') : ''; // eslint-disable-line no-useless-escape - renderer = getQueryVariable('renderer'); -} -var readyStateCheckInterval = setInterval(checkReady, 100); - -// this adds bodymovin to the window object for backwards compatibility -try { - if (!(typeof exports === 'object' && typeof module !== 'undefined') - && !(typeof define === 'function' && define.amd) // eslint-disable-line no-undef - ) { - window.bodymovin = lottie; - } -} catch (err) { - // -} - -const ShapeModifiers = (function () { - var ob = {}; - var modifiers = {}; - ob.registerModifier = registerModifier; - ob.getModifier = getModifier; - - function registerModifier(nm, factory) { - if (!modifiers[nm]) { - modifiers[nm] = factory; - } - } - - function getModifier(nm, elem, data) { - return new modifiers[nm](elem, data); - } - - return ob; -}()); - -function ShapeModifier() {} -ShapeModifier.prototype.initModifierProperties = function () {}; -ShapeModifier.prototype.addShapeToModifier = function () {}; -ShapeModifier.prototype.addShape = function (data) { - if (!this.closed) { - // Adding shape to dynamic properties. It covers the case where a shape has no effects applied, to reset it's _mdf state on every tick. - data.sh.container.addDynamicProperty(data.sh); - var shapeData = { shape: data.sh, data: data, localShapeCollection: shapeCollectionPool.newShapeCollection() }; - this.shapes.push(shapeData); - this.addShapeToModifier(shapeData); - if (this._isAnimated) { - data.setAsAnimated(); - } - } -}; -ShapeModifier.prototype.init = function (elem, data) { - this.shapes = []; - this.elem = elem; - this.initDynamicPropertyContainer(elem); - this.initModifierProperties(elem, data); - this.frameId = initialDefaultFrame; - this.closed = false; - this.k = false; - if (this.dynamicProperties.length) { - this.k = true; - } else { - this.getValue(true); - } -}; -ShapeModifier.prototype.processKeys = function () { - if (this.elem.globalData.frameId === this.frameId) { - return; - } - this.frameId = this.elem.globalData.frameId; - this.iterateDynamicProperties(); -}; - -extendPrototype([DynamicPropertyContainer], ShapeModifier); - -function TrimModifier() { -} -extendPrototype([ShapeModifier], TrimModifier); -TrimModifier.prototype.initModifierProperties = function (elem, data) { - this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this); - this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this); - this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this); - this.sValue = 0; - this.eValue = 0; - this.getValue = this.processKeys; - this.m = data.m; - this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length; -}; - -TrimModifier.prototype.addShapeToModifier = function (shapeData) { - shapeData.pathsData = []; -}; - -TrimModifier.prototype.calculateShapeEdges = function (s, e, shapeLength, addedLength, totalModifierLength) { - var segments = []; - if (e <= 1) { - segments.push({ - s: s, - e: e, - }); - } else if (s >= 1) { - segments.push({ - s: s - 1, - e: e - 1, - }); - } else { - segments.push({ - s: s, - e: 1, - }); - segments.push({ - s: 0, - e: e - 1, - }); - } - var shapeSegments = []; - var i; - var len = segments.length; - var segmentOb; - for (i = 0; i < len; i += 1) { - segmentOb = segments[i]; - if (!(segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength)) { - var shapeS; - var shapeE; - if (segmentOb.s * totalModifierLength <= addedLength) { - shapeS = 0; - } else { - shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength; - } - if (segmentOb.e * totalModifierLength >= addedLength + shapeLength) { - shapeE = 1; - } else { - shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength); - } - shapeSegments.push([shapeS, shapeE]); - } - } - if (!shapeSegments.length) { - shapeSegments.push([0, 0]); - } - return shapeSegments; -}; - -TrimModifier.prototype.releasePathsData = function (pathsData) { - var i; - var len = pathsData.length; - for (i = 0; i < len; i += 1) { - segmentsLengthPool.release(pathsData[i]); - } - pathsData.length = 0; - return pathsData; -}; - -TrimModifier.prototype.processShapes = function (_isFirstFrame) { - var s; - var e; - if (this._mdf || _isFirstFrame) { - var o = (this.o.v % 360) / 360; - if (o < 0) { - o += 1; - } - if (this.s.v > 1) { - s = 1 + o; - } else if (this.s.v < 0) { - s = 0 + o; - } else { - s = this.s.v + o; - } - if (this.e.v > 1) { - e = 1 + o; - } else if (this.e.v < 0) { - e = 0 + o; - } else { - e = this.e.v + o; - } - - if (s > e) { - var _s = s; - s = e; - e = _s; - } - s = Math.round(s * 10000) * 0.0001; - e = Math.round(e * 10000) * 0.0001; - this.sValue = s; - this.eValue = e; - } else { - s = this.sValue; - e = this.eValue; - } - var shapePaths; - var i; - var len = this.shapes.length; - var j; - var jLen; - var pathsData; - var pathData; - var totalShapeLength; - var totalModifierLength = 0; - - if (e === s) { - for (i = 0; i < len; i += 1) { - this.shapes[i].localShapeCollection.releaseShapes(); - this.shapes[i].shape._mdf = true; - this.shapes[i].shape.paths = this.shapes[i].localShapeCollection; - if (this._mdf) { - this.shapes[i].pathsData.length = 0; - } - } - } else if (!((e === 1 && s === 0) || (e === 0 && s === 1))) { - var segments = []; - var shapeData; - var localShapeCollection; - for (i = 0; i < len; i += 1) { - shapeData = this.shapes[i]; - // if shape hasn't changed and trim properties haven't changed, cached previous path can be used - if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) { - shapeData.shape.paths = shapeData.localShapeCollection; - } else { - shapePaths = shapeData.shape.paths; - jLen = shapePaths._length; - totalShapeLength = 0; - if (!shapeData.shape._mdf && shapeData.pathsData.length) { - totalShapeLength = shapeData.totalShapeLength; - } else { - pathsData = this.releasePathsData(shapeData.pathsData); - for (j = 0; j < jLen; j += 1) { - pathData = bez.getSegmentsLength(shapePaths.shapes[j]); - pathsData.push(pathData); - totalShapeLength += pathData.totalLength; - } - shapeData.totalShapeLength = totalShapeLength; - shapeData.pathsData = pathsData; - } - - totalModifierLength += totalShapeLength; - shapeData.shape._mdf = true; - } - } - var shapeS = s; - var shapeE = e; - var addedLength = 0; - var edges; - for (i = len - 1; i >= 0; i -= 1) { - shapeData = this.shapes[i]; - if (shapeData.shape._mdf) { - localShapeCollection = shapeData.localShapeCollection; - localShapeCollection.releaseShapes(); - // if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group - if (this.m === 2 && len > 1) { - edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength); - addedLength += shapeData.totalShapeLength; - } else { - edges = [[shapeS, shapeE]]; - } - jLen = edges.length; - for (j = 0; j < jLen; j += 1) { - shapeS = edges[j][0]; - shapeE = edges[j][1]; - segments.length = 0; - if (shapeE <= 1) { - segments.push({ - s: shapeData.totalShapeLength * shapeS, - e: shapeData.totalShapeLength * shapeE, - }); - } else if (shapeS >= 1) { - segments.push({ - s: shapeData.totalShapeLength * (shapeS - 1), - e: shapeData.totalShapeLength * (shapeE - 1), - }); - } else { - segments.push({ - s: shapeData.totalShapeLength * shapeS, - e: shapeData.totalShapeLength, - }); - segments.push({ - s: 0, - e: shapeData.totalShapeLength * (shapeE - 1), - }); - } - var newShapesData = this.addShapes(shapeData, segments[0]); - if (segments[0].s !== segments[0].e) { - if (segments.length > 1) { - var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1]; - if (lastShapeInCollection.c) { - var lastShape = newShapesData.pop(); - this.addPaths(newShapesData, localShapeCollection); - newShapesData = this.addShapes(shapeData, segments[1], lastShape); - } else { - this.addPaths(newShapesData, localShapeCollection); - newShapesData = this.addShapes(shapeData, segments[1]); - } - } - this.addPaths(newShapesData, localShapeCollection); - } - } - shapeData.shape.paths = localShapeCollection; - } - } - } else if (this._mdf) { - for (i = 0; i < len; i += 1) { - // Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween. - // Don't remove this even if it's losing cached info. - this.shapes[i].pathsData.length = 0; - this.shapes[i].shape._mdf = true; - } - } -}; - -TrimModifier.prototype.addPaths = function (newPaths, localShapeCollection) { - var i; - var len = newPaths.length; - for (i = 0; i < len; i += 1) { - localShapeCollection.addShape(newPaths[i]); - } -}; - -TrimModifier.prototype.addSegment = function (pt1, pt2, pt3, pt4, shapePath, pos, newShape) { - shapePath.setXYAt(pt2[0], pt2[1], 'o', pos); - shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1); - if (newShape) { - shapePath.setXYAt(pt1[0], pt1[1], 'v', pos); - } - shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1); -}; - -TrimModifier.prototype.addSegmentFromArray = function (points, shapePath, pos, newShape) { - shapePath.setXYAt(points[1], points[5], 'o', pos); - shapePath.setXYAt(points[2], points[6], 'i', pos + 1); - if (newShape) { - shapePath.setXYAt(points[0], points[4], 'v', pos); - } - shapePath.setXYAt(points[3], points[7], 'v', pos + 1); -}; - -TrimModifier.prototype.addShapes = function (shapeData, shapeSegment, shapePath) { - var pathsData = shapeData.pathsData; - var shapePaths = shapeData.shape.paths.shapes; - var i; - var len = shapeData.shape.paths._length; - var j; - var jLen; - var addedLength = 0; - var currentLengthData; - var segmentCount; - var lengths; - var segment; - var shapes = []; - var initPos; - var newShape = true; - if (!shapePath) { - shapePath = shapePool.newElement(); - segmentCount = 0; - initPos = 0; - } else { - segmentCount = shapePath._length; - initPos = shapePath._length; - } - shapes.push(shapePath); - for (i = 0; i < len; i += 1) { - lengths = pathsData[i].lengths; - shapePath.c = shapePaths[i].c; - jLen = shapePaths[i].c ? lengths.length : lengths.length + 1; - for (j = 1; j < jLen; j += 1) { - currentLengthData = lengths[j - 1]; - if (addedLength + currentLengthData.addedLength < shapeSegment.s) { - addedLength += currentLengthData.addedLength; - shapePath.c = false; - } else if (addedLength > shapeSegment.e) { - shapePath.c = false; - break; - } else { - if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) { - this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape); - newShape = false; - } else { - segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength) / currentLengthData.addedLength, (shapeSegment.e - addedLength) / currentLengthData.addedLength, lengths[j - 1]); - this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); - // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape); - newShape = false; - shapePath.c = false; - } - addedLength += currentLengthData.addedLength; - segmentCount += 1; - } - } - if (shapePaths[i].c && lengths.length) { - currentLengthData = lengths[j - 1]; - if (addedLength <= shapeSegment.e) { - var segmentLength = lengths[j - 1].addedLength; - if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) { - this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape); - newShape = false; - } else { - segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]); - this.addSegmentFromArray(segment, shapePath, segmentCount, newShape); - // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape); - newShape = false; - shapePath.c = false; - } - } else { - shapePath.c = false; - } - addedLength += currentLengthData.addedLength; - segmentCount += 1; - } - if (shapePath._length) { - shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos); - shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1], 'o', shapePath._length - 1); - } - if (addedLength > shapeSegment.e) { - break; - } - if (i < len - 1) { - shapePath = shapePool.newElement(); - newShape = true; - shapes.push(shapePath); - segmentCount = 0; - } - } - return shapes; -}; - -function PuckerAndBloatModifier() {} -extendPrototype([ShapeModifier], PuckerAndBloatModifier); -PuckerAndBloatModifier.prototype.initModifierProperties = function (elem, data) { - this.getValue = this.processKeys; - this.amount = PropertyFactory.getProp(elem, data.a, 0, null, this); - this._isAnimated = !!this.amount.effectsSequence.length; -}; - -PuckerAndBloatModifier.prototype.processPath = function (path, amount) { - var percent = amount / 100; - var centerPoint = [0, 0]; - var pathLength = path._length; - var i = 0; - for (i = 0; i < pathLength; i += 1) { - centerPoint[0] += path.v[i][0]; - centerPoint[1] += path.v[i][1]; - } - centerPoint[0] /= pathLength; - centerPoint[1] /= pathLength; - var clonedPath = shapePool.newElement(); - clonedPath.c = path.c; - var vX; - var vY; - var oX; - var oY; - var iX; - var iY; - for (i = 0; i < pathLength; i += 1) { - vX = path.v[i][0] + (centerPoint[0] - path.v[i][0]) * percent; - vY = path.v[i][1] + (centerPoint[1] - path.v[i][1]) * percent; - oX = path.o[i][0] + (centerPoint[0] - path.o[i][0]) * -percent; - oY = path.o[i][1] + (centerPoint[1] - path.o[i][1]) * -percent; - iX = path.i[i][0] + (centerPoint[0] - path.i[i][0]) * -percent; - iY = path.i[i][1] + (centerPoint[1] - path.i[i][1]) * -percent; - clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, i); - } - return clonedPath; -}; - -PuckerAndBloatModifier.prototype.processShapes = function (_isFirstFrame) { - var shapePaths; - var i; - var len = this.shapes.length; - var j; - var jLen; - var amount = this.amount.v; - - if (amount !== 0) { - var shapeData; - var localShapeCollection; - for (i = 0; i < len; i += 1) { - shapeData = this.shapes[i]; - localShapeCollection = shapeData.localShapeCollection; - if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { - localShapeCollection.releaseShapes(); - shapeData.shape._mdf = true; - shapePaths = shapeData.shape.paths.shapes; - jLen = shapeData.shape.paths._length; - for (j = 0; j < jLen; j += 1) { - localShapeCollection.addShape(this.processPath(shapePaths[j], amount)); - } - } - shapeData.shape.paths = shapeData.localShapeCollection; - } - } - if (!this.dynamicProperties.length) { - this._mdf = false; - } -}; - -const TransformPropertyFactory = (function () { - var defaultVector = [0, 0]; - - function applyToMatrix(mat) { - var _mdf = this._mdf; - this.iterateDynamicProperties(); - this._mdf = this._mdf || _mdf; - if (this.a) { - mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); - } - if (this.s) { - mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]); - } - if (this.sk) { - mat.skewFromAxis(-this.sk.v, this.sa.v); - } - if (this.r) { - mat.rotate(-this.r.v); - } else { - mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]) - .rotateY(this.or.v[1]) - .rotateX(this.or.v[0]); - } - if (this.data.p.s) { - if (this.data.p.z) { - mat.translate(this.px.v, this.py.v, -this.pz.v); - } else { - mat.translate(this.px.v, this.py.v, 0); - } - } else { - mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]); - } - } - function processKeys(forceRender) { - if (this.elem.globalData.frameId === this.frameId) { - return; - } - if (this._isDirty) { - this.precalculateMatrix(); - this._isDirty = false; - } - - this.iterateDynamicProperties(); - - if (this._mdf || forceRender) { - var frameRate; - this.v.cloneFromProps(this.pre.props); - if (this.appliedTransformations < 1) { - this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); - } - if (this.appliedTransformations < 2) { - this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]); - } - if (this.sk && this.appliedTransformations < 3) { - this.v.skewFromAxis(-this.sk.v, this.sa.v); - } - if (this.r && this.appliedTransformations < 4) { - this.v.rotate(-this.r.v); - } else if (!this.r && this.appliedTransformations < 4) { - this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]) - .rotateY(this.or.v[1]) - .rotateX(this.or.v[0]); - } - if (this.autoOriented) { - var v1; - var v2; - frameRate = this.elem.globalData.frameRate; - if (this.p && this.p.keyframes && this.p.getValueAtTime) { - if (this.p._caching.lastFrame + this.p.offsetTime <= this.p.keyframes[0].t) { - v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate, 0); - v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0); - } else if (this.p._caching.lastFrame + this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) { - v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0); - v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.05) / frameRate, 0); - } else { - v1 = this.p.pv; - v2 = this.p.getValueAtTime((this.p._caching.lastFrame + this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime); - } - } else if (this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) { - v1 = []; - v2 = []; - var px = this.px; - var py = this.py; - if (px._caching.lastFrame + px.offsetTime <= px.keyframes[0].t) { - v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate, 0); - v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate, 0); - v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate, 0); - v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate, 0); - } else if (px._caching.lastFrame + px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) { - v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate), 0); - v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate), 0); - v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate, 0); - v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate, 0); - } else { - v1 = [px.pv, py.pv]; - v2[0] = px.getValueAtTime((px._caching.lastFrame + px.offsetTime - 0.01) / frameRate, px.offsetTime); - v2[1] = py.getValueAtTime((py._caching.lastFrame + py.offsetTime - 0.01) / frameRate, py.offsetTime); - } - } else { - v2 = defaultVector; - v1 = v2; - } - this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0])); - } - if (this.data.p && this.data.p.s) { - if (this.data.p.z) { - this.v.translate(this.px.v, this.py.v, -this.pz.v); - } else { - this.v.translate(this.px.v, this.py.v, 0); - } - } else { - this.v.translate(this.p.v[0], this.p.v[1], -this.p.v[2]); - } - } - this.frameId = this.elem.globalData.frameId; - } - - function precalculateMatrix() { - if (!this.a.k) { - this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]); - this.appliedTransformations = 1; - } else { - return; - } - if (!this.s.effectsSequence.length) { - this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]); - this.appliedTransformations = 2; - } else { - return; - } - if (this.sk) { - if (!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) { - this.pre.skewFromAxis(-this.sk.v, this.sa.v); - this.appliedTransformations = 3; - } else { - return; - } - } - if (this.r) { - if (!this.r.effectsSequence.length) { - this.pre.rotate(-this.r.v); - this.appliedTransformations = 4; - } - } else if (!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) { - this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]) - .rotateY(this.or.v[1]) - .rotateX(this.or.v[0]); - this.appliedTransformations = 4; - } - } - - function autoOrient() { - // - // var prevP = this.getValueAtTime(); - } - - function addDynamicProperty(prop) { - this._addDynamicProperty(prop); - this.elem.addDynamicProperty(prop); - this._isDirty = true; - } - - function TransformProperty(elem, data, container) { - this.elem = elem; - this.frameId = -1; - this.propType = 'transform'; - this.data = data; - this.v = new Matrix(); - // Precalculated matrix with non animated properties - this.pre = new Matrix(); - this.appliedTransformations = 0; - this.initDynamicPropertyContainer(container || elem); - if (data.p && data.p.s) { - this.px = PropertyFactory.getProp(elem, data.p.x, 0, 0, this); - this.py = PropertyFactory.getProp(elem, data.p.y, 0, 0, this); - if (data.p.z) { - this.pz = PropertyFactory.getProp(elem, data.p.z, 0, 0, this); - } - } else { - this.p = PropertyFactory.getProp(elem, data.p || { k: [0, 0, 0] }, 1, 0, this); - } - if (data.rx) { - this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this); - this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this); - this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this); - if (data.or.k[0].ti) { - var i; - var len = data.or.k.length; - for (i = 0; i < len; i += 1) { - data.or.k[i].to = null; - data.or.k[i].ti = null; - } - } - this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this); - // sh Indicates it needs to be capped between -180 and 180 - this.or.sh = true; - } else { - this.r = PropertyFactory.getProp(elem, data.r || { k: 0 }, 0, degToRads, this); - } - if (data.sk) { - this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this); - this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this); - } - this.a = PropertyFactory.getProp(elem, data.a || { k: [0, 0, 0] }, 1, 0, this); - this.s = PropertyFactory.getProp(elem, data.s || { k: [100, 100, 100] }, 1, 0.01, this); - // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes. - if (data.o) { - this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, elem); - } else { - this.o = { _mdf: false, v: 1 }; - } - this._isDirty = true; - if (!this.dynamicProperties.length) { - this.getValue(true); - } - } - - TransformProperty.prototype = { - applyToMatrix: applyToMatrix, - getValue: processKeys, - precalculateMatrix: precalculateMatrix, - autoOrient: autoOrient, - }; - - extendPrototype([DynamicPropertyContainer], TransformProperty); - TransformProperty.prototype.addDynamicProperty = addDynamicProperty; - TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty; - - function getTransformProperty(elem, data, container) { - return new TransformProperty(elem, data, container); - } - - return { - getTransformProperty: getTransformProperty, - }; -}()); - -function RepeaterModifier() {} -extendPrototype([ShapeModifier], RepeaterModifier); - -RepeaterModifier.prototype.initModifierProperties = function (elem, data) { - this.getValue = this.processKeys; - this.c = PropertyFactory.getProp(elem, data.c, 0, null, this); - this.o = PropertyFactory.getProp(elem, data.o, 0, null, this); - this.tr = TransformPropertyFactory.getTransformProperty(elem, data.tr, this); - this.so = PropertyFactory.getProp(elem, data.tr.so, 0, 0.01, this); - this.eo = PropertyFactory.getProp(elem, data.tr.eo, 0, 0.01, this); - this.data = data; - if (!this.dynamicProperties.length) { - this.getValue(true); - } - this._isAnimated = !!this.dynamicProperties.length; - this.pMatrix = new Matrix(); - this.rMatrix = new Matrix(); - this.sMatrix = new Matrix(); - this.tMatrix = new Matrix(); - this.matrix = new Matrix(); -}; - -RepeaterModifier.prototype.applyTransforms = function (pMatrix, rMatrix, sMatrix, transform, perc, inv) { - var dir = inv ? -1 : 1; - var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc); - var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc); - pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]); - rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]); - rMatrix.rotate(-transform.r.v * dir * perc); - rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]); - sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]); - sMatrix.scale(inv ? 1 / scaleX : scaleX, inv ? 1 / scaleY : scaleY); - sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]); -}; - -RepeaterModifier.prototype.init = function (elem, arr, pos, elemsData) { - this.elem = elem; - this.arr = arr; - this.pos = pos; - this.elemsData = elemsData; - this._currentCopies = 0; - this._elements = []; - this._groups = []; - this.frameId = -1; - this.initDynamicPropertyContainer(elem); - this.initModifierProperties(elem, arr[pos]); - while (pos > 0) { - pos -= 1; - // this._elements.unshift(arr.splice(pos,1)[0]); - this._elements.unshift(arr[pos]); - } - if (this.dynamicProperties.length) { - this.k = true; - } else { - this.getValue(true); - } -}; - -RepeaterModifier.prototype.resetElements = function (elements) { - var i; - var len = elements.length; - for (i = 0; i < len; i += 1) { - elements[i]._processed = false; - if (elements[i].ty === 'gr') { - this.resetElements(elements[i].it); - } - } -}; - -RepeaterModifier.prototype.cloneElements = function (elements) { - var newElements = JSON.parse(JSON.stringify(elements)); - this.resetElements(newElements); - return newElements; -}; - -RepeaterModifier.prototype.changeGroupRender = function (elements, renderFlag) { - var i; - var len = elements.length; - for (i = 0; i < len; i += 1) { - elements[i]._render = renderFlag; - if (elements[i].ty === 'gr') { - this.changeGroupRender(elements[i].it, renderFlag); - } - } -}; - -RepeaterModifier.prototype.processShapes = function (_isFirstFrame) { - var items; - var itemsTransform; - var i; - var dir; - var cont; - var hasReloaded = false; - if (this._mdf || _isFirstFrame) { - var copies = Math.ceil(this.c.v); - if (this._groups.length < copies) { - while (this._groups.length < copies) { - var group = { - it: this.cloneElements(this._elements), - ty: 'gr', - }; - group.it.push({ - a: { a: 0, ix: 1, k: [0, 0] }, nm: 'Transform', o: { a: 0, ix: 7, k: 100 }, p: { a: 0, ix: 2, k: [0, 0] }, r: { a: 1, ix: 6, k: [{ s: 0, e: 0, t: 0 }, { s: 0, e: 0, t: 1 }] }, s: { a: 0, ix: 3, k: [100, 100] }, sa: { a: 0, ix: 5, k: 0 }, sk: { a: 0, ix: 4, k: 0 }, ty: 'tr', - }); - - this.arr.splice(0, 0, group); - this._groups.splice(0, 0, group); - this._currentCopies += 1; - } - this.elem.reloadShapes(); - hasReloaded = true; - } - cont = 0; - var renderFlag; - for (i = 0; i <= this._groups.length - 1; i += 1) { - renderFlag = cont < copies; - this._groups[i]._render = renderFlag; - this.changeGroupRender(this._groups[i].it, renderFlag); - if (!renderFlag) { - var elems = this.elemsData[i].it; - var transformData = elems[elems.length - 1]; - if (transformData.transform.op.v !== 0) { - transformData.transform.op._mdf = true; - transformData.transform.op.v = 0; - } else { - transformData.transform.op._mdf = false; - } - } - cont += 1; - } - - this._currentCopies = copies; - /// / - - var offset = this.o.v; - var offsetModulo = offset % 1; - var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset); - var pProps = this.pMatrix.props; - var rProps = this.rMatrix.props; - var sProps = this.sMatrix.props; - this.pMatrix.reset(); - this.rMatrix.reset(); - this.sMatrix.reset(); - this.tMatrix.reset(); - this.matrix.reset(); - var iteration = 0; - - if (offset > 0) { - while (iteration < roundOffset) { - this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false); - iteration += 1; - } - if (offsetModulo) { - this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false); - iteration += offsetModulo; - } - } else if (offset < 0) { - while (iteration > roundOffset) { - this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true); - iteration -= 1; - } - if (offsetModulo) { - this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, -offsetModulo, true); - iteration -= offsetModulo; - } - } - i = this.data.m === 1 ? 0 : this._currentCopies - 1; - dir = this.data.m === 1 ? 1 : -1; - cont = this._currentCopies; - var j; - var jLen; - while (cont) { - items = this.elemsData[i].it; - itemsTransform = items[items.length - 1].transform.mProps.v.props; - jLen = itemsTransform.length; - items[items.length - 1].transform.mProps._mdf = true; - items[items.length - 1].transform.op._mdf = true; - items[items.length - 1].transform.op.v = this._currentCopies === 1 - ? this.so.v - : this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1)); - - if (iteration !== 0) { - if ((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)) { - this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false); - } - this.matrix.transform(rProps[0], rProps[1], rProps[2], rProps[3], rProps[4], rProps[5], rProps[6], rProps[7], rProps[8], rProps[9], rProps[10], rProps[11], rProps[12], rProps[13], rProps[14], rProps[15]); - this.matrix.transform(sProps[0], sProps[1], sProps[2], sProps[3], sProps[4], sProps[5], sProps[6], sProps[7], sProps[8], sProps[9], sProps[10], sProps[11], sProps[12], sProps[13], sProps[14], sProps[15]); - this.matrix.transform(pProps[0], pProps[1], pProps[2], pProps[3], pProps[4], pProps[5], pProps[6], pProps[7], pProps[8], pProps[9], pProps[10], pProps[11], pProps[12], pProps[13], pProps[14], pProps[15]); - - for (j = 0; j < jLen; j += 1) { - itemsTransform[j] = this.matrix.props[j]; - } - this.matrix.reset(); - } else { - this.matrix.reset(); - for (j = 0; j < jLen; j += 1) { - itemsTransform[j] = this.matrix.props[j]; - } - } - iteration += 1; - cont -= 1; - i += dir; - } - } else { - cont = this._currentCopies; - i = 0; - dir = 1; - while (cont) { - items = this.elemsData[i].it; - itemsTransform = items[items.length - 1].transform.mProps.v.props; - items[items.length - 1].transform.mProps._mdf = false; - items[items.length - 1].transform.op._mdf = false; - cont -= 1; - i += dir; - } - } - return hasReloaded; -}; - -RepeaterModifier.prototype.addShape = function () {}; - -function RoundCornersModifier() {} -extendPrototype([ShapeModifier], RoundCornersModifier); -RoundCornersModifier.prototype.initModifierProperties = function (elem, data) { - this.getValue = this.processKeys; - this.rd = PropertyFactory.getProp(elem, data.r, 0, null, this); - this._isAnimated = !!this.rd.effectsSequence.length; -}; - -RoundCornersModifier.prototype.processPath = function (path, round) { - var clonedPath = shapePool.newElement(); - clonedPath.c = path.c; - var i; - var len = path._length; - var currentV; - var currentI; - var currentO; - var closerV; - var distance; - var newPosPerc; - var index = 0; - var vX; - var vY; - var oX; - var oY; - var iX; - var iY; - for (i = 0; i < len; i += 1) { - currentV = path.v[i]; - currentO = path.o[i]; - currentI = path.i[i]; - if (currentV[0] === currentO[0] && currentV[1] === currentO[1] && currentV[0] === currentI[0] && currentV[1] === currentI[1]) { - if ((i === 0 || i === len - 1) && !path.c) { - clonedPath.setTripleAt(currentV[0], currentV[1], currentO[0], currentO[1], currentI[0], currentI[1], index); - /* clonedPath.v[index] = currentV; - clonedPath.o[index] = currentO; - clonedPath.i[index] = currentI; */ - index += 1; - } else { - if (i === 0) { - closerV = path.v[len - 1]; - } else { - closerV = path.v[i - 1]; - } - distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2)); - newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0; - iX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc; - vX = iX; - iY = currentV[1] - (currentV[1] - closerV[1]) * newPosPerc; - vY = iY; - oX = vX - (vX - currentV[0]) * roundCorner; - oY = vY - (vY - currentV[1]) * roundCorner; - clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index); - index += 1; - - if (i === len - 1) { - closerV = path.v[0]; - } else { - closerV = path.v[i + 1]; - } - distance = Math.sqrt(Math.pow(currentV[0] - closerV[0], 2) + Math.pow(currentV[1] - closerV[1], 2)); - newPosPerc = distance ? Math.min(distance / 2, round) / distance : 0; - oX = currentV[0] + (closerV[0] - currentV[0]) * newPosPerc; - vX = oX; - oY = currentV[1] + (closerV[1] - currentV[1]) * newPosPerc; - vY = oY; - iX = vX - (vX - currentV[0]) * roundCorner; - iY = vY - (vY - currentV[1]) * roundCorner; - clonedPath.setTripleAt(vX, vY, oX, oY, iX, iY, index); - index += 1; - } - } else { - clonedPath.setTripleAt(path.v[i][0], path.v[i][1], path.o[i][0], path.o[i][1], path.i[i][0], path.i[i][1], index); - index += 1; - } - } - return clonedPath; -}; - -RoundCornersModifier.prototype.processShapes = function (_isFirstFrame) { - var shapePaths; - var i; - var len = this.shapes.length; - var j; - var jLen; - var rd = this.rd.v; - - if (rd !== 0) { - var shapeData; - var localShapeCollection; - for (i = 0; i < len; i += 1) { - shapeData = this.shapes[i]; - localShapeCollection = shapeData.localShapeCollection; - if (!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)) { - localShapeCollection.releaseShapes(); - shapeData.shape._mdf = true; - shapePaths = shapeData.shape.paths.shapes; - jLen = shapeData.shape.paths._length; - for (j = 0; j < jLen; j += 1) { - localShapeCollection.addShape(this.processPath(shapePaths[j], rd)); - } - } - shapeData.shape.paths = shapeData.localShapeCollection; - } - } - if (!this.dynamicProperties.length) { - this._mdf = false; - } -}; - -function getFontProperties(fontData) { - var styles = fontData.fStyle ? fontData.fStyle.split(' ') : []; - - var fWeight = 'normal'; var - fStyle = 'normal'; - var len = styles.length; - var styleName; - for (var i = 0; i < len; i += 1) { - styleName = styles[i].toLowerCase(); - switch (styleName) { - case 'italic': - fStyle = 'italic'; - break; - case 'bold': - fWeight = '700'; - break; - case 'black': - fWeight = '900'; - break; - case 'medium': - fWeight = '500'; - break; - case 'regular': - case 'normal': - fWeight = '400'; - break; - case 'light': - case 'thin': - fWeight = '200'; - break; - default: - break; - } - } - - return { - style: fStyle, - weight: fontData.fWeight || fWeight, - }; -} - -const FontManager = (function () { - var maxWaitingTime = 5000; - var emptyChar = { - w: 0, - size: 0, - shapes: [], - data: { - shapes: [], - }, - }; - var combinedCharacters = []; - // Hindi characters - combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366, - 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379, - 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]); - - var surrogateModifiers = [ - 'd83cdffb', - 'd83cdffc', - 'd83cdffd', - 'd83cdffe', - 'd83cdfff', - ]; - - var zeroWidthJoiner = [65039, 8205]; - - function trimFontOptions(font) { - var familyArray = font.split(','); - var i; - var len = familyArray.length; - var enabledFamilies = []; - for (i = 0; i < len; i += 1) { - if (familyArray[i] !== 'sans-serif' && familyArray[i] !== 'monospace') { - enabledFamilies.push(familyArray[i]); - } - } - return enabledFamilies.join(','); - } - - function setUpNode(font, family) { - var parentNode = createTag('span'); - // Node is invisible to screen readers. - parentNode.setAttribute('aria-hidden', true); - parentNode.style.fontFamily = family; - var node = createTag('span'); - // Characters that vary significantly among different fonts - node.innerText = 'giItT1WQy@!-/#'; - // Visible - so we can measure it - but not on the screen - parentNode.style.position = 'absolute'; - parentNode.style.left = '-10000px'; - parentNode.style.top = '-10000px'; - // Large font size makes even subtle changes obvious - parentNode.style.fontSize = '300px'; - // Reset any font properties - parentNode.style.fontVariant = 'normal'; - parentNode.style.fontStyle = 'normal'; - parentNode.style.fontWeight = 'normal'; - parentNode.style.letterSpacing = '0'; - parentNode.appendChild(node); - document.body.appendChild(parentNode); - - // Remember width with no applied web font - var width = node.offsetWidth; - node.style.fontFamily = trimFontOptions(font) + ', ' + family; - return { node: node, w: width, parent: parentNode }; - } - - function checkLoadedFonts() { - var i; - var len = this.fonts.length; - var node; - var w; - var loadedCount = len; - for (i = 0; i < len; i += 1) { - if (this.fonts[i].loaded) { - loadedCount -= 1; - } else if (this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0) { - this.fonts[i].loaded = true; - } else { - node = this.fonts[i].monoCase.node; - w = this.fonts[i].monoCase.w; - if (node.offsetWidth !== w) { - loadedCount -= 1; - this.fonts[i].loaded = true; - } else { - node = this.fonts[i].sansCase.node; - w = this.fonts[i].sansCase.w; - if (node.offsetWidth !== w) { - loadedCount -= 1; - this.fonts[i].loaded = true; - } - } - if (this.fonts[i].loaded) { - this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent); - this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent); - } - } - } - - if (loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime) { - setTimeout(this.checkLoadedFontsBinded, 20); - } else { - setTimeout(this.setIsLoadedBinded, 10); - } - } - - function createHelper(fontData, def) { - var engine = (document.body && def) ? 'svg' : 'canvas'; - var helper; - var fontProps = getFontProperties(fontData); - if (engine === 'svg') { - var tHelper = createNS('text'); - tHelper.style.fontSize = '100px'; - // tHelper.style.fontFamily = fontData.fFamily; - tHelper.setAttribute('font-family', fontData.fFamily); - tHelper.setAttribute('font-style', fontProps.style); - tHelper.setAttribute('font-weight', fontProps.weight); - tHelper.textContent = '1'; - if (fontData.fClass) { - tHelper.style.fontFamily = 'inherit'; - tHelper.setAttribute('class', fontData.fClass); - } else { - tHelper.style.fontFamily = fontData.fFamily; - } - def.appendChild(tHelper); - helper = tHelper; - } else { - var tCanvasHelper = new OffscreenCanvas(500, 500).getContext('2d'); - tCanvasHelper.font = fontProps.style + ' ' + fontProps.weight + ' 100px ' + fontData.fFamily; - helper = tCanvasHelper; - } - function measure(text) { - if (engine === 'svg') { - helper.textContent = text; - return helper.getComputedTextLength(); - } - return helper.measureText(text).width; - } - return { - measureText: measure, - }; - } - - function addFonts(fontData, defs) { - if (!fontData) { - this.isLoaded = true; - return; - } - if (this.chars) { - this.isLoaded = true; - this.fonts = fontData.list; - return; - } - if (!document.body) { - this.isLoaded = true; - fontData.list.forEach((data) => { - data.helper = createHelper(data); - data.cache = {}; - }); - this.fonts = fontData.list; - return; - } - - var fontArr = fontData.list; - var i; - var len = fontArr.length; - var _pendingFonts = len; - for (i = 0; i < len; i += 1) { - var shouldLoadFont = true; - var loadedSelector; - var j; - fontArr[i].loaded = false; - fontArr[i].monoCase = setUpNode(fontArr[i].fFamily, 'monospace'); - fontArr[i].sansCase = setUpNode(fontArr[i].fFamily, 'sans-serif'); - if (!fontArr[i].fPath) { - fontArr[i].loaded = true; - _pendingFonts -= 1; - } else if (fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3) { - loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="' + fontArr[i].fFamily + '"], style[f-origin="3"][f-family="' + fontArr[i].fFamily + '"]'); - - if (loadedSelector.length > 0) { - shouldLoadFont = false; - } - - if (shouldLoadFont) { - var s = createTag('style'); - s.setAttribute('f-forigin', fontArr[i].fOrigin); - s.setAttribute('f-origin', fontArr[i].origin); - s.setAttribute('f-family', fontArr[i].fFamily); - s.type = 'text/css'; - s.innerText = '@font-face {font-family: ' + fontArr[i].fFamily + "; font-style: normal; src: url('" + fontArr[i].fPath + "');}"; - defs.appendChild(s); - } - } else if (fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1) { - loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'); - - for (j = 0; j < loadedSelector.length; j += 1) { - if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) { - // Font is already loaded - shouldLoadFont = false; - } - } - - if (shouldLoadFont) { - var l = createTag('link'); - l.setAttribute('f-forigin', fontArr[i].fOrigin); - l.setAttribute('f-origin', fontArr[i].origin); - l.type = 'text/css'; - l.rel = 'stylesheet'; - l.href = fontArr[i].fPath; - document.body.appendChild(l); - } - } else if (fontArr[i].fOrigin === 't' || fontArr[i].origin === 2) { - loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]'); - - for (j = 0; j < loadedSelector.length; j += 1) { - if (fontArr[i].fPath === loadedSelector[j].src) { - // Font is already loaded - shouldLoadFont = false; - } - } - - if (shouldLoadFont) { - var sc = createTag('link'); - sc.setAttribute('f-forigin', fontArr[i].fOrigin); - sc.setAttribute('f-origin', fontArr[i].origin); - sc.setAttribute('rel', 'stylesheet'); - sc.setAttribute('href', fontArr[i].fPath); - defs.appendChild(sc); - } - } - fontArr[i].helper = createHelper(fontArr[i], defs); - fontArr[i].cache = {}; - this.fonts.push(fontArr[i]); - } - if (_pendingFonts === 0) { - this.isLoaded = true; - } else { - // On some cases even if the font is loaded, it won't load correctly when measuring text on canvas. - // Adding this timeout seems to fix it - setTimeout(this.checkLoadedFonts.bind(this), 100); - } - } - - function addChars(chars) { - if (!chars) { - return; - } - if (!this.chars) { - this.chars = []; - } - var i; - var len = chars.length; - var j; - var jLen = this.chars.length; - var found; - for (i = 0; i < len; i += 1) { - j = 0; - found = false; - while (j < jLen) { - if (this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch) { - found = true; - } - j += 1; - } - if (!found) { - this.chars.push(chars[i]); - jLen += 1; - } - } - } - - function getCharData(char, style, font) { - var i = 0; - var len = this.chars.length; - while (i < len) { - if (this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font) { - return this.chars[i]; - } - i += 1; - } - if (((typeof char === 'string' && char.charCodeAt(0) !== 13) || !char) - && console - && console.warn // eslint-disable-line no-console - && !this._warned - ) { - this._warned = true; - console.warn('Missing character from exported characters list: ', char, style, font); // eslint-disable-line no-console - } - return emptyChar; - } - - function measureText(char, fontName, size) { - var fontData = this.getFontByName(fontName); - var index = char.charCodeAt(0); - if (!fontData.cache[index + 1]) { - var tHelper = fontData.helper; - if (char === ' ') { - var doubleSize = tHelper.measureText('|' + char + '|'); - var singleSize = tHelper.measureText('||'); - fontData.cache[index + 1] = (doubleSize - singleSize) / 100; - } else { - fontData.cache[index + 1] = tHelper.measureText(char) / 100; - } - } - return fontData.cache[index + 1] * size; - } - - function getFontByName(name) { - var i = 0; - var len = this.fonts.length; - while (i < len) { - if (this.fonts[i].fName === name) { - return this.fonts[i]; - } - i += 1; - } - return this.fonts[0]; - } - - function isModifier(firstCharCode, secondCharCode) { - var sum = firstCharCode.toString(16) + secondCharCode.toString(16); - return surrogateModifiers.indexOf(sum) !== -1; - } - - function isZeroWidthJoiner(firstCharCode, secondCharCode) { - if (!secondCharCode) { - return firstCharCode === zeroWidthJoiner[1]; - } - return firstCharCode === zeroWidthJoiner[0] && secondCharCode === zeroWidthJoiner[1]; - } - - function isCombinedCharacter(char) { - return combinedCharacters.indexOf(char) !== -1; - } - - function setIsLoaded() { - this.isLoaded = true; - } - - var Font = function () { - this.fonts = []; - this.chars = null; - this.typekitLoaded = 0; - this.isLoaded = false; - this._warned = false; - this.initTime = Date.now(); - this.setIsLoadedBinded = this.setIsLoaded.bind(this); - this.checkLoadedFontsBinded = this.checkLoadedFonts.bind(this); - }; - Font.isModifier = isModifier; - Font.isZeroWidthJoiner = isZeroWidthJoiner; - Font.isCombinedCharacter = isCombinedCharacter; - - var fontPrototype = { - addChars: addChars, - addFonts: addFonts, - getCharData: getCharData, - getFontByName: getFontByName, - measureText: measureText, - checkLoadedFonts: checkLoadedFonts, - setIsLoaded: setIsLoaded, - }; - - Font.prototype = fontPrototype; - - return Font; -}()); - -function RenderableElement() { - -} - -RenderableElement.prototype = { - initRenderable: function () { - // layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange - this.isInRange = false; - // layer's display state - this.hidden = false; - // If layer's transparency equals 0, it can be hidden - this.isTransparent = false; - // list of animated components - this.renderableComponents = []; - }, - addRenderableComponent: function (component) { - if (this.renderableComponents.indexOf(component) === -1) { - this.renderableComponents.push(component); - } - }, - removeRenderableComponent: function (component) { - if (this.renderableComponents.indexOf(component) !== -1) { - this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1); - } - }, - prepareRenderableFrame: function (num) { - this.checkLayerLimits(num); - }, - checkTransparency: function () { - if (this.finalTransform.mProp.o.v <= 0) { - if (!this.isTransparent && this.globalData.renderConfig.hideOnTransparent) { - this.isTransparent = true; - this.hide(); - } - } else if (this.isTransparent) { - this.isTransparent = false; - this.show(); - } - }, - /** - * @function - * Initializes frame related properties. - * - * @param {number} num - * current frame number in Layer's time - * - */ - checkLayerLimits: function (num) { - if (this.data.ip - this.data.st <= num && this.data.op - this.data.st > num) { - if (this.isInRange !== true) { - this.globalData._mdf = true; - this._mdf = true; - this.isInRange = true; - this.show(); - } - } else if (this.isInRange !== false) { - this.globalData._mdf = true; - this.isInRange = false; - this.hide(); - } - }, - renderRenderable: function () { - var i; - var len = this.renderableComponents.length; - for (i = 0; i < len; i += 1) { - this.renderableComponents[i].renderFrame(this._isFirstFrame); - } - /* this.maskManager.renderFrame(this.finalTransform.mat); - this.renderableEffectsManager.renderFrame(this._isFirstFrame); */ - }, - sourceRectAtTime: function () { - return { - top: 0, - left: 0, - width: 100, - height: 100, - }; - }, - getLayerSize: function () { - if (this.data.ty === 5) { - return { w: this.data.textData.width, h: this.data.textData.height }; - } - return { w: this.data.width, h: this.data.height }; - }, -}; - -const MaskManagerInterface = (function () { - function MaskInterface(mask, data) { - this._mask = mask; - this._data = data; - } - Object.defineProperty(MaskInterface.prototype, 'maskPath', { - get: function () { - if (this._mask.prop.k) { - this._mask.prop.getValue(); - } - return this._mask.prop; - }, - }); - Object.defineProperty(MaskInterface.prototype, 'maskOpacity', { - get: function () { - if (this._mask.op.k) { - this._mask.op.getValue(); - } - return this._mask.op.v * 100; - }, - }); - - var MaskManager = function (maskManager) { - var _masksInterfaces = createSizedArray(maskManager.viewData.length); - var i; - var len = maskManager.viewData.length; - for (i = 0; i < len; i += 1) { - _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]); - } - - var maskFunction = function (name) { - i = 0; - while (i < len) { - if (maskManager.masksProperties[i].nm === name) { - return _masksInterfaces[i]; - } - i += 1; - } - return null; - }; - return maskFunction; - }; - return MaskManager; -}()); - -const ExpressionPropertyInterface = (function () { - var defaultUnidimensionalValue = { pv: 0, v: 0, mult: 1 }; - var defaultMultidimensionalValue = { pv: [0, 0, 0], v: [0, 0, 0], mult: 1 }; - - function completeProperty(expressionValue, property, type) { - Object.defineProperty(expressionValue, 'velocity', { - get: function () { - return property.getVelocityAtTime(property.comp.currentFrame); - }, - }); - expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0; - expressionValue.key = function (pos) { - if (!expressionValue.numKeys) { - return 0; - } - var value = ''; - if ('s' in property.keyframes[pos - 1]) { - value = property.keyframes[pos - 1].s; - } else if ('e' in property.keyframes[pos - 2]) { - value = property.keyframes[pos - 2].e; - } else { - value = property.keyframes[pos - 2].s; - } - var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value); // eslint-disable-line no-new-wrappers - valueProp.time = property.keyframes[pos - 1].t / property.elem.comp.globalData.frameRate; - valueProp.value = type === 'unidimensional' ? value[0] : value; - return valueProp; - }; - expressionValue.valueAtTime = property.getValueAtTime; - expressionValue.speedAtTime = property.getSpeedAtTime; - expressionValue.velocityAtTime = property.getVelocityAtTime; - expressionValue.propertyGroup = property.propertyGroup; - } - - function UnidimensionalPropertyInterface(property) { - if (!property || !('pv' in property)) { - property = defaultUnidimensionalValue; - } - var mult = 1 / property.mult; - var val = property.pv * mult; - var expressionValue = new Number(val); // eslint-disable-line no-new-wrappers - expressionValue.value = val; - completeProperty(expressionValue, property, 'unidimensional'); - - return function () { - if (property.k) { - property.getValue(); - } - val = property.v * mult; - if (expressionValue.value !== val) { - expressionValue = new Number(val); // eslint-disable-line no-new-wrappers - expressionValue.value = val; - completeProperty(expressionValue, property, 'unidimensional'); - } - return expressionValue; - }; - } - - function MultidimensionalPropertyInterface(property) { - if (!property || !('pv' in property)) { - property = defaultMultidimensionalValue; - } - var mult = 1 / property.mult; - var len = (property.data && property.data.l) || property.pv.length; - var expressionValue = createTypedArray('float32', len); - var arrValue = createTypedArray('float32', len); - expressionValue.value = arrValue; - completeProperty(expressionValue, property, 'multidimensional'); - - return function () { - if (property.k) { - property.getValue(); - } - for (var i = 0; i < len; i += 1) { - arrValue[i] = property.v[i] * mult; - expressionValue[i] = arrValue[i]; - } - return expressionValue; - }; - } - - // TODO: try to avoid using this getter - function defaultGetter() { - return defaultUnidimensionalValue; - } - - return function (property) { - if (!property) { - return defaultGetter; - } if (property.propType === 'unidimensional') { - return UnidimensionalPropertyInterface(property); - } - return MultidimensionalPropertyInterface(property); - }; -}()); - -const TransformExpressionInterface = (function () { - return function (transform) { - function _thisFunction(name) { - switch (name) { - case 'scale': - case 'Scale': - case 'ADBE Scale': - case 6: - return _thisFunction.scale; - case 'rotation': - case 'Rotation': - case 'ADBE Rotation': - case 'ADBE Rotate Z': - case 10: - return _thisFunction.rotation; - case 'ADBE Rotate X': - return _thisFunction.xRotation; - case 'ADBE Rotate Y': - return _thisFunction.yRotation; - case 'position': - case 'Position': - case 'ADBE Position': - case 2: - return _thisFunction.position; - case 'ADBE Position_0': - return _thisFunction.xPosition; - case 'ADBE Position_1': - return _thisFunction.yPosition; - case 'ADBE Position_2': - return _thisFunction.zPosition; - case 'anchorPoint': - case 'AnchorPoint': - case 'Anchor Point': - case 'ADBE AnchorPoint': - case 1: - return _thisFunction.anchorPoint; - case 'opacity': - case 'Opacity': - case 11: - return _thisFunction.opacity; - default: - return null; - } - } - Object.defineProperty(_thisFunction, 'rotation', { - get: ExpressionPropertyInterface(transform.r || transform.rz), - }); - - Object.defineProperty(_thisFunction, 'zRotation', { - get: ExpressionPropertyInterface(transform.rz || transform.r), - }); - - Object.defineProperty(_thisFunction, 'xRotation', { - get: ExpressionPropertyInterface(transform.rx), - }); - - Object.defineProperty(_thisFunction, 'yRotation', { - get: ExpressionPropertyInterface(transform.ry), - }); - Object.defineProperty(_thisFunction, 'scale', { - get: ExpressionPropertyInterface(transform.s), - }); - var _px; - var _py; - var _pz; - var _transformFactory; - if (transform.p) { - _transformFactory = ExpressionPropertyInterface(transform.p); - } else { - _px = ExpressionPropertyInterface(transform.px); - _py = ExpressionPropertyInterface(transform.py); - if (transform.pz) { - _pz = ExpressionPropertyInterface(transform.pz); - } - } - Object.defineProperty(_thisFunction, 'position', { - get: function () { - if (transform.p) { - return _transformFactory(); - } - return [ - _px(), - _py(), - _pz ? _pz() : 0]; - }, - }); - - Object.defineProperty(_thisFunction, 'xPosition', { - get: ExpressionPropertyInterface(transform.px), - }); - - Object.defineProperty(_thisFunction, 'yPosition', { - get: ExpressionPropertyInterface(transform.py), - }); - - Object.defineProperty(_thisFunction, 'zPosition', { - get: ExpressionPropertyInterface(transform.pz), - }); - - Object.defineProperty(_thisFunction, 'anchorPoint', { - get: ExpressionPropertyInterface(transform.a), - }); - - Object.defineProperty(_thisFunction, 'opacity', { - get: ExpressionPropertyInterface(transform.o), - }); - - Object.defineProperty(_thisFunction, 'skew', { - get: ExpressionPropertyInterface(transform.sk), - }); - - Object.defineProperty(_thisFunction, 'skewAxis', { - get: ExpressionPropertyInterface(transform.sa), - }); - - Object.defineProperty(_thisFunction, 'orientation', { - get: ExpressionPropertyInterface(transform.or), - }); - - return _thisFunction; - }; -}()); - -const LayerExpressionInterface = (function () { - function getMatrix(time) { - var toWorldMat = new Matrix(); - if (time !== undefined) { - var propMatrix = this._elem.finalTransform.mProp.getValueAtTime(time); - propMatrix.clone(toWorldMat); - } else { - var transformMat = this._elem.finalTransform.mProp; - transformMat.applyToMatrix(toWorldMat); - } - return toWorldMat; - } - - function toWorldVec(arr, time) { - var toWorldMat = this.getMatrix(time); - toWorldMat.props[12] = 0; - toWorldMat.props[13] = 0; - toWorldMat.props[14] = 0; - return this.applyPoint(toWorldMat, arr); - } - - function toWorld(arr, time) { - var toWorldMat = this.getMatrix(time); - return this.applyPoint(toWorldMat, arr); - } - - function fromWorldVec(arr, time) { - var toWorldMat = this.getMatrix(time); - toWorldMat.props[12] = 0; - toWorldMat.props[13] = 0; - toWorldMat.props[14] = 0; - return this.invertPoint(toWorldMat, arr); - } - - function fromWorld(arr, time) { - var toWorldMat = this.getMatrix(time); - return this.invertPoint(toWorldMat, arr); - } - - function applyPoint(matrix, arr) { - if (this._elem.hierarchy && this._elem.hierarchy.length) { - var i; - var len = this._elem.hierarchy.length; - for (i = 0; i < len; i += 1) { - this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix); - } - } - return matrix.applyToPointArray(arr[0], arr[1], arr[2] || 0); - } - - function invertPoint(matrix, arr) { - if (this._elem.hierarchy && this._elem.hierarchy.length) { - var i; - var len = this._elem.hierarchy.length; - for (i = 0; i < len; i += 1) { - this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(matrix); - } - } - return matrix.inversePoint(arr); - } - - function fromComp(arr) { - var toWorldMat = new Matrix(); - toWorldMat.reset(); - this._elem.finalTransform.mProp.applyToMatrix(toWorldMat); - if (this._elem.hierarchy && this._elem.hierarchy.length) { - var i; - var len = this._elem.hierarchy.length; - for (i = 0; i < len; i += 1) { - this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat); - } - return toWorldMat.inversePoint(arr); - } - return toWorldMat.inversePoint(arr); - } - - function sampleImage() { - return [1, 1, 1, 1]; - } - - return function (elem) { - var transformInterface; - - function _registerMaskInterface(maskManager) { - _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem); - } - function _registerEffectsInterface(effects) { - _thisLayerFunction.effect = effects; - } - - function _thisLayerFunction(name) { - switch (name) { - case 'ADBE Root Vectors Group': - case 'Contents': - case 2: - return _thisLayerFunction.shapeInterface; - case 1: - case 6: - case 'Transform': - case 'transform': - case 'ADBE Transform Group': - return transformInterface; - case 4: - case 'ADBE Effect Parade': - case 'effects': - case 'Effects': - return _thisLayerFunction.effect; - case 'ADBE Text Properties': - return _thisLayerFunction.textInterface; - default: - return null; - } - } - _thisLayerFunction.getMatrix = getMatrix; - _thisLayerFunction.invertPoint = invertPoint; - _thisLayerFunction.applyPoint = applyPoint; - _thisLayerFunction.toWorld = toWorld; - _thisLayerFunction.toWorldVec = toWorldVec; - _thisLayerFunction.fromWorld = fromWorld; - _thisLayerFunction.fromWorldVec = fromWorldVec; - _thisLayerFunction.toComp = toWorld; - _thisLayerFunction.fromComp = fromComp; - _thisLayerFunction.sampleImage = sampleImage; - _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem); - _thisLayerFunction._elem = elem; - transformInterface = TransformExpressionInterface(elem.finalTransform.mProp); - var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint'); - Object.defineProperties(_thisLayerFunction, { - hasParent: { - get: function () { - return elem.hierarchy.length; - }, - }, - parent: { - get: function () { - return elem.hierarchy[0].layerInterface; - }, - }, - rotation: getDescriptor(transformInterface, 'rotation'), - scale: getDescriptor(transformInterface, 'scale'), - position: getDescriptor(transformInterface, 'position'), - opacity: getDescriptor(transformInterface, 'opacity'), - anchorPoint: anchorPointDescriptor, - anchor_point: anchorPointDescriptor, - transform: { - get: function () { - return transformInterface; - }, - }, - active: { - get: function () { - return elem.isInRange; - }, - }, - }); - - _thisLayerFunction.startTime = elem.data.st; - _thisLayerFunction.index = elem.data.ind; - _thisLayerFunction.source = elem.data.refId; - _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100; - _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100; - _thisLayerFunction.inPoint = elem.data.ip / elem.comp.globalData.frameRate; - _thisLayerFunction.outPoint = elem.data.op / elem.comp.globalData.frameRate; - _thisLayerFunction._name = elem.data.nm; - - _thisLayerFunction.registerMaskInterface = _registerMaskInterface; - _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface; - return _thisLayerFunction; - }; -}()); - -const propertyGroupFactory = (function () { - return function (interfaceFunction, parentPropertyGroup) { - return function (val) { - val = val === undefined ? 1 : val; - if (val <= 0) { - return interfaceFunction; - } - return parentPropertyGroup(val - 1); - }; - }; -}()); - -const PropertyInterface = (function () { - return function (propertyName, propertyGroup) { - var interfaceFunction = { - _name: propertyName, - }; - - function _propertyGroup(val) { - val = val === undefined ? 1 : val; - if (val <= 0) { - return interfaceFunction; - } - return propertyGroup(val - 1); - } - - return _propertyGroup; - }; -}()); - -const EffectsExpressionInterface = (function () { - var ob = { - createEffectsInterface: createEffectsInterface, - }; - - function createEffectsInterface(elem, propertyGroup) { - if (elem.effectsManager) { - var effectElements = []; - var effectsData = elem.data.ef; - var i; - var len = elem.effectsManager.effectElements.length; - for (i = 0; i < len; i += 1) { - effectElements.push(createGroupInterface(effectsData[i], elem.effectsManager.effectElements[i], propertyGroup, elem)); - } - - var effects = elem.data.ef || []; - var groupInterface = function (name) { - i = 0; - len = effects.length; - while (i < len) { - if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) { - return effectElements[i]; - } - i += 1; - } - return null; - }; - Object.defineProperty(groupInterface, 'numProperties', { - get: function () { - return effects.length; - }, - }); - return groupInterface; - } - return null; - } - - function createGroupInterface(data, elements, propertyGroup, elem) { - function groupInterface(name) { - var effects = data.ef; - var i = 0; - var len = effects.length; - while (i < len) { - if (name === effects[i].nm || name === effects[i].mn || name === effects[i].ix) { - if (effects[i].ty === 5) { - return effectElements[i]; - } - return effectElements[i](); - } - i += 1; - } - throw new Error(); - } - var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup); - - var effectElements = []; - var i; - var len = data.ef.length; - for (i = 0; i < len; i += 1) { - if (data.ef[i].ty === 5) { - effectElements.push(createGroupInterface(data.ef[i], elements.effectElements[i], elements.effectElements[i].propertyGroup, elem)); - } else { - effectElements.push(createValueInterface(elements.effectElements[i], data.ef[i].ty, elem, _propertyGroup)); - } - } - - if (data.mn === 'ADBE Color Control') { - Object.defineProperty(groupInterface, 'color', { - get: function () { - return effectElements[0](); - }, - }); - } - Object.defineProperties(groupInterface, { - numProperties: { - get: function () { - return data.np; - }, - }, - _name: { value: data.nm }, - propertyGroup: { value: _propertyGroup }, - }); - groupInterface.enabled = data.en !== 0; - groupInterface.active = groupInterface.enabled; - return groupInterface; - } - - function createValueInterface(element, type, elem, propertyGroup) { - var expressionProperty = ExpressionPropertyInterface(element.p); - function interfaceFunction() { - if (type === 10) { - return elem.comp.compInterface(element.p.v); - } - return expressionProperty(); - } - - if (element.p.setGroupProperty) { - element.p.setGroupProperty(PropertyInterface('', propertyGroup)); - } - - return interfaceFunction; - } - - return ob; -}()); - -const CompExpressionInterface = (function () { - return function (comp) { - function _thisLayerFunction(name) { - var i = 0; - var len = comp.layers.length; - while (i < len) { - if (comp.layers[i].nm === name || comp.layers[i].ind === name) { - return comp.elements[i].layerInterface; - } - i += 1; - } - return null; - // return {active:false}; - } - Object.defineProperty(_thisLayerFunction, '_name', { value: comp.data.nm }); - _thisLayerFunction.layer = _thisLayerFunction; - _thisLayerFunction.pixelAspect = 1; - _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h; - _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w; - _thisLayerFunction.pixelAspect = 1; - _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate; - _thisLayerFunction.displayStartTime = 0; - _thisLayerFunction.numLayers = comp.layers.length; - return _thisLayerFunction; - }; -}()); - -const ShapePathInterface = ( - - function () { - return function pathInterfaceFactory(shape, view, propertyGroup) { - var prop = view.sh; - - function interfaceFunction(val) { - if (val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2) { - return interfaceFunction.path; - } - return null; - } - - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - prop.setGroupProperty(PropertyInterface('Path', _propertyGroup)); - Object.defineProperties(interfaceFunction, { - path: { - get: function () { - if (prop.k) { - prop.getValue(); - } - return prop; - }, - }, - shape: { - get: function () { - if (prop.k) { - prop.getValue(); - } - return prop; - }, - }, - _name: { value: shape.nm }, - ix: { value: shape.ix }, - propertyIndex: { value: shape.ix }, - mn: { value: shape.mn }, - propertyGroup: { value: propertyGroup }, - }); - return interfaceFunction; - }; - }() -); - -const ShapeExpressionInterface = (function () { - function iterateElements(shapes, view, propertyGroup) { - var arr = []; - var i; - var len = shapes ? shapes.length : 0; - for (i = 0; i < len; i += 1) { - if (shapes[i].ty === 'gr') { - arr.push(groupInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'fl') { - arr.push(fillInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'st') { - arr.push(strokeInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'tm') { - arr.push(trimInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'tr') { - // arr.push(transformInterfaceFactory(shapes[i],view[i],propertyGroup)); - } else if (shapes[i].ty === 'el') { - arr.push(ellipseInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'sr') { - arr.push(starInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'sh') { - arr.push(ShapePathInterface(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'rc') { - arr.push(rectInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'rd') { - arr.push(roundedInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'rp') { - arr.push(repeaterInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else if (shapes[i].ty === 'gf') { - arr.push(gradientFillInterfaceFactory(shapes[i], view[i], propertyGroup)); - } else { - arr.push(defaultInterfaceFactory(shapes[i], view[i], propertyGroup)); - } - } - return arr; - } - - function contentsInterfaceFactory(shape, view, propertyGroup) { - var interfaces; - var interfaceFunction = function _interfaceFunction(value) { - var i = 0; - var len = interfaces.length; - while (i < len) { - if (interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value) { - return interfaces[i]; - } - i += 1; - } - if (typeof value === 'number') { - return interfaces[value - 1]; - } - return null; - }; - - interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup); - interfaceFunction.numProperties = interfaces.length; - var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup); - interfaceFunction.transform = transformInterface; - interfaceFunction.propertyIndex = shape.cix; - interfaceFunction._name = shape.nm; - - return interfaceFunction; - } - - function groupInterfaceFactory(shape, view, propertyGroup) { - var interfaceFunction = function _interfaceFunction(value) { - switch (value) { - case 'ADBE Vectors Group': - case 'Contents': - case 2: - return interfaceFunction.content; - // Not necessary for now. Keeping them here in case a new case appears - // case 'ADBE Vector Transform Group': - // case 3: - default: - return interfaceFunction.transform; - } - }; - interfaceFunction.propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - var content = contentsInterfaceFactory(shape, view, interfaceFunction.propertyGroup); - var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1], view.it[view.it.length - 1], interfaceFunction.propertyGroup); - interfaceFunction.content = content; - interfaceFunction.transform = transformInterface; - Object.defineProperty(interfaceFunction, '_name', { - get: function () { - return shape.nm; - }, - }); - // interfaceFunction.content = interfaceFunction; - interfaceFunction.numProperties = shape.np; - interfaceFunction.propertyIndex = shape.ix; - interfaceFunction.nm = shape.nm; - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function fillInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(val) { - if (val === 'Color' || val === 'color') { - return interfaceFunction.color; - } if (val === 'Opacity' || val === 'opacity') { - return interfaceFunction.opacity; - } - return null; - } - Object.defineProperties(interfaceFunction, { - color: { - get: ExpressionPropertyInterface(view.c), - }, - opacity: { - get: ExpressionPropertyInterface(view.o), - }, - _name: { value: shape.nm }, - mn: { value: shape.mn }, - }); - - view.c.setGroupProperty(PropertyInterface('Color', propertyGroup)); - view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup)); - return interfaceFunction; - } - - function gradientFillInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(val) { - if (val === 'Start Point' || val === 'start point') { - return interfaceFunction.startPoint; - } - if (val === 'End Point' || val === 'end point') { - return interfaceFunction.endPoint; - } - if (val === 'Opacity' || val === 'opacity') { - return interfaceFunction.opacity; - } - return null; - } - Object.defineProperties(interfaceFunction, { - startPoint: { - get: ExpressionPropertyInterface(view.s), - }, - endPoint: { - get: ExpressionPropertyInterface(view.e), - }, - opacity: { - get: ExpressionPropertyInterface(view.o), - }, - type: { - get: function () { - return 'a'; - }, - }, - _name: { value: shape.nm }, - mn: { value: shape.mn }, - }); - - view.s.setGroupProperty(PropertyInterface('Start Point', propertyGroup)); - view.e.setGroupProperty(PropertyInterface('End Point', propertyGroup)); - view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup)); - return interfaceFunction; - } - function defaultInterfaceFactory() { - function interfaceFunction() { - return null; - } - return interfaceFunction; - } - - function strokeInterfaceFactory(shape, view, propertyGroup) { - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - var _dashPropertyGroup = propertyGroupFactory(dashOb, _propertyGroup); - function addPropertyToDashOb(i) { - Object.defineProperty(dashOb, shape.d[i].nm, { - get: ExpressionPropertyInterface(view.d.dataProps[i].p), - }); - } - var i; - var len = shape.d ? shape.d.length : 0; - var dashOb = {}; - for (i = 0; i < len; i += 1) { - addPropertyToDashOb(i); - view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup); - } - - function interfaceFunction(val) { - if (val === 'Color' || val === 'color') { - return interfaceFunction.color; - } if (val === 'Opacity' || val === 'opacity') { - return interfaceFunction.opacity; - } if (val === 'Stroke Width' || val === 'stroke width') { - return interfaceFunction.strokeWidth; - } - return null; - } - Object.defineProperties(interfaceFunction, { - color: { - get: ExpressionPropertyInterface(view.c), - }, - opacity: { - get: ExpressionPropertyInterface(view.o), - }, - strokeWidth: { - get: ExpressionPropertyInterface(view.w), - }, - dash: { - get: function () { - return dashOb; - }, - }, - _name: { value: shape.nm }, - mn: { value: shape.mn }, - }); - - view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup)); - view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); - view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup)); - return interfaceFunction; - } - - function trimInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(val) { - if (val === shape.e.ix || val === 'End' || val === 'end') { - return interfaceFunction.end; - } - if (val === shape.s.ix) { - return interfaceFunction.start; - } - if (val === shape.o.ix) { - return interfaceFunction.offset; - } - return null; - } - - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - interfaceFunction.propertyIndex = shape.ix; - - view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup)); - view.e.setGroupProperty(PropertyInterface('End', _propertyGroup)); - view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup)); - interfaceFunction.propertyIndex = shape.ix; - interfaceFunction.propertyGroup = propertyGroup; - - Object.defineProperties(interfaceFunction, { - start: { - get: ExpressionPropertyInterface(view.s), - }, - end: { - get: ExpressionPropertyInterface(view.e), - }, - offset: { - get: ExpressionPropertyInterface(view.o), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function transformInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.a.ix === value || value === 'Anchor Point') { - return interfaceFunction.anchorPoint; - } - if (shape.o.ix === value || value === 'Opacity') { - return interfaceFunction.opacity; - } - if (shape.p.ix === value || value === 'Position') { - return interfaceFunction.position; - } - if (shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation') { - return interfaceFunction.rotation; - } - if (shape.s.ix === value || value === 'Scale') { - return interfaceFunction.scale; - } - if ((shape.sk && shape.sk.ix === value) || value === 'Skew') { - return interfaceFunction.skew; - } - if ((shape.sa && shape.sa.ix === value) || value === 'Skew Axis') { - return interfaceFunction.skewAxis; - } - return null; - } - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); - view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); - view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup)); - view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup)); - view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); - if (view.transform.mProps.sk) { - view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup)); - view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup)); - } - view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup)); - Object.defineProperties(interfaceFunction, { - opacity: { - get: ExpressionPropertyInterface(view.transform.mProps.o), - }, - position: { - get: ExpressionPropertyInterface(view.transform.mProps.p), - }, - anchorPoint: { - get: ExpressionPropertyInterface(view.transform.mProps.a), - }, - scale: { - get: ExpressionPropertyInterface(view.transform.mProps.s), - }, - rotation: { - get: ExpressionPropertyInterface(view.transform.mProps.r), - }, - skew: { - get: ExpressionPropertyInterface(view.transform.mProps.sk), - }, - skewAxis: { - get: ExpressionPropertyInterface(view.transform.mProps.sa), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.ty = 'tr'; - interfaceFunction.mn = shape.mn; - interfaceFunction.propertyGroup = propertyGroup; - return interfaceFunction; - } - - function ellipseInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.p.ix === value) { - return interfaceFunction.position; - } - if (shape.s.ix === value) { - return interfaceFunction.size; - } - return null; - } - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - interfaceFunction.propertyIndex = shape.ix; - var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh; - prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup)); - prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); - - Object.defineProperties(interfaceFunction, { - size: { - get: ExpressionPropertyInterface(prop.s), - }, - position: { - get: ExpressionPropertyInterface(prop.p), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function starInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.p.ix === value) { - return interfaceFunction.position; - } - if (shape.r.ix === value) { - return interfaceFunction.rotation; - } - if (shape.pt.ix === value) { - return interfaceFunction.points; - } - if (shape.or.ix === value || value === 'ADBE Vector Star Outer Radius') { - return interfaceFunction.outerRadius; - } - if (shape.os.ix === value) { - return interfaceFunction.outerRoundness; - } - if (shape.ir && (shape.ir.ix === value || value === 'ADBE Vector Star Inner Radius')) { - return interfaceFunction.innerRadius; - } - if (shape.is && shape.is.ix === value) { - return interfaceFunction.innerRoundness; - } - return null; - } - - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh; - interfaceFunction.propertyIndex = shape.ix; - prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup)); - prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup)); - prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup)); - prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); - prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); - if (shape.ir) { - prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup)); - prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup)); - } - - Object.defineProperties(interfaceFunction, { - position: { - get: ExpressionPropertyInterface(prop.p), - }, - rotation: { - get: ExpressionPropertyInterface(prop.r), - }, - points: { - get: ExpressionPropertyInterface(prop.pt), - }, - outerRadius: { - get: ExpressionPropertyInterface(prop.or), - }, - outerRoundness: { - get: ExpressionPropertyInterface(prop.os), - }, - innerRadius: { - get: ExpressionPropertyInterface(prop.ir), - }, - innerRoundness: { - get: ExpressionPropertyInterface(prop.is), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function rectInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.p.ix === value) { - return interfaceFunction.position; - } - if (shape.r.ix === value) { - return interfaceFunction.roundness; - } - if (shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size') { - return interfaceFunction.size; - } - return null; - } - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - - var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh; - interfaceFunction.propertyIndex = shape.ix; - prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup)); - prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup)); - prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup)); - - Object.defineProperties(interfaceFunction, { - position: { - get: ExpressionPropertyInterface(prop.p), - }, - roundness: { - get: ExpressionPropertyInterface(prop.r), - }, - size: { - get: ExpressionPropertyInterface(prop.s), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function roundedInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.r.ix === value || value === 'Round Corners 1') { - return interfaceFunction.radius; - } - return null; - } - - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - var prop = view; - interfaceFunction.propertyIndex = shape.ix; - prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup)); - - Object.defineProperties(interfaceFunction, { - radius: { - get: ExpressionPropertyInterface(prop.rd), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - function repeaterInterfaceFactory(shape, view, propertyGroup) { - function interfaceFunction(value) { - if (shape.c.ix === value || value === 'Copies') { - return interfaceFunction.copies; - } if (shape.o.ix === value || value === 'Offset') { - return interfaceFunction.offset; - } - return null; - } - - var _propertyGroup = propertyGroupFactory(interfaceFunction, propertyGroup); - var prop = view; - interfaceFunction.propertyIndex = shape.ix; - prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup)); - prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup)); - Object.defineProperties(interfaceFunction, { - copies: { - get: ExpressionPropertyInterface(prop.c), - }, - offset: { - get: ExpressionPropertyInterface(prop.o), - }, - _name: { value: shape.nm }, - }); - interfaceFunction.mn = shape.mn; - return interfaceFunction; - } - - return function (shapes, view, propertyGroup) { - var interfaces; - function _interfaceFunction(value) { - if (typeof value === 'number') { - value = value === undefined ? 1 : value; - if (value === 0) { - return propertyGroup; - } - return interfaces[value - 1]; - } - var i = 0; - var len = interfaces.length; - while (i < len) { - if (interfaces[i]._name === value) { - return interfaces[i]; - } - i += 1; - } - return null; - } - function parentGroupWrapper() { - return propertyGroup; - } - _interfaceFunction.propertyGroup = propertyGroupFactory(_interfaceFunction, parentGroupWrapper); - interfaces = iterateElements(shapes, view, _interfaceFunction.propertyGroup); - _interfaceFunction.numProperties = interfaces.length; - _interfaceFunction._name = 'Contents'; - return _interfaceFunction; - }; -}()); - -const TextExpressionInterface = (function () { - return function (elem) { - var _prevValue; - var _sourceText; - function _thisLayerFunction(name) { - switch (name) { - case 'ADBE Text Document': - return _thisLayerFunction.sourceText; - default: - return null; - } - } - Object.defineProperty(_thisLayerFunction, 'sourceText', { - get: function () { - elem.textProperty.getValue(); - var stringValue = elem.textProperty.currentData.t; - if (stringValue !== _prevValue) { - elem.textProperty.currentData.t = _prevValue; - _sourceText = new String(stringValue); // eslint-disable-line no-new-wrappers - // If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive - _sourceText.value = stringValue || new String(stringValue); // eslint-disable-line no-new-wrappers - } - return _sourceText; - }, - }); - return _thisLayerFunction; - }; -}()); - -const getBlendMode = (function () { - var blendModeEnums = { - 0: 'source-over', - 1: 'multiply', - 2: 'screen', - 3: 'overlay', - 4: 'darken', - 5: 'lighten', - 6: 'color-dodge', - 7: 'color-burn', - 8: 'hard-light', - 9: 'soft-light', - 10: 'difference', - 11: 'exclusion', - 12: 'hue', - 13: 'saturation', - 14: 'color', - 15: 'luminosity', - }; - - return function (mode) { - return blendModeEnums[mode] || ''; - }; -}()); - -function SliderEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); -} -function AngleEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); -} -function ColorEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container); -} -function PointEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 1, 0, container); -} -function LayerIndexEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); -} -function MaskIndexEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); -} -function CheckboxEffect(data, elem, container) { - this.p = PropertyFactory.getProp(elem, data.v, 0, 0, container); -} -function NoValueEffect() { - this.p = {}; -} - -function EffectsManager(data, element) { - var effects = data.ef || []; - this.effectElements = []; - var i; - var len = effects.length; - var effectItem; - for (i = 0; i < len; i += 1) { - effectItem = new GroupEffect(effects[i], element); - this.effectElements.push(effectItem); - } -} - -function GroupEffect(data, element) { - this.init(data, element); -} - -extendPrototype([DynamicPropertyContainer], GroupEffect); - -GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties; - -GroupEffect.prototype.init = function (data, element) { - this.data = data; - this.effectElements = []; - this.initDynamicPropertyContainer(element); - var i; - var len = this.data.ef.length; - var eff; - var effects = this.data.ef; - for (i = 0; i < len; i += 1) { - eff = null; - switch (effects[i].ty) { - case 0: - eff = new SliderEffect(effects[i], element, this); - break; - case 1: - eff = new AngleEffect(effects[i], element, this); - break; - case 2: - eff = new ColorEffect(effects[i], element, this); - break; - case 3: - eff = new PointEffect(effects[i], element, this); - break; - case 4: - case 7: - eff = new CheckboxEffect(effects[i], element, this); - break; - case 10: - eff = new LayerIndexEffect(effects[i], element, this); - break; - case 11: - eff = new MaskIndexEffect(effects[i], element, this); - break; - case 5: - eff = new EffectsManager(effects[i], element, this); - break; - // case 6: - default: - eff = new NoValueEffect(effects[i], element, this); - break; - } - if (eff) { - this.effectElements.push(eff); - } - } -}; - -function BaseElement() { -} - -BaseElement.prototype = { - checkMasks: function () { - if (!this.data.hasMask) { - return false; - } - var i = 0; - var len = this.data.masksProperties.length; - while (i < len) { - if ((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) { - return true; - } - i += 1; - } - return false; - }, - initExpressions: function () { - this.layerInterface = LayerExpressionInterface(this); - if (this.data.hasMask && this.maskManager) { - this.layerInterface.registerMaskInterface(this.maskManager); - } - var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this, this.layerInterface); - this.layerInterface.registerEffectsInterface(effectsInterface); - - if (this.data.ty === 0 || this.data.xt) { - this.compInterface = CompExpressionInterface(this); - } else if (this.data.ty === 4) { - this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData, this.itemsData, this.layerInterface); - this.layerInterface.content = this.layerInterface.shapeInterface; - } else if (this.data.ty === 5) { - this.layerInterface.textInterface = TextExpressionInterface(this); - this.layerInterface.text = this.layerInterface.textInterface; - } - }, - setBlendMode: function () { - var blendModeValue = getBlendMode(this.data.bm); - var elem = this.baseElement || this.layerElement; - - elem.style['mix-blend-mode'] = blendModeValue; - }, - initBaseData: function (data, globalData, comp) { - this.globalData = globalData; - this.comp = comp; - this.data = data; - this.layerId = createElementID(); - - // Stretch factor for old animations missing this property. - if (!this.data.sr) { - this.data.sr = 1; - } - // effects manager - this.effectsManager = new EffectsManager(this.data, this, this.dynamicProperties); - }, - getType: function () { - return this.type; - }, - sourceRectAtTime: function () {}, -}; - -/** - * @file - * Handles element's layer frame update. - * Checks layer in point and out point - * - */ - -function FrameElement() {} - -FrameElement.prototype = { - /** - * @function - * Initializes frame related properties. - * - */ - initFrame: function () { - // set to true when inpoint is rendered - this._isFirstFrame = false; - // list of animated properties - this.dynamicProperties = []; - // If layer has been modified in current tick this will be true - this._mdf = false; - }, - /** - * @function - * Calculates all dynamic values - * - * @param {number} num - * current frame number in Layer's time - * @param {boolean} isVisible - * if layers is currently in range - * - */ - prepareProperties: function (num, isVisible) { - var i; - var len = this.dynamicProperties.length; - for (i = 0; i < len; i += 1) { - if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) { - this.dynamicProperties[i].getValue(); - if (this.dynamicProperties[i]._mdf) { - this.globalData._mdf = true; - this._mdf = true; - } - } - } - }, - addDynamicProperty: function (prop) { - if (this.dynamicProperties.indexOf(prop) === -1) { - this.dynamicProperties.push(prop); - } - }, -}; - -const FootageInterface = (function () { - var outlineInterfaceFactory = (function (elem) { - var currentPropertyName = ''; - var currentProperty = elem.getFootageData(); - function init() { - currentPropertyName = ''; - currentProperty = elem.getFootageData(); - return searchProperty; - } - function searchProperty(value) { - if (currentProperty[value]) { - currentPropertyName = value; - currentProperty = currentProperty[value]; - if (typeof currentProperty === 'object') { - return searchProperty; - } - return currentProperty; - } - var propertyNameIndex = value.indexOf(currentPropertyName); - if (propertyNameIndex !== -1) { - var index = parseInt(value.substr(propertyNameIndex + currentPropertyName.length), 10); - currentProperty = currentProperty[index]; - if (typeof currentProperty === 'object') { - return searchProperty; - } - return currentProperty; - } - return ''; - } - return init; - }); - - var dataInterfaceFactory = function (elem) { - function interfaceFunction(value) { - if (value === 'Outline') { - return interfaceFunction.outlineInterface(); - } - return null; - } - - interfaceFunction._name = 'Outline'; - interfaceFunction.outlineInterface = outlineInterfaceFactory(elem); - return interfaceFunction; - }; - - return function (elem) { - function _interfaceFunction(value) { - if (value === 'Data') { - return _interfaceFunction.dataInterface; - } - return null; - } - - _interfaceFunction._name = 'Data'; - _interfaceFunction.dataInterface = dataInterfaceFactory(elem); - return _interfaceFunction; - }; -}()); - -function FootageElement(data, globalData, comp) { - this.initFrame(); - this.initRenderable(); - this.assetData = globalData.getAssetData(data.refId); - this.footageData = globalData.imageLoader.getAsset(this.assetData); - this.initBaseData(data, globalData, comp); -} - -FootageElement.prototype.prepareFrame = function () { -}; - -extendPrototype([RenderableElement, BaseElement, FrameElement], FootageElement); - -FootageElement.prototype.getBaseElement = function () { - return null; -}; - -FootageElement.prototype.renderFrame = function () { -}; - -FootageElement.prototype.destroy = function () { -}; - -FootageElement.prototype.initExpressions = function () { - this.layerInterface = FootageInterface(this); -}; - -FootageElement.prototype.getFootageData = function () { - return this.footageData; -}; - -function AudioElement(data, globalData, comp) { - this.initFrame(); - this.initRenderable(); - this.assetData = globalData.getAssetData(data.refId); - this.initBaseData(data, globalData, comp); - this._isPlaying = false; - this._canPlay = false; - var assetPath = this.globalData.getAssetsPath(this.assetData); - this.audio = this.globalData.audioController.createAudio(assetPath); - this._currentTime = 0; - this.globalData.audioController.addAudio(this); - this._volumeMultiplier = 1; - this._volume = 1; - this._previousVolume = null; - this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }; - this.lv = PropertyFactory.getProp(this, data.au && data.au.lv ? data.au.lv : { k: [100] }, 1, 0.01, this); -} - -AudioElement.prototype.prepareFrame = function (num) { - this.prepareRenderableFrame(num, true); - this.prepareProperties(num, true); - if (!this.tm._placeholder) { - var timeRemapped = this.tm.v; - this._currentTime = timeRemapped; - } else { - this._currentTime = num / this.data.sr; - } - this._volume = this.lv.v[0]; - var totalVolume = this._volume * this._volumeMultiplier; - if (this._previousVolume !== totalVolume) { - this._previousVolume = totalVolume; - this.audio.volume(totalVolume); - } -}; - -extendPrototype([RenderableElement, BaseElement, FrameElement], AudioElement); - -AudioElement.prototype.renderFrame = function () { - if (this.isInRange && this._canPlay) { - if (!this._isPlaying) { - this.audio.play(); - this.audio.seek(this._currentTime / this.globalData.frameRate); - this._isPlaying = true; - } else if (!this.audio.playing() - || Math.abs(this._currentTime / this.globalData.frameRate - this.audio.seek()) > 0.1 - ) { - this.audio.seek(this._currentTime / this.globalData.frameRate); - } - } -}; - -AudioElement.prototype.show = function () { - // this.audio.play() -}; - -AudioElement.prototype.hide = function () { - this.audio.pause(); - this._isPlaying = false; -}; - -AudioElement.prototype.pause = function () { - this.audio.pause(); - this._isPlaying = false; - this._canPlay = false; -}; - -AudioElement.prototype.resume = function () { - this._canPlay = true; -}; - -AudioElement.prototype.setRate = function (rateValue) { - this.audio.rate(rateValue); -}; - -AudioElement.prototype.volume = function (volumeValue) { - this._volumeMultiplier = volumeValue; - this._previousVolume = volumeValue * this._volume; - this.audio.volume(this._previousVolume); -}; - -AudioElement.prototype.getBaseElement = function () { - return null; -}; - -AudioElement.prototype.destroy = function () { -}; - -AudioElement.prototype.sourceRectAtTime = function () { -}; - -AudioElement.prototype.initExpressions = function () { -}; - -function BaseRenderer() {} -BaseRenderer.prototype.checkLayers = function (num) { - var i; - var len = this.layers.length; - var data; - this.completeLayers = true; - for (i = len - 1; i >= 0; i -= 1) { - if (!this.elements[i]) { - data = this.layers[i]; - if (data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st)) { - this.buildItem(i); - } - } - this.completeLayers = this.elements[i] ? this.completeLayers : false; - } - this.checkPendingElements(); -}; - -BaseRenderer.prototype.createItem = function (layer) { - switch (layer.ty) { - case 2: - return this.createImage(layer); - case 0: - return this.createComp(layer); - case 1: - return this.createSolid(layer); - case 3: - return this.createNull(layer); - case 4: - return this.createShape(layer); - case 5: - return this.createText(layer); - case 6: - return this.createAudio(layer); - case 13: - return this.createCamera(layer); - case 15: - return this.createFootage(layer); - default: - return this.createNull(layer); - } -}; - -BaseRenderer.prototype.createCamera = function () { - throw new Error('You\'re using a 3d camera. Try the html renderer.'); -}; - -BaseRenderer.prototype.createAudio = function (data) { - return new AudioElement(data, this.globalData, this); -}; - -BaseRenderer.prototype.createFootage = function (data) { - return new FootageElement(data, this.globalData, this); -}; - -BaseRenderer.prototype.buildAllItems = function () { - var i; - var len = this.layers.length; - for (i = 0; i < len; i += 1) { - this.buildItem(i); - } - this.checkPendingElements(); -}; - -BaseRenderer.prototype.includeLayers = function (newLayers) { - this.completeLayers = false; - var i; - var len = newLayers.length; - var j; - var jLen = this.layers.length; - for (i = 0; i < len; i += 1) { - j = 0; - while (j < jLen) { - if (this.layers[j].id === newLayers[i].id) { - this.layers[j] = newLayers[i]; - break; - } - j += 1; - } - } -}; - -BaseRenderer.prototype.setProjectInterface = function (pInterface) { - this.globalData.projectInterface = pInterface; -}; - -BaseRenderer.prototype.initItems = function () { - if (!this.globalData.progressiveLoad) { - this.buildAllItems(); - } -}; -BaseRenderer.prototype.buildElementParenting = function (element, parentName, hierarchy) { - var elements = this.elements; - var layers = this.layers; - var i = 0; - var len = layers.length; - while (i < len) { - if (layers[i].ind == parentName) { // eslint-disable-line eqeqeq - if (!elements[i] || elements[i] === true) { - this.buildItem(i); - this.addPendingElement(element); - } else { - hierarchy.push(elements[i]); - elements[i].setAsParent(); - if (layers[i].parent !== undefined) { - this.buildElementParenting(element, layers[i].parent, hierarchy); - } else { - element.setHierarchy(hierarchy); - } - } - } - i += 1; - } -}; - -BaseRenderer.prototype.addPendingElement = function (element) { - this.pendingElements.push(element); -}; - -BaseRenderer.prototype.searchExtraCompositions = function (assets) { - var i; - var len = assets.length; - for (i = 0; i < len; i += 1) { - if (assets[i].xt) { - var comp = this.createComp(assets[i]); - comp.initExpressions(); - this.globalData.projectInterface.registerComposition(comp); - } - } -}; - -BaseRenderer.prototype.getElementByPath = function (path) { - var pathValue = path.shift(); - var element; - if (typeof pathValue === 'number') { - element = this.elements[pathValue]; - } else { - var i; - var len = this.elements.length; - for (i = 0; i < len; i += 1) { - if (this.elements[i].data.nm === pathValue) { - element = this.elements[i]; - break; - } - } - } - if (path.length === 0) { - return element; - } - return element.getElementByPath(path); -}; - -BaseRenderer.prototype.setupGlobalData = function (animData, fontsContainer) { - this.globalData.fontManager = new FontManager(); - this.globalData.fontManager.addChars(animData.chars); - this.globalData.fontManager.addFonts(animData.fonts, fontsContainer); - this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem); - this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem); - this.globalData.imageLoader = this.animationItem.imagePreloader; - this.globalData.audioController = this.animationItem.audioController; - this.globalData.frameId = 0; - this.globalData.frameRate = animData.fr; - this.globalData.nm = animData.nm; - this.globalData.compSize = { - w: animData.w, - h: animData.h, - }; -}; - -function TransformElement() {} - -TransformElement.prototype = { - initTransform: function () { - this.finalTransform = { - mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : { o: 0 }, - _matMdf: false, - _opMdf: false, - mat: new Matrix(), - }; - if (this.data.ao) { - this.finalTransform.mProp.autoOriented = true; - } - - // TODO: check TYPE 11: Guided elements - if (this.data.ty !== 11) { - // this.createElements(); - } - }, - renderTransform: function () { - this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame; - this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame; - - if (this.hierarchy) { - var mat; - var finalMat = this.finalTransform.mat; - var i = 0; - var len = this.hierarchy.length; - // Checking if any of the transformation matrices in the hierarchy chain has changed. - if (!this.finalTransform._matMdf) { - while (i < len) { - if (this.hierarchy[i].finalTransform.mProp._mdf) { - this.finalTransform._matMdf = true; - break; - } - i += 1; - } - } - - if (this.finalTransform._matMdf) { - mat = this.finalTransform.mProp.v.props; - finalMat.cloneFromProps(mat); - for (i = 0; i < len; i += 1) { - mat = this.hierarchy[i].finalTransform.mProp.v.props; - finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]); - } - } - } - }, - globalToLocal: function (pt) { - var transforms = []; - transforms.push(this.finalTransform); - var flag = true; - var comp = this.comp; - while (flag) { - if (comp.finalTransform) { - if (comp.data.hasMask) { - transforms.splice(0, 0, comp.finalTransform); - } - comp = comp.comp; - } else { - flag = false; - } - } - var i; - var len = transforms.length; - var ptNew; - for (i = 0; i < len; i += 1) { - ptNew = transforms[i].mat.applyToPointArray(0, 0, 0); - // ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]); - pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0]; - } - return pt; - }, - mHelper: new Matrix(), -}; - -function MaskElement(data, element, globalData) { - this.data = data; - this.element = element; - this.globalData = globalData; - this.storedData = []; - this.masksProperties = this.data.masksProperties || []; - this.maskElement = null; - var defs = this.globalData.defs; - var i; - var len = this.masksProperties ? this.masksProperties.length : 0; - this.viewData = createSizedArray(len); - this.solidPath = ''; - - var path; - var properties = this.masksProperties; - var count = 0; - var currentMasks = []; - var j; - var jLen; - var layerId = createElementID(); - var rect; - var expansor; - var feMorph; - var x; - var maskType = 'clipPath'; - var maskRef = 'clip-path'; - for (i = 0; i < len; i += 1) { - if ((properties[i].mode !== 'a' && properties[i].mode !== 'n') || properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x) { - maskType = 'mask'; - maskRef = 'mask'; - } - - if ((properties[i].mode === 's' || properties[i].mode === 'i') && count === 0) { - rect = createNS('rect'); - rect.setAttribute('fill', '#ffffff'); - rect.setAttribute('width', this.element.comp.data.w || 0); - rect.setAttribute('height', this.element.comp.data.h || 0); - currentMasks.push(rect); - } else { - rect = null; - } - - path = createNS('path'); - if (properties[i].mode === 'n') { - // TODO move this to a factory or to a constructor - this.viewData[i] = { - op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element), - prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3), - elem: path, - lastPath: '', - }; - defs.appendChild(path); - } else { - count += 1; - - path.setAttribute('fill', properties[i].mode === 's' ? '#000000' : '#ffffff'); - path.setAttribute('clip-rule', 'nonzero'); - var filterID; - - if (properties[i].x.k !== 0) { - maskType = 'mask'; - maskRef = 'mask'; - x = PropertyFactory.getProp(this.element, properties[i].x, 0, null, this.element); - filterID = createElementID(); - expansor = createNS('filter'); - expansor.setAttribute('id', filterID); - feMorph = createNS('feMorphology'); - feMorph.setAttribute('operator', 'erode'); - feMorph.setAttribute('in', 'SourceGraphic'); - feMorph.setAttribute('radius', '0'); - expansor.appendChild(feMorph); - defs.appendChild(expansor); - path.setAttribute('stroke', properties[i].mode === 's' ? '#000000' : '#ffffff'); - } else { - feMorph = null; - x = null; - } - - // TODO move this to a factory or to a constructor - this.storedData[i] = { - elem: path, - x: x, - expan: feMorph, - lastPath: '', - lastOperator: '', - filterId: filterID, - lastRadius: 0, - }; - if (properties[i].mode === 'i') { - jLen = currentMasks.length; - var g = createNS('g'); - for (j = 0; j < jLen; j += 1) { - g.appendChild(currentMasks[j]); - } - var mask = createNS('mask'); - mask.setAttribute('mask-type', 'alpha'); - mask.setAttribute('id', layerId + '_' + count); - mask.appendChild(path); - defs.appendChild(mask); - g.setAttribute('mask', 'url(' + getLocationHref() + '#' + layerId + '_' + count + ')'); - - currentMasks.length = 0; - currentMasks.push(g); - } else { - currentMasks.push(path); - } - if (properties[i].inv && !this.solidPath) { - this.solidPath = this.createLayerSolidPath(); - } - // TODO move this to a factory or to a constructor - this.viewData[i] = { - elem: path, - lastPath: '', - op: PropertyFactory.getProp(this.element, properties[i].o, 0, 0.01, this.element), - prop: ShapePropertyFactory.getShapeProp(this.element, properties[i], 3), - invRect: rect, - }; - if (!this.viewData[i].prop.k) { - this.drawPath(properties[i], this.viewData[i].prop.v, this.viewData[i]); - } - } - } - - this.maskElement = createNS(maskType); - - len = currentMasks.length; - for (i = 0; i < len; i += 1) { - this.maskElement.appendChild(currentMasks[i]); - } - - if (count > 0) { - this.maskElement.setAttribute('id', layerId); - this.element.maskedElement.setAttribute(maskRef, 'url(' + getLocationHref() + '#' + layerId + ')'); - defs.appendChild(this.maskElement); - } - if (this.viewData.length) { - this.element.addRenderableComponent(this); - } -} - -MaskElement.prototype.getMaskProperty = function (pos) { - return this.viewData[pos].prop; -}; - -MaskElement.prototype.renderFrame = function (isFirstFrame) { - var finalMat = this.element.finalTransform.mat; - var i; - var len = this.masksProperties.length; - for (i = 0; i < len; i += 1) { - if (this.viewData[i].prop._mdf || isFirstFrame) { - this.drawPath(this.masksProperties[i], this.viewData[i].prop.v, this.viewData[i]); - } - if (this.viewData[i].op._mdf || isFirstFrame) { - this.viewData[i].elem.setAttribute('fill-opacity', this.viewData[i].op.v); - } - if (this.masksProperties[i].mode !== 'n') { - if (this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)) { - this.viewData[i].invRect.setAttribute('transform', finalMat.getInverseMatrix().to2dCSS()); - } - if (this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)) { - var feMorph = this.storedData[i].expan; - if (this.storedData[i].x.v < 0) { - if (this.storedData[i].lastOperator !== 'erode') { - this.storedData[i].lastOperator = 'erode'; - this.storedData[i].elem.setAttribute('filter', 'url(' + getLocationHref() + '#' + this.storedData[i].filterId + ')'); - } - feMorph.setAttribute('radius', -this.storedData[i].x.v); - } else { - if (this.storedData[i].lastOperator !== 'dilate') { - this.storedData[i].lastOperator = 'dilate'; - this.storedData[i].elem.setAttribute('filter', null); - } - this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v * 2); - } - } - } - } -}; - -MaskElement.prototype.getMaskelement = function () { - return this.maskElement; -}; - -MaskElement.prototype.createLayerSolidPath = function () { - var path = 'M0,0 '; - path += ' h' + this.globalData.compSize.w; - path += ' v' + this.globalData.compSize.h; - path += ' h-' + this.globalData.compSize.w; - path += ' v-' + this.globalData.compSize.h + ' '; - return path; -}; - -MaskElement.prototype.drawPath = function (pathData, pathNodes, viewData) { - var pathString = ' M' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]; - var i; - var len; - len = pathNodes._length; - for (i = 1; i < len; i += 1) { - // pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1]; - pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[i][0] + ',' + pathNodes.i[i][1] + ' ' + pathNodes.v[i][0] + ',' + pathNodes.v[i][1]; - } - // pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1]; - if (pathNodes.c && len > 1) { - pathString += ' C' + pathNodes.o[i - 1][0] + ',' + pathNodes.o[i - 1][1] + ' ' + pathNodes.i[0][0] + ',' + pathNodes.i[0][1] + ' ' + pathNodes.v[0][0] + ',' + pathNodes.v[0][1]; - } - // pathNodes.__renderedString = pathString; - - if (viewData.lastPath !== pathString) { - var pathShapeValue = ''; - if (viewData.elem) { - if (pathNodes.c) { - pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString; - } - viewData.elem.setAttribute('d', pathShapeValue); - } - viewData.lastPath = pathString; - } -}; - -MaskElement.prototype.destroy = function () { - this.element = null; - this.globalData = null; - this.maskElement = null; - this.data = null; - this.masksProperties = null; -}; - -const filtersFactory = (function () { - var ob = {}; - ob.createFilter = createFilter; - ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter; - - function createFilter(filId, skipCoordinates) { - var fil = createNS('filter'); - fil.setAttribute('id', filId); - if (skipCoordinates !== true) { - fil.setAttribute('filterUnits', 'objectBoundingBox'); - fil.setAttribute('x', '0%'); - fil.setAttribute('y', '0%'); - fil.setAttribute('width', '100%'); - fil.setAttribute('height', '100%'); - } - return fil; - } - - function createAlphaToLuminanceFilter() { - var feColorMatrix = createNS('feColorMatrix'); - feColorMatrix.setAttribute('type', 'matrix'); - feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB'); - feColorMatrix.setAttribute('values', '0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1'); - return feColorMatrix; - } - - return ob; -}()); - -const featureSupport = (function () { - var ob = { - maskType: true, - }; - if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) { - ob.maskType = false; - } - return ob; -}()); - -var registeredEffects = {}; -var idPrefix = 'filter_result_'; - -function SVGEffects(elem) { - var i; - var source = 'SourceGraphic'; - var len = elem.data.ef ? elem.data.ef.length : 0; - var filId = createElementID(); - var fil = filtersFactory.createFilter(filId, true); - var count = 0; - this.filters = []; - var filterManager; - for (i = 0; i < len; i += 1) { - filterManager = null; - var type = elem.data.ef[i].ty; - if (registeredEffects[type]) { - var Effect = registeredEffects[type].effect; - filterManager = new Effect(fil, elem.effectsManager.effectElements[i], elem, idPrefix + count, source); - source = idPrefix + count; - if (registeredEffects[type].countsAsEffect) { - count += 1; - } - } - if (filterManager) { - this.filters.push(filterManager); - } - } - if (count) { - elem.globalData.defs.appendChild(fil); - elem.layerElement.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); - } - if (this.filters.length) { - elem.addRenderableComponent(this); - } -} - -SVGEffects.prototype.renderFrame = function (_isFirstFrame) { - var i; - var len = this.filters.length; - for (i = 0; i < len; i += 1) { - this.filters[i].renderFrame(_isFirstFrame); - } -}; - -function registerEffect(id, effect, countsAsEffect) { - registeredEffects[id] = { - effect, - countsAsEffect, - }; -} - -function SVGBaseElement() { -} - -SVGBaseElement.prototype = { - initRendererElement: function () { - this.layerElement = createNS('g'); - }, - createContainerElements: function () { - this.matteElement = createNS('g'); - this.transformedElement = this.layerElement; - this.maskedElement = this.layerElement; - this._sizeChanged = false; - var layerElementParent = null; - // If this layer acts as a mask for the following layer - var filId; - var fil; - var gg; - if (this.data.td) { - if (this.data.td == 3 || this.data.td == 1) { // eslint-disable-line eqeqeq - var masker = createNS('mask'); - masker.setAttribute('id', this.layerId); - masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha'); // eslint-disable-line eqeqeq - masker.appendChild(this.layerElement); - layerElementParent = masker; - this.globalData.defs.appendChild(masker); - // This is only for IE and Edge when mask if of type alpha - if (!featureSupport.maskType && this.data.td == 1) { // eslint-disable-line eqeqeq - masker.setAttribute('mask-type', 'luminance'); - filId = createElementID(); - fil = filtersFactory.createFilter(filId); - this.globalData.defs.appendChild(fil); - fil.appendChild(filtersFactory.createAlphaToLuminanceFilter()); - gg = createNS('g'); - gg.appendChild(this.layerElement); - layerElementParent = gg; - masker.appendChild(gg); - gg.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); - } - } else if (this.data.td == 2) { // eslint-disable-line eqeqeq - var maskGroup = createNS('mask'); - maskGroup.setAttribute('id', this.layerId); - maskGroup.setAttribute('mask-type', 'alpha'); - var maskGrouper = createNS('g'); - maskGroup.appendChild(maskGrouper); - filId = createElementID(); - fil = filtersFactory.createFilter(filId); - /// / - - // This solution doesn't work on Android when meta tag with viewport attribute is set - /* var feColorMatrix = createNS('feColorMatrix'); - feColorMatrix.setAttribute('type', 'matrix'); - feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB'); - feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1'); - fil.appendChild(feColorMatrix); */ - /// / - var feCTr = createNS('feComponentTransfer'); - feCTr.setAttribute('in', 'SourceGraphic'); - fil.appendChild(feCTr); - var feFunc = createNS('feFuncA'); - feFunc.setAttribute('type', 'table'); - feFunc.setAttribute('tableValues', '1.0 0.0'); - feCTr.appendChild(feFunc); - /// / - this.globalData.defs.appendChild(fil); - var alphaRect = createNS('rect'); - alphaRect.setAttribute('width', this.comp.data.w); - alphaRect.setAttribute('height', this.comp.data.h); - alphaRect.setAttribute('x', '0'); - alphaRect.setAttribute('y', '0'); - alphaRect.setAttribute('fill', '#ffffff'); - alphaRect.setAttribute('opacity', '0'); - maskGrouper.setAttribute('filter', 'url(' + getLocationHref() + '#' + filId + ')'); - maskGrouper.appendChild(alphaRect); - maskGrouper.appendChild(this.layerElement); - layerElementParent = maskGrouper; - if (!featureSupport.maskType) { - maskGroup.setAttribute('mask-type', 'luminance'); - fil.appendChild(filtersFactory.createAlphaToLuminanceFilter()); - gg = createNS('g'); - maskGrouper.appendChild(alphaRect); - gg.appendChild(this.layerElement); - layerElementParent = gg; - maskGrouper.appendChild(gg); - } - this.globalData.defs.appendChild(maskGroup); - } - } else if (this.data.tt) { - this.matteElement.appendChild(this.layerElement); - layerElementParent = this.matteElement; - this.baseElement = this.matteElement; - } else { - this.baseElement = this.layerElement; - } - if (this.data.ln) { - this.layerElement.setAttribute('id', this.data.ln); - } - if (this.data.cl) { - this.layerElement.setAttribute('class', this.data.cl); - } - // Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped - if (this.data.ty === 0 && !this.data.hd) { - var cp = createNS('clipPath'); - var pt = createNS('path'); - pt.setAttribute('d', 'M0,0 L' + this.data.w + ',0 L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z'); - var clipId = createElementID(); - cp.setAttribute('id', clipId); - cp.appendChild(pt); - this.globalData.defs.appendChild(cp); - - if (this.checkMasks()) { - var cpGroup = createNS('g'); - cpGroup.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')'); - cpGroup.appendChild(this.layerElement); - this.transformedElement = cpGroup; - if (layerElementParent) { - layerElementParent.appendChild(this.transformedElement); - } else { - this.baseElement = this.transformedElement; - } - } else { - this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + clipId + ')'); - } - } - if (this.data.bm !== 0) { - this.setBlendMode(); - } - }, - renderElement: function () { - if (this.finalTransform._matMdf) { - this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS()); - } - if (this.finalTransform._opMdf) { - this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v); - } - }, - destroyBaseElement: function () { - this.layerElement = null; - this.matteElement = null; - this.maskManager.destroy(); - }, - getBaseElement: function () { - if (this.data.hd) { - return null; - } - return this.baseElement; - }, - createRenderableComponents: function () { - this.maskManager = new MaskElement(this.data, this, this.globalData); - this.renderableEffectsManager = new SVGEffects(this); - }, - setMatte: function (id) { - if (!this.matteElement) { - return; - } - this.matteElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + id + ')'); - }, -}; - -/** - * @file - * Handles AE's layer parenting property. - * - */ - -function HierarchyElement() {} - -HierarchyElement.prototype = { - /** - * @function - * Initializes hierarchy properties - * - */ - initHierarchy: function () { - // element's parent list - this.hierarchy = []; - // if element is parent of another layer _isParent will be true - this._isParent = false; - this.checkParenting(); - }, - /** - * @function - * Sets layer's hierarchy. - * @param {array} hierarch - * layer's parent list - * - */ - setHierarchy: function (hierarchy) { - this.hierarchy = hierarchy; - }, - /** - * @function - * Sets layer as parent. - * - */ - setAsParent: function () { - this._isParent = true; - }, - /** - * @function - * Searches layer's parenting chain - * - */ - checkParenting: function () { - if (this.data.parent !== undefined) { - this.comp.buildElementParenting(this, this.data.parent, []); - } - }, -}; - -function RenderableDOMElement() {} - -(function () { - var _prototype = { - initElement: function (data, globalData, comp) { - this.initFrame(); - this.initBaseData(data, globalData, comp); - this.initTransform(data, globalData, comp); - this.initHierarchy(); - this.initRenderable(); - this.initRendererElement(); - this.createContainerElements(); - this.createRenderableComponents(); - this.createContent(); - this.hide(); - }, - hide: function () { - // console.log('HIDE', this); - if (!this.hidden && (!this.isInRange || this.isTransparent)) { - var elem = this.baseElement || this.layerElement; - elem.style.display = 'none'; - this.hidden = true; - } - }, - show: function () { - // console.log('SHOW', this); - if (this.isInRange && !this.isTransparent) { - if (!this.data.hd) { - var elem = this.baseElement || this.layerElement; - elem.style.display = 'block'; - } - this.hidden = false; - this._isFirstFrame = true; - } - }, - renderFrame: function () { - // If it is exported as hidden (data.hd === true) no need to render - // If it is not visible no need to render - if (this.data.hd || this.hidden) { - return; - } - this.renderTransform(); - this.renderRenderable(); - this.renderElement(); - this.renderInnerContent(); - if (this._isFirstFrame) { - this._isFirstFrame = false; - } - }, - renderInnerContent: function () {}, - prepareFrame: function (num) { - this._mdf = false; - this.prepareRenderableFrame(num); - this.prepareProperties(num, this.isInRange); - this.checkTransparency(); - }, - destroy: function () { - this.innerElem = null; - this.destroyBaseElement(); - }, - }; - extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement); -}()); - -function IImageElement(data, globalData, comp) { - this.assetData = globalData.getAssetData(data.refId); - this.initElement(data, globalData, comp); - this.sourceRect = { - top: 0, left: 0, width: this.assetData.w, height: this.assetData.h, - }; -} - -extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement], IImageElement); - -IImageElement.prototype.createContent = function () { - var assetPath = this.globalData.getAssetsPath(this.assetData); - - this.innerElem = createNS('image'); - this.innerElem.setAttribute('width', this.assetData.w + 'px'); - this.innerElem.setAttribute('height', this.assetData.h + 'px'); - this.innerElem.setAttribute('preserveAspectRatio', this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio); - this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink', 'href', assetPath); - - this.layerElement.appendChild(this.innerElem); -}; - -IImageElement.prototype.sourceRectAtTime = function () { - return this.sourceRect; -}; - -function ProcessedElement(element, position) { - this.elem = element; - this.pos = position; -} - -function IShapeElement() { -} - -IShapeElement.prototype = { - addShapeToModifiers: function (data) { - var i; - var len = this.shapeModifiers.length; - for (i = 0; i < len; i += 1) { - this.shapeModifiers[i].addShape(data); - } - }, - isShapeInAnimatedModifiers: function (data) { - var i = 0; - var len = this.shapeModifiers.length; - while (i < len) { - if (this.shapeModifiers[i].isAnimatedWithShape(data)) { - return true; - } - } - return false; - }, - renderModifiers: function () { - if (!this.shapeModifiers.length) { - return; - } - var i; - var len = this.shapes.length; - for (i = 0; i < len; i += 1) { - this.shapes[i].sh.reset(); - } - - len = this.shapeModifiers.length; - var shouldBreakProcess; - for (i = len - 1; i >= 0; i -= 1) { - shouldBreakProcess = this.shapeModifiers[i].processShapes(this._isFirstFrame); - // workaround to fix cases where a repeater resets the shape so the following processes get called twice - // TODO: find a better solution for this - if (shouldBreakProcess) { - break; - } - } - }, - - searchProcessedElement: function (elem) { - var elements = this.processedElements; - var i = 0; - var len = elements.length; - while (i < len) { - if (elements[i].elem === elem) { - return elements[i].pos; - } - i += 1; - } - return 0; - }, - addProcessedElement: function (elem, pos) { - var elements = this.processedElements; - var i = elements.length; - while (i) { - i -= 1; - if (elements[i].elem === elem) { - elements[i].pos = pos; - return; - } - } - elements.push(new ProcessedElement(elem, pos)); - }, - prepareFrame: function (num) { - this.prepareRenderableFrame(num); - this.prepareProperties(num, this.isInRange); - }, -}; - -const lineCapEnum = { - 1: 'butt', - 2: 'round', - 3: 'square', -}; - -const lineJoinEnum = { - 1: 'miter', - 2: 'round', - 3: 'bevel', -}; - -function SVGShapeData(transformers, level, shape) { - this.caches = []; - this.styles = []; - this.transformers = transformers; - this.lStr = ''; - this.sh = shape; - this.lvl = level; - // TODO find if there are some cases where _isAnimated can be false. - // For now, since shapes add up with other shapes. They have to be calculated every time. - // One way of finding out is checking if all styles associated to this shape depend only of this shape - this._isAnimated = !!shape.k; - // TODO: commenting this for now since all shapes are animated - var i = 0; - var len = transformers.length; - while (i < len) { - if (transformers[i].mProps.dynamicProperties.length) { - this._isAnimated = true; - break; - } - i += 1; - } -} - -SVGShapeData.prototype.setAsAnimated = function () { - this._isAnimated = true; -}; - -function SVGStyleData(data, level) { - this.data = data; - this.type = data.ty; - this.d = ''; - this.lvl = level; - this._mdf = false; - this.closed = data.hd === true; - this.pElem = createNS('path'); - this.msElem = null; -} - -SVGStyleData.prototype.reset = function () { - this.d = ''; - this._mdf = false; -}; - -function DashProperty(elem, data, renderer, container) { - this.elem = elem; - this.frameId = -1; - this.dataProps = createSizedArray(data.length); - this.renderer = renderer; - this.k = false; - this.dashStr = ''; - this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0); - this.dashoffset = createTypedArray('float32', 1); - this.initDynamicPropertyContainer(container); - var i; - var len = data.length || 0; - var prop; - for (i = 0; i < len; i += 1) { - prop = PropertyFactory.getProp(elem, data[i].v, 0, 0, this); - this.k = prop.k || this.k; - this.dataProps[i] = { n: data[i].n, p: prop }; - } - if (!this.k) { - this.getValue(true); - } - this._isAnimated = this.k; -} - -DashProperty.prototype.getValue = function (forceRender) { - if (this.elem.globalData.frameId === this.frameId && !forceRender) { - return; - } - this.frameId = this.elem.globalData.frameId; - this.iterateDynamicProperties(); - this._mdf = this._mdf || forceRender; - if (this._mdf) { - var i = 0; - var len = this.dataProps.length; - if (this.renderer === 'svg') { - this.dashStr = ''; - } - for (i = 0; i < len; i += 1) { - if (this.dataProps[i].n !== 'o') { - if (this.renderer === 'svg') { - this.dashStr += ' ' + this.dataProps[i].p.v; - } else { - this.dashArray[i] = this.dataProps[i].p.v; - } - } else { - this.dashoffset[0] = this.dataProps[i].p.v; - } - } - } -}; -extendPrototype([DynamicPropertyContainer], DashProperty); - -function SVGStrokeStyleData(elem, data, styleOb) { - this.initDynamicPropertyContainer(elem); - this.getValue = this.iterateDynamicProperties; - this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); - this.w = PropertyFactory.getProp(elem, data.w, 0, null, this); - this.d = new DashProperty(elem, data.d || {}, 'svg', this); - this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this); - this.style = styleOb; - this._isAnimated = !!this._isAnimated; -} - -extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData); - -function SVGFillStyleData(elem, data, styleOb) { - this.initDynamicPropertyContainer(elem); - this.getValue = this.iterateDynamicProperties; - this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); - this.c = PropertyFactory.getProp(elem, data.c, 1, 255, this); - this.style = styleOb; -} - -extendPrototype([DynamicPropertyContainer], SVGFillStyleData); - -function SVGNoStyleData(elem, data, styleOb) { - this.initDynamicPropertyContainer(elem); - this.getValue = this.iterateDynamicProperties; - this.style = styleOb; -} - -extendPrototype([DynamicPropertyContainer], SVGNoStyleData); - -function GradientProperty(elem, data, container) { - this.data = data; - this.c = createTypedArray('uint8c', data.p * 4); - var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p * 4) : data.k.k.length - data.p * 4; - this.o = createTypedArray('float32', cLength); - this._cmdf = false; - this._omdf = false; - this._collapsable = this.checkCollapsable(); - this._hasOpacity = cLength; - this.initDynamicPropertyContainer(container); - this.prop = PropertyFactory.getProp(elem, data.k, 1, null, this); - this.k = this.prop.k; - this.getValue(true); -} - -GradientProperty.prototype.comparePoints = function (values, points) { - var i = 0; - var len = this.o.length / 2; - var diff; - while (i < len) { - diff = Math.abs(values[i * 4] - values[points * 4 + i * 2]); - if (diff > 0.01) { - return false; - } - i += 1; - } - return true; -}; - -GradientProperty.prototype.checkCollapsable = function () { - if (this.o.length / 2 !== this.c.length / 4) { - return false; - } - if (this.data.k.k[0].s) { - var i = 0; - var len = this.data.k.k.length; - while (i < len) { - if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) { - return false; - } - i += 1; - } - } else if (!this.comparePoints(this.data.k.k, this.data.p)) { - return false; - } - return true; -}; - -GradientProperty.prototype.getValue = function (forceRender) { - this.prop.getValue(); - this._mdf = false; - this._cmdf = false; - this._omdf = false; - if (this.prop._mdf || forceRender) { - var i; - var len = this.data.p * 4; - var mult; - var val; - for (i = 0; i < len; i += 1) { - mult = i % 4 === 0 ? 100 : 255; - val = Math.round(this.prop.v[i] * mult); - if (this.c[i] !== val) { - this.c[i] = val; - this._cmdf = !forceRender; - } - } - if (this.o.length) { - len = this.prop.v.length; - for (i = this.data.p * 4; i < len; i += 1) { - mult = i % 2 === 0 ? 100 : 1; - val = i % 2 === 0 ? Math.round(this.prop.v[i] * 100) : this.prop.v[i]; - if (this.o[i - this.data.p * 4] !== val) { - this.o[i - this.data.p * 4] = val; - this._omdf = !forceRender; - } - } - } - this._mdf = !forceRender; - } -}; - -extendPrototype([DynamicPropertyContainer], GradientProperty); - -function SVGGradientFillStyleData(elem, data, styleOb) { - this.initDynamicPropertyContainer(elem); - this.getValue = this.iterateDynamicProperties; - this.initGradientData(elem, data, styleOb); -} - -SVGGradientFillStyleData.prototype.initGradientData = function (elem, data, styleOb) { - this.o = PropertyFactory.getProp(elem, data.o, 0, 0.01, this); - this.s = PropertyFactory.getProp(elem, data.s, 1, null, this); - this.e = PropertyFactory.getProp(elem, data.e, 1, null, this); - this.h = PropertyFactory.getProp(elem, data.h || { k: 0 }, 0, 0.01, this); - this.a = PropertyFactory.getProp(elem, data.a || { k: 0 }, 0, degToRads, this); - this.g = new GradientProperty(elem, data.g, this); - this.style = styleOb; - this.stops = []; - this.setGradientData(styleOb.pElem, data); - this.setGradientOpacity(data, styleOb); - this._isAnimated = !!this._isAnimated; -}; - -SVGGradientFillStyleData.prototype.setGradientData = function (pathElement, data) { - var gradientId = createElementID(); - var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient'); - gfill.setAttribute('id', gradientId); - gfill.setAttribute('spreadMethod', 'pad'); - gfill.setAttribute('gradientUnits', 'userSpaceOnUse'); - var stops = []; - var stop; - var j; - var jLen; - jLen = data.g.p * 4; - for (j = 0; j < jLen; j += 4) { - stop = createNS('stop'); - gfill.appendChild(stop); - stops.push(stop); - } - pathElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + gradientId + ')'); - this.gf = gfill; - this.cst = stops; -}; - -SVGGradientFillStyleData.prototype.setGradientOpacity = function (data, styleOb) { - if (this.g._hasOpacity && !this.g._collapsable) { - var stop; - var j; - var jLen; - var mask = createNS('mask'); - var maskElement = createNS('path'); - mask.appendChild(maskElement); - var opacityId = createElementID(); - var maskId = createElementID(); - mask.setAttribute('id', maskId); - var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient'); - opFill.setAttribute('id', opacityId); - opFill.setAttribute('spreadMethod', 'pad'); - opFill.setAttribute('gradientUnits', 'userSpaceOnUse'); - jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length; - var stops = this.stops; - for (j = data.g.p * 4; j < jLen; j += 2) { - stop = createNS('stop'); - stop.setAttribute('stop-color', 'rgb(255,255,255)'); - opFill.appendChild(stop); - stops.push(stop); - } - maskElement.setAttribute(data.ty === 'gf' ? 'fill' : 'stroke', 'url(' + getLocationHref() + '#' + opacityId + ')'); - if (data.ty === 'gs') { - maskElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]); - maskElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]); - if (data.lj === 1) { - maskElement.setAttribute('stroke-miterlimit', data.ml); - } - } - this.of = opFill; - this.ms = mask; - this.ost = stops; - this.maskId = maskId; - styleOb.msElem = maskElement; - } -}; - -extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData); - -function SVGGradientStrokeStyleData(elem, data, styleOb) { - this.initDynamicPropertyContainer(elem); - this.getValue = this.iterateDynamicProperties; - this.w = PropertyFactory.getProp(elem, data.w, 0, null, this); - this.d = new DashProperty(elem, data.d || {}, 'svg', this); - this.initGradientData(elem, data, styleOb); - this._isAnimated = !!this._isAnimated; -} - -extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData); - -function ShapeGroupData() { - this.it = []; - this.prevViewData = []; - this.gr = createNS('g'); -} - -function SVGTransformData(mProps, op, container) { - this.transform = { - mProps: mProps, - op: op, - container: container, - }; - this.elements = []; - this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length; -} - -const buildShapeString = function (pathNodes, length, closed, mat) { - if (length === 0) { - return ''; - } - var _o = pathNodes.o; - var _i = pathNodes.i; - var _v = pathNodes.v; - var i; - var shapeString = ' M' + mat.applyToPointStringified(_v[0][0], _v[0][1]); - for (i = 1; i < length; i += 1) { - shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[i][0], _i[i][1]) + ' ' + mat.applyToPointStringified(_v[i][0], _v[i][1]); - } - if (closed && length) { - shapeString += ' C' + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + ' ' + mat.applyToPointStringified(_i[0][0], _i[0][1]) + ' ' + mat.applyToPointStringified(_v[0][0], _v[0][1]); - shapeString += 'z'; - } - return shapeString; -}; - -const SVGElementsRenderer = (function () { - var _identityMatrix = new Matrix(); - var _matrixHelper = new Matrix(); - - var ob = { - createRenderFunction: createRenderFunction, - }; - - function createRenderFunction(data) { - switch (data.ty) { - case 'fl': - return renderFill; - case 'gf': - return renderGradient; - case 'gs': - return renderGradientStroke; - case 'st': - return renderStroke; - case 'sh': - case 'el': - case 'rc': - case 'sr': - return renderPath; - case 'tr': - return renderContentTransform; - case 'no': - return renderNoop; - default: - return null; - } - } - - function renderContentTransform(styleData, itemData, isFirstFrame) { - if (isFirstFrame || itemData.transform.op._mdf) { - itemData.transform.container.setAttribute('opacity', itemData.transform.op.v); - } - if (isFirstFrame || itemData.transform.mProps._mdf) { - itemData.transform.container.setAttribute('transform', itemData.transform.mProps.v.to2dCSS()); - } - } - - function renderNoop() { - - } - - function renderPath(styleData, itemData, isFirstFrame) { - var j; - var jLen; - var pathStringTransformed; - var redraw; - var pathNodes; - var l; - var lLen = itemData.styles.length; - var lvl = itemData.lvl; - var paths; - var mat; - var props; - var iterations; - var k; - for (l = 0; l < lLen; l += 1) { - redraw = itemData.sh._mdf || isFirstFrame; - if (itemData.styles[l].lvl < lvl) { - mat = _matrixHelper.reset(); - iterations = lvl - itemData.styles[l].lvl; - k = itemData.transformers.length - 1; - while (!redraw && iterations > 0) { - redraw = itemData.transformers[k].mProps._mdf || redraw; - iterations -= 1; - k -= 1; - } - if (redraw) { - iterations = lvl - itemData.styles[l].lvl; - k = itemData.transformers.length - 1; - while (iterations > 0) { - props = itemData.transformers[k].mProps.v.props; - mat.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]); - iterations -= 1; - k -= 1; - } - } - } else { - mat = _identityMatrix; - } - paths = itemData.sh.paths; - jLen = paths._length; - if (redraw) { - pathStringTransformed = ''; - for (j = 0; j < jLen; j += 1) { - pathNodes = paths.shapes[j]; - if (pathNodes && pathNodes._length) { - pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat); - } - } - itemData.caches[l] = pathStringTransformed; - } else { - pathStringTransformed = itemData.caches[l]; - } - itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed; - itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf; - } - } - - function renderFill(styleData, itemData, isFirstFrame) { - var styleElem = itemData.style; - - if (itemData.c._mdf || isFirstFrame) { - styleElem.pElem.setAttribute('fill', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'); - } - if (itemData.o._mdf || isFirstFrame) { - styleElem.pElem.setAttribute('fill-opacity', itemData.o.v); - } - } - - function renderGradientStroke(styleData, itemData, isFirstFrame) { - renderGradient(styleData, itemData, isFirstFrame); - renderStroke(styleData, itemData, isFirstFrame); - } - - function renderGradient(styleData, itemData, isFirstFrame) { - var gfill = itemData.gf; - var hasOpacity = itemData.g._hasOpacity; - var pt1 = itemData.s.v; - var pt2 = itemData.e.v; - - if (itemData.o._mdf || isFirstFrame) { - var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity'; - itemData.style.pElem.setAttribute(attr, itemData.o.v); - } - if (itemData.s._mdf || isFirstFrame) { - var attr1 = styleData.t === 1 ? 'x1' : 'cx'; - var attr2 = attr1 === 'x1' ? 'y1' : 'cy'; - gfill.setAttribute(attr1, pt1[0]); - gfill.setAttribute(attr2, pt1[1]); - if (hasOpacity && !itemData.g._collapsable) { - itemData.of.setAttribute(attr1, pt1[0]); - itemData.of.setAttribute(attr2, pt1[1]); - } - } - var stops; - var i; - var len; - var stop; - if (itemData.g._cmdf || isFirstFrame) { - stops = itemData.cst; - var cValues = itemData.g.c; - len = stops.length; - for (i = 0; i < len; i += 1) { - stop = stops[i]; - stop.setAttribute('offset', cValues[i * 4] + '%'); - stop.setAttribute('stop-color', 'rgb(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ')'); - } - } - if (hasOpacity && (itemData.g._omdf || isFirstFrame)) { - var oValues = itemData.g.o; - if (itemData.g._collapsable) { - stops = itemData.cst; - } else { - stops = itemData.ost; - } - len = stops.length; - for (i = 0; i < len; i += 1) { - stop = stops[i]; - if (!itemData.g._collapsable) { - stop.setAttribute('offset', oValues[i * 2] + '%'); - } - stop.setAttribute('stop-opacity', oValues[i * 2 + 1]); - } - } - if (styleData.t === 1) { - if (itemData.e._mdf || isFirstFrame) { - gfill.setAttribute('x2', pt2[0]); - gfill.setAttribute('y2', pt2[1]); - if (hasOpacity && !itemData.g._collapsable) { - itemData.of.setAttribute('x2', pt2[0]); - itemData.of.setAttribute('y2', pt2[1]); - } - } - } else { - var rad; - if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) { - rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); - gfill.setAttribute('r', rad); - if (hasOpacity && !itemData.g._collapsable) { - itemData.of.setAttribute('r', rad); - } - } - if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) { - if (!rad) { - rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); - } - var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]); - - var percent = itemData.h.v; - if (percent >= 1) { - percent = 0.99; - } else if (percent <= -1) { - percent = -0.99; - } - var dist = rad * percent; - var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]; - var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]; - gfill.setAttribute('fx', x); - gfill.setAttribute('fy', y); - if (hasOpacity && !itemData.g._collapsable) { - itemData.of.setAttribute('fx', x); - itemData.of.setAttribute('fy', y); - } - } - // gfill.setAttribute('fy','200'); - } - } - - function renderStroke(styleData, itemData, isFirstFrame) { - var styleElem = itemData.style; - var d = itemData.d; - if (d && (d._mdf || isFirstFrame) && d.dashStr) { - styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr); - styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]); - } - if (itemData.c && (itemData.c._mdf || isFirstFrame)) { - styleElem.pElem.setAttribute('stroke', 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'); - } - if (itemData.o._mdf || isFirstFrame) { - styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v); - } - if (itemData.w._mdf || isFirstFrame) { - styleElem.pElem.setAttribute('stroke-width', itemData.w.v); - if (styleElem.msElem) { - styleElem.msElem.setAttribute('stroke-width', itemData.w.v); - } - } - } - - return ob; -}()); - -function SVGShapeElement(data, globalData, comp) { - // List of drawable elements - this.shapes = []; - // Full shape data - this.shapesData = data.shapes; - // List of styles that will be applied to shapes - this.stylesList = []; - // List of modifiers that will be applied to shapes - this.shapeModifiers = []; - // List of items in shape tree - this.itemsData = []; - // List of items in previous shape tree - this.processedElements = []; - // List of animated components - this.animatedContents = []; - this.initElement(data, globalData, comp); - // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties. - // List of elements that have been created - this.prevViewData = []; - // Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties. -} - -extendPrototype([BaseElement, TransformElement, SVGBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableDOMElement], SVGShapeElement); - -SVGShapeElement.prototype.initSecondaryElement = function () { -}; - -SVGShapeElement.prototype.identityMatrix = new Matrix(); - -SVGShapeElement.prototype.buildExpressionInterface = function () {}; - -SVGShapeElement.prototype.createContent = function () { - this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true); - this.filterUniqueShapes(); -}; - -/* -This method searches for multiple shapes that affect a single element and one of them is animated -*/ -SVGShapeElement.prototype.filterUniqueShapes = function () { - var i; - var len = this.shapes.length; - var shape; - var j; - var jLen = this.stylesList.length; - var style; - var tempShapes = []; - var areAnimated = false; - for (j = 0; j < jLen; j += 1) { - style = this.stylesList[j]; - areAnimated = false; - tempShapes.length = 0; - for (i = 0; i < len; i += 1) { - shape = this.shapes[i]; - if (shape.styles.indexOf(style) !== -1) { - tempShapes.push(shape); - areAnimated = shape._isAnimated || areAnimated; - } - } - if (tempShapes.length > 1 && areAnimated) { - this.setShapesAsAnimated(tempShapes); - } - } -}; - -SVGShapeElement.prototype.setShapesAsAnimated = function (shapes) { - var i; - var len = shapes.length; - for (i = 0; i < len; i += 1) { - shapes[i].setAsAnimated(); - } -}; - -SVGShapeElement.prototype.createStyleElement = function (data, level) { - // TODO: prevent drawing of hidden styles - var elementData; - var styleOb = new SVGStyleData(data, level); - - var pathElement = styleOb.pElem; - if (data.ty === 'st') { - elementData = new SVGStrokeStyleData(this, data, styleOb); - } else if (data.ty === 'fl') { - elementData = new SVGFillStyleData(this, data, styleOb); - } else if (data.ty === 'gf' || data.ty === 'gs') { - var GradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData; - elementData = new GradientConstructor(this, data, styleOb); - this.globalData.defs.appendChild(elementData.gf); - if (elementData.maskId) { - this.globalData.defs.appendChild(elementData.ms); - this.globalData.defs.appendChild(elementData.of); - pathElement.setAttribute('mask', 'url(' + getLocationHref() + '#' + elementData.maskId + ')'); - } - } else if (data.ty === 'no') { - elementData = new SVGNoStyleData(this, data, styleOb); - } - - if (data.ty === 'st' || data.ty === 'gs') { - pathElement.setAttribute('stroke-linecap', lineCapEnum[data.lc || 2]); - pathElement.setAttribute('stroke-linejoin', lineJoinEnum[data.lj || 2]); - pathElement.setAttribute('fill-opacity', '0'); - if (data.lj === 1) { - pathElement.setAttribute('stroke-miterlimit', data.ml); - } - } - - if (data.r === 2) { - pathElement.setAttribute('fill-rule', 'evenodd'); - } - - if (data.ln) { - pathElement.setAttribute('id', data.ln); - } - if (data.cl) { - pathElement.setAttribute('class', data.cl); - } - if (data.bm) { - pathElement.style['mix-blend-mode'] = getBlendMode(data.bm); - } - this.stylesList.push(styleOb); - this.addToAnimatedContents(data, elementData); - return elementData; -}; - -SVGShapeElement.prototype.createGroupElement = function (data) { - var elementData = new ShapeGroupData(); - if (data.ln) { - elementData.gr.setAttribute('id', data.ln); - } - if (data.cl) { - elementData.gr.setAttribute('class', data.cl); - } - if (data.bm) { - elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm); - } - return elementData; -}; - -SVGShapeElement.prototype.createTransformElement = function (data, container) { - var transformProperty = TransformPropertyFactory.getTransformProperty(this, data, this); - var elementData = new SVGTransformData(transformProperty, transformProperty.o, container); - this.addToAnimatedContents(data, elementData); - return elementData; -}; - -SVGShapeElement.prototype.createShapeElement = function (data, ownTransformers, level) { - var ty = 4; - if (data.ty === 'rc') { - ty = 5; - } else if (data.ty === 'el') { - ty = 6; - } else if (data.ty === 'sr') { - ty = 7; - } - var shapeProperty = ShapePropertyFactory.getShapeProp(this, data, ty, this); - var elementData = new SVGShapeData(ownTransformers, level, shapeProperty); - this.shapes.push(elementData); - this.addShapeToModifiers(elementData); - this.addToAnimatedContents(data, elementData); - return elementData; -}; - -SVGShapeElement.prototype.addToAnimatedContents = function (data, element) { - var i = 0; - var len = this.animatedContents.length; - while (i < len) { - if (this.animatedContents[i].element === element) { - return; - } - i += 1; - } - this.animatedContents.push({ - fn: SVGElementsRenderer.createRenderFunction(data), - element: element, - data: data, - }); -}; - -SVGShapeElement.prototype.setElementStyles = function (elementData) { - var arr = elementData.styles; - var j; - var jLen = this.stylesList.length; - for (j = 0; j < jLen; j += 1) { - if (!this.stylesList[j].closed) { - arr.push(this.stylesList[j]); - } - } -}; - -SVGShapeElement.prototype.reloadShapes = function () { - this._isFirstFrame = true; - var i; - var len = this.itemsData.length; - for (i = 0; i < len; i += 1) { - this.prevViewData[i] = this.itemsData[i]; - } - this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, this.layerElement, 0, [], true); - this.filterUniqueShapes(); - len = this.dynamicProperties.length; - for (i = 0; i < len; i += 1) { - this.dynamicProperties[i].getValue(); - } - this.renderModifiers(); -}; - -SVGShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, container, level, transformers, render) { - var ownTransformers = [].concat(transformers); - var i; - var len = arr.length - 1; - var j; - var jLen; - var ownStyles = []; - var ownModifiers = []; - var currentTransform; - var modifier; - var processedPos; - for (i = len; i >= 0; i -= 1) { - processedPos = this.searchProcessedElement(arr[i]); - if (!processedPos) { - arr[i]._render = render; - } else { - itemsData[i] = prevViewData[processedPos - 1]; - } - if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs' || arr[i].ty === 'no') { - if (!processedPos) { - itemsData[i] = this.createStyleElement(arr[i], level); - } else { - itemsData[i].style.closed = false; - } - if (arr[i]._render) { - if (itemsData[i].style.pElem.parentNode !== container) { - container.appendChild(itemsData[i].style.pElem); - } - } - ownStyles.push(itemsData[i].style); - } else if (arr[i].ty === 'gr') { - if (!processedPos) { - itemsData[i] = this.createGroupElement(arr[i]); - } else { - jLen = itemsData[i].it.length; - for (j = 0; j < jLen; j += 1) { - itemsData[i].prevViewData[j] = itemsData[i].it[j]; - } - } - this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, itemsData[i].gr, level + 1, ownTransformers, render); - if (arr[i]._render) { - if (itemsData[i].gr.parentNode !== container) { - container.appendChild(itemsData[i].gr); - } - } - } else if (arr[i].ty === 'tr') { - if (!processedPos) { - itemsData[i] = this.createTransformElement(arr[i], container); - } - currentTransform = itemsData[i].transform; - ownTransformers.push(currentTransform); - } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') { - if (!processedPos) { - itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level); - } - this.setElementStyles(itemsData[i]); - } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'ms' || arr[i].ty === 'pb') { - if (!processedPos) { - modifier = ShapeModifiers.getModifier(arr[i].ty); - modifier.init(this, arr[i]); - itemsData[i] = modifier; - this.shapeModifiers.push(modifier); - } else { - modifier = itemsData[i]; - modifier.closed = false; - } - ownModifiers.push(modifier); - } else if (arr[i].ty === 'rp') { - if (!processedPos) { - modifier = ShapeModifiers.getModifier(arr[i].ty); - itemsData[i] = modifier; - modifier.init(this, arr, i, itemsData); - this.shapeModifiers.push(modifier); - render = false; - } else { - modifier = itemsData[i]; - modifier.closed = true; - } - ownModifiers.push(modifier); - } - this.addProcessedElement(arr[i], i + 1); - } - len = ownStyles.length; - for (i = 0; i < len; i += 1) { - ownStyles[i].closed = true; - } - len = ownModifiers.length; - for (i = 0; i < len; i += 1) { - ownModifiers[i].closed = true; - } -}; - -SVGShapeElement.prototype.renderInnerContent = function () { - this.renderModifiers(); - var i; - var len = this.stylesList.length; - for (i = 0; i < len; i += 1) { - this.stylesList[i].reset(); - } - this.renderShape(); - for (i = 0; i < len; i += 1) { - if (this.stylesList[i]._mdf || this._isFirstFrame) { - if (this.stylesList[i].msElem) { - this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d); - // Adding M0 0 fixes same mask bug on all browsers - this.stylesList[i].d = 'M0 0' + this.stylesList[i].d; - } - this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0'); - } - } -}; - -SVGShapeElement.prototype.renderShape = function () { - var i; - var len = this.animatedContents.length; - var animatedContent; - for (i = 0; i < len; i += 1) { - animatedContent = this.animatedContents[i]; - if ((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) { - animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame); - } - } -}; - -SVGShapeElement.prototype.destroy = function () { - this.destroyBaseElement(); - this.shapesData = null; - this.itemsData = null; -}; - -function LetterProps(o, sw, sc, fc, m, p) { - this.o = o; - this.sw = sw; - this.sc = sc; - this.fc = fc; - this.m = m; - this.p = p; - this._mdf = { - o: true, - sw: !!sw, - sc: !!sc, - fc: !!fc, - m: true, - p: true, - }; -} - -LetterProps.prototype.update = function (o, sw, sc, fc, m, p) { - this._mdf.o = false; - this._mdf.sw = false; - this._mdf.sc = false; - this._mdf.fc = false; - this._mdf.m = false; - this._mdf.p = false; - var updated = false; - - if (this.o !== o) { - this.o = o; - this._mdf.o = true; - updated = true; - } - if (this.sw !== sw) { - this.sw = sw; - this._mdf.sw = true; - updated = true; - } - if (this.sc !== sc) { - this.sc = sc; - this._mdf.sc = true; - updated = true; - } - if (this.fc !== fc) { - this.fc = fc; - this._mdf.fc = true; - updated = true; - } - if (this.m !== m) { - this.m = m; - this._mdf.m = true; - updated = true; - } - if (p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) { - this.p = p; - this._mdf.p = true; - updated = true; - } - return updated; -}; - -function TextProperty(elem, data) { - this._frameId = initialDefaultFrame; - this.pv = ''; - this.v = ''; - this.kf = false; - this._isFirstFrame = true; - this._mdf = false; - this.data = data; - this.elem = elem; - this.comp = this.elem.comp; - this.keysIndex = 0; - this.canResize = false; - this.minimumFontSize = 1; - this.effectsSequence = []; - this.currentData = { - ascent: 0, - boxWidth: this.defaultBoxWidth, - f: '', - fStyle: '', - fWeight: '', - fc: '', - j: '', - justifyOffset: '', - l: [], - lh: 0, - lineWidths: [], - ls: '', - of: '', - s: '', - sc: '', - sw: 0, - t: 0, - tr: 0, - sz: 0, - ps: null, - fillColorAnim: false, - strokeColorAnim: false, - strokeWidthAnim: false, - yOffset: 0, - finalSize: 0, - finalText: [], - finalLineHeight: 0, - __complete: false, - - }; - this.copyData(this.currentData, this.data.d.k[0].s); - - if (!this.searchProperty()) { - this.completeTextData(this.currentData); - } -} - -TextProperty.prototype.defaultBoxWidth = [0, 0]; - -TextProperty.prototype.copyData = function (obj, data) { - for (var s in data) { - if (Object.prototype.hasOwnProperty.call(data, s)) { - obj[s] = data[s]; - } - } - return obj; -}; - -TextProperty.prototype.setCurrentData = function (data) { - if (!data.__complete) { - this.completeTextData(data); - } - this.currentData = data; - this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth; - this._mdf = true; -}; - -TextProperty.prototype.searchProperty = function () { - return this.searchKeyframes(); -}; - -TextProperty.prototype.searchKeyframes = function () { - this.kf = this.data.d.k.length > 1; - if (this.kf) { - this.addEffect(this.getKeyframeValue.bind(this)); - } - return this.kf; -}; - -TextProperty.prototype.addEffect = function (effectFunction) { - this.effectsSequence.push(effectFunction); - this.elem.addDynamicProperty(this); -}; - -TextProperty.prototype.getValue = function (_finalValue) { - if ((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) { - return; - } - this.currentData.t = this.data.d.k[this.keysIndex].s.t; - var currentValue = this.currentData; - var currentIndex = this.keysIndex; - if (this.lock) { - this.setCurrentData(this.currentData); - return; - } - this.lock = true; - this._mdf = false; - var i; var - len = this.effectsSequence.length; - var finalValue = _finalValue || this.data.d.k[this.keysIndex].s; - for (i = 0; i < len; i += 1) { - // Checking if index changed to prevent creating a new object every time the expression updates. - if (currentIndex !== this.keysIndex) { - finalValue = this.effectsSequence[i](finalValue, finalValue.t); - } else { - finalValue = this.effectsSequence[i](this.currentData, finalValue.t); - } - } - if (currentValue !== finalValue) { - this.setCurrentData(finalValue); - } - this.v = this.currentData; - this.pv = this.v; - this.lock = false; - this.frameId = this.elem.globalData.frameId; -}; - -TextProperty.prototype.getKeyframeValue = function () { - var textKeys = this.data.d.k; - var frameNum = this.elem.comp.renderedFrame; - var i = 0; var - len = textKeys.length; - while (i <= len - 1) { - if (i === len - 1 || textKeys[i + 1].t > frameNum) { - break; - } - i += 1; - } - if (this.keysIndex !== i) { - this.keysIndex = i; - } - return this.data.d.k[this.keysIndex].s; -}; - -TextProperty.prototype.buildFinalText = function (text) { - var charactersArray = []; - var i = 0; - var len = text.length; - var charCode; - var secondCharCode; - var shouldCombine = false; - while (i < len) { - charCode = text.charCodeAt(i); - if (FontManager.isCombinedCharacter(charCode)) { - charactersArray[charactersArray.length - 1] += text.charAt(i); - } else if (charCode >= 0xD800 && charCode <= 0xDBFF) { - secondCharCode = text.charCodeAt(i + 1); - if (secondCharCode >= 0xDC00 && secondCharCode <= 0xDFFF) { - if (shouldCombine || FontManager.isModifier(charCode, secondCharCode)) { - charactersArray[charactersArray.length - 1] += text.substr(i, 2); - shouldCombine = false; - } else { - charactersArray.push(text.substr(i, 2)); - } - i += 1; - } else { - charactersArray.push(text.charAt(i)); - } - } else if (charCode > 0xDBFF) { - secondCharCode = text.charCodeAt(i + 1); - if (FontManager.isZeroWidthJoiner(charCode, secondCharCode)) { - shouldCombine = true; - charactersArray[charactersArray.length - 1] += text.substr(i, 2); - i += 1; - } else { - charactersArray.push(text.charAt(i)); - } - } else if (FontManager.isZeroWidthJoiner(charCode)) { - charactersArray[charactersArray.length - 1] += text.charAt(i); - shouldCombine = true; - } else { - charactersArray.push(text.charAt(i)); - } - i += 1; - } - return charactersArray; -}; - -TextProperty.prototype.completeTextData = function (documentData) { - documentData.__complete = true; - var fontManager = this.elem.globalData.fontManager; - var data = this.data; - var letters = []; - var i; var - len; - var newLineFlag; var index = 0; var - val; - var anchorGrouping = data.m.g; - var currentSize = 0; var currentPos = 0; var currentLine = 0; var - lineWidths = []; - var lineWidth = 0; - var maxLineWidth = 0; - var j; var - jLen; - var fontData = fontManager.getFontByName(documentData.f); - var charData; var - cLength = 0; - - var fontProps = getFontProperties(fontData); - documentData.fWeight = fontProps.weight; - documentData.fStyle = fontProps.style; - documentData.finalSize = documentData.s; - documentData.finalText = this.buildFinalText(documentData.t); - len = documentData.finalText.length; - documentData.finalLineHeight = documentData.lh; - var trackingOffset = (documentData.tr / 1000) * documentData.finalSize; - var charCode; - if (documentData.sz) { - var flag = true; - var boxWidth = documentData.sz[0]; - var boxHeight = documentData.sz[1]; - var currentHeight; var - finalText; - while (flag) { - finalText = this.buildFinalText(documentData.t); - currentHeight = 0; - lineWidth = 0; - len = finalText.length; - trackingOffset = (documentData.tr / 1000) * documentData.finalSize; - var lastSpaceIndex = -1; - for (i = 0; i < len; i += 1) { - charCode = finalText[i].charCodeAt(0); - newLineFlag = false; - if (finalText[i] === ' ') { - lastSpaceIndex = i; - } else if (charCode === 13 || charCode === 3) { - lineWidth = 0; - newLineFlag = true; - currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2; - } - if (fontManager.chars) { - charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily); - cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100; - } else { - // tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily; - cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize); - } - if (lineWidth + cLength > boxWidth && finalText[i] !== ' ') { - if (lastSpaceIndex === -1) { - len += 1; - } else { - i = lastSpaceIndex; - } - currentHeight += documentData.finalLineHeight || documentData.finalSize * 1.2; - finalText.splice(i, lastSpaceIndex === i ? 1 : 0, '\r'); - // finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i); - lastSpaceIndex = -1; - lineWidth = 0; - } else { - lineWidth += cLength; - lineWidth += trackingOffset; - } - } - currentHeight += (fontData.ascent * documentData.finalSize) / 100; - if (this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) { - documentData.finalSize -= 1; - documentData.finalLineHeight = (documentData.finalSize * documentData.lh) / documentData.s; - } else { - documentData.finalText = finalText; - len = documentData.finalText.length; - flag = false; - } - } - } - lineWidth = -trackingOffset; - cLength = 0; - var uncollapsedSpaces = 0; - var currentChar; - for (i = 0; i < len; i += 1) { - newLineFlag = false; - currentChar = documentData.finalText[i]; - charCode = currentChar.charCodeAt(0); - if (charCode === 13 || charCode === 3) { - uncollapsedSpaces = 0; - lineWidths.push(lineWidth); - maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth; - lineWidth = -2 * trackingOffset; - val = ''; - newLineFlag = true; - currentLine += 1; - } else { - val = currentChar; - } - if (fontManager.chars) { - charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily); - cLength = newLineFlag ? 0 : (charData.w * documentData.finalSize) / 100; - } else { - // var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize); - // tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily; - cLength = fontManager.measureText(val, documentData.f, documentData.finalSize); - } - - // - if (currentChar === ' ') { - uncollapsedSpaces += cLength + trackingOffset; - } else { - lineWidth += cLength + trackingOffset + uncollapsedSpaces; - uncollapsedSpaces = 0; - } - letters.push({ - l: cLength, an: cLength, add: currentSize, n: newLineFlag, anIndexes: [], val: val, line: currentLine, animatorJustifyOffset: 0, - }); - if (anchorGrouping == 2) { // eslint-disable-line eqeqeq - currentSize += cLength; - if (val === '' || val === ' ' || i === len - 1) { - if (val === '' || val === ' ') { - currentSize -= cLength; - } - while (currentPos <= i) { - letters[currentPos].an = currentSize; - letters[currentPos].ind = index; - letters[currentPos].extra = cLength; - currentPos += 1; - } - index += 1; - currentSize = 0; - } - } else if (anchorGrouping == 3) { // eslint-disable-line eqeqeq - currentSize += cLength; - if (val === '' || i === len - 1) { - if (val === '') { - currentSize -= cLength; - } - while (currentPos <= i) { - letters[currentPos].an = currentSize; - letters[currentPos].ind = index; - letters[currentPos].extra = cLength; - currentPos += 1; - } - currentSize = 0; - index += 1; - } - } else { - letters[index].ind = index; - letters[index].extra = 0; - index += 1; - } - } - documentData.l = letters; - maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth; - lineWidths.push(lineWidth); - if (documentData.sz) { - documentData.boxWidth = documentData.sz[0]; - documentData.justifyOffset = 0; - } else { - documentData.boxWidth = maxLineWidth; - switch (documentData.j) { - case 1: - documentData.justifyOffset = -documentData.boxWidth; - break; - case 2: - documentData.justifyOffset = -documentData.boxWidth / 2; - break; - default: - documentData.justifyOffset = 0; - } - } - documentData.lineWidths = lineWidths; - - var animators = data.a; var animatorData; var - letterData; - jLen = animators.length; - var based; var ind; var - indexes = []; - for (j = 0; j < jLen; j += 1) { - animatorData = animators[j]; - if (animatorData.a.sc) { - documentData.strokeColorAnim = true; - } - if (animatorData.a.sw) { - documentData.strokeWidthAnim = true; - } - if (animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb) { - documentData.fillColorAnim = true; - } - ind = 0; - based = animatorData.s.b; - for (i = 0; i < len; i += 1) { - letterData = letters[i]; - letterData.anIndexes[j] = ind; - if ((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== ' ') || (based == 3 && (letterData.n || letterData.val == ' ' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))) { // eslint-disable-line eqeqeq - if (animatorData.s.rn === 1) { - indexes.push(ind); - } - ind += 1; - } - } - data.a[j].s.totalChars = ind; - var currentInd = -1; var - newInd; - if (animatorData.s.rn === 1) { - for (i = 0; i < len; i += 1) { - letterData = letters[i]; - if (currentInd != letterData.anIndexes[j]) { // eslint-disable-line eqeqeq - currentInd = letterData.anIndexes[j]; - newInd = indexes.splice(Math.floor(Math.random() * indexes.length), 1)[0]; - } - letterData.anIndexes[j] = newInd; - } - } - } - documentData.yOffset = documentData.finalLineHeight || documentData.finalSize * 1.2; - documentData.ls = documentData.ls || 0; - documentData.ascent = (fontData.ascent * documentData.finalSize) / 100; -}; - -TextProperty.prototype.updateDocumentData = function (newData, index) { - index = index === undefined ? this.keysIndex : index; - var dData = this.copyData({}, this.data.d.k[index].s); - dData = this.copyData(dData, newData); - this.data.d.k[index].s = dData; - this.recalculate(index); - this.elem.addDynamicProperty(this); -}; - -TextProperty.prototype.recalculate = function (index) { - var dData = this.data.d.k[index].s; - dData.__complete = false; - this.keysIndex = 0; - this._isFirstFrame = true; - this.getValue(dData); -}; - -TextProperty.prototype.canResizeFont = function (_canResize) { - this.canResize = _canResize; - this.recalculate(this.keysIndex); - this.elem.addDynamicProperty(this); -}; - -TextProperty.prototype.setMinimumFontSize = function (_fontValue) { - this.minimumFontSize = Math.floor(_fontValue) || 1; - this.recalculate(this.keysIndex); - this.elem.addDynamicProperty(this); -}; - -const TextSelectorProp = (function () { - var max = Math.max; - var min = Math.min; - var floor = Math.floor; - - function TextSelectorPropFactory(elem, data) { - this._currentTextLength = -1; - this.k = false; - this.data = data; - this.elem = elem; - this.comp = elem.comp; - this.finalS = 0; - this.finalE = 0; - this.initDynamicPropertyContainer(elem); - this.s = PropertyFactory.getProp(elem, data.s || { k: 0 }, 0, 0, this); - if ('e' in data) { - this.e = PropertyFactory.getProp(elem, data.e, 0, 0, this); - } else { - this.e = { v: 100 }; - } - this.o = PropertyFactory.getProp(elem, data.o || { k: 0 }, 0, 0, this); - this.xe = PropertyFactory.getProp(elem, data.xe || { k: 0 }, 0, 0, this); - this.ne = PropertyFactory.getProp(elem, data.ne || { k: 0 }, 0, 0, this); - this.sm = PropertyFactory.getProp(elem, data.sm || { k: 100 }, 0, 0, this); - this.a = PropertyFactory.getProp(elem, data.a, 0, 0.01, this); - if (!this.dynamicProperties.length) { - this.getValue(); - } - } - - TextSelectorPropFactory.prototype = { - getMult: function (ind) { - if (this._currentTextLength !== this.elem.textProperty.currentData.l.length) { - this.getValue(); - } - var x1 = 0; - var y1 = 0; - var x2 = 1; - var y2 = 1; - if (this.ne.v > 0) { - x1 = this.ne.v / 100.0; - } else { - y1 = -this.ne.v / 100.0; - } - if (this.xe.v > 0) { - x2 = 1.0 - this.xe.v / 100.0; - } else { - y2 = 1.0 + this.xe.v / 100.0; - } - var easer = BezierFactory.getBezierEasing(x1, y1, x2, y2).get; - - var mult = 0; - var s = this.finalS; - var e = this.finalE; - var type = this.data.sh; - if (type === 2) { - if (e === s) { - mult = ind >= e ? 1 : 0; - } else { - mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); - } - mult = easer(mult); - } else if (type === 3) { - if (e === s) { - mult = ind >= e ? 0 : 1; - } else { - mult = 1 - max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); - } - - mult = easer(mult); - } else if (type === 4) { - if (e === s) { - mult = 0; - } else { - mult = max(0, min(0.5 / (e - s) + (ind - s) / (e - s), 1)); - if (mult < 0.5) { - mult *= 2; - } else { - mult = 1 - 2 * (mult - 0.5); - } - } - mult = easer(mult); - } else if (type === 5) { - if (e === s) { - mult = 0; - } else { - var tot = e - s; - /* ind += 0.5; - mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind; */ - ind = min(max(0, ind + 0.5 - s), e - s); - var x = -tot / 2 + ind; - var a = tot / 2; - mult = Math.sqrt(1 - (x * x) / (a * a)); - } - mult = easer(mult); - } else if (type === 6) { - if (e === s) { - mult = 0; - } else { - ind = min(max(0, ind + 0.5 - s), e - s); - mult = (1 + (Math.cos((Math.PI + Math.PI * 2 * (ind) / (e - s))))) / 2; // eslint-disable-line - } - mult = easer(mult); - } else { - if (ind >= floor(s)) { - if (ind - s < 0) { - mult = max(0, min(min(e, 1) - (s - ind), 1)); - } else { - mult = max(0, min(e - ind, 1)); - } - } - mult = easer(mult); - } - // Smoothness implementation. - // The smoothness represents a reduced range of the original [0; 1] range. - // if smoothness is 25%, the new range will be [0.375; 0.625] - // Steps are: - // - find the lower value of the new range (threshold) - // - if multiplier is smaller than that value, floor it to 0 - // - if it is larger, - // - subtract the threshold - // - divide it by the smoothness (this will return the range to [0; 1]) - // Note: If it doesn't work on some scenarios, consider applying it before the easer. - if (this.sm.v !== 100) { - var smoothness = this.sm.v * 0.01; - if (smoothness === 0) { - smoothness = 0.00000001; - } - var threshold = 0.5 - smoothness * 0.5; - if (mult < threshold) { - mult = 0; - } else { - mult = (mult - threshold) / smoothness; - if (mult > 1) { - mult = 1; - } - } - } - return mult * this.a.v; - }, - getValue: function (newCharsFlag) { - this.iterateDynamicProperties(); - this._mdf = newCharsFlag || this._mdf; - this._currentTextLength = this.elem.textProperty.currentData.l.length || 0; - if (newCharsFlag && this.data.r === 2) { - this.e.v = this._currentTextLength; - } - var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars; - var o = this.o.v / divisor; - var s = this.s.v / divisor + o; - var e = (this.e.v / divisor) + o; - if (s > e) { - var _s = s; - s = e; - e = _s; - } - this.finalS = s; - this.finalE = e; - }, - }; - extendPrototype([DynamicPropertyContainer], TextSelectorPropFactory); - - function getTextSelectorProp(elem, data, arr) { - return new TextSelectorPropFactory(elem, data, arr); - } - - return { - getTextSelectorProp: getTextSelectorProp, - }; -}()); - -function TextAnimatorDataProperty(elem, animatorProps, container) { - var defaultData = { propType: false }; - var getProp = PropertyFactory.getProp; - var textAnimatorAnimatables = animatorProps.a; - this.a = { - r: textAnimatorAnimatables.r ? getProp(elem, textAnimatorAnimatables.r, 0, degToRads, container) : defaultData, - rx: textAnimatorAnimatables.rx ? getProp(elem, textAnimatorAnimatables.rx, 0, degToRads, container) : defaultData, - ry: textAnimatorAnimatables.ry ? getProp(elem, textAnimatorAnimatables.ry, 0, degToRads, container) : defaultData, - sk: textAnimatorAnimatables.sk ? getProp(elem, textAnimatorAnimatables.sk, 0, degToRads, container) : defaultData, - sa: textAnimatorAnimatables.sa ? getProp(elem, textAnimatorAnimatables.sa, 0, degToRads, container) : defaultData, - s: textAnimatorAnimatables.s ? getProp(elem, textAnimatorAnimatables.s, 1, 0.01, container) : defaultData, - a: textAnimatorAnimatables.a ? getProp(elem, textAnimatorAnimatables.a, 1, 0, container) : defaultData, - o: textAnimatorAnimatables.o ? getProp(elem, textAnimatorAnimatables.o, 0, 0.01, container) : defaultData, - p: textAnimatorAnimatables.p ? getProp(elem, textAnimatorAnimatables.p, 1, 0, container) : defaultData, - sw: textAnimatorAnimatables.sw ? getProp(elem, textAnimatorAnimatables.sw, 0, 0, container) : defaultData, - sc: textAnimatorAnimatables.sc ? getProp(elem, textAnimatorAnimatables.sc, 1, 0, container) : defaultData, - fc: textAnimatorAnimatables.fc ? getProp(elem, textAnimatorAnimatables.fc, 1, 0, container) : defaultData, - fh: textAnimatorAnimatables.fh ? getProp(elem, textAnimatorAnimatables.fh, 0, 0, container) : defaultData, - fs: textAnimatorAnimatables.fs ? getProp(elem, textAnimatorAnimatables.fs, 0, 0.01, container) : defaultData, - fb: textAnimatorAnimatables.fb ? getProp(elem, textAnimatorAnimatables.fb, 0, 0.01, container) : defaultData, - t: textAnimatorAnimatables.t ? getProp(elem, textAnimatorAnimatables.t, 0, 0, container) : defaultData, - }; - - this.s = TextSelectorProp.getTextSelectorProp(elem, animatorProps.s, container); - this.s.t = animatorProps.s.t; -} - -function TextAnimatorProperty(textData, renderType, elem) { - this._isFirstFrame = true; - this._hasMaskedPath = false; - this._frameId = -1; - this._textData = textData; - this._renderType = renderType; - this._elem = elem; - this._animatorsData = createSizedArray(this._textData.a.length); - this._pathData = {}; - this._moreOptions = { - alignment: {}, - }; - this.renderedLetters = []; - this.lettersChangedFlag = false; - this.initDynamicPropertyContainer(elem); -} - -TextAnimatorProperty.prototype.searchProperties = function () { - var i; - var len = this._textData.a.length; - var animatorProps; - var getProp = PropertyFactory.getProp; - for (i = 0; i < len; i += 1) { - animatorProps = this._textData.a[i]; - this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this); - } - if (this._textData.p && 'm' in this._textData.p) { - this._pathData = { - a: getProp(this._elem, this._textData.p.a, 0, 0, this), - f: getProp(this._elem, this._textData.p.f, 0, 0, this), - l: getProp(this._elem, this._textData.p.l, 0, 0, this), - r: getProp(this._elem, this._textData.p.r, 0, 0, this), - p: getProp(this._elem, this._textData.p.p, 0, 0, this), - m: this._elem.maskManager.getMaskProperty(this._textData.p.m), - }; - this._hasMaskedPath = true; - } else { - this._hasMaskedPath = false; - } - this._moreOptions.alignment = getProp(this._elem, this._textData.m.a, 1, 0, this); -}; - -TextAnimatorProperty.prototype.getMeasures = function (documentData, lettersChangedFlag) { - this.lettersChangedFlag = lettersChangedFlag; - if (!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) { - return; - } - this._isFirstFrame = false; - var alignment = this._moreOptions.alignment.v; - var animators = this._animatorsData; - var textData = this._textData; - var matrixHelper = this.mHelper; - var renderType = this._renderType; - var renderedLettersCount = this.renderedLetters.length; - var xPos; - var yPos; - var i; - var len; - var letters = documentData.l; - var pathInfo; - var currentLength; - var currentPoint; - var segmentLength; - var flag; - var pointInd; - var segmentInd; - var prevPoint; - var points; - var segments; - var partialLength; - var totalLength; - var perc; - var tanAngle; - var mask; - if (this._hasMaskedPath) { - mask = this._pathData.m; - if (!this._pathData.n || this._pathData._mdf) { - var paths = mask.v; - if (this._pathData.r.v) { - paths = paths.reverse(); - } - // TODO: release bezier data cached from previous pathInfo: this._pathData.pi - pathInfo = { - tLength: 0, - segments: [], - }; - len = paths._length - 1; - var bezierData; - totalLength = 0; - for (i = 0; i < len; i += 1) { - bezierData = bez.buildBezierData(paths.v[i], - paths.v[i + 1], - [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], - [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]); - pathInfo.tLength += bezierData.segmentLength; - pathInfo.segments.push(bezierData); - totalLength += bezierData.segmentLength; - } - i = len; - if (mask.v.c) { - bezierData = bez.buildBezierData(paths.v[i], - paths.v[0], - [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]], - [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]); - pathInfo.tLength += bezierData.segmentLength; - pathInfo.segments.push(bezierData); - totalLength += bezierData.segmentLength; - } - this._pathData.pi = pathInfo; - } - pathInfo = this._pathData.pi; - - currentLength = this._pathData.f.v; - segmentInd = 0; - pointInd = 1; - segmentLength = 0; - flag = true; - segments = pathInfo.segments; - if (currentLength < 0 && mask.v.c) { - if (pathInfo.tLength < Math.abs(currentLength)) { - currentLength = -Math.abs(currentLength) % pathInfo.tLength; - } - segmentInd = segments.length - 1; - points = segments[segmentInd].points; - pointInd = points.length - 1; - while (currentLength < 0) { - currentLength += points[pointInd].partialLength; - pointInd -= 1; - if (pointInd < 0) { - segmentInd -= 1; - points = segments[segmentInd].points; - pointInd = points.length - 1; - } - } - } - points = segments[segmentInd].points; - prevPoint = points[pointInd - 1]; - currentPoint = points[pointInd]; - partialLength = currentPoint.partialLength; - } - - len = letters.length; - xPos = 0; - yPos = 0; - var yOff = documentData.finalSize * 1.2 * 0.714; - var firstLine = true; - var animatorProps; - var animatorSelector; - var j; - var jLen; - var letterValue; - - jLen = animators.length; - - var mult; - var ind = -1; - var offf; - var xPathPos; - var yPathPos; - var initPathPos = currentLength; - var initSegmentInd = segmentInd; - var initPointInd = pointInd; - var currentLine = -1; - var elemOpacity; - var sc; - var sw; - var fc; - var k; - var letterSw; - var letterSc; - var letterFc; - var letterM = ''; - var letterP = this.defaultPropsArray; - var letterO; - - // - if (documentData.j === 2 || documentData.j === 1) { - var animatorJustifyOffset = 0; - var animatorFirstCharOffset = 0; - var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1; - var lastIndex = 0; - var isNewLine = true; - - for (i = 0; i < len; i += 1) { - if (letters[i].n) { - if (animatorJustifyOffset) { - animatorJustifyOffset += animatorFirstCharOffset; - } - while (lastIndex < i) { - letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset; - lastIndex += 1; - } - animatorJustifyOffset = 0; - isNewLine = true; - } else { - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - if (animatorProps.t.propType) { - if (isNewLine && documentData.j === 2) { - animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult; - } - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (mult.length) { - animatorJustifyOffset += animatorProps.t.v * mult[0] * justifyOffsetMult; - } else { - animatorJustifyOffset += animatorProps.t.v * mult * justifyOffsetMult; - } - } - } - isNewLine = false; - } - } - if (animatorJustifyOffset) { - animatorJustifyOffset += animatorFirstCharOffset; - } - while (lastIndex < i) { - letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset; - lastIndex += 1; - } - } - // - - for (i = 0; i < len; i += 1) { - matrixHelper.reset(); - elemOpacity = 1; - if (letters[i].n) { - xPos = 0; - yPos += documentData.yOffset; - yPos += firstLine ? 1 : 0; - currentLength = initPathPos; - firstLine = false; - if (this._hasMaskedPath) { - segmentInd = initSegmentInd; - pointInd = initPointInd; - points = segments[segmentInd].points; - prevPoint = points[pointInd - 1]; - currentPoint = points[pointInd]; - partialLength = currentPoint.partialLength; - segmentLength = 0; - } - letterM = ''; - letterFc = ''; - letterSw = ''; - letterO = ''; - letterP = this.defaultPropsArray; - } else { - if (this._hasMaskedPath) { - if (currentLine !== letters[i].line) { - switch (documentData.j) { - case 1: - currentLength += totalLength - documentData.lineWidths[letters[i].line]; - break; - case 2: - currentLength += (totalLength - documentData.lineWidths[letters[i].line]) / 2; - break; - default: - break; - } - currentLine = letters[i].line; - } - if (ind !== letters[i].ind) { - if (letters[ind]) { - currentLength += letters[ind].extra; - } - currentLength += letters[i].an / 2; - ind = letters[i].ind; - } - currentLength += (alignment[0] * letters[i].an) * 0.005; - var animatorOffset = 0; - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - if (animatorProps.p.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (mult.length) { - animatorOffset += animatorProps.p.v[0] * mult[0]; - } else { - animatorOffset += animatorProps.p.v[0] * mult; - } - } - if (animatorProps.a.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (mult.length) { - animatorOffset += animatorProps.a.v[0] * mult[0]; - } else { - animatorOffset += animatorProps.a.v[0] * mult; - } - } - } - flag = true; - // Force alignment only works with a single line for now - if (this._pathData.a.v) { - currentLength = letters[0].an * 0.5 + ((totalLength - this._pathData.f.v - letters[0].an * 0.5 - letters[letters.length - 1].an * 0.5) * ind) / (len - 1); - currentLength += this._pathData.f.v; - } - while (flag) { - if (segmentLength + partialLength >= currentLength + animatorOffset || !points) { - perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength; - xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc; - yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc; - matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, -(alignment[1] * yOff) * 0.01); - flag = false; - } else if (points) { - segmentLength += currentPoint.partialLength; - pointInd += 1; - if (pointInd >= points.length) { - pointInd = 0; - segmentInd += 1; - if (!segments[segmentInd]) { - if (mask.v.c) { - pointInd = 0; - segmentInd = 0; - points = segments[segmentInd].points; - } else { - segmentLength -= currentPoint.partialLength; - points = null; - } - } else { - points = segments[segmentInd].points; - } - } - if (points) { - prevPoint = currentPoint; - currentPoint = points[pointInd]; - partialLength = currentPoint.partialLength; - } - } - } - offf = letters[i].an / 2 - letters[i].add; - matrixHelper.translate(-offf, 0, 0); - } else { - offf = letters[i].an / 2 - letters[i].add; - matrixHelper.translate(-offf, 0, 0); - - // Grouping alignment - matrixHelper.translate((-alignment[0] * letters[i].an) * 0.005, (-alignment[1] * yOff) * 0.01, 0); - } - - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - if (animatorProps.t.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - // This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine" - if (xPos !== 0 || documentData.j !== 0) { - if (this._hasMaskedPath) { - if (mult.length) { - currentLength += animatorProps.t.v * mult[0]; - } else { - currentLength += animatorProps.t.v * mult; - } - } else if (mult.length) { - xPos += animatorProps.t.v * mult[0]; - } else { - xPos += animatorProps.t.v * mult; - } - } - } - } - if (documentData.strokeWidthAnim) { - sw = documentData.sw || 0; - } - if (documentData.strokeColorAnim) { - if (documentData.sc) { - sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]]; - } else { - sc = [0, 0, 0]; - } - } - if (documentData.fillColorAnim && documentData.fc) { - fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]]; - } - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - if (animatorProps.a.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - - if (mult.length) { - matrixHelper.translate(-animatorProps.a.v[0] * mult[0], -animatorProps.a.v[1] * mult[1], animatorProps.a.v[2] * mult[2]); - } else { - matrixHelper.translate(-animatorProps.a.v[0] * mult, -animatorProps.a.v[1] * mult, animatorProps.a.v[2] * mult); - } - } - } - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - if (animatorProps.s.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (mult.length) { - matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult[0]), 1 + ((animatorProps.s.v[1] - 1) * mult[1]), 1); - } else { - matrixHelper.scale(1 + ((animatorProps.s.v[0] - 1) * mult), 1 + ((animatorProps.s.v[1] - 1) * mult), 1); - } - } - } - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (animatorProps.sk.propType) { - if (mult.length) { - matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]); - } else { - matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult); - } - } - if (animatorProps.r.propType) { - if (mult.length) { - matrixHelper.rotateZ(-animatorProps.r.v * mult[2]); - } else { - matrixHelper.rotateZ(-animatorProps.r.v * mult); - } - } - if (animatorProps.ry.propType) { - if (mult.length) { - matrixHelper.rotateY(animatorProps.ry.v * mult[1]); - } else { - matrixHelper.rotateY(animatorProps.ry.v * mult); - } - } - if (animatorProps.rx.propType) { - if (mult.length) { - matrixHelper.rotateX(animatorProps.rx.v * mult[0]); - } else { - matrixHelper.rotateX(animatorProps.rx.v * mult); - } - } - if (animatorProps.o.propType) { - if (mult.length) { - elemOpacity += ((animatorProps.o.v) * mult[0] - elemOpacity) * mult[0]; - } else { - elemOpacity += ((animatorProps.o.v) * mult - elemOpacity) * mult; - } - } - if (documentData.strokeWidthAnim && animatorProps.sw.propType) { - if (mult.length) { - sw += animatorProps.sw.v * mult[0]; - } else { - sw += animatorProps.sw.v * mult; - } - } - if (documentData.strokeColorAnim && animatorProps.sc.propType) { - for (k = 0; k < 3; k += 1) { - if (mult.length) { - sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult[0]; - } else { - sc[k] += (animatorProps.sc.v[k] - sc[k]) * mult; - } - } - } - if (documentData.fillColorAnim && documentData.fc) { - if (animatorProps.fc.propType) { - for (k = 0; k < 3; k += 1) { - if (mult.length) { - fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult[0]; - } else { - fc[k] += (animatorProps.fc.v[k] - fc[k]) * mult; - } - } - } - if (animatorProps.fh.propType) { - if (mult.length) { - fc = addHueToRGB(fc, animatorProps.fh.v * mult[0]); - } else { - fc = addHueToRGB(fc, animatorProps.fh.v * mult); - } - } - if (animatorProps.fs.propType) { - if (mult.length) { - fc = addSaturationToRGB(fc, animatorProps.fs.v * mult[0]); - } else { - fc = addSaturationToRGB(fc, animatorProps.fs.v * mult); - } - } - if (animatorProps.fb.propType) { - if (mult.length) { - fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult[0]); - } else { - fc = addBrightnessToRGB(fc, animatorProps.fb.v * mult); - } - } - } - } - - for (j = 0; j < jLen; j += 1) { - animatorProps = animators[j].a; - - if (animatorProps.p.propType) { - animatorSelector = animators[j].s; - mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars); - if (this._hasMaskedPath) { - if (mult.length) { - matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]); - } else { - matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult); - } - } else if (mult.length) { - matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]); - } else { - matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult); - } - } - } - if (documentData.strokeWidthAnim) { - letterSw = sw < 0 ? 0 : sw; - } - if (documentData.strokeColorAnim) { - letterSc = 'rgb(' + Math.round(sc[0] * 255) + ',' + Math.round(sc[1] * 255) + ',' + Math.round(sc[2] * 255) + ')'; - } - if (documentData.fillColorAnim && documentData.fc) { - letterFc = 'rgb(' + Math.round(fc[0] * 255) + ',' + Math.round(fc[1] * 255) + ',' + Math.round(fc[2] * 255) + ')'; - } - - if (this._hasMaskedPath) { - matrixHelper.translate(0, -documentData.ls); - - matrixHelper.translate(0, (alignment[1] * yOff) * 0.01 + yPos, 0); - if (this._pathData.p.v) { - tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]); - var rot = (Math.atan(tanAngle) * 180) / Math.PI; - if (currentPoint.point[0] < prevPoint.point[0]) { - rot += 180; - } - matrixHelper.rotate((-rot * Math.PI) / 180); - } - matrixHelper.translate(xPathPos, yPathPos, 0); - currentLength -= (alignment[0] * letters[i].an) * 0.005; - if (letters[i + 1] && ind !== letters[i + 1].ind) { - currentLength += letters[i].an / 2; - currentLength += (documentData.tr * 0.001) * documentData.finalSize; - } - } else { - matrixHelper.translate(xPos, yPos, 0); - - if (documentData.ps) { - // matrixHelper.translate(documentData.ps[0],documentData.ps[1],0); - matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0); - } - switch (documentData.j) { - case 1: - matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]), 0, 0); - break; - case 2: - matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]) / 2, 0, 0); - break; - default: - break; - } - matrixHelper.translate(0, -documentData.ls); - matrixHelper.translate(offf, 0, 0); - matrixHelper.translate((alignment[0] * letters[i].an) * 0.005, (alignment[1] * yOff) * 0.01, 0); - xPos += letters[i].l + (documentData.tr * 0.001) * documentData.finalSize; - } - if (renderType === 'html') { - letterM = matrixHelper.toCSS(); - } else if (renderType === 'svg') { - letterM = matrixHelper.to2dCSS(); - } else { - letterP = [matrixHelper.props[0], matrixHelper.props[1], matrixHelper.props[2], matrixHelper.props[3], matrixHelper.props[4], matrixHelper.props[5], matrixHelper.props[6], matrixHelper.props[7], matrixHelper.props[8], matrixHelper.props[9], matrixHelper.props[10], matrixHelper.props[11], matrixHelper.props[12], matrixHelper.props[13], matrixHelper.props[14], matrixHelper.props[15]]; - } - letterO = elemOpacity; - } - - if (renderedLettersCount <= i) { - letterValue = new LetterProps(letterO, letterSw, letterSc, letterFc, letterM, letterP); - this.renderedLetters.push(letterValue); - renderedLettersCount += 1; - this.lettersChangedFlag = true; - } else { - letterValue = this.renderedLetters[i]; - this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag; - } - } -}; - -TextAnimatorProperty.prototype.getValue = function () { - if (this._elem.globalData.frameId === this._frameId) { - return; - } - this._frameId = this._elem.globalData.frameId; - this.iterateDynamicProperties(); -}; - -TextAnimatorProperty.prototype.mHelper = new Matrix(); -TextAnimatorProperty.prototype.defaultPropsArray = []; -extendPrototype([DynamicPropertyContainer], TextAnimatorProperty); - -function ITextElement() { -} - -ITextElement.prototype.initElement = function (data, globalData, comp) { - this.lettersChangedFlag = true; - this.initFrame(); - this.initBaseData(data, globalData, comp); - this.textProperty = new TextProperty(this, data.t, this.dynamicProperties); - this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this); - this.initTransform(data, globalData, comp); - this.initHierarchy(); - this.initRenderable(); - this.initRendererElement(); - this.createContainerElements(); - this.createRenderableComponents(); - this.createContent(); - this.hide(); - this.textAnimator.searchProperties(this.dynamicProperties); -}; - -ITextElement.prototype.prepareFrame = function (num) { - this._mdf = false; - this.prepareRenderableFrame(num); - this.prepareProperties(num, this.isInRange); - if (this.textProperty._mdf || this.textProperty._isFirstFrame) { - this.buildNewText(); - this.textProperty._isFirstFrame = false; - this.textProperty._mdf = false; - } -}; - -ITextElement.prototype.createPathShape = function (matrixHelper, shapes) { - var j; - var jLen = shapes.length; - var pathNodes; - var shapeStr = ''; - for (j = 0; j < jLen; j += 1) { - if (shapes[j].ty === 'sh') { - pathNodes = shapes[j].ks.k; - shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper); - } - } - return shapeStr; -}; - -ITextElement.prototype.updateDocumentData = function (newData, index) { - this.textProperty.updateDocumentData(newData, index); -}; - -ITextElement.prototype.canResizeFont = function (_canResize) { - this.textProperty.canResizeFont(_canResize); -}; - -ITextElement.prototype.setMinimumFontSize = function (_fontSize) { - this.textProperty.setMinimumFontSize(_fontSize); -}; - -ITextElement.prototype.applyTextPropertiesToMatrix = function (documentData, matrixHelper, lineNumber, xPos, yPos) { - if (documentData.ps) { - matrixHelper.translate(documentData.ps[0], documentData.ps[1] + documentData.ascent, 0); - } - matrixHelper.translate(0, -documentData.ls, 0); - switch (documentData.j) { - case 1: - matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]), 0, 0); - break; - case 2: - matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]) / 2, 0, 0); - break; - default: - break; - } - matrixHelper.translate(xPos, yPos, 0); -}; - -ITextElement.prototype.buildColor = function (colorData) { - return 'rgb(' + Math.round(colorData[0] * 255) + ',' + Math.round(colorData[1] * 255) + ',' + Math.round(colorData[2] * 255) + ')'; -}; - -ITextElement.prototype.emptyProp = new LetterProps(); - -ITextElement.prototype.destroy = function () { - -}; - -var emptyShapeData = { - shapes: [], -}; - -function SVGTextLottieElement(data, globalData, comp) { - this.textSpans = []; - this.renderType = 'svg'; - this.initElement(data, globalData, comp); -} - -extendPrototype([BaseElement, TransformElement, SVGBaseElement, HierarchyElement, FrameElement, RenderableDOMElement, ITextElement], SVGTextLottieElement); - -SVGTextLottieElement.prototype.createContent = function () { - if (this.data.singleShape && !this.globalData.fontManager.chars) { - this.textContainer = createNS('text'); - } -}; - -SVGTextLottieElement.prototype.buildTextContents = function (textArray) { - var i = 0; - var len = textArray.length; - var textContents = []; - var currentTextContent = ''; - while (i < len) { - if (textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) { - textContents.push(currentTextContent); - currentTextContent = ''; - } else { - currentTextContent += textArray[i]; - } - i += 1; - } - textContents.push(currentTextContent); - return textContents; -}; - -SVGTextLottieElement.prototype.buildShapeData = function (data, scale) { - // data should probably be cloned to apply scale separately to each instance of a text on different layers - // but since text internal content gets only rendered once and then it's never rerendered, - // it's probably safe not to clone data and reuse always the same instance even if the object is mutated. - // Avoiding cloning is preferred since cloning each character shape data is expensive - if (data.shapes && data.shapes.length) { - var shape = data.shapes[0]; - if (shape.it) { - var shapeItem = shape.it[shape.it.length - 1]; - if (shapeItem.s) { - shapeItem.s.k[0] = scale; - shapeItem.s.k[1] = scale; - } - } - } - return data; -}; - -SVGTextLottieElement.prototype.buildNewText = function () { - this.addDynamicProperty(this); - var i; - var len; - - var documentData = this.textProperty.currentData; - this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0); - if (documentData.fc) { - this.layerElement.setAttribute('fill', this.buildColor(documentData.fc)); - } else { - this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)'); - } - if (documentData.sc) { - this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc)); - this.layerElement.setAttribute('stroke-width', documentData.sw); - } - this.layerElement.setAttribute('font-size', documentData.finalSize); - var fontData = this.globalData.fontManager.getFontByName(documentData.f); - if (fontData.fClass) { - this.layerElement.setAttribute('class', fontData.fClass); - } else { - this.layerElement.setAttribute('font-family', fontData.fFamily); - var fWeight = documentData.fWeight; - var fStyle = documentData.fStyle; - this.layerElement.setAttribute('font-style', fStyle); - this.layerElement.setAttribute('font-weight', fWeight); - } - this.layerElement.setAttribute('aria-label', documentData.t); - - var letters = documentData.l || []; - var usesGlyphs = !!this.globalData.fontManager.chars; - len = letters.length; - - var tSpan; - var matrixHelper = this.mHelper; - var shapeStr = ''; - var singleShape = this.data.singleShape; - var xPos = 0; - var yPos = 0; - var firstLine = true; - var trackingOffset = documentData.tr * 0.001 * documentData.finalSize; - if (singleShape && !usesGlyphs && !documentData.sz) { - var tElement = this.textContainer; - var justify = 'start'; - switch (documentData.j) { - case 1: - justify = 'end'; - break; - case 2: - justify = 'middle'; - break; - default: - justify = 'start'; - break; - } - tElement.setAttribute('text-anchor', justify); - tElement.setAttribute('letter-spacing', trackingOffset); - var textContent = this.buildTextContents(documentData.finalText); - len = textContent.length; - yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0; - for (i = 0; i < len; i += 1) { - tSpan = this.textSpans[i].span || createNS('tspan'); - tSpan.textContent = textContent[i]; - tSpan.setAttribute('x', 0); - tSpan.setAttribute('y', yPos); - tSpan.style.display = 'inherit'; - tElement.appendChild(tSpan); - if (!this.textSpans[i]) { - this.textSpans[i] = { - span: null, - glyph: null, - }; - } - this.textSpans[i].span = tSpan; - yPos += documentData.finalLineHeight; - } - - this.layerElement.appendChild(tElement); - } else { - var cachedSpansLength = this.textSpans.length; - var charData; - for (i = 0; i < len; i += 1) { - if (!this.textSpans[i]) { - this.textSpans[i] = { - span: null, - childSpan: null, - glyph: null, - }; - } - if (!usesGlyphs || !singleShape || i === 0) { - tSpan = cachedSpansLength > i ? this.textSpans[i].span : createNS(usesGlyphs ? 'g' : 'text'); - if (cachedSpansLength <= i) { - tSpan.setAttribute('stroke-linecap', 'butt'); - tSpan.setAttribute('stroke-linejoin', 'round'); - tSpan.setAttribute('stroke-miterlimit', '4'); - this.textSpans[i].span = tSpan; - if (usesGlyphs) { - var childSpan = createNS('g'); - tSpan.appendChild(childSpan); - this.textSpans[i].childSpan = childSpan; - } - this.textSpans[i].span = tSpan; - this.layerElement.appendChild(tSpan); - } - tSpan.style.display = 'inherit'; - } - - matrixHelper.reset(); - if (singleShape) { - if (letters[i].n) { - xPos = -trackingOffset; - yPos += documentData.yOffset; - yPos += firstLine ? 1 : 0; - firstLine = false; - } - this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos); - xPos += letters[i].l || 0; - // xPos += letters[i].val === ' ' ? 0 : trackingOffset; - xPos += trackingOffset; - } - if (usesGlyphs) { - charData = this.globalData.fontManager.getCharData( - documentData.finalText[i], - fontData.fStyle, - this.globalData.fontManager.getFontByName(documentData.f).fFamily - ); - var glyphElement; - // t === 1 means the character has been replaced with an animated shaped - if (charData.t === 1) { - glyphElement = new SVGCompElement(charData.data, this.globalData, this); - } else { - var data = emptyShapeData; - if (charData.data && charData.data.shapes) { - data = this.buildShapeData(charData.data, documentData.finalSize); - } - glyphElement = new SVGShapeElement(data, this.globalData, this); - } - if (this.textSpans[i].glyph) { - var glyph = this.textSpans[i].glyph; - this.textSpans[i].childSpan.removeChild(glyph.layerElement); - glyph.destroy(); - } - this.textSpans[i].glyph = glyphElement; - glyphElement._debug = true; - glyphElement.prepareFrame(0); - glyphElement.renderFrame(); - this.textSpans[i].childSpan.appendChild(glyphElement.layerElement); - // when using animated shapes, the layer will be scaled instead of replacing the internal scale - // this might have issues with strokes and might need a different solution - if (charData.t === 1) { - this.textSpans[i].childSpan.setAttribute('transform', 'scale(' + documentData.finalSize / 100 + ',' + documentData.finalSize / 100 + ')'); - } - } else { - if (singleShape) { - tSpan.setAttribute('transform', 'translate(' + matrixHelper.props[12] + ',' + matrixHelper.props[13] + ')'); - } - tSpan.textContent = letters[i].val; - tSpan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve'); - } - // - } - if (singleShape && tSpan) { - tSpan.setAttribute('d', shapeStr); - } - } - while (i < this.textSpans.length) { - this.textSpans[i].span.style.display = 'none'; - i += 1; - } - - this._sizeChanged = true; -}; - -SVGTextLottieElement.prototype.sourceRectAtTime = function () { - this.prepareFrame(this.comp.renderedFrame - this.data.st); - this.renderInnerContent(); - if (this._sizeChanged) { - this._sizeChanged = false; - var textBox = this.layerElement.getBBox(); - this.bbox = { - top: textBox.y, - left: textBox.x, - width: textBox.width, - height: textBox.height, - }; - } - return this.bbox; -}; - -SVGTextLottieElement.prototype.getValue = function () { - var i; - var len = this.textSpans.length; - var glyphElement; - this.renderedFrame = this.comp.renderedFrame; - for (i = 0; i < len; i += 1) { - glyphElement = this.textSpans[i].glyph; - if (glyphElement) { - glyphElement.prepareFrame(this.comp.renderedFrame - this.data.st); - if (glyphElement._mdf) { - this._mdf = true; - } - } - } -}; - -SVGTextLottieElement.prototype.renderInnerContent = function () { - if (!this.data.singleShape || this._mdf) { - this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); - if (this.lettersChangedFlag || this.textAnimator.lettersChangedFlag) { - this._sizeChanged = true; - var i; - var len; - var renderedLetters = this.textAnimator.renderedLetters; - - var letters = this.textProperty.currentData.l; - - len = letters.length; - var renderedLetter; - var textSpan; - var glyphElement; - for (i = 0; i < len; i += 1) { - if (!letters[i].n) { - renderedLetter = renderedLetters[i]; - textSpan = this.textSpans[i].span; - glyphElement = this.textSpans[i].glyph; - if (glyphElement) { - glyphElement.renderFrame(); - } - if (renderedLetter._mdf.m) { - textSpan.setAttribute('transform', renderedLetter.m); - } - if (renderedLetter._mdf.o) { - textSpan.setAttribute('opacity', renderedLetter.o); - } - if (renderedLetter._mdf.sw) { - textSpan.setAttribute('stroke-width', renderedLetter.sw); - } - if (renderedLetter._mdf.sc) { - textSpan.setAttribute('stroke', renderedLetter.sc); - } - if (renderedLetter._mdf.fc) { - textSpan.setAttribute('fill', renderedLetter.fc); - } - } - } - } - } -}; - -function ISolidElement(data, globalData, comp) { - this.initElement(data, globalData, comp); -} -extendPrototype([IImageElement], ISolidElement); - -ISolidElement.prototype.createContent = function () { - var rect = createNS('rect'); - /// /rect.style.width = this.data.sw; - /// /rect.style.height = this.data.sh; - /// /rect.style.fill = this.data.sc; - rect.setAttribute('width', this.data.sw); - rect.setAttribute('height', this.data.sh); - rect.setAttribute('fill', this.data.sc); - this.layerElement.appendChild(rect); -}; - -function NullElement(data, globalData, comp) { - this.initFrame(); - this.initBaseData(data, globalData, comp); - this.initFrame(); - this.initTransform(data, globalData, comp); - this.initHierarchy(); -} - -NullElement.prototype.prepareFrame = function (num) { - this.prepareProperties(num, true); -}; - -NullElement.prototype.renderFrame = function () { -}; - -NullElement.prototype.getBaseElement = function () { - return null; -}; - -NullElement.prototype.destroy = function () { -}; - -NullElement.prototype.sourceRectAtTime = function () { -}; - -NullElement.prototype.hide = function () { -}; - -extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement], NullElement); - -function SVGRendererBase() { -} - -extendPrototype([BaseRenderer], SVGRendererBase); - -SVGRendererBase.prototype.createNull = function (data) { - return new NullElement(data, this.globalData, this); -}; - -SVGRendererBase.prototype.createShape = function (data) { - return new SVGShapeElement(data, this.globalData, this); -}; - -SVGRendererBase.prototype.createText = function (data) { - return new SVGTextLottieElement(data, this.globalData, this); -}; - -SVGRendererBase.prototype.createImage = function (data) { - return new IImageElement(data, this.globalData, this); -}; - -SVGRendererBase.prototype.createSolid = function (data) { - return new ISolidElement(data, this.globalData, this); -}; - -SVGRendererBase.prototype.configAnimation = function (animData) { - this.svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg'); - if (this.renderConfig.viewBoxSize) { - this.svgElement.setAttribute('viewBox', this.renderConfig.viewBoxSize); - } else { - this.svgElement.setAttribute('viewBox', '0 0 ' + animData.w + ' ' + animData.h); - } - - if (!this.renderConfig.viewBoxOnly) { - this.svgElement.setAttribute('width', animData.w); - this.svgElement.setAttribute('height', animData.h); - this.svgElement.style.width = '100%'; - this.svgElement.style.height = '100%'; - this.svgElement.style.transform = 'translate3d(0,0,0)'; - this.svgElement.style.contentVisibility = this.renderConfig.contentVisibility; - } - if (this.renderConfig.width) { - this.svgElement.setAttribute('width', this.renderConfig.width); - } - if (this.renderConfig.height) { - this.svgElement.setAttribute('height', this.renderConfig.height); - } - if (this.renderConfig.className) { - this.svgElement.setAttribute('class', this.renderConfig.className); - } - if (this.renderConfig.id) { - this.svgElement.setAttribute('id', this.renderConfig.id); - } - if (this.renderConfig.focusable !== undefined) { - this.svgElement.setAttribute('focusable', this.renderConfig.focusable); - } - this.svgElement.setAttribute('preserveAspectRatio', this.renderConfig.preserveAspectRatio); - // this.layerElement.style.transform = 'translate3d(0,0,0)'; - // this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px"; - this.animationItem.wrapper.appendChild(this.svgElement); - // Mask animation - var defs = this.globalData.defs; - - this.setupGlobalData(animData, defs); - this.globalData.progressiveLoad = this.renderConfig.progressiveLoad; - this.data = animData; - - var maskElement = createNS('clipPath'); - var rect = createNS('rect'); - rect.setAttribute('width', animData.w); - rect.setAttribute('height', animData.h); - rect.setAttribute('x', 0); - rect.setAttribute('y', 0); - var maskId = createElementID(); - maskElement.setAttribute('id', maskId); - maskElement.appendChild(rect); - this.layerElement.setAttribute('clip-path', 'url(' + getLocationHref() + '#' + maskId + ')'); - - defs.appendChild(maskElement); - this.layers = animData.layers; - this.elements = createSizedArray(animData.layers.length); -}; - -SVGRendererBase.prototype.destroy = function () { - if (this.animationItem.wrapper) { - this.animationItem.wrapper.innerText = ''; - } - this.layerElement = null; - this.globalData.defs = null; - var i; - var len = this.layers ? this.layers.length : 0; - for (i = 0; i < len; i += 1) { - if (this.elements[i]) { - this.elements[i].destroy(); - } - } - this.elements.length = 0; - this.destroyed = true; - this.animationItem = null; -}; - -SVGRendererBase.prototype.updateContainerSize = function () { -}; - -SVGRendererBase.prototype.buildItem = function (pos) { - var elements = this.elements; - if (elements[pos] || this.layers[pos].ty === 99) { - return; - } - elements[pos] = true; - var element = this.createItem(this.layers[pos]); - - elements[pos] = element; - if (getExpressionsPlugin()) { - if (this.layers[pos].ty === 0) { - this.globalData.projectInterface.registerComposition(element); - } - element.initExpressions(); - } - this.appendElementInPos(element, pos); - if (this.layers[pos].tt) { - if (!this.elements[pos - 1] || this.elements[pos - 1] === true) { - this.buildItem(pos - 1); - this.addPendingElement(element); - } else { - element.setMatte(elements[pos - 1].layerId); - } - } -}; - -SVGRendererBase.prototype.checkPendingElements = function () { - while (this.pendingElements.length) { - var element = this.pendingElements.pop(); - element.checkParenting(); - if (element.data.tt) { - var i = 0; - var len = this.elements.length; - while (i < len) { - if (this.elements[i] === element) { - element.setMatte(this.elements[i - 1].layerId); - break; - } - i += 1; - } - } - } -}; - -SVGRendererBase.prototype.renderFrame = function (num) { - if (this.renderedFrame === num || this.destroyed) { - return; - } - if (num === null) { - num = this.renderedFrame; - } else { - this.renderedFrame = num; - } - // console.log('-------'); - // console.log('FRAME ',num); - this.globalData.frameNum = num; - this.globalData.frameId += 1; - this.globalData.projectInterface.currentFrame = num; - this.globalData._mdf = false; - var i; - var len = this.layers.length; - if (!this.completeLayers) { - this.checkLayers(num); - } - for (i = len - 1; i >= 0; i -= 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].prepareFrame(num - this.layers[i].st); - } - } - if (this.globalData._mdf) { - for (i = 0; i < len; i += 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].renderFrame(); - } - } - } -}; - -SVGRendererBase.prototype.appendElementInPos = function (element, pos) { - var newElement = element.getBaseElement(); - if (!newElement) { - return; - } - var i = 0; - var nextElement; - while (i < pos) { - if (this.elements[i] && this.elements[i] !== true && this.elements[i].getBaseElement()) { - nextElement = this.elements[i].getBaseElement(); - } - i += 1; - } - if (nextElement) { - this.layerElement.insertBefore(newElement, nextElement); - } else { - this.layerElement.appendChild(newElement); - } -}; - -SVGRendererBase.prototype.hide = function () { - this.layerElement.style.display = 'none'; -}; - -SVGRendererBase.prototype.show = function () { - this.layerElement.style.display = 'block'; -}; - -function ICompElement() {} - -extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement); - -ICompElement.prototype.initElement = function (data, globalData, comp) { - this.initFrame(); - this.initBaseData(data, globalData, comp); - this.initTransform(data, globalData, comp); - this.initRenderable(); - this.initHierarchy(); - this.initRendererElement(); - this.createContainerElements(); - this.createRenderableComponents(); - if (this.data.xt || !globalData.progressiveLoad) { - this.buildAllItems(); - } - this.hide(); -}; - -/* ICompElement.prototype.hide = function(){ - if(!this.hidden){ - this.hideElement(); - var i,len = this.elements.length; - for( i = 0; i < len; i+=1 ){ - if(this.elements[i]){ - this.elements[i].hide(); - } - } - } -}; */ - -ICompElement.prototype.prepareFrame = function (num) { - this._mdf = false; - this.prepareRenderableFrame(num); - this.prepareProperties(num, this.isInRange); - if (!this.isInRange && !this.data.xt) { - return; - } - - if (!this.tm._placeholder) { - var timeRemapped = this.tm.v; - if (timeRemapped === this.data.op) { - timeRemapped = this.data.op - 1; - } - this.renderedFrame = timeRemapped; - } else { - this.renderedFrame = num / this.data.sr; - } - var i; - var len = this.elements.length; - if (!this.completeLayers) { - this.checkLayers(this.renderedFrame); - } - // This iteration needs to be backwards because of how expressions connect between each other - for (i = len - 1; i >= 0; i -= 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st); - if (this.elements[i]._mdf) { - this._mdf = true; - } - } - } -}; - -ICompElement.prototype.renderInnerContent = function () { - var i; - var len = this.layers.length; - for (i = 0; i < len; i += 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].renderFrame(); - } - } -}; - -ICompElement.prototype.setElements = function (elems) { - this.elements = elems; -}; - -ICompElement.prototype.getElements = function () { - return this.elements; -}; - -ICompElement.prototype.destroyElements = function () { - var i; - var len = this.layers.length; - for (i = 0; i < len; i += 1) { - if (this.elements[i]) { - this.elements[i].destroy(); - } - } -}; - -ICompElement.prototype.destroy = function () { - this.destroyElements(); - this.destroyBaseElement(); -}; - -function SVGCompElement(data, globalData, comp) { - this.layers = data.layers; - this.supports3d = true; - this.completeLayers = false; - this.pendingElements = []; - this.elements = this.layers ? createSizedArray(this.layers.length) : []; - this.initElement(data, globalData, comp); - this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }; -} - -extendPrototype([SVGRendererBase, ICompElement, SVGBaseElement], SVGCompElement); - -SVGCompElement.prototype.createComp = function (data) { - return new SVGCompElement(data, this.globalData, this); -}; - -function SVGRenderer(animationItem, config) { - this.animationItem = animationItem; - this.layers = null; - this.renderedFrame = -1; - this.svgElement = createNS('svg'); - var ariaLabel = ''; - if (config && config.title) { - var titleElement = createNS('title'); - var titleId = createElementID(); - titleElement.setAttribute('id', titleId); - titleElement.textContent = config.title; - this.svgElement.appendChild(titleElement); - ariaLabel += titleId; - } - if (config && config.description) { - var descElement = createNS('desc'); - var descId = createElementID(); - descElement.setAttribute('id', descId); - descElement.textContent = config.description; - this.svgElement.appendChild(descElement); - ariaLabel += ' ' + descId; - } - if (ariaLabel) { - this.svgElement.setAttribute('aria-labelledby', ariaLabel); - } - var defs = createNS('defs'); - this.svgElement.appendChild(defs); - var maskElement = createNS('g'); - this.svgElement.appendChild(maskElement); - this.layerElement = maskElement; - this.renderConfig = { - preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet', - imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice', - contentVisibility: (config && config.contentVisibility) || 'visible', - progressiveLoad: (config && config.progressiveLoad) || false, - hideOnTransparent: !((config && config.hideOnTransparent === false)), - viewBoxOnly: (config && config.viewBoxOnly) || false, - viewBoxSize: (config && config.viewBoxSize) || false, - className: (config && config.className) || '', - id: (config && config.id) || '', - focusable: config && config.focusable, - filterSize: { - width: (config && config.filterSize && config.filterSize.width) || '100%', - height: (config && config.filterSize && config.filterSize.height) || '100%', - x: (config && config.filterSize && config.filterSize.x) || '0%', - y: (config && config.filterSize && config.filterSize.y) || '0%', - }, - width: (config && config.width), - height: (config && config.height), - }; - - this.globalData = { - _mdf: false, - frameNum: -1, - defs: defs, - renderConfig: this.renderConfig, - }; - this.elements = []; - this.pendingElements = []; - this.destroyed = false; - this.rendererType = 'svg'; -} - -extendPrototype([SVGRendererBase], SVGRenderer); - -SVGRenderer.prototype.createComp = function (data) { - return new SVGCompElement(data, this.globalData, this); -}; - -function CVContextData() { - this.saved = []; - this.cArrPos = 0; - this.cTr = new Matrix(); - this.cO = 1; - var i; - var len = 15; - this.savedOp = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - this.saved[i] = createTypedArray('float32', 16); - } - this._length = len; -} - -CVContextData.prototype.duplicate = function () { - var newLength = this._length * 2; - var currentSavedOp = this.savedOp; - this.savedOp = createTypedArray('float32', newLength); - this.savedOp.set(currentSavedOp); - var i = 0; - for (i = this._length; i < newLength; i += 1) { - this.saved[i] = createTypedArray('float32', 16); - } - this._length = newLength; -}; - -CVContextData.prototype.reset = function () { - this.cArrPos = 0; - this.cTr.reset(); - this.cO = 1; -}; - -function ShapeTransformManager() { - this.sequences = {}; - this.sequenceList = []; - this.transform_key_count = 0; -} - -ShapeTransformManager.prototype = { - addTransformSequence: function (transforms) { - var i; - var len = transforms.length; - var key = '_'; - for (i = 0; i < len; i += 1) { - key += transforms[i].transform.key + '_'; - } - var sequence = this.sequences[key]; - if (!sequence) { - sequence = { - transforms: [].concat(transforms), - finalTransform: new Matrix(), - _mdf: false, - }; - this.sequences[key] = sequence; - this.sequenceList.push(sequence); - } - return sequence; - }, - processSequence: function (sequence, isFirstFrame) { - var i = 0; - var len = sequence.transforms.length; - var _mdf = isFirstFrame; - while (i < len && !isFirstFrame) { - if (sequence.transforms[i].transform.mProps._mdf) { - _mdf = true; - break; - } - i += 1; - } - if (_mdf) { - var props; - sequence.finalTransform.reset(); - for (i = len - 1; i >= 0; i -= 1) { - props = sequence.transforms[i].transform.mProps.v.props; - sequence.finalTransform.transform(props[0], props[1], props[2], props[3], props[4], props[5], props[6], props[7], props[8], props[9], props[10], props[11], props[12], props[13], props[14], props[15]); - } - } - sequence._mdf = _mdf; - }, - processSequences: function (isFirstFrame) { - var i; - var len = this.sequenceList.length; - for (i = 0; i < len; i += 1) { - this.processSequence(this.sequenceList[i], isFirstFrame); - } - }, - getNewKey: function () { - this.transform_key_count += 1; - return '_' + this.transform_key_count; - }, -}; - -function CVEffects() { - -} -CVEffects.prototype.renderFrame = function () {}; - -function CVMaskElement(data, element) { - this.data = data; - this.element = element; - this.masksProperties = this.data.masksProperties || []; - this.viewData = createSizedArray(this.masksProperties.length); - var i; - var len = this.masksProperties.length; - var hasMasks = false; - for (i = 0; i < len; i += 1) { - if (this.masksProperties[i].mode !== 'n') { - hasMasks = true; - } - this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element, this.masksProperties[i], 3); - } - this.hasMasks = hasMasks; - if (hasMasks) { - this.element.addRenderableComponent(this); - } -} - -CVMaskElement.prototype.renderFrame = function () { - if (!this.hasMasks) { - return; - } - var transform = this.element.finalTransform.mat; - var ctx = this.element.canvasContext; - var i; - var len = this.masksProperties.length; - var pt; - var pts; - var data; - ctx.beginPath(); - for (i = 0; i < len; i += 1) { - if (this.masksProperties[i].mode !== 'n') { - if (this.masksProperties[i].inv) { - ctx.moveTo(0, 0); - ctx.lineTo(this.element.globalData.compSize.w, 0); - ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h); - ctx.lineTo(0, this.element.globalData.compSize.h); - ctx.lineTo(0, 0); - } - data = this.viewData[i].v; - pt = transform.applyToPointArray(data.v[0][0], data.v[0][1], 0); - ctx.moveTo(pt[0], pt[1]); - var j; - var jLen = data._length; - for (j = 1; j < jLen; j += 1) { - pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]); - ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); - } - pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]); - ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); - } - } - this.element.globalData.renderer.save(true); - ctx.clip(); -}; - -CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty; - -CVMaskElement.prototype.destroy = function () { - this.element = null; -}; - -function CVBaseElement() { -} - -CVBaseElement.prototype = { - createElements: function () {}, - initRendererElement: function () {}, - createContainerElements: function () { - this.canvasContext = this.globalData.canvasContext; - this.renderableEffectsManager = new CVEffects(this); - }, - createContent: function () {}, - setBlendMode: function () { - var globalData = this.globalData; - if (globalData.blendMode !== this.data.bm) { - globalData.blendMode = this.data.bm; - var blendModeValue = getBlendMode(this.data.bm); - globalData.canvasContext.globalCompositeOperation = blendModeValue; - } - }, - createRenderableComponents: function () { - this.maskManager = new CVMaskElement(this.data, this); - }, - hideElement: function () { - if (!this.hidden && (!this.isInRange || this.isTransparent)) { - this.hidden = true; - } - }, - showElement: function () { - if (this.isInRange && !this.isTransparent) { - this.hidden = false; - this._isFirstFrame = true; - this.maskManager._isFirstFrame = true; - } - }, - renderFrame: function () { - if (this.hidden || this.data.hd) { - return; - } - this.renderTransform(); - this.renderRenderable(); - this.setBlendMode(); - var forceRealStack = this.data.ty === 0; - this.globalData.renderer.save(forceRealStack); - this.globalData.renderer.ctxTransform(this.finalTransform.mat.props); - this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v); - this.renderInnerContent(); - this.globalData.renderer.restore(forceRealStack); - if (this.maskManager.hasMasks) { - this.globalData.renderer.restore(true); - } - if (this._isFirstFrame) { - this._isFirstFrame = false; - } - }, - destroy: function () { - this.canvasContext = null; - this.data = null; - this.globalData = null; - this.maskManager.destroy(); - }, - mHelper: new Matrix(), -}; -CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement; -CVBaseElement.prototype.show = CVBaseElement.prototype.showElement; - -function CVShapeData(element, data, styles, transformsManager) { - this.styledShapes = []; - this.tr = [0, 0, 0, 0, 0, 0]; - var ty = 4; - if (data.ty === 'rc') { - ty = 5; - } else if (data.ty === 'el') { - ty = 6; - } else if (data.ty === 'sr') { - ty = 7; - } - this.sh = ShapePropertyFactory.getShapeProp(element, data, ty, element); - var i; - var len = styles.length; - var styledShape; - for (i = 0; i < len; i += 1) { - if (!styles[i].closed) { - styledShape = { - transforms: transformsManager.addTransformSequence(styles[i].transforms), - trNodes: [], - }; - this.styledShapes.push(styledShape); - styles[i].elements.push(styledShape); - } - } -} - -CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated; - -function CVShapeElement(data, globalData, comp) { - this.shapes = []; - this.shapesData = data.shapes; - this.stylesList = []; - this.itemsData = []; - this.prevViewData = []; - this.shapeModifiers = []; - this.processedElements = []; - this.transformsManager = new ShapeTransformManager(); - this.initElement(data, globalData, comp); -} - -extendPrototype([BaseElement, TransformElement, CVBaseElement, IShapeElement, HierarchyElement, FrameElement, RenderableElement], CVShapeElement); - -CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement; - -CVShapeElement.prototype.transformHelper = { opacity: 1, _opMdf: false }; - -CVShapeElement.prototype.dashResetter = []; - -CVShapeElement.prototype.createContent = function () { - this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []); -}; - -CVShapeElement.prototype.createStyleElement = function (data, transforms) { - var styleElem = { - data: data, - type: data.ty, - preTransforms: this.transformsManager.addTransformSequence(transforms), - transforms: [], - elements: [], - closed: data.hd === true, - }; - var elementData = {}; - if (data.ty === 'fl' || data.ty === 'st') { - elementData.c = PropertyFactory.getProp(this, data.c, 1, 255, this); - if (!elementData.c.k) { - styleElem.co = 'rgb(' + bmFloor(elementData.c.v[0]) + ',' + bmFloor(elementData.c.v[1]) + ',' + bmFloor(elementData.c.v[2]) + ')'; - } - } else if (data.ty === 'gf' || data.ty === 'gs') { - elementData.s = PropertyFactory.getProp(this, data.s, 1, null, this); - elementData.e = PropertyFactory.getProp(this, data.e, 1, null, this); - elementData.h = PropertyFactory.getProp(this, data.h || { k: 0 }, 0, 0.01, this); - elementData.a = PropertyFactory.getProp(this, data.a || { k: 0 }, 0, degToRads, this); - elementData.g = new GradientProperty(this, data.g, this); - } - elementData.o = PropertyFactory.getProp(this, data.o, 0, 0.01, this); - if (data.ty === 'st' || data.ty === 'gs') { - styleElem.lc = lineCapEnum[data.lc || 2]; - styleElem.lj = lineJoinEnum[data.lj || 2]; - if (data.lj == 1) { // eslint-disable-line eqeqeq - styleElem.ml = data.ml; - } - elementData.w = PropertyFactory.getProp(this, data.w, 0, null, this); - if (!elementData.w.k) { - styleElem.wi = elementData.w.v; - } - if (data.d) { - var d = new DashProperty(this, data.d, 'canvas', this); - elementData.d = d; - if (!elementData.d.k) { - styleElem.da = elementData.d.dashArray; - styleElem.do = elementData.d.dashoffset[0]; - } - } - } else { - styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero'; - } - this.stylesList.push(styleElem); - elementData.style = styleElem; - return elementData; -}; - -CVShapeElement.prototype.createGroupElement = function () { - var elementData = { - it: [], - prevViewData: [], - }; - return elementData; -}; - -CVShapeElement.prototype.createTransformElement = function (data) { - var elementData = { - transform: { - opacity: 1, - _opMdf: false, - key: this.transformsManager.getNewKey(), - op: PropertyFactory.getProp(this, data.o, 0, 0.01, this), - mProps: TransformPropertyFactory.getTransformProperty(this, data, this), - }, - }; - return elementData; -}; - -CVShapeElement.prototype.createShapeElement = function (data) { - var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager); - - this.shapes.push(elementData); - this.addShapeToModifiers(elementData); - return elementData; -}; - -CVShapeElement.prototype.reloadShapes = function () { - this._isFirstFrame = true; - var i; - var len = this.itemsData.length; - for (i = 0; i < len; i += 1) { - this.prevViewData[i] = this.itemsData[i]; - } - this.searchShapes(this.shapesData, this.itemsData, this.prevViewData, true, []); - len = this.dynamicProperties.length; - for (i = 0; i < len; i += 1) { - this.dynamicProperties[i].getValue(); - } - this.renderModifiers(); - this.transformsManager.processSequences(this._isFirstFrame); -}; - -CVShapeElement.prototype.addTransformToStyleList = function (transform) { - var i; - var len = this.stylesList.length; - for (i = 0; i < len; i += 1) { - if (!this.stylesList[i].closed) { - this.stylesList[i].transforms.push(transform); - } - } -}; - -CVShapeElement.prototype.removeTransformFromStyleList = function () { - var i; - var len = this.stylesList.length; - for (i = 0; i < len; i += 1) { - if (!this.stylesList[i].closed) { - this.stylesList[i].transforms.pop(); - } - } -}; - -CVShapeElement.prototype.closeStyles = function (styles) { - var i; - var len = styles.length; - for (i = 0; i < len; i += 1) { - styles[i].closed = true; - } -}; - -CVShapeElement.prototype.searchShapes = function (arr, itemsData, prevViewData, shouldRender, transforms) { - var i; - var len = arr.length - 1; - var j; - var jLen; - var ownStyles = []; - var ownModifiers = []; - var processedPos; - var modifier; - var currentTransform; - var ownTransforms = [].concat(transforms); - for (i = len; i >= 0; i -= 1) { - processedPos = this.searchProcessedElement(arr[i]); - if (!processedPos) { - arr[i]._shouldRender = shouldRender; - } else { - itemsData[i] = prevViewData[processedPos - 1]; - } - if (arr[i].ty === 'fl' || arr[i].ty === 'st' || arr[i].ty === 'gf' || arr[i].ty === 'gs') { - if (!processedPos) { - itemsData[i] = this.createStyleElement(arr[i], ownTransforms); - } else { - itemsData[i].style.closed = false; - } - - ownStyles.push(itemsData[i].style); - } else if (arr[i].ty === 'gr') { - if (!processedPos) { - itemsData[i] = this.createGroupElement(arr[i]); - } else { - jLen = itemsData[i].it.length; - for (j = 0; j < jLen; j += 1) { - itemsData[i].prevViewData[j] = itemsData[i].it[j]; - } - } - this.searchShapes(arr[i].it, itemsData[i].it, itemsData[i].prevViewData, shouldRender, ownTransforms); - } else if (arr[i].ty === 'tr') { - if (!processedPos) { - currentTransform = this.createTransformElement(arr[i]); - itemsData[i] = currentTransform; - } - ownTransforms.push(itemsData[i]); - this.addTransformToStyleList(itemsData[i]); - } else if (arr[i].ty === 'sh' || arr[i].ty === 'rc' || arr[i].ty === 'el' || arr[i].ty === 'sr') { - if (!processedPos) { - itemsData[i] = this.createShapeElement(arr[i]); - } - } else if (arr[i].ty === 'tm' || arr[i].ty === 'rd' || arr[i].ty === 'pb') { - if (!processedPos) { - modifier = ShapeModifiers.getModifier(arr[i].ty); - modifier.init(this, arr[i]); - itemsData[i] = modifier; - this.shapeModifiers.push(modifier); - } else { - modifier = itemsData[i]; - modifier.closed = false; - } - ownModifiers.push(modifier); - } else if (arr[i].ty === 'rp') { - if (!processedPos) { - modifier = ShapeModifiers.getModifier(arr[i].ty); - itemsData[i] = modifier; - modifier.init(this, arr, i, itemsData); - this.shapeModifiers.push(modifier); - shouldRender = false; - } else { - modifier = itemsData[i]; - modifier.closed = true; - } - ownModifiers.push(modifier); - } - this.addProcessedElement(arr[i], i + 1); - } - this.removeTransformFromStyleList(); - this.closeStyles(ownStyles); - len = ownModifiers.length; - for (i = 0; i < len; i += 1) { - ownModifiers[i].closed = true; - } -}; - -CVShapeElement.prototype.renderInnerContent = function () { - this.transformHelper.opacity = 1; - this.transformHelper._opMdf = false; - this.renderModifiers(); - this.transformsManager.processSequences(this._isFirstFrame); - this.renderShape(this.transformHelper, this.shapesData, this.itemsData, true); -}; - -CVShapeElement.prototype.renderShapeTransform = function (parentTransform, groupTransform) { - if (parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) { - groupTransform.opacity = parentTransform.opacity; - groupTransform.opacity *= groupTransform.op.v; - groupTransform._opMdf = true; - } -}; - -CVShapeElement.prototype.drawLayer = function () { - var i; - var len = this.stylesList.length; - var j; - var jLen; - var k; - var kLen; - var elems; - var nodes; - var renderer = this.globalData.renderer; - var ctx = this.globalData.canvasContext; - var type; - var currentStyle; - for (i = 0; i < len; i += 1) { - currentStyle = this.stylesList[i]; - type = currentStyle.type; - - // Skipping style when - // Stroke width equals 0 - // style should not be rendered (extra unused repeaters) - // current opacity equals 0 - // global opacity equals 0 - if (!(((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0)) { - renderer.save(); - elems = currentStyle.elements; - if (type === 'st' || type === 'gs') { - ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd; - ctx.lineWidth = currentStyle.wi; - ctx.lineCap = currentStyle.lc; - ctx.lineJoin = currentStyle.lj; - ctx.miterLimit = currentStyle.ml || 0; - } else { - ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd; - } - renderer.ctxOpacity(currentStyle.coOp); - if (type !== 'st' && type !== 'gs') { - ctx.beginPath(); - } - renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props); - jLen = elems.length; - for (j = 0; j < jLen; j += 1) { - if (type === 'st' || type === 'gs') { - ctx.beginPath(); - if (currentStyle.da) { - ctx.setLineDash(currentStyle.da); - ctx.lineDashOffset = currentStyle.do; - } - } - nodes = elems[j].trNodes; - kLen = nodes.length; - - for (k = 0; k < kLen; k += 1) { - if (nodes[k].t === 'm') { - ctx.moveTo(nodes[k].p[0], nodes[k].p[1]); - } else if (nodes[k].t === 'c') { - ctx.bezierCurveTo(nodes[k].pts[0], nodes[k].pts[1], nodes[k].pts[2], nodes[k].pts[3], nodes[k].pts[4], nodes[k].pts[5]); - } else { - ctx.closePath(); - } - } - if (type === 'st' || type === 'gs') { - ctx.stroke(); - if (currentStyle.da) { - ctx.setLineDash(this.dashResetter); - } - } - } - if (type !== 'st' && type !== 'gs') { - ctx.fill(currentStyle.r); - } - renderer.restore(); - } - } -}; - -CVShapeElement.prototype.renderShape = function (parentTransform, items, data, isMain) { - var i; - var len = items.length - 1; - var groupTransform; - groupTransform = parentTransform; - for (i = len; i >= 0; i -= 1) { - if (items[i].ty === 'tr') { - groupTransform = data[i].transform; - this.renderShapeTransform(parentTransform, groupTransform); - } else if (items[i].ty === 'sh' || items[i].ty === 'el' || items[i].ty === 'rc' || items[i].ty === 'sr') { - this.renderPath(items[i], data[i]); - } else if (items[i].ty === 'fl') { - this.renderFill(items[i], data[i], groupTransform); - } else if (items[i].ty === 'st') { - this.renderStroke(items[i], data[i], groupTransform); - } else if (items[i].ty === 'gf' || items[i].ty === 'gs') { - this.renderGradientFill(items[i], data[i], groupTransform); - } else if (items[i].ty === 'gr') { - this.renderShape(groupTransform, items[i].it, data[i].it); - } else if (items[i].ty === 'tm') { - // - } - } - if (isMain) { - this.drawLayer(); - } -}; - -CVShapeElement.prototype.renderStyledShape = function (styledShape, shape) { - if (this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) { - var shapeNodes = styledShape.trNodes; - var paths = shape.paths; - var i; - var len; - var j; - var jLen = paths._length; - shapeNodes.length = 0; - var groupTransformMat = styledShape.transforms.finalTransform; - for (j = 0; j < jLen; j += 1) { - var pathNodes = paths.shapes[j]; - if (pathNodes && pathNodes.v) { - len = pathNodes._length; - for (i = 1; i < len; i += 1) { - if (i === 1) { - shapeNodes.push({ - t: 'm', - p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0), - }); - } - shapeNodes.push({ - t: 'c', - pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i]), - }); - } - if (len === 1) { - shapeNodes.push({ - t: 'm', - p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0), - }); - } - if (pathNodes.c && len) { - shapeNodes.push({ - t: 'c', - pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0]), - }); - shapeNodes.push({ - t: 'z', - }); - } - } - } - styledShape.trNodes = shapeNodes; - } -}; - -CVShapeElement.prototype.renderPath = function (pathData, itemData) { - if (pathData.hd !== true && pathData._shouldRender) { - var i; - var len = itemData.styledShapes.length; - for (i = 0; i < len; i += 1) { - this.renderStyledShape(itemData.styledShapes[i], itemData.sh); - } - } -}; - -CVShapeElement.prototype.renderFill = function (styleData, itemData, groupTransform) { - var styleElem = itemData.style; - - if (itemData.c._mdf || this._isFirstFrame) { - styleElem.co = 'rgb(' - + bmFloor(itemData.c.v[0]) + ',' - + bmFloor(itemData.c.v[1]) + ',' - + bmFloor(itemData.c.v[2]) + ')'; - } - if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) { - styleElem.coOp = itemData.o.v * groupTransform.opacity; - } -}; - -CVShapeElement.prototype.renderGradientFill = function (styleData, itemData, groupTransform) { - var styleElem = itemData.style; - var grd; - if (!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) { - var ctx = this.globalData.canvasContext; - var pt1 = itemData.s.v; - var pt2 = itemData.e.v; - if (styleData.t === 1) { - grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]); - } else { - var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2)); - var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]); - - var percent = itemData.h.v; - if (percent >= 1) { - percent = 0.99; - } else if (percent <= -1) { - percent = -0.99; - } - var dist = rad * percent; - var x = Math.cos(ang + itemData.a.v) * dist + pt1[0]; - var y = Math.sin(ang + itemData.a.v) * dist + pt1[1]; - grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad); - } - - var i; - var len = styleData.g.p; - var cValues = itemData.g.c; - var opacity = 1; - - for (i = 0; i < len; i += 1) { - if (itemData.g._hasOpacity && itemData.g._collapsable) { - opacity = itemData.g.o[i * 2 + 1]; - } - grd.addColorStop(cValues[i * 4] / 100, 'rgba(' + cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ',' + cValues[i * 4 + 3] + ',' + opacity + ')'); - } - styleElem.grd = grd; - } - styleElem.coOp = itemData.o.v * groupTransform.opacity; -}; - -CVShapeElement.prototype.renderStroke = function (styleData, itemData, groupTransform) { - var styleElem = itemData.style; - var d = itemData.d; - if (d && (d._mdf || this._isFirstFrame)) { - styleElem.da = d.dashArray; - styleElem.do = d.dashoffset[0]; - } - if (itemData.c._mdf || this._isFirstFrame) { - styleElem.co = 'rgb(' + bmFloor(itemData.c.v[0]) + ',' + bmFloor(itemData.c.v[1]) + ',' + bmFloor(itemData.c.v[2]) + ')'; - } - if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) { - styleElem.coOp = itemData.o.v * groupTransform.opacity; - } - if (itemData.w._mdf || this._isFirstFrame) { - styleElem.wi = itemData.w.v; - } -}; - -CVShapeElement.prototype.destroy = function () { - this.shapesData = null; - this.globalData = null; - this.canvasContext = null; - this.stylesList.length = 0; - this.itemsData.length = 0; -}; - -function CVTextElement(data, globalData, comp) { - this.textSpans = []; - this.yOffset = 0; - this.fillColorAnim = false; - this.strokeColorAnim = false; - this.strokeWidthAnim = false; - this.stroke = false; - this.fill = false; - this.justifyOffset = 0; - this.currentRender = null; - this.renderType = 'canvas'; - this.values = { - fill: 'rgba(0,0,0,0)', - stroke: 'rgba(0,0,0,0)', - sWidth: 0, - fValue: '', - }; - this.initElement(data, globalData, comp); -} -extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement, ITextElement], CVTextElement); - -CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d'); - -CVTextElement.prototype.buildNewText = function () { - var documentData = this.textProperty.currentData; - this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0); - - var hasFill = false; - if (documentData.fc) { - hasFill = true; - this.values.fill = this.buildColor(documentData.fc); - } else { - this.values.fill = 'rgba(0,0,0,0)'; - } - this.fill = hasFill; - var hasStroke = false; - if (documentData.sc) { - hasStroke = true; - this.values.stroke = this.buildColor(documentData.sc); - this.values.sWidth = documentData.sw; - } - var fontData = this.globalData.fontManager.getFontByName(documentData.f); - var i; - var len; - var letters = documentData.l; - var matrixHelper = this.mHelper; - this.stroke = hasStroke; - this.values.fValue = documentData.finalSize + 'px ' + this.globalData.fontManager.getFontByName(documentData.f).fFamily; - len = documentData.finalText.length; - // this.tHelper.font = this.values.fValue; - var charData; - var shapeData; - var k; - var kLen; - var shapes; - var j; - var jLen; - var pathNodes; - var commands; - var pathArr; - var singleShape = this.data.singleShape; - var trackingOffset = documentData.tr * 0.001 * documentData.finalSize; - var xPos = 0; - var yPos = 0; - var firstLine = true; - var cnt = 0; - for (i = 0; i < len; i += 1) { - charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily); - shapeData = (charData && charData.data) || {}; - matrixHelper.reset(); - if (singleShape && letters[i].n) { - xPos = -trackingOffset; - yPos += documentData.yOffset; - yPos += firstLine ? 1 : 0; - firstLine = false; - } - shapes = shapeData.shapes ? shapeData.shapes[0].it : []; - jLen = shapes.length; - matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100); - if (singleShape) { - this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos); - } - commands = createSizedArray(jLen - 1); - var commandsCounter = 0; - for (j = 0; j < jLen; j += 1) { - if (shapes[j].ty === 'sh') { - kLen = shapes[j].ks.k.i.length; - pathNodes = shapes[j].ks.k; - pathArr = []; - for (k = 1; k < kLen; k += 1) { - if (k === 1) { - pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0)); - } - pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToY(pathNodes.i[k][0], pathNodes.i[k][1], 0), matrixHelper.applyToX(pathNodes.v[k][0], pathNodes.v[k][1], 0), matrixHelper.applyToY(pathNodes.v[k][0], pathNodes.v[k][1], 0)); - } - pathArr.push(matrixHelper.applyToX(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToY(pathNodes.o[k - 1][0], pathNodes.o[k - 1][1], 0), matrixHelper.applyToX(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToY(pathNodes.i[0][0], pathNodes.i[0][1], 0), matrixHelper.applyToX(pathNodes.v[0][0], pathNodes.v[0][1], 0), matrixHelper.applyToY(pathNodes.v[0][0], pathNodes.v[0][1], 0)); - commands[commandsCounter] = pathArr; - commandsCounter += 1; - } - } - if (singleShape) { - xPos += letters[i].l; - xPos += trackingOffset; - } - if (this.textSpans[cnt]) { - this.textSpans[cnt].elem = commands; - } else { - this.textSpans[cnt] = { elem: commands }; - } - cnt += 1; - } -}; - -CVTextElement.prototype.renderInnerContent = function () { - var ctx = this.canvasContext; - ctx.font = this.values.fValue; - ctx.lineCap = 'butt'; - ctx.lineJoin = 'miter'; - ctx.miterLimit = 4; - - if (!this.data.singleShape) { - this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag); - } - - var i; - var len; - var j; - var jLen; - var k; - var kLen; - var renderedLetters = this.textAnimator.renderedLetters; - - var letters = this.textProperty.currentData.l; - - len = letters.length; - var renderedLetter; - var lastFill = null; - var lastStroke = null; - var lastStrokeW = null; - var commands; - var pathArr; - for (i = 0; i < len; i += 1) { - if (!letters[i].n) { - renderedLetter = renderedLetters[i]; - if (renderedLetter) { - this.globalData.renderer.save(); - this.globalData.renderer.ctxTransform(renderedLetter.p); - this.globalData.renderer.ctxOpacity(renderedLetter.o); - } - if (this.fill) { - if (renderedLetter && renderedLetter.fc) { - if (lastFill !== renderedLetter.fc) { - lastFill = renderedLetter.fc; - ctx.fillStyle = renderedLetter.fc; - } - } else if (lastFill !== this.values.fill) { - lastFill = this.values.fill; - ctx.fillStyle = this.values.fill; - } - commands = this.textSpans[i].elem; - jLen = commands.length; - this.globalData.canvasContext.beginPath(); - for (j = 0; j < jLen; j += 1) { - pathArr = commands[j]; - kLen = pathArr.length; - this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]); - for (k = 2; k < kLen; k += 6) { - this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]); - } - } - this.globalData.canvasContext.closePath(); - this.globalData.canvasContext.fill(); - /// ctx.fillText(this.textSpans[i].val,0,0); - } - if (this.stroke) { - if (renderedLetter && renderedLetter.sw) { - if (lastStrokeW !== renderedLetter.sw) { - lastStrokeW = renderedLetter.sw; - ctx.lineWidth = renderedLetter.sw; - } - } else if (lastStrokeW !== this.values.sWidth) { - lastStrokeW = this.values.sWidth; - ctx.lineWidth = this.values.sWidth; - } - if (renderedLetter && renderedLetter.sc) { - if (lastStroke !== renderedLetter.sc) { - lastStroke = renderedLetter.sc; - ctx.strokeStyle = renderedLetter.sc; - } - } else if (lastStroke !== this.values.stroke) { - lastStroke = this.values.stroke; - ctx.strokeStyle = this.values.stroke; - } - commands = this.textSpans[i].elem; - jLen = commands.length; - this.globalData.canvasContext.beginPath(); - for (j = 0; j < jLen; j += 1) { - pathArr = commands[j]; - kLen = pathArr.length; - this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]); - for (k = 2; k < kLen; k += 6) { - this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]); - } - } - this.globalData.canvasContext.closePath(); - this.globalData.canvasContext.stroke(); - /// ctx.strokeText(letters[i].val,0,0); - } - if (renderedLetter) { - this.globalData.renderer.restore(); - } - } - } -}; - -function CVImageElement(data, globalData, comp) { - this.assetData = globalData.getAssetData(data.refId); - this.img = globalData.imageLoader.getAsset(this.assetData); - this.initElement(data, globalData, comp); -} -extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement); - -CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement; -CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame; - -CVImageElement.prototype.createContent = function () { - if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) { - var canvas = createTag('canvas'); - canvas.width = this.assetData.w; - canvas.height = this.assetData.h; - var ctx = canvas.getContext('2d'); - - var imgW = this.img.width; - var imgH = this.img.height; - var imgRel = imgW / imgH; - var canvasRel = this.assetData.w / this.assetData.h; - var widthCrop; - var heightCrop; - var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio; - if ((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) { - heightCrop = imgH; - widthCrop = heightCrop * canvasRel; - } else { - widthCrop = imgW; - heightCrop = widthCrop / canvasRel; - } - ctx.drawImage(this.img, (imgW - widthCrop) / 2, (imgH - heightCrop) / 2, widthCrop, heightCrop, 0, 0, this.assetData.w, this.assetData.h); - this.img = canvas; - } -}; - -CVImageElement.prototype.renderInnerContent = function () { - this.canvasContext.drawImage(this.img, 0, 0); -}; - -CVImageElement.prototype.destroy = function () { - this.img = null; -}; - -function CVSolidElement(data, globalData, comp) { - this.initElement(data, globalData, comp); -} -extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement); - -CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement; -CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame; - -CVSolidElement.prototype.renderInnerContent = function () { - var ctx = this.canvasContext; - ctx.fillStyle = this.data.sc; - ctx.fillRect(0, 0, this.data.sw, this.data.sh); - // -}; - -function CanvasRendererBase(animationItem, config) { - this.animationItem = animationItem; - this.renderConfig = { - clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true, - context: (config && config.context) || null, - progressiveLoad: (config && config.progressiveLoad) || false, - preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet', - imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice', - contentVisibility: (config && config.contentVisibility) || 'visible', - className: (config && config.className) || '', - id: (config && config.id) || '', - }; - this.renderConfig.dpr = (config && config.dpr) || 1; - if (this.animationItem.wrapper) { - this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1; - } - this.renderedFrame = -1; - this.globalData = { - frameNum: -1, - _mdf: false, - renderConfig: this.renderConfig, - currentGlobalAlpha: -1, - }; - this.contextData = new CVContextData(); - this.elements = []; - this.pendingElements = []; - this.transformMat = new Matrix(); - this.completeLayers = false; - this.rendererType = 'canvas'; -} -extendPrototype([BaseRenderer], CanvasRendererBase); - -CanvasRendererBase.prototype.createShape = function (data) { - return new CVShapeElement(data, this.globalData, this); -}; - -CanvasRendererBase.prototype.createText = function (data) { - return new CVTextElement(data, this.globalData, this); -}; - -CanvasRendererBase.prototype.createImage = function (data) { - return new CVImageElement(data, this.globalData, this); -}; - -CanvasRendererBase.prototype.createSolid = function (data) { - return new CVSolidElement(data, this.globalData, this); -}; - -CanvasRendererBase.prototype.createNull = SVGRenderer.prototype.createNull; - -CanvasRendererBase.prototype.ctxTransform = function (props) { - if (props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0) { - return; - } - if (!this.renderConfig.clearCanvas) { - this.canvasContext.transform(props[0], props[1], props[4], props[5], props[12], props[13]); - return; - } - this.transformMat.cloneFromProps(props); - var cProps = this.contextData.cTr.props; - this.transformMat.transform(cProps[0], cProps[1], cProps[2], cProps[3], cProps[4], cProps[5], cProps[6], cProps[7], cProps[8], cProps[9], cProps[10], cProps[11], cProps[12], cProps[13], cProps[14], cProps[15]); - // this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]); - this.contextData.cTr.cloneFromProps(this.transformMat.props); - var trProps = this.contextData.cTr.props; - this.canvasContext.setTransform(trProps[0], trProps[1], trProps[4], trProps[5], trProps[12], trProps[13]); -}; - -CanvasRendererBase.prototype.ctxOpacity = function (op) { - /* if(op === 1){ - return; - } */ - if (!this.renderConfig.clearCanvas) { - this.canvasContext.globalAlpha *= op < 0 ? 0 : op; - this.globalData.currentGlobalAlpha = this.contextData.cO; - return; - } - this.contextData.cO *= op < 0 ? 0 : op; - if (this.globalData.currentGlobalAlpha !== this.contextData.cO) { - this.canvasContext.globalAlpha = this.contextData.cO; - this.globalData.currentGlobalAlpha = this.contextData.cO; - } -}; - -CanvasRendererBase.prototype.reset = function () { - if (!this.renderConfig.clearCanvas) { - this.canvasContext.restore(); - return; - } - this.contextData.reset(); -}; - -CanvasRendererBase.prototype.save = function (actionFlag) { - if (!this.renderConfig.clearCanvas) { - this.canvasContext.save(); - return; - } - if (actionFlag) { - this.canvasContext.save(); - } - var props = this.contextData.cTr.props; - if (this.contextData._length <= this.contextData.cArrPos) { - this.contextData.duplicate(); - } - var i; - var arr = this.contextData.saved[this.contextData.cArrPos]; - for (i = 0; i < 16; i += 1) { - arr[i] = props[i]; - } - this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO; - this.contextData.cArrPos += 1; -}; - -CanvasRendererBase.prototype.restore = function (actionFlag) { - if (!this.renderConfig.clearCanvas) { - this.canvasContext.restore(); - return; - } - if (actionFlag) { - this.canvasContext.restore(); - this.globalData.blendMode = 'source-over'; - } - this.contextData.cArrPos -= 1; - var popped = this.contextData.saved[this.contextData.cArrPos]; - var i; - var arr = this.contextData.cTr.props; - for (i = 0; i < 16; i += 1) { - arr[i] = popped[i]; - } - this.canvasContext.setTransform(popped[0], popped[1], popped[4], popped[5], popped[12], popped[13]); - popped = this.contextData.savedOp[this.contextData.cArrPos]; - this.contextData.cO = popped; - if (this.globalData.currentGlobalAlpha !== popped) { - this.canvasContext.globalAlpha = popped; - this.globalData.currentGlobalAlpha = popped; - } -}; - -CanvasRendererBase.prototype.configAnimation = function (animData) { - if (this.animationItem.wrapper) { - this.animationItem.container = createTag('canvas'); - var containerStyle = this.animationItem.container.style; - containerStyle.width = '100%'; - containerStyle.height = '100%'; - var origin = '0px 0px 0px'; - containerStyle.transformOrigin = origin; - containerStyle.mozTransformOrigin = origin; - containerStyle.webkitTransformOrigin = origin; - containerStyle['-webkit-transform'] = origin; - containerStyle.contentVisibility = this.renderConfig.contentVisibility; - this.animationItem.wrapper.appendChild(this.animationItem.container); - this.canvasContext = this.animationItem.container.getContext('2d'); - if (this.renderConfig.className) { - this.animationItem.container.setAttribute('class', this.renderConfig.className); - } - if (this.renderConfig.id) { - this.animationItem.container.setAttribute('id', this.renderConfig.id); - } - } else { - this.canvasContext = this.renderConfig.context; - } - this.data = animData; - this.layers = animData.layers; - this.transformCanvas = { - w: animData.w, - h: animData.h, - sx: 0, - sy: 0, - tx: 0, - ty: 0, - }; - this.setupGlobalData(animData, document.body); - this.globalData.canvasContext = this.canvasContext; - this.globalData.renderer = this; - this.globalData.isDashed = false; - this.globalData.progressiveLoad = this.renderConfig.progressiveLoad; - this.globalData.transformCanvas = this.transformCanvas; - this.elements = createSizedArray(animData.layers.length); - - this.updateContainerSize(); -}; - -CanvasRendererBase.prototype.updateContainerSize = function () { - this.reset(); - var elementWidth; - var elementHeight; - if (this.animationItem.wrapper && this.animationItem.container) { - elementWidth = this.animationItem.wrapper.offsetWidth; - elementHeight = this.animationItem.wrapper.offsetHeight; - this.animationItem.container.setAttribute('width', elementWidth * this.renderConfig.dpr); - this.animationItem.container.setAttribute('height', elementHeight * this.renderConfig.dpr); - } else { - elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr; - elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr; - } - var elementRel; - var animationRel; - if (this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1) { - var par = this.renderConfig.preserveAspectRatio.split(' '); - var fillType = par[1] || 'meet'; - var pos = par[0] || 'xMidYMid'; - var xPos = pos.substr(0, 4); - var yPos = pos.substr(4); - elementRel = elementWidth / elementHeight; - animationRel = this.transformCanvas.w / this.transformCanvas.h; - if ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice')) { - this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); - this.transformCanvas.sy = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); - } else { - this.transformCanvas.sx = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); - this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); - } - - if (xPos === 'xMid' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) { - this.transformCanvas.tx = ((elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) / 2) * this.renderConfig.dpr; - } else if (xPos === 'xMax' && ((animationRel < elementRel && fillType === 'meet') || (animationRel > elementRel && fillType === 'slice'))) { - this.transformCanvas.tx = (elementWidth - this.transformCanvas.w * (elementHeight / this.transformCanvas.h)) * this.renderConfig.dpr; - } else { - this.transformCanvas.tx = 0; - } - if (yPos === 'YMid' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) { - this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w)) / 2) * this.renderConfig.dpr; - } else if (yPos === 'YMax' && ((animationRel > elementRel && fillType === 'meet') || (animationRel < elementRel && fillType === 'slice'))) { - this.transformCanvas.ty = ((elementHeight - this.transformCanvas.h * (elementWidth / this.transformCanvas.w))) * this.renderConfig.dpr; - } else { - this.transformCanvas.ty = 0; - } - } else if (this.renderConfig.preserveAspectRatio === 'none') { - this.transformCanvas.sx = elementWidth / (this.transformCanvas.w / this.renderConfig.dpr); - this.transformCanvas.sy = elementHeight / (this.transformCanvas.h / this.renderConfig.dpr); - this.transformCanvas.tx = 0; - this.transformCanvas.ty = 0; - } else { - this.transformCanvas.sx = this.renderConfig.dpr; - this.transformCanvas.sy = this.renderConfig.dpr; - this.transformCanvas.tx = 0; - this.transformCanvas.ty = 0; - } - this.transformCanvas.props = [this.transformCanvas.sx, 0, 0, 0, 0, this.transformCanvas.sy, 0, 0, 0, 0, 1, 0, this.transformCanvas.tx, this.transformCanvas.ty, 0, 1]; - /* var i, len = this.elements.length; - for(i=0;i= 0; i -= 1) { - if (this.elements[i]) { - this.elements[i].destroy(); - } - } - this.elements.length = 0; - this.globalData.canvasContext = null; - this.animationItem.container = null; - this.destroyed = true; -}; - -CanvasRendererBase.prototype.renderFrame = function (num, forceRender) { - if ((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1) { - return; - } - this.renderedFrame = num; - this.globalData.frameNum = num - this.animationItem._isFirstFrame; - this.globalData.frameId += 1; - this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender; - this.globalData.projectInterface.currentFrame = num; - - // console.log('--------'); - // console.log('NEW: ',num); - var i; - var len = this.layers.length; - if (!this.completeLayers) { - this.checkLayers(num); - } - - for (i = 0; i < len; i += 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].prepareFrame(num - this.layers[i].st); - } - } - if (this.globalData._mdf) { - if (this.renderConfig.clearCanvas === true) { - this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h); - } else { - this.save(); - } - for (i = len - 1; i >= 0; i -= 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].renderFrame(); - } - } - if (this.renderConfig.clearCanvas !== true) { - this.restore(); - } - } -}; - -CanvasRendererBase.prototype.buildItem = function (pos) { - var elements = this.elements; - if (elements[pos] || this.layers[pos].ty === 99) { - return; - } - var element = this.createItem(this.layers[pos], this, this.globalData); - elements[pos] = element; - element.initExpressions(); - /* if(this.layers[pos].ty === 0){ - element.resize(this.globalData.transformCanvas); - } */ -}; - -CanvasRendererBase.prototype.checkPendingElements = function () { - while (this.pendingElements.length) { - var element = this.pendingElements.pop(); - element.checkParenting(); - } -}; - -CanvasRendererBase.prototype.hide = function () { - this.animationItem.container.style.display = 'none'; -}; - -CanvasRendererBase.prototype.show = function () { - this.animationItem.container.style.display = 'block'; -}; - -function CVCompElement(data, globalData, comp) { - this.completeLayers = false; - this.layers = data.layers; - this.pendingElements = []; - this.elements = createSizedArray(this.layers.length); - this.initElement(data, globalData, comp); - this.tm = data.tm ? PropertyFactory.getProp(this, data.tm, 0, globalData.frameRate, this) : { _placeholder: true }; -} - -extendPrototype([CanvasRendererBase, ICompElement, CVBaseElement], CVCompElement); - -CVCompElement.prototype.renderInnerContent = function () { - var ctx = this.canvasContext; - ctx.beginPath(); - ctx.moveTo(0, 0); - ctx.lineTo(this.data.w, 0); - ctx.lineTo(this.data.w, this.data.h); - ctx.lineTo(0, this.data.h); - ctx.lineTo(0, 0); - ctx.clip(); - var i; - var len = this.layers.length; - for (i = len - 1; i >= 0; i -= 1) { - if (this.completeLayers || this.elements[i]) { - this.elements[i].renderFrame(); - } - } -}; - -CVCompElement.prototype.destroy = function () { - var i; - var len = this.layers.length; - for (i = len - 1; i >= 0; i -= 1) { - if (this.elements[i]) { - this.elements[i].destroy(); - } - } - this.layers = null; - this.elements = null; -}; - -CVCompElement.prototype.createComp = function (data) { - return new CVCompElement(data, this.globalData, this); -}; - -function CanvasRenderer(animationItem, config) { - this.animationItem = animationItem; - this.renderConfig = { - clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true, - context: (config && config.context) || null, - progressiveLoad: (config && config.progressiveLoad) || false, - preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet', - imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice', - contentVisibility: (config && config.contentVisibility) || 'visible', - className: (config && config.className) || '', - id: (config && config.id) || '', - }; - this.renderConfig.dpr = (config && config.dpr) || 1; - if (this.animationItem.wrapper) { - this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1; - } - this.renderedFrame = -1; - this.globalData = { - frameNum: -1, - _mdf: false, - renderConfig: this.renderConfig, - currentGlobalAlpha: -1, - }; - this.contextData = new CVContextData(); - this.elements = []; - this.pendingElements = []; - this.transformMat = new Matrix(); - this.completeLayers = false; - this.rendererType = 'canvas'; -} -extendPrototype([CanvasRendererBase], CanvasRenderer); - -CanvasRenderer.prototype.createComp = function (data) { - return new CVCompElement(data, this.globalData, this); -}; - -// Registering renderers -registerRenderer('canvas', CanvasRenderer); - -// Registering shape modifiers -ShapeModifiers.registerModifier('tm', TrimModifier); -ShapeModifiers.registerModifier('pb', PuckerAndBloatModifier); -ShapeModifiers.registerModifier('rp', RepeaterModifier); -ShapeModifiers.registerModifier('rd', RoundCornersModifier); - -const Expressions = (function () { - var ob = {}; - ob.initExpressions = initExpressions; - - function initExpressions(animation) { - var stackCount = 0; - var registers = []; - - function pushExpression() { - stackCount += 1; - } - - function popExpression() { - stackCount -= 1; - if (stackCount === 0) { - releaseInstances(); - } - } - - function registerExpressionProperty(expression) { - if (registers.indexOf(expression) === -1) { - registers.push(expression); - } - } - - function releaseInstances() { - var i; - var len = registers.length; - for (i = 0; i < len; i += 1) { - registers[i].release(); - } - registers.length = 0; - } - - animation.renderer.compInterface = CompExpressionInterface(animation.renderer); - animation.renderer.globalData.projectInterface.registerComposition(animation.renderer); - animation.renderer.globalData.pushExpression = pushExpression; - animation.renderer.globalData.popExpression = popExpression; - animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty; - } - return ob; -}()); - -/* eslint-disable */ -/* - Copyright 2014 David Bau. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - */ - -function seedRandom(pool, math) { -// -// The following constants are related to IEEE 754 limits. -// - var global = this, - width = 256, // each RC4 output is 0 <= x < 256 - chunks = 6, // at least six RC4 outputs for each double - digits = 52, // there are 52 significant digits in a double - rngname = 'random', // rngname: name for Math.random and Math.seedrandom - startdenom = math.pow(width, chunks), - significance = math.pow(2, digits), - overflow = significance * 2, - mask = width - 1, - nodecrypto; // node.js crypto module, initialized at the bottom. - -// -// seedrandom() -// This is the seedrandom function described above. -// - function seedrandom(seed, options, callback) { - var key = []; - options = (options === true) ? { entropy: true } : (options || {}); - - // Flatten the seed string or build one from local entropy if needed. - var shortseed = mixkey(flatten( - options.entropy ? [seed, tostring(pool)] : - (seed === null) ? autoseed() : seed, 3), key); - - // Use the seed to initialize an ARC4 generator. - var arc4 = new ARC4(key); - - // This function returns a random double in [0, 1) that contains - // randomness in every bit of the mantissa of the IEEE 754 value. - var prng = function() { - var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48 - d = startdenom, // and denominator d = 2 ^ 48. - x = 0; // and no 'extra last byte'. - while (n < significance) { // Fill up all significant digits by - n = (n + x) * width; // shifting numerator and - d *= width; // denominator and generating a - x = arc4.g(1); // new least-significant-byte. - } - while (n >= overflow) { // To avoid rounding up, before adding - n /= 2; // last byte, shift everything - d /= 2; // right using integer math until - x >>>= 1; // we have exactly the desired bits. - } - return (n + x) / d; // Form the number within [0, 1). - }; - - prng.int32 = function() { return arc4.g(4) | 0; }; - prng.quick = function() { return arc4.g(4) / 0x100000000; }; - prng.double = prng; - - // Mix the randomness into accumulated entropy. - mixkey(tostring(arc4.S), pool); - - // Calling convention: what to return as a function of prng, seed, is_math. - return (options.pass || callback || - function(prng, seed, is_math_call, state) { - if (state) { - // Load the arc4 state from the given state if it has an S array. - if (state.S) { copy(state, arc4); } - // Only provide the .state method if requested via options.state. - prng.state = function() { return copy(arc4, {}); }; - } - - // If called as a method of Math (Math.seedrandom()), mutate - // Math.random because that is how seedrandom.js has worked since v1.0. - if (is_math_call) { math[rngname] = prng; return seed; } - - // Otherwise, it is a newer calling convention, so return the - // prng directly. - else return prng; - })( - prng, - shortseed, - 'global' in options ? options.global : (this == math), - options.state); - } - math['seed' + rngname] = seedrandom; - -// -// ARC4 -// -// An ARC4 implementation. The constructor takes a key in the form of -// an array of at most (width) integers that should be 0 <= x < (width). -// -// The g(count) method returns a pseudorandom integer that concatenates -// the next (count) outputs from ARC4. Its return value is a number x -// that is in the range 0 <= x < (width ^ count). -// - function ARC4(key) { - var t, keylen = key.length, - me = this, i = 0, j = me.i = me.j = 0, s = me.S = []; - - // The empty key [] is treated as [0]. - if (!keylen) { key = [keylen++]; } - - // Set up S using the standard key scheduling algorithm. - while (i < width) { - s[i] = i++; - } - for (i = 0; i < width; i++) { - s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))]; - s[j] = t; - } - - // The "g" method returns the next (count) outputs as one number. - me.g = function(count) { - // Using instance members instead of closure state nearly doubles speed. - var t, r = 0, - i = me.i, j = me.j, s = me.S; - while (count--) { - t = s[i = mask & (i + 1)]; - r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))]; - } - me.i = i; me.j = j; - return r; - // For robust unpredictability, the function call below automatically - // discards an initial batch of values. This is called RC4-drop[256]. - // See http://google.com/search?q=rsa+fluhrer+response&btnI - }; - } - -// -// copy() -// Copies internal state of ARC4 to or from a plain object. -// - function copy(f, t) { - t.i = f.i; - t.j = f.j; - t.S = f.S.slice(); - return t; - } - -// -// flatten() -// Converts an object tree to nested arrays of strings. -// - function flatten(obj, depth) { - var result = [], typ = (typeof obj), prop; - if (depth && typ == 'object') { - for (prop in obj) { - try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {} - } - } - return (result.length ? result : typ == 'string' ? obj : obj + '\0'); - } - -// -// mixkey() -// Mixes a string seed into a key that is an array of integers, and -// returns a shortened string seed that is equivalent to the result key. -// - function mixkey(seed, key) { - var stringseed = seed + '', smear, j = 0; - while (j < stringseed.length) { - key[mask & j] = - mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++)); - } - return tostring(key); - } - -// -// autoseed() -// Returns an object for autoseeding, using window.crypto and Node crypto -// module if available. -// - function autoseed() { - try { - if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); } - var out = new Uint8Array(width); - (global.crypto || global.msCrypto).getRandomValues(out); - return tostring(out); - } catch (e) { - var browser = global.navigator, - plugins = browser && browser.plugins; - return [+new Date(), global, plugins, global.screen, tostring(pool)]; - } - } - -// -// tostring() -// Converts an array of charcodes to a string -// - function tostring(a) { - return String.fromCharCode.apply(0, a); - } - -// -// When seedrandom.js is loaded, we immediately mix a few bits -// from the built-in RNG into the entropy pool. Because we do -// not want to interfere with deterministic PRNG state later, -// seedrandom will not call math.random on its own again after -// initialization. -// - mixkey(math.random(), pool); - -// -// Nodejs and AMD support: export the implementation as a module using -// either convention. -// - -// End anonymous scope, and pass initial values. -}; - -function initialize$2(BMMath) { - seedRandom([], BMMath); -} - -var propTypes = { - SHAPE: 'shape', -}; - -/* eslint-disable camelcase */ - -const ExpressionManager = (function () { - 'use strict'; - - var ob = {}; - var Math = BMMath; - var window = null; - var document = null; - var XMLHttpRequest = null; - var fetch = null; - var frames = null; - initialize$2(BMMath); - - function $bm_isInstanceOfArray(arr) { - return arr.constructor === Array || arr.constructor === Float32Array; - } - - function isNumerable(tOfV, v) { - return tOfV === 'number' || tOfV === 'boolean' || tOfV === 'string' || v instanceof Number; - } - - function $bm_neg(a) { - var tOfA = typeof a; - if (tOfA === 'number' || tOfA === 'boolean' || a instanceof Number) { - return -a; - } - if ($bm_isInstanceOfArray(a)) { - var i; - var lenA = a.length; - var retArr = []; - for (i = 0; i < lenA; i += 1) { - retArr[i] = -a[i]; - } - return retArr; - } - if (a.propType) { - return a.v; - } - return -a; - } - - var easeInBez = BezierFactory.getBezierEasing(0.333, 0, 0.833, 0.833, 'easeIn').get; - var easeOutBez = BezierFactory.getBezierEasing(0.167, 0.167, 0.667, 1, 'easeOut').get; - var easeInOutBez = BezierFactory.getBezierEasing(0.33, 0, 0.667, 1, 'easeInOut').get; - - function sum(a, b) { - var tOfA = typeof a; - var tOfB = typeof b; - if (tOfA === 'string' || tOfB === 'string') { - return a + b; - } - if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) { - return a + b; - } - if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { - a = a.slice(0); - a[0] += b; - return a; - } - if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { - b = b.slice(0); - b[0] = a + b[0]; - return b; - } - if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) { - var i = 0; - var lenA = a.length; - var lenB = b.length; - var retArr = []; - while (i < lenA || i < lenB) { - if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) { - retArr[i] = a[i] + b[i]; - } else { - retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]; - } - i += 1; - } - return retArr; - } - return 0; - } - var add = sum; - - function sub(a, b) { - var tOfA = typeof a; - var tOfB = typeof b; - if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) { - if (tOfA === 'string') { - a = parseInt(a, 10); - } - if (tOfB === 'string') { - b = parseInt(b, 10); - } - return a - b; - } - if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { - a = a.slice(0); - a[0] -= b; - return a; - } - if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { - b = b.slice(0); - b[0] = a - b[0]; - return b; - } - if ($bm_isInstanceOfArray(a) && $bm_isInstanceOfArray(b)) { - var i = 0; - var lenA = a.length; - var lenB = b.length; - var retArr = []; - while (i < lenA || i < lenB) { - if ((typeof a[i] === 'number' || a[i] instanceof Number) && (typeof b[i] === 'number' || b[i] instanceof Number)) { - retArr[i] = a[i] - b[i]; - } else { - retArr[i] = b[i] === undefined ? a[i] : a[i] || b[i]; - } - i += 1; - } - return retArr; - } - return 0; - } - - function mul(a, b) { - var tOfA = typeof a; - var tOfB = typeof b; - var arr; - if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) { - return a * b; - } - - var i; - var len; - if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { - len = a.length; - arr = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - arr[i] = a[i] * b; - } - return arr; - } - if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { - len = b.length; - arr = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - arr[i] = a * b[i]; - } - return arr; - } - return 0; - } - - function div(a, b) { - var tOfA = typeof a; - var tOfB = typeof b; - var arr; - if (isNumerable(tOfA, a) && isNumerable(tOfB, b)) { - return a / b; - } - var i; - var len; - if ($bm_isInstanceOfArray(a) && isNumerable(tOfB, b)) { - len = a.length; - arr = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - arr[i] = a[i] / b; - } - return arr; - } - if (isNumerable(tOfA, a) && $bm_isInstanceOfArray(b)) { - len = b.length; - arr = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - arr[i] = a / b[i]; - } - return arr; - } - return 0; - } - function mod(a, b) { - if (typeof a === 'string') { - a = parseInt(a, 10); - } - if (typeof b === 'string') { - b = parseInt(b, 10); - } - return a % b; - } - var $bm_sum = sum; - var $bm_sub = sub; - var $bm_mul = mul; - var $bm_div = div; - var $bm_mod = mod; - - function clamp(num, min, max) { - if (min > max) { - var mm = max; - max = min; - min = mm; - } - return Math.min(Math.max(num, min), max); - } - - function radiansToDegrees(val) { - return val / degToRads; - } - var radians_to_degrees = radiansToDegrees; - - function degreesToRadians(val) { - return val * degToRads; - } - var degrees_to_radians = radiansToDegrees; - - var helperLengthArray = [0, 0, 0, 0, 0, 0]; - - function length(arr1, arr2) { - if (typeof arr1 === 'number' || arr1 instanceof Number) { - arr2 = arr2 || 0; - return Math.abs(arr1 - arr2); - } - if (!arr2) { - arr2 = helperLengthArray; - } - var i; - var len = Math.min(arr1.length, arr2.length); - var addedLength = 0; - for (i = 0; i < len; i += 1) { - addedLength += Math.pow(arr2[i] - arr1[i], 2); - } - return Math.sqrt(addedLength); - } - - function normalize(vec) { - return div(vec, length(vec)); - } - - function rgbToHsl(val) { - var r = val[0]; var g = val[1]; var b = val[2]; - var max = Math.max(r, g, b); - var min = Math.min(r, g, b); - var h; - var s; - var l = (max + min) / 2; - - if (max === min) { - h = 0; // achromatic - s = 0; // achromatic - } else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch (max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - default: break; - } - h /= 6; - } - - return [h, s, l, val[3]]; - } - - 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) * (2 / 3 - t) * 6; - return p; - } - - function hslToRgb(val) { - var h = val[0]; - var s = val[1]; - var l = val[2]; - - var r; - var g; - var b; - - if (s === 0) { - r = l; // achromatic - b = l; // achromatic - g = l; // achromatic - } else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1 / 3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1 / 3); - } - - return [r, g, b, val[3]]; - } - - function linear(t, tMin, tMax, value1, value2) { - if (value1 === undefined || value2 === undefined) { - value1 = tMin; - value2 = tMax; - tMin = 0; - tMax = 1; - } - if (tMax < tMin) { - var _tMin = tMax; - tMax = tMin; - tMin = _tMin; - } - if (t <= tMin) { - return value1; - } if (t >= tMax) { - return value2; - } - var perc = tMax === tMin ? 0 : (t - tMin) / (tMax - tMin); - if (!value1.length) { - return value1 + (value2 - value1) * perc; - } - var i; - var len = value1.length; - var arr = createTypedArray('float32', len); - for (i = 0; i < len; i += 1) { - arr[i] = value1[i] + (value2[i] - value1[i]) * perc; - } - return arr; - } - function random(min, max) { - if (max === undefined) { - if (min === undefined) { - min = 0; - max = 1; - } else { - max = min; - min = undefined; - } - } - if (max.length) { - var i; - var len = max.length; - if (!min) { - min = createTypedArray('float32', len); - } - var arr = createTypedArray('float32', len); - var rnd = BMMath.random(); - for (i = 0; i < len; i += 1) { - arr[i] = min[i] + rnd * (max[i] - min[i]); - } - return arr; - } - if (min === undefined) { - min = 0; - } - var rndm = BMMath.random(); - return min + rndm * (max - min); - } - - function createPath(points, inTangents, outTangents, closed) { - var i; - var len = points.length; - var path = shapePool.newElement(); - path.setPathData(!!closed, len); - var arrPlaceholder = [0, 0]; - var inVertexPoint; - var outVertexPoint; - for (i = 0; i < len; i += 1) { - inVertexPoint = (inTangents && inTangents[i]) ? inTangents[i] : arrPlaceholder; - outVertexPoint = (outTangents && outTangents[i]) ? outTangents[i] : arrPlaceholder; - path.setTripleAt(points[i][0], points[i][1], outVertexPoint[0] + points[i][0], outVertexPoint[1] + points[i][1], inVertexPoint[0] + points[i][0], inVertexPoint[1] + points[i][1], i, true); - } - return path; - } - - function initiateExpression(elem, data, property) { - var val = data.x; - var needsVelocity = /velocity(?![\w\d])/.test(val); - var _needsRandom = val.indexOf('random') !== -1; - var elemType = elem.data.ty; - var transform; - var $bm_transform; - var content; - var effect; - var thisProperty = property; - thisProperty.valueAtTime = thisProperty.getValueAtTime; - Object.defineProperty(thisProperty, 'value', { - get: function () { - return thisProperty.v; - }, - }); - elem.comp.frameDuration = 1 / elem.comp.globalData.frameRate; - elem.comp.displayStartTime = 0; - var inPoint = elem.data.ip / elem.comp.globalData.frameRate; - var outPoint = elem.data.op / elem.comp.globalData.frameRate; - var width = elem.data.sw ? elem.data.sw : 0; - var height = elem.data.sh ? elem.data.sh : 0; - var name = elem.data.nm; - var loopIn; - var loop_in; - var loopOut; - var loop_out; - var smooth; - var toWorld; - var fromWorld; - var fromComp; - var toComp; - var fromCompToSurface; - var position; - var rotation; - var anchorPoint; - var scale; - var thisLayer; - var thisComp; - var mask; - var valueAtTime; - var velocityAtTime; - - var scoped_bm_rt; - // val = val.replace(/(\\?"|')((http)(s)?(:\/))?\/.*?(\\?"|')/g, "\"\""); // deter potential network calls - var expression_function = eval('[function _expression_function(){' + val + ';scoped_bm_rt=$bm_rt}]')[0]; // eslint-disable-line no-eval - var numKeys = property.kf ? data.k.length : 0; - - var active = !this.data || this.data.hd !== true; - - var wiggle = function wiggle(freq, amp) { - var iWiggle; - var j; - var lenWiggle = this.pv.length ? this.pv.length : 1; - var addedAmps = createTypedArray('float32', lenWiggle); - freq = 5; - var iterations = Math.floor(time * freq); - iWiggle = 0; - j = 0; - while (iWiggle < iterations) { - // var rnd = BMMath.random(); - for (j = 0; j < lenWiggle; j += 1) { - addedAmps[j] += -amp + amp * 2 * BMMath.random(); - // addedAmps[j] += -amp + amp*2*rnd; - } - iWiggle += 1; - } - // var rnd2 = BMMath.random(); - var periods = time * freq; - var perc = periods - Math.floor(periods); - var arr = createTypedArray('float32', lenWiggle); - if (lenWiggle > 1) { - for (j = 0; j < lenWiggle; j += 1) { - arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp * 2 * BMMath.random()) * perc; - // arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc; - // arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc); - } - return arr; - } - return this.pv + addedAmps[0] + (-amp + amp * 2 * BMMath.random()) * perc; - }.bind(this); - - if (thisProperty.loopIn) { - loopIn = thisProperty.loopIn.bind(thisProperty); - loop_in = loopIn; - } - - if (thisProperty.loopOut) { - loopOut = thisProperty.loopOut.bind(thisProperty); - loop_out = loopOut; - } - - if (thisProperty.smooth) { - smooth = thisProperty.smooth.bind(thisProperty); - } - - function loopInDuration(type, duration) { - return loopIn(type, duration, true); - } - - function loopOutDuration(type, duration) { - return loopOut(type, duration, true); - } - - if (this.getValueAtTime) { - valueAtTime = this.getValueAtTime.bind(this); - } - - if (this.getVelocityAtTime) { - velocityAtTime = this.getVelocityAtTime.bind(this); - } - - var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface); - - function lookAt(elem1, elem2) { - var fVec = [elem2[0] - elem1[0], elem2[1] - elem1[1], elem2[2] - elem1[2]]; - var pitch = Math.atan2(fVec[0], Math.sqrt(fVec[1] * fVec[1] + fVec[2] * fVec[2])) / degToRads; - var yaw = -Math.atan2(fVec[1], fVec[2]) / degToRads; - return [yaw, pitch, 0]; - } - - function easeOut(t, tMin, tMax, val1, val2) { - return applyEase(easeOutBez, t, tMin, tMax, val1, val2); - } - - function easeIn(t, tMin, tMax, val1, val2) { - return applyEase(easeInBez, t, tMin, tMax, val1, val2); - } - - function ease(t, tMin, tMax, val1, val2) { - return applyEase(easeInOutBez, t, tMin, tMax, val1, val2); - } - - function applyEase(fn, t, tMin, tMax, val1, val2) { - if (val1 === undefined) { - val1 = tMin; - val2 = tMax; - } else { - t = (t - tMin) / (tMax - tMin); - } - if (t > 1) { - t = 1; - } else if (t < 0) { - t = 0; - } - var mult = fn(t); - if ($bm_isInstanceOfArray(val1)) { - var iKey; - var lenKey = val1.length; - var arr = createTypedArray('float32', lenKey); - for (iKey = 0; iKey < lenKey; iKey += 1) { - arr[iKey] = (val2[iKey] - val1[iKey]) * mult + val1[iKey]; - } - return arr; - } - return (val2 - val1) * mult + val1; - } - - function nearestKey(time) { - var iKey; - var lenKey = data.k.length; - var index; - var keyTime; - if (!data.k.length || typeof (data.k[0]) === 'number') { - index = 0; - keyTime = 0; - } else { - index = -1; - time *= elem.comp.globalData.frameRate; - if (time < data.k[0].t) { - index = 1; - keyTime = data.k[0].t; - } else { - for (iKey = 0; iKey < lenKey - 1; iKey += 1) { - if (time === data.k[iKey].t) { - index = iKey + 1; - keyTime = data.k[iKey].t; - break; - } else if (time > data.k[iKey].t && time < data.k[iKey + 1].t) { - if (time - data.k[iKey].t > data.k[iKey + 1].t - time) { - index = iKey + 2; - keyTime = data.k[iKey + 1].t; - } else { - index = iKey + 1; - keyTime = data.k[iKey].t; - } - break; - } - } - if (index === -1) { - index = iKey + 1; - keyTime = data.k[iKey].t; - } - } - } - var obKey = {}; - obKey.index = index; - obKey.time = keyTime / elem.comp.globalData.frameRate; - return obKey; - } - - function key(ind) { - var obKey; - var iKey; - var lenKey; - if (!data.k.length || typeof (data.k[0]) === 'number') { - throw new Error('The property has no keyframe at index ' + ind); - } - ind -= 1; - obKey = { - time: data.k[ind].t / elem.comp.globalData.frameRate, - value: [], - }; - var arr = Object.prototype.hasOwnProperty.call(data.k[ind], 's') ? data.k[ind].s : data.k[ind - 1].e; - - lenKey = arr.length; - for (iKey = 0; iKey < lenKey; iKey += 1) { - obKey[iKey] = arr[iKey]; - obKey.value[iKey] = arr[iKey]; - } - return obKey; - } - - function framesToTime(fr, fps) { - if (!fps) { - fps = elem.comp.globalData.frameRate; - } - return fr / fps; - } - - function timeToFrames(t, fps) { - if (!t && t !== 0) { - t = time; - } - if (!fps) { - fps = elem.comp.globalData.frameRate; - } - return t * fps; - } - - function seedRandom(seed) { - BMMath.seedrandom(randSeed + seed); - } - - function sourceRectAtTime() { - return elem.sourceRectAtTime(); - } - - function substring(init, end) { - if (typeof value === 'string') { - if (end === undefined) { - return value.substring(init); - } - return value.substring(init, end); - } - return ''; - } - - function substr(init, end) { - if (typeof value === 'string') { - if (end === undefined) { - return value.substr(init); - } - return value.substr(init, end); - } - return ''; - } - - function posterizeTime(framesPerSecond) { - time = framesPerSecond === 0 ? 0 : Math.floor(time * framesPerSecond) / framesPerSecond; - value = valueAtTime(time); - } - - var time; - var velocity; - var value; - var text; - var textIndex; - var textTotal; - var selectorValue; - var index = elem.data.ind; - var hasParent = !!(elem.hierarchy && elem.hierarchy.length); - var parent; - var randSeed = Math.floor(Math.random() * 1000000); - var globalData = elem.globalData; - function executeExpression(_value) { - // globalData.pushExpression(); - value = _value; - if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') { - return value; - } - if (this.propType === 'textSelector') { - textIndex = this.textIndex; - textTotal = this.textTotal; - selectorValue = this.selectorValue; - } - if (!thisLayer) { - text = elem.layerInterface.text; - thisLayer = elem.layerInterface; - thisComp = elem.comp.compInterface; - toWorld = thisLayer.toWorld.bind(thisLayer); - fromWorld = thisLayer.fromWorld.bind(thisLayer); - fromComp = thisLayer.fromComp.bind(thisLayer); - toComp = thisLayer.toComp.bind(thisLayer); - mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null; - fromCompToSurface = fromComp; - } - if (!transform) { - transform = elem.layerInterface('ADBE Transform Group'); - $bm_transform = transform; - if (transform) { - anchorPoint = transform.anchorPoint; - /* position = transform.position; - rotation = transform.rotation; - scale = transform.scale; */ - } - } - - if (elemType === 4 && !content) { - content = thisLayer('ADBE Root Vectors Group'); - } - if (!effect) { - effect = thisLayer(4); - } - hasParent = !!(elem.hierarchy && elem.hierarchy.length); - if (hasParent && !parent) { - parent = elem.hierarchy[0].layerInterface; - } - time = this.comp.renderedFrame / this.comp.globalData.frameRate; - if (_needsRandom) { - seedRandom(randSeed + time); - } - if (needsVelocity) { - velocity = velocityAtTime(time); - } - expression_function(); - this.frameExpressionId = elem.globalData.frameId; - - // TODO: Check if it's possible to return on ShapeInterface the .v value - // Changed this to a ternary operation because Rollup failed compiling it correctly - scoped_bm_rt = scoped_bm_rt.propType === propTypes.SHAPE - ? scoped_bm_rt.v - : scoped_bm_rt; - return scoped_bm_rt; - } - // Bundlers will see these as dead code and unless we reference them - executeExpression.__preventDeadCodeRemoval = [$bm_transform, anchorPoint, time, velocity, inPoint, outPoint, width, height, name, loop_in, loop_out, smooth, toComp, fromCompToSurface, toWorld, fromWorld, mask, position, rotation, scale, thisComp, numKeys, active, wiggle, loopInDuration, loopOutDuration, comp, lookAt, easeOut, easeIn, ease, nearestKey, key, text, textIndex, textTotal, selectorValue, framesToTime, timeToFrames, sourceRectAtTime, substring, substr, posterizeTime, index, globalData]; - return executeExpression; - } - - ob.initiateExpression = initiateExpression; - ob.__preventDeadCodeRemoval = [window, document, XMLHttpRequest, fetch, frames, $bm_neg, add, $bm_sum, $bm_sub, $bm_mul, $bm_div, $bm_mod, clamp, radians_to_degrees, degreesToRadians, degrees_to_radians, normalize, rgbToHsl, hslToRgb, linear, random, createPath]; - return ob; -}()); - -const expressionHelpers = (function () { - function searchExpressions(elem, data, prop) { - if (data.x) { - prop.k = true; - prop.x = true; - prop.initiateExpression = ExpressionManager.initiateExpression; - prop.effectsSequence.push(prop.initiateExpression(elem, data, prop).bind(prop)); - } - } - - function getValueAtTime(frameNum) { - frameNum *= this.elem.globalData.frameRate; - frameNum -= this.offsetTime; - if (frameNum !== this._cachingAtTime.lastFrame) { - this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0; - this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime); - this._cachingAtTime.lastFrame = frameNum; - } - return this._cachingAtTime.value; - } - - function getSpeedAtTime(frameNum) { - var delta = -0.01; - var v1 = this.getValueAtTime(frameNum); - var v2 = this.getValueAtTime(frameNum + delta); - var speed = 0; - if (v1.length) { - var i; - for (i = 0; i < v1.length; i += 1) { - speed += Math.pow(v2[i] - v1[i], 2); - } - speed = Math.sqrt(speed) * 100; - } else { - speed = 0; - } - return speed; - } - - function getVelocityAtTime(frameNum) { - if (this.vel !== undefined) { - return this.vel; - } - var delta = -0.001; - // frameNum += this.elem.data.st; - var v1 = this.getValueAtTime(frameNum); - var v2 = this.getValueAtTime(frameNum + delta); - var velocity; - if (v1.length) { - velocity = createTypedArray('float32', v1.length); - var i; - for (i = 0; i < v1.length; i += 1) { - // removing frameRate - // if needed, don't add it here - // velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta); - velocity[i] = (v2[i] - v1[i]) / delta; - } - } else { - velocity = (v2 - v1) / delta; - } - return velocity; - } - - function getStaticValueAtTime() { - return this.pv; - } - - function setGroupProperty(propertyGroup) { - this.propertyGroup = propertyGroup; - } - - return { - searchExpressions: searchExpressions, - getSpeedAtTime: getSpeedAtTime, - getVelocityAtTime: getVelocityAtTime, - getValueAtTime: getValueAtTime, - getStaticValueAtTime: getStaticValueAtTime, - setGroupProperty: setGroupProperty, - }; -}()); - -function addPropertyDecorator() { - function loopOut(type, duration, durationFlag) { - if (!this.k || !this.keyframes) { - return this.pv; - } - type = type ? type.toLowerCase() : ''; - var currentFrame = this.comp.renderedFrame; - var keyframes = this.keyframes; - var lastKeyFrame = keyframes[keyframes.length - 1].t; - if (currentFrame <= lastKeyFrame) { - return this.pv; - } - var cycleDuration; - var firstKeyFrame; - if (!durationFlag) { - if (!duration || duration > keyframes.length - 1) { - duration = keyframes.length - 1; - } - firstKeyFrame = keyframes[keyframes.length - 1 - duration].t; - cycleDuration = lastKeyFrame - firstKeyFrame; - } else { - if (!duration) { - cycleDuration = Math.max(0, lastKeyFrame - this.elem.data.ip); - } else { - cycleDuration = Math.abs(lastKeyFrame - this.elem.comp.globalData.frameRate * duration); - } - firstKeyFrame = lastKeyFrame - cycleDuration; - } - var i; - var len; - var ret; - if (type === 'pingpong') { - var iterations = Math.floor((currentFrame - firstKeyFrame) / cycleDuration); - if (iterations % 2 !== 0) { - return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line - } - } else if (type === 'offset') { - var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); - var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); - var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0); // eslint-disable-line - var repeats = Math.floor((currentFrame - firstKeyFrame) / cycleDuration); - if (this.pv.length) { - ret = new Array(initV.length); - len = ret.length; - for (i = 0; i < len; i += 1) { - ret[i] = (endV[i] - initV[i]) * repeats + current[i]; - } - return ret; - } - return (endV - initV) * repeats + current; - } else if (type === 'continue') { - var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); - var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0); - if (this.pv.length) { - ret = new Array(lastValue.length); - len = ret.length; - for (i = 0; i < len; i += 1) { - ret[i] = lastValue[i] + (lastValue[i] - nextLastValue[i]) * ((currentFrame - lastKeyFrame) / this.comp.globalData.frameRate) / 0.0005; // eslint-disable-line - } - return ret; - } - return lastValue + (lastValue - nextLastValue) * (((currentFrame - lastKeyFrame)) / 0.001); - } - return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line - - } - - function loopIn(type, duration, durationFlag) { - if (!this.k) { - return this.pv; - } - type = type ? type.toLowerCase() : ''; - var currentFrame = this.comp.renderedFrame; - var keyframes = this.keyframes; - var firstKeyFrame = keyframes[0].t; - if (currentFrame >= firstKeyFrame) { - return this.pv; - } - var cycleDuration; - var lastKeyFrame; - if (!durationFlag) { - if (!duration || duration > keyframes.length - 1) { - duration = keyframes.length - 1; - } - lastKeyFrame = keyframes[duration].t; - cycleDuration = lastKeyFrame - firstKeyFrame; - } else { - if (!duration) { - cycleDuration = Math.max(0, this.elem.data.op - firstKeyFrame); - } else { - cycleDuration = Math.abs(this.elem.comp.globalData.frameRate * duration); - } - lastKeyFrame = firstKeyFrame + cycleDuration; - } - var i; - var len; - var ret; - if (type === 'pingpong') { - var iterations = Math.floor((firstKeyFrame - currentFrame) / cycleDuration); - if (iterations % 2 === 0) { - return this.getValueAtTime((((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0); // eslint-disable-line - } - } else if (type === 'offset') { - var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); - var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0); - var current = this.getValueAtTime((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration) + firstKeyFrame) / this.comp.globalData.frameRate, 0); - var repeats = Math.floor((firstKeyFrame - currentFrame) / cycleDuration) + 1; - if (this.pv.length) { - ret = new Array(initV.length); - len = ret.length; - for (i = 0; i < len; i += 1) { - ret[i] = current[i] - (endV[i] - initV[i]) * repeats; - } - return ret; - } - return current - (endV - initV) * repeats; - } else if (type === 'continue') { - var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0); - var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0); - if (this.pv.length) { - ret = new Array(firstValue.length); - len = ret.length; - for (i = 0; i < len; i += 1) { - ret[i] = firstValue[i] + ((firstValue[i] - nextFirstValue[i]) * (firstKeyFrame - currentFrame)) / 0.001; - } - return ret; - } - return firstValue + ((firstValue - nextFirstValue) * (firstKeyFrame - currentFrame)) / 0.001; - } - return this.getValueAtTime(((cycleDuration - ((firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame))) / this.comp.globalData.frameRate, 0); // eslint-disable-line - - } - - function smooth(width, samples) { - if (!this.k) { - return this.pv; - } - width = (width || 0.4) * 0.5; - samples = Math.floor(samples || 5); - if (samples <= 1) { - return this.pv; - } - var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate; - var initFrame = currentTime - width; - var endFrame = currentTime + width; - var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1; - var i = 0; - var j = 0; - var value; - if (this.pv.length) { - value = createTypedArray('float32', this.pv.length); - } else { - value = 0; - } - var sampleValue; - while (i < samples) { - sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency); - if (this.pv.length) { - for (j = 0; j < this.pv.length; j += 1) { - value[j] += sampleValue[j]; - } - } else { - value += sampleValue; - } - i += 1; - } - if (this.pv.length) { - for (j = 0; j < this.pv.length; j += 1) { - value[j] /= samples; - } - } else { - value /= samples; - } - return value; - } - - function getTransformValueAtTime(time) { - if (!this._transformCachingAtTime) { - this._transformCachingAtTime = { - v: new Matrix(), - }; - } - /// / - var matrix = this._transformCachingAtTime.v; - matrix.cloneFromProps(this.pre.props); - if (this.appliedTransformations < 1) { - var anchor = this.a.getValueAtTime(time); - matrix.translate( - -anchor[0] * this.a.mult, - -anchor[1] * this.a.mult, - anchor[2] * this.a.mult - ); - } - if (this.appliedTransformations < 2) { - var scale = this.s.getValueAtTime(time); - matrix.scale( - scale[0] * this.s.mult, - scale[1] * this.s.mult, - scale[2] * this.s.mult - ); - } - if (this.sk && this.appliedTransformations < 3) { - var skew = this.sk.getValueAtTime(time); - var skewAxis = this.sa.getValueAtTime(time); - matrix.skewFromAxis(-skew * this.sk.mult, skewAxis * this.sa.mult); - } - if (this.r && this.appliedTransformations < 4) { - var rotation = this.r.getValueAtTime(time); - matrix.rotate(-rotation * this.r.mult); - } else if (!this.r && this.appliedTransformations < 4) { - var rotationZ = this.rz.getValueAtTime(time); - var rotationY = this.ry.getValueAtTime(time); - var rotationX = this.rx.getValueAtTime(time); - var orientation = this.or.getValueAtTime(time); - matrix.rotateZ(-rotationZ * this.rz.mult) - .rotateY(rotationY * this.ry.mult) - .rotateX(rotationX * this.rx.mult) - .rotateZ(-orientation[2] * this.or.mult) - .rotateY(orientation[1] * this.or.mult) - .rotateX(orientation[0] * this.or.mult); - } - if (this.data.p && this.data.p.s) { - var positionX = this.px.getValueAtTime(time); - var positionY = this.py.getValueAtTime(time); - if (this.data.p.z) { - var positionZ = this.pz.getValueAtTime(time); - matrix.translate( - positionX * this.px.mult, - positionY * this.py.mult, - -positionZ * this.pz.mult - ); - } else { - matrix.translate(positionX * this.px.mult, positionY * this.py.mult, 0); - } - } else { - var position = this.p.getValueAtTime(time); - matrix.translate( - position[0] * this.p.mult, - position[1] * this.p.mult, - -position[2] * this.p.mult - ); - } - return matrix; - /// / - } - - function getTransformStaticValueAtTime() { - return this.v.clone(new Matrix()); - } - - var getTransformProperty = TransformPropertyFactory.getTransformProperty; - TransformPropertyFactory.getTransformProperty = function (elem, data, container) { - var prop = getTransformProperty(elem, data, container); - if (prop.dynamicProperties.length) { - prop.getValueAtTime = getTransformValueAtTime.bind(prop); - } else { - prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop); - } - prop.setGroupProperty = expressionHelpers.setGroupProperty; - return prop; - }; - - var propertyGetProp = PropertyFactory.getProp; - PropertyFactory.getProp = function (elem, data, type, mult, container) { - var prop = propertyGetProp(elem, data, type, mult, container); - // prop.getVelocityAtTime = getVelocityAtTime; - // prop.loopOut = loopOut; - // prop.loopIn = loopIn; - if (prop.kf) { - prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop); - } else { - prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop); - } - prop.setGroupProperty = expressionHelpers.setGroupProperty; - prop.loopOut = loopOut; - prop.loopIn = loopIn; - prop.smooth = smooth; - prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop); - prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop); - prop.numKeys = data.a === 1 ? data.k.length : 0; - prop.propertyIndex = data.ix; - var value = 0; - if (type !== 0) { - value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length); - } - prop._cachingAtTime = { - lastFrame: initialDefaultFrame, - lastIndex: 0, - value: value, - }; - expressionHelpers.searchExpressions(elem, data, prop); - if (prop.k) { - container.addDynamicProperty(prop); - } - - return prop; - }; - - function getShapeValueAtTime(frameNum) { - // For now this caching object is created only when needed instead of creating it when the shape is initialized. - if (!this._cachingAtTime) { - this._cachingAtTime = { - shapeValue: shapePool.clone(this.pv), - lastIndex: 0, - lastTime: initialDefaultFrame, - }; - } - - frameNum *= this.elem.globalData.frameRate; - frameNum -= this.offsetTime; - if (frameNum !== this._cachingAtTime.lastTime) { - this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0; - this._cachingAtTime.lastTime = frameNum; - this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime); - } - return this._cachingAtTime.shapeValue; - } - - var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction(); - var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction(); - - function ShapeExpressions() {} - ShapeExpressions.prototype = { - vertices: function (prop, time) { - if (this.k) { - this.getValue(); - } - var shapePath = this.v; - if (time !== undefined) { - shapePath = this.getValueAtTime(time, 0); - } - var i; - var len = shapePath._length; - var vertices = shapePath[prop]; - var points = shapePath.v; - var arr = createSizedArray(len); - for (i = 0; i < len; i += 1) { - if (prop === 'i' || prop === 'o') { - arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]]; - } else { - arr[i] = [vertices[i][0], vertices[i][1]]; - } - } - return arr; - }, - points: function (time) { - return this.vertices('v', time); - }, - inTangents: function (time) { - return this.vertices('i', time); - }, - outTangents: function (time) { - return this.vertices('o', time); - }, - isClosed: function () { - return this.v.c; - }, - pointOnPath: function (perc, time) { - var shapePath = this.v; - if (time !== undefined) { - shapePath = this.getValueAtTime(time, 0); - } - if (!this._segmentsLength) { - this._segmentsLength = bez.getSegmentsLength(shapePath); - } - - var segmentsLength = this._segmentsLength; - var lengths = segmentsLength.lengths; - var lengthPos = segmentsLength.totalLength * perc; - var i = 0; - var len = lengths.length; - var accumulatedLength = 0; - var pt; - while (i < len) { - if (accumulatedLength + lengths[i].addedLength > lengthPos) { - var initIndex = i; - var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1; - var segmentPerc = (lengthPos - accumulatedLength) / lengths[i].addedLength; - pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]); - break; - } else { - accumulatedLength += lengths[i].addedLength; - } - i += 1; - } - if (!pt) { - pt = shapePath.c ? [shapePath.v[0][0], shapePath.v[0][1]] : [shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1]]; - } - return pt; - }, - vectorOnPath: function (perc, time, vectorType) { - // perc doesn't use triple equality because it can be a Number object as well as a primitive. - if (perc == 1) { // eslint-disable-line eqeqeq - perc = this.v.c; - } else if (perc == 0) { // eslint-disable-line eqeqeq - perc = 0.999; - } - var pt1 = this.pointOnPath(perc, time); - var pt2 = this.pointOnPath(perc + 0.001, time); - var xLength = pt2[0] - pt1[0]; - var yLength = pt2[1] - pt1[1]; - var magnitude = Math.sqrt(Math.pow(xLength, 2) + Math.pow(yLength, 2)); - if (magnitude === 0) { - return [0, 0]; - } - var unitVector = vectorType === 'tangent' ? [xLength / magnitude, yLength / magnitude] : [-yLength / magnitude, xLength / magnitude]; - return unitVector; - }, - tangentOnPath: function (perc, time) { - return this.vectorOnPath(perc, time, 'tangent'); - }, - normalOnPath: function (perc, time) { - return this.vectorOnPath(perc, time, 'normal'); - }, - setGroupProperty: expressionHelpers.setGroupProperty, - getValueAtTime: expressionHelpers.getStaticValueAtTime, - }; - extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction); - extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction); - KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime; - KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression; - - var propertyGetShapeProp = ShapePropertyFactory.getShapeProp; - ShapePropertyFactory.getShapeProp = function (elem, data, type, arr, trims) { - var prop = propertyGetShapeProp(elem, data, type, arr, trims); - prop.propertyIndex = data.ix; - prop.lock = false; - if (type === 3) { - expressionHelpers.searchExpressions(elem, data.pt, prop); - } else if (type === 4) { - expressionHelpers.searchExpressions(elem, data.ks, prop); - } - if (prop.k) { - elem.addDynamicProperty(prop); - } - return prop; - }; -} - -function initialize$1() { - addPropertyDecorator(); -} - -function addDecorator() { - function searchExpressions() { - if (this.data.d.x) { - this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this); - this.addEffect(this.getExpressionValue.bind(this)); - return true; - } - return null; - } - - TextProperty.prototype.getExpressionValue = function (currentValue, text) { - var newValue = this.calculateExpression(text); - if (currentValue.t !== newValue) { - var newData = {}; - this.copyData(newData, currentValue); - newData.t = newValue.toString(); - newData.__complete = false; - return newData; - } - return currentValue; - }; - - TextProperty.prototype.searchProperty = function () { - var isKeyframed = this.searchKeyframes(); - var hasExpressions = this.searchExpressions(); - this.kf = isKeyframed || hasExpressions; - return this.kf; - }; - - TextProperty.prototype.searchExpressions = searchExpressions; -} - -function initialize() { - addDecorator(); -} - -// Registering expression plugin -setExpressionsPlugin(Expressions); -initialize$1(); -initialize(); - -} - -export { lottie as default }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/IFFParser.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/IFFParser.js deleted file mode 100644 index aec7782..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/IFFParser.js +++ /dev/null @@ -1,1217 +0,0 @@ -/** - * === IFFParser === - * - Parses data from the IFF buffer. - * - LWO3 files are in IFF format and can contain the following data types, referred to by shorthand codes - * - * ATOMIC DATA TYPES - * ID Tag - 4x 7 bit uppercase ASCII chars: ID4 - * signed integer, 1, 2, or 4 byte length: I1, I2, I4 - * unsigned integer, 1, 2, or 4 byte length: U1, U2, U4 - * float, 4 byte length: F4 - * string, series of ASCII chars followed by null byte (If the length of the string including the null terminating byte is odd, an extra null is added so that the data that follows will begin on an even byte boundary): S0 - * - * COMPOUND DATA TYPES - * Variable-length Index (index into an array or collection): U2 or U4 : VX - * Color (RGB): F4 + F4 + F4: COL12 - * Coordinate (x, y, z): F4 + F4 + F4: VEC12 - * Percentage F4 data type from 0->1 with 1 = 100%: FP4 - * Angle in radian F4: ANG4 - * Filename (string) S0: FNAM0 - * XValue F4 + index (VX) + optional envelope( ENVL ): XVAL - * XValue vector VEC12 + index (VX) + optional envelope( ENVL ): XVAL3 - * - * The IFF file is arranged in chunks: - * CHUNK = ID4 + length (U4) + length X bytes of data + optional 0 pad byte - * optional 0 pad byte is there to ensure chunk ends on even boundary, not counted in size - * - * COMPOUND DATA TYPES - * - Chunks are combined in Forms (collections of chunks) - * - FORM = string 'FORM' (ID4) + length (U4) + type (ID4) + optional ( CHUNK | FORM ) - * - CHUNKS and FORMS are collectively referred to as blocks - * - The entire file is contained in one top level FORM - * - **/ - -import { LWO2Parser } from './LWO2Parser.js'; -import { LWO3Parser } from './LWO3Parser.js'; - -class IFFParser { - - constructor() { - - this.debugger = new Debugger(); - // this.debugger.enable(); // un-comment to log IFF hierarchy. - - } - - parse( buffer ) { - - this.reader = new DataViewReader( buffer ); - - this.tree = { - materials: {}, - layers: [], - tags: [], - textures: [], - }; - - // start out at the top level to add any data before first layer is encountered - this.currentLayer = this.tree; - this.currentForm = this.tree; - - this.parseTopForm(); - - if ( this.tree.format === undefined ) return; - - if ( this.tree.format === 'LWO2' ) { - - this.parser = new LWO2Parser( this ); - while ( ! this.reader.endOfFile() ) this.parser.parseBlock(); - - } else if ( this.tree.format === 'LWO3' ) { - - this.parser = new LWO3Parser( this ); - while ( ! this.reader.endOfFile() ) this.parser.parseBlock(); - - } - - this.debugger.offset = this.reader.offset; - this.debugger.closeForms(); - - return this.tree; - - } - - parseTopForm() { - - this.debugger.offset = this.reader.offset; - - var topForm = this.reader.getIDTag(); - - if ( topForm !== 'FORM' ) { - - console.warn( 'LWOLoader: Top-level FORM missing.' ); - return; - - } - - var length = this.reader.getUint32(); - - this.debugger.dataOffset = this.reader.offset; - this.debugger.length = length; - - var type = this.reader.getIDTag(); - - if ( type === 'LWO2' ) { - - this.tree.format = type; - - } else if ( type === 'LWO3' ) { - - this.tree.format = type; - - } - - this.debugger.node = 0; - this.debugger.nodeID = type; - this.debugger.log(); - - return; - - } - - - /// - // FORM PARSING METHODS - /// - - // Forms are organisational and can contain any number of sub chunks and sub forms - // FORM ::= 'FORM'[ID4], length[U4], type[ID4], ( chunk[CHUNK] | form[FORM] ) * } - parseForm( length ) { - - var type = this.reader.getIDTag(); - - switch ( type ) { - - // SKIPPED FORMS - // if skipForm( length ) is called, the entire form and any sub forms and chunks are skipped - - case 'ISEQ': // Image sequence - case 'ANIM': // plug in animation - case 'STCC': // Color-cycling Still - case 'VPVL': - case 'VPRM': - case 'NROT': - case 'WRPW': // image wrap w ( for cylindrical and spherical projections) - case 'WRPH': // image wrap h - case 'FUNC': - case 'FALL': - case 'OPAC': - case 'GRAD': // gradient texture - case 'ENVS': - case 'VMOP': - case 'VMBG': - - // Car Material FORMS - case 'OMAX': - case 'STEX': - case 'CKBG': - case 'CKEY': - case 'VMLA': - case 'VMLB': - this.debugger.skipped = true; - this.skipForm( length ); // not currently supported - break; - - // if break; is called directly, the position in the lwoTree is not created - // any sub chunks and forms are added to the parent form instead - case 'META': - case 'NNDS': - case 'NODS': - case 'NDTA': - case 'ADAT': - case 'AOVS': - case 'BLOK': - - // used by texture nodes - case 'IBGC': // imageBackgroundColor - case 'IOPC': // imageOpacity - case 'IIMG': // hold reference to image path - case 'TXTR': - // this.setupForm( type, length ); - this.debugger.length = 4; - this.debugger.skipped = true; - break; - - case 'IFAL': // imageFallof - case 'ISCL': // imageScale - case 'IPOS': // imagePosition - case 'IROT': // imageRotation - case 'IBMP': - case 'IUTD': - case 'IVTD': - this.parseTextureNodeAttribute( type ); - break; - - case 'ENVL': - this.parseEnvelope( length ); - break; - - // CLIP FORM AND SUB FORMS - - case 'CLIP': - if ( this.tree.format === 'LWO2' ) { - - this.parseForm( length ); - - } else { - - this.parseClip( length ); - - } - - break; - - case 'STIL': - this.parseImage(); - break; - - case 'XREF': // clone of another STIL - this.reader.skip( 8 ); // unknown - this.currentForm.referenceTexture = { - index: this.reader.getUint32(), - refName: this.reader.getString() // internal unique ref - }; - break; - - // Not in spec, used by texture nodes - - case 'IMST': - this.parseImageStateForm( length ); - break; - - // SURF FORM AND SUB FORMS - - case 'SURF': - this.parseSurfaceForm( length ); - break; - - case 'VALU': // Not in spec - this.parseValueForm( length ); - break; - - case 'NTAG': - this.parseSubNode( length ); - break; - - case 'ATTR': // BSDF Node Attributes - case 'SATR': // Standard Node Attributes - this.setupForm( 'attributes', length ); - break; - - case 'NCON': - this.parseConnections( length ); - break; - - case 'SSHA': - this.parentForm = this.currentForm; - this.currentForm = this.currentSurface; - this.setupForm( 'surfaceShader', length ); - break; - - case 'SSHD': - this.setupForm( 'surfaceShaderData', length ); - break; - - case 'ENTR': // Not in spec - this.parseEntryForm( length ); - break; - - // Image Map Layer - - case 'IMAP': - this.parseImageMap( length ); - break; - - case 'TAMP': - this.parseXVAL( 'amplitude', length ); - break; - - //Texture Mapping Form - - case 'TMAP': - this.setupForm( 'textureMap', length ); - break; - - case 'CNTR': - this.parseXVAL3( 'center', length ); - break; - - case 'SIZE': - this.parseXVAL3( 'scale', length ); - break; - - case 'ROTA': - this.parseXVAL3( 'rotation', length ); - break; - - default: - this.parseUnknownForm( type, length ); - - } - - this.debugger.node = 0; - this.debugger.nodeID = type; - this.debugger.log(); - - } - - setupForm( type, length ) { - - if ( ! this.currentForm ) this.currentForm = this.currentNode; - - this.currentFormEnd = this.reader.offset + length; - this.parentForm = this.currentForm; - - if ( ! this.currentForm[ type ] ) { - - this.currentForm[ type ] = {}; - this.currentForm = this.currentForm[ type ]; - - - } else { - - // should never see this unless there's a bug in the reader - console.warn( 'LWOLoader: form already exists on parent: ', type, this.currentForm ); - - this.currentForm = this.currentForm[ type ]; - - } - - - } - - skipForm( length ) { - - this.reader.skip( length - 4 ); - - } - - parseUnknownForm( type, length ) { - - console.warn( 'LWOLoader: unknown FORM encountered: ' + type, length ); - - printBuffer( this.reader.dv.buffer, this.reader.offset, length - 4 ); - this.reader.skip( length - 4 ); - - } - - parseSurfaceForm( length ) { - - this.reader.skip( 8 ); // unknown Uint32 x2 - - var name = this.reader.getString(); - - var surface = { - attributes: {}, // LWO2 style non-node attributes will go here - connections: {}, - name: name, - inputName: name, - nodes: {}, - source: this.reader.getString(), - }; - - this.tree.materials[ name ] = surface; - this.currentSurface = surface; - - this.parentForm = this.tree.materials; - this.currentForm = surface; - this.currentFormEnd = this.reader.offset + length; - - } - - parseSurfaceLwo2( length ) { - - var name = this.reader.getString(); - - var surface = { - attributes: {}, // LWO2 style non-node attributes will go here - connections: {}, - name: name, - nodes: {}, - source: this.reader.getString(), - }; - - this.tree.materials[ name ] = surface; - this.currentSurface = surface; - - this.parentForm = this.tree.materials; - this.currentForm = surface; - this.currentFormEnd = this.reader.offset + length; - - } - - parseSubNode( length ) { - - // parse the NRNM CHUNK of the subnode FORM to get - // a meaningful name for the subNode - // some subnodes can be renamed, but Input and Surface cannot - - this.reader.skip( 8 ); // NRNM + length - var name = this.reader.getString(); - - var node = { - name: name - }; - this.currentForm = node; - this.currentNode = node; - - this.currentFormEnd = this.reader.offset + length; - - - } - - // collect attributes from all nodes at the top level of a surface - parseConnections( length ) { - - this.currentFormEnd = this.reader.offset + length; - this.parentForm = this.currentForm; - - this.currentForm = this.currentSurface.connections; - - } - - // surface node attribute data, e.g. specular, roughness etc - parseEntryForm( length ) { - - this.reader.skip( 8 ); // NAME + length - var name = this.reader.getString(); - this.currentForm = this.currentNode.attributes; - - this.setupForm( name, length ); - - } - - // parse values from material - doesn't match up to other LWO3 data types - // sub form of entry form - parseValueForm() { - - this.reader.skip( 8 ); // unknown + length - - var valueType = this.reader.getString(); - - if ( valueType === 'double' ) { - - this.currentForm.value = this.reader.getUint64(); - - } else if ( valueType === 'int' ) { - - this.currentForm.value = this.reader.getUint32(); - - } else if ( valueType === 'vparam' ) { - - this.reader.skip( 24 ); - this.currentForm.value = this.reader.getFloat64(); - - } else if ( valueType === 'vparam3' ) { - - this.reader.skip( 24 ); - this.currentForm.value = this.reader.getFloat64Array( 3 ); - - } - - } - - // holds various data about texture node image state - // Data other thanmipMapLevel unknown - parseImageStateForm() { - - this.reader.skip( 8 ); // unknown - - this.currentForm.mipMapLevel = this.reader.getFloat32(); - - } - - // LWO2 style image data node OR LWO3 textures defined at top level in editor (not as SURF node) - parseImageMap( length ) { - - this.currentFormEnd = this.reader.offset + length; - this.parentForm = this.currentForm; - - if ( ! this.currentForm.maps ) this.currentForm.maps = []; - - var map = {}; - this.currentForm.maps.push( map ); - this.currentForm = map; - - this.reader.skip( 10 ); // unknown, could be an issue if it contains a VX - - } - - parseTextureNodeAttribute( type ) { - - this.reader.skip( 28 ); // FORM + length + VPRM + unknown + Uint32 x2 + float32 - - this.reader.skip( 20 ); // FORM + length + VPVL + float32 + Uint32 - - switch ( type ) { - - case 'ISCL': - this.currentNode.scale = this.reader.getFloat32Array( 3 ); - break; - case 'IPOS': - this.currentNode.position = this.reader.getFloat32Array( 3 ); - break; - case 'IROT': - this.currentNode.rotation = this.reader.getFloat32Array( 3 ); - break; - case 'IFAL': - this.currentNode.falloff = this.reader.getFloat32Array( 3 ); - break; - - case 'IBMP': - this.currentNode.amplitude = this.reader.getFloat32(); - break; - case 'IUTD': - this.currentNode.uTiles = this.reader.getFloat32(); - break; - case 'IVTD': - this.currentNode.vTiles = this.reader.getFloat32(); - break; - - } - - this.reader.skip( 2 ); // unknown - - - } - - // ENVL forms are currently ignored - parseEnvelope( length ) { - - this.reader.skip( length - 4 ); // skipping entirely for now - - } - - /// - // CHUNK PARSING METHODS - /// - - // clips can either be defined inside a surface node, or at the top - // level and they have a different format in each case - parseClip( length ) { - - var tag = this.reader.getIDTag(); - - // inside surface node - if ( tag === 'FORM' ) { - - this.reader.skip( 16 ); - - this.currentNode.fileName = this.reader.getString(); - - return; - - } - - // otherwise top level - this.reader.setOffset( this.reader.offset - 4 ); - - this.currentFormEnd = this.reader.offset + length; - this.parentForm = this.currentForm; - - this.reader.skip( 8 ); // unknown - - var texture = { - index: this.reader.getUint32() - }; - this.tree.textures.push( texture ); - this.currentForm = texture; - - } - - parseClipLwo2( length ) { - - var texture = { - index: this.reader.getUint32(), - fileName: '' - }; - - // seach STIL block - while ( true ) { - - var tag = this.reader.getIDTag(); - var n_length = this.reader.getUint16(); - if ( tag === 'STIL' ) { - - texture.fileName = this.reader.getString(); - break; - - } - - if ( n_length >= length ) { - - break; - - } - - } - - this.tree.textures.push( texture ); - this.currentForm = texture; - - } - - parseImage() { - - this.reader.skip( 8 ); // unknown - this.currentForm.fileName = this.reader.getString(); - - } - - parseXVAL( type, length ) { - - var endOffset = this.reader.offset + length - 4; - this.reader.skip( 8 ); - - this.currentForm[ type ] = this.reader.getFloat32(); - - this.reader.setOffset( endOffset ); // set end offset directly to skip optional envelope - - } - - parseXVAL3( type, length ) { - - var endOffset = this.reader.offset + length - 4; - this.reader.skip( 8 ); - - this.currentForm[ type ] = { - x: this.reader.getFloat32(), - y: this.reader.getFloat32(), - z: this.reader.getFloat32(), - }; - - this.reader.setOffset( endOffset ); - - } - - // Tags associated with an object - // OTAG { type[ID4], tag-string[S0] } - parseObjectTag() { - - if ( ! this.tree.objectTags ) this.tree.objectTags = {}; - - this.tree.objectTags[ this.reader.getIDTag() ] = { - tagString: this.reader.getString() - }; - - } - - // Signals the start of a new layer. All the data chunks which follow will be included in this layer until another layer chunk is encountered. - // LAYR: number[U2], flags[U2], pivot[VEC12], name[S0], parent[U2] - parseLayer( length ) { - - var number = this.reader.getUint16(); - var flags = this.reader.getUint16(); // If the least significant bit of flags is set, the layer is hidden. - var pivot = this.reader.getFloat32Array( 3 ); // Note: this seems to be superflous, as the geometry is translated when pivot is present - var layer = { - number: number, - flags: flags, // If the least significant bit of flags is set, the layer is hidden. - pivot: [ - pivot[ 0 ], pivot[ 1 ], pivot[ 2 ] ], // Note: this seems to be superflous, as the geometry is translated when pivot is present - name: this.reader.getString(), - }; - - this.tree.layers.push( layer ); - this.currentLayer = layer; - - var parsedLength = 16 + stringOffset( this.currentLayer.name ); // index ( 2 ) + flags( 2 ) + pivot( 12 ) + stringlength - - // if we have not reached then end of the layer block, there must be a parent defined - this.currentLayer.parent = ( parsedLength < length ) ? this.reader.getUint16() : - 1; // omitted or -1 for no parent - - } - - // VEC12 * ( F4 + F4 + F4 ) array of x,y,z vectors - // Converting from left to right handed coordinate system: - // x -> -x and switch material FrontSide -> BackSide - parsePoints( length ) { - - this.currentPoints = []; - for ( var i = 0; i < length / 4; i += 3 ) { - - // x -> -x to match three.js right handed coords - this.currentPoints.push( - this.reader.getFloat32(), this.reader.getFloat32(), this.reader.getFloat32() ); - - } - - } - - // parse VMAP or VMAD - // Associates a set of floating-point vectors with a set of points. - // VMAP: { type[ID4], dimension[U2], name[S0], ( vert[VX], value[F4] # dimension ) * } - - // VMAD Associates a set of floating-point vectors with the vertices of specific polygons. - // Similar to VMAP UVs, but associates with polygon vertices rather than points - // to solve to problem of UV seams: VMAD chunks are paired with VMAPs of the same name, - // if they exist. The vector values in the VMAD will then replace those in the - // corresponding VMAP, but only for calculations involving the specified polygons. - // VMAD { type[ID4], dimension[U2], name[S0], ( vert[VX], poly[VX], value[F4] # dimension ) * } - parseVertexMapping( length, discontinuous ) { - - var finalOffset = this.reader.offset + length; - - var channelName = this.reader.getString(); - - if ( this.reader.offset === finalOffset ) { - - // then we are in a texture node and the VMAP chunk is just a reference to a UV channel name - this.currentForm.UVChannel = channelName; - return; - - } - - // otherwise reset to initial length and parse normal VMAP CHUNK - this.reader.setOffset( this.reader.offset - stringOffset( channelName ) ); - - var type = this.reader.getIDTag(); - - this.reader.getUint16(); // dimension - var name = this.reader.getString(); - - var remainingLength = length - 6 - stringOffset( name ); - - switch ( type ) { - - case 'TXUV': - this.parseUVMapping( name, finalOffset, discontinuous ); - break; - case 'MORF': - case 'SPOT': - this.parseMorphTargets( name, finalOffset, type ); // can't be discontinuous - break; - // unsupported VMAPs - case 'APSL': - case 'NORM': - case 'WGHT': - case 'MNVW': - case 'PICK': - case 'RGB ': - case 'RGBA': - this.reader.skip( remainingLength ); - break; - default: - console.warn( 'LWOLoader: unknown vertex map type: ' + type ); - this.reader.skip( remainingLength ); - - } - - } - - parseUVMapping( name, finalOffset, discontinuous ) { - - var uvIndices = []; - var polyIndices = []; - var uvs = []; - - while ( this.reader.offset < finalOffset ) { - - uvIndices.push( this.reader.getVariableLengthIndex() ); - - if ( discontinuous ) polyIndices.push( this.reader.getVariableLengthIndex() ); - - uvs.push( this.reader.getFloat32(), this.reader.getFloat32() ); - - } - - if ( discontinuous ) { - - if ( ! this.currentLayer.discontinuousUVs ) this.currentLayer.discontinuousUVs = {}; - - this.currentLayer.discontinuousUVs[ name ] = { - uvIndices: uvIndices, - polyIndices: polyIndices, - uvs: uvs, - }; - - } else { - - if ( ! this.currentLayer.uvs ) this.currentLayer.uvs = {}; - - this.currentLayer.uvs[ name ] = { - uvIndices: uvIndices, - uvs: uvs, - }; - - } - - } - - parseMorphTargets( name, finalOffset, type ) { - - var indices = []; - var points = []; - - type = ( type === 'MORF' ) ? 'relative' : 'absolute'; - - while ( this.reader.offset < finalOffset ) { - - indices.push( this.reader.getVariableLengthIndex() ); - // z -> -z to match three.js right handed coords - points.push( this.reader.getFloat32(), this.reader.getFloat32(), - this.reader.getFloat32() ); - - } - - if ( ! this.currentLayer.morphTargets ) this.currentLayer.morphTargets = {}; - - this.currentLayer.morphTargets[ name ] = { - indices: indices, - points: points, - type: type, - }; - - } - - // A list of polygons for the current layer. - // POLS { type[ID4], ( numvert+flags[U2], vert[VX] # numvert ) * } - parsePolygonList( length ) { - - var finalOffset = this.reader.offset + length; - var type = this.reader.getIDTag(); - - var indices = []; - - // hold a list of polygon sizes, to be split up later - var polygonDimensions = []; - - while ( this.reader.offset < finalOffset ) { - - var numverts = this.reader.getUint16(); - - //var flags = numverts & 64512; // 6 high order bits are flags - ignoring for now - numverts = numverts & 1023; // remaining ten low order bits are vertex num - polygonDimensions.push( numverts ); - - for ( var j = 0; j < numverts; j ++ ) indices.push( this.reader.getVariableLengthIndex() ); - - } - - var geometryData = { - type: type, - vertexIndices: indices, - polygonDimensions: polygonDimensions, - points: this.currentPoints - }; - - // Note: assuming that all polys will be lines or points if the first is - if ( polygonDimensions[ 0 ] === 1 ) geometryData.type = 'points'; - else if ( polygonDimensions[ 0 ] === 2 ) geometryData.type = 'lines'; - - this.currentLayer.geometry = geometryData; - - } - - // Lists the tag strings that can be associated with polygons by the PTAG chunk. - // TAGS { tag-string[S0] * } - parseTagStrings( length ) { - - this.tree.tags = this.reader.getStringArray( length ); - - } - - // Associates tags of a given type with polygons in the most recent POLS chunk. - // PTAG { type[ID4], ( poly[VX], tag[U2] ) * } - parsePolygonTagMapping( length ) { - - var finalOffset = this.reader.offset + length; - var type = this.reader.getIDTag(); - if ( type === 'SURF' ) this.parseMaterialIndices( finalOffset ); - else { //PART, SMGP, COLR not supported - - this.reader.skip( length - 4 ); - - } - - } - - parseMaterialIndices( finalOffset ) { - - // array holds polygon index followed by material index - this.currentLayer.geometry.materialIndices = []; - - while ( this.reader.offset < finalOffset ) { - - var polygonIndex = this.reader.getVariableLengthIndex(); - var materialIndex = this.reader.getUint16(); - - this.currentLayer.geometry.materialIndices.push( polygonIndex, materialIndex ); - - } - - } - - parseUnknownCHUNK( blockID, length ) { - - console.warn( 'LWOLoader: unknown chunk type: ' + blockID + ' length: ' + length ); - - // print the chunk plus some bytes padding either side - // printBuffer( this.reader.dv.buffer, this.reader.offset - 20, length + 40 ); - - var data = this.reader.getString( length ); - - this.currentForm[ blockID ] = data; - - } - -} - - -class DataViewReader { - - constructor( buffer ) { - - this.dv = new DataView( buffer ); - this.offset = 0; - this._textDecoder = new TextDecoder(); - this._bytes = new Uint8Array( buffer ); - - } - - size() { - - return this.dv.buffer.byteLength; - - } - - setOffset( offset ) { - - if ( offset > 0 && offset < this.dv.buffer.byteLength ) { - - this.offset = offset; - - } else { - - console.error( 'LWOLoader: invalid buffer offset' ); - - } - - } - - endOfFile() { - - if ( this.offset >= this.size() ) return true; - return false; - - } - - skip( length ) { - - this.offset += length; - - } - - getUint8() { - - var value = this.dv.getUint8( this.offset ); - this.offset += 1; - return value; - - } - - getUint16() { - - var value = this.dv.getUint16( this.offset ); - this.offset += 2; - return value; - - } - - getInt32() { - - var value = this.dv.getInt32( this.offset, false ); - this.offset += 4; - return value; - - } - - getUint32() { - - var value = this.dv.getUint32( this.offset, false ); - this.offset += 4; - return value; - - } - - getUint64() { - - var low, high; - - high = this.getUint32(); - low = this.getUint32(); - return high * 0x100000000 + low; - - } - - getFloat32() { - - var value = this.dv.getFloat32( this.offset, false ); - this.offset += 4; - return value; - - } - - getFloat32Array( size ) { - - var a = []; - - for ( var i = 0; i < size; i ++ ) { - - a.push( this.getFloat32() ); - - } - - return a; - - } - - getFloat64() { - - var value = this.dv.getFloat64( this.offset, this.littleEndian ); - this.offset += 8; - return value; - - } - - getFloat64Array( size ) { - - var a = []; - - for ( var i = 0; i < size; i ++ ) { - - a.push( this.getFloat64() ); - - } - - return a; - - } - - // get variable-length index data type - // VX ::= index[U2] | (index + 0xFF000000)[U4] - // If the index value is less than 65,280 (0xFF00),then VX === U2 - // otherwise VX === U4 with bits 24-31 set - // When reading an index, if the first byte encountered is 255 (0xFF), then - // the four-byte form is being used and the first byte should be discarded or masked out. - getVariableLengthIndex() { - - var firstByte = this.getUint8(); - - if ( firstByte === 255 ) { - - return this.getUint8() * 65536 + this.getUint8() * 256 + this.getUint8(); - - } - - return firstByte * 256 + this.getUint8(); - - } - - // An ID tag is a sequence of 4 bytes containing 7-bit ASCII values - getIDTag() { - - return this.getString( 4 ); - - } - - getString( size ) { - - if ( size === 0 ) return; - - const start = this.offset; - - let result; - let length; - - if ( size ) { - - length = size; - result = this._textDecoder.decode( new Uint8Array( this.dv.buffer, start, size ) ); - - } else { - - // use 1:1 mapping of buffer to avoid redundant new array creation. - length = this._bytes.indexOf( 0, start ) - start; - - result = this._textDecoder.decode( new Uint8Array( this.dv.buffer, start, length ) ); - - // account for null byte in length - length ++; - - // if string with terminating nullbyte is uneven, extra nullbyte is added, skip that too - length += length % 2; - - } - - this.skip( length ); - - return result; - - } - - getStringArray( size ) { - - var a = this.getString( size ); - a = a.split( '\0' ); - - return a.filter( Boolean ); // return array with any empty strings removed - - } - -} - - -// ************** DEBUGGER ************** - -class Debugger { - - constructor() { - - this.active = false; - this.depth = 0; - this.formList = []; - - } - - enable() { - - this.active = true; - - } - - log() { - - if ( ! this.active ) return; - - var nodeType; - - switch ( this.node ) { - - case 0: - nodeType = 'FORM'; - break; - - case 1: - nodeType = 'CHK'; - break; - - case 2: - nodeType = 'S-CHK'; - break; - - } - - console.log( - '| '.repeat( this.depth ) + - nodeType, - this.nodeID, - `( ${this.offset} ) -> ( ${this.dataOffset + this.length} )`, - ( ( this.node == 0 ) ? ' {' : '' ), - ( ( this.skipped ) ? 'SKIPPED' : '' ), - ( ( this.node == 0 && this.skipped ) ? '}' : '' ) - ); - - if ( this.node == 0 && ! this.skipped ) { - - this.depth += 1; - this.formList.push( this.dataOffset + this.length ); - - } - - this.skipped = false; - - } - - closeForms() { - - if ( ! this.active ) return; - - for ( var i = this.formList.length - 1; i >= 0; i -- ) { - - if ( this.offset >= this.formList[ i ] ) { - - this.depth -= 1; - console.log( '| '.repeat( this.depth ) + '}' ); - this.formList.splice( - 1, 1 ); - - } - - } - - } - -} - -// ************** UTILITY FUNCTIONS ************** - -function isEven( num ) { - - return num % 2; - -} - -// calculate the length of the string in the buffer -// this will be string.length + nullbyte + optional padbyte to make the length even -function stringOffset( string ) { - - return string.length + 1 + ( isEven( string.length + 1 ) ? 1 : 0 ); - -} - -// for testing purposes, dump buffer to console -// printBuffer( this.reader.dv.buffer, this.reader.offset, length ); -function printBuffer( buffer, from, to ) { - - console.log( new TextDecoder().decode( new Uint8Array( buffer, from, to ) ) ); - -} - -export { IFFParser }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO2Parser.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO2Parser.js deleted file mode 100644 index ecea9f5..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO2Parser.js +++ /dev/null @@ -1,414 +0,0 @@ -class LWO2Parser { - - constructor( IFFParser ) { - - this.IFF = IFFParser; - - } - - parseBlock() { - - this.IFF.debugger.offset = this.IFF.reader.offset; - this.IFF.debugger.closeForms(); - - const blockID = this.IFF.reader.getIDTag(); - let length = this.IFF.reader.getUint32(); // size of data in bytes - if ( length > this.IFF.reader.dv.byteLength - this.IFF.reader.offset ) { - - this.IFF.reader.offset -= 4; - length = this.IFF.reader.getUint16(); - - } - - this.IFF.debugger.dataOffset = this.IFF.reader.offset; - this.IFF.debugger.length = length; - - // Data types may be found in either LWO2 OR LWO3 spec - switch ( blockID ) { - - case 'FORM': // form blocks may consist of sub -chunks or sub-forms - this.IFF.parseForm( length ); - break; - - // SKIPPED CHUNKS - // if break; is called directly, the position in the lwoTree is not created - // any sub chunks and forms are added to the parent form instead - // MISC skipped - case 'ICON': // Thumbnail Icon Image - case 'VMPA': // Vertex Map Parameter - case 'BBOX': // bounding box - // case 'VMMD': - // case 'VTYP': - - // normal maps can be specified, normally on models imported from other applications. Currently ignored - case 'NORM': - - // ENVL FORM skipped - case 'PRE ': - case 'POST': - case 'KEY ': - case 'SPAN': - - // CLIP FORM skipped - case 'TIME': - case 'CLRS': - case 'CLRA': - case 'FILT': - case 'DITH': - case 'CONT': - case 'BRIT': - case 'SATR': - case 'HUE ': - case 'GAMM': - case 'NEGA': - case 'IFLT': - case 'PFLT': - - // Image Map Layer skipped - case 'PROJ': - case 'AXIS': - case 'AAST': - case 'PIXB': - case 'AUVO': - case 'STCK': - - // Procedural Textures skipped - case 'PROC': - case 'VALU': - case 'FUNC': - - // Gradient Textures skipped - case 'PNAM': - case 'INAM': - case 'GRST': - case 'GREN': - case 'GRPT': - case 'FKEY': - case 'IKEY': - - // Texture Mapping Form skipped - case 'CSYS': - - // Surface CHUNKs skipped - case 'OPAQ': // top level 'opacity' checkbox - case 'CMAP': // clip map - - // Surface node CHUNKS skipped - // These mainly specify the node editor setup in LW - case 'NLOC': - case 'NZOM': - case 'NVER': - case 'NSRV': - case 'NVSK': // unknown - case 'NCRD': - case 'WRPW': // image wrap w ( for cylindrical and spherical projections) - case 'WRPH': // image wrap h - case 'NMOD': - case 'NSEL': - case 'NPRW': - case 'NPLA': - case 'NODS': - case 'VERS': - case 'ENUM': - case 'TAG ': - case 'OPAC': - - // Car Material CHUNKS - case 'CGMD': - case 'CGTY': - case 'CGST': - case 'CGEN': - case 'CGTS': - case 'CGTE': - case 'OSMP': - case 'OMDE': - case 'OUTR': - case 'FLAG': - - case 'TRNL': - case 'GLOW': - case 'GVAL': // glow intensity - case 'SHRP': - case 'RFOP': - case 'RSAN': - case 'TROP': - case 'RBLR': - case 'TBLR': - case 'CLRH': - case 'CLRF': - case 'ADTR': - case 'LINE': - case 'ALPH': - case 'VCOL': - case 'ENAB': - this.IFF.debugger.skipped = true; - this.IFF.reader.skip( length ); - break; - - case 'SURF': - this.IFF.parseSurfaceLwo2( length ); - break; - - case 'CLIP': - this.IFF.parseClipLwo2( length ); - break; - - // Texture node chunks (not in spec) - case 'IPIX': // usePixelBlending - case 'IMIP': // useMipMaps - case 'IMOD': // imageBlendingMode - case 'AMOD': // unknown - case 'IINV': // imageInvertAlpha - case 'INCR': // imageInvertColor - case 'IAXS': // imageAxis ( for non-UV maps) - case 'IFOT': // imageFallofType - case 'ITIM': // timing for animated textures - case 'IWRL': - case 'IUTI': - case 'IINX': - case 'IINY': - case 'IINZ': - case 'IREF': // possibly a VX for reused texture nodes - if ( length === 4 ) this.IFF.currentNode[ blockID ] = this.IFF.reader.getInt32(); - else this.IFF.reader.skip( length ); - break; - - case 'OTAG': - this.IFF.parseObjectTag(); - break; - - case 'LAYR': - this.IFF.parseLayer( length ); - break; - - case 'PNTS': - this.IFF.parsePoints( length ); - break; - - case 'VMAP': - this.IFF.parseVertexMapping( length ); - break; - - case 'AUVU': - case 'AUVN': - this.IFF.reader.skip( length - 1 ); - this.IFF.reader.getVariableLengthIndex(); // VX - break; - - case 'POLS': - this.IFF.parsePolygonList( length ); - break; - - case 'TAGS': - this.IFF.parseTagStrings( length ); - break; - - case 'PTAG': - this.IFF.parsePolygonTagMapping( length ); - break; - - case 'VMAD': - this.IFF.parseVertexMapping( length, true ); - break; - - // Misc CHUNKS - case 'DESC': // Description Line - this.IFF.currentForm.description = this.IFF.reader.getString(); - break; - - case 'TEXT': - case 'CMNT': - case 'NCOM': - this.IFF.currentForm.comment = this.IFF.reader.getString(); - break; - - // Envelope Form - case 'NAME': - this.IFF.currentForm.channelName = this.IFF.reader.getString(); - break; - - // Image Map Layer - case 'WRAP': - this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }; - break; - - case 'IMAG': - const index = this.IFF.reader.getVariableLengthIndex(); - this.IFF.currentForm.imageIndex = index; - break; - - // Texture Mapping Form - case 'OREF': - this.IFF.currentForm.referenceObject = this.IFF.reader.getString(); - break; - - case 'ROID': - this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32(); - break; - - // Surface Blocks - case 'SSHN': - this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString(); - break; - - case 'AOVN': - this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString(); - break; - - // Nodal Blocks - case 'NSTA': - this.IFF.currentForm.disabled = this.IFF.reader.getUint16(); - break; - - case 'NRNM': - this.IFF.currentForm.realName = this.IFF.reader.getString(); - break; - - case 'NNME': - this.IFF.currentForm.refName = this.IFF.reader.getString(); - this.IFF.currentSurface.nodes[ this.IFF.currentForm.refName ] = this.IFF.currentForm; - break; - - // Nodal Blocks : connections - case 'INME': - if ( ! this.IFF.currentForm.nodeName ) this.IFF.currentForm.nodeName = []; - this.IFF.currentForm.nodeName.push( this.IFF.reader.getString() ); - break; - - case 'IINN': - if ( ! this.IFF.currentForm.inputNodeName ) this.IFF.currentForm.inputNodeName = []; - this.IFF.currentForm.inputNodeName.push( this.IFF.reader.getString() ); - break; - - case 'IINM': - if ( ! this.IFF.currentForm.inputName ) this.IFF.currentForm.inputName = []; - this.IFF.currentForm.inputName.push( this.IFF.reader.getString() ); - break; - - case 'IONM': - if ( ! this.IFF.currentForm.inputOutputName ) this.IFF.currentForm.inputOutputName = []; - this.IFF.currentForm.inputOutputName.push( this.IFF.reader.getString() ); - break; - - case 'FNAM': - this.IFF.currentForm.fileName = this.IFF.reader.getString(); - break; - - case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored - if ( length === 4 ) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag(); - else this.IFF.reader.skip( length ); - break; - - // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format - case 'SMAN': - const maxSmoothingAngle = this.IFF.reader.getFloat32(); - this.IFF.currentSurface.attributes.smooth = ( maxSmoothingAngle < 0 ) ? false : true; - break; - - // LWO2: Basic Surface Parameters - case 'COLR': - this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array( 3 ) }; - this.IFF.reader.skip( 2 ); // VX: envelope - break; - - case 'LUMI': - this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'SPEC': - this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'DIFF': - this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'REFL': - this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'GLOS': - this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'TRAN': - this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'BUMP': - this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'SIDE': - this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16(); - break; - - case 'RIMG': - this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex(); - break; - - case 'RIND': - this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'TIMG': - this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex(); - break; - - case 'IMAP': - this.IFF.reader.skip( 2 ); - break; - - case 'TMAP': - this.IFF.debugger.skipped = true; - this.IFF.reader.skip( length ); // needs implementing - break; - - case 'IUVI': // uv channel name - this.IFF.currentNode.UVChannel = this.IFF.reader.getString( length ); - break; - - case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge - this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32(); - break; - case 'IVTL': // heightWrappingMode - this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32(); - break; - - // LWO2 USE - case 'BLOK': - // skip - break; - - default: - this.IFF.parseUnknownCHUNK( blockID, length ); - - } - - if ( blockID != 'FORM' ) { - - this.IFF.debugger.node = 1; - this.IFF.debugger.nodeID = blockID; - this.IFF.debugger.log(); - - } - - if ( this.IFF.reader.offset >= this.IFF.currentFormEnd ) { - - this.IFF.currentForm = this.IFF.parentForm; - - } - - } - -} - -export { LWO2Parser }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO3Parser.js b/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO3Parser.js deleted file mode 100644 index ff2c509..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/lwo/LWO3Parser.js +++ /dev/null @@ -1,373 +0,0 @@ -class LWO3Parser { - - constructor( IFFParser ) { - - this.IFF = IFFParser; - - } - - parseBlock() { - - this.IFF.debugger.offset = this.IFF.reader.offset; - this.IFF.debugger.closeForms(); - - const blockID = this.IFF.reader.getIDTag(); - const length = this.IFF.reader.getUint32(); // size of data in bytes - - this.IFF.debugger.dataOffset = this.IFF.reader.offset; - this.IFF.debugger.length = length; - - // Data types may be found in either LWO2 OR LWO3 spec - switch ( blockID ) { - - case 'FORM': // form blocks may consist of sub -chunks or sub-forms - this.IFF.parseForm( length ); - break; - - // SKIPPED CHUNKS - // MISC skipped - case 'ICON': // Thumbnail Icon Image - case 'VMPA': // Vertex Map Parameter - case 'BBOX': // bounding box - // case 'VMMD': - // case 'VTYP': - - // normal maps can be specified, normally on models imported from other applications. Currently ignored - case 'NORM': - - // ENVL FORM skipped - case 'PRE ': // Pre-loop behavior for the keyframe - case 'POST': // Post-loop behavior for the keyframe - case 'KEY ': - case 'SPAN': - - // CLIP FORM skipped - case 'TIME': - case 'CLRS': - case 'CLRA': - case 'FILT': - case 'DITH': - case 'CONT': - case 'BRIT': - case 'SATR': - case 'HUE ': - case 'GAMM': - case 'NEGA': - case 'IFLT': - case 'PFLT': - - // Image Map Layer skipped - case 'PROJ': - case 'AXIS': - case 'AAST': - case 'PIXB': - case 'STCK': - - // Procedural Textures skipped - case 'VALU': - - // Gradient Textures skipped - case 'PNAM': - case 'INAM': - case 'GRST': - case 'GREN': - case 'GRPT': - case 'FKEY': - case 'IKEY': - - // Texture Mapping Form skipped - case 'CSYS': - - // Surface CHUNKs skipped - case 'OPAQ': // top level 'opacity' checkbox - case 'CMAP': // clip map - - // Surface node CHUNKS skipped - // These mainly specify the node editor setup in LW - case 'NLOC': - case 'NZOM': - case 'NVER': - case 'NSRV': - case 'NCRD': - case 'NMOD': - case 'NSEL': - case 'NPRW': - case 'NPLA': - case 'VERS': - case 'ENUM': - case 'TAG ': - - // Car Material CHUNKS - case 'CGMD': - case 'CGTY': - case 'CGST': - case 'CGEN': - case 'CGTS': - case 'CGTE': - case 'OSMP': - case 'OMDE': - case 'OUTR': - case 'FLAG': - - case 'TRNL': - case 'SHRP': - case 'RFOP': - case 'RSAN': - case 'TROP': - case 'RBLR': - case 'TBLR': - case 'CLRH': - case 'CLRF': - case 'ADTR': - case 'GLOW': - case 'LINE': - case 'ALPH': - case 'VCOL': - case 'ENAB': - this.IFF.debugger.skipped = true; - this.IFF.reader.skip( length ); - break; - - // Texture node chunks (not in spec) - case 'IPIX': // usePixelBlending - case 'IMIP': // useMipMaps - case 'IMOD': // imageBlendingMode - case 'AMOD': // unknown - case 'IINV': // imageInvertAlpha - case 'INCR': // imageInvertColor - case 'IAXS': // imageAxis ( for non-UV maps) - case 'IFOT': // imageFallofType - case 'ITIM': // timing for animated textures - case 'IWRL': - case 'IUTI': - case 'IINX': - case 'IINY': - case 'IINZ': - case 'IREF': // possibly a VX for reused texture nodes - if ( length === 4 ) this.IFF.currentNode[ blockID ] = this.IFF.reader.getInt32(); - else this.IFF.reader.skip( length ); - break; - - case 'OTAG': - this.IFF.parseObjectTag(); - break; - - case 'LAYR': - this.IFF.parseLayer( length ); - break; - - case 'PNTS': - this.IFF.parsePoints( length ); - break; - - case 'VMAP': - this.IFF.parseVertexMapping( length ); - break; - - case 'POLS': - this.IFF.parsePolygonList( length ); - break; - - case 'TAGS': - this.IFF.parseTagStrings( length ); - break; - - case 'PTAG': - this.IFF.parsePolygonTagMapping( length ); - break; - - case 'VMAD': - this.IFF.parseVertexMapping( length, true ); - break; - - // Misc CHUNKS - case 'DESC': // Description Line - this.IFF.currentForm.description = this.IFF.reader.getString(); - break; - - case 'TEXT': - case 'CMNT': - case 'NCOM': - this.IFF.currentForm.comment = this.IFF.reader.getString(); - break; - - // Envelope Form - case 'NAME': - this.IFF.currentForm.channelName = this.IFF.reader.getString(); - break; - - // Image Map Layer - case 'WRAP': - this.IFF.currentForm.wrap = { w: this.IFF.reader.getUint16(), h: this.IFF.reader.getUint16() }; - break; - - case 'IMAG': - const index = this.IFF.reader.getVariableLengthIndex(); - this.IFF.currentForm.imageIndex = index; - break; - - // Texture Mapping Form - case 'OREF': - this.IFF.currentForm.referenceObject = this.IFF.reader.getString(); - break; - - case 'ROID': - this.IFF.currentForm.referenceObjectID = this.IFF.reader.getUint32(); - break; - - // Surface Blocks - case 'SSHN': - this.IFF.currentSurface.surfaceShaderName = this.IFF.reader.getString(); - break; - - case 'AOVN': - this.IFF.currentSurface.surfaceCustomAOVName = this.IFF.reader.getString(); - break; - - // Nodal Blocks - case 'NSTA': - this.IFF.currentForm.disabled = this.IFF.reader.getUint16(); - break; - - case 'NRNM': - this.IFF.currentForm.realName = this.IFF.reader.getString(); - break; - - case 'NNME': - this.IFF.currentForm.refName = this.IFF.reader.getString(); - this.IFF.currentSurface.nodes[ this.IFF.currentForm.refName ] = this.IFF.currentForm; - break; - - // Nodal Blocks : connections - case 'INME': - if ( ! this.IFF.currentForm.nodeName ) this.IFF.currentForm.nodeName = []; - this.IFF.currentForm.nodeName.push( this.IFF.reader.getString() ); - break; - - case 'IINN': - if ( ! this.IFF.currentForm.inputNodeName ) this.IFF.currentForm.inputNodeName = []; - this.IFF.currentForm.inputNodeName.push( this.IFF.reader.getString() ); - break; - - case 'IINM': - if ( ! this.IFF.currentForm.inputName ) this.IFF.currentForm.inputName = []; - this.IFF.currentForm.inputName.push( this.IFF.reader.getString() ); - break; - - case 'IONM': - if ( ! this.IFF.currentForm.inputOutputName ) this.IFF.currentForm.inputOutputName = []; - this.IFF.currentForm.inputOutputName.push( this.IFF.reader.getString() ); - break; - - case 'FNAM': - this.IFF.currentForm.fileName = this.IFF.reader.getString(); - break; - - case 'CHAN': // NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored - if ( length === 4 ) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag(); - else this.IFF.reader.skip( length ); - break; - - // LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format - case 'SMAN': - const maxSmoothingAngle = this.IFF.reader.getFloat32(); - this.IFF.currentSurface.attributes.smooth = ( maxSmoothingAngle < 0 ) ? false : true; - break; - - // LWO2: Basic Surface Parameters - case 'COLR': - this.IFF.currentSurface.attributes.Color = { value: this.IFF.reader.getFloat32Array( 3 ) }; - this.IFF.reader.skip( 2 ); // VX: envelope - break; - - case 'LUMI': - this.IFF.currentSurface.attributes.Luminosity = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'SPEC': - this.IFF.currentSurface.attributes.Specular = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'DIFF': - this.IFF.currentSurface.attributes.Diffuse = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'REFL': - this.IFF.currentSurface.attributes.Reflection = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'GLOS': - this.IFF.currentSurface.attributes.Glossiness = { value: this.IFF.reader.getFloat32() }; - this.IFF.reader.skip( 2 ); - break; - - case 'TRAN': - this.IFF.currentSurface.attributes.opacity = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'BUMP': - this.IFF.currentSurface.attributes.bumpStrength = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'SIDE': - this.IFF.currentSurface.attributes.side = this.IFF.reader.getUint16(); - break; - - case 'RIMG': - this.IFF.currentSurface.attributes.reflectionMap = this.IFF.reader.getVariableLengthIndex(); - break; - - case 'RIND': - this.IFF.currentSurface.attributes.refractiveIndex = this.IFF.reader.getFloat32(); - this.IFF.reader.skip( 2 ); - break; - - case 'TIMG': - this.IFF.currentSurface.attributes.refractionMap = this.IFF.reader.getVariableLengthIndex(); - break; - - case 'IMAP': - this.IFF.currentSurface.attributes.imageMapIndex = this.IFF.reader.getUint32(); - break; - - case 'IUVI': // uv channel name - this.IFF.currentNode.UVChannel = this.IFF.reader.getString( length ); - break; - - case 'IUTL': // widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge - this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32(); - break; - case 'IVTL': // heightWrappingMode - this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32(); - break; - - default: - this.IFF.parseUnknownCHUNK( blockID, length ); - - } - - if ( blockID != 'FORM' ) { - - this.IFF.debugger.node = 1; - this.IFF.debugger.nodeID = blockID; - this.IFF.debugger.log(); - - } - - if ( this.IFF.reader.offset >= this.IFF.currentFormEnd ) { - - this.IFF.currentForm = this.IFF.parentForm; - - } - - } - -} - -export { LWO3Parser }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshGouraudMaterial.js b/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshGouraudMaterial.js deleted file mode 100644 index 2edce0f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshGouraudMaterial.js +++ /dev/null @@ -1,432 +0,0 @@ -/** - * MeshGouraudMaterial - * - * Lambert illumination model with Gouraud (per-vertex) shading - * - */ - -import { UniformsUtils, UniformsLib, ShaderMaterial, Color, MultiplyOperation } from '/static/javascript/three/build/three.module.js'; - -const GouraudShader = { - - name: 'GouraudShader', - - uniforms: UniformsUtils.merge( [ - UniformsLib.common, - UniformsLib.specularmap, - UniformsLib.envmap, - UniformsLib.aomap, - UniformsLib.lightmap, - UniformsLib.emissivemap, - UniformsLib.fog, - UniformsLib.lights, - { - emissive: { value: new Color( 0x000000 ) } - } - ] ), - - vertexShader: /* glsl */` - - #define GOURAUD - - 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 - - void main() { - - #include - #include - #include - - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - - #include - #include - - // inlining legacy - - vec3 diffuse = vec3( 1.0 ); - - vec3 geometryPosition = mvPosition.xyz; - vec3 geometryNormal = normalize( transformedNormal ); - vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); - - vec3 backGeometryNormal = - geometryNormal; - - 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 ); - - #if defined( USE_LIGHT_PROBES ) - - vIndirectFront += getLightProbeIrradiance( lightProbe, geometryNormal ); - - #endif - - #ifdef DOUBLE_SIDED - - vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); - - #if defined( USE_LIGHT_PROBES ) - - vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometryNormal ); - - #endif - - #endif - - #if NUM_POINT_LIGHTS > 0 - - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - - getPointLightInfo( pointLights[ i ], geometryPosition, directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = 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 ++ ) { - - getSpotLightInfo( spotLights[ i ], geometryPosition, directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = 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 ++ ) { - - getDirectionalLightInfo( directionalLights[ i ], directLight ); - - dotNL = dot( geometryNormal, directLight.direction ); - directLightColor_Diffuse = 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 ], geometryNormal ); - - #ifdef DOUBLE_SIDED - - vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometryNormal ); - - #endif - - } - #pragma unroll_loop_end - - #endif - - #include - #include - - }`, - - fragmentShader: /* glsl */` - - #define GOURAUD - - 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 - - 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 - - // accumulation - - #ifdef DOUBLE_SIDED - - reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; - - #else - - reflectedLight.indirectDiffuse += vIndirectFront; - - #endif - - #ifdef USE_LIGHTMAP - - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; - - #endif - - reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); - - #ifdef DOUBLE_SIDED - - reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; - - #else - - reflectedLight.directDiffuse = vLightFront; - - #endif - - reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); - - // modulation - - #include - - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - - #include - - #include - #include - #include - #include - #include - #include - - }` - -}; - -// - -class MeshGouraudMaterial extends ShaderMaterial { - - constructor( parameters ) { - - super(); - - this.isMeshGouraudMaterial = true; - - this.type = 'MeshGouraudMaterial'; - - //this.color = new THREE.Color( 0xffffff ); // diffuse - - //this.map = null; - - //this.lightMap = null; - //this.lightMapIntensity = 1.0; - - //this.aoMap = null; - //this.aoMapIntensity = 1.0; - - //this.emissive = new THREE.Color( 0x000000 ); - //this.emissiveIntensity = 1.0; - //this.emissiveMap = null; - - //this.specularMap = null; - - //this.alphaMap = null; - - //this.envMap = null; - this.combine = MultiplyOperation; // combine has no uniform - //this.reflectivity = 1; - //this.refractionRatio = 0.98; - - this.fog = false; // set to use scene fog - this.lights = true; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes - - const shader = GouraudShader; - - this.defines = Object.assign( {}, shader.defines ); - this.uniforms = UniformsUtils.clone( shader.uniforms ); - this.vertexShader = shader.vertexShader; - this.fragmentShader = shader.fragmentShader; - - const exposePropertyNames = [ - 'map', 'lightMap', 'lightMapIntensity', 'aoMap', 'aoMapIntensity', - 'emissive', 'emissiveIntensity', 'emissiveMap', 'specularMap', 'alphaMap', - 'envMap', 'reflectivity', 'refractionRatio', 'opacity', 'diffuse' - ]; - - for ( const propertyName of exposePropertyNames ) { - - Object.defineProperty( this, propertyName, { - - get: function () { - - return this.uniforms[ propertyName ].value; - - }, - - set: function ( value ) { - - this.uniforms[ propertyName ].value = value; - - } - - } ); - - } - - Object.defineProperty( this, 'color', Object.getOwnPropertyDescriptor( this, 'diffuse' ) ); - - 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.fog = source.fog; - - return this; - - } - -} - -export { MeshGouraudMaterial }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshPostProcessingMaterial.js b/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshPostProcessingMaterial.js deleted file mode 100644 index 6446d6b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/materials/MeshPostProcessingMaterial.js +++ /dev/null @@ -1,144 +0,0 @@ -import { MeshPhysicalMaterial } from '/static/javascript/three/build/three.module.js'; - -/** - * The aim of this mesh material is to use information from a post processing pass in the diffuse color pass. - * This material is based on the MeshPhysicalMaterial. - * - * In the current state, only the information of a screen space AO pass can be used in the material. - * Actually, the output of any screen space AO (SSAO, GTAO) can be used, - * as it is only necessary to provide the AO in one color channel of a texture, - * however the AO pass must be rendered prior to the color pass, - * which makes the post-processing pass somewhat of a pre-processing pass. - * Fot this purpose a new map (`aoPassMap`) is added to the material. - * The value of the map is used the same way as the `aoMap` value. - * - * Motivation to use the outputs AO pass directly in the material: - * The incident light of a fragment is composed of ambient light, direct light and indirect light - * Ambient Occlusion only occludes ambient light and environment light, but not direct light. - * Direct light is only occluded by geometry that casts shadows. - * And of course the emitted light should not be darkened by ambient occlusion either. - * This cannot be achieved if the AO post processing pass is simply blended with the diffuse render pass. - * - * Further extension work might be to use the output of an SSR pass or an HBIL pass from a previous frame. - * This would then create the possibility of SSR and IR depending on material properties such as `roughness`, `metalness` and `reflectivity`. -**/ - -class MeshPostProcessingMaterial extends MeshPhysicalMaterial { - - constructor( parameters ) { - - const aoPassMap = parameters.aoPassMap; - const aoPassMapScale = parameters.aoPassMapScale || 1.0; - delete parameters.aoPassMap; - delete parameters.aoPassMapScale; - - super( parameters ); - - this.onBeforeCompile = this._onBeforeCompile; - this.customProgramCacheKey = this._customProgramCacheKey; - this._aoPassMap = aoPassMap; - this.aoPassMapScale = aoPassMapScale; - this._shader = null; - - } - - get aoPassMap() { - - return this._aoPassMap; - - } - - set aoPassMap( aoPassMap ) { - - this._aoPassMap = aoPassMap; - this.needsUpdate = true; - this._setUniforms(); - - } - - _customProgramCacheKey() { - - return this._aoPassMap !== undefined && this._aoPassMap !== null ? 'aoPassMap' : ''; - - } - - _onBeforeCompile( shader ) { - - this._shader = shader; - - if ( this._aoPassMap !== undefined && this._aoPassMap !== null ) { - - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - aomap_pars_fragment_replacement - ); - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - aomap_fragment_replacement - ); - - } - - this._setUniforms(); - - } - - _setUniforms() { - - if ( this._shader ) { - - this._shader.uniforms.tAoPassMap = { value: this._aoPassMap }; - this._shader.uniforms.aoPassMapScale = { value: this.aoPassMapScale }; - - } - - } - -} - -const aomap_pars_fragment_replacement = /* glsl */` -#ifdef USE_AOMAP - - uniform sampler2D aoMap; - uniform float aoMapIntensity; - -#endif - - uniform sampler2D tAoPassMap; - uniform float aoPassMapScale; -`; - -const aomap_fragment_replacement = /* glsl */` -#ifndef AOPASSMAP_SWIZZLE - #define AOPASSMAP_SWIZZLE r -#endif - float ambientOcclusion = texelFetch( tAoPassMap, ivec2( gl_FragCoord.xy * aoPassMapScale ), 0 ).AOPASSMAP_SWIZZLE; - -#ifdef USE_AOMAP - - // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture - ambientOcclusion = min( ambientOcclusion, texture2D( aoMap, vAoMapUv ).r ); - ambientOcclusion *= ( ambientOcclusion - 1.0 ) * aoMapIntensity + 1.0; - -#endif - - reflectedLight.indirectDiffuse *= ambientOcclusion; - - #if defined( USE_CLEARCOAT ) - clearcoatSpecularIndirect *= ambientOcclusion; - #endif - - #if defined( USE_SHEEN ) - sheenSpecularIndirect *= ambientOcclusion; - #endif - - #if defined( USE_ENVMAP ) && defined( STANDARD ) - - float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); - - reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); - - #endif -`; - -export { MeshPostProcessingMaterial }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Capsule.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/Capsule.js deleted file mode 100644 index 5cc6803..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Capsule.js +++ /dev/null @@ -1,82 +0,0 @@ -import { - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -class Capsule { - - constructor( start = new Vector3( 0, 0, 0 ), end = new Vector3( 0, 1, 0 ), radius = 1 ) { - - this.start = start; - this.end = end; - this.radius = radius; - - } - - clone() { - - return new Capsule( this.start.clone(), this.end.clone(), this.radius ); - - } - - set( start, end, radius ) { - - this.start.copy( start ); - this.end.copy( end ); - this.radius = radius; - - } - - copy( capsule ) { - - this.start.copy( capsule.start ); - this.end.copy( capsule.end ); - this.radius = capsule.radius; - - } - - getCenter( target ) { - - return target.copy( this.end ).add( this.start ).multiplyScalar( 0.5 ); - - } - - translate( v ) { - - this.start.add( v ); - this.end.add( v ); - - } - - checkAABBAxis( p1x, p1y, p2x, p2y, minx, maxx, miny, maxy, radius ) { - - return ( - ( minx - p1x < radius || minx - p2x < radius ) && - ( p1x - maxx < radius || p2x - maxx < radius ) && - ( miny - p1y < radius || miny - p2y < radius ) && - ( p1y - maxy < radius || p2y - maxy < radius ) - ); - - } - - intersectsBox( box ) { - - return ( - this.checkAABBAxis( - this.start.x, this.start.y, this.end.x, this.end.y, - box.min.x, box.max.x, box.min.y, box.max.y, - this.radius ) && - this.checkAABBAxis( - this.start.x, this.start.z, this.end.x, this.end.z, - box.min.x, box.max.x, box.min.z, box.max.z, - this.radius ) && - this.checkAABBAxis( - this.start.y, this.start.z, this.end.y, this.end.z, - box.min.y, box.max.y, box.min.z, box.max.z, - this.radius ) - ); - - } - -} - -export { Capsule }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ColorConverter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/ColorConverter.js deleted file mode 100644 index f389780..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ColorConverter.js +++ /dev/null @@ -1,36 +0,0 @@ -import { MathUtils } from '/static/javascript/three/build/three.module.js'; - -const _hsl = {}; - -class ColorConverter { - - static setHSV( color, h, s, v ) { - - // https://gist.github.com/xpansive/1337890#file-index-js - - h = MathUtils.euclideanModulo( h, 1 ); - s = MathUtils.clamp( s, 0, 1 ); - v = MathUtils.clamp( v, 0, 1 ); - - return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 ); - - } - - static getHSV( color, target ) { - - color.getHSL( _hsl ); - - // based on https://gist.github.com/xpansive/1337890#file-index-js - _hsl.s *= ( _hsl.l < 0.5 ) ? _hsl.l : ( 1 - _hsl.l ); - - target.h = _hsl.h; - target.s = 2 * _hsl.s / ( _hsl.l + _hsl.s ); - target.v = _hsl.l + _hsl.s; - - return target; - - } - -} - -export { ColorConverter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ConvexHull.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/ConvexHull.js deleted file mode 100644 index 5e6cc56..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ConvexHull.js +++ /dev/null @@ -1,1271 +0,0 @@ -import { - Line3, - Plane, - Triangle, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Ported from: https://github.com/maurizzzio/quickhull3d/ by Mauricio Poppe (https://github.com/maurizzzio) - */ - -const Visible = 0; -const Deleted = 1; - -const _v1 = new Vector3(); -const _line3 = new Line3(); -const _plane = new Plane(); -const _closestPoint = new Vector3(); -const _triangle = new Triangle(); - -class ConvexHull { - - constructor() { - - this.tolerance = - 1; - - this.faces = []; // the generated faces of the convex hull - this.newFaces = []; // this array holds the faces that are generated within a single iteration - - // the vertex lists work as follows: - // - // let 'a' and 'b' be 'Face' instances - // let 'v' be points wrapped as instance of 'Vertex' - // - // [v, v, ..., v, v, v, ...] - // ^ ^ - // | | - // a.outside b.outside - // - this.assigned = new VertexList(); - this.unassigned = new VertexList(); - - this.vertices = []; // vertices of the hull (internal representation of given geometry data) - - } - - setFromPoints( points ) { - - // The algorithm needs at least four points. - - if ( points.length >= 4 ) { - - this.makeEmpty(); - - for ( let i = 0, l = points.length; i < l; i ++ ) { - - this.vertices.push( new VertexNode( points[ i ] ) ); - - } - - this.compute(); - - } - - return this; - - } - - setFromObject( object ) { - - const points = []; - - object.updateMatrixWorld( true ); - - object.traverse( function ( node ) { - - const geometry = node.geometry; - - if ( geometry !== undefined ) { - - const attribute = geometry.attributes.position; - - if ( attribute !== undefined ) { - - for ( let i = 0, l = attribute.count; i < l; i ++ ) { - - const point = new Vector3(); - - point.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld ); - - points.push( point ); - - } - - } - - } - - } ); - - return this.setFromPoints( points ); - - } - - containsPoint( point ) { - - const faces = this.faces; - - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const face = faces[ i ]; - - // compute signed distance and check on what half space the point lies - - if ( face.distanceToPoint( point ) > this.tolerance ) return false; - - } - - return true; - - } - - intersectRay( ray, target ) { - - // based on "Fast Ray-Convex Polyhedron Intersection" by Eric Haines, GRAPHICS GEMS II - - const faces = this.faces; - - let tNear = - Infinity; - let tFar = Infinity; - - for ( let i = 0, l = faces.length; i < l; i ++ ) { - - const face = faces[ i ]; - - // interpret faces as planes for the further computation - - const vN = face.distanceToPoint( ray.origin ); - const vD = face.normal.dot( ray.direction ); - - // if the origin is on the positive side of a plane (so the plane can "see" the origin) and - // the ray is turned away or parallel to the plane, there is no intersection - - if ( vN > 0 && vD >= 0 ) return null; - - // compute the distance from the ray’s origin to the intersection with the plane - - const t = ( vD !== 0 ) ? ( - vN / vD ) : 0; - - // only proceed if the distance is positive. a negative distance means the intersection point - // lies "behind" the origin - - if ( t <= 0 ) continue; - - // now categorized plane as front-facing or back-facing - - if ( vD > 0 ) { - - // plane faces away from the ray, so this plane is a back-face - - tFar = Math.min( t, tFar ); - - } else { - - // front-face - - tNear = Math.max( t, tNear ); - - } - - if ( tNear > tFar ) { - - // if tNear ever is greater than tFar, the ray must miss the convex hull - - return null; - - } - - } - - // evaluate intersection point - - // always try tNear first since its the closer intersection point - - if ( tNear !== - Infinity ) { - - ray.at( tNear, target ); - - } else { - - ray.at( tFar, target ); - - } - - return target; - - } - - intersectsRay( ray ) { - - return this.intersectRay( ray, _v1 ) !== null; - - } - - makeEmpty() { - - this.faces = []; - this.vertices = []; - - return this; - - } - - // Adds a vertex to the 'assigned' list of vertices and assigns it to the given face - - addVertexToFace( vertex, face ) { - - vertex.face = face; - - if ( face.outside === null ) { - - this.assigned.append( vertex ); - - } else { - - this.assigned.insertBefore( face.outside, vertex ); - - } - - face.outside = vertex; - - return this; - - } - - // Removes a vertex from the 'assigned' list of vertices and from the given face - - removeVertexFromFace( vertex, face ) { - - if ( vertex === face.outside ) { - - // fix face.outside link - - if ( vertex.next !== null && vertex.next.face === face ) { - - // face has at least 2 outside vertices, move the 'outside' reference - - face.outside = vertex.next; - - } else { - - // vertex was the only outside vertex that face had - - face.outside = null; - - } - - } - - this.assigned.remove( vertex ); - - return this; - - } - - // Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertex list - - removeAllVerticesFromFace( face ) { - - if ( face.outside !== null ) { - - // reference to the first and last vertex of this face - - const start = face.outside; - let end = face.outside; - - while ( end.next !== null && end.next.face === face ) { - - end = end.next; - - } - - this.assigned.removeSubList( start, end ); - - // fix references - - start.prev = end.next = null; - face.outside = null; - - return start; - - } - - } - - // Removes all the visible vertices that 'face' is able to see - - deleteFaceVertices( face, absorbingFace ) { - - const faceVertices = this.removeAllVerticesFromFace( face ); - - if ( faceVertices !== undefined ) { - - if ( absorbingFace === undefined ) { - - // mark the vertices to be reassigned to some other face - - this.unassigned.appendChain( faceVertices ); - - - } else { - - // if there's an absorbing face try to assign as many vertices as possible to it - - let vertex = faceVertices; - - do { - - // we need to buffer the subsequent vertex at this point because the 'vertex.next' reference - // will be changed by upcoming method calls - - const nextVertex = vertex.next; - - const distance = absorbingFace.distanceToPoint( vertex.point ); - - // check if 'vertex' is able to see 'absorbingFace' - - if ( distance > this.tolerance ) { - - this.addVertexToFace( vertex, absorbingFace ); - - } else { - - this.unassigned.append( vertex ); - - } - - // now assign next vertex - - vertex = nextVertex; - - } while ( vertex !== null ); - - } - - } - - return this; - - } - - // Reassigns as many vertices as possible from the unassigned list to the new faces - - resolveUnassignedPoints( newFaces ) { - - if ( this.unassigned.isEmpty() === false ) { - - let vertex = this.unassigned.first(); - - do { - - // buffer 'next' reference, see .deleteFaceVertices() - - const nextVertex = vertex.next; - - let maxDistance = this.tolerance; - - let maxFace = null; - - for ( let i = 0; i < newFaces.length; i ++ ) { - - const face = newFaces[ i ]; - - if ( face.mark === Visible ) { - - const distance = face.distanceToPoint( vertex.point ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - maxFace = face; - - } - - if ( maxDistance > 1000 * this.tolerance ) break; - - } - - } - - // 'maxFace' can be null e.g. if there are identical vertices - - if ( maxFace !== null ) { - - this.addVertexToFace( vertex, maxFace ); - - } - - vertex = nextVertex; - - } while ( vertex !== null ); - - } - - return this; - - } - - // Computes the extremes of a simplex which will be the initial hull - - computeExtremes() { - - const min = new Vector3(); - const max = new Vector3(); - - const minVertices = []; - const maxVertices = []; - - // initially assume that the first vertex is the min/max - - for ( let i = 0; i < 3; i ++ ) { - - minVertices[ i ] = maxVertices[ i ] = this.vertices[ 0 ]; - - } - - min.copy( this.vertices[ 0 ].point ); - max.copy( this.vertices[ 0 ].point ); - - // compute the min/max vertex on all six directions - - for ( let i = 0, l = this.vertices.length; i < l; i ++ ) { - - const vertex = this.vertices[ i ]; - const point = vertex.point; - - // update the min coordinates - - for ( let j = 0; j < 3; j ++ ) { - - if ( point.getComponent( j ) < min.getComponent( j ) ) { - - min.setComponent( j, point.getComponent( j ) ); - minVertices[ j ] = vertex; - - } - - } - - // update the max coordinates - - for ( let j = 0; j < 3; j ++ ) { - - if ( point.getComponent( j ) > max.getComponent( j ) ) { - - max.setComponent( j, point.getComponent( j ) ); - maxVertices[ j ] = vertex; - - } - - } - - } - - // use min/max vectors to compute an optimal epsilon - - this.tolerance = 3 * Number.EPSILON * ( - Math.max( Math.abs( min.x ), Math.abs( max.x ) ) + - Math.max( Math.abs( min.y ), Math.abs( max.y ) ) + - Math.max( Math.abs( min.z ), Math.abs( max.z ) ) - ); - - return { min: minVertices, max: maxVertices }; - - } - - // Computes the initial simplex assigning to its faces all the points - // that are candidates to form part of the hull - - computeInitialHull() { - - const vertices = this.vertices; - const extremes = this.computeExtremes(); - const min = extremes.min; - const max = extremes.max; - - // 1. Find the two vertices 'v0' and 'v1' with the greatest 1d separation - // (max.x - min.x) - // (max.y - min.y) - // (max.z - min.z) - - let maxDistance = 0; - let index = 0; - - for ( let i = 0; i < 3; i ++ ) { - - const distance = max[ i ].point.getComponent( i ) - min[ i ].point.getComponent( i ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - index = i; - - } - - } - - const v0 = min[ index ]; - const v1 = max[ index ]; - let v2; - let v3; - - // 2. The next vertex 'v2' is the one farthest to the line formed by 'v0' and 'v1' - - maxDistance = 0; - _line3.set( v0.point, v1.point ); - - for ( let i = 0, l = this.vertices.length; i < l; i ++ ) { - - const vertex = vertices[ i ]; - - if ( vertex !== v0 && vertex !== v1 ) { - - _line3.closestPointToPoint( vertex.point, true, _closestPoint ); - - const distance = _closestPoint.distanceToSquared( vertex.point ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - v2 = vertex; - - } - - } - - } - - // 3. The next vertex 'v3' is the one farthest to the plane 'v0', 'v1', 'v2' - - maxDistance = - 1; - _plane.setFromCoplanarPoints( v0.point, v1.point, v2.point ); - - for ( let i = 0, l = this.vertices.length; i < l; i ++ ) { - - const vertex = vertices[ i ]; - - if ( vertex !== v0 && vertex !== v1 && vertex !== v2 ) { - - const distance = Math.abs( _plane.distanceToPoint( vertex.point ) ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - v3 = vertex; - - } - - } - - } - - const faces = []; - - if ( _plane.distanceToPoint( v3.point ) < 0 ) { - - // the face is not able to see the point so 'plane.normal' is pointing outside the tetrahedron - - faces.push( - Face.create( v0, v1, v2 ), - Face.create( v3, v1, v0 ), - Face.create( v3, v2, v1 ), - Face.create( v3, v0, v2 ) - ); - - // set the twin edge - - for ( let i = 0; i < 3; i ++ ) { - - const j = ( i + 1 ) % 3; - - // join face[ i ] i > 0, with the first face - - faces[ i + 1 ].getEdge( 2 ).setTwin( faces[ 0 ].getEdge( j ) ); - - // join face[ i ] with face[ i + 1 ], 1 <= i <= 3 - - faces[ i + 1 ].getEdge( 1 ).setTwin( faces[ j + 1 ].getEdge( 0 ) ); - - } - - } else { - - // the face is able to see the point so 'plane.normal' is pointing inside the tetrahedron - - faces.push( - Face.create( v0, v2, v1 ), - Face.create( v3, v0, v1 ), - Face.create( v3, v1, v2 ), - Face.create( v3, v2, v0 ) - ); - - // set the twin edge - - for ( let i = 0; i < 3; i ++ ) { - - const j = ( i + 1 ) % 3; - - // join face[ i ] i > 0, with the first face - - faces[ i + 1 ].getEdge( 2 ).setTwin( faces[ 0 ].getEdge( ( 3 - i ) % 3 ) ); - - // join face[ i ] with face[ i + 1 ] - - faces[ i + 1 ].getEdge( 0 ).setTwin( faces[ j + 1 ].getEdge( 1 ) ); - - } - - } - - // the initial hull is the tetrahedron - - for ( let i = 0; i < 4; i ++ ) { - - this.faces.push( faces[ i ] ); - - } - - // initial assignment of vertices to the faces of the tetrahedron - - for ( let i = 0, l = vertices.length; i < l; i ++ ) { - - const vertex = vertices[ i ]; - - if ( vertex !== v0 && vertex !== v1 && vertex !== v2 && vertex !== v3 ) { - - maxDistance = this.tolerance; - let maxFace = null; - - for ( let j = 0; j < 4; j ++ ) { - - const distance = this.faces[ j ].distanceToPoint( vertex.point ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - maxFace = this.faces[ j ]; - - } - - } - - if ( maxFace !== null ) { - - this.addVertexToFace( vertex, maxFace ); - - } - - } - - } - - return this; - - } - - // Removes inactive faces - - reindexFaces() { - - const activeFaces = []; - - for ( let i = 0; i < this.faces.length; i ++ ) { - - const face = this.faces[ i ]; - - if ( face.mark === Visible ) { - - activeFaces.push( face ); - - } - - } - - this.faces = activeFaces; - - return this; - - } - - // Finds the next vertex to create faces with the current hull - - nextVertexToAdd() { - - // if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined' - - if ( this.assigned.isEmpty() === false ) { - - let eyeVertex, maxDistance = 0; - - // grap the first available face and start with the first visible vertex of that face - - const eyeFace = this.assigned.first().face; - let vertex = eyeFace.outside; - - // now calculate the farthest vertex that face can see - - do { - - const distance = eyeFace.distanceToPoint( vertex.point ); - - if ( distance > maxDistance ) { - - maxDistance = distance; - eyeVertex = vertex; - - } - - vertex = vertex.next; - - } while ( vertex !== null && vertex.face === eyeFace ); - - return eyeVertex; - - } - - } - - // Computes a chain of half edges in CCW order called the 'horizon'. - // For an edge to be part of the horizon it must join a face that can see - // 'eyePoint' and a face that cannot see 'eyePoint'. - - computeHorizon( eyePoint, crossEdge, face, horizon ) { - - // moves face's vertices to the 'unassigned' vertex list - - this.deleteFaceVertices( face ); - - face.mark = Deleted; - - let edge; - - if ( crossEdge === null ) { - - edge = crossEdge = face.getEdge( 0 ); - - } else { - - // start from the next edge since 'crossEdge' was already analyzed - // (actually 'crossEdge.twin' was the edge who called this method recursively) - - edge = crossEdge.next; - - } - - do { - - const twinEdge = edge.twin; - const oppositeFace = twinEdge.face; - - if ( oppositeFace.mark === Visible ) { - - if ( oppositeFace.distanceToPoint( eyePoint ) > this.tolerance ) { - - // the opposite face can see the vertex, so proceed with next edge - - this.computeHorizon( eyePoint, twinEdge, oppositeFace, horizon ); - - } else { - - // the opposite face can't see the vertex, so this edge is part of the horizon - - horizon.push( edge ); - - } - - } - - edge = edge.next; - - } while ( edge !== crossEdge ); - - return this; - - } - - // Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order - - addAdjoiningFace( eyeVertex, horizonEdge ) { - - // all the half edges are created in ccw order thus the face is always pointing outside the hull - - const face = Face.create( eyeVertex, horizonEdge.tail(), horizonEdge.head() ); - - this.faces.push( face ); - - // join face.getEdge( - 1 ) with the horizon's opposite edge face.getEdge( - 1 ) = face.getEdge( 2 ) - - face.getEdge( - 1 ).setTwin( horizonEdge.twin ); - - return face.getEdge( 0 ); // the half edge whose vertex is the eyeVertex - - - } - - // Adds 'horizon.length' faces to the hull, each face will be linked with the - // horizon opposite face and the face on the left/right - - addNewFaces( eyeVertex, horizon ) { - - this.newFaces = []; - - let firstSideEdge = null; - let previousSideEdge = null; - - for ( let i = 0; i < horizon.length; i ++ ) { - - const horizonEdge = horizon[ i ]; - - // returns the right side edge - - const sideEdge = this.addAdjoiningFace( eyeVertex, horizonEdge ); - - if ( firstSideEdge === null ) { - - firstSideEdge = sideEdge; - - } else { - - // joins face.getEdge( 1 ) with previousFace.getEdge( 0 ) - - sideEdge.next.setTwin( previousSideEdge ); - - } - - this.newFaces.push( sideEdge.face ); - previousSideEdge = sideEdge; - - } - - // perform final join of new faces - - firstSideEdge.next.setTwin( previousSideEdge ); - - return this; - - } - - // Adds a vertex to the hull - - addVertexToHull( eyeVertex ) { - - const horizon = []; - - this.unassigned.clear(); - - // remove 'eyeVertex' from 'eyeVertex.face' so that it can't be added to the 'unassigned' vertex list - - this.removeVertexFromFace( eyeVertex, eyeVertex.face ); - - this.computeHorizon( eyeVertex.point, null, eyeVertex.face, horizon ); - - this.addNewFaces( eyeVertex, horizon ); - - // reassign 'unassigned' vertices to the new faces - - this.resolveUnassignedPoints( this.newFaces ); - - return this; - - } - - cleanup() { - - this.assigned.clear(); - this.unassigned.clear(); - this.newFaces = []; - - return this; - - } - - compute() { - - let vertex; - - this.computeInitialHull(); - - // add all available vertices gradually to the hull - - while ( ( vertex = this.nextVertexToAdd() ) !== undefined ) { - - this.addVertexToHull( vertex ); - - } - - this.reindexFaces(); - - this.cleanup(); - - return this; - - } - -} - -// - -class Face { - - constructor() { - - this.normal = new Vector3(); - this.midpoint = new Vector3(); - this.area = 0; - - this.constant = 0; // signed distance from face to the origin - this.outside = null; // reference to a vertex in a vertex list this face can see - this.mark = Visible; - this.edge = null; - - } - - static create( a, b, c ) { - - const face = new Face(); - - const e0 = new HalfEdge( a, face ); - const e1 = new HalfEdge( b, face ); - const e2 = new HalfEdge( c, face ); - - // join edges - - e0.next = e2.prev = e1; - e1.next = e0.prev = e2; - e2.next = e1.prev = e0; - - // main half edge reference - - face.edge = e0; - - return face.compute(); - - } - - getEdge( i ) { - - let edge = this.edge; - - while ( i > 0 ) { - - edge = edge.next; - i --; - - } - - while ( i < 0 ) { - - edge = edge.prev; - i ++; - - } - - return edge; - - } - - compute() { - - const a = this.edge.tail(); - const b = this.edge.head(); - const c = this.edge.next.head(); - - _triangle.set( a.point, b.point, c.point ); - - _triangle.getNormal( this.normal ); - _triangle.getMidpoint( this.midpoint ); - this.area = _triangle.getArea(); - - this.constant = this.normal.dot( this.midpoint ); - - return this; - - } - - distanceToPoint( point ) { - - return this.normal.dot( point ) - this.constant; - - } - -} - -// Entity for a Doubly-Connected Edge List (DCEL). - -class HalfEdge { - - - constructor( vertex, face ) { - - this.vertex = vertex; - this.prev = null; - this.next = null; - this.twin = null; - this.face = face; - - } - - head() { - - return this.vertex; - - } - - tail() { - - return this.prev ? this.prev.vertex : null; - - } - - length() { - - const head = this.head(); - const tail = this.tail(); - - if ( tail !== null ) { - - return tail.point.distanceTo( head.point ); - - } - - return - 1; - - } - - lengthSquared() { - - const head = this.head(); - const tail = this.tail(); - - if ( tail !== null ) { - - return tail.point.distanceToSquared( head.point ); - - } - - return - 1; - - } - - setTwin( edge ) { - - this.twin = edge; - edge.twin = this; - - return this; - - } - -} - -// A vertex as a double linked list node. - -class VertexNode { - - constructor( point ) { - - this.point = point; - this.prev = null; - this.next = null; - this.face = null; // the face that is able to see this vertex - - } - -} - -// A double linked list that contains vertex nodes. - -class VertexList { - - constructor() { - - this.head = null; - this.tail = null; - - } - - first() { - - return this.head; - - } - - last() { - - return this.tail; - - } - - clear() { - - this.head = this.tail = null; - - return this; - - } - - // Inserts a vertex before the target vertex - - insertBefore( target, vertex ) { - - vertex.prev = target.prev; - vertex.next = target; - - if ( vertex.prev === null ) { - - this.head = vertex; - - } else { - - vertex.prev.next = vertex; - - } - - target.prev = vertex; - - return this; - - } - - // Inserts a vertex after the target vertex - - insertAfter( target, vertex ) { - - vertex.prev = target; - vertex.next = target.next; - - if ( vertex.next === null ) { - - this.tail = vertex; - - } else { - - vertex.next.prev = vertex; - - } - - target.next = vertex; - - return this; - - } - - // Appends a vertex to the end of the linked list - - append( vertex ) { - - if ( this.head === null ) { - - this.head = vertex; - - } else { - - this.tail.next = vertex; - - } - - vertex.prev = this.tail; - vertex.next = null; // the tail has no subsequent vertex - - this.tail = vertex; - - return this; - - } - - // Appends a chain of vertices where 'vertex' is the head. - - appendChain( vertex ) { - - if ( this.head === null ) { - - this.head = vertex; - - } else { - - this.tail.next = vertex; - - } - - vertex.prev = this.tail; - - // ensure that the 'tail' reference points to the last vertex of the chain - - while ( vertex.next !== null ) { - - vertex = vertex.next; - - } - - this.tail = vertex; - - return this; - - } - - // Removes a vertex from the linked list - - remove( vertex ) { - - if ( vertex.prev === null ) { - - this.head = vertex.next; - - } else { - - vertex.prev.next = vertex.next; - - } - - if ( vertex.next === null ) { - - this.tail = vertex.prev; - - } else { - - vertex.next.prev = vertex.prev; - - } - - return this; - - } - - // Removes a list of vertices whose 'head' is 'a' and whose 'tail' is b - - removeSubList( a, b ) { - - if ( a.prev === null ) { - - this.head = b.next; - - } else { - - a.prev.next = b.next; - - } - - if ( b.next === null ) { - - this.tail = a.prev; - - } else { - - b.next.prev = a.prev; - - } - - return this; - - } - - isEmpty() { - - return this.head === null; - - } - -} - -export { ConvexHull, Face, HalfEdge, VertexNode, VertexList }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ImprovedNoise.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/ImprovedNoise.js deleted file mode 100644 index 5647d1b..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/ImprovedNoise.js +++ /dev/null @@ -1,71 +0,0 @@ -// https://cs.nyu.edu/~perlin/noise/ - -const _p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, - 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, - 174, 20, 125, 136, 171, 168, 68, 175, 74, 165, 71, 134, 139, 48, 27, 166, 77, 146, 158, 231, 83, 111, 229, 122, 60, 211, - 133, 230, 220, 105, 92, 41, 55, 46, 245, 40, 244, 102, 143, 54, 65, 25, 63, 161, 1, 216, 80, 73, 209, 76, 132, 187, 208, - 89, 18, 169, 200, 196, 135, 130, 116, 188, 159, 86, 164, 100, 109, 198, 173, 186, 3, 64, 52, 217, 226, 250, 124, 123, 5, - 202, 38, 147, 118, 126, 255, 82, 85, 212, 207, 206, 59, 227, 47, 16, 58, 17, 182, 189, 28, 42, 223, 183, 170, 213, 119, - 248, 152, 2, 44, 154, 163, 70, 221, 153, 101, 155, 167, 43, 172, 9, 129, 22, 39, 253, 19, 98, 108, 110, 79, 113, 224, 232, - 178, 185, 112, 104, 218, 246, 97, 228, 251, 34, 242, 193, 238, 210, 144, 12, 191, 179, 162, 241, 81, 51, 145, 235, 249, - 14, 239, 107, 49, 192, 214, 31, 181, 199, 106, 157, 184, 84, 204, 176, 115, 121, 50, 45, 127, 4, 150, 254, 138, 236, 205, - 93, 222, 114, 67, 29, 24, 72, 243, 141, 128, 195, 78, 66, 215, 61, 156, 180 ]; - -for ( let i = 0; i < 256; i ++ ) { - - _p[ 256 + i ] = _p[ i ]; - -} - -function fade( t ) { - - return t * t * t * ( t * ( t * 6 - 15 ) + 10 ); - -} - -function lerp( t, a, b ) { - - return a + t * ( b - a ); - -} - -function grad( hash, x, y, z ) { - - const h = hash & 15; - const u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z; - return ( ( h & 1 ) == 0 ? u : - u ) + ( ( h & 2 ) == 0 ? v : - v ); - -} - -class ImprovedNoise { - - noise( x, y, z ) { - - const floorX = Math.floor( x ), floorY = Math.floor( y ), floorZ = Math.floor( z ); - - const X = floorX & 255, Y = floorY & 255, Z = floorZ & 255; - - x -= floorX; - y -= floorY; - z -= floorZ; - - const xMinus1 = x - 1, yMinus1 = y - 1, zMinus1 = z - 1; - - const u = fade( x ), v = fade( y ), w = fade( z ); - - const A = _p[ X ] + Y, AA = _p[ A ] + Z, AB = _p[ A + 1 ] + Z, B = _p[ X + 1 ] + Y, BA = _p[ B ] + Z, BB = _p[ B + 1 ] + Z; - - return lerp( w, lerp( v, lerp( u, grad( _p[ AA ], x, y, z ), - grad( _p[ BA ], xMinus1, y, z ) ), - lerp( u, grad( _p[ AB ], x, yMinus1, z ), - grad( _p[ BB ], xMinus1, yMinus1, z ) ) ), - lerp( v, lerp( u, grad( _p[ AA + 1 ], x, y, zMinus1 ), - grad( _p[ BA + 1 ], xMinus1, y, zMinus1 ) ), - lerp( u, grad( _p[ AB + 1 ], x, yMinus1, zMinus1 ), - grad( _p[ BB + 1 ], xMinus1, yMinus1, zMinus1 ) ) ) ); - - } - -} - -export { ImprovedNoise }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Lut.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/Lut.js deleted file mode 100644 index b86c114..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Lut.js +++ /dev/null @@ -1,204 +0,0 @@ -import { - Color, - LinearSRGBColorSpace, - MathUtils -} from '/static/javascript/three/build/three.module.js'; - -class Lut { - - constructor( colormap, count = 32 ) { - - this.isLut = true; - - this.lut = []; - this.map = []; - this.n = 0; - this.minV = 0; - this.maxV = 1; - - this.setColorMap( colormap, count ); - - } - - set( value ) { - - if ( value.isLut === true ) { - - this.copy( value ); - - } - - return this; - - } - - setMin( min ) { - - this.minV = min; - - return this; - - } - - setMax( max ) { - - this.maxV = max; - - return this; - - } - - setColorMap( colormap, count = 32 ) { - - this.map = ColorMapKeywords[ colormap ] || ColorMapKeywords.rainbow; - this.n = count; - - const step = 1.0 / this.n; - const minColor = new Color(); - const maxColor = new Color(); - - this.lut.length = 0; - - // sample at 0 - - this.lut.push( new Color( this.map[ 0 ][ 1 ] ) ); - - // sample at 1/n, ..., (n-1)/n - - for ( let i = 1; i < count; i ++ ) { - - const alpha = i * step; - - for ( let j = 0; j < this.map.length - 1; j ++ ) { - - if ( alpha > this.map[ j ][ 0 ] && alpha <= this.map[ j + 1 ][ 0 ] ) { - - const min = this.map[ j ][ 0 ]; - const max = this.map[ j + 1 ][ 0 ]; - - minColor.setHex( this.map[ j ][ 1 ], LinearSRGBColorSpace ); - maxColor.setHex( this.map[ j + 1 ][ 1 ], LinearSRGBColorSpace ); - - const color = new Color().lerpColors( minColor, maxColor, ( alpha - min ) / ( max - min ) ); - - this.lut.push( color ); - - } - - } - - } - - // sample at 1 - - this.lut.push( new Color( this.map[ this.map.length - 1 ][ 1 ] ) ); - - return this; - - } - - copy( lut ) { - - this.lut = lut.lut; - this.map = lut.map; - this.n = lut.n; - this.minV = lut.minV; - this.maxV = lut.maxV; - - return this; - - } - - getColor( alpha ) { - - alpha = MathUtils.clamp( alpha, this.minV, this.maxV ); - - alpha = ( alpha - this.minV ) / ( this.maxV - this.minV ); - - const colorPosition = Math.round( alpha * this.n ); - - return this.lut[ colorPosition ]; - - } - - addColorMap( name, arrayOfColors ) { - - ColorMapKeywords[ name ] = arrayOfColors; - - return this; - - } - - createCanvas() { - - const canvas = document.createElement( 'canvas' ); - canvas.width = 1; - canvas.height = this.n; - - this.updateCanvas( canvas ); - - return canvas; - - } - - updateCanvas( canvas ) { - - const ctx = canvas.getContext( '2d', { alpha: false } ); - - const imageData = ctx.getImageData( 0, 0, 1, this.n ); - - const data = imageData.data; - - let k = 0; - - const step = 1.0 / this.n; - - const minColor = new Color(); - const maxColor = new Color(); - const finalColor = new Color(); - - for ( let i = 1; i >= 0; i -= step ) { - - for ( let j = this.map.length - 1; j >= 0; j -- ) { - - if ( i < this.map[ j ][ 0 ] && i >= this.map[ j - 1 ][ 0 ] ) { - - const min = this.map[ j - 1 ][ 0 ]; - const max = this.map[ j ][ 0 ]; - - minColor.setHex( this.map[ j - 1 ][ 1 ], LinearSRGBColorSpace ); - maxColor.setHex( this.map[ j ][ 1 ], LinearSRGBColorSpace ); - - finalColor.lerpColors( minColor, maxColor, ( i - min ) / ( max - min ) ); - - data[ k * 4 ] = Math.round( finalColor.r * 255 ); - data[ k * 4 + 1 ] = Math.round( finalColor.g * 255 ); - data[ k * 4 + 2 ] = Math.round( finalColor.b * 255 ); - data[ k * 4 + 3 ] = 255; - - k += 1; - - } - - } - - } - - ctx.putImageData( imageData, 0, 0 ); - - return canvas; - - } - -} - -const ColorMapKeywords = { - - 'rainbow': [[ 0.0, 0x0000FF ], [ 0.2, 0x00FFFF ], [ 0.5, 0x00FF00 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFF0000 ]], - 'cooltowarm': [[ 0.0, 0x3C4EC2 ], [ 0.2, 0x9BBCFF ], [ 0.5, 0xDCDCDC ], [ 0.8, 0xF6A385 ], [ 1.0, 0xB40426 ]], - 'blackbody': [[ 0.0, 0x000000 ], [ 0.2, 0x780000 ], [ 0.5, 0xE63200 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFFFFFF ]], - 'grayscale': [[ 0.0, 0x000000 ], [ 0.2, 0x404040 ], [ 0.5, 0x7F7F80 ], [ 0.8, 0xBFBFBF ], [ 1.0, 0xFFFFFF ]] - -}; - -export { Lut, ColorMapKeywords }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/MeshSurfaceSampler.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/MeshSurfaceSampler.js deleted file mode 100644 index 922ea22..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/MeshSurfaceSampler.js +++ /dev/null @@ -1,250 +0,0 @@ -import { - Triangle, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Utility class for sampling weighted random points on the surface of a mesh. - * - * Building the sampler is a one-time O(n) operation. Once built, any number of - * random samples may be selected in O(logn) time. Memory usage is O(n). - * - * References: - * - http://www.joesfer.com/?p=84 - * - https://stackoverflow.com/a/4322940/1314762 - */ - -const _face = new Triangle(); -const _color = new Vector3(); -const _uva = new Vector2(), _uvb = new Vector2(), _uvc = new Vector2(); - -class MeshSurfaceSampler { - - constructor( mesh ) { - - this.geometry = mesh.geometry; - this.randomFunction = Math.random; - - this.indexAttribute = this.geometry.index; - this.positionAttribute = this.geometry.getAttribute( 'position' ); - this.normalAttribute = this.geometry.getAttribute( 'normal' ); - this.colorAttribute = this.geometry.getAttribute( 'color' ); - this.uvAttribute = this.geometry.getAttribute( 'uv' ); - this.weightAttribute = null; - - this.distribution = null; - - } - - setWeightAttribute( name ) { - - this.weightAttribute = name ? this.geometry.getAttribute( name ) : null; - - return this; - - } - - build() { - - const indexAttribute = this.indexAttribute; - const positionAttribute = this.positionAttribute; - const weightAttribute = this.weightAttribute; - - const totalFaces = indexAttribute ? ( indexAttribute.count / 3 ) : ( positionAttribute.count / 3 ); - const faceWeights = new Float32Array( totalFaces ); - - // Accumulate weights for each mesh face. - - for ( let i = 0; i < totalFaces; i ++ ) { - - let faceWeight = 1; - - let i0 = 3 * i; - let i1 = 3 * i + 1; - let i2 = 3 * i + 2; - - if ( indexAttribute ) { - - i0 = indexAttribute.getX( i0 ); - i1 = indexAttribute.getX( i1 ); - i2 = indexAttribute.getX( i2 ); - - } - - if ( weightAttribute ) { - - faceWeight = weightAttribute.getX( i0 ) - + weightAttribute.getX( i1 ) - + weightAttribute.getX( i2 ); - - } - - _face.a.fromBufferAttribute( positionAttribute, i0 ); - _face.b.fromBufferAttribute( positionAttribute, i1 ); - _face.c.fromBufferAttribute( positionAttribute, i2 ); - faceWeight *= _face.getArea(); - - faceWeights[ i ] = faceWeight; - - } - - // Store cumulative total face weights in an array, where weight index - // corresponds to face index. - - const distribution = new Float32Array( totalFaces ); - let cumulativeTotal = 0; - - for ( let i = 0; i < totalFaces; i ++ ) { - - cumulativeTotal += faceWeights[ i ]; - distribution[ i ] = cumulativeTotal; - - } - - this.distribution = distribution; - return this; - - } - - setRandomGenerator( randomFunction ) { - - this.randomFunction = randomFunction; - return this; - - } - - sample( targetPosition, targetNormal, targetColor, targetUV ) { - - const faceIndex = this.sampleFaceIndex(); - return this.sampleFace( faceIndex, targetPosition, targetNormal, targetColor, targetUV ); - - } - - sampleFaceIndex() { - - const cumulativeTotal = this.distribution[ this.distribution.length - 1 ]; - return this.binarySearch( this.randomFunction() * cumulativeTotal ); - - } - - binarySearch( x ) { - - const dist = this.distribution; - let start = 0; - let end = dist.length - 1; - - let index = - 1; - - while ( start <= end ) { - - const mid = Math.ceil( ( start + end ) / 2 ); - - if ( mid === 0 || dist[ mid - 1 ] <= x && dist[ mid ] > x ) { - - index = mid; - - break; - - } else if ( x < dist[ mid ] ) { - - end = mid - 1; - - } else { - - start = mid + 1; - - } - - } - - return index; - - } - - sampleFace( faceIndex, targetPosition, targetNormal, targetColor, targetUV ) { - - let u = this.randomFunction(); - let v = this.randomFunction(); - - if ( u + v > 1 ) { - - u = 1 - u; - v = 1 - v; - - } - - // get the vertex attribute indices - const indexAttribute = this.indexAttribute; - let i0 = faceIndex * 3; - let i1 = faceIndex * 3 + 1; - let i2 = faceIndex * 3 + 2; - if ( indexAttribute ) { - - i0 = indexAttribute.getX( i0 ); - i1 = indexAttribute.getX( i1 ); - i2 = indexAttribute.getX( i2 ); - - } - - _face.a.fromBufferAttribute( this.positionAttribute, i0 ); - _face.b.fromBufferAttribute( this.positionAttribute, i1 ); - _face.c.fromBufferAttribute( this.positionAttribute, i2 ); - - targetPosition - .set( 0, 0, 0 ) - .addScaledVector( _face.a, u ) - .addScaledVector( _face.b, v ) - .addScaledVector( _face.c, 1 - ( u + v ) ); - - if ( targetNormal !== undefined ) { - - if ( this.normalAttribute !== undefined ) { - - _face.a.fromBufferAttribute( this.normalAttribute, i0 ); - _face.b.fromBufferAttribute( this.normalAttribute, i1 ); - _face.c.fromBufferAttribute( this.normalAttribute, i2 ); - targetNormal.set( 0, 0, 0 ).addScaledVector( _face.a, u ).addScaledVector( _face.b, v ).addScaledVector( _face.c, 1 - ( u + v ) ).normalize(); - - } else { - - _face.getNormal( targetNormal ); - - } - - } - - if ( targetColor !== undefined && this.colorAttribute !== undefined ) { - - _face.a.fromBufferAttribute( this.colorAttribute, i0 ); - _face.b.fromBufferAttribute( this.colorAttribute, i1 ); - _face.c.fromBufferAttribute( this.colorAttribute, i2 ); - - _color - .set( 0, 0, 0 ) - .addScaledVector( _face.a, u ) - .addScaledVector( _face.b, v ) - .addScaledVector( _face.c, 1 - ( u + v ) ); - - targetColor.r = _color.x; - targetColor.g = _color.y; - targetColor.b = _color.z; - - } - - if ( targetUV !== undefined && this.uvAttribute !== undefined ) { - - _uva.fromBufferAttribute( this.uvAttribute, i0 ); - _uvb.fromBufferAttribute( this.uvAttribute, i1 ); - _uvc.fromBufferAttribute( this.uvAttribute, i2 ); - targetUV.set( 0, 0 ).addScaledVector( _uva, u ).addScaledVector( _uvb, v ).addScaledVector( _uvc, 1 - ( u + v ) ); - - } - - return this; - - } - -} - -export { MeshSurfaceSampler }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/OBB.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/OBB.js deleted file mode 100644 index 3f5d732..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/OBB.js +++ /dev/null @@ -1,423 +0,0 @@ -import { - Box3, - MathUtils, - Matrix4, - Matrix3, - Ray, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -// module scope helper variables - -const a = { - c: null, // center - u: [ new Vector3(), new Vector3(), new Vector3() ], // basis vectors - e: [] // half width -}; - -const b = { - c: null, // center - u: [ new Vector3(), new Vector3(), new Vector3() ], // basis vectors - e: [] // half width -}; - -const R = [[], [], []]; -const AbsR = [[], [], []]; -const t = []; - -const xAxis = new Vector3(); -const yAxis = new Vector3(); -const zAxis = new Vector3(); -const v1 = new Vector3(); -const size = new Vector3(); -const closestPoint = new Vector3(); -const rotationMatrix = new Matrix3(); -const aabb = new Box3(); -const matrix = new Matrix4(); -const inverse = new Matrix4(); -const localRay = new Ray(); - -// OBB - -class OBB { - - constructor( center = new Vector3(), halfSize = new Vector3(), rotation = new Matrix3() ) { - - this.center = center; - this.halfSize = halfSize; - this.rotation = rotation; - - } - - set( center, halfSize, rotation ) { - - this.center = center; - this.halfSize = halfSize; - this.rotation = rotation; - - return this; - - } - - copy( obb ) { - - this.center.copy( obb.center ); - this.halfSize.copy( obb.halfSize ); - this.rotation.copy( obb.rotation ); - - return this; - - } - - clone() { - - return new this.constructor().copy( this ); - - } - - getSize( result ) { - - return result.copy( this.halfSize ).multiplyScalar( 2 ); - - } - - /** - * Reference: Closest Point on OBB to Point in Real-Time Collision Detection - * by Christer Ericson (chapter 5.1.4) - */ - clampPoint( point, result ) { - - const halfSize = this.halfSize; - - v1.subVectors( point, this.center ); - this.rotation.extractBasis( xAxis, yAxis, zAxis ); - - // start at the center position of the OBB - - result.copy( this.center ); - - // project the target onto the OBB axes and walk towards that point - - const x = MathUtils.clamp( v1.dot( xAxis ), - halfSize.x, halfSize.x ); - result.add( xAxis.multiplyScalar( x ) ); - - const y = MathUtils.clamp( v1.dot( yAxis ), - halfSize.y, halfSize.y ); - result.add( yAxis.multiplyScalar( y ) ); - - const z = MathUtils.clamp( v1.dot( zAxis ), - halfSize.z, halfSize.z ); - result.add( zAxis.multiplyScalar( z ) ); - - return result; - - } - - containsPoint( point ) { - - v1.subVectors( point, this.center ); - this.rotation.extractBasis( xAxis, yAxis, zAxis ); - - // project v1 onto each axis and check if these points lie inside the OBB - - return Math.abs( v1.dot( xAxis ) ) <= this.halfSize.x && - Math.abs( v1.dot( yAxis ) ) <= this.halfSize.y && - Math.abs( v1.dot( zAxis ) ) <= this.halfSize.z; - - } - - intersectsBox3( box3 ) { - - return this.intersectsOBB( obb.fromBox3( box3 ) ); - - } - - intersectsSphere( sphere ) { - - // find the point on the OBB closest to the sphere center - - this.clampPoint( sphere.center, closestPoint ); - - // if that point is inside the sphere, the OBB and sphere intersect - - return closestPoint.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); - - } - - /** - * Reference: OBB-OBB Intersection in Real-Time Collision Detection - * by Christer Ericson (chapter 4.4.1) - * - */ - intersectsOBB( obb, epsilon = Number.EPSILON ) { - - // prepare data structures (the code uses the same nomenclature like the reference) - - a.c = this.center; - a.e[ 0 ] = this.halfSize.x; - a.e[ 1 ] = this.halfSize.y; - a.e[ 2 ] = this.halfSize.z; - this.rotation.extractBasis( a.u[ 0 ], a.u[ 1 ], a.u[ 2 ] ); - - b.c = obb.center; - b.e[ 0 ] = obb.halfSize.x; - b.e[ 1 ] = obb.halfSize.y; - b.e[ 2 ] = obb.halfSize.z; - obb.rotation.extractBasis( b.u[ 0 ], b.u[ 1 ], b.u[ 2 ] ); - - // compute rotation matrix expressing b in a's coordinate frame - - for ( let i = 0; i < 3; i ++ ) { - - for ( let j = 0; j < 3; j ++ ) { - - R[ i ][ j ] = a.u[ i ].dot( b.u[ j ] ); - - } - - } - - // compute translation vector - - v1.subVectors( b.c, a.c ); - - // bring translation into a's coordinate frame - - t[ 0 ] = v1.dot( a.u[ 0 ] ); - t[ 1 ] = v1.dot( a.u[ 1 ] ); - t[ 2 ] = v1.dot( a.u[ 2 ] ); - - // compute common subexpressions. Add in an epsilon term to - // counteract arithmetic errors when two edges are parallel and - // their cross product is (near) null - - for ( let i = 0; i < 3; i ++ ) { - - for ( let j = 0; j < 3; j ++ ) { - - AbsR[ i ][ j ] = Math.abs( R[ i ][ j ] ) + epsilon; - - } - - } - - let ra, rb; - - // test axes L = A0, L = A1, L = A2 - - for ( let i = 0; i < 3; i ++ ) { - - ra = a.e[ i ]; - rb = b.e[ 0 ] * AbsR[ i ][ 0 ] + b.e[ 1 ] * AbsR[ i ][ 1 ] + b.e[ 2 ] * AbsR[ i ][ 2 ]; - if ( Math.abs( t[ i ] ) > ra + rb ) return false; - - - } - - // test axes L = B0, L = B1, L = B2 - - for ( let i = 0; i < 3; i ++ ) { - - ra = a.e[ 0 ] * AbsR[ 0 ][ i ] + a.e[ 1 ] * AbsR[ 1 ][ i ] + a.e[ 2 ] * AbsR[ 2 ][ i ]; - rb = b.e[ i ]; - if ( Math.abs( t[ 0 ] * R[ 0 ][ i ] + t[ 1 ] * R[ 1 ][ i ] + t[ 2 ] * R[ 2 ][ i ] ) > ra + rb ) return false; - - } - - // test axis L = A0 x B0 - - ra = a.e[ 1 ] * AbsR[ 2 ][ 0 ] + a.e[ 2 ] * AbsR[ 1 ][ 0 ]; - rb = b.e[ 1 ] * AbsR[ 0 ][ 2 ] + b.e[ 2 ] * AbsR[ 0 ][ 1 ]; - if ( Math.abs( t[ 2 ] * R[ 1 ][ 0 ] - t[ 1 ] * R[ 2 ][ 0 ] ) > ra + rb ) return false; - - // test axis L = A0 x B1 - - ra = a.e[ 1 ] * AbsR[ 2 ][ 1 ] + a.e[ 2 ] * AbsR[ 1 ][ 1 ]; - rb = b.e[ 0 ] * AbsR[ 0 ][ 2 ] + b.e[ 2 ] * AbsR[ 0 ][ 0 ]; - if ( Math.abs( t[ 2 ] * R[ 1 ][ 1 ] - t[ 1 ] * R[ 2 ][ 1 ] ) > ra + rb ) return false; - - // test axis L = A0 x B2 - - ra = a.e[ 1 ] * AbsR[ 2 ][ 2 ] + a.e[ 2 ] * AbsR[ 1 ][ 2 ]; - rb = b.e[ 0 ] * AbsR[ 0 ][ 1 ] + b.e[ 1 ] * AbsR[ 0 ][ 0 ]; - if ( Math.abs( t[ 2 ] * R[ 1 ][ 2 ] - t[ 1 ] * R[ 2 ][ 2 ] ) > ra + rb ) return false; - - // test axis L = A1 x B0 - - ra = a.e[ 0 ] * AbsR[ 2 ][ 0 ] + a.e[ 2 ] * AbsR[ 0 ][ 0 ]; - rb = b.e[ 1 ] * AbsR[ 1 ][ 2 ] + b.e[ 2 ] * AbsR[ 1 ][ 1 ]; - if ( Math.abs( t[ 0 ] * R[ 2 ][ 0 ] - t[ 2 ] * R[ 0 ][ 0 ] ) > ra + rb ) return false; - - // test axis L = A1 x B1 - - ra = a.e[ 0 ] * AbsR[ 2 ][ 1 ] + a.e[ 2 ] * AbsR[ 0 ][ 1 ]; - rb = b.e[ 0 ] * AbsR[ 1 ][ 2 ] + b.e[ 2 ] * AbsR[ 1 ][ 0 ]; - if ( Math.abs( t[ 0 ] * R[ 2 ][ 1 ] - t[ 2 ] * R[ 0 ][ 1 ] ) > ra + rb ) return false; - - // test axis L = A1 x B2 - - ra = a.e[ 0 ] * AbsR[ 2 ][ 2 ] + a.e[ 2 ] * AbsR[ 0 ][ 2 ]; - rb = b.e[ 0 ] * AbsR[ 1 ][ 1 ] + b.e[ 1 ] * AbsR[ 1 ][ 0 ]; - if ( Math.abs( t[ 0 ] * R[ 2 ][ 2 ] - t[ 2 ] * R[ 0 ][ 2 ] ) > ra + rb ) return false; - - // test axis L = A2 x B0 - - ra = a.e[ 0 ] * AbsR[ 1 ][ 0 ] + a.e[ 1 ] * AbsR[ 0 ][ 0 ]; - rb = b.e[ 1 ] * AbsR[ 2 ][ 2 ] + b.e[ 2 ] * AbsR[ 2 ][ 1 ]; - if ( Math.abs( t[ 1 ] * R[ 0 ][ 0 ] - t[ 0 ] * R[ 1 ][ 0 ] ) > ra + rb ) return false; - - // test axis L = A2 x B1 - - ra = a.e[ 0 ] * AbsR[ 1 ][ 1 ] + a.e[ 1 ] * AbsR[ 0 ][ 1 ]; - rb = b.e[ 0 ] * AbsR[ 2 ][ 2 ] + b.e[ 2 ] * AbsR[ 2 ][ 0 ]; - if ( Math.abs( t[ 1 ] * R[ 0 ][ 1 ] - t[ 0 ] * R[ 1 ][ 1 ] ) > ra + rb ) return false; - - // test axis L = A2 x B2 - - ra = a.e[ 0 ] * AbsR[ 1 ][ 2 ] + a.e[ 1 ] * AbsR[ 0 ][ 2 ]; - rb = b.e[ 0 ] * AbsR[ 2 ][ 1 ] + b.e[ 1 ] * AbsR[ 2 ][ 0 ]; - if ( Math.abs( t[ 1 ] * R[ 0 ][ 2 ] - t[ 0 ] * R[ 1 ][ 2 ] ) > ra + rb ) return false; - - // since no separating axis is found, the OBBs must be intersecting - - return true; - - } - - /** - * Reference: Testing Box Against Plane in Real-Time Collision Detection - * by Christer Ericson (chapter 5.2.3) - */ - intersectsPlane( plane ) { - - this.rotation.extractBasis( xAxis, yAxis, zAxis ); - - // compute the projection interval radius of this OBB onto L(t) = this->center + t * p.normal; - - const r = this.halfSize.x * Math.abs( plane.normal.dot( xAxis ) ) + - this.halfSize.y * Math.abs( plane.normal.dot( yAxis ) ) + - this.halfSize.z * Math.abs( plane.normal.dot( zAxis ) ); - - // compute distance of the OBB's center from the plane - - const d = plane.normal.dot( this.center ) - plane.constant; - - // Intersection occurs when distance d falls within [-r,+r] interval - - return Math.abs( d ) <= r; - - } - - /** - * Performs a ray/OBB intersection test and stores the intersection point - * to the given 3D vector. If no intersection is detected, *null* is returned. - */ - intersectRay( ray, result ) { - - // the idea is to perform the intersection test in the local space - // of the OBB. - - this.getSize( size ); - aabb.setFromCenterAndSize( v1.set( 0, 0, 0 ), size ); - - // create a 4x4 transformation matrix - - matrix.setFromMatrix3( this.rotation ); - matrix.setPosition( this.center ); - - // transform ray to the local space of the OBB - - inverse.copy( matrix ).invert(); - localRay.copy( ray ).applyMatrix4( inverse ); - - // perform ray <-> AABB intersection test - - if ( localRay.intersectBox( aabb, result ) ) { - - // transform the intersection point back to world space - - return result.applyMatrix4( matrix ); - - } else { - - return null; - - } - - } - - /** - * Performs a ray/OBB intersection test. Returns either true or false if - * there is a intersection or not. - */ - intersectsRay( ray ) { - - return this.intersectRay( ray, v1 ) !== null; - - } - - fromBox3( box3 ) { - - box3.getCenter( this.center ); - - box3.getSize( this.halfSize ).multiplyScalar( 0.5 ); - - this.rotation.identity(); - - return this; - - } - - equals( obb ) { - - return obb.center.equals( this.center ) && - obb.halfSize.equals( this.halfSize ) && - obb.rotation.equals( this.rotation ); - - } - - applyMatrix4( matrix ) { - - const e = matrix.elements; - - let sx = v1.set( e[ 0 ], e[ 1 ], e[ 2 ] ).length(); - const sy = v1.set( e[ 4 ], e[ 5 ], e[ 6 ] ).length(); - const sz = v1.set( e[ 8 ], e[ 9 ], e[ 10 ] ).length(); - - const det = matrix.determinant(); - if ( det < 0 ) sx = - sx; - - rotationMatrix.setFromMatrix4( matrix ); - - const invSX = 1 / sx; - const invSY = 1 / sy; - const invSZ = 1 / sz; - - rotationMatrix.elements[ 0 ] *= invSX; - rotationMatrix.elements[ 1 ] *= invSX; - rotationMatrix.elements[ 2 ] *= invSX; - - rotationMatrix.elements[ 3 ] *= invSY; - rotationMatrix.elements[ 4 ] *= invSY; - rotationMatrix.elements[ 5 ] *= invSY; - - rotationMatrix.elements[ 6 ] *= invSZ; - rotationMatrix.elements[ 7 ] *= invSZ; - rotationMatrix.elements[ 8 ] *= invSZ; - - this.rotation.multiply( rotationMatrix ); - - this.halfSize.x *= sx; - this.halfSize.y *= sy; - this.halfSize.z *= sz; - - v1.setFromMatrixPosition( matrix ); - this.center.add( v1 ); - - return this; - - } - -} - -const obb = new OBB(); - -export { OBB }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Octree.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/Octree.js deleted file mode 100644 index aeb79ba..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/Octree.js +++ /dev/null @@ -1,546 +0,0 @@ -import { - Box3, - Line3, - Plane, - Sphere, - Triangle, - Vector3, - Layers -} from '/static/javascript/three/build/three.module.js'; -import { Capsule } from '../math/Capsule.js'; - - -const _v1 = new Vector3(); -const _v2 = new Vector3(); -const _point1 = new Vector3(); -const _point2 = new Vector3(); -const _plane = new Plane(); -const _line1 = new Line3(); -const _line2 = new Line3(); -const _sphere = new Sphere(); -const _capsule = new Capsule(); - -const _temp1 = new Vector3(); -const _temp2 = new Vector3(); -const _temp3 = new Vector3(); -const EPS = 1e-10; - -function lineToLineClosestPoints( line1, line2, target1 = null, target2 = null ) { - - const r = _temp1.copy( line1.end ).sub( line1.start ); - const s = _temp2.copy( line2.end ).sub( line2.start ); - const w = _temp3.copy( line2.start ).sub( line1.start ); - - const a = r.dot( s ), - b = r.dot( r ), - c = s.dot( s ), - d = s.dot( w ), - e = r.dot( w ); - - let t1, t2; - const divisor = b * c - a * a; - - if ( Math.abs( divisor ) < EPS ) { - - const d1 = - d / c; - const d2 = ( a - d ) / c; - - if ( Math.abs( d1 - 0.5 ) < Math.abs( d2 - 0.5 ) ) { - - t1 = 0; - t2 = d1; - - } else { - - t1 = 1; - t2 = d2; - - } - - } else { - - t1 = ( d * a + e * c ) / divisor; - t2 = ( t1 * a - d ) / c; - - } - - t2 = Math.max( 0, Math.min( 1, t2 ) ); - t1 = Math.max( 0, Math.min( 1, t1 ) ); - - if ( target1 ) { - - target1.copy( r ).multiplyScalar( t1 ).add( line1.start ); - - } - - if ( target2 ) { - - target2.copy( s ).multiplyScalar( t2 ).add( line2.start ); - - } - -} - -class Octree { - - constructor( box ) { - - this.box = box; - this.bounds = new Box3(); - - this.subTrees = []; - this.triangles = []; - this.layers = new Layers(); - - } - - addTriangle( triangle ) { - - this.bounds.min.x = Math.min( this.bounds.min.x, triangle.a.x, triangle.b.x, triangle.c.x ); - this.bounds.min.y = Math.min( this.bounds.min.y, triangle.a.y, triangle.b.y, triangle.c.y ); - this.bounds.min.z = Math.min( this.bounds.min.z, triangle.a.z, triangle.b.z, triangle.c.z ); - this.bounds.max.x = Math.max( this.bounds.max.x, triangle.a.x, triangle.b.x, triangle.c.x ); - this.bounds.max.y = Math.max( this.bounds.max.y, triangle.a.y, triangle.b.y, triangle.c.y ); - this.bounds.max.z = Math.max( this.bounds.max.z, triangle.a.z, triangle.b.z, triangle.c.z ); - - this.triangles.push( triangle ); - - return this; - - } - - calcBox() { - - this.box = this.bounds.clone(); - - // offset small amount to account for regular grid - this.box.min.x -= 0.01; - this.box.min.y -= 0.01; - this.box.min.z -= 0.01; - - return this; - - } - - split( level ) { - - if ( ! this.box ) return; - - const subTrees = []; - const halfsize = _v2.copy( this.box.max ).sub( this.box.min ).multiplyScalar( 0.5 ); - - for ( let x = 0; x < 2; x ++ ) { - - for ( let y = 0; y < 2; y ++ ) { - - for ( let z = 0; z < 2; z ++ ) { - - const box = new Box3(); - const v = _v1.set( x, y, z ); - - box.min.copy( this.box.min ).add( v.multiply( halfsize ) ); - box.max.copy( box.min ).add( halfsize ); - - subTrees.push( new Octree( box ) ); - - } - - } - - } - - let triangle; - - while ( triangle = this.triangles.pop() ) { - - for ( let i = 0; i < subTrees.length; i ++ ) { - - if ( subTrees[ i ].box.intersectsTriangle( triangle ) ) { - - subTrees[ i ].triangles.push( triangle ); - - } - - } - - } - - for ( let i = 0; i < subTrees.length; i ++ ) { - - const len = subTrees[ i ].triangles.length; - - if ( len > 8 && level < 16 ) { - - subTrees[ i ].split( level + 1 ); - - } - - if ( len !== 0 ) { - - this.subTrees.push( subTrees[ i ] ); - - } - - } - - return this; - - } - - build() { - - this.calcBox(); - this.split( 0 ); - - return this; - - } - - getRayTriangles( ray, triangles ) { - - for ( let i = 0; i < this.subTrees.length; i ++ ) { - - const subTree = this.subTrees[ i ]; - if ( ! ray.intersectsBox( subTree.box ) ) continue; - - if ( subTree.triangles.length > 0 ) { - - for ( let j = 0; j < subTree.triangles.length; j ++ ) { - - if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); - - } - - } else { - - subTree.getRayTriangles( ray, triangles ); - - } - - } - - return triangles; - - } - - triangleCapsuleIntersect( capsule, triangle ) { - - triangle.getPlane( _plane ); - - const d1 = _plane.distanceToPoint( capsule.start ) - capsule.radius; - const d2 = _plane.distanceToPoint( capsule.end ) - capsule.radius; - - if ( ( d1 > 0 && d2 > 0 ) || ( d1 < - capsule.radius && d2 < - capsule.radius ) ) { - - return false; - - } - - const delta = Math.abs( d1 / ( Math.abs( d1 ) + Math.abs( d2 ) ) ); - const intersectPoint = _v1.copy( capsule.start ).lerp( capsule.end, delta ); - - if ( triangle.containsPoint( intersectPoint ) ) { - - return { normal: _plane.normal.clone(), point: intersectPoint.clone(), depth: Math.abs( Math.min( d1, d2 ) ) }; - - } - - const r2 = capsule.radius * capsule.radius; - - const line1 = _line1.set( capsule.start, capsule.end ); - - const lines = [ - [ triangle.a, triangle.b ], - [ triangle.b, triangle.c ], - [ triangle.c, triangle.a ] - ]; - - for ( let i = 0; i < lines.length; i ++ ) { - - const line2 = _line2.set( lines[ i ][ 0 ], lines[ i ][ 1 ] ); - - lineToLineClosestPoints( line1, line2, _point1, _point2 ); - - if ( _point1.distanceToSquared( _point2 ) < r2 ) { - - return { - normal: _point1.clone().sub( _point2 ).normalize(), - point: _point2.clone(), - depth: capsule.radius - _point1.distanceTo( _point2 ) - }; - - } - - } - - return false; - - } - - triangleSphereIntersect( sphere, triangle ) { - - triangle.getPlane( _plane ); - - if ( ! sphere.intersectsPlane( _plane ) ) return false; - - const depth = Math.abs( _plane.distanceToSphere( sphere ) ); - const r2 = sphere.radius * sphere.radius - depth * depth; - - const plainPoint = _plane.projectPoint( sphere.center, _v1 ); - - if ( triangle.containsPoint( sphere.center ) ) { - - return { normal: _plane.normal.clone(), point: plainPoint.clone(), depth: Math.abs( _plane.distanceToSphere( sphere ) ) }; - - } - - const lines = [ - [ triangle.a, triangle.b ], - [ triangle.b, triangle.c ], - [ triangle.c, triangle.a ] - ]; - - for ( let i = 0; i < lines.length; i ++ ) { - - _line1.set( lines[ i ][ 0 ], lines[ i ][ 1 ] ); - _line1.closestPointToPoint( plainPoint, true, _v2 ); - - const d = _v2.distanceToSquared( sphere.center ); - - if ( d < r2 ) { - - return { normal: sphere.center.clone().sub( _v2 ).normalize(), point: _v2.clone(), depth: sphere.radius - Math.sqrt( d ) }; - - } - - } - - return false; - - } - - getSphereTriangles( sphere, triangles ) { - - for ( let i = 0; i < this.subTrees.length; i ++ ) { - - const subTree = this.subTrees[ i ]; - - if ( ! sphere.intersectsBox( subTree.box ) ) continue; - - if ( subTree.triangles.length > 0 ) { - - for ( let j = 0; j < subTree.triangles.length; j ++ ) { - - if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); - - } - - } else { - - subTree.getSphereTriangles( sphere, triangles ); - - } - - } - - } - - getCapsuleTriangles( capsule, triangles ) { - - for ( let i = 0; i < this.subTrees.length; i ++ ) { - - const subTree = this.subTrees[ i ]; - - if ( ! capsule.intersectsBox( subTree.box ) ) continue; - - if ( subTree.triangles.length > 0 ) { - - for ( let j = 0; j < subTree.triangles.length; j ++ ) { - - if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); - - } - - } else { - - subTree.getCapsuleTriangles( capsule, triangles ); - - } - - } - - } - - sphereIntersect( sphere ) { - - _sphere.copy( sphere ); - - const triangles = []; - let result, hit = false; - - this.getSphereTriangles( sphere, triangles ); - - for ( let i = 0; i < triangles.length; i ++ ) { - - if ( result = this.triangleSphereIntersect( _sphere, triangles[ i ] ) ) { - - hit = true; - - _sphere.center.add( result.normal.multiplyScalar( result.depth ) ); - - } - - } - - if ( hit ) { - - const collisionVector = _sphere.center.clone().sub( sphere.center ); - const depth = collisionVector.length(); - - return { normal: collisionVector.normalize(), depth: depth }; - - } - - return false; - - } - - capsuleIntersect( capsule ) { - - _capsule.copy( capsule ); - - const triangles = []; - let result, hit = false; - - this.getCapsuleTriangles( _capsule, triangles ); - - for ( let i = 0; i < triangles.length; i ++ ) { - - if ( result = this.triangleCapsuleIntersect( _capsule, triangles[ i ] ) ) { - - hit = true; - - _capsule.translate( result.normal.multiplyScalar( result.depth ) ); - - } - - } - - if ( hit ) { - - const collisionVector = _capsule.getCenter( new Vector3() ).sub( capsule.getCenter( _v1 ) ); - const depth = collisionVector.length(); - - return { normal: collisionVector.normalize(), depth: depth }; - - } - - return false; - - } - - rayIntersect( ray ) { - - if ( ray.direction.length() === 0 ) return; - - const triangles = []; - let triangle, position, distance = 1e100; - - this.getRayTriangles( ray, triangles ); - - for ( let i = 0; i < triangles.length; i ++ ) { - - const result = ray.intersectTriangle( triangles[ i ].a, triangles[ i ].b, triangles[ i ].c, true, _v1 ); - - if ( result ) { - - const newdistance = result.sub( ray.origin ).length(); - - if ( distance > newdistance ) { - - position = result.clone().add( ray.origin ); - distance = newdistance; - triangle = triangles[ i ]; - - } - - } - - } - - return distance < 1e100 ? { distance: distance, triangle: triangle, position: position } : false; - - } - - fromGraphNode( group ) { - - group.updateWorldMatrix( true, true ); - - group.traverse( ( obj ) => { - - if ( obj.isMesh === true ) { - - if ( this.layers.test( obj.layers ) ) { - - let geometry, isTemp = false; - - if ( obj.geometry.index !== null ) { - - isTemp = true; - geometry = obj.geometry.toNonIndexed(); - - } else { - - geometry = obj.geometry; - - } - - const positionAttribute = geometry.getAttribute( 'position' ); - - for ( let i = 0; i < positionAttribute.count; i += 3 ) { - - const v1 = new Vector3().fromBufferAttribute( positionAttribute, i ); - const v2 = new Vector3().fromBufferAttribute( positionAttribute, i + 1 ); - const v3 = new Vector3().fromBufferAttribute( positionAttribute, i + 2 ); - - v1.applyMatrix4( obj.matrixWorld ); - v2.applyMatrix4( obj.matrixWorld ); - v3.applyMatrix4( obj.matrixWorld ); - - this.addTriangle( new Triangle( v1, v2, v3 ) ); - - } - - if ( isTemp ) { - - geometry.dispose(); - - } - - } - - } - - } ); - - this.build(); - - return this; - - } - - clear() { - - this.box = null; - this.bounds.makeEmpty(); - - this.subTrees.length = 0; - this.triangles.length = 0; - - return this; - - } - -} - -export { Octree }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/math/SimplexNoise.js b/docker-compose/requirements/nginx/static/javascript/taaaa/math/SimplexNoise.js deleted file mode 100644 index 8ba2694..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/math/SimplexNoise.js +++ /dev/null @@ -1,444 +0,0 @@ -// Ported from Stefan Gustavson's java implementation -// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf -// Read Stefan's excellent paper for details on how this code works. -// -// Sean McCullough banksean@gmail.com -// -// Added 4D noise - -/** - * You can pass in a random number generator object if you like. - * It is assumed to have a random() method. - */ -class SimplexNoise { - - constructor( r = Math ) { - - this.grad3 = [[ 1, 1, 0 ], [ - 1, 1, 0 ], [ 1, - 1, 0 ], [ - 1, - 1, 0 ], - [ 1, 0, 1 ], [ - 1, 0, 1 ], [ 1, 0, - 1 ], [ - 1, 0, - 1 ], - [ 0, 1, 1 ], [ 0, - 1, 1 ], [ 0, 1, - 1 ], [ 0, - 1, - 1 ]]; - - this.grad4 = [[ 0, 1, 1, 1 ], [ 0, 1, 1, - 1 ], [ 0, 1, - 1, 1 ], [ 0, 1, - 1, - 1 ], - [ 0, - 1, 1, 1 ], [ 0, - 1, 1, - 1 ], [ 0, - 1, - 1, 1 ], [ 0, - 1, - 1, - 1 ], - [ 1, 0, 1, 1 ], [ 1, 0, 1, - 1 ], [ 1, 0, - 1, 1 ], [ 1, 0, - 1, - 1 ], - [ - 1, 0, 1, 1 ], [ - 1, 0, 1, - 1 ], [ - 1, 0, - 1, 1 ], [ - 1, 0, - 1, - 1 ], - [ 1, 1, 0, 1 ], [ 1, 1, 0, - 1 ], [ 1, - 1, 0, 1 ], [ 1, - 1, 0, - 1 ], - [ - 1, 1, 0, 1 ], [ - 1, 1, 0, - 1 ], [ - 1, - 1, 0, 1 ], [ - 1, - 1, 0, - 1 ], - [ 1, 1, 1, 0 ], [ 1, 1, - 1, 0 ], [ 1, - 1, 1, 0 ], [ 1, - 1, - 1, 0 ], - [ - 1, 1, 1, 0 ], [ - 1, 1, - 1, 0 ], [ - 1, - 1, 1, 0 ], [ - 1, - 1, - 1, 0 ]]; - - this.p = []; - - for ( let i = 0; i < 256; i ++ ) { - - this.p[ i ] = Math.floor( r.random() * 256 ); - - } - - // To remove the need for index wrapping, double the permutation table length - this.perm = []; - - for ( let i = 0; i < 512; i ++ ) { - - this.perm[ i ] = this.p[ i & 255 ]; - - } - - // A lookup table to traverse the simplex around a given point in 4D. - // Details can be found where this table is used, in the 4D noise method. - this.simplex = [ - [ 0, 1, 2, 3 ], [ 0, 1, 3, 2 ], [ 0, 0, 0, 0 ], [ 0, 2, 3, 1 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 1, 2, 3, 0 ], - [ 0, 2, 1, 3 ], [ 0, 0, 0, 0 ], [ 0, 3, 1, 2 ], [ 0, 3, 2, 1 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 1, 3, 2, 0 ], - [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], - [ 1, 2, 0, 3 ], [ 0, 0, 0, 0 ], [ 1, 3, 0, 2 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 2, 3, 0, 1 ], [ 2, 3, 1, 0 ], - [ 1, 0, 2, 3 ], [ 1, 0, 3, 2 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 2, 0, 3, 1 ], [ 0, 0, 0, 0 ], [ 2, 1, 3, 0 ], - [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], - [ 2, 0, 1, 3 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 3, 0, 1, 2 ], [ 3, 0, 2, 1 ], [ 0, 0, 0, 0 ], [ 3, 1, 2, 0 ], - [ 2, 1, 0, 3 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 3, 1, 0, 2 ], [ 0, 0, 0, 0 ], [ 3, 2, 0, 1 ], [ 3, 2, 1, 0 ]]; - - } - - dot( g, x, y ) { - - return g[ 0 ] * x + g[ 1 ] * y; - - } - - dot3( g, x, y, z ) { - - return g[ 0 ] * x + g[ 1 ] * y + g[ 2 ] * z; - - } - - dot4( g, x, y, z, w ) { - - return g[ 0 ] * x + g[ 1 ] * y + g[ 2 ] * z + g[ 3 ] * w; - - } - - noise( xin, yin ) { - - let n0; // Noise contributions from the three corners - let n1; - let n2; - // Skew the input space to determine which simplex cell we're in - const F2 = 0.5 * ( Math.sqrt( 3.0 ) - 1.0 ); - const s = ( xin + yin ) * F2; // Hairy factor for 2D - const i = Math.floor( xin + s ); - const j = Math.floor( yin + s ); - const G2 = ( 3.0 - Math.sqrt( 3.0 ) ) / 6.0; - const t = ( i + j ) * G2; - const X0 = i - t; // Unskew the cell origin back to (x,y) space - const Y0 = j - t; - const x0 = xin - X0; // The x,y distances from the cell origin - const y0 = yin - Y0; - - // For the 2D case, the simplex shape is an equilateral triangle. - // Determine which simplex we are in. - let i1; // Offsets for second (middle) corner of simplex in (i,j) coords - - let j1; - if ( x0 > y0 ) { - - i1 = 1; j1 = 0; - - // lower triangle, XY order: (0,0)->(1,0)->(1,1) - - } else { - - i1 = 0; j1 = 1; - - } // upper triangle, YX order: (0,0)->(0,1)->(1,1) - - // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and - // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where - // c = (3-sqrt(3))/6 - const x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords - const y1 = y0 - j1 + G2; - const x2 = x0 - 1.0 + 2.0 * G2; // Offsets for last corner in (x,y) unskewed coords - const y2 = y0 - 1.0 + 2.0 * G2; - // Work out the hashed gradient indices of the three simplex corners - const ii = i & 255; - const jj = j & 255; - const gi0 = this.perm[ ii + this.perm[ jj ] ] % 12; - const gi1 = this.perm[ ii + i1 + this.perm[ jj + j1 ] ] % 12; - const gi2 = this.perm[ ii + 1 + this.perm[ jj + 1 ] ] % 12; - // Calculate the contribution from the three corners - let t0 = 0.5 - x0 * x0 - y0 * y0; - if ( t0 < 0 ) n0 = 0.0; - else { - - t0 *= t0; - n0 = t0 * t0 * this.dot( this.grad3[ gi0 ], x0, y0 ); // (x,y) of grad3 used for 2D gradient - - } - - let t1 = 0.5 - x1 * x1 - y1 * y1; - if ( t1 < 0 ) n1 = 0.0; - else { - - t1 *= t1; - n1 = t1 * t1 * this.dot( this.grad3[ gi1 ], x1, y1 ); - - } - - let t2 = 0.5 - x2 * x2 - y2 * y2; - if ( t2 < 0 ) n2 = 0.0; - else { - - t2 *= t2; - n2 = t2 * t2 * this.dot( this.grad3[ gi2 ], x2, y2 ); - - } - - // Add contributions from each corner to get the final noise value. - // The result is scaled to return values in the interval [-1,1]. - return 70.0 * ( n0 + n1 + n2 ); - - } - - // 3D simplex noise - noise3d( xin, yin, zin ) { - - let n0; // Noise contributions from the four corners - let n1; - let n2; - let n3; - // Skew the input space to determine which simplex cell we're in - const F3 = 1.0 / 3.0; - const s = ( xin + yin + zin ) * F3; // Very nice and simple skew factor for 3D - const i = Math.floor( xin + s ); - const j = Math.floor( yin + s ); - const k = Math.floor( zin + s ); - const G3 = 1.0 / 6.0; // Very nice and simple unskew factor, too - const t = ( i + j + k ) * G3; - const X0 = i - t; // Unskew the cell origin back to (x,y,z) space - const Y0 = j - t; - const Z0 = k - t; - const x0 = xin - X0; // The x,y,z distances from the cell origin - const y0 = yin - Y0; - const z0 = zin - Z0; - - // For the 3D case, the simplex shape is a slightly irregular tetrahedron. - // Determine which simplex we are in. - let i1; // Offsets for second corner of simplex in (i,j,k) coords - - let j1; - let k1; - let i2; // Offsets for third corner of simplex in (i,j,k) coords - let j2; - let k2; - if ( x0 >= y0 ) { - - if ( y0 >= z0 ) { - - i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 0; - - // X Y Z order - - } else if ( x0 >= z0 ) { - - i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 0; k2 = 1; - - // X Z Y order - - } else { - - i1 = 0; j1 = 0; k1 = 1; i2 = 1; j2 = 0; k2 = 1; - - } // Z X Y order - - } else { // x0 y0 ) ? 32 : 0; - const c2 = ( x0 > z0 ) ? 16 : 0; - const c3 = ( y0 > z0 ) ? 8 : 0; - const c4 = ( x0 > w0 ) ? 4 : 0; - const c5 = ( y0 > w0 ) ? 2 : 0; - const c6 = ( z0 > w0 ) ? 1 : 0; - const c = c1 + c2 + c3 + c4 + c5 + c6; - - // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. - // Many values of c will never occur, since e.g. x>y>z>w makes x= 3 ? 1 : 0; - const j1 = simplex[ c ][ 1 ] >= 3 ? 1 : 0; - const k1 = simplex[ c ][ 2 ] >= 3 ? 1 : 0; - const l1 = simplex[ c ][ 3 ] >= 3 ? 1 : 0; - // The number 2 in the "simplex" array is at the second largest coordinate. - const i2 = simplex[ c ][ 0 ] >= 2 ? 1 : 0; - const j2 = simplex[ c ][ 1 ] >= 2 ? 1 : 0; - const k2 = simplex[ c ][ 2 ] >= 2 ? 1 : 0; - const l2 = simplex[ c ][ 3 ] >= 2 ? 1 : 0; - // The number 1 in the "simplex" array is at the second smallest coordinate. - const i3 = simplex[ c ][ 0 ] >= 1 ? 1 : 0; - const j3 = simplex[ c ][ 1 ] >= 1 ? 1 : 0; - const k3 = simplex[ c ][ 2 ] >= 1 ? 1 : 0; - const l3 = simplex[ c ][ 3 ] >= 1 ? 1 : 0; - // The fifth corner has all coordinate offsets = 1, so no need to look that up. - const x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords - const y1 = y0 - j1 + G4; - const z1 = z0 - k1 + G4; - const w1 = w0 - l1 + G4; - const x2 = x0 - i2 + 2.0 * G4; // Offsets for third corner in (x,y,z,w) coords - const y2 = y0 - j2 + 2.0 * G4; - const z2 = z0 - k2 + 2.0 * G4; - const w2 = w0 - l2 + 2.0 * G4; - const x3 = x0 - i3 + 3.0 * G4; // Offsets for fourth corner in (x,y,z,w) coords - const y3 = y0 - j3 + 3.0 * G4; - const z3 = z0 - k3 + 3.0 * G4; - const w3 = w0 - l3 + 3.0 * G4; - const x4 = x0 - 1.0 + 4.0 * G4; // Offsets for last corner in (x,y,z,w) coords - const y4 = y0 - 1.0 + 4.0 * G4; - const z4 = z0 - 1.0 + 4.0 * G4; - const w4 = w0 - 1.0 + 4.0 * G4; - // Work out the hashed gradient indices of the five simplex corners - const ii = i & 255; - const jj = j & 255; - const kk = k & 255; - const ll = l & 255; - const gi0 = perm[ ii + perm[ jj + perm[ kk + perm[ ll ] ] ] ] % 32; - const gi1 = perm[ ii + i1 + perm[ jj + j1 + perm[ kk + k1 + perm[ ll + l1 ] ] ] ] % 32; - const gi2 = perm[ ii + i2 + perm[ jj + j2 + perm[ kk + k2 + perm[ ll + l2 ] ] ] ] % 32; - const gi3 = perm[ ii + i3 + perm[ jj + j3 + perm[ kk + k3 + perm[ ll + l3 ] ] ] ] % 32; - const gi4 = perm[ ii + 1 + perm[ jj + 1 + perm[ kk + 1 + perm[ ll + 1 ] ] ] ] % 32; - // Calculate the contribution from the five corners - let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; - if ( t0 < 0 ) n0 = 0.0; - else { - - t0 *= t0; - n0 = t0 * t0 * this.dot4( grad4[ gi0 ], x0, y0, z0, w0 ); - - } - - let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; - if ( t1 < 0 ) n1 = 0.0; - else { - - t1 *= t1; - n1 = t1 * t1 * this.dot4( grad4[ gi1 ], x1, y1, z1, w1 ); - - } - - let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; - if ( t2 < 0 ) n2 = 0.0; - else { - - t2 *= t2; - n2 = t2 * t2 * this.dot4( grad4[ gi2 ], x2, y2, z2, w2 ); - - } - - let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; - if ( t3 < 0 ) n3 = 0.0; - else { - - t3 *= t3; - n3 = t3 * t3 * this.dot4( grad4[ gi3 ], x3, y3, z3, w3 ); - - } - - let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; - if ( t4 < 0 ) n4 = 0.0; - else { - - t4 *= t4; - n4 = t4 * t4 * this.dot4( grad4[ gi4 ], x4, y4, z4, w4 ); - - } - - // Sum up and scale the result to cover the range [-1,1] - return 27.0 * ( n0 + n1 + n2 + n3 + n4 ); - - } - -} - -export { SimplexNoise }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/meshopt_decoder.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/meshopt_decoder.module.js deleted file mode 100644 index d0933a9..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/meshopt_decoder.module.js +++ /dev/null @@ -1,178 +0,0 @@ -// This file is part of meshoptimizer library and is distributed under the terms of MIT License. -// Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) -var MeshoptDecoder = (function() { - "use strict"; - - // Built with clang version 14.0.4 - // Built from meshoptimizer 0.18 - var wasm_base = "b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb"; - var wasm_simd = "b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb"; - - var detector = new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]); - var wasmpack = new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]); - - if (typeof WebAssembly !== 'object') { - return { - supported: false, - }; - } - - var wasm = WebAssembly.validate(detector) ? wasm_simd : wasm_base; - - var instance; - - var ready = - WebAssembly.instantiate(unpack(wasm), {}) - .then(function(result) { - instance = result.instance; - instance.exports.__wasm_call_ctors(); - }); - - function unpack(data) { - var result = new Uint8Array(data.length); - for (var i = 0; i < data.length; ++i) { - var ch = data.charCodeAt(i); - result[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4; - } - var write = 0; - for (var i = 0; i < data.length; ++i) { - result[write++] = (result[i] < 60) ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i]; - } - return result.buffer.slice(0, write); - } - - function decode(fun, target, count, size, source, filter) { - var sbrk = instance.exports.sbrk; - var count4 = (count + 3) & ~3; - var tp = sbrk(count4 * size); - var sp = sbrk(source.length); - var heap = new Uint8Array(instance.exports.memory.buffer); - heap.set(source, sp); - var res = fun(tp, count, size, sp, source.length); - if (res == 0 && filter) { - filter(tp, count4, size); - } - target.set(heap.subarray(tp, tp + count * size)); - sbrk(tp - sbrk(0)); - if (res != 0) { - throw new Error("Malformed buffer data: " + res); - } - } - - var filters = { - NONE: "", - OCTAHEDRAL: "meshopt_decodeFilterOct", - QUATERNION: "meshopt_decodeFilterQuat", - EXPONENTIAL: "meshopt_decodeFilterExp", - }; - - var decoders = { - ATTRIBUTES: "meshopt_decodeVertexBuffer", - TRIANGLES: "meshopt_decodeIndexBuffer", - INDICES: "meshopt_decodeIndexSequence", - }; - - var workers = []; - var requestId = 0; - - function createWorker(url) { - var worker = { - object: new Worker(url), - pending: 0, - requests: {} - }; - - worker.object.onmessage = function(event) { - var data = event.data; - - worker.pending -= data.count; - worker.requests[data.id][data.action](data.value); - - delete worker.requests[data.id]; - }; - - return worker; - } - - function initWorkers(count) { - var source = - "var instance; var ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(unpack(wasm)) + "]), {})" + - ".then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });" + - "self.onmessage = workerProcess;" + - decode.toString() + workerProcess.toString(); - - var blob = new Blob([source], {type: 'text/javascript'}); - var url = URL.createObjectURL(blob); - - for (var i = 0; i < count; ++i) { - workers[i] = createWorker(url); - } - - URL.revokeObjectURL(url); - } - - function decodeWorker(count, size, source, mode, filter) { - var worker = workers[0]; - - for (var i = 1; i < workers.length; ++i) { - if (workers[i].pending < worker.pending) { - worker = workers[i]; - } - } - - return new Promise(function (resolve, reject) { - var data = new Uint8Array(source); - var id = requestId++; - - worker.pending += count; - worker.requests[id] = { resolve: resolve, reject: reject }; - worker.object.postMessage({ id: id, count: count, size: size, source: data, mode: mode, filter: filter }, [ data.buffer ]); - }); - } - - function workerProcess(event) { - ready.then(function() { - var data = event.data; - try { - var target = new Uint8Array(data.count * data.size); - decode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]); - self.postMessage({ id: data.id, count: data.count, action: "resolve", value: target }, [ target.buffer ]); - } catch (error) { - self.postMessage({ id: data.id, count: data.count, action: "reject", value: error }); - } - }); - } - - return { - ready: ready, - supported: true, - useWorkers: function(count) { - initWorkers(count); - }, - decodeVertexBuffer: function(target, count, size, source, filter) { - decode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]); - }, - decodeIndexBuffer: function(target, count, size, source) { - decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source); - }, - decodeIndexSequence: function(target, count, size, source) { - decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source); - }, - decodeGltfBuffer: function(target, count, size, source, mode, filter) { - decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]); - }, - decodeGltfBufferAsync: function(count, size, source, mode, filter) { - if (workers.length > 0) { - return decodeWorker(count, size, source, decoders[mode], filters[filter]); - } - - return ready.then(function() { - var target = new Uint8Array(count * size); - decode(instance.exports[decoders[mode]], target, count, size, source, instance.exports[filters[filter]]); - return target; - }); - } - }; -})(); - -export { MeshoptDecoder }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/mikktspace.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/mikktspace.module.js deleted file mode 100644 index 0a1baaa..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/mikktspace.module.js +++ /dev/null @@ -1,128 +0,0 @@ -const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder; - -let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true }); - -cachedTextDecoder.decode(); - -let cachegetUint8Memory0 = null; -function getUint8Memory0() { - if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) { - cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachegetUint8Memory0; -} - -function getStringFromWasm0(ptr, len) { - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); -} - -const heap = new Array(32).fill(undefined); - -heap.push(undefined, null, true, false); - -let heap_next = heap.length; - -function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; - - heap[idx] = obj; - return idx; -} - -function getObject(idx) { return heap[idx]; } - -function dropObject(idx) { - if (idx < 36) return; - heap[idx] = heap_next; - heap_next = idx; -} - -function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; -} - -let cachegetFloat32Memory0 = null; -function getFloat32Memory0() { - if (cachegetFloat32Memory0 === null || cachegetFloat32Memory0.buffer !== wasm.memory.buffer) { - cachegetFloat32Memory0 = new Float32Array(wasm.memory.buffer); - } - return cachegetFloat32Memory0; -} - -let WASM_VECTOR_LEN = 0; - -function passArrayF32ToWasm0(arg, malloc) { - const ptr = malloc(arg.length * 4); - getFloat32Memory0().set(arg, ptr / 4); - WASM_VECTOR_LEN = arg.length; - return ptr; -} - -let cachegetInt32Memory0 = null; -function getInt32Memory0() { - if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { - cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer); - } - return cachegetInt32Memory0; -} - -function getArrayF32FromWasm0(ptr, len) { - return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len); -} -/** -* Generates vertex tangents for the given position/normal/texcoord attributes. -* @param {Float32Array} position -* @param {Float32Array} normal -* @param {Float32Array} texcoord -* @returns {Float32Array} -*/ -export function generateTangents(position, normal, texcoord) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - var ptr0 = passArrayF32ToWasm0(position, wasm.__wbindgen_malloc); - var len0 = WASM_VECTOR_LEN; - var ptr1 = passArrayF32ToWasm0(normal, wasm.__wbindgen_malloc); - var len1 = WASM_VECTOR_LEN; - var ptr2 = passArrayF32ToWasm0(texcoord, wasm.__wbindgen_malloc); - var len2 = WASM_VECTOR_LEN; - wasm.generateTangents(retptr, ptr0, len0, ptr1, len1, ptr2, len2); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var v3 = getArrayF32FromWasm0(r0, r1).slice(); - wasm.__wbindgen_free(r0, r1 * 4); - return v3; - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } -} - -export const __wbindgen_string_new = function(arg0, arg1) { - var ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); -}; - -export const __wbindgen_rethrow = function(arg0) { - throw takeObject(arg0); -}; - -// - -const wasmDataURI = 'data:application/octet-stream;base64,AGFzbQEAAAABiQEWYAN/f38AYAJ/fwBgAn9/AX9gAX8AYAN/f38Bf2AEf39/fwBgAX8Bf2AFf39/f38Bf2ABfwF+YAV/f39/fwBgBH9/f38Bf2ACf38BfWAAAGAHf39/f39/fwBgBX9/fX1/AGACfn8Bf2ABfQF/YAN9fX0Bf2ADf39/AX5gAX8BfWAAAXxgAXwBfAJiAhkuL21pa2t0c3BhY2VfbW9kdWxlX2JnLmpzFV9fd2JpbmRnZW5fc3RyaW5nX25ldwACGS4vbWlra3RzcGFjZV9tb2R1bGVfYmcuanMSX193YmluZGdlbl9yZXRocm93AAMDeXgGAwkABQQCFAcCEwkVAgULBwUPAAAFAAAAAAABBQ4ADQABAQUAAAsBAAAABQIFAgUFAwEBAQEAAQUEERIHAAIAAAABAAAEAAMDAQADAAoGBgMDAwMDAwMBAgMBAwMBAQEKAQEEAgIAAQAMAgIGEAECBgIGCAgIAwEEBQFwASEhBQMBABEGCQF/AUGAgMAACwdlBQZtZW1vcnkCABBnZW5lcmF0ZVRhbmdlbnRzACEfX193YmluZGdlbl9hZGRfdG9fc3RhY2tfcG9pbnRlcgBuEV9fd2JpbmRnZW5fbWFsbG9jAFAPX193YmluZGdlbl9mcmVlAGQJJgEAQQELIHg6cXJ4MnN0eHhEYHh1eXhlD0B3Xh0kS2lddnVtbHh3CvXrAXiUUQQqfwN+Cn0BfCMAQeAGayIBJAAgACgCCCIIQQluIRMQCSE4AkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAhBCU8EQCABQbgDaiATQQNsIgpBARA4IAEgCjYCyAMgASABKQO4AzcDwAMgAUHgA2pByAAQWhogAUGYBmogAUHgA2pByAAQTiABQdADaiABQZgGaiATEEUgASgC0AMhDiAB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agsqAgAhMCABQaADaiAKQQEQOCABIAo2AtAFIAEgASkDoAM3A8gFIAFBmANqQYAQQQEQOCABQYAQNgLgBSABIAEpA5gDNwPYBSABQZADakGAEEEBEDggAUGAEDYC8AUgASABKQOQAzcD6AUgAUGIA2pBgBBBARA4IAFBgBA2AoAGIAEgASkDiAM3A/gFIAhBCU8EQCABQZgGakEAQQRBCCAGGyALG2ohByAFIQIgCiEDA0AgAUGAA2ogAigCABBhIAFBmAZqIAAgASgCgAMgASgChAMQMSAwIC4gByoCABA8IQQgAUHoBWooAgAgASgC8AUiESAETQ0WIARBAnRqIgQgBCgCAEEBajYCACACQQRqIQIgA0F/aiIDDQALCyABQdgFaigCACABKALgBUUNFUEAIQJBADYCAEEBIQQDQCABQfgCaiABQdgFahBjIAEoAvwCIgMgBEF/aiIHTQ0UIAEoAvgCIAJqKAIAIQMgAUHwAmogAUHoBWoQYyABKAL0AiINIAdNDRMgASgC8AIgAmooAgAhByABQdgFaigCACENIAEoAuAFIhEgBE0NEiACIA1qQQRqIAMgB2o2AgAgAkEEaiECIARBAWoiBEGAEEcNAAsgCEEJTwRAQQAhBCABQZgGakEAQQRBCCAGGyALG2ohCCAFIQMDQCABQegCaiADKAIAEGEgAUGYBmogACABKALoAiABKALsAhAxIDAgLiAIKgIAEDwhAiABQeACaiABQdgFahBjIAEoAuQCIgYgAk0NEiABQcgFaigCACABKALQBSINIAJBAnQiBiABKALgAmooAgAiC00NESABQdgCaiABQfgFahBjIAEoAtwCIg0gAk0NECALQQJ0aiABKALYAiAGaigCAEECdGogBDYCACABQfgFaigCACELIAEoAoAGIgcgAk0NDyAGIAtqIgIgAigCAEEBajYCACADQQRqIQMgCiAEQQFqIgRHDQALCyABQdACaiABQegFahBjIAEoAtQCRQ0MIAEoAtACKAIAIQNBBCECQQEhBANAIAFByAJqIAFB6AVqEGMgASgCzAIiCiAETQ0MIAMgASgCyAIgAmooAgBJBEAgAUHAAmogAUHoBWoQYyABKALEAiIDIARNDQwgASgCwAIgAmooAgAhAwsgAkEEaiECIARBAWoiBEGAEEcNAAsgAUHgA2oiAkIANwIAIAJBCGpCADcCACABQaAGaiABQegDaikDADcDACABIAEpA+ADNwOYBiABQYgGaiABQZgGaiADEEEgASgCiAYhCiABKAKQBiELQQAhBgNAIAFBuAJqIAFB2AVqEGMgASgCvAIiAyAGTQ0KIAFByAVqKAIAIQIgASgC0AUiBCAGQQJ0IgggASgCuAJqKAIAIgNNDQkgAUGwAmogAUHoBWoQYyABKAK0AiIEIAZNDQggASgCsAIgCGooAgAiCEECTwRAIAIgA0ECdGohBEEAIQMgCiECA0AgAUGoAmogBSAEKAIAIgdBAnRqKAIAEGEgAUGYBmogACABKAKoAiABKAKsAhAxIAMgC0YNCSACIAEoApgGNgIAIAJBBGogASgCnAY2AgAgASgCoAYhDSACQQxqIAc2AgAgAkEIaiANNgIAIARBBGohBCACQRBqIQIgCCADQQFqIgNHDQALIAUgCiAAQQAgCEF/ahAECyAGQQFqIgZBgBBHDQALIBNBASATQQFLGyEFIA5BPGohAyABQYgGahBSIAFB+AVqKAIAGiABQfgFahBWIAFB6AVqKAIAGiABQegFahBWIAFB2AVqKAIAGiABQdgFahBWIAFByAVqKAIAGiABQcgFahBWQQAhAkEAIQRBACEGQQAhBwNAIAFBoAJqIAFBwANqEGMgASgCpAIiCiAETQ0GIAEoAqACIAJqKAIAIQogAUGYAmogAUHAA2oQYyABKAKcAiILIARBAWpNDQUgASgCmAIgAmpBBGooAgAhCyABQZACaiABQcADahBjIAEoApQCIgggBEECak0NBCABKAKQAiACakEIaigCACEIIAFBiAJqIAoQYSABQYgGaiAAIAEoAogCIAEoAowCEDEgAUGAAmogCxBhIAFB4ANqIAAgASgCgAIgASgChAIQMSABQfgBaiAIEGEgAUGYBmogACABKAL4ASABKAL8ARAxAkACQCABQYgGaiABQeADahALDQAgAUGIBmogAUGYBmoQCw0AIAFB4ANqIAFBmAZqEAtFDQELIAwgBk0NBCADIAMoAgBBAXI2AgAgB0EBaiEHCyACQQxqIQIgBEEDaiEEIANByABqIQMgBSAGQQFqIgZHDQALIA4gAUHAA2ooAgAgEyAHayIKIBMQECABQcADaigCACELAkACQCAKRQRAQX8hBgwBC0EAIQYDQCAOIAZByABsaiIDQn83AgAgA0EIakF/NgIAIANBDGpCADcCACADQRRqQQA2AgAgA0E8aiADQRhqIQIgAygCPCEEQQMhAwNAIAJCADcCACACQRhqQgA3AgAgAkEQakIANwIAIAJBCGpCADcCACAEQQRyIQQgA0F/aiIDDQALIAQ2AgAgBkEBaiIGIApHDQALIAFBpAZqIQYgAUHsA2ohDEEAIQUDQCABQfABaiALIAVBDGxqIgMoAgAQYSABQagFaiAAIAEoAvABIAEoAvQBEDEgAUHoAWogA0EEaiICKAIAEGEgAUG4BWogACABKALoASABKALsARAxIAFB4AFqIANBCGoiBCgCABBhIAFByAVqIAAgASgC4AEgASgC5AEQMSABQdgBaiADKAIAEGEgACABKALYASABKALcARA9ISsgAUHQAWogAigCABBhIAAgASgC0AEgASgC1AEQPSEsIAFByAFqIAQoAgAQYSAAIAEoAsgBIAEoAswBED0hLSABQegDaiIDIAFBwAVqKAIANgIAIAEgASkDuAU3A+ADIAFBoAZqIgQgAUGwBWoiAigCADYCACABIAEpA6gFNwOYBiABQdgFaiABQeADaiABQZgGahAVIAMgAUHQBWooAgA2AgAgASABKQPIBTcD4AMgBCACKAIANgIAIAEgASkDqAU3A5gGIAFB6AVqIAFB4ANqIAFBmAZqEBUgAyABQeAFaiIIKAIANgIAIAEgASkD2AU3A+ADIAFBwAFqIAFB4ANqIAwQaCAtQiCIp74gK0IgiKe+IjCTIS4gASgCwAEiAiABKALEASIHRwRAA0AgAiAuIAIqAgCUOAIAIAcgAkEEaiICRw0ACwsgLEIgiKe+IDCTITAgBCABQfAFaiIHKAIANgIAIAEgASkD6AU3A5gGIAFBuAFqIAFBmAZqIAYQaCABKAK4ASICIAEoArwBIg1HBEADQCACIDAgAioCAJQ4AgAgDSACQQRqIgJHDQALCyAtp74gK6e+Ii+TIT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dxIgQ2AjwgAyAOIAVByABsaigCPEEIcSAEcjYCPAsgAkECagsiAiAGSQ0ACwsgAUHgA2oiA0EANgIIIANCADcCACABQaAGaiIDIAFB6ANqIgIoAgA2AgAgASABKQPgAzcDmAYgAUGIBmogAUGYBmogCkEDbCIbEEIgDiABKAKIBiALIAoQBiABQYgGahBVIAFB4ANqIgVCADcCACAFQQVqQgA3AAAgAyACKQMANwMAIAEgASkD4AM3A5gGIAFBqARqIAFBmAZqIBsQQSABQZABaiAbQQEQOCABIBs2AsAEIAEgASkDkAE3A7gEIAEoAtADIgsgASgCqAQiDiABQbgEaigCACABQcADaigCACAKEBIhBiABQeADahBKIAEoAoAEIQMgAS0AhAQhAiABQbAGakKAgICAgICAwD83AwAgASACOgC8BiABIAM2ArgGIAFCgICAgICAgMA/NwOoBiABQoCAgICAgIDAPzcDoAYgAUKAgID8AzcDmAYgAUHIBGogAUGYBmogCRBGIAEoAsgEIRQgASgC0AQhIiABQcADaigCACEcAkAgBkEBSA0AQQAhAiAOIQQgBiEDA0AgBCgCACIFIAIgAiAFSRshAiAEQRBqIQQgA0F/aiIDDQALIAJFDQAgAUHgA2oQSiABQZgGaiABQeADakEoEE4gAUHYBGogAUGYBmogAhBGIAFB4ANqIgNCgICAgMAANwIAIANBCGpCADcCACABQaAGaiIDIAFB6ANqKQMANwMAIAEgASkD4AM3A5gGIAFB6ARqIAFBmAZqIAIQQyABQYgBaiACQQEQOCABIAI2AoAFIAEgASkDiAE3A/gEIAFBlAZqIRkgAUGoBmohFSABQaQGaiEeIAFB4ANqQQRyIREDQAJAIA4gI0EEdGoiDSgCAEEBSA0AIA1BDGohJiANQQhqIScgDUEEaiEkQQAhH0EAIQwCQAJAAkACQANAICQoAgAgH0ECdGooAgAhAiABQgA3A+gDIAFCgICAgMAANwPgAyABQQA2ApAFIAFCADcDiAUgAUEANgKgBSABQgA3A5gFIAFBADYCsAUgAUIANwOoBSABQYABaiAcAn8gDSALIAJByABsaiIIKAIMRgRAQQEhI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AEGEgAUG4BWogACABKAJYIAEoAlwQLyABQYAGaiIWIA9BIGooAgA2AgAgASAPKQIYNwP4BSABQbgFaiAPQRhqEBEhMCAEIAFBwAVqIhgoAgA2AgAgASABKQO4BTcDiAYgAUHQAGogAUGIBmogGRBoIAEoAlAiAiABKAJUIiFHBEADQCACIDAgAioCAJQ4AgAgISACQQRqIgJHDQALCyABQegFaiABQfgFaiABQYgGahAVIAEqAugFITMgASoC7AUhLyABKgLwBSEyIBYgD0EsaigCADYCACABIA8pAiQ3A/gFIAFBuAVqIA9BJGoQESEwIAQgGCgCADYCACABIAEpA7gFNwOIBiABQcgAaiABQYgGaiAZEGggASgCSCICIAEoAkwiIUcEQANAIAIgMCACKgIAlDgCACAhIAJBBGoiAkcNAAsLIAFB6AVqIAFB+AVqIAFBiAZqEBUgASoC6AUhNCABKgLsBSEwIAEqAvAFITEgASAyOAKQBiABIC84AowGIAEgMzgCiAYgAUGIBmoQUQRAIAEgMjgCkAYgASAvOAKMBiABIDM4AogGIAFB+AVqIAFBiAZqECMgASoC+AUhMyABKgKABiEyIAEqAvwFIS8LIAEgMTgCkAYgASAwOAKMBiABIDQ4AogGIAFBiAZqEFEEQCABIDE4ApAGIAEgMDgCjAYgASA0OAKIBiABQfgFaiABQYgGahAjIAEqAvgFITQgASoCgAYhMSABKgL8BSEwCyAcIBBBAWpBACAdGyAXakECdGooAgAhHSAqKAIAIQIgAUFAayAcIBBBf2pBAiASGyAXakECdGooAgAQYSABQYgGaiAAIAEoAkAgASgCRBAxIAEpA4gGISsgASgCkAYhFyABQThqIAIQYSABQYgGaiAAIAEoAjggASgCPBAxIAEoAogGIQIgASgCjAYhECABKAKQBiESIAFBMGogHRBhIAFBiAZqIAAgASgCMCABKAI0EDEgASkDiAYhLCABKAKQBiEdIAEgFzYCgAYgASArNwP4BSABIBI2ApAGIAEgEDYCjAYgASACNgKIBiABQcgFaiABQfgFaiABQYgGahAVIAEgHTYCgAYgASAsNwP4BSABIBI2ApAGIAEgEDYCjAYgASACNgKIBiABQdgFaiABQfgFaiABQYgGahAVIBYgAUHQBWoiECgCADYCACABIAEpA8gFNwP4BSABQbgFaiABQcgFahARITUgBCAYKAIANgIAIAEgASkDuAU3A4gGIAFBKGogAUGIBmogGRBoIAEoAigiAiABKAIsIhJHBEADQCACIDUgAioCAJQ4AgAgEiACQQRqIgJHDQALCyABQcgFaiABQfgFaiABQYgGahAVIAQgECgCADYCACABIAEpA8gFNwOIBiABQYgGahBRBEAgBCAQKAIANgIAIAEgASkDyAU3A4gGIAFByAVqIAFBiAZqECMLIBYgAUHgBWoiECgCADYCACABIAEpA9gFNwP4BSABQbgFaiABQdgFahARITUgBCAYKAIANgIAIAEgASkDuAU3A4gGIAFBIGogAUGIBmogGRBoIAEoAiAiAiABKAIkIhJHBEADQCACIDUgAioCAJQ4AgAgEiACQQRqIgJHDQALCyABQdgFaiABQfgFaiABQYgGahAVIAQgECgCADYCACABIAEpA9gFNwOIBiABQYgGahBRBEAgBCAQKAIANgIAIAEgASkD2AU3A4gGIAFB2AVqIAFBiAZqECMLQwAAgD8gAUHIBWogAUHYBWoQESI1QwAAgL+XIDVDAACAP14buxAOIA8qAjQhNSAPKgIwITcgFiADKAIANgIAIAEgASkDmAY3A/gFIAEgMjgCkAYgASAvOAKMBiABIDM4AogGIAFBGGogAUGIBmogGRBotiEvIAEoAhgiAiABKAIcIg9HBEADQCACIAIqAgAgL5Q4AgAgDyACQQRqIgJHDQALCyABQZgGaiABQfgFaiABQYgGahAWIBYgFUEIaiIPKAIANgIAIAEgFSkCADcD+AUgASAxOAKQBiABIDA4AowGIAEgNDgCiAYgAUEQaiABQYgGaiAZEGggASgCECICIAEoAhQiEEcEQANAIAIgAioCACAvlDgCACAQIAJBBGoiAkcNAAsLIAFB6AVqIAFB+AVqIAFBiAZqEBYgDyABQfAFaigCADYCACAVIAEpA+gFNwIAIAEgNyAvlCABKgKkBpI4AqQGIAEgNSAvlCABKgK0BpI4ArQGIC4gL5IhLgsgCSAHQQFq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2pBxABqLQAAakEobGpBKBA7GgsgBkEBaiIGQQNHDQALCyADICVGIANBAWohA0UNAAsLIApBAU4EQCALQcQAaiEEQQAhBQNAAkAgCyAFQcgAbGoiAy0APEECcUUNACABQQA2AugDIAFCADcD4AMgAUEIaiADKAI4IgYCf0EBQQEgA0HFAGotAABBH3F0QQEgAy0AREEfcXRyQQEgA0HGAGotAABBH3F0ciICQQJxRQ0AGkECIAJBBHFFDQAaQQBBAyACQQhxGwsiDhBmEGEgAUGYBmogACABKAIIIAEoAgwQMSABQegDaiABQaAGaigCADYCACABIAEpA5gGNwPgAyADQUBrIQNBACECA0AgASAGIAIgBGotAAAiCRBmEGEgAUGYBmogACABKAIAIAEoAgQQMSABQZgGaiABQeADahALBEAgFCADKAIAIgMgDmpBKGxqIBQgAyAJakEobGpBKBA7GgwCCyACQQFqIgJBA0cNAAsLIARByABqIQQgBUEBaiIFIApHDQALCyABKALQBCEFQQAhBkEAIQkDQEEAIAUgCWsiAyADIAVLGyEKIBQgCUEobGohDkEAIQNBACEEA0AgBCAKRg0DIAMgDmoiAikCACErIAEgAkEIaigCADYC6AMgASArNwLgAyAAIAFB4ANqIAJBDGoqAgAgAkEcaioCACACQSRqLQAAEB8gBEEBaiEEIANBKGoiA0H4AEcNAAsgBCAJaiEJIAZBAWoiBiATRw0ACyABQcgEahBUIAFBuARqKAIAGiABQbgEahBWIAFBqARqEFIgAUHQA2oQUyABQcADaigCABogAUHAA2oQVkEBIQILIAFB4AZqJAAgAg8LIAQgCWogBUHMgsAAED8ACyAGIAxBvILAABA/AAsgBEECaiAIQayCwAAQPwALIARBAWogC0GcgsAAED8ACyAEIApBjILAABA/AAsgCyALQdyFwAAQPwALIAYgBEHMhcAAED8ACyADIARBvIXAABA/AAsgBiADQayFwAAQPwALIAQgA0GchcAAED8ACyAEIApBjIXAABA/AAtBAEEAQfyEwAAQPwALIAIgB0HshMAAED8ACyACIA1B3ITAABA/AAsgCyANQcyEwAAQPwALIAIgBkG8hMAAED8AC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ogAiABIANBIGoQLSADQRhqKAIAIQEgAygCFCECIAMoAhBBAUYNASAAIAI2AgAgACABQShuNgIECyADQTBqJAAPCyADQQhqIAIgARBoIAMoAgghASADKAIMDAELIAMgAkEAEGggAygCACEBIAMoAgQLIgAEQCABIAAQcAALEGsAC6cCAgN/AX4jAEEwayIDJAACfwJAAkAgACgCBCIEIAFrIAJJBEAgASACaiICIAFJDQJBBCEBAkAgBEEBdCIFIAIgBSACSxsiAkEEIAJBBEsbrUIMfiIGQiCIp0UEQCAGpyECDAELIAAoAgQhBEEAIQELAkAgBARAIAAoAgAhBSADQShqQQQ2AgAgAyAEQQxsNgIkIAMgBTYCIAwBCyADQQA2AiALIANBEGogAiABIANBIGoQLSADQRhqKAIAIQEgAygCFCECIAMoAhBBAUYNASAAIAI2AgAgACABQQxuNgIECyADQTBqJAAPCyADQQhqIAIgARBoIAMoAgghASADKAIMDAELIAMgAkEAEGggAygCACEBIAMoAgQLIgAEQCABIAAQcAALEGsAC6gCAQN/IwBBMGsiAyQAAn8CQAJAIAAoAgQiBCABayACSQRAIAEgAmoiAiABSQ0CQQQhAQJAIARBAXQiBSACIAUgAksbIgJBBCACQQRLGyICQf////8DcSACRgRAIAJBAnQhAgwBCyAAKAIEIQRBACEBCwJAIAQEQCAAKAIAIQUgA0EoakEENgIAIAMgBEECdDYCJCADIAU2AiAMAQsgA0EANgIgCyADQRBqIAIgASADQSBqEC0gA0EYaigCACEBIAMoAhQhAiADKAIQQQFGDQEgACACNgIAIAAgAUECdjYCBAsgA0EwaiQADwsgA0EIaiACIAEQaCADKAIIIQEgAygCDAwBCyADIAJBABBoIAMoAgAhASADKAIECyIABEAgASAAEHAACxBrAAuoAgEDfyMAQTBrIgMkAAJ/AkACQCAAKAIEIgQgAWsgAkkEQCABIAJqIgIgAUkNAkEEIQECQCAEQQF0IgUgAiAFIAJLGyICQQQgAkEESxsiAkH/////AHEgAkYEQCACQQR0IQIMAQsgACgCBCEEQQAhAQsCQCAEBEAgACgCACEF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4iA0IgiKcNACADpyIBQX9MDQACQCABBEAgAUEEEGciAg0BIAFBBBBwAAtBBCECCyAAIAI2AgAgACABQcgAbjYCBA8LEGsAC1MBAX8CQCABIAFB/////wBxRw0AIAFBBHQiAUF/TA0AAkAgAQRAIAFBBBBnIgINASABQQQQcAALQQQhAgsgACACNgIAIAAgAUEEdjYCBA8LEGsAC4MBAQF/AkAgASABQf////8DcUcNACABQQJ0IgFBf0wNAAJAAkACQAJAIAIEQCABDQEMAwsgAUUNAiABQQQQZyICDQMMAQsgASICQQQQLiIDBEAgAyACEFoaCyADIgINAgsgAUEEEHAAC0EEIQILIAAgAjYCACAAIAFBAnY2AgQPCxBrAAt0AgJ/AX4jAEEQayICJAAgAkEIaiABEGMgAigCCCEDIAIgAigCDCIBQQAQOCACKQMAIQQgAEEANgIIIAAgBDcCACAAQQAgARAbIAAoAgAgACgCCEECdGogAyABQQJ0EE4gACABIAAoAghqNgIIIAJBEGokAAtxAAJ/IAJBAnQiASADQQN0QYCAAWoiAiABIAJLG0GHgARqIgFBEHZAACICQX9GBEBBACEDQQEMAQsgAkEQdCIDQgA3AwAgA0EANgIIIAMgAyABQYCAfHFqQQJyNgIAQQALIQIgACADNgIEIAAgAjYCAAtvAQF/AkAgASAATwRAIAJFDQEgACEDA0AgAyABLQAAOgAAIAFBAWohASADQQFqIQMgAkF/aiICDQALDAELIAJFDQAgAUF/aiEBIABBf2ohAwNAIAIgA2ogASACai0AADoAACACQX9qIgINAAsLIAALbwECfwJ/IAIgAJMgASAAk5VDAAAARZQiAEMAAADPYCIDQQFzIABD////Tl9FckUEQCAAqAwBC0H/////B0GAgICAeCADGyIEIARBACAAQ////05fGyADGwsiA0EAIANBAEobIgNB/w8gA0H/D0gbC2YBAX8CQCAAQSBqKAIAIgMgAUEGbCACQQF0aiIBSwRAIAMgAUEBciICTQ0BIAAoAhgiACACQQJ0ajUCAEIghiAAIAFBAnRqNQIAhA8LIAEgA0HsgMAAED8ACyACIANB/IDAABA/AAtrAQJ/IwBBEGsiBiQAAkAgACABIAIgAyAEEAoiBQ0AIAZBCGogAyAAIAEgBCgCDBEFAEEAIQUgBigCCA0AIAYoAgwiBSACKAIANgIIIAIgBTYCACAAIAEgAiADIAQQCiEFCyAGQRBqJAAgBQtsAQF/IwBBMGsiAyQAIAMgATYCBCADIAA2AgAgA0EcakECNgIAIANBLGpBHTYCACADQgI3AgwgA0G0kMAANgIIIANBHTYCJCADIANBIGo2AhggAyADNgIoIAMgA0EEajYCICADQQhqIAIQWQALVAEBfyMAQSBrIgIkACACIAAoAgA2AgQgAkEYaiABQRBqKQIANwMAIAJBEGogAUEIaikCADcDACACIAEpAgA3AwggAkEEaiACQQhqEAggAkEgaiQAC1kCAX8BfiMAQSBrIgMkACADQQhqIAIQNyADKQMIIQQgAEEANgIIIAAgBDcCACADQRhqIAFBCGopAgA3AwAgAyABKQIANwMQIAAgAiADQRBqECcgA0EgaiQAC1kCAX8BfiMAQSBrIgMkACADQQhqIAIQNCADKQMIIQQgAEEANgIIIAAgBDcCACADQRhqIAFBCGooAgA2AgAgAyABKQIANwMQIAAgAiADQRBqECYgA0EgaiQAC1kCAX8BfiMAQSBrIgMkACADQQhqIAIQNyADKQMIIQQgAEEANgIIIAAgBDcCACADQRhqIAFBCGopAgA3AwAgAyABKQIANwMQIAAgAiADQRBqECAgA0EgaiQAC1QBAn8gASgCACECIAFBADYCAAJAIAIEQCABKAIEIQNBCEEEEGciAUUNASABIAM2AgQgASACNgIAIABByI3AADYCBCAAIAE2AgAPCwALQQhBBBBwAAtKAgF/AX4jAEHQAGsiAyQAIAMgAhA2IAMpAwAhBCAAQQA2AgggACAENwIAIANBCGogAUHIABBOIAAgAiADQQhqECsgA0HQAGokAAtHAgF/AX4jAEEwayIDJAAgAyACEDUgAykDACEEIABBADYCCCAAIAQ3AgAgA0EIaiABQSgQTiAAIAIgA0EIahAsIANBMGokAAtKAAJ/IAFBgIDEAEcEQEEBIAAoAhggASAAQRxqKAIAKAIQEQIADQEaCyACR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IgEkACABQQhqIABBCGooAgA2AgAgASAAKQIANwMAIAEQWwALLAEBfyMAQRBrIgEkACABQQhqIABBCGooAgA2AgAgASAAKQIANwMAIAEQMwALNAEBfyMAQRBrIgIkACACIAE2AgwgAiAANgIIIAJB8I/AADYCBCACQfCPwAA2AgAgAhBNAAspAQF/IAEEQCAAIQIDQCACQQA6AAAgAkEBaiECIAFBf2oiAQ0ACwsgAAsrAQF/IwBBEGsiASQAIAEgACkCADcDCCABQQhqQbSNwABBACAAKAIIECUACycBAX8jAEEQayICJAAgAiABNgIIIAJBHTYCBCACIAA2AgAgAhBXAAsmAQF/AkAgACgCACIBRQ0AIABBBGooAgAiAEUNACABIABBARBqCwsmAQF/AkAgACgCBCIBRQ0AIABBCGooAgAiAEUNACABIABBARBqCwshACAAQQM2AgwgACABNgIEIAAgATYCACAAIAFBDGo2AggLHQAgASgCAEUEQAALIABByI3AADYCBCAAIAE2AgALFgAgACABQQNxNgIEIAAgAUECdjYCAAsMACAAIAEgAiADEE8LFgAgACABKAIINgIEIAAgASgCADYCAAsPACABBEAgACABQQQQagsLEgAgACgCACABIAEgAmoQIkEACw0AIAFBA3EgAEECdHILCAAgACABEC4LEAAgACACNgIEIAAgATYCAAsTACAAQaCPwAA2AgQgACABNgIACwoAIAAgASACECoLEQBBzI/AAEERQeCPwAAQSAALDgAgACgCABoDQAwACwALCwAgADUCACABEBQLCwAgACMAaiQAIwALCwAgAItDAACAAF4LGQAgACABQcSdwAAoAgAiAEEPIAAbEQEAAAsFAEGABAsEAEEBCwQAIAELBABBAAsNAEL0+Z7m7qOq+f4ACw0AQve47vqqzNXu5QALDABC6dCi28yi6rtGCwMAAQsDAAELC6QVAgBBgIDAAAvBCnNyYy9saWIucnMAAAAAEAAKAAAANgAAAA0AAAAAABAACgAAADcAAAANAAAAAAAQAAoAAAA4AAAADQAAAAAAEAAKAAAAPgAAAA0AAAAAABAACgAAAD8AAAANAAAAAAAQAAoAAABAAAAADQAAAAAAEAAKAAAARgAAAA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5mPwAt6l8Auid1AOXrxwA9e/EA9zkHAJJSigD7a+oAH7FfAAhdjQAwA1YAe/xGAPCrawAgvM8ANvSaAOOpHQBeYZEACBvmAIWZZQCgFF8AjUBoAIDY/wAnc00ABgYxAMpWFQDJqHMAe+JgAGuMwAAAAABA+yH5PwAAAAAtRHQ+AAAAgJhG+DwAAABgUcx4OwAAAICDG/A5AAAAQCAlejgAAACAIoLjNgAAAAAd82k1AHsJcHJvZHVjZXJzAghsYW5ndWFnZQEEUnVzdAAMcHJvY2Vzc2VkLWJ5AwVydXN0Yx0xLjQ5LjAgKGUxODg0YThlMyAyMDIwLTEyLTI5KQZ3YWxydXMGMC4xOC4wDHdhc20tYmluZGdlbhIwLjIuNzMgKDNjZWZlMmM4Mik='; - -export let wasm; - -export let isReady = false; - -export const ready = fetch(wasmDataURI) - .then((res) => res.arrayBuffer()) - .then((buffer) => WebAssembly.instantiate(buffer, { - './mikktspace_module_bg.js': {__wbindgen_string_new, __wbindgen_rethrow} - })) - .then((result) => { - wasm = result.instance.exports; - isReady = true; - }); diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ConvexObjectBreaker.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ConvexObjectBreaker.js deleted file mode 100644 index b74df73..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ConvexObjectBreaker.js +++ /dev/null @@ -1,519 +0,0 @@ -import { - Line3, - Mesh, - Plane, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import { ConvexGeometry } from '../geometries/ConvexGeometry.js'; - -/** - * @fileoverview This class can be used to subdivide a convex Geometry object into pieces. - * - * Usage: - * - * Use the function prepareBreakableObject to prepare a Mesh object to be broken. - * - * Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane) - * - * Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them. - * - * Requisites for the object: - * - * - Mesh object must have a buffer geometry and a material - * - * - Vertex normals must be planar (not smoothed) - * - * - The geometry must be convex (this is not checked in the library). You can create convex - * geometries with ConvexGeometry. The BoxGeometry, SphereGeometry and other convex primitives - * can also be used. - * - * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function) - * Use with caution and read the code when using with other libs. - * - * @param {double} minSizeForBreak Min size a debris can have to break. - * @param {double} smallDelta Max distance to consider that a point belongs to a plane. - * -*/ - -const _v1 = new Vector3(); - -class ConvexObjectBreaker { - - constructor( minSizeForBreak = 1.4, smallDelta = 0.0001 ) { - - this.minSizeForBreak = minSizeForBreak; - this.smallDelta = smallDelta; - - this.tempLine1 = new Line3(); - this.tempPlane1 = new Plane(); - this.tempPlane2 = new Plane(); - this.tempPlane_Cut = new Plane(); - this.tempCM1 = new Vector3(); - this.tempCM2 = new Vector3(); - this.tempVector3 = new Vector3(); - this.tempVector3_2 = new Vector3(); - this.tempVector3_3 = new Vector3(); - this.tempVector3_P0 = new Vector3(); - this.tempVector3_P1 = new Vector3(); - this.tempVector3_P2 = new Vector3(); - this.tempVector3_N0 = new Vector3(); - this.tempVector3_N1 = new Vector3(); - this.tempVector3_AB = new Vector3(); - this.tempVector3_CB = new Vector3(); - this.tempResultObjects = { object1: null, object2: null }; - - this.segments = []; - const n = 30 * 30; - for ( let i = 0; i < n; i ++ ) this.segments[ i ] = false; - - } - - prepareBreakableObject( object, mass, velocity, angularVelocity, breakable ) { - - // object is a Object3d (normally a Mesh), must have a buffer geometry, and it must be convex. - // Its material property is propagated to its children (sub-pieces) - // mass must be > 0 - - const userData = object.userData; - userData.mass = mass; - userData.velocity = velocity.clone(); - userData.angularVelocity = angularVelocity.clone(); - userData.breakable = breakable; - - } - - /* - * @param {int} maxRadialIterations Iterations for radial cuts. - * @param {int} maxRandomIterations Max random iterations for not-radial cuts - * - * Returns the array of pieces - */ - subdivideByImpact( object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations ) { - - const debris = []; - - const tempPlane1 = this.tempPlane1; - const tempPlane2 = this.tempPlane2; - - this.tempVector3.addVectors( pointOfImpact, normal ); - tempPlane1.setFromCoplanarPoints( pointOfImpact, object.position, this.tempVector3 ); - - const maxTotalIterations = maxRandomIterations + maxRadialIterations; - - const scope = this; - - function subdivideRadial( subObject, startAngle, endAngle, numIterations ) { - - if ( Math.random() < numIterations * 0.05 || numIterations > maxTotalIterations ) { - - debris.push( subObject ); - - return; - - } - - let angle = Math.PI; - - if ( numIterations === 0 ) { - - tempPlane2.normal.copy( tempPlane1.normal ); - tempPlane2.constant = tempPlane1.constant; - - } else { - - if ( numIterations <= maxRadialIterations ) { - - angle = ( endAngle - startAngle ) * ( 0.2 + 0.6 * Math.random() ) + startAngle; - - // Rotate tempPlane2 at impact point around normal axis and the angle - scope.tempVector3_2.copy( object.position ).sub( pointOfImpact ).applyAxisAngle( normal, angle ).add( pointOfImpact ); - tempPlane2.setFromCoplanarPoints( pointOfImpact, scope.tempVector3, scope.tempVector3_2 ); - - } else { - - angle = ( ( 0.5 * ( numIterations & 1 ) ) + 0.2 * ( 2 - Math.random() ) ) * Math.PI; - - // Rotate tempPlane2 at object position around normal axis and the angle - scope.tempVector3_2.copy( pointOfImpact ).sub( subObject.position ).applyAxisAngle( normal, angle ).add( subObject.position ); - scope.tempVector3_3.copy( normal ).add( subObject.position ); - tempPlane2.setFromCoplanarPoints( subObject.position, scope.tempVector3_3, scope.tempVector3_2 ); - - } - - } - - // Perform the cut - scope.cutByPlane( subObject, tempPlane2, scope.tempResultObjects ); - - const obj1 = scope.tempResultObjects.object1; - const obj2 = scope.tempResultObjects.object2; - - if ( obj1 ) { - - subdivideRadial( obj1, startAngle, angle, numIterations + 1 ); - - } - - if ( obj2 ) { - - subdivideRadial( obj2, angle, endAngle, numIterations + 1 ); - - } - - } - - subdivideRadial( object, 0, 2 * Math.PI, 0 ); - - return debris; - - } - - cutByPlane( object, plane, output ) { - - // Returns breakable objects in output.object1 and output.object2 members, the resulting 2 pieces of the cut. - // object2 can be null if the plane doesn't cut the object. - // object1 can be null only in case of internal error - // Returned value is number of pieces, 0 for error. - - const geometry = object.geometry; - const coords = geometry.attributes.position.array; - const normals = geometry.attributes.normal.array; - - const numPoints = coords.length / 3; - let numFaces = numPoints / 3; - - let indices = geometry.getIndex(); - - if ( indices ) { - - indices = indices.array; - numFaces = indices.length / 3; - - } - - function getVertexIndex( faceIdx, vert ) { - - // vert = 0, 1 or 2. - - const idx = faceIdx * 3 + vert; - - return indices ? indices[ idx ] : idx; - - } - - const points1 = []; - const points2 = []; - - const delta = this.smallDelta; - - // Reset segments mark - const numPointPairs = numPoints * numPoints; - for ( let i = 0; i < numPointPairs; i ++ ) this.segments[ i ] = false; - - const p0 = this.tempVector3_P0; - const p1 = this.tempVector3_P1; - const n0 = this.tempVector3_N0; - const n1 = this.tempVector3_N1; - - // Iterate through the faces to mark edges shared by coplanar faces - for ( let i = 0; i < numFaces - 1; i ++ ) { - - const a1 = getVertexIndex( i, 0 ); - const b1 = getVertexIndex( i, 1 ); - const c1 = getVertexIndex( i, 2 ); - - // Assuming all 3 vertices have the same normal - n0.set( normals[ a1 ], normals[ a1 ] + 1, normals[ a1 ] + 2 ); - - for ( let j = i + 1; j < numFaces; j ++ ) { - - const a2 = getVertexIndex( j, 0 ); - const b2 = getVertexIndex( j, 1 ); - const c2 = getVertexIndex( j, 2 ); - - // Assuming all 3 vertices have the same normal - n1.set( normals[ a2 ], normals[ a2 ] + 1, normals[ a2 ] + 2 ); - - const coplanar = 1 - n0.dot( n1 ) < delta; - - if ( coplanar ) { - - if ( a1 === a2 || a1 === b2 || a1 === c2 ) { - - if ( b1 === a2 || b1 === b2 || b1 === c2 ) { - - this.segments[ a1 * numPoints + b1 ] = true; - this.segments[ b1 * numPoints + a1 ] = true; - - } else { - - this.segments[ c1 * numPoints + a1 ] = true; - this.segments[ a1 * numPoints + c1 ] = true; - - } - - } else if ( b1 === a2 || b1 === b2 || b1 === c2 ) { - - this.segments[ c1 * numPoints + b1 ] = true; - this.segments[ b1 * numPoints + c1 ] = true; - - } - - } - - } - - } - - // Transform the plane to object local space - const localPlane = this.tempPlane_Cut; - object.updateMatrix(); - ConvexObjectBreaker.transformPlaneToLocalSpace( plane, object.matrix, localPlane ); - - // Iterate through the faces adding points to both pieces - for ( let i = 0; i < numFaces; i ++ ) { - - const va = getVertexIndex( i, 0 ); - const vb = getVertexIndex( i, 1 ); - const vc = getVertexIndex( i, 2 ); - - for ( let segment = 0; segment < 3; segment ++ ) { - - const i0 = segment === 0 ? va : ( segment === 1 ? vb : vc ); - const i1 = segment === 0 ? vb : ( segment === 1 ? vc : va ); - - const segmentState = this.segments[ i0 * numPoints + i1 ]; - - if ( segmentState ) continue; // The segment already has been processed in another face - - // Mark segment as processed (also inverted segment) - this.segments[ i0 * numPoints + i1 ] = true; - this.segments[ i1 * numPoints + i0 ] = true; - - p0.set( coords[ 3 * i0 ], coords[ 3 * i0 + 1 ], coords[ 3 * i0 + 2 ] ); - p1.set( coords[ 3 * i1 ], coords[ 3 * i1 + 1 ], coords[ 3 * i1 + 2 ] ); - - // mark: 1 for negative side, 2 for positive side, 3 for coplanar point - let mark0 = 0; - - let d = localPlane.distanceToPoint( p0 ); - - if ( d > delta ) { - - mark0 = 2; - points2.push( p0.clone() ); - - } else if ( d < - delta ) { - - mark0 = 1; - points1.push( p0.clone() ); - - } else { - - mark0 = 3; - points1.push( p0.clone() ); - points2.push( p0.clone() ); - - } - - // mark: 1 for negative side, 2 for positive side, 3 for coplanar point - let mark1 = 0; - - d = localPlane.distanceToPoint( p1 ); - - if ( d > delta ) { - - mark1 = 2; - points2.push( p1.clone() ); - - } else if ( d < - delta ) { - - mark1 = 1; - points1.push( p1.clone() ); - - } else { - - mark1 = 3; - points1.push( p1.clone() ); - points2.push( p1.clone() ); - - } - - if ( ( mark0 === 1 && mark1 === 2 ) || ( mark0 === 2 && mark1 === 1 ) ) { - - // Intersection of segment with the plane - - this.tempLine1.start.copy( p0 ); - this.tempLine1.end.copy( p1 ); - - let intersection = new Vector3(); - intersection = localPlane.intersectLine( this.tempLine1, intersection ); - - if ( intersection === null ) { - - // Shouldn't happen - console.error( 'Internal error: segment does not intersect plane.' ); - output.segmentedObject1 = null; - output.segmentedObject2 = null; - return 0; - - } - - points1.push( intersection ); - points2.push( intersection.clone() ); - - } - - } - - } - - // Calculate debris mass (very fast and imprecise): - const newMass = object.userData.mass * 0.5; - - // Calculate debris Center of Mass (again fast and imprecise) - this.tempCM1.set( 0, 0, 0 ); - let radius1 = 0; - const numPoints1 = points1.length; - - if ( numPoints1 > 0 ) { - - for ( let i = 0; i < numPoints1; i ++ ) this.tempCM1.add( points1[ i ] ); - - this.tempCM1.divideScalar( numPoints1 ); - for ( let i = 0; i < numPoints1; i ++ ) { - - const p = points1[ i ]; - p.sub( this.tempCM1 ); - radius1 = Math.max( radius1, p.x, p.y, p.z ); - - } - - this.tempCM1.add( object.position ); - - } - - this.tempCM2.set( 0, 0, 0 ); - let radius2 = 0; - const numPoints2 = points2.length; - if ( numPoints2 > 0 ) { - - for ( let i = 0; i < numPoints2; i ++ ) this.tempCM2.add( points2[ i ] ); - - this.tempCM2.divideScalar( numPoints2 ); - for ( let i = 0; i < numPoints2; i ++ ) { - - const p = points2[ i ]; - p.sub( this.tempCM2 ); - radius2 = Math.max( radius2, p.x, p.y, p.z ); - - } - - this.tempCM2.add( object.position ); - - } - - let object1 = null; - let object2 = null; - - let numObjects = 0; - - if ( numPoints1 > 4 ) { - - object1 = new Mesh( new ConvexGeometry( points1 ), object.material ); - object1.position.copy( this.tempCM1 ); - object1.quaternion.copy( object.quaternion ); - - this.prepareBreakableObject( object1, newMass, object.userData.velocity, object.userData.angularVelocity, 2 * radius1 > this.minSizeForBreak ); - - numObjects ++; - - } - - if ( numPoints2 > 4 ) { - - object2 = new Mesh( new ConvexGeometry( points2 ), object.material ); - object2.position.copy( this.tempCM2 ); - object2.quaternion.copy( object.quaternion ); - - this.prepareBreakableObject( object2, newMass, object.userData.velocity, object.userData.angularVelocity, 2 * radius2 > this.minSizeForBreak ); - - numObjects ++; - - } - - output.object1 = object1; - output.object2 = object2; - - return numObjects; - - } - - static transformFreeVector( v, m ) { - - // input: - // vector interpreted as a free vector - // THREE.Matrix4 orthogonal matrix (matrix without scale) - - const x = v.x, y = v.y, z = v.z; - const e = m.elements; - - v.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z; - v.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z; - v.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z; - - return v; - - } - - static transformFreeVectorInverse( v, m ) { - - // input: - // vector interpreted as a free vector - // THREE.Matrix4 orthogonal matrix (matrix without scale) - - const x = v.x, y = v.y, z = v.z; - const e = m.elements; - - v.x = e[ 0 ] * x + e[ 1 ] * y + e[ 2 ] * z; - v.y = e[ 4 ] * x + e[ 5 ] * y + e[ 6 ] * z; - v.z = e[ 8 ] * x + e[ 9 ] * y + e[ 10 ] * z; - - return v; - - } - - static transformTiedVectorInverse( v, m ) { - - // input: - // vector interpreted as a tied (ordinary) vector - // THREE.Matrix4 orthogonal matrix (matrix without scale) - - const x = v.x, y = v.y, z = v.z; - const e = m.elements; - - v.x = e[ 0 ] * x + e[ 1 ] * y + e[ 2 ] * z - e[ 12 ]; - v.y = e[ 4 ] * x + e[ 5 ] * y + e[ 6 ] * z - e[ 13 ]; - v.z = e[ 8 ] * x + e[ 9 ] * y + e[ 10 ] * z - e[ 14 ]; - - return v; - - } - - static transformPlaneToLocalSpace( plane, m, resultPlane ) { - - resultPlane.normal.copy( plane.normal ); - resultPlane.constant = plane.constant; - - const referencePoint = ConvexObjectBreaker.transformTiedVectorInverse( plane.coplanarPoint( _v1 ), m ); - - ConvexObjectBreaker.transformFreeVectorInverse( resultPlane.normal, m ); - - // recalculate constant (like in setFromNormalAndCoplanarPoint) - resultPlane.constant = - referencePoint.dot( resultPlane.normal ); - - } - -} - -export { ConvexObjectBreaker }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/GPUComputationRenderer.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/GPUComputationRenderer.js deleted file mode 100644 index 24480ff..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/GPUComputationRenderer.js +++ /dev/null @@ -1,430 +0,0 @@ -import { - ClampToEdgeWrapping, - DataTexture, - FloatType, - NearestFilter, - RGBAFormat, - ShaderMaterial, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; - -import { FullScreenQuad } from '../postprocessing/Pass.js'; - -/** - * GPUComputationRenderer, based on SimulationRenderer by zz85 - * - * The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats - * for each compute element (texel) - * - * Each variable has a fragment shader that defines the computation made to obtain the variable in question. - * You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader - * (the sampler uniforms are added automatically) Most of the variables will need themselves as dependency. - * - * The renderer has actually two render targets per variable, to make ping-pong. Textures from the current frame are used - * as inputs to render the textures of the next frame. - * - * The render targets of the variables can be used as input textures for your visualization shaders. - * - * Variable names should be valid identifiers and should not collide with THREE GLSL used identifiers. - * a common approach could be to use 'texture' prefixing the variable name; i.e texturePosition, textureVelocity... - * - * The size of the computation (sizeX * sizeY) is defined as 'resolution' automatically in the shader. For example: - * #DEFINE resolution vec2( 1024.0, 1024.0 ) - * - * ------------- - * - * Basic use: - * - * // Initialization... - * - * // Create computation renderer - * const gpuCompute = new GPUComputationRenderer( 1024, 1024, renderer ); - * - * // Create initial state float textures - * const pos0 = gpuCompute.createTexture(); - * const vel0 = gpuCompute.createTexture(); - * // and fill in here the texture data... - * - * // Add texture variables - * const velVar = gpuCompute.addVariable( "textureVelocity", fragmentShaderVel, vel0 ); - * const posVar = gpuCompute.addVariable( "texturePosition", fragmentShaderPos, pos0 ); - * - * // Add variable dependencies - * gpuCompute.setVariableDependencies( velVar, [ velVar, posVar ] ); - * gpuCompute.setVariableDependencies( posVar, [ velVar, posVar ] ); - * - * // Add custom uniforms - * velVar.material.uniforms.time = { value: 0.0 }; - * - * // Check for completeness - * const error = gpuCompute.init(); - * if ( error !== null ) { - * console.error( error ); - * } - * - * - * // In each frame... - * - * // Compute! - * gpuCompute.compute(); - * - * // Update texture uniforms in your visualization materials with the gpu renderer output - * myMaterial.uniforms.myTexture.value = gpuCompute.getCurrentRenderTarget( posVar ).texture; - * - * // Do your rendering - * renderer.render( myScene, myCamera ); - * - * ------------- - * - * Also, you can use utility functions to create ShaderMaterial and perform computations (rendering between textures) - * Note that the shaders can have multiple input textures. - * - * const myFilter1 = gpuCompute.createShaderMaterial( myFilterFragmentShader1, { theTexture: { value: null } } ); - * const myFilter2 = gpuCompute.createShaderMaterial( myFilterFragmentShader2, { theTexture: { value: null } } ); - * - * const inputTexture = gpuCompute.createTexture(); - * - * // Fill in here inputTexture... - * - * myFilter1.uniforms.theTexture.value = inputTexture; - * - * const myRenderTarget = gpuCompute.createRenderTarget(); - * myFilter2.uniforms.theTexture.value = myRenderTarget.texture; - * - * const outputRenderTarget = gpuCompute.createRenderTarget(); - * - * // Now use the output texture where you want: - * myMaterial.uniforms.map.value = outputRenderTarget.texture; - * - * // And compute each frame, before rendering to screen: - * gpuCompute.doRenderTarget( myFilter1, myRenderTarget ); - * gpuCompute.doRenderTarget( myFilter2, outputRenderTarget ); - * - * - * - * @param {int} sizeX Computation problem size is always 2d: sizeX * sizeY elements. - * @param {int} sizeY Computation problem size is always 2d: sizeX * sizeY elements. - * @param {WebGLRenderer} renderer The renderer - */ - -class GPUComputationRenderer { - - constructor( sizeX, sizeY, renderer ) { - - this.variables = []; - - this.currentTextureIndex = 0; - - let dataType = FloatType; - - const passThruUniforms = { - passThruTexture: { value: null } - }; - - const passThruShader = createShaderMaterial( getPassThroughFragmentShader(), passThruUniforms ); - - const quad = new FullScreenQuad( passThruShader ); - - this.setDataType = function ( type ) { - - dataType = type; - return this; - - }; - - this.addVariable = function ( variableName, computeFragmentShader, initialValueTexture ) { - - const material = this.createShaderMaterial( computeFragmentShader ); - - const variable = { - name: variableName, - initialValueTexture: initialValueTexture, - material: material, - dependencies: null, - renderTargets: [], - wrapS: null, - wrapT: null, - minFilter: NearestFilter, - magFilter: NearestFilter - }; - - this.variables.push( variable ); - - return variable; - - }; - - this.setVariableDependencies = function ( variable, dependencies ) { - - variable.dependencies = dependencies; - - }; - - this.init = function () { - - if ( renderer.capabilities.maxVertexTextures === 0 ) { - - return 'No support for vertex shader textures.'; - - } - - for ( let i = 0; i < this.variables.length; i ++ ) { - - const variable = this.variables[ i ]; - - // Creates rendertargets and initialize them with input texture - variable.renderTargets[ 0 ] = this.createRenderTarget( sizeX, sizeY, variable.wrapS, variable.wrapT, variable.minFilter, variable.magFilter ); - variable.renderTargets[ 1 ] = this.createRenderTarget( sizeX, sizeY, variable.wrapS, variable.wrapT, variable.minFilter, variable.magFilter ); - this.renderTexture( variable.initialValueTexture, variable.renderTargets[ 0 ] ); - this.renderTexture( variable.initialValueTexture, variable.renderTargets[ 1 ] ); - - // Adds dependencies uniforms to the ShaderMaterial - const material = variable.material; - const uniforms = material.uniforms; - - if ( variable.dependencies !== null ) { - - for ( let d = 0; d < variable.dependencies.length; d ++ ) { - - const depVar = variable.dependencies[ d ]; - - if ( depVar.name !== variable.name ) { - - // Checks if variable exists - let found = false; - - for ( let j = 0; j < this.variables.length; j ++ ) { - - if ( depVar.name === this.variables[ j ].name ) { - - found = true; - break; - - } - - } - - if ( ! found ) { - - return 'Variable dependency not found. Variable=' + variable.name + ', dependency=' + depVar.name; - - } - - } - - uniforms[ depVar.name ] = { value: null }; - - material.fragmentShader = '\nuniform sampler2D ' + depVar.name + ';\n' + material.fragmentShader; - - } - - } - - } - - this.currentTextureIndex = 0; - - return null; - - }; - - this.compute = function () { - - const currentTextureIndex = this.currentTextureIndex; - const nextTextureIndex = this.currentTextureIndex === 0 ? 1 : 0; - - for ( let i = 0, il = this.variables.length; i < il; i ++ ) { - - const variable = this.variables[ i ]; - - // Sets texture dependencies uniforms - if ( variable.dependencies !== null ) { - - const uniforms = variable.material.uniforms; - - for ( let d = 0, dl = variable.dependencies.length; d < dl; d ++ ) { - - const depVar = variable.dependencies[ d ]; - - uniforms[ depVar.name ].value = depVar.renderTargets[ currentTextureIndex ].texture; - - } - - } - - // Performs the computation for this variable - this.doRenderTarget( variable.material, variable.renderTargets[ nextTextureIndex ] ); - - } - - this.currentTextureIndex = nextTextureIndex; - - }; - - this.getCurrentRenderTarget = function ( variable ) { - - return variable.renderTargets[ this.currentTextureIndex ]; - - }; - - this.getAlternateRenderTarget = function ( variable ) { - - return variable.renderTargets[ this.currentTextureIndex === 0 ? 1 : 0 ]; - - }; - - this.dispose = function () { - - quad.dispose(); - - const variables = this.variables; - - for ( let i = 0; i < variables.length; i ++ ) { - - const variable = variables[ i ]; - - if ( variable.initialValueTexture ) variable.initialValueTexture.dispose(); - - const renderTargets = variable.renderTargets; - - for ( let j = 0; j < renderTargets.length; j ++ ) { - - const renderTarget = renderTargets[ j ]; - renderTarget.dispose(); - - } - - } - - }; - - function addResolutionDefine( materialShader ) { - - materialShader.defines.resolution = 'vec2( ' + sizeX.toFixed( 1 ) + ', ' + sizeY.toFixed( 1 ) + ' )'; - - } - - this.addResolutionDefine = addResolutionDefine; - - - // The following functions can be used to compute things manually - - function createShaderMaterial( computeFragmentShader, uniforms ) { - - uniforms = uniforms || {}; - - const material = new ShaderMaterial( { - name: 'GPUComputationShader', - uniforms: uniforms, - vertexShader: getPassThroughVertexShader(), - fragmentShader: computeFragmentShader - } ); - - addResolutionDefine( material ); - - return material; - - } - - this.createShaderMaterial = createShaderMaterial; - - this.createRenderTarget = function ( sizeXTexture, sizeYTexture, wrapS, wrapT, minFilter, magFilter ) { - - sizeXTexture = sizeXTexture || sizeX; - sizeYTexture = sizeYTexture || sizeY; - - wrapS = wrapS || ClampToEdgeWrapping; - wrapT = wrapT || ClampToEdgeWrapping; - - minFilter = minFilter || NearestFilter; - magFilter = magFilter || NearestFilter; - - const renderTarget = new WebGLRenderTarget( sizeXTexture, sizeYTexture, { - wrapS: wrapS, - wrapT: wrapT, - minFilter: minFilter, - magFilter: magFilter, - format: RGBAFormat, - type: dataType, - depthBuffer: false - } ); - - return renderTarget; - - }; - - this.createTexture = function () { - - const data = new Float32Array( sizeX * sizeY * 4 ); - const texture = new DataTexture( data, sizeX, sizeY, RGBAFormat, FloatType ); - texture.needsUpdate = true; - return texture; - - }; - - this.renderTexture = function ( input, output ) { - - // Takes a texture, and render out in rendertarget - // input = Texture - // output = RenderTarget - - passThruUniforms.passThruTexture.value = input; - - this.doRenderTarget( passThruShader, output ); - - passThruUniforms.passThruTexture.value = null; - - }; - - this.doRenderTarget = function ( material, output ) { - - const currentRenderTarget = renderer.getRenderTarget(); - - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - - renderer.xr.enabled = false; // Avoid camera modification - renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows - quad.material = material; - renderer.setRenderTarget( output ); - quad.render( renderer ); - quad.material = passThruShader; - - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - - renderer.setRenderTarget( currentRenderTarget ); - - }; - - // Shaders - - function getPassThroughVertexShader() { - - return 'void main() {\n' + - '\n' + - ' gl_Position = vec4( position, 1.0 );\n' + - '\n' + - '}\n'; - - } - - function getPassThroughFragmentShader() { - - return 'uniform sampler2D passThruTexture;\n' + - '\n' + - 'void main() {\n' + - '\n' + - ' vec2 uv = gl_FragCoord.xy / resolution.xy;\n' + - '\n' + - ' gl_FragColor = texture2D( passThruTexture, uv );\n' + - '\n' + - '}\n'; - - } - - } - -} - -export { GPUComputationRenderer }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Gyroscope.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Gyroscope.js deleted file mode 100644 index ea13115..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Gyroscope.js +++ /dev/null @@ -1,66 +0,0 @@ -import { - Object3D, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -const _translationObject = new Vector3(); -const _quaternionObject = new Quaternion(); -const _scaleObject = new Vector3(); - -const _translationWorld = new Vector3(); -const _quaternionWorld = new Quaternion(); -const _scaleWorld = new Vector3(); - -class Gyroscope extends Object3D { - - constructor() { - - super(); - - } - - updateMatrixWorld( force ) { - - this.matrixAutoUpdate && this.updateMatrix(); - - // update matrixWorld - - if ( this.matrixWorldNeedsUpdate || force ) { - - if ( this.parent !== null ) { - - this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); - - this.matrixWorld.decompose( _translationWorld, _quaternionWorld, _scaleWorld ); - this.matrix.decompose( _translationObject, _quaternionObject, _scaleObject ); - - this.matrixWorld.compose( _translationWorld, _quaternionObject, _scaleWorld ); - - - } else { - - this.matrixWorld.copy( this.matrix ); - - } - - - this.matrixWorldNeedsUpdate = false; - - force = true; - - } - - // update children - - for ( let i = 0, l = this.children.length; i < l; i ++ ) { - - this.children[ i ].updateMatrixWorld( force ); - - } - - } - -} - -export { Gyroscope }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2Character.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2Character.js deleted file mode 100644 index 8750456..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2Character.js +++ /dev/null @@ -1,276 +0,0 @@ -import { - AnimationMixer, - Box3, - Mesh, - MeshLambertMaterial, - Object3D, - TextureLoader, - UVMapping, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; -import { MD2Loader } from '../loaders/MD2Loader.js'; - -class MD2Character { - - constructor() { - - this.scale = 1; - this.animationFPS = 6; - - this.root = new Object3D(); - - this.meshBody = null; - this.meshWeapon = null; - - this.skinsBody = []; - this.skinsWeapon = []; - - this.weapons = []; - - this.activeAnimation = null; - - this.mixer = null; - - this.onLoadComplete = function () {}; - - this.loadCounter = 0; - - } - - loadParts( config ) { - - const scope = this; - - function createPart( geometry, skinMap ) { - - const materialWireframe = new MeshLambertMaterial( { color: 0xffaa00, wireframe: true } ); - const materialTexture = new MeshLambertMaterial( { color: 0xffffff, wireframe: false, map: skinMap } ); - - // - - const mesh = new Mesh( geometry, materialTexture ); - mesh.rotation.y = - Math.PI / 2; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - // - - mesh.materialTexture = materialTexture; - mesh.materialWireframe = materialWireframe; - - return mesh; - - } - - function loadTextures( baseUrl, textureUrls ) { - - const textureLoader = new TextureLoader(); - const textures = []; - - for ( let i = 0; i < textureUrls.length; i ++ ) { - - textures[ i ] = textureLoader.load( baseUrl + textureUrls[ i ], checkLoadingComplete ); - textures[ i ].mapping = UVMapping; - textures[ i ].name = textureUrls[ i ]; - textures[ i ].colorSpace = SRGBColorSpace; - - } - - return textures; - - } - - function checkLoadingComplete() { - - scope.loadCounter -= 1; - - if ( scope.loadCounter === 0 ) scope.onLoadComplete(); - - } - - this.loadCounter = config.weapons.length * 2 + config.skins.length + 1; - - const weaponsTextures = []; - for ( let i = 0; i < config.weapons.length; i ++ ) weaponsTextures[ i ] = config.weapons[ i ][ 1 ]; - // SKINS - - this.skinsBody = loadTextures( config.baseUrl + 'skins/', config.skins ); - this.skinsWeapon = loadTextures( config.baseUrl + 'skins/', weaponsTextures ); - - // BODY - - const loader = new MD2Loader(); - - loader.load( config.baseUrl + config.body, function ( geo ) { - - const boundingBox = new Box3(); - boundingBox.setFromBufferAttribute( geo.attributes.position ); - - scope.root.position.y = - scope.scale * boundingBox.min.y; - - const mesh = createPart( geo, scope.skinsBody[ 0 ] ); - mesh.scale.set( scope.scale, scope.scale, scope.scale ); - - scope.root.add( mesh ); - - scope.meshBody = mesh; - - scope.meshBody.clipOffset = 0; - scope.activeAnimationClipName = mesh.geometry.animations[ 0 ].name; - - scope.mixer = new AnimationMixer( mesh ); - - checkLoadingComplete(); - - } ); - - // WEAPONS - - const generateCallback = function ( index, name ) { - - return function ( geo ) { - - const mesh = createPart( geo, scope.skinsWeapon[ index ] ); - mesh.scale.set( scope.scale, scope.scale, scope.scale ); - mesh.visible = false; - - mesh.name = name; - - scope.root.add( mesh ); - - scope.weapons[ index ] = mesh; - scope.meshWeapon = mesh; - - checkLoadingComplete(); - - }; - - }; - - for ( let i = 0; i < config.weapons.length; i ++ ) { - - loader.load( config.baseUrl + config.weapons[ i ][ 0 ], generateCallback( i, config.weapons[ i ][ 0 ] ) ); - - } - - } - - setPlaybackRate( rate ) { - - if ( rate !== 0 ) { - - this.mixer.timeScale = 1 / rate; - - } else { - - this.mixer.timeScale = 0; - - } - - } - - setWireframe( wireframeEnabled ) { - - if ( wireframeEnabled ) { - - if ( this.meshBody ) this.meshBody.material = this.meshBody.materialWireframe; - if ( this.meshWeapon ) this.meshWeapon.material = this.meshWeapon.materialWireframe; - - } else { - - if ( this.meshBody ) this.meshBody.material = this.meshBody.materialTexture; - if ( this.meshWeapon ) this.meshWeapon.material = this.meshWeapon.materialTexture; - - } - - } - - setSkin( index ) { - - if ( this.meshBody && this.meshBody.material.wireframe === false ) { - - this.meshBody.material.map = this.skinsBody[ index ]; - - } - - } - - setWeapon( index ) { - - for ( let i = 0; i < this.weapons.length; i ++ ) this.weapons[ i ].visible = false; - - const activeWeapon = this.weapons[ index ]; - - if ( activeWeapon ) { - - activeWeapon.visible = true; - this.meshWeapon = activeWeapon; - - this.syncWeaponAnimation(); - - } - - } - - setAnimation( clipName ) { - - if ( this.meshBody ) { - - if ( this.meshBody.activeAction ) { - - this.meshBody.activeAction.stop(); - this.meshBody.activeAction = null; - - } - - const action = this.mixer.clipAction( clipName, this.meshBody ); - - if ( action ) { - - this.meshBody.activeAction = action.play(); - - } - - } - - this.activeClipName = clipName; - - this.syncWeaponAnimation(); - - } - - syncWeaponAnimation() { - - const clipName = this.activeClipName; - - if ( this.meshWeapon ) { - - if ( this.meshWeapon.activeAction ) { - - this.meshWeapon.activeAction.stop(); - this.meshWeapon.activeAction = null; - - } - - const action = this.mixer.clipAction( clipName, this.meshWeapon ); - - if ( action ) { - - this.meshWeapon.activeAction = action.syncWith( this.meshBody.activeAction ).play(); - - } - - } - - } - - update( delta ) { - - if ( this.mixer ) this.mixer.update( delta ); - - } - -} - -export { MD2Character }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2CharacterComplex.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2CharacterComplex.js deleted file mode 100644 index 4b333d4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MD2CharacterComplex.js +++ /dev/null @@ -1,576 +0,0 @@ -import { - Box3, - MathUtils, - MeshLambertMaterial, - Object3D, - TextureLoader, - UVMapping, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; -import { MD2Loader } from '../loaders/MD2Loader.js'; -import { MorphBlendMesh } from '../misc/MorphBlendMesh.js'; - -class MD2CharacterComplex { - - constructor() { - - this.scale = 1; - - // animation parameters - - this.animationFPS = 6; - this.transitionFrames = 15; - - // movement model parameters - - this.maxSpeed = 275; - this.maxReverseSpeed = - 275; - - this.frontAcceleration = 600; - this.backAcceleration = 600; - - this.frontDecceleration = 600; - - this.angularSpeed = 2.5; - - // rig - - this.root = new Object3D(); - - this.meshBody = null; - this.meshWeapon = null; - - this.controls = null; - - // skins - - this.skinsBody = []; - this.skinsWeapon = []; - - this.weapons = []; - - this.currentSkin = undefined; - - // - - this.onLoadComplete = function () {}; - - // internals - - this.meshes = []; - this.animations = {}; - - this.loadCounter = 0; - - // internal movement control variables - - this.speed = 0; - this.bodyOrientation = 0; - - this.walkSpeed = this.maxSpeed; - this.crouchSpeed = this.maxSpeed * 0.5; - - // internal animation parameters - - this.activeAnimation = null; - this.oldAnimation = null; - - // API - - } - - enableShadows( enable ) { - - for ( let i = 0; i < this.meshes.length; i ++ ) { - - this.meshes[ i ].castShadow = enable; - this.meshes[ i ].receiveShadow = enable; - - } - - } - - setVisible( enable ) { - - for ( let i = 0; i < this.meshes.length; i ++ ) { - - this.meshes[ i ].visible = enable; - this.meshes[ i ].visible = enable; - - } - - } - - shareParts( original ) { - - this.animations = original.animations; - this.walkSpeed = original.walkSpeed; - this.crouchSpeed = original.crouchSpeed; - - this.skinsBody = original.skinsBody; - this.skinsWeapon = original.skinsWeapon; - - // BODY - - const mesh = this._createPart( original.meshBody.geometry, this.skinsBody[ 0 ] ); - mesh.scale.set( this.scale, this.scale, this.scale ); - - this.root.position.y = original.root.position.y; - this.root.add( mesh ); - - this.meshBody = mesh; - - this.meshes.push( mesh ); - - // WEAPONS - - for ( let i = 0; i < original.weapons.length; i ++ ) { - - const meshWeapon = this._createPart( original.weapons[ i ].geometry, this.skinsWeapon[ i ] ); - meshWeapon.scale.set( this.scale, this.scale, this.scale ); - meshWeapon.visible = false; - - meshWeapon.name = original.weapons[ i ].name; - - this.root.add( meshWeapon ); - - this.weapons[ i ] = meshWeapon; - this.meshWeapon = meshWeapon; - - this.meshes.push( meshWeapon ); - - } - - } - - loadParts( config ) { - - const scope = this; - - function loadTextures( baseUrl, textureUrls ) { - - const textureLoader = new TextureLoader(); - const textures = []; - - for ( let i = 0; i < textureUrls.length; i ++ ) { - - textures[ i ] = textureLoader.load( baseUrl + textureUrls[ i ], checkLoadingComplete ); - textures[ i ].mapping = UVMapping; - textures[ i ].name = textureUrls[ i ]; - textures[ i ].colorSpace = SRGBColorSpace; - - } - - return textures; - - } - - function checkLoadingComplete() { - - scope.loadCounter -= 1; - if ( scope.loadCounter === 0 ) scope.onLoadComplete(); - - } - - this.animations = config.animations; - this.walkSpeed = config.walkSpeed; - this.crouchSpeed = config.crouchSpeed; - - this.loadCounter = config.weapons.length * 2 + config.skins.length + 1; - - const weaponsTextures = []; - for ( let i = 0; i < config.weapons.length; i ++ ) weaponsTextures[ i ] = config.weapons[ i ][ 1 ]; - - // SKINS - - this.skinsBody = loadTextures( config.baseUrl + 'skins/', config.skins ); - this.skinsWeapon = loadTextures( config.baseUrl + 'skins/', weaponsTextures ); - - // BODY - - const loader = new MD2Loader(); - - loader.load( config.baseUrl + config.body, function ( geo ) { - - const boundingBox = new Box3(); - boundingBox.setFromBufferAttribute( geo.attributes.position ); - - scope.root.position.y = - scope.scale * boundingBox.min.y; - - const mesh = scope._createPart( geo, scope.skinsBody[ 0 ] ); - mesh.scale.set( scope.scale, scope.scale, scope.scale ); - - scope.root.add( mesh ); - - scope.meshBody = mesh; - scope.meshes.push( mesh ); - - checkLoadingComplete(); - - } ); - - // WEAPONS - - const generateCallback = function ( index, name ) { - - return function ( geo ) { - - const mesh = scope._createPart( geo, scope.skinsWeapon[ index ] ); - mesh.scale.set( scope.scale, scope.scale, scope.scale ); - mesh.visible = false; - - mesh.name = name; - - scope.root.add( mesh ); - - scope.weapons[ index ] = mesh; - scope.meshWeapon = mesh; - scope.meshes.push( mesh ); - - checkLoadingComplete(); - - }; - - }; - - for ( let i = 0; i < config.weapons.length; i ++ ) { - - loader.load( config.baseUrl + config.weapons[ i ][ 0 ], generateCallback( i, config.weapons[ i ][ 0 ] ) ); - - } - - } - - setPlaybackRate( rate ) { - - if ( this.meshBody ) this.meshBody.duration = this.meshBody.baseDuration / rate; - if ( this.meshWeapon ) this.meshWeapon.duration = this.meshWeapon.baseDuration / rate; - - } - - setWireframe( wireframeEnabled ) { - - if ( wireframeEnabled ) { - - if ( this.meshBody ) this.meshBody.material = this.meshBody.materialWireframe; - if ( this.meshWeapon ) this.meshWeapon.material = this.meshWeapon.materialWireframe; - - } else { - - if ( this.meshBody ) this.meshBody.material = this.meshBody.materialTexture; - if ( this.meshWeapon ) this.meshWeapon.material = this.meshWeapon.materialTexture; - - } - - } - - setSkin( index ) { - - if ( this.meshBody && this.meshBody.material.wireframe === false ) { - - this.meshBody.material.map = this.skinsBody[ index ]; - this.currentSkin = index; - - } - - } - - setWeapon( index ) { - - for ( let i = 0; i < this.weapons.length; i ++ ) this.weapons[ i ].visible = false; - - const activeWeapon = this.weapons[ index ]; - - if ( activeWeapon ) { - - activeWeapon.visible = true; - this.meshWeapon = activeWeapon; - - if ( this.activeAnimation ) { - - activeWeapon.playAnimation( this.activeAnimation ); - this.meshWeapon.setAnimationTime( this.activeAnimation, this.meshBody.getAnimationTime( this.activeAnimation ) ); - - } - - } - - } - - setAnimation( animationName ) { - - if ( animationName === this.activeAnimation || ! animationName ) return; - - if ( this.meshBody ) { - - this.meshBody.setAnimationWeight( animationName, 0 ); - this.meshBody.playAnimation( animationName ); - - this.oldAnimation = this.activeAnimation; - this.activeAnimation = animationName; - - this.blendCounter = this.transitionFrames; - - } - - if ( this.meshWeapon ) { - - this.meshWeapon.setAnimationWeight( animationName, 0 ); - this.meshWeapon.playAnimation( animationName ); - - } - - - } - - update( delta ) { - - if ( this.controls ) this.updateMovementModel( delta ); - - if ( this.animations ) { - - this.updateBehaviors(); - this.updateAnimations( delta ); - - } - - } - - updateAnimations( delta ) { - - let mix = 1; - - if ( this.blendCounter > 0 ) { - - mix = ( this.transitionFrames - this.blendCounter ) / this.transitionFrames; - this.blendCounter -= 1; - - } - - if ( this.meshBody ) { - - this.meshBody.update( delta ); - - this.meshBody.setAnimationWeight( this.activeAnimation, mix ); - this.meshBody.setAnimationWeight( this.oldAnimation, 1 - mix ); - - } - - if ( this.meshWeapon ) { - - this.meshWeapon.update( delta ); - - this.meshWeapon.setAnimationWeight( this.activeAnimation, mix ); - this.meshWeapon.setAnimationWeight( this.oldAnimation, 1 - mix ); - - } - - } - - updateBehaviors() { - - const controls = this.controls; - const animations = this.animations; - - let moveAnimation, idleAnimation; - - // crouch vs stand - - if ( controls.crouch ) { - - moveAnimation = animations[ 'crouchMove' ]; - idleAnimation = animations[ 'crouchIdle' ]; - - } else { - - moveAnimation = animations[ 'move' ]; - idleAnimation = animations[ 'idle' ]; - - } - - // actions - - if ( controls.jump ) { - - moveAnimation = animations[ 'jump' ]; - idleAnimation = animations[ 'jump' ]; - - } - - if ( controls.attack ) { - - if ( controls.crouch ) { - - moveAnimation = animations[ 'crouchAttack' ]; - idleAnimation = animations[ 'crouchAttack' ]; - - } else { - - moveAnimation = animations[ 'attack' ]; - idleAnimation = animations[ 'attack' ]; - - } - - } - - // set animations - - if ( controls.moveForward || controls.moveBackward || controls.moveLeft || controls.moveRight ) { - - if ( this.activeAnimation !== moveAnimation ) { - - this.setAnimation( moveAnimation ); - - } - - } - - - if ( Math.abs( this.speed ) < 0.2 * this.maxSpeed && ! ( controls.moveLeft || controls.moveRight || controls.moveForward || controls.moveBackward ) ) { - - if ( this.activeAnimation !== idleAnimation ) { - - this.setAnimation( idleAnimation ); - - } - - } - - // set animation direction - - if ( controls.moveForward ) { - - if ( this.meshBody ) { - - this.meshBody.setAnimationDirectionForward( this.activeAnimation ); - this.meshBody.setAnimationDirectionForward( this.oldAnimation ); - - } - - if ( this.meshWeapon ) { - - this.meshWeapon.setAnimationDirectionForward( this.activeAnimation ); - this.meshWeapon.setAnimationDirectionForward( this.oldAnimation ); - - } - - } - - if ( controls.moveBackward ) { - - if ( this.meshBody ) { - - this.meshBody.setAnimationDirectionBackward( this.activeAnimation ); - this.meshBody.setAnimationDirectionBackward( this.oldAnimation ); - - } - - if ( this.meshWeapon ) { - - this.meshWeapon.setAnimationDirectionBackward( this.activeAnimation ); - this.meshWeapon.setAnimationDirectionBackward( this.oldAnimation ); - - } - - } - - } - - updateMovementModel( delta ) { - - function exponentialEaseOut( k ) { - - return k === 1 ? 1 : - Math.pow( 2, - 10 * k ) + 1; - - } - - const controls = this.controls; - - // speed based on controls - - if ( controls.crouch ) this.maxSpeed = this.crouchSpeed; - else this.maxSpeed = this.walkSpeed; - - this.maxReverseSpeed = - this.maxSpeed; - - if ( controls.moveForward ) this.speed = MathUtils.clamp( this.speed + delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed ); - if ( controls.moveBackward ) this.speed = MathUtils.clamp( this.speed - delta * this.backAcceleration, this.maxReverseSpeed, this.maxSpeed ); - - // orientation based on controls - // (don't just stand while turning) - - const dir = 1; - - if ( controls.moveLeft ) { - - this.bodyOrientation += delta * this.angularSpeed; - this.speed = MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed ); - - } - - if ( controls.moveRight ) { - - this.bodyOrientation -= delta * this.angularSpeed; - this.speed = MathUtils.clamp( this.speed + dir * delta * this.frontAcceleration, this.maxReverseSpeed, this.maxSpeed ); - - } - - // speed decay - - if ( ! ( controls.moveForward || controls.moveBackward ) ) { - - if ( this.speed > 0 ) { - - const k = exponentialEaseOut( this.speed / this.maxSpeed ); - this.speed = MathUtils.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed ); - - } else { - - const k = exponentialEaseOut( this.speed / this.maxReverseSpeed ); - this.speed = MathUtils.clamp( this.speed + k * delta * this.backAcceleration, this.maxReverseSpeed, 0 ); - - } - - } - - // displacement - - const forwardDelta = this.speed * delta; - - this.root.position.x += Math.sin( this.bodyOrientation ) * forwardDelta; - this.root.position.z += Math.cos( this.bodyOrientation ) * forwardDelta; - - // steering - - this.root.rotation.y = this.bodyOrientation; - - } - - // internal - - _createPart( geometry, skinMap ) { - - const materialWireframe = new MeshLambertMaterial( { color: 0xffaa00, wireframe: true } ); - const materialTexture = new MeshLambertMaterial( { color: 0xffffff, wireframe: false, map: skinMap } ); - - // - - const mesh = new MorphBlendMesh( geometry, materialTexture ); - mesh.rotation.y = - Math.PI / 2; - - // - - mesh.materialTexture = materialTexture; - mesh.materialWireframe = materialWireframe; - - // - - mesh.autoCreateAnimations( this.animationFPS ); - - return mesh; - - } - -} - -export { MD2CharacterComplex }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphAnimMesh.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphAnimMesh.js deleted file mode 100644 index a88748f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphAnimMesh.js +++ /dev/null @@ -1,75 +0,0 @@ -import { - AnimationClip, - AnimationMixer, - Mesh -} from '/static/javascript/three/build/three.module.js'; - -class MorphAnimMesh extends Mesh { - - constructor( geometry, material ) { - - super( geometry, material ); - - this.type = 'MorphAnimMesh'; - - this.mixer = new AnimationMixer( this ); - this.activeAction = null; - - } - - setDirectionForward() { - - this.mixer.timeScale = 1.0; - - } - - setDirectionBackward() { - - this.mixer.timeScale = - 1.0; - - } - - playAnimation( label, fps ) { - - if ( this.activeAction ) { - - this.activeAction.stop(); - this.activeAction = null; - - } - - const clip = AnimationClip.findByName( this, label ); - - if ( clip ) { - - const action = this.mixer.clipAction( clip ); - action.timeScale = ( clip.tracks.length * fps ) / clip.duration; - this.activeAction = action.play(); - - } else { - - throw new Error( 'THREE.MorphAnimMesh: animations[' + label + '] undefined in .playAnimation()' ); - - } - - } - - updateAnimation( delta ) { - - this.mixer.update( delta ); - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - this.mixer = new AnimationMixer( this ); - - return this; - - } - -} - -export { MorphAnimMesh }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphBlendMesh.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphBlendMesh.js deleted file mode 100644 index 1ce7209..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/MorphBlendMesh.js +++ /dev/null @@ -1,322 +0,0 @@ -import { - MathUtils, - Mesh -} from '/static/javascript/three/build/three.module.js'; - -class MorphBlendMesh extends Mesh { - - constructor( geometry, material ) { - - super( geometry, material ); - - this.animationsMap = {}; - this.animationsList = []; - - // prepare default animation - // (all frames played together in 1 second) - - const numFrames = Object.keys( this.morphTargetDictionary ).length; - - const name = '__default'; - - const startFrame = 0; - const endFrame = numFrames - 1; - - const fps = numFrames / 1; - - this.createAnimation( name, startFrame, endFrame, fps ); - this.setAnimationWeight( name, 1 ); - - } - - createAnimation( name, start, end, fps ) { - - const animation = { - - start: start, - end: end, - - length: end - start + 1, - - fps: fps, - duration: ( end - start ) / fps, - - lastFrame: 0, - currentFrame: 0, - - active: false, - - time: 0, - direction: 1, - weight: 1, - - directionBackwards: false, - mirroredLoop: false - - }; - - this.animationsMap[ name ] = animation; - this.animationsList.push( animation ); - - } - - autoCreateAnimations( fps ) { - - const pattern = /([a-z]+)_?(\d+)/i; - - let firstAnimation; - - const frameRanges = {}; - - let i = 0; - - for ( const key in this.morphTargetDictionary ) { - - const chunks = key.match( pattern ); - - if ( chunks && chunks.length > 1 ) { - - const name = chunks[ 1 ]; - - if ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity }; - - const range = frameRanges[ name ]; - - if ( i < range.start ) range.start = i; - if ( i > range.end ) range.end = i; - - if ( ! firstAnimation ) firstAnimation = name; - - } - - i ++; - - } - - for ( const name in frameRanges ) { - - const range = frameRanges[ name ]; - this.createAnimation( name, range.start, range.end, fps ); - - } - - this.firstAnimation = firstAnimation; - - } - - setAnimationDirectionForward( name ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = 1; - animation.directionBackwards = false; - - } - - } - - setAnimationDirectionBackward( name ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.direction = - 1; - animation.directionBackwards = true; - - } - - } - - setAnimationFPS( name, fps ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.fps = fps; - animation.duration = ( animation.end - animation.start ) / animation.fps; - - } - - } - - setAnimationDuration( name, duration ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.duration = duration; - animation.fps = ( animation.end - animation.start ) / animation.duration; - - } - - } - - setAnimationWeight( name, weight ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.weight = weight; - - } - - } - - setAnimationTime( name, time ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = time; - - } - - } - - getAnimationTime( name ) { - - let time = 0; - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - time = animation.time; - - } - - return time; - - } - - getAnimationDuration( name ) { - - let duration = - 1; - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - duration = animation.duration; - - } - - return duration; - - } - - playAnimation( name ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.time = 0; - animation.active = true; - - } else { - - console.warn( 'THREE.MorphBlendMesh: animation[' + name + '] undefined in .playAnimation()' ); - - } - - } - - stopAnimation( name ) { - - const animation = this.animationsMap[ name ]; - - if ( animation ) { - - animation.active = false; - - } - - } - - update( delta ) { - - for ( let i = 0, il = this.animationsList.length; i < il; i ++ ) { - - const animation = this.animationsList[ i ]; - - if ( ! animation.active ) continue; - - const frameTime = animation.duration / animation.length; - - animation.time += animation.direction * delta; - - if ( animation.mirroredLoop ) { - - if ( animation.time > animation.duration || animation.time < 0 ) { - - animation.direction *= - 1; - - if ( animation.time > animation.duration ) { - - animation.time = animation.duration; - animation.directionBackwards = true; - - } - - if ( animation.time < 0 ) { - - animation.time = 0; - animation.directionBackwards = false; - - } - - } - - } else { - - animation.time = animation.time % animation.duration; - - if ( animation.time < 0 ) animation.time += animation.duration; - - } - - const keyframe = animation.start + MathUtils.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 ); - const weight = animation.weight; - - if ( keyframe !== animation.currentFrame ) { - - this.morphTargetInfluences[ animation.lastFrame ] = 0; - this.morphTargetInfluences[ animation.currentFrame ] = 1 * weight; - - this.morphTargetInfluences[ keyframe ] = 0; - - animation.lastFrame = animation.currentFrame; - animation.currentFrame = keyframe; - - } - - let mix = ( animation.time % frameTime ) / frameTime; - - if ( animation.directionBackwards ) mix = 1 - mix; - - if ( animation.currentFrame !== animation.lastFrame ) { - - this.morphTargetInfluences[ animation.currentFrame ] = mix * weight; - this.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight; - - } else { - - this.morphTargetInfluences[ animation.currentFrame ] = weight; - - } - - } - - } - -} - -export { MorphBlendMesh }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ProgressiveLightMap.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ProgressiveLightMap.js deleted file mode 100644 index 51d69cb..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/ProgressiveLightMap.js +++ /dev/null @@ -1,324 +0,0 @@ -import * as THREE from '/static/javascript/three/build/three.module.js'; -import { potpack } from '../libs/potpack.module.js'; - -/** - * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/) - * - * To use, simply construct a `ProgressiveLightMap` object, - * `plmap.addObjectsToLightMap(object)` an array of semi-static - * objects and lights to the class once, and then call - * `plmap.update(camera)` every frame to begin accumulating - * lighting samples. - * - * This should begin accumulating lightmaps which apply to - * your objects, so you can start jittering lighting to achieve - * the texture-space effect you're looking for. - * - * @param {WebGLRenderer} renderer A WebGL Rendering Context - * @param {number} res The side-long dimension of you total lightmap - */ -class ProgressiveLightMap { - - constructor( renderer, res = 1024 ) { - - this.renderer = renderer; - this.res = res; - this.lightMapContainers = []; - this.compiled = false; - this.scene = new THREE.Scene(); - this.scene.background = null; - this.tinyTarget = new THREE.WebGLRenderTarget( 1, 1 ); - this.buffer1Active = false; - this.firstUpdate = true; - this.warned = false; - - // Create the Progressive LightMap Texture - const format = /(Android|iPad|iPhone|iPod)/g.test( navigator.userAgent ) ? THREE.HalfFloatType : THREE.FloatType; - this.progressiveLightMap1 = new THREE.WebGLRenderTarget( this.res, this.res, { type: format } ); - this.progressiveLightMap2 = new THREE.WebGLRenderTarget( this.res, this.res, { type: format } ); - this.progressiveLightMap2.texture.channel = 1; - - // Inject some spicy new logic into a standard phong material - this.uvMat = new THREE.MeshPhongMaterial(); - this.uvMat.uniforms = {}; - this.uvMat.onBeforeCompile = ( shader ) => { - - // Vertex Shader: Set Vertex Positions to the Unwrapped UV Positions - shader.vertexShader = - 'attribute vec2 uv1;\n' + - '#define USE_LIGHTMAP\n' + - '#define LIGHTMAP_UV uv1\n' + - shader.vertexShader.slice( 0, - 1 ) + - ' gl_Position = vec4((LIGHTMAP_UV - 0.5) * 2.0, 1.0, 1.0); }'; - - // Fragment Shader: Set Pixels to average in the Previous frame's Shadows - const bodyStart = shader.fragmentShader.indexOf( 'void main() {' ); - shader.fragmentShader = - '#define USE_LIGHTMAP\n' + - shader.fragmentShader.slice( 0, bodyStart ) + - ' uniform sampler2D previousShadowMap;\n uniform float averagingWindow;\n' + - shader.fragmentShader.slice( bodyStart - 1, - 1 ) + - `\nvec3 texelOld = texture2D(previousShadowMap, vLightMapUv).rgb; - gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/averagingWindow); - }`; - - // Set the Previous Frame's Texture Buffer and Averaging Window - shader.uniforms.previousShadowMap = { value: this.progressiveLightMap1.texture }; - shader.uniforms.averagingWindow = { value: 100 }; - - this.uvMat.uniforms = shader.uniforms; - - // Set the new Shader to this - this.uvMat.userData.shader = shader; - - this.compiled = true; - - }; - - } - - /** - * Sets these objects' materials' lightmaps and modifies their uv1's. - * @param {Object3D} objects An array of objects and lights to set up your lightmap. - */ - addObjectsToLightMap( objects ) { - - // Prepare list of UV bounding boxes for packing later... - this.uv_boxes = []; const padding = 3 / this.res; - - for ( let ob = 0; ob < objects.length; ob ++ ) { - - const object = objects[ ob ]; - - // If this object is a light, simply add it to the internal scene - if ( object.isLight ) { - - this.scene.attach( object ); continue; - - } - - if ( ! object.geometry.hasAttribute( 'uv' ) ) { - - console.warn( 'All lightmap objects need UVs!' ); continue; - - } - - if ( this.blurringPlane == null ) { - - this._initializeBlurPlane( this.res, this.progressiveLightMap1 ); - - } - - // Apply the lightmap to the object - object.material.lightMap = this.progressiveLightMap2.texture; - object.material.dithering = true; - object.castShadow = true; - object.receiveShadow = true; - object.renderOrder = 1000 + ob; - - // Prepare UV boxes for potpack - // TODO: Size these by object surface area - this.uv_boxes.push( { w: 1 + ( padding * 2 ), - h: 1 + ( padding * 2 ), index: ob } ); - - this.lightMapContainers.push( { basicMat: object.material, object: object } ); - - this.compiled = false; - - } - - // Pack the objects' lightmap UVs into the same global space - const dimensions = potpack( this.uv_boxes ); - this.uv_boxes.forEach( ( box ) => { - - const uv1 = objects[ box.index ].geometry.getAttribute( 'uv' ).clone(); - for ( let i = 0; i < uv1.array.length; i += uv1.itemSize ) { - - uv1.array[ i ] = ( uv1.array[ i ] + box.x + padding ) / dimensions.w; - uv1.array[ i + 1 ] = ( uv1.array[ i + 1 ] + box.y + padding ) / dimensions.h; - - } - - objects[ box.index ].geometry.setAttribute( 'uv1', uv1 ); - objects[ box.index ].geometry.getAttribute( 'uv1' ).needsUpdate = true; - - } ); - - } - - /** - * This function renders each mesh one at a time into their respective surface maps - * @param {Camera} camera Standard Rendering Camera - * @param {number} blendWindow When >1, samples will accumulate over time. - * @param {boolean} blurEdges Whether to fix UV Edges via blurring - */ - update( camera, blendWindow = 100, blurEdges = true ) { - - if ( this.blurringPlane == null ) { - - return; - - } - - // Store the original Render Target - const oldTarget = this.renderer.getRenderTarget(); - - // The blurring plane applies blur to the seams of the lightmap - this.blurringPlane.visible = blurEdges; - - // Steal the Object3D from the real world to our special dimension - for ( let l = 0; l < this.lightMapContainers.length; l ++ ) { - - this.lightMapContainers[ l ].object.oldScene = - this.lightMapContainers[ l ].object.parent; - this.scene.attach( this.lightMapContainers[ l ].object ); - - } - - // Render once normally to initialize everything - if ( this.firstUpdate ) { - - this.renderer.setRenderTarget( this.tinyTarget ); // Tiny for Speed - this.renderer.render( this.scene, camera ); - this.firstUpdate = false; - - } - - // Set each object's material to the UV Unwrapped Surface Mapping Version - for ( let l = 0; l < this.lightMapContainers.length; l ++ ) { - - this.uvMat.uniforms.averagingWindow = { value: blendWindow }; - this.lightMapContainers[ l ].object.material = this.uvMat; - this.lightMapContainers[ l ].object.oldFrustumCulled = - this.lightMapContainers[ l ].object.frustumCulled; - this.lightMapContainers[ l ].object.frustumCulled = false; - - } - - // Ping-pong two surface buffers for reading/writing - const activeMap = this.buffer1Active ? this.progressiveLightMap1 : this.progressiveLightMap2; - const inactiveMap = this.buffer1Active ? this.progressiveLightMap2 : this.progressiveLightMap1; - - // Render the object's surface maps - this.renderer.setRenderTarget( activeMap ); - this.uvMat.uniforms.previousShadowMap = { value: inactiveMap.texture }; - this.blurringPlane.material.uniforms.previousShadowMap = { value: inactiveMap.texture }; - this.buffer1Active = ! this.buffer1Active; - this.renderer.render( this.scene, camera ); - - // Restore the object's Real-time Material and add it back to the original world - for ( let l = 0; l < this.lightMapContainers.length; l ++ ) { - - this.lightMapContainers[ l ].object.frustumCulled = - this.lightMapContainers[ l ].object.oldFrustumCulled; - this.lightMapContainers[ l ].object.material = this.lightMapContainers[ l ].basicMat; - this.lightMapContainers[ l ].object.oldScene.attach( this.lightMapContainers[ l ].object ); - - } - - // Restore the original Render Target - this.renderer.setRenderTarget( oldTarget ); - - } - - /** DEBUG - * Draw the lightmap in the main scene. Call this after adding the objects to it. - * @param {boolean} visible Whether the debug plane should be visible - * @param {Vector3} position Where the debug plane should be drawn - */ - showDebugLightmap( visible, position = undefined ) { - - if ( this.lightMapContainers.length == 0 ) { - - if ( ! this.warned ) { - - console.warn( 'Call this after adding the objects!' ); this.warned = true; - - } - - return; - - } - - if ( this.labelMesh == null ) { - - this.labelMaterial = new THREE.MeshBasicMaterial( - { map: this.progressiveLightMap1.texture, side: THREE.DoubleSide } ); - this.labelPlane = new THREE.PlaneGeometry( 100, 100 ); - this.labelMesh = new THREE.Mesh( this.labelPlane, this.labelMaterial ); - this.labelMesh.position.y = 250; - this.lightMapContainers[ 0 ].object.parent.add( this.labelMesh ); - - } - - if ( position != undefined ) { - - this.labelMesh.position.copy( position ); - - } - - this.labelMesh.visible = visible; - - } - - /** - * INTERNAL Creates the Blurring Plane - * @param {number} res The square resolution of this object's lightMap. - * @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with. - */ - _initializeBlurPlane( res, lightMap = null ) { - - const blurMaterial = new THREE.MeshBasicMaterial(); - blurMaterial.uniforms = { previousShadowMap: { value: null }, - pixelOffset: { value: 1.0 / res }, - polygonOffset: true, polygonOffsetFactor: - 1, polygonOffsetUnits: 3.0 }; - blurMaterial.onBeforeCompile = ( shader ) => { - - // Vertex Shader: Set Vertex Positions to the Unwrapped UV Positions - shader.vertexShader = - '#define USE_UV\n' + - shader.vertexShader.slice( 0, - 1 ) + - ' gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }'; - - // Fragment Shader: Set Pixels to 9-tap box blur the current frame's Shadows - const bodyStart = shader.fragmentShader.indexOf( 'void main() {' ); - shader.fragmentShader = - '#define USE_UV\n' + - shader.fragmentShader.slice( 0, bodyStart ) + - ' uniform sampler2D previousShadowMap;\n uniform float pixelOffset;\n' + - shader.fragmentShader.slice( bodyStart - 1, - 1 ) + - ` gl_FragColor.rgb = ( - texture2D(previousShadowMap, vUv + vec2( pixelOffset, 0.0 )).rgb + - texture2D(previousShadowMap, vUv + vec2( 0.0 , pixelOffset)).rgb + - texture2D(previousShadowMap, vUv + vec2( 0.0 , -pixelOffset)).rgb + - texture2D(previousShadowMap, vUv + vec2(-pixelOffset, 0.0 )).rgb + - texture2D(previousShadowMap, vUv + vec2( pixelOffset, pixelOffset)).rgb + - texture2D(previousShadowMap, vUv + vec2(-pixelOffset, pixelOffset)).rgb + - texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb + - texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0; - }`; - - // Set the LightMap Accumulation Buffer - shader.uniforms.previousShadowMap = { value: lightMap.texture }; - shader.uniforms.pixelOffset = { value: 0.5 / res }; - blurMaterial.uniforms = shader.uniforms; - - // Set the new Shader to this - blurMaterial.userData.shader = shader; - - this.compiled = true; - - }; - - this.blurringPlane = new THREE.Mesh( new THREE.PlaneGeometry( 1, 1 ), blurMaterial ); - this.blurringPlane.name = 'Blurring Plane'; - this.blurringPlane.frustumCulled = false; - this.blurringPlane.renderOrder = 0; - this.blurringPlane.material.depthWrite = false; - this.scene.add( this.blurringPlane ); - - } - -} - -export { ProgressiveLightMap }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/RollerCoaster.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/RollerCoaster.js deleted file mode 100644 index 1c688b6..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/RollerCoaster.js +++ /dev/null @@ -1,566 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - Quaternion, - Raycaster, - SRGBColorSpace, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -class RollerCoasterGeometry extends BufferGeometry { - - constructor( curve, divisions ) { - - super(); - - const vertices = []; - const normals = []; - const colors = []; - - const color1 = [ 1, 1, 1 ]; - const color2 = [ 1, 1, 0 ]; - - const up = new Vector3( 0, 1, 0 ); - const forward = new Vector3(); - const right = new Vector3(); - - const quaternion = new Quaternion(); - const prevQuaternion = new Quaternion(); - prevQuaternion.setFromAxisAngle( up, Math.PI / 2 ); - - const point = new Vector3(); - const prevPoint = new Vector3(); - prevPoint.copy( curve.getPointAt( 0 ) ); - - // shapes - - const step = [ - new Vector3( - 0.225, 0, 0 ), - new Vector3( 0, - 0.050, 0 ), - new Vector3( 0, - 0.175, 0 ), - - new Vector3( 0, - 0.050, 0 ), - new Vector3( 0.225, 0, 0 ), - new Vector3( 0, - 0.175, 0 ) - ]; - - const PI2 = Math.PI * 2; - - let sides = 5; - const tube1 = []; - - for ( let i = 0; i < sides; i ++ ) { - - const angle = ( i / sides ) * PI2; - tube1.push( new Vector3( Math.sin( angle ) * 0.06, Math.cos( angle ) * 0.06, 0 ) ); - - } - - sides = 6; - const tube2 = []; - - for ( let i = 0; i < sides; i ++ ) { - - const angle = ( i / sides ) * PI2; - tube2.push( new Vector3( Math.sin( angle ) * 0.025, Math.cos( angle ) * 0.025, 0 ) ); - - } - - const vector = new Vector3(); - const normal = new Vector3(); - - function drawShape( shape, color ) { - - normal.set( 0, 0, - 1 ).applyQuaternion( quaternion ); - - for ( let j = 0; j < shape.length; j ++ ) { - - vector.copy( shape[ j ] ); - vector.applyQuaternion( quaternion ); - vector.add( point ); - - vertices.push( vector.x, vector.y, vector.z ); - normals.push( normal.x, normal.y, normal.z ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - - } - - normal.set( 0, 0, 1 ).applyQuaternion( quaternion ); - - for ( let j = shape.length - 1; j >= 0; j -- ) { - - vector.copy( shape[ j ] ); - vector.applyQuaternion( quaternion ); - vector.add( point ); - - vertices.push( vector.x, vector.y, vector.z ); - normals.push( normal.x, normal.y, normal.z ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - - } - - } - - const vector1 = new Vector3(); - const vector2 = new Vector3(); - const vector3 = new Vector3(); - const vector4 = new Vector3(); - - const normal1 = new Vector3(); - const normal2 = new Vector3(); - const normal3 = new Vector3(); - const normal4 = new Vector3(); - - function extrudeShape( shape, offset, color ) { - - for ( let j = 0, jl = shape.length; j < jl; j ++ ) { - - const point1 = shape[ j ]; - const point2 = shape[ ( j + 1 ) % jl ]; - - vector1.copy( point1 ).add( offset ); - vector1.applyQuaternion( quaternion ); - vector1.add( point ); - - vector2.copy( point2 ).add( offset ); - vector2.applyQuaternion( quaternion ); - vector2.add( point ); - - vector3.copy( point2 ).add( offset ); - vector3.applyQuaternion( prevQuaternion ); - vector3.add( prevPoint ); - - vector4.copy( point1 ).add( offset ); - vector4.applyQuaternion( prevQuaternion ); - vector4.add( prevPoint ); - - vertices.push( vector1.x, vector1.y, vector1.z ); - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector3.x, vector3.y, vector3.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - // - - normal1.copy( point1 ); - normal1.applyQuaternion( quaternion ); - normal1.normalize(); - - normal2.copy( point2 ); - normal2.applyQuaternion( quaternion ); - normal2.normalize(); - - normal3.copy( point2 ); - normal3.applyQuaternion( prevQuaternion ); - normal3.normalize(); - - normal4.copy( point1 ); - normal4.applyQuaternion( prevQuaternion ); - normal4.normalize(); - - normals.push( normal1.x, normal1.y, normal1.z ); - normals.push( normal2.x, normal2.y, normal2.z ); - normals.push( normal4.x, normal4.y, normal4.z ); - - normals.push( normal2.x, normal2.y, normal2.z ); - normals.push( normal3.x, normal3.y, normal3.z ); - normals.push( normal4.x, normal4.y, normal4.z ); - - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - colors.push( color[ 0 ], color[ 1 ], color[ 2 ] ); - - } - - } - - const offset = new Vector3(); - - for ( let i = 1; i <= divisions; i ++ ) { - - point.copy( curve.getPointAt( i / divisions ) ); - - up.set( 0, 1, 0 ); - - forward.subVectors( point, prevPoint ).normalize(); - right.crossVectors( up, forward ).normalize(); - up.crossVectors( forward, right ); - - const angle = Math.atan2( forward.x, forward.z ); - - quaternion.setFromAxisAngle( up, angle ); - - if ( i % 2 === 0 ) { - - drawShape( step, color2 ); - - } - - extrudeShape( tube1, offset.set( 0, - 0.125, 0 ), color2 ); - extrudeShape( tube2, offset.set( 0.2, 0, 0 ), color1 ); - extrudeShape( tube2, offset.set( - 0.2, 0, 0 ), color1 ); - - prevPoint.copy( point ); - prevQuaternion.copy( quaternion ); - - } - - // console.log( vertices.length ); - - this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) ); - this.setAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) ); - this.setAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) ); - - } - -} - -class RollerCoasterLiftersGeometry extends BufferGeometry { - - constructor( curve, divisions ) { - - super(); - - const vertices = []; - const normals = []; - - const quaternion = new Quaternion(); - - const up = new Vector3( 0, 1, 0 ); - - const point = new Vector3(); - const tangent = new Vector3(); - - // shapes - - const tube1 = [ - new Vector3( 0, 0.05, - 0.05 ), - new Vector3( 0, 0.05, 0.05 ), - new Vector3( 0, - 0.05, 0 ) - ]; - - const tube2 = [ - new Vector3( - 0.05, 0, 0.05 ), - new Vector3( - 0.05, 0, - 0.05 ), - new Vector3( 0.05, 0, 0 ) - ]; - - const tube3 = [ - new Vector3( 0.05, 0, - 0.05 ), - new Vector3( 0.05, 0, 0.05 ), - new Vector3( - 0.05, 0, 0 ) - ]; - - const vector1 = new Vector3(); - const vector2 = new Vector3(); - const vector3 = new Vector3(); - const vector4 = new Vector3(); - - const normal1 = new Vector3(); - const normal2 = new Vector3(); - const normal3 = new Vector3(); - const normal4 = new Vector3(); - - function extrudeShape( shape, fromPoint, toPoint ) { - - for ( let j = 0, jl = shape.length; j < jl; j ++ ) { - - const point1 = shape[ j ]; - const point2 = shape[ ( j + 1 ) % jl ]; - - vector1.copy( point1 ); - vector1.applyQuaternion( quaternion ); - vector1.add( fromPoint ); - - vector2.copy( point2 ); - vector2.applyQuaternion( quaternion ); - vector2.add( fromPoint ); - - vector3.copy( point2 ); - vector3.applyQuaternion( quaternion ); - vector3.add( toPoint ); - - vector4.copy( point1 ); - vector4.applyQuaternion( quaternion ); - vector4.add( toPoint ); - - vertices.push( vector1.x, vector1.y, vector1.z ); - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector3.x, vector3.y, vector3.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - // - - normal1.copy( point1 ); - normal1.applyQuaternion( quaternion ); - normal1.normalize(); - - normal2.copy( point2 ); - normal2.applyQuaternion( quaternion ); - normal2.normalize(); - - normal3.copy( point2 ); - normal3.applyQuaternion( quaternion ); - normal3.normalize(); - - normal4.copy( point1 ); - normal4.applyQuaternion( quaternion ); - normal4.normalize(); - - normals.push( normal1.x, normal1.y, normal1.z ); - normals.push( normal2.x, normal2.y, normal2.z ); - normals.push( normal4.x, normal4.y, normal4.z ); - - normals.push( normal2.x, normal2.y, normal2.z ); - normals.push( normal3.x, normal3.y, normal3.z ); - normals.push( normal4.x, normal4.y, normal4.z ); - - } - - } - - const fromPoint = new Vector3(); - const toPoint = new Vector3(); - - for ( let i = 1; i <= divisions; i ++ ) { - - point.copy( curve.getPointAt( i / divisions ) ); - tangent.copy( curve.getTangentAt( i / divisions ) ); - - const angle = Math.atan2( tangent.x, tangent.z ); - - quaternion.setFromAxisAngle( up, angle ); - - // - - if ( point.y > 10 ) { - - fromPoint.set( - 0.75, - 0.35, 0 ); - fromPoint.applyQuaternion( quaternion ); - fromPoint.add( point ); - - toPoint.set( 0.75, - 0.35, 0 ); - toPoint.applyQuaternion( quaternion ); - toPoint.add( point ); - - extrudeShape( tube1, fromPoint, toPoint ); - - fromPoint.set( - 0.7, - 0.3, 0 ); - fromPoint.applyQuaternion( quaternion ); - fromPoint.add( point ); - - toPoint.set( - 0.7, - point.y, 0 ); - toPoint.applyQuaternion( quaternion ); - toPoint.add( point ); - - extrudeShape( tube2, fromPoint, toPoint ); - - fromPoint.set( 0.7, - 0.3, 0 ); - fromPoint.applyQuaternion( quaternion ); - fromPoint.add( point ); - - toPoint.set( 0.7, - point.y, 0 ); - toPoint.applyQuaternion( quaternion ); - toPoint.add( point ); - - extrudeShape( tube3, fromPoint, toPoint ); - - } else { - - fromPoint.set( 0, - 0.2, 0 ); - fromPoint.applyQuaternion( quaternion ); - fromPoint.add( point ); - - toPoint.set( 0, - point.y, 0 ); - toPoint.applyQuaternion( quaternion ); - toPoint.add( point ); - - extrudeShape( tube3, fromPoint, toPoint ); - - } - - } - - this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) ); - this.setAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) ); - - } - -} - -class RollerCoasterShadowGeometry extends BufferGeometry { - - constructor( curve, divisions ) { - - super(); - - const vertices = []; - - const up = new Vector3( 0, 1, 0 ); - const forward = new Vector3(); - - const quaternion = new Quaternion(); - const prevQuaternion = new Quaternion(); - prevQuaternion.setFromAxisAngle( up, Math.PI / 2 ); - - const point = new Vector3(); - - const prevPoint = new Vector3(); - prevPoint.copy( curve.getPointAt( 0 ) ); - prevPoint.y = 0; - - const vector1 = new Vector3(); - const vector2 = new Vector3(); - const vector3 = new Vector3(); - const vector4 = new Vector3(); - - for ( let i = 1; i <= divisions; i ++ ) { - - point.copy( curve.getPointAt( i / divisions ) ); - point.y = 0; - - forward.subVectors( point, prevPoint ); - - const angle = Math.atan2( forward.x, forward.z ); - - quaternion.setFromAxisAngle( up, angle ); - - vector1.set( - 0.3, 0, 0 ); - vector1.applyQuaternion( quaternion ); - vector1.add( point ); - - vector2.set( 0.3, 0, 0 ); - vector2.applyQuaternion( quaternion ); - vector2.add( point ); - - vector3.set( 0.3, 0, 0 ); - vector3.applyQuaternion( prevQuaternion ); - vector3.add( prevPoint ); - - vector4.set( - 0.3, 0, 0 ); - vector4.applyQuaternion( prevQuaternion ); - vector4.add( prevPoint ); - - vertices.push( vector1.x, vector1.y, vector1.z ); - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - vertices.push( vector2.x, vector2.y, vector2.z ); - vertices.push( vector3.x, vector3.y, vector3.z ); - vertices.push( vector4.x, vector4.y, vector4.z ); - - prevPoint.copy( point ); - prevQuaternion.copy( quaternion ); - - } - - this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) ); - - } - -} - -class SkyGeometry extends BufferGeometry { - - constructor() { - - super(); - - const vertices = []; - - for ( let i = 0; i < 100; i ++ ) { - - const x = Math.random() * 800 - 400; - const y = Math.random() * 50 + 50; - const z = Math.random() * 800 - 400; - - const size = Math.random() * 40 + 20; - - vertices.push( x - size, y, z - size ); - vertices.push( x + size, y, z - size ); - vertices.push( x - size, y, z + size ); - - vertices.push( x + size, y, z - size ); - vertices.push( x + size, y, z + size ); - vertices.push( x - size, y, z + size ); - - } - - - this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) ); - - } - -} - -class TreesGeometry extends BufferGeometry { - - constructor( landscape ) { - - super(); - - const vertices = []; - const colors = []; - - const raycaster = new Raycaster(); - raycaster.ray.direction.set( 0, - 1, 0 ); - - const _color = new Color(); - - for ( let i = 0; i < 2000; i ++ ) { - - const x = Math.random() * 500 - 250; - const z = Math.random() * 500 - 250; - - raycaster.ray.origin.set( x, 50, z ); - - const intersections = raycaster.intersectObject( landscape ); - - if ( intersections.length === 0 ) continue; - - const y = intersections[ 0 ].point.y; - - const height = Math.random() * 5 + 0.5; - - let angle = Math.random() * Math.PI * 2; - - vertices.push( x + Math.sin( angle ), y, z + Math.cos( angle ) ); - vertices.push( x, y + height, z ); - vertices.push( x + Math.sin( angle + Math.PI ), y, z + Math.cos( angle + Math.PI ) ); - - angle += Math.PI / 2; - - vertices.push( x + Math.sin( angle ), y, z + Math.cos( angle ) ); - vertices.push( x, y + height, z ); - vertices.push( x + Math.sin( angle + Math.PI ), y, z + Math.cos( angle + Math.PI ) ); - - const random = Math.random() * 0.1; - - for ( let j = 0; j < 6; j ++ ) { - - _color.setRGB( 0.2 + random, 0.4 + random, 0, SRGBColorSpace ); - - colors.push( _color.r, _color.g, _color.b ); - - } - - } - - this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) ); - this.setAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) ); - - } - -} - -export { RollerCoasterGeometry, RollerCoasterLiftersGeometry, RollerCoasterShadowGeometry, SkyGeometry, TreesGeometry }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Timer.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Timer.js deleted file mode 100644 index 36ff8a7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Timer.js +++ /dev/null @@ -1,128 +0,0 @@ -class Timer { - - constructor() { - - this._previousTime = 0; - this._currentTime = 0; - this._startTime = now(); - - this._delta = 0; - this._elapsed = 0; - - this._timescale = 1; - - // use Page Visibility API to avoid large time delta values - - this._usePageVisibilityAPI = ( typeof document !== 'undefined' && document.hidden !== undefined ); - - if ( this._usePageVisibilityAPI === true ) { - - this._pageVisibilityHandler = handleVisibilityChange.bind( this ); - - document.addEventListener( 'visibilitychange', this._pageVisibilityHandler, false ); - - } - - } - - getDelta() { - - return this._delta / 1000; - - } - - getElapsed() { - - return this._elapsed / 1000; - - } - - getTimescale() { - - return this._timescale; - - } - - setTimescale( timescale ) { - - this._timescale = timescale; - - return this; - - } - - reset() { - - this._currentTime = now() - this._startTime; - - return this; - - } - - dispose() { - - if ( this._usePageVisibilityAPI === true ) { - - document.removeEventListener( 'visibilitychange', this._pageVisibilityHandler ); - - } - - return this; - - } - - update( timestamp ) { - - - if ( this._usePageVisibilityAPI === true && document.hidden === true ) { - - this._delta = 0; - - } else { - - this._previousTime = this._currentTime; - this._currentTime = ( timestamp !== undefined ? timestamp : now() ) - this._startTime; - - this._delta = ( this._currentTime - this._previousTime ) * this._timescale; - this._elapsed += this._delta; // _elapsed is the accumulation of all previous deltas - - } - - return this; - - } - -} - -class FixedTimer extends Timer { - - constructor( fps = 60 ) { - - super(); - this._delta = ( 1 / fps ) * 1000; - - } - - update() { - - this._elapsed += ( this._delta * this._timescale ); // _elapsed is the accumulation of all previous deltas - - return this; - - } - -} - -function now() { - - return ( typeof performance === 'undefined' ? Date : performance ).now(); - -} - -function handleVisibilityChange() { - - if ( document.hidden === false ) this.reset(); - -} - -export { Timer, FixedTimer }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/TubePainter.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/TubePainter.js deleted file mode 100644 index 743b94f..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/TubePainter.js +++ /dev/null @@ -1,202 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - DynamicDrawUsage, - Matrix4, - Mesh, - MeshStandardMaterial, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -function TubePainter() { - - const BUFFER_SIZE = 1000000 * 3; - - const positions = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 ); - positions.usage = DynamicDrawUsage; - - const normals = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 ); - normals.usage = DynamicDrawUsage; - - const colors = new BufferAttribute( new Float32Array( BUFFER_SIZE ), 3 ); - colors.usage = DynamicDrawUsage; - - const geometry = new BufferGeometry(); - geometry.setAttribute( 'position', positions ); - geometry.setAttribute( 'normal', normals ); - geometry.setAttribute( 'color', colors ); - geometry.drawRange.count = 0; - - const material = new MeshStandardMaterial( { - vertexColors: true - } ); - - const mesh = new Mesh( geometry, material ); - mesh.frustumCulled = false; - - // - - function getPoints( size ) { - - const PI2 = Math.PI * 2; - - const sides = 10; - const array = []; - const radius = 0.01 * size; - - for ( let i = 0; i < sides; i ++ ) { - - const angle = ( i / sides ) * PI2; - array.push( new Vector3( Math.sin( angle ) * radius, Math.cos( angle ) * radius, 0 ) ); - - } - - return array; - - } - - // - - const vector1 = new Vector3(); - const vector2 = new Vector3(); - const vector3 = new Vector3(); - const vector4 = new Vector3(); - - const color = new Color( 0xffffff ); - let size = 1; - - function stroke( position1, position2, matrix1, matrix2 ) { - - if ( position1.distanceToSquared( position2 ) === 0 ) return; - - let count = geometry.drawRange.count; - - const points = getPoints( size ); - - for ( let i = 0, il = points.length; i < il; i ++ ) { - - const vertex1 = points[ i ]; - const vertex2 = points[ ( i + 1 ) % il ]; - - // positions - - vector1.copy( vertex1 ).applyMatrix4( matrix2 ).add( position2 ); - vector2.copy( vertex2 ).applyMatrix4( matrix2 ).add( position2 ); - vector3.copy( vertex2 ).applyMatrix4( matrix1 ).add( position1 ); - vector4.copy( vertex1 ).applyMatrix4( matrix1 ).add( position1 ); - - vector1.toArray( positions.array, ( count + 0 ) * 3 ); - vector2.toArray( positions.array, ( count + 1 ) * 3 ); - vector4.toArray( positions.array, ( count + 2 ) * 3 ); - - vector2.toArray( positions.array, ( count + 3 ) * 3 ); - vector3.toArray( positions.array, ( count + 4 ) * 3 ); - vector4.toArray( positions.array, ( count + 5 ) * 3 ); - - // normals - - vector1.copy( vertex1 ).applyMatrix4( matrix2 ).normalize(); - vector2.copy( vertex2 ).applyMatrix4( matrix2 ).normalize(); - vector3.copy( vertex2 ).applyMatrix4( matrix1 ).normalize(); - vector4.copy( vertex1 ).applyMatrix4( matrix1 ).normalize(); - - vector1.toArray( normals.array, ( count + 0 ) * 3 ); - vector2.toArray( normals.array, ( count + 1 ) * 3 ); - vector4.toArray( normals.array, ( count + 2 ) * 3 ); - - vector2.toArray( normals.array, ( count + 3 ) * 3 ); - vector3.toArray( normals.array, ( count + 4 ) * 3 ); - vector4.toArray( normals.array, ( count + 5 ) * 3 ); - - // colors - - color.toArray( colors.array, ( count + 0 ) * 3 ); - color.toArray( colors.array, ( count + 1 ) * 3 ); - color.toArray( colors.array, ( count + 2 ) * 3 ); - - color.toArray( colors.array, ( count + 3 ) * 3 ); - color.toArray( colors.array, ( count + 4 ) * 3 ); - color.toArray( colors.array, ( count + 5 ) * 3 ); - - count += 6; - - } - - geometry.drawRange.count = count; - - } - - // - - const up = new Vector3( 0, 1, 0 ); - - const point1 = new Vector3(); - const point2 = new Vector3(); - - const matrix1 = new Matrix4(); - const matrix2 = new Matrix4(); - - function moveTo( position ) { - - point1.copy( position ); - matrix1.lookAt( point2, point1, up ); - - point2.copy( position ); - matrix2.copy( matrix1 ); - - } - - function lineTo( position ) { - - point1.copy( position ); - matrix1.lookAt( point2, point1, up ); - - stroke( point1, point2, matrix1, matrix2 ); - - point2.copy( point1 ); - matrix2.copy( matrix1 ); - - } - - function setSize( value ) { - - size = value; - - } - - // - - let count = 0; - - function update() { - - const start = count; - const end = geometry.drawRange.count; - - if ( start === end ) return; - - positions.addUpdateRange( start * 3, ( end - start ) * 3 ); - positions.needsUpdate = true; - - normals.addUpdateRange( start * 3, ( end - start ) * 3 ); - normals.needsUpdate = true; - - colors.addUpdateRange( start * 3, ( end - start ) * 3 ); - colors.needsUpdate = true; - - count = geometry.drawRange.count; - - } - - return { - mesh: mesh, - moveTo: moveTo, - lineTo: lineTo, - setSize: setSize, - update: update - }; - -} - -export { TubePainter }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Volume.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Volume.js deleted file mode 100644 index 23d0859..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/Volume.js +++ /dev/null @@ -1,473 +0,0 @@ -import { - Matrix3, - Matrix4, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import { VolumeSlice } from './VolumeSlice.js'; - -/** - * This class had been written to handle the output of the NRRD loader. - * It contains a volume of data and informations about it. - * For now it only handles 3 dimensional data. - * See the webgl_loader_nrrd.html example and the loaderNRRD.js file to see how to use this class. - * @class - * @param {number} xLength Width of the volume - * @param {number} yLength Length of the volume - * @param {number} zLength Depth of the volume - * @param {string} type The type of data (uint8, uint16, ...) - * @param {ArrayBuffer} arrayBuffer The buffer with volume data - */ -class Volume { - - constructor( xLength, yLength, zLength, type, arrayBuffer ) { - - if ( xLength !== undefined ) { - - /** - * @member {number} xLength Width of the volume in the IJK coordinate system - */ - this.xLength = Number( xLength ) || 1; - /** - * @member {number} yLength Height of the volume in the IJK coordinate system - */ - this.yLength = Number( yLength ) || 1; - /** - * @member {number} zLength Depth of the volume in the IJK coordinate system - */ - this.zLength = Number( zLength ) || 1; - /** - * @member {Array} The order of the Axis dictated by the NRRD header - */ - this.axisOrder = [ 'x', 'y', 'z' ]; - /** - * @member {TypedArray} data Data of the volume - */ - - switch ( type ) { - - case 'Uint8' : - case 'uint8' : - case 'uchar' : - case 'unsigned char' : - case 'uint8_t' : - this.data = new Uint8Array( arrayBuffer ); - break; - case 'Int8' : - case 'int8' : - case 'signed char' : - case 'int8_t' : - this.data = new Int8Array( arrayBuffer ); - break; - case 'Int16' : - case 'int16' : - case 'short' : - case 'short int' : - case 'signed short' : - case 'signed short int' : - case 'int16_t' : - this.data = new Int16Array( arrayBuffer ); - break; - case 'Uint16' : - case 'uint16' : - case 'ushort' : - case 'unsigned short' : - case 'unsigned short int' : - case 'uint16_t' : - this.data = new Uint16Array( arrayBuffer ); - break; - case 'Int32' : - case 'int32' : - case 'int' : - case 'signed int' : - case 'int32_t' : - this.data = new Int32Array( arrayBuffer ); - break; - case 'Uint32' : - case 'uint32' : - case 'uint' : - case 'unsigned int' : - case 'uint32_t' : - this.data = new Uint32Array( arrayBuffer ); - break; - case 'longlong' : - case 'long long' : - case 'long long int' : - case 'signed long long' : - case 'signed long long int' : - case 'int64' : - case 'int64_t' : - case 'ulonglong' : - case 'unsigned long long' : - case 'unsigned long long int' : - case 'uint64' : - case 'uint64_t' : - throw new Error( 'Error in Volume constructor : this type is not supported in JavaScript' ); - break; - case 'Float32' : - case 'float32' : - case 'float' : - this.data = new Float32Array( arrayBuffer ); - break; - case 'Float64' : - case 'float64' : - case 'double' : - this.data = new Float64Array( arrayBuffer ); - break; - default : - this.data = new Uint8Array( arrayBuffer ); - - } - - if ( this.data.length !== this.xLength * this.yLength * this.zLength ) { - - throw new Error( 'Error in Volume constructor, lengths are not matching arrayBuffer size' ); - - } - - } - - /** - * @member {Array} spacing Spacing to apply to the volume from IJK to RAS coordinate system - */ - this.spacing = [ 1, 1, 1 ]; - /** - * @member {Array} offset Offset of the volume in the RAS coordinate system - */ - this.offset = [ 0, 0, 0 ]; - /** - * @member {Martrix3} matrix The IJK to RAS matrix - */ - this.matrix = new Matrix3(); - this.matrix.identity(); - /** - * @member {Martrix3} inverseMatrix The RAS to IJK matrix - */ - /** - * @member {number} lowerThreshold The voxels with values under this threshold won't appear in the slices. - * If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume - */ - let lowerThreshold = - Infinity; - Object.defineProperty( this, 'lowerThreshold', { - get: function () { - - return lowerThreshold; - - }, - set: function ( value ) { - - lowerThreshold = value; - this.sliceList.forEach( function ( slice ) { - - slice.geometryNeedsUpdate = true; - - } ); - - } - } ); - /** - * @member {number} upperThreshold The voxels with values over this threshold won't appear in the slices. - * If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume - */ - let upperThreshold = Infinity; - Object.defineProperty( this, 'upperThreshold', { - get: function () { - - return upperThreshold; - - }, - set: function ( value ) { - - upperThreshold = value; - this.sliceList.forEach( function ( slice ) { - - slice.geometryNeedsUpdate = true; - - } ); - - } - } ); - - - /** - * @member {Array} sliceList The list of all the slices associated to this volume - */ - this.sliceList = []; - - - /** - * @member {boolean} segmentation in segmentation mode, it can load 16-bits nrrds correctly - */ - this.segmentation = false; - - - /** - * @member {Array} RASDimensions This array holds the dimensions of the volume in the RAS space - */ - - - - } - - /** - * @member {Function} getData Shortcut for data[access(i,j,k)] - * @memberof Volume - * @param {number} i First coordinate - * @param {number} j Second coordinate - * @param {number} k Third coordinate - * @returns {number} value in the data array - */ - getData( i, j, k ) { - - return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ]; - - } - - /** - * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system - * @memberof Volume - * @param {number} i First coordinate - * @param {number} j Second coordinate - * @param {number} k Third coordinate - * @returns {number} index - */ - access( i, j, k ) { - - return k * this.xLength * this.yLength + j * this.xLength + i; - - } - - /** - * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data - * @memberof Volume - * @param {number} index index of the voxel - * @returns {Array} [x,y,z] - */ - reverseAccess( index ) { - - const z = Math.floor( index / ( this.yLength * this.xLength ) ); - const y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength ); - const x = index - z * this.yLength * this.xLength - y * this.xLength; - return [ x, y, z ]; - - } - - /** - * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced - * @memberof Volume - * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters : - * value of the voxel - * index of the voxel - * the data (TypedArray) - * @param {Object} context You can specify a context in which call the function, default if this Volume - * @returns {Volume} this - */ - map( functionToMap, context ) { - - const length = this.data.length; - context = context || this; - - for ( let i = 0; i < length; i ++ ) { - - this.data[ i ] = functionToMap.call( context, this.data[ i ], i, this.data ); - - } - - return this; - - } - - /** - * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system. - * @memberof Volume - * @param {string} axis the normal axis to the slice 'x' 'y' or 'z' - * @param {number} index the index of the slice - * @returns {Object} an object containing all the usefull information on the geometry of the slice - */ - extractPerpendicularPlane( axis, RASIndex ) { - - let firstSpacing, - secondSpacing, - positionOffset, - IJKIndex; - - const axisInIJK = new Vector3(), - firstDirection = new Vector3(), - secondDirection = new Vector3(), - planeMatrix = ( new Matrix4() ).identity(), - volume = this; - - const dimensions = new Vector3( this.xLength, this.yLength, this.zLength ); - - - switch ( axis ) { - - case 'x' : - axisInIJK.set( 1, 0, 0 ); - firstDirection.set( 0, 0, - 1 ); - secondDirection.set( 0, - 1, 0 ); - firstSpacing = this.spacing[ this.axisOrder.indexOf( 'z' ) ]; - secondSpacing = this.spacing[ this.axisOrder.indexOf( 'y' ) ]; - IJKIndex = new Vector3( RASIndex, 0, 0 ); - - planeMatrix.multiply( ( new Matrix4() ).makeRotationY( Math.PI / 2 ) ); - positionOffset = ( volume.RASDimensions[ 0 ] - 1 ) / 2; - planeMatrix.setPosition( new Vector3( RASIndex - positionOffset, 0, 0 ) ); - break; - case 'y' : - axisInIJK.set( 0, 1, 0 ); - firstDirection.set( 1, 0, 0 ); - secondDirection.set( 0, 0, 1 ); - firstSpacing = this.spacing[ this.axisOrder.indexOf( 'x' ) ]; - secondSpacing = this.spacing[ this.axisOrder.indexOf( 'z' ) ]; - IJKIndex = new Vector3( 0, RASIndex, 0 ); - - planeMatrix.multiply( ( new Matrix4() ).makeRotationX( - Math.PI / 2 ) ); - positionOffset = ( volume.RASDimensions[ 1 ] - 1 ) / 2; - planeMatrix.setPosition( new Vector3( 0, RASIndex - positionOffset, 0 ) ); - break; - case 'z' : - default : - axisInIJK.set( 0, 0, 1 ); - firstDirection.set( 1, 0, 0 ); - secondDirection.set( 0, - 1, 0 ); - firstSpacing = this.spacing[ this.axisOrder.indexOf( 'x' ) ]; - secondSpacing = this.spacing[ this.axisOrder.indexOf( 'y' ) ]; - IJKIndex = new Vector3( 0, 0, RASIndex ); - - positionOffset = ( volume.RASDimensions[ 2 ] - 1 ) / 2; - planeMatrix.setPosition( new Vector3( 0, 0, RASIndex - positionOffset ) ); - break; - - } - - if ( ! this.segmentation ) { - - firstDirection.applyMatrix4( volume.inverseMatrix ).normalize(); - secondDirection.applyMatrix4( volume.inverseMatrix ).normalize(); - axisInIJK.applyMatrix4( volume.inverseMatrix ).normalize(); - - } - - firstDirection.arglet = 'i'; - secondDirection.arglet = 'j'; - const iLength = Math.floor( Math.abs( firstDirection.dot( dimensions ) ) ); - const jLength = Math.floor( Math.abs( secondDirection.dot( dimensions ) ) ); - const planeWidth = Math.abs( iLength * firstSpacing ); - const planeHeight = Math.abs( jLength * secondSpacing ); - - IJKIndex = Math.abs( Math.round( IJKIndex.applyMatrix4( volume.inverseMatrix ).dot( axisInIJK ) ) ); - const base = [ new Vector3( 1, 0, 0 ), new Vector3( 0, 1, 0 ), new Vector3( 0, 0, 1 ) ]; - const iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) { - - return Math.abs( x.dot( base[ 0 ] ) ) > 0.9; - - } ); - const jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) { - - return Math.abs( x.dot( base[ 1 ] ) ) > 0.9; - - } ); - const kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) { - - return Math.abs( x.dot( base[ 2 ] ) ) > 0.9; - - } ); - - function sliceAccess( i, j ) { - - const si = ( iDirection === axisInIJK ) ? IJKIndex : ( iDirection.arglet === 'i' ? i : j ); - const sj = ( jDirection === axisInIJK ) ? IJKIndex : ( jDirection.arglet === 'i' ? i : j ); - const sk = ( kDirection === axisInIJK ) ? IJKIndex : ( kDirection.arglet === 'i' ? i : j ); - - // invert indices if necessary - - const accessI = ( iDirection.dot( base[ 0 ] ) > 0 ) ? si : ( volume.xLength - 1 ) - si; - const accessJ = ( jDirection.dot( base[ 1 ] ) > 0 ) ? sj : ( volume.yLength - 1 ) - sj; - const accessK = ( kDirection.dot( base[ 2 ] ) > 0 ) ? sk : ( volume.zLength - 1 ) - sk; - - return volume.access( accessI, accessJ, accessK ); - - } - - return { - iLength: iLength, - jLength: jLength, - sliceAccess: sliceAccess, - matrix: planeMatrix, - planeWidth: planeWidth, - planeHeight: planeHeight - }; - - } - - /** - * @member {Function} extractSlice Returns a slice corresponding to the given axis and index - * The coordinate are given in the Right Anterior Superior coordinate format - * @memberof Volume - * @param {string} axis the normal axis to the slice 'x' 'y' or 'z' - * @param {number} index the index of the slice - * @returns {VolumeSlice} the extracted slice - */ - extractSlice( axis, index ) { - - const slice = new VolumeSlice( this, index, axis ); - this.sliceList.push( slice ); - return slice; - - } - - /** - * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume - * @see VolumeSlice.repaint - * @memberof Volume - * @returns {Volume} this - */ - repaintAllSlices() { - - this.sliceList.forEach( function ( slice ) { - - slice.repaint(); - - } ); - - return this; - - } - - /** - * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume - * @memberof Volume - * @returns {Array} [min,max] - */ - computeMinMax() { - - let min = Infinity; - let max = - Infinity; - - // buffer the length - const datasize = this.data.length; - - let i = 0; - - for ( i = 0; i < datasize; i ++ ) { - - if ( ! isNaN( this.data[ i ] ) ) { - - const value = this.data[ i ]; - min = Math.min( min, value ); - max = Math.max( max, value ); - - } - - } - - this.min = min; - this.max = max; - - return [ min, max ]; - - } - -} - -export { Volume }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/VolumeSlice.js b/docker-compose/requirements/nginx/static/javascript/taaaa/misc/VolumeSlice.js deleted file mode 100644 index c0c3915..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/misc/VolumeSlice.js +++ /dev/null @@ -1,229 +0,0 @@ -import { - ClampToEdgeWrapping, - DoubleSide, - LinearFilter, - Mesh, - MeshBasicMaterial, - PlaneGeometry, - Texture, - SRGBColorSpace -} from '/static/javascript/three/build/three.module.js'; - -/** - * This class has been made to hold a slice of a volume data - * @class - * @param {Volume} volume The associated volume - * @param {number} [index=0] The index of the slice - * @param {string} [axis='z'] For now only 'x', 'y' or 'z' but later it will change to a normal vector - * @see Volume - */ -class VolumeSlice { - - constructor( volume, index, axis ) { - - const slice = this; - /** - * @member {Volume} volume The associated volume - */ - this.volume = volume; - /** - * @member {Number} index The index of the slice, if changed, will automatically call updateGeometry at the next repaint - */ - index = index || 0; - Object.defineProperty( this, 'index', { - get: function () { - - return index; - - }, - set: function ( value ) { - - index = value; - slice.geometryNeedsUpdate = true; - return index; - - } - } ); - /** - * @member {String} axis The normal axis - */ - this.axis = axis || 'z'; - - /** - * @member {HTMLCanvasElement} canvas The final canvas used for the texture - */ - /** - * @member {CanvasRenderingContext2D} ctx Context of the canvas - */ - this.canvas = document.createElement( 'canvas' ); - /** - * @member {HTMLCanvasElement} canvasBuffer The intermediary canvas used to paint the data - */ - /** - * @member {CanvasRenderingContext2D} ctxBuffer Context of the canvas buffer - */ - this.canvasBuffer = document.createElement( 'canvas' ); - this.updateGeometry(); - - - const canvasMap = new Texture( this.canvas ); - canvasMap.minFilter = LinearFilter; - canvasMap.wrapS = canvasMap.wrapT = ClampToEdgeWrapping; - canvasMap.colorSpace = SRGBColorSpace; - const material = new MeshBasicMaterial( { map: canvasMap, side: DoubleSide, transparent: true } ); - /** - * @member {Mesh} mesh The mesh ready to get used in the scene - */ - this.mesh = new Mesh( this.geometry, material ); - this.mesh.matrixAutoUpdate = false; - /** - * @member {Boolean} geometryNeedsUpdate If set to true, updateGeometry will be triggered at the next repaint - */ - this.geometryNeedsUpdate = true; - this.repaint(); - - /** - * @member {Number} iLength Width of slice in the original coordinate system, corresponds to the width of the buffer canvas - */ - - /** - * @member {Number} jLength Height of slice in the original coordinate system, corresponds to the height of the buffer canvas - */ - - /** - * @member {Function} sliceAccess Function that allow the slice to access right data - * @see Volume.extractPerpendicularPlane - * @param {Number} i The first coordinate - * @param {Number} j The second coordinate - * @returns {Number} the index corresponding to the voxel in volume.data of the given position in the slice - */ - - - } - - /** - * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true - * @memberof VolumeSlice - */ - repaint() { - - if ( this.geometryNeedsUpdate ) { - - this.updateGeometry(); - - } - - const iLength = this.iLength, - jLength = this.jLength, - sliceAccess = this.sliceAccess, - volume = this.volume, - canvas = this.canvasBuffer, - ctx = this.ctxBuffer; - - - // get the imageData and pixel array from the canvas - const imgData = ctx.getImageData( 0, 0, iLength, jLength ); - const data = imgData.data; - const volumeData = volume.data; - const upperThreshold = volume.upperThreshold; - const lowerThreshold = volume.lowerThreshold; - const windowLow = volume.windowLow; - const windowHigh = volume.windowHigh; - - // manipulate some pixel elements - let pixelCount = 0; - - if ( volume.dataType === 'label' ) { - - //this part is currently useless but will be used when colortables will be handled - for ( let j = 0; j < jLength; j ++ ) { - - for ( let i = 0; i < iLength; i ++ ) { - - let label = volumeData[ sliceAccess( i, j ) ]; - label = label >= this.colorMap.length ? ( label % this.colorMap.length ) + 1 : label; - const color = this.colorMap[ label ]; - data[ 4 * pixelCount ] = ( color >> 24 ) & 0xff; - data[ 4 * pixelCount + 1 ] = ( color >> 16 ) & 0xff; - data[ 4 * pixelCount + 2 ] = ( color >> 8 ) & 0xff; - data[ 4 * pixelCount + 3 ] = color & 0xff; - pixelCount ++; - - } - - } - - } else { - - for ( let j = 0; j < jLength; j ++ ) { - - for ( let i = 0; i < iLength; i ++ ) { - - let value = volumeData[ sliceAccess( i, j ) ]; - let alpha = 0xff; - //apply threshold - alpha = upperThreshold >= value ? ( lowerThreshold <= value ? alpha : 0 ) : 0; - //apply window level - value = Math.floor( 255 * ( value - windowLow ) / ( windowHigh - windowLow ) ); - value = value > 255 ? 255 : ( value < 0 ? 0 : value | 0 ); - - data[ 4 * pixelCount ] = value; - data[ 4 * pixelCount + 1 ] = value; - data[ 4 * pixelCount + 2 ] = value; - data[ 4 * pixelCount + 3 ] = alpha; - pixelCount ++; - - } - - } - - } - - ctx.putImageData( imgData, 0, 0 ); - this.ctx.drawImage( canvas, 0, 0, iLength, jLength, 0, 0, this.canvas.width, this.canvas.height ); - - - this.mesh.material.map.needsUpdate = true; - - } - - /** - * @member {Function} Refresh the geometry according to axis and index - * @see Volume.extractPerpendicularPlane - * @memberof VolumeSlice - */ - updateGeometry() { - - const extracted = this.volume.extractPerpendicularPlane( this.axis, this.index ); - this.sliceAccess = extracted.sliceAccess; - this.jLength = extracted.jLength; - this.iLength = extracted.iLength; - this.matrix = extracted.matrix; - - this.canvas.width = extracted.planeWidth; - this.canvas.height = extracted.planeHeight; - this.canvasBuffer.width = this.iLength; - this.canvasBuffer.height = this.jLength; - this.ctx = this.canvas.getContext( '2d' ); - this.ctxBuffer = this.canvasBuffer.getContext( '2d' ); - - if ( this.geometry ) this.geometry.dispose(); // dispose existing geometry - - this.geometry = new PlaneGeometry( extracted.planeWidth, extracted.planeHeight ); - - if ( this.mesh ) { - - this.mesh.geometry = this.geometry; - //reset mesh matrix - this.mesh.matrix.identity(); - this.mesh.applyMatrix4( this.matrix ); - - } - - this.geometryNeedsUpdate = false; - - } - -} - -export { VolumeSlice }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/mmdparser.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/mmdparser.module.js deleted file mode 100644 index 5a587f1..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/mmdparser.module.js +++ /dev/null @@ -1,11530 +0,0 @@ -/** - * @author Takahiro / https://github.com/takahirox - * - * Simple CharsetEncoder. - */ - -function CharsetEncoder() { -} - -/* - * Converts from Shift_JIS Uint8Array data to Unicode strings. - */ -CharsetEncoder.prototype.s2u = function(uint8Array) { - var t = this.s2uTable; - var str = ''; - var p = 0; - - while(p < uint8Array.length) { - var key = uint8Array[p++]; - - if(! ((key >= 0x00 && key <= 0x7e) || - (key >= 0xa1 && key <= 0xdf)) && - p < uint8Array.length) { - key = (key << 8) | uint8Array[p++]; - } - - if(t[key] === undefined) { - console.error('unknown char code ' + key + '.'); - return str; - } - - str += String.fromCharCode(t[key]); - } - - return str; -}; - -CharsetEncoder.prototype.s2uTable = { -0:0, -1:1, -2:2, -3:3, -4:4, -5:5, -6:6, -7:7, -8:8, -9:9, -10:10, -11:11, -12:12, -13:13, -14:14, -15:15, -16:16, -17:17, -18:18, -19:19, -20:20, -21:21, -22:22, -23:23, -24:24, -25:25, -26:26, -27:27, -28:28, -29:29, -30:30, -31:31, -32:32, -33:33, -34:34, -35:35, -36:36, -37:37, -38:38, -39:39, -40:40, -41:41, -42:42, -43:43, -44:44, -45:45, -46:46, -47:47, -48:48, -49:49, -50:50, -51:51, -52:52, -53:53, -54:54, -55:55, -56:56, -57:57, -58:58, -59:59, -60:60, -61:61, -62:62, -63:63, -64:64, -65:65, -66:66, -67:67, -68:68, -69:69, -70:70, -71:71, -72:72, -73:73, -74:74, -75:75, -76:76, -77:77, -78:78, -79:79, -80:80, -81:81, -82:82, -83:83, -84:84, -85:85, -86:86, -87:87, -88:88, -89:89, -90:90, -91:91, -92:92, -93:93, -94:94, -95:95, -96:96, -97:97, -98:98, -99:99, -100:100, -101:101, -102:102, -103:103, -104:104, -105:105, -106:106, -107:107, -108:108, -109:109, -110:110, -111:111, -112:112, -113:113, -114:114, -115:115, -116:116, -117:117, -118:118, -119:119, -120:120, -121:121, -122:122, -123:123, -124:124, -125:125, -126:126, -161:65377, -162:65378, -163:65379, -164:65380, -165:65381, -166:65382, -167:65383, -168:65384, -169:65385, -170:65386, -171:65387, -172:65388, -173:65389, -174:65390, -175:65391, -176:65392, -177:65393, -178:65394, -179:65395, -180:65396, -181:65397, -182:65398, -183:65399, -184:65400, -185:65401, -186:65402, -187:65403, -188:65404, -189:65405, -190:65406, -191:65407, -192:65408, -193:65409, -194:65410, -195:65411, -196:65412, -197:65413, -198:65414, -199:65415, -200:65416, -201:65417, -202:65418, -203:65419, -204:65420, -205:65421, -206:65422, -207:65423, -208:65424, -209:65425, -210:65426, -211:65427, -212:65428, -213:65429, -214:65430, -215:65431, -216:65432, -217:65433, -218:65434, -219:65435, -220:65436, -221:65437, -222:65438, -223:65439, -33088:12288, -33089:12289, -33090:12290, -33091:65292, -33092:65294, -33093:12539, -33094:65306, -33095:65307, -33096:65311, -33097:65281, -33098:12443, -33099:12444, -33100:180, -33101:65344, -33102:168, -33103:65342, -33104:65507, -33105:65343, -33106:12541, -33107:12542, -33108:12445, -33109:12446, -33110:12291, -33111:20189, -33112:12293, -33113:12294, -33114:12295, -33115:12540, -33116:8213, -33117:8208, -33118:65295, -33119:65340, -33120:65374, -33121:8741, -33122:65372, -33123:8230, -33124:8229, -33125:8216, -33126:8217, -33127:8220, -33128:8221, -33129:65288, -33130:65289, -33131:12308, -33132:12309, -33133:65339, -33134:65341, -33135:65371, -33136:65373, -33137:12296, -33138:12297, -33139:12298, -33140:12299, -33141:12300, -33142:12301, -33143:12302, -33144:12303, -33145:12304, -33146:12305, -33147:65291, -33148:65293, -33149:177, -33150:215, -33152:247, -33153:65309, -33154:8800, -33155:65308, -33156:65310, -33157:8806, -33158:8807, -33159:8734, -33160:8756, -33161:9794, -33162:9792, -33163:176, -33164:8242, -33165:8243, -33166:8451, -33167:65509, -33168:65284, -33169:65504, -33170:65505, -33171:65285, -33172:65283, -33173:65286, -33174:65290, -33175:65312, -33176:167, -33177:9734, -33178:9733, -33179:9675, -33180:9679, -33181:9678, -33182:9671, -33183:9670, -33184:9633, -33185:9632, -33186:9651, -33187:9650, -33188:9661, -33189:9660, -33190:8251, -33191:12306, -33192:8594, -33193:8592, -33194:8593, -33195:8595, -33196:12307, -33208:8712, -33209:8715, -33210:8838, -33211:8839, -33212:8834, -33213:8835, -33214:8746, -33215:8745, -33224:8743, -33225:8744, -33226:65506, -33227:8658, -33228:8660, -33229:8704, -33230:8707, -33242:8736, -33243:8869, -33244:8978, -33245:8706, -33246:8711, -33247:8801, -33248:8786, -33249:8810, -33250:8811, -33251:8730, -33252:8765, -33253:8733, -33254:8757, -33255:8747, -33256:8748, -33264:8491, -33265:8240, -33266:9839, -33267:9837, -33268:9834, -33269:8224, -33270:8225, -33271:182, -33276:9711, -33359:65296, -33360:65297, -33361:65298, -33362:65299, -33363:65300, -33364:65301, -33365:65302, -33366:65303, -33367:65304, -33368:65305, -33376:65313, -33377:65314, -33378:65315, -33379:65316, -33380:65317, -33381:65318, -33382:65319, -33383:65320, -33384:65321, -33385:65322, -33386:65323, -33387:65324, -33388:65325, -33389:65326, -33390:65327, -33391:65328, -33392:65329, -33393:65330, -33394:65331, -33395:65332, -33396:65333, -33397:65334, -33398:65335, -33399:65336, -33400:65337, -33401:65338, -33409:65345, -33410:65346, -33411:65347, -33412:65348, -33413:65349, -33414:65350, -33415:65351, -33416:65352, -33417:65353, -33418:65354, -33419:65355, -33420:65356, -33421:65357, -33422:65358, -33423:65359, -33424:65360, -33425:65361, -33426:65362, -33427:65363, -33428:65364, -33429:65365, -33430:65366, -33431:65367, -33432:65368, -33433:65369, -33434:65370, -33439:12353, -33440:12354, -33441:12355, -33442:12356, -33443:12357, -33444:12358, -33445:12359, -33446:12360, -33447:12361, -33448:12362, -33449:12363, -33450:12364, -33451:12365, -33452:12366, -33453:12367, -33454:12368, -33455:12369, -33456:12370, -33457:12371, -33458:12372, -33459:12373, -33460:12374, -33461:12375, -33462:12376, -33463:12377, -33464:12378, -33465:12379, -33466:12380, -33467:12381, -33468:12382, -33469:12383, -33470:12384, -33471:12385, -33472:12386, -33473:12387, -33474:12388, -33475:12389, -33476:12390, -33477:12391, -33478:12392, -33479:12393, -33480:12394, -33481:12395, -33482:12396, -33483:12397, -33484:12398, -33485:12399, -33486:12400, -33487:12401, -33488:12402, -33489:12403, -33490:12404, -33491:12405, -33492:12406, -33493:12407, -33494:12408, -33495:12409, -33496:12410, -33497:12411, -33498:12412, -33499:12413, -33500:12414, -33501:12415, -33502:12416, -33503:12417, -33504:12418, -33505:12419, -33506:12420, -33507:12421, -33508:12422, -33509:12423, -33510:12424, -33511:12425, -33512:12426, -33513:12427, -33514:12428, -33515:12429, -33516:12430, -33517:12431, -33518:12432, -33519:12433, -33520:12434, -33521:12435, -33600:12449, -33601:12450, -33602:12451, -33603:12452, -33604:12453, -33605:12454, -33606:12455, -33607:12456, -33608:12457, -33609:12458, -33610:12459, -33611:12460, -33612:12461, -33613:12462, -33614:12463, -33615:12464, -33616:12465, -33617:12466, -33618:12467, -33619:12468, -33620:12469, -33621:12470, -33622:12471, -33623:12472, -33624:12473, -33625:12474, -33626:12475, -33627:12476, -33628:12477, -33629:12478, -33630:12479, -33631:12480, -33632:12481, -33633:12482, -33634:12483, -33635:12484, -33636:12485, -33637:12486, -33638:12487, -33639:12488, -33640:12489, -33641:12490, -33642:12491, -33643:12492, -33644:12493, -33645:12494, -33646:12495, -33647:12496, -33648:12497, -33649:12498, -33650:12499, -33651:12500, -33652:12501, -33653:12502, -33654:12503, -33655:12504, -33656:12505, -33657:12506, -33658:12507, -33659:12508, -33660:12509, -33661:12510, -33662:12511, -33664:12512, -33665:12513, -33666:12514, -33667:12515, -33668:12516, -33669:12517, -33670:12518, -33671:12519, -33672:12520, -33673:12521, -33674:12522, -33675:12523, -33676:12524, -33677:12525, -33678:12526, -33679:12527, -33680:12528, -33681:12529, -33682:12530, -33683:12531, -33684:12532, -33685:12533, -33686:12534, -33695:913, -33696:914, -33697:915, -33698:916, -33699:917, -33700:918, -33701:919, -33702:920, -33703:921, -33704:922, -33705:923, -33706:924, -33707:925, -33708:926, -33709:927, -33710:928, -33711:929, -33712:931, -33713:932, -33714:933, -33715:934, -33716:935, -33717:936, -33718:937, -33727:945, -33728:946, -33729:947, -33730:948, -33731:949, -33732:950, -33733:951, -33734:952, -33735:953, -33736:954, -33737:955, -33738:956, -33739:957, -33740:958, -33741:959, -33742:960, -33743:961, -33744:963, -33745:964, -33746:965, -33747:966, -33748:967, -33749:968, -33750:969, -33856:1040, -33857:1041, -33858:1042, -33859:1043, -33860:1044, -33861:1045, -33862:1025, -33863:1046, -33864:1047, -33865:1048, -33866:1049, -33867:1050, -33868:1051, -33869:1052, -33870:1053, -33871:1054, -33872:1055, -33873:1056, -33874:1057, -33875:1058, -33876:1059, -33877:1060, -33878:1061, -33879:1062, -33880:1063, -33881:1064, -33882:1065, -33883:1066, -33884:1067, -33885:1068, -33886:1069, -33887:1070, -33888:1071, -33904:1072, -33905:1073, -33906:1074, -33907:1075, -33908:1076, -33909:1077, -33910:1105, -33911:1078, -33912:1079, -33913:1080, -33914:1081, -33915:1082, -33916:1083, -33917:1084, -33918:1085, -33920:1086, -33921:1087, -33922:1088, -33923:1089, -33924:1090, -33925:1091, -33926:1092, -33927:1093, -33928:1094, -33929:1095, -33930:1096, -33931:1097, -33932:1098, -33933:1099, -33934:1100, -33935:1101, -33936:1102, -33937:1103, -33951:9472, -33952:9474, -33953:9484, -33954:9488, -33955:9496, -33956:9492, -33957:9500, -33958:9516, -33959:9508, -33960:9524, -33961:9532, -33962:9473, -33963:9475, -33964:9487, -33965:9491, -33966:9499, -33967:9495, -33968:9507, -33969:9523, -33970:9515, -33971:9531, -33972:9547, -33973:9504, -33974:9519, -33975:9512, -33976:9527, -33977:9535, -33978:9501, -33979:9520, -33980:9509, -33981:9528, -33982:9538, -34624:9312, -34625:9313, -34626:9314, -34627:9315, -34628:9316, -34629:9317, -34630:9318, -34631:9319, -34632:9320, -34633:9321, -34634:9322, -34635:9323, -34636:9324, -34637:9325, -34638:9326, -34639:9327, -34640:9328, -34641:9329, -34642:9330, -34643:9331, -34644:8544, -34645:8545, -34646:8546, -34647:8547, -34648:8548, -34649:8549, -34650:8550, -34651:8551, -34652:8552, -34653:8553, -34655:13129, -34656:13076, -34657:13090, -34658:13133, -34659:13080, -34660:13095, -34661:13059, -34662:13110, -34663:13137, -34664:13143, -34665:13069, -34666:13094, -34667:13091, -34668:13099, -34669:13130, -34670:13115, -34671:13212, -34672:13213, -34673:13214, -34674:13198, -34675:13199, -34676:13252, -34677:13217, -34686:13179, -34688:12317, -34689:12319, -34690:8470, -34691:13261, -34692:8481, -34693:12964, -34694:12965, -34695:12966, -34696:12967, -34697:12968, -34698:12849, -34699:12850, -34700:12857, -34701:13182, -34702:13181, -34703:13180, -34704:8786, -34705:8801, -34706:8747, -34707:8750, -34708:8721, -34709:8730, -34710:8869, -34711:8736, -34712:8735, -34713:8895, -34714:8757, -34715:8745, -34716:8746, -34975:20124, -34976:21782, -34977:23043, -34978:38463, -34979:21696, -34980:24859, -34981:25384, -34982:23030, -34983:36898, -34984:33909, -34985:33564, -34986:31312, -34987:24746, -34988:25569, -34989:28197, -34990:26093, -34991:33894, -34992:33446, -34993:39925, -34994:26771, -34995:22311, -34996:26017, -34997:25201, -34998:23451, -34999:22992, -35000:34427, -35001:39156, -35002:32098, -35003:32190, -35004:39822, -35005:25110, -35006:31903, -35007:34999, -35008:23433, -35009:24245, -35010:25353, -35011:26263, -35012:26696, -35013:38343, -35014:38797, -35015:26447, -35016:20197, -35017:20234, -35018:20301, -35019:20381, -35020:20553, -35021:22258, -35022:22839, -35023:22996, -35024:23041, -35025:23561, -35026:24799, -35027:24847, -35028:24944, -35029:26131, -35030:26885, -35031:28858, -35032:30031, -35033:30064, -35034:31227, -35035:32173, -35036:32239, -35037:32963, -35038:33806, -35039:34915, -35040:35586, -35041:36949, -35042:36986, -35043:21307, -35044:20117, -35045:20133, -35046:22495, -35047:32946, -35048:37057, -35049:30959, -35050:19968, -35051:22769, -35052:28322, -35053:36920, -35054:31282, -35055:33576, -35056:33419, -35057:39983, -35058:20801, -35059:21360, -35060:21693, -35061:21729, -35062:22240, -35063:23035, -35064:24341, -35065:39154, -35066:28139, -35067:32996, -35068:34093, -35136:38498, -35137:38512, -35138:38560, -35139:38907, -35140:21515, -35141:21491, -35142:23431, -35143:28879, -35144:32701, -35145:36802, -35146:38632, -35147:21359, -35148:40284, -35149:31418, -35150:19985, -35151:30867, -35152:33276, -35153:28198, -35154:22040, -35155:21764, -35156:27421, -35157:34074, -35158:39995, -35159:23013, -35160:21417, -35161:28006, -35162:29916, -35163:38287, -35164:22082, -35165:20113, -35166:36939, -35167:38642, -35168:33615, -35169:39180, -35170:21473, -35171:21942, -35172:23344, -35173:24433, -35174:26144, -35175:26355, -35176:26628, -35177:27704, -35178:27891, -35179:27945, -35180:29787, -35181:30408, -35182:31310, -35183:38964, -35184:33521, -35185:34907, -35186:35424, -35187:37613, -35188:28082, -35189:30123, -35190:30410, -35191:39365, -35192:24742, -35193:35585, -35194:36234, -35195:38322, -35196:27022, -35197:21421, -35198:20870, -35200:22290, -35201:22576, -35202:22852, -35203:23476, -35204:24310, -35205:24616, -35206:25513, -35207:25588, -35208:27839, -35209:28436, -35210:28814, -35211:28948, -35212:29017, -35213:29141, -35214:29503, -35215:32257, -35216:33398, -35217:33489, -35218:34199, -35219:36960, -35220:37467, -35221:40219, -35222:22633, -35223:26044, -35224:27738, -35225:29989, -35226:20985, -35227:22830, -35228:22885, -35229:24448, -35230:24540, -35231:25276, -35232:26106, -35233:27178, -35234:27431, -35235:27572, -35236:29579, -35237:32705, -35238:35158, -35239:40236, -35240:40206, -35241:40644, -35242:23713, -35243:27798, -35244:33659, -35245:20740, -35246:23627, -35247:25014, -35248:33222, -35249:26742, -35250:29281, -35251:20057, -35252:20474, -35253:21368, -35254:24681, -35255:28201, -35256:31311, -35257:38899, -35258:19979, -35259:21270, -35260:20206, -35261:20309, -35262:20285, -35263:20385, -35264:20339, -35265:21152, -35266:21487, -35267:22025, -35268:22799, -35269:23233, -35270:23478, -35271:23521, -35272:31185, -35273:26247, -35274:26524, -35275:26550, -35276:27468, -35277:27827, -35278:28779, -35279:29634, -35280:31117, -35281:31166, -35282:31292, -35283:31623, -35284:33457, -35285:33499, -35286:33540, -35287:33655, -35288:33775, -35289:33747, -35290:34662, -35291:35506, -35292:22057, -35293:36008, -35294:36838, -35295:36942, -35296:38686, -35297:34442, -35298:20420, -35299:23784, -35300:25105, -35301:29273, -35302:30011, -35303:33253, -35304:33469, -35305:34558, -35306:36032, -35307:38597, -35308:39187, -35309:39381, -35310:20171, -35311:20250, -35312:35299, -35313:22238, -35314:22602, -35315:22730, -35316:24315, -35317:24555, -35318:24618, -35319:24724, -35320:24674, -35321:25040, -35322:25106, -35323:25296, -35324:25913, -35392:39745, -35393:26214, -35394:26800, -35395:28023, -35396:28784, -35397:30028, -35398:30342, -35399:32117, -35400:33445, -35401:34809, -35402:38283, -35403:38542, -35404:35997, -35405:20977, -35406:21182, -35407:22806, -35408:21683, -35409:23475, -35410:23830, -35411:24936, -35412:27010, -35413:28079, -35414:30861, -35415:33995, -35416:34903, -35417:35442, -35418:37799, -35419:39608, -35420:28012, -35421:39336, -35422:34521, -35423:22435, -35424:26623, -35425:34510, -35426:37390, -35427:21123, -35428:22151, -35429:21508, -35430:24275, -35431:25313, -35432:25785, -35433:26684, -35434:26680, -35435:27579, -35436:29554, -35437:30906, -35438:31339, -35439:35226, -35440:35282, -35441:36203, -35442:36611, -35443:37101, -35444:38307, -35445:38548, -35446:38761, -35447:23398, -35448:23731, -35449:27005, -35450:38989, -35451:38990, -35452:25499, -35453:31520, -35454:27179, -35456:27263, -35457:26806, -35458:39949, -35459:28511, -35460:21106, -35461:21917, -35462:24688, -35463:25324, -35464:27963, -35465:28167, -35466:28369, -35467:33883, -35468:35088, -35469:36676, -35470:19988, -35471:39993, -35472:21494, -35473:26907, -35474:27194, -35475:38788, -35476:26666, -35477:20828, -35478:31427, -35479:33970, -35480:37340, -35481:37772, -35482:22107, -35483:40232, -35484:26658, -35485:33541, -35486:33841, -35487:31909, -35488:21000, -35489:33477, -35490:29926, -35491:20094, -35492:20355, -35493:20896, -35494:23506, -35495:21002, -35496:21208, -35497:21223, -35498:24059, -35499:21914, -35500:22570, -35501:23014, -35502:23436, -35503:23448, -35504:23515, -35505:24178, -35506:24185, -35507:24739, -35508:24863, -35509:24931, -35510:25022, -35511:25563, -35512:25954, -35513:26577, -35514:26707, -35515:26874, -35516:27454, -35517:27475, -35518:27735, -35519:28450, -35520:28567, -35521:28485, -35522:29872, -35523:29976, -35524:30435, -35525:30475, -35526:31487, -35527:31649, -35528:31777, -35529:32233, -35530:32566, -35531:32752, -35532:32925, -35533:33382, -35534:33694, -35535:35251, -35536:35532, -35537:36011, -35538:36996, -35539:37969, -35540:38291, -35541:38289, -35542:38306, -35543:38501, -35544:38867, -35545:39208, -35546:33304, -35547:20024, -35548:21547, -35549:23736, -35550:24012, -35551:29609, -35552:30284, -35553:30524, -35554:23721, -35555:32747, -35556:36107, -35557:38593, -35558:38929, -35559:38996, -35560:39000, -35561:20225, -35562:20238, -35563:21361, -35564:21916, -35565:22120, -35566:22522, -35567:22855, -35568:23305, -35569:23492, -35570:23696, -35571:24076, -35572:24190, -35573:24524, -35574:25582, -35575:26426, -35576:26071, -35577:26082, -35578:26399, -35579:26827, -35580:26820, -35648:27231, -35649:24112, -35650:27589, -35651:27671, -35652:27773, -35653:30079, -35654:31048, -35655:23395, -35656:31232, -35657:32000, -35658:24509, -35659:35215, -35660:35352, -35661:36020, -35662:36215, -35663:36556, -35664:36637, -35665:39138, -35666:39438, -35667:39740, -35668:20096, -35669:20605, -35670:20736, -35671:22931, -35672:23452, -35673:25135, -35674:25216, -35675:25836, -35676:27450, -35677:29344, -35678:30097, -35679:31047, -35680:32681, -35681:34811, -35682:35516, -35683:35696, -35684:25516, -35685:33738, -35686:38816, -35687:21513, -35688:21507, -35689:21931, -35690:26708, -35691:27224, -35692:35440, -35693:30759, -35694:26485, -35695:40653, -35696:21364, -35697:23458, -35698:33050, -35699:34384, -35700:36870, -35701:19992, -35702:20037, -35703:20167, -35704:20241, -35705:21450, -35706:21560, -35707:23470, -35708:24339, -35709:24613, -35710:25937, -35712:26429, -35713:27714, -35714:27762, -35715:27875, -35716:28792, -35717:29699, -35718:31350, -35719:31406, -35720:31496, -35721:32026, -35722:31998, -35723:32102, -35724:26087, -35725:29275, -35726:21435, -35727:23621, -35728:24040, -35729:25298, -35730:25312, -35731:25369, -35732:28192, -35733:34394, -35734:35377, -35735:36317, -35736:37624, -35737:28417, -35738:31142, -35739:39770, -35740:20136, -35741:20139, -35742:20140, -35743:20379, -35744:20384, -35745:20689, -35746:20807, -35747:31478, -35748:20849, -35749:20982, -35750:21332, -35751:21281, -35752:21375, -35753:21483, -35754:21932, -35755:22659, -35756:23777, -35757:24375, -35758:24394, -35759:24623, -35760:24656, -35761:24685, -35762:25375, -35763:25945, -35764:27211, -35765:27841, -35766:29378, -35767:29421, -35768:30703, -35769:33016, -35770:33029, -35771:33288, -35772:34126, -35773:37111, -35774:37857, -35775:38911, -35776:39255, -35777:39514, -35778:20208, -35779:20957, -35780:23597, -35781:26241, -35782:26989, -35783:23616, -35784:26354, -35785:26997, -35786:29577, -35787:26704, -35788:31873, -35789:20677, -35790:21220, -35791:22343, -35792:24062, -35793:37670, -35794:26020, -35795:27427, -35796:27453, -35797:29748, -35798:31105, -35799:31165, -35800:31563, -35801:32202, -35802:33465, -35803:33740, -35804:34943, -35805:35167, -35806:35641, -35807:36817, -35808:37329, -35809:21535, -35810:37504, -35811:20061, -35812:20534, -35813:21477, -35814:21306, -35815:29399, -35816:29590, -35817:30697, -35818:33510, -35819:36527, -35820:39366, -35821:39368, -35822:39378, -35823:20855, -35824:24858, -35825:34398, -35826:21936, -35827:31354, -35828:20598, -35829:23507, -35830:36935, -35831:38533, -35832:20018, -35833:27355, -35834:37351, -35835:23633, -35836:23624, -35904:25496, -35905:31391, -35906:27795, -35907:38772, -35908:36705, -35909:31402, -35910:29066, -35911:38536, -35912:31874, -35913:26647, -35914:32368, -35915:26705, -35916:37740, -35917:21234, -35918:21531, -35919:34219, -35920:35347, -35921:32676, -35922:36557, -35923:37089, -35924:21350, -35925:34952, -35926:31041, -35927:20418, -35928:20670, -35929:21009, -35930:20804, -35931:21843, -35932:22317, -35933:29674, -35934:22411, -35935:22865, -35936:24418, -35937:24452, -35938:24693, -35939:24950, -35940:24935, -35941:25001, -35942:25522, -35943:25658, -35944:25964, -35945:26223, -35946:26690, -35947:28179, -35948:30054, -35949:31293, -35950:31995, -35951:32076, -35952:32153, -35953:32331, -35954:32619, -35955:33550, -35956:33610, -35957:34509, -35958:35336, -35959:35427, -35960:35686, -35961:36605, -35962:38938, -35963:40335, -35964:33464, -35965:36814, -35966:39912, -35968:21127, -35969:25119, -35970:25731, -35971:28608, -35972:38553, -35973:26689, -35974:20625, -35975:27424, -35976:27770, -35977:28500, -35978:31348, -35979:32080, -35980:34880, -35981:35363, -35982:26376, -35983:20214, -35984:20537, -35985:20518, -35986:20581, -35987:20860, -35988:21048, -35989:21091, -35990:21927, -35991:22287, -35992:22533, -35993:23244, -35994:24314, -35995:25010, -35996:25080, -35997:25331, -35998:25458, -35999:26908, -36000:27177, -36001:29309, -36002:29356, -36003:29486, -36004:30740, -36005:30831, -36006:32121, -36007:30476, -36008:32937, -36009:35211, -36010:35609, -36011:36066, -36012:36562, -36013:36963, -36014:37749, -36015:38522, -36016:38997, -36017:39443, -36018:40568, -36019:20803, -36020:21407, -36021:21427, -36022:24187, -36023:24358, -36024:28187, -36025:28304, -36026:29572, -36027:29694, -36028:32067, -36029:33335, -36030:35328, -36031:35578, -36032:38480, -36033:20046, -36034:20491, -36035:21476, -36036:21628, -36037:22266, -36038:22993, -36039:23396, -36040:24049, -36041:24235, -36042:24359, -36043:25144, -36044:25925, -36045:26543, -36046:28246, -36047:29392, -36048:31946, -36049:34996, -36050:32929, -36051:32993, -36052:33776, -36053:34382, -36054:35463, -36055:36328, -36056:37431, -36057:38599, -36058:39015, -36059:40723, -36060:20116, -36061:20114, -36062:20237, -36063:21320, -36064:21577, -36065:21566, -36066:23087, -36067:24460, -36068:24481, -36069:24735, -36070:26791, -36071:27278, -36072:29786, -36073:30849, -36074:35486, -36075:35492, -36076:35703, -36077:37264, -36078:20062, -36079:39881, -36080:20132, -36081:20348, -36082:20399, -36083:20505, -36084:20502, -36085:20809, -36086:20844, -36087:21151, -36088:21177, -36089:21246, -36090:21402, -36091:21475, -36092:21521, -36160:21518, -36161:21897, -36162:22353, -36163:22434, -36164:22909, -36165:23380, -36166:23389, -36167:23439, -36168:24037, -36169:24039, -36170:24055, -36171:24184, -36172:24195, -36173:24218, -36174:24247, -36175:24344, -36176:24658, -36177:24908, -36178:25239, -36179:25304, -36180:25511, -36181:25915, -36182:26114, -36183:26179, -36184:26356, -36185:26477, -36186:26657, -36187:26775, -36188:27083, -36189:27743, -36190:27946, -36191:28009, -36192:28207, -36193:28317, -36194:30002, -36195:30343, -36196:30828, -36197:31295, -36198:31968, -36199:32005, -36200:32024, -36201:32094, -36202:32177, -36203:32789, -36204:32771, -36205:32943, -36206:32945, -36207:33108, -36208:33167, -36209:33322, -36210:33618, -36211:34892, -36212:34913, -36213:35611, -36214:36002, -36215:36092, -36216:37066, -36217:37237, -36218:37489, -36219:30783, -36220:37628, -36221:38308, -36222:38477, -36224:38917, -36225:39321, -36226:39640, -36227:40251, -36228:21083, -36229:21163, -36230:21495, -36231:21512, -36232:22741, -36233:25335, -36234:28640, -36235:35946, -36236:36703, -36237:40633, -36238:20811, -36239:21051, -36240:21578, -36241:22269, -36242:31296, -36243:37239, -36244:40288, -36245:40658, -36246:29508, -36247:28425, -36248:33136, -36249:29969, -36250:24573, -36251:24794, -36252:39592, -36253:29403, -36254:36796, -36255:27492, -36256:38915, -36257:20170, -36258:22256, -36259:22372, -36260:22718, -36261:23130, -36262:24680, -36263:25031, -36264:26127, -36265:26118, -36266:26681, -36267:26801, -36268:28151, -36269:30165, -36270:32058, -36271:33390, -36272:39746, -36273:20123, -36274:20304, -36275:21449, -36276:21766, -36277:23919, -36278:24038, -36279:24046, -36280:26619, -36281:27801, -36282:29811, -36283:30722, -36284:35408, -36285:37782, -36286:35039, -36287:22352, -36288:24231, -36289:25387, -36290:20661, -36291:20652, -36292:20877, -36293:26368, -36294:21705, -36295:22622, -36296:22971, -36297:23472, -36298:24425, -36299:25165, -36300:25505, -36301:26685, -36302:27507, -36303:28168, -36304:28797, -36305:37319, -36306:29312, -36307:30741, -36308:30758, -36309:31085, -36310:25998, -36311:32048, -36312:33756, -36313:35009, -36314:36617, -36315:38555, -36316:21092, -36317:22312, -36318:26448, -36319:32618, -36320:36001, -36321:20916, -36322:22338, -36323:38442, -36324:22586, -36325:27018, -36326:32948, -36327:21682, -36328:23822, -36329:22524, -36330:30869, -36331:40442, -36332:20316, -36333:21066, -36334:21643, -36335:25662, -36336:26152, -36337:26388, -36338:26613, -36339:31364, -36340:31574, -36341:32034, -36342:37679, -36343:26716, -36344:39853, -36345:31545, -36346:21273, -36347:20874, -36348:21047, -36416:23519, -36417:25334, -36418:25774, -36419:25830, -36420:26413, -36421:27578, -36422:34217, -36423:38609, -36424:30352, -36425:39894, -36426:25420, -36427:37638, -36428:39851, -36429:30399, -36430:26194, -36431:19977, -36432:20632, -36433:21442, -36434:23665, -36435:24808, -36436:25746, -36437:25955, -36438:26719, -36439:29158, -36440:29642, -36441:29987, -36442:31639, -36443:32386, -36444:34453, -36445:35715, -36446:36059, -36447:37240, -36448:39184, -36449:26028, -36450:26283, -36451:27531, -36452:20181, -36453:20180, -36454:20282, -36455:20351, -36456:21050, -36457:21496, -36458:21490, -36459:21987, -36460:22235, -36461:22763, -36462:22987, -36463:22985, -36464:23039, -36465:23376, -36466:23629, -36467:24066, -36468:24107, -36469:24535, -36470:24605, -36471:25351, -36472:25903, -36473:23388, -36474:26031, -36475:26045, -36476:26088, -36477:26525, -36478:27490, -36480:27515, -36481:27663, -36482:29509, -36483:31049, -36484:31169, -36485:31992, -36486:32025, -36487:32043, -36488:32930, -36489:33026, -36490:33267, -36491:35222, -36492:35422, -36493:35433, -36494:35430, -36495:35468, -36496:35566, -36497:36039, -36498:36060, -36499:38604, -36500:39164, -36501:27503, -36502:20107, -36503:20284, -36504:20365, -36505:20816, -36506:23383, -36507:23546, -36508:24904, -36509:25345, -36510:26178, -36511:27425, -36512:28363, -36513:27835, -36514:29246, -36515:29885, -36516:30164, -36517:30913, -36518:31034, -36519:32780, -36520:32819, -36521:33258, -36522:33940, -36523:36766, -36524:27728, -36525:40575, -36526:24335, -36527:35672, -36528:40235, -36529:31482, -36530:36600, -36531:23437, -36532:38635, -36533:19971, -36534:21489, -36535:22519, -36536:22833, -36537:23241, -36538:23460, -36539:24713, -36540:28287, -36541:28422, -36542:30142, -36543:36074, -36544:23455, -36545:34048, -36546:31712, -36547:20594, -36548:26612, -36549:33437, -36550:23649, -36551:34122, -36552:32286, -36553:33294, -36554:20889, -36555:23556, -36556:25448, -36557:36198, -36558:26012, -36559:29038, -36560:31038, -36561:32023, -36562:32773, -36563:35613, -36564:36554, -36565:36974, -36566:34503, -36567:37034, -36568:20511, -36569:21242, -36570:23610, -36571:26451, -36572:28796, -36573:29237, -36574:37196, -36575:37320, -36576:37675, -36577:33509, -36578:23490, -36579:24369, -36580:24825, -36581:20027, -36582:21462, -36583:23432, -36584:25163, -36585:26417, -36586:27530, -36587:29417, -36588:29664, -36589:31278, -36590:33131, -36591:36259, -36592:37202, -36593:39318, -36594:20754, -36595:21463, -36596:21610, -36597:23551, -36598:25480, -36599:27193, -36600:32172, -36601:38656, -36602:22234, -36603:21454, -36604:21608, -36672:23447, -36673:23601, -36674:24030, -36675:20462, -36676:24833, -36677:25342, -36678:27954, -36679:31168, -36680:31179, -36681:32066, -36682:32333, -36683:32722, -36684:33261, -36685:33311, -36686:33936, -36687:34886, -36688:35186, -36689:35728, -36690:36468, -36691:36655, -36692:36913, -36693:37195, -36694:37228, -36695:38598, -36696:37276, -36697:20160, -36698:20303, -36699:20805, -36700:21313, -36701:24467, -36702:25102, -36703:26580, -36704:27713, -36705:28171, -36706:29539, -36707:32294, -36708:37325, -36709:37507, -36710:21460, -36711:22809, -36712:23487, -36713:28113, -36714:31069, -36715:32302, -36716:31899, -36717:22654, -36718:29087, -36719:20986, -36720:34899, -36721:36848, -36722:20426, -36723:23803, -36724:26149, -36725:30636, -36726:31459, -36727:33308, -36728:39423, -36729:20934, -36730:24490, -36731:26092, -36732:26991, -36733:27529, -36734:28147, -36736:28310, -36737:28516, -36738:30462, -36739:32020, -36740:24033, -36741:36981, -36742:37255, -36743:38918, -36744:20966, -36745:21021, -36746:25152, -36747:26257, -36748:26329, -36749:28186, -36750:24246, -36751:32210, -36752:32626, -36753:26360, -36754:34223, -36755:34295, -36756:35576, -36757:21161, -36758:21465, -36759:22899, -36760:24207, -36761:24464, -36762:24661, -36763:37604, -36764:38500, -36765:20663, -36766:20767, -36767:21213, -36768:21280, -36769:21319, -36770:21484, -36771:21736, -36772:21830, -36773:21809, -36774:22039, -36775:22888, -36776:22974, -36777:23100, -36778:23477, -36779:23558, -36780:23567, -36781:23569, -36782:23578, -36783:24196, -36784:24202, -36785:24288, -36786:24432, -36787:25215, -36788:25220, -36789:25307, -36790:25484, -36791:25463, -36792:26119, -36793:26124, -36794:26157, -36795:26230, -36796:26494, -36797:26786, -36798:27167, -36799:27189, -36800:27836, -36801:28040, -36802:28169, -36803:28248, -36804:28988, -36805:28966, -36806:29031, -36807:30151, -36808:30465, -36809:30813, -36810:30977, -36811:31077, -36812:31216, -36813:31456, -36814:31505, -36815:31911, -36816:32057, -36817:32918, -36818:33750, -36819:33931, -36820:34121, -36821:34909, -36822:35059, -36823:35359, -36824:35388, -36825:35412, -36826:35443, -36827:35937, -36828:36062, -36829:37284, -36830:37478, -36831:37758, -36832:37912, -36833:38556, -36834:38808, -36835:19978, -36836:19976, -36837:19998, -36838:20055, -36839:20887, -36840:21104, -36841:22478, -36842:22580, -36843:22732, -36844:23330, -36845:24120, -36846:24773, -36847:25854, -36848:26465, -36849:26454, -36850:27972, -36851:29366, -36852:30067, -36853:31331, -36854:33976, -36855:35698, -36856:37304, -36857:37664, -36858:22065, -36859:22516, -36860:39166, -36928:25325, -36929:26893, -36930:27542, -36931:29165, -36932:32340, -36933:32887, -36934:33394, -36935:35302, -36936:39135, -36937:34645, -36938:36785, -36939:23611, -36940:20280, -36941:20449, -36942:20405, -36943:21767, -36944:23072, -36945:23517, -36946:23529, -36947:24515, -36948:24910, -36949:25391, -36950:26032, -36951:26187, -36952:26862, -36953:27035, -36954:28024, -36955:28145, -36956:30003, -36957:30137, -36958:30495, -36959:31070, -36960:31206, -36961:32051, -36962:33251, -36963:33455, -36964:34218, -36965:35242, -36966:35386, -36967:36523, -36968:36763, -36969:36914, -36970:37341, -36971:38663, -36972:20154, -36973:20161, -36974:20995, -36975:22645, -36976:22764, -36977:23563, -36978:29978, -36979:23613, -36980:33102, -36981:35338, -36982:36805, -36983:38499, -36984:38765, -36985:31525, -36986:35535, -36987:38920, -36988:37218, -36989:22259, -36990:21416, -36992:36887, -36993:21561, -36994:22402, -36995:24101, -36996:25512, -36997:27700, -36998:28810, -36999:30561, -37000:31883, -37001:32736, -37002:34928, -37003:36930, -37004:37204, -37005:37648, -37006:37656, -37007:38543, -37008:29790, -37009:39620, -37010:23815, -37011:23913, -37012:25968, -37013:26530, -37014:36264, -37015:38619, -37016:25454, -37017:26441, -37018:26905, -37019:33733, -37020:38935, -37021:38592, -37022:35070, -37023:28548, -37024:25722, -37025:23544, -37026:19990, -37027:28716, -37028:30045, -37029:26159, -37030:20932, -37031:21046, -37032:21218, -37033:22995, -37034:24449, -37035:24615, -37036:25104, -37037:25919, -37038:25972, -37039:26143, -37040:26228, -37041:26866, -37042:26646, -37043:27491, -37044:28165, -37045:29298, -37046:29983, -37047:30427, -37048:31934, -37049:32854, -37050:22768, -37051:35069, -37052:35199, -37053:35488, -37054:35475, -37055:35531, -37056:36893, -37057:37266, -37058:38738, -37059:38745, -37060:25993, -37061:31246, -37062:33030, -37063:38587, -37064:24109, -37065:24796, -37066:25114, -37067:26021, -37068:26132, -37069:26512, -37070:30707, -37071:31309, -37072:31821, -37073:32318, -37074:33034, -37075:36012, -37076:36196, -37077:36321, -37078:36447, -37079:30889, -37080:20999, -37081:25305, -37082:25509, -37083:25666, -37084:25240, -37085:35373, -37086:31363, -37087:31680, -37088:35500, -37089:38634, -37090:32118, -37091:33292, -37092:34633, -37093:20185, -37094:20808, -37095:21315, -37096:21344, -37097:23459, -37098:23554, -37099:23574, -37100:24029, -37101:25126, -37102:25159, -37103:25776, -37104:26643, -37105:26676, -37106:27849, -37107:27973, -37108:27927, -37109:26579, -37110:28508, -37111:29006, -37112:29053, -37113:26059, -37114:31359, -37115:31661, -37116:32218, -37184:32330, -37185:32680, -37186:33146, -37187:33307, -37188:33337, -37189:34214, -37190:35438, -37191:36046, -37192:36341, -37193:36984, -37194:36983, -37195:37549, -37196:37521, -37197:38275, -37198:39854, -37199:21069, -37200:21892, -37201:28472, -37202:28982, -37203:20840, -37204:31109, -37205:32341, -37206:33203, -37207:31950, -37208:22092, -37209:22609, -37210:23720, -37211:25514, -37212:26366, -37213:26365, -37214:26970, -37215:29401, -37216:30095, -37217:30094, -37218:30990, -37219:31062, -37220:31199, -37221:31895, -37222:32032, -37223:32068, -37224:34311, -37225:35380, -37226:38459, -37227:36961, -37228:40736, -37229:20711, -37230:21109, -37231:21452, -37232:21474, -37233:20489, -37234:21930, -37235:22766, -37236:22863, -37237:29245, -37238:23435, -37239:23652, -37240:21277, -37241:24803, -37242:24819, -37243:25436, -37244:25475, -37245:25407, -37246:25531, -37248:25805, -37249:26089, -37250:26361, -37251:24035, -37252:27085, -37253:27133, -37254:28437, -37255:29157, -37256:20105, -37257:30185, -37258:30456, -37259:31379, -37260:31967, -37261:32207, -37262:32156, -37263:32865, -37264:33609, -37265:33624, -37266:33900, -37267:33980, -37268:34299, -37269:35013, -37270:36208, -37271:36865, -37272:36973, -37273:37783, -37274:38684, -37275:39442, -37276:20687, -37277:22679, -37278:24974, -37279:33235, -37280:34101, -37281:36104, -37282:36896, -37283:20419, -37284:20596, -37285:21063, -37286:21363, -37287:24687, -37288:25417, -37289:26463, -37290:28204, -37291:36275, -37292:36895, -37293:20439, -37294:23646, -37295:36042, -37296:26063, -37297:32154, -37298:21330, -37299:34966, -37300:20854, -37301:25539, -37302:23384, -37303:23403, -37304:23562, -37305:25613, -37306:26449, -37307:36956, -37308:20182, -37309:22810, -37310:22826, -37311:27760, -37312:35409, -37313:21822, -37314:22549, -37315:22949, -37316:24816, -37317:25171, -37318:26561, -37319:33333, -37320:26965, -37321:38464, -37322:39364, -37323:39464, -37324:20307, -37325:22534, -37326:23550, -37327:32784, -37328:23729, -37329:24111, -37330:24453, -37331:24608, -37332:24907, -37333:25140, -37334:26367, -37335:27888, -37336:28382, -37337:32974, -37338:33151, -37339:33492, -37340:34955, -37341:36024, -37342:36864, -37343:36910, -37344:38538, -37345:40667, -37346:39899, -37347:20195, -37348:21488, -37349:22823, -37350:31532, -37351:37261, -37352:38988, -37353:40441, -37354:28381, -37355:28711, -37356:21331, -37357:21828, -37358:23429, -37359:25176, -37360:25246, -37361:25299, -37362:27810, -37363:28655, -37364:29730, -37365:35351, -37366:37944, -37367:28609, -37368:35582, -37369:33592, -37370:20967, -37371:34552, -37372:21482, -37440:21481, -37441:20294, -37442:36948, -37443:36784, -37444:22890, -37445:33073, -37446:24061, -37447:31466, -37448:36799, -37449:26842, -37450:35895, -37451:29432, -37452:40008, -37453:27197, -37454:35504, -37455:20025, -37456:21336, -37457:22022, -37458:22374, -37459:25285, -37460:25506, -37461:26086, -37462:27470, -37463:28129, -37464:28251, -37465:28845, -37466:30701, -37467:31471, -37468:31658, -37469:32187, -37470:32829, -37471:32966, -37472:34507, -37473:35477, -37474:37723, -37475:22243, -37476:22727, -37477:24382, -37478:26029, -37479:26262, -37480:27264, -37481:27573, -37482:30007, -37483:35527, -37484:20516, -37485:30693, -37486:22320, -37487:24347, -37488:24677, -37489:26234, -37490:27744, -37491:30196, -37492:31258, -37493:32622, -37494:33268, -37495:34584, -37496:36933, -37497:39347, -37498:31689, -37499:30044, -37500:31481, -37501:31569, -37502:33988, -37504:36880, -37505:31209, -37506:31378, -37507:33590, -37508:23265, -37509:30528, -37510:20013, -37511:20210, -37512:23449, -37513:24544, -37514:25277, -37515:26172, -37516:26609, -37517:27880, -37518:34411, -37519:34935, -37520:35387, -37521:37198, -37522:37619, -37523:39376, -37524:27159, -37525:28710, -37526:29482, -37527:33511, -37528:33879, -37529:36015, -37530:19969, -37531:20806, -37532:20939, -37533:21899, -37534:23541, -37535:24086, -37536:24115, -37537:24193, -37538:24340, -37539:24373, -37540:24427, -37541:24500, -37542:25074, -37543:25361, -37544:26274, -37545:26397, -37546:28526, -37547:29266, -37548:30010, -37549:30522, -37550:32884, -37551:33081, -37552:33144, -37553:34678, -37554:35519, -37555:35548, -37556:36229, -37557:36339, -37558:37530, -37559:38263, -37560:38914, -37561:40165, -37562:21189, -37563:25431, -37564:30452, -37565:26389, -37566:27784, -37567:29645, -37568:36035, -37569:37806, -37570:38515, -37571:27941, -37572:22684, -37573:26894, -37574:27084, -37575:36861, -37576:37786, -37577:30171, -37578:36890, -37579:22618, -37580:26626, -37581:25524, -37582:27131, -37583:20291, -37584:28460, -37585:26584, -37586:36795, -37587:34086, -37588:32180, -37589:37716, -37590:26943, -37591:28528, -37592:22378, -37593:22775, -37594:23340, -37595:32044, -37596:29226, -37597:21514, -37598:37347, -37599:40372, -37600:20141, -37601:20302, -37602:20572, -37603:20597, -37604:21059, -37605:35998, -37606:21576, -37607:22564, -37608:23450, -37609:24093, -37610:24213, -37611:24237, -37612:24311, -37613:24351, -37614:24716, -37615:25269, -37616:25402, -37617:25552, -37618:26799, -37619:27712, -37620:30855, -37621:31118, -37622:31243, -37623:32224, -37624:33351, -37625:35330, -37626:35558, -37627:36420, -37628:36883, -37696:37048, -37697:37165, -37698:37336, -37699:40718, -37700:27877, -37701:25688, -37702:25826, -37703:25973, -37704:28404, -37705:30340, -37706:31515, -37707:36969, -37708:37841, -37709:28346, -37710:21746, -37711:24505, -37712:25764, -37713:36685, -37714:36845, -37715:37444, -37716:20856, -37717:22635, -37718:22825, -37719:23637, -37720:24215, -37721:28155, -37722:32399, -37723:29980, -37724:36028, -37725:36578, -37726:39003, -37727:28857, -37728:20253, -37729:27583, -37730:28593, -37731:30000, -37732:38651, -37733:20814, -37734:21520, -37735:22581, -37736:22615, -37737:22956, -37738:23648, -37739:24466, -37740:26007, -37741:26460, -37742:28193, -37743:30331, -37744:33759, -37745:36077, -37746:36884, -37747:37117, -37748:37709, -37749:30757, -37750:30778, -37751:21162, -37752:24230, -37753:22303, -37754:22900, -37755:24594, -37756:20498, -37757:20826, -37758:20908, -37760:20941, -37761:20992, -37762:21776, -37763:22612, -37764:22616, -37765:22871, -37766:23445, -37767:23798, -37768:23947, -37769:24764, -37770:25237, -37771:25645, -37772:26481, -37773:26691, -37774:26812, -37775:26847, -37776:30423, -37777:28120, -37778:28271, -37779:28059, -37780:28783, -37781:29128, -37782:24403, -37783:30168, -37784:31095, -37785:31561, -37786:31572, -37787:31570, -37788:31958, -37789:32113, -37790:21040, -37791:33891, -37792:34153, -37793:34276, -37794:35342, -37795:35588, -37796:35910, -37797:36367, -37798:36867, -37799:36879, -37800:37913, -37801:38518, -37802:38957, -37803:39472, -37804:38360, -37805:20685, -37806:21205, -37807:21516, -37808:22530, -37809:23566, -37810:24999, -37811:25758, -37812:27934, -37813:30643, -37814:31461, -37815:33012, -37816:33796, -37817:36947, -37818:37509, -37819:23776, -37820:40199, -37821:21311, -37822:24471, -37823:24499, -37824:28060, -37825:29305, -37826:30563, -37827:31167, -37828:31716, -37829:27602, -37830:29420, -37831:35501, -37832:26627, -37833:27233, -37834:20984, -37835:31361, -37836:26932, -37837:23626, -37838:40182, -37839:33515, -37840:23493, -37841:37193, -37842:28702, -37843:22136, -37844:23663, -37845:24775, -37846:25958, -37847:27788, -37848:35930, -37849:36929, -37850:38931, -37851:21585, -37852:26311, -37853:37389, -37854:22856, -37855:37027, -37856:20869, -37857:20045, -37858:20970, -37859:34201, -37860:35598, -37861:28760, -37862:25466, -37863:37707, -37864:26978, -37865:39348, -37866:32260, -37867:30071, -37868:21335, -37869:26976, -37870:36575, -37871:38627, -37872:27741, -37873:20108, -37874:23612, -37875:24336, -37876:36841, -37877:21250, -37878:36049, -37879:32905, -37880:34425, -37881:24319, -37882:26085, -37883:20083, -37884:20837, -37952:22914, -37953:23615, -37954:38894, -37955:20219, -37956:22922, -37957:24525, -37958:35469, -37959:28641, -37960:31152, -37961:31074, -37962:23527, -37963:33905, -37964:29483, -37965:29105, -37966:24180, -37967:24565, -37968:25467, -37969:25754, -37970:29123, -37971:31896, -37972:20035, -37973:24316, -37974:20043, -37975:22492, -37976:22178, -37977:24745, -37978:28611, -37979:32013, -37980:33021, -37981:33075, -37982:33215, -37983:36786, -37984:35223, -37985:34468, -37986:24052, -37987:25226, -37988:25773, -37989:35207, -37990:26487, -37991:27874, -37992:27966, -37993:29750, -37994:30772, -37995:23110, -37996:32629, -37997:33453, -37998:39340, -37999:20467, -38000:24259, -38001:25309, -38002:25490, -38003:25943, -38004:26479, -38005:30403, -38006:29260, -38007:32972, -38008:32954, -38009:36649, -38010:37197, -38011:20493, -38012:22521, -38013:23186, -38014:26757, -38016:26995, -38017:29028, -38018:29437, -38019:36023, -38020:22770, -38021:36064, -38022:38506, -38023:36889, -38024:34687, -38025:31204, -38026:30695, -38027:33833, -38028:20271, -38029:21093, -38030:21338, -38031:25293, -38032:26575, -38033:27850, -38034:30333, -38035:31636, -38036:31893, -38037:33334, -38038:34180, -38039:36843, -38040:26333, -38041:28448, -38042:29190, -38043:32283, -38044:33707, -38045:39361, -38046:40614, -38047:20989, -38048:31665, -38049:30834, -38050:31672, -38051:32903, -38052:31560, -38053:27368, -38054:24161, -38055:32908, -38056:30033, -38057:30048, -38058:20843, -38059:37474, -38060:28300, -38061:30330, -38062:37271, -38063:39658, -38064:20240, -38065:32624, -38066:25244, -38067:31567, -38068:38309, -38069:40169, -38070:22138, -38071:22617, -38072:34532, -38073:38588, -38074:20276, -38075:21028, -38076:21322, -38077:21453, -38078:21467, -38079:24070, -38080:25644, -38081:26001, -38082:26495, -38083:27710, -38084:27726, -38085:29256, -38086:29359, -38087:29677, -38088:30036, -38089:32321, -38090:33324, -38091:34281, -38092:36009, -38093:31684, -38094:37318, -38095:29033, -38096:38930, -38097:39151, -38098:25405, -38099:26217, -38100:30058, -38101:30436, -38102:30928, -38103:34115, -38104:34542, -38105:21290, -38106:21329, -38107:21542, -38108:22915, -38109:24199, -38110:24444, -38111:24754, -38112:25161, -38113:25209, -38114:25259, -38115:26000, -38116:27604, -38117:27852, -38118:30130, -38119:30382, -38120:30865, -38121:31192, -38122:32203, -38123:32631, -38124:32933, -38125:34987, -38126:35513, -38127:36027, -38128:36991, -38129:38750, -38130:39131, -38131:27147, -38132:31800, -38133:20633, -38134:23614, -38135:24494, -38136:26503, -38137:27608, -38138:29749, -38139:30473, -38140:32654, -38208:40763, -38209:26570, -38210:31255, -38211:21305, -38212:30091, -38213:39661, -38214:24422, -38215:33181, -38216:33777, -38217:32920, -38218:24380, -38219:24517, -38220:30050, -38221:31558, -38222:36924, -38223:26727, -38224:23019, -38225:23195, -38226:32016, -38227:30334, -38228:35628, -38229:20469, -38230:24426, -38231:27161, -38232:27703, -38233:28418, -38234:29922, -38235:31080, -38236:34920, -38237:35413, -38238:35961, -38239:24287, -38240:25551, -38241:30149, -38242:31186, -38243:33495, -38244:37672, -38245:37618, -38246:33948, -38247:34541, -38248:39981, -38249:21697, -38250:24428, -38251:25996, -38252:27996, -38253:28693, -38254:36007, -38255:36051, -38256:38971, -38257:25935, -38258:29942, -38259:19981, -38260:20184, -38261:22496, -38262:22827, -38263:23142, -38264:23500, -38265:20904, -38266:24067, -38267:24220, -38268:24598, -38269:25206, -38270:25975, -38272:26023, -38273:26222, -38274:28014, -38275:29238, -38276:31526, -38277:33104, -38278:33178, -38279:33433, -38280:35676, -38281:36000, -38282:36070, -38283:36212, -38284:38428, -38285:38468, -38286:20398, -38287:25771, -38288:27494, -38289:33310, -38290:33889, -38291:34154, -38292:37096, -38293:23553, -38294:26963, -38295:39080, -38296:33914, -38297:34135, -38298:20239, -38299:21103, -38300:24489, -38301:24133, -38302:26381, -38303:31119, -38304:33145, -38305:35079, -38306:35206, -38307:28149, -38308:24343, -38309:25173, -38310:27832, -38311:20175, -38312:29289, -38313:39826, -38314:20998, -38315:21563, -38316:22132, -38317:22707, -38318:24996, -38319:25198, -38320:28954, -38321:22894, -38322:31881, -38323:31966, -38324:32027, -38325:38640, -38326:25991, -38327:32862, -38328:19993, -38329:20341, -38330:20853, -38331:22592, -38332:24163, -38333:24179, -38334:24330, -38335:26564, -38336:20006, -38337:34109, -38338:38281, -38339:38491, -38340:31859, -38341:38913, -38342:20731, -38343:22721, -38344:30294, -38345:30887, -38346:21029, -38347:30629, -38348:34065, -38349:31622, -38350:20559, -38351:22793, -38352:29255, -38353:31687, -38354:32232, -38355:36794, -38356:36820, -38357:36941, -38358:20415, -38359:21193, -38360:23081, -38361:24321, -38362:38829, -38363:20445, -38364:33303, -38365:37610, -38366:22275, -38367:25429, -38368:27497, -38369:29995, -38370:35036, -38371:36628, -38372:31298, -38373:21215, -38374:22675, -38375:24917, -38376:25098, -38377:26286, -38378:27597, -38379:31807, -38380:33769, -38381:20515, -38382:20472, -38383:21253, -38384:21574, -38385:22577, -38386:22857, -38387:23453, -38388:23792, -38389:23791, -38390:23849, -38391:24214, -38392:25265, -38393:25447, -38394:25918, -38395:26041, -38396:26379, -38464:27861, -38465:27873, -38466:28921, -38467:30770, -38468:32299, -38469:32990, -38470:33459, -38471:33804, -38472:34028, -38473:34562, -38474:35090, -38475:35370, -38476:35914, -38477:37030, -38478:37586, -38479:39165, -38480:40179, -38481:40300, -38482:20047, -38483:20129, -38484:20621, -38485:21078, -38486:22346, -38487:22952, -38488:24125, -38489:24536, -38490:24537, -38491:25151, -38492:26292, -38493:26395, -38494:26576, -38495:26834, -38496:20882, -38497:32033, -38498:32938, -38499:33192, -38500:35584, -38501:35980, -38502:36031, -38503:37502, -38504:38450, -38505:21536, -38506:38956, -38507:21271, -38508:20693, -38509:21340, -38510:22696, -38511:25778, -38512:26420, -38513:29287, -38514:30566, -38515:31302, -38516:37350, -38517:21187, -38518:27809, -38519:27526, -38520:22528, -38521:24140, -38522:22868, -38523:26412, -38524:32763, -38525:20961, -38526:30406, -38528:25705, -38529:30952, -38530:39764, -38531:40635, -38532:22475, -38533:22969, -38534:26151, -38535:26522, -38536:27598, -38537:21737, -38538:27097, -38539:24149, -38540:33180, -38541:26517, -38542:39850, -38543:26622, -38544:40018, -38545:26717, -38546:20134, -38547:20451, -38548:21448, -38549:25273, -38550:26411, -38551:27819, -38552:36804, -38553:20397, -38554:32365, -38555:40639, -38556:19975, -38557:24930, -38558:28288, -38559:28459, -38560:34067, -38561:21619, -38562:26410, -38563:39749, -38564:24051, -38565:31637, -38566:23724, -38567:23494, -38568:34588, -38569:28234, -38570:34001, -38571:31252, -38572:33032, -38573:22937, -38574:31885, -38575:27665, -38576:30496, -38577:21209, -38578:22818, -38579:28961, -38580:29279, -38581:30683, -38582:38695, -38583:40289, -38584:26891, -38585:23167, -38586:23064, -38587:20901, -38588:21517, -38589:21629, -38590:26126, -38591:30431, -38592:36855, -38593:37528, -38594:40180, -38595:23018, -38596:29277, -38597:28357, -38598:20813, -38599:26825, -38600:32191, -38601:32236, -38602:38754, -38603:40634, -38604:25720, -38605:27169, -38606:33538, -38607:22916, -38608:23391, -38609:27611, -38610:29467, -38611:30450, -38612:32178, -38613:32791, -38614:33945, -38615:20786, -38616:26408, -38617:40665, -38618:30446, -38619:26466, -38620:21247, -38621:39173, -38622:23588, -38623:25147, -38624:31870, -38625:36016, -38626:21839, -38627:24758, -38628:32011, -38629:38272, -38630:21249, -38631:20063, -38632:20918, -38633:22812, -38634:29242, -38635:32822, -38636:37326, -38637:24357, -38638:30690, -38639:21380, -38640:24441, -38641:32004, -38642:34220, -38643:35379, -38644:36493, -38645:38742, -38646:26611, -38647:34222, -38648:37971, -38649:24841, -38650:24840, -38651:27833, -38652:30290, -38720:35565, -38721:36664, -38722:21807, -38723:20305, -38724:20778, -38725:21191, -38726:21451, -38727:23461, -38728:24189, -38729:24736, -38730:24962, -38731:25558, -38732:26377, -38733:26586, -38734:28263, -38735:28044, -38736:29494, -38737:29495, -38738:30001, -38739:31056, -38740:35029, -38741:35480, -38742:36938, -38743:37009, -38744:37109, -38745:38596, -38746:34701, -38747:22805, -38748:20104, -38749:20313, -38750:19982, -38751:35465, -38752:36671, -38753:38928, -38754:20653, -38755:24188, -38756:22934, -38757:23481, -38758:24248, -38759:25562, -38760:25594, -38761:25793, -38762:26332, -38763:26954, -38764:27096, -38765:27915, -38766:28342, -38767:29076, -38768:29992, -38769:31407, -38770:32650, -38771:32768, -38772:33865, -38773:33993, -38774:35201, -38775:35617, -38776:36362, -38777:36965, -38778:38525, -38779:39178, -38780:24958, -38781:25233, -38782:27442, -38784:27779, -38785:28020, -38786:32716, -38787:32764, -38788:28096, -38789:32645, -38790:34746, -38791:35064, -38792:26469, -38793:33713, -38794:38972, -38795:38647, -38796:27931, -38797:32097, -38798:33853, -38799:37226, -38800:20081, -38801:21365, -38802:23888, -38803:27396, -38804:28651, -38805:34253, -38806:34349, -38807:35239, -38808:21033, -38809:21519, -38810:23653, -38811:26446, -38812:26792, -38813:29702, -38814:29827, -38815:30178, -38816:35023, -38817:35041, -38818:37324, -38819:38626, -38820:38520, -38821:24459, -38822:29575, -38823:31435, -38824:33870, -38825:25504, -38826:30053, -38827:21129, -38828:27969, -38829:28316, -38830:29705, -38831:30041, -38832:30827, -38833:31890, -38834:38534, -38835:31452, -38836:40845, -38837:20406, -38838:24942, -38839:26053, -38840:34396, -38841:20102, -38842:20142, -38843:20698, -38844:20001, -38845:20940, -38846:23534, -38847:26009, -38848:26753, -38849:28092, -38850:29471, -38851:30274, -38852:30637, -38853:31260, -38854:31975, -38855:33391, -38856:35538, -38857:36988, -38858:37327, -38859:38517, -38860:38936, -38861:21147, -38862:32209, -38863:20523, -38864:21400, -38865:26519, -38866:28107, -38867:29136, -38868:29747, -38869:33256, -38870:36650, -38871:38563, -38872:40023, -38873:40607, -38874:29792, -38875:22593, -38876:28057, -38877:32047, -38878:39006, -38879:20196, -38880:20278, -38881:20363, -38882:20919, -38883:21169, -38884:23994, -38885:24604, -38886:29618, -38887:31036, -38888:33491, -38889:37428, -38890:38583, -38891:38646, -38892:38666, -38893:40599, -38894:40802, -38895:26278, -38896:27508, -38897:21015, -38898:21155, -38899:28872, -38900:35010, -38901:24265, -38902:24651, -38903:24976, -38904:28451, -38905:29001, -38906:31806, -38907:32244, -38908:32879, -38976:34030, -38977:36899, -38978:37676, -38979:21570, -38980:39791, -38981:27347, -38982:28809, -38983:36034, -38984:36335, -38985:38706, -38986:21172, -38987:23105, -38988:24266, -38989:24324, -38990:26391, -38991:27004, -38992:27028, -38993:28010, -38994:28431, -38995:29282, -38996:29436, -38997:31725, -38998:32769, -38999:32894, -39000:34635, -39001:37070, -39002:20845, -39003:40595, -39004:31108, -39005:32907, -39006:37682, -39007:35542, -39008:20525, -39009:21644, -39010:35441, -39011:27498, -39012:36036, -39013:33031, -39014:24785, -39015:26528, -39016:40434, -39017:20121, -39018:20120, -39019:39952, -39020:35435, -39021:34241, -39022:34152, -39023:26880, -39024:28286, -39025:30871, -39026:33109, -39071:24332, -39072:19984, -39073:19989, -39074:20010, -39075:20017, -39076:20022, -39077:20028, -39078:20031, -39079:20034, -39080:20054, -39081:20056, -39082:20098, -39083:20101, -39084:35947, -39085:20106, -39086:33298, -39087:24333, -39088:20110, -39089:20126, -39090:20127, -39091:20128, -39092:20130, -39093:20144, -39094:20147, -39095:20150, -39096:20174, -39097:20173, -39098:20164, -39099:20166, -39100:20162, -39101:20183, -39102:20190, -39103:20205, -39104:20191, -39105:20215, -39106:20233, -39107:20314, -39108:20272, -39109:20315, -39110:20317, -39111:20311, -39112:20295, -39113:20342, -39114:20360, -39115:20367, -39116:20376, -39117:20347, -39118:20329, -39119:20336, -39120:20369, -39121:20335, -39122:20358, -39123:20374, -39124:20760, -39125:20436, -39126:20447, -39127:20430, -39128:20440, -39129:20443, -39130:20433, -39131:20442, -39132:20432, -39133:20452, -39134:20453, -39135:20506, -39136:20520, -39137:20500, -39138:20522, -39139:20517, -39140:20485, -39141:20252, -39142:20470, -39143:20513, -39144:20521, -39145:20524, -39146:20478, -39147:20463, -39148:20497, -39149:20486, -39150:20547, -39151:20551, -39152:26371, -39153:20565, -39154:20560, -39155:20552, -39156:20570, -39157:20566, -39158:20588, -39159:20600, -39160:20608, -39161:20634, -39162:20613, -39163:20660, -39164:20658, -39232:20681, -39233:20682, -39234:20659, -39235:20674, -39236:20694, -39237:20702, -39238:20709, -39239:20717, -39240:20707, -39241:20718, -39242:20729, -39243:20725, -39244:20745, -39245:20737, -39246:20738, -39247:20758, -39248:20757, -39249:20756, -39250:20762, -39251:20769, -39252:20794, -39253:20791, -39254:20796, -39255:20795, -39256:20799, -39257:20800, -39258:20818, -39259:20812, -39260:20820, -39261:20834, -39262:31480, -39263:20841, -39264:20842, -39265:20846, -39266:20864, -39267:20866, -39268:22232, -39269:20876, -39270:20873, -39271:20879, -39272:20881, -39273:20883, -39274:20885, -39275:20886, -39276:20900, -39277:20902, -39278:20898, -39279:20905, -39280:20906, -39281:20907, -39282:20915, -39283:20913, -39284:20914, -39285:20912, -39286:20917, -39287:20925, -39288:20933, -39289:20937, -39290:20955, -39291:20960, -39292:34389, -39293:20969, -39294:20973, -39296:20976, -39297:20981, -39298:20990, -39299:20996, -39300:21003, -39301:21012, -39302:21006, -39303:21031, -39304:21034, -39305:21038, -39306:21043, -39307:21049, -39308:21071, -39309:21060, -39310:21067, -39311:21068, -39312:21086, -39313:21076, -39314:21098, -39315:21108, -39316:21097, -39317:21107, -39318:21119, -39319:21117, -39320:21133, -39321:21140, -39322:21138, -39323:21105, -39324:21128, -39325:21137, -39326:36776, -39327:36775, -39328:21164, -39329:21165, -39330:21180, -39331:21173, -39332:21185, -39333:21197, -39334:21207, -39335:21214, -39336:21219, -39337:21222, -39338:39149, -39339:21216, -39340:21235, -39341:21237, -39342:21240, -39343:21241, -39344:21254, -39345:21256, -39346:30008, -39347:21261, -39348:21264, -39349:21263, -39350:21269, -39351:21274, -39352:21283, -39353:21295, -39354:21297, -39355:21299, -39356:21304, -39357:21312, -39358:21318, -39359:21317, -39360:19991, -39361:21321, -39362:21325, -39363:20950, -39364:21342, -39365:21353, -39366:21358, -39367:22808, -39368:21371, -39369:21367, -39370:21378, -39371:21398, -39372:21408, -39373:21414, -39374:21413, -39375:21422, -39376:21424, -39377:21430, -39378:21443, -39379:31762, -39380:38617, -39381:21471, -39382:26364, -39383:29166, -39384:21486, -39385:21480, -39386:21485, -39387:21498, -39388:21505, -39389:21565, -39390:21568, -39391:21548, -39392:21549, -39393:21564, -39394:21550, -39395:21558, -39396:21545, -39397:21533, -39398:21582, -39399:21647, -39400:21621, -39401:21646, -39402:21599, -39403:21617, -39404:21623, -39405:21616, -39406:21650, -39407:21627, -39408:21632, -39409:21622, -39410:21636, -39411:21648, -39412:21638, -39413:21703, -39414:21666, -39415:21688, -39416:21669, -39417:21676, -39418:21700, -39419:21704, -39420:21672, -39488:21675, -39489:21698, -39490:21668, -39491:21694, -39492:21692, -39493:21720, -39494:21733, -39495:21734, -39496:21775, -39497:21780, -39498:21757, -39499:21742, -39500:21741, -39501:21754, -39502:21730, -39503:21817, -39504:21824, -39505:21859, -39506:21836, -39507:21806, -39508:21852, -39509:21829, -39510:21846, -39511:21847, -39512:21816, -39513:21811, -39514:21853, -39515:21913, -39516:21888, -39517:21679, -39518:21898, -39519:21919, -39520:21883, -39521:21886, -39522:21912, -39523:21918, -39524:21934, -39525:21884, -39526:21891, -39527:21929, -39528:21895, -39529:21928, -39530:21978, -39531:21957, -39532:21983, -39533:21956, -39534:21980, -39535:21988, -39536:21972, -39537:22036, -39538:22007, -39539:22038, -39540:22014, -39541:22013, -39542:22043, -39543:22009, -39544:22094, -39545:22096, -39546:29151, -39547:22068, -39548:22070, -39549:22066, -39550:22072, -39552:22123, -39553:22116, -39554:22063, -39555:22124, -39556:22122, -39557:22150, -39558:22144, -39559:22154, -39560:22176, -39561:22164, -39562:22159, -39563:22181, -39564:22190, -39565:22198, -39566:22196, -39567:22210, -39568:22204, -39569:22209, -39570:22211, -39571:22208, -39572:22216, -39573:22222, -39574:22225, -39575:22227, -39576:22231, -39577:22254, -39578:22265, -39579:22272, -39580:22271, -39581:22276, -39582:22281, -39583:22280, -39584:22283, -39585:22285, -39586:22291, -39587:22296, -39588:22294, -39589:21959, -39590:22300, -39591:22310, -39592:22327, -39593:22328, -39594:22350, -39595:22331, -39596:22336, -39597:22351, -39598:22377, -39599:22464, -39600:22408, -39601:22369, -39602:22399, -39603:22409, -39604:22419, -39605:22432, -39606:22451, -39607:22436, -39608:22442, -39609:22448, -39610:22467, -39611:22470, -39612:22484, -39613:22482, -39614:22483, -39615:22538, -39616:22486, -39617:22499, -39618:22539, -39619:22553, -39620:22557, -39621:22642, -39622:22561, -39623:22626, -39624:22603, -39625:22640, -39626:27584, -39627:22610, -39628:22589, -39629:22649, -39630:22661, -39631:22713, -39632:22687, -39633:22699, -39634:22714, -39635:22750, -39636:22715, -39637:22712, -39638:22702, -39639:22725, -39640:22739, -39641:22737, -39642:22743, -39643:22745, -39644:22744, -39645:22757, -39646:22748, -39647:22756, -39648:22751, -39649:22767, -39650:22778, -39651:22777, -39652:22779, -39653:22780, -39654:22781, -39655:22786, -39656:22794, -39657:22800, -39658:22811, -39659:26790, -39660:22821, -39661:22828, -39662:22829, -39663:22834, -39664:22840, -39665:22846, -39666:31442, -39667:22869, -39668:22864, -39669:22862, -39670:22874, -39671:22872, -39672:22882, -39673:22880, -39674:22887, -39675:22892, -39676:22889, -39744:22904, -39745:22913, -39746:22941, -39747:20318, -39748:20395, -39749:22947, -39750:22962, -39751:22982, -39752:23016, -39753:23004, -39754:22925, -39755:23001, -39756:23002, -39757:23077, -39758:23071, -39759:23057, -39760:23068, -39761:23049, -39762:23066, -39763:23104, -39764:23148, -39765:23113, -39766:23093, -39767:23094, -39768:23138, -39769:23146, -39770:23194, -39771:23228, -39772:23230, -39773:23243, -39774:23234, -39775:23229, -39776:23267, -39777:23255, -39778:23270, -39779:23273, -39780:23254, -39781:23290, -39782:23291, -39783:23308, -39784:23307, -39785:23318, -39786:23346, -39787:23248, -39788:23338, -39789:23350, -39790:23358, -39791:23363, -39792:23365, -39793:23360, -39794:23377, -39795:23381, -39796:23386, -39797:23387, -39798:23397, -39799:23401, -39800:23408, -39801:23411, -39802:23413, -39803:23416, -39804:25992, -39805:23418, -39806:23424, -39808:23427, -39809:23462, -39810:23480, -39811:23491, -39812:23495, -39813:23497, -39814:23508, -39815:23504, -39816:23524, -39817:23526, -39818:23522, -39819:23518, -39820:23525, -39821:23531, -39822:23536, -39823:23542, -39824:23539, -39825:23557, -39826:23559, -39827:23560, -39828:23565, -39829:23571, -39830:23584, -39831:23586, -39832:23592, -39833:23608, -39834:23609, -39835:23617, -39836:23622, -39837:23630, -39838:23635, -39839:23632, -39840:23631, -39841:23409, -39842:23660, -39843:23662, -39844:20066, -39845:23670, -39846:23673, -39847:23692, -39848:23697, -39849:23700, -39850:22939, -39851:23723, -39852:23739, -39853:23734, -39854:23740, -39855:23735, -39856:23749, -39857:23742, -39858:23751, -39859:23769, -39860:23785, -39861:23805, -39862:23802, -39863:23789, -39864:23948, -39865:23786, -39866:23819, -39867:23829, -39868:23831, -39869:23900, -39870:23839, -39871:23835, -39872:23825, -39873:23828, -39874:23842, -39875:23834, -39876:23833, -39877:23832, -39878:23884, -39879:23890, -39880:23886, -39881:23883, -39882:23916, -39883:23923, -39884:23926, -39885:23943, -39886:23940, -39887:23938, -39888:23970, -39889:23965, -39890:23980, -39891:23982, -39892:23997, -39893:23952, -39894:23991, -39895:23996, -39896:24009, -39897:24013, -39898:24019, -39899:24018, -39900:24022, -39901:24027, -39902:24043, -39903:24050, -39904:24053, -39905:24075, -39906:24090, -39907:24089, -39908:24081, -39909:24091, -39910:24118, -39911:24119, -39912:24132, -39913:24131, -39914:24128, -39915:24142, -39916:24151, -39917:24148, -39918:24159, -39919:24162, -39920:24164, -39921:24135, -39922:24181, -39923:24182, -39924:24186, -39925:40636, -39926:24191, -39927:24224, -39928:24257, -39929:24258, -39930:24264, -39931:24272, -39932:24271, -40000:24278, -40001:24291, -40002:24285, -40003:24282, -40004:24283, -40005:24290, -40006:24289, -40007:24296, -40008:24297, -40009:24300, -40010:24305, -40011:24307, -40012:24304, -40013:24308, -40014:24312, -40015:24318, -40016:24323, -40017:24329, -40018:24413, -40019:24412, -40020:24331, -40021:24337, -40022:24342, -40023:24361, -40024:24365, -40025:24376, -40026:24385, -40027:24392, -40028:24396, -40029:24398, -40030:24367, -40031:24401, -40032:24406, -40033:24407, -40034:24409, -40035:24417, -40036:24429, -40037:24435, -40038:24439, -40039:24451, -40040:24450, -40041:24447, -40042:24458, -40043:24456, -40044:24465, -40045:24455, -40046:24478, -40047:24473, -40048:24472, -40049:24480, -40050:24488, -40051:24493, -40052:24508, -40053:24534, -40054:24571, -40055:24548, -40056:24568, -40057:24561, -40058:24541, -40059:24755, -40060:24575, -40061:24609, -40062:24672, -40064:24601, -40065:24592, -40066:24617, -40067:24590, -40068:24625, -40069:24603, -40070:24597, -40071:24619, -40072:24614, -40073:24591, -40074:24634, -40075:24666, -40076:24641, -40077:24682, -40078:24695, -40079:24671, -40080:24650, -40081:24646, -40082:24653, -40083:24675, -40084:24643, -40085:24676, -40086:24642, -40087:24684, -40088:24683, -40089:24665, -40090:24705, -40091:24717, -40092:24807, -40093:24707, -40094:24730, -40095:24708, -40096:24731, -40097:24726, -40098:24727, -40099:24722, -40100:24743, -40101:24715, -40102:24801, -40103:24760, -40104:24800, -40105:24787, -40106:24756, -40107:24560, -40108:24765, -40109:24774, -40110:24757, -40111:24792, -40112:24909, -40113:24853, -40114:24838, -40115:24822, -40116:24823, -40117:24832, -40118:24820, -40119:24826, -40120:24835, -40121:24865, -40122:24827, -40123:24817, -40124:24845, -40125:24846, -40126:24903, -40127:24894, -40128:24872, -40129:24871, -40130:24906, -40131:24895, -40132:24892, -40133:24876, -40134:24884, -40135:24893, -40136:24898, -40137:24900, -40138:24947, -40139:24951, -40140:24920, -40141:24921, -40142:24922, -40143:24939, -40144:24948, -40145:24943, -40146:24933, -40147:24945, -40148:24927, -40149:24925, -40150:24915, -40151:24949, -40152:24985, -40153:24982, -40154:24967, -40155:25004, -40156:24980, -40157:24986, -40158:24970, -40159:24977, -40160:25003, -40161:25006, -40162:25036, -40163:25034, -40164:25033, -40165:25079, -40166:25032, -40167:25027, -40168:25030, -40169:25018, -40170:25035, -40171:32633, -40172:25037, -40173:25062, -40174:25059, -40175:25078, -40176:25082, -40177:25076, -40178:25087, -40179:25085, -40180:25084, -40181:25086, -40182:25088, -40183:25096, -40184:25097, -40185:25101, -40186:25100, -40187:25108, -40188:25115, -40256:25118, -40257:25121, -40258:25130, -40259:25134, -40260:25136, -40261:25138, -40262:25139, -40263:25153, -40264:25166, -40265:25182, -40266:25187, -40267:25179, -40268:25184, -40269:25192, -40270:25212, -40271:25218, -40272:25225, -40273:25214, -40274:25234, -40275:25235, -40276:25238, -40277:25300, -40278:25219, -40279:25236, -40280:25303, -40281:25297, -40282:25275, -40283:25295, -40284:25343, -40285:25286, -40286:25812, -40287:25288, -40288:25308, -40289:25292, -40290:25290, -40291:25282, -40292:25287, -40293:25243, -40294:25289, -40295:25356, -40296:25326, -40297:25329, -40298:25383, -40299:25346, -40300:25352, -40301:25327, -40302:25333, -40303:25424, -40304:25406, -40305:25421, -40306:25628, -40307:25423, -40308:25494, -40309:25486, -40310:25472, -40311:25515, -40312:25462, -40313:25507, -40314:25487, -40315:25481, -40316:25503, -40317:25525, -40318:25451, -40320:25449, -40321:25534, -40322:25577, -40323:25536, -40324:25542, -40325:25571, -40326:25545, -40327:25554, -40328:25590, -40329:25540, -40330:25622, -40331:25652, -40332:25606, -40333:25619, -40334:25638, -40335:25654, -40336:25885, -40337:25623, -40338:25640, -40339:25615, -40340:25703, -40341:25711, -40342:25718, -40343:25678, -40344:25898, -40345:25749, -40346:25747, -40347:25765, -40348:25769, -40349:25736, -40350:25788, -40351:25818, -40352:25810, -40353:25797, -40354:25799, -40355:25787, -40356:25816, -40357:25794, -40358:25841, -40359:25831, -40360:33289, -40361:25824, -40362:25825, -40363:25260, -40364:25827, -40365:25839, -40366:25900, -40367:25846, -40368:25844, -40369:25842, -40370:25850, -40371:25856, -40372:25853, -40373:25880, -40374:25884, -40375:25861, -40376:25892, -40377:25891, -40378:25899, -40379:25908, -40380:25909, -40381:25911, -40382:25910, -40383:25912, -40384:30027, -40385:25928, -40386:25942, -40387:25941, -40388:25933, -40389:25944, -40390:25950, -40391:25949, -40392:25970, -40393:25976, -40394:25986, -40395:25987, -40396:35722, -40397:26011, -40398:26015, -40399:26027, -40400:26039, -40401:26051, -40402:26054, -40403:26049, -40404:26052, -40405:26060, -40406:26066, -40407:26075, -40408:26073, -40409:26080, -40410:26081, -40411:26097, -40412:26482, -40413:26122, -40414:26115, -40415:26107, -40416:26483, -40417:26165, -40418:26166, -40419:26164, -40420:26140, -40421:26191, -40422:26180, -40423:26185, -40424:26177, -40425:26206, -40426:26205, -40427:26212, -40428:26215, -40429:26216, -40430:26207, -40431:26210, -40432:26224, -40433:26243, -40434:26248, -40435:26254, -40436:26249, -40437:26244, -40438:26264, -40439:26269, -40440:26305, -40441:26297, -40442:26313, -40443:26302, -40444:26300, -40512:26308, -40513:26296, -40514:26326, -40515:26330, -40516:26336, -40517:26175, -40518:26342, -40519:26345, -40520:26352, -40521:26357, -40522:26359, -40523:26383, -40524:26390, -40525:26398, -40526:26406, -40527:26407, -40528:38712, -40529:26414, -40530:26431, -40531:26422, -40532:26433, -40533:26424, -40534:26423, -40535:26438, -40536:26462, -40537:26464, -40538:26457, -40539:26467, -40540:26468, -40541:26505, -40542:26480, -40543:26537, -40544:26492, -40545:26474, -40546:26508, -40547:26507, -40548:26534, -40549:26529, -40550:26501, -40551:26551, -40552:26607, -40553:26548, -40554:26604, -40555:26547, -40556:26601, -40557:26552, -40558:26596, -40559:26590, -40560:26589, -40561:26594, -40562:26606, -40563:26553, -40564:26574, -40565:26566, -40566:26599, -40567:27292, -40568:26654, -40569:26694, -40570:26665, -40571:26688, -40572:26701, -40573:26674, -40574:26702, -40576:26803, -40577:26667, -40578:26713, -40579:26723, -40580:26743, -40581:26751, -40582:26783, -40583:26767, -40584:26797, -40585:26772, -40586:26781, -40587:26779, -40588:26755, -40589:27310, -40590:26809, -40591:26740, -40592:26805, -40593:26784, -40594:26810, -40595:26895, -40596:26765, -40597:26750, -40598:26881, -40599:26826, -40600:26888, -40601:26840, -40602:26914, -40603:26918, -40604:26849, -40605:26892, -40606:26829, -40607:26836, -40608:26855, -40609:26837, -40610:26934, -40611:26898, -40612:26884, -40613:26839, -40614:26851, -40615:26917, -40616:26873, -40617:26848, -40618:26863, -40619:26920, -40620:26922, -40621:26906, -40622:26915, -40623:26913, -40624:26822, -40625:27001, -40626:26999, -40627:26972, -40628:27000, -40629:26987, -40630:26964, -40631:27006, -40632:26990, -40633:26937, -40634:26996, -40635:26941, -40636:26969, -40637:26928, -40638:26977, -40639:26974, -40640:26973, -40641:27009, -40642:26986, -40643:27058, -40644:27054, -40645:27088, -40646:27071, -40647:27073, -40648:27091, -40649:27070, -40650:27086, -40651:23528, -40652:27082, -40653:27101, -40654:27067, -40655:27075, -40656:27047, -40657:27182, -40658:27025, -40659:27040, -40660:27036, -40661:27029, -40662:27060, -40663:27102, -40664:27112, -40665:27138, -40666:27163, -40667:27135, -40668:27402, -40669:27129, -40670:27122, -40671:27111, -40672:27141, -40673:27057, -40674:27166, -40675:27117, -40676:27156, -40677:27115, -40678:27146, -40679:27154, -40680:27329, -40681:27171, -40682:27155, -40683:27204, -40684:27148, -40685:27250, -40686:27190, -40687:27256, -40688:27207, -40689:27234, -40690:27225, -40691:27238, -40692:27208, -40693:27192, -40694:27170, -40695:27280, -40696:27277, -40697:27296, -40698:27268, -40699:27298, -40700:27299, -40768:27287, -40769:34327, -40770:27323, -40771:27331, -40772:27330, -40773:27320, -40774:27315, -40775:27308, -40776:27358, -40777:27345, -40778:27359, -40779:27306, -40780:27354, -40781:27370, -40782:27387, -40783:27397, -40784:34326, -40785:27386, -40786:27410, -40787:27414, -40788:39729, -40789:27423, -40790:27448, -40791:27447, -40792:30428, -40793:27449, -40794:39150, -40795:27463, -40796:27459, -40797:27465, -40798:27472, -40799:27481, -40800:27476, -40801:27483, -40802:27487, -40803:27489, -40804:27512, -40805:27513, -40806:27519, -40807:27520, -40808:27524, -40809:27523, -40810:27533, -40811:27544, -40812:27541, -40813:27550, -40814:27556, -40815:27562, -40816:27563, -40817:27567, -40818:27570, -40819:27569, -40820:27571, -40821:27575, -40822:27580, -40823:27590, -40824:27595, -40825:27603, -40826:27615, -40827:27628, -40828:27627, -40829:27635, -40830:27631, -40832:40638, -40833:27656, -40834:27667, -40835:27668, -40836:27675, -40837:27684, -40838:27683, -40839:27742, -40840:27733, -40841:27746, -40842:27754, -40843:27778, -40844:27789, -40845:27802, -40846:27777, -40847:27803, -40848:27774, -40849:27752, -40850:27763, -40851:27794, -40852:27792, -40853:27844, -40854:27889, -40855:27859, -40856:27837, -40857:27863, -40858:27845, -40859:27869, -40860:27822, -40861:27825, -40862:27838, -40863:27834, -40864:27867, -40865:27887, -40866:27865, -40867:27882, -40868:27935, -40869:34893, -40870:27958, -40871:27947, -40872:27965, -40873:27960, -40874:27929, -40875:27957, -40876:27955, -40877:27922, -40878:27916, -40879:28003, -40880:28051, -40881:28004, -40882:27994, -40883:28025, -40884:27993, -40885:28046, -40886:28053, -40887:28644, -40888:28037, -40889:28153, -40890:28181, -40891:28170, -40892:28085, -40893:28103, -40894:28134, -40895:28088, -40896:28102, -40897:28140, -40898:28126, -40899:28108, -40900:28136, -40901:28114, -40902:28101, -40903:28154, -40904:28121, -40905:28132, -40906:28117, -40907:28138, -40908:28142, -40909:28205, -40910:28270, -40911:28206, -40912:28185, -40913:28274, -40914:28255, -40915:28222, -40916:28195, -40917:28267, -40918:28203, -40919:28278, -40920:28237, -40921:28191, -40922:28227, -40923:28218, -40924:28238, -40925:28196, -40926:28415, -40927:28189, -40928:28216, -40929:28290, -40930:28330, -40931:28312, -40932:28361, -40933:28343, -40934:28371, -40935:28349, -40936:28335, -40937:28356, -40938:28338, -40939:28372, -40940:28373, -40941:28303, -40942:28325, -40943:28354, -40944:28319, -40945:28481, -40946:28433, -40947:28748, -40948:28396, -40949:28408, -40950:28414, -40951:28479, -40952:28402, -40953:28465, -40954:28399, -40955:28466, -40956:28364, -57408:28478, -57409:28435, -57410:28407, -57411:28550, -57412:28538, -57413:28536, -57414:28545, -57415:28544, -57416:28527, -57417:28507, -57418:28659, -57419:28525, -57420:28546, -57421:28540, -57422:28504, -57423:28558, -57424:28561, -57425:28610, -57426:28518, -57427:28595, -57428:28579, -57429:28577, -57430:28580, -57431:28601, -57432:28614, -57433:28586, -57434:28639, -57435:28629, -57436:28652, -57437:28628, -57438:28632, -57439:28657, -57440:28654, -57441:28635, -57442:28681, -57443:28683, -57444:28666, -57445:28689, -57446:28673, -57447:28687, -57448:28670, -57449:28699, -57450:28698, -57451:28532, -57452:28701, -57453:28696, -57454:28703, -57455:28720, -57456:28734, -57457:28722, -57458:28753, -57459:28771, -57460:28825, -57461:28818, -57462:28847, -57463:28913, -57464:28844, -57465:28856, -57466:28851, -57467:28846, -57468:28895, -57469:28875, -57470:28893, -57472:28889, -57473:28937, -57474:28925, -57475:28956, -57476:28953, -57477:29029, -57478:29013, -57479:29064, -57480:29030, -57481:29026, -57482:29004, -57483:29014, -57484:29036, -57485:29071, -57486:29179, -57487:29060, -57488:29077, -57489:29096, -57490:29100, -57491:29143, -57492:29113, -57493:29118, -57494:29138, -57495:29129, -57496:29140, -57497:29134, -57498:29152, -57499:29164, -57500:29159, -57501:29173, -57502:29180, -57503:29177, -57504:29183, -57505:29197, -57506:29200, -57507:29211, -57508:29224, -57509:29229, -57510:29228, -57511:29232, -57512:29234, -57513:29243, -57514:29244, -57515:29247, -57516:29248, -57517:29254, -57518:29259, -57519:29272, -57520:29300, -57521:29310, -57522:29314, -57523:29313, -57524:29319, -57525:29330, -57526:29334, -57527:29346, -57528:29351, -57529:29369, -57530:29362, -57531:29379, -57532:29382, -57533:29380, -57534:29390, -57535:29394, -57536:29410, -57537:29408, -57538:29409, -57539:29433, -57540:29431, -57541:20495, -57542:29463, -57543:29450, -57544:29468, -57545:29462, -57546:29469, -57547:29492, -57548:29487, -57549:29481, -57550:29477, -57551:29502, -57552:29518, -57553:29519, -57554:40664, -57555:29527, -57556:29546, -57557:29544, -57558:29552, -57559:29560, -57560:29557, -57561:29563, -57562:29562, -57563:29640, -57564:29619, -57565:29646, -57566:29627, -57567:29632, -57568:29669, -57569:29678, -57570:29662, -57571:29858, -57572:29701, -57573:29807, -57574:29733, -57575:29688, -57576:29746, -57577:29754, -57578:29781, -57579:29759, -57580:29791, -57581:29785, -57582:29761, -57583:29788, -57584:29801, -57585:29808, -57586:29795, -57587:29802, -57588:29814, -57589:29822, -57590:29835, -57591:29854, -57592:29863, -57593:29898, -57594:29903, -57595:29908, -57596:29681, -57664:29920, -57665:29923, -57666:29927, -57667:29929, -57668:29934, -57669:29938, -57670:29936, -57671:29937, -57672:29944, -57673:29943, -57674:29956, -57675:29955, -57676:29957, -57677:29964, -57678:29966, -57679:29965, -57680:29973, -57681:29971, -57682:29982, -57683:29990, -57684:29996, -57685:30012, -57686:30020, -57687:30029, -57688:30026, -57689:30025, -57690:30043, -57691:30022, -57692:30042, -57693:30057, -57694:30052, -57695:30055, -57696:30059, -57697:30061, -57698:30072, -57699:30070, -57700:30086, -57701:30087, -57702:30068, -57703:30090, -57704:30089, -57705:30082, -57706:30100, -57707:30106, -57708:30109, -57709:30117, -57710:30115, -57711:30146, -57712:30131, -57713:30147, -57714:30133, -57715:30141, -57716:30136, -57717:30140, -57718:30129, -57719:30157, -57720:30154, -57721:30162, -57722:30169, -57723:30179, -57724:30174, -57725:30206, -57726:30207, -57728:30204, -57729:30209, -57730:30192, -57731:30202, -57732:30194, -57733:30195, -57734:30219, -57735:30221, -57736:30217, -57737:30239, -57738:30247, -57739:30240, -57740:30241, -57741:30242, -57742:30244, -57743:30260, -57744:30256, -57745:30267, -57746:30279, -57747:30280, -57748:30278, -57749:30300, -57750:30296, -57751:30305, -57752:30306, -57753:30312, -57754:30313, -57755:30314, -57756:30311, -57757:30316, -57758:30320, -57759:30322, -57760:30326, -57761:30328, -57762:30332, -57763:30336, -57764:30339, -57765:30344, -57766:30347, -57767:30350, -57768:30358, -57769:30355, -57770:30361, -57771:30362, -57772:30384, -57773:30388, -57774:30392, -57775:30393, -57776:30394, -57777:30402, -57778:30413, -57779:30422, -57780:30418, -57781:30430, -57782:30433, -57783:30437, -57784:30439, -57785:30442, -57786:34351, -57787:30459, -57788:30472, -57789:30471, -57790:30468, -57791:30505, -57792:30500, -57793:30494, -57794:30501, -57795:30502, -57796:30491, -57797:30519, -57798:30520, -57799:30535, -57800:30554, -57801:30568, -57802:30571, -57803:30555, -57804:30565, -57805:30591, -57806:30590, -57807:30585, -57808:30606, -57809:30603, -57810:30609, -57811:30624, -57812:30622, -57813:30640, -57814:30646, -57815:30649, -57816:30655, -57817:30652, -57818:30653, -57819:30651, -57820:30663, -57821:30669, -57822:30679, -57823:30682, -57824:30684, -57825:30691, -57826:30702, -57827:30716, -57828:30732, -57829:30738, -57830:31014, -57831:30752, -57832:31018, -57833:30789, -57834:30862, -57835:30836, -57836:30854, -57837:30844, -57838:30874, -57839:30860, -57840:30883, -57841:30901, -57842:30890, -57843:30895, -57844:30929, -57845:30918, -57846:30923, -57847:30932, -57848:30910, -57849:30908, -57850:30917, -57851:30922, -57852:30956, -57920:30951, -57921:30938, -57922:30973, -57923:30964, -57924:30983, -57925:30994, -57926:30993, -57927:31001, -57928:31020, -57929:31019, -57930:31040, -57931:31072, -57932:31063, -57933:31071, -57934:31066, -57935:31061, -57936:31059, -57937:31098, -57938:31103, -57939:31114, -57940:31133, -57941:31143, -57942:40779, -57943:31146, -57944:31150, -57945:31155, -57946:31161, -57947:31162, -57948:31177, -57949:31189, -57950:31207, -57951:31212, -57952:31201, -57953:31203, -57954:31240, -57955:31245, -57956:31256, -57957:31257, -57958:31264, -57959:31263, -57960:31104, -57961:31281, -57962:31291, -57963:31294, -57964:31287, -57965:31299, -57966:31319, -57967:31305, -57968:31329, -57969:31330, -57970:31337, -57971:40861, -57972:31344, -57973:31353, -57974:31357, -57975:31368, -57976:31383, -57977:31381, -57978:31384, -57979:31382, -57980:31401, -57981:31432, -57982:31408, -57984:31414, -57985:31429, -57986:31428, -57987:31423, -57988:36995, -57989:31431, -57990:31434, -57991:31437, -57992:31439, -57993:31445, -57994:31443, -57995:31449, -57996:31450, -57997:31453, -57998:31457, -57999:31458, -58000:31462, -58001:31469, -58002:31472, -58003:31490, -58004:31503, -58005:31498, -58006:31494, -58007:31539, -58008:31512, -58009:31513, -58010:31518, -58011:31541, -58012:31528, -58013:31542, -58014:31568, -58015:31610, -58016:31492, -58017:31565, -58018:31499, -58019:31564, -58020:31557, -58021:31605, -58022:31589, -58023:31604, -58024:31591, -58025:31600, -58026:31601, -58027:31596, -58028:31598, -58029:31645, -58030:31640, -58031:31647, -58032:31629, -58033:31644, -58034:31642, -58035:31627, -58036:31634, -58037:31631, -58038:31581, -58039:31641, -58040:31691, -58041:31681, -58042:31692, -58043:31695, -58044:31668, -58045:31686, -58046:31709, -58047:31721, -58048:31761, -58049:31764, -58050:31718, -58051:31717, -58052:31840, -58053:31744, -58054:31751, -58055:31763, -58056:31731, -58057:31735, -58058:31767, -58059:31757, -58060:31734, -58061:31779, -58062:31783, -58063:31786, -58064:31775, -58065:31799, -58066:31787, -58067:31805, -58068:31820, -58069:31811, -58070:31828, -58071:31823, -58072:31808, -58073:31824, -58074:31832, -58075:31839, -58076:31844, -58077:31830, -58078:31845, -58079:31852, -58080:31861, -58081:31875, -58082:31888, -58083:31908, -58084:31917, -58085:31906, -58086:31915, -58087:31905, -58088:31912, -58089:31923, -58090:31922, -58091:31921, -58092:31918, -58093:31929, -58094:31933, -58095:31936, -58096:31941, -58097:31938, -58098:31960, -58099:31954, -58100:31964, -58101:31970, -58102:39739, -58103:31983, -58104:31986, -58105:31988, -58106:31990, -58107:31994, -58108:32006, -58176:32002, -58177:32028, -58178:32021, -58179:32010, -58180:32069, -58181:32075, -58182:32046, -58183:32050, -58184:32063, -58185:32053, -58186:32070, -58187:32115, -58188:32086, -58189:32078, -58190:32114, -58191:32104, -58192:32110, -58193:32079, -58194:32099, -58195:32147, -58196:32137, -58197:32091, -58198:32143, -58199:32125, -58200:32155, -58201:32186, -58202:32174, -58203:32163, -58204:32181, -58205:32199, -58206:32189, -58207:32171, -58208:32317, -58209:32162, -58210:32175, -58211:32220, -58212:32184, -58213:32159, -58214:32176, -58215:32216, -58216:32221, -58217:32228, -58218:32222, -58219:32251, -58220:32242, -58221:32225, -58222:32261, -58223:32266, -58224:32291, -58225:32289, -58226:32274, -58227:32305, -58228:32287, -58229:32265, -58230:32267, -58231:32290, -58232:32326, -58233:32358, -58234:32315, -58235:32309, -58236:32313, -58237:32323, -58238:32311, -58240:32306, -58241:32314, -58242:32359, -58243:32349, -58244:32342, -58245:32350, -58246:32345, -58247:32346, -58248:32377, -58249:32362, -58250:32361, -58251:32380, -58252:32379, -58253:32387, -58254:32213, -58255:32381, -58256:36782, -58257:32383, -58258:32392, -58259:32393, -58260:32396, -58261:32402, -58262:32400, -58263:32403, -58264:32404, -58265:32406, -58266:32398, -58267:32411, -58268:32412, -58269:32568, -58270:32570, -58271:32581, -58272:32588, -58273:32589, -58274:32590, -58275:32592, -58276:32593, -58277:32597, -58278:32596, -58279:32600, -58280:32607, -58281:32608, -58282:32616, -58283:32617, -58284:32615, -58285:32632, -58286:32642, -58287:32646, -58288:32643, -58289:32648, -58290:32647, -58291:32652, -58292:32660, -58293:32670, -58294:32669, -58295:32666, -58296:32675, -58297:32687, -58298:32690, -58299:32697, -58300:32686, -58301:32694, -58302:32696, -58303:35697, -58304:32709, -58305:32710, -58306:32714, -58307:32725, -58308:32724, -58309:32737, -58310:32742, -58311:32745, -58312:32755, -58313:32761, -58314:39132, -58315:32774, -58316:32772, -58317:32779, -58318:32786, -58319:32792, -58320:32793, -58321:32796, -58322:32801, -58323:32808, -58324:32831, -58325:32827, -58326:32842, -58327:32838, -58328:32850, -58329:32856, -58330:32858, -58331:32863, -58332:32866, -58333:32872, -58334:32883, -58335:32882, -58336:32880, -58337:32886, -58338:32889, -58339:32893, -58340:32895, -58341:32900, -58342:32902, -58343:32901, -58344:32923, -58345:32915, -58346:32922, -58347:32941, -58348:20880, -58349:32940, -58350:32987, -58351:32997, -58352:32985, -58353:32989, -58354:32964, -58355:32986, -58356:32982, -58357:33033, -58358:33007, -58359:33009, -58360:33051, -58361:33065, -58362:33059, -58363:33071, -58364:33099, -58432:38539, -58433:33094, -58434:33086, -58435:33107, -58436:33105, -58437:33020, -58438:33137, -58439:33134, -58440:33125, -58441:33126, -58442:33140, -58443:33155, -58444:33160, -58445:33162, -58446:33152, -58447:33154, -58448:33184, -58449:33173, -58450:33188, -58451:33187, -58452:33119, -58453:33171, -58454:33193, -58455:33200, -58456:33205, -58457:33214, -58458:33208, -58459:33213, -58460:33216, -58461:33218, -58462:33210, -58463:33225, -58464:33229, -58465:33233, -58466:33241, -58467:33240, -58468:33224, -58469:33242, -58470:33247, -58471:33248, -58472:33255, -58473:33274, -58474:33275, -58475:33278, -58476:33281, -58477:33282, -58478:33285, -58479:33287, -58480:33290, -58481:33293, -58482:33296, -58483:33302, -58484:33321, -58485:33323, -58486:33336, -58487:33331, -58488:33344, -58489:33369, -58490:33368, -58491:33373, -58492:33370, -58493:33375, -58494:33380, -58496:33378, -58497:33384, -58498:33386, -58499:33387, -58500:33326, -58501:33393, -58502:33399, -58503:33400, -58504:33406, -58505:33421, -58506:33426, -58507:33451, -58508:33439, -58509:33467, -58510:33452, -58511:33505, -58512:33507, -58513:33503, -58514:33490, -58515:33524, -58516:33523, -58517:33530, -58518:33683, -58519:33539, -58520:33531, -58521:33529, -58522:33502, -58523:33542, -58524:33500, -58525:33545, -58526:33497, -58527:33589, -58528:33588, -58529:33558, -58530:33586, -58531:33585, -58532:33600, -58533:33593, -58534:33616, -58535:33605, -58536:33583, -58537:33579, -58538:33559, -58539:33560, -58540:33669, -58541:33690, -58542:33706, -58543:33695, -58544:33698, -58545:33686, -58546:33571, -58547:33678, -58548:33671, -58549:33674, -58550:33660, -58551:33717, -58552:33651, -58553:33653, -58554:33696, -58555:33673, -58556:33704, -58557:33780, -58558:33811, -58559:33771, -58560:33742, -58561:33789, -58562:33795, -58563:33752, -58564:33803, -58565:33729, -58566:33783, -58567:33799, -58568:33760, -58569:33778, -58570:33805, -58571:33826, -58572:33824, -58573:33725, -58574:33848, -58575:34054, -58576:33787, -58577:33901, -58578:33834, -58579:33852, -58580:34138, -58581:33924, -58582:33911, -58583:33899, -58584:33965, -58585:33902, -58586:33922, -58587:33897, -58588:33862, -58589:33836, -58590:33903, -58591:33913, -58592:33845, -58593:33994, -58594:33890, -58595:33977, -58596:33983, -58597:33951, -58598:34009, -58599:33997, -58600:33979, -58601:34010, -58602:34000, -58603:33985, -58604:33990, -58605:34006, -58606:33953, -58607:34081, -58608:34047, -58609:34036, -58610:34071, -58611:34072, -58612:34092, -58613:34079, -58614:34069, -58615:34068, -58616:34044, -58617:34112, -58618:34147, -58619:34136, -58620:34120, -58688:34113, -58689:34306, -58690:34123, -58691:34133, -58692:34176, -58693:34212, -58694:34184, -58695:34193, -58696:34186, -58697:34216, -58698:34157, -58699:34196, -58700:34203, -58701:34282, -58702:34183, -58703:34204, -58704:34167, -58705:34174, -58706:34192, -58707:34249, -58708:34234, -58709:34255, -58710:34233, -58711:34256, -58712:34261, -58713:34269, -58714:34277, -58715:34268, -58716:34297, -58717:34314, -58718:34323, -58719:34315, -58720:34302, -58721:34298, -58722:34310, -58723:34338, -58724:34330, -58725:34352, -58726:34367, -58727:34381, -58728:20053, -58729:34388, -58730:34399, -58731:34407, -58732:34417, -58733:34451, -58734:34467, -58735:34473, -58736:34474, -58737:34443, -58738:34444, -58739:34486, -58740:34479, -58741:34500, -58742:34502, -58743:34480, -58744:34505, -58745:34851, -58746:34475, -58747:34516, -58748:34526, -58749:34537, -58750:34540, -58752:34527, -58753:34523, -58754:34543, -58755:34578, -58756:34566, -58757:34568, -58758:34560, -58759:34563, -58760:34555, -58761:34577, -58762:34569, -58763:34573, -58764:34553, -58765:34570, -58766:34612, -58767:34623, -58768:34615, -58769:34619, -58770:34597, -58771:34601, -58772:34586, -58773:34656, -58774:34655, -58775:34680, -58776:34636, -58777:34638, -58778:34676, -58779:34647, -58780:34664, -58781:34670, -58782:34649, -58783:34643, -58784:34659, -58785:34666, -58786:34821, -58787:34722, -58788:34719, -58789:34690, -58790:34735, -58791:34763, -58792:34749, -58793:34752, -58794:34768, -58795:38614, -58796:34731, -58797:34756, -58798:34739, -58799:34759, -58800:34758, -58801:34747, -58802:34799, -58803:34802, -58804:34784, -58805:34831, -58806:34829, -58807:34814, -58808:34806, -58809:34807, -58810:34830, -58811:34770, -58812:34833, -58813:34838, -58814:34837, -58815:34850, -58816:34849, -58817:34865, -58818:34870, -58819:34873, -58820:34855, -58821:34875, -58822:34884, -58823:34882, -58824:34898, -58825:34905, -58826:34910, -58827:34914, -58828:34923, -58829:34945, -58830:34942, -58831:34974, -58832:34933, -58833:34941, -58834:34997, -58835:34930, -58836:34946, -58837:34967, -58838:34962, -58839:34990, -58840:34969, -58841:34978, -58842:34957, -58843:34980, -58844:34992, -58845:35007, -58846:34993, -58847:35011, -58848:35012, -58849:35028, -58850:35032, -58851:35033, -58852:35037, -58853:35065, -58854:35074, -58855:35068, -58856:35060, -58857:35048, -58858:35058, -58859:35076, -58860:35084, -58861:35082, -58862:35091, -58863:35139, -58864:35102, -58865:35109, -58866:35114, -58867:35115, -58868:35137, -58869:35140, -58870:35131, -58871:35126, -58872:35128, -58873:35148, -58874:35101, -58875:35168, -58876:35166, -58944:35174, -58945:35172, -58946:35181, -58947:35178, -58948:35183, -58949:35188, -58950:35191, -58951:35198, -58952:35203, -58953:35208, -58954:35210, -58955:35219, -58956:35224, -58957:35233, -58958:35241, -58959:35238, -58960:35244, -58961:35247, -58962:35250, -58963:35258, -58964:35261, -58965:35263, -58966:35264, -58967:35290, -58968:35292, -58969:35293, -58970:35303, -58971:35316, -58972:35320, -58973:35331, -58974:35350, -58975:35344, -58976:35340, -58977:35355, -58978:35357, -58979:35365, -58980:35382, -58981:35393, -58982:35419, -58983:35410, -58984:35398, -58985:35400, -58986:35452, -58987:35437, -58988:35436, -58989:35426, -58990:35461, -58991:35458, -58992:35460, -58993:35496, -58994:35489, -58995:35473, -58996:35493, -58997:35494, -58998:35482, -58999:35491, -59000:35524, -59001:35533, -59002:35522, -59003:35546, -59004:35563, -59005:35571, -59006:35559, -59008:35556, -59009:35569, -59010:35604, -59011:35552, -59012:35554, -59013:35575, -59014:35550, -59015:35547, -59016:35596, -59017:35591, -59018:35610, -59019:35553, -59020:35606, -59021:35600, -59022:35607, -59023:35616, -59024:35635, -59025:38827, -59026:35622, -59027:35627, -59028:35646, -59029:35624, -59030:35649, -59031:35660, -59032:35663, -59033:35662, -59034:35657, -59035:35670, -59036:35675, -59037:35674, -59038:35691, -59039:35679, -59040:35692, -59041:35695, -59042:35700, -59043:35709, -59044:35712, -59045:35724, -59046:35726, -59047:35730, -59048:35731, -59049:35734, -59050:35737, -59051:35738, -59052:35898, -59053:35905, -59054:35903, -59055:35912, -59056:35916, -59057:35918, -59058:35920, -59059:35925, -59060:35938, -59061:35948, -59062:35960, -59063:35962, -59064:35970, -59065:35977, -59066:35973, -59067:35978, -59068:35981, -59069:35982, -59070:35988, -59071:35964, -59072:35992, -59073:25117, -59074:36013, -59075:36010, -59076:36029, -59077:36018, -59078:36019, -59079:36014, -59080:36022, -59081:36040, -59082:36033, -59083:36068, -59084:36067, -59085:36058, -59086:36093, -59087:36090, -59088:36091, -59089:36100, -59090:36101, -59091:36106, -59092:36103, -59093:36111, -59094:36109, -59095:36112, -59096:40782, -59097:36115, -59098:36045, -59099:36116, -59100:36118, -59101:36199, -59102:36205, -59103:36209, -59104:36211, -59105:36225, -59106:36249, -59107:36290, -59108:36286, -59109:36282, -59110:36303, -59111:36314, -59112:36310, -59113:36300, -59114:36315, -59115:36299, -59116:36330, -59117:36331, -59118:36319, -59119:36323, -59120:36348, -59121:36360, -59122:36361, -59123:36351, -59124:36381, -59125:36382, -59126:36368, -59127:36383, -59128:36418, -59129:36405, -59130:36400, -59131:36404, -59132:36426, -59200:36423, -59201:36425, -59202:36428, -59203:36432, -59204:36424, -59205:36441, -59206:36452, -59207:36448, -59208:36394, -59209:36451, -59210:36437, -59211:36470, -59212:36466, -59213:36476, -59214:36481, -59215:36487, -59216:36485, -59217:36484, -59218:36491, -59219:36490, -59220:36499, -59221:36497, -59222:36500, -59223:36505, -59224:36522, -59225:36513, -59226:36524, -59227:36528, -59228:36550, -59229:36529, -59230:36542, -59231:36549, -59232:36552, -59233:36555, -59234:36571, -59235:36579, -59236:36604, -59237:36603, -59238:36587, -59239:36606, -59240:36618, -59241:36613, -59242:36629, -59243:36626, -59244:36633, -59245:36627, -59246:36636, -59247:36639, -59248:36635, -59249:36620, -59250:36646, -59251:36659, -59252:36667, -59253:36665, -59254:36677, -59255:36674, -59256:36670, -59257:36684, -59258:36681, -59259:36678, -59260:36686, -59261:36695, -59262:36700, -59264:36706, -59265:36707, -59266:36708, -59267:36764, -59268:36767, -59269:36771, -59270:36781, -59271:36783, -59272:36791, -59273:36826, -59274:36837, -59275:36834, -59276:36842, -59277:36847, -59278:36999, -59279:36852, -59280:36869, -59281:36857, -59282:36858, -59283:36881, -59284:36885, -59285:36897, -59286:36877, -59287:36894, -59288:36886, -59289:36875, -59290:36903, -59291:36918, -59292:36917, -59293:36921, -59294:36856, -59295:36943, -59296:36944, -59297:36945, -59298:36946, -59299:36878, -59300:36937, -59301:36926, -59302:36950, -59303:36952, -59304:36958, -59305:36968, -59306:36975, -59307:36982, -59308:38568, -59309:36978, -59310:36994, -59311:36989, -59312:36993, -59313:36992, -59314:37002, -59315:37001, -59316:37007, -59317:37032, -59318:37039, -59319:37041, -59320:37045, -59321:37090, -59322:37092, -59323:25160, -59324:37083, -59325:37122, -59326:37138, -59327:37145, -59328:37170, -59329:37168, -59330:37194, -59331:37206, -59332:37208, -59333:37219, -59334:37221, -59335:37225, -59336:37235, -59337:37234, -59338:37259, -59339:37257, -59340:37250, -59341:37282, -59342:37291, -59343:37295, -59344:37290, -59345:37301, -59346:37300, -59347:37306, -59348:37312, -59349:37313, -59350:37321, -59351:37323, -59352:37328, -59353:37334, -59354:37343, -59355:37345, -59356:37339, -59357:37372, -59358:37365, -59359:37366, -59360:37406, -59361:37375, -59362:37396, -59363:37420, -59364:37397, -59365:37393, -59366:37470, -59367:37463, -59368:37445, -59369:37449, -59370:37476, -59371:37448, -59372:37525, -59373:37439, -59374:37451, -59375:37456, -59376:37532, -59377:37526, -59378:37523, -59379:37531, -59380:37466, -59381:37583, -59382:37561, -59383:37559, -59384:37609, -59385:37647, -59386:37626, -59387:37700, -59388:37678, -59456:37657, -59457:37666, -59458:37658, -59459:37667, -59460:37690, -59461:37685, -59462:37691, -59463:37724, -59464:37728, -59465:37756, -59466:37742, -59467:37718, -59468:37808, -59469:37804, -59470:37805, -59471:37780, -59472:37817, -59473:37846, -59474:37847, -59475:37864, -59476:37861, -59477:37848, -59478:37827, -59479:37853, -59480:37840, -59481:37832, -59482:37860, -59483:37914, -59484:37908, -59485:37907, -59486:37891, -59487:37895, -59488:37904, -59489:37942, -59490:37931, -59491:37941, -59492:37921, -59493:37946, -59494:37953, -59495:37970, -59496:37956, -59497:37979, -59498:37984, -59499:37986, -59500:37982, -59501:37994, -59502:37417, -59503:38000, -59504:38005, -59505:38007, -59506:38013, -59507:37978, -59508:38012, -59509:38014, -59510:38017, -59511:38015, -59512:38274, -59513:38279, -59514:38282, -59515:38292, -59516:38294, -59517:38296, -59518:38297, -59520:38304, -59521:38312, -59522:38311, -59523:38317, -59524:38332, -59525:38331, -59526:38329, -59527:38334, -59528:38346, -59529:28662, -59530:38339, -59531:38349, -59532:38348, -59533:38357, -59534:38356, -59535:38358, -59536:38364, -59537:38369, -59538:38373, -59539:38370, -59540:38433, -59541:38440, -59542:38446, -59543:38447, -59544:38466, -59545:38476, -59546:38479, -59547:38475, -59548:38519, -59549:38492, -59550:38494, -59551:38493, -59552:38495, -59553:38502, -59554:38514, -59555:38508, -59556:38541, -59557:38552, -59558:38549, -59559:38551, -59560:38570, -59561:38567, -59562:38577, -59563:38578, -59564:38576, -59565:38580, -59566:38582, -59567:38584, -59568:38585, -59569:38606, -59570:38603, -59571:38601, -59572:38605, -59573:35149, -59574:38620, -59575:38669, -59576:38613, -59577:38649, -59578:38660, -59579:38662, -59580:38664, -59581:38675, -59582:38670, -59583:38673, -59584:38671, -59585:38678, -59586:38681, -59587:38692, -59588:38698, -59589:38704, -59590:38713, -59591:38717, -59592:38718, -59593:38724, -59594:38726, -59595:38728, -59596:38722, -59597:38729, -59598:38748, -59599:38752, -59600:38756, -59601:38758, -59602:38760, -59603:21202, -59604:38763, -59605:38769, -59606:38777, -59607:38789, -59608:38780, -59609:38785, -59610:38778, -59611:38790, -59612:38795, -59613:38799, -59614:38800, -59615:38812, -59616:38824, -59617:38822, -59618:38819, -59619:38835, -59620:38836, -59621:38851, -59622:38854, -59623:38856, -59624:38859, -59625:38876, -59626:38893, -59627:40783, -59628:38898, -59629:31455, -59630:38902, -59631:38901, -59632:38927, -59633:38924, -59634:38968, -59635:38948, -59636:38945, -59637:38967, -59638:38973, -59639:38982, -59640:38991, -59641:38987, -59642:39019, -59643:39023, -59644:39024, -59712:39025, -59713:39028, -59714:39027, -59715:39082, -59716:39087, -59717:39089, -59718:39094, -59719:39108, -59720:39107, -59721:39110, -59722:39145, -59723:39147, -59724:39171, -59725:39177, -59726:39186, -59727:39188, -59728:39192, -59729:39201, -59730:39197, -59731:39198, -59732:39204, -59733:39200, -59734:39212, -59735:39214, -59736:39229, -59737:39230, -59738:39234, -59739:39241, -59740:39237, -59741:39248, -59742:39243, -59743:39249, -59744:39250, -59745:39244, -59746:39253, -59747:39319, -59748:39320, -59749:39333, -59750:39341, -59751:39342, -59752:39356, -59753:39391, -59754:39387, -59755:39389, -59756:39384, -59757:39377, -59758:39405, -59759:39406, -59760:39409, -59761:39410, -59762:39419, -59763:39416, -59764:39425, -59765:39439, -59766:39429, -59767:39394, -59768:39449, -59769:39467, -59770:39479, -59771:39493, -59772:39490, -59773:39488, -59774:39491, -59776:39486, -59777:39509, -59778:39501, -59779:39515, -59780:39511, -59781:39519, -59782:39522, -59783:39525, -59784:39524, -59785:39529, -59786:39531, -59787:39530, -59788:39597, -59789:39600, -59790:39612, -59791:39616, -59792:39631, -59793:39633, -59794:39635, -59795:39636, -59796:39646, -59797:39647, -59798:39650, -59799:39651, -59800:39654, -59801:39663, -59802:39659, -59803:39662, -59804:39668, -59805:39665, -59806:39671, -59807:39675, -59808:39686, -59809:39704, -59810:39706, -59811:39711, -59812:39714, -59813:39715, -59814:39717, -59815:39719, -59816:39720, -59817:39721, -59818:39722, -59819:39726, -59820:39727, -59821:39730, -59822:39748, -59823:39747, -59824:39759, -59825:39757, -59826:39758, -59827:39761, -59828:39768, -59829:39796, -59830:39827, -59831:39811, -59832:39825, -59833:39830, -59834:39831, -59835:39839, -59836:39840, -59837:39848, -59838:39860, -59839:39872, -59840:39882, -59841:39865, -59842:39878, -59843:39887, -59844:39889, -59845:39890, -59846:39907, -59847:39906, -59848:39908, -59849:39892, -59850:39905, -59851:39994, -59852:39922, -59853:39921, -59854:39920, -59855:39957, -59856:39956, -59857:39945, -59858:39955, -59859:39948, -59860:39942, -59861:39944, -59862:39954, -59863:39946, -59864:39940, -59865:39982, -59866:39963, -59867:39973, -59868:39972, -59869:39969, -59870:39984, -59871:40007, -59872:39986, -59873:40006, -59874:39998, -59875:40026, -59876:40032, -59877:40039, -59878:40054, -59879:40056, -59880:40167, -59881:40172, -59882:40176, -59883:40201, -59884:40200, -59885:40171, -59886:40195, -59887:40198, -59888:40234, -59889:40230, -59890:40367, -59891:40227, -59892:40223, -59893:40260, -59894:40213, -59895:40210, -59896:40257, -59897:40255, -59898:40254, -59899:40262, -59900:40264, -59968:40285, -59969:40286, -59970:40292, -59971:40273, -59972:40272, -59973:40281, -59974:40306, -59975:40329, -59976:40327, -59977:40363, -59978:40303, -59979:40314, -59980:40346, -59981:40356, -59982:40361, -59983:40370, -59984:40388, -59985:40385, -59986:40379, -59987:40376, -59988:40378, -59989:40390, -59990:40399, -59991:40386, -59992:40409, -59993:40403, -59994:40440, -59995:40422, -59996:40429, -59997:40431, -59998:40445, -59999:40474, -60000:40475, -60001:40478, -60002:40565, -60003:40569, -60004:40573, -60005:40577, -60006:40584, -60007:40587, -60008:40588, -60009:40594, -60010:40597, -60011:40593, -60012:40605, -60013:40613, -60014:40617, -60015:40632, -60016:40618, -60017:40621, -60018:38753, -60019:40652, -60020:40654, -60021:40655, -60022:40656, -60023:40660, -60024:40668, -60025:40670, -60026:40669, -60027:40672, -60028:40677, -60029:40680, -60030:40687, -60032:40692, -60033:40694, -60034:40695, -60035:40697, -60036:40699, -60037:40700, -60038:40701, -60039:40711, -60040:40712, -60041:30391, -60042:40725, -60043:40737, -60044:40748, -60045:40766, -60046:40778, -60047:40786, -60048:40788, -60049:40803, -60050:40799, -60051:40800, -60052:40801, -60053:40806, -60054:40807, -60055:40812, -60056:40810, -60057:40823, -60058:40818, -60059:40822, -60060:40853, -60061:40860, -60062:40864, -60063:22575, -60064:27079, -60065:36953, -60066:29796, -60067:20956, -60068:29081, -60736:32394, -60737:35100, -60738:37704, -60739:37512, -60740:34012, -60741:20425, -60742:28859, -60743:26161, -60744:26824, -60745:37625, -60746:26363, -60747:24389, -60748:20008, -60749:20193, -60750:20220, -60751:20224, -60752:20227, -60753:20281, -60754:20310, -60755:20370, -60756:20362, -60757:20378, -60758:20372, -60759:20429, -60760:20544, -60761:20514, -60762:20479, -60763:20510, -60764:20550, -60765:20592, -60766:20546, -60767:20628, -60768:20724, -60769:20696, -60770:20810, -60771:20836, -60772:20893, -60773:20926, -60774:20972, -60775:21013, -60776:21148, -60777:21158, -60778:21184, -60779:21211, -60780:21248, -60781:21255, -60782:21284, -60783:21362, -60784:21395, -60785:21426, -60786:21469, -60787:64014, -60788:21660, -60789:21642, -60790:21673, -60791:21759, -60792:21894, -60793:22361, -60794:22373, -60795:22444, -60796:22472, -60797:22471, -60798:64015, -60800:64016, -60801:22686, -60802:22706, -60803:22795, -60804:22867, -60805:22875, -60806:22877, -60807:22883, -60808:22948, -60809:22970, -60810:23382, -60811:23488, -60812:29999, -60813:23512, -60814:23532, -60815:23582, -60816:23718, -60817:23738, -60818:23797, -60819:23847, -60820:23891, -60821:64017, -60822:23874, -60823:23917, -60824:23992, -60825:23993, -60826:24016, -60827:24353, -60828:24372, -60829:24423, -60830:24503, -60831:24542, -60832:24669, -60833:24709, -60834:24714, -60835:24798, -60836:24789, -60837:24864, -60838:24818, -60839:24849, -60840:24887, -60841:24880, -60842:24984, -60843:25107, -60844:25254, -60845:25589, -60846:25696, -60847:25757, -60848:25806, -60849:25934, -60850:26112, -60851:26133, -60852:26171, -60853:26121, -60854:26158, -60855:26142, -60856:26148, -60857:26213, -60858:26199, -60859:26201, -60860:64018, -60861:26227, -60862:26265, -60863:26272, -60864:26290, -60865:26303, -60866:26362, -60867:26382, -60868:63785, -60869:26470, -60870:26555, -60871:26706, -60872:26560, -60873:26625, -60874:26692, -60875:26831, -60876:64019, -60877:26984, -60878:64020, -60879:27032, -60880:27106, -60881:27184, -60882:27243, -60883:27206, -60884:27251, -60885:27262, -60886:27362, -60887:27364, -60888:27606, -60889:27711, -60890:27740, -60891:27782, -60892:27759, -60893:27866, -60894:27908, -60895:28039, -60896:28015, -60897:28054, -60898:28076, -60899:28111, -60900:28152, -60901:28146, -60902:28156, -60903:28217, -60904:28252, -60905:28199, -60906:28220, -60907:28351, -60908:28552, -60909:28597, -60910:28661, -60911:28677, -60912:28679, -60913:28712, -60914:28805, -60915:28843, -60916:28943, -60917:28932, -60918:29020, -60919:28998, -60920:28999, -60921:64021, -60922:29121, -60923:29182, -60924:29361, -60992:29374, -60993:29476, -60994:64022, -60995:29559, -60996:29629, -60997:29641, -60998:29654, -60999:29667, -61000:29650, -61001:29703, -61002:29685, -61003:29734, -61004:29738, -61005:29737, -61006:29742, -61007:29794, -61008:29833, -61009:29855, -61010:29953, -61011:30063, -61012:30338, -61013:30364, -61014:30366, -61015:30363, -61016:30374, -61017:64023, -61018:30534, -61019:21167, -61020:30753, -61021:30798, -61022:30820, -61023:30842, -61024:31024, -61025:64024, -61026:64025, -61027:64026, -61028:31124, -61029:64027, -61030:31131, -61031:31441, -61032:31463, -61033:64028, -61034:31467, -61035:31646, -61036:64029, -61037:32072, -61038:32092, -61039:32183, -61040:32160, -61041:32214, -61042:32338, -61043:32583, -61044:32673, -61045:64030, -61046:33537, -61047:33634, -61048:33663, -61049:33735, -61050:33782, -61051:33864, -61052:33972, -61053:34131, -61054:34137, -61056:34155, -61057:64031, -61058:34224, -61059:64032, -61060:64033, -61061:34823, -61062:35061, -61063:35346, -61064:35383, -61065:35449, -61066:35495, -61067:35518, -61068:35551, -61069:64034, -61070:35574, -61071:35667, -61072:35711, -61073:36080, -61074:36084, -61075:36114, -61076:36214, -61077:64035, -61078:36559, -61079:64036, -61080:64037, -61081:36967, -61082:37086, -61083:64038, -61084:37141, -61085:37159, -61086:37338, -61087:37335, -61088:37342, -61089:37357, -61090:37358, -61091:37348, -61092:37349, -61093:37382, -61094:37392, -61095:37386, -61096:37434, -61097:37440, -61098:37436, -61099:37454, -61100:37465, -61101:37457, -61102:37433, -61103:37479, -61104:37543, -61105:37495, -61106:37496, -61107:37607, -61108:37591, -61109:37593, -61110:37584, -61111:64039, -61112:37589, -61113:37600, -61114:37587, -61115:37669, -61116:37665, -61117:37627, -61118:64040, -61119:37662, -61120:37631, -61121:37661, -61122:37634, -61123:37744, -61124:37719, -61125:37796, -61126:37830, -61127:37854, -61128:37880, -61129:37937, -61130:37957, -61131:37960, -61132:38290, -61133:63964, -61134:64041, -61135:38557, -61136:38575, -61137:38707, -61138:38715, -61139:38723, -61140:38733, -61141:38735, -61142:38737, -61143:38741, -61144:38999, -61145:39013, -61146:64042, -61147:64043, -61148:39207, -61149:64044, -61150:39326, -61151:39502, -61152:39641, -61153:39644, -61154:39797, -61155:39794, -61156:39823, -61157:39857, -61158:39867, -61159:39936, -61160:40304, -61161:40299, -61162:64045, -61163:40473, -61164:40657, -61167:8560, -61168:8561, -61169:8562, -61170:8563, -61171:8564, -61172:8565, -61173:8566, -61174:8567, -61175:8568, -61176:8569, -61177:65506, -61178:65508, -61179:65287, -61180:65282, -61504:57344, -61505:57345, -61506:57346, -61507:57347, -61508:57348, -61509:57349, -61510:57350, -61511:57351, -61512:57352, -61513:57353, -61514:57354, -61515:57355, -61516:57356, -61517:57357, -61518:57358, -61519:57359, -61520:57360, -61521:57361, -61522:57362, -61523:57363, -61524:57364, -61525:57365, -61526:57366, -61527:57367, -61528:57368, -61529:57369, -61530:57370, -61531:57371, -61532:57372, -61533:57373, -61534:57374, -61535:57375, -61536:57376, -61537:57377, -61538:57378, -61539:57379, -61540:57380, -61541:57381, -61542:57382, -61543:57383, -61544:57384, -61545:57385, -61546:57386, -61547:57387, -61548:57388, -61549:57389, -61550:57390, -61551:57391, -61552:57392, -61553:57393, -61554:57394, -61555:57395, -61556:57396, -61557:57397, -61558:57398, -61559:57399, -61560:57400, -61561:57401, -61562:57402, -61563:57403, -61564:57404, -61565:57405, -61566:57406, -61568:57407, -61569:57408, -61570:57409, -61571:57410, -61572:57411, -61573:57412, -61574:57413, -61575:57414, -61576:57415, -61577:57416, -61578:57417, -61579:57418, -61580:57419, -61581:57420, -61582:57421, -61583:57422, -61584:57423, -61585:57424, -61586:57425, -61587:57426, -61588:57427, -61589:57428, -61590:57429, -61591:57430, -61592:57431, -61593:57432, -61594:57433, -61595:57434, -61596:57435, -61597:57436, -61598:57437, -61599:57438, -61600:57439, -61601:57440, -61602:57441, -61603:57442, -61604:57443, -61605:57444, -61606:57445, -61607:57446, -61608:57447, -61609:57448, -61610:57449, -61611:57450, -61612:57451, -61613:57452, -61614:57453, -61615:57454, -61616:57455, -61617:57456, -61618:57457, -61619:57458, -61620:57459, -61621:57460, -61622:57461, -61623:57462, -61624:57463, -61625:57464, -61626:57465, -61627:57466, -61628:57467, -61629:57468, -61630:57469, -61631:57470, -61632:57471, -61633:57472, -61634:57473, -61635:57474, -61636:57475, -61637:57476, -61638:57477, -61639:57478, -61640:57479, -61641:57480, -61642:57481, -61643:57482, -61644:57483, -61645:57484, -61646:57485, -61647:57486, -61648:57487, -61649:57488, -61650:57489, -61651:57490, -61652:57491, -61653:57492, -61654:57493, -61655:57494, -61656:57495, -61657:57496, -61658:57497, -61659:57498, -61660:57499, -61661:57500, -61662:57501, -61663:57502, -61664:57503, -61665:57504, -61666:57505, -61667:57506, -61668:57507, -61669:57508, -61670:57509, -61671:57510, -61672:57511, -61673:57512, -61674:57513, -61675:57514, -61676:57515, -61677:57516, -61678:57517, -61679:57518, -61680:57519, -61681:57520, -61682:57521, -61683:57522, -61684:57523, -61685:57524, -61686:57525, -61687:57526, -61688:57527, -61689:57528, -61690:57529, -61691:57530, -61692:57531, -61760:57532, -61761:57533, -61762:57534, -61763:57535, -61764:57536, -61765:57537, -61766:57538, -61767:57539, -61768:57540, -61769:57541, -61770:57542, -61771:57543, -61772:57544, -61773:57545, -61774:57546, -61775:57547, -61776:57548, -61777:57549, -61778:57550, -61779:57551, -61780:57552, -61781:57553, -61782:57554, -61783:57555, -61784:57556, -61785:57557, -61786:57558, -61787:57559, -61788:57560, -61789:57561, -61790:57562, -61791:57563, -61792:57564, -61793:57565, -61794:57566, -61795:57567, -61796:57568, -61797:57569, -61798:57570, -61799:57571, -61800:57572, -61801:57573, -61802:57574, -61803:57575, -61804:57576, -61805:57577, -61806:57578, -61807:57579, -61808:57580, -61809:57581, -61810:57582, -61811:57583, -61812:57584, -61813:57585, -61814:57586, -61815:57587, -61816:57588, -61817:57589, -61818:57590, -61819:57591, -61820:57592, -61821:57593, -61822:57594, -61824:57595, -61825:57596, -61826:57597, -61827:57598, -61828:57599, -61829:57600, -61830:57601, -61831:57602, -61832:57603, -61833:57604, -61834:57605, -61835:57606, -61836:57607, -61837:57608, -61838:57609, -61839:57610, -61840:57611, -61841:57612, -61842:57613, -61843:57614, -61844:57615, -61845:57616, -61846:57617, -61847:57618, -61848:57619, -61849:57620, -61850:57621, -61851:57622, -61852:57623, -61853:57624, -61854:57625, -61855:57626, -61856:57627, -61857:57628, -61858:57629, -61859:57630, -61860:57631, -61861:57632, -61862:57633, -61863:57634, -61864:57635, -61865:57636, -61866:57637, -61867:57638, -61868:57639, -61869:57640, -61870:57641, -61871:57642, -61872:57643, -61873:57644, -61874:57645, -61875:57646, -61876:57647, -61877:57648, -61878:57649, -61879:57650, -61880:57651, -61881:57652, -61882:57653, -61883:57654, -61884:57655, -61885:57656, -61886:57657, -61887:57658, -61888:57659, -61889:57660, -61890:57661, -61891:57662, -61892:57663, -61893:57664, -61894:57665, -61895:57666, -61896:57667, -61897:57668, -61898:57669, -61899:57670, -61900:57671, -61901:57672, -61902:57673, -61903:57674, -61904:57675, -61905:57676, -61906:57677, -61907:57678, -61908:57679, -61909:57680, -61910:57681, -61911:57682, -61912:57683, -61913:57684, -61914:57685, -61915:57686, -61916:57687, -61917:57688, -61918:57689, -61919:57690, -61920:57691, -61921:57692, -61922:57693, -61923:57694, -61924:57695, -61925:57696, -61926:57697, -61927:57698, -61928:57699, -61929:57700, -61930:57701, -61931:57702, -61932:57703, -61933:57704, -61934:57705, -61935:57706, -61936:57707, -61937:57708, -61938:57709, -61939:57710, -61940:57711, -61941:57712, -61942:57713, -61943:57714, -61944:57715, -61945:57716, -61946:57717, -61947:57718, -61948:57719, -62016:57720, -62017:57721, -62018:57722, -62019:57723, -62020:57724, -62021:57725, -62022:57726, -62023:57727, -62024:57728, -62025:57729, -62026:57730, -62027:57731, -62028:57732, -62029:57733, -62030:57734, -62031:57735, -62032:57736, -62033:57737, -62034:57738, -62035:57739, -62036:57740, -62037:57741, -62038:57742, -62039:57743, -62040:57744, -62041:57745, -62042:57746, -62043:57747, -62044:57748, -62045:57749, -62046:57750, -62047:57751, -62048:57752, -62049:57753, -62050:57754, -62051:57755, -62052:57756, -62053:57757, -62054:57758, -62055:57759, -62056:57760, -62057:57761, -62058:57762, -62059:57763, -62060:57764, -62061:57765, -62062:57766, -62063:57767, -62064:57768, -62065:57769, -62066:57770, -62067:57771, -62068:57772, -62069:57773, -62070:57774, -62071:57775, -62072:57776, -62073:57777, -62074:57778, -62075:57779, -62076:57780, -62077:57781, -62078:57782, -62080:57783, -62081:57784, -62082:57785, -62083:57786, -62084:57787, -62085:57788, -62086:57789, -62087:57790, -62088:57791, -62089:57792, -62090:57793, -62091:57794, -62092:57795, -62093:57796, -62094:57797, -62095:57798, -62096:57799, -62097:57800, -62098:57801, -62099:57802, -62100:57803, -62101:57804, -62102:57805, -62103:57806, -62104:57807, -62105:57808, -62106:57809, -62107:57810, -62108:57811, -62109:57812, -62110:57813, -62111:57814, -62112:57815, -62113:57816, -62114:57817, -62115:57818, -62116:57819, -62117:57820, -62118:57821, -62119:57822, -62120:57823, -62121:57824, -62122:57825, -62123:57826, -62124:57827, -62125:57828, -62126:57829, -62127:57830, -62128:57831, -62129:57832, -62130:57833, -62131:57834, -62132:57835, -62133:57836, -62134:57837, -62135:57838, -62136:57839, -62137:57840, -62138:57841, -62139:57842, -62140:57843, -62141:57844, -62142:57845, -62143:57846, -62144:57847, -62145:57848, -62146:57849, -62147:57850, -62148:57851, -62149:57852, -62150:57853, -62151:57854, -62152:57855, -62153:57856, -62154:57857, -62155:57858, -62156:57859, -62157:57860, -62158:57861, -62159:57862, -62160:57863, -62161:57864, -62162:57865, -62163:57866, -62164:57867, -62165:57868, -62166:57869, -62167:57870, -62168:57871, -62169:57872, -62170:57873, -62171:57874, -62172:57875, -62173:57876, -62174:57877, -62175:57878, -62176:57879, -62177:57880, -62178:57881, -62179:57882, -62180:57883, -62181:57884, -62182:57885, -62183:57886, -62184:57887, -62185:57888, -62186:57889, -62187:57890, -62188:57891, -62189:57892, -62190:57893, -62191:57894, -62192:57895, -62193:57896, -62194:57897, -62195:57898, -62196:57899, -62197:57900, -62198:57901, -62199:57902, -62200:57903, -62201:57904, -62202:57905, -62203:57906, -62204:57907, -62272:57908, -62273:57909, -62274:57910, -62275:57911, -62276:57912, -62277:57913, -62278:57914, -62279:57915, -62280:57916, -62281:57917, -62282:57918, -62283:57919, -62284:57920, -62285:57921, -62286:57922, -62287:57923, -62288:57924, -62289:57925, -62290:57926, -62291:57927, -62292:57928, -62293:57929, -62294:57930, -62295:57931, -62296:57932, -62297:57933, -62298:57934, -62299:57935, -62300:57936, -62301:57937, -62302:57938, -62303:57939, -62304:57940, -62305:57941, -62306:57942, -62307:57943, -62308:57944, -62309:57945, -62310:57946, -62311:57947, -62312:57948, -62313:57949, -62314:57950, -62315:57951, -62316:57952, -62317:57953, -62318:57954, -62319:57955, -62320:57956, -62321:57957, -62322:57958, -62323:57959, -62324:57960, -62325:57961, -62326:57962, -62327:57963, -62328:57964, -62329:57965, -62330:57966, -62331:57967, -62332:57968, -62333:57969, -62334:57970, -62336:57971, -62337:57972, -62338:57973, -62339:57974, -62340:57975, -62341:57976, -62342:57977, -62343:57978, -62344:57979, -62345:57980, -62346:57981, -62347:57982, -62348:57983, -62349:57984, -62350:57985, -62351:57986, -62352:57987, -62353:57988, -62354:57989, -62355:57990, -62356:57991, -62357:57992, -62358:57993, -62359:57994, -62360:57995, -62361:57996, -62362:57997, -62363:57998, -62364:57999, -62365:58000, -62366:58001, -62367:58002, -62368:58003, -62369:58004, -62370:58005, -62371:58006, -62372:58007, -62373:58008, -62374:58009, -62375:58010, -62376:58011, -62377:58012, -62378:58013, -62379:58014, -62380:58015, -62381:58016, -62382:58017, -62383:58018, -62384:58019, -62385:58020, -62386:58021, -62387:58022, -62388:58023, -62389:58024, -62390:58025, -62391:58026, -62392:58027, -62393:58028, -62394:58029, -62395:58030, -62396:58031, -62397:58032, -62398:58033, -62399:58034, -62400:58035, -62401:58036, -62402:58037, -62403:58038, -62404:58039, -62405:58040, -62406:58041, -62407:58042, -62408:58043, -62409:58044, -62410:58045, -62411:58046, -62412:58047, -62413:58048, -62414:58049, -62415:58050, -62416:58051, -62417:58052, -62418:58053, -62419:58054, -62420:58055, -62421:58056, -62422:58057, -62423:58058, -62424:58059, -62425:58060, -62426:58061, -62427:58062, -62428:58063, -62429:58064, -62430:58065, -62431:58066, -62432:58067, -62433:58068, -62434:58069, -62435:58070, -62436:58071, -62437:58072, -62438:58073, -62439:58074, -62440:58075, -62441:58076, -62442:58077, -62443:58078, -62444:58079, -62445:58080, -62446:58081, -62447:58082, -62448:58083, -62449:58084, -62450:58085, -62451:58086, -62452:58087, -62453:58088, -62454:58089, -62455:58090, -62456:58091, -62457:58092, -62458:58093, -62459:58094, -62460:58095, -62528:58096, -62529:58097, -62530:58098, -62531:58099, -62532:58100, -62533:58101, -62534:58102, -62535:58103, -62536:58104, -62537:58105, -62538:58106, -62539:58107, -62540:58108, -62541:58109, -62542:58110, -62543:58111, -62544:58112, -62545:58113, -62546:58114, -62547:58115, -62548:58116, -62549:58117, -62550:58118, -62551:58119, -62552:58120, -62553:58121, -62554:58122, -62555:58123, -62556:58124, -62557:58125, -62558:58126, -62559:58127, -62560:58128, -62561:58129, -62562:58130, -62563:58131, -62564:58132, -62565:58133, -62566:58134, -62567:58135, -62568:58136, -62569:58137, -62570:58138, -62571:58139, -62572:58140, -62573:58141, -62574:58142, -62575:58143, -62576:58144, -62577:58145, -62578:58146, -62579:58147, -62580:58148, -62581:58149, -62582:58150, -62583:58151, -62584:58152, -62585:58153, -62586:58154, -62587:58155, -62588:58156, -62589:58157, -62590:58158, -62592:58159, -62593:58160, -62594:58161, -62595:58162, -62596:58163, -62597:58164, -62598:58165, -62599:58166, -62600:58167, -62601:58168, -62602:58169, -62603:58170, -62604:58171, -62605:58172, -62606:58173, -62607:58174, -62608:58175, -62609:58176, -62610:58177, -62611:58178, -62612:58179, -62613:58180, -62614:58181, -62615:58182, -62616:58183, -62617:58184, -62618:58185, -62619:58186, -62620:58187, -62621:58188, -62622:58189, -62623:58190, -62624:58191, -62625:58192, -62626:58193, -62627:58194, -62628:58195, -62629:58196, -62630:58197, -62631:58198, -62632:58199, -62633:58200, -62634:58201, -62635:58202, -62636:58203, -62637:58204, -62638:58205, -62639:58206, -62640:58207, -62641:58208, -62642:58209, -62643:58210, -62644:58211, -62645:58212, -62646:58213, -62647:58214, -62648:58215, -62649:58216, -62650:58217, -62651:58218, -62652:58219, -62653:58220, -62654:58221, -62655:58222, -62656:58223, -62657:58224, -62658:58225, -62659:58226, -62660:58227, -62661:58228, -62662:58229, -62663:58230, -62664:58231, -62665:58232, -62666:58233, -62667:58234, -62668:58235, -62669:58236, -62670:58237, -62671:58238, -62672:58239, -62673:58240, -62674:58241, -62675:58242, -62676:58243, -62677:58244, -62678:58245, -62679:58246, -62680:58247, -62681:58248, -62682:58249, -62683:58250, -62684:58251, -62685:58252, -62686:58253, -62687:58254, -62688:58255, -62689:58256, -62690:58257, -62691:58258, -62692:58259, -62693:58260, -62694:58261, -62695:58262, -62696:58263, -62697:58264, -62698:58265, -62699:58266, -62700:58267, -62701:58268, -62702:58269, -62703:58270, -62704:58271, -62705:58272, -62706:58273, -62707:58274, -62708:58275, -62709:58276, -62710:58277, -62711:58278, -62712:58279, -62713:58280, -62714:58281, -62715:58282, -62716:58283, -62784:58284, -62785:58285, -62786:58286, -62787:58287, -62788:58288, -62789:58289, -62790:58290, -62791:58291, -62792:58292, -62793:58293, -62794:58294, -62795:58295, -62796:58296, -62797:58297, -62798:58298, -62799:58299, -62800:58300, -62801:58301, -62802:58302, -62803:58303, -62804:58304, -62805:58305, -62806:58306, -62807:58307, -62808:58308, -62809:58309, -62810:58310, -62811:58311, -62812:58312, -62813:58313, -62814:58314, -62815:58315, -62816:58316, -62817:58317, -62818:58318, -62819:58319, -62820:58320, -62821:58321, -62822:58322, -62823:58323, -62824:58324, -62825:58325, -62826:58326, -62827:58327, -62828:58328, -62829:58329, -62830:58330, -62831:58331, -62832:58332, -62833:58333, -62834:58334, -62835:58335, -62836:58336, -62837:58337, -62838:58338, -62839:58339, -62840:58340, -62841:58341, -62842:58342, -62843:58343, -62844:58344, -62845:58345, -62846:58346, -62848:58347, -62849:58348, -62850:58349, -62851:58350, -62852:58351, -62853:58352, -62854:58353, -62855:58354, -62856:58355, -62857:58356, -62858:58357, -62859:58358, -62860:58359, -62861:58360, -62862:58361, -62863:58362, -62864:58363, -62865:58364, -62866:58365, -62867:58366, -62868:58367, -62869:58368, -62870:58369, -62871:58370, -62872:58371, -62873:58372, -62874:58373, -62875:58374, -62876:58375, -62877:58376, -62878:58377, -62879:58378, -62880:58379, -62881:58380, -62882:58381, -62883:58382, -62884:58383, -62885:58384, -62886:58385, -62887:58386, -62888:58387, -62889:58388, -62890:58389, -62891:58390, -62892:58391, -62893:58392, -62894:58393, -62895:58394, -62896:58395, -62897:58396, -62898:58397, -62899:58398, -62900:58399, -62901:58400, -62902:58401, -62903:58402, -62904:58403, -62905:58404, -62906:58405, -62907:58406, -62908:58407, -62909:58408, -62910:58409, -62911:58410, -62912:58411, -62913:58412, -62914:58413, -62915:58414, -62916:58415, -62917:58416, -62918:58417, -62919:58418, -62920:58419, -62921:58420, -62922:58421, -62923:58422, -62924:58423, -62925:58424, -62926:58425, -62927:58426, -62928:58427, -62929:58428, -62930:58429, -62931:58430, -62932:58431, -62933:58432, -62934:58433, -62935:58434, -62936:58435, -62937:58436, -62938:58437, -62939:58438, -62940:58439, -62941:58440, -62942:58441, -62943:58442, -62944:58443, -62945:58444, -62946:58445, -62947:58446, -62948:58447, -62949:58448, -62950:58449, -62951:58450, -62952:58451, -62953:58452, -62954:58453, -62955:58454, -62956:58455, -62957:58456, -62958:58457, -62959:58458, -62960:58459, -62961:58460, -62962:58461, -62963:58462, -62964:58463, -62965:58464, -62966:58465, -62967:58466, -62968:58467, -62969:58468, -62970:58469, -62971:58470, -62972:58471, -63040:58472, -63041:58473, -63042:58474, -63043:58475, -63044:58476, -63045:58477, -63046:58478, -63047:58479, -63048:58480, -63049:58481, -63050:58482, -63051:58483, -63052:58484, -63053:58485, -63054:58486, -63055:58487, -63056:58488, -63057:58489, -63058:58490, -63059:58491, -63060:58492, -63061:58493, -63062:58494, -63063:58495, -63064:58496, -63065:58497, -63066:58498, -63067:58499, -63068:58500, -63069:58501, -63070:58502, -63071:58503, -63072:58504, -63073:58505, -63074:58506, -63075:58507, -63076:58508, -63077:58509, -63078:58510, -63079:58511, -63080:58512, -63081:58513, -63082:58514, -63083:58515, -63084:58516, -63085:58517, -63086:58518, -63087:58519, -63088:58520, -63089:58521, -63090:58522, -63091:58523, -63092:58524, -63093:58525, -63094:58526, -63095:58527, -63096:58528, -63097:58529, -63098:58530, -63099:58531, -63100:58532, -63101:58533, -63102:58534, -63104:58535, -63105:58536, -63106:58537, -63107:58538, -63108:58539, -63109:58540, -63110:58541, -63111:58542, -63112:58543, -63113:58544, -63114:58545, -63115:58546, -63116:58547, -63117:58548, -63118:58549, -63119:58550, -63120:58551, -63121:58552, -63122:58553, -63123:58554, -63124:58555, -63125:58556, -63126:58557, -63127:58558, -63128:58559, -63129:58560, -63130:58561, -63131:58562, -63132:58563, -63133:58564, -63134:58565, -63135:58566, -63136:58567, -63137:58568, -63138:58569, -63139:58570, -63140:58571, -63141:58572, -63142:58573, -63143:58574, -63144:58575, -63145:58576, -63146:58577, -63147:58578, -63148:58579, -63149:58580, -63150:58581, -63151:58582, -63152:58583, -63153:58584, -63154:58585, -63155:58586, -63156:58587, -63157:58588, -63158:58589, -63159:58590, -63160:58591, -63161:58592, -63162:58593, -63163:58594, -63164:58595, -63165:58596, -63166:58597, -63167:58598, -63168:58599, -63169:58600, -63170:58601, -63171:58602, -63172:58603, -63173:58604, -63174:58605, -63175:58606, -63176:58607, -63177:58608, -63178:58609, -63179:58610, -63180:58611, -63181:58612, -63182:58613, -63183:58614, -63184:58615, -63185:58616, -63186:58617, -63187:58618, -63188:58619, -63189:58620, -63190:58621, -63191:58622, -63192:58623, -63193:58624, -63194:58625, -63195:58626, -63196:58627, -63197:58628, -63198:58629, -63199:58630, -63200:58631, -63201:58632, -63202:58633, -63203:58634, -63204:58635, -63205:58636, -63206:58637, -63207:58638, -63208:58639, -63209:58640, -63210:58641, -63211:58642, -63212:58643, -63213:58644, -63214:58645, -63215:58646, -63216:58647, -63217:58648, -63218:58649, -63219:58650, -63220:58651, -63221:58652, -63222:58653, -63223:58654, -63224:58655, -63225:58656, -63226:58657, -63227:58658, -63228:58659, -63296:58660, -63297:58661, -63298:58662, -63299:58663, -63300:58664, -63301:58665, -63302:58666, -63303:58667, -63304:58668, -63305:58669, -63306:58670, -63307:58671, -63308:58672, -63309:58673, -63310:58674, -63311:58675, -63312:58676, -63313:58677, -63314:58678, -63315:58679, -63316:58680, -63317:58681, -63318:58682, -63319:58683, -63320:58684, -63321:58685, -63322:58686, -63323:58687, -63324:58688, -63325:58689, -63326:58690, -63327:58691, -63328:58692, -63329:58693, -63330:58694, -63331:58695, -63332:58696, -63333:58697, -63334:58698, -63335:58699, -63336:58700, -63337:58701, -63338:58702, -63339:58703, -63340:58704, -63341:58705, -63342:58706, -63343:58707, -63344:58708, -63345:58709, -63346:58710, -63347:58711, -63348:58712, -63349:58713, -63350:58714, -63351:58715, -63352:58716, -63353:58717, -63354:58718, -63355:58719, -63356:58720, -63357:58721, -63358:58722, -63360:58723, -63361:58724, -63362:58725, -63363:58726, -63364:58727, -63365:58728, -63366:58729, -63367:58730, -63368:58731, -63369:58732, -63370:58733, -63371:58734, -63372:58735, -63373:58736, -63374:58737, -63375:58738, -63376:58739, -63377:58740, -63378:58741, -63379:58742, -63380:58743, -63381:58744, -63382:58745, -63383:58746, -63384:58747, -63385:58748, -63386:58749, -63387:58750, -63388:58751, -63389:58752, -63390:58753, -63391:58754, -63392:58755, -63393:58756, -63394:58757, -63395:58758, -63396:58759, -63397:58760, -63398:58761, -63399:58762, -63400:58763, -63401:58764, -63402:58765, -63403:58766, -63404:58767, -63405:58768, -63406:58769, -63407:58770, -63408:58771, -63409:58772, -63410:58773, -63411:58774, -63412:58775, -63413:58776, -63414:58777, -63415:58778, -63416:58779, -63417:58780, -63418:58781, -63419:58782, -63420:58783, -63421:58784, -63422:58785, -63423:58786, -63424:58787, -63425:58788, -63426:58789, -63427:58790, -63428:58791, -63429:58792, -63430:58793, -63431:58794, -63432:58795, -63433:58796, -63434:58797, -63435:58798, -63436:58799, -63437:58800, -63438:58801, -63439:58802, -63440:58803, -63441:58804, -63442:58805, -63443:58806, -63444:58807, -63445:58808, -63446:58809, -63447:58810, -63448:58811, -63449:58812, -63450:58813, -63451:58814, -63452:58815, -63453:58816, -63454:58817, -63455:58818, -63456:58819, -63457:58820, -63458:58821, -63459:58822, -63460:58823, -63461:58824, -63462:58825, -63463:58826, -63464:58827, -63465:58828, -63466:58829, -63467:58830, -63468:58831, -63469:58832, -63470:58833, -63471:58834, -63472:58835, -63473:58836, -63474:58837, -63475:58838, -63476:58839, -63477:58840, -63478:58841, -63479:58842, -63480:58843, -63481:58844, -63482:58845, -63483:58846, -63484:58847, -63552:58848, -63553:58849, -63554:58850, -63555:58851, -63556:58852, -63557:58853, -63558:58854, -63559:58855, -63560:58856, -63561:58857, -63562:58858, -63563:58859, -63564:58860, -63565:58861, -63566:58862, -63567:58863, -63568:58864, -63569:58865, -63570:58866, -63571:58867, -63572:58868, -63573:58869, -63574:58870, -63575:58871, -63576:58872, -63577:58873, -63578:58874, -63579:58875, -63580:58876, -63581:58877, -63582:58878, -63583:58879, -63584:58880, -63585:58881, -63586:58882, -63587:58883, -63588:58884, -63589:58885, -63590:58886, -63591:58887, -63592:58888, -63593:58889, -63594:58890, -63595:58891, -63596:58892, -63597:58893, -63598:58894, -63599:58895, -63600:58896, -63601:58897, -63602:58898, -63603:58899, -63604:58900, -63605:58901, -63606:58902, -63607:58903, -63608:58904, -63609:58905, -63610:58906, -63611:58907, -63612:58908, -63613:58909, -63614:58910, -63616:58911, -63617:58912, -63618:58913, -63619:58914, -63620:58915, -63621:58916, -63622:58917, -63623:58918, -63624:58919, -63625:58920, -63626:58921, -63627:58922, -63628:58923, -63629:58924, -63630:58925, -63631:58926, -63632:58927, -63633:58928, -63634:58929, -63635:58930, -63636:58931, -63637:58932, -63638:58933, -63639:58934, -63640:58935, -63641:58936, -63642:58937, -63643:58938, -63644:58939, -63645:58940, -63646:58941, -63647:58942, -63648:58943, -63649:58944, -63650:58945, -63651:58946, -63652:58947, -63653:58948, -63654:58949, -63655:58950, -63656:58951, -63657:58952, -63658:58953, -63659:58954, -63660:58955, -63661:58956, -63662:58957, -63663:58958, -63664:58959, -63665:58960, -63666:58961, -63667:58962, -63668:58963, -63669:58964, -63670:58965, -63671:58966, -63672:58967, -63673:58968, -63674:58969, -63675:58970, -63676:58971, -63677:58972, -63678:58973, -63679:58974, -63680:58975, -63681:58976, -63682:58977, -63683:58978, -63684:58979, -63685:58980, -63686:58981, -63687:58982, -63688:58983, -63689:58984, -63690:58985, -63691:58986, -63692:58987, -63693:58988, -63694:58989, -63695:58990, -63696:58991, -63697:58992, -63698:58993, -63699:58994, -63700:58995, -63701:58996, -63702:58997, -63703:58998, -63704:58999, -63705:59000, -63706:59001, -63707:59002, -63708:59003, -63709:59004, -63710:59005, -63711:59006, -63712:59007, -63713:59008, -63714:59009, -63715:59010, -63716:59011, -63717:59012, -63718:59013, -63719:59014, -63720:59015, -63721:59016, -63722:59017, -63723:59018, -63724:59019, -63725:59020, -63726:59021, -63727:59022, -63728:59023, -63729:59024, -63730:59025, -63731:59026, -63732:59027, -63733:59028, -63734:59029, -63735:59030, -63736:59031, -63737:59032, -63738:59033, -63739:59034, -63740:59035, -64064:8560, -64065:8561, -64066:8562, -64067:8563, -64068:8564, -64069:8565, -64070:8566, -64071:8567, -64072:8568, -64073:8569, -64074:8544, -64075:8545, -64076:8546, -64077:8547, -64078:8548, -64079:8549, -64080:8550, -64081:8551, -64082:8552, -64083:8553, -64084:65506, -64085:65508, -64086:65287, -64087:65282, -64088:12849, -64089:8470, -64090:8481, -64091:8757, -64092:32394, -64093:35100, -64094:37704, -64095:37512, -64096:34012, -64097:20425, -64098:28859, -64099:26161, -64100:26824, -64101:37625, -64102:26363, -64103:24389, -64104:20008, -64105:20193, -64106:20220, -64107:20224, -64108:20227, -64109:20281, -64110:20310, -64111:20370, -64112:20362, -64113:20378, -64114:20372, -64115:20429, -64116:20544, -64117:20514, -64118:20479, -64119:20510, -64120:20550, -64121:20592, -64122:20546, -64123:20628, -64124:20724, -64125:20696, -64126:20810, -64128:20836, -64129:20893, -64130:20926, -64131:20972, -64132:21013, -64133:21148, -64134:21158, -64135:21184, -64136:21211, -64137:21248, -64138:21255, -64139:21284, -64140:21362, -64141:21395, -64142:21426, -64143:21469, -64144:64014, -64145:21660, -64146:21642, -64147:21673, -64148:21759, -64149:21894, -64150:22361, -64151:22373, -64152:22444, -64153:22472, -64154:22471, -64155:64015, -64156:64016, -64157:22686, -64158:22706, -64159:22795, -64160:22867, -64161:22875, -64162:22877, -64163:22883, -64164:22948, -64165:22970, -64166:23382, -64167:23488, -64168:29999, -64169:23512, -64170:23532, -64171:23582, -64172:23718, -64173:23738, -64174:23797, -64175:23847, -64176:23891, -64177:64017, -64178:23874, -64179:23917, -64180:23992, -64181:23993, -64182:24016, -64183:24353, -64184:24372, -64185:24423, -64186:24503, -64187:24542, -64188:24669, -64189:24709, -64190:24714, -64191:24798, -64192:24789, -64193:24864, -64194:24818, -64195:24849, -64196:24887, -64197:24880, -64198:24984, -64199:25107, -64200:25254, -64201:25589, -64202:25696, -64203:25757, -64204:25806, -64205:25934, -64206:26112, -64207:26133, -64208:26171, -64209:26121, -64210:26158, -64211:26142, -64212:26148, -64213:26213, -64214:26199, -64215:26201, -64216:64018, -64217:26227, -64218:26265, -64219:26272, -64220:26290, -64221:26303, -64222:26362, -64223:26382, -64224:63785, -64225:26470, -64226:26555, -64227:26706, -64228:26560, -64229:26625, -64230:26692, -64231:26831, -64232:64019, -64233:26984, -64234:64020, -64235:27032, -64236:27106, -64237:27184, -64238:27243, -64239:27206, -64240:27251, -64241:27262, -64242:27362, -64243:27364, -64244:27606, -64245:27711, -64246:27740, -64247:27782, -64248:27759, -64249:27866, -64250:27908, -64251:28039, -64252:28015, -64320:28054, -64321:28076, -64322:28111, -64323:28152, -64324:28146, -64325:28156, -64326:28217, -64327:28252, -64328:28199, -64329:28220, -64330:28351, -64331:28552, -64332:28597, -64333:28661, -64334:28677, -64335:28679, -64336:28712, -64337:28805, -64338:28843, -64339:28943, -64340:28932, -64341:29020, -64342:28998, -64343:28999, -64344:64021, -64345:29121, -64346:29182, -64347:29361, -64348:29374, -64349:29476, -64350:64022, -64351:29559, -64352:29629, -64353:29641, -64354:29654, -64355:29667, -64356:29650, -64357:29703, -64358:29685, -64359:29734, -64360:29738, -64361:29737, -64362:29742, -64363:29794, -64364:29833, -64365:29855, -64366:29953, -64367:30063, -64368:30338, -64369:30364, -64370:30366, -64371:30363, -64372:30374, -64373:64023, -64374:30534, -64375:21167, -64376:30753, -64377:30798, -64378:30820, -64379:30842, -64380:31024, -64381:64024, -64382:64025, -64384:64026, -64385:31124, -64386:64027, -64387:31131, -64388:31441, -64389:31463, -64390:64028, -64391:31467, -64392:31646, -64393:64029, -64394:32072, -64395:32092, -64396:32183, -64397:32160, -64398:32214, -64399:32338, -64400:32583, -64401:32673, -64402:64030, -64403:33537, -64404:33634, -64405:33663, -64406:33735, -64407:33782, -64408:33864, -64409:33972, -64410:34131, -64411:34137, -64412:34155, -64413:64031, -64414:34224, -64415:64032, -64416:64033, -64417:34823, -64418:35061, -64419:35346, -64420:35383, -64421:35449, -64422:35495, -64423:35518, -64424:35551, -64425:64034, -64426:35574, -64427:35667, -64428:35711, -64429:36080, -64430:36084, -64431:36114, -64432:36214, -64433:64035, -64434:36559, -64435:64036, -64436:64037, -64437:36967, -64438:37086, -64439:64038, -64440:37141, -64441:37159, -64442:37338, -64443:37335, -64444:37342, -64445:37357, -64446:37358, -64447:37348, -64448:37349, -64449:37382, -64450:37392, -64451:37386, -64452:37434, -64453:37440, -64454:37436, -64455:37454, -64456:37465, -64457:37457, -64458:37433, -64459:37479, -64460:37543, -64461:37495, -64462:37496, -64463:37607, -64464:37591, -64465:37593, -64466:37584, -64467:64039, -64468:37589, -64469:37600, -64470:37587, -64471:37669, -64472:37665, -64473:37627, -64474:64040, -64475:37662, -64476:37631, -64477:37661, -64478:37634, -64479:37744, -64480:37719, -64481:37796, -64482:37830, -64483:37854, -64484:37880, -64485:37937, -64486:37957, -64487:37960, -64488:38290, -64489:63964, -64490:64041, -64491:38557, -64492:38575, -64493:38707, -64494:38715, -64495:38723, -64496:38733, -64497:38735, -64498:38737, -64499:38741, -64500:38999, -64501:39013, -64502:64042, -64503:64043, -64504:39207, -64505:64044, -64506:39326, -64507:39502, -64508:39641, -64576:39644, -64577:39797, -64578:39794, -64579:39823, -64580:39857, -64581:39867, -64582:39936, -64583:40304, -64584:40299, -64585:64045, -64586:40473, -64587:40657 -}; - -/** - * @author takahiro / https://github.com/takahirox - */ - -function DataViewEx ( buffer, littleEndian ) { - - this.dv = new DataView( buffer ); - this.offset = 0; - this.littleEndian = ( littleEndian !== undefined ) ? littleEndian : true; - this.encoder = new CharsetEncoder(); - -} - -DataViewEx.prototype = { - - constructor: DataViewEx, - - getInt8: function () { - - var value = this.dv.getInt8( this.offset ); - this.offset += 1; - return value; - - }, - - getInt8Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getInt8() ); - - } - - return a; - - }, - - getUint8: function () { - - var value = this.dv.getUint8( this.offset ); - this.offset += 1; - return value; - - }, - - getUint8Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getUint8() ); - - } - - return a; - - }, - - - getInt16: function () { - - var value = this.dv.getInt16( this.offset, this.littleEndian ); - this.offset += 2; - return value; - - }, - - getInt16Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getInt16() ); - - } - - return a; - - }, - - getUint16: function () { - - var value = this.dv.getUint16( this.offset, this.littleEndian ); - this.offset += 2; - return value; - - }, - - getUint16Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getUint16() ); - - } - - return a; - - }, - - getInt32: function () { - - var value = this.dv.getInt32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - }, - - getInt32Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getInt32() ); - - } - - return a; - - }, - - getUint32: function () { - - var value = this.dv.getUint32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - }, - - getUint32Array: function ( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getUint32() ); - - } - - return a; - - }, - - getFloat32: function () { - - var value = this.dv.getFloat32( this.offset, this.littleEndian ); - this.offset += 4; - return value; - - }, - - getFloat32Array: function( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getFloat32() ); - - } - - return a; - - }, - - getFloat64: function () { - - var value = this.dv.getFloat64( this.offset, this.littleEndian ); - this.offset += 8; - return value; - - }, - - getFloat64Array: function( size ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getFloat64() ); - - } - - return a; - - }, - - getIndex: function ( type, isUnsigned ) { - - switch ( type ) { - - case 1: - return ( isUnsigned === true ) ? this.getUint8() : this.getInt8(); - - case 2: - return ( isUnsigned === true ) ? this.getUint16() : this.getInt16(); - - case 4: - return this.getInt32(); // No Uint32 - - default: - throw 'unknown number type ' + type + ' exception.'; - - } - - }, - - getIndexArray: function ( type, size, isUnsigned ) { - - var a = []; - - for ( var i = 0; i < size; i++ ) { - - a.push( this.getIndex( type, isUnsigned ) ); - - } - - return a; - - }, - - getChars: function ( size ) { - - var str = ''; - - while ( size > 0 ) { - - var value = this.getUint8(); - size--; - - if ( value === 0 ) { - - break; - - } - - str += String.fromCharCode( value ); - - } - - while ( size > 0 ) { - - this.getUint8(); - size--; - - } - - return str; - - }, - - getSjisStringsAsUnicode: function ( size ) { - - var a = []; - - while ( size > 0 ) { - - var value = this.getUint8(); - size--; - - if ( value === 0 ) { - - break; - - } - - a.push( value ); - - } - - while ( size > 0 ) { - - this.getUint8(); - size--; - - } - - return this.encoder.s2u( new Uint8Array( a ) ); - - }, - - getUnicodeStrings: function ( size ) { - - var str = ''; - - while ( size > 0 ) { - - var value = this.getUint16(); - size -= 2; - - if ( value === 0 ) { - - break; - - } - - str += String.fromCharCode( value ); - - } - - while ( size > 0 ) { - - this.getUint8(); - size--; - - } - - return str; - - }, - - getTextBuffer: function () { - - var size = this.getUint32(); - return this.getUnicodeStrings( size ); - - } - -}; - -/** - * @author takahiro / https://github.com/takahirox - */ - -function DataCreationHelper () { -} - -DataCreationHelper.prototype = { - - constructor: DataCreationHelper, - - leftToRightVector3: function ( v ) { - - v[ 2 ] = -v[ 2 ]; - - }, - - leftToRightQuaternion: function ( q ) { - - q[ 0 ] = -q[ 0 ]; - q[ 1 ] = -q[ 1 ]; - - }, - - leftToRightEuler: function ( r ) { - - r[ 0 ] = -r[ 0 ]; - r[ 1 ] = -r[ 1 ]; - - }, - - leftToRightIndexOrder: function ( p ) { - - var tmp = p[ 2 ]; - p[ 2 ] = p[ 0 ]; - p[ 0 ] = tmp; - - }, - - leftToRightVector3Range: function ( v1, v2 ) { - - var tmp = -v2[ 2 ]; - v2[ 2 ] = -v1[ 2 ]; - v1[ 2 ] = tmp; - - }, - - leftToRightEulerRange: function ( r1, r2 ) { - - var tmp1 = -r2[ 0 ]; - var tmp2 = -r2[ 1 ]; - r2[ 0 ] = -r1[ 0 ]; - r2[ 1 ] = -r1[ 1 ]; - r1[ 0 ] = tmp1; - r1[ 1 ] = tmp2; - - } - -}; - -/** - * @author takahiro / https://github.com/takahirox - */ - -function Parser() { -} - -Parser.prototype.parsePmd = function ( buffer, leftToRight ) { - - var pmd = {}; - var dv = new DataViewEx( buffer ); - - pmd.metadata = {}; - pmd.metadata.format = 'pmd'; - pmd.metadata.coordinateSystem = 'left'; - - var parseHeader = function () { - - var metadata = pmd.metadata; - metadata.magic = dv.getChars( 3 ); - - if ( metadata.magic !== 'Pmd' ) { - - throw 'PMD file magic is not Pmd, but ' + metadata.magic; - - } - - metadata.version = dv.getFloat32(); - metadata.modelName = dv.getSjisStringsAsUnicode( 20 ); - metadata.comment = dv.getSjisStringsAsUnicode( 256 ); - - }; - - var parseVertices = function () { - - var parseVertex = function () { - - var p = {}; - p.position = dv.getFloat32Array( 3 ); - p.normal = dv.getFloat32Array( 3 ); - p.uv = dv.getFloat32Array( 2 ); - p.skinIndices = dv.getUint16Array( 2 ); - p.skinWeights = [ dv.getUint8() / 100 ]; - p.skinWeights.push( 1.0 - p.skinWeights[ 0 ] ); - p.edgeFlag = dv.getUint8(); - return p; - - }; - - var metadata = pmd.metadata; - metadata.vertexCount = dv.getUint32(); - - pmd.vertices = []; - - for ( var i = 0; i < metadata.vertexCount; i++ ) { - - pmd.vertices.push( parseVertex() ); - - } - - }; - - var parseFaces = function () { - - var parseFace = function () { - - var p = {}; - p.indices = dv.getUint16Array( 3 ); - return p; - - }; - - var metadata = pmd.metadata; - metadata.faceCount = dv.getUint32() / 3; - - pmd.faces = []; - - for ( var i = 0; i < metadata.faceCount; i++ ) { - - pmd.faces.push( parseFace() ); - - } - - }; - - var parseMaterials = function () { - - var parseMaterial = function () { - - var p = {}; - p.diffuse = dv.getFloat32Array( 4 ); - p.shininess = dv.getFloat32(); - p.specular = dv.getFloat32Array( 3 ); - p.ambient = dv.getFloat32Array( 3 ); - p.toonIndex = dv.getInt8(); - p.edgeFlag = dv.getUint8(); - p.faceCount = dv.getUint32() / 3; - p.fileName = dv.getSjisStringsAsUnicode( 20 ); - return p; - - }; - - var metadata = pmd.metadata; - metadata.materialCount = dv.getUint32(); - - pmd.materials = []; - - for ( var i = 0; i < metadata.materialCount; i++ ) { - - pmd.materials.push( parseMaterial() ); - - } - - }; - - var parseBones = function () { - - var parseBone = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - p.parentIndex = dv.getInt16(); - p.tailIndex = dv.getInt16(); - p.type = dv.getUint8(); - p.ikIndex = dv.getInt16(); - p.position = dv.getFloat32Array( 3 ); - return p; - - }; - - var metadata = pmd.metadata; - metadata.boneCount = dv.getUint16(); - - pmd.bones = []; - - for ( var i = 0; i < metadata.boneCount; i++ ) { - - pmd.bones.push( parseBone() ); - - } - - }; - - var parseIks = function () { - - var parseIk = function () { - - var p = {}; - p.target = dv.getUint16(); - p.effector = dv.getUint16(); - p.linkCount = dv.getUint8(); - p.iteration = dv.getUint16(); - p.maxAngle = dv.getFloat32(); - - p.links = []; - for ( var i = 0; i < p.linkCount; i++ ) { - - var link = {}; - link.index = dv.getUint16(); - p.links.push( link ); - - } - - return p; - - }; - - var metadata = pmd.metadata; - metadata.ikCount = dv.getUint16(); - - pmd.iks = []; - - for ( var i = 0; i < metadata.ikCount; i++ ) { - - pmd.iks.push( parseIk() ); - - } - - }; - - var parseMorphs = function () { - - var parseMorph = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - p.elementCount = dv.getUint32(); - p.type = dv.getUint8(); - - p.elements = []; - for ( var i = 0; i < p.elementCount; i++ ) { - - p.elements.push( { - index: dv.getUint32(), - position: dv.getFloat32Array( 3 ) - } ) ; - - } - - return p; - - }; - - var metadata = pmd.metadata; - metadata.morphCount = dv.getUint16(); - - pmd.morphs = []; - - for ( var i = 0; i < metadata.morphCount; i++ ) { - - pmd.morphs.push( parseMorph() ); - - } - - - }; - - var parseMorphFrames = function () { - - var parseMorphFrame = function () { - - var p = {}; - p.index = dv.getUint16(); - return p; - - }; - - var metadata = pmd.metadata; - metadata.morphFrameCount = dv.getUint8(); - - pmd.morphFrames = []; - - for ( var i = 0; i < metadata.morphFrameCount; i++ ) { - - pmd.morphFrames.push( parseMorphFrame() ); - - } - - }; - - var parseBoneFrameNames = function () { - - var parseBoneFrameName = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 50 ); - return p; - - }; - - var metadata = pmd.metadata; - metadata.boneFrameNameCount = dv.getUint8(); - - pmd.boneFrameNames = []; - - for ( var i = 0; i < metadata.boneFrameNameCount; i++ ) { - - pmd.boneFrameNames.push( parseBoneFrameName() ); - - } - - }; - - var parseBoneFrames = function () { - - var parseBoneFrame = function () { - - var p = {}; - p.boneIndex = dv.getInt16(); - p.frameIndex = dv.getUint8(); - return p; - - }; - - var metadata = pmd.metadata; - metadata.boneFrameCount = dv.getUint32(); - - pmd.boneFrames = []; - - for ( var i = 0; i < metadata.boneFrameCount; i++ ) { - - pmd.boneFrames.push( parseBoneFrame() ); - - } - - }; - - var parseEnglishHeader = function () { - - var metadata = pmd.metadata; - metadata.englishCompatibility = dv.getUint8(); - - if ( metadata.englishCompatibility > 0 ) { - - metadata.englishModelName = dv.getSjisStringsAsUnicode( 20 ); - metadata.englishComment = dv.getSjisStringsAsUnicode( 256 ); - - } - - }; - - var parseEnglishBoneNames = function () { - - var parseEnglishBoneName = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - return p; - - }; - - var metadata = pmd.metadata; - - if ( metadata.englishCompatibility === 0 ) { - - return; - - } - - pmd.englishBoneNames = []; - - for ( var i = 0; i < metadata.boneCount; i++ ) { - - pmd.englishBoneNames.push( parseEnglishBoneName() ); - - } - - }; - - var parseEnglishMorphNames = function () { - - var parseEnglishMorphName = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - return p; - - }; - - var metadata = pmd.metadata; - - if ( metadata.englishCompatibility === 0 ) { - - return; - - } - - pmd.englishMorphNames = []; - - for ( var i = 0; i < metadata.morphCount - 1; i++ ) { - - pmd.englishMorphNames.push( parseEnglishMorphName() ); - - } - - }; - - var parseEnglishBoneFrameNames = function () { - - var parseEnglishBoneFrameName = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 50 ); - return p; - - }; - - var metadata = pmd.metadata; - - if ( metadata.englishCompatibility === 0 ) { - - return; - - } - - pmd.englishBoneFrameNames = []; - - for ( var i = 0; i < metadata.boneFrameNameCount; i++ ) { - - pmd.englishBoneFrameNames.push( parseEnglishBoneFrameName() ); - - } - - }; - - var parseToonTextures = function () { - - var parseToonTexture = function () { - - var p = {}; - p.fileName = dv.getSjisStringsAsUnicode( 100 ); - return p; - - }; - - pmd.toonTextures = []; - - for ( var i = 0; i < 10; i++ ) { - - pmd.toonTextures.push( parseToonTexture() ); - - } - - }; - - var parseRigidBodies = function () { - - var parseRigidBody = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - p.boneIndex = dv.getInt16(); - p.groupIndex = dv.getUint8(); - p.groupTarget = dv.getUint16(); - p.shapeType = dv.getUint8(); - p.width = dv.getFloat32(); - p.height = dv.getFloat32(); - p.depth = dv.getFloat32(); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 3 ); - p.weight = dv.getFloat32(); - p.positionDamping = dv.getFloat32(); - p.rotationDamping = dv.getFloat32(); - p.restitution = dv.getFloat32(); - p.friction = dv.getFloat32(); - p.type = dv.getUint8(); - return p; - - }; - - var metadata = pmd.metadata; - metadata.rigidBodyCount = dv.getUint32(); - - pmd.rigidBodies = []; - - for ( var i = 0; i < metadata.rigidBodyCount; i++ ) { - - pmd.rigidBodies.push( parseRigidBody() ); - - } - - }; - - var parseConstraints = function () { - - var parseConstraint = function () { - - var p = {}; - p.name = dv.getSjisStringsAsUnicode( 20 ); - p.rigidBodyIndex1 = dv.getUint32(); - p.rigidBodyIndex2 = dv.getUint32(); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 3 ); - p.translationLimitation1 = dv.getFloat32Array( 3 ); - p.translationLimitation2 = dv.getFloat32Array( 3 ); - p.rotationLimitation1 = dv.getFloat32Array( 3 ); - p.rotationLimitation2 = dv.getFloat32Array( 3 ); - p.springPosition = dv.getFloat32Array( 3 ); - p.springRotation = dv.getFloat32Array( 3 ); - return p; - - }; - - var metadata = pmd.metadata; - metadata.constraintCount = dv.getUint32(); - - pmd.constraints = []; - - for ( var i = 0; i < metadata.constraintCount; i++ ) { - - pmd.constraints.push( parseConstraint() ); - - } - - }; - - parseHeader(); - parseVertices(); - parseFaces(); - parseMaterials(); - parseBones(); - parseIks(); - parseMorphs(); - parseMorphFrames(); - parseBoneFrameNames(); - parseBoneFrames(); - parseEnglishHeader(); - parseEnglishBoneNames(); - parseEnglishMorphNames(); - parseEnglishBoneFrameNames(); - parseToonTextures(); - parseRigidBodies(); - parseConstraints(); - - if ( leftToRight === true ) this.leftToRightModel( pmd ); - - // console.log( pmd ); // for console debug - - return pmd; - -}; - -Parser.prototype.parsePmx = function ( buffer, leftToRight ) { - - var pmx = {}; - var dv = new DataViewEx( buffer ); - - pmx.metadata = {}; - pmx.metadata.format = 'pmx'; - pmx.metadata.coordinateSystem = 'left'; - - var parseHeader = function () { - - var metadata = pmx.metadata; - metadata.magic = dv.getChars( 4 ); - - // Note: don't remove the last blank space. - if ( metadata.magic !== 'PMX ' ) { - - throw 'PMX file magic is not PMX , but ' + metadata.magic; - - } - - metadata.version = dv.getFloat32(); - - if ( metadata.version !== 2.0 && metadata.version !== 2.1 ) { - - throw 'PMX version ' + metadata.version + ' is not supported.'; - - } - - metadata.headerSize = dv.getUint8(); - metadata.encoding = dv.getUint8(); - metadata.additionalUvNum = dv.getUint8(); - metadata.vertexIndexSize = dv.getUint8(); - metadata.textureIndexSize = dv.getUint8(); - metadata.materialIndexSize = dv.getUint8(); - metadata.boneIndexSize = dv.getUint8(); - metadata.morphIndexSize = dv.getUint8(); - metadata.rigidBodyIndexSize = dv.getUint8(); - metadata.modelName = dv.getTextBuffer(); - metadata.englishModelName = dv.getTextBuffer(); - metadata.comment = dv.getTextBuffer(); - metadata.englishComment = dv.getTextBuffer(); - - }; - - var parseVertices = function () { - - var parseVertex = function () { - - var p = {}; - p.position = dv.getFloat32Array( 3 ); - p.normal = dv.getFloat32Array( 3 ); - p.uv = dv.getFloat32Array( 2 ); - - p.auvs = []; - - for ( var i = 0; i < pmx.metadata.additionalUvNum; i++ ) { - - p.auvs.push( dv.getFloat32Array( 4 ) ); - - } - - p.type = dv.getUint8(); - - var indexSize = metadata.boneIndexSize; - - if ( p.type === 0 ) { // BDEF1 - - p.skinIndices = dv.getIndexArray( indexSize, 1 ); - p.skinWeights = [ 1.0 ]; - - } else if ( p.type === 1 ) { // BDEF2 - - p.skinIndices = dv.getIndexArray( indexSize, 2 ); - p.skinWeights = dv.getFloat32Array( 1 ); - p.skinWeights.push( 1.0 - p.skinWeights[ 0 ] ); - - } else if ( p.type === 2 ) { // BDEF4 - - p.skinIndices = dv.getIndexArray( indexSize, 4 ); - p.skinWeights = dv.getFloat32Array( 4 ); - - } else if ( p.type === 3 ) { // SDEF - - p.skinIndices = dv.getIndexArray( indexSize, 2 ); - p.skinWeights = dv.getFloat32Array( 1 ); - p.skinWeights.push( 1.0 - p.skinWeights[ 0 ] ); - - p.skinC = dv.getFloat32Array( 3 ); - p.skinR0 = dv.getFloat32Array( 3 ); - p.skinR1 = dv.getFloat32Array( 3 ); - - // SDEF is not supported yet and is handled as BDEF2 so far. - // TODO: SDEF support - p.type = 1; - - } else { - - throw 'unsupport bone type ' + p.type + ' exception.'; - - } - - p.edgeRatio = dv.getFloat32(); - return p; - - }; - - var metadata = pmx.metadata; - metadata.vertexCount = dv.getUint32(); - - pmx.vertices = []; - - for ( var i = 0; i < metadata.vertexCount; i++ ) { - - pmx.vertices.push( parseVertex() ); - - } - - }; - - var parseFaces = function () { - - var parseFace = function () { - - var p = {}; - p.indices = dv.getIndexArray( metadata.vertexIndexSize, 3, true ); - return p; - - }; - - var metadata = pmx.metadata; - metadata.faceCount = dv.getUint32() / 3; - - pmx.faces = []; - - for ( var i = 0; i < metadata.faceCount; i++ ) { - - pmx.faces.push( parseFace() ); - - } - - }; - - var parseTextures = function () { - - var parseTexture = function () { - - return dv.getTextBuffer(); - - }; - - var metadata = pmx.metadata; - metadata.textureCount = dv.getUint32(); - - pmx.textures = []; - - for ( var i = 0; i < metadata.textureCount; i++ ) { - - pmx.textures.push( parseTexture() ); - - } - - }; - - var parseMaterials = function () { - - var parseMaterial = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.diffuse = dv.getFloat32Array( 4 ); - p.specular = dv.getFloat32Array( 3 ); - p.shininess = dv.getFloat32(); - p.ambient = dv.getFloat32Array( 3 ); - p.flag = dv.getUint8(); - p.edgeColor = dv.getFloat32Array( 4 ); - p.edgeSize = dv.getFloat32(); - p.textureIndex = dv.getIndex( pmx.metadata.textureIndexSize ); - p.envTextureIndex = dv.getIndex( pmx.metadata.textureIndexSize ); - p.envFlag = dv.getUint8(); - p.toonFlag = dv.getUint8(); - - if ( p.toonFlag === 0 ) { - - p.toonIndex = dv.getIndex( pmx.metadata.textureIndexSize ); - - } else if ( p.toonFlag === 1 ) { - - p.toonIndex = dv.getInt8(); - - } else { - - throw 'unknown toon flag ' + p.toonFlag + ' exception.'; - - } - - p.comment = dv.getTextBuffer(); - p.faceCount = dv.getUint32() / 3; - return p; - - }; - - var metadata = pmx.metadata; - metadata.materialCount = dv.getUint32(); - - pmx.materials = []; - - for ( var i = 0; i < metadata.materialCount; i++ ) { - - pmx.materials.push( parseMaterial() ); - - } - - }; - - var parseBones = function () { - - var parseBone = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.position = dv.getFloat32Array( 3 ); - p.parentIndex = dv.getIndex( pmx.metadata.boneIndexSize ); - p.transformationClass = dv.getUint32(); - p.flag = dv.getUint16(); - - if ( p.flag & 0x1 ) { - - p.connectIndex = dv.getIndex( pmx.metadata.boneIndexSize ); - - } else { - - p.offsetPosition = dv.getFloat32Array( 3 ); - - } - - if ( p.flag & 0x100 || p.flag & 0x200 ) { - - // Note: I don't think Grant is an appropriate name - // but I found that some English translated MMD tools use this term - // so I've named it Grant so far. - // I'd rename to more appropriate name from Grant later. - var grant = {}; - - grant.isLocal = ( p.flag & 0x80 ) !== 0 ? true : false; - grant.affectRotation = ( p.flag & 0x100 ) !== 0 ? true : false; - grant.affectPosition = ( p.flag & 0x200 ) !== 0 ? true : false; - grant.parentIndex = dv.getIndex( pmx.metadata.boneIndexSize ); - grant.ratio = dv.getFloat32(); - - p.grant = grant; - - } - - if ( p.flag & 0x400 ) { - - p.fixAxis = dv.getFloat32Array( 3 ); - - } - - if ( p.flag & 0x800 ) { - - p.localXVector = dv.getFloat32Array( 3 ); - p.localZVector = dv.getFloat32Array( 3 ); - - } - - if ( p.flag & 0x2000 ) { - - p.key = dv.getUint32(); - - } - - if ( p.flag & 0x20 ) { - - var ik = {}; - - ik.effector = dv.getIndex( pmx.metadata.boneIndexSize ); - ik.target = null; - ik.iteration = dv.getUint32(); - ik.maxAngle = dv.getFloat32(); - ik.linkCount = dv.getUint32(); - ik.links = []; - - for ( var i = 0; i < ik.linkCount; i++ ) { - - var link = {}; - link.index = dv.getIndex( pmx.metadata.boneIndexSize ); - link.angleLimitation = dv.getUint8(); - - if ( link.angleLimitation === 1 ) { - - link.lowerLimitationAngle = dv.getFloat32Array( 3 ); - link.upperLimitationAngle = dv.getFloat32Array( 3 ); - - } - - ik.links.push( link ); - - } - - p.ik = ik; - } - - return p; - - }; - - var metadata = pmx.metadata; - metadata.boneCount = dv.getUint32(); - - pmx.bones = []; - - for ( var i = 0; i < metadata.boneCount; i++ ) { - - pmx.bones.push( parseBone() ); - - } - - }; - - var parseMorphs = function () { - - var parseMorph = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.panel = dv.getUint8(); - p.type = dv.getUint8(); - p.elementCount = dv.getUint32(); - p.elements = []; - - for ( var i = 0; i < p.elementCount; i++ ) { - - if ( p.type === 0 ) { // group morph - - var m = {}; - m.index = dv.getIndex( pmx.metadata.morphIndexSize ); - m.ratio = dv.getFloat32(); - p.elements.push( m ); - - } else if ( p.type === 1 ) { // vertex morph - - var m = {}; - m.index = dv.getIndex( pmx.metadata.vertexIndexSize, true ); - m.position = dv.getFloat32Array( 3 ); - p.elements.push( m ); - - } else if ( p.type === 2 ) { // bone morph - - var m = {}; - m.index = dv.getIndex( pmx.metadata.boneIndexSize ); - m.position = dv.getFloat32Array( 3 ); - m.rotation = dv.getFloat32Array( 4 ); - p.elements.push( m ); - - } else if ( p.type === 3 ) { // uv morph - - var m = {}; - m.index = dv.getIndex( pmx.metadata.vertexIndexSize, true ); - m.uv = dv.getFloat32Array( 4 ); - p.elements.push( m ); - - } else if ( p.type === 4 ) { // additional uv1 - - // TODO: implement - - } else if ( p.type === 5 ) { // additional uv2 - - // TODO: implement - - } else if ( p.type === 6 ) { // additional uv3 - - // TODO: implement - - } else if ( p.type === 7 ) { // additional uv4 - - // TODO: implement - - } else if ( p.type === 8 ) { // material morph - - var m = {}; - m.index = dv.getIndex( pmx.metadata.materialIndexSize ); - m.type = dv.getUint8(); - m.diffuse = dv.getFloat32Array( 4 ); - m.specular = dv.getFloat32Array( 3 ); - m.shininess = dv.getFloat32(); - m.ambient = dv.getFloat32Array( 3 ); - m.edgeColor = dv.getFloat32Array( 4 ); - m.edgeSize = dv.getFloat32(); - m.textureColor = dv.getFloat32Array( 4 ); - m.sphereTextureColor = dv.getFloat32Array( 4 ); - m.toonColor = dv.getFloat32Array( 4 ); - p.elements.push( m ); - - } - - } - - return p; - - }; - - var metadata = pmx.metadata; - metadata.morphCount = dv.getUint32(); - - pmx.morphs = []; - - for ( var i = 0; i < metadata.morphCount; i++ ) { - - pmx.morphs.push( parseMorph() ); - - } - - }; - - var parseFrames = function () { - - var parseFrame = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.type = dv.getUint8(); - p.elementCount = dv.getUint32(); - p.elements = []; - - for ( var i = 0; i < p.elementCount; i++ ) { - - var e = {}; - e.target = dv.getUint8(); - e.index = ( e.target === 0 ) ? dv.getIndex( pmx.metadata.boneIndexSize ) : dv.getIndex( pmx.metadata.morphIndexSize ); - p.elements.push( e ); - - } - - return p; - - }; - - var metadata = pmx.metadata; - metadata.frameCount = dv.getUint32(); - - pmx.frames = []; - - for ( var i = 0; i < metadata.frameCount; i++ ) { - - pmx.frames.push( parseFrame() ); - - } - - }; - - var parseRigidBodies = function () { - - var parseRigidBody = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.boneIndex = dv.getIndex( pmx.metadata.boneIndexSize ); - p.groupIndex = dv.getUint8(); - p.groupTarget = dv.getUint16(); - p.shapeType = dv.getUint8(); - p.width = dv.getFloat32(); - p.height = dv.getFloat32(); - p.depth = dv.getFloat32(); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 3 ); - p.weight = dv.getFloat32(); - p.positionDamping = dv.getFloat32(); - p.rotationDamping = dv.getFloat32(); - p.restitution = dv.getFloat32(); - p.friction = dv.getFloat32(); - p.type = dv.getUint8(); - return p; - - }; - - var metadata = pmx.metadata; - metadata.rigidBodyCount = dv.getUint32(); - - pmx.rigidBodies = []; - - for ( var i = 0; i < metadata.rigidBodyCount; i++ ) { - - pmx.rigidBodies.push( parseRigidBody() ); - - } - - }; - - var parseConstraints = function () { - - var parseConstraint = function () { - - var p = {}; - p.name = dv.getTextBuffer(); - p.englishName = dv.getTextBuffer(); - p.type = dv.getUint8(); - p.rigidBodyIndex1 = dv.getIndex( pmx.metadata.rigidBodyIndexSize ); - p.rigidBodyIndex2 = dv.getIndex( pmx.metadata.rigidBodyIndexSize ); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 3 ); - p.translationLimitation1 = dv.getFloat32Array( 3 ); - p.translationLimitation2 = dv.getFloat32Array( 3 ); - p.rotationLimitation1 = dv.getFloat32Array( 3 ); - p.rotationLimitation2 = dv.getFloat32Array( 3 ); - p.springPosition = dv.getFloat32Array( 3 ); - p.springRotation = dv.getFloat32Array( 3 ); - return p; - - }; - - var metadata = pmx.metadata; - metadata.constraintCount = dv.getUint32(); - - pmx.constraints = []; - - for ( var i = 0; i < metadata.constraintCount; i++ ) { - - pmx.constraints.push( parseConstraint() ); - - } - - }; - - parseHeader(); - parseVertices(); - parseFaces(); - parseTextures(); - parseMaterials(); - parseBones(); - parseMorphs(); - parseFrames(); - parseRigidBodies(); - parseConstraints(); - - if ( leftToRight === true ) this.leftToRightModel( pmx ); - - // console.log( pmx ); // for console debug - - return pmx; - -}; - -Parser.prototype.parseVmd = function ( buffer, leftToRight ) { - - var vmd = {}; - var dv = new DataViewEx( buffer ); - - vmd.metadata = {}; - vmd.metadata.coordinateSystem = 'left'; - - var parseHeader = function () { - - var metadata = vmd.metadata; - metadata.magic = dv.getChars( 30 ); - - if ( metadata.magic !== 'Vocaloid Motion Data 0002' ) { - - throw 'VMD file magic is not Vocaloid Motion Data 0002, but ' + metadata.magic; - - } - - metadata.name = dv.getSjisStringsAsUnicode( 20 ); - - }; - - var parseMotions = function () { - - var parseMotion = function () { - - var p = {}; - p.boneName = dv.getSjisStringsAsUnicode( 15 ); - p.frameNum = dv.getUint32(); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 4 ); - p.interpolation = dv.getUint8Array( 64 ); - return p; - - }; - - var metadata = vmd.metadata; - metadata.motionCount = dv.getUint32(); - - vmd.motions = []; - for ( var i = 0; i < metadata.motionCount; i++ ) { - - vmd.motions.push( parseMotion() ); - - } - - }; - - var parseMorphs = function () { - - var parseMorph = function () { - - var p = {}; - p.morphName = dv.getSjisStringsAsUnicode( 15 ); - p.frameNum = dv.getUint32(); - p.weight = dv.getFloat32(); - return p; - - }; - - var metadata = vmd.metadata; - metadata.morphCount = dv.getUint32(); - - vmd.morphs = []; - for ( var i = 0; i < metadata.morphCount; i++ ) { - - vmd.morphs.push( parseMorph() ); - - } - - }; - - var parseCameras = function () { - - var parseCamera = function () { - - var p = {}; - p.frameNum = dv.getUint32(); - p.distance = dv.getFloat32(); - p.position = dv.getFloat32Array( 3 ); - p.rotation = dv.getFloat32Array( 3 ); - p.interpolation = dv.getUint8Array( 24 ); - p.fov = dv.getUint32(); - p.perspective = dv.getUint8(); - return p; - - }; - - var metadata = vmd.metadata; - metadata.cameraCount = dv.getUint32(); - - vmd.cameras = []; - for ( var i = 0; i < metadata.cameraCount; i++ ) { - - vmd.cameras.push( parseCamera() ); - - } - - }; - - parseHeader(); - parseMotions(); - parseMorphs(); - parseCameras(); - - if ( leftToRight === true ) this.leftToRightVmd( vmd ); - - // console.log( vmd ); // for console debug - - return vmd; - -}; - -Parser.prototype.parseVpd = function ( text, leftToRight ) { - - var vpd = {}; - - vpd.metadata = {}; - vpd.metadata.coordinateSystem = 'left'; - - vpd.bones = []; - - var commentPatternG = /\/\/\w*(\r|\n|\r\n)/g; - var newlinePattern = /\r|\n|\r\n/; - - var lines = text.replace( commentPatternG, '' ).split( newlinePattern ); - - function throwError () { - - throw 'the file seems not vpd file.'; - - } - - function checkMagic () { - - if ( lines[ 0 ] !== 'Vocaloid Pose Data file' ) { - - throwError(); - - } - - } - - function parseHeader () { - - if ( lines.length < 4 ) { - - throwError(); - - } - - vpd.metadata.parentFile = lines[ 2 ]; - vpd.metadata.boneCount = parseInt( lines[ 3 ] ); - - } - - function parseBones () { - - var boneHeaderPattern = /^\s*(Bone[0-9]+)\s*\{\s*(.*)$/; - var boneVectorPattern = /^\s*(-?[0-9]+\.[0-9]+)\s*,\s*(-?[0-9]+\.[0-9]+)\s*,\s*(-?[0-9]+\.[0-9]+)\s*;/; - var boneQuaternionPattern = /^\s*(-?[0-9]+\.[0-9]+)\s*,\s*(-?[0-9]+\.[0-9]+)\s*,\s*(-?[0-9]+\.[0-9]+)\s*,\s*(-?[0-9]+\.[0-9]+)\s*;/; - var boneFooterPattern = /^\s*}/; - - var bones = vpd.bones; - var n = null; - var v = null; - var q = null; - - for ( var i = 4; i < lines.length; i++ ) { - - var line = lines[ i ]; - - var result; - - result = line.match( boneHeaderPattern ); - - if ( result !== null ) { - - if ( n !== null ) { - - throwError(); - - } - - n = result[ 2 ]; - - } - - result = line.match( boneVectorPattern ); - - if ( result !== null ) { - - if ( v !== null ) { - - throwError(); - - } - - v = [ - - parseFloat( result[ 1 ] ), - parseFloat( result[ 2 ] ), - parseFloat( result[ 3 ] ) - - ]; - - } - - result = line.match( boneQuaternionPattern ); - - if ( result !== null ) { - - if ( q !== null ) { - - throwError(); - - } - - q = [ - - parseFloat( result[ 1 ] ), - parseFloat( result[ 2 ] ), - parseFloat( result[ 3 ] ), - parseFloat( result[ 4 ] ) - - ]; - - - } - - result = line.match( boneFooterPattern ); - - if ( result !== null ) { - - if ( n === null || v === null || q === null ) { - - throwError(); - - } - - bones.push( { - - name: n, - translation: v, - quaternion: q - - } ); - - n = null; - v = null; - q = null; - - } - - } - - if ( n !== null || v !== null || q !== null ) { - - throwError(); - - } - - } - - checkMagic(); - parseHeader(); - parseBones(); - - if ( leftToRight === true ) this.leftToRightVpd( vpd ); - - // console.log( vpd ); // for console debug - - return vpd; - -}; - -Parser.prototype.mergeVmds = function ( vmds ) { - - var v = {}; - v.metadata = {}; - v.metadata.name = vmds[ 0 ].metadata.name; - v.metadata.coordinateSystem = vmds[ 0 ].metadata.coordinateSystem; - v.metadata.motionCount = 0; - v.metadata.morphCount = 0; - v.metadata.cameraCount = 0; - v.motions = []; - v.morphs = []; - v.cameras = []; - - for ( var i = 0; i < vmds.length; i++ ) { - - var v2 = vmds[ i ]; - - v.metadata.motionCount += v2.metadata.motionCount; - v.metadata.morphCount += v2.metadata.morphCount; - v.metadata.cameraCount += v2.metadata.cameraCount; - - for ( var j = 0; j < v2.metadata.motionCount; j++ ) { - - v.motions.push( v2.motions[ j ] ); - - } - - for ( var j = 0; j < v2.metadata.morphCount; j++ ) { - - v.morphs.push( v2.morphs[ j ] ); - - } - - for ( var j = 0; j < v2.metadata.cameraCount; j++ ) { - - v.cameras.push( v2.cameras[ j ] ); - - } - - } - - return v; - -}; - -Parser.prototype.leftToRightModel = function ( model ) { - - if ( model.metadata.coordinateSystem === 'right' ) { - - return; - - } - - model.metadata.coordinateSystem = 'right'; - - var helper = new DataCreationHelper(); - - for ( var i = 0; i < model.metadata.vertexCount; i++ ) { - - helper.leftToRightVector3( model.vertices[ i ].position ); - helper.leftToRightVector3( model.vertices[ i ].normal ); - - } - - for ( var i = 0; i < model.metadata.faceCount; i++ ) { - - helper.leftToRightIndexOrder( model.faces[ i ].indices ); - - } - - for ( var i = 0; i < model.metadata.boneCount; i++ ) { - - helper.leftToRightVector3( model.bones[ i ].position ); - - } - - // TODO: support other morph for PMX - for ( var i = 0; i < model.metadata.morphCount; i++ ) { - - var m = model.morphs[ i ]; - - if ( model.metadata.format === 'pmx' && m.type !== 1 ) { - - // TODO: implement - continue; - - } - - for ( var j = 0; j < m.elements.length; j++ ) { - - helper.leftToRightVector3( m.elements[ j ].position ); - - } - - } - - for ( var i = 0; i < model.metadata.rigidBodyCount; i++ ) { - - helper.leftToRightVector3( model.rigidBodies[ i ].position ); - helper.leftToRightEuler( model.rigidBodies[ i ].rotation ); - - } - - for ( var i = 0; i < model.metadata.constraintCount; i++ ) { - - helper.leftToRightVector3( model.constraints[ i ].position ); - helper.leftToRightEuler( model.constraints[ i ].rotation ); - helper.leftToRightVector3Range( model.constraints[ i ].translationLimitation1, model.constraints[ i ].translationLimitation2 ); - helper.leftToRightEulerRange( model.constraints[ i ].rotationLimitation1, model.constraints[ i ].rotationLimitation2 ); - - } - -}; - -Parser.prototype.leftToRightVmd = function ( vmd ) { - - if ( vmd.metadata.coordinateSystem === 'right' ) { - - return; - - } - - vmd.metadata.coordinateSystem = 'right'; - - var helper = new DataCreationHelper(); - - for ( var i = 0; i < vmd.metadata.motionCount; i++ ) { - - helper.leftToRightVector3( vmd.motions[ i ].position ); - helper.leftToRightQuaternion( vmd.motions[ i ].rotation ); - - } - - for ( var i = 0; i < vmd.metadata.cameraCount; i++ ) { - - helper.leftToRightVector3( vmd.cameras[ i ].position ); - helper.leftToRightEuler( vmd.cameras[ i ].rotation ); - - } - -}; - -Parser.prototype.leftToRightVpd = function ( vpd ) { - - if ( vpd.metadata.coordinateSystem === 'right' ) { - - return; - - } - - vpd.metadata.coordinateSystem = 'right'; - - var helper = new DataCreationHelper(); - - for ( var i = 0; i < vpd.bones.length; i++ ) { - - helper.leftToRightVector3( vpd.bones[ i ].translation ); - helper.leftToRightQuaternion( vpd.bones[ i ].quaternion ); - - } - -}; - -var MMDParser = { - CharsetEncoder: CharsetEncoder, - Parser: Parser -}; - -export { MMDParser, CharsetEncoder, Parser }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/CurveModifier.js b/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/CurveModifier.js deleted file mode 100644 index d9bedea..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/CurveModifier.js +++ /dev/null @@ -1,346 +0,0 @@ -// Original src: https://github.com/zz85/threejs-path-flow -const CHANNELS = 4; -const TEXTURE_WIDTH = 1024; -const TEXTURE_HEIGHT = 4; - -import { - DataTexture, - DataUtils, - RGBAFormat, - HalfFloatType, - RepeatWrapping, - Mesh, - InstancedMesh, - LinearFilter, - DynamicDrawUsage, - Matrix4 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Make a new DataTexture to store the descriptions of the curves. - * - * @param { number } numberOfCurves the number of curves needed to be described by this texture. - */ -export function initSplineTexture( numberOfCurves = 1 ) { - - const dataArray = new Uint16Array( TEXTURE_WIDTH * TEXTURE_HEIGHT * numberOfCurves * CHANNELS ); - const dataTexture = new DataTexture( - dataArray, - TEXTURE_WIDTH, - TEXTURE_HEIGHT * numberOfCurves, - RGBAFormat, - HalfFloatType - ); - - dataTexture.wrapS = RepeatWrapping; - dataTexture.wrapY = RepeatWrapping; - dataTexture.magFilter = LinearFilter; - dataTexture.minFilter = LinearFilter; - dataTexture.needsUpdate = true; - - return dataTexture; - -} - -/** - * Write the curve description to the data texture - * - * @param { DataTexture } texture The DataTexture to write to - * @param { Curve } splineCurve The curve to describe - * @param { number } offset Which curve slot to write to - */ -export function updateSplineTexture( texture, splineCurve, offset = 0 ) { - - const numberOfPoints = Math.floor( TEXTURE_WIDTH * ( TEXTURE_HEIGHT / 4 ) ); - splineCurve.arcLengthDivisions = numberOfPoints / 2; - splineCurve.updateArcLengths(); - const points = splineCurve.getSpacedPoints( numberOfPoints ); - const frenetFrames = splineCurve.computeFrenetFrames( numberOfPoints, true ); - - for ( let i = 0; i < numberOfPoints; i ++ ) { - - const rowOffset = Math.floor( i / TEXTURE_WIDTH ); - const rowIndex = i % TEXTURE_WIDTH; - - let pt = points[ i ]; - setTextureValue( texture, rowIndex, pt.x, pt.y, pt.z, 0 + rowOffset + ( TEXTURE_HEIGHT * offset ) ); - pt = frenetFrames.tangents[ i ]; - setTextureValue( texture, rowIndex, pt.x, pt.y, pt.z, 1 + rowOffset + ( TEXTURE_HEIGHT * offset ) ); - pt = frenetFrames.normals[ i ]; - setTextureValue( texture, rowIndex, pt.x, pt.y, pt.z, 2 + rowOffset + ( TEXTURE_HEIGHT * offset ) ); - pt = frenetFrames.binormals[ i ]; - setTextureValue( texture, rowIndex, pt.x, pt.y, pt.z, 3 + rowOffset + ( TEXTURE_HEIGHT * offset ) ); - - } - - texture.needsUpdate = true; - -} - - -function setTextureValue( texture, index, x, y, z, o ) { - - const image = texture.image; - const { data } = image; - const i = CHANNELS * TEXTURE_WIDTH * o; // Row Offset - data[ index * CHANNELS + i + 0 ] = DataUtils.toHalfFloat( x ); - data[ index * CHANNELS + i + 1 ] = DataUtils.toHalfFloat( y ); - data[ index * CHANNELS + i + 2 ] = DataUtils.toHalfFloat( z ); - data[ index * CHANNELS + i + 3 ] = DataUtils.toHalfFloat( 1 ); - -} - -/** - * Create a new set of uniforms for describing the curve modifier - * - * @param { DataTexture } Texture which holds the curve description - */ -export function getUniforms( splineTexture ) { - - const uniforms = { - spineTexture: { value: splineTexture }, - pathOffset: { type: 'f', value: 0 }, // time of path curve - pathSegment: { type: 'f', value: 1 }, // fractional length of path - spineOffset: { type: 'f', value: 161 }, - spineLength: { type: 'f', value: 400 }, - flow: { type: 'i', value: 1 }, - }; - return uniforms; - -} - -export function modifyShader( material, uniforms, numberOfCurves = 1 ) { - - if ( material.__ok ) return; - material.__ok = true; - - material.onBeforeCompile = ( shader ) => { - - if ( shader.__modified ) return; - shader.__modified = true; - - Object.assign( shader.uniforms, uniforms ); - - const vertexShader = ` - uniform sampler2D spineTexture; - uniform float pathOffset; - uniform float pathSegment; - uniform float spineOffset; - uniform float spineLength; - uniform int flow; - - float textureLayers = ${TEXTURE_HEIGHT * numberOfCurves}.; - float textureStacks = ${TEXTURE_HEIGHT / 4}.; - - ${shader.vertexShader} - ` - // chunk import moved in front of modified shader below - .replace( '#include ', '' ) - - // vec3 transformedNormal declaration overriden below - .replace( '#include ', '' ) - - // vec3 transformed declaration overriden below - .replace( '#include ', '' ) - - // shader override - .replace( - /void\s*main\s*\(\)\s*\{/, - ` -void main() { -#include - -vec4 worldPos = modelMatrix * vec4(position, 1.); - -bool bend = flow > 0; -float xWeight = bend ? 0. : 1.; - -#ifdef USE_INSTANCING -float pathOffsetFromInstanceMatrix = instanceMatrix[3][2]; -float spineLengthFromInstanceMatrix = instanceMatrix[3][0]; -float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.; -float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks; -#else -float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.; -float mt = (spinePortion * pathSegment + pathOffset)*textureStacks; -#endif - -mt = mod(mt, textureStacks); -float rowOffset = floor(mt); - -#ifdef USE_INSTANCING -rowOffset += instanceMatrix[3][1] * ${TEXTURE_HEIGHT}.; -#endif - -vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz; -vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz; -vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz; -vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz; -mat3 basis = mat3(a, b, c); - -vec3 transformed = basis - * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.) - + spinePos; - -vec3 transformedNormal = normalMatrix * (basis * objectNormal); - ` ).replace( - '#include ', - `vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 ); - gl_Position = projectionMatrix * mvPosition;` - ); - - shader.vertexShader = vertexShader; - - }; - -} - -/** - * A helper class for making meshes bend aroudn curves - */ -export class Flow { - - /** - * @param {Mesh} mesh The mesh to clone and modify to bend around the curve - * @param {number} numberOfCurves The amount of space that should preallocated for additional curves - */ - constructor( mesh, numberOfCurves = 1 ) { - - const obj3D = mesh.clone(); - const splineTexure = initSplineTexture( numberOfCurves ); - const uniforms = getUniforms( splineTexure ); - obj3D.traverse( function ( child ) { - - if ( - child instanceof Mesh || - child instanceof InstancedMesh - ) { - - if ( Array.isArray( child.material ) ) { - - const materials = []; - - for ( const material of child.material ) { - - const newMaterial = material.clone(); - modifyShader( newMaterial, uniforms, numberOfCurves ); - materials.push( newMaterial ); - - } - - child.material = materials; - - } else { - - child.material = child.material.clone(); - modifyShader( child.material, uniforms, numberOfCurves ); - - } - - } - - } ); - - this.curveArray = new Array( numberOfCurves ); - this.curveLengthArray = new Array( numberOfCurves ); - - this.object3D = obj3D; - this.splineTexure = splineTexure; - this.uniforms = uniforms; - - } - - updateCurve( index, curve ) { - - if ( index >= this.curveArray.length ) throw Error( 'Index out of range for Flow' ); - const curveLength = curve.getLength(); - this.uniforms.spineLength.value = curveLength; - this.curveLengthArray[ index ] = curveLength; - this.curveArray[ index ] = curve; - updateSplineTexture( this.splineTexure, curve, index ); - - } - - moveAlongCurve( amount ) { - - this.uniforms.pathOffset.value += amount; - - } - -} -const matrix = new Matrix4(); - -/** - * A helper class for creating instanced versions of flow, where the instances are placed on the curve. - */ -export class InstancedFlow extends Flow { - - /** - * - * @param {number} count The number of instanced elements - * @param {number} curveCount The number of curves to preallocate for - * @param {Geometry} geometry The geometry to use for the instanced mesh - * @param {Material} material The material to use for the instanced mesh - */ - constructor( count, curveCount, geometry, material ) { - - const mesh = new InstancedMesh( - geometry, - material, - count - ); - mesh.instanceMatrix.setUsage( DynamicDrawUsage ); - mesh.frustumCulled = false; - super( mesh, curveCount ); - - this.offsets = new Array( count ).fill( 0 ); - this.whichCurve = new Array( count ).fill( 0 ); - - } - - /** - * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects - * This writes that information to the matrix and marks it as needing update. - * - * @param {number} index of the instanced element to update - */ - writeChanges( index ) { - - matrix.makeTranslation( - this.curveLengthArray[ this.whichCurve[ index ] ], - this.whichCurve[ index ], - this.offsets[ index ] - ); - this.object3D.setMatrixAt( index, matrix ); - this.object3D.instanceMatrix.needsUpdate = true; - - } - - /** - * Move an individual element along the curve by a specific amount - * - * @param {number} index Which element to update - * @param {number} offset Move by how much - */ - moveIndividualAlongCurve( index, offset ) { - - this.offsets[ index ] += offset; - this.writeChanges( index ); - - } - - /** - * Select which curve to use for an element - * - * @param {number} index the index of the instanced element to update - * @param {number} curveNo the index of the curve it should use - */ - setCurve( index, curveNo ) { - - if ( isNaN( curveNo ) ) throw Error( 'curve index being set is Not a Number (NaN)' ); - this.whichCurve[ index ] = curveNo; - this.writeChanges( index ); - - } - -} diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/EdgeSplitModifier.js b/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/EdgeSplitModifier.js deleted file mode 100644 index 1a48d26..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/EdgeSplitModifier.js +++ /dev/null @@ -1,279 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import * as BufferGeometryUtils from '../utils/BufferGeometryUtils.js'; - -const _A = new Vector3(); -const _B = new Vector3(); -const _C = new Vector3(); - -class EdgeSplitModifier { - - modify( geometry, cutOffAngle, tryKeepNormals = true ) { - - function computeNormals() { - - normals = new Float32Array( indexes.length * 3 ); - - for ( let i = 0; i < indexes.length; i += 3 ) { - - let index = indexes[ i ]; - - _A.set( - positions[ 3 * index ], - positions[ 3 * index + 1 ], - positions[ 3 * index + 2 ] ); - - index = indexes[ i + 1 ]; - _B.set( - positions[ 3 * index ], - positions[ 3 * index + 1 ], - positions[ 3 * index + 2 ] ); - - index = indexes[ i + 2 ]; - _C.set( - positions[ 3 * index ], - positions[ 3 * index + 1 ], - positions[ 3 * index + 2 ] ); - - _C.sub( _B ); - _A.sub( _B ); - - const normal = _C.cross( _A ).normalize(); - - for ( let j = 0; j < 3; j ++ ) { - - normals[ 3 * ( i + j ) ] = normal.x; - normals[ 3 * ( i + j ) + 1 ] = normal.y; - normals[ 3 * ( i + j ) + 2 ] = normal.z; - - } - - } - - } - - - function mapPositionsToIndexes() { - - pointToIndexMap = Array( positions.length / 3 ); - - for ( let i = 0; i < indexes.length; i ++ ) { - - const index = indexes[ i ]; - - if ( pointToIndexMap[ index ] == null ) { - - pointToIndexMap[ index ] = []; - - } - - pointToIndexMap[ index ].push( i ); - - } - - } - - - function edgeSplitToGroups( indexes, cutOff, firstIndex ) { - - _A.set( normals[ 3 * firstIndex ], normals[ 3 * firstIndex + 1 ], normals[ 3 * firstIndex + 2 ] ).normalize(); - - const result = { - splitGroup: [], - currentGroup: [ firstIndex ] - }; - - for ( const j of indexes ) { - - if ( j !== firstIndex ) { - - _B.set( normals[ 3 * j ], normals[ 3 * j + 1 ], normals[ 3 * j + 2 ] ).normalize(); - - if ( _B.dot( _A ) < cutOff ) { - - result.splitGroup.push( j ); - - } else { - - result.currentGroup.push( j ); - - } - - } - - } - - return result; - - } - - - function edgeSplit( indexes, cutOff, original = null ) { - - if ( indexes.length === 0 ) return; - - const groupResults = []; - - for ( const index of indexes ) { - - groupResults.push( edgeSplitToGroups( indexes, cutOff, index ) ); - - } - - let result = groupResults[ 0 ]; - - for ( const groupResult of groupResults ) { - - if ( groupResult.currentGroup.length > result.currentGroup.length ) { - - result = groupResult; - - } - - } - - - if ( original != null ) { - - splitIndexes.push( { - original: original, - indexes: result.currentGroup - } ); - - } - - if ( result.splitGroup.length ) { - - edgeSplit( result.splitGroup, cutOff, original || result.currentGroup[ 0 ] ); - - } - - } - - let hadNormals = false; - let oldNormals = null; - - if ( geometry.attributes.normal ) { - - hadNormals = true; - - geometry = geometry.clone(); - - if ( tryKeepNormals === true && geometry.index !== null ) { - - oldNormals = geometry.attributes.normal.array; - - } - - geometry.deleteAttribute( 'normal' ); - - } - - if ( geometry.index == null ) { - - geometry = BufferGeometryUtils.mergeVertices( geometry ); - - } - - const indexes = geometry.index.array; - const positions = geometry.getAttribute( 'position' ).array; - - let normals; - let pointToIndexMap; - - computeNormals(); - mapPositionsToIndexes(); - - const splitIndexes = []; - - for ( const vertexIndexes of pointToIndexMap ) { - - edgeSplit( vertexIndexes, Math.cos( cutOffAngle ) - 0.001 ); - - } - - const newAttributes = {}; - for ( const name of Object.keys( geometry.attributes ) ) { - - const oldAttribute = geometry.attributes[ name ]; - const newArray = new oldAttribute.array.constructor( ( indexes.length + splitIndexes.length ) * oldAttribute.itemSize ); - newArray.set( oldAttribute.array ); - newAttributes[ name ] = new BufferAttribute( newArray, oldAttribute.itemSize, oldAttribute.normalized ); - - } - - const newIndexes = new Uint32Array( indexes.length ); - newIndexes.set( indexes ); - - for ( let i = 0; i < splitIndexes.length; i ++ ) { - - const split = splitIndexes[ i ]; - const index = indexes[ split.original ]; - - for ( const attribute of Object.values( newAttributes ) ) { - - for ( let j = 0; j < attribute.itemSize; j ++ ) { - - attribute.array[ ( indexes.length + i ) * attribute.itemSize + j ] = - attribute.array[ index * attribute.itemSize + j ]; - - } - - } - - for ( const j of split.indexes ) { - - newIndexes[ j ] = indexes.length + i; - - } - - } - - geometry = new BufferGeometry(); - geometry.setIndex( new BufferAttribute( newIndexes, 1 ) ); - - for ( const name of Object.keys( newAttributes ) ) { - - geometry.setAttribute( name, newAttributes[ name ] ); - - } - - if ( hadNormals ) { - - geometry.computeVertexNormals(); - - if ( oldNormals !== null ) { - - const changedNormals = new Array( oldNormals.length / 3 ).fill( false ); - - for ( const splitData of splitIndexes ) - changedNormals[ splitData.original ] = true; - - for ( let i = 0; i < changedNormals.length; i ++ ) { - - if ( changedNormals[ i ] === false ) { - - for ( let j = 0; j < 3; j ++ ) - geometry.attributes.normal.array[ 3 * i + j ] = oldNormals[ 3 * i + j ]; - - } - - } - - - } - - } - - return geometry; - - } - -} - - - -export { EdgeSplitModifier }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/SimplifyModifier.js b/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/SimplifyModifier.js deleted file mode 100644 index cd2a18d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/SimplifyModifier.js +++ /dev/null @@ -1,618 +0,0 @@ -import { - BufferGeometry, - Color, - Float32BufferAttribute, - Vector2, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import * as BufferGeometryUtils from '../utils/BufferGeometryUtils.js'; - -/** - * Simplification Geometry Modifier - * - based on code and technique - * - by Stan Melax in 1998 - * - Progressive Mesh type Polygon Reduction Algorithm - * - http://www.melax.com/polychop/ - */ - -const _cb = new Vector3(), _ab = new Vector3(); - -class SimplifyModifier { - - modify( geometry, count ) { - - geometry = geometry.clone(); - - // currently morphAttributes are not supported - delete geometry.morphAttributes.position; - delete geometry.morphAttributes.normal; - const attributes = geometry.attributes; - - // this modifier can only process indexed and non-indexed geomtries with at least a position attribute - - for ( const name in attributes ) { - - if ( name !== 'position' && name !== 'uv' && name !== 'normal' && name !== 'tangent' && name !== 'color' ) geometry.deleteAttribute( name ); - - } - - geometry = BufferGeometryUtils.mergeVertices( geometry ); - - // - // put data of original geometry in different data structures - // - - const vertices = []; - const faces = []; - - // add vertices - - const positionAttribute = geometry.getAttribute( 'position' ); - const uvAttribute = geometry.getAttribute( 'uv' ); - const normalAttribute = geometry.getAttribute( 'normal' ); - const tangentAttribute = geometry.getAttribute( 'tangent' ); - const colorAttribute = geometry.getAttribute( 'color' ); - - let t = null; - let v2 = null; - let nor = null; - let col = null; - - for ( let i = 0; i < positionAttribute.count; i ++ ) { - - const v = new Vector3().fromBufferAttribute( positionAttribute, i ); - if ( uvAttribute ) { - - v2 = new Vector2().fromBufferAttribute( uvAttribute, i ); - - } - - if ( normalAttribute ) { - - nor = new Vector3().fromBufferAttribute( normalAttribute, i ); - - } - - if ( tangentAttribute ) { - - t = new Vector4().fromBufferAttribute( tangentAttribute, i ); - - } - - if ( colorAttribute ) { - - col = new Color().fromBufferAttribute( colorAttribute, i ); - - } - - const vertex = new Vertex( v, v2, nor, t, col ); - vertices.push( vertex ); - - } - - // add faces - - let index = geometry.getIndex(); - - if ( index !== null ) { - - for ( let i = 0; i < index.count; i += 3 ) { - - const a = index.getX( i ); - const b = index.getX( i + 1 ); - const c = index.getX( i + 2 ); - - const triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c ); - faces.push( triangle ); - - } - - } else { - - for ( let i = 0; i < positionAttribute.count; i += 3 ) { - - const a = i; - const b = i + 1; - const c = i + 2; - - const triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c ); - faces.push( triangle ); - - } - - } - - // compute all edge collapse costs - - for ( let i = 0, il = vertices.length; i < il; i ++ ) { - - computeEdgeCostAtVertex( vertices[ i ] ); - - } - - let nextVertex; - - let z = count; - - while ( z -- ) { - - nextVertex = minimumCostEdge( vertices ); - - if ( ! nextVertex ) { - - console.log( 'THREE.SimplifyModifier: No next vertex' ); - break; - - } - - collapse( vertices, faces, nextVertex, nextVertex.collapseNeighbor ); - - } - - // - - const simplifiedGeometry = new BufferGeometry(); - const position = []; - const uv = []; - const normal = []; - const tangent = []; - const color = []; - - index = []; - - // - - for ( let i = 0; i < vertices.length; i ++ ) { - - const vertex = vertices[ i ]; - position.push( vertex.position.x, vertex.position.y, vertex.position.z ); - if ( vertex.uv ) { - - uv.push( vertex.uv.x, vertex.uv.y ); - - } - - if ( vertex.normal ) { - - normal.push( vertex.normal.x, vertex.normal.y, vertex.normal.z ); - - } - - if ( vertex.tangent ) { - - tangent.push( vertex.tangent.x, vertex.tangent.y, vertex.tangent.z, vertex.tangent.w ); - - } - - if ( vertex.color ) { - - color.push( vertex.color.r, vertex.color.g, vertex.color.b ); - - } - - - // cache final index to GREATLY speed up faces reconstruction - vertex.id = i; - - } - - // - - for ( let i = 0; i < faces.length; i ++ ) { - - const face = faces[ i ]; - index.push( face.v1.id, face.v2.id, face.v3.id ); - - } - - simplifiedGeometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) ); - if ( uv.length > 0 ) simplifiedGeometry.setAttribute( 'uv', new Float32BufferAttribute( uv, 2 ) ); - if ( normal.length > 0 ) simplifiedGeometry.setAttribute( 'normal', new Float32BufferAttribute( normal, 3 ) ); - if ( tangent.length > 0 ) simplifiedGeometry.setAttribute( 'tangent', new Float32BufferAttribute( tangent, 4 ) ); - if ( color.length > 0 ) simplifiedGeometry.setAttribute( 'color', new Float32BufferAttribute( color, 3 ) ); - - simplifiedGeometry.setIndex( index ); - - return simplifiedGeometry; - - } - -} - -function pushIfUnique( array, object ) { - - if ( array.indexOf( object ) === - 1 ) array.push( object ); - -} - -function removeFromArray( array, object ) { - - const k = array.indexOf( object ); - if ( k > - 1 ) array.splice( k, 1 ); - -} - -function computeEdgeCollapseCost( u, v ) { - - // if we collapse edge uv by moving u to v then how - // much different will the model change, i.e. the "error". - - const edgelength = v.position.distanceTo( u.position ); - let curvature = 0; - - const sideFaces = []; - - // find the "sides" triangles that are on the edge uv - for ( let i = 0, il = u.faces.length; i < il; i ++ ) { - - const face = u.faces[ i ]; - - if ( face.hasVertex( v ) ) { - - sideFaces.push( face ); - - } - - } - - // use the triangle facing most away from the sides - // to determine our curvature term - for ( let i = 0, il = u.faces.length; i < il; i ++ ) { - - let minCurvature = 1; - const face = u.faces[ i ]; - - for ( let j = 0; j < sideFaces.length; j ++ ) { - - const sideFace = sideFaces[ j ]; - // use dot product of face normals. - const dotProd = face.normal.dot( sideFace.normal ); - minCurvature = Math.min( minCurvature, ( 1.001 - dotProd ) / 2 ); - - } - - curvature = Math.max( curvature, minCurvature ); - - } - - // crude approach in attempt to preserve borders - // though it seems not to be totally correct - const borders = 0; - - if ( sideFaces.length < 2 ) { - - // we add some arbitrary cost for borders, - // borders += 10; - curvature = 1; - - } - - const amt = edgelength * curvature + borders; - - return amt; - -} - -function computeEdgeCostAtVertex( v ) { - - // compute the edge collapse cost for all edges that start - // from vertex v. Since we are only interested in reducing - // the object by selecting the min cost edge at each step, we - // only cache the cost of the least cost edge at this vertex - // (in member variable collapse) as well as the value of the - // cost (in member variable collapseCost). - - if ( v.neighbors.length === 0 ) { - - // collapse if no neighbors. - v.collapseNeighbor = null; - v.collapseCost = - 0.01; - - return; - - } - - v.collapseCost = 100000; - v.collapseNeighbor = null; - - // search all neighboring edges for "least cost" edge - for ( let i = 0; i < v.neighbors.length; i ++ ) { - - const collapseCost = computeEdgeCollapseCost( v, v.neighbors[ i ] ); - - if ( ! v.collapseNeighbor ) { - - v.collapseNeighbor = v.neighbors[ i ]; - v.collapseCost = collapseCost; - v.minCost = collapseCost; - v.totalCost = 0; - v.costCount = 0; - - } - - v.costCount ++; - v.totalCost += collapseCost; - - if ( collapseCost < v.minCost ) { - - v.collapseNeighbor = v.neighbors[ i ]; - v.minCost = collapseCost; - - } - - } - - // we average the cost of collapsing at this vertex - v.collapseCost = v.totalCost / v.costCount; - // v.collapseCost = v.minCost; - -} - -function removeVertex( v, vertices ) { - - console.assert( v.faces.length === 0 ); - - while ( v.neighbors.length ) { - - const n = v.neighbors.pop(); - removeFromArray( n.neighbors, v ); - - } - - removeFromArray( vertices, v ); - -} - -function removeFace( f, faces ) { - - removeFromArray( faces, f ); - - if ( f.v1 ) removeFromArray( f.v1.faces, f ); - if ( f.v2 ) removeFromArray( f.v2.faces, f ); - if ( f.v3 ) removeFromArray( f.v3.faces, f ); - - // TODO optimize this! - const vs = [ f.v1, f.v2, f.v3 ]; - - for ( let i = 0; i < 3; i ++ ) { - - const v1 = vs[ i ]; - const v2 = vs[ ( i + 1 ) % 3 ]; - - if ( ! v1 || ! v2 ) continue; - - v1.removeIfNonNeighbor( v2 ); - v2.removeIfNonNeighbor( v1 ); - - } - -} - -function collapse( vertices, faces, u, v ) { - - // Collapse the edge uv by moving vertex u onto v - - if ( ! v ) { - - // u is a vertex all by itself so just delete it.. - removeVertex( u, vertices ); - return; - - } - - if ( v.uv ) { - - u.uv.copy( v.uv ); - - } - - if ( v.normal ) { - - v.normal.add( u.normal ).normalize(); - - } - - if ( v.tangent ) { - - v.tangent.add( u.tangent ).normalize(); - - } - - const tmpVertices = []; - - for ( let i = 0; i < u.neighbors.length; i ++ ) { - - tmpVertices.push( u.neighbors[ i ] ); - - } - - - // delete triangles on edge uv: - for ( let i = u.faces.length - 1; i >= 0; i -- ) { - - if ( u.faces[ i ] && u.faces[ i ].hasVertex( v ) ) { - - removeFace( u.faces[ i ], faces ); - - } - - } - - // update remaining triangles to have v instead of u - for ( let i = u.faces.length - 1; i >= 0; i -- ) { - - u.faces[ i ].replaceVertex( u, v ); - - } - - - removeVertex( u, vertices ); - - // recompute the edge collapse costs in neighborhood - for ( let i = 0; i < tmpVertices.length; i ++ ) { - - computeEdgeCostAtVertex( tmpVertices[ i ] ); - - } - -} - - - -function minimumCostEdge( vertices ) { - - // O(n * n) approach. TODO optimize this - - let least = vertices[ 0 ]; - - for ( let i = 0; i < vertices.length; i ++ ) { - - if ( vertices[ i ].collapseCost < least.collapseCost ) { - - least = vertices[ i ]; - - } - - } - - return least; - -} - -// we use a triangle class to represent structure of face slightly differently - -class Triangle { - - constructor( v1, v2, v3, a, b, c ) { - - this.a = a; - this.b = b; - this.c = c; - - this.v1 = v1; - this.v2 = v2; - this.v3 = v3; - - this.normal = new Vector3(); - - this.computeNormal(); - - v1.faces.push( this ); - v1.addUniqueNeighbor( v2 ); - v1.addUniqueNeighbor( v3 ); - - v2.faces.push( this ); - v2.addUniqueNeighbor( v1 ); - v2.addUniqueNeighbor( v3 ); - - - v3.faces.push( this ); - v3.addUniqueNeighbor( v1 ); - v3.addUniqueNeighbor( v2 ); - - } - - computeNormal() { - - const vA = this.v1.position; - const vB = this.v2.position; - const vC = this.v3.position; - - _cb.subVectors( vC, vB ); - _ab.subVectors( vA, vB ); - _cb.cross( _ab ).normalize(); - - this.normal.copy( _cb ); - - } - - hasVertex( v ) { - - return v === this.v1 || v === this.v2 || v === this.v3; - - } - - replaceVertex( oldv, newv ) { - - if ( oldv === this.v1 ) this.v1 = newv; - else if ( oldv === this.v2 ) this.v2 = newv; - else if ( oldv === this.v3 ) this.v3 = newv; - - removeFromArray( oldv.faces, this ); - newv.faces.push( this ); - - - oldv.removeIfNonNeighbor( this.v1 ); - this.v1.removeIfNonNeighbor( oldv ); - - oldv.removeIfNonNeighbor( this.v2 ); - this.v2.removeIfNonNeighbor( oldv ); - - oldv.removeIfNonNeighbor( this.v3 ); - this.v3.removeIfNonNeighbor( oldv ); - - this.v1.addUniqueNeighbor( this.v2 ); - this.v1.addUniqueNeighbor( this.v3 ); - - this.v2.addUniqueNeighbor( this.v1 ); - this.v2.addUniqueNeighbor( this.v3 ); - - this.v3.addUniqueNeighbor( this.v1 ); - this.v3.addUniqueNeighbor( this.v2 ); - - this.computeNormal(); - - } - -} - -class Vertex { - - constructor( v, uv, normal, tangent, color ) { - - this.position = v; - this.uv = uv; - this.normal = normal; - this.tangent = tangent; - this.color = color; - - this.id = - 1; // external use position in vertices list (for e.g. face generation) - - this.faces = []; // faces vertex is connected - this.neighbors = []; // neighbouring vertices aka "adjacentVertices" - - // these will be computed in computeEdgeCostAtVertex() - this.collapseCost = 0; // cost of collapsing this vertex, the less the better. aka objdist - this.collapseNeighbor = null; // best candinate for collapsing - - } - - addUniqueNeighbor( vertex ) { - - pushIfUnique( this.neighbors, vertex ); - - } - - removeIfNonNeighbor( n ) { - - const neighbors = this.neighbors; - const faces = this.faces; - - const offset = neighbors.indexOf( n ); - - if ( offset === - 1 ) return; - - for ( let i = 0; i < faces.length; i ++ ) { - - if ( faces[ i ].hasVertex( n ) ) return; - - } - - neighbors.splice( offset, 1 ); - - } - -} - -export { SimplifyModifier }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/TessellateModifier.js b/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/TessellateModifier.js deleted file mode 100644 index e8d2759..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/modifiers/TessellateModifier.js +++ /dev/null @@ -1,307 +0,0 @@ -import { - BufferGeometry, - Color, - Float32BufferAttribute, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Break faces with edges longer than maxEdgeLength - */ - -class TessellateModifier { - - constructor( maxEdgeLength = 0.1, maxIterations = 6 ) { - - this.maxEdgeLength = maxEdgeLength; - this.maxIterations = maxIterations; - - } - - modify( geometry ) { - - if ( geometry.index !== null ) { - - geometry = geometry.toNonIndexed(); - - } - - // - - const maxIterations = this.maxIterations; - const maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength; - - const va = new Vector3(); - const vb = new Vector3(); - const vc = new Vector3(); - const vm = new Vector3(); - const vs = [ va, vb, vc, vm ]; - - const na = new Vector3(); - const nb = new Vector3(); - const nc = new Vector3(); - const nm = new Vector3(); - const ns = [ na, nb, nc, nm ]; - - const ca = new Color(); - const cb = new Color(); - const cc = new Color(); - const cm = new Color(); - const cs = [ ca, cb, cc, cm ]; - - const ua = new Vector2(); - const ub = new Vector2(); - const uc = new Vector2(); - const um = new Vector2(); - const us = [ ua, ub, uc, um ]; - - const u2a = new Vector2(); - const u2b = new Vector2(); - const u2c = new Vector2(); - const u2m = new Vector2(); - const u2s = [ u2a, u2b, u2c, u2m ]; - - const attributes = geometry.attributes; - const hasNormals = attributes.normal !== undefined; - const hasColors = attributes.color !== undefined; - const hasUVs = attributes.uv !== undefined; - const hasUV1s = attributes.uv1 !== undefined; - - let positions = attributes.position.array; - let normals = hasNormals ? attributes.normal.array : null; - let colors = hasColors ? attributes.color.array : null; - let uvs = hasUVs ? attributes.uv.array : null; - let uv1s = hasUV1s ? attributes.uv1.array : null; - - let positions2 = positions; - let normals2 = normals; - let colors2 = colors; - let uvs2 = uvs; - let uv1s2 = uv1s; - - let iteration = 0; - let tessellating = true; - - function addTriangle( a, b, c ) { - - const v1 = vs[ a ]; - const v2 = vs[ b ]; - const v3 = vs[ c ]; - - positions2.push( v1.x, v1.y, v1.z ); - positions2.push( v2.x, v2.y, v2.z ); - positions2.push( v3.x, v3.y, v3.z ); - - if ( hasNormals ) { - - const n1 = ns[ a ]; - const n2 = ns[ b ]; - const n3 = ns[ c ]; - - normals2.push( n1.x, n1.y, n1.z ); - normals2.push( n2.x, n2.y, n2.z ); - normals2.push( n3.x, n3.y, n3.z ); - - } - - if ( hasColors ) { - - const c1 = cs[ a ]; - const c2 = cs[ b ]; - const c3 = cs[ c ]; - - colors2.push( c1.r, c1.g, c1.b ); - colors2.push( c2.r, c2.g, c2.b ); - colors2.push( c3.r, c3.g, c3.b ); - - } - - if ( hasUVs ) { - - const u1 = us[ a ]; - const u2 = us[ b ]; - const u3 = us[ c ]; - - uvs2.push( u1.x, u1.y ); - uvs2.push( u2.x, u2.y ); - uvs2.push( u3.x, u3.y ); - - } - - if ( hasUV1s ) { - - const u21 = u2s[ a ]; - const u22 = u2s[ b ]; - const u23 = u2s[ c ]; - - uv1s2.push( u21.x, u21.y ); - uv1s2.push( u22.x, u22.y ); - uv1s2.push( u23.x, u23.y ); - - } - - } - - while ( tessellating && iteration < maxIterations ) { - - iteration ++; - tessellating = false; - - positions = positions2; - positions2 = []; - - if ( hasNormals ) { - - normals = normals2; - normals2 = []; - - } - - if ( hasColors ) { - - colors = colors2; - colors2 = []; - - } - - if ( hasUVs ) { - - uvs = uvs2; - uvs2 = []; - - } - - if ( hasUV1s ) { - - uv1s = uv1s2; - uv1s2 = []; - - } - - for ( let i = 0, i2 = 0, il = positions.length; i < il; i += 9, i2 += 6 ) { - - va.fromArray( positions, i + 0 ); - vb.fromArray( positions, i + 3 ); - vc.fromArray( positions, i + 6 ); - - if ( hasNormals ) { - - na.fromArray( normals, i + 0 ); - nb.fromArray( normals, i + 3 ); - nc.fromArray( normals, i + 6 ); - - } - - if ( hasColors ) { - - ca.fromArray( colors, i + 0 ); - cb.fromArray( colors, i + 3 ); - cc.fromArray( colors, i + 6 ); - - } - - if ( hasUVs ) { - - ua.fromArray( uvs, i2 + 0 ); - ub.fromArray( uvs, i2 + 2 ); - uc.fromArray( uvs, i2 + 4 ); - - } - - if ( hasUV1s ) { - - u2a.fromArray( uv1s, i2 + 0 ); - u2b.fromArray( uv1s, i2 + 2 ); - u2c.fromArray( uv1s, i2 + 4 ); - - } - - const dab = va.distanceToSquared( vb ); - const dbc = vb.distanceToSquared( vc ); - const dac = va.distanceToSquared( vc ); - - if ( dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared ) { - - tessellating = true; - - if ( dab >= dbc && dab >= dac ) { - - vm.lerpVectors( va, vb, 0.5 ); - if ( hasNormals ) nm.lerpVectors( na, nb, 0.5 ); - if ( hasColors ) cm.lerpColors( ca, cb, 0.5 ); - if ( hasUVs ) um.lerpVectors( ua, ub, 0.5 ); - if ( hasUV1s ) u2m.lerpVectors( u2a, u2b, 0.5 ); - - addTriangle( 0, 3, 2 ); - addTriangle( 3, 1, 2 ); - - } else if ( dbc >= dab && dbc >= dac ) { - - vm.lerpVectors( vb, vc, 0.5 ); - if ( hasNormals ) nm.lerpVectors( nb, nc, 0.5 ); - if ( hasColors ) cm.lerpColors( cb, cc, 0.5 ); - if ( hasUVs ) um.lerpVectors( ub, uc, 0.5 ); - if ( hasUV1s ) u2m.lerpVectors( u2b, u2c, 0.5 ); - - addTriangle( 0, 1, 3 ); - addTriangle( 3, 2, 0 ); - - } else { - - vm.lerpVectors( va, vc, 0.5 ); - if ( hasNormals ) nm.lerpVectors( na, nc, 0.5 ); - if ( hasColors ) cm.lerpColors( ca, cc, 0.5 ); - if ( hasUVs ) um.lerpVectors( ua, uc, 0.5 ); - if ( hasUV1s ) u2m.lerpVectors( u2a, u2c, 0.5 ); - - addTriangle( 0, 1, 3 ); - addTriangle( 3, 1, 2 ); - - } - - } else { - - addTriangle( 0, 1, 2 ); - - } - - } - - } - - const geometry2 = new BufferGeometry(); - - geometry2.setAttribute( 'position', new Float32BufferAttribute( positions2, 3 ) ); - - if ( hasNormals ) { - - geometry2.setAttribute( 'normal', new Float32BufferAttribute( normals2, 3 ) ); - - } - - if ( hasColors ) { - - geometry2.setAttribute( 'color', new Float32BufferAttribute( colors2, 3 ) ); - - } - - if ( hasUVs ) { - - geometry2.setAttribute( 'uv', new Float32BufferAttribute( uvs2, 2 ) ); - - } - - if ( hasUV1s ) { - - geometry2.setAttribute( 'uv1', new Float32BufferAttribute( uv1s2, 2 ) ); - - } - - return geometry2; - - } - -} - -export { TessellateModifier }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/GroundedSkybox.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/GroundedSkybox.js deleted file mode 100644 index 5ea3e30..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/GroundedSkybox.js +++ /dev/null @@ -1,50 +0,0 @@ -import { Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from '/static/javascript/three/build/three.module.js'; - -/** - * A ground-projected skybox. The height is how far the camera that took the photo was above the ground - - * a larger value will magnify the downward part of the image. By default the object is centered at the camera, - * so it is often helpful to set skybox.position.y = height to put the ground at the origin. Set the radius - * large enough to ensure your user's camera stays inside. - */ - -class GroundedSkybox extends Mesh { - - constructor( map, height, radius, resolution = 128 ) { - - if ( height <= 0 || radius <= 0 || resolution <= 0 ) { - - throw new Error( 'GroundedSkybox height, radius, and resolution must be positive.' ); - - } - - const geometry = new SphereGeometry( radius, 2 * resolution, resolution ); - geometry.scale( 1, 1, -1 ); - - const pos = geometry.getAttribute( 'position' ); - const tmp = new Vector3(); - - for ( let i = 0; i < pos.count; ++ i ) { - - tmp.fromBufferAttribute( pos, i ); - if ( tmp.y < 0 ) { - - // Smooth out the transition from flat floor to sphere: - const y1 = - height * 3 / 2; - const f = - tmp.y < y1 ? - height / tmp.y : ( 1 - tmp.y * tmp.y / ( 3 * y1 * y1 ) ); - tmp.multiplyScalar( f ); - tmp.toArray( pos.array, 3 * i ); - - } - - } - - pos.needsUpdate = true; - - super( geometry, new MeshBasicMaterial( { map, depthWrite: false } ) ); - - } - -} - -export { GroundedSkybox }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/InstancedPoints.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/InstancedPoints.js deleted file mode 100644 index b0b0f24..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/InstancedPoints.js +++ /dev/null @@ -1,21 +0,0 @@ -import { - Mesh, - InstancedPointsNodeMaterial -} from '/static/javascript/three/build/three.module.js'; -import InstancedPointsGeometry from '../geometries/InstancedPointsGeometry.js'; - -class InstancedPoints extends Mesh { - - constructor( geometry = new InstancedPointsGeometry(), material = new InstancedPointsNodeMaterial() ) { - - super( geometry, material ); - - this.isInstancedPoints = true; - - this.type = 'InstancedPoints'; - - } - -} - -export default InstancedPoints; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Lensflare.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Lensflare.js deleted file mode 100644 index cc14550..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Lensflare.js +++ /dev/null @@ -1,397 +0,0 @@ -import { - AdditiveBlending, - Box2, - BufferGeometry, - Color, - FramebufferTexture, - InterleavedBuffer, - InterleavedBufferAttribute, - Mesh, - MeshBasicMaterial, - RawShaderMaterial, - UnsignedByteType, - Vector2, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; - -class Lensflare extends Mesh { - - constructor() { - - super( Lensflare.Geometry, new MeshBasicMaterial( { opacity: 0, transparent: true } ) ); - - this.isLensflare = true; - - this.type = 'Lensflare'; - this.frustumCulled = false; - this.renderOrder = Infinity; - - // - - const positionScreen = new Vector3(); - const positionView = new Vector3(); - - // textures - - const tempMap = new FramebufferTexture( 16, 16 ); - const occlusionMap = new FramebufferTexture( 16, 16 ); - - let currentType = UnsignedByteType; - - // material - - const geometry = Lensflare.Geometry; - - const material1a = new RawShaderMaterial( { - uniforms: { - 'scale': { value: null }, - 'screenPosition': { value: null } - }, - vertexShader: /* glsl */` - - precision highp float; - - uniform vec3 screenPosition; - uniform vec2 scale; - - attribute vec3 position; - - void main() { - - gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - precision highp float; - - void main() { - - gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); - - }`, - depthTest: true, - depthWrite: false, - transparent: false - } ); - - const material1b = new RawShaderMaterial( { - uniforms: { - 'map': { value: tempMap }, - 'scale': { value: null }, - 'screenPosition': { value: null } - }, - vertexShader: /* glsl */` - - precision highp float; - - uniform vec3 screenPosition; - uniform vec2 scale; - - attribute vec3 position; - attribute vec2 uv; - - varying vec2 vUV; - - void main() { - - vUV = uv; - - gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - precision highp float; - - uniform sampler2D map; - - varying vec2 vUV; - - void main() { - - gl_FragColor = texture2D( map, vUV ); - - }`, - depthTest: false, - depthWrite: false, - transparent: false - } ); - - // the following object is used for occlusionMap generation - - const mesh1 = new Mesh( geometry, material1a ); - - // - - const elements = []; - - const shader = LensflareElement.Shader; - - const material2 = new RawShaderMaterial( { - name: shader.name, - uniforms: { - 'map': { value: null }, - 'occlusionMap': { value: occlusionMap }, - 'color': { value: new Color( 0xffffff ) }, - 'scale': { value: new Vector2() }, - 'screenPosition': { value: new Vector3() } - }, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - blending: AdditiveBlending, - transparent: true, - depthWrite: false - } ); - - const mesh2 = new Mesh( geometry, material2 ); - - this.addElement = function ( element ) { - - elements.push( element ); - - }; - - // - - const scale = new Vector2(); - const screenPositionPixels = new Vector2(); - const validArea = new Box2(); - const viewport = new Vector4(); - - this.onBeforeRender = function ( renderer, scene, camera ) { - - renderer.getCurrentViewport( viewport ); - - const renderTarget = renderer.getRenderTarget(); - const type = ( renderTarget !== null ) ? renderTarget.texture.type : UnsignedByteType; - - if ( currentType !== type ) { - - tempMap.dispose(); - occlusionMap.dispose(); - - tempMap.type = occlusionMap.type = type; - - currentType = type; - - } - - const invAspect = viewport.w / viewport.z; - const halfViewportWidth = viewport.z / 2.0; - const halfViewportHeight = viewport.w / 2.0; - - let size = 16 / viewport.w; - scale.set( size * invAspect, size ); - - validArea.min.set( viewport.x, viewport.y ); - validArea.max.set( viewport.x + ( viewport.z - 16 ), viewport.y + ( viewport.w - 16 ) ); - - // calculate position in screen space - - positionView.setFromMatrixPosition( this.matrixWorld ); - positionView.applyMatrix4( camera.matrixWorldInverse ); - - if ( positionView.z > 0 ) return; // lensflare is behind the camera - - positionScreen.copy( positionView ).applyMatrix4( camera.projectionMatrix ); - - // horizontal and vertical coordinate of the lower left corner of the pixels to copy - - screenPositionPixels.x = viewport.x + ( positionScreen.x * halfViewportWidth ) + halfViewportWidth - 8; - screenPositionPixels.y = viewport.y + ( positionScreen.y * halfViewportHeight ) + halfViewportHeight - 8; - - // screen cull - - if ( validArea.containsPoint( screenPositionPixels ) ) { - - // save current RGB to temp texture - - renderer.copyFramebufferToTexture( tempMap, screenPositionPixels ); - - // render pink quad - - let uniforms = material1a.uniforms; - uniforms[ 'scale' ].value = scale; - uniforms[ 'screenPosition' ].value = positionScreen; - - renderer.renderBufferDirect( camera, null, geometry, material1a, mesh1, null ); - - // copy result to occlusionMap - - renderer.copyFramebufferToTexture( occlusionMap, screenPositionPixels ); - - // restore graphics - - uniforms = material1b.uniforms; - uniforms[ 'scale' ].value = scale; - uniforms[ 'screenPosition' ].value = positionScreen; - - renderer.renderBufferDirect( camera, null, geometry, material1b, mesh1, null ); - - // render elements - - const vecX = - positionScreen.x * 2; - const vecY = - positionScreen.y * 2; - - for ( let i = 0, l = elements.length; i < l; i ++ ) { - - const element = elements[ i ]; - - const uniforms = material2.uniforms; - - uniforms[ 'color' ].value.copy( element.color ); - uniforms[ 'map' ].value = element.texture; - uniforms[ 'screenPosition' ].value.x = positionScreen.x + vecX * element.distance; - uniforms[ 'screenPosition' ].value.y = positionScreen.y + vecY * element.distance; - - size = element.size / viewport.w; - const invAspect = viewport.w / viewport.z; - - uniforms[ 'scale' ].value.set( size * invAspect, size ); - - material2.uniformsNeedUpdate = true; - - renderer.renderBufferDirect( camera, null, geometry, material2, mesh2, null ); - - } - - } - - }; - - this.dispose = function () { - - material1a.dispose(); - material1b.dispose(); - material2.dispose(); - - tempMap.dispose(); - occlusionMap.dispose(); - - for ( let i = 0, l = elements.length; i < l; i ++ ) { - - elements[ i ].texture.dispose(); - - } - - }; - - } - -} - -// - -class LensflareElement { - - constructor( texture, size = 1, distance = 0, color = new Color( 0xffffff ) ) { - - this.texture = texture; - this.size = size; - this.distance = distance; - this.color = color; - - } - -} - -LensflareElement.Shader = { - - name: 'LensflareElementShader', - - uniforms: { - - 'map': { value: null }, - 'occlusionMap': { value: null }, - 'color': { value: null }, - 'scale': { value: null }, - 'screenPosition': { value: null } - - }, - - vertexShader: /* glsl */` - - precision highp float; - - uniform vec3 screenPosition; - uniform vec2 scale; - - uniform sampler2D occlusionMap; - - attribute vec3 position; - attribute vec2 uv; - - varying vec2 vUV; - varying float vVisibility; - - void main() { - - vUV = uv; - - vec2 pos = position.xy; - - vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ); - visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) ); - visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) ); - visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ); - visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) ); - visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ); - visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) ); - visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ); - visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) ); - - vVisibility = visibility.r / 9.0; - vVisibility *= 1.0 - visibility.g / 9.0; - vVisibility *= visibility.b / 9.0; - - gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - precision highp float; - - uniform sampler2D map; - uniform vec3 color; - - varying vec2 vUV; - varying float vVisibility; - - void main() { - - vec4 texture = texture2D( map, vUV ); - texture.a *= vVisibility; - gl_FragColor = texture; - gl_FragColor.rgb *= color; - - }` - -}; - -Lensflare.Geometry = ( function () { - - const geometry = new BufferGeometry(); - - const float32Array = new Float32Array( [ - - 1, - 1, 0, 0, 0, - 1, - 1, 0, 1, 0, - 1, 1, 0, 1, 1, - - 1, 1, 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 ) ); - - return geometry; - -} )(); - -export { Lensflare, LensflareElement }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/MarchingCubes.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/MarchingCubes.js deleted file mode 100644 index 52bcfc7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/MarchingCubes.js +++ /dev/null @@ -1,1176 +0,0 @@ -import { - BufferAttribute, - BufferGeometry, - Color, - DynamicDrawUsage, - Mesh, - Sphere, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Port of http://webglsamples.org/blob/blob.html - */ - -class MarchingCubes extends Mesh { - - constructor( resolution, material, enableUvs = false, enableColors = false, maxPolyCount = 10000 ) { - - const geometry = new BufferGeometry(); - - super( geometry, material ); - - this.isMarchingCubes = true; - - const scope = this; - - // temp buffers used in polygonize - - const vlist = new Float32Array( 12 * 3 ); - const nlist = new Float32Array( 12 * 3 ); - const clist = new Float32Array( 12 * 3 ); - - this.enableUvs = enableUvs; - this.enableColors = enableColors; - - // functions have to be object properties - // prototype functions kill performance - // (tested and it was 4x slower !!!) - - this.init = function ( resolution ) { - - this.resolution = resolution; - - // parameters - - this.isolation = 80.0; - - // size of field, 32 is pushing it in Javascript :) - - this.size = resolution; - this.size2 = this.size * this.size; - this.size3 = this.size2 * this.size; - this.halfsize = this.size / 2.0; - - // deltas - - this.delta = 2.0 / this.size; - this.yd = this.size; - this.zd = this.size2; - - this.field = new Float32Array( this.size3 ); - this.normal_cache = new Float32Array( this.size3 * 3 ); - this.palette = new Float32Array( this.size3 * 3 ); - - // - - this.count = 0; - - const maxVertexCount = maxPolyCount * 3; - - this.positionArray = new Float32Array( maxVertexCount * 3 ); - const positionAttribute = new BufferAttribute( this.positionArray, 3 ); - positionAttribute.setUsage( DynamicDrawUsage ); - geometry.setAttribute( 'position', positionAttribute ); - - this.normalArray = new Float32Array( maxVertexCount * 3 ); - const normalAttribute = new BufferAttribute( this.normalArray, 3 ); - normalAttribute.setUsage( DynamicDrawUsage ); - geometry.setAttribute( 'normal', normalAttribute ); - - if ( this.enableUvs ) { - - this.uvArray = new Float32Array( maxVertexCount * 2 ); - const uvAttribute = new BufferAttribute( this.uvArray, 2 ); - uvAttribute.setUsage( DynamicDrawUsage ); - geometry.setAttribute( 'uv', uvAttribute ); - - } - - if ( this.enableColors ) { - - this.colorArray = new Float32Array( maxVertexCount * 3 ); - const colorAttribute = new BufferAttribute( this.colorArray, 3 ); - colorAttribute.setUsage( DynamicDrawUsage ); - geometry.setAttribute( 'color', colorAttribute ); - - } - - geometry.boundingSphere = new Sphere( new Vector3(), 1 ); - - }; - - /////////////////////// - // Polygonization - /////////////////////// - - function lerp( a, b, t ) { - - return a + ( b - a ) * t; - - } - - function VIntX( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) { - - const mu = ( isol - valp1 ) / ( valp2 - valp1 ), - nc = scope.normal_cache; - - vlist[ offset + 0 ] = x + mu * scope.delta; - vlist[ offset + 1 ] = y; - vlist[ offset + 2 ] = z; - - nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q + 3 ], mu ); - nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q + 4 ], mu ); - nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q + 5 ], mu ); - - clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu ); - clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu ); - clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu ); - - } - - function VIntY( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) { - - const mu = ( isol - valp1 ) / ( valp2 - valp1 ), - nc = scope.normal_cache; - - vlist[ offset + 0 ] = x; - vlist[ offset + 1 ] = y + mu * scope.delta; - vlist[ offset + 2 ] = z; - - const q2 = q + scope.yd * 3; - - nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu ); - nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu ); - nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu ); - - clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu ); - clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu ); - clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu ); - - } - - function VIntZ( q, offset, isol, x, y, z, valp1, valp2, c_offset1, c_offset2 ) { - - const mu = ( isol - valp1 ) / ( valp2 - valp1 ), - nc = scope.normal_cache; - - vlist[ offset + 0 ] = x; - vlist[ offset + 1 ] = y; - vlist[ offset + 2 ] = z + mu * scope.delta; - - const q2 = q + scope.zd * 3; - - nlist[ offset + 0 ] = lerp( nc[ q + 0 ], nc[ q2 + 0 ], mu ); - nlist[ offset + 1 ] = lerp( nc[ q + 1 ], nc[ q2 + 1 ], mu ); - nlist[ offset + 2 ] = lerp( nc[ q + 2 ], nc[ q2 + 2 ], mu ); - - clist[ offset + 0 ] = lerp( scope.palette[ c_offset1 * 3 + 0 ], scope.palette[ c_offset2 * 3 + 0 ], mu ); - clist[ offset + 1 ] = lerp( scope.palette[ c_offset1 * 3 + 1 ], scope.palette[ c_offset2 * 3 + 1 ], mu ); - clist[ offset + 2 ] = lerp( scope.palette[ c_offset1 * 3 + 2 ], scope.palette[ c_offset2 * 3 + 2 ], mu ); - - } - - function compNorm( q ) { - - const q3 = q * 3; - - if ( scope.normal_cache[ q3 ] === 0.0 ) { - - scope.normal_cache[ q3 + 0 ] = scope.field[ q - 1 ] - scope.field[ q + 1 ]; - scope.normal_cache[ q3 + 1 ] = - scope.field[ q - scope.yd ] - scope.field[ q + scope.yd ]; - scope.normal_cache[ q3 + 2 ] = - scope.field[ q - scope.zd ] - scope.field[ q + scope.zd ]; - - } - - } - - // Returns total number of triangles. Fills triangles. - // (this is where most of time is spent - it's inner work of O(n3) loop ) - - function polygonize( fx, fy, fz, q, isol ) { - - // cache indices - const q1 = q + 1, - qy = q + scope.yd, - qz = q + scope.zd, - q1y = q1 + scope.yd, - q1z = q1 + scope.zd, - qyz = q + scope.yd + scope.zd, - q1yz = q1 + scope.yd + scope.zd; - - let cubeindex = 0; - const field0 = scope.field[ q ], - field1 = scope.field[ q1 ], - field2 = scope.field[ qy ], - field3 = scope.field[ q1y ], - field4 = scope.field[ qz ], - field5 = scope.field[ q1z ], - field6 = scope.field[ qyz ], - field7 = scope.field[ q1yz ]; - - if ( field0 < isol ) cubeindex |= 1; - if ( field1 < isol ) cubeindex |= 2; - if ( field2 < isol ) cubeindex |= 8; - if ( field3 < isol ) cubeindex |= 4; - if ( field4 < isol ) cubeindex |= 16; - if ( field5 < isol ) cubeindex |= 32; - if ( field6 < isol ) cubeindex |= 128; - if ( field7 < isol ) cubeindex |= 64; - - // if cube is entirely in/out of the surface - bail, nothing to draw - - const bits = edgeTable[ cubeindex ]; - if ( bits === 0 ) return 0; - - const d = scope.delta, - fx2 = fx + d, - fy2 = fy + d, - fz2 = fz + d; - - // top of the cube - - if ( bits & 1 ) { - - compNorm( q ); - compNorm( q1 ); - VIntX( q * 3, 0, isol, fx, fy, fz, field0, field1, q, q1 ); - - } - - if ( bits & 2 ) { - - compNorm( q1 ); - compNorm( q1y ); - VIntY( q1 * 3, 3, isol, fx2, fy, fz, field1, field3, q1, q1y ); - - } - - if ( bits & 4 ) { - - compNorm( qy ); - compNorm( q1y ); - VIntX( qy * 3, 6, isol, fx, fy2, fz, field2, field3, qy, q1y ); - - } - - if ( bits & 8 ) { - - compNorm( q ); - compNorm( qy ); - VIntY( q * 3, 9, isol, fx, fy, fz, field0, field2, q, qy ); - - } - - // bottom of the cube - - if ( bits & 16 ) { - - compNorm( qz ); - compNorm( q1z ); - VIntX( qz * 3, 12, isol, fx, fy, fz2, field4, field5, qz, q1z ); - - } - - if ( bits & 32 ) { - - compNorm( q1z ); - compNorm( q1yz ); - VIntY( - q1z * 3, - 15, - isol, - fx2, - fy, - fz2, - field5, - field7, - q1z, - q1yz - ); - - } - - if ( bits & 64 ) { - - compNorm( qyz ); - compNorm( q1yz ); - VIntX( - qyz * 3, - 18, - isol, - fx, - fy2, - fz2, - field6, - field7, - qyz, - q1yz - ); - - } - - if ( bits & 128 ) { - - compNorm( qz ); - compNorm( qyz ); - VIntY( qz * 3, 21, isol, fx, fy, fz2, field4, field6, qz, qyz ); - - } - - // vertical lines of the cube - if ( bits & 256 ) { - - compNorm( q ); - compNorm( qz ); - VIntZ( q * 3, 24, isol, fx, fy, fz, field0, field4, q, qz ); - - } - - if ( bits & 512 ) { - - compNorm( q1 ); - compNorm( q1z ); - VIntZ( q1 * 3, 27, isol, fx2, fy, fz, field1, field5, q1, q1z ); - - } - - if ( bits & 1024 ) { - - compNorm( q1y ); - compNorm( q1yz ); - VIntZ( - q1y * 3, - 30, - isol, - fx2, - fy2, - fz, - field3, - field7, - q1y, - q1yz - ); - - } - - if ( bits & 2048 ) { - - compNorm( qy ); - compNorm( qyz ); - VIntZ( qy * 3, 33, isol, fx, fy2, fz, field2, field6, qy, qyz ); - - } - - cubeindex <<= 4; // re-purpose cubeindex into an offset into triTable - - let o1, - o2, - o3, - numtris = 0, - i = 0; - - // here is where triangles are created - - while ( triTable[ cubeindex + i ] != - 1 ) { - - o1 = cubeindex + i; - o2 = o1 + 1; - o3 = o1 + 2; - - posnormtriv( - vlist, - nlist, - clist, - 3 * triTable[ o1 ], - 3 * triTable[ o2 ], - 3 * triTable[ o3 ] - ); - - i += 3; - numtris ++; - - } - - return numtris; - - } - - function posnormtriv( pos, norm, colors, o1, o2, o3 ) { - - const c = scope.count * 3; - - // positions - - scope.positionArray[ c + 0 ] = pos[ o1 ]; - scope.positionArray[ c + 1 ] = pos[ o1 + 1 ]; - scope.positionArray[ c + 2 ] = pos[ o1 + 2 ]; - - scope.positionArray[ c + 3 ] = pos[ o2 ]; - scope.positionArray[ c + 4 ] = pos[ o2 + 1 ]; - scope.positionArray[ c + 5 ] = pos[ o2 + 2 ]; - - scope.positionArray[ c + 6 ] = pos[ o3 ]; - scope.positionArray[ c + 7 ] = pos[ o3 + 1 ]; - scope.positionArray[ c + 8 ] = pos[ o3 + 2 ]; - - // normals - - if ( scope.material.flatShading === true ) { - - const nx = ( norm[ o1 + 0 ] + norm[ o2 + 0 ] + norm[ o3 + 0 ] ) / 3; - const ny = ( norm[ o1 + 1 ] + norm[ o2 + 1 ] + norm[ o3 + 1 ] ) / 3; - const nz = ( norm[ o1 + 2 ] + norm[ o2 + 2 ] + norm[ o3 + 2 ] ) / 3; - - scope.normalArray[ c + 0 ] = nx; - scope.normalArray[ c + 1 ] = ny; - scope.normalArray[ c + 2 ] = nz; - - scope.normalArray[ c + 3 ] = nx; - scope.normalArray[ c + 4 ] = ny; - scope.normalArray[ c + 5 ] = nz; - - scope.normalArray[ c + 6 ] = nx; - scope.normalArray[ c + 7 ] = ny; - scope.normalArray[ c + 8 ] = nz; - - } else { - - scope.normalArray[ c + 0 ] = norm[ o1 + 0 ]; - scope.normalArray[ c + 1 ] = norm[ o1 + 1 ]; - scope.normalArray[ c + 2 ] = norm[ o1 + 2 ]; - - scope.normalArray[ c + 3 ] = norm[ o2 + 0 ]; - scope.normalArray[ c + 4 ] = norm[ o2 + 1 ]; - scope.normalArray[ c + 5 ] = norm[ o2 + 2 ]; - - scope.normalArray[ c + 6 ] = norm[ o3 + 0 ]; - scope.normalArray[ c + 7 ] = norm[ o3 + 1 ]; - scope.normalArray[ c + 8 ] = norm[ o3 + 2 ]; - - } - - // uvs - - if ( scope.enableUvs ) { - - const d = scope.count * 2; - - scope.uvArray[ d + 0 ] = pos[ o1 + 0 ]; - scope.uvArray[ d + 1 ] = pos[ o1 + 2 ]; - - scope.uvArray[ d + 2 ] = pos[ o2 + 0 ]; - scope.uvArray[ d + 3 ] = pos[ o2 + 2 ]; - - scope.uvArray[ d + 4 ] = pos[ o3 + 0 ]; - scope.uvArray[ d + 5 ] = pos[ o3 + 2 ]; - - } - - // colors - - if ( scope.enableColors ) { - - scope.colorArray[ c + 0 ] = colors[ o1 + 0 ]; - scope.colorArray[ c + 1 ] = colors[ o1 + 1 ]; - scope.colorArray[ c + 2 ] = colors[ o1 + 2 ]; - - scope.colorArray[ c + 3 ] = colors[ o2 + 0 ]; - scope.colorArray[ c + 4 ] = colors[ o2 + 1 ]; - scope.colorArray[ c + 5 ] = colors[ o2 + 2 ]; - - scope.colorArray[ c + 6 ] = colors[ o3 + 0 ]; - scope.colorArray[ c + 7 ] = colors[ o3 + 1 ]; - scope.colorArray[ c + 8 ] = colors[ o3 + 2 ]; - - } - - scope.count += 3; - - } - - ///////////////////////////////////// - // Metaballs - ///////////////////////////////////// - - // Adds a reciprocal ball (nice and blobby) that, to be fast, fades to zero after - // a fixed distance, determined by strength and subtract. - - this.addBall = function ( ballx, bally, ballz, strength, subtract, colors ) { - - const sign = Math.sign( strength ); - strength = Math.abs( strength ); - const userDefineColor = ! ( colors === undefined || colors === null ); - let ballColor = new Color( ballx, bally, ballz ); - - if ( userDefineColor ) { - - try { - - ballColor = - colors instanceof Color - ? colors - : Array.isArray( colors ) - ? new Color( - Math.min( Math.abs( colors[ 0 ] ), 1 ), - Math.min( Math.abs( colors[ 1 ] ), 1 ), - Math.min( Math.abs( colors[ 2 ] ), 1 ) - ) - : new Color( colors ); - - } catch ( err ) { - - ballColor = new Color( ballx, bally, ballz ); - - } - - } - - // Let's solve the equation to find the radius: - // 1.0 / (0.000001 + radius^2) * strength - subtract = 0 - // strength / (radius^2) = subtract - // strength = subtract * radius^2 - // radius^2 = strength / subtract - // radius = sqrt(strength / subtract) - - const radius = this.size * Math.sqrt( strength / subtract ), - zs = ballz * this.size, - ys = bally * this.size, - xs = ballx * this.size; - - let min_z = Math.floor( zs - radius ); - if ( min_z < 1 ) min_z = 1; - let max_z = Math.floor( zs + radius ); - if ( max_z > this.size - 1 ) max_z = this.size - 1; - let min_y = Math.floor( ys - radius ); - if ( min_y < 1 ) min_y = 1; - let max_y = Math.floor( ys + radius ); - if ( max_y > this.size - 1 ) max_y = this.size - 1; - let min_x = Math.floor( xs - radius ); - if ( min_x < 1 ) min_x = 1; - let max_x = Math.floor( xs + radius ); - if ( max_x > this.size - 1 ) max_x = this.size - 1; - - // Don't polygonize in the outer layer because normals aren't - // well-defined there. - - let x, y, z, y_offset, z_offset, fx, fy, fz, fz2, fy2, val; - - for ( z = min_z; z < max_z; z ++ ) { - - z_offset = this.size2 * z; - fz = z / this.size - ballz; - fz2 = fz * fz; - - for ( y = min_y; y < max_y; y ++ ) { - - y_offset = z_offset + this.size * y; - fy = y / this.size - bally; - fy2 = fy * fy; - - for ( x = min_x; x < max_x; x ++ ) { - - fx = x / this.size - ballx; - val = strength / ( 0.000001 + fx * fx + fy2 + fz2 ) - subtract; - if ( val > 0.0 ) { - - this.field[ y_offset + x ] += val * sign; - - // optimization - // http://www.geisswerks.com/ryan/BLOBS/blobs.html - const ratio = - Math.sqrt( ( x - xs ) * ( x - xs ) + ( y - ys ) * ( y - ys ) + ( z - zs ) * ( z - zs ) ) / radius; - const contrib = - 1 - ratio * ratio * ratio * ( ratio * ( ratio * 6 - 15 ) + 10 ); - this.palette[ ( y_offset + x ) * 3 + 0 ] += ballColor.r * contrib; - this.palette[ ( y_offset + x ) * 3 + 1 ] += ballColor.g * contrib; - this.palette[ ( y_offset + x ) * 3 + 2 ] += ballColor.b * contrib; - - } - - } - - } - - } - - }; - - this.addPlaneX = function ( strength, subtract ) { - - // cache attribute lookups - const size = this.size, - yd = this.yd, - zd = this.zd, - field = this.field; - - let x, - y, - z, - xx, - val, - xdiv, - cxy, - dist = size * Math.sqrt( strength / subtract ); - - if ( dist > size ) dist = size; - - for ( x = 0; x < dist; x ++ ) { - - xdiv = x / size; - xx = xdiv * xdiv; - val = strength / ( 0.0001 + xx ) - subtract; - - if ( val > 0.0 ) { - - for ( y = 0; y < size; y ++ ) { - - cxy = x + y * yd; - - for ( z = 0; z < size; z ++ ) { - - field[ zd * z + cxy ] += val; - - } - - } - - } - - } - - }; - - this.addPlaneY = function ( strength, subtract ) { - - // cache attribute lookups - const size = this.size, - yd = this.yd, - zd = this.zd, - field = this.field; - - let x, - y, - z, - yy, - val, - ydiv, - cy, - cxy, - dist = size * Math.sqrt( strength / subtract ); - - if ( dist > size ) dist = size; - - for ( y = 0; y < dist; y ++ ) { - - ydiv = y / size; - yy = ydiv * ydiv; - val = strength / ( 0.0001 + yy ) - subtract; - - if ( val > 0.0 ) { - - cy = y * yd; - - for ( x = 0; x < size; x ++ ) { - - cxy = cy + x; - - for ( z = 0; z < size; z ++ ) field[ zd * z + cxy ] += val; - - } - - } - - } - - }; - - this.addPlaneZ = function ( strength, subtract ) { - - // cache attribute lookups - - const size = this.size, - yd = this.yd, - zd = this.zd, - field = this.field; - - let x, - y, - z, - zz, - val, - zdiv, - cz, - cyz, - dist = size * Math.sqrt( strength / subtract ); - - if ( dist > size ) dist = size; - - for ( z = 0; z < dist; z ++ ) { - - zdiv = z / size; - zz = zdiv * zdiv; - val = strength / ( 0.0001 + zz ) - subtract; - if ( val > 0.0 ) { - - cz = zd * z; - - for ( y = 0; y < size; y ++ ) { - - cyz = cz + y * yd; - - for ( x = 0; x < size; x ++ ) field[ cyz + x ] += val; - - } - - } - - } - - }; - - ///////////////////////////////////// - // Updates - ///////////////////////////////////// - - this.setCell = function ( x, y, z, value ) { - - const index = this.size2 * z + this.size * y + x; - this.field[ index ] = value; - - }; - - this.getCell = function ( x, y, z ) { - - const index = this.size2 * z + this.size * y + x; - return this.field[ index ]; - - }; - - this.blur = function ( intensity = 1 ) { - - const field = this.field; - const fieldCopy = field.slice(); - const size = this.size; - const size2 = this.size2; - for ( let x = 0; x < size; x ++ ) { - - for ( let y = 0; y < size; y ++ ) { - - for ( let z = 0; z < size; z ++ ) { - - const index = size2 * z + size * y + x; - let val = fieldCopy[ index ]; - let count = 1; - - for ( let x2 = - 1; x2 <= 1; x2 += 2 ) { - - const x3 = x2 + x; - if ( x3 < 0 || x3 >= size ) continue; - - for ( let y2 = - 1; y2 <= 1; y2 += 2 ) { - - const y3 = y2 + y; - if ( y3 < 0 || y3 >= size ) continue; - - for ( let z2 = - 1; z2 <= 1; z2 += 2 ) { - - const z3 = z2 + z; - if ( z3 < 0 || z3 >= size ) continue; - - const index2 = size2 * z3 + size * y3 + x3; - const val2 = fieldCopy[ index2 ]; - - count ++; - val += intensity * ( val2 - val ) / count; - - } - - } - - } - - field[ index ] = val; - - } - - } - - } - - }; - - this.reset = function () { - - // wipe the normal cache - - for ( let i = 0; i < this.size3; i ++ ) { - - this.normal_cache[ i * 3 ] = 0.0; - this.field[ i ] = 0.0; - this.palette[ i * 3 ] = this.palette[ i * 3 + 1 ] = this.palette[ - i * 3 + 2 - ] = 0.0; - - } - - }; - - this.update = function () { - - this.count = 0; - - // Triangulate. Yeah, this is slow. - - const smin2 = this.size - 2; - - for ( let z = 1; z < smin2; z ++ ) { - - const z_offset = this.size2 * z; - const fz = ( z - this.halfsize ) / this.halfsize; //+ 1 - - for ( let y = 1; y < smin2; y ++ ) { - - const y_offset = z_offset + this.size * y; - const fy = ( y - this.halfsize ) / this.halfsize; //+ 1 - - for ( let x = 1; x < smin2; x ++ ) { - - const fx = ( x - this.halfsize ) / this.halfsize; //+ 1 - const q = y_offset + x; - - polygonize( fx, fy, fz, q, this.isolation ); - - } - - } - - } - - // set the draw range to only the processed triangles - - this.geometry.setDrawRange( 0, this.count ); - - // update geometry data - - geometry.getAttribute( 'position' ).needsUpdate = true; - geometry.getAttribute( 'normal' ).needsUpdate = true; - - if ( this.enableUvs ) geometry.getAttribute( 'uv' ).needsUpdate = true; - if ( this.enableColors ) geometry.getAttribute( 'color' ).needsUpdate = true; - - // safety check - - if ( this.count / 3 > maxPolyCount ) console.warn( 'THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.' ); - - }; - - this.init( resolution ); - - } - -} - -///////////////////////////////////// -// Marching cubes lookup tables -///////////////////////////////////// - -// These tables are straight from Paul Bourke's page: -// http://paulbourke.net/geometry/polygonise/ -// who in turn got them from Cory Gene Bloyd. - -const edgeTable = new Int32Array( [ - 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, - 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, - 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, - 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, - 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, - 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, - 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, - 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, - 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, - 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, - 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, - 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, - 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, - 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, - 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, - 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, - 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, - 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, - 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, - 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, - 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, - 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, - 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, - 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, - 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, - 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, - 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, - 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, - 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, - 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, - 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, - 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 ] ); - -const triTable = new Int32Array( [ - - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 8, 3, 9, 8, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 2, 10, 0, 2, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 8, 3, 2, 10, 8, 10, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 11, 2, 8, 11, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 9, 0, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 11, 2, 1, 9, 11, 9, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 10, 1, 11, 10, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 10, 1, 0, 8, 10, 8, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 9, 0, 3, 11, 9, 11, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 3, 0, 7, 3, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 1, 9, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 1, 9, 4, 7, 1, 7, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 4, 7, 3, 0, 4, 1, 2, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 2, 10, 9, 0, 2, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1, - 8, 4, 7, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 4, 7, 11, 2, 4, 2, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 0, 1, 8, 4, 7, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, - 1, - 1, - 1, - 1, - 3, 10, 1, 3, 11, 10, 7, 8, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, - 1, - 1, - 1, - 1, - 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1, - 4, 7, 11, 4, 11, 9, 9, 11, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 5, 4, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 5, 4, 1, 5, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 5, 4, 8, 3, 5, 3, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 0, 8, 1, 2, 10, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 2, 10, 5, 4, 2, 4, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, - 1, - 1, - 1, - 1, - 9, 5, 4, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 11, 2, 0, 8, 11, 4, 9, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 5, 4, 0, 1, 5, 2, 3, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, - 1, - 1, - 1, - 1, - 10, 3, 11, 10, 1, 3, 9, 5, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, - 1, - 1, - 1, - 1, - 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, - 1, - 1, - 1, - 1, - 5, 4, 8, 5, 8, 10, 10, 8, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 7, 8, 5, 7, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 3, 0, 9, 5, 3, 5, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 7, 8, 0, 1, 7, 1, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 7, 8, 9, 5, 7, 10, 1, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, - 1, - 1, - 1, - 1, - 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, - 1, - 1, - 1, - 1, - 2, 10, 5, 2, 5, 3, 3, 5, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 9, 5, 7, 8, 9, 3, 11, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1, - 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, - 1, - 1, - 1, - 1, - 11, 2, 1, 11, 1, 7, 7, 1, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, - 1, - 1, - 1, - 1, - 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, - 1, - 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, - 1, - 11, 10, 5, 7, 11, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 0, 1, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 8, 3, 1, 9, 8, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 6, 5, 2, 6, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 6, 5, 1, 2, 6, 3, 0, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 6, 5, 9, 0, 6, 0, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, - 1, - 1, - 1, - 1, - 2, 3, 11, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 0, 8, 11, 2, 0, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 1, 9, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, - 1, - 1, - 1, - 1, - 6, 3, 11, 6, 5, 3, 5, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1, - 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, - 1, - 1, - 1, - 1, - 6, 5, 9, 6, 9, 11, 11, 9, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 10, 6, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 3, 0, 4, 7, 3, 6, 5, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 9, 0, 5, 10, 6, 8, 4, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, - 1, - 1, - 1, - 1, - 6, 1, 2, 6, 5, 1, 4, 7, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, - 1, - 1, - 1, - 1, - 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, - 1, - 1, - 1, - 1, - 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, - 1, - 3, 11, 2, 7, 8, 4, 10, 6, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, - 1, - 1, - 1, - 1, - 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, - 1, - 1, - 1, - 1, - 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, - 1, - 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, - 1, - 1, - 1, - 1, - 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, - 1, - 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, - 1, - 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, - 1, - 1, - 1, - 1, - 10, 4, 9, 6, 4, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 10, 6, 4, 9, 10, 0, 8, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 0, 1, 10, 6, 0, 6, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1, - 1, 4, 9, 1, 2, 4, 2, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, - 1, - 1, - 1, - 1, - 0, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 3, 2, 8, 2, 4, 4, 2, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 4, 9, 10, 6, 4, 11, 2, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, - 1, - 1, - 1, - 1, - 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, - 1, - 1, - 1, - 1, - 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, - 1, - 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, - 1, - 1, - 1, - 1, - 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, - 1, - 3, 11, 6, 3, 6, 0, 0, 6, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 6, 4, 8, 11, 6, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 10, 6, 7, 8, 10, 8, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, - 1, - 1, - 1, - 1, - 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, - 1, - 1, - 1, - 1, - 10, 6, 7, 10, 7, 1, 1, 7, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1, - 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, - 1, - 7, 8, 0, 7, 0, 6, 6, 0, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 3, 2, 6, 7, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, - 1, - 1, - 1, - 1, - 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, - 1, - 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, - 1, - 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, - 1, - 1, - 1, - 1, - 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, - 1, - 0, 9, 1, 11, 6, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, - 1, - 1, - 1, - 1, - 7, 11, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 0, 8, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 1, 9, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 1, 9, 8, 3, 1, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 1, 2, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, 3, 0, 8, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 9, 0, 2, 10, 9, 6, 11, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, - 1, - 1, - 1, - 1, - 7, 2, 3, 6, 2, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 7, 0, 8, 7, 6, 0, 6, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 7, 6, 2, 3, 7, 0, 1, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, - 1, - 1, - 1, - 1, - 10, 7, 6, 10, 1, 7, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, - 1, - 1, - 1, - 1, - 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, - 1, - 1, - 1, - 1, - 7, 6, 10, 7, 10, 8, 8, 10, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 6, 8, 4, 11, 8, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 6, 11, 3, 0, 6, 0, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 6, 11, 8, 4, 6, 9, 0, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, - 1, - 1, - 1, - 1, - 6, 8, 4, 6, 11, 8, 2, 10, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, - 1, - 1, - 1, - 1, - 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, - 1, - 1, - 1, - 1, - 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, - 1, - 8, 2, 3, 8, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 4, 2, 4, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, - 1, - 1, - 1, - 1, - 1, 9, 4, 1, 4, 2, 2, 4, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, - 1, - 1, - 1, - 1, - 10, 1, 0, 10, 0, 6, 6, 0, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, - 1, - 10, 9, 4, 6, 10, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 9, 5, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, 4, 9, 5, 11, 7, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 0, 1, 5, 4, 0, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, - 1, - 1, - 1, - 1, - 9, 5, 4, 10, 1, 2, 7, 6, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, - 1, - 1, - 1, - 1, - 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, - 1, - 1, - 1, - 1, - 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, - 1, - 7, 2, 3, 7, 6, 2, 5, 4, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, - 1, - 1, - 1, - 1, - 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, - 1, - 1, - 1, - 1, - 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, - 1, - 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, - 1, - 1, - 1, - 1, - 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, - 1, - 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, - 1, - 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, - 1, - 1, - 1, - 1, - 6, 9, 5, 6, 11, 9, 11, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, - 1, - 1, - 1, - 1, - 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, - 1, - 1, - 1, - 1, - 6, 11, 3, 6, 3, 5, 5, 3, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, - 1, - 1, - 1, - 1, - 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, - 1, - 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, - 1, - 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, - 1, - 1, - 1, - 1, - 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, - 1, - 1, - 1, - 1, - 9, 5, 6, 9, 6, 0, 0, 6, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, - 1, - 1, 5, 6, 2, 1, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, - 1, - 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, - 1, - 1, - 1, - 1, - 0, 3, 8, 5, 6, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 5, 6, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 5, 10, 7, 5, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 5, 10, 11, 7, 5, 8, 3, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 11, 7, 5, 10, 11, 1, 9, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, - 1, - 1, - 1, - 1, - 11, 1, 2, 11, 7, 1, 7, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, - 1, - 1, - 1, - 1, - 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, - 1, - 1, - 1, - 1, - 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, - 1, - 2, 5, 10, 2, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, - 1, - 1, - 1, - 1, - 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, - 1, - 1, - 1, - 1, - 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, - 1, - 1, 3, 5, 3, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 7, 0, 7, 1, 1, 7, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 0, 3, 9, 3, 5, 5, 3, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 8, 7, 5, 9, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 8, 4, 5, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, - 1, - 1, - 1, - 1, - 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, - 1, - 1, - 1, - 1, - 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, - 1, - 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, - 1, - 1, - 1, - 1, - 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, - 1, - 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, - 1, - 9, 4, 5, 2, 11, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, - 1, - 1, - 1, - 1, - 5, 10, 2, 5, 2, 4, 4, 2, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, - 1, - 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, - 1, - 1, - 1, - 1, - 8, 4, 5, 8, 5, 3, 3, 5, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 4, 5, 1, 0, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, - 1, - 1, - 1, - 1, - 9, 4, 5, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 11, 7, 4, 9, 11, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, - 1, - 1, - 1, - 1, - 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, - 1, - 1, - 1, - 1, - 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, - 1, - 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, - 1, - 1, - 1, - 1, - 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, - 1, - 11, 7, 4, 11, 4, 2, 2, 4, 0, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, - 1, - 1, - 1, - 1, - 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, - 1, - 1, - 1, - 1, - 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, - 1, - 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, - 1, - 1, 10, 2, 8, 7, 4, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 9, 1, 4, 1, 7, 7, 1, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, - 1, - 1, - 1, - 1, - 4, 0, 3, 7, 4, 3, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 4, 8, 7, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 10, 8, 10, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 0, 9, 3, 9, 11, 11, 9, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 1, 10, 0, 10, 8, 8, 10, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 1, 10, 11, 3, 10, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 2, 11, 1, 11, 9, 9, 11, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, - 1, - 1, - 1, - 1, - 0, 2, 11, 8, 0, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 3, 2, 11, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 3, 8, 2, 8, 10, 10, 8, 9, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 9, 10, 2, 0, 9, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, - 1, - 1, - 1, - 1, - 1, 10, 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, 3, 8, 9, 1, 8, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 9, 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 0, 3, 8, - 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, - 1, - 1 ] ); - -export { MarchingCubes, edgeTable, triTable }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Reflector.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Reflector.js deleted file mode 100644 index 65402e3..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Reflector.js +++ /dev/null @@ -1,264 +0,0 @@ -import { - Color, - Matrix4, - Mesh, - PerspectiveCamera, - Plane, - ShaderMaterial, - UniformsUtils, - Vector3, - Vector4, - WebGLRenderTarget, - HalfFloatType -} from '/static/javascript/three/build/three.module.js'; - -class Reflector extends Mesh { - - constructor( geometry, options = {} ) { - - super( geometry ); - - this.isReflector = true; - - this.type = 'Reflector'; - this.camera = new PerspectiveCamera(); - - const scope = this; - - const color = ( options.color !== undefined ) ? new Color( options.color ) : new Color( 0x7F7F7F ); - const textureWidth = options.textureWidth || 512; - const textureHeight = options.textureHeight || 512; - const clipBias = options.clipBias || 0; - const shader = options.shader || Reflector.ReflectorShader; - const multisample = ( options.multisample !== undefined ) ? options.multisample : 4; - - // - - const reflectorPlane = new Plane(); - const normal = new Vector3(); - const reflectorWorldPosition = new Vector3(); - const cameraWorldPosition = new Vector3(); - const rotationMatrix = new Matrix4(); - const lookAtPosition = new Vector3( 0, 0, - 1 ); - const clipPlane = new Vector4(); - - const view = new Vector3(); - const target = new Vector3(); - const q = new Vector4(); - - const textureMatrix = new Matrix4(); - const virtualCamera = this.camera; - - const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, { samples: multisample, type: HalfFloatType } ); - - const material = new ShaderMaterial( { - name: ( shader.name !== undefined ) ? shader.name : 'unspecified', - uniforms: UniformsUtils.clone( shader.uniforms ), - fragmentShader: shader.fragmentShader, - vertexShader: shader.vertexShader - } ); - - material.uniforms[ 'tDiffuse' ].value = renderTarget.texture; - material.uniforms[ 'color' ].value = color; - material.uniforms[ 'textureMatrix' ].value = textureMatrix; - - this.material = material; - - this.onBeforeRender = function ( renderer, scene, camera ) { - - reflectorWorldPosition.setFromMatrixPosition( scope.matrixWorld ); - cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld ); - - rotationMatrix.extractRotation( scope.matrixWorld ); - - normal.set( 0, 0, 1 ); - normal.applyMatrix4( rotationMatrix ); - - view.subVectors( reflectorWorldPosition, cameraWorldPosition ); - - // Avoid rendering when reflector is facing away - - if ( view.dot( normal ) > 0 ) return; - - view.reflect( normal ).negate(); - view.add( reflectorWorldPosition ); - - rotationMatrix.extractRotation( camera.matrixWorld ); - - lookAtPosition.set( 0, 0, - 1 ); - lookAtPosition.applyMatrix4( rotationMatrix ); - lookAtPosition.add( cameraWorldPosition ); - - target.subVectors( reflectorWorldPosition, lookAtPosition ); - target.reflect( normal ).negate(); - target.add( reflectorWorldPosition ); - - virtualCamera.position.copy( view ); - virtualCamera.up.set( 0, 1, 0 ); - virtualCamera.up.applyMatrix4( rotationMatrix ); - virtualCamera.up.reflect( normal ); - virtualCamera.lookAt( target ); - - virtualCamera.far = camera.far; // Used in WebGLBackground - - virtualCamera.updateMatrixWorld(); - virtualCamera.projectionMatrix.copy( camera.projectionMatrix ); - - // Update the texture matrix - textureMatrix.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 - ); - textureMatrix.multiply( virtualCamera.projectionMatrix ); - textureMatrix.multiply( virtualCamera.matrixWorldInverse ); - textureMatrix.multiply( scope.matrixWorld ); - - // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html - // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf - reflectorPlane.setFromNormalAndCoplanarPoint( normal, reflectorWorldPosition ); - reflectorPlane.applyMatrix4( virtualCamera.matrixWorldInverse ); - - clipPlane.set( reflectorPlane.normal.x, reflectorPlane.normal.y, reflectorPlane.normal.z, reflectorPlane.constant ); - - const projectionMatrix = virtualCamera.projectionMatrix; - - q.x = ( Math.sign( clipPlane.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ]; - q.y = ( Math.sign( clipPlane.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ]; - q.z = - 1.0; - q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ]; - - // Calculate the scaled plane vector - clipPlane.multiplyScalar( 2.0 / clipPlane.dot( q ) ); - - // Replacing the third row of the projection matrix - projectionMatrix.elements[ 2 ] = clipPlane.x; - projectionMatrix.elements[ 6 ] = clipPlane.y; - projectionMatrix.elements[ 10 ] = clipPlane.z + 1.0 - clipBias; - projectionMatrix.elements[ 14 ] = clipPlane.w; - - // Render - scope.visible = false; - - const currentRenderTarget = renderer.getRenderTarget(); - - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - - renderer.xr.enabled = false; // Avoid camera modification - renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows - - renderer.setRenderTarget( renderTarget ); - - renderer.state.buffers.depth.setMask( true ); // make sure the depth buffer is writable so it can be properly cleared, see #18897 - - if ( renderer.autoClear === false ) renderer.clear(); - renderer.render( scene, virtualCamera ); - - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - - renderer.setRenderTarget( currentRenderTarget ); - - // Restore viewport - - const viewport = camera.viewport; - - if ( viewport !== undefined ) { - - renderer.state.viewport( viewport ); - - } - - scope.visible = true; - - }; - - this.getRenderTarget = function () { - - return renderTarget; - - }; - - this.dispose = function () { - - renderTarget.dispose(); - scope.material.dispose(); - - }; - - } - -} - -Reflector.ReflectorShader = { - - name: 'ReflectorShader', - - uniforms: { - - 'color': { - value: null - }, - - 'tDiffuse': { - value: null - }, - - 'textureMatrix': { - value: null - } - - }, - - vertexShader: /* glsl */` - uniform mat4 textureMatrix; - varying vec4 vUv; - - #include - #include - - void main() { - - vUv = textureMatrix * vec4( position, 1.0 ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - #include - - }`, - - fragmentShader: /* glsl */` - uniform vec3 color; - uniform sampler2D tDiffuse; - varying vec4 vUv; - - #include - - float blendOverlay( float base, float blend ) { - - return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); - - } - - vec3 blendOverlay( vec3 base, vec3 blend ) { - - return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); - - } - - void main() { - - #include - - vec4 base = texture2DProj( tDiffuse, vUv ); - gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); - - #include - #include - - }` -}; - -export { Reflector }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ReflectorForSSRPass.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ReflectorForSSRPass.js deleted file mode 100644 index 39ab58e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ReflectorForSSRPass.js +++ /dev/null @@ -1,352 +0,0 @@ -import { - Color, - Matrix4, - Mesh, - PerspectiveCamera, - ShaderMaterial, - UniformsUtils, - Vector2, - Vector3, - WebGLRenderTarget, - DepthTexture, - UnsignedShortType, - NearestFilter, - Plane, - HalfFloatType -} from '/static/javascript/three/build/three.module.js'; - -class ReflectorForSSRPass extends Mesh { - - constructor( geometry, options = {} ) { - - super( geometry ); - - this.isReflectorForSSRPass = true; - - this.type = 'ReflectorForSSRPass'; - - const scope = this; - - const color = ( options.color !== undefined ) ? new Color( options.color ) : new Color( 0x7F7F7F ); - const textureWidth = options.textureWidth || 512; - const textureHeight = options.textureHeight || 512; - const clipBias = options.clipBias || 0; - const shader = options.shader || ReflectorForSSRPass.ReflectorShader; - const useDepthTexture = options.useDepthTexture === true; - const yAxis = new Vector3( 0, 1, 0 ); - const vecTemp0 = new Vector3(); - const vecTemp1 = new Vector3(); - - // - - scope.needsUpdate = false; - scope.maxDistance = ReflectorForSSRPass.ReflectorShader.uniforms.maxDistance.value; - scope.opacity = ReflectorForSSRPass.ReflectorShader.uniforms.opacity.value; - scope.color = color; - scope.resolution = options.resolution || new Vector2( window.innerWidth, window.innerHeight ); - - - scope._distanceAttenuation = ReflectorForSSRPass.ReflectorShader.defines.DISTANCE_ATTENUATION; - Object.defineProperty( scope, 'distanceAttenuation', { - get() { - - return scope._distanceAttenuation; - - }, - set( val ) { - - if ( scope._distanceAttenuation === val ) return; - scope._distanceAttenuation = val; - scope.material.defines.DISTANCE_ATTENUATION = val; - scope.material.needsUpdate = true; - - } - } ); - - scope._fresnel = ReflectorForSSRPass.ReflectorShader.defines.FRESNEL; - Object.defineProperty( scope, 'fresnel', { - get() { - - return scope._fresnel; - - }, - set( val ) { - - if ( scope._fresnel === val ) return; - scope._fresnel = val; - scope.material.defines.FRESNEL = val; - scope.material.needsUpdate = true; - - } - } ); - - const normal = new Vector3(); - const reflectorWorldPosition = new Vector3(); - const cameraWorldPosition = new Vector3(); - const rotationMatrix = new Matrix4(); - const lookAtPosition = new Vector3( 0, 0, - 1 ); - - const view = new Vector3(); - const target = new Vector3(); - - const textureMatrix = new Matrix4(); - const virtualCamera = new PerspectiveCamera(); - - let depthTexture; - - if ( useDepthTexture ) { - - depthTexture = new DepthTexture(); - depthTexture.type = UnsignedShortType; - depthTexture.minFilter = NearestFilter; - depthTexture.magFilter = NearestFilter; - - } - - const parameters = { - depthTexture: useDepthTexture ? depthTexture : null, - type: HalfFloatType - }; - - const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters ); - - const material = new ShaderMaterial( { - name: ( shader.name !== undefined ) ? shader.name : 'unspecified', - transparent: useDepthTexture, - defines: Object.assign( {}, ReflectorForSSRPass.ReflectorShader.defines, { - useDepthTexture - } ), - uniforms: UniformsUtils.clone( shader.uniforms ), - fragmentShader: shader.fragmentShader, - vertexShader: shader.vertexShader - } ); - - material.uniforms[ 'tDiffuse' ].value = renderTarget.texture; - material.uniforms[ 'color' ].value = scope.color; - material.uniforms[ 'textureMatrix' ].value = textureMatrix; - if ( useDepthTexture ) { - - material.uniforms[ 'tDepth' ].value = renderTarget.depthTexture; - - } - - this.material = material; - - const globalPlane = new Plane( new Vector3( 0, 1, 0 ), clipBias ); - const globalPlanes = [ globalPlane ]; - - this.doRender = function ( renderer, scene, camera ) { - - material.uniforms[ 'maxDistance' ].value = scope.maxDistance; - material.uniforms[ 'color' ].value = scope.color; - material.uniforms[ 'opacity' ].value = scope.opacity; - - vecTemp0.copy( camera.position ).normalize(); - vecTemp1.copy( vecTemp0 ).reflect( yAxis ); - material.uniforms[ 'fresnelCoe' ].value = ( vecTemp0.dot( vecTemp1 ) + 1. ) / 2.; // TODO: Also need to use glsl viewPosition and viewNormal per pixel. - - reflectorWorldPosition.setFromMatrixPosition( scope.matrixWorld ); - cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld ); - - rotationMatrix.extractRotation( scope.matrixWorld ); - - normal.set( 0, 0, 1 ); - normal.applyMatrix4( rotationMatrix ); - - view.subVectors( reflectorWorldPosition, cameraWorldPosition ); - - // Avoid rendering when reflector is facing away - - if ( view.dot( normal ) > 0 ) return; - - view.reflect( normal ).negate(); - view.add( reflectorWorldPosition ); - - rotationMatrix.extractRotation( camera.matrixWorld ); - - lookAtPosition.set( 0, 0, - 1 ); - lookAtPosition.applyMatrix4( rotationMatrix ); - lookAtPosition.add( cameraWorldPosition ); - - target.subVectors( reflectorWorldPosition, lookAtPosition ); - target.reflect( normal ).negate(); - target.add( reflectorWorldPosition ); - - virtualCamera.position.copy( view ); - virtualCamera.up.set( 0, 1, 0 ); - virtualCamera.up.applyMatrix4( rotationMatrix ); - virtualCamera.up.reflect( normal ); - virtualCamera.lookAt( target ); - - virtualCamera.far = camera.far; // Used in WebGLBackground - - virtualCamera.updateMatrixWorld(); - virtualCamera.projectionMatrix.copy( camera.projectionMatrix ); - - material.uniforms[ 'virtualCameraNear' ].value = camera.near; - material.uniforms[ 'virtualCameraFar' ].value = camera.far; - material.uniforms[ 'virtualCameraMatrixWorld' ].value = virtualCamera.matrixWorld; - material.uniforms[ 'virtualCameraProjectionMatrix' ].value = camera.projectionMatrix; - material.uniforms[ 'virtualCameraProjectionMatrixInverse' ].value = camera.projectionMatrixInverse; - material.uniforms[ 'resolution' ].value = scope.resolution; - - // Update the texture matrix - textureMatrix.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 - ); - textureMatrix.multiply( virtualCamera.projectionMatrix ); - textureMatrix.multiply( virtualCamera.matrixWorldInverse ); - textureMatrix.multiply( scope.matrixWorld ); - - // scope.visible = false; - - const currentRenderTarget = renderer.getRenderTarget(); - - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - const currentClippingPlanes = renderer.clippingPlanes; - - renderer.xr.enabled = false; // Avoid camera modification - renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows - renderer.clippingPlanes = globalPlanes; - - renderer.setRenderTarget( renderTarget ); - - renderer.state.buffers.depth.setMask( true ); // make sure the depth buffer is writable so it can be properly cleared, see #18897 - - if ( renderer.autoClear === false ) renderer.clear(); - renderer.render( scene, virtualCamera ); - - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - renderer.clippingPlanes = currentClippingPlanes; - - renderer.setRenderTarget( currentRenderTarget ); - - // Restore viewport - - const viewport = camera.viewport; - - if ( viewport !== undefined ) { - - renderer.state.viewport( viewport ); - - } - - // scope.visible = true; - - }; - - this.getRenderTarget = function () { - - return renderTarget; - - }; - - } - -} - -ReflectorForSSRPass.ReflectorShader = { - - name: 'ReflectorShader', - - defines: { - DISTANCE_ATTENUATION: true, - FRESNEL: true, - }, - - uniforms: { - - color: { value: null }, - tDiffuse: { value: null }, - tDepth: { value: null }, - textureMatrix: { value: new Matrix4() }, - maxDistance: { value: 180 }, - opacity: { value: 0.5 }, - fresnelCoe: { value: null }, - virtualCameraNear: { value: null }, - virtualCameraFar: { value: null }, - virtualCameraProjectionMatrix: { value: new Matrix4() }, - virtualCameraMatrixWorld: { value: new Matrix4() }, - virtualCameraProjectionMatrixInverse: { value: new Matrix4() }, - resolution: { value: new Vector2() }, - - }, - - vertexShader: /* glsl */` - uniform mat4 textureMatrix; - varying vec4 vUv; - - void main() { - - vUv = textureMatrix * vec4( position, 1.0 ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - uniform vec3 color; - uniform sampler2D tDiffuse; - uniform sampler2D tDepth; - uniform float maxDistance; - uniform float opacity; - uniform float fresnelCoe; - uniform float virtualCameraNear; - uniform float virtualCameraFar; - uniform mat4 virtualCameraProjectionMatrix; - uniform mat4 virtualCameraProjectionMatrixInverse; - uniform mat4 virtualCameraMatrixWorld; - uniform vec2 resolution; - varying vec4 vUv; - #include - float blendOverlay( float base, float blend ) { - return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); - } - vec3 blendOverlay( vec3 base, vec3 blend ) { - return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); - } - float getDepth( const in vec2 uv ) { - return texture2D( tDepth, uv ).x; - } - float getViewZ( const in float depth ) { - return perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar ); - } - vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) { - vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc - clipPosition *= clipW; //clip - return ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view - } - void main() { - vec4 base = texture2DProj( tDiffuse, vUv ); - #ifdef useDepthTexture - vec2 uv=(gl_FragCoord.xy-.5)/resolution.xy; - uv.x=1.-uv.x; - float depth = texture2DProj( tDepth, vUv ).r; - float viewZ = getViewZ( depth ); - float clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3]; - vec3 viewPosition=getViewPosition( uv, depth, clipW ); - vec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz; - if(worldPosition.y>maxDistance) discard; - float op=opacity; - #ifdef DISTANCE_ATTENUATION - float ratio=1.-(worldPosition.y/maxDistance); - float attenuation=ratio*ratio; - op=opacity*attenuation; - #endif - #ifdef FRESNEL - op*=fresnelCoe; - #endif - gl_FragColor = vec4( blendOverlay( base.rgb, color ), op ); - #else - gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); - #endif - } - `, -}; - -export { ReflectorForSSRPass }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Refractor.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Refractor.js deleted file mode 100644 index ee1dff8..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Refractor.js +++ /dev/null @@ -1,327 +0,0 @@ -import { - Color, - Matrix4, - Mesh, - PerspectiveCamera, - Plane, - Quaternion, - ShaderMaterial, - UniformsUtils, - Vector3, - Vector4, - WebGLRenderTarget, - HalfFloatType -} from '/static/javascript/three/build/three.module.js'; - -class Refractor extends Mesh { - - constructor( geometry, options = {} ) { - - super( geometry ); - - this.isRefractor = true; - - this.type = 'Refractor'; - this.camera = new PerspectiveCamera(); - - const scope = this; - - const color = ( options.color !== undefined ) ? new Color( options.color ) : new Color( 0x7F7F7F ); - const textureWidth = options.textureWidth || 512; - const textureHeight = options.textureHeight || 512; - const clipBias = options.clipBias || 0; - const shader = options.shader || Refractor.RefractorShader; - const multisample = ( options.multisample !== undefined ) ? options.multisample : 4; - - // - - const virtualCamera = this.camera; - virtualCamera.matrixAutoUpdate = false; - virtualCamera.userData.refractor = true; - - // - - const refractorPlane = new Plane(); - const textureMatrix = new Matrix4(); - - // render target - - const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, { samples: multisample, type: HalfFloatType } ); - - // material - - this.material = new ShaderMaterial( { - name: ( shader.name !== undefined ) ? shader.name : 'unspecified', - uniforms: UniformsUtils.clone( shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - transparent: true // ensures, refractors are drawn from farthest to closest - } ); - - this.material.uniforms[ 'color' ].value = color; - this.material.uniforms[ 'tDiffuse' ].value = renderTarget.texture; - this.material.uniforms[ 'textureMatrix' ].value = textureMatrix; - - // functions - - const visible = ( function () { - - const refractorWorldPosition = new Vector3(); - const cameraWorldPosition = new Vector3(); - const rotationMatrix = new Matrix4(); - - const view = new Vector3(); - const normal = new Vector3(); - - return function visible( camera ) { - - refractorWorldPosition.setFromMatrixPosition( scope.matrixWorld ); - cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld ); - - view.subVectors( refractorWorldPosition, cameraWorldPosition ); - - rotationMatrix.extractRotation( scope.matrixWorld ); - - normal.set( 0, 0, 1 ); - normal.applyMatrix4( rotationMatrix ); - - return view.dot( normal ) < 0; - - }; - - } )(); - - const updateRefractorPlane = ( function () { - - const normal = new Vector3(); - const position = new Vector3(); - const quaternion = new Quaternion(); - const scale = new Vector3(); - - return function updateRefractorPlane() { - - scope.matrixWorld.decompose( position, quaternion, scale ); - normal.set( 0, 0, 1 ).applyQuaternion( quaternion ).normalize(); - - // flip the normal because we want to cull everything above the plane - - normal.negate(); - - refractorPlane.setFromNormalAndCoplanarPoint( normal, position ); - - }; - - } )(); - - const updateVirtualCamera = ( function () { - - const clipPlane = new Plane(); - const clipVector = new Vector4(); - const q = new Vector4(); - - return function updateVirtualCamera( camera ) { - - virtualCamera.matrixWorld.copy( camera.matrixWorld ); - virtualCamera.matrixWorldInverse.copy( virtualCamera.matrixWorld ).invert(); - virtualCamera.projectionMatrix.copy( camera.projectionMatrix ); - virtualCamera.far = camera.far; // used in WebGLBackground - - // The following code creates an oblique view frustum for clipping. - // see: Lengyel, Eric. “Oblique View Frustum Depth Projection and Clipping”. - // Journal of Game Development, Vol. 1, No. 2 (2005), Charles River Media, pp. 5–16 - - clipPlane.copy( refractorPlane ); - clipPlane.applyMatrix4( virtualCamera.matrixWorldInverse ); - - clipVector.set( clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.constant ); - - // calculate the clip-space corner point opposite the clipping plane and - // transform it into camera space by multiplying it by the inverse of the projection matrix - - const projectionMatrix = virtualCamera.projectionMatrix; - - q.x = ( Math.sign( clipVector.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ]; - q.y = ( Math.sign( clipVector.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ]; - q.z = - 1.0; - q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ]; - - // calculate the scaled plane vector - - clipVector.multiplyScalar( 2.0 / clipVector.dot( q ) ); - - // replacing the third row of the projection matrix - - projectionMatrix.elements[ 2 ] = clipVector.x; - projectionMatrix.elements[ 6 ] = clipVector.y; - projectionMatrix.elements[ 10 ] = clipVector.z + 1.0 - clipBias; - projectionMatrix.elements[ 14 ] = clipVector.w; - - }; - - } )(); - - // This will update the texture matrix that is used for projective texture mapping in the shader. - // see: http://developer.download.nvidia.com/assets/gamedev/docs/projective_texture_mapping.pdf - - function updateTextureMatrix( camera ) { - - // this matrix does range mapping to [ 0, 1 ] - - textureMatrix.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 - ); - - // we use "Object Linear Texgen", so we need to multiply the texture matrix T - // (matrix above) with the projection and view matrix of the virtual camera - // and the model matrix of the refractor - - textureMatrix.multiply( camera.projectionMatrix ); - textureMatrix.multiply( camera.matrixWorldInverse ); - textureMatrix.multiply( scope.matrixWorld ); - - } - - // - - function render( renderer, scene, camera ) { - - scope.visible = false; - - const currentRenderTarget = renderer.getRenderTarget(); - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - - renderer.xr.enabled = false; // avoid camera modification - renderer.shadowMap.autoUpdate = false; // avoid re-computing shadows - - renderer.setRenderTarget( renderTarget ); - if ( renderer.autoClear === false ) renderer.clear(); - renderer.render( scene, virtualCamera ); - - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - renderer.setRenderTarget( currentRenderTarget ); - - // restore viewport - - const viewport = camera.viewport; - - if ( viewport !== undefined ) { - - renderer.state.viewport( viewport ); - - } - - scope.visible = true; - - } - - // - - this.onBeforeRender = function ( renderer, scene, camera ) { - - // ensure refractors are rendered only once per frame - - if ( camera.userData.refractor === true ) return; - - // avoid rendering when the refractor is viewed from behind - - if ( ! visible( camera ) === true ) return; - - // update - - updateRefractorPlane(); - - updateTextureMatrix( camera ); - - updateVirtualCamera( camera ); - - render( renderer, scene, camera ); - - }; - - this.getRenderTarget = function () { - - return renderTarget; - - }; - - this.dispose = function () { - - renderTarget.dispose(); - scope.material.dispose(); - - }; - - } - -} - -Refractor.RefractorShader = { - - name: 'RefractorShader', - - uniforms: { - - 'color': { - value: null - }, - - 'tDiffuse': { - value: null - }, - - 'textureMatrix': { - value: null - } - - }, - - vertexShader: /* glsl */` - - uniform mat4 textureMatrix; - - varying vec4 vUv; - - void main() { - - vUv = textureMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - }`, - - fragmentShader: /* glsl */` - - uniform vec3 color; - uniform sampler2D tDiffuse; - - varying vec4 vUv; - - float blendOverlay( float base, float blend ) { - - return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); - - } - - vec3 blendOverlay( vec3 base, vec3 blend ) { - - return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); - - } - - void main() { - - vec4 base = texture2DProj( tDiffuse, vUv ); - gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); - - #include - #include - - }` - -}; - -export { Refractor }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ShadowMesh.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ShadowMesh.js deleted file mode 100644 index 86595ee..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/ShadowMesh.js +++ /dev/null @@ -1,80 +0,0 @@ -import { - Matrix4, - Mesh, - MeshBasicMaterial, - EqualStencilFunc, - IncrementStencilOp -} from '/static/javascript/three/build/three.module.js'; - -/** - * A shadow Mesh that follows a shadow-casting Mesh in the scene, but is confined to a single plane. - */ - -const _shadowMatrix = new Matrix4(); - -class ShadowMesh extends Mesh { - - constructor( mesh ) { - - const shadowMaterial = new MeshBasicMaterial( { - - color: 0x000000, - transparent: true, - opacity: 0.6, - depthWrite: false, - stencilWrite: true, - stencilFunc: EqualStencilFunc, - stencilRef: 0, - stencilZPass: IncrementStencilOp - - } ); - - super( mesh.geometry, shadowMaterial ); - - this.isShadowMesh = true; - - this.meshMatrix = mesh.matrixWorld; - - this.frustumCulled = false; - this.matrixAutoUpdate = false; - - } - - update( plane, lightPosition4D ) { - - // based on https://www.opengl.org/archives/resources/features/StencilTalk/tsld021.htm - - const dot = plane.normal.x * lightPosition4D.x + - plane.normal.y * lightPosition4D.y + - plane.normal.z * lightPosition4D.z + - - plane.constant * lightPosition4D.w; - - const sme = _shadowMatrix.elements; - - sme[ 0 ] = dot - lightPosition4D.x * plane.normal.x; - sme[ 4 ] = - lightPosition4D.x * plane.normal.y; - sme[ 8 ] = - lightPosition4D.x * plane.normal.z; - sme[ 12 ] = - lightPosition4D.x * - plane.constant; - - sme[ 1 ] = - lightPosition4D.y * plane.normal.x; - sme[ 5 ] = dot - lightPosition4D.y * plane.normal.y; - sme[ 9 ] = - lightPosition4D.y * plane.normal.z; - sme[ 13 ] = - lightPosition4D.y * - plane.constant; - - sme[ 2 ] = - lightPosition4D.z * plane.normal.x; - sme[ 6 ] = - lightPosition4D.z * plane.normal.y; - sme[ 10 ] = dot - lightPosition4D.z * plane.normal.z; - sme[ 14 ] = - lightPosition4D.z * - plane.constant; - - sme[ 3 ] = - lightPosition4D.w * plane.normal.x; - sme[ 7 ] = - lightPosition4D.w * plane.normal.y; - sme[ 11 ] = - lightPosition4D.w * plane.normal.z; - sme[ 15 ] = dot - lightPosition4D.w * - plane.constant; - - this.matrix.multiplyMatrices( _shadowMatrix, this.meshMatrix ); - - } - -} - -export { ShadowMesh }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Sky.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Sky.js deleted file mode 100644 index 2efbdf2..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Sky.js +++ /dev/null @@ -1,219 +0,0 @@ -import { - BackSide, - BoxGeometry, - Mesh, - ShaderMaterial, - UniformsUtils, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Based on "A Practical Analytic Model for Daylight" - * aka The Preetham Model, the de facto standard analytic skydome model - * https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight - * - * First implemented by Simon Wallner - * http://simonwallner.at/project/atmospheric-scattering/ - * - * Improved by Martin Upitis - * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR - * - * Three.js integration by zz85 http://twitter.com/blurspline -*/ - -class Sky extends Mesh { - - constructor() { - - const shader = Sky.SkyShader; - - const material = new ShaderMaterial( { - name: shader.name, - uniforms: UniformsUtils.clone( shader.uniforms ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - side: BackSide, - depthWrite: false - } ); - - super( new BoxGeometry( 1, 1, 1 ), material ); - - this.isSky = true; - - } - -} - -Sky.SkyShader = { - - name: 'SkyShader', - - uniforms: { - 'turbidity': { value: 2 }, - 'rayleigh': { value: 1 }, - 'mieCoefficient': { value: 0.005 }, - 'mieDirectionalG': { value: 0.8 }, - 'sunPosition': { value: new Vector3() }, - 'up': { value: new Vector3( 0, 1, 0 ) } - }, - - vertexShader: /* glsl */` - uniform vec3 sunPosition; - uniform float rayleigh; - uniform float turbidity; - uniform float mieCoefficient; - uniform vec3 up; - - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - // constants for atmospheric scattering - const float e = 2.71828182845904523536028747135266249775724709369995957; - const float pi = 3.141592653589793238462643383279502884197169; - - // wavelength of used primaries, according to preetham - const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); - // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: - // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) - const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); - - // mie stuff - // K coefficient for the primaries - const float v = 4.0; - const vec3 K = vec3( 0.686, 0.678, 0.666 ); - // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K - const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); - - // earth shadow hack - // cutoffAngle = pi / 1.95; - const float cutoffAngle = 1.6110731556870734; - const float steepness = 1.5; - const float EE = 1000.0; - - float sunIntensity( float zenithAngleCos ) { - zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); - return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); - } - - vec3 totalMie( float T ) { - float c = ( 0.2 * T ) * 10E-18; - return 0.434 * c * MieConst; - } - - void main() { - - vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); - vWorldPosition = worldPosition.xyz; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - gl_Position.z = gl_Position.w; // set z to camera.far - - vSunDirection = normalize( sunPosition ); - - vSunE = sunIntensity( dot( vSunDirection, up ) ); - - vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); - - float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); - - // extinction (absorbtion + out scattering) - // rayleigh coefficients - vBetaR = totalRayleigh * rayleighCoefficient; - - // mie coefficients - vBetaM = totalMie( turbidity ) * mieCoefficient; - - }`, - - fragmentShader: /* glsl */` - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - uniform float mieDirectionalG; - uniform vec3 up; - - // constants for atmospheric scattering - const float pi = 3.141592653589793238462643383279502884197169; - - const float n = 1.0003; // refractive index of air - const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) - - // optical length at zenith for molecules - const float rayleighZenithLength = 8.4E3; - const float mieZenithLength = 1.25E3; - // 66 arc seconds -> degrees, and the cosine of that - const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; - - // 3.0 / ( 16.0 * pi ) - const float THREE_OVER_SIXTEENPI = 0.05968310365946075; - // 1.0 / ( 4.0 * pi ) - const float ONE_OVER_FOURPI = 0.07957747154594767; - - float rayleighPhase( float cosTheta ) { - return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); - } - - float hgPhase( float cosTheta, float g ) { - float g2 = pow( g, 2.0 ); - float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); - return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); - } - - void main() { - - vec3 direction = normalize( vWorldPosition - cameraPosition ); - - // optical length - // cutoff angle at 90 to avoid singularity in next formula. - float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); - float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); - float sR = rayleighZenithLength * inverse; - float sM = mieZenithLength * inverse; - - // combined extinction factor - vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); - - // in scattering - float cosTheta = dot( direction, vSunDirection ); - - float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); - vec3 betaRTheta = vBetaR * rPhase; - - float mPhase = hgPhase( cosTheta, mieDirectionalG ); - vec3 betaMTheta = vBetaM * mPhase; - - vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); - Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); - - // nightsky - float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] - float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] - vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); - vec3 L0 = vec3( 0.1 ) * Fex; - - // composition + solar disc - float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); - L0 += ( vSunE * 19000.0 * Fex ) * sundisk; - - vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); - - vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); - - gl_FragColor = vec4( retColor, 1.0 ); - - #include - #include - - }` - -}; - -export { Sky }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water.js deleted file mode 100644 index b698420..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water.js +++ /dev/null @@ -1,333 +0,0 @@ -import { - Color, - FrontSide, - Matrix4, - Mesh, - PerspectiveCamera, - Plane, - ShaderMaterial, - UniformsLib, - UniformsUtils, - Vector3, - Vector4, - WebGLRenderTarget -} from '/static/javascript/three/build/three.module.js'; - -/** - * Work based on : - * https://github.com/Slayvin: Flat mirror for three.js - * https://home.adelphi.edu/~stemkoski/ : An implementation of water shader based on the flat mirror - * http://29a.ch/ && http://29a.ch/slides/2012/webglwater/ : Water shader explanations in WebGL - */ - -class Water extends Mesh { - - constructor( geometry, options = {} ) { - - super( geometry ); - - this.isWater = true; - - const scope = this; - - const textureWidth = options.textureWidth !== undefined ? options.textureWidth : 512; - const textureHeight = options.textureHeight !== undefined ? options.textureHeight : 512; - - const clipBias = options.clipBias !== undefined ? options.clipBias : 0.0; - const alpha = options.alpha !== undefined ? options.alpha : 1.0; - const time = options.time !== undefined ? options.time : 0.0; - const normalSampler = options.waterNormals !== undefined ? options.waterNormals : null; - const sunDirection = options.sunDirection !== undefined ? options.sunDirection : new Vector3( 0.70707, 0.70707, 0.0 ); - const sunColor = new Color( options.sunColor !== undefined ? options.sunColor : 0xffffff ); - const waterColor = new Color( options.waterColor !== undefined ? options.waterColor : 0x7F7F7F ); - const eye = options.eye !== undefined ? options.eye : new Vector3( 0, 0, 0 ); - const distortionScale = options.distortionScale !== undefined ? options.distortionScale : 20.0; - const side = options.side !== undefined ? options.side : FrontSide; - const fog = options.fog !== undefined ? options.fog : false; - - // - - const mirrorPlane = new Plane(); - const normal = new Vector3(); - const mirrorWorldPosition = new Vector3(); - const cameraWorldPosition = new Vector3(); - const rotationMatrix = new Matrix4(); - const lookAtPosition = new Vector3( 0, 0, - 1 ); - const clipPlane = new Vector4(); - - const view = new Vector3(); - const target = new Vector3(); - const q = new Vector4(); - - const textureMatrix = new Matrix4(); - - const mirrorCamera = new PerspectiveCamera(); - - const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight ); - - const mirrorShader = { - - name: 'MirrorShader', - - uniforms: UniformsUtils.merge( [ - UniformsLib[ 'fog' ], - UniformsLib[ 'lights' ], - { - 'normalSampler': { value: null }, - 'mirrorSampler': { value: null }, - 'alpha': { value: 1.0 }, - 'time': { value: 0.0 }, - 'size': { value: 1.0 }, - 'distortionScale': { value: 20.0 }, - 'textureMatrix': { value: new Matrix4() }, - 'sunColor': { value: new Color( 0x7F7F7F ) }, - 'sunDirection': { value: new Vector3( 0.70707, 0.70707, 0 ) }, - 'eye': { value: new Vector3() }, - 'waterColor': { value: new Color( 0x555555 ) } - } - ] ), - - vertexShader: /* glsl */` - uniform mat4 textureMatrix; - uniform float time; - - varying vec4 mirrorCoord; - varying vec4 worldPosition; - - #include - #include - #include - #include - - void main() { - mirrorCoord = modelMatrix * vec4( position, 1.0 ); - worldPosition = mirrorCoord.xyzw; - mirrorCoord = textureMatrix * mirrorCoord; - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix * mvPosition; - - #include - #include - #include - #include - #include - }`, - - fragmentShader: /* glsl */` - uniform sampler2D mirrorSampler; - uniform float alpha; - uniform float time; - uniform float size; - uniform float distortionScale; - uniform sampler2D normalSampler; - uniform vec3 sunColor; - uniform vec3 sunDirection; - uniform vec3 eye; - uniform vec3 waterColor; - - varying vec4 mirrorCoord; - varying vec4 worldPosition; - - vec4 getNoise( vec2 uv ) { - vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0); - vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 ); - vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 ); - vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 ); - vec4 noise = texture2D( normalSampler, uv0 ) + - texture2D( normalSampler, uv1 ) + - texture2D( normalSampler, uv2 ) + - texture2D( normalSampler, uv3 ); - return noise * 0.5 - 1.0; - } - - void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) { - vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) ); - float direction = max( 0.0, dot( eyeDirection, reflection ) ); - specularColor += pow( direction, shiny ) * sunColor * spec; - diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse; - } - - #include - #include - #include - #include - #include - #include - #include - #include - - void main() { - - #include - vec4 noise = getNoise( worldPosition.xz * size ); - vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) ); - - vec3 diffuseLight = vec3(0.0); - vec3 specularLight = vec3(0.0); - - vec3 worldToEye = eye-worldPosition.xyz; - vec3 eyeDirection = normalize( worldToEye ); - sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight ); - - float distance = length(worldToEye); - - vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale; - vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) ); - - float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 ); - float rf0 = 0.3; - float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 ); - vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor; - vec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance); - vec3 outgoingLight = albedo; - gl_FragColor = vec4( outgoingLight, alpha ); - - #include - #include - #include - }` - - }; - - const material = new ShaderMaterial( { - name: mirrorShader.name, - uniforms: UniformsUtils.clone( mirrorShader.uniforms ), - vertexShader: mirrorShader.vertexShader, - fragmentShader: mirrorShader.fragmentShader, - lights: true, - side: side, - fog: fog - } ); - - material.uniforms[ 'mirrorSampler' ].value = renderTarget.texture; - material.uniforms[ 'textureMatrix' ].value = textureMatrix; - material.uniforms[ 'alpha' ].value = alpha; - material.uniforms[ 'time' ].value = time; - material.uniforms[ 'normalSampler' ].value = normalSampler; - material.uniforms[ 'sunColor' ].value = sunColor; - material.uniforms[ 'waterColor' ].value = waterColor; - material.uniforms[ 'sunDirection' ].value = sunDirection; - material.uniforms[ 'distortionScale' ].value = distortionScale; - - material.uniforms[ 'eye' ].value = eye; - - scope.material = material; - - scope.onBeforeRender = function ( renderer, scene, camera ) { - - mirrorWorldPosition.setFromMatrixPosition( scope.matrixWorld ); - cameraWorldPosition.setFromMatrixPosition( camera.matrixWorld ); - - rotationMatrix.extractRotation( scope.matrixWorld ); - - normal.set( 0, 0, 1 ); - normal.applyMatrix4( rotationMatrix ); - - view.subVectors( mirrorWorldPosition, cameraWorldPosition ); - - // Avoid rendering when mirror is facing away - - if ( view.dot( normal ) > 0 ) return; - - view.reflect( normal ).negate(); - view.add( mirrorWorldPosition ); - - rotationMatrix.extractRotation( camera.matrixWorld ); - - lookAtPosition.set( 0, 0, - 1 ); - lookAtPosition.applyMatrix4( rotationMatrix ); - lookAtPosition.add( cameraWorldPosition ); - - target.subVectors( mirrorWorldPosition, lookAtPosition ); - target.reflect( normal ).negate(); - target.add( mirrorWorldPosition ); - - mirrorCamera.position.copy( view ); - mirrorCamera.up.set( 0, 1, 0 ); - mirrorCamera.up.applyMatrix4( rotationMatrix ); - mirrorCamera.up.reflect( normal ); - mirrorCamera.lookAt( target ); - - mirrorCamera.far = camera.far; // Used in WebGLBackground - - mirrorCamera.updateMatrixWorld(); - mirrorCamera.projectionMatrix.copy( camera.projectionMatrix ); - - // Update the texture matrix - textureMatrix.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 - ); - textureMatrix.multiply( mirrorCamera.projectionMatrix ); - textureMatrix.multiply( mirrorCamera.matrixWorldInverse ); - - // Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html - // Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf - mirrorPlane.setFromNormalAndCoplanarPoint( normal, mirrorWorldPosition ); - mirrorPlane.applyMatrix4( mirrorCamera.matrixWorldInverse ); - - clipPlane.set( mirrorPlane.normal.x, mirrorPlane.normal.y, mirrorPlane.normal.z, mirrorPlane.constant ); - - const projectionMatrix = mirrorCamera.projectionMatrix; - - q.x = ( Math.sign( clipPlane.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ]; - q.y = ( Math.sign( clipPlane.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ]; - q.z = - 1.0; - q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ]; - - // Calculate the scaled plane vector - clipPlane.multiplyScalar( 2.0 / clipPlane.dot( q ) ); - - // Replacing the third row of the projection matrix - projectionMatrix.elements[ 2 ] = clipPlane.x; - projectionMatrix.elements[ 6 ] = clipPlane.y; - projectionMatrix.elements[ 10 ] = clipPlane.z + 1.0 - clipBias; - projectionMatrix.elements[ 14 ] = clipPlane.w; - - eye.setFromMatrixPosition( camera.matrixWorld ); - - // Render - - const currentRenderTarget = renderer.getRenderTarget(); - - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - - scope.visible = false; - - renderer.xr.enabled = false; // Avoid camera modification and recursion - renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows - - renderer.setRenderTarget( renderTarget ); - - renderer.state.buffers.depth.setMask( true ); // make sure the depth buffer is writable so it can be properly cleared, see #18897 - - if ( renderer.autoClear === false ) renderer.clear(); - renderer.render( scene, mirrorCamera ); - - scope.visible = true; - - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - - renderer.setRenderTarget( currentRenderTarget ); - - // Restore viewport - - const viewport = camera.viewport; - - if ( viewport !== undefined ) { - - renderer.state.viewport( viewport ); - - } - - }; - - } - -} - -export { Water }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water2.js b/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water2.js deleted file mode 100644 index 8e15f20..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/objects/Water2.js +++ /dev/null @@ -1,361 +0,0 @@ -import { - Clock, - Color, - Matrix4, - Mesh, - RepeatWrapping, - ShaderMaterial, - TextureLoader, - UniformsLib, - UniformsUtils, - Vector2, - Vector4 -} from '/static/javascript/three/build/three.module.js'; -import { Reflector } from './Reflector.js'; -import { Refractor } from './Refractor.js'; - -/** - * References: - * https://alex.vlachos.com/graphics/Vlachos-SIGGRAPH10-WaterFlow.pdf - * http://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html - * - */ - -class Water extends Mesh { - - constructor( geometry, options = {} ) { - - super( geometry ); - - this.isWater = true; - - this.type = 'Water'; - - const scope = this; - - const color = ( options.color !== undefined ) ? new Color( options.color ) : new Color( 0xFFFFFF ); - const textureWidth = options.textureWidth !== undefined ? options.textureWidth : 512; - const textureHeight = options.textureHeight !== undefined ? options.textureHeight : 512; - const clipBias = options.clipBias !== undefined ? options.clipBias : 0; - const flowDirection = options.flowDirection !== undefined ? options.flowDirection : new Vector2( 1, 0 ); - const flowSpeed = options.flowSpeed !== undefined ? options.flowSpeed : 0.03; - const reflectivity = options.reflectivity !== undefined ? options.reflectivity : 0.02; - const scale = options.scale !== undefined ? options.scale : 1; - const shader = options.shader !== undefined ? options.shader : Water.WaterShader; - - const textureLoader = new TextureLoader(); - - const flowMap = options.flowMap || undefined; - const normalMap0 = options.normalMap0 || textureLoader.load( 'textures/water/Water_1_M_Normal.jpg' ); - const normalMap1 = options.normalMap1 || textureLoader.load( 'textures/water/Water_2_M_Normal.jpg' ); - - const cycle = 0.15; // a cycle of a flow map phase - const halfCycle = cycle * 0.5; - const textureMatrix = new Matrix4(); - const clock = new Clock(); - - // internal components - - if ( Reflector === undefined ) { - - console.error( 'THREE.Water: Required component Reflector not found.' ); - return; - - } - - if ( Refractor === undefined ) { - - console.error( 'THREE.Water: Required component Refractor not found.' ); - return; - - } - - const reflector = new Reflector( geometry, { - textureWidth: textureWidth, - textureHeight: textureHeight, - clipBias: clipBias - } ); - - const refractor = new Refractor( geometry, { - textureWidth: textureWidth, - textureHeight: textureHeight, - clipBias: clipBias - } ); - - reflector.matrixAutoUpdate = false; - refractor.matrixAutoUpdate = false; - - // material - - this.material = new ShaderMaterial( { - name: shader.name, - uniforms: UniformsUtils.merge( [ - UniformsLib[ 'fog' ], - shader.uniforms - ] ), - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - transparent: true, - fog: true - } ); - - if ( flowMap !== undefined ) { - - this.material.defines.USE_FLOWMAP = ''; - this.material.uniforms[ 'tFlowMap' ] = { - type: 't', - value: flowMap - }; - - } else { - - this.material.uniforms[ 'flowDirection' ] = { - type: 'v2', - value: flowDirection - }; - - } - - // maps - - normalMap0.wrapS = normalMap0.wrapT = RepeatWrapping; - normalMap1.wrapS = normalMap1.wrapT = RepeatWrapping; - - this.material.uniforms[ 'tReflectionMap' ].value = reflector.getRenderTarget().texture; - this.material.uniforms[ 'tRefractionMap' ].value = refractor.getRenderTarget().texture; - this.material.uniforms[ 'tNormalMap0' ].value = normalMap0; - this.material.uniforms[ 'tNormalMap1' ].value = normalMap1; - - // water - - this.material.uniforms[ 'color' ].value = color; - this.material.uniforms[ 'reflectivity' ].value = reflectivity; - this.material.uniforms[ 'textureMatrix' ].value = textureMatrix; - - // inital values - - this.material.uniforms[ 'config' ].value.x = 0; // flowMapOffset0 - this.material.uniforms[ 'config' ].value.y = halfCycle; // flowMapOffset1 - this.material.uniforms[ 'config' ].value.z = halfCycle; // halfCycle - this.material.uniforms[ 'config' ].value.w = scale; // scale - - // functions - - function updateTextureMatrix( camera ) { - - textureMatrix.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 - ); - - textureMatrix.multiply( camera.projectionMatrix ); - textureMatrix.multiply( camera.matrixWorldInverse ); - textureMatrix.multiply( scope.matrixWorld ); - - } - - function updateFlow() { - - const delta = clock.getDelta(); - const config = scope.material.uniforms[ 'config' ]; - - config.value.x += flowSpeed * delta; // flowMapOffset0 - config.value.y = config.value.x + halfCycle; // flowMapOffset1 - - // Important: The distance between offsets should be always the value of "halfCycle". - // Moreover, both offsets should be in the range of [ 0, cycle ]. - // This approach ensures a smooth water flow and avoids "reset" effects. - - if ( config.value.x >= cycle ) { - - config.value.x = 0; - config.value.y = halfCycle; - - } else if ( config.value.y >= cycle ) { - - config.value.y = config.value.y - cycle; - - } - - } - - // - - this.onBeforeRender = function ( renderer, scene, camera ) { - - updateTextureMatrix( camera ); - updateFlow(); - - scope.visible = false; - - reflector.matrixWorld.copy( scope.matrixWorld ); - refractor.matrixWorld.copy( scope.matrixWorld ); - - reflector.onBeforeRender( renderer, scene, camera ); - refractor.onBeforeRender( renderer, scene, camera ); - - scope.visible = true; - - }; - - } - -} - -Water.WaterShader = { - - name: 'WaterShader', - - uniforms: { - - 'color': { - type: 'c', - value: null - }, - - 'reflectivity': { - type: 'f', - value: 0 - }, - - 'tReflectionMap': { - type: 't', - value: null - }, - - 'tRefractionMap': { - type: 't', - value: null - }, - - 'tNormalMap0': { - type: 't', - value: null - }, - - 'tNormalMap1': { - type: 't', - value: null - }, - - 'textureMatrix': { - type: 'm4', - value: null - }, - - 'config': { - type: 'v4', - value: new Vector4() - } - - }, - - vertexShader: /* glsl */` - - #include - #include - #include - - uniform mat4 textureMatrix; - - varying vec4 vCoord; - varying vec2 vUv; - varying vec3 vToEye; - - void main() { - - vUv = uv; - vCoord = textureMatrix * vec4( position, 1.0 ); - - vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); - vToEye = cameraPosition - worldPosition.xyz; - - vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex - gl_Position = projectionMatrix * mvPosition; - - #include - #include - - }`, - - fragmentShader: /* glsl */` - - #include - #include - #include - - uniform sampler2D tReflectionMap; - uniform sampler2D tRefractionMap; - uniform sampler2D tNormalMap0; - uniform sampler2D tNormalMap1; - - #ifdef USE_FLOWMAP - uniform sampler2D tFlowMap; - #else - uniform vec2 flowDirection; - #endif - - uniform vec3 color; - uniform float reflectivity; - uniform vec4 config; - - varying vec4 vCoord; - varying vec2 vUv; - varying vec3 vToEye; - - void main() { - - #include - - float flowMapOffset0 = config.x; - float flowMapOffset1 = config.y; - float halfCycle = config.z; - float scale = config.w; - - vec3 toEye = normalize( vToEye ); - - // determine flow direction - vec2 flow; - #ifdef USE_FLOWMAP - flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0; - #else - flow = flowDirection; - #endif - flow.x *= - 1.0; - - // sample normal maps (distort uvs with flowdata) - vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 ); - vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 ); - - // linear interpolate to get the final normal color - float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle; - vec4 normalColor = mix( normalColor0, normalColor1, flowLerp ); - - // calculate normal vector - vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) ); - - // calculate the fresnel term to blend reflection and refraction maps - float theta = max( dot( toEye, normal ), 0.0 ); - float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 ); - - // calculate final uv coords - vec3 coord = vCoord.xyz / vCoord.w; - vec2 uv = coord.xy + coord.z * normal.xz * 0.05; - - vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) ); - vec4 refractColor = texture2D( tRefractionMap, uv ); - - // multiply water color with the mix of both textures - gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance ); - - #include - #include - #include - - }` - -}; - -export { Water }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/jank.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/jank.js deleted file mode 100644 index 2a4f1e7..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/jank.js +++ /dev/null @@ -1,45 +0,0 @@ -let interval = null; -let result = null; - -function initJank() { - - const button = document.getElementById( 'button' ); - button.addEventListener( 'click', function () { - - if ( interval === null ) { - - interval = setInterval( jank, 1000 / 60 ); - - button.textContent = 'STOP JANK'; - - } else { - - clearInterval( interval ); - interval = null; - - button.textContent = 'START JANK'; - result.textContent = ''; - - } - - } ); - - result = document.getElementById( 'result' ); - -} - -function jank() { - - let number = 0; - - for ( let i = 0; i < 10000000; i ++ ) { - - number += Math.random(); - - } - - result.textContent = number; - -} - -export default initJank; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/offscreen.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/offscreen.js deleted file mode 100644 index ba69f0a..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/offscreen.js +++ /dev/null @@ -1,8 +0,0 @@ -import init from './scene.js'; - -self.onmessage = function ( message ) { - - const data = message.data; - init( data.drawingSurface, data.width, data.height, data.pixelRatio, data.path ); - -}; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS2DRenderer.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS2DRenderer.js deleted file mode 100644 index 75bea09..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS2DRenderer.js +++ /dev/null @@ -1,235 +0,0 @@ -import { - Matrix4, - Object3D, - Vector2, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -class CSS2DObject extends Object3D { - - constructor( element = document.createElement( 'div' ) ) { - - super(); - - this.isCSS2DObject = true; - - this.element = element; - - this.element.style.position = 'absolute'; - this.element.style.userSelect = 'none'; - - this.element.setAttribute( 'draggable', false ); - - this.center = new Vector2( 0.5, 0.5 ); // ( 0, 0 ) is the lower left; ( 1, 1 ) is the top right - - this.addEventListener( 'removed', function () { - - this.traverse( function ( object ) { - - if ( object.element instanceof Element && object.element.parentNode !== null ) { - - object.element.parentNode.removeChild( object.element ); - - } - - } ); - - } ); - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - this.element = source.element.cloneNode( true ); - - this.center = source.center; - - return this; - - } - -} - -// - -const _vector = new Vector3(); -const _viewMatrix = new Matrix4(); -const _viewProjectionMatrix = new Matrix4(); -const _a = new Vector3(); -const _b = new Vector3(); - -class CSS2DRenderer { - - constructor( parameters = {} ) { - - const _this = this; - - let _width, _height; - let _widthHalf, _heightHalf; - - const cache = { - objects: new WeakMap() - }; - - const domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' ); - - domElement.style.overflow = 'hidden'; - - this.domElement = domElement; - - this.getSize = function () { - - return { - width: _width, - height: _height - }; - - }; - - this.render = function ( scene, camera ) { - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - _viewMatrix.copy( camera.matrixWorldInverse ); - _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix ); - - renderObject( scene, scene, camera ); - zOrder( scene ); - - }; - - this.setSize = function ( width, height ) { - - _width = width; - _height = height; - - _widthHalf = _width / 2; - _heightHalf = _height / 2; - - domElement.style.width = width + 'px'; - domElement.style.height = height + 'px'; - - }; - - function hideObject( object ) { - - if ( object.isCSS2DObject ) object.element.style.display = 'none'; - - for ( let i = 0, l = object.children.length; i < l; i ++ ) { - - hideObject( object.children[ i ] ); - - } - - } - - function renderObject( object, scene, camera ) { - - if ( object.visible === false ) { - - hideObject( object ); - - return; - - } - - if ( object.isCSS2DObject ) { - - _vector.setFromMatrixPosition( object.matrixWorld ); - _vector.applyMatrix4( _viewProjectionMatrix ); - - const visible = ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true ); - - const element = object.element; - element.style.display = visible === true ? '' : 'none'; - - if ( visible === true ) { - - object.onBeforeRender( _this, scene, camera ); - - element.style.transform = 'translate(' + ( - 100 * object.center.x ) + '%,' + ( - 100 * object.center.y ) + '%)' + 'translate(' + ( _vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - _vector.y * _heightHalf + _heightHalf ) + 'px)'; - - if ( element.parentNode !== domElement ) { - - domElement.appendChild( element ); - - } - - object.onAfterRender( _this, scene, camera ); - - } - - const objectData = { - distanceToCameraSquared: getDistanceToSquared( camera, object ) - }; - - cache.objects.set( object, objectData ); - - } - - for ( let i = 0, l = object.children.length; i < l; i ++ ) { - - renderObject( object.children[ i ], scene, camera ); - - } - - } - - function getDistanceToSquared( object1, object2 ) { - - _a.setFromMatrixPosition( object1.matrixWorld ); - _b.setFromMatrixPosition( object2.matrixWorld ); - - return _a.distanceToSquared( _b ); - - } - - function filterAndFlatten( scene ) { - - const result = []; - - scene.traverseVisible( function ( object ) { - - if ( object.isCSS2DObject ) result.push( object ); - - } ); - - return result; - - } - - function zOrder( scene ) { - - const sorted = filterAndFlatten( scene ).sort( function ( a, b ) { - - if ( a.renderOrder !== b.renderOrder ) { - - return b.renderOrder - a.renderOrder; - - } - - const distanceA = cache.objects.get( a ).distanceToCameraSquared; - const distanceB = cache.objects.get( b ).distanceToCameraSquared; - - return distanceA - distanceB; - - } ); - - const zMax = sorted.length; - - for ( let i = 0, l = sorted.length; i < l; i ++ ) { - - sorted[ i ].element.style.zIndex = zMax - i; - - } - - } - - } - -} - -export { CSS2DObject, CSS2DRenderer }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS3DRenderer.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS3DRenderer.js deleted file mode 100644 index 9a8ca4d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/CSS3DRenderer.js +++ /dev/null @@ -1,350 +0,0 @@ -import { - Matrix4, - Object3D, - Quaternion, - Vector3 -} from '/static/javascript/three/build/three.module.js'; - -/** - * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs - */ - -const _position = new Vector3(); -const _quaternion = new Quaternion(); -const _scale = new Vector3(); - -class CSS3DObject extends Object3D { - - constructor( element = document.createElement( 'div' ) ) { - - super(); - - this.isCSS3DObject = true; - - this.element = element; - this.element.style.position = 'absolute'; - this.element.style.pointerEvents = 'auto'; - this.element.style.userSelect = 'none'; - - this.element.setAttribute( 'draggable', false ); - - this.addEventListener( 'removed', function () { - - this.traverse( function ( object ) { - - if ( object.element instanceof Element && object.element.parentNode !== null ) { - - object.element.parentNode.removeChild( object.element ); - - } - - } ); - - } ); - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - this.element = source.element.cloneNode( true ); - - return this; - - } - -} - -class CSS3DSprite extends CSS3DObject { - - constructor( element ) { - - super( element ); - - this.isCSS3DSprite = true; - - this.rotation2D = 0; - - } - - copy( source, recursive ) { - - super.copy( source, recursive ); - - this.rotation2D = source.rotation2D; - - return this; - - } - -} - -// - -const _matrix = new Matrix4(); -const _matrix2 = new Matrix4(); - -class CSS3DRenderer { - - constructor( parameters = {} ) { - - const _this = this; - - let _width, _height; - let _widthHalf, _heightHalf; - - const cache = { - camera: { style: '' }, - objects: new WeakMap() - }; - - const domElement = parameters.element !== undefined ? parameters.element : document.createElement( 'div' ); - - domElement.style.overflow = 'hidden'; - - this.domElement = domElement; - - const viewElement = document.createElement( 'div' ); - viewElement.style.transformOrigin = '0 0'; - viewElement.style.pointerEvents = 'none'; - domElement.appendChild( viewElement ); - - const cameraElement = document.createElement( 'div' ); - - cameraElement.style.transformStyle = 'preserve-3d'; - - viewElement.appendChild( cameraElement ); - - this.getSize = function () { - - return { - width: _width, - height: _height - }; - - }; - - this.render = function ( scene, camera ) { - - const fov = camera.projectionMatrix.elements[ 5 ] * _heightHalf; - - if ( camera.view && camera.view.enabled ) { - - // view offset - viewElement.style.transform = `translate( ${ - camera.view.offsetX * ( _width / camera.view.width ) }px, ${ - camera.view.offsetY * ( _height / camera.view.height ) }px )`; - - // view fullWidth and fullHeight, view width and height - viewElement.style.transform += `scale( ${ camera.view.fullWidth / camera.view.width }, ${ camera.view.fullHeight / camera.view.height } )`; - - } else { - - viewElement.style.transform = ''; - - } - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - let tx, ty; - - if ( camera.isOrthographicCamera ) { - - tx = - ( camera.right + camera.left ) / 2; - ty = ( camera.top + camera.bottom ) / 2; - - } - - const scaleByViewOffset = camera.view && camera.view.enabled ? camera.view.height / camera.view.fullHeight : 1; - const cameraCSSMatrix = camera.isOrthographicCamera ? - `scale( ${ scaleByViewOffset } )` + 'scale(' + fov + ')' + 'translate(' + epsilon( tx ) + 'px,' + epsilon( ty ) + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ) : - `scale( ${ scaleByViewOffset } )` + 'translateZ(' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ); - const perspective = camera.isPerspectiveCamera ? 'perspective(' + fov + 'px) ' : ''; - - const style = perspective + cameraCSSMatrix + - 'translate(' + _widthHalf + 'px,' + _heightHalf + 'px)'; - - if ( cache.camera.style !== style ) { - - cameraElement.style.transform = style; - - cache.camera.style = style; - - } - - renderObject( scene, scene, camera, cameraCSSMatrix ); - - }; - - this.setSize = function ( width, height ) { - - _width = width; - _height = height; - _widthHalf = _width / 2; - _heightHalf = _height / 2; - - domElement.style.width = width + 'px'; - domElement.style.height = height + 'px'; - - viewElement.style.width = width + 'px'; - viewElement.style.height = height + 'px'; - - cameraElement.style.width = width + 'px'; - cameraElement.style.height = height + 'px'; - - }; - - function epsilon( value ) { - - return Math.abs( value ) < 1e-10 ? 0 : value; - - } - - function getCameraCSSMatrix( matrix ) { - - const elements = matrix.elements; - - return 'matrix3d(' + - epsilon( elements[ 0 ] ) + ',' + - epsilon( - elements[ 1 ] ) + ',' + - epsilon( elements[ 2 ] ) + ',' + - epsilon( elements[ 3 ] ) + ',' + - epsilon( elements[ 4 ] ) + ',' + - epsilon( - elements[ 5 ] ) + ',' + - epsilon( elements[ 6 ] ) + ',' + - epsilon( elements[ 7 ] ) + ',' + - epsilon( elements[ 8 ] ) + ',' + - epsilon( - elements[ 9 ] ) + ',' + - epsilon( elements[ 10 ] ) + ',' + - epsilon( elements[ 11 ] ) + ',' + - epsilon( elements[ 12 ] ) + ',' + - epsilon( - elements[ 13 ] ) + ',' + - epsilon( elements[ 14 ] ) + ',' + - epsilon( elements[ 15 ] ) + - ')'; - - } - - function getObjectCSSMatrix( matrix ) { - - const elements = matrix.elements; - const matrix3d = 'matrix3d(' + - epsilon( elements[ 0 ] ) + ',' + - epsilon( elements[ 1 ] ) + ',' + - epsilon( elements[ 2 ] ) + ',' + - epsilon( elements[ 3 ] ) + ',' + - epsilon( - elements[ 4 ] ) + ',' + - epsilon( - elements[ 5 ] ) + ',' + - epsilon( - elements[ 6 ] ) + ',' + - epsilon( - elements[ 7 ] ) + ',' + - epsilon( elements[ 8 ] ) + ',' + - epsilon( elements[ 9 ] ) + ',' + - epsilon( elements[ 10 ] ) + ',' + - epsilon( elements[ 11 ] ) + ',' + - epsilon( elements[ 12 ] ) + ',' + - epsilon( elements[ 13 ] ) + ',' + - epsilon( elements[ 14 ] ) + ',' + - epsilon( elements[ 15 ] ) + - ')'; - - return 'translate(-50%,-50%)' + matrix3d; - - } - - function hideObject( object ) { - - if ( object.isCSS3DObject ) object.element.style.display = 'none'; - - for ( let i = 0, l = object.children.length; i < l; i ++ ) { - - hideObject( object.children[ i ] ); - - } - - } - - function renderObject( object, scene, camera, cameraCSSMatrix ) { - - if ( object.visible === false ) { - - hideObject( object ); - - return; - - } - - if ( object.isCSS3DObject ) { - - const visible = ( object.layers.test( camera.layers ) === true ); - - const element = object.element; - element.style.display = visible === true ? '' : 'none'; - - if ( visible === true ) { - - object.onBeforeRender( _this, scene, camera ); - - let style; - - if ( object.isCSS3DSprite ) { - - // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/ - - _matrix.copy( camera.matrixWorldInverse ); - _matrix.transpose(); - - if ( object.rotation2D !== 0 ) _matrix.multiply( _matrix2.makeRotationZ( object.rotation2D ) ); - - object.matrixWorld.decompose( _position, _quaternion, _scale ); - _matrix.setPosition( _position ); - _matrix.scale( _scale ); - - _matrix.elements[ 3 ] = 0; - _matrix.elements[ 7 ] = 0; - _matrix.elements[ 11 ] = 0; - _matrix.elements[ 15 ] = 1; - - style = getObjectCSSMatrix( _matrix ); - - } else { - - style = getObjectCSSMatrix( object.matrixWorld ); - - } - - const cachedObject = cache.objects.get( object ); - - if ( cachedObject === undefined || cachedObject.style !== style ) { - - element.style.transform = style; - - const objectData = { style: style }; - cache.objects.set( object, objectData ); - - } - - if ( element.parentNode !== cameraElement ) { - - cameraElement.appendChild( element ); - - } - - object.onAfterRender( _this, scene, camera ); - - } - - } - - for ( let i = 0, l = object.children.length; i < l; i ++ ) { - - renderObject( object.children[ i ], scene, camera, cameraCSSMatrix ); - - } - - } - - } - -} - -export { CSS3DObject, CSS3DSprite, CSS3DRenderer }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/Projector.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/Projector.js deleted file mode 100644 index a18c086..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/Projector.js +++ /dev/null @@ -1,918 +0,0 @@ -import { - Box3, - Color, - DoubleSide, - Frustum, - Matrix3, - Matrix4, - Vector2, - Vector3, - Vector4 -} from '/static/javascript/three/build/three.module.js'; - -class RenderableObject { - - constructor() { - - this.id = 0; - - this.object = null; - this.z = 0; - this.renderOrder = 0; - - } - -} - -// - -class RenderableFace { - - constructor() { - - this.id = 0; - - this.v1 = new RenderableVertex(); - this.v2 = new RenderableVertex(); - this.v3 = new RenderableVertex(); - - this.normalModel = new Vector3(); - - this.vertexNormalsModel = [ new Vector3(), new Vector3(), new Vector3() ]; - this.vertexNormalsLength = 0; - - this.color = new Color(); - this.material = null; - this.uvs = [ new Vector2(), new Vector2(), new Vector2() ]; - - this.z = 0; - this.renderOrder = 0; - - } - -} - -// - -class RenderableVertex { - - constructor() { - - this.position = new Vector3(); - this.positionWorld = new Vector3(); - this.positionScreen = new Vector4(); - - this.visible = true; - - } - - copy( vertex ) { - - this.positionWorld.copy( vertex.positionWorld ); - this.positionScreen.copy( vertex.positionScreen ); - - } - -} - -// - -class RenderableLine { - - constructor() { - - this.id = 0; - - this.v1 = new RenderableVertex(); - this.v2 = new RenderableVertex(); - - this.vertexColors = [ new Color(), new Color() ]; - this.material = null; - - this.z = 0; - this.renderOrder = 0; - - } - -} - -// - -class RenderableSprite { - - constructor() { - - this.id = 0; - - this.object = null; - - this.x = 0; - this.y = 0; - this.z = 0; - - this.rotation = 0; - this.scale = new Vector2(); - - this.material = null; - this.renderOrder = 0; - - } - -} - -// - -class Projector { - - constructor() { - - let _object, _objectCount, _objectPoolLength = 0, - _vertex, _vertexCount, _vertexPoolLength = 0, - _face, _faceCount, _facePoolLength = 0, - _line, _lineCount, _linePoolLength = 0, - _sprite, _spriteCount, _spritePoolLength = 0, - _modelMatrix; - - const - - _renderData = { objects: [], lights: [], elements: [] }, - - _vector3 = new Vector3(), - _vector4 = new Vector4(), - - _clipBox = new Box3( new Vector3( - 1, - 1, - 1 ), new Vector3( 1, 1, 1 ) ), - _boundingBox = new Box3(), - _points3 = new Array( 3 ), - - _viewMatrix = new Matrix4(), - _viewProjectionMatrix = new Matrix4(), - - _modelViewProjectionMatrix = new Matrix4(), - - _frustum = new Frustum(), - - _objectPool = [], _vertexPool = [], _facePool = [], _linePool = [], _spritePool = []; - - // - - function RenderList() { - - const normals = []; - const colors = []; - const uvs = []; - - let object = null; - - const normalMatrix = new Matrix3(); - - function setObject( value ) { - - object = value; - - normalMatrix.getNormalMatrix( object.matrixWorld ); - - normals.length = 0; - colors.length = 0; - uvs.length = 0; - - } - - function projectVertex( vertex ) { - - const position = vertex.position; - const positionWorld = vertex.positionWorld; - const positionScreen = vertex.positionScreen; - - positionWorld.copy( position ).applyMatrix4( _modelMatrix ); - positionScreen.copy( positionWorld ).applyMatrix4( _viewProjectionMatrix ); - - const invW = 1 / positionScreen.w; - - positionScreen.x *= invW; - positionScreen.y *= invW; - positionScreen.z *= invW; - - vertex.visible = positionScreen.x >= - 1 && positionScreen.x <= 1 && - positionScreen.y >= - 1 && positionScreen.y <= 1 && - positionScreen.z >= - 1 && positionScreen.z <= 1; - - } - - function pushVertex( x, y, z ) { - - _vertex = getNextVertexInPool(); - _vertex.position.set( x, y, z ); - - projectVertex( _vertex ); - - } - - function pushNormal( x, y, z ) { - - normals.push( x, y, z ); - - } - - function pushColor( r, g, b ) { - - colors.push( r, g, b ); - - } - - function pushUv( x, y ) { - - uvs.push( x, y ); - - } - - function checkTriangleVisibility( v1, v2, v3 ) { - - if ( v1.visible === true || v2.visible === true || v3.visible === true ) return true; - - _points3[ 0 ] = v1.positionScreen; - _points3[ 1 ] = v2.positionScreen; - _points3[ 2 ] = v3.positionScreen; - - return _clipBox.intersectsBox( _boundingBox.setFromPoints( _points3 ) ); - - } - - function checkBackfaceCulling( v1, v2, v3 ) { - - return ( ( v3.positionScreen.x - v1.positionScreen.x ) * - ( v2.positionScreen.y - v1.positionScreen.y ) - - ( v3.positionScreen.y - v1.positionScreen.y ) * - ( v2.positionScreen.x - v1.positionScreen.x ) ) < 0; - - } - - function pushLine( a, b ) { - - const v1 = _vertexPool[ a ]; - const v2 = _vertexPool[ b ]; - - // Clip - - v1.positionScreen.copy( v1.position ).applyMatrix4( _modelViewProjectionMatrix ); - v2.positionScreen.copy( v2.position ).applyMatrix4( _modelViewProjectionMatrix ); - - if ( clipLine( v1.positionScreen, v2.positionScreen ) === true ) { - - // Perform the perspective divide - v1.positionScreen.multiplyScalar( 1 / v1.positionScreen.w ); - v2.positionScreen.multiplyScalar( 1 / v2.positionScreen.w ); - - _line = getNextLineInPool(); - _line.id = object.id; - _line.v1.copy( v1 ); - _line.v2.copy( v2 ); - _line.z = Math.max( v1.positionScreen.z, v2.positionScreen.z ); - _line.renderOrder = object.renderOrder; - - _line.material = object.material; - - if ( object.material.vertexColors ) { - - _line.vertexColors[ 0 ].fromArray( colors, a * 3 ); - _line.vertexColors[ 1 ].fromArray( colors, b * 3 ); - - } - - _renderData.elements.push( _line ); - - } - - } - - function pushTriangle( a, b, c, material ) { - - const v1 = _vertexPool[ a ]; - const v2 = _vertexPool[ b ]; - const v3 = _vertexPool[ c ]; - - if ( checkTriangleVisibility( v1, v2, v3 ) === false ) return; - - if ( material.side === DoubleSide || checkBackfaceCulling( v1, v2, v3 ) === true ) { - - _face = getNextFaceInPool(); - - _face.id = object.id; - _face.v1.copy( v1 ); - _face.v2.copy( v2 ); - _face.v3.copy( v3 ); - _face.z = ( v1.positionScreen.z + v2.positionScreen.z + v3.positionScreen.z ) / 3; - _face.renderOrder = object.renderOrder; - - // face normal - _vector3.subVectors( v3.position, v2.position ); - _vector4.subVectors( v1.position, v2.position ); - _vector3.cross( _vector4 ); - _face.normalModel.copy( _vector3 ); - _face.normalModel.applyMatrix3( normalMatrix ).normalize(); - - for ( let i = 0; i < 3; i ++ ) { - - const normal = _face.vertexNormalsModel[ i ]; - normal.fromArray( normals, arguments[ i ] * 3 ); - normal.applyMatrix3( normalMatrix ).normalize(); - - const uv = _face.uvs[ i ]; - uv.fromArray( uvs, arguments[ i ] * 2 ); - - } - - _face.vertexNormalsLength = 3; - - _face.material = material; - - if ( material.vertexColors ) { - - _face.color.fromArray( colors, a * 3 ); - - } - - _renderData.elements.push( _face ); - - } - - } - - return { - setObject: setObject, - projectVertex: projectVertex, - checkTriangleVisibility: checkTriangleVisibility, - checkBackfaceCulling: checkBackfaceCulling, - pushVertex: pushVertex, - pushNormal: pushNormal, - pushColor: pushColor, - pushUv: pushUv, - pushLine: pushLine, - pushTriangle: pushTriangle - }; - - } - - const renderList = new RenderList(); - - function projectObject( object ) { - - if ( object.visible === false ) return; - - if ( object.isLight ) { - - _renderData.lights.push( object ); - - } else if ( object.isMesh || object.isLine || object.isPoints ) { - - if ( object.material.visible === false ) return; - if ( object.frustumCulled === true && _frustum.intersectsObject( object ) === false ) return; - - addObject( object ); - - } else if ( object.isSprite ) { - - if ( object.material.visible === false ) return; - if ( object.frustumCulled === true && _frustum.intersectsSprite( object ) === false ) return; - - addObject( object ); - - } - - const children = object.children; - - for ( let i = 0, l = children.length; i < l; i ++ ) { - - projectObject( children[ i ] ); - - } - - } - - function addObject( object ) { - - _object = getNextObjectInPool(); - _object.id = object.id; - _object.object = object; - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyMatrix4( _viewProjectionMatrix ); - _object.z = _vector3.z; - _object.renderOrder = object.renderOrder; - - _renderData.objects.push( _object ); - - } - - this.projectScene = function ( scene, camera, sortObjects, sortElements ) { - - _faceCount = 0; - _lineCount = 0; - _spriteCount = 0; - - _renderData.elements.length = 0; - - if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld(); - if ( camera.parent === null && camera.matrixWorldAutoUpdate === true ) camera.updateMatrixWorld(); - - _viewMatrix.copy( camera.matrixWorldInverse ); - _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix ); - - _frustum.setFromProjectionMatrix( _viewProjectionMatrix ); - - // - - _objectCount = 0; - - _renderData.objects.length = 0; - _renderData.lights.length = 0; - - projectObject( scene ); - - if ( sortObjects === true ) { - - _renderData.objects.sort( painterSort ); - - } - - // - - const objects = _renderData.objects; - - for ( let o = 0, ol = objects.length; o < ol; o ++ ) { - - const object = objects[ o ].object; - const geometry = object.geometry; - - renderList.setObject( object ); - - _modelMatrix = object.matrixWorld; - - _vertexCount = 0; - - if ( object.isMesh ) { - - let material = object.material; - - const isMultiMaterial = Array.isArray( material ); - - const attributes = geometry.attributes; - const groups = geometry.groups; - - if ( attributes.position === undefined ) continue; - - const positions = attributes.position.array; - - for ( let i = 0, l = positions.length; i < l; i += 3 ) { - - let x = positions[ i ]; - let y = positions[ i + 1 ]; - let z = positions[ i + 2 ]; - - const morphTargets = geometry.morphAttributes.position; - - if ( morphTargets !== undefined ) { - - const morphTargetsRelative = geometry.morphTargetsRelative; - const morphInfluences = object.morphTargetInfluences; - - for ( let t = 0, tl = morphTargets.length; t < tl; t ++ ) { - - const influence = morphInfluences[ t ]; - - if ( influence === 0 ) continue; - - const target = morphTargets[ t ]; - - if ( morphTargetsRelative ) { - - x += target.getX( i / 3 ) * influence; - y += target.getY( i / 3 ) * influence; - z += target.getZ( i / 3 ) * influence; - - } else { - - x += ( target.getX( i / 3 ) - positions[ i ] ) * influence; - y += ( target.getY( i / 3 ) - positions[ i + 1 ] ) * influence; - z += ( target.getZ( i / 3 ) - positions[ i + 2 ] ) * influence; - - } - - } - - } - - renderList.pushVertex( x, y, z ); - - } - - if ( attributes.normal !== undefined ) { - - const normals = attributes.normal.array; - - for ( let i = 0, l = normals.length; i < l; i += 3 ) { - - renderList.pushNormal( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ); - - } - - } - - if ( attributes.color !== undefined ) { - - const colors = attributes.color.array; - - for ( let i = 0, l = colors.length; i < l; i += 3 ) { - - renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ); - - } - - } - - if ( attributes.uv !== undefined ) { - - const uvs = attributes.uv.array; - - for ( let i = 0, l = uvs.length; i < l; i += 2 ) { - - renderList.pushUv( uvs[ i ], uvs[ i + 1 ] ); - - } - - } - - if ( geometry.index !== null ) { - - const indices = geometry.index.array; - - if ( groups.length > 0 ) { - - for ( let g = 0; g < groups.length; g ++ ) { - - const group = groups[ g ]; - - material = isMultiMaterial === true - ? object.material[ group.materialIndex ] - : object.material; - - if ( material === undefined ) continue; - - for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) { - - renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ], material ); - - } - - } - - } else { - - for ( let i = 0, l = indices.length; i < l; i += 3 ) { - - renderList.pushTriangle( indices[ i ], indices[ i + 1 ], indices[ i + 2 ], material ); - - } - - } - - } else { - - if ( groups.length > 0 ) { - - for ( let g = 0; g < groups.length; g ++ ) { - - const group = groups[ g ]; - - material = isMultiMaterial === true - ? object.material[ group.materialIndex ] - : object.material; - - if ( material === undefined ) continue; - - for ( let i = group.start, l = group.start + group.count; i < l; i += 3 ) { - - renderList.pushTriangle( i, i + 1, i + 2, material ); - - } - - } - - } else { - - for ( let i = 0, l = positions.length / 3; i < l; i += 3 ) { - - renderList.pushTriangle( i, i + 1, i + 2, material ); - - } - - } - - } - - } else if ( object.isLine ) { - - _modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix ); - - const attributes = geometry.attributes; - - if ( attributes.position !== undefined ) { - - const positions = attributes.position.array; - - for ( let i = 0, l = positions.length; i < l; i += 3 ) { - - renderList.pushVertex( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); - - } - - if ( attributes.color !== undefined ) { - - const colors = attributes.color.array; - - for ( let i = 0, l = colors.length; i < l; i += 3 ) { - - renderList.pushColor( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ); - - } - - } - - if ( geometry.index !== null ) { - - const indices = geometry.index.array; - - for ( let i = 0, l = indices.length; i < l; i += 2 ) { - - renderList.pushLine( indices[ i ], indices[ i + 1 ] ); - - } - - } else { - - const step = object.isLineSegments ? 2 : 1; - - for ( let i = 0, l = ( positions.length / 3 ) - 1; i < l; i += step ) { - - renderList.pushLine( i, i + 1 ); - - } - - } - - } - - } else if ( object.isPoints ) { - - _modelViewProjectionMatrix.multiplyMatrices( _viewProjectionMatrix, _modelMatrix ); - - const attributes = geometry.attributes; - - if ( attributes.position !== undefined ) { - - const positions = attributes.position.array; - - for ( let i = 0, l = positions.length; i < l; i += 3 ) { - - _vector4.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ], 1 ); - _vector4.applyMatrix4( _modelViewProjectionMatrix ); - - pushPoint( _vector4, object, camera ); - - } - - } - - } else if ( object.isSprite ) { - - object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld ); - _vector4.set( _modelMatrix.elements[ 12 ], _modelMatrix.elements[ 13 ], _modelMatrix.elements[ 14 ], 1 ); - _vector4.applyMatrix4( _viewProjectionMatrix ); - - pushPoint( _vector4, object, camera ); - - } - - } - - if ( sortElements === true ) { - - _renderData.elements.sort( painterSort ); - - } - - return _renderData; - - }; - - function pushPoint( _vector4, object, camera ) { - - const invW = 1 / _vector4.w; - - _vector4.z *= invW; - - if ( _vector4.z >= - 1 && _vector4.z <= 1 ) { - - _sprite = getNextSpriteInPool(); - _sprite.id = object.id; - _sprite.x = _vector4.x * invW; - _sprite.y = _vector4.y * invW; - _sprite.z = _vector4.z; - _sprite.renderOrder = object.renderOrder; - _sprite.object = object; - - _sprite.rotation = object.rotation; - - _sprite.scale.x = object.scale.x * Math.abs( _sprite.x - ( _vector4.x + camera.projectionMatrix.elements[ 0 ] ) / ( _vector4.w + camera.projectionMatrix.elements[ 12 ] ) ); - _sprite.scale.y = object.scale.y * Math.abs( _sprite.y - ( _vector4.y + camera.projectionMatrix.elements[ 5 ] ) / ( _vector4.w + camera.projectionMatrix.elements[ 13 ] ) ); - - _sprite.material = object.material; - - _renderData.elements.push( _sprite ); - - } - - } - - // Pools - - function getNextObjectInPool() { - - if ( _objectCount === _objectPoolLength ) { - - const object = new RenderableObject(); - _objectPool.push( object ); - _objectPoolLength ++; - _objectCount ++; - return object; - - } - - return _objectPool[ _objectCount ++ ]; - - } - - function getNextVertexInPool() { - - if ( _vertexCount === _vertexPoolLength ) { - - const vertex = new RenderableVertex(); - _vertexPool.push( vertex ); - _vertexPoolLength ++; - _vertexCount ++; - return vertex; - - } - - return _vertexPool[ _vertexCount ++ ]; - - } - - function getNextFaceInPool() { - - if ( _faceCount === _facePoolLength ) { - - const face = new RenderableFace(); - _facePool.push( face ); - _facePoolLength ++; - _faceCount ++; - return face; - - } - - return _facePool[ _faceCount ++ ]; - - - } - - function getNextLineInPool() { - - if ( _lineCount === _linePoolLength ) { - - const line = new RenderableLine(); - _linePool.push( line ); - _linePoolLength ++; - _lineCount ++; - return line; - - } - - return _linePool[ _lineCount ++ ]; - - } - - function getNextSpriteInPool() { - - if ( _spriteCount === _spritePoolLength ) { - - const sprite = new RenderableSprite(); - _spritePool.push( sprite ); - _spritePoolLength ++; - _spriteCount ++; - return sprite; - - } - - return _spritePool[ _spriteCount ++ ]; - - } - - // - - function painterSort( a, b ) { - - if ( a.renderOrder !== b.renderOrder ) { - - return a.renderOrder - b.renderOrder; - - } else if ( a.z !== b.z ) { - - return b.z - a.z; - - } else if ( a.id !== b.id ) { - - return a.id - b.id; - - } else { - - return 0; - - } - - } - - function clipLine( s1, s2 ) { - - let alpha1 = 0, alpha2 = 1; - - // Calculate the boundary coordinate of each vertex for the near and far clip planes, - // Z = -1 and Z = +1, respectively. - - const bc1near = s1.z + s1.w, - bc2near = s2.z + s2.w, - bc1far = - s1.z + s1.w, - bc2far = - s2.z + s2.w; - - if ( bc1near >= 0 && bc2near >= 0 && bc1far >= 0 && bc2far >= 0 ) { - - // Both vertices lie entirely within all clip planes. - return true; - - } else if ( ( bc1near < 0 && bc2near < 0 ) || ( bc1far < 0 && bc2far < 0 ) ) { - - // Both vertices lie entirely outside one of the clip planes. - return false; - - } else { - - // The line segment spans at least one clip plane. - - if ( bc1near < 0 ) { - - // v1 lies outside the near plane, v2 inside - alpha1 = Math.max( alpha1, bc1near / ( bc1near - bc2near ) ); - - } else if ( bc2near < 0 ) { - - // v2 lies outside the near plane, v1 inside - alpha2 = Math.min( alpha2, bc1near / ( bc1near - bc2near ) ); - - } - - if ( bc1far < 0 ) { - - // v1 lies outside the far plane, v2 inside - alpha1 = Math.max( alpha1, bc1far / ( bc1far - bc2far ) ); - - } else if ( bc2far < 0 ) { - - // v2 lies outside the far plane, v2 inside - alpha2 = Math.min( alpha2, bc1far / ( bc1far - bc2far ) ); - - } - - if ( alpha2 < alpha1 ) { - - // The line segment spans two boundaries, but is outside both of them. - // (This can't happen when we're only clipping against just near/far but good - // to leave the check here for future usage if other clip planes are added.) - return false; - - } else { - - // Update the s1 and s2 vertices to match the clipped line segment. - s1.lerp( s2, alpha1 ); - s2.lerp( s1, 1 - alpha2 ); - - return true; - - } - - } - - } - - } - -} - -export { RenderableObject, RenderableFace, RenderableVertex, RenderableLine, RenderableSprite, Projector }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/SVGRenderer.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/SVGRenderer.js deleted file mode 100644 index 2847204..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/renderers/SVGRenderer.js +++ /dev/null @@ -1,556 +0,0 @@ -import { - Box2, - Camera, - Color, - Matrix3, - Matrix4, - Object3D, - SRGBColorSpace, - Vector3 -} from '/static/javascript/three/build/three.module.js'; -import { Projector } from '../renderers/Projector.js'; -import { RenderableFace } from '../renderers/Projector.js'; -import { RenderableLine } from '../renderers/Projector.js'; -import { RenderableSprite } from '../renderers/Projector.js'; - -class SVGObject extends Object3D { - - constructor( node ) { - - super(); - - this.isSVGObject = true; - - this.node = node; - - } - -} - -class SVGRenderer { - - constructor() { - - let _renderData, _elements, _lights, - _svgWidth, _svgHeight, _svgWidthHalf, _svgHeightHalf, - - _v1, _v2, _v3, - - _svgNode, - _pathCount = 0, - - _precision = null, - _quality = 1, - - _currentPath, _currentStyle; - - const _this = this, - _clipBox = new Box2(), - _elemBox = new Box2(), - - _color = new Color(), - _diffuseColor = new Color(), - _ambientLight = new Color(), - _directionalLights = new Color(), - _pointLights = new Color(), - _clearColor = new Color(), - - _vector3 = new Vector3(), // Needed for PointLight - _centroid = new Vector3(), - _normal = new Vector3(), - _normalViewMatrix = new Matrix3(), - - _viewMatrix = new Matrix4(), - _viewProjectionMatrix = new Matrix4(), - - _svgPathPool = [], - - _projector = new Projector(), - _svg = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' ); - - this.domElement = _svg; - - this.autoClear = true; - this.sortObjects = true; - this.sortElements = true; - - this.overdraw = 0.5; - - this.outputColorSpace = SRGBColorSpace; - - this.info = { - - render: { - - vertices: 0, - faces: 0 - - } - - }; - - this.setQuality = function ( quality ) { - - switch ( quality ) { - - case 'high': _quality = 1; break; - case 'low': _quality = 0; break; - - } - - }; - - this.setClearColor = function ( color ) { - - _clearColor.set( color ); - - }; - - this.setPixelRatio = function () {}; - - this.setSize = function ( width, height ) { - - _svgWidth = width; _svgHeight = height; - _svgWidthHalf = _svgWidth / 2; _svgHeightHalf = _svgHeight / 2; - - _svg.setAttribute( 'viewBox', ( - _svgWidthHalf ) + ' ' + ( - _svgHeightHalf ) + ' ' + _svgWidth + ' ' + _svgHeight ); - _svg.setAttribute( 'width', _svgWidth ); - _svg.setAttribute( 'height', _svgHeight ); - - _clipBox.min.set( - _svgWidthHalf, - _svgHeightHalf ); - _clipBox.max.set( _svgWidthHalf, _svgHeightHalf ); - - }; - - this.getSize = function () { - - return { - width: _svgWidth, - height: _svgHeight - }; - - }; - - this.setPrecision = function ( precision ) { - - _precision = precision; - - }; - - function removeChildNodes() { - - _pathCount = 0; - - while ( _svg.childNodes.length > 0 ) { - - _svg.removeChild( _svg.childNodes[ 0 ] ); - - } - - } - - function convert( c ) { - - return _precision !== null ? c.toFixed( _precision ) : c; - - } - - this.clear = function () { - - removeChildNodes(); - _svg.style.backgroundColor = _clearColor.getStyle( _this.outputColorSpace ); - - }; - - this.render = function ( scene, camera ) { - - if ( camera instanceof Camera === false ) { - - console.error( 'THREE.SVGRenderer.render: camera is not an instance of Camera.' ); - return; - - } - - const background = scene.background; - - if ( background && background.isColor ) { - - removeChildNodes(); - _svg.style.backgroundColor = background.getStyle( _this.outputColorSpace ); - - } else if ( this.autoClear === true ) { - - this.clear(); - - } - - _this.info.render.vertices = 0; - _this.info.render.faces = 0; - - _viewMatrix.copy( camera.matrixWorldInverse ); - _viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, _viewMatrix ); - - _renderData = _projector.projectScene( scene, camera, this.sortObjects, this.sortElements ); - _elements = _renderData.elements; - _lights = _renderData.lights; - - _normalViewMatrix.getNormalMatrix( camera.matrixWorldInverse ); - - calculateLights( _lights ); - - // reset accumulated path - - _currentPath = ''; - _currentStyle = ''; - - for ( let e = 0, el = _elements.length; e < el; e ++ ) { - - const element = _elements[ e ]; - const material = element.material; - - if ( material === undefined || material.opacity === 0 ) continue; - - _elemBox.makeEmpty(); - - if ( element instanceof RenderableSprite ) { - - _v1 = element; - _v1.x *= _svgWidthHalf; _v1.y *= - _svgHeightHalf; - - renderSprite( _v1, element, material ); - - } else if ( element instanceof RenderableLine ) { - - _v1 = element.v1; _v2 = element.v2; - - _v1.positionScreen.x *= _svgWidthHalf; _v1.positionScreen.y *= - _svgHeightHalf; - _v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= - _svgHeightHalf; - - _elemBox.setFromPoints( [ _v1.positionScreen, _v2.positionScreen ] ); - - if ( _clipBox.intersectsBox( _elemBox ) === true ) { - - renderLine( _v1, _v2, material ); - - } - - } else if ( element instanceof RenderableFace ) { - - _v1 = element.v1; _v2 = element.v2; _v3 = element.v3; - - if ( _v1.positionScreen.z < - 1 || _v1.positionScreen.z > 1 ) continue; - if ( _v2.positionScreen.z < - 1 || _v2.positionScreen.z > 1 ) continue; - if ( _v3.positionScreen.z < - 1 || _v3.positionScreen.z > 1 ) continue; - - _v1.positionScreen.x *= _svgWidthHalf; _v1.positionScreen.y *= - _svgHeightHalf; - _v2.positionScreen.x *= _svgWidthHalf; _v2.positionScreen.y *= - _svgHeightHalf; - _v3.positionScreen.x *= _svgWidthHalf; _v3.positionScreen.y *= - _svgHeightHalf; - - if ( this.overdraw > 0 ) { - - expand( _v1.positionScreen, _v2.positionScreen, this.overdraw ); - expand( _v2.positionScreen, _v3.positionScreen, this.overdraw ); - expand( _v3.positionScreen, _v1.positionScreen, this.overdraw ); - - } - - _elemBox.setFromPoints( [ - _v1.positionScreen, - _v2.positionScreen, - _v3.positionScreen - ] ); - - if ( _clipBox.intersectsBox( _elemBox ) === true ) { - - renderFace3( _v1, _v2, _v3, element, material ); - - } - - } - - } - - flushPath(); // just to flush last svg:path - - scene.traverseVisible( function ( object ) { - - if ( object.isSVGObject ) { - - _vector3.setFromMatrixPosition( object.matrixWorld ); - _vector3.applyMatrix4( _viewProjectionMatrix ); - - if ( _vector3.z < - 1 || _vector3.z > 1 ) return; - - const x = _vector3.x * _svgWidthHalf; - const y = - _vector3.y * _svgHeightHalf; - - const node = object.node; - node.setAttribute( 'transform', 'translate(' + x + ',' + y + ')' ); - - _svg.appendChild( node ); - - } - - } ); - - }; - - function calculateLights( lights ) { - - _ambientLight.setRGB( 0, 0, 0 ); - _directionalLights.setRGB( 0, 0, 0 ); - _pointLights.setRGB( 0, 0, 0 ); - - for ( let l = 0, ll = lights.length; l < ll; l ++ ) { - - const light = lights[ l ]; - const lightColor = light.color; - - if ( light.isAmbientLight ) { - - _ambientLight.r += lightColor.r; - _ambientLight.g += lightColor.g; - _ambientLight.b += lightColor.b; - - } else if ( light.isDirectionalLight ) { - - _directionalLights.r += lightColor.r; - _directionalLights.g += lightColor.g; - _directionalLights.b += lightColor.b; - - } else if ( light.isPointLight ) { - - _pointLights.r += lightColor.r; - _pointLights.g += lightColor.g; - _pointLights.b += lightColor.b; - - } - - } - - } - - function calculateLight( lights, position, normal, color ) { - - for ( let l = 0, ll = lights.length; l < ll; l ++ ) { - - const light = lights[ l ]; - const lightColor = light.color; - - if ( light.isDirectionalLight ) { - - const lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld ).normalize(); - - let amount = normal.dot( lightPosition ); - - if ( amount <= 0 ) continue; - - amount *= light.intensity; - - color.r += lightColor.r * amount; - color.g += lightColor.g * amount; - color.b += lightColor.b * amount; - - } else if ( light.isPointLight ) { - - const lightPosition = _vector3.setFromMatrixPosition( light.matrixWorld ); - - let amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() ); - - if ( amount <= 0 ) continue; - - amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 ); - - if ( amount == 0 ) continue; - - amount *= light.intensity; - - color.r += lightColor.r * amount; - color.g += lightColor.g * amount; - color.b += lightColor.b * amount; - - } - - } - - } - - function renderSprite( v1, element, material ) { - - let scaleX = element.scale.x * _svgWidthHalf; - let scaleY = element.scale.y * _svgHeightHalf; - - if ( material.isPointsMaterial ) { - - scaleX *= material.size; - scaleY *= material.size; - - } - - const path = 'M' + convert( v1.x - scaleX * 0.5 ) + ',' + convert( v1.y - scaleY * 0.5 ) + 'h' + convert( scaleX ) + 'v' + convert( scaleY ) + 'h' + convert( - scaleX ) + 'z'; - let style = ''; - - if ( material.isSpriteMaterial || material.isPointsMaterial ) { - - style = 'fill:' + material.color.getStyle( _this.outputColorSpace ) + ';fill-opacity:' + material.opacity; - - } - - addPath( style, path ); - - } - - function renderLine( v1, v2, material ) { - - const path = 'M' + convert( v1.positionScreen.x ) + ',' + convert( v1.positionScreen.y ) + 'L' + convert( v2.positionScreen.x ) + ',' + convert( v2.positionScreen.y ); - - if ( material.isLineBasicMaterial ) { - - let style = 'fill:none;stroke:' + material.color.getStyle( _this.outputColorSpace ) + ';stroke-opacity:' + material.opacity + ';stroke-width:' + material.linewidth + ';stroke-linecap:' + material.linecap; - - if ( material.isLineDashedMaterial ) { - - style = style + ';stroke-dasharray:' + material.dashSize + ',' + material.gapSize; - - } - - addPath( style, path ); - - } - - } - - function renderFace3( v1, v2, v3, element, material ) { - - _this.info.render.vertices += 3; - _this.info.render.faces ++; - - const path = 'M' + convert( v1.positionScreen.x ) + ',' + convert( v1.positionScreen.y ) + 'L' + convert( v2.positionScreen.x ) + ',' + convert( v2.positionScreen.y ) + 'L' + convert( v3.positionScreen.x ) + ',' + convert( v3.positionScreen.y ) + 'z'; - let style = ''; - - if ( material.isMeshBasicMaterial ) { - - _color.copy( material.color ); - - if ( material.vertexColors ) { - - _color.multiply( element.color ); - - } - - } else if ( material.isMeshLambertMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial ) { - - _diffuseColor.copy( material.color ); - - if ( material.vertexColors ) { - - _diffuseColor.multiply( element.color ); - - } - - _color.copy( _ambientLight ); - - _centroid.copy( v1.positionWorld ).add( v2.positionWorld ).add( v3.positionWorld ).divideScalar( 3 ); - - calculateLight( _lights, _centroid, element.normalModel, _color ); - - _color.multiply( _diffuseColor ).add( material.emissive ); - - } else if ( material.isMeshNormalMaterial ) { - - _normal.copy( element.normalModel ).applyMatrix3( _normalViewMatrix ).normalize(); - - _color.setRGB( _normal.x, _normal.y, _normal.z ).multiplyScalar( 0.5 ).addScalar( 0.5 ); - - } - - if ( material.wireframe ) { - - style = 'fill:none;stroke:' + _color.getStyle( _this.outputColorSpace ) + ';stroke-opacity:' + material.opacity + ';stroke-width:' + material.wireframeLinewidth + ';stroke-linecap:' + material.wireframeLinecap + ';stroke-linejoin:' + material.wireframeLinejoin; - - } else { - - style = 'fill:' + _color.getStyle( _this.outputColorSpace ) + ';fill-opacity:' + material.opacity; - - } - - addPath( style, path ); - - } - - // Hide anti-alias gaps - - function expand( v1, v2, pixels ) { - - let x = v2.x - v1.x, y = v2.y - v1.y; - const det = x * x + y * y; - - if ( det === 0 ) return; - - const idet = pixels / Math.sqrt( det ); - - x *= idet; y *= idet; - - v2.x += x; v2.y += y; - v1.x -= x; v1.y -= y; - - } - - function addPath( style, path ) { - - if ( _currentStyle === style ) { - - _currentPath += path; - - } else { - - flushPath(); - - _currentStyle = style; - _currentPath = path; - - } - - } - - function flushPath() { - - if ( _currentPath ) { - - _svgNode = getPathNode( _pathCount ++ ); - _svgNode.setAttribute( 'd', _currentPath ); - _svgNode.setAttribute( 'style', _currentStyle ); - _svg.appendChild( _svgNode ); - - } - - _currentPath = ''; - _currentStyle = ''; - - } - - function getPathNode( id ) { - - if ( _svgPathPool[ id ] == null ) { - - _svgPathPool[ id ] = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' ); - - if ( _quality == 0 ) { - - _svgPathPool[ id ].setAttribute( 'shape-rendering', 'crispEdges' ); //optimizeSpeed - - } - - return _svgPathPool[ id ]; - - } - - return _svgPathPool[ id ]; - - } - - } - -} - -export { SVGObject, SVGRenderer }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/scene.js b/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/scene.js deleted file mode 100644 index fa18baa..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/offscreen/scene.js +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from '../../../build/three.module.js'; - -let camera, scene, renderer, group; - -function init( canvas, width, height, pixelRatio, path ) { - - camera = new THREE.PerspectiveCamera( 40, width / height, 1, 1000 ); - camera.position.z = 200; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog( 0x444466, 100, 400 ); - scene.background = new THREE.Color( 0x444466 ); - - group = new THREE.Group(); - scene.add( group ); - - // we don't use ImageLoader since it has a DOM dependency (HTML5 image element) - - const loader = new THREE.ImageBitmapLoader().setPath( path ); - loader.setOptions( { imageOrientation: 'flipY' } ); - loader.load( 'textures/matcaps/matcap-porcelain-white.jpg', function ( imageBitmap ) { - - const texture = new THREE.CanvasTexture( imageBitmap ); - - const geometry = new THREE.IcosahedronGeometry( 5, 8 ); - const materials = [ - new THREE.MeshMatcapMaterial( { color: 0xaa24df, matcap: texture } ), - new THREE.MeshMatcapMaterial( { color: 0x605d90, matcap: texture } ), - new THREE.MeshMatcapMaterial( { color: 0xe04a3f, matcap: texture } ), - new THREE.MeshMatcapMaterial( { color: 0xe30456, matcap: texture } ) - ]; - - for ( let i = 0; i < 100; i ++ ) { - - const material = materials[ i % materials.length ]; - const mesh = new THREE.Mesh( geometry, material ); - mesh.position.x = random() * 200 - 100; - mesh.position.y = random() * 200 - 100; - mesh.position.z = random() * 200 - 100; - mesh.scale.setScalar( random() + 1 ); - group.add( mesh ); - - } - - renderer = new THREE.WebGLRenderer( { antialias: true, canvas: canvas } ); - renderer.setPixelRatio( pixelRatio ); - renderer.setSize( width, height, false ); - - animate(); - - } ); - -} - -function animate() { - - // group.rotation.x = Date.now() / 4000; - group.rotation.y = - Date.now() / 4000; - - renderer.render( scene, camera ); - - if ( self.requestAnimationFrame ) { - - self.requestAnimationFrame( animate ); - - } else { - - // Firefox - - } - -} - -// PRNG - -let seed = 1; - -function random() { - - const x = Math.sin( seed ++ ) * 10000; - - return x - Math.floor( x ); - -} - -export default init; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/opentype.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/opentype.module.js deleted file mode 100644 index 7b5d64e..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/opentype.module.js +++ /dev/null @@ -1,14506 +0,0 @@ -/** - * https://opentype.js.org v1.3.4 | (c) Frederik De Bleser and other contributors | MIT License | Uses tiny-inflate by Devon Govett and string.prototype.codepointat polyfill by Mathias Bynens - */ - -/*! https://mths.be/codepointat v0.2.0 by @mathias */ -if (!String.prototype.codePointAt) { - (function() { - var defineProperty = (function() { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch(error) {} - return result; - }()); - var codePointAt = function(position) { - if (this == null) { - throw TypeError(); - } - var string = String(this); - var size = string.length; - // `ToInteger` - var index = position ? Number(position) : 0; - if (index != index) { // better `isNaN` - index = 0; - } - // Account for out-of-bounds indices: - if (index < 0 || index >= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - }; - if (defineProperty) { - defineProperty(String.prototype, 'codePointAt', { - 'value': codePointAt, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.codePointAt = codePointAt; - } - }()); -} - -var TINF_OK = 0; -var TINF_DATA_ERROR = -3; - -function Tree() { - this.table = new Uint16Array(16); /* table of code length counts */ - this.trans = new Uint16Array(288); /* code -> symbol translation table */ -} - -function Data(source, dest) { - this.source = source; - this.sourceIndex = 0; - this.tag = 0; - this.bitcount = 0; - - this.dest = dest; - this.destLen = 0; - - this.ltree = new Tree(); /* dynamic length/symbol tree */ - this.dtree = new Tree(); /* dynamic distance tree */ -} - -/* --------------------------------------------------- * - * -- uninitialized global data (static structures) -- * - * --------------------------------------------------- */ - -var sltree = new Tree(); -var sdtree = new Tree(); - -/* extra bits and base tables for length codes */ -var length_bits = new Uint8Array(30); -var length_base = new Uint16Array(30); - -/* extra bits and base tables for distance codes */ -var dist_bits = new Uint8Array(30); -var dist_base = new Uint16Array(30); - -/* special ordering of code length codes */ -var clcidx = new Uint8Array([ - 16, 17, 18, 0, 8, 7, 9, 6, - 10, 5, 11, 4, 12, 3, 13, 2, - 14, 1, 15 -]); - -/* used by tinf_decode_trees, avoids allocations every call */ -var code_tree = new Tree(); -var lengths = new Uint8Array(288 + 32); - -/* ----------------------- * - * -- utility functions -- * - * ----------------------- */ - -/* build extra bits and base tables */ -function tinf_build_bits_base(bits, base, delta, first) { - var i, sum; - - /* build bits table */ - for (i = 0; i < delta; ++i) { bits[i] = 0; } - for (i = 0; i < 30 - delta; ++i) { bits[i + delta] = i / delta | 0; } - - /* build base table */ - for (sum = first, i = 0; i < 30; ++i) { - base[i] = sum; - sum += 1 << bits[i]; - } -} - -/* build the fixed huffman trees */ -function tinf_build_fixed_trees(lt, dt) { - var i; - - /* build fixed length tree */ - for (i = 0; i < 7; ++i) { lt.table[i] = 0; } - - lt.table[7] = 24; - lt.table[8] = 152; - lt.table[9] = 112; - - for (i = 0; i < 24; ++i) { lt.trans[i] = 256 + i; } - for (i = 0; i < 144; ++i) { lt.trans[24 + i] = i; } - for (i = 0; i < 8; ++i) { lt.trans[24 + 144 + i] = 280 + i; } - for (i = 0; i < 112; ++i) { lt.trans[24 + 144 + 8 + i] = 144 + i; } - - /* build fixed distance tree */ - for (i = 0; i < 5; ++i) { dt.table[i] = 0; } - - dt.table[5] = 32; - - for (i = 0; i < 32; ++i) { dt.trans[i] = i; } -} - -/* given an array of code lengths, build a tree */ -var offs = new Uint16Array(16); - -function tinf_build_tree(t, lengths, off, num) { - var i, sum; - - /* clear code length count table */ - for (i = 0; i < 16; ++i) { t.table[i] = 0; } - - /* scan symbol lengths, and sum code length counts */ - for (i = 0; i < num; ++i) { t.table[lengths[off + i]]++; } - - t.table[0] = 0; - - /* compute offset table for distribution sort */ - for (sum = 0, i = 0; i < 16; ++i) { - offs[i] = sum; - sum += t.table[i]; - } - - /* create code->symbol translation table (symbols sorted by code) */ - for (i = 0; i < num; ++i) { - if (lengths[off + i]) { t.trans[offs[lengths[off + i]]++] = i; } - } -} - -/* ---------------------- * - * -- decode functions -- * - * ---------------------- */ - -/* get one bit from source stream */ -function tinf_getbit(d) { - /* check if tag is empty */ - if (!d.bitcount--) { - /* load next tag */ - d.tag = d.source[d.sourceIndex++]; - d.bitcount = 7; - } - - /* shift bit out of tag */ - var bit = d.tag & 1; - d.tag >>>= 1; - - return bit; -} - -/* read a num bit value from a stream and add base */ -function tinf_read_bits(d, num, base) { - if (!num) - { return base; } - - while (d.bitcount < 24) { - d.tag |= d.source[d.sourceIndex++] << d.bitcount; - d.bitcount += 8; - } - - var val = d.tag & (0xffff >>> (16 - num)); - d.tag >>>= num; - d.bitcount -= num; - return val + base; -} - -/* given a data stream and a tree, decode a symbol */ -function tinf_decode_symbol(d, t) { - while (d.bitcount < 24) { - d.tag |= d.source[d.sourceIndex++] << d.bitcount; - d.bitcount += 8; - } - - var sum = 0, cur = 0, len = 0; - var tag = d.tag; - - /* get more bits while code value is above sum */ - do { - cur = 2 * cur + (tag & 1); - tag >>>= 1; - ++len; - - sum += t.table[len]; - cur -= t.table[len]; - } while (cur >= 0); - - d.tag = tag; - d.bitcount -= len; - - return t.trans[sum + cur]; -} - -/* given a data stream, decode dynamic trees from it */ -function tinf_decode_trees(d, lt, dt) { - var hlit, hdist, hclen; - var i, num, length; - - /* get 5 bits HLIT (257-286) */ - hlit = tinf_read_bits(d, 5, 257); - - /* get 5 bits HDIST (1-32) */ - hdist = tinf_read_bits(d, 5, 1); - - /* get 4 bits HCLEN (4-19) */ - hclen = tinf_read_bits(d, 4, 4); - - for (i = 0; i < 19; ++i) { lengths[i] = 0; } - - /* read code lengths for code length alphabet */ - for (i = 0; i < hclen; ++i) { - /* get 3 bits code length (0-7) */ - var clen = tinf_read_bits(d, 3, 0); - lengths[clcidx[i]] = clen; - } - - /* build code length tree */ - tinf_build_tree(code_tree, lengths, 0, 19); - - /* decode code lengths for the dynamic trees */ - for (num = 0; num < hlit + hdist;) { - var sym = tinf_decode_symbol(d, code_tree); - - switch (sym) { - case 16: - /* copy previous code length 3-6 times (read 2 bits) */ - var prev = lengths[num - 1]; - for (length = tinf_read_bits(d, 2, 3); length; --length) { - lengths[num++] = prev; - } - break; - case 17: - /* repeat code length 0 for 3-10 times (read 3 bits) */ - for (length = tinf_read_bits(d, 3, 3); length; --length) { - lengths[num++] = 0; - } - break; - case 18: - /* repeat code length 0 for 11-138 times (read 7 bits) */ - for (length = tinf_read_bits(d, 7, 11); length; --length) { - lengths[num++] = 0; - } - break; - default: - /* values 0-15 represent the actual code lengths */ - lengths[num++] = sym; - break; - } - } - - /* build dynamic trees */ - tinf_build_tree(lt, lengths, 0, hlit); - tinf_build_tree(dt, lengths, hlit, hdist); -} - -/* ----------------------------- * - * -- block inflate functions -- * - * ----------------------------- */ - -/* given a stream and two trees, inflate a block of data */ -function tinf_inflate_block_data(d, lt, dt) { - while (1) { - var sym = tinf_decode_symbol(d, lt); - - /* check for end of block */ - if (sym === 256) { - return TINF_OK; - } - - if (sym < 256) { - d.dest[d.destLen++] = sym; - } else { - var length, dist, offs; - var i; - - sym -= 257; - - /* possibly get more bits from length code */ - length = tinf_read_bits(d, length_bits[sym], length_base[sym]); - - dist = tinf_decode_symbol(d, dt); - - /* possibly get more bits from distance code */ - offs = d.destLen - tinf_read_bits(d, dist_bits[dist], dist_base[dist]); - - /* copy match */ - for (i = offs; i < offs + length; ++i) { - d.dest[d.destLen++] = d.dest[i]; - } - } - } -} - -/* inflate an uncompressed block of data */ -function tinf_inflate_uncompressed_block(d) { - var length, invlength; - var i; - - /* unread from bitbuffer */ - while (d.bitcount > 8) { - d.sourceIndex--; - d.bitcount -= 8; - } - - /* get length */ - length = d.source[d.sourceIndex + 1]; - length = 256 * length + d.source[d.sourceIndex]; - - /* get one's complement of length */ - invlength = d.source[d.sourceIndex + 3]; - invlength = 256 * invlength + d.source[d.sourceIndex + 2]; - - /* check length */ - if (length !== (~invlength & 0x0000ffff)) - { return TINF_DATA_ERROR; } - - d.sourceIndex += 4; - - /* copy block */ - for (i = length; i; --i) - { d.dest[d.destLen++] = d.source[d.sourceIndex++]; } - - /* make sure we start next block on a byte boundary */ - d.bitcount = 0; - - return TINF_OK; -} - -/* inflate stream from source to dest */ -function tinf_uncompress(source, dest) { - var d = new Data(source, dest); - var bfinal, btype, res; - - do { - /* read final block flag */ - bfinal = tinf_getbit(d); - - /* read block type (2 bits) */ - btype = tinf_read_bits(d, 2, 0); - - /* decompress block */ - switch (btype) { - case 0: - /* decompress uncompressed block */ - res = tinf_inflate_uncompressed_block(d); - break; - case 1: - /* decompress block with fixed huffman trees */ - res = tinf_inflate_block_data(d, sltree, sdtree); - break; - case 2: - /* decompress block with dynamic huffman trees */ - tinf_decode_trees(d, d.ltree, d.dtree); - res = tinf_inflate_block_data(d, d.ltree, d.dtree); - break; - default: - res = TINF_DATA_ERROR; - } - - if (res !== TINF_OK) - { throw new Error('Data error'); } - - } while (!bfinal); - - if (d.destLen < d.dest.length) { - if (typeof d.dest.slice === 'function') - { return d.dest.slice(0, d.destLen); } - else - { return d.dest.subarray(0, d.destLen); } - } - - return d.dest; -} - -/* -------------------- * - * -- initialization -- * - * -------------------- */ - -/* build fixed huffman trees */ -tinf_build_fixed_trees(sltree, sdtree); - -/* build extra bits and base tables */ -tinf_build_bits_base(length_bits, length_base, 4, 3); -tinf_build_bits_base(dist_bits, dist_base, 2, 1); - -/* fix a special case */ -length_bits[28] = 0; -length_base[28] = 258; - -var tinyInflate = tinf_uncompress; - -// The Bounding Box object - -function derive(v0, v1, v2, v3, t) { - return Math.pow(1 - t, 3) * v0 + - 3 * Math.pow(1 - t, 2) * t * v1 + - 3 * (1 - t) * Math.pow(t, 2) * v2 + - Math.pow(t, 3) * v3; -} -/** - * A bounding box is an enclosing box that describes the smallest measure within which all the points lie. - * It is used to calculate the bounding box of a glyph or text path. - * - * On initialization, x1/y1/x2/y2 will be NaN. Check if the bounding box is empty using `isEmpty()`. - * - * @exports opentype.BoundingBox - * @class - * @constructor - */ -function BoundingBox() { - this.x1 = Number.NaN; - this.y1 = Number.NaN; - this.x2 = Number.NaN; - this.y2 = Number.NaN; -} - -/** - * Returns true if the bounding box is empty, that is, no points have been added to the box yet. - */ -BoundingBox.prototype.isEmpty = function() { - return isNaN(this.x1) || isNaN(this.y1) || isNaN(this.x2) || isNaN(this.y2); -}; - -/** - * Add the point to the bounding box. - * The x1/y1/x2/y2 coordinates of the bounding box will now encompass the given point. - * @param {number} x - The X coordinate of the point. - * @param {number} y - The Y coordinate of the point. - */ -BoundingBox.prototype.addPoint = function(x, y) { - if (typeof x === 'number') { - if (isNaN(this.x1) || isNaN(this.x2)) { - this.x1 = x; - this.x2 = x; - } - if (x < this.x1) { - this.x1 = x; - } - if (x > this.x2) { - this.x2 = x; - } - } - if (typeof y === 'number') { - if (isNaN(this.y1) || isNaN(this.y2)) { - this.y1 = y; - this.y2 = y; - } - if (y < this.y1) { - this.y1 = y; - } - if (y > this.y2) { - this.y2 = y; - } - } -}; - -/** - * Add a X coordinate to the bounding box. - * This extends the bounding box to include the X coordinate. - * This function is used internally inside of addBezier. - * @param {number} x - The X coordinate of the point. - */ -BoundingBox.prototype.addX = function(x) { - this.addPoint(x, null); -}; - -/** - * Add a Y coordinate to the bounding box. - * This extends the bounding box to include the Y coordinate. - * This function is used internally inside of addBezier. - * @param {number} y - The Y coordinate of the point. - */ -BoundingBox.prototype.addY = function(y) { - this.addPoint(null, y); -}; - -/** - * Add a Bézier curve to the bounding box. - * This extends the bounding box to include the entire Bézier. - * @param {number} x0 - The starting X coordinate. - * @param {number} y0 - The starting Y coordinate. - * @param {number} x1 - The X coordinate of the first control point. - * @param {number} y1 - The Y coordinate of the first control point. - * @param {number} x2 - The X coordinate of the second control point. - * @param {number} y2 - The Y coordinate of the second control point. - * @param {number} x - The ending X coordinate. - * @param {number} y - The ending Y coordinate. - */ -BoundingBox.prototype.addBezier = function(x0, y0, x1, y1, x2, y2, x, y) { - // This code is based on http://nishiohirokazu.blogspot.com/2009/06/how-to-calculate-bezier-curves-bounding.html - // and https://github.com/icons8/svg-path-bounding-box - - var p0 = [x0, y0]; - var p1 = [x1, y1]; - var p2 = [x2, y2]; - var p3 = [x, y]; - - this.addPoint(x0, y0); - this.addPoint(x, y); - - for (var i = 0; i <= 1; i++) { - var b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i]; - var a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i]; - var c = 3 * p1[i] - 3 * p0[i]; - - if (a === 0) { - if (b === 0) { continue; } - var t = -c / b; - if (0 < t && t < 1) { - if (i === 0) { this.addX(derive(p0[i], p1[i], p2[i], p3[i], t)); } - if (i === 1) { this.addY(derive(p0[i], p1[i], p2[i], p3[i], t)); } - } - continue; - } - - var b2ac = Math.pow(b, 2) - 4 * c * a; - if (b2ac < 0) { continue; } - var t1 = (-b + Math.sqrt(b2ac)) / (2 * a); - if (0 < t1 && t1 < 1) { - if (i === 0) { this.addX(derive(p0[i], p1[i], p2[i], p3[i], t1)); } - if (i === 1) { this.addY(derive(p0[i], p1[i], p2[i], p3[i], t1)); } - } - var t2 = (-b - Math.sqrt(b2ac)) / (2 * a); - if (0 < t2 && t2 < 1) { - if (i === 0) { this.addX(derive(p0[i], p1[i], p2[i], p3[i], t2)); } - if (i === 1) { this.addY(derive(p0[i], p1[i], p2[i], p3[i], t2)); } - } - } -}; - -/** - * Add a quadratic curve to the bounding box. - * This extends the bounding box to include the entire quadratic curve. - * @param {number} x0 - The starting X coordinate. - * @param {number} y0 - The starting Y coordinate. - * @param {number} x1 - The X coordinate of the control point. - * @param {number} y1 - The Y coordinate of the control point. - * @param {number} x - The ending X coordinate. - * @param {number} y - The ending Y coordinate. - */ -BoundingBox.prototype.addQuad = function(x0, y0, x1, y1, x, y) { - var cp1x = x0 + 2 / 3 * (x1 - x0); - var cp1y = y0 + 2 / 3 * (y1 - y0); - var cp2x = cp1x + 1 / 3 * (x - x0); - var cp2y = cp1y + 1 / 3 * (y - y0); - this.addBezier(x0, y0, cp1x, cp1y, cp2x, cp2y, x, y); -}; - -// Geometric objects - -/** - * A bézier path containing a set of path commands similar to a SVG path. - * Paths can be drawn on a context using `draw`. - * @exports opentype.Path - * @class - * @constructor - */ -function Path() { - this.commands = []; - this.fill = 'black'; - this.stroke = null; - this.strokeWidth = 1; -} - -/** - * @param {number} x - * @param {number} y - */ -Path.prototype.moveTo = function(x, y) { - this.commands.push({ - type: 'M', - x: x, - y: y - }); -}; - -/** - * @param {number} x - * @param {number} y - */ -Path.prototype.lineTo = function(x, y) { - this.commands.push({ - type: 'L', - x: x, - y: y - }); -}; - -/** - * Draws cubic curve - * @function - * curveTo - * @memberof opentype.Path.prototype - * @param {number} x1 - x of control 1 - * @param {number} y1 - y of control 1 - * @param {number} x2 - x of control 2 - * @param {number} y2 - y of control 2 - * @param {number} x - x of path point - * @param {number} y - y of path point - */ - -/** - * Draws cubic curve - * @function - * bezierCurveTo - * @memberof opentype.Path.prototype - * @param {number} x1 - x of control 1 - * @param {number} y1 - y of control 1 - * @param {number} x2 - x of control 2 - * @param {number} y2 - y of control 2 - * @param {number} x - x of path point - * @param {number} y - y of path point - * @see curveTo - */ -Path.prototype.curveTo = Path.prototype.bezierCurveTo = function(x1, y1, x2, y2, x, y) { - this.commands.push({ - type: 'C', - x1: x1, - y1: y1, - x2: x2, - y2: y2, - x: x, - y: y - }); -}; - -/** - * Draws quadratic curve - * @function - * quadraticCurveTo - * @memberof opentype.Path.prototype - * @param {number} x1 - x of control - * @param {number} y1 - y of control - * @param {number} x - x of path point - * @param {number} y - y of path point - */ - -/** - * Draws quadratic curve - * @function - * quadTo - * @memberof opentype.Path.prototype - * @param {number} x1 - x of control - * @param {number} y1 - y of control - * @param {number} x - x of path point - * @param {number} y - y of path point - */ -Path.prototype.quadTo = Path.prototype.quadraticCurveTo = function(x1, y1, x, y) { - this.commands.push({ - type: 'Q', - x1: x1, - y1: y1, - x: x, - y: y - }); -}; - -/** - * Closes the path - * @function closePath - * @memberof opentype.Path.prototype - */ - -/** - * Close the path - * @function close - * @memberof opentype.Path.prototype - */ -Path.prototype.close = Path.prototype.closePath = function() { - this.commands.push({ - type: 'Z' - }); -}; - -/** - * Add the given path or list of commands to the commands of this path. - * @param {Array} pathOrCommands - another opentype.Path, an opentype.BoundingBox, or an array of commands. - */ -Path.prototype.extend = function(pathOrCommands) { - if (pathOrCommands.commands) { - pathOrCommands = pathOrCommands.commands; - } else if (pathOrCommands instanceof BoundingBox) { - var box = pathOrCommands; - this.moveTo(box.x1, box.y1); - this.lineTo(box.x2, box.y1); - this.lineTo(box.x2, box.y2); - this.lineTo(box.x1, box.y2); - this.close(); - return; - } - - Array.prototype.push.apply(this.commands, pathOrCommands); -}; - -/** - * Calculate the bounding box of the path. - * @returns {opentype.BoundingBox} - */ -Path.prototype.getBoundingBox = function() { - var box = new BoundingBox(); - - var startX = 0; - var startY = 0; - var prevX = 0; - var prevY = 0; - for (var i = 0; i < this.commands.length; i++) { - var cmd = this.commands[i]; - switch (cmd.type) { - case 'M': - box.addPoint(cmd.x, cmd.y); - startX = prevX = cmd.x; - startY = prevY = cmd.y; - break; - case 'L': - box.addPoint(cmd.x, cmd.y); - prevX = cmd.x; - prevY = cmd.y; - break; - case 'Q': - box.addQuad(prevX, prevY, cmd.x1, cmd.y1, cmd.x, cmd.y); - prevX = cmd.x; - prevY = cmd.y; - break; - case 'C': - box.addBezier(prevX, prevY, cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y); - prevX = cmd.x; - prevY = cmd.y; - break; - case 'Z': - prevX = startX; - prevY = startY; - break; - default: - throw new Error('Unexpected path command ' + cmd.type); - } - } - if (box.isEmpty()) { - box.addPoint(0, 0); - } - return box; -}; - -/** - * Draw the path to a 2D context. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context. - */ -Path.prototype.draw = function(ctx) { - ctx.beginPath(); - for (var i = 0; i < this.commands.length; i += 1) { - var cmd = this.commands[i]; - if (cmd.type === 'M') { - ctx.moveTo(cmd.x, cmd.y); - } else if (cmd.type === 'L') { - ctx.lineTo(cmd.x, cmd.y); - } else if (cmd.type === 'C') { - ctx.bezierCurveTo(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y); - } else if (cmd.type === 'Q') { - ctx.quadraticCurveTo(cmd.x1, cmd.y1, cmd.x, cmd.y); - } else if (cmd.type === 'Z') { - ctx.closePath(); - } - } - - if (this.fill) { - ctx.fillStyle = this.fill; - ctx.fill(); - } - - if (this.stroke) { - ctx.strokeStyle = this.stroke; - ctx.lineWidth = this.strokeWidth; - ctx.stroke(); - } -}; - -/** - * Convert the Path to a string of path data instructions - * See http://www.w3.org/TR/SVG/paths.html#PathData - * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values - * @return {string} - */ -Path.prototype.toPathData = function(decimalPlaces) { - decimalPlaces = decimalPlaces !== undefined ? decimalPlaces : 2; - - function floatToString(v) { - if (Math.round(v) === v) { - return '' + Math.round(v); - } else { - return v.toFixed(decimalPlaces); - } - } - - function packValues() { - var arguments$1 = arguments; - - var s = ''; - for (var i = 0; i < arguments.length; i += 1) { - var v = arguments$1[i]; - if (v >= 0 && i > 0) { - s += ' '; - } - - s += floatToString(v); - } - - return s; - } - - var d = ''; - for (var i = 0; i < this.commands.length; i += 1) { - var cmd = this.commands[i]; - if (cmd.type === 'M') { - d += 'M' + packValues(cmd.x, cmd.y); - } else if (cmd.type === 'L') { - d += 'L' + packValues(cmd.x, cmd.y); - } else if (cmd.type === 'C') { - d += 'C' + packValues(cmd.x1, cmd.y1, cmd.x2, cmd.y2, cmd.x, cmd.y); - } else if (cmd.type === 'Q') { - d += 'Q' + packValues(cmd.x1, cmd.y1, cmd.x, cmd.y); - } else if (cmd.type === 'Z') { - d += 'Z'; - } - } - - return d; -}; - -/** - * Convert the path to an SVG element, as a string. - * @param {number} [decimalPlaces=2] - The amount of decimal places for floating-point values - * @return {string} - */ -Path.prototype.toSVG = function(decimalPlaces) { - var svg = '= 0 && v <= 255, 'Byte value should be between 0 and 255.'); - return [v]; -}; -/** - * @constant - * @type {number} - */ -sizeOf.BYTE = constant(1); - -/** - * Convert a 8-bit signed integer to a list of 1 byte. - * @param {string} - * @returns {Array} - */ -encode.CHAR = function(v) { - return [v.charCodeAt(0)]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.CHAR = constant(1); - -/** - * Convert an ASCII string to a list of bytes. - * @param {string} - * @returns {Array} - */ -encode.CHARARRAY = function(v) { - if (typeof v === 'undefined') { - v = ''; - console.warn('Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name.'); - } - var b = []; - for (var i = 0; i < v.length; i += 1) { - b[i] = v.charCodeAt(i); - } - - return b; -}; - -/** - * @param {Array} - * @returns {number} - */ -sizeOf.CHARARRAY = function(v) { - if (typeof v === 'undefined') { - return 0; - } - return v.length; -}; - -/** - * Convert a 16-bit unsigned integer to a list of 2 bytes. - * @param {number} - * @returns {Array} - */ -encode.USHORT = function(v) { - return [(v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.USHORT = constant(2); - -/** - * Convert a 16-bit signed integer to a list of 2 bytes. - * @param {number} - * @returns {Array} - */ -encode.SHORT = function(v) { - // Two's complement - if (v >= LIMIT16) { - v = -(2 * LIMIT16 - v); - } - - return [(v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.SHORT = constant(2); - -/** - * Convert a 24-bit unsigned integer to a list of 3 bytes. - * @param {number} - * @returns {Array} - */ -encode.UINT24 = function(v) { - return [(v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.UINT24 = constant(3); - -/** - * Convert a 32-bit unsigned integer to a list of 4 bytes. - * @param {number} - * @returns {Array} - */ -encode.ULONG = function(v) { - return [(v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.ULONG = constant(4); - -/** - * Convert a 32-bit unsigned integer to a list of 4 bytes. - * @param {number} - * @returns {Array} - */ -encode.LONG = function(v) { - // Two's complement - if (v >= LIMIT32) { - v = -(2 * LIMIT32 - v); - } - - return [(v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.LONG = constant(4); - -encode.FIXED = encode.ULONG; -sizeOf.FIXED = sizeOf.ULONG; - -encode.FWORD = encode.SHORT; -sizeOf.FWORD = sizeOf.SHORT; - -encode.UFWORD = encode.USHORT; -sizeOf.UFWORD = sizeOf.USHORT; - -/** - * Convert a 32-bit Apple Mac timestamp integer to a list of 8 bytes, 64-bit timestamp. - * @param {number} - * @returns {Array} - */ -encode.LONGDATETIME = function(v) { - return [0, 0, 0, 0, (v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.LONGDATETIME = constant(8); - -/** - * Convert a 4-char tag to a list of 4 bytes. - * @param {string} - * @returns {Array} - */ -encode.TAG = function(v) { - check.argument(v.length === 4, 'Tag should be exactly 4 ASCII characters.'); - return [v.charCodeAt(0), - v.charCodeAt(1), - v.charCodeAt(2), - v.charCodeAt(3)]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.TAG = constant(4); - -// CFF data types /////////////////////////////////////////////////////////// - -encode.Card8 = encode.BYTE; -sizeOf.Card8 = sizeOf.BYTE; - -encode.Card16 = encode.USHORT; -sizeOf.Card16 = sizeOf.USHORT; - -encode.OffSize = encode.BYTE; -sizeOf.OffSize = sizeOf.BYTE; - -encode.SID = encode.USHORT; -sizeOf.SID = sizeOf.USHORT; - -// Convert a numeric operand or charstring number to a variable-size list of bytes. -/** - * Convert a numeric operand or charstring number to a variable-size list of bytes. - * @param {number} - * @returns {Array} - */ -encode.NUMBER = function(v) { - if (v >= -107 && v <= 107) { - return [v + 139]; - } else if (v >= 108 && v <= 1131) { - v = v - 108; - return [(v >> 8) + 247, v & 0xFF]; - } else if (v >= -1131 && v <= -108) { - v = -v - 108; - return [(v >> 8) + 251, v & 0xFF]; - } else if (v >= -32768 && v <= 32767) { - return encode.NUMBER16(v); - } else { - return encode.NUMBER32(v); - } -}; - -/** - * @param {number} - * @returns {number} - */ -sizeOf.NUMBER = function(v) { - return encode.NUMBER(v).length; -}; - -/** - * Convert a signed number between -32768 and +32767 to a three-byte value. - * This ensures we always use three bytes, but is not the most compact format. - * @param {number} - * @returns {Array} - */ -encode.NUMBER16 = function(v) { - return [28, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.NUMBER16 = constant(3); - -/** - * Convert a signed number between -(2^31) and +(2^31-1) to a five-byte value. - * This is useful if you want to be sure you always use four bytes, - * at the expense of wasting a few bytes for smaller numbers. - * @param {number} - * @returns {Array} - */ -encode.NUMBER32 = function(v) { - return [29, (v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]; -}; - -/** - * @constant - * @type {number} - */ -sizeOf.NUMBER32 = constant(5); - -/** - * @param {number} - * @returns {Array} - */ -encode.REAL = function(v) { - var value = v.toString(); - - // Some numbers use an epsilon to encode the value. (e.g. JavaScript will store 0.0000001 as 1e-7) - // This code converts it back to a number without the epsilon. - var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value); - if (m) { - var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length)); - value = (Math.round(v * epsilon) / epsilon).toString(); - } - - var nibbles = ''; - for (var i = 0, ii = value.length; i < ii; i += 1) { - var c = value[i]; - if (c === 'e') { - nibbles += value[++i] === '-' ? 'c' : 'b'; - } else if (c === '.') { - nibbles += 'a'; - } else if (c === '-') { - nibbles += 'e'; - } else { - nibbles += c; - } - } - - nibbles += (nibbles.length & 1) ? 'f' : 'ff'; - var out = [30]; - for (var i$1 = 0, ii$1 = nibbles.length; i$1 < ii$1; i$1 += 2) { - out.push(parseInt(nibbles.substr(i$1, 2), 16)); - } - - return out; -}; - -/** - * @param {number} - * @returns {number} - */ -sizeOf.REAL = function(v) { - return encode.REAL(v).length; -}; - -encode.NAME = encode.CHARARRAY; -sizeOf.NAME = sizeOf.CHARARRAY; - -encode.STRING = encode.CHARARRAY; -sizeOf.STRING = sizeOf.CHARARRAY; - -/** - * @param {DataView} data - * @param {number} offset - * @param {number} numBytes - * @returns {string} - */ -decode.UTF8 = function(data, offset, numBytes) { - var codePoints = []; - var numChars = numBytes; - for (var j = 0; j < numChars; j++, offset += 1) { - codePoints[j] = data.getUint8(offset); - } - - return String.fromCharCode.apply(null, codePoints); -}; - -/** - * @param {DataView} data - * @param {number} offset - * @param {number} numBytes - * @returns {string} - */ -decode.UTF16 = function(data, offset, numBytes) { - var codePoints = []; - var numChars = numBytes / 2; - for (var j = 0; j < numChars; j++, offset += 2) { - codePoints[j] = data.getUint16(offset); - } - - return String.fromCharCode.apply(null, codePoints); -}; - -/** - * Convert a JavaScript string to UTF16-BE. - * @param {string} - * @returns {Array} - */ -encode.UTF16 = function(v) { - var b = []; - for (var i = 0; i < v.length; i += 1) { - var codepoint = v.charCodeAt(i); - b[b.length] = (codepoint >> 8) & 0xFF; - b[b.length] = codepoint & 0xFF; - } - - return b; -}; - -/** - * @param {string} - * @returns {number} - */ -sizeOf.UTF16 = function(v) { - return v.length * 2; -}; - -// Data for converting old eight-bit Macintosh encodings to Unicode. -// This representation is optimized for decoding; encoding is slower -// and needs more memory. The assumption is that all opentype.js users -// want to open fonts, but saving a font will be comparatively rare -// so it can be more expensive. Keyed by IANA character set name. -// -// Python script for generating these strings: -// -// s = u''.join([chr(c).decode('mac_greek') for c in range(128, 256)]) -// print(s.encode('utf-8')) -/** - * @private - */ -var eightBitMacEncodings = { - 'x-mac-croatian': // Python: 'mac_croatian' - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø' + - '¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ', - 'x-mac-cyrillic': // Python: 'mac_cyrillic' - 'АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњ' + - 'јЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю', - 'x-mac-gaelic': // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/GAELIC.TXT - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæø' + - 'ṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ', - 'x-mac-greek': // Python: 'mac_greek' - 'Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩ' + - 'άΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ\u00AD', - 'x-mac-icelandic': // Python: 'mac_iceland' - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + - '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', - 'x-mac-inuit': // http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/INUIT.TXT - 'ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗ' + - 'ᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł', - 'x-mac-ce': // Python: 'mac_latin2' - 'ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅ' + - 'ņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ', - macintosh: // Python: 'mac_roman' - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + - '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', - 'x-mac-romanian': // Python: 'mac_romanian' - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș' + - '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ', - 'x-mac-turkish': // Python: 'mac_turkish' - 'ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø' + - '¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ' -}; - -/** - * Decodes an old-style Macintosh string. Returns either a Unicode JavaScript - * string, or 'undefined' if the encoding is unsupported. For example, we do - * not support Chinese, Japanese or Korean because these would need large - * mapping tables. - * @param {DataView} dataView - * @param {number} offset - * @param {number} dataLength - * @param {string} encoding - * @returns {string} - */ -decode.MACSTRING = function(dataView, offset, dataLength, encoding) { - var table = eightBitMacEncodings[encoding]; - if (table === undefined) { - return undefined; - } - - var result = ''; - for (var i = 0; i < dataLength; i++) { - var c = dataView.getUint8(offset + i); - // In all eight-bit Mac encodings, the characters 0x00..0x7F are - // mapped to U+0000..U+007F; we only need to look up the others. - if (c <= 0x7F) { - result += String.fromCharCode(c); - } else { - result += table[c & 0x7F]; - } - } - - return result; -}; - -// Helper function for encode.MACSTRING. Returns a dictionary for mapping -// Unicode character codes to their 8-bit MacOS equivalent. This table -// is not exactly a super cheap data structure, but we do not care because -// encoding Macintosh strings is only rarely needed in typical applications. -var macEncodingTableCache = typeof WeakMap === 'function' && new WeakMap(); -var macEncodingCacheKeys; -var getMacEncodingTable = function (encoding) { - // Since we use encoding as a cache key for WeakMap, it has to be - // a String object and not a literal. And at least on NodeJS 2.10.1, - // WeakMap requires that the same String instance is passed for cache hits. - if (!macEncodingCacheKeys) { - macEncodingCacheKeys = {}; - for (var e in eightBitMacEncodings) { - /*jshint -W053 */ // Suppress "Do not use String as a constructor." - macEncodingCacheKeys[e] = new String(e); - } - } - - var cacheKey = macEncodingCacheKeys[encoding]; - if (cacheKey === undefined) { - return undefined; - } - - // We can't do "if (cache.has(key)) {return cache.get(key)}" here: - // since garbage collection may run at any time, it could also kick in - // between the calls to cache.has() and cache.get(). In that case, - // we would return 'undefined' even though we do support the encoding. - if (macEncodingTableCache) { - var cachedTable = macEncodingTableCache.get(cacheKey); - if (cachedTable !== undefined) { - return cachedTable; - } - } - - var decodingTable = eightBitMacEncodings[encoding]; - if (decodingTable === undefined) { - return undefined; - } - - var encodingTable = {}; - for (var i = 0; i < decodingTable.length; i++) { - encodingTable[decodingTable.charCodeAt(i)] = i + 0x80; - } - - if (macEncodingTableCache) { - macEncodingTableCache.set(cacheKey, encodingTable); - } - - return encodingTable; -}; - -/** - * Encodes an old-style Macintosh string. Returns a byte array upon success. - * If the requested encoding is unsupported, or if the input string contains - * a character that cannot be expressed in the encoding, the function returns - * 'undefined'. - * @param {string} str - * @param {string} encoding - * @returns {Array} - */ -encode.MACSTRING = function(str, encoding) { - var table = getMacEncodingTable(encoding); - if (table === undefined) { - return undefined; - } - - var result = []; - for (var i = 0; i < str.length; i++) { - var c = str.charCodeAt(i); - - // In all eight-bit Mac encodings, the characters 0x00..0x7F are - // mapped to U+0000..U+007F; we only need to look up the others. - if (c >= 0x80) { - c = table[c]; - if (c === undefined) { - // str contains a Unicode character that cannot be encoded - // in the requested encoding. - return undefined; - } - } - result[i] = c; - // result.push(c); - } - - return result; -}; - -/** - * @param {string} str - * @param {string} encoding - * @returns {number} - */ -sizeOf.MACSTRING = function(str, encoding) { - var b = encode.MACSTRING(str, encoding); - if (b !== undefined) { - return b.length; - } else { - return 0; - } -}; - -// Helper for encode.VARDELTAS -function isByteEncodable(value) { - return value >= -128 && value <= 127; -} - -// Helper for encode.VARDELTAS -function encodeVarDeltaRunAsZeroes(deltas, pos, result) { - var runLength = 0; - var numDeltas = deltas.length; - while (pos < numDeltas && runLength < 64 && deltas[pos] === 0) { - ++pos; - ++runLength; - } - result.push(0x80 | (runLength - 1)); - return pos; -} - -// Helper for encode.VARDELTAS -function encodeVarDeltaRunAsBytes(deltas, offset, result) { - var runLength = 0; - var numDeltas = deltas.length; - var pos = offset; - while (pos < numDeltas && runLength < 64) { - var value = deltas[pos]; - if (!isByteEncodable(value)) { - break; - } - - // Within a byte-encoded run of deltas, a single zero is best - // stored literally as 0x00 value. However, if we have two or - // more zeroes in a sequence, it is better to start a new run. - // Fore example, the sequence of deltas [15, 15, 0, 15, 15] - // becomes 6 bytes (04 0F 0F 00 0F 0F) when storing the zero - // within the current run, but 7 bytes (01 0F 0F 80 01 0F 0F) - // when starting a new run. - if (value === 0 && pos + 1 < numDeltas && deltas[pos + 1] === 0) { - break; - } - - ++pos; - ++runLength; - } - result.push(runLength - 1); - for (var i = offset; i < pos; ++i) { - result.push((deltas[i] + 256) & 0xff); - } - return pos; -} - -// Helper for encode.VARDELTAS -function encodeVarDeltaRunAsWords(deltas, offset, result) { - var runLength = 0; - var numDeltas = deltas.length; - var pos = offset; - while (pos < numDeltas && runLength < 64) { - var value = deltas[pos]; - - // Within a word-encoded run of deltas, it is easiest to start - // a new run (with a different encoding) whenever we encounter - // a zero value. For example, the sequence [0x6666, 0, 0x7777] - // needs 7 bytes when storing the zero inside the current run - // (42 66 66 00 00 77 77), and equally 7 bytes when starting a - // new run (40 66 66 80 40 77 77). - if (value === 0) { - break; - } - - // Within a word-encoded run of deltas, a single value in the - // range (-128..127) should be encoded within the current run - // because it is more compact. For example, the sequence - // [0x6666, 2, 0x7777] becomes 7 bytes when storing the value - // literally (42 66 66 00 02 77 77), but 8 bytes when starting - // a new run (40 66 66 00 02 40 77 77). - if (isByteEncodable(value) && pos + 1 < numDeltas && isByteEncodable(deltas[pos + 1])) { - break; - } - - ++pos; - ++runLength; - } - result.push(0x40 | (runLength - 1)); - for (var i = offset; i < pos; ++i) { - var val = deltas[i]; - result.push(((val + 0x10000) >> 8) & 0xff, (val + 0x100) & 0xff); - } - return pos; -} - -/** - * Encode a list of variation adjustment deltas. - * - * Variation adjustment deltas are used in ‘gvar’ and ‘cvar’ tables. - * They indicate how points (in ‘gvar’) or values (in ‘cvar’) get adjusted - * when generating instances of variation fonts. - * - * @see https://www.microsoft.com/typography/otspec/gvar.htm - * @see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gvar.html - * @param {Array} - * @return {Array} - */ -encode.VARDELTAS = function(deltas) { - var pos = 0; - var result = []; - while (pos < deltas.length) { - var value = deltas[pos]; - if (value === 0) { - pos = encodeVarDeltaRunAsZeroes(deltas, pos, result); - } else if (value >= -128 && value <= 127) { - pos = encodeVarDeltaRunAsBytes(deltas, pos, result); - } else { - pos = encodeVarDeltaRunAsWords(deltas, pos, result); - } - } - return result; -}; - -// Convert a list of values to a CFF INDEX structure. -// The values should be objects containing name / type / value. -/** - * @param {Array} l - * @returns {Array} - */ -encode.INDEX = function(l) { - //var offset, offsets, offsetEncoder, encodedOffsets, encodedOffset, data, - // i, v; - // Because we have to know which data type to use to encode the offsets, - // we have to go through the values twice: once to encode the data and - // calculate the offsets, then again to encode the offsets using the fitting data type. - var offset = 1; // First offset is always 1. - var offsets = [offset]; - var data = []; - for (var i = 0; i < l.length; i += 1) { - var v = encode.OBJECT(l[i]); - Array.prototype.push.apply(data, v); - offset += v.length; - offsets.push(offset); - } - - if (data.length === 0) { - return [0, 0]; - } - - var encodedOffsets = []; - var offSize = (1 + Math.floor(Math.log(offset) / Math.log(2)) / 8) | 0; - var offsetEncoder = [undefined, encode.BYTE, encode.USHORT, encode.UINT24, encode.ULONG][offSize]; - for (var i$1 = 0; i$1 < offsets.length; i$1 += 1) { - var encodedOffset = offsetEncoder(offsets[i$1]); - Array.prototype.push.apply(encodedOffsets, encodedOffset); - } - - return Array.prototype.concat(encode.Card16(l.length), - encode.OffSize(offSize), - encodedOffsets, - data); -}; - -/** - * @param {Array} - * @returns {number} - */ -sizeOf.INDEX = function(v) { - return encode.INDEX(v).length; -}; - -/** - * Convert an object to a CFF DICT structure. - * The keys should be numeric. - * The values should be objects containing name / type / value. - * @param {Object} m - * @returns {Array} - */ -encode.DICT = function(m) { - var d = []; - var keys = Object.keys(m); - var length = keys.length; - - for (var i = 0; i < length; i += 1) { - // Object.keys() return string keys, but our keys are always numeric. - var k = parseInt(keys[i], 0); - var v = m[k]; - // Value comes before the key. - d = d.concat(encode.OPERAND(v.value, v.type)); - d = d.concat(encode.OPERATOR(k)); - } - - return d; -}; - -/** - * @param {Object} - * @returns {number} - */ -sizeOf.DICT = function(m) { - return encode.DICT(m).length; -}; - -/** - * @param {number} - * @returns {Array} - */ -encode.OPERATOR = function(v) { - if (v < 1200) { - return [v]; - } else { - return [12, v - 1200]; - } -}; - -/** - * @param {Array} v - * @param {string} - * @returns {Array} - */ -encode.OPERAND = function(v, type) { - var d = []; - if (Array.isArray(type)) { - for (var i = 0; i < type.length; i += 1) { - check.argument(v.length === type.length, 'Not enough arguments given for type' + type); - d = d.concat(encode.OPERAND(v[i], type[i])); - } - } else { - if (type === 'SID') { - d = d.concat(encode.NUMBER(v)); - } else if (type === 'offset') { - // We make it easy for ourselves and always encode offsets as - // 4 bytes. This makes offset calculation for the top dict easier. - d = d.concat(encode.NUMBER32(v)); - } else if (type === 'number') { - d = d.concat(encode.NUMBER(v)); - } else if (type === 'real') { - d = d.concat(encode.REAL(v)); - } else { - throw new Error('Unknown operand type ' + type); - // FIXME Add support for booleans - } - } - - return d; -}; - -encode.OP = encode.BYTE; -sizeOf.OP = sizeOf.BYTE; - -// memoize charstring encoding using WeakMap if available -var wmm = typeof WeakMap === 'function' && new WeakMap(); - -/** - * Convert a list of CharString operations to bytes. - * @param {Array} - * @returns {Array} - */ -encode.CHARSTRING = function(ops) { - // See encode.MACSTRING for why we don't do "if (wmm && wmm.has(ops))". - if (wmm) { - var cachedValue = wmm.get(ops); - if (cachedValue !== undefined) { - return cachedValue; - } - } - - var d = []; - var length = ops.length; - - for (var i = 0; i < length; i += 1) { - var op = ops[i]; - d = d.concat(encode[op.type](op.value)); - } - - if (wmm) { - wmm.set(ops, d); - } - - return d; -}; - -/** - * @param {Array} - * @returns {number} - */ -sizeOf.CHARSTRING = function(ops) { - return encode.CHARSTRING(ops).length; -}; - -// Utility functions //////////////////////////////////////////////////////// - -/** - * Convert an object containing name / type / value to bytes. - * @param {Object} - * @returns {Array} - */ -encode.OBJECT = function(v) { - var encodingFunction = encode[v.type]; - check.argument(encodingFunction !== undefined, 'No encoding function for type ' + v.type); - return encodingFunction(v.value); -}; - -/** - * @param {Object} - * @returns {number} - */ -sizeOf.OBJECT = function(v) { - var sizeOfFunction = sizeOf[v.type]; - check.argument(sizeOfFunction !== undefined, 'No sizeOf function for type ' + v.type); - return sizeOfFunction(v.value); -}; - -/** - * Convert a table object to bytes. - * A table contains a list of fields containing the metadata (name, type and default value). - * The table itself has the field values set as attributes. - * @param {opentype.Table} - * @returns {Array} - */ -encode.TABLE = function(table) { - var d = []; - var length = table.fields.length; - var subtables = []; - var subtableOffsets = []; - - for (var i = 0; i < length; i += 1) { - var field = table.fields[i]; - var encodingFunction = encode[field.type]; - check.argument(encodingFunction !== undefined, 'No encoding function for field type ' + field.type + ' (' + field.name + ')'); - var value = table[field.name]; - if (value === undefined) { - value = field.value; - } - - var bytes = encodingFunction(value); - - if (field.type === 'TABLE') { - subtableOffsets.push(d.length); - d = d.concat([0, 0]); - subtables.push(bytes); - } else { - d = d.concat(bytes); - } - } - - for (var i$1 = 0; i$1 < subtables.length; i$1 += 1) { - var o = subtableOffsets[i$1]; - var offset = d.length; - check.argument(offset < 65536, 'Table ' + table.tableName + ' too big.'); - d[o] = offset >> 8; - d[o + 1] = offset & 0xff; - d = d.concat(subtables[i$1]); - } - - return d; -}; - -/** - * @param {opentype.Table} - * @returns {number} - */ -sizeOf.TABLE = function(table) { - var numBytes = 0; - var length = table.fields.length; - - for (var i = 0; i < length; i += 1) { - var field = table.fields[i]; - var sizeOfFunction = sizeOf[field.type]; - check.argument(sizeOfFunction !== undefined, 'No sizeOf function for field type ' + field.type + ' (' + field.name + ')'); - var value = table[field.name]; - if (value === undefined) { - value = field.value; - } - - numBytes += sizeOfFunction(value); - - // Subtables take 2 more bytes for offsets. - if (field.type === 'TABLE') { - numBytes += 2; - } - } - - return numBytes; -}; - -encode.RECORD = encode.TABLE; -sizeOf.RECORD = sizeOf.TABLE; - -// Merge in a list of bytes. -encode.LITERAL = function(v) { - return v; -}; - -sizeOf.LITERAL = function(v) { - return v.length; -}; - -// Table metadata - -/** - * @exports opentype.Table - * @class - * @param {string} tableName - * @param {Array} fields - * @param {Object} options - * @constructor - */ -function Table(tableName, fields, options) { - // For coverage tables with coverage format 2, we do not want to add the coverage data directly to the table object, - // as this will result in wrong encoding order of the coverage data on serialization to bytes. - // The fallback of using the field values directly when not present on the table is handled in types.encode.TABLE() already. - if (fields.length && (fields[0].name !== 'coverageFormat' || fields[0].value === 1)) { - for (var i = 0; i < fields.length; i += 1) { - var field = fields[i]; - this[field.name] = field.value; - } - } - - this.tableName = tableName; - this.fields = fields; - if (options) { - var optionKeys = Object.keys(options); - for (var i$1 = 0; i$1 < optionKeys.length; i$1 += 1) { - var k = optionKeys[i$1]; - var v = options[k]; - if (this[k] !== undefined) { - this[k] = v; - } - } - } -} - -/** - * Encodes the table and returns an array of bytes - * @return {Array} - */ -Table.prototype.encode = function() { - return encode.TABLE(this); -}; - -/** - * Get the size of the table. - * @return {number} - */ -Table.prototype.sizeOf = function() { - return sizeOf.TABLE(this); -}; - -/** - * @private - */ -function ushortList(itemName, list, count) { - if (count === undefined) { - count = list.length; - } - var fields = new Array(list.length + 1); - fields[0] = {name: itemName + 'Count', type: 'USHORT', value: count}; - for (var i = 0; i < list.length; i++) { - fields[i + 1] = {name: itemName + i, type: 'USHORT', value: list[i]}; - } - return fields; -} - -/** - * @private - */ -function tableList(itemName, records, itemCallback) { - var count = records.length; - var fields = new Array(count + 1); - fields[0] = {name: itemName + 'Count', type: 'USHORT', value: count}; - for (var i = 0; i < count; i++) { - fields[i + 1] = {name: itemName + i, type: 'TABLE', value: itemCallback(records[i], i)}; - } - return fields; -} - -/** - * @private - */ -function recordList(itemName, records, itemCallback) { - var count = records.length; - var fields = []; - fields[0] = {name: itemName + 'Count', type: 'USHORT', value: count}; - for (var i = 0; i < count; i++) { - fields = fields.concat(itemCallback(records[i], i)); - } - return fields; -} - -// Common Layout Tables - -/** - * @exports opentype.Coverage - * @class - * @param {opentype.Table} - * @constructor - * @extends opentype.Table - */ -function Coverage(coverageTable) { - if (coverageTable.format === 1) { - Table.call(this, 'coverageTable', - [{name: 'coverageFormat', type: 'USHORT', value: 1}] - .concat(ushortList('glyph', coverageTable.glyphs)) - ); - } else if (coverageTable.format === 2) { - Table.call(this, 'coverageTable', - [{name: 'coverageFormat', type: 'USHORT', value: 2}] - .concat(recordList('rangeRecord', coverageTable.ranges, function(RangeRecord) { - return [ - {name: 'startGlyphID', type: 'USHORT', value: RangeRecord.start}, - {name: 'endGlyphID', type: 'USHORT', value: RangeRecord.end}, - {name: 'startCoverageIndex', type: 'USHORT', value: RangeRecord.index} ]; - })) - ); - } else { - check.assert(false, 'Coverage format must be 1 or 2.'); - } -} -Coverage.prototype = Object.create(Table.prototype); -Coverage.prototype.constructor = Coverage; - -function ScriptList(scriptListTable) { - Table.call(this, 'scriptListTable', - recordList('scriptRecord', scriptListTable, function(scriptRecord, i) { - var script = scriptRecord.script; - var defaultLangSys = script.defaultLangSys; - check.assert(!!defaultLangSys, 'Unable to write GSUB: script ' + scriptRecord.tag + ' has no default language system.'); - return [ - {name: 'scriptTag' + i, type: 'TAG', value: scriptRecord.tag}, - {name: 'script' + i, type: 'TABLE', value: new Table('scriptTable', [ - {name: 'defaultLangSys', type: 'TABLE', value: new Table('defaultLangSys', [ - {name: 'lookupOrder', type: 'USHORT', value: 0}, - {name: 'reqFeatureIndex', type: 'USHORT', value: defaultLangSys.reqFeatureIndex}] - .concat(ushortList('featureIndex', defaultLangSys.featureIndexes)))} - ].concat(recordList('langSys', script.langSysRecords, function(langSysRecord, i) { - var langSys = langSysRecord.langSys; - return [ - {name: 'langSysTag' + i, type: 'TAG', value: langSysRecord.tag}, - {name: 'langSys' + i, type: 'TABLE', value: new Table('langSys', [ - {name: 'lookupOrder', type: 'USHORT', value: 0}, - {name: 'reqFeatureIndex', type: 'USHORT', value: langSys.reqFeatureIndex} - ].concat(ushortList('featureIndex', langSys.featureIndexes)))} - ]; - })))} - ]; - }) - ); -} -ScriptList.prototype = Object.create(Table.prototype); -ScriptList.prototype.constructor = ScriptList; - -/** - * @exports opentype.FeatureList - * @class - * @param {opentype.Table} - * @constructor - * @extends opentype.Table - */ -function FeatureList(featureListTable) { - Table.call(this, 'featureListTable', - recordList('featureRecord', featureListTable, function(featureRecord, i) { - var feature = featureRecord.feature; - return [ - {name: 'featureTag' + i, type: 'TAG', value: featureRecord.tag}, - {name: 'feature' + i, type: 'TABLE', value: new Table('featureTable', [ - {name: 'featureParams', type: 'USHORT', value: feature.featureParams} ].concat(ushortList('lookupListIndex', feature.lookupListIndexes)))} - ]; - }) - ); -} -FeatureList.prototype = Object.create(Table.prototype); -FeatureList.prototype.constructor = FeatureList; - -/** - * @exports opentype.LookupList - * @class - * @param {opentype.Table} - * @param {Object} - * @constructor - * @extends opentype.Table - */ -function LookupList(lookupListTable, subtableMakers) { - Table.call(this, 'lookupListTable', tableList('lookup', lookupListTable, function(lookupTable) { - var subtableCallback = subtableMakers[lookupTable.lookupType]; - check.assert(!!subtableCallback, 'Unable to write GSUB lookup type ' + lookupTable.lookupType + ' tables.'); - return new Table('lookupTable', [ - {name: 'lookupType', type: 'USHORT', value: lookupTable.lookupType}, - {name: 'lookupFlag', type: 'USHORT', value: lookupTable.lookupFlag} - ].concat(tableList('subtable', lookupTable.subtables, subtableCallback))); - })); -} -LookupList.prototype = Object.create(Table.prototype); -LookupList.prototype.constructor = LookupList; - -// Record = same as Table, but inlined (a Table has an offset and its data is further in the stream) -// Don't use offsets inside Records (probable bug), only in Tables. -var table = { - Table: Table, - Record: Table, - Coverage: Coverage, - ScriptList: ScriptList, - FeatureList: FeatureList, - LookupList: LookupList, - ushortList: ushortList, - tableList: tableList, - recordList: recordList, -}; - -// Parsing utility functions - -// Retrieve an unsigned byte from the DataView. -function getByte(dataView, offset) { - return dataView.getUint8(offset); -} - -// Retrieve an unsigned 16-bit short from the DataView. -// The value is stored in big endian. -function getUShort(dataView, offset) { - return dataView.getUint16(offset, false); -} - -// Retrieve a signed 16-bit short from the DataView. -// The value is stored in big endian. -function getShort(dataView, offset) { - return dataView.getInt16(offset, false); -} - -// Retrieve an unsigned 32-bit long from the DataView. -// The value is stored in big endian. -function getULong(dataView, offset) { - return dataView.getUint32(offset, false); -} - -// Retrieve a 32-bit signed fixed-point number (16.16) from the DataView. -// The value is stored in big endian. -function getFixed(dataView, offset) { - var decimal = dataView.getInt16(offset, false); - var fraction = dataView.getUint16(offset + 2, false); - return decimal + fraction / 65535; -} - -// Retrieve a 4-character tag from the DataView. -// Tags are used to identify tables. -function getTag(dataView, offset) { - var tag = ''; - for (var i = offset; i < offset + 4; i += 1) { - tag += String.fromCharCode(dataView.getInt8(i)); - } - - return tag; -} - -// Retrieve an offset from the DataView. -// Offsets are 1 to 4 bytes in length, depending on the offSize argument. -function getOffset(dataView, offset, offSize) { - var v = 0; - for (var i = 0; i < offSize; i += 1) { - v <<= 8; - v += dataView.getUint8(offset + i); - } - - return v; -} - -// Retrieve a number of bytes from start offset to the end offset from the DataView. -function getBytes(dataView, startOffset, endOffset) { - var bytes = []; - for (var i = startOffset; i < endOffset; i += 1) { - bytes.push(dataView.getUint8(i)); - } - - return bytes; -} - -// Convert the list of bytes to a string. -function bytesToString(bytes) { - var s = ''; - for (var i = 0; i < bytes.length; i += 1) { - s += String.fromCharCode(bytes[i]); - } - - return s; -} - -var typeOffsets = { - byte: 1, - uShort: 2, - short: 2, - uLong: 4, - fixed: 4, - longDateTime: 8, - tag: 4 -}; - -// A stateful parser that changes the offset whenever a value is retrieved. -// The data is a DataView. -function Parser(data, offset) { - this.data = data; - this.offset = offset; - this.relativeOffset = 0; -} - -Parser.prototype.parseByte = function() { - var v = this.data.getUint8(this.offset + this.relativeOffset); - this.relativeOffset += 1; - return v; -}; - -Parser.prototype.parseChar = function() { - var v = this.data.getInt8(this.offset + this.relativeOffset); - this.relativeOffset += 1; - return v; -}; - -Parser.prototype.parseCard8 = Parser.prototype.parseByte; - -Parser.prototype.parseUShort = function() { - var v = this.data.getUint16(this.offset + this.relativeOffset); - this.relativeOffset += 2; - return v; -}; - -Parser.prototype.parseCard16 = Parser.prototype.parseUShort; -Parser.prototype.parseSID = Parser.prototype.parseUShort; -Parser.prototype.parseOffset16 = Parser.prototype.parseUShort; - -Parser.prototype.parseShort = function() { - var v = this.data.getInt16(this.offset + this.relativeOffset); - this.relativeOffset += 2; - return v; -}; - -Parser.prototype.parseF2Dot14 = function() { - var v = this.data.getInt16(this.offset + this.relativeOffset) / 16384; - this.relativeOffset += 2; - return v; -}; - -Parser.prototype.parseULong = function() { - var v = getULong(this.data, this.offset + this.relativeOffset); - this.relativeOffset += 4; - return v; -}; - -Parser.prototype.parseOffset32 = Parser.prototype.parseULong; - -Parser.prototype.parseFixed = function() { - var v = getFixed(this.data, this.offset + this.relativeOffset); - this.relativeOffset += 4; - return v; -}; - -Parser.prototype.parseString = function(length) { - var dataView = this.data; - var offset = this.offset + this.relativeOffset; - var string = ''; - this.relativeOffset += length; - for (var i = 0; i < length; i++) { - string += String.fromCharCode(dataView.getUint8(offset + i)); - } - - return string; -}; - -Parser.prototype.parseTag = function() { - return this.parseString(4); -}; - -// LONGDATETIME is a 64-bit integer. -// JavaScript and unix timestamps traditionally use 32 bits, so we -// only take the last 32 bits. -// + Since until 2038 those bits will be filled by zeros we can ignore them. -Parser.prototype.parseLongDateTime = function() { - var v = getULong(this.data, this.offset + this.relativeOffset + 4); - // Subtract seconds between 01/01/1904 and 01/01/1970 - // to convert Apple Mac timestamp to Standard Unix timestamp - v -= 2082844800; - this.relativeOffset += 8; - return v; -}; - -Parser.prototype.parseVersion = function(minorBase) { - var major = getUShort(this.data, this.offset + this.relativeOffset); - - // How to interpret the minor version is very vague in the spec. 0x5000 is 5, 0x1000 is 1 - // Default returns the correct number if minor = 0xN000 where N is 0-9 - // Set minorBase to 1 for tables that use minor = N where N is 0-9 - var minor = getUShort(this.data, this.offset + this.relativeOffset + 2); - this.relativeOffset += 4; - if (minorBase === undefined) { minorBase = 0x1000; } - return major + minor / minorBase / 10; -}; - -Parser.prototype.skip = function(type, amount) { - if (amount === undefined) { - amount = 1; - } - - this.relativeOffset += typeOffsets[type] * amount; -}; - -///// Parsing lists and records /////////////////////////////// - -// Parse a list of 32 bit unsigned integers. -Parser.prototype.parseULongList = function(count) { - if (count === undefined) { count = this.parseULong(); } - var offsets = new Array(count); - var dataView = this.data; - var offset = this.offset + this.relativeOffset; - for (var i = 0; i < count; i++) { - offsets[i] = dataView.getUint32(offset); - offset += 4; - } - - this.relativeOffset += count * 4; - return offsets; -}; - -// Parse a list of 16 bit unsigned integers. The length of the list can be read on the stream -// or provided as an argument. -Parser.prototype.parseOffset16List = -Parser.prototype.parseUShortList = function(count) { - if (count === undefined) { count = this.parseUShort(); } - var offsets = new Array(count); - var dataView = this.data; - var offset = this.offset + this.relativeOffset; - for (var i = 0; i < count; i++) { - offsets[i] = dataView.getUint16(offset); - offset += 2; - } - - this.relativeOffset += count * 2; - return offsets; -}; - -// Parses a list of 16 bit signed integers. -Parser.prototype.parseShortList = function(count) { - var list = new Array(count); - var dataView = this.data; - var offset = this.offset + this.relativeOffset; - for (var i = 0; i < count; i++) { - list[i] = dataView.getInt16(offset); - offset += 2; - } - - this.relativeOffset += count * 2; - return list; -}; - -// Parses a list of bytes. -Parser.prototype.parseByteList = function(count) { - var list = new Array(count); - var dataView = this.data; - var offset = this.offset + this.relativeOffset; - for (var i = 0; i < count; i++) { - list[i] = dataView.getUint8(offset++); - } - - this.relativeOffset += count; - return list; -}; - -/** - * Parse a list of items. - * Record count is optional, if omitted it is read from the stream. - * itemCallback is one of the Parser methods. - */ -Parser.prototype.parseList = function(count, itemCallback) { - if (!itemCallback) { - itemCallback = count; - count = this.parseUShort(); - } - var list = new Array(count); - for (var i = 0; i < count; i++) { - list[i] = itemCallback.call(this); - } - return list; -}; - -Parser.prototype.parseList32 = function(count, itemCallback) { - if (!itemCallback) { - itemCallback = count; - count = this.parseULong(); - } - var list = new Array(count); - for (var i = 0; i < count; i++) { - list[i] = itemCallback.call(this); - } - return list; -}; - -/** - * Parse a list of records. - * Record count is optional, if omitted it is read from the stream. - * Example of recordDescription: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort } - */ -Parser.prototype.parseRecordList = function(count, recordDescription) { - // If the count argument is absent, read it in the stream. - if (!recordDescription) { - recordDescription = count; - count = this.parseUShort(); - } - var records = new Array(count); - var fields = Object.keys(recordDescription); - for (var i = 0; i < count; i++) { - var rec = {}; - for (var j = 0; j < fields.length; j++) { - var fieldName = fields[j]; - var fieldType = recordDescription[fieldName]; - rec[fieldName] = fieldType.call(this); - } - records[i] = rec; - } - return records; -}; - -Parser.prototype.parseRecordList32 = function(count, recordDescription) { - // If the count argument is absent, read it in the stream. - if (!recordDescription) { - recordDescription = count; - count = this.parseULong(); - } - var records = new Array(count); - var fields = Object.keys(recordDescription); - for (var i = 0; i < count; i++) { - var rec = {}; - for (var j = 0; j < fields.length; j++) { - var fieldName = fields[j]; - var fieldType = recordDescription[fieldName]; - rec[fieldName] = fieldType.call(this); - } - records[i] = rec; - } - return records; -}; - -// Parse a data structure into an object -// Example of description: { sequenceIndex: Parser.uShort, lookupListIndex: Parser.uShort } -Parser.prototype.parseStruct = function(description) { - if (typeof description === 'function') { - return description.call(this); - } else { - var fields = Object.keys(description); - var struct = {}; - for (var j = 0; j < fields.length; j++) { - var fieldName = fields[j]; - var fieldType = description[fieldName]; - struct[fieldName] = fieldType.call(this); - } - return struct; - } -}; - -/** - * Parse a GPOS valueRecord - * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record - * valueFormat is optional, if omitted it is read from the stream. - */ -Parser.prototype.parseValueRecord = function(valueFormat) { - if (valueFormat === undefined) { - valueFormat = this.parseUShort(); - } - if (valueFormat === 0) { - // valueFormat2 in kerning pairs is most often 0 - // in this case return undefined instead of an empty object, to save space - return; - } - var valueRecord = {}; - - if (valueFormat & 0x0001) { valueRecord.xPlacement = this.parseShort(); } - if (valueFormat & 0x0002) { valueRecord.yPlacement = this.parseShort(); } - if (valueFormat & 0x0004) { valueRecord.xAdvance = this.parseShort(); } - if (valueFormat & 0x0008) { valueRecord.yAdvance = this.parseShort(); } - - // Device table (non-variable font) / VariationIndex table (variable font) not supported - // https://docs.microsoft.com/fr-fr/typography/opentype/spec/chapter2#devVarIdxTbls - if (valueFormat & 0x0010) { valueRecord.xPlaDevice = undefined; this.parseShort(); } - if (valueFormat & 0x0020) { valueRecord.yPlaDevice = undefined; this.parseShort(); } - if (valueFormat & 0x0040) { valueRecord.xAdvDevice = undefined; this.parseShort(); } - if (valueFormat & 0x0080) { valueRecord.yAdvDevice = undefined; this.parseShort(); } - - return valueRecord; -}; - -/** - * Parse a list of GPOS valueRecords - * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#value-record - * valueFormat and valueCount are read from the stream. - */ -Parser.prototype.parseValueRecordList = function() { - var valueFormat = this.parseUShort(); - var valueCount = this.parseUShort(); - var values = new Array(valueCount); - for (var i = 0; i < valueCount; i++) { - values[i] = this.parseValueRecord(valueFormat); - } - return values; -}; - -Parser.prototype.parsePointer = function(description) { - var structOffset = this.parseOffset16(); - if (structOffset > 0) { - // NULL offset => return undefined - return new Parser(this.data, this.offset + structOffset).parseStruct(description); - } - return undefined; -}; - -Parser.prototype.parsePointer32 = function(description) { - var structOffset = this.parseOffset32(); - if (structOffset > 0) { - // NULL offset => return undefined - return new Parser(this.data, this.offset + structOffset).parseStruct(description); - } - return undefined; -}; - -/** - * Parse a list of offsets to lists of 16-bit integers, - * or a list of offsets to lists of offsets to any kind of items. - * If itemCallback is not provided, a list of list of UShort is assumed. - * If provided, itemCallback is called on each item and must parse the item. - * See examples in tables/gsub.js - */ -Parser.prototype.parseListOfLists = function(itemCallback) { - var offsets = this.parseOffset16List(); - var count = offsets.length; - var relativeOffset = this.relativeOffset; - var list = new Array(count); - for (var i = 0; i < count; i++) { - var start = offsets[i]; - if (start === 0) { - // NULL offset - // Add i as owned property to list. Convenient with assert. - list[i] = undefined; - continue; - } - this.relativeOffset = start; - if (itemCallback) { - var subOffsets = this.parseOffset16List(); - var subList = new Array(subOffsets.length); - for (var j = 0; j < subOffsets.length; j++) { - this.relativeOffset = start + subOffsets[j]; - subList[j] = itemCallback.call(this); - } - list[i] = subList; - } else { - list[i] = this.parseUShortList(); - } - } - this.relativeOffset = relativeOffset; - return list; -}; - -///// Complex tables parsing ////////////////////////////////// - -// Parse a coverage table in a GSUB, GPOS or GDEF table. -// https://www.microsoft.com/typography/OTSPEC/chapter2.htm -// parser.offset must point to the start of the table containing the coverage. -Parser.prototype.parseCoverage = function() { - var startOffset = this.offset + this.relativeOffset; - var format = this.parseUShort(); - var count = this.parseUShort(); - if (format === 1) { - return { - format: 1, - glyphs: this.parseUShortList(count) - }; - } else if (format === 2) { - var ranges = new Array(count); - for (var i = 0; i < count; i++) { - ranges[i] = { - start: this.parseUShort(), - end: this.parseUShort(), - index: this.parseUShort() - }; - } - return { - format: 2, - ranges: ranges - }; - } - throw new Error('0x' + startOffset.toString(16) + ': Coverage format must be 1 or 2.'); -}; - -// Parse a Class Definition Table in a GSUB, GPOS or GDEF table. -// https://www.microsoft.com/typography/OTSPEC/chapter2.htm -Parser.prototype.parseClassDef = function() { - var startOffset = this.offset + this.relativeOffset; - var format = this.parseUShort(); - if (format === 1) { - return { - format: 1, - startGlyph: this.parseUShort(), - classes: this.parseUShortList() - }; - } else if (format === 2) { - return { - format: 2, - ranges: this.parseRecordList({ - start: Parser.uShort, - end: Parser.uShort, - classId: Parser.uShort - }) - }; - } - throw new Error('0x' + startOffset.toString(16) + ': ClassDef format must be 1 or 2.'); -}; - -///// Static methods /////////////////////////////////// -// These convenience methods can be used as callbacks and should be called with "this" context set to a Parser instance. - -Parser.list = function(count, itemCallback) { - return function() { - return this.parseList(count, itemCallback); - }; -}; - -Parser.list32 = function(count, itemCallback) { - return function() { - return this.parseList32(count, itemCallback); - }; -}; - -Parser.recordList = function(count, recordDescription) { - return function() { - return this.parseRecordList(count, recordDescription); - }; -}; - -Parser.recordList32 = function(count, recordDescription) { - return function() { - return this.parseRecordList32(count, recordDescription); - }; -}; - -Parser.pointer = function(description) { - return function() { - return this.parsePointer(description); - }; -}; - -Parser.pointer32 = function(description) { - return function() { - return this.parsePointer32(description); - }; -}; - -Parser.tag = Parser.prototype.parseTag; -Parser.byte = Parser.prototype.parseByte; -Parser.uShort = Parser.offset16 = Parser.prototype.parseUShort; -Parser.uShortList = Parser.prototype.parseUShortList; -Parser.uLong = Parser.offset32 = Parser.prototype.parseULong; -Parser.uLongList = Parser.prototype.parseULongList; -Parser.struct = Parser.prototype.parseStruct; -Parser.coverage = Parser.prototype.parseCoverage; -Parser.classDef = Parser.prototype.parseClassDef; - -///// Script, Feature, Lookup lists /////////////////////////////////////////////// -// https://www.microsoft.com/typography/OTSPEC/chapter2.htm - -var langSysTable = { - reserved: Parser.uShort, - reqFeatureIndex: Parser.uShort, - featureIndexes: Parser.uShortList -}; - -Parser.prototype.parseScriptList = function() { - return this.parsePointer(Parser.recordList({ - tag: Parser.tag, - script: Parser.pointer({ - defaultLangSys: Parser.pointer(langSysTable), - langSysRecords: Parser.recordList({ - tag: Parser.tag, - langSys: Parser.pointer(langSysTable) - }) - }) - })) || []; -}; - -Parser.prototype.parseFeatureList = function() { - return this.parsePointer(Parser.recordList({ - tag: Parser.tag, - feature: Parser.pointer({ - featureParams: Parser.offset16, - lookupListIndexes: Parser.uShortList - }) - })) || []; -}; - -Parser.prototype.parseLookupList = function(lookupTableParsers) { - return this.parsePointer(Parser.list(Parser.pointer(function() { - var lookupType = this.parseUShort(); - check.argument(1 <= lookupType && lookupType <= 9, 'GPOS/GSUB lookup type ' + lookupType + ' unknown.'); - var lookupFlag = this.parseUShort(); - var useMarkFilteringSet = lookupFlag & 0x10; - return { - lookupType: lookupType, - lookupFlag: lookupFlag, - subtables: this.parseList(Parser.pointer(lookupTableParsers[lookupType])), - markFilteringSet: useMarkFilteringSet ? this.parseUShort() : undefined - }; - }))) || []; -}; - -Parser.prototype.parseFeatureVariationsList = function() { - return this.parsePointer32(function() { - var majorVersion = this.parseUShort(); - var minorVersion = this.parseUShort(); - check.argument(majorVersion === 1 && minorVersion < 1, 'GPOS/GSUB feature variations table unknown.'); - var featureVariations = this.parseRecordList32({ - conditionSetOffset: Parser.offset32, - featureTableSubstitutionOffset: Parser.offset32 - }); - return featureVariations; - }) || []; -}; - -var parse = { - getByte: getByte, - getCard8: getByte, - getUShort: getUShort, - getCard16: getUShort, - getShort: getShort, - getULong: getULong, - getFixed: getFixed, - getTag: getTag, - getOffset: getOffset, - getBytes: getBytes, - bytesToString: bytesToString, - Parser: Parser, -}; - -// The `cmap` table stores the mappings from characters to glyphs. - -function parseCmapTableFormat12(cmap, p) { - //Skip reserved. - p.parseUShort(); - - // Length in bytes of the sub-tables. - cmap.length = p.parseULong(); - cmap.language = p.parseULong(); - - var groupCount; - cmap.groupCount = groupCount = p.parseULong(); - cmap.glyphIndexMap = {}; - - for (var i = 0; i < groupCount; i += 1) { - var startCharCode = p.parseULong(); - var endCharCode = p.parseULong(); - var startGlyphId = p.parseULong(); - - for (var c = startCharCode; c <= endCharCode; c += 1) { - cmap.glyphIndexMap[c] = startGlyphId; - startGlyphId++; - } - } -} - -function parseCmapTableFormat4(cmap, p, data, start, offset) { - // Length in bytes of the sub-tables. - cmap.length = p.parseUShort(); - cmap.language = p.parseUShort(); - - // segCount is stored x 2. - var segCount; - cmap.segCount = segCount = p.parseUShort() >> 1; - - // Skip searchRange, entrySelector, rangeShift. - p.skip('uShort', 3); - - // The "unrolled" mapping from character codes to glyph indices. - cmap.glyphIndexMap = {}; - var endCountParser = new parse.Parser(data, start + offset + 14); - var startCountParser = new parse.Parser(data, start + offset + 16 + segCount * 2); - var idDeltaParser = new parse.Parser(data, start + offset + 16 + segCount * 4); - var idRangeOffsetParser = new parse.Parser(data, start + offset + 16 + segCount * 6); - var glyphIndexOffset = start + offset + 16 + segCount * 8; - for (var i = 0; i < segCount - 1; i += 1) { - var glyphIndex = (void 0); - var endCount = endCountParser.parseUShort(); - var startCount = startCountParser.parseUShort(); - var idDelta = idDeltaParser.parseShort(); - var idRangeOffset = idRangeOffsetParser.parseUShort(); - for (var c = startCount; c <= endCount; c += 1) { - if (idRangeOffset !== 0) { - // The idRangeOffset is relative to the current position in the idRangeOffset array. - // Take the current offset in the idRangeOffset array. - glyphIndexOffset = (idRangeOffsetParser.offset + idRangeOffsetParser.relativeOffset - 2); - - // Add the value of the idRangeOffset, which will move us into the glyphIndex array. - glyphIndexOffset += idRangeOffset; - - // Then add the character index of the current segment, multiplied by 2 for USHORTs. - glyphIndexOffset += (c - startCount) * 2; - glyphIndex = parse.getUShort(data, glyphIndexOffset); - if (glyphIndex !== 0) { - glyphIndex = (glyphIndex + idDelta) & 0xFFFF; - } - } else { - glyphIndex = (c + idDelta) & 0xFFFF; - } - - cmap.glyphIndexMap[c] = glyphIndex; - } - } -} - -// Parse the `cmap` table. This table stores the mappings from characters to glyphs. -// There are many available formats, but we only support the Windows format 4 and 12. -// This function returns a `CmapEncoding` object or null if no supported format could be found. -function parseCmapTable(data, start) { - var cmap = {}; - cmap.version = parse.getUShort(data, start); - check.argument(cmap.version === 0, 'cmap table version should be 0.'); - - // The cmap table can contain many sub-tables, each with their own format. - // We're only interested in a "platform 0" (Unicode format) and "platform 3" (Windows format) table. - cmap.numTables = parse.getUShort(data, start + 2); - var offset = -1; - for (var i = cmap.numTables - 1; i >= 0; i -= 1) { - var platformId = parse.getUShort(data, start + 4 + (i * 8)); - var encodingId = parse.getUShort(data, start + 4 + (i * 8) + 2); - if ((platformId === 3 && (encodingId === 0 || encodingId === 1 || encodingId === 10)) || - (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 2 || encodingId === 3 || encodingId === 4))) { - offset = parse.getULong(data, start + 4 + (i * 8) + 4); - break; - } - } - - if (offset === -1) { - // There is no cmap table in the font that we support. - throw new Error('No valid cmap sub-tables found.'); - } - - var p = new parse.Parser(data, start + offset); - cmap.format = p.parseUShort(); - - if (cmap.format === 12) { - parseCmapTableFormat12(cmap, p); - } else if (cmap.format === 4) { - parseCmapTableFormat4(cmap, p, data, start, offset); - } else { - throw new Error('Only format 4 and 12 cmap tables are supported (found format ' + cmap.format + ').'); - } - - return cmap; -} - -function addSegment(t, code, glyphIndex) { - t.segments.push({ - end: code, - start: code, - delta: -(code - glyphIndex), - offset: 0, - glyphIndex: glyphIndex - }); -} - -function addTerminatorSegment(t) { - t.segments.push({ - end: 0xFFFF, - start: 0xFFFF, - delta: 1, - offset: 0 - }); -} - -// Make cmap table, format 4 by default, 12 if needed only -function makeCmapTable(glyphs) { - // Plan 0 is the base Unicode Plan but emojis, for example are on another plan, and needs cmap 12 format (with 32bit) - var isPlan0Only = true; - var i; - - // Check if we need to add cmap format 12 or if format 4 only is fine - for (i = glyphs.length - 1; i > 0; i -= 1) { - var g = glyphs.get(i); - if (g.unicode > 65535) { - console.log('Adding CMAP format 12 (needed!)'); - isPlan0Only = false; - break; - } - } - - var cmapTable = [ - {name: 'version', type: 'USHORT', value: 0}, - {name: 'numTables', type: 'USHORT', value: isPlan0Only ? 1 : 2}, - - // CMAP 4 header - {name: 'platformID', type: 'USHORT', value: 3}, - {name: 'encodingID', type: 'USHORT', value: 1}, - {name: 'offset', type: 'ULONG', value: isPlan0Only ? 12 : (12 + 8)} - ]; - - if (!isPlan0Only) - { cmapTable = cmapTable.concat([ - // CMAP 12 header - {name: 'cmap12PlatformID', type: 'USHORT', value: 3}, // We encode only for PlatformID = 3 (Windows) because it is supported everywhere - {name: 'cmap12EncodingID', type: 'USHORT', value: 10}, - {name: 'cmap12Offset', type: 'ULONG', value: 0} - ]); } - - cmapTable = cmapTable.concat([ - // CMAP 4 Subtable - {name: 'format', type: 'USHORT', value: 4}, - {name: 'cmap4Length', type: 'USHORT', value: 0}, - {name: 'language', type: 'USHORT', value: 0}, - {name: 'segCountX2', type: 'USHORT', value: 0}, - {name: 'searchRange', type: 'USHORT', value: 0}, - {name: 'entrySelector', type: 'USHORT', value: 0}, - {name: 'rangeShift', type: 'USHORT', value: 0} - ]); - - var t = new table.Table('cmap', cmapTable); - - t.segments = []; - for (i = 0; i < glyphs.length; i += 1) { - var glyph = glyphs.get(i); - for (var j = 0; j < glyph.unicodes.length; j += 1) { - addSegment(t, glyph.unicodes[j], i); - } - - t.segments = t.segments.sort(function (a, b) { - return a.start - b.start; - }); - } - - addTerminatorSegment(t); - - var segCount = t.segments.length; - var segCountToRemove = 0; - - // CMAP 4 - // Set up parallel segment arrays. - var endCounts = []; - var startCounts = []; - var idDeltas = []; - var idRangeOffsets = []; - var glyphIds = []; - - // CMAP 12 - var cmap12Groups = []; - - // Reminder this loop is not following the specification at 100% - // The specification -> find suites of characters and make a group - // Here we're doing one group for each letter - // Doing as the spec can save 8 times (or more) space - for (i = 0; i < segCount; i += 1) { - var segment = t.segments[i]; - - // CMAP 4 - if (segment.end <= 65535 && segment.start <= 65535) { - endCounts = endCounts.concat({name: 'end_' + i, type: 'USHORT', value: segment.end}); - startCounts = startCounts.concat({name: 'start_' + i, type: 'USHORT', value: segment.start}); - idDeltas = idDeltas.concat({name: 'idDelta_' + i, type: 'SHORT', value: segment.delta}); - idRangeOffsets = idRangeOffsets.concat({name: 'idRangeOffset_' + i, type: 'USHORT', value: segment.offset}); - if (segment.glyphId !== undefined) { - glyphIds = glyphIds.concat({name: 'glyph_' + i, type: 'USHORT', value: segment.glyphId}); - } - } else { - // Skip Unicode > 65535 (16bit unsigned max) for CMAP 4, will be added in CMAP 12 - segCountToRemove += 1; - } - - // CMAP 12 - // Skip Terminator Segment - if (!isPlan0Only && segment.glyphIndex !== undefined) { - cmap12Groups = cmap12Groups.concat({name: 'cmap12Start_' + i, type: 'ULONG', value: segment.start}); - cmap12Groups = cmap12Groups.concat({name: 'cmap12End_' + i, type: 'ULONG', value: segment.end}); - cmap12Groups = cmap12Groups.concat({name: 'cmap12Glyph_' + i, type: 'ULONG', value: segment.glyphIndex}); - } - } - - // CMAP 4 Subtable - t.segCountX2 = (segCount - segCountToRemove) * 2; - t.searchRange = Math.pow(2, Math.floor(Math.log((segCount - segCountToRemove)) / Math.log(2))) * 2; - t.entrySelector = Math.log(t.searchRange / 2) / Math.log(2); - t.rangeShift = t.segCountX2 - t.searchRange; - - t.fields = t.fields.concat(endCounts); - t.fields.push({name: 'reservedPad', type: 'USHORT', value: 0}); - t.fields = t.fields.concat(startCounts); - t.fields = t.fields.concat(idDeltas); - t.fields = t.fields.concat(idRangeOffsets); - t.fields = t.fields.concat(glyphIds); - - t.cmap4Length = 14 + // Subtable header - endCounts.length * 2 + - 2 + // reservedPad - startCounts.length * 2 + - idDeltas.length * 2 + - idRangeOffsets.length * 2 + - glyphIds.length * 2; - - if (!isPlan0Only) { - // CMAP 12 Subtable - var cmap12Length = 16 + // Subtable header - cmap12Groups.length * 4; - - t.cmap12Offset = 12 + (2 * 2) + 4 + t.cmap4Length; - t.fields = t.fields.concat([ - {name: 'cmap12Format', type: 'USHORT', value: 12}, - {name: 'cmap12Reserved', type: 'USHORT', value: 0}, - {name: 'cmap12Length', type: 'ULONG', value: cmap12Length}, - {name: 'cmap12Language', type: 'ULONG', value: 0}, - {name: 'cmap12nGroups', type: 'ULONG', value: cmap12Groups.length / 3} - ]); - - t.fields = t.fields.concat(cmap12Groups); - } - - return t; -} - -var cmap = { parse: parseCmapTable, make: makeCmapTable }; - -// Glyph encoding - -var cffStandardStrings = [ - '.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', - 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', - 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', - 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', - 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', - 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', - 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', - 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', - 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', - 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', - 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', - 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', - 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', - 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', - 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', - 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', - 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', - 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', - 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', - 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', - 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', '266 ff', 'onedotenleader', - 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', - 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', - 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', - 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', - 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', - 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', - 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', - 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', - 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', - 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', - 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', - 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', - 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', - 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', - 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', - 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', - 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', - 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', - 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', - '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold']; - -var cffStandardEncoding = [ - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', - 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', - 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', - 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', - 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '', '', '', - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', - 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', - 'daggerdbl', 'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', - 'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', 'tilde', - 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', - 'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '', 'ordfeminine', '', '', '', - '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', - 'lslash', 'oslash', 'oe', 'germandbls']; - -var cffExpertEncoding = [ - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', 'dollarsuperior', - 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', - 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', - 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', - 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', '', 'asuperior', - 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', - 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', - 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', - 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', - 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', - 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', '', '', '', '', '', - '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', - 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', '', '', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', - 'Brevesmall', 'Caronsmall', '', 'Dotaccentsmall', '', '', 'Macronsmall', '', '', 'figuredash', 'hypheninferior', - '', '', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', '', '', '', 'onequarter', 'onehalf', 'threequarters', - 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', - '', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', - 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', - 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', - 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', - 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', - 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', - 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', - 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', - 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall']; - -var standardNames = [ - '.notdef', '.null', 'nonmarkingreturn', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', - 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', - 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', - 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', - 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', - 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', - 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', - 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', - 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', - 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', - 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', - 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', - 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', - 'ellipsis', 'nonbreakingspace', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', - 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', - 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', - 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', - 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', - 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', - 'ogonek', 'caron', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Zcaron', 'zcaron', 'brokenbar', 'Eth', 'eth', - 'Yacute', 'yacute', 'Thorn', 'thorn', 'minus', 'multiply', 'onesuperior', 'twosuperior', 'threesuperior', - 'onehalf', 'onequarter', 'threequarters', 'franc', 'Gbreve', 'gbreve', 'Idotaccent', 'Scedilla', 'scedilla', - 'Cacute', 'cacute', 'Ccaron', 'ccaron', 'dcroat']; - -/** - * This is the encoding used for fonts created from scratch. - * It loops through all glyphs and finds the appropriate unicode value. - * Since it's linear time, other encodings will be faster. - * @exports opentype.DefaultEncoding - * @class - * @constructor - * @param {opentype.Font} - */ -function DefaultEncoding(font) { - this.font = font; -} - -DefaultEncoding.prototype.charToGlyphIndex = function(c) { - var code = c.codePointAt(0); - var glyphs = this.font.glyphs; - if (glyphs) { - for (var i = 0; i < glyphs.length; i += 1) { - var glyph = glyphs.get(i); - for (var j = 0; j < glyph.unicodes.length; j += 1) { - if (glyph.unicodes[j] === code) { - return i; - } - } - } - } - return null; -}; - -/** - * @exports opentype.CmapEncoding - * @class - * @constructor - * @param {Object} cmap - a object with the cmap encoded data - */ -function CmapEncoding(cmap) { - this.cmap = cmap; -} - -/** - * @param {string} c - the character - * @return {number} The glyph index. - */ -CmapEncoding.prototype.charToGlyphIndex = function(c) { - return this.cmap.glyphIndexMap[c.codePointAt(0)] || 0; -}; - -/** - * @exports opentype.CffEncoding - * @class - * @constructor - * @param {string} encoding - The encoding - * @param {Array} charset - The character set. - */ -function CffEncoding(encoding, charset) { - this.encoding = encoding; - this.charset = charset; -} - -/** - * @param {string} s - The character - * @return {number} The index. - */ -CffEncoding.prototype.charToGlyphIndex = function(s) { - var code = s.codePointAt(0); - var charName = this.encoding[code]; - return this.charset.indexOf(charName); -}; - -/** - * @exports opentype.GlyphNames - * @class - * @constructor - * @param {Object} post - */ -function GlyphNames(post) { - switch (post.version) { - case 1: - this.names = standardNames.slice(); - break; - case 2: - this.names = new Array(post.numberOfGlyphs); - for (var i = 0; i < post.numberOfGlyphs; i++) { - if (post.glyphNameIndex[i] < standardNames.length) { - this.names[i] = standardNames[post.glyphNameIndex[i]]; - } else { - this.names[i] = post.names[post.glyphNameIndex[i] - standardNames.length]; - } - } - - break; - case 2.5: - this.names = new Array(post.numberOfGlyphs); - for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) { - this.names[i$1] = standardNames[i$1 + post.glyphNameIndex[i$1]]; - } - - break; - case 3: - this.names = []; - break; - default: - this.names = []; - break; - } -} - -/** - * Gets the index of a glyph by name. - * @param {string} name - The glyph name - * @return {number} The index - */ -GlyphNames.prototype.nameToGlyphIndex = function(name) { - return this.names.indexOf(name); -}; - -/** - * @param {number} gid - * @return {string} - */ -GlyphNames.prototype.glyphIndexToName = function(gid) { - return this.names[gid]; -}; - -function addGlyphNamesAll(font) { - var glyph; - var glyphIndexMap = font.tables.cmap.glyphIndexMap; - var charCodes = Object.keys(glyphIndexMap); - - for (var i = 0; i < charCodes.length; i += 1) { - var c = charCodes[i]; - var glyphIndex = glyphIndexMap[c]; - glyph = font.glyphs.get(glyphIndex); - glyph.addUnicode(parseInt(c)); - } - - for (var i$1 = 0; i$1 < font.glyphs.length; i$1 += 1) { - glyph = font.glyphs.get(i$1); - if (font.cffEncoding) { - if (font.isCIDFont) { - glyph.name = 'gid' + i$1; - } else { - glyph.name = font.cffEncoding.charset[i$1]; - } - } else if (font.glyphNames.names) { - glyph.name = font.glyphNames.glyphIndexToName(i$1); - } - } -} - -function addGlyphNamesToUnicodeMap(font) { - font._IndexToUnicodeMap = {}; - - var glyphIndexMap = font.tables.cmap.glyphIndexMap; - var charCodes = Object.keys(glyphIndexMap); - - for (var i = 0; i < charCodes.length; i += 1) { - var c = charCodes[i]; - var glyphIndex = glyphIndexMap[c]; - if (font._IndexToUnicodeMap[glyphIndex] === undefined) { - font._IndexToUnicodeMap[glyphIndex] = { - unicodes: [parseInt(c)] - }; - } else { - font._IndexToUnicodeMap[glyphIndex].unicodes.push(parseInt(c)); - } - } -} - -/** - * @alias opentype.addGlyphNames - * @param {opentype.Font} - * @param {Object} - */ -function addGlyphNames(font, opt) { - if (opt.lowMemory) { - addGlyphNamesToUnicodeMap(font); - } else { - addGlyphNamesAll(font); - } -} - -// Drawing utility functions. - -// Draw a line on the given context from point `x1,y1` to point `x2,y2`. -function line(ctx, x1, y1, x2, y2) { - ctx.beginPath(); - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.stroke(); -} - -var draw = { line: line }; - -// The Glyph object -// import glyf from './tables/glyf' Can't be imported here, because it's a circular dependency - -function getPathDefinition(glyph, path) { - var _path = path || new Path(); - return { - configurable: true, - - get: function() { - if (typeof _path === 'function') { - _path = _path(); - } - - return _path; - }, - - set: function(p) { - _path = p; - } - }; -} -/** - * @typedef GlyphOptions - * @type Object - * @property {string} [name] - The glyph name - * @property {number} [unicode] - * @property {Array} [unicodes] - * @property {number} [xMin] - * @property {number} [yMin] - * @property {number} [xMax] - * @property {number} [yMax] - * @property {number} [advanceWidth] - */ - -// A Glyph is an individual mark that often corresponds to a character. -// Some glyphs, such as ligatures, are a combination of many characters. -// Glyphs are the basic building blocks of a font. -// -// The `Glyph` class contains utility methods for drawing the path and its points. -/** - * @exports opentype.Glyph - * @class - * @param {GlyphOptions} - * @constructor - */ -function Glyph(options) { - // By putting all the code on a prototype function (which is only declared once) - // we reduce the memory requirements for larger fonts by some 2% - this.bindConstructorValues(options); -} - -/** - * @param {GlyphOptions} - */ -Glyph.prototype.bindConstructorValues = function(options) { - this.index = options.index || 0; - - // These three values cannot be deferred for memory optimization: - this.name = options.name || null; - this.unicode = options.unicode || undefined; - this.unicodes = options.unicodes || options.unicode !== undefined ? [options.unicode] : []; - - // But by binding these values only when necessary, we reduce can - // the memory requirements by almost 3% for larger fonts. - if ('xMin' in options) { - this.xMin = options.xMin; - } - - if ('yMin' in options) { - this.yMin = options.yMin; - } - - if ('xMax' in options) { - this.xMax = options.xMax; - } - - if ('yMax' in options) { - this.yMax = options.yMax; - } - - if ('advanceWidth' in options) { - this.advanceWidth = options.advanceWidth; - } - - // The path for a glyph is the most memory intensive, and is bound as a value - // with a getter/setter to ensure we actually do path parsing only once the - // path is actually needed by anything. - Object.defineProperty(this, 'path', getPathDefinition(this, options.path)); -}; - -/** - * @param {number} - */ -Glyph.prototype.addUnicode = function(unicode) { - if (this.unicodes.length === 0) { - this.unicode = unicode; - } - - this.unicodes.push(unicode); -}; - -/** - * Calculate the minimum bounding box for this glyph. - * @return {opentype.BoundingBox} - */ -Glyph.prototype.getBoundingBox = function() { - return this.path.getBoundingBox(); -}; - -/** - * Convert the glyph to a Path we can draw on a drawing context. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {Object=} options - xScale, yScale to stretch the glyph. - * @param {opentype.Font} if hinting is to be used, the font - * @return {opentype.Path} - */ -Glyph.prototype.getPath = function(x, y, fontSize, options, font) { - x = x !== undefined ? x : 0; - y = y !== undefined ? y : 0; - fontSize = fontSize !== undefined ? fontSize : 72; - var commands; - var hPoints; - if (!options) { options = { }; } - var xScale = options.xScale; - var yScale = options.yScale; - - if (options.hinting && font && font.hinting) { - // in case of hinting, the hinting engine takes care - // of scaling the points (not the path) before hinting. - hPoints = this.path && font.hinting.exec(this, fontSize); - // in case the hinting engine failed hPoints is undefined - // and thus reverts to plain rending - } - - if (hPoints) { - // Call font.hinting.getCommands instead of `glyf.getPath(hPoints).commands` to avoid a circular dependency - commands = font.hinting.getCommands(hPoints); - x = Math.round(x); - y = Math.round(y); - // TODO in case of hinting xyScaling is not yet supported - xScale = yScale = 1; - } else { - commands = this.path.commands; - var scale = 1 / (this.path.unitsPerEm || 1000) * fontSize; - if (xScale === undefined) { xScale = scale; } - if (yScale === undefined) { yScale = scale; } - } - - var p = new Path(); - for (var i = 0; i < commands.length; i += 1) { - var cmd = commands[i]; - if (cmd.type === 'M') { - p.moveTo(x + (cmd.x * xScale), y + (-cmd.y * yScale)); - } else if (cmd.type === 'L') { - p.lineTo(x + (cmd.x * xScale), y + (-cmd.y * yScale)); - } else if (cmd.type === 'Q') { - p.quadraticCurveTo(x + (cmd.x1 * xScale), y + (-cmd.y1 * yScale), - x + (cmd.x * xScale), y + (-cmd.y * yScale)); - } else if (cmd.type === 'C') { - p.curveTo(x + (cmd.x1 * xScale), y + (-cmd.y1 * yScale), - x + (cmd.x2 * xScale), y + (-cmd.y2 * yScale), - x + (cmd.x * xScale), y + (-cmd.y * yScale)); - } else if (cmd.type === 'Z') { - p.closePath(); - } - } - - return p; -}; - -/** - * Split the glyph into contours. - * This function is here for backwards compatibility, and to - * provide raw access to the TrueType glyph outlines. - * @return {Array} - */ -Glyph.prototype.getContours = function() { - if (this.points === undefined) { - return []; - } - - var contours = []; - var currentContour = []; - for (var i = 0; i < this.points.length; i += 1) { - var pt = this.points[i]; - currentContour.push(pt); - if (pt.lastPointOfContour) { - contours.push(currentContour); - currentContour = []; - } - } - - check.argument(currentContour.length === 0, 'There are still points left in the current contour.'); - return contours; -}; - -/** - * Calculate the xMin/yMin/xMax/yMax/lsb/rsb for a Glyph. - * @return {Object} - */ -Glyph.prototype.getMetrics = function() { - var commands = this.path.commands; - var xCoords = []; - var yCoords = []; - for (var i = 0; i < commands.length; i += 1) { - var cmd = commands[i]; - if (cmd.type !== 'Z') { - xCoords.push(cmd.x); - yCoords.push(cmd.y); - } - - if (cmd.type === 'Q' || cmd.type === 'C') { - xCoords.push(cmd.x1); - yCoords.push(cmd.y1); - } - - if (cmd.type === 'C') { - xCoords.push(cmd.x2); - yCoords.push(cmd.y2); - } - } - - var metrics = { - xMin: Math.min.apply(null, xCoords), - yMin: Math.min.apply(null, yCoords), - xMax: Math.max.apply(null, xCoords), - yMax: Math.max.apply(null, yCoords), - leftSideBearing: this.leftSideBearing - }; - - if (!isFinite(metrics.xMin)) { - metrics.xMin = 0; - } - - if (!isFinite(metrics.xMax)) { - metrics.xMax = this.advanceWidth; - } - - if (!isFinite(metrics.yMin)) { - metrics.yMin = 0; - } - - if (!isFinite(metrics.yMax)) { - metrics.yMax = 0; - } - - metrics.rightSideBearing = this.advanceWidth - metrics.leftSideBearing - (metrics.xMax - metrics.xMin); - return metrics; -}; - -/** - * Draw the glyph on the given context. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {Object=} options - xScale, yScale to stretch the glyph. - */ -Glyph.prototype.draw = function(ctx, x, y, fontSize, options) { - this.getPath(x, y, fontSize, options).draw(ctx); -}; - -/** - * Draw the points of the glyph. - * On-curve points will be drawn in blue, off-curve points will be drawn in red. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - */ -Glyph.prototype.drawPoints = function(ctx, x, y, fontSize) { - function drawCircles(l, x, y, scale) { - ctx.beginPath(); - for (var j = 0; j < l.length; j += 1) { - ctx.moveTo(x + (l[j].x * scale), y + (l[j].y * scale)); - ctx.arc(x + (l[j].x * scale), y + (l[j].y * scale), 2, 0, Math.PI * 2, false); - } - - ctx.closePath(); - ctx.fill(); - } - - x = x !== undefined ? x : 0; - y = y !== undefined ? y : 0; - fontSize = fontSize !== undefined ? fontSize : 24; - var scale = 1 / this.path.unitsPerEm * fontSize; - - var blueCircles = []; - var redCircles = []; - var path = this.path; - for (var i = 0; i < path.commands.length; i += 1) { - var cmd = path.commands[i]; - if (cmd.x !== undefined) { - blueCircles.push({x: cmd.x, y: -cmd.y}); - } - - if (cmd.x1 !== undefined) { - redCircles.push({x: cmd.x1, y: -cmd.y1}); - } - - if (cmd.x2 !== undefined) { - redCircles.push({x: cmd.x2, y: -cmd.y2}); - } - } - - ctx.fillStyle = 'blue'; - drawCircles(blueCircles, x, y, scale); - ctx.fillStyle = 'red'; - drawCircles(redCircles, x, y, scale); -}; - -/** - * Draw lines indicating important font measurements. - * Black lines indicate the origin of the coordinate system (point 0,0). - * Blue lines indicate the glyph bounding box. - * Green line indicates the advance width of the glyph. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - */ -Glyph.prototype.drawMetrics = function(ctx, x, y, fontSize) { - var scale; - x = x !== undefined ? x : 0; - y = y !== undefined ? y : 0; - fontSize = fontSize !== undefined ? fontSize : 24; - scale = 1 / this.path.unitsPerEm * fontSize; - ctx.lineWidth = 1; - - // Draw the origin - ctx.strokeStyle = 'black'; - draw.line(ctx, x, -10000, x, 10000); - draw.line(ctx, -10000, y, 10000, y); - - // This code is here due to memory optimization: by not using - // defaults in the constructor, we save a notable amount of memory. - var xMin = this.xMin || 0; - var yMin = this.yMin || 0; - var xMax = this.xMax || 0; - var yMax = this.yMax || 0; - var advanceWidth = this.advanceWidth || 0; - - // Draw the glyph box - ctx.strokeStyle = 'blue'; - draw.line(ctx, x + (xMin * scale), -10000, x + (xMin * scale), 10000); - draw.line(ctx, x + (xMax * scale), -10000, x + (xMax * scale), 10000); - draw.line(ctx, -10000, y + (-yMin * scale), 10000, y + (-yMin * scale)); - draw.line(ctx, -10000, y + (-yMax * scale), 10000, y + (-yMax * scale)); - - // Draw the advance width - ctx.strokeStyle = 'green'; - draw.line(ctx, x + (advanceWidth * scale), -10000, x + (advanceWidth * scale), 10000); -}; - -// The GlyphSet object - -// Define a property on the glyph that depends on the path being loaded. -function defineDependentProperty(glyph, externalName, internalName) { - Object.defineProperty(glyph, externalName, { - get: function() { - // Request the path property to make sure the path is loaded. - glyph.path; // jshint ignore:line - return glyph[internalName]; - }, - set: function(newValue) { - glyph[internalName] = newValue; - }, - enumerable: true, - configurable: true - }); -} - -/** - * A GlyphSet represents all glyphs available in the font, but modelled using - * a deferred glyph loader, for retrieving glyphs only once they are absolutely - * necessary, to keep the memory footprint down. - * @exports opentype.GlyphSet - * @class - * @param {opentype.Font} - * @param {Array} - */ -function GlyphSet(font, glyphs) { - this.font = font; - this.glyphs = {}; - if (Array.isArray(glyphs)) { - for (var i = 0; i < glyphs.length; i++) { - var glyph = glyphs[i]; - glyph.path.unitsPerEm = font.unitsPerEm; - this.glyphs[i] = glyph; - } - } - - this.length = (glyphs && glyphs.length) || 0; -} - -/** - * @param {number} index - * @return {opentype.Glyph} - */ -GlyphSet.prototype.get = function(index) { - // this.glyphs[index] is 'undefined' when low memory mode is on. glyph is pushed on request only. - if (this.glyphs[index] === undefined) { - this.font._push(index); - if (typeof this.glyphs[index] === 'function') { - this.glyphs[index] = this.glyphs[index](); - } - - var glyph = this.glyphs[index]; - var unicodeObj = this.font._IndexToUnicodeMap[index]; - - if (unicodeObj) { - for (var j = 0; j < unicodeObj.unicodes.length; j++) - { glyph.addUnicode(unicodeObj.unicodes[j]); } - } - - if (this.font.cffEncoding) { - if (this.font.isCIDFont) { - glyph.name = 'gid' + index; - } else { - glyph.name = this.font.cffEncoding.charset[index]; - } - } else if (this.font.glyphNames.names) { - glyph.name = this.font.glyphNames.glyphIndexToName(index); - } - - this.glyphs[index].advanceWidth = this.font._hmtxTableData[index].advanceWidth; - this.glyphs[index].leftSideBearing = this.font._hmtxTableData[index].leftSideBearing; - } else { - if (typeof this.glyphs[index] === 'function') { - this.glyphs[index] = this.glyphs[index](); - } - } - - return this.glyphs[index]; -}; - -/** - * @param {number} index - * @param {Object} - */ -GlyphSet.prototype.push = function(index, loader) { - this.glyphs[index] = loader; - this.length++; -}; - -/** - * @alias opentype.glyphLoader - * @param {opentype.Font} font - * @param {number} index - * @return {opentype.Glyph} - */ -function glyphLoader(font, index) { - return new Glyph({index: index, font: font}); -} - -/** - * Generate a stub glyph that can be filled with all metadata *except* - * the "points" and "path" properties, which must be loaded only once - * the glyph's path is actually requested for text shaping. - * @alias opentype.ttfGlyphLoader - * @param {opentype.Font} font - * @param {number} index - * @param {Function} parseGlyph - * @param {Object} data - * @param {number} position - * @param {Function} buildPath - * @return {opentype.Glyph} - */ -function ttfGlyphLoader(font, index, parseGlyph, data, position, buildPath) { - return function() { - var glyph = new Glyph({index: index, font: font}); - - glyph.path = function() { - parseGlyph(glyph, data, position); - var path = buildPath(font.glyphs, glyph); - path.unitsPerEm = font.unitsPerEm; - return path; - }; - - defineDependentProperty(glyph, 'xMin', '_xMin'); - defineDependentProperty(glyph, 'xMax', '_xMax'); - defineDependentProperty(glyph, 'yMin', '_yMin'); - defineDependentProperty(glyph, 'yMax', '_yMax'); - - return glyph; - }; -} -/** - * @alias opentype.cffGlyphLoader - * @param {opentype.Font} font - * @param {number} index - * @param {Function} parseCFFCharstring - * @param {string} charstring - * @return {opentype.Glyph} - */ -function cffGlyphLoader(font, index, parseCFFCharstring, charstring) { - return function() { - var glyph = new Glyph({index: index, font: font}); - - glyph.path = function() { - var path = parseCFFCharstring(font, glyph, charstring); - path.unitsPerEm = font.unitsPerEm; - return path; - }; - - return glyph; - }; -} - -var glyphset = { GlyphSet: GlyphSet, glyphLoader: glyphLoader, ttfGlyphLoader: ttfGlyphLoader, cffGlyphLoader: cffGlyphLoader }; - -// The `CFF` table contains the glyph outlines in PostScript format. - -// Custom equals function that can also check lists. -function equals(a, b) { - if (a === b) { - return true; - } else if (Array.isArray(a) && Array.isArray(b)) { - if (a.length !== b.length) { - return false; - } - - for (var i = 0; i < a.length; i += 1) { - if (!equals(a[i], b[i])) { - return false; - } - } - - return true; - } else { - return false; - } -} - -// Subroutines are encoded using the negative half of the number space. -// See type 2 chapter 4.7 "Subroutine operators". -function calcCFFSubroutineBias(subrs) { - var bias; - if (subrs.length < 1240) { - bias = 107; - } else if (subrs.length < 33900) { - bias = 1131; - } else { - bias = 32768; - } - - return bias; -} - -// Parse a `CFF` INDEX array. -// An index array consists of a list of offsets, then a list of objects at those offsets. -function parseCFFIndex(data, start, conversionFn) { - var offsets = []; - var objects = []; - var count = parse.getCard16(data, start); - var objectOffset; - var endOffset; - if (count !== 0) { - var offsetSize = parse.getByte(data, start + 2); - objectOffset = start + ((count + 1) * offsetSize) + 2; - var pos = start + 3; - for (var i = 0; i < count + 1; i += 1) { - offsets.push(parse.getOffset(data, pos, offsetSize)); - pos += offsetSize; - } - - // The total size of the index array is 4 header bytes + the value of the last offset. - endOffset = objectOffset + offsets[count]; - } else { - endOffset = start + 2; - } - - for (var i$1 = 0; i$1 < offsets.length - 1; i$1 += 1) { - var value = parse.getBytes(data, objectOffset + offsets[i$1], objectOffset + offsets[i$1 + 1]); - if (conversionFn) { - value = conversionFn(value); - } - - objects.push(value); - } - - return {objects: objects, startOffset: start, endOffset: endOffset}; -} - -function parseCFFIndexLowMemory(data, start) { - var offsets = []; - var count = parse.getCard16(data, start); - var objectOffset; - var endOffset; - if (count !== 0) { - var offsetSize = parse.getByte(data, start + 2); - objectOffset = start + ((count + 1) * offsetSize) + 2; - var pos = start + 3; - for (var i = 0; i < count + 1; i += 1) { - offsets.push(parse.getOffset(data, pos, offsetSize)); - pos += offsetSize; - } - - // The total size of the index array is 4 header bytes + the value of the last offset. - endOffset = objectOffset + offsets[count]; - } else { - endOffset = start + 2; - } - - return {offsets: offsets, startOffset: start, endOffset: endOffset}; -} -function getCffIndexObject(i, offsets, data, start, conversionFn) { - var count = parse.getCard16(data, start); - var objectOffset = 0; - if (count !== 0) { - var offsetSize = parse.getByte(data, start + 2); - objectOffset = start + ((count + 1) * offsetSize) + 2; - } - - var value = parse.getBytes(data, objectOffset + offsets[i], objectOffset + offsets[i + 1]); - if (conversionFn) { - value = conversionFn(value); - } - return value; -} - -// Parse a `CFF` DICT real value. -function parseFloatOperand(parser) { - var s = ''; - var eof = 15; - var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-']; - while (true) { - var b = parser.parseByte(); - var n1 = b >> 4; - var n2 = b & 15; - - if (n1 === eof) { - break; - } - - s += lookup[n1]; - - if (n2 === eof) { - break; - } - - s += lookup[n2]; - } - - return parseFloat(s); -} - -// Parse a `CFF` DICT operand. -function parseOperand(parser, b0) { - var b1; - var b2; - var b3; - var b4; - if (b0 === 28) { - b1 = parser.parseByte(); - b2 = parser.parseByte(); - return b1 << 8 | b2; - } - - if (b0 === 29) { - b1 = parser.parseByte(); - b2 = parser.parseByte(); - b3 = parser.parseByte(); - b4 = parser.parseByte(); - return b1 << 24 | b2 << 16 | b3 << 8 | b4; - } - - if (b0 === 30) { - return parseFloatOperand(parser); - } - - if (b0 >= 32 && b0 <= 246) { - return b0 - 139; - } - - if (b0 >= 247 && b0 <= 250) { - b1 = parser.parseByte(); - return (b0 - 247) * 256 + b1 + 108; - } - - if (b0 >= 251 && b0 <= 254) { - b1 = parser.parseByte(); - return -(b0 - 251) * 256 - b1 - 108; - } - - throw new Error('Invalid b0 ' + b0); -} - -// Convert the entries returned by `parseDict` to a proper dictionary. -// If a value is a list of one, it is unpacked. -function entriesToObject(entries) { - var o = {}; - for (var i = 0; i < entries.length; i += 1) { - var key = entries[i][0]; - var values = entries[i][1]; - var value = (void 0); - if (values.length === 1) { - value = values[0]; - } else { - value = values; - } - - if (o.hasOwnProperty(key) && !isNaN(o[key])) { - throw new Error('Object ' + o + ' already has key ' + key); - } - - o[key] = value; - } - - return o; -} - -// Parse a `CFF` DICT object. -// A dictionary contains key-value pairs in a compact tokenized format. -function parseCFFDict(data, start, size) { - start = start !== undefined ? start : 0; - var parser = new parse.Parser(data, start); - var entries = []; - var operands = []; - size = size !== undefined ? size : data.length; - - while (parser.relativeOffset < size) { - var op = parser.parseByte(); - - // The first byte for each dict item distinguishes between operator (key) and operand (value). - // Values <= 21 are operators. - if (op <= 21) { - // Two-byte operators have an initial escape byte of 12. - if (op === 12) { - op = 1200 + parser.parseByte(); - } - - entries.push([op, operands]); - operands = []; - } else { - // Since the operands (values) come before the operators (keys), we store all operands in a list - // until we encounter an operator. - operands.push(parseOperand(parser, op)); - } - } - - return entriesToObject(entries); -} - -// Given a String Index (SID), return the value of the string. -// Strings below index 392 are standard CFF strings and are not encoded in the font. -function getCFFString(strings, index) { - if (index <= 390) { - index = cffStandardStrings[index]; - } else { - index = strings[index - 391]; - } - - return index; -} - -// Interpret a dictionary and return a new dictionary with readable keys and values for missing entries. -// This function takes `meta` which is a list of objects containing `operand`, `name` and `default`. -function interpretDict(dict, meta, strings) { - var newDict = {}; - var value; - - // Because we also want to include missing values, we start out from the meta list - // and lookup values in the dict. - for (var i = 0; i < meta.length; i += 1) { - var m = meta[i]; - - if (Array.isArray(m.type)) { - var values = []; - values.length = m.type.length; - for (var j = 0; j < m.type.length; j++) { - value = dict[m.op] !== undefined ? dict[m.op][j] : undefined; - if (value === undefined) { - value = m.value !== undefined && m.value[j] !== undefined ? m.value[j] : null; - } - if (m.type[j] === 'SID') { - value = getCFFString(strings, value); - } - values[j] = value; - } - newDict[m.name] = values; - } else { - value = dict[m.op]; - if (value === undefined) { - value = m.value !== undefined ? m.value : null; - } - - if (m.type === 'SID') { - value = getCFFString(strings, value); - } - newDict[m.name] = value; - } - } - - return newDict; -} - -// Parse the CFF header. -function parseCFFHeader(data, start) { - var header = {}; - header.formatMajor = parse.getCard8(data, start); - header.formatMinor = parse.getCard8(data, start + 1); - header.size = parse.getCard8(data, start + 2); - header.offsetSize = parse.getCard8(data, start + 3); - header.startOffset = start; - header.endOffset = start + 4; - return header; -} - -var TOP_DICT_META = [ - {name: 'version', op: 0, type: 'SID'}, - {name: 'notice', op: 1, type: 'SID'}, - {name: 'copyright', op: 1200, type: 'SID'}, - {name: 'fullName', op: 2, type: 'SID'}, - {name: 'familyName', op: 3, type: 'SID'}, - {name: 'weight', op: 4, type: 'SID'}, - {name: 'isFixedPitch', op: 1201, type: 'number', value: 0}, - {name: 'italicAngle', op: 1202, type: 'number', value: 0}, - {name: 'underlinePosition', op: 1203, type: 'number', value: -100}, - {name: 'underlineThickness', op: 1204, type: 'number', value: 50}, - {name: 'paintType', op: 1205, type: 'number', value: 0}, - {name: 'charstringType', op: 1206, type: 'number', value: 2}, - { - name: 'fontMatrix', - op: 1207, - type: ['real', 'real', 'real', 'real', 'real', 'real'], - value: [0.001, 0, 0, 0.001, 0, 0] - }, - {name: 'uniqueId', op: 13, type: 'number'}, - {name: 'fontBBox', op: 5, type: ['number', 'number', 'number', 'number'], value: [0, 0, 0, 0]}, - {name: 'strokeWidth', op: 1208, type: 'number', value: 0}, - {name: 'xuid', op: 14, type: [], value: null}, - {name: 'charset', op: 15, type: 'offset', value: 0}, - {name: 'encoding', op: 16, type: 'offset', value: 0}, - {name: 'charStrings', op: 17, type: 'offset', value: 0}, - {name: 'private', op: 18, type: ['number', 'offset'], value: [0, 0]}, - {name: 'ros', op: 1230, type: ['SID', 'SID', 'number']}, - {name: 'cidFontVersion', op: 1231, type: 'number', value: 0}, - {name: 'cidFontRevision', op: 1232, type: 'number', value: 0}, - {name: 'cidFontType', op: 1233, type: 'number', value: 0}, - {name: 'cidCount', op: 1234, type: 'number', value: 8720}, - {name: 'uidBase', op: 1235, type: 'number'}, - {name: 'fdArray', op: 1236, type: 'offset'}, - {name: 'fdSelect', op: 1237, type: 'offset'}, - {name: 'fontName', op: 1238, type: 'SID'} -]; - -var PRIVATE_DICT_META = [ - {name: 'subrs', op: 19, type: 'offset', value: 0}, - {name: 'defaultWidthX', op: 20, type: 'number', value: 0}, - {name: 'nominalWidthX', op: 21, type: 'number', value: 0} -]; - -// Parse the CFF top dictionary. A CFF table can contain multiple fonts, each with their own top dictionary. -// The top dictionary contains the essential metadata for the font, together with the private dictionary. -function parseCFFTopDict(data, strings) { - var dict = parseCFFDict(data, 0, data.byteLength); - return interpretDict(dict, TOP_DICT_META, strings); -} - -// Parse the CFF private dictionary. We don't fully parse out all the values, only the ones we need. -function parseCFFPrivateDict(data, start, size, strings) { - var dict = parseCFFDict(data, start, size); - return interpretDict(dict, PRIVATE_DICT_META, strings); -} - -// Returns a list of "Top DICT"s found using an INDEX list. -// Used to read both the usual high-level Top DICTs and also the FDArray -// discovered inside CID-keyed fonts. When a Top DICT has a reference to -// a Private DICT that is read and saved into the Top DICT. -// -// In addition to the expected/optional values as outlined in TOP_DICT_META -// the following values might be saved into the Top DICT. -// -// _subrs [] array of local CFF subroutines from Private DICT -// _subrsBias bias value computed from number of subroutines -// (see calcCFFSubroutineBias() and parseCFFCharstring()) -// _defaultWidthX default widths for CFF characters -// _nominalWidthX bias added to width embedded within glyph description -// -// _privateDict saved copy of parsed Private DICT from Top DICT -function gatherCFFTopDicts(data, start, cffIndex, strings) { - var topDictArray = []; - for (var iTopDict = 0; iTopDict < cffIndex.length; iTopDict += 1) { - var topDictData = new DataView(new Uint8Array(cffIndex[iTopDict]).buffer); - var topDict = parseCFFTopDict(topDictData, strings); - topDict._subrs = []; - topDict._subrsBias = 0; - topDict._defaultWidthX = 0; - topDict._nominalWidthX = 0; - var privateSize = topDict.private[0]; - var privateOffset = topDict.private[1]; - if (privateSize !== 0 && privateOffset !== 0) { - var privateDict = parseCFFPrivateDict(data, privateOffset + start, privateSize, strings); - topDict._defaultWidthX = privateDict.defaultWidthX; - topDict._nominalWidthX = privateDict.nominalWidthX; - if (privateDict.subrs !== 0) { - var subrOffset = privateOffset + privateDict.subrs; - var subrIndex = parseCFFIndex(data, subrOffset + start); - topDict._subrs = subrIndex.objects; - topDict._subrsBias = calcCFFSubroutineBias(topDict._subrs); - } - topDict._privateDict = privateDict; - } - topDictArray.push(topDict); - } - return topDictArray; -} - -// Parse the CFF charset table, which contains internal names for all the glyphs. -// This function will return a list of glyph names. -// See Adobe TN #5176 chapter 13, "Charsets". -function parseCFFCharset(data, start, nGlyphs, strings) { - var sid; - var count; - var parser = new parse.Parser(data, start); - - // The .notdef glyph is not included, so subtract 1. - nGlyphs -= 1; - var charset = ['.notdef']; - - var format = parser.parseCard8(); - if (format === 0) { - for (var i = 0; i < nGlyphs; i += 1) { - sid = parser.parseSID(); - charset.push(getCFFString(strings, sid)); - } - } else if (format === 1) { - while (charset.length <= nGlyphs) { - sid = parser.parseSID(); - count = parser.parseCard8(); - for (var i$1 = 0; i$1 <= count; i$1 += 1) { - charset.push(getCFFString(strings, sid)); - sid += 1; - } - } - } else if (format === 2) { - while (charset.length <= nGlyphs) { - sid = parser.parseSID(); - count = parser.parseCard16(); - for (var i$2 = 0; i$2 <= count; i$2 += 1) { - charset.push(getCFFString(strings, sid)); - sid += 1; - } - } - } else { - throw new Error('Unknown charset format ' + format); - } - - return charset; -} - -// Parse the CFF encoding data. Only one encoding can be specified per font. -// See Adobe TN #5176 chapter 12, "Encodings". -function parseCFFEncoding(data, start, charset) { - var code; - var enc = {}; - var parser = new parse.Parser(data, start); - var format = parser.parseCard8(); - if (format === 0) { - var nCodes = parser.parseCard8(); - for (var i = 0; i < nCodes; i += 1) { - code = parser.parseCard8(); - enc[code] = i; - } - } else if (format === 1) { - var nRanges = parser.parseCard8(); - code = 1; - for (var i$1 = 0; i$1 < nRanges; i$1 += 1) { - var first = parser.parseCard8(); - var nLeft = parser.parseCard8(); - for (var j = first; j <= first + nLeft; j += 1) { - enc[j] = code; - code += 1; - } - } - } else { - throw new Error('Unknown encoding format ' + format); - } - - return new CffEncoding(enc, charset); -} - -// Take in charstring code and return a Glyph object. -// The encoding is described in the Type 2 Charstring Format -// https://www.microsoft.com/typography/OTSPEC/charstr2.htm -function parseCFFCharstring(font, glyph, code) { - var c1x; - var c1y; - var c2x; - var c2y; - var p = new Path(); - var stack = []; - var nStems = 0; - var haveWidth = false; - var open = false; - var x = 0; - var y = 0; - var subrs; - var subrsBias; - var defaultWidthX; - var nominalWidthX; - if (font.isCIDFont) { - var fdIndex = font.tables.cff.topDict._fdSelect[glyph.index]; - var fdDict = font.tables.cff.topDict._fdArray[fdIndex]; - subrs = fdDict._subrs; - subrsBias = fdDict._subrsBias; - defaultWidthX = fdDict._defaultWidthX; - nominalWidthX = fdDict._nominalWidthX; - } else { - subrs = font.tables.cff.topDict._subrs; - subrsBias = font.tables.cff.topDict._subrsBias; - defaultWidthX = font.tables.cff.topDict._defaultWidthX; - nominalWidthX = font.tables.cff.topDict._nominalWidthX; - } - var width = defaultWidthX; - - function newContour(x, y) { - if (open) { - p.closePath(); - } - - p.moveTo(x, y); - open = true; - } - - function parseStems() { - var hasWidthArg; - - // The number of stem operators on the stack is always even. - // If the value is uneven, that means a width is specified. - hasWidthArg = stack.length % 2 !== 0; - if (hasWidthArg && !haveWidth) { - width = stack.shift() + nominalWidthX; - } - - nStems += stack.length >> 1; - stack.length = 0; - haveWidth = true; - } - - function parse(code) { - var b1; - var b2; - var b3; - var b4; - var codeIndex; - var subrCode; - var jpx; - var jpy; - var c3x; - var c3y; - var c4x; - var c4y; - - var i = 0; - while (i < code.length) { - var v = code[i]; - i += 1; - switch (v) { - case 1: // hstem - parseStems(); - break; - case 3: // vstem - parseStems(); - break; - case 4: // vmoveto - if (stack.length > 1 && !haveWidth) { - width = stack.shift() + nominalWidthX; - haveWidth = true; - } - - y += stack.pop(); - newContour(x, y); - break; - case 5: // rlineto - while (stack.length > 0) { - x += stack.shift(); - y += stack.shift(); - p.lineTo(x, y); - } - - break; - case 6: // hlineto - while (stack.length > 0) { - x += stack.shift(); - p.lineTo(x, y); - if (stack.length === 0) { - break; - } - - y += stack.shift(); - p.lineTo(x, y); - } - - break; - case 7: // vlineto - while (stack.length > 0) { - y += stack.shift(); - p.lineTo(x, y); - if (stack.length === 0) { - break; - } - - x += stack.shift(); - p.lineTo(x, y); - } - - break; - case 8: // rrcurveto - while (stack.length > 0) { - c1x = x + stack.shift(); - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y + stack.shift(); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - break; - case 10: // callsubr - codeIndex = stack.pop() + subrsBias; - subrCode = subrs[codeIndex]; - if (subrCode) { - parse(subrCode); - } - - break; - case 11: // return - return; - case 12: // flex operators - v = code[i]; - i += 1; - switch (v) { - case 35: // flex - // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 dx6 dy6 fd flex (12 35) |- - c1x = x + stack.shift(); // dx1 - c1y = y + stack.shift(); // dy1 - c2x = c1x + stack.shift(); // dx2 - c2y = c1y + stack.shift(); // dy2 - jpx = c2x + stack.shift(); // dx3 - jpy = c2y + stack.shift(); // dy3 - c3x = jpx + stack.shift(); // dx4 - c3y = jpy + stack.shift(); // dy4 - c4x = c3x + stack.shift(); // dx5 - c4y = c3y + stack.shift(); // dy5 - x = c4x + stack.shift(); // dx6 - y = c4y + stack.shift(); // dy6 - stack.shift(); // flex depth - p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy); - p.curveTo(c3x, c3y, c4x, c4y, x, y); - break; - case 34: // hflex - // |- dx1 dx2 dy2 dx3 dx4 dx5 dx6 hflex (12 34) |- - c1x = x + stack.shift(); // dx1 - c1y = y; // dy1 - c2x = c1x + stack.shift(); // dx2 - c2y = c1y + stack.shift(); // dy2 - jpx = c2x + stack.shift(); // dx3 - jpy = c2y; // dy3 - c3x = jpx + stack.shift(); // dx4 - c3y = c2y; // dy4 - c4x = c3x + stack.shift(); // dx5 - c4y = y; // dy5 - x = c4x + stack.shift(); // dx6 - p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy); - p.curveTo(c3x, c3y, c4x, c4y, x, y); - break; - case 36: // hflex1 - // |- dx1 dy1 dx2 dy2 dx3 dx4 dx5 dy5 dx6 hflex1 (12 36) |- - c1x = x + stack.shift(); // dx1 - c1y = y + stack.shift(); // dy1 - c2x = c1x + stack.shift(); // dx2 - c2y = c1y + stack.shift(); // dy2 - jpx = c2x + stack.shift(); // dx3 - jpy = c2y; // dy3 - c3x = jpx + stack.shift(); // dx4 - c3y = c2y; // dy4 - c4x = c3x + stack.shift(); // dx5 - c4y = c3y + stack.shift(); // dy5 - x = c4x + stack.shift(); // dx6 - p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy); - p.curveTo(c3x, c3y, c4x, c4y, x, y); - break; - case 37: // flex1 - // |- dx1 dy1 dx2 dy2 dx3 dy3 dx4 dy4 dx5 dy5 d6 flex1 (12 37) |- - c1x = x + stack.shift(); // dx1 - c1y = y + stack.shift(); // dy1 - c2x = c1x + stack.shift(); // dx2 - c2y = c1y + stack.shift(); // dy2 - jpx = c2x + stack.shift(); // dx3 - jpy = c2y + stack.shift(); // dy3 - c3x = jpx + stack.shift(); // dx4 - c3y = jpy + stack.shift(); // dy4 - c4x = c3x + stack.shift(); // dx5 - c4y = c3y + stack.shift(); // dy5 - if (Math.abs(c4x - x) > Math.abs(c4y - y)) { - x = c4x + stack.shift(); - } else { - y = c4y + stack.shift(); - } - - p.curveTo(c1x, c1y, c2x, c2y, jpx, jpy); - p.curveTo(c3x, c3y, c4x, c4y, x, y); - break; - default: - console.log('Glyph ' + glyph.index + ': unknown operator ' + 1200 + v); - stack.length = 0; - } - break; - case 14: // endchar - if (stack.length > 0 && !haveWidth) { - width = stack.shift() + nominalWidthX; - haveWidth = true; - } - - if (open) { - p.closePath(); - open = false; - } - - break; - case 18: // hstemhm - parseStems(); - break; - case 19: // hintmask - case 20: // cntrmask - parseStems(); - i += (nStems + 7) >> 3; - break; - case 21: // rmoveto - if (stack.length > 2 && !haveWidth) { - width = stack.shift() + nominalWidthX; - haveWidth = true; - } - - y += stack.pop(); - x += stack.pop(); - newContour(x, y); - break; - case 22: // hmoveto - if (stack.length > 1 && !haveWidth) { - width = stack.shift() + nominalWidthX; - haveWidth = true; - } - - x += stack.pop(); - newContour(x, y); - break; - case 23: // vstemhm - parseStems(); - break; - case 24: // rcurveline - while (stack.length > 2) { - c1x = x + stack.shift(); - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y + stack.shift(); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - x += stack.shift(); - y += stack.shift(); - p.lineTo(x, y); - break; - case 25: // rlinecurve - while (stack.length > 6) { - x += stack.shift(); - y += stack.shift(); - p.lineTo(x, y); - } - - c1x = x + stack.shift(); - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y + stack.shift(); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - break; - case 26: // vvcurveto - if (stack.length % 2) { - x += stack.shift(); - } - - while (stack.length > 0) { - c1x = x; - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x; - y = c2y + stack.shift(); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - break; - case 27: // hhcurveto - if (stack.length % 2) { - y += stack.shift(); - } - - while (stack.length > 0) { - c1x = x + stack.shift(); - c1y = y; - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y; - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - break; - case 28: // shortint - b1 = code[i]; - b2 = code[i + 1]; - stack.push(((b1 << 24) | (b2 << 16)) >> 16); - i += 2; - break; - case 29: // callgsubr - codeIndex = stack.pop() + font.gsubrsBias; - subrCode = font.gsubrs[codeIndex]; - if (subrCode) { - parse(subrCode); - } - - break; - case 30: // vhcurveto - while (stack.length > 0) { - c1x = x; - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y + (stack.length === 1 ? stack.shift() : 0); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - if (stack.length === 0) { - break; - } - - c1x = x + stack.shift(); - c1y = y; - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - y = c2y + stack.shift(); - x = c2x + (stack.length === 1 ? stack.shift() : 0); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - break; - case 31: // hvcurveto - while (stack.length > 0) { - c1x = x + stack.shift(); - c1y = y; - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - y = c2y + stack.shift(); - x = c2x + (stack.length === 1 ? stack.shift() : 0); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - if (stack.length === 0) { - break; - } - - c1x = x; - c1y = y + stack.shift(); - c2x = c1x + stack.shift(); - c2y = c1y + stack.shift(); - x = c2x + stack.shift(); - y = c2y + (stack.length === 1 ? stack.shift() : 0); - p.curveTo(c1x, c1y, c2x, c2y, x, y); - } - - break; - default: - if (v < 32) { - console.log('Glyph ' + glyph.index + ': unknown operator ' + v); - } else if (v < 247) { - stack.push(v - 139); - } else if (v < 251) { - b1 = code[i]; - i += 1; - stack.push((v - 247) * 256 + b1 + 108); - } else if (v < 255) { - b1 = code[i]; - i += 1; - stack.push(-(v - 251) * 256 - b1 - 108); - } else { - b1 = code[i]; - b2 = code[i + 1]; - b3 = code[i + 2]; - b4 = code[i + 3]; - i += 4; - stack.push(((b1 << 24) | (b2 << 16) | (b3 << 8) | b4) / 65536); - } - } - } - } - - parse(code); - - glyph.advanceWidth = width; - return p; -} - -function parseCFFFDSelect(data, start, nGlyphs, fdArrayCount) { - var fdSelect = []; - var fdIndex; - var parser = new parse.Parser(data, start); - var format = parser.parseCard8(); - if (format === 0) { - // Simple list of nGlyphs elements - for (var iGid = 0; iGid < nGlyphs; iGid++) { - fdIndex = parser.parseCard8(); - if (fdIndex >= fdArrayCount) { - throw new Error('CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')'); - } - fdSelect.push(fdIndex); - } - } else if (format === 3) { - // Ranges - var nRanges = parser.parseCard16(); - var first = parser.parseCard16(); - if (first !== 0) { - throw new Error('CFF Table CID Font FDSelect format 3 range has bad initial GID ' + first); - } - var next; - for (var iRange = 0; iRange < nRanges; iRange++) { - fdIndex = parser.parseCard8(); - next = parser.parseCard16(); - if (fdIndex >= fdArrayCount) { - throw new Error('CFF table CID Font FDSelect has bad FD index value ' + fdIndex + ' (FD count ' + fdArrayCount + ')'); - } - if (next > nGlyphs) { - throw new Error('CFF Table CID Font FDSelect format 3 range has bad GID ' + next); - } - for (; first < next; first++) { - fdSelect.push(fdIndex); - } - first = next; - } - if (next !== nGlyphs) { - throw new Error('CFF Table CID Font FDSelect format 3 range has bad final GID ' + next); - } - } else { - throw new Error('CFF Table CID Font FDSelect table has unsupported format ' + format); - } - return fdSelect; -} - -// Parse the `CFF` table, which contains the glyph outlines in PostScript format. -function parseCFFTable(data, start, font, opt) { - font.tables.cff = {}; - var header = parseCFFHeader(data, start); - var nameIndex = parseCFFIndex(data, header.endOffset, parse.bytesToString); - var topDictIndex = parseCFFIndex(data, nameIndex.endOffset); - var stringIndex = parseCFFIndex(data, topDictIndex.endOffset, parse.bytesToString); - var globalSubrIndex = parseCFFIndex(data, stringIndex.endOffset); - font.gsubrs = globalSubrIndex.objects; - font.gsubrsBias = calcCFFSubroutineBias(font.gsubrs); - - var topDictArray = gatherCFFTopDicts(data, start, topDictIndex.objects, stringIndex.objects); - if (topDictArray.length !== 1) { - throw new Error('CFF table has too many fonts in \'FontSet\' - count of fonts NameIndex.length = ' + topDictArray.length); - } - - var topDict = topDictArray[0]; - font.tables.cff.topDict = topDict; - - if (topDict._privateDict) { - font.defaultWidthX = topDict._privateDict.defaultWidthX; - font.nominalWidthX = topDict._privateDict.nominalWidthX; - } - - if (topDict.ros[0] !== undefined && topDict.ros[1] !== undefined) { - font.isCIDFont = true; - } - - if (font.isCIDFont) { - var fdArrayOffset = topDict.fdArray; - var fdSelectOffset = topDict.fdSelect; - if (fdArrayOffset === 0 || fdSelectOffset === 0) { - throw new Error('Font is marked as a CID font, but FDArray and/or FDSelect information is missing'); - } - fdArrayOffset += start; - var fdArrayIndex = parseCFFIndex(data, fdArrayOffset); - var fdArray = gatherCFFTopDicts(data, start, fdArrayIndex.objects, stringIndex.objects); - topDict._fdArray = fdArray; - fdSelectOffset += start; - topDict._fdSelect = parseCFFFDSelect(data, fdSelectOffset, font.numGlyphs, fdArray.length); - } - - var privateDictOffset = start + topDict.private[1]; - var privateDict = parseCFFPrivateDict(data, privateDictOffset, topDict.private[0], stringIndex.objects); - font.defaultWidthX = privateDict.defaultWidthX; - font.nominalWidthX = privateDict.nominalWidthX; - - if (privateDict.subrs !== 0) { - var subrOffset = privateDictOffset + privateDict.subrs; - var subrIndex = parseCFFIndex(data, subrOffset); - font.subrs = subrIndex.objects; - font.subrsBias = calcCFFSubroutineBias(font.subrs); - } else { - font.subrs = []; - font.subrsBias = 0; - } - - // Offsets in the top dict are relative to the beginning of the CFF data, so add the CFF start offset. - var charStringsIndex; - if (opt.lowMemory) { - charStringsIndex = parseCFFIndexLowMemory(data, start + topDict.charStrings); - font.nGlyphs = charStringsIndex.offsets.length; - } else { - charStringsIndex = parseCFFIndex(data, start + topDict.charStrings); - font.nGlyphs = charStringsIndex.objects.length; - } - - var charset = parseCFFCharset(data, start + topDict.charset, font.nGlyphs, stringIndex.objects); - if (topDict.encoding === 0) { - // Standard encoding - font.cffEncoding = new CffEncoding(cffStandardEncoding, charset); - } else if (topDict.encoding === 1) { - // Expert encoding - font.cffEncoding = new CffEncoding(cffExpertEncoding, charset); - } else { - font.cffEncoding = parseCFFEncoding(data, start + topDict.encoding, charset); - } - - // Prefer the CMAP encoding to the CFF encoding. - font.encoding = font.encoding || font.cffEncoding; - - font.glyphs = new glyphset.GlyphSet(font); - if (opt.lowMemory) { - font._push = function(i) { - var charString = getCffIndexObject(i, charStringsIndex.offsets, data, start + topDict.charStrings); - font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString)); - }; - } else { - for (var i = 0; i < font.nGlyphs; i += 1) { - var charString = charStringsIndex.objects[i]; - font.glyphs.push(i, glyphset.cffGlyphLoader(font, i, parseCFFCharstring, charString)); - } - } -} - -// Convert a string to a String ID (SID). -// The list of strings is modified in place. -function encodeString(s, strings) { - var sid; - - // Is the string in the CFF standard strings? - var i = cffStandardStrings.indexOf(s); - if (i >= 0) { - sid = i; - } - - // Is the string already in the string index? - i = strings.indexOf(s); - if (i >= 0) { - sid = i + cffStandardStrings.length; - } else { - sid = cffStandardStrings.length + strings.length; - strings.push(s); - } - - return sid; -} - -function makeHeader() { - return new table.Record('Header', [ - {name: 'major', type: 'Card8', value: 1}, - {name: 'minor', type: 'Card8', value: 0}, - {name: 'hdrSize', type: 'Card8', value: 4}, - {name: 'major', type: 'Card8', value: 1} - ]); -} - -function makeNameIndex(fontNames) { - var t = new table.Record('Name INDEX', [ - {name: 'names', type: 'INDEX', value: []} - ]); - t.names = []; - for (var i = 0; i < fontNames.length; i += 1) { - t.names.push({name: 'name_' + i, type: 'NAME', value: fontNames[i]}); - } - - return t; -} - -// Given a dictionary's metadata, create a DICT structure. -function makeDict(meta, attrs, strings) { - var m = {}; - for (var i = 0; i < meta.length; i += 1) { - var entry = meta[i]; - var value = attrs[entry.name]; - if (value !== undefined && !equals(value, entry.value)) { - if (entry.type === 'SID') { - value = encodeString(value, strings); - } - - m[entry.op] = {name: entry.name, type: entry.type, value: value}; - } - } - - return m; -} - -// The Top DICT houses the global font attributes. -function makeTopDict(attrs, strings) { - var t = new table.Record('Top DICT', [ - {name: 'dict', type: 'DICT', value: {}} - ]); - t.dict = makeDict(TOP_DICT_META, attrs, strings); - return t; -} - -function makeTopDictIndex(topDict) { - var t = new table.Record('Top DICT INDEX', [ - {name: 'topDicts', type: 'INDEX', value: []} - ]); - t.topDicts = [{name: 'topDict_0', type: 'TABLE', value: topDict}]; - return t; -} - -function makeStringIndex(strings) { - var t = new table.Record('String INDEX', [ - {name: 'strings', type: 'INDEX', value: []} - ]); - t.strings = []; - for (var i = 0; i < strings.length; i += 1) { - t.strings.push({name: 'string_' + i, type: 'STRING', value: strings[i]}); - } - - return t; -} - -function makeGlobalSubrIndex() { - // Currently we don't use subroutines. - return new table.Record('Global Subr INDEX', [ - {name: 'subrs', type: 'INDEX', value: []} - ]); -} - -function makeCharsets(glyphNames, strings) { - var t = new table.Record('Charsets', [ - {name: 'format', type: 'Card8', value: 0} - ]); - for (var i = 0; i < glyphNames.length; i += 1) { - var glyphName = glyphNames[i]; - var glyphSID = encodeString(glyphName, strings); - t.fields.push({name: 'glyph_' + i, type: 'SID', value: glyphSID}); - } - - return t; -} - -function glyphToOps(glyph) { - var ops = []; - var path = glyph.path; - ops.push({name: 'width', type: 'NUMBER', value: glyph.advanceWidth}); - var x = 0; - var y = 0; - for (var i = 0; i < path.commands.length; i += 1) { - var dx = (void 0); - var dy = (void 0); - var cmd = path.commands[i]; - if (cmd.type === 'Q') { - // CFF only supports bézier curves, so convert the quad to a bézier. - var _13 = 1 / 3; - var _23 = 2 / 3; - - // We're going to create a new command so we don't change the original path. - // Since all coordinates are relative, we round() them ASAP to avoid propagating errors. - cmd = { - type: 'C', - x: cmd.x, - y: cmd.y, - x1: Math.round(_13 * x + _23 * cmd.x1), - y1: Math.round(_13 * y + _23 * cmd.y1), - x2: Math.round(_13 * cmd.x + _23 * cmd.x1), - y2: Math.round(_13 * cmd.y + _23 * cmd.y1) - }; - } - - if (cmd.type === 'M') { - dx = Math.round(cmd.x - x); - dy = Math.round(cmd.y - y); - ops.push({name: 'dx', type: 'NUMBER', value: dx}); - ops.push({name: 'dy', type: 'NUMBER', value: dy}); - ops.push({name: 'rmoveto', type: 'OP', value: 21}); - x = Math.round(cmd.x); - y = Math.round(cmd.y); - } else if (cmd.type === 'L') { - dx = Math.round(cmd.x - x); - dy = Math.round(cmd.y - y); - ops.push({name: 'dx', type: 'NUMBER', value: dx}); - ops.push({name: 'dy', type: 'NUMBER', value: dy}); - ops.push({name: 'rlineto', type: 'OP', value: 5}); - x = Math.round(cmd.x); - y = Math.round(cmd.y); - } else if (cmd.type === 'C') { - var dx1 = Math.round(cmd.x1 - x); - var dy1 = Math.round(cmd.y1 - y); - var dx2 = Math.round(cmd.x2 - cmd.x1); - var dy2 = Math.round(cmd.y2 - cmd.y1); - dx = Math.round(cmd.x - cmd.x2); - dy = Math.round(cmd.y - cmd.y2); - ops.push({name: 'dx1', type: 'NUMBER', value: dx1}); - ops.push({name: 'dy1', type: 'NUMBER', value: dy1}); - ops.push({name: 'dx2', type: 'NUMBER', value: dx2}); - ops.push({name: 'dy2', type: 'NUMBER', value: dy2}); - ops.push({name: 'dx', type: 'NUMBER', value: dx}); - ops.push({name: 'dy', type: 'NUMBER', value: dy}); - ops.push({name: 'rrcurveto', type: 'OP', value: 8}); - x = Math.round(cmd.x); - y = Math.round(cmd.y); - } - - // Contours are closed automatically. - } - - ops.push({name: 'endchar', type: 'OP', value: 14}); - return ops; -} - -function makeCharStringsIndex(glyphs) { - var t = new table.Record('CharStrings INDEX', [ - {name: 'charStrings', type: 'INDEX', value: []} - ]); - - for (var i = 0; i < glyphs.length; i += 1) { - var glyph = glyphs.get(i); - var ops = glyphToOps(glyph); - t.charStrings.push({name: glyph.name, type: 'CHARSTRING', value: ops}); - } - - return t; -} - -function makePrivateDict(attrs, strings) { - var t = new table.Record('Private DICT', [ - {name: 'dict', type: 'DICT', value: {}} - ]); - t.dict = makeDict(PRIVATE_DICT_META, attrs, strings); - return t; -} - -function makeCFFTable(glyphs, options) { - var t = new table.Table('CFF ', [ - {name: 'header', type: 'RECORD'}, - {name: 'nameIndex', type: 'RECORD'}, - {name: 'topDictIndex', type: 'RECORD'}, - {name: 'stringIndex', type: 'RECORD'}, - {name: 'globalSubrIndex', type: 'RECORD'}, - {name: 'charsets', type: 'RECORD'}, - {name: 'charStringsIndex', type: 'RECORD'}, - {name: 'privateDict', type: 'RECORD'} - ]); - - var fontScale = 1 / options.unitsPerEm; - // We use non-zero values for the offsets so that the DICT encodes them. - // This is important because the size of the Top DICT plays a role in offset calculation, - // and the size shouldn't change after we've written correct offsets. - var attrs = { - version: options.version, - fullName: options.fullName, - familyName: options.familyName, - weight: options.weightName, - fontBBox: options.fontBBox || [0, 0, 0, 0], - fontMatrix: [fontScale, 0, 0, fontScale, 0, 0], - charset: 999, - encoding: 0, - charStrings: 999, - private: [0, 999] - }; - - var privateAttrs = {}; - - var glyphNames = []; - var glyph; - - // Skip first glyph (.notdef) - for (var i = 1; i < glyphs.length; i += 1) { - glyph = glyphs.get(i); - glyphNames.push(glyph.name); - } - - var strings = []; - - t.header = makeHeader(); - t.nameIndex = makeNameIndex([options.postScriptName]); - var topDict = makeTopDict(attrs, strings); - t.topDictIndex = makeTopDictIndex(topDict); - t.globalSubrIndex = makeGlobalSubrIndex(); - t.charsets = makeCharsets(glyphNames, strings); - t.charStringsIndex = makeCharStringsIndex(glyphs); - t.privateDict = makePrivateDict(privateAttrs, strings); - - // Needs to come at the end, to encode all custom strings used in the font. - t.stringIndex = makeStringIndex(strings); - - var startOffset = t.header.sizeOf() + - t.nameIndex.sizeOf() + - t.topDictIndex.sizeOf() + - t.stringIndex.sizeOf() + - t.globalSubrIndex.sizeOf(); - attrs.charset = startOffset; - - // We use the CFF standard encoding; proper encoding will be handled in cmap. - attrs.encoding = 0; - attrs.charStrings = attrs.charset + t.charsets.sizeOf(); - attrs.private[1] = attrs.charStrings + t.charStringsIndex.sizeOf(); - - // Recreate the Top DICT INDEX with the correct offsets. - topDict = makeTopDict(attrs, strings); - t.topDictIndex = makeTopDictIndex(topDict); - - return t; -} - -var cff = { parse: parseCFFTable, make: makeCFFTable }; - -// The `head` table contains global information about the font. - -// Parse the header `head` table -function parseHeadTable(data, start) { - var head = {}; - var p = new parse.Parser(data, start); - head.version = p.parseVersion(); - head.fontRevision = Math.round(p.parseFixed() * 1000) / 1000; - head.checkSumAdjustment = p.parseULong(); - head.magicNumber = p.parseULong(); - check.argument(head.magicNumber === 0x5F0F3CF5, 'Font header has wrong magic number.'); - head.flags = p.parseUShort(); - head.unitsPerEm = p.parseUShort(); - head.created = p.parseLongDateTime(); - head.modified = p.parseLongDateTime(); - head.xMin = p.parseShort(); - head.yMin = p.parseShort(); - head.xMax = p.parseShort(); - head.yMax = p.parseShort(); - head.macStyle = p.parseUShort(); - head.lowestRecPPEM = p.parseUShort(); - head.fontDirectionHint = p.parseShort(); - head.indexToLocFormat = p.parseShort(); - head.glyphDataFormat = p.parseShort(); - return head; -} - -function makeHeadTable(options) { - // Apple Mac timestamp epoch is 01/01/1904 not 01/01/1970 - var timestamp = Math.round(new Date().getTime() / 1000) + 2082844800; - var createdTimestamp = timestamp; - - if (options.createdTimestamp) { - createdTimestamp = options.createdTimestamp + 2082844800; - } - - return new table.Table('head', [ - {name: 'version', type: 'FIXED', value: 0x00010000}, - {name: 'fontRevision', type: 'FIXED', value: 0x00010000}, - {name: 'checkSumAdjustment', type: 'ULONG', value: 0}, - {name: 'magicNumber', type: 'ULONG', value: 0x5F0F3CF5}, - {name: 'flags', type: 'USHORT', value: 0}, - {name: 'unitsPerEm', type: 'USHORT', value: 1000}, - {name: 'created', type: 'LONGDATETIME', value: createdTimestamp}, - {name: 'modified', type: 'LONGDATETIME', value: timestamp}, - {name: 'xMin', type: 'SHORT', value: 0}, - {name: 'yMin', type: 'SHORT', value: 0}, - {name: 'xMax', type: 'SHORT', value: 0}, - {name: 'yMax', type: 'SHORT', value: 0}, - {name: 'macStyle', type: 'USHORT', value: 0}, - {name: 'lowestRecPPEM', type: 'USHORT', value: 0}, - {name: 'fontDirectionHint', type: 'SHORT', value: 2}, - {name: 'indexToLocFormat', type: 'SHORT', value: 0}, - {name: 'glyphDataFormat', type: 'SHORT', value: 0} - ], options); -} - -var head = { parse: parseHeadTable, make: makeHeadTable }; - -// The `hhea` table contains information for horizontal layout. - -// Parse the horizontal header `hhea` table -function parseHheaTable(data, start) { - var hhea = {}; - var p = new parse.Parser(data, start); - hhea.version = p.parseVersion(); - hhea.ascender = p.parseShort(); - hhea.descender = p.parseShort(); - hhea.lineGap = p.parseShort(); - hhea.advanceWidthMax = p.parseUShort(); - hhea.minLeftSideBearing = p.parseShort(); - hhea.minRightSideBearing = p.parseShort(); - hhea.xMaxExtent = p.parseShort(); - hhea.caretSlopeRise = p.parseShort(); - hhea.caretSlopeRun = p.parseShort(); - hhea.caretOffset = p.parseShort(); - p.relativeOffset += 8; - hhea.metricDataFormat = p.parseShort(); - hhea.numberOfHMetrics = p.parseUShort(); - return hhea; -} - -function makeHheaTable(options) { - return new table.Table('hhea', [ - {name: 'version', type: 'FIXED', value: 0x00010000}, - {name: 'ascender', type: 'FWORD', value: 0}, - {name: 'descender', type: 'FWORD', value: 0}, - {name: 'lineGap', type: 'FWORD', value: 0}, - {name: 'advanceWidthMax', type: 'UFWORD', value: 0}, - {name: 'minLeftSideBearing', type: 'FWORD', value: 0}, - {name: 'minRightSideBearing', type: 'FWORD', value: 0}, - {name: 'xMaxExtent', type: 'FWORD', value: 0}, - {name: 'caretSlopeRise', type: 'SHORT', value: 1}, - {name: 'caretSlopeRun', type: 'SHORT', value: 0}, - {name: 'caretOffset', type: 'SHORT', value: 0}, - {name: 'reserved1', type: 'SHORT', value: 0}, - {name: 'reserved2', type: 'SHORT', value: 0}, - {name: 'reserved3', type: 'SHORT', value: 0}, - {name: 'reserved4', type: 'SHORT', value: 0}, - {name: 'metricDataFormat', type: 'SHORT', value: 0}, - {name: 'numberOfHMetrics', type: 'USHORT', value: 0} - ], options); -} - -var hhea = { parse: parseHheaTable, make: makeHheaTable }; - -// The `hmtx` table contains the horizontal metrics for all glyphs. - -function parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs) { - var advanceWidth; - var leftSideBearing; - var p = new parse.Parser(data, start); - for (var i = 0; i < numGlyphs; i += 1) { - // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs. - if (i < numMetrics) { - advanceWidth = p.parseUShort(); - leftSideBearing = p.parseShort(); - } - - var glyph = glyphs.get(i); - glyph.advanceWidth = advanceWidth; - glyph.leftSideBearing = leftSideBearing; - } -} - -function parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs) { - font._hmtxTableData = {}; - - var advanceWidth; - var leftSideBearing; - var p = new parse.Parser(data, start); - for (var i = 0; i < numGlyphs; i += 1) { - // If the font is monospaced, only one entry is needed. This last entry applies to all subsequent glyphs. - if (i < numMetrics) { - advanceWidth = p.parseUShort(); - leftSideBearing = p.parseShort(); - } - - font._hmtxTableData[i] = { - advanceWidth: advanceWidth, - leftSideBearing: leftSideBearing - }; - } -} - -// Parse the `hmtx` table, which contains the horizontal metrics for all glyphs. -// This function augments the glyph array, adding the advanceWidth and leftSideBearing to each glyph. -function parseHmtxTable(font, data, start, numMetrics, numGlyphs, glyphs, opt) { - if (opt.lowMemory) - { parseHmtxTableOnLowMemory(font, data, start, numMetrics, numGlyphs); } - else - { parseHmtxTableAll(data, start, numMetrics, numGlyphs, glyphs); } -} - -function makeHmtxTable(glyphs) { - var t = new table.Table('hmtx', []); - for (var i = 0; i < glyphs.length; i += 1) { - var glyph = glyphs.get(i); - var advanceWidth = glyph.advanceWidth || 0; - var leftSideBearing = glyph.leftSideBearing || 0; - t.fields.push({name: 'advanceWidth_' + i, type: 'USHORT', value: advanceWidth}); - t.fields.push({name: 'leftSideBearing_' + i, type: 'SHORT', value: leftSideBearing}); - } - - return t; -} - -var hmtx = { parse: parseHmtxTable, make: makeHmtxTable }; - -// The `ltag` table stores IETF BCP-47 language tags. It allows supporting - -function makeLtagTable(tags) { - var result = new table.Table('ltag', [ - {name: 'version', type: 'ULONG', value: 1}, - {name: 'flags', type: 'ULONG', value: 0}, - {name: 'numTags', type: 'ULONG', value: tags.length} - ]); - - var stringPool = ''; - var stringPoolOffset = 12 + tags.length * 4; - for (var i = 0; i < tags.length; ++i) { - var pos = stringPool.indexOf(tags[i]); - if (pos < 0) { - pos = stringPool.length; - stringPool += tags[i]; - } - - result.fields.push({name: 'offset ' + i, type: 'USHORT', value: stringPoolOffset + pos}); - result.fields.push({name: 'length ' + i, type: 'USHORT', value: tags[i].length}); - } - - result.fields.push({name: 'stringPool', type: 'CHARARRAY', value: stringPool}); - return result; -} - -function parseLtagTable(data, start) { - var p = new parse.Parser(data, start); - var tableVersion = p.parseULong(); - check.argument(tableVersion === 1, 'Unsupported ltag table version.'); - // The 'ltag' specification does not define any flags; skip the field. - p.skip('uLong', 1); - var numTags = p.parseULong(); - - var tags = []; - for (var i = 0; i < numTags; i++) { - var tag = ''; - var offset = start + p.parseUShort(); - var length = p.parseUShort(); - for (var j = offset; j < offset + length; ++j) { - tag += String.fromCharCode(data.getInt8(j)); - } - - tags.push(tag); - } - - return tags; -} - -var ltag = { make: makeLtagTable, parse: parseLtagTable }; - -// The `maxp` table establishes the memory requirements for the font. - -// Parse the maximum profile `maxp` table. -function parseMaxpTable(data, start) { - var maxp = {}; - var p = new parse.Parser(data, start); - maxp.version = p.parseVersion(); - maxp.numGlyphs = p.parseUShort(); - if (maxp.version === 1.0) { - maxp.maxPoints = p.parseUShort(); - maxp.maxContours = p.parseUShort(); - maxp.maxCompositePoints = p.parseUShort(); - maxp.maxCompositeContours = p.parseUShort(); - maxp.maxZones = p.parseUShort(); - maxp.maxTwilightPoints = p.parseUShort(); - maxp.maxStorage = p.parseUShort(); - maxp.maxFunctionDefs = p.parseUShort(); - maxp.maxInstructionDefs = p.parseUShort(); - maxp.maxStackElements = p.parseUShort(); - maxp.maxSizeOfInstructions = p.parseUShort(); - maxp.maxComponentElements = p.parseUShort(); - maxp.maxComponentDepth = p.parseUShort(); - } - - return maxp; -} - -function makeMaxpTable(numGlyphs) { - return new table.Table('maxp', [ - {name: 'version', type: 'FIXED', value: 0x00005000}, - {name: 'numGlyphs', type: 'USHORT', value: numGlyphs} - ]); -} - -var maxp = { parse: parseMaxpTable, make: makeMaxpTable }; - -// The `name` naming table. - -// NameIDs for the name table. -var nameTableNames = [ - 'copyright', // 0 - 'fontFamily', // 1 - 'fontSubfamily', // 2 - 'uniqueID', // 3 - 'fullName', // 4 - 'version', // 5 - 'postScriptName', // 6 - 'trademark', // 7 - 'manufacturer', // 8 - 'designer', // 9 - 'description', // 10 - 'manufacturerURL', // 11 - 'designerURL', // 12 - 'license', // 13 - 'licenseURL', // 14 - 'reserved', // 15 - 'preferredFamily', // 16 - 'preferredSubfamily', // 17 - 'compatibleFullName', // 18 - 'sampleText', // 19 - 'postScriptFindFontName', // 20 - 'wwsFamily', // 21 - 'wwsSubfamily' // 22 -]; - -var macLanguages = { - 0: 'en', - 1: 'fr', - 2: 'de', - 3: 'it', - 4: 'nl', - 5: 'sv', - 6: 'es', - 7: 'da', - 8: 'pt', - 9: 'no', - 10: 'he', - 11: 'ja', - 12: 'ar', - 13: 'fi', - 14: 'el', - 15: 'is', - 16: 'mt', - 17: 'tr', - 18: 'hr', - 19: 'zh-Hant', - 20: 'ur', - 21: 'hi', - 22: 'th', - 23: 'ko', - 24: 'lt', - 25: 'pl', - 26: 'hu', - 27: 'es', - 28: 'lv', - 29: 'se', - 30: 'fo', - 31: 'fa', - 32: 'ru', - 33: 'zh', - 34: 'nl-BE', - 35: 'ga', - 36: 'sq', - 37: 'ro', - 38: 'cz', - 39: 'sk', - 40: 'si', - 41: 'yi', - 42: 'sr', - 43: 'mk', - 44: 'bg', - 45: 'uk', - 46: 'be', - 47: 'uz', - 48: 'kk', - 49: 'az-Cyrl', - 50: 'az-Arab', - 51: 'hy', - 52: 'ka', - 53: 'mo', - 54: 'ky', - 55: 'tg', - 56: 'tk', - 57: 'mn-CN', - 58: 'mn', - 59: 'ps', - 60: 'ks', - 61: 'ku', - 62: 'sd', - 63: 'bo', - 64: 'ne', - 65: 'sa', - 66: 'mr', - 67: 'bn', - 68: 'as', - 69: 'gu', - 70: 'pa', - 71: 'or', - 72: 'ml', - 73: 'kn', - 74: 'ta', - 75: 'te', - 76: 'si', - 77: 'my', - 78: 'km', - 79: 'lo', - 80: 'vi', - 81: 'id', - 82: 'tl', - 83: 'ms', - 84: 'ms-Arab', - 85: 'am', - 86: 'ti', - 87: 'om', - 88: 'so', - 89: 'sw', - 90: 'rw', - 91: 'rn', - 92: 'ny', - 93: 'mg', - 94: 'eo', - 128: 'cy', - 129: 'eu', - 130: 'ca', - 131: 'la', - 132: 'qu', - 133: 'gn', - 134: 'ay', - 135: 'tt', - 136: 'ug', - 137: 'dz', - 138: 'jv', - 139: 'su', - 140: 'gl', - 141: 'af', - 142: 'br', - 143: 'iu', - 144: 'gd', - 145: 'gv', - 146: 'ga', - 147: 'to', - 148: 'el-polyton', - 149: 'kl', - 150: 'az', - 151: 'nn' -}; - -// MacOS language ID → MacOS script ID -// -// Note that the script ID is not sufficient to determine what encoding -// to use in TrueType files. For some languages, MacOS used a modification -// of a mainstream script. For example, an Icelandic name would be stored -// with smRoman in the TrueType naming table, but the actual encoding -// is a special Icelandic version of the normal Macintosh Roman encoding. -// As another example, Inuktitut uses an 8-bit encoding for Canadian Aboriginal -// Syllables but MacOS had run out of available script codes, so this was -// done as a (pretty radical) "modification" of Ethiopic. -// -// http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt -var macLanguageToScript = { - 0: 0, // langEnglish → smRoman - 1: 0, // langFrench → smRoman - 2: 0, // langGerman → smRoman - 3: 0, // langItalian → smRoman - 4: 0, // langDutch → smRoman - 5: 0, // langSwedish → smRoman - 6: 0, // langSpanish → smRoman - 7: 0, // langDanish → smRoman - 8: 0, // langPortuguese → smRoman - 9: 0, // langNorwegian → smRoman - 10: 5, // langHebrew → smHebrew - 11: 1, // langJapanese → smJapanese - 12: 4, // langArabic → smArabic - 13: 0, // langFinnish → smRoman - 14: 6, // langGreek → smGreek - 15: 0, // langIcelandic → smRoman (modified) - 16: 0, // langMaltese → smRoman - 17: 0, // langTurkish → smRoman (modified) - 18: 0, // langCroatian → smRoman (modified) - 19: 2, // langTradChinese → smTradChinese - 20: 4, // langUrdu → smArabic - 21: 9, // langHindi → smDevanagari - 22: 21, // langThai → smThai - 23: 3, // langKorean → smKorean - 24: 29, // langLithuanian → smCentralEuroRoman - 25: 29, // langPolish → smCentralEuroRoman - 26: 29, // langHungarian → smCentralEuroRoman - 27: 29, // langEstonian → smCentralEuroRoman - 28: 29, // langLatvian → smCentralEuroRoman - 29: 0, // langSami → smRoman - 30: 0, // langFaroese → smRoman (modified) - 31: 4, // langFarsi → smArabic (modified) - 32: 7, // langRussian → smCyrillic - 33: 25, // langSimpChinese → smSimpChinese - 34: 0, // langFlemish → smRoman - 35: 0, // langIrishGaelic → smRoman (modified) - 36: 0, // langAlbanian → smRoman - 37: 0, // langRomanian → smRoman (modified) - 38: 29, // langCzech → smCentralEuroRoman - 39: 29, // langSlovak → smCentralEuroRoman - 40: 0, // langSlovenian → smRoman (modified) - 41: 5, // langYiddish → smHebrew - 42: 7, // langSerbian → smCyrillic - 43: 7, // langMacedonian → smCyrillic - 44: 7, // langBulgarian → smCyrillic - 45: 7, // langUkrainian → smCyrillic (modified) - 46: 7, // langByelorussian → smCyrillic - 47: 7, // langUzbek → smCyrillic - 48: 7, // langKazakh → smCyrillic - 49: 7, // langAzerbaijani → smCyrillic - 50: 4, // langAzerbaijanAr → smArabic - 51: 24, // langArmenian → smArmenian - 52: 23, // langGeorgian → smGeorgian - 53: 7, // langMoldavian → smCyrillic - 54: 7, // langKirghiz → smCyrillic - 55: 7, // langTajiki → smCyrillic - 56: 7, // langTurkmen → smCyrillic - 57: 27, // langMongolian → smMongolian - 58: 7, // langMongolianCyr → smCyrillic - 59: 4, // langPashto → smArabic - 60: 4, // langKurdish → smArabic - 61: 4, // langKashmiri → smArabic - 62: 4, // langSindhi → smArabic - 63: 26, // langTibetan → smTibetan - 64: 9, // langNepali → smDevanagari - 65: 9, // langSanskrit → smDevanagari - 66: 9, // langMarathi → smDevanagari - 67: 13, // langBengali → smBengali - 68: 13, // langAssamese → smBengali - 69: 11, // langGujarati → smGujarati - 70: 10, // langPunjabi → smGurmukhi - 71: 12, // langOriya → smOriya - 72: 17, // langMalayalam → smMalayalam - 73: 16, // langKannada → smKannada - 74: 14, // langTamil → smTamil - 75: 15, // langTelugu → smTelugu - 76: 18, // langSinhalese → smSinhalese - 77: 19, // langBurmese → smBurmese - 78: 20, // langKhmer → smKhmer - 79: 22, // langLao → smLao - 80: 30, // langVietnamese → smVietnamese - 81: 0, // langIndonesian → smRoman - 82: 0, // langTagalog → smRoman - 83: 0, // langMalayRoman → smRoman - 84: 4, // langMalayArabic → smArabic - 85: 28, // langAmharic → smEthiopic - 86: 28, // langTigrinya → smEthiopic - 87: 28, // langOromo → smEthiopic - 88: 0, // langSomali → smRoman - 89: 0, // langSwahili → smRoman - 90: 0, // langKinyarwanda → smRoman - 91: 0, // langRundi → smRoman - 92: 0, // langNyanja → smRoman - 93: 0, // langMalagasy → smRoman - 94: 0, // langEsperanto → smRoman - 128: 0, // langWelsh → smRoman (modified) - 129: 0, // langBasque → smRoman - 130: 0, // langCatalan → smRoman - 131: 0, // langLatin → smRoman - 132: 0, // langQuechua → smRoman - 133: 0, // langGuarani → smRoman - 134: 0, // langAymara → smRoman - 135: 7, // langTatar → smCyrillic - 136: 4, // langUighur → smArabic - 137: 26, // langDzongkha → smTibetan - 138: 0, // langJavaneseRom → smRoman - 139: 0, // langSundaneseRom → smRoman - 140: 0, // langGalician → smRoman - 141: 0, // langAfrikaans → smRoman - 142: 0, // langBreton → smRoman (modified) - 143: 28, // langInuktitut → smEthiopic (modified) - 144: 0, // langScottishGaelic → smRoman (modified) - 145: 0, // langManxGaelic → smRoman (modified) - 146: 0, // langIrishGaelicScript → smRoman (modified) - 147: 0, // langTongan → smRoman - 148: 6, // langGreekAncient → smRoman - 149: 0, // langGreenlandic → smRoman - 150: 0, // langAzerbaijanRoman → smRoman - 151: 0 // langNynorsk → smRoman -}; - -// While Microsoft indicates a region/country for all its language -// IDs, we omit the region code if it's equal to the "most likely -// region subtag" according to Unicode CLDR. For scripts, we omit -// the subtag if it is equal to the Suppress-Script entry in the -// IANA language subtag registry for IETF BCP 47. -// -// For example, Microsoft states that its language code 0x041A is -// Croatian in Croatia. We transform this to the BCP 47 language code 'hr' -// and not 'hr-HR' because Croatia is the default country for Croatian, -// according to Unicode CLDR. As another example, Microsoft states -// that 0x101A is Croatian (Latin) in Bosnia-Herzegovina. We transform -// this to 'hr-BA' and not 'hr-Latn-BA' because Latin is the default script -// for the Croatian language, according to IANA. -// -// http://www.unicode.org/cldr/charts/latest/supplemental/likely_subtags.html -// http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry -var windowsLanguages = { - 0x0436: 'af', - 0x041C: 'sq', - 0x0484: 'gsw', - 0x045E: 'am', - 0x1401: 'ar-DZ', - 0x3C01: 'ar-BH', - 0x0C01: 'ar', - 0x0801: 'ar-IQ', - 0x2C01: 'ar-JO', - 0x3401: 'ar-KW', - 0x3001: 'ar-LB', - 0x1001: 'ar-LY', - 0x1801: 'ary', - 0x2001: 'ar-OM', - 0x4001: 'ar-QA', - 0x0401: 'ar-SA', - 0x2801: 'ar-SY', - 0x1C01: 'aeb', - 0x3801: 'ar-AE', - 0x2401: 'ar-YE', - 0x042B: 'hy', - 0x044D: 'as', - 0x082C: 'az-Cyrl', - 0x042C: 'az', - 0x046D: 'ba', - 0x042D: 'eu', - 0x0423: 'be', - 0x0845: 'bn', - 0x0445: 'bn-IN', - 0x201A: 'bs-Cyrl', - 0x141A: 'bs', - 0x047E: 'br', - 0x0402: 'bg', - 0x0403: 'ca', - 0x0C04: 'zh-HK', - 0x1404: 'zh-MO', - 0x0804: 'zh', - 0x1004: 'zh-SG', - 0x0404: 'zh-TW', - 0x0483: 'co', - 0x041A: 'hr', - 0x101A: 'hr-BA', - 0x0405: 'cs', - 0x0406: 'da', - 0x048C: 'prs', - 0x0465: 'dv', - 0x0813: 'nl-BE', - 0x0413: 'nl', - 0x0C09: 'en-AU', - 0x2809: 'en-BZ', - 0x1009: 'en-CA', - 0x2409: 'en-029', - 0x4009: 'en-IN', - 0x1809: 'en-IE', - 0x2009: 'en-JM', - 0x4409: 'en-MY', - 0x1409: 'en-NZ', - 0x3409: 'en-PH', - 0x4809: 'en-SG', - 0x1C09: 'en-ZA', - 0x2C09: 'en-TT', - 0x0809: 'en-GB', - 0x0409: 'en', - 0x3009: 'en-ZW', - 0x0425: 'et', - 0x0438: 'fo', - 0x0464: 'fil', - 0x040B: 'fi', - 0x080C: 'fr-BE', - 0x0C0C: 'fr-CA', - 0x040C: 'fr', - 0x140C: 'fr-LU', - 0x180C: 'fr-MC', - 0x100C: 'fr-CH', - 0x0462: 'fy', - 0x0456: 'gl', - 0x0437: 'ka', - 0x0C07: 'de-AT', - 0x0407: 'de', - 0x1407: 'de-LI', - 0x1007: 'de-LU', - 0x0807: 'de-CH', - 0x0408: 'el', - 0x046F: 'kl', - 0x0447: 'gu', - 0x0468: 'ha', - 0x040D: 'he', - 0x0439: 'hi', - 0x040E: 'hu', - 0x040F: 'is', - 0x0470: 'ig', - 0x0421: 'id', - 0x045D: 'iu', - 0x085D: 'iu-Latn', - 0x083C: 'ga', - 0x0434: 'xh', - 0x0435: 'zu', - 0x0410: 'it', - 0x0810: 'it-CH', - 0x0411: 'ja', - 0x044B: 'kn', - 0x043F: 'kk', - 0x0453: 'km', - 0x0486: 'quc', - 0x0487: 'rw', - 0x0441: 'sw', - 0x0457: 'kok', - 0x0412: 'ko', - 0x0440: 'ky', - 0x0454: 'lo', - 0x0426: 'lv', - 0x0427: 'lt', - 0x082E: 'dsb', - 0x046E: 'lb', - 0x042F: 'mk', - 0x083E: 'ms-BN', - 0x043E: 'ms', - 0x044C: 'ml', - 0x043A: 'mt', - 0x0481: 'mi', - 0x047A: 'arn', - 0x044E: 'mr', - 0x047C: 'moh', - 0x0450: 'mn', - 0x0850: 'mn-CN', - 0x0461: 'ne', - 0x0414: 'nb', - 0x0814: 'nn', - 0x0482: 'oc', - 0x0448: 'or', - 0x0463: 'ps', - 0x0415: 'pl', - 0x0416: 'pt', - 0x0816: 'pt-PT', - 0x0446: 'pa', - 0x046B: 'qu-BO', - 0x086B: 'qu-EC', - 0x0C6B: 'qu', - 0x0418: 'ro', - 0x0417: 'rm', - 0x0419: 'ru', - 0x243B: 'smn', - 0x103B: 'smj-NO', - 0x143B: 'smj', - 0x0C3B: 'se-FI', - 0x043B: 'se', - 0x083B: 'se-SE', - 0x203B: 'sms', - 0x183B: 'sma-NO', - 0x1C3B: 'sms', - 0x044F: 'sa', - 0x1C1A: 'sr-Cyrl-BA', - 0x0C1A: 'sr', - 0x181A: 'sr-Latn-BA', - 0x081A: 'sr-Latn', - 0x046C: 'nso', - 0x0432: 'tn', - 0x045B: 'si', - 0x041B: 'sk', - 0x0424: 'sl', - 0x2C0A: 'es-AR', - 0x400A: 'es-BO', - 0x340A: 'es-CL', - 0x240A: 'es-CO', - 0x140A: 'es-CR', - 0x1C0A: 'es-DO', - 0x300A: 'es-EC', - 0x440A: 'es-SV', - 0x100A: 'es-GT', - 0x480A: 'es-HN', - 0x080A: 'es-MX', - 0x4C0A: 'es-NI', - 0x180A: 'es-PA', - 0x3C0A: 'es-PY', - 0x280A: 'es-PE', - 0x500A: 'es-PR', - - // Microsoft has defined two different language codes for - // “Spanish with modern sorting” and “Spanish with traditional - // sorting”. This makes sense for collation APIs, and it would be - // possible to express this in BCP 47 language tags via Unicode - // extensions (eg., es-u-co-trad is Spanish with traditional - // sorting). However, for storing names in fonts, the distinction - // does not make sense, so we give “es” in both cases. - 0x0C0A: 'es', - 0x040A: 'es', - - 0x540A: 'es-US', - 0x380A: 'es-UY', - 0x200A: 'es-VE', - 0x081D: 'sv-FI', - 0x041D: 'sv', - 0x045A: 'syr', - 0x0428: 'tg', - 0x085F: 'tzm', - 0x0449: 'ta', - 0x0444: 'tt', - 0x044A: 'te', - 0x041E: 'th', - 0x0451: 'bo', - 0x041F: 'tr', - 0x0442: 'tk', - 0x0480: 'ug', - 0x0422: 'uk', - 0x042E: 'hsb', - 0x0420: 'ur', - 0x0843: 'uz-Cyrl', - 0x0443: 'uz', - 0x042A: 'vi', - 0x0452: 'cy', - 0x0488: 'wo', - 0x0485: 'sah', - 0x0478: 'ii', - 0x046A: 'yo' -}; - -// Returns a IETF BCP 47 language code, for example 'zh-Hant' -// for 'Chinese in the traditional script'. -function getLanguageCode(platformID, languageID, ltag) { - switch (platformID) { - case 0: // Unicode - if (languageID === 0xFFFF) { - return 'und'; - } else if (ltag) { - return ltag[languageID]; - } - - break; - - case 1: // Macintosh - return macLanguages[languageID]; - - case 3: // Windows - return windowsLanguages[languageID]; - } - - return undefined; -} - -var utf16 = 'utf-16'; - -// MacOS script ID → encoding. This table stores the default case, -// which can be overridden by macLanguageEncodings. -var macScriptEncodings = { - 0: 'macintosh', // smRoman - 1: 'x-mac-japanese', // smJapanese - 2: 'x-mac-chinesetrad', // smTradChinese - 3: 'x-mac-korean', // smKorean - 6: 'x-mac-greek', // smGreek - 7: 'x-mac-cyrillic', // smCyrillic - 9: 'x-mac-devanagai', // smDevanagari - 10: 'x-mac-gurmukhi', // smGurmukhi - 11: 'x-mac-gujarati', // smGujarati - 12: 'x-mac-oriya', // smOriya - 13: 'x-mac-bengali', // smBengali - 14: 'x-mac-tamil', // smTamil - 15: 'x-mac-telugu', // smTelugu - 16: 'x-mac-kannada', // smKannada - 17: 'x-mac-malayalam', // smMalayalam - 18: 'x-mac-sinhalese', // smSinhalese - 19: 'x-mac-burmese', // smBurmese - 20: 'x-mac-khmer', // smKhmer - 21: 'x-mac-thai', // smThai - 22: 'x-mac-lao', // smLao - 23: 'x-mac-georgian', // smGeorgian - 24: 'x-mac-armenian', // smArmenian - 25: 'x-mac-chinesesimp', // smSimpChinese - 26: 'x-mac-tibetan', // smTibetan - 27: 'x-mac-mongolian', // smMongolian - 28: 'x-mac-ethiopic', // smEthiopic - 29: 'x-mac-ce', // smCentralEuroRoman - 30: 'x-mac-vietnamese', // smVietnamese - 31: 'x-mac-extarabic' // smExtArabic -}; - -// MacOS language ID → encoding. This table stores the exceptional -// cases, which override macScriptEncodings. For writing MacOS naming -// tables, we need to emit a MacOS script ID. Therefore, we cannot -// merge macScriptEncodings into macLanguageEncodings. -// -// http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/Readme.txt -var macLanguageEncodings = { - 15: 'x-mac-icelandic', // langIcelandic - 17: 'x-mac-turkish', // langTurkish - 18: 'x-mac-croatian', // langCroatian - 24: 'x-mac-ce', // langLithuanian - 25: 'x-mac-ce', // langPolish - 26: 'x-mac-ce', // langHungarian - 27: 'x-mac-ce', // langEstonian - 28: 'x-mac-ce', // langLatvian - 30: 'x-mac-icelandic', // langFaroese - 37: 'x-mac-romanian', // langRomanian - 38: 'x-mac-ce', // langCzech - 39: 'x-mac-ce', // langSlovak - 40: 'x-mac-ce', // langSlovenian - 143: 'x-mac-inuit', // langInuktitut - 146: 'x-mac-gaelic' // langIrishGaelicScript -}; - -function getEncoding(platformID, encodingID, languageID) { - switch (platformID) { - case 0: // Unicode - return utf16; - - case 1: // Apple Macintosh - return macLanguageEncodings[languageID] || macScriptEncodings[encodingID]; - - case 3: // Microsoft Windows - if (encodingID === 1 || encodingID === 10) { - return utf16; - } - - break; - } - - return undefined; -} - -// Parse the naming `name` table. -// FIXME: Format 1 additional fields are not supported yet. -// ltag is the content of the `ltag' table, such as ['en', 'zh-Hans', 'de-CH-1904']. -function parseNameTable(data, start, ltag) { - var name = {}; - var p = new parse.Parser(data, start); - var format = p.parseUShort(); - var count = p.parseUShort(); - var stringOffset = p.offset + p.parseUShort(); - for (var i = 0; i < count; i++) { - var platformID = p.parseUShort(); - var encodingID = p.parseUShort(); - var languageID = p.parseUShort(); - var nameID = p.parseUShort(); - var property = nameTableNames[nameID] || nameID; - var byteLength = p.parseUShort(); - var offset = p.parseUShort(); - var language = getLanguageCode(platformID, languageID, ltag); - var encoding = getEncoding(platformID, encodingID, languageID); - if (encoding !== undefined && language !== undefined) { - var text = (void 0); - if (encoding === utf16) { - text = decode.UTF16(data, stringOffset + offset, byteLength); - } else { - text = decode.MACSTRING(data, stringOffset + offset, byteLength, encoding); - } - - if (text) { - var translations = name[property]; - if (translations === undefined) { - translations = name[property] = {}; - } - - translations[language] = text; - } - } - } - - var langTagCount = 0; - if (format === 1) { - // FIXME: Also handle Microsoft's 'name' table 1. - langTagCount = p.parseUShort(); - } - - return name; -} - -// {23: 'foo'} → {'foo': 23} -// ['bar', 'baz'] → {'bar': 0, 'baz': 1} -function reverseDict(dict) { - var result = {}; - for (var key in dict) { - result[dict[key]] = parseInt(key); - } - - return result; -} - -function makeNameRecord(platformID, encodingID, languageID, nameID, length, offset) { - return new table.Record('NameRecord', [ - {name: 'platformID', type: 'USHORT', value: platformID}, - {name: 'encodingID', type: 'USHORT', value: encodingID}, - {name: 'languageID', type: 'USHORT', value: languageID}, - {name: 'nameID', type: 'USHORT', value: nameID}, - {name: 'length', type: 'USHORT', value: length}, - {name: 'offset', type: 'USHORT', value: offset} - ]); -} - -// Finds the position of needle in haystack, or -1 if not there. -// Like String.indexOf(), but for arrays. -function findSubArray(needle, haystack) { - var needleLength = needle.length; - var limit = haystack.length - needleLength + 1; - - loop: - for (var pos = 0; pos < limit; pos++) { - for (; pos < limit; pos++) { - for (var k = 0; k < needleLength; k++) { - if (haystack[pos + k] !== needle[k]) { - continue loop; - } - } - - return pos; - } - } - - return -1; -} - -function addStringToPool(s, pool) { - var offset = findSubArray(s, pool); - if (offset < 0) { - offset = pool.length; - var i = 0; - var len = s.length; - for (; i < len; ++i) { - pool.push(s[i]); - } - - } - - return offset; -} - -function makeNameTable(names, ltag) { - var nameID; - var nameIDs = []; - - var namesWithNumericKeys = {}; - var nameTableIds = reverseDict(nameTableNames); - for (var key in names) { - var id = nameTableIds[key]; - if (id === undefined) { - id = key; - } - - nameID = parseInt(id); - - if (isNaN(nameID)) { - throw new Error('Name table entry "' + key + '" does not exist, see nameTableNames for complete list.'); - } - - namesWithNumericKeys[nameID] = names[key]; - nameIDs.push(nameID); - } - - var macLanguageIds = reverseDict(macLanguages); - var windowsLanguageIds = reverseDict(windowsLanguages); - - var nameRecords = []; - var stringPool = []; - - for (var i = 0; i < nameIDs.length; i++) { - nameID = nameIDs[i]; - var translations = namesWithNumericKeys[nameID]; - for (var lang in translations) { - var text = translations[lang]; - - // For MacOS, we try to emit the name in the form that was introduced - // in the initial version of the TrueType spec (in the late 1980s). - // However, this can fail for various reasons: the requested BCP 47 - // language code might not have an old-style Mac equivalent; - // we might not have a codec for the needed character encoding; - // or the name might contain characters that cannot be expressed - // in the old-style Macintosh encoding. In case of failure, we emit - // the name in a more modern fashion (Unicode encoding with BCP 47 - // language tags) that is recognized by MacOS 10.5, released in 2009. - // If fonts were only read by operating systems, we could simply - // emit all names in the modern form; this would be much easier. - // However, there are many applications and libraries that read - // 'name' tables directly, and these will usually only recognize - // the ancient form (silently skipping the unrecognized names). - var macPlatform = 1; // Macintosh - var macLanguage = macLanguageIds[lang]; - var macScript = macLanguageToScript[macLanguage]; - var macEncoding = getEncoding(macPlatform, macScript, macLanguage); - var macName = encode.MACSTRING(text, macEncoding); - if (macName === undefined) { - macPlatform = 0; // Unicode - macLanguage = ltag.indexOf(lang); - if (macLanguage < 0) { - macLanguage = ltag.length; - ltag.push(lang); - } - - macScript = 4; // Unicode 2.0 and later - macName = encode.UTF16(text); - } - - var macNameOffset = addStringToPool(macName, stringPool); - nameRecords.push(makeNameRecord(macPlatform, macScript, macLanguage, - nameID, macName.length, macNameOffset)); - - var winLanguage = windowsLanguageIds[lang]; - if (winLanguage !== undefined) { - var winName = encode.UTF16(text); - var winNameOffset = addStringToPool(winName, stringPool); - nameRecords.push(makeNameRecord(3, 1, winLanguage, - nameID, winName.length, winNameOffset)); - } - } - } - - nameRecords.sort(function(a, b) { - return ((a.platformID - b.platformID) || - (a.encodingID - b.encodingID) || - (a.languageID - b.languageID) || - (a.nameID - b.nameID)); - }); - - var t = new table.Table('name', [ - {name: 'format', type: 'USHORT', value: 0}, - {name: 'count', type: 'USHORT', value: nameRecords.length}, - {name: 'stringOffset', type: 'USHORT', value: 6 + nameRecords.length * 12} - ]); - - for (var r = 0; r < nameRecords.length; r++) { - t.fields.push({name: 'record_' + r, type: 'RECORD', value: nameRecords[r]}); - } - - t.fields.push({name: 'strings', type: 'LITERAL', value: stringPool}); - return t; -} - -var _name = { parse: parseNameTable, make: makeNameTable }; - -// The `OS/2` table contains metrics required in OpenType fonts. - -var unicodeRanges = [ - {begin: 0x0000, end: 0x007F}, // Basic Latin - {begin: 0x0080, end: 0x00FF}, // Latin-1 Supplement - {begin: 0x0100, end: 0x017F}, // Latin Extended-A - {begin: 0x0180, end: 0x024F}, // Latin Extended-B - {begin: 0x0250, end: 0x02AF}, // IPA Extensions - {begin: 0x02B0, end: 0x02FF}, // Spacing Modifier Letters - {begin: 0x0300, end: 0x036F}, // Combining Diacritical Marks - {begin: 0x0370, end: 0x03FF}, // Greek and Coptic - {begin: 0x2C80, end: 0x2CFF}, // Coptic - {begin: 0x0400, end: 0x04FF}, // Cyrillic - {begin: 0x0530, end: 0x058F}, // Armenian - {begin: 0x0590, end: 0x05FF}, // Hebrew - {begin: 0xA500, end: 0xA63F}, // Vai - {begin: 0x0600, end: 0x06FF}, // Arabic - {begin: 0x07C0, end: 0x07FF}, // NKo - {begin: 0x0900, end: 0x097F}, // Devanagari - {begin: 0x0980, end: 0x09FF}, // Bengali - {begin: 0x0A00, end: 0x0A7F}, // Gurmukhi - {begin: 0x0A80, end: 0x0AFF}, // Gujarati - {begin: 0x0B00, end: 0x0B7F}, // Oriya - {begin: 0x0B80, end: 0x0BFF}, // Tamil - {begin: 0x0C00, end: 0x0C7F}, // Telugu - {begin: 0x0C80, end: 0x0CFF}, // Kannada - {begin: 0x0D00, end: 0x0D7F}, // Malayalam - {begin: 0x0E00, end: 0x0E7F}, // Thai - {begin: 0x0E80, end: 0x0EFF}, // Lao - {begin: 0x10A0, end: 0x10FF}, // Georgian - {begin: 0x1B00, end: 0x1B7F}, // Balinese - {begin: 0x1100, end: 0x11FF}, // Hangul Jamo - {begin: 0x1E00, end: 0x1EFF}, // Latin Extended Additional - {begin: 0x1F00, end: 0x1FFF}, // Greek Extended - {begin: 0x2000, end: 0x206F}, // General Punctuation - {begin: 0x2070, end: 0x209F}, // Superscripts And Subscripts - {begin: 0x20A0, end: 0x20CF}, // Currency Symbol - {begin: 0x20D0, end: 0x20FF}, // Combining Diacritical Marks For Symbols - {begin: 0x2100, end: 0x214F}, // Letterlike Symbols - {begin: 0x2150, end: 0x218F}, // Number Forms - {begin: 0x2190, end: 0x21FF}, // Arrows - {begin: 0x2200, end: 0x22FF}, // Mathematical Operators - {begin: 0x2300, end: 0x23FF}, // Miscellaneous Technical - {begin: 0x2400, end: 0x243F}, // Control Pictures - {begin: 0x2440, end: 0x245F}, // Optical Character Recognition - {begin: 0x2460, end: 0x24FF}, // Enclosed Alphanumerics - {begin: 0x2500, end: 0x257F}, // Box Drawing - {begin: 0x2580, end: 0x259F}, // Block Elements - {begin: 0x25A0, end: 0x25FF}, // Geometric Shapes - {begin: 0x2600, end: 0x26FF}, // Miscellaneous Symbols - {begin: 0x2700, end: 0x27BF}, // Dingbats - {begin: 0x3000, end: 0x303F}, // CJK Symbols And Punctuation - {begin: 0x3040, end: 0x309F}, // Hiragana - {begin: 0x30A0, end: 0x30FF}, // Katakana - {begin: 0x3100, end: 0x312F}, // Bopomofo - {begin: 0x3130, end: 0x318F}, // Hangul Compatibility Jamo - {begin: 0xA840, end: 0xA87F}, // Phags-pa - {begin: 0x3200, end: 0x32FF}, // Enclosed CJK Letters And Months - {begin: 0x3300, end: 0x33FF}, // CJK Compatibility - {begin: 0xAC00, end: 0xD7AF}, // Hangul Syllables - {begin: 0xD800, end: 0xDFFF}, // Non-Plane 0 * - {begin: 0x10900, end: 0x1091F}, // Phoenicia - {begin: 0x4E00, end: 0x9FFF}, // CJK Unified Ideographs - {begin: 0xE000, end: 0xF8FF}, // Private Use Area (plane 0) - {begin: 0x31C0, end: 0x31EF}, // CJK Strokes - {begin: 0xFB00, end: 0xFB4F}, // Alphabetic Presentation Forms - {begin: 0xFB50, end: 0xFDFF}, // Arabic Presentation Forms-A - {begin: 0xFE20, end: 0xFE2F}, // Combining Half Marks - {begin: 0xFE10, end: 0xFE1F}, // Vertical Forms - {begin: 0xFE50, end: 0xFE6F}, // Small Form Variants - {begin: 0xFE70, end: 0xFEFF}, // Arabic Presentation Forms-B - {begin: 0xFF00, end: 0xFFEF}, // Halfwidth And Fullwidth Forms - {begin: 0xFFF0, end: 0xFFFF}, // Specials - {begin: 0x0F00, end: 0x0FFF}, // Tibetan - {begin: 0x0700, end: 0x074F}, // Syriac - {begin: 0x0780, end: 0x07BF}, // Thaana - {begin: 0x0D80, end: 0x0DFF}, // Sinhala - {begin: 0x1000, end: 0x109F}, // Myanmar - {begin: 0x1200, end: 0x137F}, // Ethiopic - {begin: 0x13A0, end: 0x13FF}, // Cherokee - {begin: 0x1400, end: 0x167F}, // Unified Canadian Aboriginal Syllabics - {begin: 0x1680, end: 0x169F}, // Ogham - {begin: 0x16A0, end: 0x16FF}, // Runic - {begin: 0x1780, end: 0x17FF}, // Khmer - {begin: 0x1800, end: 0x18AF}, // Mongolian - {begin: 0x2800, end: 0x28FF}, // Braille Patterns - {begin: 0xA000, end: 0xA48F}, // Yi Syllables - {begin: 0x1700, end: 0x171F}, // Tagalog - {begin: 0x10300, end: 0x1032F}, // Old Italic - {begin: 0x10330, end: 0x1034F}, // Gothic - {begin: 0x10400, end: 0x1044F}, // Deseret - {begin: 0x1D000, end: 0x1D0FF}, // Byzantine Musical Symbols - {begin: 0x1D400, end: 0x1D7FF}, // Mathematical Alphanumeric Symbols - {begin: 0xFF000, end: 0xFFFFD}, // Private Use (plane 15) - {begin: 0xFE00, end: 0xFE0F}, // Variation Selectors - {begin: 0xE0000, end: 0xE007F}, // Tags - {begin: 0x1900, end: 0x194F}, // Limbu - {begin: 0x1950, end: 0x197F}, // Tai Le - {begin: 0x1980, end: 0x19DF}, // New Tai Lue - {begin: 0x1A00, end: 0x1A1F}, // Buginese - {begin: 0x2C00, end: 0x2C5F}, // Glagolitic - {begin: 0x2D30, end: 0x2D7F}, // Tifinagh - {begin: 0x4DC0, end: 0x4DFF}, // Yijing Hexagram Symbols - {begin: 0xA800, end: 0xA82F}, // Syloti Nagri - {begin: 0x10000, end: 0x1007F}, // Linear B Syllabary - {begin: 0x10140, end: 0x1018F}, // Ancient Greek Numbers - {begin: 0x10380, end: 0x1039F}, // Ugaritic - {begin: 0x103A0, end: 0x103DF}, // Old Persian - {begin: 0x10450, end: 0x1047F}, // Shavian - {begin: 0x10480, end: 0x104AF}, // Osmanya - {begin: 0x10800, end: 0x1083F}, // Cypriot Syllabary - {begin: 0x10A00, end: 0x10A5F}, // Kharoshthi - {begin: 0x1D300, end: 0x1D35F}, // Tai Xuan Jing Symbols - {begin: 0x12000, end: 0x123FF}, // Cuneiform - {begin: 0x1D360, end: 0x1D37F}, // Counting Rod Numerals - {begin: 0x1B80, end: 0x1BBF}, // Sundanese - {begin: 0x1C00, end: 0x1C4F}, // Lepcha - {begin: 0x1C50, end: 0x1C7F}, // Ol Chiki - {begin: 0xA880, end: 0xA8DF}, // Saurashtra - {begin: 0xA900, end: 0xA92F}, // Kayah Li - {begin: 0xA930, end: 0xA95F}, // Rejang - {begin: 0xAA00, end: 0xAA5F}, // Cham - {begin: 0x10190, end: 0x101CF}, // Ancient Symbols - {begin: 0x101D0, end: 0x101FF}, // Phaistos Disc - {begin: 0x102A0, end: 0x102DF}, // Carian - {begin: 0x1F030, end: 0x1F09F} // Domino Tiles -]; - -function getUnicodeRange(unicode) { - for (var i = 0; i < unicodeRanges.length; i += 1) { - var range = unicodeRanges[i]; - if (unicode >= range.begin && unicode < range.end) { - return i; - } - } - - return -1; -} - -// Parse the OS/2 and Windows metrics `OS/2` table -function parseOS2Table(data, start) { - var os2 = {}; - var p = new parse.Parser(data, start); - os2.version = p.parseUShort(); - os2.xAvgCharWidth = p.parseShort(); - os2.usWeightClass = p.parseUShort(); - os2.usWidthClass = p.parseUShort(); - os2.fsType = p.parseUShort(); - os2.ySubscriptXSize = p.parseShort(); - os2.ySubscriptYSize = p.parseShort(); - os2.ySubscriptXOffset = p.parseShort(); - os2.ySubscriptYOffset = p.parseShort(); - os2.ySuperscriptXSize = p.parseShort(); - os2.ySuperscriptYSize = p.parseShort(); - os2.ySuperscriptXOffset = p.parseShort(); - os2.ySuperscriptYOffset = p.parseShort(); - os2.yStrikeoutSize = p.parseShort(); - os2.yStrikeoutPosition = p.parseShort(); - os2.sFamilyClass = p.parseShort(); - os2.panose = []; - for (var i = 0; i < 10; i++) { - os2.panose[i] = p.parseByte(); - } - - os2.ulUnicodeRange1 = p.parseULong(); - os2.ulUnicodeRange2 = p.parseULong(); - os2.ulUnicodeRange3 = p.parseULong(); - os2.ulUnicodeRange4 = p.parseULong(); - os2.achVendID = String.fromCharCode(p.parseByte(), p.parseByte(), p.parseByte(), p.parseByte()); - os2.fsSelection = p.parseUShort(); - os2.usFirstCharIndex = p.parseUShort(); - os2.usLastCharIndex = p.parseUShort(); - os2.sTypoAscender = p.parseShort(); - os2.sTypoDescender = p.parseShort(); - os2.sTypoLineGap = p.parseShort(); - os2.usWinAscent = p.parseUShort(); - os2.usWinDescent = p.parseUShort(); - if (os2.version >= 1) { - os2.ulCodePageRange1 = p.parseULong(); - os2.ulCodePageRange2 = p.parseULong(); - } - - if (os2.version >= 2) { - os2.sxHeight = p.parseShort(); - os2.sCapHeight = p.parseShort(); - os2.usDefaultChar = p.parseUShort(); - os2.usBreakChar = p.parseUShort(); - os2.usMaxContent = p.parseUShort(); - } - - return os2; -} - -function makeOS2Table(options) { - return new table.Table('OS/2', [ - {name: 'version', type: 'USHORT', value: 0x0003}, - {name: 'xAvgCharWidth', type: 'SHORT', value: 0}, - {name: 'usWeightClass', type: 'USHORT', value: 0}, - {name: 'usWidthClass', type: 'USHORT', value: 0}, - {name: 'fsType', type: 'USHORT', value: 0}, - {name: 'ySubscriptXSize', type: 'SHORT', value: 650}, - {name: 'ySubscriptYSize', type: 'SHORT', value: 699}, - {name: 'ySubscriptXOffset', type: 'SHORT', value: 0}, - {name: 'ySubscriptYOffset', type: 'SHORT', value: 140}, - {name: 'ySuperscriptXSize', type: 'SHORT', value: 650}, - {name: 'ySuperscriptYSize', type: 'SHORT', value: 699}, - {name: 'ySuperscriptXOffset', type: 'SHORT', value: 0}, - {name: 'ySuperscriptYOffset', type: 'SHORT', value: 479}, - {name: 'yStrikeoutSize', type: 'SHORT', value: 49}, - {name: 'yStrikeoutPosition', type: 'SHORT', value: 258}, - {name: 'sFamilyClass', type: 'SHORT', value: 0}, - {name: 'bFamilyType', type: 'BYTE', value: 0}, - {name: 'bSerifStyle', type: 'BYTE', value: 0}, - {name: 'bWeight', type: 'BYTE', value: 0}, - {name: 'bProportion', type: 'BYTE', value: 0}, - {name: 'bContrast', type: 'BYTE', value: 0}, - {name: 'bStrokeVariation', type: 'BYTE', value: 0}, - {name: 'bArmStyle', type: 'BYTE', value: 0}, - {name: 'bLetterform', type: 'BYTE', value: 0}, - {name: 'bMidline', type: 'BYTE', value: 0}, - {name: 'bXHeight', type: 'BYTE', value: 0}, - {name: 'ulUnicodeRange1', type: 'ULONG', value: 0}, - {name: 'ulUnicodeRange2', type: 'ULONG', value: 0}, - {name: 'ulUnicodeRange3', type: 'ULONG', value: 0}, - {name: 'ulUnicodeRange4', type: 'ULONG', value: 0}, - {name: 'achVendID', type: 'CHARARRAY', value: 'XXXX'}, - {name: 'fsSelection', type: 'USHORT', value: 0}, - {name: 'usFirstCharIndex', type: 'USHORT', value: 0}, - {name: 'usLastCharIndex', type: 'USHORT', value: 0}, - {name: 'sTypoAscender', type: 'SHORT', value: 0}, - {name: 'sTypoDescender', type: 'SHORT', value: 0}, - {name: 'sTypoLineGap', type: 'SHORT', value: 0}, - {name: 'usWinAscent', type: 'USHORT', value: 0}, - {name: 'usWinDescent', type: 'USHORT', value: 0}, - {name: 'ulCodePageRange1', type: 'ULONG', value: 0}, - {name: 'ulCodePageRange2', type: 'ULONG', value: 0}, - {name: 'sxHeight', type: 'SHORT', value: 0}, - {name: 'sCapHeight', type: 'SHORT', value: 0}, - {name: 'usDefaultChar', type: 'USHORT', value: 0}, - {name: 'usBreakChar', type: 'USHORT', value: 0}, - {name: 'usMaxContext', type: 'USHORT', value: 0} - ], options); -} - -var os2 = { parse: parseOS2Table, make: makeOS2Table, unicodeRanges: unicodeRanges, getUnicodeRange: getUnicodeRange }; - -// The `post` table stores additional PostScript information, such as glyph names. - -// Parse the PostScript `post` table -function parsePostTable(data, start) { - var post = {}; - var p = new parse.Parser(data, start); - post.version = p.parseVersion(); - post.italicAngle = p.parseFixed(); - post.underlinePosition = p.parseShort(); - post.underlineThickness = p.parseShort(); - post.isFixedPitch = p.parseULong(); - post.minMemType42 = p.parseULong(); - post.maxMemType42 = p.parseULong(); - post.minMemType1 = p.parseULong(); - post.maxMemType1 = p.parseULong(); - switch (post.version) { - case 1: - post.names = standardNames.slice(); - break; - case 2: - post.numberOfGlyphs = p.parseUShort(); - post.glyphNameIndex = new Array(post.numberOfGlyphs); - for (var i = 0; i < post.numberOfGlyphs; i++) { - post.glyphNameIndex[i] = p.parseUShort(); - } - - post.names = []; - for (var i$1 = 0; i$1 < post.numberOfGlyphs; i$1++) { - if (post.glyphNameIndex[i$1] >= standardNames.length) { - var nameLength = p.parseChar(); - post.names.push(p.parseString(nameLength)); - } - } - - break; - case 2.5: - post.numberOfGlyphs = p.parseUShort(); - post.offset = new Array(post.numberOfGlyphs); - for (var i$2 = 0; i$2 < post.numberOfGlyphs; i$2++) { - post.offset[i$2] = p.parseChar(); - } - - break; - } - return post; -} - -function makePostTable() { - return new table.Table('post', [ - {name: 'version', type: 'FIXED', value: 0x00030000}, - {name: 'italicAngle', type: 'FIXED', value: 0}, - {name: 'underlinePosition', type: 'FWORD', value: 0}, - {name: 'underlineThickness', type: 'FWORD', value: 0}, - {name: 'isFixedPitch', type: 'ULONG', value: 0}, - {name: 'minMemType42', type: 'ULONG', value: 0}, - {name: 'maxMemType42', type: 'ULONG', value: 0}, - {name: 'minMemType1', type: 'ULONG', value: 0}, - {name: 'maxMemType1', type: 'ULONG', value: 0} - ]); -} - -var post = { parse: parsePostTable, make: makePostTable }; - -// The `GSUB` table contains ligatures, among other things. - -var subtableParsers = new Array(9); // subtableParsers[0] is unused - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#SS -subtableParsers[1] = function parseLookup1() { - var start = this.offset + this.relativeOffset; - var substFormat = this.parseUShort(); - if (substFormat === 1) { - return { - substFormat: 1, - coverage: this.parsePointer(Parser.coverage), - deltaGlyphId: this.parseUShort() - }; - } else if (substFormat === 2) { - return { - substFormat: 2, - coverage: this.parsePointer(Parser.coverage), - substitute: this.parseOffset16List() - }; - } - check.assert(false, '0x' + start.toString(16) + ': lookup type 1 format must be 1 or 2.'); -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#MS -subtableParsers[2] = function parseLookup2() { - var substFormat = this.parseUShort(); - check.argument(substFormat === 1, 'GSUB Multiple Substitution Subtable identifier-format must be 1'); - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - sequences: this.parseListOfLists() - }; -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#AS -subtableParsers[3] = function parseLookup3() { - var substFormat = this.parseUShort(); - check.argument(substFormat === 1, 'GSUB Alternate Substitution Subtable identifier-format must be 1'); - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - alternateSets: this.parseListOfLists() - }; -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#LS -subtableParsers[4] = function parseLookup4() { - var substFormat = this.parseUShort(); - check.argument(substFormat === 1, 'GSUB ligature table identifier-format must be 1'); - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - ligatureSets: this.parseListOfLists(function() { - return { - ligGlyph: this.parseUShort(), - components: this.parseUShortList(this.parseUShort() - 1) - }; - }) - }; -}; - -var lookupRecordDesc = { - sequenceIndex: Parser.uShort, - lookupListIndex: Parser.uShort -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CSF -subtableParsers[5] = function parseLookup5() { - var start = this.offset + this.relativeOffset; - var substFormat = this.parseUShort(); - - if (substFormat === 1) { - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - ruleSets: this.parseListOfLists(function() { - var glyphCount = this.parseUShort(); - var substCount = this.parseUShort(); - return { - input: this.parseUShortList(glyphCount - 1), - lookupRecords: this.parseRecordList(substCount, lookupRecordDesc) - }; - }) - }; - } else if (substFormat === 2) { - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - classDef: this.parsePointer(Parser.classDef), - classSets: this.parseListOfLists(function() { - var glyphCount = this.parseUShort(); - var substCount = this.parseUShort(); - return { - classes: this.parseUShortList(glyphCount - 1), - lookupRecords: this.parseRecordList(substCount, lookupRecordDesc) - }; - }) - }; - } else if (substFormat === 3) { - var glyphCount = this.parseUShort(); - var substCount = this.parseUShort(); - return { - substFormat: substFormat, - coverages: this.parseList(glyphCount, Parser.pointer(Parser.coverage)), - lookupRecords: this.parseRecordList(substCount, lookupRecordDesc) - }; - } - check.assert(false, '0x' + start.toString(16) + ': lookup type 5 format must be 1, 2 or 3.'); -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#CC -subtableParsers[6] = function parseLookup6() { - var start = this.offset + this.relativeOffset; - var substFormat = this.parseUShort(); - if (substFormat === 1) { - return { - substFormat: 1, - coverage: this.parsePointer(Parser.coverage), - chainRuleSets: this.parseListOfLists(function() { - return { - backtrack: this.parseUShortList(), - input: this.parseUShortList(this.parseShort() - 1), - lookahead: this.parseUShortList(), - lookupRecords: this.parseRecordList(lookupRecordDesc) - }; - }) - }; - } else if (substFormat === 2) { - return { - substFormat: 2, - coverage: this.parsePointer(Parser.coverage), - backtrackClassDef: this.parsePointer(Parser.classDef), - inputClassDef: this.parsePointer(Parser.classDef), - lookaheadClassDef: this.parsePointer(Parser.classDef), - chainClassSet: this.parseListOfLists(function() { - return { - backtrack: this.parseUShortList(), - input: this.parseUShortList(this.parseShort() - 1), - lookahead: this.parseUShortList(), - lookupRecords: this.parseRecordList(lookupRecordDesc) - }; - }) - }; - } else if (substFormat === 3) { - return { - substFormat: 3, - backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)), - inputCoverage: this.parseList(Parser.pointer(Parser.coverage)), - lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)), - lookupRecords: this.parseRecordList(lookupRecordDesc) - }; - } - check.assert(false, '0x' + start.toString(16) + ': lookup type 6 format must be 1, 2 or 3.'); -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#ES -subtableParsers[7] = function parseLookup7() { - // Extension Substitution subtable - var substFormat = this.parseUShort(); - check.argument(substFormat === 1, 'GSUB Extension Substitution subtable identifier-format must be 1'); - var extensionLookupType = this.parseUShort(); - var extensionParser = new Parser(this.data, this.offset + this.parseULong()); - return { - substFormat: 1, - lookupType: extensionLookupType, - extension: subtableParsers[extensionLookupType].call(extensionParser) - }; -}; - -// https://www.microsoft.com/typography/OTSPEC/GSUB.htm#RCCS -subtableParsers[8] = function parseLookup8() { - var substFormat = this.parseUShort(); - check.argument(substFormat === 1, 'GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1'); - return { - substFormat: substFormat, - coverage: this.parsePointer(Parser.coverage), - backtrackCoverage: this.parseList(Parser.pointer(Parser.coverage)), - lookaheadCoverage: this.parseList(Parser.pointer(Parser.coverage)), - substitutes: this.parseUShortList() - }; -}; - -// https://www.microsoft.com/typography/OTSPEC/gsub.htm -function parseGsubTable(data, start) { - start = start || 0; - var p = new Parser(data, start); - var tableVersion = p.parseVersion(1); - check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GSUB table version.'); - if (tableVersion === 1) { - return { - version: tableVersion, - scripts: p.parseScriptList(), - features: p.parseFeatureList(), - lookups: p.parseLookupList(subtableParsers) - }; - } else { - return { - version: tableVersion, - scripts: p.parseScriptList(), - features: p.parseFeatureList(), - lookups: p.parseLookupList(subtableParsers), - variations: p.parseFeatureVariationsList() - }; - } - -} - -// GSUB Writing ////////////////////////////////////////////// -var subtableMakers = new Array(9); - -subtableMakers[1] = function makeLookup1(subtable) { - if (subtable.substFormat === 1) { - return new table.Table('substitutionTable', [ - {name: 'substFormat', type: 'USHORT', value: 1}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)}, - {name: 'deltaGlyphID', type: 'USHORT', value: subtable.deltaGlyphId} - ]); - } else { - return new table.Table('substitutionTable', [ - {name: 'substFormat', type: 'USHORT', value: 2}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)} - ].concat(table.ushortList('substitute', subtable.substitute))); - } -}; - -subtableMakers[2] = function makeLookup2(subtable) { - check.assert(subtable.substFormat === 1, 'Lookup type 2 substFormat must be 1.'); - return new table.Table('substitutionTable', [ - {name: 'substFormat', type: 'USHORT', value: 1}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)} - ].concat(table.tableList('seqSet', subtable.sequences, function(sequenceSet) { - return new table.Table('sequenceSetTable', table.ushortList('sequence', sequenceSet)); - }))); -}; - -subtableMakers[3] = function makeLookup3(subtable) { - check.assert(subtable.substFormat === 1, 'Lookup type 3 substFormat must be 1.'); - return new table.Table('substitutionTable', [ - {name: 'substFormat', type: 'USHORT', value: 1}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)} - ].concat(table.tableList('altSet', subtable.alternateSets, function(alternateSet) { - return new table.Table('alternateSetTable', table.ushortList('alternate', alternateSet)); - }))); -}; - -subtableMakers[4] = function makeLookup4(subtable) { - check.assert(subtable.substFormat === 1, 'Lookup type 4 substFormat must be 1.'); - return new table.Table('substitutionTable', [ - {name: 'substFormat', type: 'USHORT', value: 1}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)} - ].concat(table.tableList('ligSet', subtable.ligatureSets, function(ligatureSet) { - return new table.Table('ligatureSetTable', table.tableList('ligature', ligatureSet, function(ligature) { - return new table.Table('ligatureTable', - [{name: 'ligGlyph', type: 'USHORT', value: ligature.ligGlyph}] - .concat(table.ushortList('component', ligature.components, ligature.components.length + 1)) - ); - })); - }))); -}; - -subtableMakers[6] = function makeLookup6(subtable) { - if (subtable.substFormat === 1) { - var returnTable = new table.Table('chainContextTable', [ - {name: 'substFormat', type: 'USHORT', value: subtable.substFormat}, - {name: 'coverage', type: 'TABLE', value: new table.Coverage(subtable.coverage)} - ].concat(table.tableList('chainRuleSet', subtable.chainRuleSets, function(chainRuleSet) { - return new table.Table('chainRuleSetTable', table.tableList('chainRule', chainRuleSet, function(chainRule) { - var tableData = table.ushortList('backtrackGlyph', chainRule.backtrack, chainRule.backtrack.length) - .concat(table.ushortList('inputGlyph', chainRule.input, chainRule.input.length + 1)) - .concat(table.ushortList('lookaheadGlyph', chainRule.lookahead, chainRule.lookahead.length)) - .concat(table.ushortList('substitution', [], chainRule.lookupRecords.length)); - - chainRule.lookupRecords.forEach(function (record, i) { - tableData = tableData - .concat({name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex}) - .concat({name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex}); - }); - return new table.Table('chainRuleTable', tableData); - })); - }))); - return returnTable; - } else if (subtable.substFormat === 2) { - check.assert(false, 'lookup type 6 format 2 is not yet supported.'); - } else if (subtable.substFormat === 3) { - var tableData = [ - {name: 'substFormat', type: 'USHORT', value: subtable.substFormat} ]; - - tableData.push({name: 'backtrackGlyphCount', type: 'USHORT', value: subtable.backtrackCoverage.length}); - subtable.backtrackCoverage.forEach(function (coverage, i) { - tableData.push({name: 'backtrackCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage)}); - }); - tableData.push({name: 'inputGlyphCount', type: 'USHORT', value: subtable.inputCoverage.length}); - subtable.inputCoverage.forEach(function (coverage, i) { - tableData.push({name: 'inputCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage)}); - }); - tableData.push({name: 'lookaheadGlyphCount', type: 'USHORT', value: subtable.lookaheadCoverage.length}); - subtable.lookaheadCoverage.forEach(function (coverage, i) { - tableData.push({name: 'lookaheadCoverage' + i, type: 'TABLE', value: new table.Coverage(coverage)}); - }); - - tableData.push({name: 'substitutionCount', type: 'USHORT', value: subtable.lookupRecords.length}); - subtable.lookupRecords.forEach(function (record, i) { - tableData = tableData - .concat({name: 'sequenceIndex' + i, type: 'USHORT', value: record.sequenceIndex}) - .concat({name: 'lookupListIndex' + i, type: 'USHORT', value: record.lookupListIndex}); - }); - - var returnTable$1 = new table.Table('chainContextTable', tableData); - - return returnTable$1; - } - - check.assert(false, 'lookup type 6 format must be 1, 2 or 3.'); -}; - -function makeGsubTable(gsub) { - return new table.Table('GSUB', [ - {name: 'version', type: 'ULONG', value: 0x10000}, - {name: 'scripts', type: 'TABLE', value: new table.ScriptList(gsub.scripts)}, - {name: 'features', type: 'TABLE', value: new table.FeatureList(gsub.features)}, - {name: 'lookups', type: 'TABLE', value: new table.LookupList(gsub.lookups, subtableMakers)} - ]); -} - -var gsub = { parse: parseGsubTable, make: makeGsubTable }; - -// The `GPOS` table contains kerning pairs, among other things. - -// Parse the metadata `meta` table. -// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6meta.html -function parseMetaTable(data, start) { - var p = new parse.Parser(data, start); - var tableVersion = p.parseULong(); - check.argument(tableVersion === 1, 'Unsupported META table version.'); - p.parseULong(); // flags - currently unused and set to 0 - p.parseULong(); // tableOffset - var numDataMaps = p.parseULong(); - - var tags = {}; - for (var i = 0; i < numDataMaps; i++) { - var tag = p.parseTag(); - var dataOffset = p.parseULong(); - var dataLength = p.parseULong(); - var text = decode.UTF8(data, start + dataOffset, dataLength); - - tags[tag] = text; - } - return tags; -} - -function makeMetaTable(tags) { - var numTags = Object.keys(tags).length; - var stringPool = ''; - var stringPoolOffset = 16 + numTags * 12; - - var result = new table.Table('meta', [ - {name: 'version', type: 'ULONG', value: 1}, - {name: 'flags', type: 'ULONG', value: 0}, - {name: 'offset', type: 'ULONG', value: stringPoolOffset}, - {name: 'numTags', type: 'ULONG', value: numTags} - ]); - - for (var tag in tags) { - var pos = stringPool.length; - stringPool += tags[tag]; - - result.fields.push({name: 'tag ' + tag, type: 'TAG', value: tag}); - result.fields.push({name: 'offset ' + tag, type: 'ULONG', value: stringPoolOffset + pos}); - result.fields.push({name: 'length ' + tag, type: 'ULONG', value: tags[tag].length}); - } - - result.fields.push({name: 'stringPool', type: 'CHARARRAY', value: stringPool}); - - return result; -} - -var meta = { parse: parseMetaTable, make: makeMetaTable }; - -// The `COLR` table adds support for multi-colored glyphs - -function parseColrTable(data, start) { - var p = new Parser(data, start); - var version = p.parseUShort(); - check.argument(version === 0x0000, 'Only COLRv0 supported.'); - var numBaseGlyphRecords = p.parseUShort(); - var baseGlyphRecordsOffset = p.parseOffset32(); - var layerRecordsOffset = p.parseOffset32(); - var numLayerRecords = p.parseUShort(); - p.relativeOffset = baseGlyphRecordsOffset; - var baseGlyphRecords = p.parseRecordList(numBaseGlyphRecords, { - glyphID: Parser.uShort, - firstLayerIndex: Parser.uShort, - numLayers: Parser.uShort, - }); - p.relativeOffset = layerRecordsOffset; - var layerRecords = p.parseRecordList(numLayerRecords, { - glyphID: Parser.uShort, - paletteIndex: Parser.uShort - }); - - return { - version: version, - baseGlyphRecords: baseGlyphRecords, - layerRecords: layerRecords, - }; -} - -function makeColrTable(ref) { - var version = ref.version; if ( version === void 0 ) version = 0x0000; - var baseGlyphRecords = ref.baseGlyphRecords; if ( baseGlyphRecords === void 0 ) baseGlyphRecords = []; - var layerRecords = ref.layerRecords; if ( layerRecords === void 0 ) layerRecords = []; - - check.argument(version === 0x0000, 'Only COLRv0 supported.'); - var baseGlyphRecordsOffset = 14; - var layerRecordsOffset = baseGlyphRecordsOffset + (baseGlyphRecords.length * 6); - return new table.Table('COLR', [ - { name: 'version', type: 'USHORT', value: version }, - { name: 'numBaseGlyphRecords', type: 'USHORT', value: baseGlyphRecords.length }, - { name: 'baseGlyphRecordsOffset', type: 'ULONG', value: baseGlyphRecordsOffset }, - { name: 'layerRecordsOffset', type: 'ULONG', value: layerRecordsOffset }, - { name: 'numLayerRecords', type: 'USHORT', value: layerRecords.length } ].concat( baseGlyphRecords.map(function (glyph, i) { return [ - { name: 'glyphID_' + i, type: 'USHORT', value: glyph.glyphID }, - { name: 'firstLayerIndex_' + i, type: 'USHORT', value: glyph.firstLayerIndex }, - { name: 'numLayers_' + i, type: 'USHORT', value: glyph.numLayers } ]; }).flat(), - layerRecords.map(function (layer, i) { return [ - { name: 'LayerGlyphID_' + i, type: 'USHORT', value: layer.glyphID }, - { name: 'paletteIndex_' + i, type: 'USHORT', value: layer.paletteIndex } ]; }).flat() )); -} - -var colr = { parse: parseColrTable, make: makeColrTable }; - -// The `CPAL` define a contiguous list of colors (colorRecords) - -// Parse the header `head` table -function parseCpalTable(data, start) { - var p = new Parser(data, start); - var version = p.parseShort(); - var numPaletteEntries = p.parseShort(); - var numPalettes = p.parseShort(); - var numColorRecords = p.parseShort(); - var colorRecordsArrayOffset = p.parseOffset32(); - var colorRecordIndices = p.parseUShortList(numPalettes); - p.relativeOffset = colorRecordsArrayOffset; - var colorRecords = p.parseULongList(numColorRecords); - return { - version: version, - numPaletteEntries: numPaletteEntries, - colorRecords: colorRecords, - colorRecordIndices: colorRecordIndices, - }; -} - -function makeCpalTable(ref) { - var version = ref.version; if ( version === void 0 ) version = 0; - var numPaletteEntries = ref.numPaletteEntries; if ( numPaletteEntries === void 0 ) numPaletteEntries = 0; - var colorRecords = ref.colorRecords; if ( colorRecords === void 0 ) colorRecords = []; - var colorRecordIndices = ref.colorRecordIndices; if ( colorRecordIndices === void 0 ) colorRecordIndices = [0]; - - check.argument(version === 0, 'Only CPALv0 are supported.'); - check.argument(colorRecords.length, 'No colorRecords given.'); - check.argument(colorRecordIndices.length, 'No colorRecordIndices given.'); - check.argument(!numPaletteEntries && colorRecordIndices.length == 1, 'Can\'t infer numPaletteEntries on multiple colorRecordIndices'); - return new table.Table('CPAL', [ - { name: 'version', type: 'USHORT', value: version }, - { name: 'numPaletteEntries', type: 'USHORT', value: numPaletteEntries || colorRecords.length }, - { name: 'numPalettes', type: 'USHORT', value: colorRecordIndices.length }, - { name: 'numColorRecords', type: 'USHORT', value: colorRecords.length }, - { name: 'colorRecordsArrayOffset', type: 'ULONG', value: 12 + 2 * colorRecordIndices.length } ].concat( colorRecordIndices.map(function (palette, i) { return ({ name: 'colorRecordIndices_' + i, type: 'USHORT', value: palette }); }), - colorRecords.map(function (color, i) { return ({ name: 'colorRecords_' + i, type: 'ULONG', value: color }); }) )); -} - -var cpal = { parse: parseCpalTable, make: makeCpalTable }; - -// The `sfnt` wrapper provides organization for the tables in the font. - -function log2(v) { - return Math.log(v) / Math.log(2) | 0; -} - -function computeCheckSum(bytes) { - while (bytes.length % 4 !== 0) { - bytes.push(0); - } - - var sum = 0; - for (var i = 0; i < bytes.length; i += 4) { - sum += (bytes[i] << 24) + - (bytes[i + 1] << 16) + - (bytes[i + 2] << 8) + - (bytes[i + 3]); - } - - sum %= Math.pow(2, 32); - return sum; -} - -function makeTableRecord(tag, checkSum, offset, length) { - return new table.Record('Table Record', [ - {name: 'tag', type: 'TAG', value: tag !== undefined ? tag : ''}, - {name: 'checkSum', type: 'ULONG', value: checkSum !== undefined ? checkSum : 0}, - {name: 'offset', type: 'ULONG', value: offset !== undefined ? offset : 0}, - {name: 'length', type: 'ULONG', value: length !== undefined ? length : 0} - ]); -} - -function makeSfntTable(tables) { - var sfnt = new table.Table('sfnt', [ - {name: 'version', type: 'TAG', value: 'OTTO'}, - {name: 'numTables', type: 'USHORT', value: 0}, - {name: 'searchRange', type: 'USHORT', value: 0}, - {name: 'entrySelector', type: 'USHORT', value: 0}, - {name: 'rangeShift', type: 'USHORT', value: 0} - ]); - sfnt.tables = tables; - sfnt.numTables = tables.length; - var highestPowerOf2 = Math.pow(2, log2(sfnt.numTables)); - sfnt.searchRange = 16 * highestPowerOf2; - sfnt.entrySelector = log2(highestPowerOf2); - sfnt.rangeShift = sfnt.numTables * 16 - sfnt.searchRange; - - var recordFields = []; - var tableFields = []; - - var offset = sfnt.sizeOf() + (makeTableRecord().sizeOf() * sfnt.numTables); - while (offset % 4 !== 0) { - offset += 1; - tableFields.push({name: 'padding', type: 'BYTE', value: 0}); - } - - for (var i = 0; i < tables.length; i += 1) { - var t = tables[i]; - check.argument(t.tableName.length === 4, 'Table name' + t.tableName + ' is invalid.'); - var tableLength = t.sizeOf(); - var tableRecord = makeTableRecord(t.tableName, computeCheckSum(t.encode()), offset, tableLength); - recordFields.push({name: tableRecord.tag + ' Table Record', type: 'RECORD', value: tableRecord}); - tableFields.push({name: t.tableName + ' table', type: 'RECORD', value: t}); - offset += tableLength; - check.argument(!isNaN(offset), 'Something went wrong calculating the offset.'); - while (offset % 4 !== 0) { - offset += 1; - tableFields.push({name: 'padding', type: 'BYTE', value: 0}); - } - } - - // Table records need to be sorted alphabetically. - recordFields.sort(function(r1, r2) { - if (r1.value.tag > r2.value.tag) { - return 1; - } else { - return -1; - } - }); - - sfnt.fields = sfnt.fields.concat(recordFields); - sfnt.fields = sfnt.fields.concat(tableFields); - return sfnt; -} - -// Get the metrics for a character. If the string has more than one character -// this function returns metrics for the first available character. -// You can provide optional fallback metrics if no characters are available. -function metricsForChar(font, chars, notFoundMetrics) { - for (var i = 0; i < chars.length; i += 1) { - var glyphIndex = font.charToGlyphIndex(chars[i]); - if (glyphIndex > 0) { - var glyph = font.glyphs.get(glyphIndex); - return glyph.getMetrics(); - } - } - - return notFoundMetrics; -} - -function average(vs) { - var sum = 0; - for (var i = 0; i < vs.length; i += 1) { - sum += vs[i]; - } - - return sum / vs.length; -} - -// Convert the font object to a SFNT data structure. -// This structure contains all the necessary tables and metadata to create a binary OTF file. -function fontToSfntTable(font) { - var xMins = []; - var yMins = []; - var xMaxs = []; - var yMaxs = []; - var advanceWidths = []; - var leftSideBearings = []; - var rightSideBearings = []; - var firstCharIndex; - var lastCharIndex = 0; - var ulUnicodeRange1 = 0; - var ulUnicodeRange2 = 0; - var ulUnicodeRange3 = 0; - var ulUnicodeRange4 = 0; - - for (var i = 0; i < font.glyphs.length; i += 1) { - var glyph = font.glyphs.get(i); - var unicode = glyph.unicode | 0; - - if (isNaN(glyph.advanceWidth)) { - throw new Error('Glyph ' + glyph.name + ' (' + i + '): advanceWidth is not a number.'); - } - - if (firstCharIndex > unicode || firstCharIndex === undefined) { - // ignore .notdef char - if (unicode > 0) { - firstCharIndex = unicode; - } - } - - if (lastCharIndex < unicode) { - lastCharIndex = unicode; - } - - var position = os2.getUnicodeRange(unicode); - if (position < 32) { - ulUnicodeRange1 |= 1 << position; - } else if (position < 64) { - ulUnicodeRange2 |= 1 << position - 32; - } else if (position < 96) { - ulUnicodeRange3 |= 1 << position - 64; - } else if (position < 123) { - ulUnicodeRange4 |= 1 << position - 96; - } else { - throw new Error('Unicode ranges bits > 123 are reserved for internal usage'); - } - // Skip non-important characters. - if (glyph.name === '.notdef') { continue; } - var metrics = glyph.getMetrics(); - xMins.push(metrics.xMin); - yMins.push(metrics.yMin); - xMaxs.push(metrics.xMax); - yMaxs.push(metrics.yMax); - leftSideBearings.push(metrics.leftSideBearing); - rightSideBearings.push(metrics.rightSideBearing); - advanceWidths.push(glyph.advanceWidth); - } - - var globals = { - xMin: Math.min.apply(null, xMins), - yMin: Math.min.apply(null, yMins), - xMax: Math.max.apply(null, xMaxs), - yMax: Math.max.apply(null, yMaxs), - advanceWidthMax: Math.max.apply(null, advanceWidths), - advanceWidthAvg: average(advanceWidths), - minLeftSideBearing: Math.min.apply(null, leftSideBearings), - maxLeftSideBearing: Math.max.apply(null, leftSideBearings), - minRightSideBearing: Math.min.apply(null, rightSideBearings) - }; - globals.ascender = font.ascender; - globals.descender = font.descender; - - var headTable = head.make({ - flags: 3, // 00000011 (baseline for font at y=0; left sidebearing point at x=0) - unitsPerEm: font.unitsPerEm, - xMin: globals.xMin, - yMin: globals.yMin, - xMax: globals.xMax, - yMax: globals.yMax, - lowestRecPPEM: 3, - createdTimestamp: font.createdTimestamp - }); - - var hheaTable = hhea.make({ - ascender: globals.ascender, - descender: globals.descender, - advanceWidthMax: globals.advanceWidthMax, - minLeftSideBearing: globals.minLeftSideBearing, - minRightSideBearing: globals.minRightSideBearing, - xMaxExtent: globals.maxLeftSideBearing + (globals.xMax - globals.xMin), - numberOfHMetrics: font.glyphs.length - }); - - var maxpTable = maxp.make(font.glyphs.length); - - var os2Table = os2.make(Object.assign({ - xAvgCharWidth: Math.round(globals.advanceWidthAvg), - usFirstCharIndex: firstCharIndex, - usLastCharIndex: lastCharIndex, - ulUnicodeRange1: ulUnicodeRange1, - ulUnicodeRange2: ulUnicodeRange2, - ulUnicodeRange3: ulUnicodeRange3, - ulUnicodeRange4: ulUnicodeRange4, - // See http://typophile.com/node/13081 for more info on vertical metrics. - // We get metrics for typical characters (such as "x" for xHeight). - // We provide some fallback characters if characters are unavailable: their - // ordering was chosen experimentally. - sTypoAscender: globals.ascender, - sTypoDescender: globals.descender, - sTypoLineGap: 0, - usWinAscent: globals.yMax, - usWinDescent: Math.abs(globals.yMin), - ulCodePageRange1: 1, // FIXME: hard-code Latin 1 support for now - sxHeight: metricsForChar(font, 'xyvw', {yMax: Math.round(globals.ascender / 2)}).yMax, - sCapHeight: metricsForChar(font, 'HIKLEFJMNTZBDPRAGOQSUVWXY', globals).yMax, - usDefaultChar: font.hasChar(' ') ? 32 : 0, // Use space as the default character, if available. - usBreakChar: font.hasChar(' ') ? 32 : 0, // Use space as the break character, if available. - }, font.tables.os2)); - - var hmtxTable = hmtx.make(font.glyphs); - var cmapTable = cmap.make(font.glyphs); - - var englishFamilyName = font.getEnglishName('fontFamily'); - var englishStyleName = font.getEnglishName('fontSubfamily'); - var englishFullName = englishFamilyName + ' ' + englishStyleName; - var postScriptName = font.getEnglishName('postScriptName'); - if (!postScriptName) { - postScriptName = englishFamilyName.replace(/\s/g, '') + '-' + englishStyleName; - } - - var names = {}; - for (var n in font.names) { - names[n] = font.names[n]; - } - - if (!names.uniqueID) { - names.uniqueID = {en: font.getEnglishName('manufacturer') + ':' + englishFullName}; - } - - if (!names.postScriptName) { - names.postScriptName = {en: postScriptName}; - } - - if (!names.preferredFamily) { - names.preferredFamily = font.names.fontFamily; - } - - if (!names.preferredSubfamily) { - names.preferredSubfamily = font.names.fontSubfamily; - } - - var languageTags = []; - var nameTable = _name.make(names, languageTags); - var ltagTable = (languageTags.length > 0 ? ltag.make(languageTags) : undefined); - - var postTable = post.make(); - var cffTable = cff.make(font.glyphs, { - version: font.getEnglishName('version'), - fullName: englishFullName, - familyName: englishFamilyName, - weightName: englishStyleName, - postScriptName: postScriptName, - unitsPerEm: font.unitsPerEm, - fontBBox: [0, globals.yMin, globals.ascender, globals.advanceWidthMax] - }); - - var metaTable = (font.metas && Object.keys(font.metas).length > 0) ? meta.make(font.metas) : undefined; - - // The order does not matter because makeSfntTable() will sort them. - var tables = [headTable, hheaTable, maxpTable, os2Table, nameTable, cmapTable, postTable, cffTable, hmtxTable]; - if (ltagTable) { - tables.push(ltagTable); - } - // Optional tables - if (font.tables.gsub) { - tables.push(gsub.make(font.tables.gsub)); - } - if (font.tables.cpal) { - tables.push(cpal.make(font.tables.cpal)); - } - if (font.tables.colr) { - tables.push(colr.make(font.tables.colr)); - } - if (metaTable) { - tables.push(metaTable); - } - - var sfntTable = makeSfntTable(tables); - - // Compute the font's checkSum and store it in head.checkSumAdjustment. - var bytes = sfntTable.encode(); - var checkSum = computeCheckSum(bytes); - var tableFields = sfntTable.fields; - var checkSumAdjusted = false; - for (var i$1 = 0; i$1 < tableFields.length; i$1 += 1) { - if (tableFields[i$1].name === 'head table') { - tableFields[i$1].value.checkSumAdjustment = 0xB1B0AFBA - checkSum; - checkSumAdjusted = true; - break; - } - } - - if (!checkSumAdjusted) { - throw new Error('Could not find head table with checkSum to adjust.'); - } - - return sfntTable; -} - -var sfnt = { make: makeSfntTable, fontToTable: fontToSfntTable, computeCheckSum: computeCheckSum }; - -// The Layout object is the prototype of Substitution objects, and provides - -function searchTag(arr, tag) { - /* jshint bitwise: false */ - var imin = 0; - var imax = arr.length - 1; - while (imin <= imax) { - var imid = (imin + imax) >>> 1; - var val = arr[imid].tag; - if (val === tag) { - return imid; - } else if (val < tag) { - imin = imid + 1; - } else { imax = imid - 1; } - } - // Not found: return -1-insertion point - return -imin - 1; -} - -function binSearch(arr, value) { - /* jshint bitwise: false */ - var imin = 0; - var imax = arr.length - 1; - while (imin <= imax) { - var imid = (imin + imax) >>> 1; - var val = arr[imid]; - if (val === value) { - return imid; - } else if (val < value) { - imin = imid + 1; - } else { imax = imid - 1; } - } - // Not found: return -1-insertion point - return -imin - 1; -} - -// binary search in a list of ranges (coverage, class definition) -function searchRange(ranges, value) { - // jshint bitwise: false - var range; - var imin = 0; - var imax = ranges.length - 1; - while (imin <= imax) { - var imid = (imin + imax) >>> 1; - range = ranges[imid]; - var start = range.start; - if (start === value) { - return range; - } else if (start < value) { - imin = imid + 1; - } else { imax = imid - 1; } - } - if (imin > 0) { - range = ranges[imin - 1]; - if (value > range.end) { return 0; } - return range; - } -} - -/** - * @exports opentype.Layout - * @class - */ -function Layout(font, tableName) { - this.font = font; - this.tableName = tableName; -} - -Layout.prototype = { - - /** - * Binary search an object by "tag" property - * @instance - * @function searchTag - * @memberof opentype.Layout - * @param {Array} arr - * @param {string} tag - * @return {number} - */ - searchTag: searchTag, - - /** - * Binary search in a list of numbers - * @instance - * @function binSearch - * @memberof opentype.Layout - * @param {Array} arr - * @param {number} value - * @return {number} - */ - binSearch: binSearch, - - /** - * Get or create the Layout table (GSUB, GPOS etc). - * @param {boolean} create - Whether to create a new one. - * @return {Object} The GSUB or GPOS table. - */ - getTable: function(create) { - var layout = this.font.tables[this.tableName]; - if (!layout && create) { - layout = this.font.tables[this.tableName] = this.createDefaultTable(); - } - return layout; - }, - - /** - * Returns all scripts in the substitution table. - * @instance - * @return {Array} - */ - getScriptNames: function() { - var layout = this.getTable(); - if (!layout) { return []; } - return layout.scripts.map(function(script) { - return script.tag; - }); - }, - - /** - * Returns the best bet for a script name. - * Returns 'DFLT' if it exists. - * If not, returns 'latn' if it exists. - * If neither exist, returns undefined. - */ - getDefaultScriptName: function() { - var layout = this.getTable(); - if (!layout) { return; } - var hasLatn = false; - for (var i = 0; i < layout.scripts.length; i++) { - var name = layout.scripts[i].tag; - if (name === 'DFLT') { return name; } - if (name === 'latn') { hasLatn = true; } - } - if (hasLatn) { return 'latn'; } - }, - - /** - * Returns all LangSysRecords in the given script. - * @instance - * @param {string} [script='DFLT'] - * @param {boolean} create - forces the creation of this script table if it doesn't exist. - * @return {Object} An object with tag and script properties. - */ - getScriptTable: function(script, create) { - var layout = this.getTable(create); - if (layout) { - script = script || 'DFLT'; - var scripts = layout.scripts; - var pos = searchTag(layout.scripts, script); - if (pos >= 0) { - return scripts[pos].script; - } else if (create) { - var scr = { - tag: script, - script: { - defaultLangSys: {reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: []}, - langSysRecords: [] - } - }; - scripts.splice(-1 - pos, 0, scr); - return scr.script; - } - } - }, - - /** - * Returns a language system table - * @instance - * @param {string} [script='DFLT'] - * @param {string} [language='dlft'] - * @param {boolean} create - forces the creation of this langSysTable if it doesn't exist. - * @return {Object} - */ - getLangSysTable: function(script, language, create) { - var scriptTable = this.getScriptTable(script, create); - if (scriptTable) { - if (!language || language === 'dflt' || language === 'DFLT') { - return scriptTable.defaultLangSys; - } - var pos = searchTag(scriptTable.langSysRecords, language); - if (pos >= 0) { - return scriptTable.langSysRecords[pos].langSys; - } else if (create) { - var langSysRecord = { - tag: language, - langSys: {reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: []} - }; - scriptTable.langSysRecords.splice(-1 - pos, 0, langSysRecord); - return langSysRecord.langSys; - } - } - }, - - /** - * Get a specific feature table. - * @instance - * @param {string} [script='DFLT'] - * @param {string} [language='dlft'] - * @param {string} feature - One of the codes listed at https://www.microsoft.com/typography/OTSPEC/featurelist.htm - * @param {boolean} create - forces the creation of the feature table if it doesn't exist. - * @return {Object} - */ - getFeatureTable: function(script, language, feature, create) { - var langSysTable = this.getLangSysTable(script, language, create); - if (langSysTable) { - var featureRecord; - var featIndexes = langSysTable.featureIndexes; - var allFeatures = this.font.tables[this.tableName].features; - // The FeatureIndex array of indices is in arbitrary order, - // even if allFeatures is sorted alphabetically by feature tag. - for (var i = 0; i < featIndexes.length; i++) { - featureRecord = allFeatures[featIndexes[i]]; - if (featureRecord.tag === feature) { - return featureRecord.feature; - } - } - if (create) { - var index = allFeatures.length; - // Automatic ordering of features would require to shift feature indexes in the script list. - check.assert(index === 0 || feature >= allFeatures[index - 1].tag, 'Features must be added in alphabetical order.'); - featureRecord = { - tag: feature, - feature: { params: 0, lookupListIndexes: [] } - }; - allFeatures.push(featureRecord); - featIndexes.push(index); - return featureRecord.feature; - } - } - }, - - /** - * Get the lookup tables of a given type for a script/language/feature. - * @instance - * @param {string} [script='DFLT'] - * @param {string} [language='dlft'] - * @param {string} feature - 4-letter feature code - * @param {number} lookupType - 1 to 9 - * @param {boolean} create - forces the creation of the lookup table if it doesn't exist, with no subtables. - * @return {Object[]} - */ - getLookupTables: function(script, language, feature, lookupType, create) { - var featureTable = this.getFeatureTable(script, language, feature, create); - var tables = []; - if (featureTable) { - var lookupTable; - var lookupListIndexes = featureTable.lookupListIndexes; - var allLookups = this.font.tables[this.tableName].lookups; - // lookupListIndexes are in no particular order, so use naive search. - for (var i = 0; i < lookupListIndexes.length; i++) { - lookupTable = allLookups[lookupListIndexes[i]]; - if (lookupTable.lookupType === lookupType) { - tables.push(lookupTable); - } - } - if (tables.length === 0 && create) { - lookupTable = { - lookupType: lookupType, - lookupFlag: 0, - subtables: [], - markFilteringSet: undefined - }; - var index = allLookups.length; - allLookups.push(lookupTable); - lookupListIndexes.push(index); - return [lookupTable]; - } - } - return tables; - }, - - /** - * Find a glyph in a class definition table - * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#class-definition-table - * @param {object} classDefTable - an OpenType Layout class definition table - * @param {number} glyphIndex - the index of the glyph to find - * @returns {number} -1 if not found - */ - getGlyphClass: function(classDefTable, glyphIndex) { - switch (classDefTable.format) { - case 1: - if (classDefTable.startGlyph <= glyphIndex && glyphIndex < classDefTable.startGlyph + classDefTable.classes.length) { - return classDefTable.classes[glyphIndex - classDefTable.startGlyph]; - } - return 0; - case 2: - var range = searchRange(classDefTable.ranges, glyphIndex); - return range ? range.classId : 0; - } - }, - - /** - * Find a glyph in a coverage table - * https://docs.microsoft.com/en-us/typography/opentype/spec/chapter2#coverage-table - * @param {object} coverageTable - an OpenType Layout coverage table - * @param {number} glyphIndex - the index of the glyph to find - * @returns {number} -1 if not found - */ - getCoverageIndex: function(coverageTable, glyphIndex) { - switch (coverageTable.format) { - case 1: - var index = binSearch(coverageTable.glyphs, glyphIndex); - return index >= 0 ? index : -1; - case 2: - var range = searchRange(coverageTable.ranges, glyphIndex); - return range ? range.index + glyphIndex - range.start : -1; - } - }, - - /** - * Returns the list of glyph indexes of a coverage table. - * Format 1: the list is stored raw - * Format 2: compact list as range records. - * @instance - * @param {Object} coverageTable - * @return {Array} - */ - expandCoverage: function(coverageTable) { - if (coverageTable.format === 1) { - return coverageTable.glyphs; - } else { - var glyphs = []; - var ranges = coverageTable.ranges; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - var start = range.start; - var end = range.end; - for (var j = start; j <= end; j++) { - glyphs.push(j); - } - } - return glyphs; - } - } - -}; - -// The Position object provides utility methods to manipulate - -/** - * @exports opentype.Position - * @class - * @extends opentype.Layout - * @param {opentype.Font} - * @constructor - */ -function Position(font) { - Layout.call(this, font, 'gpos'); -} - -Position.prototype = Layout.prototype; - -/** - * Init some data for faster and easier access later. - */ -Position.prototype.init = function() { - var script = this.getDefaultScriptName(); - this.defaultKerningTables = this.getKerningTables(script); -}; - -/** - * Find a glyph pair in a list of lookup tables of type 2 and retrieve the xAdvance kerning value. - * - * @param {integer} leftIndex - left glyph index - * @param {integer} rightIndex - right glyph index - * @returns {integer} - */ -Position.prototype.getKerningValue = function(kerningLookups, leftIndex, rightIndex) { - for (var i = 0; i < kerningLookups.length; i++) { - var subtables = kerningLookups[i].subtables; - for (var j = 0; j < subtables.length; j++) { - var subtable = subtables[j]; - var covIndex = this.getCoverageIndex(subtable.coverage, leftIndex); - if (covIndex < 0) { continue; } - switch (subtable.posFormat) { - case 1: - // Search Pair Adjustment Positioning Format 1 - var pairSet = subtable.pairSets[covIndex]; - for (var k = 0; k < pairSet.length; k++) { - var pair = pairSet[k]; - if (pair.secondGlyph === rightIndex) { - return pair.value1 && pair.value1.xAdvance || 0; - } - } - break; // left glyph found, not right glyph - try next subtable - case 2: - // Search Pair Adjustment Positioning Format 2 - var class1 = this.getGlyphClass(subtable.classDef1, leftIndex); - var class2 = this.getGlyphClass(subtable.classDef2, rightIndex); - var pair$1 = subtable.classRecords[class1][class2]; - return pair$1.value1 && pair$1.value1.xAdvance || 0; - } - } - } - return 0; -}; - -/** - * List all kerning lookup tables. - * - * @param {string} [script='DFLT'] - use font.position.getDefaultScriptName() for a better default value - * @param {string} [language='dflt'] - * @return {object[]} The list of kerning lookup tables (may be empty), or undefined if there is no GPOS table (and we should use the kern table) - */ -Position.prototype.getKerningTables = function(script, language) { - if (this.font.tables.gpos) { - return this.getLookupTables(script, language, 'kern', 2); - } -}; - -// The Substitution object provides utility methods to manipulate - -/** - * @exports opentype.Substitution - * @class - * @extends opentype.Layout - * @param {opentype.Font} - * @constructor - */ -function Substitution(font) { - Layout.call(this, font, 'gsub'); -} - -// Check if 2 arrays of primitives are equal. -function arraysEqual(ar1, ar2) { - var n = ar1.length; - if (n !== ar2.length) { return false; } - for (var i = 0; i < n; i++) { - if (ar1[i] !== ar2[i]) { return false; } - } - return true; -} - -// Find the first subtable of a lookup table in a particular format. -function getSubstFormat(lookupTable, format, defaultSubtable) { - var subtables = lookupTable.subtables; - for (var i = 0; i < subtables.length; i++) { - var subtable = subtables[i]; - if (subtable.substFormat === format) { - return subtable; - } - } - if (defaultSubtable) { - subtables.push(defaultSubtable); - return defaultSubtable; - } - return undefined; -} - -Substitution.prototype = Layout.prototype; - -/** - * Create a default GSUB table. - * @return {Object} gsub - The GSUB table. - */ -Substitution.prototype.createDefaultTable = function() { - // Generate a default empty GSUB table with just a DFLT script and dflt lang sys. - return { - version: 1, - scripts: [{ - tag: 'DFLT', - script: { - defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [] }, - langSysRecords: [] - } - }], - features: [], - lookups: [] - }; -}; - -/** - * List all single substitutions (lookup type 1) for a given script, language, and feature. - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - * @param {string} feature - 4-character feature name ('aalt', 'salt', 'ss01'...) - * @return {Array} substitutions - The list of substitutions. - */ -Substitution.prototype.getSingle = function(feature, script, language) { - var substitutions = []; - var lookupTables = this.getLookupTables(script, language, feature, 1); - for (var idx = 0; idx < lookupTables.length; idx++) { - var subtables = lookupTables[idx].subtables; - for (var i = 0; i < subtables.length; i++) { - var subtable = subtables[i]; - var glyphs = this.expandCoverage(subtable.coverage); - var j = (void 0); - if (subtable.substFormat === 1) { - var delta = subtable.deltaGlyphId; - for (j = 0; j < glyphs.length; j++) { - var glyph = glyphs[j]; - substitutions.push({ sub: glyph, by: glyph + delta }); - } - } else { - var substitute = subtable.substitute; - for (j = 0; j < glyphs.length; j++) { - substitutions.push({ sub: glyphs[j], by: substitute[j] }); - } - } - } - } - return substitutions; -}; - -/** - * List all multiple substitutions (lookup type 2) for a given script, language, and feature. - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - * @param {string} feature - 4-character feature name ('ccmp', 'stch') - * @return {Array} substitutions - The list of substitutions. - */ -Substitution.prototype.getMultiple = function(feature, script, language) { - var substitutions = []; - var lookupTables = this.getLookupTables(script, language, feature, 2); - for (var idx = 0; idx < lookupTables.length; idx++) { - var subtables = lookupTables[idx].subtables; - for (var i = 0; i < subtables.length; i++) { - var subtable = subtables[i]; - var glyphs = this.expandCoverage(subtable.coverage); - var j = (void 0); - - for (j = 0; j < glyphs.length; j++) { - var glyph = glyphs[j]; - var replacements = subtable.sequences[j]; - substitutions.push({ sub: glyph, by: replacements }); - } - } - } - return substitutions; -}; - -/** - * List all alternates (lookup type 3) for a given script, language, and feature. - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - * @param {string} feature - 4-character feature name ('aalt', 'salt'...) - * @return {Array} alternates - The list of alternates - */ -Substitution.prototype.getAlternates = function(feature, script, language) { - var alternates = []; - var lookupTables = this.getLookupTables(script, language, feature, 3); - for (var idx = 0; idx < lookupTables.length; idx++) { - var subtables = lookupTables[idx].subtables; - for (var i = 0; i < subtables.length; i++) { - var subtable = subtables[i]; - var glyphs = this.expandCoverage(subtable.coverage); - var alternateSets = subtable.alternateSets; - for (var j = 0; j < glyphs.length; j++) { - alternates.push({ sub: glyphs[j], by: alternateSets[j] }); - } - } - } - return alternates; -}; - -/** - * List all ligatures (lookup type 4) for a given script, language, and feature. - * The result is an array of ligature objects like { sub: [ids], by: id } - * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...) - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - * @return {Array} ligatures - The list of ligatures. - */ -Substitution.prototype.getLigatures = function(feature, script, language) { - var ligatures = []; - var lookupTables = this.getLookupTables(script, language, feature, 4); - for (var idx = 0; idx < lookupTables.length; idx++) { - var subtables = lookupTables[idx].subtables; - for (var i = 0; i < subtables.length; i++) { - var subtable = subtables[i]; - var glyphs = this.expandCoverage(subtable.coverage); - var ligatureSets = subtable.ligatureSets; - for (var j = 0; j < glyphs.length; j++) { - var startGlyph = glyphs[j]; - var ligSet = ligatureSets[j]; - for (var k = 0; k < ligSet.length; k++) { - var lig = ligSet[k]; - ligatures.push({ - sub: [startGlyph].concat(lig.components), - by: lig.ligGlyph - }); - } - } - } - } - return ligatures; -}; - -/** - * Add or modify a single substitution (lookup type 1) - * Format 2, more flexible, is always used. - * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...) - * @param {Object} substitution - { sub: id, by: id } (format 1 is not supported) - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - */ -Substitution.prototype.addSingle = function(feature, substitution, script, language) { - var lookupTable = this.getLookupTables(script, language, feature, 1, true)[0]; - var subtable = getSubstFormat(lookupTable, 2, { // lookup type 1 subtable, format 2, coverage format 1 - substFormat: 2, - coverage: {format: 1, glyphs: []}, - substitute: [] - }); - check.assert(subtable.coverage.format === 1, 'Single: unable to modify coverage table format ' + subtable.coverage.format); - var coverageGlyph = substitution.sub; - var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph); - if (pos < 0) { - pos = -1 - pos; - subtable.coverage.glyphs.splice(pos, 0, coverageGlyph); - subtable.substitute.splice(pos, 0, 0); - } - subtable.substitute[pos] = substitution.by; -}; - -/** - * Add or modify a multiple substitution (lookup type 2) - * @param {string} feature - 4-letter feature name ('ccmp', 'stch') - * @param {Object} substitution - { sub: id, by: [id] } for format 2. - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - */ -Substitution.prototype.addMultiple = function(feature, substitution, script, language) { - check.assert(substitution.by instanceof Array && substitution.by.length > 1, 'Multiple: "by" must be an array of two or more ids'); - var lookupTable = this.getLookupTables(script, language, feature, 2, true)[0]; - var subtable = getSubstFormat(lookupTable, 1, { // lookup type 2 subtable, format 1, coverage format 1 - substFormat: 1, - coverage: {format: 1, glyphs: []}, - sequences: [] - }); - check.assert(subtable.coverage.format === 1, 'Multiple: unable to modify coverage table format ' + subtable.coverage.format); - var coverageGlyph = substitution.sub; - var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph); - if (pos < 0) { - pos = -1 - pos; - subtable.coverage.glyphs.splice(pos, 0, coverageGlyph); - subtable.sequences.splice(pos, 0, 0); - } - subtable.sequences[pos] = substitution.by; -}; - -/** - * Add or modify an alternate substitution (lookup type 3) - * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...) - * @param {Object} substitution - { sub: id, by: [ids] } - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - */ -Substitution.prototype.addAlternate = function(feature, substitution, script, language) { - var lookupTable = this.getLookupTables(script, language, feature, 3, true)[0]; - var subtable = getSubstFormat(lookupTable, 1, { // lookup type 3 subtable, format 1, coverage format 1 - substFormat: 1, - coverage: {format: 1, glyphs: []}, - alternateSets: [] - }); - check.assert(subtable.coverage.format === 1, 'Alternate: unable to modify coverage table format ' + subtable.coverage.format); - var coverageGlyph = substitution.sub; - var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph); - if (pos < 0) { - pos = -1 - pos; - subtable.coverage.glyphs.splice(pos, 0, coverageGlyph); - subtable.alternateSets.splice(pos, 0, 0); - } - subtable.alternateSets[pos] = substitution.by; -}; - -/** - * Add a ligature (lookup type 4) - * Ligatures with more components must be stored ahead of those with fewer components in order to be found - * @param {string} feature - 4-letter feature name ('liga', 'rlig', 'dlig'...) - * @param {Object} ligature - { sub: [ids], by: id } - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - */ -Substitution.prototype.addLigature = function(feature, ligature, script, language) { - var lookupTable = this.getLookupTables(script, language, feature, 4, true)[0]; - var subtable = lookupTable.subtables[0]; - if (!subtable) { - subtable = { // lookup type 4 subtable, format 1, coverage format 1 - substFormat: 1, - coverage: { format: 1, glyphs: [] }, - ligatureSets: [] - }; - lookupTable.subtables[0] = subtable; - } - check.assert(subtable.coverage.format === 1, 'Ligature: unable to modify coverage table format ' + subtable.coverage.format); - var coverageGlyph = ligature.sub[0]; - var ligComponents = ligature.sub.slice(1); - var ligatureTable = { - ligGlyph: ligature.by, - components: ligComponents - }; - var pos = this.binSearch(subtable.coverage.glyphs, coverageGlyph); - if (pos >= 0) { - // ligatureSet already exists - var ligatureSet = subtable.ligatureSets[pos]; - for (var i = 0; i < ligatureSet.length; i++) { - // If ligature already exists, return. - if (arraysEqual(ligatureSet[i].components, ligComponents)) { - return; - } - } - // ligature does not exist: add it. - ligatureSet.push(ligatureTable); - } else { - // Create a new ligatureSet and add coverage for the first glyph. - pos = -1 - pos; - subtable.coverage.glyphs.splice(pos, 0, coverageGlyph); - subtable.ligatureSets.splice(pos, 0, [ligatureTable]); - } -}; - -/** - * List all feature data for a given script and language. - * @param {string} feature - 4-letter feature name - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - * @return {Array} substitutions - The list of substitutions. - */ -Substitution.prototype.getFeature = function(feature, script, language) { - if (/ss\d\d/.test(feature)) { - // ss01 - ss20 - return this.getSingle(feature, script, language); - } - switch (feature) { - case 'aalt': - case 'salt': - return this.getSingle(feature, script, language) - .concat(this.getAlternates(feature, script, language)); - case 'dlig': - case 'liga': - case 'rlig': - return this.getLigatures(feature, script, language); - case 'ccmp': - return this.getMultiple(feature, script, language) - .concat(this.getLigatures(feature, script, language)); - case 'stch': - return this.getMultiple(feature, script, language); - } - return undefined; -}; - -/** - * Add a substitution to a feature for a given script and language. - * @param {string} feature - 4-letter feature name - * @param {Object} sub - the substitution to add (an object like { sub: id or [ids], by: id or [ids] }) - * @param {string} [script='DFLT'] - * @param {string} [language='dflt'] - */ -Substitution.prototype.add = function(feature, sub, script, language) { - if (/ss\d\d/.test(feature)) { - // ss01 - ss20 - return this.addSingle(feature, sub, script, language); - } - switch (feature) { - case 'aalt': - case 'salt': - if (typeof sub.by === 'number') { - return this.addSingle(feature, sub, script, language); - } - return this.addAlternate(feature, sub, script, language); - case 'dlig': - case 'liga': - case 'rlig': - return this.addLigature(feature, sub, script, language); - case 'ccmp': - if (sub.by instanceof Array) { - return this.addMultiple(feature, sub, script, language); - } - return this.addLigature(feature, sub, script, language); - } - return undefined; -}; - -function checkArgument(expression, message) { - if (!expression) { - throw message; - } -} - -// The `glyf` table describes the glyphs in TrueType outline format. - -// Parse the coordinate data for a glyph. -function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) { - var v; - if ((flag & shortVectorBitMask) > 0) { - // The coordinate is 1 byte long. - v = p.parseByte(); - // The `same` bit is re-used for short values to signify the sign of the value. - if ((flag & sameBitMask) === 0) { - v = -v; - } - - v = previousValue + v; - } else { - // The coordinate is 2 bytes long. - // If the `same` bit is set, the coordinate is the same as the previous coordinate. - if ((flag & sameBitMask) > 0) { - v = previousValue; - } else { - // Parse the coordinate as a signed 16-bit delta value. - v = previousValue + p.parseShort(); - } - } - - return v; -} - -// Parse a TrueType glyph. -function parseGlyph(glyph, data, start) { - var p = new parse.Parser(data, start); - glyph.numberOfContours = p.parseShort(); - glyph._xMin = p.parseShort(); - glyph._yMin = p.parseShort(); - glyph._xMax = p.parseShort(); - glyph._yMax = p.parseShort(); - var flags; - var flag; - - if (glyph.numberOfContours > 0) { - // This glyph is not a composite. - var endPointIndices = glyph.endPointIndices = []; - for (var i = 0; i < glyph.numberOfContours; i += 1) { - endPointIndices.push(p.parseUShort()); - } - - glyph.instructionLength = p.parseUShort(); - glyph.instructions = []; - for (var i$1 = 0; i$1 < glyph.instructionLength; i$1 += 1) { - glyph.instructions.push(p.parseByte()); - } - - var numberOfCoordinates = endPointIndices[endPointIndices.length - 1] + 1; - flags = []; - for (var i$2 = 0; i$2 < numberOfCoordinates; i$2 += 1) { - flag = p.parseByte(); - flags.push(flag); - // If bit 3 is set, we repeat this flag n times, where n is the next byte. - if ((flag & 8) > 0) { - var repeatCount = p.parseByte(); - for (var j = 0; j < repeatCount; j += 1) { - flags.push(flag); - i$2 += 1; - } - } - } - - check.argument(flags.length === numberOfCoordinates, 'Bad flags.'); - - if (endPointIndices.length > 0) { - var points = []; - var point; - // X/Y coordinates are relative to the previous point, except for the first point which is relative to 0,0. - if (numberOfCoordinates > 0) { - for (var i$3 = 0; i$3 < numberOfCoordinates; i$3 += 1) { - flag = flags[i$3]; - point = {}; - point.onCurve = !!(flag & 1); - point.lastPointOfContour = endPointIndices.indexOf(i$3) >= 0; - points.push(point); - } - - var px = 0; - for (var i$4 = 0; i$4 < numberOfCoordinates; i$4 += 1) { - flag = flags[i$4]; - point = points[i$4]; - point.x = parseGlyphCoordinate(p, flag, px, 2, 16); - px = point.x; - } - - var py = 0; - for (var i$5 = 0; i$5 < numberOfCoordinates; i$5 += 1) { - flag = flags[i$5]; - point = points[i$5]; - point.y = parseGlyphCoordinate(p, flag, py, 4, 32); - py = point.y; - } - } - - glyph.points = points; - } else { - glyph.points = []; - } - } else if (glyph.numberOfContours === 0) { - glyph.points = []; - } else { - glyph.isComposite = true; - glyph.points = []; - glyph.components = []; - var moreComponents = true; - while (moreComponents) { - flags = p.parseUShort(); - var component = { - glyphIndex: p.parseUShort(), - xScale: 1, - scale01: 0, - scale10: 0, - yScale: 1, - dx: 0, - dy: 0 - }; - if ((flags & 1) > 0) { - // The arguments are words - if ((flags & 2) > 0) { - // values are offset - component.dx = p.parseShort(); - component.dy = p.parseShort(); - } else { - // values are matched points - component.matchedPoints = [p.parseUShort(), p.parseUShort()]; - } - - } else { - // The arguments are bytes - if ((flags & 2) > 0) { - // values are offset - component.dx = p.parseChar(); - component.dy = p.parseChar(); - } else { - // values are matched points - component.matchedPoints = [p.parseByte(), p.parseByte()]; - } - } - - if ((flags & 8) > 0) { - // We have a scale - component.xScale = component.yScale = p.parseF2Dot14(); - } else if ((flags & 64) > 0) { - // We have an X / Y scale - component.xScale = p.parseF2Dot14(); - component.yScale = p.parseF2Dot14(); - } else if ((flags & 128) > 0) { - // We have a 2x2 transformation - component.xScale = p.parseF2Dot14(); - component.scale01 = p.parseF2Dot14(); - component.scale10 = p.parseF2Dot14(); - component.yScale = p.parseF2Dot14(); - } - - glyph.components.push(component); - moreComponents = !!(flags & 32); - } - if (flags & 0x100) { - // We have instructions - glyph.instructionLength = p.parseUShort(); - glyph.instructions = []; - for (var i$6 = 0; i$6 < glyph.instructionLength; i$6 += 1) { - glyph.instructions.push(p.parseByte()); - } - } - } -} - -// Transform an array of points and return a new array. -function transformPoints(points, transform) { - var newPoints = []; - for (var i = 0; i < points.length; i += 1) { - var pt = points[i]; - var newPt = { - x: transform.xScale * pt.x + transform.scale01 * pt.y + transform.dx, - y: transform.scale10 * pt.x + transform.yScale * pt.y + transform.dy, - onCurve: pt.onCurve, - lastPointOfContour: pt.lastPointOfContour - }; - newPoints.push(newPt); - } - - return newPoints; -} - -function getContours(points) { - var contours = []; - var currentContour = []; - for (var i = 0; i < points.length; i += 1) { - var pt = points[i]; - currentContour.push(pt); - if (pt.lastPointOfContour) { - contours.push(currentContour); - currentContour = []; - } - } - - check.argument(currentContour.length === 0, 'There are still points left in the current contour.'); - return contours; -} - -// Convert the TrueType glyph outline to a Path. -function getPath(points) { - var p = new Path(); - if (!points) { - return p; - } - - var contours = getContours(points); - - for (var contourIndex = 0; contourIndex < contours.length; ++contourIndex) { - var contour = contours[contourIndex]; - - var prev = null; - var curr = contour[contour.length - 1]; - var next = contour[0]; - - if (curr.onCurve) { - p.moveTo(curr.x, curr.y); - } else { - if (next.onCurve) { - p.moveTo(next.x, next.y); - } else { - // If both first and last points are off-curve, start at their middle. - var start = {x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5}; - p.moveTo(start.x, start.y); - } - } - - for (var i = 0; i < contour.length; ++i) { - prev = curr; - curr = next; - next = contour[(i + 1) % contour.length]; - - if (curr.onCurve) { - // This is a straight line. - p.lineTo(curr.x, curr.y); - } else { - var prev2 = prev; - var next2 = next; - - if (!prev.onCurve) { - prev2 = { x: (curr.x + prev.x) * 0.5, y: (curr.y + prev.y) * 0.5 }; - } - - if (!next.onCurve) { - next2 = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }; - } - - p.quadraticCurveTo(curr.x, curr.y, next2.x, next2.y); - } - } - - p.closePath(); - } - return p; -} - -function buildPath(glyphs, glyph) { - if (glyph.isComposite) { - for (var j = 0; j < glyph.components.length; j += 1) { - var component = glyph.components[j]; - var componentGlyph = glyphs.get(component.glyphIndex); - // Force the ttfGlyphLoader to parse the glyph. - componentGlyph.getPath(); - if (componentGlyph.points) { - var transformedPoints = (void 0); - if (component.matchedPoints === undefined) { - // component positioned by offset - transformedPoints = transformPoints(componentGlyph.points, component); - } else { - // component positioned by matched points - if ((component.matchedPoints[0] > glyph.points.length - 1) || - (component.matchedPoints[1] > componentGlyph.points.length - 1)) { - throw Error('Matched points out of range in ' + glyph.name); - } - var firstPt = glyph.points[component.matchedPoints[0]]; - var secondPt = componentGlyph.points[component.matchedPoints[1]]; - var transform = { - xScale: component.xScale, scale01: component.scale01, - scale10: component.scale10, yScale: component.yScale, - dx: 0, dy: 0 - }; - secondPt = transformPoints([secondPt], transform)[0]; - transform.dx = firstPt.x - secondPt.x; - transform.dy = firstPt.y - secondPt.y; - transformedPoints = transformPoints(componentGlyph.points, transform); - } - glyph.points = glyph.points.concat(transformedPoints); - } - } - } - - return getPath(glyph.points); -} - -function parseGlyfTableAll(data, start, loca, font) { - var glyphs = new glyphset.GlyphSet(font); - - // The last element of the loca table is invalid. - for (var i = 0; i < loca.length - 1; i += 1) { - var offset = loca[i]; - var nextOffset = loca[i + 1]; - if (offset !== nextOffset) { - glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath)); - } else { - glyphs.push(i, glyphset.glyphLoader(font, i)); - } - } - - return glyphs; -} - -function parseGlyfTableOnLowMemory(data, start, loca, font) { - var glyphs = new glyphset.GlyphSet(font); - - font._push = function(i) { - var offset = loca[i]; - var nextOffset = loca[i + 1]; - if (offset !== nextOffset) { - glyphs.push(i, glyphset.ttfGlyphLoader(font, i, parseGlyph, data, start + offset, buildPath)); - } else { - glyphs.push(i, glyphset.glyphLoader(font, i)); - } - }; - - return glyphs; -} - -// Parse all the glyphs according to the offsets from the `loca` table. -function parseGlyfTable(data, start, loca, font, opt) { - if (opt.lowMemory) - { return parseGlyfTableOnLowMemory(data, start, loca, font); } - else - { return parseGlyfTableAll(data, start, loca, font); } -} - -var glyf = { getPath: getPath, parse: parseGlyfTable}; - -/* A TrueType font hinting interpreter. -* -* (c) 2017 Axel Kittenberger -* -* This interpreter has been implemented according to this documentation: -* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html -* -* According to the documentation F24DOT6 values are used for pixels. -* That means calculation is 1/64 pixel accurate and uses integer operations. -* However, Javascript has floating point operations by default and only -* those are available. One could make a case to simulate the 1/64 accuracy -* exactly by truncating after every division operation -* (for example with << 0) to get pixel exactly results as other TrueType -* implementations. It may make sense since some fonts are pixel optimized -* by hand using DELTAP instructions. The current implementation doesn't -* and rather uses full floating point precision. -* -* xScale, yScale and rotation is currently ignored. -* -* A few non-trivial instructions are missing as I didn't encounter yet -* a font that used them to test a possible implementation. -* -* Some fonts seem to use undocumented features regarding the twilight zone. -* Only some of them are implemented as they were encountered. -* -* The exports.DEBUG statements are removed on the minified distribution file. -*/ - -var instructionTable; -var exec; -var execGlyph; -var execComponent; - -/* -* Creates a hinting object. -* -* There ought to be exactly one -* for each truetype font that is used for hinting. -*/ -function Hinting(font) { - // the font this hinting object is for - this.font = font; - - this.getCommands = function (hPoints) { - return glyf.getPath(hPoints).commands; - }; - - // cached states - this._fpgmState = - this._prepState = - undefined; - - // errorState - // 0 ... all okay - // 1 ... had an error in a glyf, - // continue working but stop spamming - // the console - // 2 ... error at prep, stop hinting at this ppem - // 3 ... error at fpeg, stop hinting for this font at all - this._errorState = 0; -} - -/* -* Not rounding. -*/ -function roundOff(v) { - return v; -} - -/* -* Rounding to grid. -*/ -function roundToGrid(v) { - //Rounding in TT is supposed to "symmetrical around zero" - return Math.sign(v) * Math.round(Math.abs(v)); -} - -/* -* Rounding to double grid. -*/ -function roundToDoubleGrid(v) { - return Math.sign(v) * Math.round(Math.abs(v * 2)) / 2; -} - -/* -* Rounding to half grid. -*/ -function roundToHalfGrid(v) { - return Math.sign(v) * (Math.round(Math.abs(v) + 0.5) - 0.5); -} - -/* -* Rounding to up to grid. -*/ -function roundUpToGrid(v) { - return Math.sign(v) * Math.ceil(Math.abs(v)); -} - -/* -* Rounding to down to grid. -*/ -function roundDownToGrid(v) { - return Math.sign(v) * Math.floor(Math.abs(v)); -} - -/* -* Super rounding. -*/ -var roundSuper = function (v) { - var period = this.srPeriod; - var phase = this.srPhase; - var threshold = this.srThreshold; - var sign = 1; - - if (v < 0) { - v = -v; - sign = -1; - } - - v += threshold - phase; - - v = Math.trunc(v / period) * period; - - v += phase; - - // according to http://xgridfit.sourceforge.net/round.html - if (v < 0) { return phase * sign; } - - return v * sign; -}; - -/* -* Unit vector of x-axis. -*/ -var xUnitVector = { - x: 1, - - y: 0, - - axis: 'x', - - // Gets the projected distance between two points. - // o1/o2 ... if true, respective original position is used. - distance: function (p1, p2, o1, o2) { - return (o1 ? p1.xo : p1.x) - (o2 ? p2.xo : p2.x); - }, - - // Moves point p so the moved position has the same relative - // position to the moved positions of rp1 and rp2 than the - // original positions had. - // - // See APPENDIX on INTERPOLATE at the bottom of this file. - interpolate: function (p, rp1, rp2, pv) { - var do1; - var do2; - var doa1; - var doa2; - var dm1; - var dm2; - var dt; - - if (!pv || pv === this) { - do1 = p.xo - rp1.xo; - do2 = p.xo - rp2.xo; - dm1 = rp1.x - rp1.xo; - dm2 = rp2.x - rp2.xo; - doa1 = Math.abs(do1); - doa2 = Math.abs(do2); - dt = doa1 + doa2; - - if (dt === 0) { - p.x = p.xo + (dm1 + dm2) / 2; - return; - } - - p.x = p.xo + (dm1 * doa2 + dm2 * doa1) / dt; - return; - } - - do1 = pv.distance(p, rp1, true, true); - do2 = pv.distance(p, rp2, true, true); - dm1 = pv.distance(rp1, rp1, false, true); - dm2 = pv.distance(rp2, rp2, false, true); - doa1 = Math.abs(do1); - doa2 = Math.abs(do2); - dt = doa1 + doa2; - - if (dt === 0) { - xUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true); - return; - } - - xUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true); - }, - - // Slope of line normal to this - normalSlope: Number.NEGATIVE_INFINITY, - - // Sets the point 'p' relative to point 'rp' - // by the distance 'd'. - // - // See APPENDIX on SETRELATIVE at the bottom of this file. - // - // p ... point to set - // rp ... reference point - // d ... distance on projection vector - // pv ... projection vector (undefined = this) - // org ... if true, uses the original position of rp as reference. - setRelative: function (p, rp, d, pv, org) { - if (!pv || pv === this) { - p.x = (org ? rp.xo : rp.x) + d; - return; - } - - var rpx = org ? rp.xo : rp.x; - var rpy = org ? rp.yo : rp.y; - var rpdx = rpx + d * pv.x; - var rpdy = rpy + d * pv.y; - - p.x = rpdx + (p.y - rpdy) / pv.normalSlope; - }, - - // Slope of vector line. - slope: 0, - - // Touches the point p. - touch: function (p) { - p.xTouched = true; - }, - - // Tests if a point p is touched. - touched: function (p) { - return p.xTouched; - }, - - // Untouches the point p. - untouch: function (p) { - p.xTouched = false; - } -}; - -/* -* Unit vector of y-axis. -*/ -var yUnitVector = { - x: 0, - - y: 1, - - axis: 'y', - - // Gets the projected distance between two points. - // o1/o2 ... if true, respective original position is used. - distance: function (p1, p2, o1, o2) { - return (o1 ? p1.yo : p1.y) - (o2 ? p2.yo : p2.y); - }, - - // Moves point p so the moved position has the same relative - // position to the moved positions of rp1 and rp2 than the - // original positions had. - // - // See APPENDIX on INTERPOLATE at the bottom of this file. - interpolate: function (p, rp1, rp2, pv) { - var do1; - var do2; - var doa1; - var doa2; - var dm1; - var dm2; - var dt; - - if (!pv || pv === this) { - do1 = p.yo - rp1.yo; - do2 = p.yo - rp2.yo; - dm1 = rp1.y - rp1.yo; - dm2 = rp2.y - rp2.yo; - doa1 = Math.abs(do1); - doa2 = Math.abs(do2); - dt = doa1 + doa2; - - if (dt === 0) { - p.y = p.yo + (dm1 + dm2) / 2; - return; - } - - p.y = p.yo + (dm1 * doa2 + dm2 * doa1) / dt; - return; - } - - do1 = pv.distance(p, rp1, true, true); - do2 = pv.distance(p, rp2, true, true); - dm1 = pv.distance(rp1, rp1, false, true); - dm2 = pv.distance(rp2, rp2, false, true); - doa1 = Math.abs(do1); - doa2 = Math.abs(do2); - dt = doa1 + doa2; - - if (dt === 0) { - yUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true); - return; - } - - yUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true); - }, - - // Slope of line normal to this. - normalSlope: 0, - - // Sets the point 'p' relative to point 'rp' - // by the distance 'd' - // - // See APPENDIX on SETRELATIVE at the bottom of this file. - // - // p ... point to set - // rp ... reference point - // d ... distance on projection vector - // pv ... projection vector (undefined = this) - // org ... if true, uses the original position of rp as reference. - setRelative: function (p, rp, d, pv, org) { - if (!pv || pv === this) { - p.y = (org ? rp.yo : rp.y) + d; - return; - } - - var rpx = org ? rp.xo : rp.x; - var rpy = org ? rp.yo : rp.y; - var rpdx = rpx + d * pv.x; - var rpdy = rpy + d * pv.y; - - p.y = rpdy + pv.normalSlope * (p.x - rpdx); - }, - - // Slope of vector line. - slope: Number.POSITIVE_INFINITY, - - // Touches the point p. - touch: function (p) { - p.yTouched = true; - }, - - // Tests if a point p is touched. - touched: function (p) { - return p.yTouched; - }, - - // Untouches the point p. - untouch: function (p) { - p.yTouched = false; - } -}; - -Object.freeze(xUnitVector); -Object.freeze(yUnitVector); - -/* -* Creates a unit vector that is not x- or y-axis. -*/ -function UnitVector(x, y) { - this.x = x; - this.y = y; - this.axis = undefined; - this.slope = y / x; - this.normalSlope = -x / y; - Object.freeze(this); -} - -/* -* Gets the projected distance between two points. -* o1/o2 ... if true, respective original position is used. -*/ -UnitVector.prototype.distance = function(p1, p2, o1, o2) { - return ( - this.x * xUnitVector.distance(p1, p2, o1, o2) + - this.y * yUnitVector.distance(p1, p2, o1, o2) - ); -}; - -/* -* Moves point p so the moved position has the same relative -* position to the moved positions of rp1 and rp2 than the -* original positions had. -* -* See APPENDIX on INTERPOLATE at the bottom of this file. -*/ -UnitVector.prototype.interpolate = function(p, rp1, rp2, pv) { - var dm1; - var dm2; - var do1; - var do2; - var doa1; - var doa2; - var dt; - - do1 = pv.distance(p, rp1, true, true); - do2 = pv.distance(p, rp2, true, true); - dm1 = pv.distance(rp1, rp1, false, true); - dm2 = pv.distance(rp2, rp2, false, true); - doa1 = Math.abs(do1); - doa2 = Math.abs(do2); - dt = doa1 + doa2; - - if (dt === 0) { - this.setRelative(p, p, (dm1 + dm2) / 2, pv, true); - return; - } - - this.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true); -}; - -/* -* Sets the point 'p' relative to point 'rp' -* by the distance 'd' -* -* See APPENDIX on SETRELATIVE at the bottom of this file. -* -* p ... point to set -* rp ... reference point -* d ... distance on projection vector -* pv ... projection vector (undefined = this) -* org ... if true, uses the original position of rp as reference. -*/ -UnitVector.prototype.setRelative = function(p, rp, d, pv, org) { - pv = pv || this; - - var rpx = org ? rp.xo : rp.x; - var rpy = org ? rp.yo : rp.y; - var rpdx = rpx + d * pv.x; - var rpdy = rpy + d * pv.y; - - var pvns = pv.normalSlope; - var fvs = this.slope; - - var px = p.x; - var py = p.y; - - p.x = (fvs * px - pvns * rpdx + rpdy - py) / (fvs - pvns); - p.y = fvs * (p.x - px) + py; -}; - -/* -* Touches the point p. -*/ -UnitVector.prototype.touch = function(p) { - p.xTouched = true; - p.yTouched = true; -}; - -/* -* Returns a unit vector with x/y coordinates. -*/ -function getUnitVector(x, y) { - var d = Math.sqrt(x * x + y * y); - - x /= d; - y /= d; - - if (x === 1 && y === 0) { return xUnitVector; } - else if (x === 0 && y === 1) { return yUnitVector; } - else { return new UnitVector(x, y); } -} - -/* -* Creates a point in the hinting engine. -*/ -function HPoint( - x, - y, - lastPointOfContour, - onCurve -) { - this.x = this.xo = Math.round(x * 64) / 64; // hinted x value and original x-value - this.y = this.yo = Math.round(y * 64) / 64; // hinted y value and original y-value - - this.lastPointOfContour = lastPointOfContour; - this.onCurve = onCurve; - this.prevPointOnContour = undefined; - this.nextPointOnContour = undefined; - this.xTouched = false; - this.yTouched = false; - - Object.preventExtensions(this); -} - -/* -* Returns the next touched point on the contour. -* -* v ... unit vector to test touch axis. -*/ -HPoint.prototype.nextTouched = function(v) { - var p = this.nextPointOnContour; - - while (!v.touched(p) && p !== this) { p = p.nextPointOnContour; } - - return p; -}; - -/* -* Returns the previous touched point on the contour -* -* v ... unit vector to test touch axis. -*/ -HPoint.prototype.prevTouched = function(v) { - var p = this.prevPointOnContour; - - while (!v.touched(p) && p !== this) { p = p.prevPointOnContour; } - - return p; -}; - -/* -* The zero point. -*/ -var HPZero = Object.freeze(new HPoint(0, 0)); - -/* -* The default state of the interpreter. -* -* Note: Freezing the defaultState and then deriving from it -* makes the V8 Javascript engine going awkward, -* so this is avoided, albeit the defaultState shouldn't -* ever change. -*/ -var defaultState = { - cvCutIn: 17 / 16, // control value cut in - deltaBase: 9, - deltaShift: 0.125, - loop: 1, // loops some instructions - minDis: 1, // minimum distance - autoFlip: true -}; - -/* -* The current state of the interpreter. -* -* env ... 'fpgm' or 'prep' or 'glyf' -* prog ... the program -*/ -function State(env, prog) { - this.env = env; - this.stack = []; - this.prog = prog; - - switch (env) { - case 'glyf' : - this.zp0 = this.zp1 = this.zp2 = 1; - this.rp0 = this.rp1 = this.rp2 = 0; - /* fall through */ - case 'prep' : - this.fv = this.pv = this.dpv = xUnitVector; - this.round = roundToGrid; - } -} - -/* -* Executes a glyph program. -* -* This does the hinting for each glyph. -* -* Returns an array of moved points. -* -* glyph: the glyph to hint -* ppem: the size the glyph is rendered for -*/ -Hinting.prototype.exec = function(glyph, ppem) { - if (typeof ppem !== 'number') { - throw new Error('Point size is not a number!'); - } - - // Received a fatal error, don't do any hinting anymore. - if (this._errorState > 2) { return; } - - var font = this.font; - var prepState = this._prepState; - - if (!prepState || prepState.ppem !== ppem) { - var fpgmState = this._fpgmState; - - if (!fpgmState) { - // Executes the fpgm state. - // This is used by fonts to define functions. - State.prototype = defaultState; - - fpgmState = - this._fpgmState = - new State('fpgm', font.tables.fpgm); - - fpgmState.funcs = [ ]; - fpgmState.font = font; - - if (exports.DEBUG) { - console.log('---EXEC FPGM---'); - fpgmState.step = -1; - } - - try { - exec(fpgmState); - } catch (e) { - console.log('Hinting error in FPGM:' + e); - this._errorState = 3; - return; - } - } - - // Executes the prep program for this ppem setting. - // This is used by fonts to set cvt values - // depending on to be rendered font size. - - State.prototype = fpgmState; - prepState = - this._prepState = - new State('prep', font.tables.prep); - - prepState.ppem = ppem; - - // Creates a copy of the cvt table - // and scales it to the current ppem setting. - var oCvt = font.tables.cvt; - if (oCvt) { - var cvt = prepState.cvt = new Array(oCvt.length); - var scale = ppem / font.unitsPerEm; - for (var c = 0; c < oCvt.length; c++) { - cvt[c] = oCvt[c] * scale; - } - } else { - prepState.cvt = []; - } - - if (exports.DEBUG) { - console.log('---EXEC PREP---'); - prepState.step = -1; - } - - try { - exec(prepState); - } catch (e) { - if (this._errorState < 2) { - console.log('Hinting error in PREP:' + e); - } - this._errorState = 2; - } - } - - if (this._errorState > 1) { return; } - - try { - return execGlyph(glyph, prepState); - } catch (e) { - if (this._errorState < 1) { - console.log('Hinting error:' + e); - console.log('Note: further hinting errors are silenced'); - } - this._errorState = 1; - return undefined; - } -}; - -/* -* Executes the hinting program for a glyph. -*/ -execGlyph = function(glyph, prepState) { - // original point positions - var xScale = prepState.ppem / prepState.font.unitsPerEm; - var yScale = xScale; - var components = glyph.components; - var contours; - var gZone; - var state; - - State.prototype = prepState; - if (!components) { - state = new State('glyf', glyph.instructions); - if (exports.DEBUG) { - console.log('---EXEC GLYPH---'); - state.step = -1; - } - execComponent(glyph, state, xScale, yScale); - gZone = state.gZone; - } else { - var font = prepState.font; - gZone = []; - contours = []; - for (var i = 0; i < components.length; i++) { - var c = components[i]; - var cg = font.glyphs.get(c.glyphIndex); - - state = new State('glyf', cg.instructions); - - if (exports.DEBUG) { - console.log('---EXEC COMP ' + i + '---'); - state.step = -1; - } - - execComponent(cg, state, xScale, yScale); - // appends the computed points to the result array - // post processes the component points - var dx = Math.round(c.dx * xScale); - var dy = Math.round(c.dy * yScale); - var gz = state.gZone; - var cc = state.contours; - for (var pi = 0; pi < gz.length; pi++) { - var p = gz[pi]; - p.xTouched = p.yTouched = false; - p.xo = p.x = p.x + dx; - p.yo = p.y = p.y + dy; - } - - var gLen = gZone.length; - gZone.push.apply(gZone, gz); - for (var j = 0; j < cc.length; j++) { - contours.push(cc[j] + gLen); - } - } - - if (glyph.instructions && !state.inhibitGridFit) { - // the composite has instructions on its own - state = new State('glyf', glyph.instructions); - - state.gZone = state.z0 = state.z1 = state.z2 = gZone; - - state.contours = contours; - - // note: HPZero cannot be used here, since - // the point might be modified - gZone.push( - new HPoint(0, 0), - new HPoint(Math.round(glyph.advanceWidth * xScale), 0) - ); - - if (exports.DEBUG) { - console.log('---EXEC COMPOSITE---'); - state.step = -1; - } - - exec(state); - - gZone.length -= 2; - } - } - - return gZone; -}; - -/* -* Executes the hinting program for a component of a multi-component glyph -* or of the glyph itself for a non-component glyph. -*/ -execComponent = function(glyph, state, xScale, yScale) -{ - var points = glyph.points || []; - var pLen = points.length; - var gZone = state.gZone = state.z0 = state.z1 = state.z2 = []; - var contours = state.contours = []; - - // Scales the original points and - // makes copies for the hinted points. - var cp; // current point - for (var i = 0; i < pLen; i++) { - cp = points[i]; - - gZone[i] = new HPoint( - cp.x * xScale, - cp.y * yScale, - cp.lastPointOfContour, - cp.onCurve - ); - } - - // Chain links the contours. - var sp; // start point - var np; // next point - - for (var i$1 = 0; i$1 < pLen; i$1++) { - cp = gZone[i$1]; - - if (!sp) { - sp = cp; - contours.push(i$1); - } - - if (cp.lastPointOfContour) { - cp.nextPointOnContour = sp; - sp.prevPointOnContour = cp; - sp = undefined; - } else { - np = gZone[i$1 + 1]; - cp.nextPointOnContour = np; - np.prevPointOnContour = cp; - } - } - - if (state.inhibitGridFit) { return; } - - if (exports.DEBUG) { - console.log('PROCESSING GLYPH', state.stack); - for (var i$2 = 0; i$2 < pLen; i$2++) { - console.log(i$2, gZone[i$2].x, gZone[i$2].y); - } - } - - gZone.push( - new HPoint(0, 0), - new HPoint(Math.round(glyph.advanceWidth * xScale), 0) - ); - - exec(state); - - // Removes the extra points. - gZone.length -= 2; - - if (exports.DEBUG) { - console.log('FINISHED GLYPH', state.stack); - for (var i$3 = 0; i$3 < pLen; i$3++) { - console.log(i$3, gZone[i$3].x, gZone[i$3].y); - } - } -}; - -/* -* Executes the program loaded in state. -*/ -exec = function(state) { - var prog = state.prog; - - if (!prog) { return; } - - var pLen = prog.length; - var ins; - - for (state.ip = 0; state.ip < pLen; state.ip++) { - if (exports.DEBUG) { state.step++; } - ins = instructionTable[prog[state.ip]]; - - if (!ins) { - throw new Error( - 'unknown instruction: 0x' + - Number(prog[state.ip]).toString(16) - ); - } - - ins(state); - - // very extensive debugging for each step - /* - if (exports.DEBUG) { - var da; - if (state.gZone) { - da = []; - for (let i = 0; i < state.gZone.length; i++) - { - da.push(i + ' ' + - state.gZone[i].x * 64 + ' ' + - state.gZone[i].y * 64 + ' ' + - (state.gZone[i].xTouched ? 'x' : '') + - (state.gZone[i].yTouched ? 'y' : '') - ); - } - console.log('GZ', da); - } - - if (state.tZone) { - da = []; - for (let i = 0; i < state.tZone.length; i++) { - da.push(i + ' ' + - state.tZone[i].x * 64 + ' ' + - state.tZone[i].y * 64 + ' ' + - (state.tZone[i].xTouched ? 'x' : '') + - (state.tZone[i].yTouched ? 'y' : '') - ); - } - console.log('TZ', da); - } - - if (state.stack.length > 10) { - console.log( - state.stack.length, - '...', state.stack.slice(state.stack.length - 10) - ); - } else { - console.log(state.stack.length, state.stack); - } - } - */ - } -}; - -/* -* Initializes the twilight zone. -* -* This is only done if a SZPx instruction -* refers to the twilight zone. -*/ -function initTZone(state) -{ - var tZone = state.tZone = new Array(state.gZone.length); - - // no idea if this is actually correct... - for (var i = 0; i < tZone.length; i++) - { - tZone[i] = new HPoint(0, 0); - } -} - -/* -* Skips the instruction pointer ahead over an IF/ELSE block. -* handleElse .. if true breaks on matching ELSE -*/ -function skip(state, handleElse) -{ - var prog = state.prog; - var ip = state.ip; - var nesting = 1; - var ins; - - do { - ins = prog[++ip]; - if (ins === 0x58) // IF - { nesting++; } - else if (ins === 0x59) // EIF - { nesting--; } - else if (ins === 0x40) // NPUSHB - { ip += prog[ip + 1] + 1; } - else if (ins === 0x41) // NPUSHW - { ip += 2 * prog[ip + 1] + 1; } - else if (ins >= 0xB0 && ins <= 0xB7) // PUSHB - { ip += ins - 0xB0 + 1; } - else if (ins >= 0xB8 && ins <= 0xBF) // PUSHW - { ip += (ins - 0xB8 + 1) * 2; } - else if (handleElse && nesting === 1 && ins === 0x1B) // ELSE - { break; } - } while (nesting > 0); - - state.ip = ip; -} - -/*----------------------------------------------------------* -* And then a lot of instructions... * -*----------------------------------------------------------*/ - -// SVTCA[a] Set freedom and projection Vectors To Coordinate Axis -// 0x00-0x01 -function SVTCA(v, state) { - if (exports.DEBUG) { console.log(state.step, 'SVTCA[' + v.axis + ']'); } - - state.fv = state.pv = state.dpv = v; -} - -// SPVTCA[a] Set Projection Vector to Coordinate Axis -// 0x02-0x03 -function SPVTCA(v, state) { - if (exports.DEBUG) { console.log(state.step, 'SPVTCA[' + v.axis + ']'); } - - state.pv = state.dpv = v; -} - -// SFVTCA[a] Set Freedom Vector to Coordinate Axis -// 0x04-0x05 -function SFVTCA(v, state) { - if (exports.DEBUG) { console.log(state.step, 'SFVTCA[' + v.axis + ']'); } - - state.fv = v; -} - -// SPVTL[a] Set Projection Vector To Line -// 0x06-0x07 -function SPVTL(a, state) { - var stack = state.stack; - var p2i = stack.pop(); - var p1i = stack.pop(); - var p2 = state.z2[p2i]; - var p1 = state.z1[p1i]; - - if (exports.DEBUG) { console.log('SPVTL[' + a + ']', p2i, p1i); } - - var dx; - var dy; - - if (!a) { - dx = p1.x - p2.x; - dy = p1.y - p2.y; - } else { - dx = p2.y - p1.y; - dy = p1.x - p2.x; - } - - state.pv = state.dpv = getUnitVector(dx, dy); -} - -// SFVTL[a] Set Freedom Vector To Line -// 0x08-0x09 -function SFVTL(a, state) { - var stack = state.stack; - var p2i = stack.pop(); - var p1i = stack.pop(); - var p2 = state.z2[p2i]; - var p1 = state.z1[p1i]; - - if (exports.DEBUG) { console.log('SFVTL[' + a + ']', p2i, p1i); } - - var dx; - var dy; - - if (!a) { - dx = p1.x - p2.x; - dy = p1.y - p2.y; - } else { - dx = p2.y - p1.y; - dy = p1.x - p2.x; - } - - state.fv = getUnitVector(dx, dy); -} - -// SPVFS[] Set Projection Vector From Stack -// 0x0A -function SPVFS(state) { - var stack = state.stack; - var y = stack.pop(); - var x = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SPVFS[]', y, x); } - - state.pv = state.dpv = getUnitVector(x, y); -} - -// SFVFS[] Set Freedom Vector From Stack -// 0x0B -function SFVFS(state) { - var stack = state.stack; - var y = stack.pop(); - var x = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SPVFS[]', y, x); } - - state.fv = getUnitVector(x, y); -} - -// GPV[] Get Projection Vector -// 0x0C -function GPV(state) { - var stack = state.stack; - var pv = state.pv; - - if (exports.DEBUG) { console.log(state.step, 'GPV[]'); } - - stack.push(pv.x * 0x4000); - stack.push(pv.y * 0x4000); -} - -// GFV[] Get Freedom Vector -// 0x0C -function GFV(state) { - var stack = state.stack; - var fv = state.fv; - - if (exports.DEBUG) { console.log(state.step, 'GFV[]'); } - - stack.push(fv.x * 0x4000); - stack.push(fv.y * 0x4000); -} - -// SFVTPV[] Set Freedom Vector To Projection Vector -// 0x0E -function SFVTPV(state) { - state.fv = state.pv; - - if (exports.DEBUG) { console.log(state.step, 'SFVTPV[]'); } -} - -// ISECT[] moves point p to the InterSECTion of two lines -// 0x0F -function ISECT(state) -{ - var stack = state.stack; - var pa0i = stack.pop(); - var pa1i = stack.pop(); - var pb0i = stack.pop(); - var pb1i = stack.pop(); - var pi = stack.pop(); - var z0 = state.z0; - var z1 = state.z1; - var pa0 = z0[pa0i]; - var pa1 = z0[pa1i]; - var pb0 = z1[pb0i]; - var pb1 = z1[pb1i]; - var p = state.z2[pi]; - - if (exports.DEBUG) { console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi); } - - // math from - // en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line - - var x1 = pa0.x; - var y1 = pa0.y; - var x2 = pa1.x; - var y2 = pa1.y; - var x3 = pb0.x; - var y3 = pb0.y; - var x4 = pb1.x; - var y4 = pb1.y; - - var div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); - var f1 = x1 * y2 - y1 * x2; - var f2 = x3 * y4 - y3 * x4; - - p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div; - p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div; -} - -// SRP0[] Set Reference Point 0 -// 0x10 -function SRP0(state) { - state.rp0 = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SRP0[]', state.rp0); } -} - -// SRP1[] Set Reference Point 1 -// 0x11 -function SRP1(state) { - state.rp1 = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SRP1[]', state.rp1); } -} - -// SRP1[] Set Reference Point 2 -// 0x12 -function SRP2(state) { - state.rp2 = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SRP2[]', state.rp2); } -} - -// SZP0[] Set Zone Pointer 0 -// 0x13 -function SZP0(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SZP0[]', n); } - - state.zp0 = n; - - switch (n) { - case 0: - if (!state.tZone) { initTZone(state); } - state.z0 = state.tZone; - break; - case 1 : - state.z0 = state.gZone; - break; - default : - throw new Error('Invalid zone pointer'); - } -} - -// SZP1[] Set Zone Pointer 1 -// 0x14 -function SZP1(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SZP1[]', n); } - - state.zp1 = n; - - switch (n) { - case 0: - if (!state.tZone) { initTZone(state); } - state.z1 = state.tZone; - break; - case 1 : - state.z1 = state.gZone; - break; - default : - throw new Error('Invalid zone pointer'); - } -} - -// SZP2[] Set Zone Pointer 2 -// 0x15 -function SZP2(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SZP2[]', n); } - - state.zp2 = n; - - switch (n) { - case 0: - if (!state.tZone) { initTZone(state); } - state.z2 = state.tZone; - break; - case 1 : - state.z2 = state.gZone; - break; - default : - throw new Error('Invalid zone pointer'); - } -} - -// SZPS[] Set Zone PointerS -// 0x16 -function SZPS(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SZPS[]', n); } - - state.zp0 = state.zp1 = state.zp2 = n; - - switch (n) { - case 0: - if (!state.tZone) { initTZone(state); } - state.z0 = state.z1 = state.z2 = state.tZone; - break; - case 1 : - state.z0 = state.z1 = state.z2 = state.gZone; - break; - default : - throw new Error('Invalid zone pointer'); - } -} - -// SLOOP[] Set LOOP variable -// 0x17 -function SLOOP(state) { - state.loop = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SLOOP[]', state.loop); } -} - -// RTG[] Round To Grid -// 0x18 -function RTG(state) { - if (exports.DEBUG) { console.log(state.step, 'RTG[]'); } - - state.round = roundToGrid; -} - -// RTHG[] Round To Half Grid -// 0x19 -function RTHG(state) { - if (exports.DEBUG) { console.log(state.step, 'RTHG[]'); } - - state.round = roundToHalfGrid; -} - -// SMD[] Set Minimum Distance -// 0x1A -function SMD(state) { - var d = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SMD[]', d); } - - state.minDis = d / 0x40; -} - -// ELSE[] ELSE clause -// 0x1B -function ELSE(state) { - // This instruction has been reached by executing a then branch - // so it just skips ahead until matching EIF. - // - // In case the IF was negative the IF[] instruction already - // skipped forward over the ELSE[] - - if (exports.DEBUG) { console.log(state.step, 'ELSE[]'); } - - skip(state, false); -} - -// JMPR[] JuMP Relative -// 0x1C -function JMPR(state) { - var o = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'JMPR[]', o); } - - // A jump by 1 would do nothing. - state.ip += o - 1; -} - -// SCVTCI[] Set Control Value Table Cut-In -// 0x1D -function SCVTCI(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SCVTCI[]', n); } - - state.cvCutIn = n / 0x40; -} - -// DUP[] DUPlicate top stack element -// 0x20 -function DUP(state) { - var stack = state.stack; - - if (exports.DEBUG) { console.log(state.step, 'DUP[]'); } - - stack.push(stack[stack.length - 1]); -} - -// POP[] POP top stack element -// 0x21 -function POP(state) { - if (exports.DEBUG) { console.log(state.step, 'POP[]'); } - - state.stack.pop(); -} - -// CLEAR[] CLEAR the stack -// 0x22 -function CLEAR(state) { - if (exports.DEBUG) { console.log(state.step, 'CLEAR[]'); } - - state.stack.length = 0; -} - -// SWAP[] SWAP the top two elements on the stack -// 0x23 -function SWAP(state) { - var stack = state.stack; - - var a = stack.pop(); - var b = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SWAP[]'); } - - stack.push(a); - stack.push(b); -} - -// DEPTH[] DEPTH of the stack -// 0x24 -function DEPTH(state) { - var stack = state.stack; - - if (exports.DEBUG) { console.log(state.step, 'DEPTH[]'); } - - stack.push(stack.length); -} - -// LOOPCALL[] LOOPCALL function -// 0x2A -function LOOPCALL(state) { - var stack = state.stack; - var fn = stack.pop(); - var c = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'LOOPCALL[]', fn, c); } - - // saves callers program - var cip = state.ip; - var cprog = state.prog; - - state.prog = state.funcs[fn]; - - // executes the function - for (var i = 0; i < c; i++) { - exec(state); - - if (exports.DEBUG) { console.log( - ++state.step, - i + 1 < c ? 'next loopcall' : 'done loopcall', - i - ); } - } - - // restores the callers program - state.ip = cip; - state.prog = cprog; -} - -// CALL[] CALL function -// 0x2B -function CALL(state) { - var fn = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'CALL[]', fn); } - - // saves callers program - var cip = state.ip; - var cprog = state.prog; - - state.prog = state.funcs[fn]; - - // executes the function - exec(state); - - // restores the callers program - state.ip = cip; - state.prog = cprog; - - if (exports.DEBUG) { console.log(++state.step, 'returning from', fn); } -} - -// CINDEX[] Copy the INDEXed element to the top of the stack -// 0x25 -function CINDEX(state) { - var stack = state.stack; - var k = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'CINDEX[]', k); } - - // In case of k == 1, it copies the last element after popping - // thus stack.length - k. - stack.push(stack[stack.length - k]); -} - -// MINDEX[] Move the INDEXed element to the top of the stack -// 0x26 -function MINDEX(state) { - var stack = state.stack; - var k = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'MINDEX[]', k); } - - stack.push(stack.splice(stack.length - k, 1)[0]); -} - -// FDEF[] Function DEFinition -// 0x2C -function FDEF(state) { - if (state.env !== 'fpgm') { throw new Error('FDEF not allowed here'); } - var stack = state.stack; - var prog = state.prog; - var ip = state.ip; - - var fn = stack.pop(); - var ipBegin = ip; - - if (exports.DEBUG) { console.log(state.step, 'FDEF[]', fn); } - - while (prog[++ip] !== 0x2D){ } - - state.ip = ip; - state.funcs[fn] = prog.slice(ipBegin + 1, ip); -} - -// MDAP[a] Move Direct Absolute Point -// 0x2E-0x2F -function MDAP(round, state) { - var pi = state.stack.pop(); - var p = state.z0[pi]; - var fv = state.fv; - var pv = state.pv; - - if (exports.DEBUG) { console.log(state.step, 'MDAP[' + round + ']', pi); } - - var d = pv.distance(p, HPZero); - - if (round) { d = state.round(d); } - - fv.setRelative(p, HPZero, d, pv); - fv.touch(p); - - state.rp0 = state.rp1 = pi; -} - -// IUP[a] Interpolate Untouched Points through the outline -// 0x30 -function IUP(v, state) { - var z2 = state.z2; - var pLen = z2.length - 2; - var cp; - var pp; - var np; - - if (exports.DEBUG) { console.log(state.step, 'IUP[' + v.axis + ']'); } - - for (var i = 0; i < pLen; i++) { - cp = z2[i]; // current point - - // if this point has been touched go on - if (v.touched(cp)) { continue; } - - pp = cp.prevTouched(v); - - // no point on the contour has been touched? - if (pp === cp) { continue; } - - np = cp.nextTouched(v); - - if (pp === np) { - // only one point on the contour has been touched - // so simply moves the point like that - - v.setRelative(cp, cp, v.distance(pp, pp, false, true), v, true); - } - - v.interpolate(cp, pp, np, v); - } -} - -// SHP[] SHift Point using reference point -// 0x32-0x33 -function SHP(a, state) { - var stack = state.stack; - var rpi = a ? state.rp1 : state.rp2; - var rp = (a ? state.z0 : state.z1)[rpi]; - var fv = state.fv; - var pv = state.pv; - var loop = state.loop; - var z2 = state.z2; - - while (loop--) - { - var pi = stack.pop(); - var p = z2[pi]; - - var d = pv.distance(rp, rp, false, true); - fv.setRelative(p, p, d, pv); - fv.touch(p); - - if (exports.DEBUG) { - console.log( - state.step, - (state.loop > 1 ? - 'loop ' + (state.loop - loop) + ': ' : - '' - ) + - 'SHP[' + (a ? 'rp1' : 'rp2') + ']', pi - ); - } - } - - state.loop = 1; -} - -// SHC[] SHift Contour using reference point -// 0x36-0x37 -function SHC(a, state) { - var stack = state.stack; - var rpi = a ? state.rp1 : state.rp2; - var rp = (a ? state.z0 : state.z1)[rpi]; - var fv = state.fv; - var pv = state.pv; - var ci = stack.pop(); - var sp = state.z2[state.contours[ci]]; - var p = sp; - - if (exports.DEBUG) { console.log(state.step, 'SHC[' + a + ']', ci); } - - var d = pv.distance(rp, rp, false, true); - - do { - if (p !== rp) { fv.setRelative(p, p, d, pv); } - p = p.nextPointOnContour; - } while (p !== sp); -} - -// SHZ[] SHift Zone using reference point -// 0x36-0x37 -function SHZ(a, state) { - var stack = state.stack; - var rpi = a ? state.rp1 : state.rp2; - var rp = (a ? state.z0 : state.z1)[rpi]; - var fv = state.fv; - var pv = state.pv; - - var e = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SHZ[' + a + ']', e); } - - var z; - switch (e) { - case 0 : z = state.tZone; break; - case 1 : z = state.gZone; break; - default : throw new Error('Invalid zone'); - } - - var p; - var d = pv.distance(rp, rp, false, true); - var pLen = z.length - 2; - for (var i = 0; i < pLen; i++) - { - p = z[i]; - fv.setRelative(p, p, d, pv); - //if (p !== rp) fv.setRelative(p, p, d, pv); - } -} - -// SHPIX[] SHift point by a PIXel amount -// 0x38 -function SHPIX(state) { - var stack = state.stack; - var loop = state.loop; - var fv = state.fv; - var d = stack.pop() / 0x40; - var z2 = state.z2; - - while (loop--) { - var pi = stack.pop(); - var p = z2[pi]; - - if (exports.DEBUG) { - console.log( - state.step, - (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + - 'SHPIX[]', pi, d - ); - } - - fv.setRelative(p, p, d); - fv.touch(p); - } - - state.loop = 1; -} - -// IP[] Interpolate Point -// 0x39 -function IP(state) { - var stack = state.stack; - var rp1i = state.rp1; - var rp2i = state.rp2; - var loop = state.loop; - var rp1 = state.z0[rp1i]; - var rp2 = state.z1[rp2i]; - var fv = state.fv; - var pv = state.dpv; - var z2 = state.z2; - - while (loop--) { - var pi = stack.pop(); - var p = z2[pi]; - - if (exports.DEBUG) { - console.log( - state.step, - (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + - 'IP[]', pi, rp1i, '<->', rp2i - ); - } - - fv.interpolate(p, rp1, rp2, pv); - - fv.touch(p); - } - - state.loop = 1; -} - -// MSIRP[a] Move Stack Indirect Relative Point -// 0x3A-0x3B -function MSIRP(a, state) { - var stack = state.stack; - var d = stack.pop() / 64; - var pi = stack.pop(); - var p = state.z1[pi]; - var rp0 = state.z0[state.rp0]; - var fv = state.fv; - var pv = state.pv; - - fv.setRelative(p, rp0, d, pv); - fv.touch(p); - - if (exports.DEBUG) { console.log(state.step, 'MSIRP[' + a + ']', d, pi); } - - state.rp1 = state.rp0; - state.rp2 = pi; - if (a) { state.rp0 = pi; } -} - -// ALIGNRP[] Align to reference point. -// 0x3C -function ALIGNRP(state) { - var stack = state.stack; - var rp0i = state.rp0; - var rp0 = state.z0[rp0i]; - var loop = state.loop; - var fv = state.fv; - var pv = state.pv; - var z1 = state.z1; - - while (loop--) { - var pi = stack.pop(); - var p = z1[pi]; - - if (exports.DEBUG) { - console.log( - state.step, - (state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') + - 'ALIGNRP[]', pi - ); - } - - fv.setRelative(p, rp0, 0, pv); - fv.touch(p); - } - - state.loop = 1; -} - -// RTG[] Round To Double Grid -// 0x3D -function RTDG(state) { - if (exports.DEBUG) { console.log(state.step, 'RTDG[]'); } - - state.round = roundToDoubleGrid; -} - -// MIAP[a] Move Indirect Absolute Point -// 0x3E-0x3F -function MIAP(round, state) { - var stack = state.stack; - var n = stack.pop(); - var pi = stack.pop(); - var p = state.z0[pi]; - var fv = state.fv; - var pv = state.pv; - var cv = state.cvt[n]; - - if (exports.DEBUG) { - console.log( - state.step, - 'MIAP[' + round + ']', - n, '(', cv, ')', pi - ); - } - - var d = pv.distance(p, HPZero); - - if (round) { - if (Math.abs(d - cv) < state.cvCutIn) { d = cv; } - - d = state.round(d); - } - - fv.setRelative(p, HPZero, d, pv); - - if (state.zp0 === 0) { - p.xo = p.x; - p.yo = p.y; - } - - fv.touch(p); - - state.rp0 = state.rp1 = pi; -} - -// NPUSB[] PUSH N Bytes -// 0x40 -function NPUSHB(state) { - var prog = state.prog; - var ip = state.ip; - var stack = state.stack; - - var n = prog[++ip]; - - if (exports.DEBUG) { console.log(state.step, 'NPUSHB[]', n); } - - for (var i = 0; i < n; i++) { stack.push(prog[++ip]); } - - state.ip = ip; -} - -// NPUSHW[] PUSH N Words -// 0x41 -function NPUSHW(state) { - var ip = state.ip; - var prog = state.prog; - var stack = state.stack; - var n = prog[++ip]; - - if (exports.DEBUG) { console.log(state.step, 'NPUSHW[]', n); } - - for (var i = 0; i < n; i++) { - var w = (prog[++ip] << 8) | prog[++ip]; - if (w & 0x8000) { w = -((w ^ 0xffff) + 1); } - stack.push(w); - } - - state.ip = ip; -} - -// WS[] Write Store -// 0x42 -function WS(state) { - var stack = state.stack; - var store = state.store; - - if (!store) { store = state.store = []; } - - var v = stack.pop(); - var l = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'WS', v, l); } - - store[l] = v; -} - -// RS[] Read Store -// 0x43 -function RS(state) { - var stack = state.stack; - var store = state.store; - - var l = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'RS', l); } - - var v = (store && store[l]) || 0; - - stack.push(v); -} - -// WCVTP[] Write Control Value Table in Pixel units -// 0x44 -function WCVTP(state) { - var stack = state.stack; - - var v = stack.pop(); - var l = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'WCVTP', v, l); } - - state.cvt[l] = v / 0x40; -} - -// RCVT[] Read Control Value Table entry -// 0x45 -function RCVT(state) { - var stack = state.stack; - var cvte = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'RCVT', cvte); } - - stack.push(state.cvt[cvte] * 0x40); -} - -// GC[] Get Coordinate projected onto the projection vector -// 0x46-0x47 -function GC(a, state) { - var stack = state.stack; - var pi = stack.pop(); - var p = state.z2[pi]; - - if (exports.DEBUG) { console.log(state.step, 'GC[' + a + ']', pi); } - - stack.push(state.dpv.distance(p, HPZero, a, false) * 0x40); -} - -// MD[a] Measure Distance -// 0x49-0x4A -function MD(a, state) { - var stack = state.stack; - var pi2 = stack.pop(); - var pi1 = stack.pop(); - var p2 = state.z1[pi2]; - var p1 = state.z0[pi1]; - var d = state.dpv.distance(p1, p2, a, a); - - if (exports.DEBUG) { console.log(state.step, 'MD[' + a + ']', pi2, pi1, '->', d); } - - state.stack.push(Math.round(d * 64)); -} - -// MPPEM[] Measure Pixels Per EM -// 0x4B -function MPPEM(state) { - if (exports.DEBUG) { console.log(state.step, 'MPPEM[]'); } - state.stack.push(state.ppem); -} - -// FLIPON[] set the auto FLIP Boolean to ON -// 0x4D -function FLIPON(state) { - if (exports.DEBUG) { console.log(state.step, 'FLIPON[]'); } - state.autoFlip = true; -} - -// LT[] Less Than -// 0x50 -function LT(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'LT[]', e2, e1); } - - stack.push(e1 < e2 ? 1 : 0); -} - -// LTEQ[] Less Than or EQual -// 0x53 -function LTEQ(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'LTEQ[]', e2, e1); } - - stack.push(e1 <= e2 ? 1 : 0); -} - -// GTEQ[] Greater Than -// 0x52 -function GT(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'GT[]', e2, e1); } - - stack.push(e1 > e2 ? 1 : 0); -} - -// GTEQ[] Greater Than or EQual -// 0x53 -function GTEQ(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'GTEQ[]', e2, e1); } - - stack.push(e1 >= e2 ? 1 : 0); -} - -// EQ[] EQual -// 0x54 -function EQ(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'EQ[]', e2, e1); } - - stack.push(e2 === e1 ? 1 : 0); -} - -// NEQ[] Not EQual -// 0x55 -function NEQ(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'NEQ[]', e2, e1); } - - stack.push(e2 !== e1 ? 1 : 0); -} - -// ODD[] ODD -// 0x56 -function ODD(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'ODD[]', n); } - - stack.push(Math.trunc(n) % 2 ? 1 : 0); -} - -// EVEN[] EVEN -// 0x57 -function EVEN(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'EVEN[]', n); } - - stack.push(Math.trunc(n) % 2 ? 0 : 1); -} - -// IF[] IF test -// 0x58 -function IF(state) { - var test = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'IF[]', test); } - - // if test is true it just continues - // if not the ip is skipped until matching ELSE or EIF - if (!test) { - skip(state, true); - - if (exports.DEBUG) { console.log(state.step, 'EIF[]'); } - } -} - -// EIF[] End IF -// 0x59 -function EIF(state) { - // this can be reached normally when - // executing an else branch. - // -> just ignore it - - if (exports.DEBUG) { console.log(state.step, 'EIF[]'); } -} - -// AND[] logical AND -// 0x5A -function AND(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'AND[]', e2, e1); } - - stack.push(e2 && e1 ? 1 : 0); -} - -// OR[] logical OR -// 0x5B -function OR(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'OR[]', e2, e1); } - - stack.push(e2 || e1 ? 1 : 0); -} - -// NOT[] logical NOT -// 0x5C -function NOT(state) { - var stack = state.stack; - var e = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'NOT[]', e); } - - stack.push(e ? 0 : 1); -} - -// DELTAP1[] DELTA exception P1 -// DELTAP2[] DELTA exception P2 -// DELTAP3[] DELTA exception P3 -// 0x5D, 0x71, 0x72 -function DELTAP123(b, state) { - var stack = state.stack; - var n = stack.pop(); - var fv = state.fv; - var pv = state.pv; - var ppem = state.ppem; - var base = state.deltaBase + (b - 1) * 16; - var ds = state.deltaShift; - var z0 = state.z0; - - if (exports.DEBUG) { console.log(state.step, 'DELTAP[' + b + ']', n, stack); } - - for (var i = 0; i < n; i++) { - var pi = stack.pop(); - var arg = stack.pop(); - var appem = base + ((arg & 0xF0) >> 4); - if (appem !== ppem) { continue; } - - var mag = (arg & 0x0F) - 8; - if (mag >= 0) { mag++; } - if (exports.DEBUG) { console.log(state.step, 'DELTAPFIX', pi, 'by', mag * ds); } - - var p = z0[pi]; - fv.setRelative(p, p, mag * ds, pv); - } -} - -// SDB[] Set Delta Base in the graphics state -// 0x5E -function SDB(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SDB[]', n); } - - state.deltaBase = n; -} - -// SDS[] Set Delta Shift in the graphics state -// 0x5F -function SDS(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SDS[]', n); } - - state.deltaShift = Math.pow(0.5, n); -} - -// ADD[] ADD -// 0x60 -function ADD(state) { - var stack = state.stack; - var n2 = stack.pop(); - var n1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'ADD[]', n2, n1); } - - stack.push(n1 + n2); -} - -// SUB[] SUB -// 0x61 -function SUB(state) { - var stack = state.stack; - var n2 = stack.pop(); - var n1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SUB[]', n2, n1); } - - stack.push(n1 - n2); -} - -// DIV[] DIV -// 0x62 -function DIV(state) { - var stack = state.stack; - var n2 = stack.pop(); - var n1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'DIV[]', n2, n1); } - - stack.push(n1 * 64 / n2); -} - -// MUL[] MUL -// 0x63 -function MUL(state) { - var stack = state.stack; - var n2 = stack.pop(); - var n1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'MUL[]', n2, n1); } - - stack.push(n1 * n2 / 64); -} - -// ABS[] ABSolute value -// 0x64 -function ABS(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'ABS[]', n); } - - stack.push(Math.abs(n)); -} - -// NEG[] NEGate -// 0x65 -function NEG(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'NEG[]', n); } - - stack.push(-n); -} - -// FLOOR[] FLOOR -// 0x66 -function FLOOR(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'FLOOR[]', n); } - - stack.push(Math.floor(n / 0x40) * 0x40); -} - -// CEILING[] CEILING -// 0x67 -function CEILING(state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'CEILING[]', n); } - - stack.push(Math.ceil(n / 0x40) * 0x40); -} - -// ROUND[ab] ROUND value -// 0x68-0x6B -function ROUND(dt, state) { - var stack = state.stack; - var n = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'ROUND[]'); } - - stack.push(state.round(n / 0x40) * 0x40); -} - -// WCVTF[] Write Control Value Table in Funits -// 0x70 -function WCVTF(state) { - var stack = state.stack; - var v = stack.pop(); - var l = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'WCVTF[]', v, l); } - - state.cvt[l] = v * state.ppem / state.font.unitsPerEm; -} - -// DELTAC1[] DELTA exception C1 -// DELTAC2[] DELTA exception C2 -// DELTAC3[] DELTA exception C3 -// 0x73, 0x74, 0x75 -function DELTAC123(b, state) { - var stack = state.stack; - var n = stack.pop(); - var ppem = state.ppem; - var base = state.deltaBase + (b - 1) * 16; - var ds = state.deltaShift; - - if (exports.DEBUG) { console.log(state.step, 'DELTAC[' + b + ']', n, stack); } - - for (var i = 0; i < n; i++) { - var c = stack.pop(); - var arg = stack.pop(); - var appem = base + ((arg & 0xF0) >> 4); - if (appem !== ppem) { continue; } - - var mag = (arg & 0x0F) - 8; - if (mag >= 0) { mag++; } - - var delta = mag * ds; - - if (exports.DEBUG) { console.log(state.step, 'DELTACFIX', c, 'by', delta); } - - state.cvt[c] += delta; - } -} - -// SROUND[] Super ROUND -// 0x76 -function SROUND(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'SROUND[]', n); } - - state.round = roundSuper; - - var period; - - switch (n & 0xC0) { - case 0x00: - period = 0.5; - break; - case 0x40: - period = 1; - break; - case 0x80: - period = 2; - break; - default: - throw new Error('invalid SROUND value'); - } - - state.srPeriod = period; - - switch (n & 0x30) { - case 0x00: - state.srPhase = 0; - break; - case 0x10: - state.srPhase = 0.25 * period; - break; - case 0x20: - state.srPhase = 0.5 * period; - break; - case 0x30: - state.srPhase = 0.75 * period; - break; - default: throw new Error('invalid SROUND value'); - } - - n &= 0x0F; - - if (n === 0) { state.srThreshold = 0; } - else { state.srThreshold = (n / 8 - 0.5) * period; } -} - -// S45ROUND[] Super ROUND 45 degrees -// 0x77 -function S45ROUND(state) { - var n = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'S45ROUND[]', n); } - - state.round = roundSuper; - - var period; - - switch (n & 0xC0) { - case 0x00: - period = Math.sqrt(2) / 2; - break; - case 0x40: - period = Math.sqrt(2); - break; - case 0x80: - period = 2 * Math.sqrt(2); - break; - default: - throw new Error('invalid S45ROUND value'); - } - - state.srPeriod = period; - - switch (n & 0x30) { - case 0x00: - state.srPhase = 0; - break; - case 0x10: - state.srPhase = 0.25 * period; - break; - case 0x20: - state.srPhase = 0.5 * period; - break; - case 0x30: - state.srPhase = 0.75 * period; - break; - default: - throw new Error('invalid S45ROUND value'); - } - - n &= 0x0F; - - if (n === 0) { state.srThreshold = 0; } - else { state.srThreshold = (n / 8 - 0.5) * period; } -} - -// ROFF[] Round Off -// 0x7A -function ROFF(state) { - if (exports.DEBUG) { console.log(state.step, 'ROFF[]'); } - - state.round = roundOff; -} - -// RUTG[] Round Up To Grid -// 0x7C -function RUTG(state) { - if (exports.DEBUG) { console.log(state.step, 'RUTG[]'); } - - state.round = roundUpToGrid; -} - -// RDTG[] Round Down To Grid -// 0x7D -function RDTG(state) { - if (exports.DEBUG) { console.log(state.step, 'RDTG[]'); } - - state.round = roundDownToGrid; -} - -// SCANCTRL[] SCAN conversion ConTRoL -// 0x85 -function SCANCTRL(state) { - var n = state.stack.pop(); - - // ignored by opentype.js - - if (exports.DEBUG) { console.log(state.step, 'SCANCTRL[]', n); } -} - -// SDPVTL[a] Set Dual Projection Vector To Line -// 0x86-0x87 -function SDPVTL(a, state) { - var stack = state.stack; - var p2i = stack.pop(); - var p1i = stack.pop(); - var p2 = state.z2[p2i]; - var p1 = state.z1[p1i]; - - if (exports.DEBUG) { console.log(state.step, 'SDPVTL[' + a + ']', p2i, p1i); } - - var dx; - var dy; - - if (!a) { - dx = p1.x - p2.x; - dy = p1.y - p2.y; - } else { - dx = p2.y - p1.y; - dy = p1.x - p2.x; - } - - state.dpv = getUnitVector(dx, dy); -} - -// GETINFO[] GET INFOrmation -// 0x88 -function GETINFO(state) { - var stack = state.stack; - var sel = stack.pop(); - var r = 0; - - if (exports.DEBUG) { console.log(state.step, 'GETINFO[]', sel); } - - // v35 as in no subpixel hinting - if (sel & 0x01) { r = 35; } - - // TODO rotation and stretch currently not supported - // and thus those GETINFO are always 0. - - // opentype.js is always gray scaling - if (sel & 0x20) { r |= 0x1000; } - - stack.push(r); -} - -// ROLL[] ROLL the top three stack elements -// 0x8A -function ROLL(state) { - var stack = state.stack; - var a = stack.pop(); - var b = stack.pop(); - var c = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'ROLL[]'); } - - stack.push(b); - stack.push(a); - stack.push(c); -} - -// MAX[] MAXimum of top two stack elements -// 0x8B -function MAX(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'MAX[]', e2, e1); } - - stack.push(Math.max(e1, e2)); -} - -// MIN[] MINimum of top two stack elements -// 0x8C -function MIN(state) { - var stack = state.stack; - var e2 = stack.pop(); - var e1 = stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'MIN[]', e2, e1); } - - stack.push(Math.min(e1, e2)); -} - -// SCANTYPE[] SCANTYPE -// 0x8D -function SCANTYPE(state) { - var n = state.stack.pop(); - // ignored by opentype.js - if (exports.DEBUG) { console.log(state.step, 'SCANTYPE[]', n); } -} - -// INSTCTRL[] INSTCTRL -// 0x8D -function INSTCTRL(state) { - var s = state.stack.pop(); - var v = state.stack.pop(); - - if (exports.DEBUG) { console.log(state.step, 'INSTCTRL[]', s, v); } - - switch (s) { - case 1 : state.inhibitGridFit = !!v; return; - case 2 : state.ignoreCvt = !!v; return; - default: throw new Error('invalid INSTCTRL[] selector'); - } -} - -// PUSHB[abc] PUSH Bytes -// 0xB0-0xB7 -function PUSHB(n, state) { - var stack = state.stack; - var prog = state.prog; - var ip = state.ip; - - if (exports.DEBUG) { console.log(state.step, 'PUSHB[' + n + ']'); } - - for (var i = 0; i < n; i++) { stack.push(prog[++ip]); } - - state.ip = ip; -} - -// PUSHW[abc] PUSH Words -// 0xB8-0xBF -function PUSHW(n, state) { - var ip = state.ip; - var prog = state.prog; - var stack = state.stack; - - if (exports.DEBUG) { console.log(state.ip, 'PUSHW[' + n + ']'); } - - for (var i = 0; i < n; i++) { - var w = (prog[++ip] << 8) | prog[++ip]; - if (w & 0x8000) { w = -((w ^ 0xffff) + 1); } - stack.push(w); - } - - state.ip = ip; -} - -// MDRP[abcde] Move Direct Relative Point -// 0xD0-0xEF -// (if indirect is 0) -// -// and -// -// MIRP[abcde] Move Indirect Relative Point -// 0xE0-0xFF -// (if indirect is 1) - -function MDRP_MIRP(indirect, setRp0, keepD, ro, dt, state) { - var stack = state.stack; - var cvte = indirect && stack.pop(); - var pi = stack.pop(); - var rp0i = state.rp0; - var rp = state.z0[rp0i]; - var p = state.z1[pi]; - - var md = state.minDis; - var fv = state.fv; - var pv = state.dpv; - var od; // original distance - var d; // moving distance - var sign; // sign of distance - var cv; - - d = od = pv.distance(p, rp, true, true); - sign = d >= 0 ? 1 : -1; // Math.sign would be 0 in case of 0 - - // TODO consider autoFlip - d = Math.abs(d); - - if (indirect) { - cv = state.cvt[cvte]; - - if (ro && Math.abs(d - cv) < state.cvCutIn) { d = cv; } - } - - if (keepD && d < md) { d = md; } - - if (ro) { d = state.round(d); } - - fv.setRelative(p, rp, sign * d, pv); - fv.touch(p); - - if (exports.DEBUG) { - console.log( - state.step, - (indirect ? 'MIRP[' : 'MDRP[') + - (setRp0 ? 'M' : 'm') + - (keepD ? '>' : '_') + - (ro ? 'R' : '_') + - (dt === 0 ? 'Gr' : (dt === 1 ? 'Bl' : (dt === 2 ? 'Wh' : ''))) + - ']', - indirect ? - cvte + '(' + state.cvt[cvte] + ',' + cv + ')' : - '', - pi, - '(d =', od, '->', sign * d, ')' - ); - } - - state.rp1 = state.rp0; - state.rp2 = pi; - if (setRp0) { state.rp0 = pi; } -} - -/* -* The instruction table. -*/ -instructionTable = [ - /* 0x00 */ SVTCA.bind(undefined, yUnitVector), - /* 0x01 */ SVTCA.bind(undefined, xUnitVector), - /* 0x02 */ SPVTCA.bind(undefined, yUnitVector), - /* 0x03 */ SPVTCA.bind(undefined, xUnitVector), - /* 0x04 */ SFVTCA.bind(undefined, yUnitVector), - /* 0x05 */ SFVTCA.bind(undefined, xUnitVector), - /* 0x06 */ SPVTL.bind(undefined, 0), - /* 0x07 */ SPVTL.bind(undefined, 1), - /* 0x08 */ SFVTL.bind(undefined, 0), - /* 0x09 */ SFVTL.bind(undefined, 1), - /* 0x0A */ SPVFS, - /* 0x0B */ SFVFS, - /* 0x0C */ GPV, - /* 0x0D */ GFV, - /* 0x0E */ SFVTPV, - /* 0x0F */ ISECT, - /* 0x10 */ SRP0, - /* 0x11 */ SRP1, - /* 0x12 */ SRP2, - /* 0x13 */ SZP0, - /* 0x14 */ SZP1, - /* 0x15 */ SZP2, - /* 0x16 */ SZPS, - /* 0x17 */ SLOOP, - /* 0x18 */ RTG, - /* 0x19 */ RTHG, - /* 0x1A */ SMD, - /* 0x1B */ ELSE, - /* 0x1C */ JMPR, - /* 0x1D */ SCVTCI, - /* 0x1E */ undefined, // TODO SSWCI - /* 0x1F */ undefined, // TODO SSW - /* 0x20 */ DUP, - /* 0x21 */ POP, - /* 0x22 */ CLEAR, - /* 0x23 */ SWAP, - /* 0x24 */ DEPTH, - /* 0x25 */ CINDEX, - /* 0x26 */ MINDEX, - /* 0x27 */ undefined, // TODO ALIGNPTS - /* 0x28 */ undefined, - /* 0x29 */ undefined, // TODO UTP - /* 0x2A */ LOOPCALL, - /* 0x2B */ CALL, - /* 0x2C */ FDEF, - /* 0x2D */ undefined, // ENDF (eaten by FDEF) - /* 0x2E */ MDAP.bind(undefined, 0), - /* 0x2F */ MDAP.bind(undefined, 1), - /* 0x30 */ IUP.bind(undefined, yUnitVector), - /* 0x31 */ IUP.bind(undefined, xUnitVector), - /* 0x32 */ SHP.bind(undefined, 0), - /* 0x33 */ SHP.bind(undefined, 1), - /* 0x34 */ SHC.bind(undefined, 0), - /* 0x35 */ SHC.bind(undefined, 1), - /* 0x36 */ SHZ.bind(undefined, 0), - /* 0x37 */ SHZ.bind(undefined, 1), - /* 0x38 */ SHPIX, - /* 0x39 */ IP, - /* 0x3A */ MSIRP.bind(undefined, 0), - /* 0x3B */ MSIRP.bind(undefined, 1), - /* 0x3C */ ALIGNRP, - /* 0x3D */ RTDG, - /* 0x3E */ MIAP.bind(undefined, 0), - /* 0x3F */ MIAP.bind(undefined, 1), - /* 0x40 */ NPUSHB, - /* 0x41 */ NPUSHW, - /* 0x42 */ WS, - /* 0x43 */ RS, - /* 0x44 */ WCVTP, - /* 0x45 */ RCVT, - /* 0x46 */ GC.bind(undefined, 0), - /* 0x47 */ GC.bind(undefined, 1), - /* 0x48 */ undefined, // TODO SCFS - /* 0x49 */ MD.bind(undefined, 0), - /* 0x4A */ MD.bind(undefined, 1), - /* 0x4B */ MPPEM, - /* 0x4C */ undefined, // TODO MPS - /* 0x4D */ FLIPON, - /* 0x4E */ undefined, // TODO FLIPOFF - /* 0x4F */ undefined, // TODO DEBUG - /* 0x50 */ LT, - /* 0x51 */ LTEQ, - /* 0x52 */ GT, - /* 0x53 */ GTEQ, - /* 0x54 */ EQ, - /* 0x55 */ NEQ, - /* 0x56 */ ODD, - /* 0x57 */ EVEN, - /* 0x58 */ IF, - /* 0x59 */ EIF, - /* 0x5A */ AND, - /* 0x5B */ OR, - /* 0x5C */ NOT, - /* 0x5D */ DELTAP123.bind(undefined, 1), - /* 0x5E */ SDB, - /* 0x5F */ SDS, - /* 0x60 */ ADD, - /* 0x61 */ SUB, - /* 0x62 */ DIV, - /* 0x63 */ MUL, - /* 0x64 */ ABS, - /* 0x65 */ NEG, - /* 0x66 */ FLOOR, - /* 0x67 */ CEILING, - /* 0x68 */ ROUND.bind(undefined, 0), - /* 0x69 */ ROUND.bind(undefined, 1), - /* 0x6A */ ROUND.bind(undefined, 2), - /* 0x6B */ ROUND.bind(undefined, 3), - /* 0x6C */ undefined, // TODO NROUND[ab] - /* 0x6D */ undefined, // TODO NROUND[ab] - /* 0x6E */ undefined, // TODO NROUND[ab] - /* 0x6F */ undefined, // TODO NROUND[ab] - /* 0x70 */ WCVTF, - /* 0x71 */ DELTAP123.bind(undefined, 2), - /* 0x72 */ DELTAP123.bind(undefined, 3), - /* 0x73 */ DELTAC123.bind(undefined, 1), - /* 0x74 */ DELTAC123.bind(undefined, 2), - /* 0x75 */ DELTAC123.bind(undefined, 3), - /* 0x76 */ SROUND, - /* 0x77 */ S45ROUND, - /* 0x78 */ undefined, // TODO JROT[] - /* 0x79 */ undefined, // TODO JROF[] - /* 0x7A */ ROFF, - /* 0x7B */ undefined, - /* 0x7C */ RUTG, - /* 0x7D */ RDTG, - /* 0x7E */ POP, // actually SANGW, supposed to do only a pop though - /* 0x7F */ POP, // actually AA, supposed to do only a pop though - /* 0x80 */ undefined, // TODO FLIPPT - /* 0x81 */ undefined, // TODO FLIPRGON - /* 0x82 */ undefined, // TODO FLIPRGOFF - /* 0x83 */ undefined, - /* 0x84 */ undefined, - /* 0x85 */ SCANCTRL, - /* 0x86 */ SDPVTL.bind(undefined, 0), - /* 0x87 */ SDPVTL.bind(undefined, 1), - /* 0x88 */ GETINFO, - /* 0x89 */ undefined, // TODO IDEF - /* 0x8A */ ROLL, - /* 0x8B */ MAX, - /* 0x8C */ MIN, - /* 0x8D */ SCANTYPE, - /* 0x8E */ INSTCTRL, - /* 0x8F */ undefined, - /* 0x90 */ undefined, - /* 0x91 */ undefined, - /* 0x92 */ undefined, - /* 0x93 */ undefined, - /* 0x94 */ undefined, - /* 0x95 */ undefined, - /* 0x96 */ undefined, - /* 0x97 */ undefined, - /* 0x98 */ undefined, - /* 0x99 */ undefined, - /* 0x9A */ undefined, - /* 0x9B */ undefined, - /* 0x9C */ undefined, - /* 0x9D */ undefined, - /* 0x9E */ undefined, - /* 0x9F */ undefined, - /* 0xA0 */ undefined, - /* 0xA1 */ undefined, - /* 0xA2 */ undefined, - /* 0xA3 */ undefined, - /* 0xA4 */ undefined, - /* 0xA5 */ undefined, - /* 0xA6 */ undefined, - /* 0xA7 */ undefined, - /* 0xA8 */ undefined, - /* 0xA9 */ undefined, - /* 0xAA */ undefined, - /* 0xAB */ undefined, - /* 0xAC */ undefined, - /* 0xAD */ undefined, - /* 0xAE */ undefined, - /* 0xAF */ undefined, - /* 0xB0 */ PUSHB.bind(undefined, 1), - /* 0xB1 */ PUSHB.bind(undefined, 2), - /* 0xB2 */ PUSHB.bind(undefined, 3), - /* 0xB3 */ PUSHB.bind(undefined, 4), - /* 0xB4 */ PUSHB.bind(undefined, 5), - /* 0xB5 */ PUSHB.bind(undefined, 6), - /* 0xB6 */ PUSHB.bind(undefined, 7), - /* 0xB7 */ PUSHB.bind(undefined, 8), - /* 0xB8 */ PUSHW.bind(undefined, 1), - /* 0xB9 */ PUSHW.bind(undefined, 2), - /* 0xBA */ PUSHW.bind(undefined, 3), - /* 0xBB */ PUSHW.bind(undefined, 4), - /* 0xBC */ PUSHW.bind(undefined, 5), - /* 0xBD */ PUSHW.bind(undefined, 6), - /* 0xBE */ PUSHW.bind(undefined, 7), - /* 0xBF */ PUSHW.bind(undefined, 8), - /* 0xC0 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 0), - /* 0xC1 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 1), - /* 0xC2 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 2), - /* 0xC3 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 3), - /* 0xC4 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 0), - /* 0xC5 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 1), - /* 0xC6 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 2), - /* 0xC7 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 3), - /* 0xC8 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 0), - /* 0xC9 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 1), - /* 0xCA */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 2), - /* 0xCB */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 3), - /* 0xCC */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 0), - /* 0xCD */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 1), - /* 0xCE */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 2), - /* 0xCF */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 3), - /* 0xD0 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 0), - /* 0xD1 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 1), - /* 0xD2 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 2), - /* 0xD3 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 3), - /* 0xD4 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 0), - /* 0xD5 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 1), - /* 0xD6 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 2), - /* 0xD7 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 3), - /* 0xD8 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 0), - /* 0xD9 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 1), - /* 0xDA */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 2), - /* 0xDB */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 3), - /* 0xDC */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 0), - /* 0xDD */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 1), - /* 0xDE */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 2), - /* 0xDF */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 3), - /* 0xE0 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 0), - /* 0xE1 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 1), - /* 0xE2 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 2), - /* 0xE3 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 3), - /* 0xE4 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 0), - /* 0xE5 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 1), - /* 0xE6 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 2), - /* 0xE7 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 3), - /* 0xE8 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 0), - /* 0xE9 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 1), - /* 0xEA */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 2), - /* 0xEB */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 3), - /* 0xEC */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 0), - /* 0xED */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 1), - /* 0xEE */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 2), - /* 0xEF */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 3), - /* 0xF0 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 0), - /* 0xF1 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 1), - /* 0xF2 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 2), - /* 0xF3 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 3), - /* 0xF4 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 0), - /* 0xF5 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 1), - /* 0xF6 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 2), - /* 0xF7 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 3), - /* 0xF8 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 0), - /* 0xF9 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 1), - /* 0xFA */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 2), - /* 0xFB */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 3), - /* 0xFC */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 0), - /* 0xFD */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 1), - /* 0xFE */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 2), - /* 0xFF */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 3) -]; - -/***************************** - Mathematical Considerations -****************************** - -fv ... refers to freedom vector -pv ... refers to projection vector -rp ... refers to reference point -p ... refers to to point being operated on -d ... refers to distance - -SETRELATIVE: -============ - -case freedom vector == x-axis: ------------------------------- - - (pv) - .-' - rpd .-' - .-* - d .-'90°' - .-' ' - .-' ' - *-' ' b - rp ' - ' - ' - p *----------*-------------- (fv) - pm - - rpdx = rpx + d * pv.x - rpdy = rpy + d * pv.y - - equation of line b - - y - rpdy = pvns * (x- rpdx) - - y = p.y - - x = rpdx + ( p.y - rpdy ) / pvns - - -case freedom vector == y-axis: ------------------------------- - - * pm - |\ - | \ - | \ - | \ - | \ - | \ - | \ - | \ - | \ - | \ b - | \ - | \ - | \ .-' (pv) - | 90° \.-' - | .-'* rpd - | .-' - * *-' d - p rp - - rpdx = rpx + d * pv.x - rpdy = rpy + d * pv.y - - equation of line b: - pvns ... normal slope to pv - - y - rpdy = pvns * (x - rpdx) - - x = p.x - - y = rpdy + pvns * (p.x - rpdx) - - - -generic case: -------------- - - - .'(fv) - .' - .* pm - .' ! - .' . - .' ! - .' . b - .' ! - * . - p ! - 90° . ... (pv) - ...-*-''' - ...---''' rpd - ...---''' d - *--''' - rp - - rpdx = rpx + d * pv.x - rpdy = rpy + d * pv.y - - equation of line b: - pvns... normal slope to pv - - y - rpdy = pvns * (x - rpdx) - - equation of freedom vector line: - fvs ... slope of freedom vector (=fy/fx) - - y - py = fvs * (x - px) - - - on pm both equations are true for same x/y - - y - rpdy = pvns * (x - rpdx) - - y - py = fvs * (x - px) - - form to y and set equal: - - pvns * (x - rpdx) + rpdy = fvs * (x - px) + py - - expand: - - pvns * x - pvns * rpdx + rpdy = fvs * x - fvs * px + py - - switch: - - fvs * x - fvs * px + py = pvns * x - pvns * rpdx + rpdy - - solve for x: - - fvs * x - pvns * x = fvs * px - pvns * rpdx - py + rpdy - - - - fvs * px - pvns * rpdx + rpdy - py - x = ----------------------------------- - fvs - pvns - - and: - - y = fvs * (x - px) + py - - - -INTERPOLATE: -============ - -Examples of point interpolation. - -The weight of the movement of the reference point gets bigger -the further the other reference point is away, thus the safest -option (that is avoiding 0/0 divisions) is to weight the -original distance of the other point by the sum of both distances. - -If the sum of both distances is 0, then move the point by the -arithmetic average of the movement of both reference points. - - - - - (+6) - rp1o *---->*rp1 - . . (+12) - . . rp2o *---------->* rp2 - . . . . - . . . . - . 10 20 . . - |.........|...................| . - . . . - . . (+8) . - po *------>*p . - . . . - . 12 . 24 . - |...........|.......................| - 36 - - -------- - - - - (+10) - rp1o *-------->*rp1 - . . (-10) - . . rp2 *<---------* rpo2 - . . . . - . . . . - . 10 . 30 . . - |.........|.............................| - . . - . (+5) . - po *--->* p . - . . . - . . 20 . - |....|..............| - 5 15 - - -------- - - - (+10) - rp1o *-------->*rp1 - . . - . . - rp2o *-------->*rp2 - - - (+10) - po *-------->* p - -------- - - - (+10) - rp1o *-------->*rp1 - . . - . .(+30) - rp2o *---------------------------->*rp2 - - - (+25) - po *----------------------->* p - - - -vim: set ts=4 sw=4 expandtab: -*****/ - -/** - * Converts a string into a list of tokens. - */ - -/** - * Create a new token - * @param {string} char a single char - */ -function Token(char) { - this.char = char; - this.state = {}; - this.activeState = null; -} - -/** - * Create a new context range - * @param {number} startIndex range start index - * @param {number} endOffset range end index offset - * @param {string} contextName owner context name - */ -function ContextRange(startIndex, endOffset, contextName) { - this.contextName = contextName; - this.startIndex = startIndex; - this.endOffset = endOffset; -} - -/** - * Check context start and end - * @param {string} contextName a unique context name - * @param {function} checkStart a predicate function the indicates a context's start - * @param {function} checkEnd a predicate function the indicates a context's end - */ -function ContextChecker(contextName, checkStart, checkEnd) { - this.contextName = contextName; - this.openRange = null; - this.ranges = []; - this.checkStart = checkStart; - this.checkEnd = checkEnd; -} - -/** - * @typedef ContextParams - * @type Object - * @property {array} context context items - * @property {number} currentIndex current item index - */ - -/** - * Create a context params - * @param {array} context a list of items - * @param {number} currentIndex current item index - */ -function ContextParams(context, currentIndex) { - this.context = context; - this.index = currentIndex; - this.length = context.length; - this.current = context[currentIndex]; - this.backtrack = context.slice(0, currentIndex); - this.lookahead = context.slice(currentIndex + 1); -} - -/** - * Create an event instance - * @param {string} eventId event unique id - */ -function Event(eventId) { - this.eventId = eventId; - this.subscribers = []; -} - -/** - * Initialize a core events and auto subscribe required event handlers - * @param {any} events an object that enlists core events handlers - */ -function initializeCoreEvents(events) { - var this$1 = this; - - var coreEvents = [ - 'start', 'end', 'next', 'newToken', 'contextStart', - 'contextEnd', 'insertToken', 'removeToken', 'removeRange', - 'replaceToken', 'replaceRange', 'composeRUD', 'updateContextsRanges' - ]; - - coreEvents.forEach(function (eventId) { - Object.defineProperty(this$1.events, eventId, { - value: new Event(eventId) - }); - }); - - if (!!events) { - coreEvents.forEach(function (eventId) { - var event = events[eventId]; - if (typeof event === 'function') { - this$1.events[eventId].subscribe(event); - } - }); - } - var requiresContextUpdate = [ - 'insertToken', 'removeToken', 'removeRange', - 'replaceToken', 'replaceRange', 'composeRUD' - ]; - requiresContextUpdate.forEach(function (eventId) { - this$1.events[eventId].subscribe( - this$1.updateContextsRanges - ); - }); -} - -/** - * Converts a string into a list of tokens - * @param {any} events tokenizer core events - */ -function Tokenizer(events) { - this.tokens = []; - this.registeredContexts = {}; - this.contextCheckers = []; - this.events = {}; - this.registeredModifiers = []; - - initializeCoreEvents.call(this, events); -} - -/** - * Sets the state of a token, usually called by a state modifier. - * @param {string} key state item key - * @param {any} value state item value - */ -Token.prototype.setState = function(key, value) { - this.state[key] = value; - this.activeState = { key: key, value: this.state[key] }; - return this.activeState; -}; - -Token.prototype.getState = function (stateId) { - return this.state[stateId] || null; -}; - -/** - * Checks if an index exists in the tokens list. - * @param {number} index token index - */ -Tokenizer.prototype.inboundIndex = function(index) { - return index >= 0 && index < this.tokens.length; -}; - -/** - * Compose and apply a list of operations (replace, update, delete) - * @param {array} RUDs replace, update and delete operations - * TODO: Perf. Optimization (lengthBefore === lengthAfter ? dispatch once) - */ -Tokenizer.prototype.composeRUD = function (RUDs) { - var this$1 = this; - - var silent = true; - var state = RUDs.map(function (RUD) { return ( - this$1[RUD[0]].apply(this$1, RUD.slice(1).concat(silent)) - ); }); - var hasFAILObject = function (obj) { return ( - typeof obj === 'object' && - obj.hasOwnProperty('FAIL') - ); }; - if (state.every(hasFAILObject)) { - return { - FAIL: "composeRUD: one or more operations hasn't completed successfully", - report: state.filter(hasFAILObject) - }; - } - this.dispatch('composeRUD', [state.filter(function (op) { return !hasFAILObject(op); })]); -}; - -/** - * Replace a range of tokens with a list of tokens - * @param {number} startIndex range start index - * @param {number} offset range offset - * @param {token} tokens a list of tokens to replace - * @param {boolean} silent dispatch events and update context ranges - */ -Tokenizer.prototype.replaceRange = function (startIndex, offset, tokens, silent) { - offset = offset !== null ? offset : this.tokens.length; - var isTokenType = tokens.every(function (token) { return token instanceof Token; }); - if (!isNaN(startIndex) && this.inboundIndex(startIndex) && isTokenType) { - var replaced = this.tokens.splice.apply( - this.tokens, [startIndex, offset].concat(tokens) - ); - if (!silent) { this.dispatch('replaceToken', [startIndex, offset, tokens]); } - return [replaced, tokens]; - } else { - return { FAIL: 'replaceRange: invalid tokens or startIndex.' }; - } -}; - -/** - * Replace a token with another token - * @param {number} index token index - * @param {token} token a token to replace - * @param {boolean} silent dispatch events and update context ranges - */ -Tokenizer.prototype.replaceToken = function (index, token, silent) { - if (!isNaN(index) && this.inboundIndex(index) && token instanceof Token) { - var replaced = this.tokens.splice(index, 1, token); - if (!silent) { this.dispatch('replaceToken', [index, token]); } - return [replaced[0], token]; - } else { - return { FAIL: 'replaceToken: invalid token or index.' }; - } -}; - -/** - * Removes a range of tokens - * @param {number} startIndex range start index - * @param {number} offset range offset - * @param {boolean} silent dispatch events and update context ranges - */ -Tokenizer.prototype.removeRange = function(startIndex, offset, silent) { - offset = !isNaN(offset) ? offset : this.tokens.length; - var tokens = this.tokens.splice(startIndex, offset); - if (!silent) { this.dispatch('removeRange', [tokens, startIndex, offset]); } - return tokens; -}; - -/** - * Remove a token at a certain index - * @param {number} index token index - * @param {boolean} silent dispatch events and update context ranges - */ -Tokenizer.prototype.removeToken = function(index, silent) { - if (!isNaN(index) && this.inboundIndex(index)) { - var token = this.tokens.splice(index, 1); - if (!silent) { this.dispatch('removeToken', [token, index]); } - return token; - } else { - return { FAIL: 'removeToken: invalid token index.' }; - } -}; - -/** - * Insert a list of tokens at a certain index - * @param {array} tokens a list of tokens to insert - * @param {number} index insert the list of tokens at index - * @param {boolean} silent dispatch events and update context ranges - */ -Tokenizer.prototype.insertToken = function (tokens, index, silent) { - var tokenType = tokens.every( - function (token) { return token instanceof Token; } - ); - if (tokenType) { - this.tokens.splice.apply( - this.tokens, [index, 0].concat(tokens) - ); - if (!silent) { this.dispatch('insertToken', [tokens, index]); } - return tokens; - } else { - return { FAIL: 'insertToken: invalid token(s).' }; - } -}; - -/** - * A state modifier that is called on 'newToken' event - * @param {string} modifierId state modifier id - * @param {function} condition a predicate function that returns true or false - * @param {function} modifier a function to update token state - */ -Tokenizer.prototype.registerModifier = function(modifierId, condition, modifier) { - this.events.newToken.subscribe(function(token, contextParams) { - var conditionParams = [token, contextParams]; - var canApplyModifier = ( - condition === null || - condition.apply(this, conditionParams) === true - ); - var modifierParams = [token, contextParams]; - if (canApplyModifier) { - var newStateValue = modifier.apply(this, modifierParams); - token.setState(modifierId, newStateValue); - } - }); - this.registeredModifiers.push(modifierId); -}; - -/** - * Subscribe a handler to an event - * @param {function} eventHandler an event handler function - */ -Event.prototype.subscribe = function (eventHandler) { - if (typeof eventHandler === 'function') { - return ((this.subscribers.push(eventHandler)) - 1); - } else { - return { FAIL: ("invalid '" + (this.eventId) + "' event handler")}; - } -}; - -/** - * Unsubscribe an event handler - * @param {string} subsId subscription id - */ -Event.prototype.unsubscribe = function (subsId) { - this.subscribers.splice(subsId, 1); -}; - -/** - * Sets context params current value index - * @param {number} index context params current value index - */ -ContextParams.prototype.setCurrentIndex = function(index) { - this.index = index; - this.current = this.context[index]; - this.backtrack = this.context.slice(0, index); - this.lookahead = this.context.slice(index + 1); -}; - -/** - * Get an item at an offset from the current value - * example (current value is 3): - * 1 2 [3] 4 5 | items values - * -2 -1 0 1 2 | offset values - * @param {number} offset an offset from current value index - */ -ContextParams.prototype.get = function (offset) { - switch (true) { - case (offset === 0): - return this.current; - case (offset < 0 && Math.abs(offset) <= this.backtrack.length): - return this.backtrack.slice(offset)[0]; - case (offset > 0 && offset <= this.lookahead.length): - return this.lookahead[offset - 1]; - default: - return null; - } -}; - -/** - * Converts a context range into a string value - * @param {contextRange} range a context range - */ -Tokenizer.prototype.rangeToText = function (range) { - if (range instanceof ContextRange) { - return ( - this.getRangeTokens(range) - .map(function (token) { return token.char; }).join('') - ); - } -}; - -/** - * Converts all tokens into a string - */ -Tokenizer.prototype.getText = function () { - return this.tokens.map(function (token) { return token.char; }).join(''); -}; - -/** - * Get a context by name - * @param {string} contextName context name to get - */ -Tokenizer.prototype.getContext = function (contextName) { - var context = this.registeredContexts[contextName]; - return !!context ? context : null; -}; - -/** - * Subscribes a new event handler to an event - * @param {string} eventName event name to subscribe to - * @param {function} eventHandler a function to be invoked on event - */ -Tokenizer.prototype.on = function(eventName, eventHandler) { - var event = this.events[eventName]; - if (!!event) { - return event.subscribe(eventHandler); - } else { - return null; - } -}; - -/** - * Dispatches an event - * @param {string} eventName event name - * @param {any} args event handler arguments - */ -Tokenizer.prototype.dispatch = function(eventName, args) { - var this$1 = this; - - var event = this.events[eventName]; - if (event instanceof Event) { - event.subscribers.forEach(function (subscriber) { - subscriber.apply(this$1, args || []); - }); - } -}; - -/** - * Register a new context checker - * @param {string} contextName a unique context name - * @param {function} contextStartCheck a predicate function that returns true on context start - * @param {function} contextEndCheck a predicate function that returns true on context end - * TODO: call tokenize on registration to update context ranges with the new context. - */ -Tokenizer.prototype.registerContextChecker = function(contextName, contextStartCheck, contextEndCheck) { - if (!!this.getContext(contextName)) { return { - FAIL: - ("context name '" + contextName + "' is already registered.") - }; } - if (typeof contextStartCheck !== 'function') { return { - FAIL: - "missing context start check." - }; } - if (typeof contextEndCheck !== 'function') { return { - FAIL: - "missing context end check." - }; } - var contextCheckers = new ContextChecker( - contextName, contextStartCheck, contextEndCheck - ); - this.registeredContexts[contextName] = contextCheckers; - this.contextCheckers.push(contextCheckers); - return contextCheckers; -}; - -/** - * Gets a context range tokens - * @param {contextRange} range a context range - */ -Tokenizer.prototype.getRangeTokens = function(range) { - var endIndex = range.startIndex + range.endOffset; - return [].concat( - this.tokens - .slice(range.startIndex, endIndex) - ); -}; - -/** - * Gets the ranges of a context - * @param {string} contextName context name - */ -Tokenizer.prototype.getContextRanges = function(contextName) { - var context = this.getContext(contextName); - if (!!context) { - return context.ranges; - } else { - return { FAIL: ("context checker '" + contextName + "' is not registered.") }; - } -}; - -/** - * Resets context ranges to run context update - */ -Tokenizer.prototype.resetContextsRanges = function () { - var registeredContexts = this.registeredContexts; - for (var contextName in registeredContexts) { - if (registeredContexts.hasOwnProperty(contextName)) { - var context = registeredContexts[contextName]; - context.ranges = []; - } - } -}; - -/** - * Updates context ranges - */ -Tokenizer.prototype.updateContextsRanges = function () { - this.resetContextsRanges(); - var chars = this.tokens.map(function (token) { return token.char; }); - for (var i = 0; i < chars.length; i++) { - var contextParams = new ContextParams(chars, i); - this.runContextCheck(contextParams); - } - this.dispatch('updateContextsRanges', [this.registeredContexts]); -}; - -/** - * Sets the end offset of an open range - * @param {number} offset range end offset - * @param {string} contextName context name - */ -Tokenizer.prototype.setEndOffset = function (offset, contextName) { - var startIndex = this.getContext(contextName).openRange.startIndex; - var range = new ContextRange(startIndex, offset, contextName); - var ranges = this.getContext(contextName).ranges; - range.rangeId = contextName + "." + (ranges.length); - ranges.push(range); - this.getContext(contextName).openRange = null; - return range; -}; - -/** - * Runs a context check on the current context - * @param {contextParams} contextParams current context params - */ -Tokenizer.prototype.runContextCheck = function(contextParams) { - var this$1 = this; - - var index = contextParams.index; - this.contextCheckers.forEach(function (contextChecker) { - var contextName = contextChecker.contextName; - var openRange = this$1.getContext(contextName).openRange; - if (!openRange && contextChecker.checkStart(contextParams)) { - openRange = new ContextRange(index, null, contextName); - this$1.getContext(contextName).openRange = openRange; - this$1.dispatch('contextStart', [contextName, index]); - } - if (!!openRange && contextChecker.checkEnd(contextParams)) { - var offset = (index - openRange.startIndex) + 1; - var range = this$1.setEndOffset(offset, contextName); - this$1.dispatch('contextEnd', [contextName, range]); - } - }); -}; - -/** - * Converts a text into a list of tokens - * @param {string} text a text to tokenize - */ -Tokenizer.prototype.tokenize = function (text) { - this.tokens = []; - this.resetContextsRanges(); - var chars = Array.from(text); - this.dispatch('start'); - for (var i = 0; i < chars.length; i++) { - var char = chars[i]; - var contextParams = new ContextParams(chars, i); - this.dispatch('next', [contextParams]); - this.runContextCheck(contextParams); - var token = new Token(char); - this.tokens.push(token); - this.dispatch('newToken', [token, contextParams]); - } - this.dispatch('end', [this.tokens]); - return this.tokens; -}; - -// ╭─┄┄┄────────────────────────┄─────────────────────────────────────────────╮ -// ┊ Character Class Assertions ┊ Checks if a char belongs to a certain class ┊ -// ╰─╾──────────────────────────┄─────────────────────────────────────────────╯ -// jscs:disable maximumLineLength -/** - * Check if a char is Arabic - * @param {string} c a single char - */ -function isArabicChar(c) { - return /[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(c); -} - -/** - * Check if a char is an isolated arabic char - * @param {string} c a single char - */ -function isIsolatedArabicChar(char) { - return /[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(char); -} - -/** - * Check if a char is an Arabic Tashkeel char - * @param {string} c a single char - */ -function isTashkeelArabicChar(char) { - return /[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(char); -} - -/** - * Check if a char is Latin - * @param {string} c a single char - */ -function isLatinChar(c) { - return /[A-z]/.test(c); -} - -/** - * Check if a char is whitespace char - * @param {string} c a single char - */ -function isWhiteSpace(c) { - return /\s/.test(c); -} - -/** - * Query a feature by some of it's properties to lookup a glyph substitution. - */ - -/** - * Create feature query instance - * @param {Font} font opentype font instance - */ -function FeatureQuery(font) { - this.font = font; - this.features = {}; -} - -/** - * @typedef SubstitutionAction - * @type Object - * @property {number} id substitution type - * @property {string} tag feature tag - * @property {any} substitution substitution value(s) - */ - -/** - * Create a substitution action instance - * @param {SubstitutionAction} action - */ -function SubstitutionAction(action) { - this.id = action.id; - this.tag = action.tag; - this.substitution = action.substitution; -} - -/** - * Lookup a coverage table - * @param {number} glyphIndex glyph index - * @param {CoverageTable} coverage coverage table - */ -function lookupCoverage(glyphIndex, coverage) { - if (!glyphIndex) { return -1; } - switch (coverage.format) { - case 1: - return coverage.glyphs.indexOf(glyphIndex); - - case 2: - var ranges = coverage.ranges; - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (glyphIndex >= range.start && glyphIndex <= range.end) { - var offset = glyphIndex - range.start; - return range.index + offset; - } - } - break; - default: - return -1; // not found - } - return -1; -} - -/** - * Handle a single substitution - format 1 - * @param {ContextParams} contextParams context params to lookup - */ -function singleSubstitutionFormat1(glyphIndex, subtable) { - var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage); - if (substituteIndex === -1) { return null; } - return glyphIndex + subtable.deltaGlyphId; -} - -/** - * Handle a single substitution - format 2 - * @param {ContextParams} contextParams context params to lookup - */ -function singleSubstitutionFormat2(glyphIndex, subtable) { - var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage); - if (substituteIndex === -1) { return null; } - return subtable.substitute[substituteIndex]; -} - -/** - * Lookup a list of coverage tables - * @param {any} coverageList a list of coverage tables - * @param {ContextParams} contextParams context params to lookup - */ -function lookupCoverageList(coverageList, contextParams) { - var lookupList = []; - for (var i = 0; i < coverageList.length; i++) { - var coverage = coverageList[i]; - var glyphIndex = contextParams.current; - glyphIndex = Array.isArray(glyphIndex) ? glyphIndex[0] : glyphIndex; - var lookupIndex = lookupCoverage(glyphIndex, coverage); - if (lookupIndex !== -1) { - lookupList.push(lookupIndex); - } - } - if (lookupList.length !== coverageList.length) { return -1; } - return lookupList; -} - -/** - * Handle chaining context substitution - format 3 - * @param {ContextParams} contextParams context params to lookup - */ -function chainingSubstitutionFormat3(contextParams, subtable) { - var lookupsCount = ( - subtable.inputCoverage.length + - subtable.lookaheadCoverage.length + - subtable.backtrackCoverage.length - ); - if (contextParams.context.length < lookupsCount) { return []; } - // INPUT LOOKUP // - var inputLookups = lookupCoverageList( - subtable.inputCoverage, contextParams - ); - if (inputLookups === -1) { return []; } - // LOOKAHEAD LOOKUP // - var lookaheadOffset = subtable.inputCoverage.length - 1; - if (contextParams.lookahead.length < subtable.lookaheadCoverage.length) { return []; } - var lookaheadContext = contextParams.lookahead.slice(lookaheadOffset); - while (lookaheadContext.length && isTashkeelArabicChar(lookaheadContext[0].char)) { - lookaheadContext.shift(); - } - var lookaheadParams = new ContextParams(lookaheadContext, 0); - var lookaheadLookups = lookupCoverageList( - subtable.lookaheadCoverage, lookaheadParams - ); - // BACKTRACK LOOKUP // - var backtrackContext = [].concat(contextParams.backtrack); - backtrackContext.reverse(); - while (backtrackContext.length && isTashkeelArabicChar(backtrackContext[0].char)) { - backtrackContext.shift(); - } - if (backtrackContext.length < subtable.backtrackCoverage.length) { return []; } - var backtrackParams = new ContextParams(backtrackContext, 0); - var backtrackLookups = lookupCoverageList( - subtable.backtrackCoverage, backtrackParams - ); - var contextRulesMatch = ( - inputLookups.length === subtable.inputCoverage.length && - lookaheadLookups.length === subtable.lookaheadCoverage.length && - backtrackLookups.length === subtable.backtrackCoverage.length - ); - var substitutions = []; - if (contextRulesMatch) { - for (var i = 0; i < subtable.lookupRecords.length; i++) { - var lookupRecord = subtable.lookupRecords[i]; - var lookupListIndex = lookupRecord.lookupListIndex; - var lookupTable = this.getLookupByIndex(lookupListIndex); - for (var s = 0; s < lookupTable.subtables.length; s++) { - var subtable$1 = lookupTable.subtables[s]; - var lookup = this.getLookupMethod(lookupTable, subtable$1); - var substitutionType = this.getSubstitutionType(lookupTable, subtable$1); - if (substitutionType === '12') { - for (var n = 0; n < inputLookups.length; n++) { - var glyphIndex = contextParams.get(n); - var substitution = lookup(glyphIndex); - if (substitution) { substitutions.push(substitution); } - } - } - } - } - } - return substitutions; -} - -/** - * Handle ligature substitution - format 1 - * @param {ContextParams} contextParams context params to lookup - */ -function ligatureSubstitutionFormat1(contextParams, subtable) { - // COVERAGE LOOKUP // - var glyphIndex = contextParams.current; - var ligSetIndex = lookupCoverage(glyphIndex, subtable.coverage); - if (ligSetIndex === -1) { return null; } - // COMPONENTS LOOKUP - // (!) note, components are ordered in the written direction. - var ligature; - var ligatureSet = subtable.ligatureSets[ligSetIndex]; - for (var s = 0; s < ligatureSet.length; s++) { - ligature = ligatureSet[s]; - for (var l = 0; l < ligature.components.length; l++) { - var lookaheadItem = contextParams.lookahead[l]; - var component = ligature.components[l]; - if (lookaheadItem !== component) { break; } - if (l === ligature.components.length - 1) { return ligature; } - } - } - return null; -} - -/** - * Handle decomposition substitution - format 1 - * @param {number} glyphIndex glyph index - * @param {any} subtable subtable - */ -function decompositionSubstitutionFormat1(glyphIndex, subtable) { - var substituteIndex = lookupCoverage(glyphIndex, subtable.coverage); - if (substituteIndex === -1) { return null; } - return subtable.sequences[substituteIndex]; -} - -/** - * Get default script features indexes - */ -FeatureQuery.prototype.getDefaultScriptFeaturesIndexes = function () { - var scripts = this.font.tables.gsub.scripts; - for (var s = 0; s < scripts.length; s++) { - var script = scripts[s]; - if (script.tag === 'DFLT') { return ( - script.script.defaultLangSys.featureIndexes - ); } - } - return []; -}; - -/** - * Get feature indexes of a specific script - * @param {string} scriptTag script tag - */ -FeatureQuery.prototype.getScriptFeaturesIndexes = function(scriptTag) { - var tables = this.font.tables; - if (!tables.gsub) { return []; } - if (!scriptTag) { return this.getDefaultScriptFeaturesIndexes(); } - var scripts = this.font.tables.gsub.scripts; - for (var i = 0; i < scripts.length; i++) { - var script = scripts[i]; - if (script.tag === scriptTag && script.script.defaultLangSys) { - return script.script.defaultLangSys.featureIndexes; - } else { - var langSysRecords = script.langSysRecords; - if (!!langSysRecords) { - for (var j = 0; j < langSysRecords.length; j++) { - var langSysRecord = langSysRecords[j]; - if (langSysRecord.tag === scriptTag) { - var langSys = langSysRecord.langSys; - return langSys.featureIndexes; - } - } - } - } - } - return this.getDefaultScriptFeaturesIndexes(); -}; - -/** - * Map a feature tag to a gsub feature - * @param {any} features gsub features - * @param {string} scriptTag script tag - */ -FeatureQuery.prototype.mapTagsToFeatures = function (features, scriptTag) { - var tags = {}; - for (var i = 0; i < features.length; i++) { - var tag = features[i].tag; - var feature = features[i].feature; - tags[tag] = feature; - } - this.features[scriptTag].tags = tags; -}; - -/** - * Get features of a specific script - * @param {string} scriptTag script tag - */ -FeatureQuery.prototype.getScriptFeatures = function (scriptTag) { - var features = this.features[scriptTag]; - if (this.features.hasOwnProperty(scriptTag)) { return features; } - var featuresIndexes = this.getScriptFeaturesIndexes(scriptTag); - if (!featuresIndexes) { return null; } - var gsub = this.font.tables.gsub; - features = featuresIndexes.map(function (index) { return gsub.features[index]; }); - this.features[scriptTag] = features; - this.mapTagsToFeatures(features, scriptTag); - return features; -}; - -/** - * Get substitution type - * @param {any} lookupTable lookup table - * @param {any} subtable subtable - */ -FeatureQuery.prototype.getSubstitutionType = function(lookupTable, subtable) { - var lookupType = lookupTable.lookupType.toString(); - var substFormat = subtable.substFormat.toString(); - return lookupType + substFormat; -}; - -/** - * Get lookup method - * @param {any} lookupTable lookup table - * @param {any} subtable subtable - */ -FeatureQuery.prototype.getLookupMethod = function(lookupTable, subtable) { - var this$1 = this; - - var substitutionType = this.getSubstitutionType(lookupTable, subtable); - switch (substitutionType) { - case '11': - return function (glyphIndex) { return singleSubstitutionFormat1.apply( - this$1, [glyphIndex, subtable] - ); }; - case '12': - return function (glyphIndex) { return singleSubstitutionFormat2.apply( - this$1, [glyphIndex, subtable] - ); }; - case '63': - return function (contextParams) { return chainingSubstitutionFormat3.apply( - this$1, [contextParams, subtable] - ); }; - case '41': - return function (contextParams) { return ligatureSubstitutionFormat1.apply( - this$1, [contextParams, subtable] - ); }; - case '21': - return function (glyphIndex) { return decompositionSubstitutionFormat1.apply( - this$1, [glyphIndex, subtable] - ); }; - default: - throw new Error( - "lookupType: " + (lookupTable.lookupType) + " - " + - "substFormat: " + (subtable.substFormat) + " " + - "is not yet supported" - ); - } -}; - -/** - * [ LOOKUP TYPES ] - * ------------------------------- - * Single 1; - * Multiple 2; - * Alternate 3; - * Ligature 4; - * Context 5; - * ChainingContext 6; - * ExtensionSubstitution 7; - * ReverseChainingContext 8; - * ------------------------------- - * - */ - -/** - * @typedef FQuery - * @type Object - * @param {string} tag feature tag - * @param {string} script feature script - * @param {ContextParams} contextParams context params - */ - -/** - * Lookup a feature using a query parameters - * @param {FQuery} query feature query - */ -FeatureQuery.prototype.lookupFeature = function (query) { - var contextParams = query.contextParams; - var currentIndex = contextParams.index; - var feature = this.getFeature({ - tag: query.tag, script: query.script - }); - if (!feature) { return new Error( - "font '" + (this.font.names.fullName.en) + "' " + - "doesn't support feature '" + (query.tag) + "' " + - "for script '" + (query.script) + "'." - ); } - var lookups = this.getFeatureLookups(feature); - var substitutions = [].concat(contextParams.context); - for (var l = 0; l < lookups.length; l++) { - var lookupTable = lookups[l]; - var subtables = this.getLookupSubtables(lookupTable); - for (var s = 0; s < subtables.length; s++) { - var subtable = subtables[s]; - var substType = this.getSubstitutionType(lookupTable, subtable); - var lookup = this.getLookupMethod(lookupTable, subtable); - var substitution = (void 0); - switch (substType) { - case '11': - substitution = lookup(contextParams.current); - if (substitution) { - substitutions.splice(currentIndex, 1, new SubstitutionAction({ - id: 11, tag: query.tag, substitution: substitution - })); - } - break; - case '12': - substitution = lookup(contextParams.current); - if (substitution) { - substitutions.splice(currentIndex, 1, new SubstitutionAction({ - id: 12, tag: query.tag, substitution: substitution - })); - } - break; - case '63': - substitution = lookup(contextParams); - if (Array.isArray(substitution) && substitution.length) { - substitutions.splice(currentIndex, 1, new SubstitutionAction({ - id: 63, tag: query.tag, substitution: substitution - })); - } - break; - case '41': - substitution = lookup(contextParams); - if (substitution) { - substitutions.splice(currentIndex, 1, new SubstitutionAction({ - id: 41, tag: query.tag, substitution: substitution - })); - } - break; - case '21': - substitution = lookup(contextParams.current); - if (substitution) { - substitutions.splice(currentIndex, 1, new SubstitutionAction({ - id: 21, tag: query.tag, substitution: substitution - })); - } - break; - } - contextParams = new ContextParams(substitutions, currentIndex); - if (Array.isArray(substitution) && !substitution.length) { continue; } - substitution = null; - } - } - return substitutions.length ? substitutions : null; -}; - -/** - * Checks if a font supports a specific features - * @param {FQuery} query feature query object - */ -FeatureQuery.prototype.supports = function (query) { - if (!query.script) { return false; } - this.getScriptFeatures(query.script); - var supportedScript = this.features.hasOwnProperty(query.script); - if (!query.tag) { return supportedScript; } - var supportedFeature = ( - this.features[query.script].some(function (feature) { return feature.tag === query.tag; }) - ); - return supportedScript && supportedFeature; -}; - -/** - * Get lookup table subtables - * @param {any} lookupTable lookup table - */ -FeatureQuery.prototype.getLookupSubtables = function (lookupTable) { - return lookupTable.subtables || null; -}; - -/** - * Get lookup table by index - * @param {number} index lookup table index - */ -FeatureQuery.prototype.getLookupByIndex = function (index) { - var lookups = this.font.tables.gsub.lookups; - return lookups[index] || null; -}; - -/** - * Get lookup tables for a feature - * @param {string} feature - */ -FeatureQuery.prototype.getFeatureLookups = function (feature) { - // TODO: memoize - return feature.lookupListIndexes.map(this.getLookupByIndex.bind(this)); -}; - -/** - * Query a feature by it's properties - * @param {any} query an object that describes the properties of a query - */ -FeatureQuery.prototype.getFeature = function getFeature(query) { - if (!this.font) { return { FAIL: "No font was found"}; } - if (!this.features.hasOwnProperty(query.script)) { - this.getScriptFeatures(query.script); - } - var scriptFeatures = this.features[query.script]; - if (!scriptFeatures) { return ( - { FAIL: ("No feature for script " + (query.script))} - ); } - if (!scriptFeatures.tags[query.tag]) { return null; } - return this.features[query.script].tags[query.tag]; -}; - -/** - * Arabic word context checkers - */ - -function arabicWordStartCheck(contextParams) { - var char = contextParams.current; - var prevChar = contextParams.get(-1); - return ( - // ? arabic first char - (prevChar === null && isArabicChar(char)) || - // ? arabic char preceded with a non arabic char - (!isArabicChar(prevChar) && isArabicChar(char)) - ); -} - -function arabicWordEndCheck(contextParams) { - var nextChar = contextParams.get(1); - return ( - // ? last arabic char - (nextChar === null) || - // ? next char is not arabic - (!isArabicChar(nextChar)) - ); -} - -var arabicWordCheck = { - startCheck: arabicWordStartCheck, - endCheck: arabicWordEndCheck -}; - -/** - * Arabic sentence context checkers - */ - -function arabicSentenceStartCheck(contextParams) { - var char = contextParams.current; - var prevChar = contextParams.get(-1); - return ( - // ? an arabic char preceded with a non arabic char - (isArabicChar(char) || isTashkeelArabicChar(char)) && - !isArabicChar(prevChar) - ); -} - -function arabicSentenceEndCheck(contextParams) { - var nextChar = contextParams.get(1); - switch (true) { - case nextChar === null: - return true; - case (!isArabicChar(nextChar) && !isTashkeelArabicChar(nextChar)): - var nextIsWhitespace = isWhiteSpace(nextChar); - if (!nextIsWhitespace) { return true; } - if (nextIsWhitespace) { - var arabicCharAhead = false; - arabicCharAhead = ( - contextParams.lookahead.some( - function (c) { return isArabicChar(c) || isTashkeelArabicChar(c); } - ) - ); - if (!arabicCharAhead) { return true; } - } - break; - default: - return false; - } -} - -var arabicSentenceCheck = { - startCheck: arabicSentenceStartCheck, - endCheck: arabicSentenceEndCheck -}; - -/** - * Apply single substitution format 1 - * @param {Array} substitutions substitutions - * @param {any} tokens a list of tokens - * @param {number} index token index - */ -function singleSubstitutionFormat1$1(action, tokens, index) { - tokens[index].setState(action.tag, action.substitution); -} - -/** - * Apply single substitution format 2 - * @param {Array} substitutions substitutions - * @param {any} tokens a list of tokens - * @param {number} index token index - */ -function singleSubstitutionFormat2$1(action, tokens, index) { - tokens[index].setState(action.tag, action.substitution); -} - -/** - * Apply chaining context substitution format 3 - * @param {Array} substitutions substitutions - * @param {any} tokens a list of tokens - * @param {number} index token index - */ -function chainingSubstitutionFormat3$1(action, tokens, index) { - action.substitution.forEach(function (subst, offset) { - var token = tokens[index + offset]; - token.setState(action.tag, subst); - }); -} - -/** - * Apply ligature substitution format 1 - * @param {Array} substitutions substitutions - * @param {any} tokens a list of tokens - * @param {number} index token index - */ -function ligatureSubstitutionFormat1$1(action, tokens, index) { - var token = tokens[index]; - token.setState(action.tag, action.substitution.ligGlyph); - var compsCount = action.substitution.components.length; - for (var i = 0; i < compsCount; i++) { - token = tokens[index + i + 1]; - token.setState('deleted', true); - } -} - -/** - * Supported substitutions - */ -var SUBSTITUTIONS = { - 11: singleSubstitutionFormat1$1, - 12: singleSubstitutionFormat2$1, - 63: chainingSubstitutionFormat3$1, - 41: ligatureSubstitutionFormat1$1 -}; - -/** - * Apply substitutions to a list of tokens - * @param {Array} substitutions substitutions - * @param {any} tokens a list of tokens - * @param {number} index token index - */ -function applySubstitution(action, tokens, index) { - if (action instanceof SubstitutionAction && SUBSTITUTIONS[action.id]) { - SUBSTITUTIONS[action.id](action, tokens, index); - } -} - -/** - * Apply Arabic presentation forms to a range of tokens - */ - -/** - * Check if a char can be connected to it's preceding char - * @param {ContextParams} charContextParams context params of a char - */ -function willConnectPrev(charContextParams) { - var backtrack = [].concat(charContextParams.backtrack); - for (var i = backtrack.length - 1; i >= 0; i--) { - var prevChar = backtrack[i]; - var isolated = isIsolatedArabicChar(prevChar); - var tashkeel = isTashkeelArabicChar(prevChar); - if (!isolated && !tashkeel) { return true; } - if (isolated) { return false; } - } - return false; -} - -/** - * Check if a char can be connected to it's proceeding char - * @param {ContextParams} charContextParams context params of a char - */ -function willConnectNext(charContextParams) { - if (isIsolatedArabicChar(charContextParams.current)) { return false; } - for (var i = 0; i < charContextParams.lookahead.length; i++) { - var nextChar = charContextParams.lookahead[i]; - var tashkeel = isTashkeelArabicChar(nextChar); - if (!tashkeel) { return true; } - } - return false; -} - -/** - * Apply arabic presentation forms to a list of tokens - * @param {ContextRange} range a range of tokens - */ -function arabicPresentationForms(range) { - var this$1 = this; - - var script = 'arab'; - var tags = this.featuresTags[script]; - var tokens = this.tokenizer.getRangeTokens(range); - if (tokens.length === 1) { return; } - var contextParams = new ContextParams( - tokens.map(function (token) { return token.getState('glyphIndex'); } - ), 0); - var charContextParams = new ContextParams( - tokens.map(function (token) { return token.char; } - ), 0); - tokens.forEach(function (token, index) { - if (isTashkeelArabicChar(token.char)) { return; } - contextParams.setCurrentIndex(index); - charContextParams.setCurrentIndex(index); - var CONNECT = 0; // 2 bits 00 (10: can connect next) (01: can connect prev) - if (willConnectPrev(charContextParams)) { CONNECT |= 1; } - if (willConnectNext(charContextParams)) { CONNECT |= 2; } - var tag; - switch (CONNECT) { - case 1: (tag = 'fina'); break; - case 2: (tag = 'init'); break; - case 3: (tag = 'medi'); break; - } - if (tags.indexOf(tag) === -1) { return; } - var substitutions = this$1.query.lookupFeature({ - tag: tag, script: script, contextParams: contextParams - }); - if (substitutions instanceof Error) { return console.info(substitutions.message); } - substitutions.forEach(function (action, index) { - if (action instanceof SubstitutionAction) { - applySubstitution(action, tokens, index); - contextParams.context[index] = action.substitution; - } - }); - }); -} - -/** - * Apply Arabic required ligatures feature to a range of tokens - */ - -/** - * Update context params - * @param {any} tokens a list of tokens - * @param {number} index current item index - */ -function getContextParams(tokens, index) { - var context = tokens.map(function (token) { return token.activeState.value; }); - return new ContextParams(context, index || 0); -} - -/** - * Apply Arabic required ligatures to a context range - * @param {ContextRange} range a range of tokens - */ -function arabicRequiredLigatures(range) { - var this$1 = this; - - var script = 'arab'; - var tokens = this.tokenizer.getRangeTokens(range); - var contextParams = getContextParams(tokens); - contextParams.context.forEach(function (glyphIndex, index) { - contextParams.setCurrentIndex(index); - var substitutions = this$1.query.lookupFeature({ - tag: 'rlig', script: script, contextParams: contextParams - }); - if (substitutions.length) { - substitutions.forEach( - function (action) { return applySubstitution(action, tokens, index); } - ); - contextParams = getContextParams(tokens); - } - }); -} - -/** - * Latin word context checkers - */ - -function latinWordStartCheck(contextParams) { - var char = contextParams.current; - var prevChar = contextParams.get(-1); - return ( - // ? latin first char - (prevChar === null && isLatinChar(char)) || - // ? latin char preceded with a non latin char - (!isLatinChar(prevChar) && isLatinChar(char)) - ); -} - -function latinWordEndCheck(contextParams) { - var nextChar = contextParams.get(1); - return ( - // ? last latin char - (nextChar === null) || - // ? next char is not latin - (!isLatinChar(nextChar)) - ); -} - -var latinWordCheck = { - startCheck: latinWordStartCheck, - endCheck: latinWordEndCheck -}; - -/** - * Apply Latin ligature feature to a range of tokens - */ - -/** - * Update context params - * @param {any} tokens a list of tokens - * @param {number} index current item index - */ -function getContextParams$1(tokens, index) { - var context = tokens.map(function (token) { return token.activeState.value; }); - return new ContextParams(context, index || 0); -} - -/** - * Apply Arabic required ligatures to a context range - * @param {ContextRange} range a range of tokens - */ -function latinLigature(range) { - var this$1 = this; - - var script = 'latn'; - var tokens = this.tokenizer.getRangeTokens(range); - var contextParams = getContextParams$1(tokens); - contextParams.context.forEach(function (glyphIndex, index) { - contextParams.setCurrentIndex(index); - var substitutions = this$1.query.lookupFeature({ - tag: 'liga', script: script, contextParams: contextParams - }); - if (substitutions.length) { - substitutions.forEach( - function (action) { return applySubstitution(action, tokens, index); } - ); - contextParams = getContextParams$1(tokens); - } - }); -} - -/** - * Infer bidirectional properties for a given text and apply - * the corresponding layout rules. - */ - -/** - * Create Bidi. features - * @param {string} baseDir text base direction. value either 'ltr' or 'rtl' - */ -function Bidi(baseDir) { - this.baseDir = baseDir || 'ltr'; - this.tokenizer = new Tokenizer(); - this.featuresTags = {}; -} - -/** - * Sets Bidi text - * @param {string} text a text input - */ -Bidi.prototype.setText = function (text) { - this.text = text; -}; - -/** - * Store essential context checks: - * arabic word check for applying gsub features - * arabic sentence check for adjusting arabic layout - */ -Bidi.prototype.contextChecks = ({ - latinWordCheck: latinWordCheck, - arabicWordCheck: arabicWordCheck, - arabicSentenceCheck: arabicSentenceCheck -}); - -/** - * Register arabic word check - */ -function registerContextChecker(checkId) { - var check = this.contextChecks[(checkId + "Check")]; - return this.tokenizer.registerContextChecker( - checkId, check.startCheck, check.endCheck - ); -} - -/** - * Perform pre tokenization procedure then - * tokenize text input - */ -function tokenizeText() { - registerContextChecker.call(this, 'latinWord'); - registerContextChecker.call(this, 'arabicWord'); - registerContextChecker.call(this, 'arabicSentence'); - return this.tokenizer.tokenize(this.text); -} - -/** - * Reverse arabic sentence layout - * TODO: check base dir before applying adjustments - priority low - */ -function reverseArabicSentences() { - var this$1 = this; - - var ranges = this.tokenizer.getContextRanges('arabicSentence'); - ranges.forEach(function (range) { - var rangeTokens = this$1.tokenizer.getRangeTokens(range); - this$1.tokenizer.replaceRange( - range.startIndex, - range.endOffset, - rangeTokens.reverse() - ); - }); -} - -/** - * Register supported features tags - * @param {script} script script tag - * @param {Array} tags features tags list - */ -Bidi.prototype.registerFeatures = function (script, tags) { - var this$1 = this; - - var supportedTags = tags.filter( - function (tag) { return this$1.query.supports({script: script, tag: tag}); } - ); - if (!this.featuresTags.hasOwnProperty(script)) { - this.featuresTags[script] = supportedTags; - } else { - this.featuresTags[script] = - this.featuresTags[script].concat(supportedTags); - } -}; - -/** - * Apply GSUB features - * @param {Array} tagsList a list of features tags - * @param {string} script a script tag - * @param {Font} font opentype font instance - */ -Bidi.prototype.applyFeatures = function (font, features) { - if (!font) { throw new Error( - 'No valid font was provided to apply features' - ); } - if (!this.query) { this.query = new FeatureQuery(font); } - for (var f = 0; f < features.length; f++) { - var feature = features[f]; - if (!this.query.supports({script: feature.script})) { continue; } - this.registerFeatures(feature.script, feature.tags); - } -}; - -/** - * Register a state modifier - * @param {string} modifierId state modifier id - * @param {function} condition a predicate function that returns true or false - * @param {function} modifier a modifier function to set token state - */ -Bidi.prototype.registerModifier = function (modifierId, condition, modifier) { - this.tokenizer.registerModifier(modifierId, condition, modifier); -}; - -/** - * Check if 'glyphIndex' is registered - */ -function checkGlyphIndexStatus() { - if (this.tokenizer.registeredModifiers.indexOf('glyphIndex') === -1) { - throw new Error( - 'glyphIndex modifier is required to apply ' + - 'arabic presentation features.' - ); - } -} - -/** - * Apply arabic presentation forms features - */ -function applyArabicPresentationForms() { - var this$1 = this; - - var script = 'arab'; - if (!this.featuresTags.hasOwnProperty(script)) { return; } - checkGlyphIndexStatus.call(this); - var ranges = this.tokenizer.getContextRanges('arabicWord'); - ranges.forEach(function (range) { - arabicPresentationForms.call(this$1, range); - }); -} - -/** - * Apply required arabic ligatures - */ -function applyArabicRequireLigatures() { - var this$1 = this; - - var script = 'arab'; - if (!this.featuresTags.hasOwnProperty(script)) { return; } - var tags = this.featuresTags[script]; - if (tags.indexOf('rlig') === -1) { return; } - checkGlyphIndexStatus.call(this); - var ranges = this.tokenizer.getContextRanges('arabicWord'); - ranges.forEach(function (range) { - arabicRequiredLigatures.call(this$1, range); - }); -} - -/** - * Apply required arabic ligatures - */ -function applyLatinLigatures() { - var this$1 = this; - - var script = 'latn'; - if (!this.featuresTags.hasOwnProperty(script)) { return; } - var tags = this.featuresTags[script]; - if (tags.indexOf('liga') === -1) { return; } - checkGlyphIndexStatus.call(this); - var ranges = this.tokenizer.getContextRanges('latinWord'); - ranges.forEach(function (range) { - latinLigature.call(this$1, range); - }); -} - -/** - * Check if a context is registered - * @param {string} contextId context id - */ -Bidi.prototype.checkContextReady = function (contextId) { - return !!this.tokenizer.getContext(contextId); -}; - -/** - * Apply features to registered contexts - */ -Bidi.prototype.applyFeaturesToContexts = function () { - if (this.checkContextReady('arabicWord')) { - applyArabicPresentationForms.call(this); - applyArabicRequireLigatures.call(this); - } - if (this.checkContextReady('latinWord')) { - applyLatinLigatures.call(this); - } - if (this.checkContextReady('arabicSentence')) { - reverseArabicSentences.call(this); - } -}; - -/** - * process text input - * @param {string} text an input text - */ -Bidi.prototype.processText = function(text) { - if (!this.text || this.text !== text) { - this.setText(text); - tokenizeText.call(this); - this.applyFeaturesToContexts(); - } -}; - -/** - * Process a string of text to identify and adjust - * bidirectional text entities. - * @param {string} text input text - */ -Bidi.prototype.getBidiText = function (text) { - this.processText(text); - return this.tokenizer.getText(); -}; - -/** - * Get the current state index of each token - * @param {text} text an input text - */ -Bidi.prototype.getTextGlyphs = function (text) { - this.processText(text); - var indexes = []; - for (var i = 0; i < this.tokenizer.tokens.length; i++) { - var token = this.tokenizer.tokens[i]; - if (token.state.deleted) { continue; } - var index = token.activeState.value; - indexes.push(Array.isArray(index) ? index[0] : index); - } - return indexes; -}; - -// The Font object - -/** - * @typedef FontOptions - * @type Object - * @property {Boolean} empty - whether to create a new empty font - * @property {string} familyName - * @property {string} styleName - * @property {string=} fullName - * @property {string=} postScriptName - * @property {string=} designer - * @property {string=} designerURL - * @property {string=} manufacturer - * @property {string=} manufacturerURL - * @property {string=} license - * @property {string=} licenseURL - * @property {string=} version - * @property {string=} description - * @property {string=} copyright - * @property {string=} trademark - * @property {Number} unitsPerEm - * @property {Number} ascender - * @property {Number} descender - * @property {Number} createdTimestamp - * @property {string=} weightClass - * @property {string=} widthClass - * @property {string=} fsSelection - */ - -/** - * A Font represents a loaded OpenType font file. - * It contains a set of glyphs and methods to draw text on a drawing context, - * or to get a path representing the text. - * @exports opentype.Font - * @class - * @param {FontOptions} - * @constructor - */ -function Font(options) { - options = options || {}; - options.tables = options.tables || {}; - - if (!options.empty) { - // Check that we've provided the minimum set of names. - checkArgument(options.familyName, 'When creating a new Font object, familyName is required.'); - checkArgument(options.styleName, 'When creating a new Font object, styleName is required.'); - checkArgument(options.unitsPerEm, 'When creating a new Font object, unitsPerEm is required.'); - checkArgument(options.ascender, 'When creating a new Font object, ascender is required.'); - checkArgument(options.descender <= 0, 'When creating a new Font object, negative descender value is required.'); - - // OS X will complain if the names are empty, so we put a single space everywhere by default. - this.names = { - fontFamily: {en: options.familyName || ' '}, - fontSubfamily: {en: options.styleName || ' '}, - fullName: {en: options.fullName || options.familyName + ' ' + options.styleName}, - // postScriptName may not contain any whitespace - postScriptName: {en: options.postScriptName || (options.familyName + options.styleName).replace(/\s/g, '')}, - designer: {en: options.designer || ' '}, - designerURL: {en: options.designerURL || ' '}, - manufacturer: {en: options.manufacturer || ' '}, - manufacturerURL: {en: options.manufacturerURL || ' '}, - license: {en: options.license || ' '}, - licenseURL: {en: options.licenseURL || ' '}, - version: {en: options.version || 'Version 0.1'}, - description: {en: options.description || ' '}, - copyright: {en: options.copyright || ' '}, - trademark: {en: options.trademark || ' '} - }; - this.unitsPerEm = options.unitsPerEm || 1000; - this.ascender = options.ascender; - this.descender = options.descender; - this.createdTimestamp = options.createdTimestamp; - this.tables = Object.assign(options.tables, { - os2: Object.assign({ - usWeightClass: options.weightClass || this.usWeightClasses.MEDIUM, - usWidthClass: options.widthClass || this.usWidthClasses.MEDIUM, - fsSelection: options.fsSelection || this.fsSelectionValues.REGULAR, - }, options.tables.os2) - }); - } - - this.supported = true; // Deprecated: parseBuffer will throw an error if font is not supported. - this.glyphs = new glyphset.GlyphSet(this, options.glyphs || []); - this.encoding = new DefaultEncoding(this); - this.position = new Position(this); - this.substitution = new Substitution(this); - this.tables = this.tables || {}; - - // needed for low memory mode only. - this._push = null; - this._hmtxTableData = {}; - - Object.defineProperty(this, 'hinting', { - get: function() { - if (this._hinting) { return this._hinting; } - if (this.outlinesFormat === 'truetype') { - return (this._hinting = new Hinting(this)); - } - } - }); -} - -/** - * Check if the font has a glyph for the given character. - * @param {string} - * @return {Boolean} - */ -Font.prototype.hasChar = function(c) { - return this.encoding.charToGlyphIndex(c) !== null; -}; - -/** - * Convert the given character to a single glyph index. - * Note that this function assumes that there is a one-to-one mapping between - * the given character and a glyph; for complex scripts this might not be the case. - * @param {string} - * @return {Number} - */ -Font.prototype.charToGlyphIndex = function(s) { - return this.encoding.charToGlyphIndex(s); -}; - -/** - * Convert the given character to a single Glyph object. - * Note that this function assumes that there is a one-to-one mapping between - * the given character and a glyph; for complex scripts this might not be the case. - * @param {string} - * @return {opentype.Glyph} - */ -Font.prototype.charToGlyph = function(c) { - var glyphIndex = this.charToGlyphIndex(c); - var glyph = this.glyphs.get(glyphIndex); - if (!glyph) { - // .notdef - glyph = this.glyphs.get(0); - } - - return glyph; -}; - -/** - * Update features - * @param {any} options features options - */ -Font.prototype.updateFeatures = function (options) { - // TODO: update all features options not only 'latn'. - return this.defaultRenderOptions.features.map(function (feature) { - if (feature.script === 'latn') { - return { - script: 'latn', - tags: feature.tags.filter(function (tag) { return options[tag]; }) - }; - } else { - return feature; - } - }); -}; - -/** - * Convert the given text to a list of Glyph objects. - * Note that there is no strict one-to-one mapping between characters and - * glyphs, so the list of returned glyphs can be larger or smaller than the - * length of the given string. - * @param {string} - * @param {GlyphRenderOptions} [options] - * @return {opentype.Glyph[]} - */ -Font.prototype.stringToGlyphs = function(s, options) { - var this$1 = this; - - - var bidi = new Bidi(); - - // Create and register 'glyphIndex' state modifier - var charToGlyphIndexMod = function (token) { return this$1.charToGlyphIndex(token.char); }; - bidi.registerModifier('glyphIndex', null, charToGlyphIndexMod); - - // roll-back to default features - var features = options ? - this.updateFeatures(options.features) : - this.defaultRenderOptions.features; - - bidi.applyFeatures(this, features); - - var indexes = bidi.getTextGlyphs(s); - - var length = indexes.length; - - // convert glyph indexes to glyph objects - var glyphs = new Array(length); - var notdef = this.glyphs.get(0); - for (var i = 0; i < length; i += 1) { - glyphs[i] = this.glyphs.get(indexes[i]) || notdef; - } - return glyphs; -}; - -/** - * @param {string} - * @return {Number} - */ -Font.prototype.nameToGlyphIndex = function(name) { - return this.glyphNames.nameToGlyphIndex(name); -}; - -/** - * @param {string} - * @return {opentype.Glyph} - */ -Font.prototype.nameToGlyph = function(name) { - var glyphIndex = this.nameToGlyphIndex(name); - var glyph = this.glyphs.get(glyphIndex); - if (!glyph) { - // .notdef - glyph = this.glyphs.get(0); - } - - return glyph; -}; - -/** - * @param {Number} - * @return {String} - */ -Font.prototype.glyphIndexToName = function(gid) { - if (!this.glyphNames.glyphIndexToName) { - return ''; - } - - return this.glyphNames.glyphIndexToName(gid); -}; - -/** - * Retrieve the value of the kerning pair between the left glyph (or its index) - * and the right glyph (or its index). If no kerning pair is found, return 0. - * The kerning value gets added to the advance width when calculating the spacing - * between glyphs. - * For GPOS kerning, this method uses the default script and language, which covers - * most use cases. To have greater control, use font.position.getKerningValue . - * @param {opentype.Glyph} leftGlyph - * @param {opentype.Glyph} rightGlyph - * @return {Number} - */ -Font.prototype.getKerningValue = function(leftGlyph, rightGlyph) { - leftGlyph = leftGlyph.index || leftGlyph; - rightGlyph = rightGlyph.index || rightGlyph; - var gposKerning = this.position.defaultKerningTables; - if (gposKerning) { - return this.position.getKerningValue(gposKerning, leftGlyph, rightGlyph); - } - // "kern" table - return this.kerningPairs[leftGlyph + ',' + rightGlyph] || 0; -}; - -/** - * @typedef GlyphRenderOptions - * @type Object - * @property {string} [script] - script used to determine which features to apply. By default, 'DFLT' or 'latn' is used. - * See https://www.microsoft.com/typography/otspec/scripttags.htm - * @property {string} [language='dflt'] - language system used to determine which features to apply. - * See https://www.microsoft.com/typography/developers/opentype/languagetags.aspx - * @property {boolean} [kerning=true] - whether to include kerning values - * @property {object} [features] - OpenType Layout feature tags. Used to enable or disable the features of the given script/language system. - * See https://www.microsoft.com/typography/otspec/featuretags.htm - */ -Font.prototype.defaultRenderOptions = { - kerning: true, - features: [ - /** - * these 4 features are required to render Arabic text properly - * and shouldn't be turned off when rendering arabic text. - */ - { script: 'arab', tags: ['init', 'medi', 'fina', 'rlig'] }, - { script: 'latn', tags: ['liga', 'rlig'] } - ] -}; - -/** - * Helper function that invokes the given callback for each glyph in the given text. - * The callback gets `(glyph, x, y, fontSize, options)`.* @param {string} text - * @param {string} text - The text to apply. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - * @param {Function} callback - */ -Font.prototype.forEachGlyph = function(text, x, y, fontSize, options, callback) { - x = x !== undefined ? x : 0; - y = y !== undefined ? y : 0; - fontSize = fontSize !== undefined ? fontSize : 72; - options = Object.assign({}, this.defaultRenderOptions, options); - var fontScale = 1 / this.unitsPerEm * fontSize; - var glyphs = this.stringToGlyphs(text, options); - var kerningLookups; - if (options.kerning) { - var script = options.script || this.position.getDefaultScriptName(); - kerningLookups = this.position.getKerningTables(script, options.language); - } - for (var i = 0; i < glyphs.length; i += 1) { - var glyph = glyphs[i]; - callback.call(this, glyph, x, y, fontSize, options); - if (glyph.advanceWidth) { - x += glyph.advanceWidth * fontScale; - } - - if (options.kerning && i < glyphs.length - 1) { - // We should apply position adjustment lookups in a more generic way. - // Here we only use the xAdvance value. - var kerningValue = kerningLookups ? - this.position.getKerningValue(kerningLookups, glyph.index, glyphs[i + 1].index) : - this.getKerningValue(glyph, glyphs[i + 1]); - x += kerningValue * fontScale; - } - - if (options.letterSpacing) { - x += options.letterSpacing * fontSize; - } else if (options.tracking) { - x += (options.tracking / 1000) * fontSize; - } - } - return x; -}; - -/** - * Create a Path object that represents the given text. - * @param {string} text - The text to create. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - * @return {opentype.Path} - */ -Font.prototype.getPath = function(text, x, y, fontSize, options) { - var fullPath = new Path(); - this.forEachGlyph(text, x, y, fontSize, options, function(glyph, gX, gY, gFontSize) { - var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this); - fullPath.extend(glyphPath); - }); - return fullPath; -}; - -/** - * Create an array of Path objects that represent the glyphs of a given text. - * @param {string} text - The text to create. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - * @return {opentype.Path[]} - */ -Font.prototype.getPaths = function(text, x, y, fontSize, options) { - var glyphPaths = []; - this.forEachGlyph(text, x, y, fontSize, options, function(glyph, gX, gY, gFontSize) { - var glyphPath = glyph.getPath(gX, gY, gFontSize, options, this); - glyphPaths.push(glyphPath); - }); - - return glyphPaths; -}; - -/** - * Returns the advance width of a text. - * - * This is something different than Path.getBoundingBox() as for example a - * suffixed whitespace increases the advanceWidth but not the bounding box - * or an overhanging letter like a calligraphic 'f' might have a quite larger - * bounding box than its advance width. - * - * This corresponds to canvas2dContext.measureText(text).width - * - * @param {string} text - The text to create. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - * @return advance width - */ -Font.prototype.getAdvanceWidth = function(text, fontSize, options) { - return this.forEachGlyph(text, 0, 0, fontSize, options, function() {}); -}; - -/** - * Draw the text on the given drawing context. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {string} text - The text to create. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - */ -Font.prototype.draw = function(ctx, text, x, y, fontSize, options) { - this.getPath(text, x, y, fontSize, options).draw(ctx); -}; - -/** - * Draw the points of all glyphs in the text. - * On-curve points will be drawn in blue, off-curve points will be drawn in red. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {string} text - The text to create. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - */ -Font.prototype.drawPoints = function(ctx, text, x, y, fontSize, options) { - this.forEachGlyph(text, x, y, fontSize, options, function(glyph, gX, gY, gFontSize) { - glyph.drawPoints(ctx, gX, gY, gFontSize); - }); -}; - -/** - * Draw lines indicating important font measurements for all glyphs in the text. - * Black lines indicate the origin of the coordinate system (point 0,0). - * Blue lines indicate the glyph bounding box. - * Green line indicates the advance width of the glyph. - * @param {CanvasRenderingContext2D} ctx - A 2D drawing context, like Canvas. - * @param {string} text - The text to create. - * @param {number} [x=0] - Horizontal position of the beginning of the text. - * @param {number} [y=0] - Vertical position of the *baseline* of the text. - * @param {number} [fontSize=72] - Font size in pixels. We scale the glyph units by `1 / unitsPerEm * fontSize`. - * @param {GlyphRenderOptions=} options - */ -Font.prototype.drawMetrics = function(ctx, text, x, y, fontSize, options) { - this.forEachGlyph(text, x, y, fontSize, options, function(glyph, gX, gY, gFontSize) { - glyph.drawMetrics(ctx, gX, gY, gFontSize); - }); -}; - -/** - * @param {string} - * @return {string} - */ -Font.prototype.getEnglishName = function(name) { - var translations = this.names[name]; - if (translations) { - return translations.en; - } -}; - -/** - * Validate - */ -Font.prototype.validate = function() { - var _this = this; - - function assert(predicate, message) { - } - - function assertNamePresent(name) { - var englishName = _this.getEnglishName(name); - assert(englishName && englishName.trim().length > 0); - } - - // Identification information - assertNamePresent('fontFamily'); - assertNamePresent('weightName'); - assertNamePresent('manufacturer'); - assertNamePresent('copyright'); - assertNamePresent('version'); - - // Dimension information - assert(this.unitsPerEm > 0); -}; - -/** - * Convert the font object to a SFNT data structure. - * This structure contains all the necessary tables and metadata to create a binary OTF file. - * @return {opentype.Table} - */ -Font.prototype.toTables = function() { - return sfnt.fontToTable(this); -}; -/** - * @deprecated Font.toBuffer is deprecated. Use Font.toArrayBuffer instead. - */ -Font.prototype.toBuffer = function() { - console.warn('Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.'); - return this.toArrayBuffer(); -}; -/** - * Converts a `opentype.Font` into an `ArrayBuffer` - * @return {ArrayBuffer} - */ -Font.prototype.toArrayBuffer = function() { - var sfntTable = this.toTables(); - var bytes = sfntTable.encode(); - var buffer = new ArrayBuffer(bytes.length); - var intArray = new Uint8Array(buffer); - for (var i = 0; i < bytes.length; i++) { - intArray[i] = bytes[i]; - } - - return buffer; -}; - -/** - * Initiate a download of the OpenType font. - */ -Font.prototype.download = function(fileName) { - var familyName = this.getEnglishName('fontFamily'); - var styleName = this.getEnglishName('fontSubfamily'); - fileName = fileName || familyName.replace(/\s/g, '') + '-' + styleName + '.otf'; - var arrayBuffer = this.toArrayBuffer(); - - window.URL = window.URL || window.webkitURL; - - if (window.URL) { - var dataView = new DataView(arrayBuffer); - var blob = new Blob([dataView], {type: 'font/opentype'}); - - var link = document.createElement('a'); - link.href = window.URL.createObjectURL(blob); - link.download = fileName; - - var event = document.createEvent('MouseEvents'); - event.initEvent('click', true, false); - link.dispatchEvent(event); - } else { - console.warn('Font file could not be downloaded. Try using a different browser.'); - } -}; -/** - * @private - */ -Font.prototype.fsSelectionValues = { - ITALIC: 0x001, //1 - UNDERSCORE: 0x002, //2 - NEGATIVE: 0x004, //4 - OUTLINED: 0x008, //8 - STRIKEOUT: 0x010, //16 - BOLD: 0x020, //32 - REGULAR: 0x040, //64 - USER_TYPO_METRICS: 0x080, //128 - WWS: 0x100, //256 - OBLIQUE: 0x200 //512 -}; - -/** - * @private - */ -Font.prototype.usWidthClasses = { - ULTRA_CONDENSED: 1, - EXTRA_CONDENSED: 2, - CONDENSED: 3, - SEMI_CONDENSED: 4, - MEDIUM: 5, - SEMI_EXPANDED: 6, - EXPANDED: 7, - EXTRA_EXPANDED: 8, - ULTRA_EXPANDED: 9 -}; - -/** - * @private - */ -Font.prototype.usWeightClasses = { - THIN: 100, - EXTRA_LIGHT: 200, - LIGHT: 300, - NORMAL: 400, - MEDIUM: 500, - SEMI_BOLD: 600, - BOLD: 700, - EXTRA_BOLD: 800, - BLACK: 900 -}; - -// The `fvar` table stores font variation axes and instances. - -function addName(name, names) { - var nameString = JSON.stringify(name); - var nameID = 256; - for (var nameKey in names) { - var n = parseInt(nameKey); - if (!n || n < 256) { - continue; - } - - if (JSON.stringify(names[nameKey]) === nameString) { - return n; - } - - if (nameID <= n) { - nameID = n + 1; - } - } - - names[nameID] = name; - return nameID; -} - -function makeFvarAxis(n, axis, names) { - var nameID = addName(axis.name, names); - return [ - {name: 'tag_' + n, type: 'TAG', value: axis.tag}, - {name: 'minValue_' + n, type: 'FIXED', value: axis.minValue << 16}, - {name: 'defaultValue_' + n, type: 'FIXED', value: axis.defaultValue << 16}, - {name: 'maxValue_' + n, type: 'FIXED', value: axis.maxValue << 16}, - {name: 'flags_' + n, type: 'USHORT', value: 0}, - {name: 'nameID_' + n, type: 'USHORT', value: nameID} - ]; -} - -function parseFvarAxis(data, start, names) { - var axis = {}; - var p = new parse.Parser(data, start); - axis.tag = p.parseTag(); - axis.minValue = p.parseFixed(); - axis.defaultValue = p.parseFixed(); - axis.maxValue = p.parseFixed(); - p.skip('uShort', 1); // reserved for flags; no values defined - axis.name = names[p.parseUShort()] || {}; - return axis; -} - -function makeFvarInstance(n, inst, axes, names) { - var nameID = addName(inst.name, names); - var fields = [ - {name: 'nameID_' + n, type: 'USHORT', value: nameID}, - {name: 'flags_' + n, type: 'USHORT', value: 0} - ]; - - for (var i = 0; i < axes.length; ++i) { - var axisTag = axes[i].tag; - fields.push({ - name: 'axis_' + n + ' ' + axisTag, - type: 'FIXED', - value: inst.coordinates[axisTag] << 16 - }); - } - - return fields; -} - -function parseFvarInstance(data, start, axes, names) { - var inst = {}; - var p = new parse.Parser(data, start); - inst.name = names[p.parseUShort()] || {}; - p.skip('uShort', 1); // reserved for flags; no values defined - - inst.coordinates = {}; - for (var i = 0; i < axes.length; ++i) { - inst.coordinates[axes[i].tag] = p.parseFixed(); - } - - return inst; -} - -function makeFvarTable(fvar, names) { - var result = new table.Table('fvar', [ - {name: 'version', type: 'ULONG', value: 0x10000}, - {name: 'offsetToData', type: 'USHORT', value: 0}, - {name: 'countSizePairs', type: 'USHORT', value: 2}, - {name: 'axisCount', type: 'USHORT', value: fvar.axes.length}, - {name: 'axisSize', type: 'USHORT', value: 20}, - {name: 'instanceCount', type: 'USHORT', value: fvar.instances.length}, - {name: 'instanceSize', type: 'USHORT', value: 4 + fvar.axes.length * 4} - ]); - result.offsetToData = result.sizeOf(); - - for (var i = 0; i < fvar.axes.length; i++) { - result.fields = result.fields.concat(makeFvarAxis(i, fvar.axes[i], names)); - } - - for (var j = 0; j < fvar.instances.length; j++) { - result.fields = result.fields.concat(makeFvarInstance(j, fvar.instances[j], fvar.axes, names)); - } - - return result; -} - -function parseFvarTable(data, start, names) { - var p = new parse.Parser(data, start); - var tableVersion = p.parseULong(); - check.argument(tableVersion === 0x00010000, 'Unsupported fvar table version.'); - var offsetToData = p.parseOffset16(); - // Skip countSizePairs. - p.skip('uShort', 1); - var axisCount = p.parseUShort(); - var axisSize = p.parseUShort(); - var instanceCount = p.parseUShort(); - var instanceSize = p.parseUShort(); - - var axes = []; - for (var i = 0; i < axisCount; i++) { - axes.push(parseFvarAxis(data, start + offsetToData + i * axisSize, names)); - } - - var instances = []; - var instanceStart = start + offsetToData + axisCount * axisSize; - for (var j = 0; j < instanceCount; j++) { - instances.push(parseFvarInstance(data, instanceStart + j * instanceSize, axes, names)); - } - - return {axes: axes, instances: instances}; -} - -var fvar = { make: makeFvarTable, parse: parseFvarTable }; - -// The `GDEF` table contains various glyph properties - -var attachList = function() { - return { - coverage: this.parsePointer(Parser.coverage), - attachPoints: this.parseList(Parser.pointer(Parser.uShortList)) - }; -}; - -var caretValue = function() { - var format = this.parseUShort(); - check.argument(format === 1 || format === 2 || format === 3, - 'Unsupported CaretValue table version.'); - if (format === 1) { - return { coordinate: this.parseShort() }; - } else if (format === 2) { - return { pointindex: this.parseShort() }; - } else if (format === 3) { - // Device / Variation Index tables unsupported - return { coordinate: this.parseShort() }; - } -}; - -var ligGlyph = function() { - return this.parseList(Parser.pointer(caretValue)); -}; - -var ligCaretList = function() { - return { - coverage: this.parsePointer(Parser.coverage), - ligGlyphs: this.parseList(Parser.pointer(ligGlyph)) - }; -}; - -var markGlyphSets = function() { - this.parseUShort(); // Version - return this.parseList(Parser.pointer(Parser.coverage)); -}; - -function parseGDEFTable(data, start) { - start = start || 0; - var p = new Parser(data, start); - var tableVersion = p.parseVersion(1); - check.argument(tableVersion === 1 || tableVersion === 1.2 || tableVersion === 1.3, - 'Unsupported GDEF table version.'); - var gdef = { - version: tableVersion, - classDef: p.parsePointer(Parser.classDef), - attachList: p.parsePointer(attachList), - ligCaretList: p.parsePointer(ligCaretList), - markAttachClassDef: p.parsePointer(Parser.classDef) - }; - if (tableVersion >= 1.2) { - gdef.markGlyphSets = p.parsePointer(markGlyphSets); - } - return gdef; -} -var gdef = { parse: parseGDEFTable }; - -// The `GPOS` table contains kerning pairs, among other things. - -var subtableParsers$1 = new Array(10); // subtableParsers[0] is unused - -// https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-1-single-adjustment-positioning-subtable -// this = Parser instance -subtableParsers$1[1] = function parseLookup1() { - var start = this.offset + this.relativeOffset; - var posformat = this.parseUShort(); - if (posformat === 1) { - return { - posFormat: 1, - coverage: this.parsePointer(Parser.coverage), - value: this.parseValueRecord() - }; - } else if (posformat === 2) { - return { - posFormat: 2, - coverage: this.parsePointer(Parser.coverage), - values: this.parseValueRecordList() - }; - } - check.assert(false, '0x' + start.toString(16) + ': GPOS lookup type 1 format must be 1 or 2.'); -}; - -// https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#lookup-type-2-pair-adjustment-positioning-subtable -subtableParsers$1[2] = function parseLookup2() { - var start = this.offset + this.relativeOffset; - var posFormat = this.parseUShort(); - check.assert(posFormat === 1 || posFormat === 2, '0x' + start.toString(16) + ': GPOS lookup type 2 format must be 1 or 2.'); - var coverage = this.parsePointer(Parser.coverage); - var valueFormat1 = this.parseUShort(); - var valueFormat2 = this.parseUShort(); - if (posFormat === 1) { - // Adjustments for Glyph Pairs - return { - posFormat: posFormat, - coverage: coverage, - valueFormat1: valueFormat1, - valueFormat2: valueFormat2, - pairSets: this.parseList(Parser.pointer(Parser.list(function() { - return { // pairValueRecord - secondGlyph: this.parseUShort(), - value1: this.parseValueRecord(valueFormat1), - value2: this.parseValueRecord(valueFormat2) - }; - }))) - }; - } else if (posFormat === 2) { - var classDef1 = this.parsePointer(Parser.classDef); - var classDef2 = this.parsePointer(Parser.classDef); - var class1Count = this.parseUShort(); - var class2Count = this.parseUShort(); - return { - // Class Pair Adjustment - posFormat: posFormat, - coverage: coverage, - valueFormat1: valueFormat1, - valueFormat2: valueFormat2, - classDef1: classDef1, - classDef2: classDef2, - class1Count: class1Count, - class2Count: class2Count, - classRecords: this.parseList(class1Count, Parser.list(class2Count, function() { - return { - value1: this.parseValueRecord(valueFormat1), - value2: this.parseValueRecord(valueFormat2) - }; - })) - }; - } -}; - -subtableParsers$1[3] = function parseLookup3() { return { error: 'GPOS Lookup 3 not supported' }; }; -subtableParsers$1[4] = function parseLookup4() { return { error: 'GPOS Lookup 4 not supported' }; }; -subtableParsers$1[5] = function parseLookup5() { return { error: 'GPOS Lookup 5 not supported' }; }; -subtableParsers$1[6] = function parseLookup6() { return { error: 'GPOS Lookup 6 not supported' }; }; -subtableParsers$1[7] = function parseLookup7() { return { error: 'GPOS Lookup 7 not supported' }; }; -subtableParsers$1[8] = function parseLookup8() { return { error: 'GPOS Lookup 8 not supported' }; }; -subtableParsers$1[9] = function parseLookup9() { return { error: 'GPOS Lookup 9 not supported' }; }; - -// https://docs.microsoft.com/en-us/typography/opentype/spec/gpos -function parseGposTable(data, start) { - start = start || 0; - var p = new Parser(data, start); - var tableVersion = p.parseVersion(1); - check.argument(tableVersion === 1 || tableVersion === 1.1, 'Unsupported GPOS table version ' + tableVersion); - - if (tableVersion === 1) { - return { - version: tableVersion, - scripts: p.parseScriptList(), - features: p.parseFeatureList(), - lookups: p.parseLookupList(subtableParsers$1) - }; - } else { - return { - version: tableVersion, - scripts: p.parseScriptList(), - features: p.parseFeatureList(), - lookups: p.parseLookupList(subtableParsers$1), - variations: p.parseFeatureVariationsList() - }; - } - -} - -// GPOS Writing ////////////////////////////////////////////// -// NOT SUPPORTED -var subtableMakers$1 = new Array(10); - -function makeGposTable(gpos) { - return new table.Table('GPOS', [ - {name: 'version', type: 'ULONG', value: 0x10000}, - {name: 'scripts', type: 'TABLE', value: new table.ScriptList(gpos.scripts)}, - {name: 'features', type: 'TABLE', value: new table.FeatureList(gpos.features)}, - {name: 'lookups', type: 'TABLE', value: new table.LookupList(gpos.lookups, subtableMakers$1)} - ]); -} - -var gpos = { parse: parseGposTable, make: makeGposTable }; - -// The `kern` table contains kerning pairs. - -function parseWindowsKernTable(p) { - var pairs = {}; - // Skip nTables. - p.skip('uShort'); - var subtableVersion = p.parseUShort(); - check.argument(subtableVersion === 0, 'Unsupported kern sub-table version.'); - // Skip subtableLength, subtableCoverage - p.skip('uShort', 2); - var nPairs = p.parseUShort(); - // Skip searchRange, entrySelector, rangeShift. - p.skip('uShort', 3); - for (var i = 0; i < nPairs; i += 1) { - var leftIndex = p.parseUShort(); - var rightIndex = p.parseUShort(); - var value = p.parseShort(); - pairs[leftIndex + ',' + rightIndex] = value; - } - return pairs; -} - -function parseMacKernTable(p) { - var pairs = {}; - // The Mac kern table stores the version as a fixed (32 bits) but we only loaded the first 16 bits. - // Skip the rest. - p.skip('uShort'); - var nTables = p.parseULong(); - //check.argument(nTables === 1, 'Only 1 subtable is supported (got ' + nTables + ').'); - if (nTables > 1) { - console.warn('Only the first kern subtable is supported.'); - } - p.skip('uLong'); - var coverage = p.parseUShort(); - var subtableVersion = coverage & 0xFF; - p.skip('uShort'); - if (subtableVersion === 0) { - var nPairs = p.parseUShort(); - // Skip searchRange, entrySelector, rangeShift. - p.skip('uShort', 3); - for (var i = 0; i < nPairs; i += 1) { - var leftIndex = p.parseUShort(); - var rightIndex = p.parseUShort(); - var value = p.parseShort(); - pairs[leftIndex + ',' + rightIndex] = value; - } - } - return pairs; -} - -// Parse the `kern` table which contains kerning pairs. -function parseKernTable(data, start) { - var p = new parse.Parser(data, start); - var tableVersion = p.parseUShort(); - if (tableVersion === 0) { - return parseWindowsKernTable(p); - } else if (tableVersion === 1) { - return parseMacKernTable(p); - } else { - throw new Error('Unsupported kern table version (' + tableVersion + ').'); - } -} - -var kern = { parse: parseKernTable }; - -// The `loca` table stores the offsets to the locations of the glyphs in the font. - -// Parse the `loca` table. This table stores the offsets to the locations of the glyphs in the font, -// relative to the beginning of the glyphData table. -// The number of glyphs stored in the `loca` table is specified in the `maxp` table (under numGlyphs) -// The loca table has two versions: a short version where offsets are stored as uShorts, and a long -// version where offsets are stored as uLongs. The `head` table specifies which version to use -// (under indexToLocFormat). -function parseLocaTable(data, start, numGlyphs, shortVersion) { - var p = new parse.Parser(data, start); - var parseFn = shortVersion ? p.parseUShort : p.parseULong; - // There is an extra entry after the last index element to compute the length of the last glyph. - // That's why we use numGlyphs + 1. - var glyphOffsets = []; - for (var i = 0; i < numGlyphs + 1; i += 1) { - var glyphOffset = parseFn.call(p); - if (shortVersion) { - // The short table version stores the actual offset divided by 2. - glyphOffset *= 2; - } - - glyphOffsets.push(glyphOffset); - } - - return glyphOffsets; -} - -var loca = { parse: parseLocaTable }; - -// opentype.js - -/** - * The opentype library. - * @namespace opentype - */ - -// File loaders ///////////////////////////////////////////////////////// - -/** - * Loads a font from a URL. The callback throws an error message as the first parameter if it fails - * and the font as an ArrayBuffer in the second parameter if it succeeds. - * @param {string} url - The URL of the font file. - * @param {Function} callback - The function to call when the font load completes - */ -function loadFromUrl(url, callback) { - var request = new XMLHttpRequest(); - request.open('get', url, true); - request.responseType = 'arraybuffer'; - request.onload = function() { - if (request.response) { - return callback(null, request.response); - } else { - return callback('Font could not be loaded: ' + request.statusText); - } - }; - - request.onerror = function () { - callback('Font could not be loaded'); - }; - - request.send(); -} - -// Table Directory Entries ////////////////////////////////////////////// -/** - * Parses OpenType table entries. - * @param {DataView} - * @param {Number} - * @return {Object[]} - */ -function parseOpenTypeTableEntries(data, numTables) { - var tableEntries = []; - var p = 12; - for (var i = 0; i < numTables; i += 1) { - var tag = parse.getTag(data, p); - var checksum = parse.getULong(data, p + 4); - var offset = parse.getULong(data, p + 8); - var length = parse.getULong(data, p + 12); - tableEntries.push({tag: tag, checksum: checksum, offset: offset, length: length, compression: false}); - p += 16; - } - - return tableEntries; -} - -/** - * Parses WOFF table entries. - * @param {DataView} - * @param {Number} - * @return {Object[]} - */ -function parseWOFFTableEntries(data, numTables) { - var tableEntries = []; - var p = 44; // offset to the first table directory entry. - for (var i = 0; i < numTables; i += 1) { - var tag = parse.getTag(data, p); - var offset = parse.getULong(data, p + 4); - var compLength = parse.getULong(data, p + 8); - var origLength = parse.getULong(data, p + 12); - var compression = (void 0); - if (compLength < origLength) { - compression = 'WOFF'; - } else { - compression = false; - } - - tableEntries.push({tag: tag, offset: offset, compression: compression, - compressedLength: compLength, length: origLength}); - p += 20; - } - - return tableEntries; -} - -/** - * @typedef TableData - * @type Object - * @property {DataView} data - The DataView - * @property {number} offset - The data offset. - */ - -/** - * @param {DataView} - * @param {Object} - * @return {TableData} - */ -function uncompressTable(data, tableEntry) { - if (tableEntry.compression === 'WOFF') { - var inBuffer = new Uint8Array(data.buffer, tableEntry.offset + 2, tableEntry.compressedLength - 2); - var outBuffer = new Uint8Array(tableEntry.length); - tinyInflate(inBuffer, outBuffer); - if (outBuffer.byteLength !== tableEntry.length) { - throw new Error('Decompression error: ' + tableEntry.tag + ' decompressed length doesn\'t match recorded length'); - } - - var view = new DataView(outBuffer.buffer, 0); - return {data: view, offset: 0}; - } else { - return {data: data, offset: tableEntry.offset}; - } -} - -// Public API /////////////////////////////////////////////////////////// - -/** - * Parse the OpenType file data (as an ArrayBuffer) and return a Font object. - * Throws an error if the font could not be parsed. - * @param {ArrayBuffer} - * @param {Object} opt - options for parsing - * @return {opentype.Font} - */ -function parseBuffer(buffer, opt) { - opt = (opt === undefined || opt === null) ? {} : opt; - - var indexToLocFormat; - var ltagTable; - - // Since the constructor can also be called to create new fonts from scratch, we indicate this - // should be an empty font that we'll fill with our own data. - var font = new Font({empty: true}); - - // OpenType fonts use big endian byte ordering. - // We can't rely on typed array view types, because they operate with the endianness of the host computer. - // Instead we use DataViews where we can specify endianness. - var data = new DataView(buffer, 0); - var numTables; - var tableEntries = []; - var signature = parse.getTag(data, 0); - if (signature === String.fromCharCode(0, 1, 0, 0) || signature === 'true' || signature === 'typ1') { - font.outlinesFormat = 'truetype'; - numTables = parse.getUShort(data, 4); - tableEntries = parseOpenTypeTableEntries(data, numTables); - } else if (signature === 'OTTO') { - font.outlinesFormat = 'cff'; - numTables = parse.getUShort(data, 4); - tableEntries = parseOpenTypeTableEntries(data, numTables); - } else if (signature === 'wOFF') { - var flavor = parse.getTag(data, 4); - if (flavor === String.fromCharCode(0, 1, 0, 0)) { - font.outlinesFormat = 'truetype'; - } else if (flavor === 'OTTO') { - font.outlinesFormat = 'cff'; - } else { - throw new Error('Unsupported OpenType flavor ' + signature); - } - - numTables = parse.getUShort(data, 12); - tableEntries = parseWOFFTableEntries(data, numTables); - } else { - throw new Error('Unsupported OpenType signature ' + signature); - } - - var cffTableEntry; - var fvarTableEntry; - var glyfTableEntry; - var gdefTableEntry; - var gposTableEntry; - var gsubTableEntry; - var hmtxTableEntry; - var kernTableEntry; - var locaTableEntry; - var nameTableEntry; - var metaTableEntry; - var p; - - for (var i = 0; i < numTables; i += 1) { - var tableEntry = tableEntries[i]; - var table = (void 0); - switch (tableEntry.tag) { - case 'cmap': - table = uncompressTable(data, tableEntry); - font.tables.cmap = cmap.parse(table.data, table.offset); - font.encoding = new CmapEncoding(font.tables.cmap); - break; - case 'cvt ' : - table = uncompressTable(data, tableEntry); - p = new parse.Parser(table.data, table.offset); - font.tables.cvt = p.parseShortList(tableEntry.length / 2); - break; - case 'fvar': - fvarTableEntry = tableEntry; - break; - case 'fpgm' : - table = uncompressTable(data, tableEntry); - p = new parse.Parser(table.data, table.offset); - font.tables.fpgm = p.parseByteList(tableEntry.length); - break; - case 'head': - table = uncompressTable(data, tableEntry); - font.tables.head = head.parse(table.data, table.offset); - font.unitsPerEm = font.tables.head.unitsPerEm; - indexToLocFormat = font.tables.head.indexToLocFormat; - break; - case 'hhea': - table = uncompressTable(data, tableEntry); - font.tables.hhea = hhea.parse(table.data, table.offset); - font.ascender = font.tables.hhea.ascender; - font.descender = font.tables.hhea.descender; - font.numberOfHMetrics = font.tables.hhea.numberOfHMetrics; - break; - case 'hmtx': - hmtxTableEntry = tableEntry; - break; - case 'ltag': - table = uncompressTable(data, tableEntry); - ltagTable = ltag.parse(table.data, table.offset); - break; - case 'COLR': - table = uncompressTable(data, tableEntry); - font.tables.colr = colr.parse(table.data, table.offset); - break; - case 'CPAL': - table = uncompressTable(data, tableEntry); - font.tables.cpal = cpal.parse(table.data, table.offset); - break; - case 'maxp': - table = uncompressTable(data, tableEntry); - font.tables.maxp = maxp.parse(table.data, table.offset); - font.numGlyphs = font.tables.maxp.numGlyphs; - break; - case 'name': - nameTableEntry = tableEntry; - break; - case 'OS/2': - table = uncompressTable(data, tableEntry); - font.tables.os2 = os2.parse(table.data, table.offset); - break; - case 'post': - table = uncompressTable(data, tableEntry); - font.tables.post = post.parse(table.data, table.offset); - font.glyphNames = new GlyphNames(font.tables.post); - break; - case 'prep' : - table = uncompressTable(data, tableEntry); - p = new parse.Parser(table.data, table.offset); - font.tables.prep = p.parseByteList(tableEntry.length); - break; - case 'glyf': - glyfTableEntry = tableEntry; - break; - case 'loca': - locaTableEntry = tableEntry; - break; - case 'CFF ': - cffTableEntry = tableEntry; - break; - case 'kern': - kernTableEntry = tableEntry; - break; - case 'GDEF': - gdefTableEntry = tableEntry; - break; - case 'GPOS': - gposTableEntry = tableEntry; - break; - case 'GSUB': - gsubTableEntry = tableEntry; - break; - case 'meta': - metaTableEntry = tableEntry; - break; - } - } - - var nameTable = uncompressTable(data, nameTableEntry); - font.tables.name = _name.parse(nameTable.data, nameTable.offset, ltagTable); - font.names = font.tables.name; - - if (glyfTableEntry && locaTableEntry) { - var shortVersion = indexToLocFormat === 0; - var locaTable = uncompressTable(data, locaTableEntry); - var locaOffsets = loca.parse(locaTable.data, locaTable.offset, font.numGlyphs, shortVersion); - var glyfTable = uncompressTable(data, glyfTableEntry); - font.glyphs = glyf.parse(glyfTable.data, glyfTable.offset, locaOffsets, font, opt); - } else if (cffTableEntry) { - var cffTable = uncompressTable(data, cffTableEntry); - cff.parse(cffTable.data, cffTable.offset, font, opt); - } else { - throw new Error('Font doesn\'t contain TrueType or CFF outlines.'); - } - - var hmtxTable = uncompressTable(data, hmtxTableEntry); - hmtx.parse(font, hmtxTable.data, hmtxTable.offset, font.numberOfHMetrics, font.numGlyphs, font.glyphs, opt); - addGlyphNames(font, opt); - - if (kernTableEntry) { - var kernTable = uncompressTable(data, kernTableEntry); - font.kerningPairs = kern.parse(kernTable.data, kernTable.offset); - } else { - font.kerningPairs = {}; - } - - if (gdefTableEntry) { - var gdefTable = uncompressTable(data, gdefTableEntry); - font.tables.gdef = gdef.parse(gdefTable.data, gdefTable.offset); - } - - if (gposTableEntry) { - var gposTable = uncompressTable(data, gposTableEntry); - font.tables.gpos = gpos.parse(gposTable.data, gposTable.offset); - font.position.init(); - } - - if (gsubTableEntry) { - var gsubTable = uncompressTable(data, gsubTableEntry); - font.tables.gsub = gsub.parse(gsubTable.data, gsubTable.offset); - } - - if (fvarTableEntry) { - var fvarTable = uncompressTable(data, fvarTableEntry); - font.tables.fvar = fvar.parse(fvarTable.data, fvarTable.offset, font.names); - } - - if (metaTableEntry) { - var metaTable = uncompressTable(data, metaTableEntry); - font.tables.meta = meta.parse(metaTable.data, metaTable.offset); - font.metas = font.tables.meta; - } - - return font; -} - -/** - * Asynchronously load the font from a URL or a filesystem. When done, call the callback - * with two arguments `(err, font)`. The `err` will be null on success, - * the `font` is a Font object. - * We use the node.js callback convention so that - * opentype.js can integrate with frameworks like async.js. - * @alias opentype.load - * @param {string} url - The URL of the font to load. - * @param {Function} callback - The callback. - */ -function load(url, callback, opt) { - opt = (opt === undefined || opt === null) ? {} : opt; - - return new Promise(function (resolve, reject) { - loadFromUrl(url, function(err, arrayBuffer) { - if (err) { - if (callback) { - return callback(err); - } else { - reject(err); - } - } - var font; - try { - font = parseBuffer(arrayBuffer, opt); - } catch (e) { - if (callback) { - return callback(e, null); - } else { - reject(e); - } - } - if (callback) { - return callback(null, font); - } else { - resolve(font); - } - }); - }); -} - -var opentype = /*#__PURE__*/Object.freeze({ - __proto__: null, - Font: Font, - Glyph: Glyph, - Path: Path, - BoundingBox: BoundingBox, - _parse: parse, - parse: parseBuffer, - load: load, -}); - -export default opentype; -export { BoundingBox, Font, Glyph, Path, parse as _parse, load, parseBuffer as parse }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/AmmoPhysics.js b/docker-compose/requirements/nginx/static/javascript/taaaa/physics/AmmoPhysics.js deleted file mode 100644 index 3874206..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/AmmoPhysics.js +++ /dev/null @@ -1,306 +0,0 @@ -async function AmmoPhysics() { - - if ( 'Ammo' in window === false ) { - - console.error( 'AmmoPhysics: Couldn\'t find Ammo.js' ); - return; - - } - - const AmmoLib = await Ammo(); // eslint-disable-line no-undef - - const frameRate = 60; - - const collisionConfiguration = new AmmoLib.btDefaultCollisionConfiguration(); - const dispatcher = new AmmoLib.btCollisionDispatcher( collisionConfiguration ); - const broadphase = new AmmoLib.btDbvtBroadphase(); - const solver = new AmmoLib.btSequentialImpulseConstraintSolver(); - const world = new AmmoLib.btDiscreteDynamicsWorld( dispatcher, broadphase, solver, collisionConfiguration ); - world.setGravity( new AmmoLib.btVector3( 0, - 9.8, 0 ) ); - - const worldTransform = new AmmoLib.btTransform(); - - // - - function getShape( geometry ) { - - const parameters = geometry.parameters; - - // TODO change type to is* - - if ( geometry.type === 'BoxGeometry' ) { - - const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5; - const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5; - const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5; - - const shape = new AmmoLib.btBoxShape( new AmmoLib.btVector3( sx, sy, sz ) ); - shape.setMargin( 0.05 ); - - return shape; - - } else if ( geometry.type === 'SphereGeometry' || geometry.type === 'IcosahedronGeometry' ) { - - const radius = parameters.radius !== undefined ? parameters.radius : 1; - - const shape = new AmmoLib.btSphereShape( radius ); - shape.setMargin( 0.05 ); - - return shape; - - } - - return null; - - } - - const meshes = []; - const meshMap = new WeakMap(); - - function addScene( scene ) { - - scene.traverse( function ( child ) { - - if ( child.isMesh ) { - - const physics = child.userData.physics; - - if ( physics ) { - - addMesh( child, physics.mass ); - - } - - } - - } ); - - } - - function addMesh( mesh, mass = 0 ) { - - const shape = getShape( mesh.geometry ); - - if ( shape !== null ) { - - if ( mesh.isInstancedMesh ) { - - handleInstancedMesh( mesh, mass, shape ); - - } else if ( mesh.isMesh ) { - - handleMesh( mesh, mass, shape ); - - } - - } - - } - - function handleMesh( mesh, mass, shape ) { - - const position = mesh.position; - const quaternion = mesh.quaternion; - - const transform = new AmmoLib.btTransform(); - transform.setIdentity(); - transform.setOrigin( new AmmoLib.btVector3( position.x, position.y, position.z ) ); - transform.setRotation( new AmmoLib.btQuaternion( quaternion.x, quaternion.y, quaternion.z, quaternion.w ) ); - - const motionState = new AmmoLib.btDefaultMotionState( transform ); - - const localInertia = new AmmoLib.btVector3( 0, 0, 0 ); - shape.calculateLocalInertia( mass, localInertia ); - - const rbInfo = new AmmoLib.btRigidBodyConstructionInfo( mass, motionState, shape, localInertia ); - - const body = new AmmoLib.btRigidBody( rbInfo ); - // body.setFriction( 4 ); - world.addRigidBody( body ); - - if ( mass > 0 ) { - - meshes.push( mesh ); - meshMap.set( mesh, body ); - - } - - - } - - function handleInstancedMesh( mesh, mass, shape ) { - - const array = mesh.instanceMatrix.array; - - const bodies = []; - - for ( let i = 0; i < mesh.count; i ++ ) { - - const index = i * 16; - - const transform = new AmmoLib.btTransform(); - transform.setFromOpenGLMatrix( array.slice( index, index + 16 ) ); - - const motionState = new AmmoLib.btDefaultMotionState( transform ); - - const localInertia = new AmmoLib.btVector3( 0, 0, 0 ); - shape.calculateLocalInertia( mass, localInertia ); - - const rbInfo = new AmmoLib.btRigidBodyConstructionInfo( mass, motionState, shape, localInertia ); - - const body = new AmmoLib.btRigidBody( rbInfo ); - world.addRigidBody( body ); - - bodies.push( body ); - - } - - if ( mass > 0 ) { - - meshes.push( mesh ); - - meshMap.set( mesh, bodies ); - - } - - } - - // - - function setMeshPosition( mesh, position, index = 0 ) { - - if ( mesh.isInstancedMesh ) { - - const bodies = meshMap.get( mesh ); - const body = bodies[ index ]; - - body.setAngularVelocity( new AmmoLib.btVector3( 0, 0, 0 ) ); - body.setLinearVelocity( new AmmoLib.btVector3( 0, 0, 0 ) ); - - worldTransform.setIdentity(); - worldTransform.setOrigin( new AmmoLib.btVector3( position.x, position.y, position.z ) ); - body.setWorldTransform( worldTransform ); - - } else if ( mesh.isMesh ) { - - const body = meshMap.get( mesh ); - - body.setAngularVelocity( new AmmoLib.btVector3( 0, 0, 0 ) ); - body.setLinearVelocity( new AmmoLib.btVector3( 0, 0, 0 ) ); - - worldTransform.setIdentity(); - worldTransform.setOrigin( new AmmoLib.btVector3( position.x, position.y, position.z ) ); - body.setWorldTransform( worldTransform ); - - } - - } - - // - - let lastTime = 0; - - function step() { - - const time = performance.now(); - - if ( lastTime > 0 ) { - - const delta = ( time - lastTime ) / 1000; - - world.stepSimulation( delta, 10 ); - - // - - for ( let i = 0, l = meshes.length; i < l; i ++ ) { - - const mesh = meshes[ i ]; - - if ( mesh.isInstancedMesh ) { - - const array = mesh.instanceMatrix.array; - const bodies = meshMap.get( mesh ); - - for ( let j = 0; j < bodies.length; j ++ ) { - - const body = bodies[ j ]; - - const motionState = body.getMotionState(); - motionState.getWorldTransform( worldTransform ); - - const position = worldTransform.getOrigin(); - const quaternion = worldTransform.getRotation(); - - compose( position, quaternion, array, j * 16 ); - - } - - mesh.instanceMatrix.needsUpdate = true; - mesh.computeBoundingSphere(); - - } else if ( mesh.isMesh ) { - - const body = meshMap.get( mesh ); - - const motionState = body.getMotionState(); - motionState.getWorldTransform( worldTransform ); - - const position = worldTransform.getOrigin(); - const quaternion = worldTransform.getRotation(); - mesh.position.set( position.x(), position.y(), position.z() ); - mesh.quaternion.set( quaternion.x(), quaternion.y(), quaternion.z(), quaternion.w() ); - - } - - } - - } - - lastTime = time; - - } - - // animate - - setInterval( step, 1000 / frameRate ); - - return { - addScene: addScene, - addMesh: addMesh, - setMeshPosition: setMeshPosition - // addCompoundMesh - }; - -} - -function compose( position, quaternion, array, index ) { - - 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; - - array[ index + 0 ] = ( 1 - ( yy + zz ) ); - array[ index + 1 ] = ( xy + wz ); - array[ index + 2 ] = ( xz - wy ); - array[ index + 3 ] = 0; - - array[ index + 4 ] = ( xy - wz ); - array[ index + 5 ] = ( 1 - ( xx + zz ) ); - array[ index + 6 ] = ( yz + wx ); - array[ index + 7 ] = 0; - - array[ index + 8 ] = ( xz + wy ); - array[ index + 9 ] = ( yz - wx ); - array[ index + 10 ] = ( 1 - ( xx + yy ) ); - array[ index + 11 ] = 0; - - array[ index + 12 ] = position.x(); - array[ index + 13 ] = position.y(); - array[ index + 14 ] = position.z(); - array[ index + 15 ] = 1; - -} - -export { AmmoPhysics }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/JoltPhysics.js b/docker-compose/requirements/nginx/static/javascript/taaaa/physics/JoltPhysics.js deleted file mode 100644 index 255c85d..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/JoltPhysics.js +++ /dev/null @@ -1,281 +0,0 @@ -import { Clock, Vector3, Quaternion, Matrix4 } from '/static/javascript/three/build/three.module.js'; - -const JOLT_PATH = 'https://cdn.jsdelivr.net/npm/jolt-physics@0.23.0/dist/jolt-physics.wasm-compat.js'; - -const frameRate = 60; - -let Jolt = null; - -function getShape( geometry ) { - - const parameters = geometry.parameters; - - // TODO change type to is* - - if ( geometry.type === 'BoxGeometry' ) { - - const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5; - const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5; - const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5; - - return new Jolt.BoxShape( new Jolt.Vec3( sx, sy, sz ), 0.05 * Math.min( sx, sy, sz ), null ); - - } else if ( geometry.type === 'SphereGeometry' || geometry.type === 'IcosahedronGeometry' ) { - - const radius = parameters.radius !== undefined ? parameters.radius : 1; - - return new Jolt.SphereShape( radius, null ); - - } - - return null; - -} - -// Object layers -const LAYER_NON_MOVING = 0; -const LAYER_MOVING = 1; -const NUM_OBJECT_LAYERS = 2; - -function setupCollisionFiltering( settings ) { - - let objectFilter = new Jolt.ObjectLayerPairFilterTable( NUM_OBJECT_LAYERS ); - objectFilter.EnableCollision( LAYER_NON_MOVING, LAYER_MOVING ); - objectFilter.EnableCollision( LAYER_MOVING, LAYER_MOVING ); - - const BP_LAYER_NON_MOVING = new Jolt.BroadPhaseLayer( 0 ); - const BP_LAYER_MOVING = new Jolt.BroadPhaseLayer( 1 ); - const NUM_BROAD_PHASE_LAYERS = 2; - - let bpInterface = new Jolt.BroadPhaseLayerInterfaceTable( NUM_OBJECT_LAYERS, NUM_BROAD_PHASE_LAYERS ); - bpInterface.MapObjectToBroadPhaseLayer( LAYER_NON_MOVING, BP_LAYER_NON_MOVING ); - bpInterface.MapObjectToBroadPhaseLayer( LAYER_MOVING, BP_LAYER_MOVING ); - - settings.mObjectLayerPairFilter = objectFilter; - settings.mBroadPhaseLayerInterface = bpInterface; - settings.mObjectVsBroadPhaseLayerFilter = new Jolt.ObjectVsBroadPhaseLayerFilterTable( settings.mBroadPhaseLayerInterface, NUM_BROAD_PHASE_LAYERS, settings.mObjectLayerPairFilter, NUM_OBJECT_LAYERS ); - -}; - -async function JoltPhysics() { - - if ( Jolt === null ) { - - const { default: initJolt } = await import( JOLT_PATH ); - Jolt = await initJolt(); - - } - - const settings = new Jolt.JoltSettings(); - setupCollisionFiltering( settings ); - - const jolt = new Jolt.JoltInterface( settings ); - Jolt.destroy( settings ); - - const physicsSystem = jolt.GetPhysicsSystem(); - const bodyInterface = physicsSystem.GetBodyInterface(); - - const meshes = []; - const meshMap = new WeakMap(); - - const _position = new Vector3(); - const _quaternion = new Quaternion(); - const _scale = new Vector3( 1, 1, 1 ); - - const _matrix = new Matrix4(); - - function addScene( scene ) { - - scene.traverse( function ( child ) { - - if ( child.isMesh ) { - - const physics = child.userData.physics; - - if ( physics ) { - - addMesh( child, physics.mass, physics.restitution ); - - } - - } - - } ); - - } - - function addMesh( mesh, mass = 0, restitution = 0 ) { - - const shape = getShape( mesh.geometry ); - - if ( shape === null ) return; - - const body = mesh.isInstancedMesh - ? createInstancedBody( mesh, mass, restitution, shape ) - : createBody( mesh.position, mesh.quaternion, mass, restitution, shape ); - - if ( mass > 0 ) { - - meshes.push( mesh ); - meshMap.set( mesh, body ); - - } - - } - - function createInstancedBody( mesh, mass, restitution, shape ) { - - const array = mesh.instanceMatrix.array; - - const bodies = []; - - for ( let i = 0; i < mesh.count; i ++ ) { - - const position = _position.fromArray( array, i * 16 + 12 ); - const quaternion = _quaternion.setFromRotationMatrix( _matrix.fromArray( array, i * 16 ) ); // TODO Copilot did this - bodies.push( createBody( position, quaternion, mass, restitution, shape ) ); - - } - - return bodies; - - } - - function createBody( position, rotation, mass, restitution, shape ) { - - const pos = new Jolt.Vec3( position.x, position.y, position.z ); - const rot = new Jolt.Quat( rotation.x, rotation.y, rotation.z, rotation.w ); - - const motion = mass > 0 ? Jolt.EMotionType_Dynamic : Jolt.EMotionType_Static; - const layer = mass > 0 ? LAYER_MOVING : LAYER_NON_MOVING; - - const creationSettings = new Jolt.BodyCreationSettings( shape, pos, rot, motion, layer ); - creationSettings.mRestitution = restitution; - - const body = bodyInterface.CreateBody( creationSettings ); - - bodyInterface.AddBody( body.GetID(), Jolt.EActivation_Activate ); - - Jolt.destroy( creationSettings ); - - return body; - - } - - function setMeshPosition( mesh, position, index = 0 ) { - - if ( mesh.isInstancedMesh ) { - - const bodies = meshMap.get( mesh ); - - const body = bodies[ index ]; - - bodyInterface.RemoveBody( body.GetID() ); - bodyInterface.DestroyBody( body.GetID() ); - - const physics = mesh.userData.physics; - - let shape = body.GetShape(); - let body2 = createBody( position, { x: 0, y: 0, z: 0, w: 1 }, physics.mass, physics.restitution, shape ); - - bodies[ index ] = body2; - - } else { - - // TODO: Implement this - - } - - } - - function setMeshVelocity( mesh, velocity, index = 0 ) { - - /* - let body = meshMap.get( mesh ); - - if ( mesh.isInstancedMesh ) { - - body = body[ index ]; - - } - - body.setLinvel( velocity ); - */ - - } - - // - - const clock = new Clock(); - - function step() { - - let deltaTime = clock.getDelta(); - - // Don't go below 30 Hz to prevent spiral of death - deltaTime = Math.min( deltaTime, 1.0 / 30.0 ); - - // When running below 55 Hz, do 2 steps instead of 1 - const numSteps = deltaTime > 1.0 / 55.0 ? 2 : 1; - - // Step the physics world - jolt.Step( deltaTime, numSteps ); - - // - - for ( let i = 0, l = meshes.length; i < l; i ++ ) { - - const mesh = meshes[ i ]; - - if ( mesh.isInstancedMesh ) { - - const array = mesh.instanceMatrix.array; - const bodies = meshMap.get( mesh ); - - for ( let j = 0; j < bodies.length; j ++ ) { - - const body = bodies[ j ]; - - const position = body.GetPosition(); - const quaternion = body.GetRotation(); - - _position.set( position.GetX(), position.GetY(), position.GetZ() ); - _quaternion.set( quaternion.GetX(), quaternion.GetY(), quaternion.GetZ(), quaternion.GetW() ); - - _matrix.compose( _position, _quaternion, _scale ).toArray( array, j * 16 ); - - } - - mesh.instanceMatrix.needsUpdate = true; - mesh.computeBoundingSphere(); - - } else { - - const body = meshMap.get( mesh ); - - const position = body.GetPosition(); - const rotation = body.GetRotation(); - - mesh.position.set( position.GetX(), position.GetY(), position.GetZ() ); - mesh.quaternion.set( rotation.GetX(), rotation.GetY(), rotation.GetZ(), rotation.GetW() ); - - } - - } - - } - - // animate - - setInterval( step, 1000 / frameRate ); - - return { - addScene: addScene, - addMesh: addMesh, - setMeshPosition: setMeshPosition, - setMeshVelocity: setMeshVelocity - }; - -} - -export { JoltPhysics }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/RapierPhysics.js b/docker-compose/requirements/nginx/static/javascript/taaaa/physics/RapierPhysics.js deleted file mode 100644 index a2c7e01..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/physics/RapierPhysics.js +++ /dev/null @@ -1,220 +0,0 @@ -import { Clock, Vector3, Quaternion, Matrix4 } from '/static/javascript/three/build/three.module.js'; - -const RAPIER_PATH = 'https://cdn.skypack.dev/@dimforge/rapier3d-compat@0.12.0'; - -const frameRate = 60; - -const _scale = new Vector3( 1, 1, 1 ); -const ZERO = new Vector3(); - -let RAPIER = null; - -function getShape( geometry ) { - - const parameters = geometry.parameters; - - // TODO change type to is* - - if ( geometry.type === 'BoxGeometry' ) { - - const sx = parameters.width !== undefined ? parameters.width / 2 : 0.5; - const sy = parameters.height !== undefined ? parameters.height / 2 : 0.5; - const sz = parameters.depth !== undefined ? parameters.depth / 2 : 0.5; - - return RAPIER.ColliderDesc.cuboid( sx, sy, sz ); - - } else if ( geometry.type === 'SphereGeometry' || geometry.type === 'IcosahedronGeometry' ) { - - const radius = parameters.radius !== undefined ? parameters.radius : 1; - return RAPIER.ColliderDesc.ball( radius ); - - } - - return null; - -} - -async function RapierPhysics() { - - if ( RAPIER === null ) { - - RAPIER = await import( RAPIER_PATH ); - await RAPIER.init(); - - } - - // Docs: https://rapier.rs/docs/api/javascript/JavaScript3D/ - - const gravity = new Vector3( 0.0, - 9.81, 0.0 ); - const world = new RAPIER.World( gravity ); - - const meshes = []; - const meshMap = new WeakMap(); - - const _vector = new Vector3(); - const _quaternion = new Quaternion(); - const _matrix = new Matrix4(); - - function addScene( scene ) { - - scene.traverse( function ( child ) { - - if ( child.isMesh ) { - - const physics = child.userData.physics; - - if ( physics ) { - - addMesh( child, physics.mass, physics.restitution ); - - } - - } - - } ); - - } - - function addMesh( mesh, mass = 0, restitution = 0 ) { - - const shape = getShape( mesh.geometry ); - - if ( shape === null ) return; - - shape.setMass( mass ); - shape.setRestitution( restitution ); - - const body = mesh.isInstancedMesh - ? createInstancedBody( mesh, mass, shape ) - : createBody( mesh.position, mesh.quaternion, mass, shape ); - - if ( mass > 0 ) { - - meshes.push( mesh ); - meshMap.set( mesh, body ); - - } - - } - - function createInstancedBody( mesh, mass, shape ) { - - const array = mesh.instanceMatrix.array; - - const bodies = []; - - for ( let i = 0; i < mesh.count; i ++ ) { - - const position = _vector.fromArray( array, i * 16 + 12 ); - bodies.push( createBody( position, null, mass, shape ) ); - - } - - return bodies; - - } - - function createBody( position, quaternion, mass, shape ) { - - const desc = mass > 0 ? RAPIER.RigidBodyDesc.dynamic() : RAPIER.RigidBodyDesc.fixed(); - desc.setTranslation( ...position ); - if ( quaternion !== null ) desc.setRotation( quaternion ); - - const body = world.createRigidBody( desc ); - world.createCollider( shape, body ); - - return body; - - } - - function setMeshPosition( mesh, position, index = 0 ) { - - let body = meshMap.get( mesh ); - - if ( mesh.isInstancedMesh ) { - - body = body[ index ]; - - } - - body.setAngvel( ZERO ); - body.setLinvel( ZERO ); - body.setTranslation( position ); - - } - - function setMeshVelocity( mesh, velocity, index = 0 ) { - - let body = meshMap.get( mesh ); - - if ( mesh.isInstancedMesh ) { - - body = body[ index ]; - - } - - body.setLinvel( velocity ); - - } - - // - - const clock = new Clock(); - - function step() { - - world.timestep = clock.getDelta(); - world.step(); - - // - - for ( let i = 0, l = meshes.length; i < l; i ++ ) { - - const mesh = meshes[ i ]; - - if ( mesh.isInstancedMesh ) { - - const array = mesh.instanceMatrix.array; - const bodies = meshMap.get( mesh ); - - for ( let j = 0; j < bodies.length; j ++ ) { - - const body = bodies[ j ]; - - const position = body.translation(); - _quaternion.copy( body.rotation() ); - - _matrix.compose( position, _quaternion, _scale ).toArray( array, j * 16 ); - - } - - mesh.instanceMatrix.needsUpdate = true; - mesh.computeBoundingSphere(); - - } else { - - const body = meshMap.get( mesh ); - - mesh.position.copy( body.translation() ); - mesh.quaternion.copy( body.rotation() ); - - } - - } - - } - - // animate - - setInterval( step, 1000 / frameRate ); - - return { - addScene: addScene, - addMesh: addMesh, - setMeshPosition: setMeshPosition, - setMeshVelocity: setMeshVelocity - }; - -} - -export { RapierPhysics }; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/potpack.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/potpack.module.js deleted file mode 100644 index efba9a4..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/potpack.module.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * potpack - by [@mourner](https://github.com/mourner) - * - * A tiny JavaScript function for packing 2D rectangles into a near-square container, - * which is useful for generating CSS sprites and WebGL textures. Similar to - * [shelf-pack](https://github.com/mapbox/shelf-pack), but static (you can't add items - * once a layout is generated), and aims for maximal space utilization. - * - * A variation of algorithms used in [rectpack2D](https://github.com/TeamHypersomnia/rectpack2D) - * and [bin-pack](https://github.com/bryanburgers/bin-pack), which are in turn based - * on [this article by Blackpawn](http://blackpawn.com/texts/lightmaps/default.html). - * - * @license - * ISC License - * - * Copyright (c) 2018, Mapbox - * - * Permission to use, copy, modify, and/or distribute this software for any purpose - * with or without fee is hereby granted, provided that the above copyright notice - * and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ - -function potpack(boxes) { - - // calculate total box area and maximum box width - let area = 0; - let maxWidth = 0; - - for (const box of boxes) { - area += box.w * box.h; - maxWidth = Math.max(maxWidth, box.w); - } - - // sort the boxes for insertion by height, descending - boxes.sort((a, b) => b.h - a.h); - - // aim for a squarish resulting container, - // slightly adjusted for sub-100% space utilization - const startWidth = Math.max(Math.ceil(Math.sqrt(area / 0.95)), maxWidth); - - // start with a single empty space, unbounded at the bottom - const spaces = [{x: 0, y: 0, w: startWidth, h: Infinity}]; - - let width = 0; - let height = 0; - - for (const box of boxes) { - // look through spaces backwards so that we check smaller spaces first - for (let i = spaces.length - 1; i >= 0; i--) { - const space = spaces[i]; - - // look for empty spaces that can accommodate the current box - if (box.w > space.w || box.h > space.h) continue; - - // found the space; add the box to its top-left corner - // |-------|-------| - // | box | | - // |_______| | - // | space | - // |_______________| - box.x = space.x; - box.y = space.y; - - height = Math.max(height, box.y + box.h); - width = Math.max(width, box.x + box.w); - - if (box.w === space.w && box.h === space.h) { - // space matches the box exactly; remove it - const last = spaces.pop(); - if (i < spaces.length) spaces[i] = last; - - } else if (box.h === space.h) { - // space matches the box height; update it accordingly - // |-------|---------------| - // | box | updated space | - // |_______|_______________| - space.x += box.w; - space.w -= box.w; - - } else if (box.w === space.w) { - // space matches the box width; update it accordingly - // |---------------| - // | box | - // |_______________| - // | updated space | - // |_______________| - space.y += box.h; - space.h -= box.h; - - } else { - // otherwise the box splits the space into two spaces - // |-------|-----------| - // | box | new space | - // |_______|___________| - // | updated space | - // |___________________| - spaces.push({ - x: space.x + box.w, - y: space.y, - w: space.w - box.w, - h: box.h - }); - space.y += box.h; - space.h -= box.h; - } - break; - } - } - - return { - w: width, // container width - h: height, // container height - fill: (area / (width * height)) || 0 // space utilization - }; -} - -export { potpack }; \ No newline at end of file diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.js b/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.js deleted file mode 100644 index 8b41705..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.js +++ /dev/null @@ -1,21 +0,0 @@ - -var rhino3dm = (() => { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; - return ( -function(config) { - var rhino3dm = config || {}; - -var Module=typeof rhino3dm!="undefined"?rhino3dm:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};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",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}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.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;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(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}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 lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;SOCKFS.root=FS.mount(SOCKFS,{},null);if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}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 addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}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()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="rhino3dm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}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"]["oa"];updateMemoryViews();wasmTable=Module["asm"]["qa"];addOnInit(Module["asm"]["pa"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).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)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;if(ENVIRONMENT_IS_NODE){WebSocketConstructor=require("ws")}else{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},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},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_connect(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);var info=getSocketAddress(addr,addrlen);sock.sock_ops.connect(sock,info.addr,info.port);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function ___syscall_ftruncate64(fd,length_low,length_high){try{var length=convertI32PairToI53Checked(length_low,length_high);if(isNaN(length))return-61;FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var tupleRegistrations={};function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAP32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}return name}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function __embind_finalize_value_array(rawTupleType){var reg=tupleRegistrations[rawTupleType];delete tupleRegistrations[rawTupleType];var elements=reg.elements;var elementsLength=elements.length;var elementTypes=elements.map(function(elt){return elt.getterReturnType}).concat(elements.map(function(elt){return elt.setterArgumentType}));var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;whenDependentTypesAreResolved([rawTupleType],elementTypes,function(elementTypes){elements.forEach((elt,i)=>{var getterReturnType=elementTypes[i];var getter=elt.getter;var getterContext=elt.getterContext;var setterArgumentType=elementTypes[i+elementsLength];var setter=elt.setter;var setterContext=elt.setterContext;elt.read=ptr=>{return getterReturnType["fromWireType"](getter(getterContext,ptr))};elt.write=(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}});return[{name:reg.name,"fromWireType":function(ptr){var rv=new Array(elementsLength);for(var i=0;ifield.getterReturnType).concat(fieldRecords.map(field=>field.setterArgumentType));whenDependentTypesAreResolved([structType],fieldTypes,fieldTypes=>{var fields={};fieldRecords.forEach((field,i)=>{var fieldName=field.fieldName;var getterReturnType=fieldTypes[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:ptr=>{return getterReturnType["fromWireType"](getter(getterContext,ptr))},write:(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}}});return[{name:reg.name,"fromWireType":function(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},"toWireType":function(destructors,o){for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError('Missing field: "'+fieldName+'"')}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]})}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}function registerType(rawType,registeredInstance,options={}){if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}var name=registeredInstance.name;if(!rawType){throwBindingError('type "'+name+'" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError("Cannot register type '"+name+"' twice")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(wt){return!!wt},"toWireType":function(destructors,o){return o?trueValue:falseValue},"argPackAdvance":8,"readValueFromPointer":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}var finalizationRegistry=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}var registeredPointers={};function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}var delayFunction=undefined;function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function attachFinalizer(handle){if("undefined"===typeof FinalizationRegistry){attachFinalizer=handle=>handle;return handle}finalizationRegistry=new FinalizationRegistry(info=>{releaseClassHandle(info.$$)});attachFinalizer=handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$:$$};finalizationRegistry.register(handle,info,handle)}return handle};detachFinalizer=handle=>finalizationRegistry.unregister(handle);return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype["isAliasOf"]=ClassHandle_isAliasOf;ClassHandle.prototype["clone"]=ClassHandle_clone;ClassHandle.prototype["delete"]=ClassHandle_delete;ClassHandle.prototype["isDeleted"]=ClassHandle_isDeleted;ClassHandle.prototype["deleteLater"]=ClassHandle_deleteLater}function ClassHandle(){}function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,Emval.toHandle(function(){clonedHandle["delete"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle["delete"]()}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype["fromWireType"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function getWasmTableEntry(funcPtr){return wasmTable.get(funcPtr)}function dynCall(sig,ptr,args){if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}var rtn=getWasmTableEntry(ptr).apply(null,args);return rtn}function getDynCaller(sig,ptr){var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]))}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError("Cannot construct "+name+" due to unbound types",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError("Use 'new' to construct "+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+" has no accessible constructor")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+") parameters instead!")}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2])}return array}function __embind_register_class_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,fn){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}if(methodName.startsWith("@@")){methodName=Symbol[methodName.substring(2)]}var proto=classType.registeredClass.constructor;if(undefined===proto[methodName]){unboundTypesHandler.argCount=argCount-1;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-1]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));var func=craftInvokerFunction(humanName,invokerArgsArray,null,rawInvoker,fn);if(undefined===proto[methodName].overloadTable){func.argCount=argCount-1;proto[methodName]=func}else{proto[methodName].overloadTable[argCount-1]=func}return[]});return[]})}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){assert(argCount>0);var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=()=>{throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})}function __embind_register_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;if(methodName.startsWith("@@")){methodName=Symbol[methodName.substring(2)]}if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})}function validateThis(this_,classType,humanName){if(!(this_ instanceof Object)){throwBindingError(humanName+' with invalid "this": '+this_)}if(!(this_ instanceof classType.registeredClass.constructor)){throwBindingError(humanName+' incompatible with "this" of type '+this_.constructor.name)}if(!this_.$$.ptr){throwBindingError("cannot call emscripten binding method "+humanName+" on deleted object")}return upcastPointer(this_.$$.ptr,this_.$$.ptrType.registeredClass,classType.registeredClass)}function __embind_register_class_property(classType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){fieldName=readLatin1String(fieldName);getter=embind__requireFunction(getterSignature,getter);whenDependentTypesAreResolved([],[classType],function(classType){classType=classType[0];var humanName=classType.name+"."+fieldName;var desc={get:function(){throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])},enumerable:true,configurable:true};if(setter){desc.set=()=>{throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])}}else{desc.set=v=>{throwBindingError(humanName+" is a read-only property")}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);whenDependentTypesAreResolved([],setter?[getterReturnType,setterArgumentType]:[getterReturnType],function(types){var getterReturnType=types[0];var desc={get:function(){var ptr=validateThis(this,classType,humanName+" getter");return getterReturnType["fromWireType"](getter(getterContext,ptr))},enumerable:true};if(setter){setter=embind__requireFunction(setterSignature,setter);var setterArgumentType=types[1];desc.set=function(v){var ptr=validateThis(this,classType,humanName+" setter");var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,v));runDestructors(destructors)}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);return[]});return[]})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handle_array[handle].value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}};function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},"toWireType":function(destructors,value){return Emval.toHandle(value)},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function enumReadValueFromPointer(name,shift,signed){switch(shift){case 0:return function(pointer){var heap=signed?HEAP8:HEAPU8;return this["fromWireType"](heap[pointer])};case 1:return function(pointer){var heap=signed?HEAP16:HEAPU16;return this["fromWireType"](heap[pointer>>1])};case 2:return function(pointer){var heap=signed?HEAP32:HEAPU32;return this["fromWireType"](heap[pointer>>2])};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_enum(rawType,name,size,isSigned){var shift=getShiftFromSize(size);name=readLatin1String(name);function ctor(){}ctor.values={};registerType(rawType,{name:name,constructor:ctor,"fromWireType":function(c){return this.constructor.values[c]},"toWireType":function(destructors,c){return c.value},"argPackAdvance":8,"readValueFromPointer":enumReadValueFromPointer(name,shift,isSigned),destructorFunction:null});exposePublicSymbol(name,ctor)}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+" has unknown type "+getTypeName(rawType))}return impl}function __embind_register_enum_value(rawEnumType,name,enumValue){var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(enumType.name+"_"+name,function(){})}});Enum.values[enumValue]=Value;Enum[name]=Value}function embindRepr(v){if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":toWireType,"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,getHeap,lengthBytesUTF,shift;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;getHeap=()=>HEAPU16;shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=()=>HEAPU32;shift=2}registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type "+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_value_array(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){tupleRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),elements:[]}}function __embind_register_value_array_element(rawTupleType,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){tupleRegistrations[rawTupleType].elements.push({getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}}function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=Emval.toHandle(destructors);HEAPU32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)}function emval_allocateDestructors(destructorsRef){var destructors=[];HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors);return destructors}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol}var emval_methodCallers=[];function __emval_call_method(caller,handle,methodName,destructorsRef,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);return caller(handle,methodName,emval_allocateDestructors(destructorsRef),args)}function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function __emval_equals(first,second){first=Emval.toValue(first);second=Emval.toValue(second);return first==second}function emval_get_global(){if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()}function __emval_get_global(name){if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}}function emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i>2],"parameter "+i)}return a}var emval_registeredMethods=[];function __emval_get_method_caller(argCount,argTypes){var types=emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined){return returnId}var params=["retType"];var args=[retType];var argsList="";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function __emval_instanceof(object,constructor){object=Emval.toValue(object);constructor=Emval.toValue(constructor);return object instanceof constructor}function __emval_is_number(handle){handle=Emval.toValue(handle);return typeof handle=="number"}function __emval_is_string(handle){handle=Emval.toValue(handle);return typeof handle=="string"}function craftEmvalAllocator(argCount){var argsList="";for(var i=0;iHEAPU32;var functionBody="return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n"+" var HEAPU32 = getMemory();\n";for(var i=0;i>2)], 'parameter "+i+"');\n"+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"+"argTypes += 4;\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return valueToHandle(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","valueToHandle","getMemory",functionBody)(requireRegisteredType,Module,Emval.toHandle,getMemory)}var emval_newers={};function __emval_new(handle,argCount,argTypes,args){handle=Emval.toValue(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)}function __emval_new_array(){return Emval.toHandle([])}function __emval_new_cstring(v){return Emval.toHandle(getStringOrSymbol(v))}function __emval_new_object(){return Emval.toHandle({})}function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)}function __emval_set_property(handle,key,value){handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value}function __emval_take_value(type,arg){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}var __MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var __MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function __mktime_js(tmPtr){var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();return date.getTime()/1e3|0}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}function _emscripten_date_now(){return Date.now()}function getHeapMax(){return 2147483648}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();function emscripten_realloc_buffer(size){var b=wasmMemory.buffer;try{wasmMemory.grow(size-b.byteLength+65535>>>16);updateMemoryViews();return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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 ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(typeof offset!=="undefined"){offset+=curr}}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();InternalError=Module["InternalError"]=extendError(Error,"InternalError");embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");init_emval();var asmLibraryArg={"v":___cxa_throw,"U":___syscall_connect,"ea":___syscall_faccessat,"o":___syscall_fcntl64,"Z":___syscall_fstat64,"S":___syscall_ftruncate64,"K":___syscall_ioctl,"W":___syscall_lstat64,"X":___syscall_newfstatat,"G":___syscall_openat,"F":___syscall_socket,"Y":___syscall_stat64,"r":__embind_finalize_value_array,"ka":__embind_finalize_value_object,"T":__embind_register_bigint,"ga":__embind_register_bool,"e":__embind_register_class,"f":__embind_register_class_class_function,"g":__embind_register_class_constructor,"b":__embind_register_class_function,"a":__embind_register_class_property,"fa":__embind_register_emval,"i":__embind_register_enum,"d":__embind_register_enum_value,"M":__embind_register_float,"p":__embind_register_integer,"l":__embind_register_memory_view,"L":__embind_register_std_string,"B":__embind_register_std_wstring,"q":__embind_register_value_array,"ia":__embind_register_value_array_element,"ja":__embind_register_value_object,"N":__embind_register_value_object_field,"ha":__embind_register_void,"t":__emval_as,"la":__emval_call_method,"P":__emval_call_void_method,"c":__emval_decref,"Q":__emval_equals,"y":__emval_get_global,"C":__emval_get_method_caller,"E":__emval_get_module_property,"w":__emval_get_property,"m":__emval_incref,"D":__emval_instanceof,"na":__emval_is_number,"ma":__emval_is_string,"O":__emval_new,"n":__emval_new_array,"u":__emval_new_cstring,"k":__emval_new_object,"s":__emval_run_destructors,"j":__emval_set_property,"h":__emval_take_value,"aa":__gmtime_js,"ba":__localtime_js,"ca":__mktime_js,"da":__tzset_js,"z":_abort,"I":_emscripten_date_now,"H":_emscripten_get_now,"V":_emscripten_resize_heap,"_":_environ_get,"$":_environ_sizes_get,"x":_fd_close,"J":_fd_read,"R":_fd_seek,"A":_fd_write};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["pa"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["ra"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["sa"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["ta"]).apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return(___getTypeName=Module["___getTypeName"]=Module["asm"]["ua"]).apply(null,arguments)};var __embind_initialize_bindings=Module["__embind_initialize_bindings"]=function(){return(__embind_initialize_bindings=Module["__embind_initialize_bindings"]=Module["asm"]["va"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["wa"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["xa"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["ya"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["za"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["Aa"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["Ba"]).apply(null,arguments)};var calledRun;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();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()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); - - - return rhino3dm.ready -} -); -})(); -if (typeof exports === 'object' && typeof module === 'object') - module.exports = rhino3dm; -else if (typeof define === 'function' && define['amd']) - define([], function() { return rhino3dm; }); -else if (typeof exports === 'object') - exports["rhino3dm"] = rhino3dm; diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.module.js b/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.module.js deleted file mode 100644 index 14ec133..0000000 --- a/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.module.js +++ /dev/null @@ -1,16 +0,0 @@ - -var rhino3dm = (() => { - var _scriptDir = import.meta.url; - - return ( -async function(config) { - var rhino3dm = config || {}; - -var Module=typeof rhino3dm!="undefined"?rhino3dm:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;function logExceptionOnExit(e){if(e instanceof ExitStatus)return;let toLog=e;err("exiting due to exception: "+toLog)}if(ENVIRONMENT_IS_NODE){const{createRequire:createRequire}=await import("module");var require=createRequire(import.meta.url);var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=require("url").fileURLToPath(new URL("./",import.meta.url))}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};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",function(reason){throw reason});quit_=(status,toThrow)=>{if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}logExceptionOnExit(toThrow);process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}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.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var POINTER_SIZE=4;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(text)}}var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}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 lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function keepRuntimeAlive(){return noExitRuntime}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;SOCKFS.root=FS.mount(SOCKFS,{},null);if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}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 addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}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()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="rhino3dm.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}}else{wasmBinaryFile=new URL("rhino3dm.wasm",import.meta.url).href}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}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"]["oa"];updateMemoryViews();wasmTable=Module["asm"]["qa"];addOnInit(Module["asm"]["pa"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(function(instance){return instance}).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)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync().catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24;this.set_type=function(type){HEAPU32[this.ptr+4>>2]=type};this.get_type=function(){return HEAPU32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAPU32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAPU32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1};this.set_adjusted_ptr=function(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr};this.get_adjusted_ptr=function(){return HEAPU32[this.ptr+16>>2]};this.get_exception_ptr=function(){var isPointer=___cxa_is_pointer_type(this.get_type());if(isPointer){return HEAPU32[this.excPtr>>2]}var adjusted=this.get_adjusted_ptr();if(adjusted!==0)return adjusted;return this.excPtr}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function getRandomDevice(){if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){var randomBuffer=new Uint8Array(1);return()=>{crypto.getRandomValues(randomBuffer);return randomBuffer[0]}}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");return()=>crypto_module["randomBytes"](1)[0]}catch(e){}}return()=>abort("randomDevice")}var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>{return PATH.normalize(l+"/"+r)}};var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var TTY={ttys:[],init:function(){},shutdown:function(){},register:function(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open:function(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close:function(stream){stream.tty.ops.fsync(stream.tty)},fsync:function(stream){stream.tty.ops.fsync(stream.tty)},read:function(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};function mmapAlloc(size){abort()}var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray:function(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage:function(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr:function(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr:function(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup:function(parent,name){throw FS.genericErrors[44]},mknod:function(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename:function(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink:function(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir:function(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir:function(node){var entries=[".",".."];for(var key in node.contents){if(!node.contents.hasOwnProperty(key)){continue}entries.push(key)}return entries},symlink:function(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink:function(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read:function(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{assert(arrayBuffer,'Loading data file "'+url+'" failed (no arrayBuffer).');onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw'Loading data file "'+url+'" failed.'}});if(dep)addRunDependency(dep)}var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(path,opts={})=>{path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath:node=>{var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?mount+"/"+path:mount+path}path=path?node.name+"/"+path:node.name;node=node.parent}},hashName:(parentid,name)=>{var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:node=>{var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:node=>{var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:(parent,name)=>{var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:(parent,name,mode,rdev)=>{var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:node=>{FS.hashRemoveNode(node)},isRoot:node=>{return node===node.parent},isMountpoint:node=>{return!!node.mounted},isFile:mode=>{return(mode&61440)===32768},isDir:mode=>{return(mode&61440)===16384},isLink:mode=>{return(mode&61440)===40960},isChrdev:mode=>{return(mode&61440)===8192},isBlkdev:mode=>{return(mode&61440)===24576},isFIFO:mode=>{return(mode&61440)===4096},isSocket:mode=>{return(mode&49152)===49152},flagModes:{"r":0,"r+":2,"w":577,"w+":578,"a":1089,"a+":1090},modeStringToFlags:str=>{var flags=FS.flagModes[str];if(typeof flags=="undefined"){throw new Error("Unknown file open mode: "+str)}return flags},flagsToPermissionString:flag=>{var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions:(node,perms)=>{if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup:dir=>{var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate:(dir,name)=>{try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete:(dir,name,isdir)=>{var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen:(node,flags)=>{if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:(fd_start=0,fd_end=FS.MAX_OPEN_FDS)=>{for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStream:fd=>FS.streams[fd],createStream:(stream,fd_start,fd_end)=>{if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(val){this.shared.flags=val}},position:{get:function(){return this.shared.position},set:function(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:fd=>{FS.streams[fd]=null},chrdev_stream_ops:{open:stream=>{var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:()=>{throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice:(dev,ops)=>{FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts:mount=>{var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:(populate,callback)=>{if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err("warning: "+FS.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:(type,opts,mountpoint)=>{var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:mountpoint=>{var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup:(parent,name)=>{return parent.node_ops.lookup(parent,name)},mknod:(path,mode,dev)=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create:(path,mode)=>{mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:(path,mode)=>{mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:(path,mode)=>{var dirs=path.split("/");var d="";for(var i=0;i{if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink:(oldpath,newpath)=>{if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},rename:(old_path,new_path)=>{var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name)}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir:path=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node.node_ops.readdir){throw new FS.ErrnoError(54)}return node.node_ops.readdir(node)},unlink:path=>{var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink:path=>{var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return PATH_FS.resolve(FS.getPath(link.parent),link.node_ops.readlink(link))},stat:(path,dontFollow)=>{var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;if(!node){throw new FS.ErrnoError(44)}if(!node.node_ops.getattr){throw new FS.ErrnoError(63)}return node.node_ops.getattr(node)},lstat:path=>{return FS.stat(path,true)},chmod:(path,mode,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{mode:mode&4095|node.mode&~4095,timestamp:Date.now()})},lchmod:(path,mode)=>{FS.chmod(path,mode,true)},fchmod:(fd,mode)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chmod(stream.node,mode)},chown:(path,uid,gid,dontFollow)=>{var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}node.node_ops.setattr(node,{timestamp:Date.now()})},lchown:(path,uid,gid)=>{FS.chown(path,uid,gid,true)},fchown:(fd,uid,gid)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}FS.chown(stream.node,uid,gid)},truncate:(path,len)=>{if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}if(!node.node_ops.setattr){throw new FS.ErrnoError(63)}if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}node.node_ops.setattr(node,{size:len,timestamp:Date.now()})},ftruncate:(fd,len)=>{var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.truncate(stream.node,len)},utime:(path,atime,mtime)=>{var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;node.node_ops.setattr(node,{timestamp:Math.max(atime,mtime)})},open:(path,flags,mode)=>{if(path===""){throw new FS.ErrnoError(44)}flags=typeof flags=="string"?FS.modeStringToFlags(flags):flags;mode=typeof mode=="undefined"?438:mode;if(flags&64){mode=mode&4095|32768}else{mode=0}var node;if(typeof path=="object"){node=path}else{path=PATH.normalize(path);try{var lookup=FS.lookupPath(path,{follow:!(flags&131072)});node=lookup.node}catch(e){}}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else{node=FS.mknod(path,mode,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node:node,path:FS.getPath(node),flags:flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(Module["logReadFiles"]&&!(flags&1)){if(!FS.readFiles)FS.readFiles={};if(!(path in FS.readFiles)){FS.readFiles[path]=1}}return stream},close:stream=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed:stream=>{return stream.fd===null},llseek:(stream,offset,whence)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read:(stream,buffer,offset,length,position)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:(stream,buffer,offset,length,position,canOwn)=>{if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:(stream,offset,length)=>{if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(offset<0||length<=0){throw new FS.ErrnoError(28)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(!FS.isFile(stream.node.mode)&&!FS.isDir(stream.node.mode)){throw new FS.ErrnoError(43)}if(!stream.stream_ops.allocate){throw new FS.ErrnoError(138)}stream.stream_ops.allocate(stream,offset,length)},mmap:(stream,length,position,prot,flags)=>{if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync:(stream,buffer,offset,length,mmapFlags)=>{if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},munmap:stream=>0,ioctl:(stream,cmd,arg)=>{if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile:(path,opts={})=>{opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error('Invalid encoding type "'+opts.encoding+'"')}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile:(path,data,opts={})=>{opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir:path=>{var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories:()=>{FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices:()=>{FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var random_device=getRandomDevice();FS.createDevice("/dev","random",random_device);FS.createDevice("/dev","urandom",random_device);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount:()=>{var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup:(parent,name)=>{var fd=+name;var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams:()=>{if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError:()=>{if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit:()=>{FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init:(input,output,error)=>{FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit:()=>{FS.init.initialized=false;for(var i=0;i{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode},findObject:(path,dontResolveLastLink)=>{var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath:(path,dontResolveLastLink)=>{try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath:(parent,path,canRead,canWrite)=>{parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){}parent=current}return current},createFile:(parent,name,properties,canRead,canWrite)=>{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile:(parent,name,data,canRead,canWrite,canOwn)=>{var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS.getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){if(typeof data=="string"){var arr=new Array(data.length);for(var i=0,len=data.length;i{var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS.getMode(!!input,!!output);if(!FS.createDevice.major)FS.createDevice.major=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open:stream=>{stream.seekable=false},close:stream=>{if(output&&output.buffer&&output.buffer.length){output(10)}},read:(stream,buffer,offset,length,pos)=>{var bytesRead=0;for(var i=0;i{for(var i=0;i{if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(typeof XMLHttpRequest!="undefined"){throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.")}else if(read_){try{obj.contents=intArrayFromString(read_(obj.url),true);obj.usedBytes=obj.contents.length}catch(e){throw new FS.ErrnoError(29)}}else{throw new Error("Cannot load without read() or XMLHttpRequest.")}},createLazyFile:(parent,name,url,canRead,canWrite)=>{function LazyUint8Array(){this.lengthKnown=false;this.chunks=[]}LazyUint8Array.prototype.get=function LazyUint8Array_get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node},createPreloadedFile:(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency("cp "+fullname);function processData(byteArray){function finish(byteArray){if(preFinish)preFinish();if(!dontCreateFile){FS.createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}if(onload)onload();removeRunDependency(dep)}if(Browser.handledByPreloadPlugin(byteArray,fullname,finish,()=>{if(onerror)onerror();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}},indexedDB:()=>{return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:()=>{return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=()=>{out("creating db");var db=openRequest.result;db.createObjectStore(FS.DB_STORE_NAME)};openRequest.onsuccess=()=>{var db=openRequest.result;var transaction=db.transaction([FS.DB_STORE_NAME],"readwrite");var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var putRequest=files.put(FS.analyzePath(path).object.contents,path);putRequest.onsuccess=()=>{ok++;if(ok+fail==total)finish()};putRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror},loadFilesFromDB:(paths,onload,onerror)=>{onload=onload||(()=>{});onerror=onerror||(()=>{});var indexedDB=FS.indexedDB();try{var openRequest=indexedDB.open(FS.DB_NAME(),FS.DB_VERSION)}catch(e){return onerror(e)}openRequest.onupgradeneeded=onerror;openRequest.onsuccess=()=>{var db=openRequest.result;try{var transaction=db.transaction([FS.DB_STORE_NAME],"readonly")}catch(e){onerror(e);return}var files=transaction.objectStore(FS.DB_STORE_NAME);var ok=0,fail=0,total=paths.length;function finish(){if(fail==0)onload();else onerror()}paths.forEach(path=>{var getRequest=files.get(path);getRequest.onsuccess=()=>{if(FS.analyzePath(path).exists){FS.unlink(path)}FS.createDataFile(PATH.dirname(path),PATH.basename(path),getRequest.result,true,true,true);ok++;if(ok+fail==total)finish()};getRequest.onerror=()=>{fail++;if(ok+fail==total)finish()}});transaction.onerror=onerror};openRequest.onerror=onerror}};var SOCKFS={mount:function(mount){Module["websocket"]=Module["websocket"]&&"object"===typeof Module["websocket"]?Module["websocket"]:{};Module["websocket"]._callbacks={};Module["websocket"]["on"]=function(event,callback){if("function"===typeof callback){this._callbacks[event]=callback}return this};Module["websocket"].emit=function(event,param){if("function"===typeof this._callbacks[event]){this._callbacks[event].call(this,param)}};return FS.createNode(null,"/",16384|511,0)},createSocket:function(family,type,protocol){type&=~526336;var streaming=type==1;if(streaming&&protocol&&protocol!=6){throw new FS.ErrnoError(66)}var sock={family:family,type:type,protocol:protocol,server:null,error:null,peers:{},pending:[],recv_queue:[],sock_ops:SOCKFS.websocket_sock_ops};var name=SOCKFS.nextname();var node=FS.createNode(SOCKFS.root,name,49152,0);node.sock=sock;var stream=FS.createStream({path:name,node:node,flags:2,seekable:false,stream_ops:SOCKFS.stream_ops});sock.stream=stream;return sock},getSocket:function(fd){var stream=FS.getStream(fd);if(!stream||!FS.isSocket(stream.node.mode)){return null}return stream.node.sock},stream_ops:{poll:function(stream){var sock=stream.node.sock;return sock.sock_ops.poll(sock)},ioctl:function(stream,request,varargs){var sock=stream.node.sock;return sock.sock_ops.ioctl(sock,request,varargs)},read:function(stream,buffer,offset,length,position){var sock=stream.node.sock;var msg=sock.sock_ops.recvmsg(sock,length);if(!msg){return 0}buffer.set(msg.buffer,offset);return msg.buffer.length},write:function(stream,buffer,offset,length,position){var sock=stream.node.sock;return sock.sock_ops.sendmsg(sock,buffer,offset,length)},close:function(stream){var sock=stream.node.sock;sock.sock_ops.close(sock)}},nextname:function(){if(!SOCKFS.nextname.current){SOCKFS.nextname.current=0}return"socket["+SOCKFS.nextname.current+++"]"},websocket_sock_ops:{createPeer:function(sock,addr,port){var ws;if(typeof addr=="object"){ws=addr;addr=null;port=null}if(ws){if(ws._socket){addr=ws._socket.remoteAddress;port=ws._socket.remotePort}else{var result=/ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url);if(!result){throw new Error("WebSocket URL must be in the format ws(s)://address:port")}addr=result[1];port=parseInt(result[2],10)}}else{try{var runtimeConfig=Module["websocket"]&&"object"===typeof Module["websocket"];var url="ws:#".replace("#","//");if(runtimeConfig){if("string"===typeof Module["websocket"]["url"]){url=Module["websocket"]["url"]}}if(url==="ws://"||url==="wss://"){var parts=addr.split("/");url=url+parts[0]+":"+port+"/"+parts.slice(1).join("/")}var subProtocols="binary";if(runtimeConfig){if("string"===typeof Module["websocket"]["subprotocol"]){subProtocols=Module["websocket"]["subprotocol"]}}var opts=undefined;if(subProtocols!=="null"){subProtocols=subProtocols.replace(/^ +| +$/g,"").split(/ *, */);opts=subProtocols}if(runtimeConfig&&null===Module["websocket"]["subprotocol"]){subProtocols="null";opts=undefined}var WebSocketConstructor;if(ENVIRONMENT_IS_NODE){WebSocketConstructor=require("ws")}else{WebSocketConstructor=WebSocket}ws=new WebSocketConstructor(url,opts);ws.binaryType="arraybuffer"}catch(e){throw new FS.ErrnoError(23)}}var peer={addr:addr,port:port,socket:ws,dgram_send_queue:[]};SOCKFS.websocket_sock_ops.addPeer(sock,peer);SOCKFS.websocket_sock_ops.handlePeerEvents(sock,peer);if(sock.type===2&&typeof sock.sport!="undefined"){peer.dgram_send_queue.push(new Uint8Array([255,255,255,255,"p".charCodeAt(0),"o".charCodeAt(0),"r".charCodeAt(0),"t".charCodeAt(0),(sock.sport&65280)>>8,sock.sport&255]))}return peer},getPeer:function(sock,addr,port){return sock.peers[addr+":"+port]},addPeer:function(sock,peer){sock.peers[peer.addr+":"+peer.port]=peer},removePeer:function(sock,peer){delete sock.peers[peer.addr+":"+peer.port]},handlePeerEvents:function(sock,peer){var first=true;var handleOpen=function(){Module["websocket"].emit("open",sock.stream.fd);try{var queued=peer.dgram_send_queue.shift();while(queued){peer.socket.send(queued);queued=peer.dgram_send_queue.shift()}}catch(e){peer.socket.close()}};function handleMessage(data){if(typeof data=="string"){var encoder=new TextEncoder;data=encoder.encode(data)}else{assert(data.byteLength!==undefined);if(data.byteLength==0){return}data=new Uint8Array(data)}var wasfirst=first;first=false;if(wasfirst&&data.length===10&&data[0]===255&&data[1]===255&&data[2]===255&&data[3]===255&&data[4]==="p".charCodeAt(0)&&data[5]==="o".charCodeAt(0)&&data[6]==="r".charCodeAt(0)&&data[7]==="t".charCodeAt(0)){var newport=data[8]<<8|data[9];SOCKFS.websocket_sock_ops.removePeer(sock,peer);peer.port=newport;SOCKFS.websocket_sock_ops.addPeer(sock,peer);return}sock.recv_queue.push({addr:peer.addr,port:peer.port,data:data});Module["websocket"].emit("message",sock.stream.fd)}if(ENVIRONMENT_IS_NODE){peer.socket.on("open",handleOpen);peer.socket.on("message",function(data,isBinary){if(!isBinary){return}handleMessage(new Uint8Array(data).buffer)});peer.socket.on("close",function(){Module["websocket"].emit("close",sock.stream.fd)});peer.socket.on("error",function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])})}else{peer.socket.onopen=handleOpen;peer.socket.onclose=function(){Module["websocket"].emit("close",sock.stream.fd)};peer.socket.onmessage=function peer_socket_onmessage(event){handleMessage(event.data)};peer.socket.onerror=function(error){sock.error=14;Module["websocket"].emit("error",[sock.stream.fd,sock.error,"ECONNREFUSED: Connection refused"])}}},poll:function(sock){if(sock.type===1&&sock.server){return sock.pending.length?64|1:0}var mask=0;var dest=sock.type===1?SOCKFS.websocket_sock_ops.getPeer(sock,sock.daddr,sock.dport):null;if(sock.recv_queue.length||!dest||dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=64|1}if(!dest||dest&&dest.socket.readyState===dest.socket.OPEN){mask|=4}if(dest&&dest.socket.readyState===dest.socket.CLOSING||dest&&dest.socket.readyState===dest.socket.CLOSED){mask|=16}return mask},ioctl:function(sock,request,arg){switch(request){case 21531:var bytes=0;if(sock.recv_queue.length){bytes=sock.recv_queue[0].data.length}HEAP32[arg>>2]=bytes;return 0;default:return 28}},close:function(sock){if(sock.server){try{sock.server.close()}catch(e){}sock.server=null}var peers=Object.keys(sock.peers);for(var i=0;i>2]=value;return value}function inetNtop4(addr){return(addr&255)+"."+(addr>>8&255)+"."+(addr>>16&255)+"."+(addr>>24&255)}function inetNtop6(ints){var str="";var word=0;var longest=0;var lastzero=0;var zstart=0;var len=0;var i=0;var parts=[ints[0]&65535,ints[0]>>16,ints[1]&65535,ints[1]>>16,ints[2]&65535,ints[2]>>16,ints[3]&65535,ints[3]>>16];var hasipv4=true;var v4part="";for(i=0;i<5;i++){if(parts[i]!==0){hasipv4=false;break}}if(hasipv4){v4part=inetNtop4(parts[6]|parts[7]<<16);if(parts[5]===-1){str="::ffff:";str+=v4part;return str}if(parts[5]===0){str="::";if(v4part==="0.0.0.0")v4part="";if(v4part==="0.0.0.1")v4part="1";str+=v4part;return str}}for(word=0;word<8;word++){if(parts[word]===0){if(word-lastzero>1){len=0}lastzero=word;len++}if(len>longest){longest=len;zstart=word-longest+1}}for(word=0;word<8;word++){if(longest>1){if(parts[word]===0&&word>=zstart&&word>1];var port=_ntohs(HEAPU16[sa+2>>1]);var addr;switch(family){case 2:if(salen!==16){return{errno:28}}addr=HEAP32[sa+4>>2];addr=inetNtop4(addr);break;case 10:if(salen!==28){return{errno:28}}addr=[HEAP32[sa+8>>2],HEAP32[sa+12>>2],HEAP32[sa+16>>2],HEAP32[sa+20>>2]];addr=inetNtop6(addr);break;default:return{errno:5}}return{family:family,addr:addr,port:port}}function inetPton4(str){var b=str.split(".");for(var i=0;i<4;i++){var tmp=Number(b[i]);if(isNaN(tmp))return null;b[i]=tmp}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0}function jstoi_q(str){return parseInt(str)}function inetPton6(str){var words;var w,offset,z;var valid6regx=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i;var parts=[];if(!valid6regx.test(str)){return null}if(str==="::"){return[0,0,0,0,0,0,0,0]}if(str.startsWith("::")){str=str.replace("::","Z:")}else{str=str.replace("::",":Z:")}if(str.indexOf(".")>0){str=str.replace(new RegExp("[.]","g"),":");words=str.split(":");words[words.length-4]=jstoi_q(words[words.length-4])+jstoi_q(words[words.length-3])*256;words[words.length-3]=jstoi_q(words[words.length-2])+jstoi_q(words[words.length-1])*256;words=words.slice(0,words.length-2)}else{words=str.split(":")}offset=0;z=0;for(w=0;w>2]=stat.dev;HEAP32[buf+8>>2]=stat.ino;HEAP32[buf+12>>2]=stat.mode;HEAPU32[buf+16>>2]=stat.nlink;HEAP32[buf+20>>2]=stat.uid;HEAP32[buf+24>>2]=stat.gid;HEAP32[buf+28>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAP32[buf+48>>2]=4096;HEAP32[buf+52>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];HEAPU32[buf+96>>2]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+104>>2]=tempI64[0],HEAP32[buf+108>>2]=tempI64[1];return 0},doMsync:function(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},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},getStreamFromFD:function(fd){var stream=FS.getStream(fd);if(!stream)throw new FS.ErrnoError(8);return stream}};function ___syscall_connect(fd,addr,addrlen){try{var sock=getSocketFromFD(fd);var info=getSocketAddress(addr,addrlen);sock.sock_ops.connect(sock,info.addr,info.port);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.get();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function convertI32PairToI53Checked(lo,hi){return hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN}function ___syscall_ftruncate64(fd,length_low,length_high){try{var length=convertI32PairToI53Checked(length_low,length_high);if(isNaN(length))return-61;FS.ftruncate(fd,length);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:case 21505:{if(!stream.tty)return-59;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-59;return 0}case 21519:{if(!stream.tty)return-59;var argp=SYSCALLS.get();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;return 0}case 21524:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_socket(domain,type,protocol){try{var sock=SOCKFS.createSocket(domain,type,protocol);return sock.stream.fd}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return-e.errno}}var tupleRegistrations={};function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAP32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}return name}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i{if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(()=>{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function __embind_finalize_value_array(rawTupleType){var reg=tupleRegistrations[rawTupleType];delete tupleRegistrations[rawTupleType];var elements=reg.elements;var elementsLength=elements.length;var elementTypes=elements.map(function(elt){return elt.getterReturnType}).concat(elements.map(function(elt){return elt.setterArgumentType}));var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;whenDependentTypesAreResolved([rawTupleType],elementTypes,function(elementTypes){elements.forEach((elt,i)=>{var getterReturnType=elementTypes[i];var getter=elt.getter;var getterContext=elt.getterContext;var setterArgumentType=elementTypes[i+elementsLength];var setter=elt.setter;var setterContext=elt.setterContext;elt.read=ptr=>{return getterReturnType["fromWireType"](getter(getterContext,ptr))};elt.write=(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}});return[{name:reg.name,"fromWireType":function(ptr){var rv=new Array(elementsLength);for(var i=0;ifield.getterReturnType).concat(fieldRecords.map(field=>field.setterArgumentType));whenDependentTypesAreResolved([structType],fieldTypes,fieldTypes=>{var fields={};fieldRecords.forEach((field,i)=>{var fieldName=field.fieldName;var getterReturnType=fieldTypes[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:ptr=>{return getterReturnType["fromWireType"](getter(getterContext,ptr))},write:(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}}});return[{name:reg.name,"fromWireType":function(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},"toWireType":function(destructors,o){for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError('Missing field: "'+fieldName+'"')}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]})}function __embind_register_bigint(primitiveType,name,size,minRange,maxRange){}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}function registerType(rawType,registeredInstance,options={}){if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}var name=registeredInstance.name;if(!rawType){throwBindingError('type "'+name+'" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError("Cannot register type '"+name+"' twice")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(wt){return!!wt},"toWireType":function(destructors,o){return o?trueValue:falseValue},"argPackAdvance":8,"readValueFromPointer":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}var finalizationRegistry=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}var registeredPointers={};function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}var delayFunction=undefined;function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function attachFinalizer(handle){if("undefined"===typeof FinalizationRegistry){attachFinalizer=handle=>handle;return handle}finalizationRegistry=new FinalizationRegistry(info=>{releaseClassHandle(info.$$)});attachFinalizer=handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$:$$};finalizationRegistry.register(handle,info,handle)}return handle};detachFinalizer=handle=>finalizationRegistry.unregister(handle);return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype["isAliasOf"]=ClassHandle_isAliasOf;ClassHandle.prototype["clone"]=ClassHandle_clone;ClassHandle.prototype["delete"]=ClassHandle_delete;ClassHandle.prototype["isDeleted"]=ClassHandle_isDeleted;ClassHandle.prototype["deleteLater"]=ClassHandle_deleteLater}function ClassHandle(){}function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,Emval.toHandle(function(){clonedHandle["delete"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle["delete"]()}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype["fromWireType"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){var f=Module["dynCall_"+sig];return args&&args.length?f.apply(null,[ptr].concat(args)):f.call(null,ptr)}function getWasmTableEntry(funcPtr){return wasmTable.get(funcPtr)}function dynCall(sig,ptr,args){if(sig.includes("j")){return dynCallLegacy(sig,ptr,args)}var rtn=getWasmTableEntry(ptr).apply(null,args);return rtn}function getDynCaller(sig,ptr){var argCache=[];return function(){argCache.length=0;Object.assign(argCache,arguments);return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.includes("j")){return getDynCaller(signature,rawFunction)}return getWasmTableEntry(rawFunction)}var fp=makeDynCaller();if(typeof fp!="function"){throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]))}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError("Cannot construct "+name+" due to unbound types",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError("Use 'new' to construct "+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+" has no accessible constructor")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+") parameters instead!")}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2])}return array}function __embind_register_class_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,fn){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}if(methodName.startsWith("@@")){methodName=Symbol[methodName.substring(2)]}var proto=classType.registeredClass.constructor;if(undefined===proto[methodName]){unboundTypesHandler.argCount=argCount-1;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-1]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));var func=craftInvokerFunction(humanName,invokerArgsArray,null,rawInvoker,fn);if(undefined===proto[methodName].overloadTable){func.argCount=argCount-1;proto[methodName]=func}else{proto[methodName].overloadTable[argCount-1]=func}return[]});return[]})}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){assert(argCount>0);var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=()=>{throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})}function __embind_register_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;if(methodName.startsWith("@@")){methodName=Symbol[methodName.substring(2)]}if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})}function validateThis(this_,classType,humanName){if(!(this_ instanceof Object)){throwBindingError(humanName+' with invalid "this": '+this_)}if(!(this_ instanceof classType.registeredClass.constructor)){throwBindingError(humanName+' incompatible with "this" of type '+this_.constructor.name)}if(!this_.$$.ptr){throwBindingError("cannot call emscripten binding method "+humanName+" on deleted object")}return upcastPointer(this_.$$.ptr,this_.$$.ptrType.registeredClass,classType.registeredClass)}function __embind_register_class_property(classType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){fieldName=readLatin1String(fieldName);getter=embind__requireFunction(getterSignature,getter);whenDependentTypesAreResolved([],[classType],function(classType){classType=classType[0];var humanName=classType.name+"."+fieldName;var desc={get:function(){throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])},enumerable:true,configurable:true};if(setter){desc.set=()=>{throwUnboundTypeError("Cannot access "+humanName+" due to unbound types",[getterReturnType,setterArgumentType])}}else{desc.set=v=>{throwBindingError(humanName+" is a read-only property")}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);whenDependentTypesAreResolved([],setter?[getterReturnType,setterArgumentType]:[getterReturnType],function(types){var getterReturnType=types[0];var desc={get:function(){var ptr=validateThis(this,classType,humanName+" getter");return getterReturnType["fromWireType"](getter(getterContext,ptr))},enumerable:true};if(setter){setter=embind__requireFunction(setterSignature,setter);var setterArgumentType=types[1];desc.set=function(v){var ptr=validateThis(this,classType,humanName+" setter");var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,v));runDestructors(destructors)}}Object.defineProperty(classType.registeredClass.instancePrototype,fieldName,desc);return[]});return[]})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i{if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handle_array[handle].value},toHandle:value=>{switch(value){case undefined:return 1;case null:return 2;case true:return 3;case false:return 4;default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}};function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(handle){var rv=Emval.toValue(handle);__emval_decref(handle);return rv},"toWireType":function(destructors,value){return Emval.toHandle(value)},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function enumReadValueFromPointer(name,shift,signed){switch(shift){case 0:return function(pointer){var heap=signed?HEAP8:HEAPU8;return this["fromWireType"](heap[pointer])};case 1:return function(pointer){var heap=signed?HEAP16:HEAPU16;return this["fromWireType"](heap[pointer>>1])};case 2:return function(pointer){var heap=signed?HEAP32:HEAPU32;return this["fromWireType"](heap[pointer>>2])};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_enum(rawType,name,size,isSigned){var shift=getShiftFromSize(size);name=readLatin1String(name);function ctor(){}ctor.values={};registerType(rawType,{name:name,constructor:ctor,"fromWireType":function(c){return this.constructor.values[c]},"toWireType":function(destructors,c){return c.value},"argPackAdvance":8,"readValueFromPointer":enumReadValueFromPointer(name,shift,isSigned),destructorFunction:null});exposePublicSymbol(name,ctor)}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+" has unknown type "+getTypeName(rawType))}return impl}function __embind_register_enum_value(rawEnumType,name,enumValue){var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(enumType.name+"_"+name,function(){})}});Enum.values[enumValue]=Value;Enum[name]=Value}function embindRepr(v){if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=value=>value;if(minRange===0){var bitshift=32-8*size;fromWireType=value=>value<>>bitshift}var isUnsignedType=name.includes("unsigned");var checkAssertions=(value,toTypeName)=>{};var toWireType;if(isUnsignedType){toWireType=function(destructors,value){checkAssertions(value,this.name);return value>>>0}}else{toWireType=function(destructors,value){checkAssertions(value,this.name);return value}}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":toWireType,"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap.buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){var decodeStartPtr=payload;for(var i=0;i<=length;++i){var currentBytePtr=payload+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr,length+1)}else{if(valueIsOfTypeString){for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+i]=charCode}}else{for(var i=0;i>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder)return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr));var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i=55296&&codeUnit<=57343)++i;len+=4}return len}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,getHeap,lengthBytesUTF,shift;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;getHeap=()=>HEAPU16;shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=()=>HEAPU32;shift=2}registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value=="string")){throwBindingError("Cannot pass non-string to C++ string type "+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_value_array(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){tupleRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),elements:[]}}function __embind_register_value_array_element(rawTupleType,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){tupleRegistrations[rawTupleType].elements.push({getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}}function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}function __emval_as(handle,returnType,destructorsRef){handle=Emval.toValue(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=Emval.toHandle(destructors);HEAPU32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)}function emval_allocateDestructors(destructorsRef){var destructors=[];HEAPU32[destructorsRef>>2]=Emval.toHandle(destructors);return destructors}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}return symbol}var emval_methodCallers=[];function __emval_call_method(caller,handle,methodName,destructorsRef,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);return caller(handle,methodName,emval_allocateDestructors(destructorsRef),args)}function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=Emval.toValue(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function __emval_equals(first,second){first=Emval.toValue(first);second=Emval.toValue(second);return first==second}function emval_get_global(){if(typeof globalThis=="object"){return globalThis}return function(){return Function}()("return this")()}function __emval_get_global(name){if(name===0){return Emval.toHandle(emval_get_global())}else{name=getStringOrSymbol(name);return Emval.toHandle(emval_get_global()[name])}}function emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i>2],"parameter "+i)}return a}var emval_registeredMethods=[];function __emval_get_method_caller(argCount,argTypes){var types=emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var returnId=emval_registeredMethods[signatureName];if(returnId!==undefined){return returnId}var params=["retType"];var args=[retType];var argsList="";for(var i=0;i4){emval_handle_array[handle].refcount+=1}}function __emval_instanceof(object,constructor){object=Emval.toValue(object);constructor=Emval.toValue(constructor);return object instanceof constructor}function __emval_is_number(handle){handle=Emval.toValue(handle);return typeof handle=="number"}function __emval_is_string(handle){handle=Emval.toValue(handle);return typeof handle=="string"}function craftEmvalAllocator(argCount){var argsList="";for(var i=0;iHEAPU32;var functionBody="return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n"+" var HEAPU32 = getMemory();\n";for(var i=0;i>2)], 'parameter "+i+"');\n"+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"+"argTypes += 4;\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return valueToHandle(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","valueToHandle","getMemory",functionBody)(requireRegisteredType,Module,Emval.toHandle,getMemory)}var emval_newers={};function __emval_new(handle,argCount,argTypes,args){handle=Emval.toValue(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)}function __emval_new_array(){return Emval.toHandle([])}function __emval_new_cstring(v){return Emval.toHandle(getStringOrSymbol(v))}function __emval_new_object(){return Emval.toHandle({})}function __emval_run_destructors(handle){var destructors=Emval.toValue(handle);runDestructors(destructors);__emval_decref(handle)}function __emval_set_property(handle,key,value){handle=Emval.toValue(handle);key=Emval.toValue(key);value=Emval.toValue(value);handle[key]=value}function __emval_take_value(type,arg){type=requireRegisteredType(type,"_emval_take_value");var v=type["readValueFromPointer"](arg);return Emval.toHandle(v)}function readI53FromI64(ptr){return HEAPU32[ptr>>2]+HEAP32[ptr+4>>2]*4294967296}function __gmtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}var __MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var __MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];function __yday_from_date(date){var isLeapYear=__isLeapYear(date.getFullYear());var monthDaysCumulative=isLeapYear?__MONTH_DAYS_LEAP_CUMULATIVE:__MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday}function __localtime_js(time,tmPtr){var date=new Date(readI53FromI64(time)*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}function __mktime_js(tmPtr){var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=__yday_from_date(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();return date.getTime()/1e3|0}function allocateUTF8(str){var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8Array(str,HEAP8,ret,size);return ret}function __tzset_js(timezone,daylight,tzname){var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=allocateUTF8(winterName);var summerNamePtr=allocateUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}}function _abort(){abort("")}function _emscripten_date_now(){return Date.now()}function getHeapMax(){return 2147483648}var _emscripten_get_now;if(ENVIRONMENT_IS_NODE){_emscripten_get_now=()=>{var t=process["hrtime"]();return t[0]*1e3+t[1]/1e6}}else _emscripten_get_now=()=>performance.now();function emscripten_realloc_buffer(size){var b=wasmMemory.buffer;try{wasmMemory.grow(size-b.byteLength+65535>>>16);updateMemoryViews();return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}let alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;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 ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAPU32[penviron_buf_size>>2]=bufSize;return 0}function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doReadv(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){try{var offset=convertI32PairToI53Checked(offset_low,offset_high);if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?(Math.min(+Math.floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}function doWritev(stream,iov,iovcnt,offset){var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(typeof offset!=="undefined"){offset+=curr}}return ret}function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e instanceof FS.ErrnoError))throw e;return e.errno}}var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.staticInit();InternalError=Module["InternalError"]=extendError(Error,"InternalError");embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");init_ClassHandle();init_embind();init_RegisteredPointer();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");init_emval();var asmLibraryArg={"v":___cxa_throw,"U":___syscall_connect,"ea":___syscall_faccessat,"o":___syscall_fcntl64,"Z":___syscall_fstat64,"S":___syscall_ftruncate64,"K":___syscall_ioctl,"W":___syscall_lstat64,"X":___syscall_newfstatat,"G":___syscall_openat,"F":___syscall_socket,"Y":___syscall_stat64,"r":__embind_finalize_value_array,"ka":__embind_finalize_value_object,"T":__embind_register_bigint,"ga":__embind_register_bool,"e":__embind_register_class,"f":__embind_register_class_class_function,"g":__embind_register_class_constructor,"b":__embind_register_class_function,"a":__embind_register_class_property,"fa":__embind_register_emval,"i":__embind_register_enum,"d":__embind_register_enum_value,"M":__embind_register_float,"p":__embind_register_integer,"l":__embind_register_memory_view,"L":__embind_register_std_string,"B":__embind_register_std_wstring,"q":__embind_register_value_array,"ia":__embind_register_value_array_element,"ja":__embind_register_value_object,"N":__embind_register_value_object_field,"ha":__embind_register_void,"t":__emval_as,"la":__emval_call_method,"P":__emval_call_void_method,"c":__emval_decref,"Q":__emval_equals,"y":__emval_get_global,"C":__emval_get_method_caller,"E":__emval_get_module_property,"w":__emval_get_property,"m":__emval_incref,"D":__emval_instanceof,"na":__emval_is_number,"ma":__emval_is_string,"O":__emval_new,"n":__emval_new_array,"u":__emval_new_cstring,"k":__emval_new_object,"s":__emval_run_destructors,"j":__emval_set_property,"h":__emval_take_value,"aa":__gmtime_js,"ba":__localtime_js,"ca":__mktime_js,"da":__tzset_js,"z":_abort,"I":_emscripten_date_now,"H":_emscripten_get_now,"V":_emscripten_resize_heap,"_":_environ_get,"$":_environ_sizes_get,"x":_fd_close,"J":_fd_read,"R":_fd_seek,"A":_fd_write};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["pa"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["ra"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["sa"]).apply(null,arguments)};var ___errno_location=Module["___errno_location"]=function(){return(___errno_location=Module["___errno_location"]=Module["asm"]["ta"]).apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return(___getTypeName=Module["___getTypeName"]=Module["asm"]["ua"]).apply(null,arguments)};var __embind_initialize_bindings=Module["__embind_initialize_bindings"]=function(){return(__embind_initialize_bindings=Module["__embind_initialize_bindings"]=Module["asm"]["va"]).apply(null,arguments)};var _htons=Module["_htons"]=function(){return(_htons=Module["_htons"]=Module["asm"]["wa"]).apply(null,arguments)};var _ntohs=Module["_ntohs"]=function(){return(_ntohs=Module["_ntohs"]=Module["asm"]["xa"]).apply(null,arguments)};var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=function(){return(___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=Module["asm"]["ya"]).apply(null,arguments)};var dynCall_ji=Module["dynCall_ji"]=function(){return(dynCall_ji=Module["dynCall_ji"]=Module["asm"]["za"]).apply(null,arguments)};var dynCall_vij=Module["dynCall_vij"]=function(){return(dynCall_vij=Module["dynCall_vij"]=Module["asm"]["Aa"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["Ba"]).apply(null,arguments)};var calledRun;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();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()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); - - - return rhino3dm.ready -} -); -})(); -export default rhino3dm; \ No newline at end of file diff --git a/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.wasm b/docker-compose/requirements/nginx/static/javascript/taaaa/rhino3dm/rhino3dm.wasm deleted file mode 100644 index 7b305791acecfacadfd043262e90b0035c7abef4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2545991 zcmZ^K2S8Nmmgc>;0#OiYbGO|XS_SO3a?UvyGrJRN({pBOa?Z@Ye$Rx7AR;0P2E-h} zfH^DXgqScPh#ADJh_c_g1@?Qpv$v@Gr}LkD&L2vdN&oaWEW)tnmHuDR?ulY6=)WQA|0Ka5@Aw-+t7<~CU^9vDm#b*4H$3t&1-${_MVN`$$2zm#I zz%OIqgc}WlC5+T5M6KG{*q^baPnY3kxD@VjYIFLED8up1DNf`}l)TZTjcGkEu@5JN)J z3rYcci6l+nCjy2zAZ|pYTa+;u;E|B#h=*QLc;2BsGD=Jkcq`2U2(ihF&8vaf>DR|4 zU&i#qlOr?7A|S>h3`6|<`U_=Ld!6MAxuNa-8lOBzXv)%tu9nEG(TOZt>8qM!gB z3eet%M+#ux>O5OeR!nOkMj=W%i%ClArsT@Y3w=O&Kast7Df`&#OANr@YYe^uWMm3% zjlj-MVka^G1@Av%M&SL&i~#RHVMKUGnZLmMPnqF({~42p_n$K?-haU);{BIA%wI7H zsQ)!z{~Lbp-|{_w#|Y8?_e>Jr|G>}vM}G95`1e0EYV`jL7K%yizw&ecjmP}&d`~X_ z{txC`j9Qp@ysbQpjfb)GZwC+KWKuBd;$hs(e?{HHzrB2qkLSV9aOe;47=pZ{A$~N> zOOeB4`yD0~Fu%*g{}*1~|H@UO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