Transaction

aa37f3028ef145c606e37096a68df7a835fb4e049f89e79a2c3dff9295646044
( - )
255,266
2019-07-09 10:30:17
1
95,287 B

2 Outputs

Total Output:
  • j"1ChDHzdd1H4wSjgGMHyndZm6qxEDGjqpJLNsin(1/r)/(2*Math.PI),r*Math.pow(2,-10*n)*Math.sin((n-t)*(2*Math.PI)/i)+1)},InOut:function(n){var t,r=.1,i=.4;return 0===n?0:1===n?1:(!r||r<1?(r=1,t=i/4):t=i*Math.asin(1/r)/(2*Math.PI),(n*=2)<1?-.5*(r*Math.pow(2,10*(n-=1))*Math.sin((n-t)*(2*Math.PI)/i)):r*Math.pow(2,-10*(n-=1))*Math.sin((n-t)*(2*Math.PI)/i)*.5+1)}},Back:{In:function(n){var t=1.70158;return n*n*((t+1)*n-t)},Out:function(n){var t=1.70158;return--n*n*((t+1)*n+t)+1},InOut:function(n){var t=2.5949095;return(n*=2)<1?.5*(n*n*((t+1)*n-t)):.5*((n-=2)*n*((t+1)*n+t)+2)}},Bounce:{In:function(n){return 1-TWEEN.Easing.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?.5*TWEEN.Easing.Bounce.In(2*n):.5*TWEEN.Easing.Bounce.Out(2*n-1)+.5}}},TWEEN.Interpolation={Linear:function(n,t){var r=n.length-1,i=r*t,u=Math.floor(i),e=TWEEN.Interpolation.Utils.Linear;return t<0?e(n[0],n[1],i):t>1?e(n[r],n[r-1],r-i):e(n[u],n[u+1>r?r:u+1],i-u)},Bezier:function(n,t){var r,i=0,u=n.length-1,e=Math.pow,o=TWEEN.Interpolation.Utils.Bernstein;for(r=0;r<=u;r++)i+=e(1-t,u-r)*e(t,r)*n[r]*o(u,r);return i},CatmullRom:function(n,t){var r=n.length-1,i=r*t,u=Math.floor(i),e=TWEEN.Interpolation.Utils.CatmullRom;return n[0]===n[r]?(t<0&&(u=Math.floor(i=r*(1+t))),e(n[(u-1+r)%r],n[u],n[(u+1)%r],n[(u+2)%r],i-u)):t<0?n[0]-(e(n[0],n[0],n[1],n[1],-i)-n[0]):t>1?n[r]-(e(n[r],n[r],n[r-1],n[r-1],i-r)-n[r]):e(n[u?u-1:0],n[u],n[r<u+1?r:u+1],n[r<u+2?r:u+2],i-u)},Utils:{Linear:function(n,t,r){return(t-n)*r+n},Bernstein:function(n,t){var r=TWEEN.Interpolation.Utils.Factorial;return r(n)/r(t)/r(n-t)},Factorial:function(){var n=[1];return function(t){var r,i=1;if(n[t])return n[t];for(r=t;r>1;r--)i*=r;return n[t]=i}}(),CatmullRom:function(n,t,r,i,u){var e=.5*(r-n),o=.5*(i-t),a=u*u,f=u*a;return(2*t-2*r+e+o)*f+(-3*t+3*r-2*e-o)*a+e*u+t}}},function(n){"function"==typeof define&&define.amd?define([],function(){return TWEEN}):"object"==typeof exports?module.exports=TWEEN:n.TWEEN=TWEEN}(this); },{}],50:[function(_dereq_,module,exports){ (function (global){ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,i.WebVRPolyfill=e()}}(function(){return function e(i,t,M){function s(r,n){if(!t[r]){if(!i[r]){var u="function"==typeof _dereq_&&_dereq_;if(!n&&u)return u(r,!0);if(A)return A(r,!0);var N=new Error("Cannot find module '"+r+"'");throw N.code="MODULE_NOT_FOUND",N}var a=t[r]={exports:{}};i[r][0].call(a.exports,function(e){var t=i[r][1][e];return s(t?t:e)},a,a.exports,e,i,t,M)}return t[r].exports}for(var A="function"==typeof _dereq_&&_dereq_,r=0;r<M.length;r++)s(M[r]);return s}({1:[function(e,i,t){"use strict";function M(){}function s(e,i,t){this.fn=e,this.context=i,this.once=t||!1}function A(){this._events=new M,this._eventsCount=0}var r=Object.prototype.hasOwnProperty,n="~";Object.create&&(M.prototype=Object.create(null),(new M).__proto__||(n=!1)),A.prototype.eventNames=function(){var e,i,t=[];if(0===this._eventsCount)return t;for(i in e=this._events)r.call(e,i)&&t.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t},A.prototype.listeners=function(e,i){var t=n?n+e:e,M=this._events[t];if(i)return!!M;if(!M)return[];if(M.fn)return[M.fn];for(var s=0,A=M.length,r=new Array(A);s<A;s++)r[s]=M[s].fn;return r},A.prototype.emit=function(e,i,t,M,s,A){var r=n?n+e:e;if(!this._events[r])return!1;var u,N,a=this._events[r],D=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),D){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,i),!0;case 3:return a.fn.call(a.context,i,t),!0;case 4:return a.fn.call(a.context,i,t,M),!0;case 5:return a.fn.call(a.context,i,t,M,s),!0;case 6:return a.fn.call(a.context,i,t,M,s,A),!0}for(N=1,u=new Array(D-1);N<D;N++)u[N-1]=arguments[N];a.fn.apply(a.context,u)}else{var o,g=a.length;for(N=0;N<g;N++)switch(a[N].once&&this.removeListener(e,a[N].fn,void 0,!0),D){case 1:a[N].fn.call(a[N].context);break;case 2:a[N].fn.call(a[N].context,i);break;case 3:a[N].fn.call(a[N].context,i,t);break;case 4:a[N].fn.call(a[N].context,i,t,M);break;default:if(!u)for(o=1,u=new Array(D-1);o<D;o++)u[o-1]=arguments[o];a[N].fn.apply(a[N].context,u)}}return!0},A.prototype.on=function(e,i,t){var M=new s(i,t||this),A=n?n+e:e;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],M]:this._events[A].push(M):(this._events[A]=M,this._eventsCount++),this},A.prototype.once=function(e,i,t){var M=new s(i,t||this,!0),A=n?n+e:e;return this._events[A]?this._events[A].fn?this._events[A]=[this._events[A],M]:this._events[A].push(M):(this._events[A]=M,this._eventsCount++),this},A.prototype.removeListener=function(e,i,t,s){var A=n?n+e:e;if(!this._events[A])return this;if(!i)return 0===--this._eventsCount?this._events=new M:delete this._events[A],this;var r=this._events[A];if(r.fn)r.fn!==i||s&&!r.once||t&&r.context!==t||(0===--this._eventsCount?this._events=new M:delete this._events[A]);else{for(var u=0,N=[],a=r.length;u<a;u++)(r[u].fn!==i||s&&!r[u].once||t&&r[u].context!==t)&&N.push(r[u]);N.length?this._events[A]=1===N.length?N[0]:N:0===--this._eventsCount?this._events=new M:delete this._events[A]}return this},A.prototype.removeAllListeners=function(e){var i;return e?(i=n?n+e:e,this._events[i]&&(0===--this._eventsCount?this._events=new M:delete this._events[i])):(this._events=new M,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prototype.setMaxListeners=function(){return this},A.prefixed=n,A.EventEmitter=A,"undefined"!=typeof i&&(i.exports=A)},{}],2:[function(e,i,t){"use strict";function M(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function s(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var i={},t=0;t<10;t++)i["_"+String.fromCharCode(t)]=t;var M=Object.getOwnPropertyNames(i).map(function(e){return i[e]});if("0123456789"!==M.join(""))return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(e){s[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},s)).join("")}catch(e){return!1}}var A=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;i.exports=s()?Object.assign:function(e,i){for(var t,s,n=M(e),u=1;u<arguments.length;u++){t=Object(arguments[u]);for(var N in t)A.call(t,N)&&(n[N]=t[N]);if(Object.getOwnPropertySymbols){s=Object.getOwnPropertySymbols(t);for(var a=0;a<s.length;a++)r.call(t,s[a])&&(n[s[a]]=t[s[a]])}}return n}},{}],3:[function(e,i,t){function M(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function s(){this.isPolyfilled=!0,this.displayId=a++,this.displayName="webvr-polyfill displayName",this.depthNear=.01,this.depthFar=1e4,this.isConnected=!0,this.isPresenting=!1,this.capabilities={hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1},this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,this.wakelock_=new N}function A(){this.isPolyfilled=!0,this.hardwareUnitId="webvr-polyfill hardwareUnitId",this.deviceId="webvr-polyfill deviceId",this.deviceName="webvr-polyfill deviceName"}function r(){}function n(){}var u=e("./util.js"),N=e("./wakelock.js"),a=1e3,D=!1,o=[0,0,.5,1],g=[.5,0,.5,1];s.prototype.getFrameData=function(e){return u.frameDataFromPose(e,this.getPose(),this)},s.prototype.getPose=function(){return this.getImmediatePose()},s.prototype.requestAnimationFrame=function(e){return window.requestAnimationFrame(e)},s.prototype.cancelAnimationFrame=function(e){return window.cancelAnimationFrame(e)},s.prototype.wrapForFullscreen=function(e){function i(){if(s.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];s.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}if(u.isIOS())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;this.removeFullscreenWrapper(),this.fullscreenElement_=e;var M=this.fullscreenElement_.parentElement;M.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),M.removeChild(this.fullscreenElement_),this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var s=this;return i(),this.fullscreenWrapper_},s.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var i=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),i.insertBefore(e,this.fullscreenWrapper_),i.removeChild(this.fullscreenWrapper_),e}},s.prototype.requestPresent=function(e){var i=this.isPresenting,t=this;return e instanceof Array||(D||(console.warn("Using a deprecated form of requestPresent. Should pass in an array of VRLayers."),D=!0),e=[e]),new Promise(function(M,s){function A(){var e=u.getFullscreenElement();t.isPresenting=L===e,t.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch(function(e){console.error("screen.orientation.lock() failed due to",e.message)}),t.waitingForPresent_=!1,t.beginPresent_(),M()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),t.removeFullscreenWrapper(),t.wakelock_.release(),t.endPresent_(),t.removeFullscreenListeners_()),t.fireVRDisplayPresentChange_()}function r(){t.waitingForPresent_&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.wakelock_.release(),t.waitingForPresent_=!1,t.isPresenting=!1,s(new Error("Unable to present.")))}if(!t.capabilities.canPresent)return void s(new Error("VRDisplay is not capable of presenting."));if(0==e.length||e.length>t.capabilities.maxLayers)return void s(new Error("Invalid number of layers."));var n=e[0];if(!n.source)return void M();var N=n.leftBounds||o,a=n.rightBounds||g;if(i){var D=t.layer_;D.source!==n.source&&(D.source=n.source);for(var j=0;j<4;j++)D.leftBounds[j]!==N[j]&&(D.leftBounds[j]=N[j]),D.rightBounds[j]!==a[j]&&(D.rightBounds[j]=a[j]);return void M()}if(t.layer_={predistorted:n.predistorted,source:n.source,leftBounds:N.slice(0),rightBounds:a.slice(0)},t.waitingForPresent_=!1,t.layer_&&t.layer_.source){var L=t.wrapForFullscreen(t.layer_.source);t.addFullscreenListeners_(L,A,r),u.requestFullscreen(L)?(t.wakelock_.request(),t.waitingForPresent_=!0):(u.isIOS()||u.isWebViewAndroid())&&(t.wakelock_.request(),t.isPresenting=!0,t.beginPresent_(),t.fireVRDisplayPresentChange_(),M())}t.waitingForPresent_||u.isIOS()||(u.exitFullscreen(),s(new Error("Unable to present.")))})},s.prototype.exitPresent=function(){var e=this.isPresenting,i=this;return this.isPresenting=!1,this.layer_=null,this.wakelock_.release(),new Promise(function(t,M){e?(!u.exitFullscreen()&&u.isIOS()&&(i.endPresent_(),i.fireVRDisplayPresentChange_()),u.isWebViewAndroid()&&(i.removeFullscreenWrapper(),i.removeFullscreenListeners_(),i.endPresent_(),i.fireVRDisplayPresentChange_()),t()):M(new Error("Was not presenting to VRDisplay."))})},s.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},s.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},s.prototype.addFullscreenListeners_=function(e,i,t){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=i,this.fullscreenErrorHandler_=t,i&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",i,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",i,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",i,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",i,!1)),t&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",t,!1))},s.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var i=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",i,!1),e.removeEventListener("webkitfullscreenchange",i,!1),document.removeEventListener("mozfullscreenchange",i,!1),e.removeEventListener("msfullscreenchange",i,!1)}if(this.fullscreenErrorHandler_){var t=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",t,!1),e.removeEventListener("webkitfullscreenerror",t,!1),document.removeEventListener("mozfullscreenerror",t,!1),e.removeEventListener("msfullscreenerror",t,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},s.prototype.beginPresent_=function(){},s.prototype.endPresent_=function(){},s.prototype.submitFrame=function(e){},s.prototype.getEyeParameters=function(e){return null},r.prototype=new A,n.prototype=new A,i.exports.VRFrameData=M,i.exports.VRDisplay=s,i.exports.VRDevice=A,i.exports.HMDVRDevice=r,i.exports.PositionSensorVRDevice=n},{"./util.js":23,"./wakelock.js":25}],4:[function(e,i,t){function M(e){this.gl=e,this.ctxAttribs=e.getContextAttributes(),this.meshWidth=20,this.meshHeight=20,this.bufferScale=WebVRConfig.BUFFER_SCALE,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,A.isIOS()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=A.linkProgram(e,n,u,this.attribs),this.uniforms=A.getProgramUniforms(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize(),WebVRConfig.CARDBOARD_UI_DISABLED||(this.cardboardUI=new s(e))}var s=e("./cardboard-ui.js"),A=e("./util.js"),r=e("./deps/wglu-preserve-state.js"),n=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),u=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");M.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},M.prototype.onResize=function(){var e=this.gl,i=this,t=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];r(e,t,function(e){i.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),i.scissorTest&&i.realDisable.call(e,e.SCISSOR_TEST),i.realColorMask.call(e,!0,!0,!0,!0),i.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),i.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),i.realBindFramebuffer.call(e,e.FRAMEBUFFER,i.framebuffer),e.bindTexture(e.TEXTURE_2D,i.renderTarget),e.texImage2D(e.TEXTURE_2D,0,i.ctxAttribs.alpha?e.RGBA:e.RGB,i.bufferWidth,i.bufferHeight,0,i.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,i.renderTarget,0),i.ctxAttribs.depth&&i.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,i.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.bufferWidth,i.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i.depthStencilBuffer)):i.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,i.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i.bufferWidth,i.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,i.depthBuffer)):i.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,i.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,i.bufferWidth,i.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,i.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),i.realBindFramebuffer.call(e,e.FRAMEBUFFER,i.lastBoundFramebuffer),i.scissorTest&&i.realEnable.call(e,e.SCISSOR_TEST),i.realColorMask.apply(e,i.colorMask),i.realViewport.apply(e,i.viewport),i.realClearColor.apply(e,i.clearColor)}),this.cardboardUI&&this.cardboardUI.onResize()},M.prototype.patch=function(){if(!this.isPatched){var e=this,i=this.gl.canvas,t=this.gl;A.isIOS()||(i.width=A.getScreenWidth()*this.bufferScale,i.height=A.getScreenHeight()*this.bufferScale,Object.defineProperty(i,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(t){e.bufferWidth=t,e.realCanvasWidth.set.call(i,t),e.onResize()}}),Object.defineProperty(i,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(t){e.bufferHeight=t,e.realCanvasHeight.set.call(i,t),e.onResize()}})),this.lastBoundFramebuffer=t.getParameter(t.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(i,M){e.lastBoundFramebuffer=M?M:e.framebuffer,e.realBindFramebuffer.call(t,i,e.lastBoundFramebuffer)},this.cullFace=t.getParameter(t.CULL_FACE),this.depthTest=t.getParameter(t.DEPTH_TEST),this.blend=t.getParameter(t.BLEND),this.scissorTest=t.getParameter(t.SCISSOR_TEST),this.stencilTest=t.getParameter(t.STENCIL_TEST),t.enable=function(i){switch(i){case t.CULL_FACE:e.cullFace=!0;break;case t.DEPTH_TEST:e.depthTest=!0;break;case t.BLEND:e.blend=!0;break;case t.SCISSOR_TEST:e.scissorTest=!0;break;case t.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(t,i)},t.disable=function(i){switch(i){case t.CULL_FACE:e.cullFace=!1;break;case t.DEPTH_TEST:e.depthTest=!1;break;case t.BLEND:e.blend=!1;break;case t.SCISSOR_TEST:e.scissorTest=!1;break;case t.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(t,i)},this.colorMask=t.getParameter(t.COLOR_WRITEMASK),t.colorMask=function(i,M,s,A){e.colorMask[0]=i,e.colorMask[1]=M,e.colorMask[2]=s,e.colorMask[3]=A,e.realColorMask.call(t,i,M,s,A)},this.clearColor=t.getParameter(t.COLOR_CLEAR_VALUE),t.clearColor=function(i,M,s,A){e.clearColor[0]=i,e.clearColor[1]=M,e.clearColor[2]=s,e.clearColor[3]=A,e.realClearColor.call(t,i,M,s,A)},this.viewport=t.getParameter(t.VIEWPORT),t.viewport=function(i,M,s,A){e.viewport[0]=i,e.viewport[1]=M,e.viewport[2]=s,e.viewport[3]=A,e.realViewport.call(t,i,M,s,A)},this.isPatched=!0,A.safariCssSizeWorkaround(i)}},M.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,i=this.gl.canvas;A.isIOS()||(Object.defineProperty(i,"width",this.realCanvasWidth),Object.defineProperty(i,"height",this.realCanvasHeight)),i.width=this.bufferWidth,i.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout(function(){A.safariCssSizeWorkaround(i)},1)}},M.prototype.setTextureBounds=function(e,i){e||(e=[0,0,.5,1]),i||(i=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=i[0],this.viewportOffsetScale[5]=i[1],this.viewportOffsetScale[6]=i[2],this.viewportOffsetScale[7]=i[3]},M.prototype.submitFrame=function(){var e=this.gl,i=this,t=[];if(WebVRConfig.DIRTY_SUBMIT_FRAME_BINDINGS||t.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),r(e,t,function(e){i.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),i.cullFace&&i.realDisable.call(e,e.CULL_FACE),i.depthTest&&i.realDisable.call(e,e.DEPTH_TEST),i.blend&&i.realDisable.call(e,e.BLEND),i.scissorTest&&i.realDisable.call(e,e.SCISSOR_TEST),i.stencilTest&&i.realDisable.call(e,e.STENCIL_TEST),i.realColorMask.call(e,!0,!0,!0,!0),i.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(i.ctxAttribs.alpha||A.isIOS())&&(i.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(i.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,i.vertexBuffer),e.enableVertexAttribArray(i.attribs.position),e.enableVertexAttribArray(i.attribs.texCoord),e.vertexAttribPointer(i.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(i.attribs.texCoord,3,e.FLOAT,!1,20,8),e.activeTexture(e.TEXTURE0),e.uniform1i(i.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,i.renderTarget),e.uniform4fv(i.uniforms.viewportOffsetScale,i.viewportOffsetScale),e.drawElements(e.TRIANGLES,i.indexCount,e.UNSIGNED_SHORT,0),i.cardboardUI&&i.cardboardUI.renderNoState(),i.realBindFramebuffer.call(i.gl,e.FRAMEBUFFER,i.framebuffer),i.ctxAttribs.preserveDrawingBuffer||(i.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),WebVRConfig.DIRTY_SUBMIT_FRAME_BINDINGS||i.realBindFramebuffer.call(e,e.FRAMEBUFFER,i.lastBoundFramebuffer),i.cullFace&&i.realEnable.call(e,e.CULL_FACE),i.depthTest&&i.realEnable.call(e,e.DEPTH_TEST),i.blend&&i.realEnable.call(e,e.BLEND),i.scissorTest&&i.realEnable.call(e,e.SCISSOR_TEST),i.stencilTest&&i.realEnable.call(e,e.STENCIL_TEST),i.realColorMask.apply(e,i.colorMask),i.realViewport.apply(e,i.viewport),!i.ctxAttribs.alpha&&i.ctxAttribs.preserveDrawingBuffer||i.realClearColor.apply(e,i.clearColor)}),A.isIOS()){var M=e.canvas;M.width==i.bufferWidth&&M.height==i.bufferHeight||(i.bufferWidth=M.width,i.bufferHeight=M.height,i.onResize())}},M.prototype.updateDeviceInfo=function(e){var i=this.gl,t=this,M=[i.ARRAY_BUFFER_BINDING,i.ELEMENT_ARRAY_BUFFER_BINDING];r(i,M,function(i){var M=t.computeMeshVertices_(t.meshWidth,t.meshHeight,e);if(i.bindBuffer(i.ARRAY_BUFFER,t.vertexBuffer),i.bufferData(i.ARRAY_BUFFER,M,i.STATIC_DRAW),!t.indexCount){var s=t.computeMeshIndices_(t.meshWidth,t.meshHeight);i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t.indexBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),t.indexCount=s.length}})},M.prototype.computeMeshVertices_=function(e,i,t){for(var M=new Float32Array(2*e*i*5),s=t.getLeftEyeVisibleTanAngles(),r=t.getLeftEyeNoLensTanAngles(),n=t.getLeftEyeVisibleScreenRect(r),u=0,N=0;N<2;N++){for(var a=0;a<i;a++)for(var D=0;D<e;D++,u++){var o=D/(e-1),g=a/(i-1),j=o,L=g,c=A.lerp(s[0],s[2],o),I=A.lerp(s[3],s[1],g),T=Math.sqrt(c*c+I*I),w=t.distortion.distortInverse(T),y=c*w/T,E=I*w/T;o=(y-r[0])/(r[2]-r[0]),g=(E-r[3])/(r[1]-r[3]);t.device.widthMeters/t.device.heightMeters;o=2*(n.x+o*n.width-.5),g=2*(n.y+g*n.height-.5),M[5*u+0]=o,M[5*u+1]=g,M[5*u+2]=j,M[5*u+3]=L,M[5*u+4]=N}var d=s[2]-s[0];s[0]=-(d+s[0]),s[2]=d-s[2],d=r[2]-r[0],r[0]=-(d+r[0]),r[2]=d-r[2],n.x=1-(n.x+n.width)}return M},M.prototype.computeMeshIndices_=function(e,i){for(var t=new Uint16Array(2*(e-1)*(i-1)*6),M=e/2,s=i/2,A=0,r=0,n=0;n<2;n++)for(var u=0;u<i;u++)for(var N=0;N<e;N++,A++)0!=N&&0!=u&&(N<=M==u<=s?(t[r++]=A,t[r++]=A-e-1,t[r++]=A-e,t[r++]=A-e-1,t[r++]=A,t[r++]=A-1):(t[r++]=A-1,t[r++]=A-e,t[r++]=A,t[r++]=A-e,t[r++]=A-1,t[r++]=A-e-1));return t},M.prototype.getOwnPropertyDescriptor_=function(e,i){var t=Object.getOwnPropertyDescriptor(e,i);return void 0!==t.get&&void 0!==t.set||(t.configurable=!0,t.enumerable=!0,t.get=function(){return this.getAttribute(i)},t.set=function(e){this.setAttribute(i,e)}),t},i.exports=M},{"./cardboard-ui.js":5,"./deps/wglu-preserve-state.js":7,"./util.js":23}],5:[function(e,i,t){function M(e){this.gl=e,this.attribs={position:0},this.program=s.linkProgram(e,r,n,this.attribs),this.uniforms=s.getProgramUniforms(e,this.program),this.vertexBuffer=e.createBuffer(),this.gearOffset=0,this.gearVertexCount=0,this.arrowOffset=0,this.arrowVertexCount=0,this.projMat=new Float32Array(16),this.listener=null,this.onResize()}var s=e("./util.js"),A=e("./deps/wglu-preserve-state.js"),r=["attribute vec2 position;","uniform mat4 projectionMat;","void main() {"," gl_Position = projectionMat * vec4( position, -1.0, 1.0 );","}"].join("\n"),n=["precision mediump float;","uniform vec4 color;","void main() {"," gl_FragColor = color;","}"].join("\n"),u=Math.PI/180,N=60,a=12,D=20,o=1,g=.75,j=.3125,L=4,c=28,I=1.5;M.prototype.destroy=function(){var e=this.gl;this.listener&&e.canvas.removeEventListener("click",this.listener,!1),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer)},M.prototype.listen=function(e,i){var t=this.gl.canvas;this.listener=function(M){var s=t.clientWidth/2,A=c*I;M.clientX>s-A&&M.clientX<s+A&&M.clientY>t.clientHeight-A?e(M):M.clientX<A&&M.clientY<A&&i(M)},t.addEventListener("click",this.listener,!1)},M.prototype.onResize=function(){var e=this.gl,i=this,t=[e.ARRAY_BUFFER_BINDING];A(e,t,function(e){function t(e,i){var t=(90-e)*u,M=Math.cos(t),s=Math.sin(t);A.push(j*M*y+r,j*s*y+y),A.push(i*M*y+r,i*s*y+y)}function M(i,t){A.push(E+i,e.drawingBufferHeight-E-t)}var A=[],r=e.drawingBufferWidth/2,n=e.drawingBufferWidth/(screen.width*window.devicePixelRatio);s.isIOS()||(n*=window.devicePixelRatio);var T=L*n/2,w=c*I*n,y=c*n/2,E=(c*I-c)*n;A.push(r-T,w),A.push(r-T,e.drawingBufferHeight),A.push(r+T,w),A.push(r+T,e.drawingBufferHeight),i.gearOffset=A.length/2;for(var d=0;d<=6;d++){var l=d*N;t(l,o),t(l+a,o),t(l+D,g),t(l+(N-D),g),t(l+(N-a),o)}i.gearVertexCount=A.length/2-i.gearOffset,i.arrowOffset=A.length/2;var h=T/Math.sin(45*u);M(0,y),M(y,0),M(y+h,h),M(h,y+h),M(h,y-h),M(0,y),M(y,2*y),M(y+h,2*y-h),M(h,y-h),M(0,y),M(h,y-T),M(c*n,y-T),M(h,y+T),M(c*n,y+T),i.arrowVertexCount=A.length/2-i.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,i.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(A),e.STATIC_DRAW)})},M.prototype.render=function(){var e=this.gl,i=this,t=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];A(e,t,function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),i.renderNoState()})},M.prototype.renderNoState=function(){var e=this.gl;e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,this.vertexBuffer),e.enableVertexAttribArray(this.attribs.position),e.vertexAttribPointer(this.attribs.position,2,e.FLOAT,!1,8,0),e.uniform4f(this.uniforms.color,1,1,1,1),s.orthoMatrix(this.projMat,0,e.drawingBufferWidth,0,e.drawingBufferHeight,.1,1024),e.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),e.drawArrays(e.TRIANGLE_STRIP,0,4),e.drawArrays(e.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),e.drawArrays(e.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},i.exports=M},{"./deps/wglu-preserve-state.js":7,"./util.js":23}],6:[function(e,i,t){function M(){this.displayName="Cardboard VRDisplay (webvr-polyfill)",this.capabilities.hasOrientation=!0,this.capabilities.canPresent=!0,this.bufferScale_=WebVRConfig.BUFFER_SCALE,this.poseSensor_=new u,this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new n(!0,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new r(this.dpdb_.getDeviceParams()),this.viewerSelector_=new a,this.viewerSelector_.on("change",this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),WebVRConfig.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new N),o.isIOS()&&window.addEventListener("resize",this.onResize_.bind(this))}var s=e("./cardboard-distorter.js"),A=e("./cardboard-ui.js"),r=e("./device-info.js"),n=e("./dpdb/dpdb.js"),u=e("./sensor-fusion/fusion-pose-sensor.js"),N=e("./rotate-instructions.js"),a=e("./viewer-selector.js"),D=e("./base.js").VRDisplay,o=e("./util.js"),g={LEFT:"left",RIGHT:"right"};M.prototype=new D,M.prototype.getImmediatePose=function(){return{position:this.poseSensor_.getPosition(),orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},M.prototype.resetPose=function(){this.poseSensor_.resetPose()},M.prototype.getEyeParameters=function(e){var i,t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0];if(e==g.LEFT)t[0]*=-1,i=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=g.RIGHT)return console.error("Invalid eye provided: %s",e),null;i=this.deviceInfo_.getFieldOfViewRightEye()}return{fieldOfView:i,offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_}},M.prototype.onDeviceParamsUpdated_=function(e){o.isDebug()&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},M.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},M.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?WebVRConfig.CARDBOARD_UI_DISABLED||(e.canvas.width=o.getScreenWidth()*this.bufferScale_,e.canvas.height=o.getScreenHeight()*this.bufferScale_,this.cardboardUI_=new A(e)):(this.distorter_=new s(e),this.distorter_.updateDeviceInfo(this.deviceInfo_),this.cardboardUI_=this.distorter_.cardboardUI),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(o.isLandscapeMode()&&o.isMobile()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},M.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},M.prototype.submitFrame=function(e){if(this.distorter_)this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var i=this.layer_.source.getContext("webgl").canvas;i.width==this.lastWidth&&i.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=i.width,this.lastHeight=i.height,this.cardboardUI_.render()}},M.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},M.prototype.onResize_=function(e){if(this.layer_){var i=this.layer_.source.getContext("webgl"),t=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0 10px 10px 0"]; i.canvas.setAttribute("style",t.join("; ")+";"),o.safariCssSizeWorkaround(i.canvas)}},M.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},M.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},i.exports=M},{"./base.js":3,"./cardboard-distorter.js":4,"./cardboard-ui.js":5,"./device-info.js":8,"./dpdb/dpdb.js":13,"./rotate-instructions.js":17,"./sensor-fusion/fusion-pose-sensor.js":19,"./util.js":23,"./viewer-selector.js":24}],7:[function(e,i,t){function M(e,i,t){if(!i)return void t(e);for(var M=[],s=null,A=0;A<i.length;++A){var r=i[A];switch(r){case e.TEXTURE_BINDING_2D:case e.TEXTURE_BINDING_CUBE_MAP:var n=i[++A];if(n<e.TEXTURE0||n>e.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),M.push(null,null);break}s||(s=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(n),M.push(e.getParameter(r),null);break;case e.ACTIVE_TEXTURE:s=e.getParameter(e.ACTIVE_TEXTURE),M.push(null);break;default:M.push(e.getParameter(r))}}t(e);for(var A=0;A<i.length;++A){var r=i[A],u=M[A];switch(r){case e.ACTIVE_TEXTURE:break;case e.ARRAY_BUFFER_BINDING:e.bindBuffer(e.ARRAY_BUFFER,u);break;case e.COLOR_CLEAR_VALUE:e.clearColor(u[0],u[1],u[2],u[3]);break;case e.COLOR_WRITEMASK:e.colorMask(u[0],u[1],u[2],u[3]);break;case e.CURRENT_PROGRAM:e.useProgram(u);break;case e.ELEMENT_ARRAY_BUFFER_BINDING:e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u);break;case e.FRAMEBUFFER_BINDING:e.bindFramebuffer(e.FRAMEBUFFER,u);break;case e.RENDERBUFFER_BINDING:e.bindRenderbuffer(e.RENDERBUFFER,u);break;case e.TEXTURE_BINDING_2D:var n=i[++A];if(n<e.TEXTURE0||n>e.TEXTURE31)break;e.activeTexture(n),e.bindTexture(e.TEXTURE_2D,u);break;case e.TEXTURE_BINDING_CUBE_MAP:var n=i[++A];if(n<e.TEXTURE0||n>e.TEXTURE31)break;e.activeTexture(n),e.bindTexture(e.TEXTURE_CUBE_MAP,u);break;case e.VIEWPORT:e.viewport(u[0],u[1],u[2],u[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:u?e.enable(r):e.disable(r);break;default:console.log("No GL restore behavior for 0x"+r.toString(16))}s&&e.activeTexture(s)}}i.exports=M},{}],8:[function(e,i,t){function M(e){this.width=e.width||u.getScreenWidth(),this.height=e.height||u.getScreenHeight(),this.widthMeters=e.widthMeters,this.heightMeters=e.heightMeters,this.bevelMeters=e.bevelMeters}function s(e){this.viewer=D.CardboardV2,this.updateDeviceParams(e),this.distortion=new r(this.viewer.distortionCoefficients)}function A(e){this.id=e.id,this.label=e.label,this.fov=e.fov,this.interLensDistance=e.interLensDistance,this.baselineLensDistance=e.baselineLensDistance,this.screenLensDistance=e.screenLensDistance,this.distortionCoefficients=e.distortionCoefficients,this.inverseCoefficients=e.inverseCoefficients}var r=e("./distortion/distortion.js"),n=e("./math-util.js"),u=e("./util.js"),N=new M({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),a=new M({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),D={CardboardV1:new A({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new A({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};s.prototype.updateDeviceParams=function(e){this.device=this.determineDevice_(e)||this.device},s.prototype.getDevice=function(){return this.device},s.prototype.setViewer=function(e){this.viewer=e,this.distortion=new r(this.viewer.distortionCoefficients)},s.prototype.determineDevice_=function(e){if(!e)return u.isIOS()?(console.warn("Using fallback iOS device measurements."),a):(console.warn("Using fallback Android device measurements."),N);var i=.0254,t=i/e.xdpi,s=i/e.ydpi,A=u.getScreenWidth(),r=u.getScreenHeight();return new M({widthMeters:t*A,heightMeters:s*r,bevelMeters:.001*e.bevelMm})},s.prototype.getDistortedFieldOfViewLeftEye=function(){var e=this.viewer,i=this.device,t=this.distortion,M=e.screenLensDistance,s=(i.widthMeters-e.interLensDistance)/2,A=e.interLensDistance/2,r=e.baselineLensDistance-i.bevelMeters,u=i.heightMeters-r,N=n.radToDeg*Math.atan(t.distort(s/M)),a=n.radToDeg*Math.atan(t.distort(A/M)),D=n.radToDeg*Math.atan(t.distort(r/M)),o=n.radToDeg*Math.atan(t.distort(u/M));return{leftDegrees:Math.min(N,e.fov),rightDegrees:Math.min(a,e.fov),downDegrees:Math.min(D,e.fov),upDegrees:Math.min(o,e.fov)}},s.prototype.getLeftEyeVisibleTanAngles=function(){var e=this.viewer,i=this.device,t=this.distortion,M=Math.tan(-n.degToRad*e.fov),s=Math.tan(n.degToRad*e.fov),A=Math.tan(n.degToRad*e.fov),r=Math.tan(-n.degToRad*e.fov),u=i.widthMeters/4,N=i.heightMeters/2,a=e.baselineLensDistance-i.bevelMeters-N,D=e.interLensDistance/2-u,o=-a,g=e.screenLensDistance,j=t.distort((D-u)/g),L=t.distort((o+N)/g),c=t.distort((D+u)/g),I=t.distort((o-N)/g),T=new Float32Array(4);return T[0]=Math.max(M,j),T[1]=Math.min(s,L),T[2]=Math.min(A,c),T[3]=Math.max(r,I),T},s.prototype.getLeftEyeNoLensTanAngles=function(){var e=this.viewer,i=this.device,t=this.distortion,M=new Float32Array(4),s=t.distortInverse(Math.tan(-n.degToRad*e.fov)),A=t.distortInverse(Math.tan(n.degToRad*e.fov)),r=t.distortInverse(Math.tan(n.degToRad*e.fov)),u=t.distortInverse(Math.tan(-n.degToRad*e.fov)),N=i.widthMeters/4,a=i.heightMeters/2,D=e.baselineLensDistance-i.bevelMeters-a,o=e.interLensDistance/2-N,g=-D,j=e.screenLensDistance,L=(o-N)/j,c=(g+a)/j,I=(o+N)/j,T=(g-a)/j;return M[0]=Math.max(s,L),M[1]=Math.min(A,c),M[2]=Math.min(r,I),M[3]=Math.max(u,T),M},s.prototype.getLeftEyeVisibleScreenRect=function(e){var i=this.viewer,t=this.device,M=i.screenLensDistance,s=(t.widthMeters-i.interLensDistance)/2,A=i.baselineLensDistance-t.bevelMeters,r=(e[0]*M+s)/t.widthMeters,n=(e[1]*M+A)/t.heightMeters,u=(e[2]*M+s)/t.widthMeters,N=(e[3]*M+A)/t.heightMeters;return{x:r,y:N,width:u-r,height:n-N}},s.prototype.getFieldOfViewLeftEye=function(e){return e?this.getUndistortedFieldOfViewLeftEye():this.getDistortedFieldOfViewLeftEye()},s.prototype.getFieldOfViewRightEye=function(e){var i=this.getFieldOfViewLeftEye(e);return{leftDegrees:i.rightDegrees,rightDegrees:i.leftDegrees,upDegrees:i.upDegrees,downDegrees:i.downDegrees}},s.prototype.getUndistortedFieldOfViewLeftEye=function(){var e=this.getUndistortedParams_();return{leftDegrees:n.radToDeg*Math.atan(e.outerDist),rightDegrees:n.radToDeg*Math.atan(e.innerDist),downDegrees:n.radToDeg*Math.atan(e.bottomDist),upDegrees:n.radToDeg*Math.atan(e.topDist)}},s.prototype.getUndistortedViewportLeftEye=function(){var e=this.getUndistortedParams_(),i=this.viewer,t=this.device,M=i.screenLensDistance,s=t.widthMeters/M,A=t.heightMeters/M,r=t.width/s,n=t.height/A,u=Math.round((e.eyePosX-e.outerDist)*r),N=Math.round((e.eyePosY-e.bottomDist)*n);return{x:u,y:N,width:Math.round((e.eyePosX+e.innerDist)*r)-u,height:Math.round((e.eyePosY+e.topDist)*n)-N}},s.prototype.getUndistortedParams_=function(){var e=this.viewer,i=this.device,t=this.distortion,M=e.screenLensDistance,s=e.interLensDistance/2/M,A=i.widthMeters/M,r=i.heightMeters/M,u=A/2-s,N=(e.baselineLensDistance-i.bevelMeters)/M,a=e.fov,D=t.distortInverse(Math.tan(n.degToRad*a)),o=Math.min(u,D),g=Math.min(s,D),j=Math.min(N,D),L=Math.min(r-N,D);return{outerDist:o,innerDist:g,topDist:L,bottomDist:j,eyePosX:u,eyePosY:N}},s.Viewers=D,i.exports=s},{"./distortion/distortion.js":10,"./math-util.js":15,"./util.js":23}],9:[function(e,i,t){function M(e){this.display=e,this.hardwareUnitId=e.displayId,this.deviceId="webvr-polyfill:HMD:"+e.displayId,this.deviceName=e.displayName+" (HMD)"}function s(e){this.display=e,this.hardwareUnitId=e.displayId,this.deviceId="webvr-polyfill:PositionSensor: "+e.displayId,this.deviceName=e.displayName+" (PositionSensor)"}var A=(e("./base.js").VRDisplay,e("./base.js").HMDVRDevice),r=e("./base.js").PositionSensorVRDevice;M.prototype=new A,M.prototype.getEyeParameters=function(e){var i=this.display.getEyeParameters(e);return{currentFieldOfView:i.fieldOfView,maximumFieldOfView:i.fieldOfView,minimumFieldOfView:i.fieldOfView,recommendedFieldOfView:i.fieldOfView,eyeTranslation:{x:i.offset[0],y:i.offset[1],z:i.offset[2]},renderRect:{x:"right"==e?i.renderWidth:0,y:0,width:i.renderWidth,height:i.renderHeight}}},M.prototype.setFieldOfView=function(e,i,t,M){},s.prototype=new r,s.prototype.getState=function(){var e=this.display.getPose();return{position:e.position?{x:e.position[0],y:e.position[1],z:e.position[2]}:null,orientation:e.orientation?{x:e.orientation[0],y:e.orientation[1],z:e.orientation[2],w:e.orientation[3]}:null,linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},s.prototype.resetState=function(){return this.positionDevice.resetPose()},i.exports.VRDisplayHMDDevice=M,i.exports.VRDisplayPositionSensorDevice=s},{"./base.js":3}],10:[function(e,i,t){function M(e){this.coefficients=e}M.prototype.distortInverse=function(e){for(var i=0,t=1,M=e-this.distort(i);Math.abs(t-i)>1e-4;){var s=e-this.distort(t),A=t-s*((t-i)/(s-M));i=t,t=A,M=s}return t},M.prototype.distort=function(e){for(var i=e*e,t=0,M=0;M<this.coefficients.length;M++)t=i*(t+this.coefficients[M]);return(t+1)*e},M.prototype.solveLinear_=function(e,i){for(var t=e.length,M=0;M<t-1;++M)for(var s=M+1;s<t;++s){for(var A=e[M][s]/e[M][M],r=M+1;r<t;++r)e[r][s]-=A*e[r][M];i[s]-=A*i[M]}for(var n=new Array(t),M=t-1;M>=0;--M){for(var u=i[M],r=M+1;r<t;++r)u-=e[r][M]*n[r];n[M]=u/e[M][M]}return n},M.prototype.solveLeastSquares_=function(e,i){var t,M,s,A,r=e.length,n=e[0].length;if(r!=i.Length)throw new Error("Matrix / vector dimension mismatch");var u=new Array(n);for(s=0;s<n;++s)for(u[s]=new Array(n),M=0;M<n;++M){for(A=0,t=0;t<r;++t)A+=e[M][t]*e[s][t];u[s][M]=A}var N=new Array(n);for(M=0;M<n;++M){for(A=0,t=0;t<r;++t)A+=e[M][t]*i[t];N[M]=A}return this.solveLinear_(u,N)},M.prototype.approximateInverse=function(e,i){e=e||1,i=i||100;var t,s,A=6,r=new Array(A);for(s=0;s<A;++s)r[s]=new Array(i);var n=new Array(i);for(t=0;t<i;++t){var u=e*(t+1)/i,N=this.distort(u),a=N;for(s=0;s<A;++s)a*=N*N,r[s][t]=a;n[t]=u-N}var D=this.solveLeastSquares_(r,n);return new M(D)},i.exports=M},{}],11:[function(e,i,t){var M={format:1,last_updated:"2016-01-20T00:18:35Z",devices:[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google//Pixel XL/"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 "}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 "}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},
    https://whatsonchain.com/tx/aa37f3028ef145c606e37096a68df7a835fb4e049f89e79a2c3dff9295646044
    Partial data displayed. To get full data click on Download.