[
  {
    "path": ".github/FUNDING.yml",
    "content": "github: [mrdoob]\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2009-2016 stats.js authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "stats.js\n========\n\n#### JavaScript Performance Monitor ####\n\nThis class provides a simple info box that will help you monitor your code performance.\n\n* **FPS** Frames rendered in the last second. The higher the number the better.\n* **MS** Milliseconds needed to render a frame. The lower the number the better.\n* **MB** MBytes of allocated memory. (Run Chrome with `--enable-precise-memory-info`)\n* **CUSTOM** User-defined panel support.\n\n\n### Screenshots ###\n\n![fps.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/fps.png)\n![ms.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/ms.png)\n![mb.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/mb.png)\n![custom.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/custom.png)\n\n\n### Installation ###\n```bash\nnpm install stats.js\n```\n\n### Usage ###\n\n```javascript\nvar stats = new Stats();\nstats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom\ndocument.body.appendChild( stats.dom );\n\nfunction animate() {\n\n\tstats.begin();\n\n\t// monitored code goes here\n\n\tstats.end();\n\n\trequestAnimationFrame( animate );\n\n}\n\nrequestAnimationFrame( animate );\n```\n\n\n### Bookmarklet ###\n\nYou can add this code to any page using the following bookmarklet:\n\n```javascript\njavascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='https://mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})()\n```\n"
  },
  {
    "path": "bower.json",
    "content": "{\n\t\"name\": \"stats.js\",\n\t\"homepage\": \"https://github.com/mrdoob/stats.js\",\n\t\"description\": \"JavaScript Performance Monitor\",\n\t\"main\": \"build/stats.js\",\n\t\"keywords\": [\n\t\t\"stats\",\n\t\t\"statistics\",\n\t\t\"performance\",\n\t\t\"monitor\",\n\t\t\"fps\"\n\t],\n\t\"license\": \"MIT\",\n\t\"ignore\": [\n\t\t\"examples\",\n\t\t\"utils\",\n\t\t\"LICENSE\"\n\t]\n}\n"
  },
  {
    "path": "build/stats.js",
    "content": "(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.Stats = factory());\n}(this, (function () { 'use strict';\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.createElement( 'div' );\n\tcontainer.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n\tcontainer.addEventListener( 'click', function ( event ) {\n\n\t\tevent.preventDefault();\n\t\tshowPanel( ++ mode % container.children.length );\n\n\t}, false );\n\n\t//\n\n\tfunction addPanel( panel ) {\n\n\t\tcontainer.appendChild( panel.dom );\n\t\treturn panel;\n\n\t}\n\n\tfunction showPanel( id ) {\n\n\t\tfor ( var i = 0; i < container.children.length; i ++ ) {\n\n\t\t\tcontainer.children[ i ].style.display = i === id ? 'block' : 'none';\n\n\t\t}\n\n\t\tmode = id;\n\n\t}\n\n\t//\n\n\tvar beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n\tvar fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n\tvar msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n\tif ( self.performance && self.performance.memory ) {\n\n\t\tvar memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n\t}\n\n\tshowPanel( 0 );\n\n\treturn {\n\n\t\tREVISION: 16,\n\n\t\tdom: container,\n\n\t\taddPanel: addPanel,\n\t\tshowPanel: showPanel,\n\n\t\tbegin: function () {\n\n\t\t\tbeginTime = ( performance || Date ).now();\n\n\t\t},\n\n\t\tend: function () {\n\n\t\t\tframes ++;\n\n\t\t\tvar time = ( performance || Date ).now();\n\n\t\t\tmsPanel.update( time - beginTime, 200 );\n\n\t\t\tif ( time >= prevTime + 1000 ) {\n\n\t\t\t\tfpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n\t\t\t\tprevTime = time;\n\t\t\t\tframes = 0;\n\n\t\t\t\tif ( memPanel ) {\n\n\t\t\t\t\tvar memory = performance.memory;\n\t\t\t\t\tmemPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn time;\n\n\t\t},\n\n\t\tupdate: function () {\n\n\t\t\tbeginTime = this.end();\n\n\t\t},\n\n\t\t// Backwards Compatibility\n\n\t\tdomElement: container,\n\t\tsetMode: showPanel\n\n\t};\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n\tvar min = Infinity, max = 0, round = Math.round;\n\tvar PR = round( window.devicePixelRatio || 1 );\n\n\tvar WIDTH = 80 * PR, HEIGHT = 48 * PR,\n\t\t\tTEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n\t\t\tGRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n\t\t\tGRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n\tvar canvas = document.createElement( 'canvas' );\n\tcanvas.width = WIDTH;\n\tcanvas.height = HEIGHT;\n\tcanvas.style.cssText = 'width:80px;height:48px';\n\n\tvar context = canvas.getContext( '2d' );\n\tcontext.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n\tcontext.textBaseline = 'top';\n\n\tcontext.fillStyle = bg;\n\tcontext.fillRect( 0, 0, WIDTH, HEIGHT );\n\n\tcontext.fillStyle = fg;\n\tcontext.fillText( name, TEXT_X, TEXT_Y );\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\tcontext.fillStyle = bg;\n\tcontext.globalAlpha = 0.9;\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\treturn {\n\n\t\tdom: canvas,\n\n\t\tupdate: function ( value, maxValue ) {\n\n\t\t\tmin = Math.min( min, value );\n\t\t\tmax = Math.max( max, value );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 1;\n\t\t\tcontext.fillRect( 0, 0, WIDTH, GRAPH_Y );\n\t\t\tcontext.fillStyle = fg;\n\t\t\tcontext.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n\t\t\tcontext.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 0.9;\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n\t\t}\n\n\t};\n\n};\n\nreturn Stats;\n\n})));\n"
  },
  {
    "path": "build/stats.module.js",
    "content": "/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.createElement( 'div' );\n\tcontainer.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n\tcontainer.addEventListener( 'click', function ( event ) {\n\n\t\tevent.preventDefault();\n\t\tshowPanel( ++ mode % container.children.length );\n\n\t}, false );\n\n\t//\n\n\tfunction addPanel( panel ) {\n\n\t\tcontainer.appendChild( panel.dom );\n\t\treturn panel;\n\n\t}\n\n\tfunction showPanel( id ) {\n\n\t\tfor ( var i = 0; i < container.children.length; i ++ ) {\n\n\t\t\tcontainer.children[ i ].style.display = i === id ? 'block' : 'none';\n\n\t\t}\n\n\t\tmode = id;\n\n\t}\n\n\t//\n\n\tvar beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n\tvar fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n\tvar msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n\tif ( self.performance && self.performance.memory ) {\n\n\t\tvar memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n\t}\n\n\tshowPanel( 0 );\n\n\treturn {\n\n\t\tREVISION: 16,\n\n\t\tdom: container,\n\n\t\taddPanel: addPanel,\n\t\tshowPanel: showPanel,\n\n\t\tbegin: function () {\n\n\t\t\tbeginTime = ( performance || Date ).now();\n\n\t\t},\n\n\t\tend: function () {\n\n\t\t\tframes ++;\n\n\t\t\tvar time = ( performance || Date ).now();\n\n\t\t\tmsPanel.update( time - beginTime, 200 );\n\n\t\t\tif ( time >= prevTime + 1000 ) {\n\n\t\t\t\tfpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n\t\t\t\tprevTime = time;\n\t\t\t\tframes = 0;\n\n\t\t\t\tif ( memPanel ) {\n\n\t\t\t\t\tvar memory = performance.memory;\n\t\t\t\t\tmemPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn time;\n\n\t\t},\n\n\t\tupdate: function () {\n\n\t\t\tbeginTime = this.end();\n\n\t\t},\n\n\t\t// Backwards Compatibility\n\n\t\tdomElement: container,\n\t\tsetMode: showPanel\n\n\t};\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n\tvar min = Infinity, max = 0, round = Math.round;\n\tvar PR = round( window.devicePixelRatio || 1 );\n\n\tvar WIDTH = 80 * PR, HEIGHT = 48 * PR,\n\t\t\tTEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n\t\t\tGRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n\t\t\tGRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n\tvar canvas = document.createElement( 'canvas' );\n\tcanvas.width = WIDTH;\n\tcanvas.height = HEIGHT;\n\tcanvas.style.cssText = 'width:80px;height:48px';\n\n\tvar context = canvas.getContext( '2d' );\n\tcontext.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n\tcontext.textBaseline = 'top';\n\n\tcontext.fillStyle = bg;\n\tcontext.fillRect( 0, 0, WIDTH, HEIGHT );\n\n\tcontext.fillStyle = fg;\n\tcontext.fillText( name, TEXT_X, TEXT_Y );\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\tcontext.fillStyle = bg;\n\tcontext.globalAlpha = 0.9;\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\treturn {\n\n\t\tdom: canvas,\n\n\t\tupdate: function ( value, maxValue ) {\n\n\t\t\tmin = Math.min( min, value );\n\t\t\tmax = Math.max( max, value );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 1;\n\t\t\tcontext.fillRect( 0, 0, WIDTH, GRAPH_Y );\n\t\t\tcontext.fillStyle = fg;\n\t\t\tcontext.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n\t\t\tcontext.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 0.9;\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n\t\t}\n\n\t};\n\n};\n\nexport default Stats;\n"
  },
  {
    "path": "examples/basic.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - basic example</title>\n\t\t<meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\">\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0px;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<script src=\"../build/stats.min.js\"></script>\n\t\t<script>\n\n\t\t\tvar stats = new Stats();\n\t\t\tstats.showPanel( 1 );\n\t\t\tdocument.body.appendChild( stats.dom );\n\n\t\t\tvar canvas = document.createElement( 'canvas' );\n\t\t\tcanvas.width = 512;\n\t\t\tcanvas.height = 512;\n\t\t\tdocument.body.appendChild( canvas );\n\n\t\t\tvar context = canvas.getContext( '2d' );\n\t\t\tcontext.fillStyle = 'rgba(127,0,255,0.05)';\n\n\t\t\tfunction animate() {\n\n\t\t\t\tvar time = performance.now() / 1000;\n\n\t\t\t\tcontext.clearRect( 0, 0, 512, 512 );\n\n\t\t\t\tstats.begin();\n\n\t\t\t\tfor ( var i = 0; i < 2000; i ++ ) {\n\n\t\t\t\t\tvar x = Math.cos( time + i * 0.01 ) * 196 + 256;\n\t\t\t\t\tvar y = Math.sin( time + i * 0.01234 ) * 196 + 256;\n\n\t\t\t\t\tcontext.beginPath();\n\t\t\t\t\tcontext.arc( x, y, 10, 0, Math.PI * 2, true );\n\t\t\t\t\tcontext.fill();\n\n\t\t\t\t}\n\n\t\t\t\tstats.end();\n\n\t\t\t\trequestAnimationFrame( animate );\n\n\t\t\t}\n\n\t\t\tanimate();\n\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "examples/custom.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - custom panel example</title>\n\t\t<meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\">\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0px;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<script src=\"../build/stats.min.js\"></script>\n\t\t<script>\n\n\t\t\tvar stats = new Stats();\n\t\t\tvar xPanel = stats.addPanel( new Stats.Panel( 'x', '#ff8', '#221' ) );\n\t\t\tvar yPanel = stats.addPanel( new Stats.Panel( 'y', '#f8f', '#212' ) );\n\t\t\tstats.showPanel( 3 );\n\t\t\tdocument.body.appendChild( stats.dom );\n\n\t\t\tvar canvas = document.createElement( 'canvas' );\n\t\t\tcanvas.width = 512;\n\t\t\tcanvas.height = 512;\n\t\t\tdocument.body.appendChild( canvas );\n\n\t\t\tvar context = canvas.getContext( '2d' );\n\t\t\tcontext.fillStyle = 'rgba(127,0,255,0.05)';\n\n\t\t\tvar test = [];\n\n\t\t\tfunction animate() {\n\n\t\t\t\tvar time = performance.now() / 1000;\n\n\t\t\t\tcontext.clearRect( 0, 0, 512, 512 );\n\n\t\t\t\tstats.begin();\n\n\t\t\t\tfor ( var i = 0; i < 2000; i ++ ) {\n\n\t\t\t\t\tvar x = Math.cos( time + i * 0.01 ) * 196 + 256;\n\t\t\t\t\tvar y = Math.sin( time + i * 0.01234 ) * 196 + 256;\n\n\t\t\t\t\tcontext.beginPath();\n\t\t\t\t\tcontext.arc( x, y, 10, 0, Math.PI * 2, true );\n\t\t\t\t\tcontext.fill();\n\n\t\t\t\t}\n\n\t\t\t\tstats.end();\n\n\t\t\t\txPanel.update( x, 460 );\n\t\t\t\tyPanel.update( y, 460 );\n\n\t\t\t\trequestAnimationFrame( animate );\n\n\t\t\t}\n\n\t\t\tanimate();\n\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "examples/stress.html",
    "content": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>stats.js - stress test</title>\n\t\t<meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\">\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0px;\n\t\t\t\toverflow: hidden;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<script src=\"../build/stats.min.js\"></script>\n\t\t<script>\n\n\t\t\tvar array = [];\n\n\t\t\tfor ( var i = 0; i < 500; i ++ ) {\n\n\t\t\t\tvar stats = new Stats();\n\t\t\t\tstats.dom.style.position = 'relative';\n\t\t\t\tstats.dom.style.float = 'left';\n\t\t\t\tdocument.body.appendChild( stats.dom );\n\n\t\t\t\tarray.push( stats );\n\n\t\t\t}\n\n\t\t\tfunction animate() {\n\n\t\t\t\tfor ( var i = 0; i < array.length; i ++ ) {\n\n\t\t\t\t\tvar stats = array[ i ];\n\t\t\t\t\tstats.update();\n\n\t\t\t\t}\n\n\t\t\t\trequestAnimationFrame( animate );\n\n\t\t\t}\n\n\t\t\tanimate();\n\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"stats.js\",\n  \"version\": \"0.17.0\",\n  \"description\": \"JavaScript Performance Monitor\",\n  \"main\": \"build/stats.js\",\n  \"module\": \"build/stats.module.js\",\n  \"repository\": \"mrdoob/stats.js\",\n  \"directories\": {\n    \"example\": \"examples\"\n  },\n  \"files\": [\n    \"build\",\n    \"src\"\n  ],\n  \"scripts\": {\n    \"build\": \"rollup -c\",\n    \"build-closure\": \"rollup -c && google-closure-compiler --language_in=ECMASCRIPT5_STRICT --js build/stats.js --js_output_file build/stats.min.js\",\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"keywords\": [\n    \"performance\",\n    \"fps\",\n    \"stats\"\n  ],\n  \"author\": \"mrdoob\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/mrdoob/stats.js/issues\"\n  },\n  \"homepage\": \"https://github.com/mrdoob/stats.js\",\n  \"devDependencies\": {\n    \"rollup\": \"^2.3.2\",\n    \"google-closure-compiler\": \"20200224.0.0\"\n  }\n}\n"
  },
  {
    "path": "rollup.config.js",
    "content": "export default {\n\tinput: 'src/Stats.js',\n\toutput: [\n\t\t{\n\t\t\tformat: 'umd',\n\t\t\tname: 'Stats',\n\t\t\tfile: 'build/stats.js',\n\t\t\tindent: '\\t'\n\t\t},\n\t\t{\n\t\t\tformat: 'es',\n\t\t\tname: 'Stats',\n\t\t\tfile: 'build/stats.module.js',\n\t\t\tindent: '\\t'\n\t\t}\n\t]\n};\n"
  },
  {
    "path": "src/Stats.js",
    "content": "/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nvar Stats = function () {\n\n\tvar mode = 0;\n\n\tvar container = document.createElement( 'div' );\n\tcontainer.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';\n\tcontainer.addEventListener( 'click', function ( event ) {\n\n\t\tevent.preventDefault();\n\t\tshowPanel( ++ mode % container.children.length );\n\n\t}, false );\n\n\t//\n\n\tfunction addPanel( panel ) {\n\n\t\tcontainer.appendChild( panel.dom );\n\t\treturn panel;\n\n\t}\n\n\tfunction showPanel( id ) {\n\n\t\tfor ( var i = 0; i < container.children.length; i ++ ) {\n\n\t\t\tcontainer.children[ i ].style.display = i === id ? 'block' : 'none';\n\n\t\t}\n\n\t\tmode = id;\n\n\t}\n\n\t//\n\n\tvar beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;\n\n\tvar fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );\n\tvar msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );\n\n\tif ( self.performance && self.performance.memory ) {\n\n\t\tvar memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );\n\n\t}\n\n\tshowPanel( 0 );\n\n\treturn {\n\n\t\tREVISION: 16,\n\n\t\tdom: container,\n\n\t\taddPanel: addPanel,\n\t\tshowPanel: showPanel,\n\n\t\tbegin: function () {\n\n\t\t\tbeginTime = ( performance || Date ).now();\n\n\t\t},\n\n\t\tend: function () {\n\n\t\t\tframes ++;\n\n\t\t\tvar time = ( performance || Date ).now();\n\n\t\t\tmsPanel.update( time - beginTime, 200 );\n\n\t\t\tif ( time >= prevTime + 1000 ) {\n\n\t\t\t\tfpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );\n\n\t\t\t\tprevTime = time;\n\t\t\t\tframes = 0;\n\n\t\t\t\tif ( memPanel ) {\n\n\t\t\t\t\tvar memory = performance.memory;\n\t\t\t\t\tmemPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn time;\n\n\t\t},\n\n\t\tupdate: function () {\n\n\t\t\tbeginTime = this.end();\n\n\t\t},\n\n\t\t// Backwards Compatibility\n\n\t\tdomElement: container,\n\t\tsetMode: showPanel\n\n\t};\n\n};\n\nStats.Panel = function ( name, fg, bg ) {\n\n\tvar min = Infinity, max = 0, round = Math.round;\n\tvar PR = round( window.devicePixelRatio || 1 );\n\n\tvar WIDTH = 80 * PR, HEIGHT = 48 * PR,\n\t\t\tTEXT_X = 3 * PR, TEXT_Y = 2 * PR,\n\t\t\tGRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,\n\t\t\tGRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;\n\n\tvar canvas = document.createElement( 'canvas' );\n\tcanvas.width = WIDTH;\n\tcanvas.height = HEIGHT;\n\tcanvas.style.cssText = 'width:80px;height:48px';\n\n\tvar context = canvas.getContext( '2d' );\n\tcontext.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';\n\tcontext.textBaseline = 'top';\n\n\tcontext.fillStyle = bg;\n\tcontext.fillRect( 0, 0, WIDTH, HEIGHT );\n\n\tcontext.fillStyle = fg;\n\tcontext.fillText( name, TEXT_X, TEXT_Y );\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\tcontext.fillStyle = bg;\n\tcontext.globalAlpha = 0.9;\n\tcontext.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );\n\n\treturn {\n\n\t\tdom: canvas,\n\n\t\tupdate: function ( value, maxValue ) {\n\n\t\t\tmin = Math.min( min, value );\n\t\t\tmax = Math.max( max, value );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 1;\n\t\t\tcontext.fillRect( 0, 0, WIDTH, GRAPH_Y );\n\t\t\tcontext.fillStyle = fg;\n\t\t\tcontext.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );\n\n\t\t\tcontext.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );\n\n\t\t\tcontext.fillStyle = bg;\n\t\t\tcontext.globalAlpha = 0.9;\n\t\t\tcontext.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );\n\n\t\t}\n\n\t};\n\n};\n\nexport { Stats as default };\n"
  }
]