/* v 3.14
author http://codecanyon.net/user/creativeinteractivemedia/portfolio?ref=creativeinteractivemedia
*/

var FLIPBOOK=FLIPBOOK||{};FLIPBOOK.PageWebGL=function(t,e,i,o,s,n){THREE.Object3D.call(this),this.book=t,this.index=e,this.pW=o.pageWidth,this.pH=o.pageHeight,this.nfacesw=o.pageSegmentsW,this.nfacesh=o.pageSegmentsH,this.mats=[],this.pageHardness=i,this.pageThickness=i,this.duration=o.pageFlipDuration,this.angle=.25*Math.PI*this.pW/this.pH,this.force=10,this.offset=0,this.to=null,this.mod=null,this.bend=null,this.pivot=null,this.isFlippedLeft=!1,this.isFlippedRight=!0,this.flippingLeft=!1,this.flippingRight=!1;var r=(this.options=o).rightToLeft?o.pages.length/2-this.index-1:this.index;this.indexF=o.rightToLeft?2*r+1:2*r,this.indexB=o.rightToLeft?2*r:2*r+1,this.showing=!1,this.preloaderMatF=s,this.preloaderMatB=n;var h=this;0==e&&this.options.cornerCurl&&(this.nfacesw=20,this.nfacesh=20,this.cornerCurlTween=new FLIPBOOK.TWEEN.Tween(0).to(1,1e3).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.Out).onUpdate(function(t){h.cornerCurl&&(h.b2.force=-1.8*t,h.modF.apply())}).repeat(11e3).start()),this.gF=new THREE.BoxGeometry(this.pW,this.pH,.01,this.nfacesw,this.nfacesh,0);var a=new THREE.MeshBasicMaterial({color:15592941}),p=[a,a,a,a,s,n],c=[a,a,a,a,a,a];if(this.options.pagePreloader)c=[a,a,a,a,s,n];this.cube=new THREE.Mesh(this.gF,p),this.cube.position.x=.5*this.pW,this.options.shadows&&(this.cube.castShadow=!0,this.cube.receiveShadow=!0),this.gF.faceVertexUvs[1]=this.gF.faceVertexUvs[0],this.showMat(),this.cubeEmpty=new THREE.Mesh(new THREE.BoxGeometry(this.pW,this.pH,.01,1,1,0),c),this.cubeEmpty.position.x=.5*this.pW,this.pageFlippedAngle=Math.PI*this.options.pageFlippedAngle/180,this.bendF=new MOD3.Bend(0,0,0),this.bendF.constraint=MOD3.ModConstant.LEFT,this.pH>this.pW&&(this.bendF.switchAxes=!0),this.b2=new MOD3.Bend(0,0,0),this.b2.constraint=MOD3.ModConstant.LEFT,this.pH>this.pW&&(this.b2.switchAxes=!0),this.b2.offset=.98,this.b2.setAngle(1),this.modF=new MOD3.ModifierStack(new MOD3.LibraryThree,this.cube),this.modF.addModifier(this.bendF),0==e&&this.options.cornerCurl&&this.modF.addModifier(this.b2),this.modF.apply()},FLIPBOOK.PageWebGL.prototype=new THREE.Object3D,FLIPBOOK.PageWebGL.prototype.constructor=FLIPBOOK.PageWebGL,FLIPBOOK.PageWebGL.prototype.startCornerCurl=function(){this.cornerCurl=!0},FLIPBOOK.PageWebGL.prototype.stopCornerCurl=function(){this.cornerCurl=!1,this.b2.force=0,this.modF.apply()},FLIPBOOK.PageWebGL.prototype.onPageCanvasLoaded=function(t,e,i){if("front"==e&&this.sizeFront!=t.size){this.sizeFront=t.size;var o=t.canvas,s=new THREE.CanvasTexture(o);s.minFilter=THREE.LinearFilter,s.needsUpdate=!0,s.repeat.x=o.scaleX,s.repeat.y=o.scaleY,s.offset.y=1-o.scaleY,o.double&&(s.offset.x=.5),this.frontMaterial=this.createMaterial(s,"front"),this.frontMaterial.needsUpdate=!0,this.setFrontMat(this.frontMaterial)}else if("back"==e&&this.sizeBack!=t.size){this.sizeBack=t.size;o=t.canvas;var n=new THREE.CanvasTexture(o);n.minFilter=THREE.LinearFilter,n.needsUpdate=!0,n.repeat.x=o.scaleX,n.repeat.y=o.scaleY,n.offset.y=1-o.scaleY,this.backMaterial=this.createMaterial(n,"back"),this.backMaterial.needsUpdate=!0,this.setBackMat(this.backMaterial)}i.call(this)},FLIPBOOK.PageWebGL.prototype.loadHTML=function(t,e){var i="front"==t?this.indexF:this.indexB,o=this;this.htmlLoaded?e.call(this):this.options.main.loadPageHTML(i,function(t){e.call(o)})},FLIPBOOK.PageWebGL.prototype.load=function(t,i){var e=this.book.model;if(e.wrapperH&&e.zoom){for(var o=this.book.pages,s=this,n=this.book.options,r=0;r<o.length;r++){var h=o[r];if(h.flippingLeft||h.flippingRight)return}this.disposed=!1;var a=e.wrapperH*e.zoom<.8*n.pageTextureSizeSmall?n.pageTextureSizeSmall:n.pageTextureSize;"front"==t?this.sizeFront==a?i&&i.call(this):this.options.main.loadPage(this.indexF,a,function(t){if(t){if(t.canvas)s.onPageCanvasLoaded(t,"front",i);else if(t.image){if(s.loadedFront)return void i.call(s);s.loadedFront=!0;var e=new THREE.Texture;e.image=t.image,e.minFilter=THREE.LinearFilter,e.needsUpdate=!0,"left"==s.options.pages[2*s.index].side?e.repeat.x=.5:"right"==s.options.pages[2*s.index].side&&(e.repeat.x=.5,e.offset.x=.5),s.frontMaterial=s.createMaterial(e),s.setFrontMat(s.frontMaterial),i.call(s)}}else i&&i.call(s)}):"back"==t&&(this.sizeBack==a?i&&i.call(this):this.options.main.loadPage(this.indexB,a,function(t){if(t){if(t.canvas)s.onPageCanvasLoaded(t,"back",i);else if(t.image){if(s.loadedBack)return void i.call(s);s.loadedBack=!0;var e=new THREE.Texture;e.image=t.image,e.minFilter=THREE.LinearFilter,e.needsUpdate=!0,"left"==s.options.pages[2*s.index+1].side?e.repeat.x=.5:"right"==s.options.pages[2*s.index+1].side&&(e.repeat.x=.5,e.offset.x=.5),s.backMaterial=s.createMaterial(e,"back"),s.setBackMat(s.backMaterial),i.call(s)}}else i&&i.call(s)}))}},FLIPBOOK.PageWebGL.prototype.unload=function(t){if("front"==t&&this.sizeFront){var e=(i=this.cube.material[4]).map;i.dispose(),e&&e.dispose(),this.loadedFront=!1,this.sizeFront=0,this.setFrontMat(this.preloaderMatF)}else if("back"==t&&this.sizeBack){var i;e=(i=this.cube.material[5]).map;i.dispose(),e&&e.dispose(),this.loadedBack=!1,this.sizeBack=0,this.setBackMat(this.preloaderMatB)}},FLIPBOOK.PageWebGL.prototype.disposeMat=function(){if(this.loaded){var t=this.cube.material[4],e=this.cube.material[5],i=t.map,o=e.map;t.dispose(),e.dispose(),i&&i.dispose(),o&&o.dispose(),this.disposed=!0,this.loaded=!1}},FLIPBOOK.PageWebGL.prototype.createMaterial=function(t,e){var i;if(this.options.lights){var o="back"==e?this.book.specularB:this.book.specularF,s=this.options;i=new THREE.MeshStandardMaterial({map:t,roughness:s.pageRoughness,metalness:s.pageMetalness,emissive:0,color:16777215,lightMap:o})}else i=new THREE.MeshBasicMaterial({map:t});return i},FLIPBOOK.PageWebGL.prototype._setAngle=function(t,e){if(t<=180&&-180<=t){if(t=t/180*Math.PI,this.singlePage&&(90<=t&&(t=90),t<0&&(t-=90),t<-180&&(t=-180),this.index==this.book.pages.length-1))return;t<0&&(t+=Math.PI),this.angle=t,this.positionZ(200),this.dragging=!0,this.rotation.y=-t,this.isFlippedLeft?this.bendF.force=1.35*Math.pow(-Math.abs(Math.cos(-t/2)),1)/Math.pow(this.pageHardness,1.5):this.bendF.force=1.35*Math.pow(Math.abs(Math.sin(-t/2)),1)/Math.pow(this.pageHardness,1.5),this.updateBend(),this.book.htmlLayerVisible&&(this.book.$pageL.hide(),this.book.$pageR.hide(),this.book.$pageC.hide(),this.book.htmlLayerVisible=!1),this.book.needsUpdate=!0}},FLIPBOOK.PageWebGL.prototype.updateBend=function(){this.stopCornerCurl(),this.modF.apply(),this.gF.computeFaceNormals(),this.gF.computeVertexNormals(!0),this.book.needsUpdate=!0},FLIPBOOK.PageWebGL.prototype.flipLeft=function(t){if(this.onComplete=t,this.dragging=!1,!this.isFlippedLeft&&!this.flippingLeft&&!this.flippingRight&&this.index==this.book.flippedleft){if(0<this.duration){this.flippingLeft=!0,this.flipping=!0,this.force=0;var e=(1+.5*Math.random())/this.pageHardness,i=.1+.2*Math.random();this.to={angle:this.rotation.y,t:-1,xx:0,thiss:this,force:this.force,offset:this.offset},this.bendIn(-Math.PI,e,i)}else this.rotation.y=-Math.PI,this.flippingLeft=!1,this.isFlippedLeft=!0,this.flippingRight=!1,this.isFlippedRight=!1;this.correctZOrder()}},FLIPBOOK.PageWebGL.prototype.correctZOrder=function(){var t;for(this.position.z=3,t=this.index-1;0<=t;t--)this.book.pages[t].position.z=this.book.pages[t+1].position.z-2-2-1;for(t=this.index+1;t<this.book.pages.length;t++)this.book.pages[t].position.z=this.book.pages[t-1].position.z-2-2-1},FLIPBOOK.PageWebGL.prototype.flipLeftInstant=function(t){if(this.onComplete=t,this.dragging=!1,!this.isFlippedLeft&&!this.flippingLeft&&!this.flippingRight&&this.index==this.book.flippedleft){(this.thiss=this).xx=0,this.angle=-Math.PI,this.flippingLeft=!0,this.isFlippedLeft=!1,this.renderFlip(),this.flippingLeft=!1,this.isFlippedLeft=!0,this.flippingRight=!1,this.isFlippedRight=!1;this.position.z=3;for(var e=this.index+1;e<this.book.pages.length;e++)this.book.pages[e].position.z=this.book.pages[e-1].position.z-2-2-1;if(this.index<this.book.pages.length-1){this.position.z=this.book.pages[this.index+1].position.z;for(e=this.index-1;0<=e;e--)this.book.pages[e].position.z=this.book.pages[e+1].position.z-2-2-1}else 0<this.index&&(this.book.pages[this.index].position.z=this.book.pages[this.index-1].position.z+2+2-1);this.flipFinished()}},FLIPBOOK.PageWebGL.prototype.hideMat=function(){this.showing&&(this.remove(this.cube),this.add(this.cubeEmpty),this.showing=!1)},FLIPBOOK.PageWebGL.prototype.showMat=function(){this.showing||(this.add(this.cube),this.remove(this.cubeEmpty),this.showing=!0,this.book.needsUpdate=!0)},FLIPBOOK.PageWebGL.prototype.setFrontMat=function(t){this.cube.material[4]!==t&&(this.cube.material[4]=t,this.book.needsUpdate=!0)},FLIPBOOK.PageWebGL.prototype.setBackMat=function(t){this.cube.material[5]!==t&&(this.cube.material[5]=t,this.book.needsUpdate=!0)},FLIPBOOK.PageWebGL.prototype.flipRightInstant=function(t){if(this.onComplete=t,this.dragging=!1,!this.isFlippedRight&&!this.flippingRight&&!this.flippingLeft&&this.index==this.book.getNumPages()-this.book.flippedright-1){(this.thiss=this).xx=0,this.angle=0,this.flippingRight=!0,this.isFlippedRight=!1,this.renderFlip(),this.flippingLeft=!1,this.isFlippedLeft=!1,this.flippingRight=!1,this.isFlippedRight=!0;this.position.z=3;for(var e=this.index-1;0<=e;e--)this.book.pages[e].position.z=this.book.pages[e+1].position.z-2-2-1;if(0<this.index){this.position.z=this.book.pages[this.index-1].position.z;for(e=this.index+1;e<this.book.pages.length;e++)this.book.pages[e].position.z=this.book.pages[e-1].position.z-2-2-1}else 1<this.book.pages.length&&(this.position.z=this.book.pages[this.index+1].position.z+2+2-1);this.flipFinished()}},FLIPBOOK.PageWebGL.prototype.flipRight=function(t){if(this.onComplete=t,this.dragging=!1,!this.isFlippedRight&&!this.flippingRight&&!this.flippingLeft&&this.index==this.book.getNumPages()-this.book.flippedright-1){if(0<this.duration){this.flippingRight=!0,this.flipping=!0,this.force=0,this.to={angle:this.rotation.y,t:-1,xx:0,thiss:this,force:this.force,offset:this.offset};var e=(-1-.5*Math.random())/this.pageHardness,i=.1+.2*Math.random();this.bendIn(0,e,i)}else this.rotation.y=0,this.flippingLeft=!1,this.isFlippedLeft=!1,this.flippingRight=!1,this.isFlippedRight=!0;this.correctZOrder()}},FLIPBOOK.PageWebGL.prototype.bendIn=function(t,e,i){this.bendF.force=0,this.bendF.offset=0,this.updateBend();var o=2*this.duration*240*Math.pow(Math.abs(this.rotation.y-t)/Math.PI,.5)*Math.pow(this.pageHardness,.25);new FLIPBOOK.TWEEN.Tween(this.to).to({angle:t,xx:1,t:1},o).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.In).onUpdate(this.renderFlip).onComplete(this.bendOut).start(),this.options.main.playFlipSound()},FLIPBOOK.PageWebGL.prototype.bendOut=function(){var t=this.thiss,e=t.duration*Math.pow(Math.abs(t.bendF.force),.5)*1e3;new FLIPBOOK.TWEEN.Tween(t.bendF).to({force:0,offset:1},e).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.Out).onUpdate(function(){t.updateBend()}).onComplete(function(){t.flipFinished(t)}).start();if(t.flippingLeft)if(t.index<t.book.pages.length-1){t.position.z=t.book.pages[t.index+1].position.z;for(var i=t.index-1;0<=i;i--)t.book.pages[i].position.z=t.book.pages[i+1].position.z-2-2-1}else 1<t.book.pages.length&&(t.book.pages[t.index].position.z=t.book.pages[t.index-1].position.z+2+2-1);if(t.flippingRight)if(0<t.index){t.position.z=t.book.pages[t.index-1].position.z;for(i=t.index+1;i<t.book.pages.length;i++)t.book.pages[i].position.z=t.book.pages[i-1].position.z-2-2-1}else 1<t.book.pages.length&&(t.position.z=t.book.pages[t.index+1].position.z+2+2-1)},FLIPBOOK.PageWebGL.prototype.modApply=function(){this.thiss.bendF.force=this.thiss.bendB.force=this.force,this.thiss.bendF.offset=this.thiss.bendB.offset=this.offset,this.thiss.updateBend()},FLIPBOOK.PageWebGL.prototype.renderFlip=function(){this.thiss._setAngle(180*-this.angle/Math.PI)},FLIPBOOK.PageWebGL.prototype.flipFinished=function(){var t=this;t.flippingLeft?(t.flippingLeft=!1,t.isFlippedLeft=!0,t.flippingRight=!1,t.isFlippedRight=!1):t.flippingRight&&(t.flippingLeft=!1,t.isFlippedRight=!0,t.flippingRight=!1,t.isFlippedLeft=!1),t.bendF.force=0,t.bendF.offset=0,t.updateBend(),t.flipping=!1,t.dragging=!1,void 0!==t.onComplete&&t.onComplete(t),t.book.flipFinnished()},FLIPBOOK.PageWebGL.prototype.isFlippedLeft=function(){return this.thiss.isFlippedLeft},FLIPBOOK.PageWebGL.prototype.isFlippedRight=function(){return this.thiss.isFlippedRight},FLIPBOOK.PageWebGL.prototype.positionZ=function(){},FLIPBOOK.BookWebGL=function(t,e,i){this.wrapper=t,this.options=i,this.model=e,this.options.cameraDistance=2800,this.pageW=i.pageWidth,this.pageH=i.pageHeight,this.pageW=1e3*i.pageWidth/i.pageHeight,this.pageH=1e3,i.pageWidth=this.pageW,i.pageHeight=this.pageH,this.scroll=i.scroll,this.pagesArr=i.pages,this.pages=[],this.animating=!1,this.sc=1;var o=this.wrapper.style;o.width="100%",o.height="100%",o.position="absolute",o.overflow="hidden",this.options.cameraDistance=this.options.cameraDistance/1.5},FLIPBOOK.BookWebGL.prototype=Object.create(FLIPBOOK.Book.prototype),FLIPBOOK.BookWebGL.prototype.constructor=FLIPBOOK.BookWebGL,FLIPBOOK.BookWebGL.prototype.init3d=function(){var e=this,t=jQuery(e.wrapper).width()/jQuery(e.wrapper).height(),i=this.options;this.Scene=new THREE.Scene,this.centerContainer=new THREE.Object3D,this.Scene.add(this.centerContainer),this.Camera=new THREE.PerspectiveCamera(30,t,1,1e4),this.Scene.add(this.Camera),this.zoom=i.zoom,this.pan=i.pan,this.tilt=i.tilt,this.updateCameraPosition();var o=this.wrapper,s=(document.createElement("canvas").getContext("webgl"),new THREE.WebGLRenderer({antialias:this.options.antialias,alpha:!0}));(window.renderer=s).gammaInput=!0,s.gammaOutput=!0,this.options.shadows&&(s.shadowMap.enabled=!0,s.shadowMap.type=THREE.PCFShadowMap),window.webglrenderer=this.renderer=s,this.renderer.setSize(o.clientWidth,o.clientHeight);var n=window.devicePixelRatio<i.minPixelRatio?i.minPixelRatio:window.devicePixelRatio;this.renderer.setPixelRatio(n),o.appendChild(this.renderer.domElement);for(var r=!1,h=this.options.pages,a=0;a<h.length;a++)h[a].htmlContent&&(r=!0);if(this.options.hasHtmlContent=r||i.pdfMode,this.options.hasHtmlContent&&this.initHtmlContent(),this.canvas=this.renderer.domElement,this._bind("mousedown",this.canvas.parentNode.parentNode),this._bind("mousemove",this.canvas.parentNode.parentNode),this._bind("mouseout",this.canvas.parentNode.parentNode),this._bind("mouseup",this.canvas.parentNode.parentNode),this._bind("touchstart",this.canvas.parentNode.parentNode),this._bind("touchmove",this.canvas.parentNode.parentNode),this._bind("touchend",this.canvas.parentNode.parentNode),this._bind("touchcancel",this.canvas.parentNode.parentNode),this.options.lights){var p=i.lightColor,c=new THREE.SpotLight(p);if(c.intensity=i.lightIntensity,c.position.set(i.lightPositionX,i.lightPositionY,i.lightPositionZ),c.distance=4e3,this.options.shadows){c.castShadow=!0,c.shadow.bias=-2e-6,c.shadow.mapSize.x=this.options.shadowMapSize,c.shadow.mapSize.y=this.options.shadowMapSize;var l=new THREE.ShadowMaterial;l.opacity=this.options.shadowOpacity;var d=new THREE.Mesh(new THREE.BoxGeometry(1e4,1e4,1,1,1,1),l);d.position.set(0,0,-i.shadowDistance),this.Scene.add(d),d.receiveShadow=!0}this.Scene.add(c);var u=i.ambientLightColor||3355443;new THREE.AmbientLight(u)}this.centerContainer.position.set(0,0,0),this.onResize(),this.centerContainer.position.x=.5*-this.pageW*this.centerContainer.scale.x,this.updateHtmlLayerPosition(),this.flippedleft=0,this.flippedright=0,this.cameraZMin=300,this.cameraZMax=5e3,function t(){if(FLIPBOOK.TWEEN.update(),e.rendering){if(!e.enabled)return;e.needsUpdate&&(e.renderer.render(e.Scene,e.Camera),e.needsUpdate=!1,e.htmlLayer&&e.cssRenderer.render(e.Scene,e.Camera))}requestAnimationFrame(t)}()},FLIPBOOK.BookWebGL.prototype.onPageUnloaded=function(t,e){var i,o=Math.floor(t/2);i=this.options.rightToLeft?(o=this.pages.length-o-1,t%2==0?"back":"front"):t%2==0?"front":"back",this.pages[o].unload(i)},FLIPBOOK.BookWebGL.prototype.initHtmlContent=function(){var t=document.createElement("div");t.className="htmlLayer "+Math.random();var e=jQuery(t);this.$htmlLayer=e,this.$pageR=jQuery(document.createElement("div")).addClass("R").css({width:1e3*this.options.pageWidth/this.options.pageHeight+"px",height:"1000px",position:"absolute",top:"-500px","pointer-events":"none"}).appendTo(e),this.$pageRInner=jQuery("<div>").css("pointer-events","all").appendTo(this.$pageR),this.$pageL=jQuery(document.createElement("div")).addClass("L").css({width:1e3*this.options.pageWidth/this.options.pageHeight+"px",height:"1000px",position:"absolute",top:"-500px",left:-1e3*this.options.pageWidth/this.options.pageHeight+"px","pointer-events":"none"}).appendTo(e),this.$pageLInner=jQuery(document.createElement("div")).css("pointer-events","all").appendTo(this.$pageL),this.$pageC=jQuery(document.createElement("div")).addClass("C").css({width:2e3*this.options.pageWidth/this.options.pageHeight+"px",height:"1000px",position:"absolute",top:"-500px",left:-1e3*this.options.pageWidth/this.options.pageHeight+"px","pointer-events":"none"}).appendTo(e),this.$pageCInner=jQuery(document.createElement("div")).css("pointer-events","all").appendTo(this.$pageC),this.htmlLayer=new FLIPBOOK.CSS3DObject(t),this.Scene.add(this.htmlLayer),this.cssRenderer=new FLIPBOOK.CSS3DRenderer;this.wrapper;this.wrapper.appendChild(this.cssRenderer.domElement),this.cssRenderer.domElement.style.position="absolute",this.cssRenderer.domElement.style.top="0",this.cssRenderer.domElement.style.left="0",this.cssRenderer.domElement.style.pointerEvents="none",this.cssRenderer.domElement.className="cssRenderer "+Math.random();var i=this;this.model.on("toolSelect",function(){i.updateTool()}),this.model.on("toolMove",function(){i.updateTool()})},FLIPBOOK.BookWebGL.prototype.enablePrev=function(t){this.prevEnabled=t},FLIPBOOK.BookWebGL.prototype.enableNext=function(t){this.nextEnabled=t},FLIPBOOK.BookWebGL.prototype.isZoomed=function(){return this.options.zoom>this.options.zoomMin&&1<this.options.zoom},FLIPBOOK.BookWebGL.prototype.getRightPage=function(){return this.pages[this.flippedleft]},FLIPBOOK.BookWebGL.prototype.getNextPage=function(){return this.pages[this.flippedleft+1]},FLIPBOOK.BookWebGL.prototype.getLeftPage=function(){return this.pages[this.flippedleft-1]},FLIPBOOK.BookWebGL.prototype.getPrevPage=function(){return this.pages[this.flippedleft-2]},FLIPBOOK.BookWebGL.prototype.onSwipe=function(t,e,i,o,s,n,r){if(!this.isZoomed()){"right"==i&&(o*=-1);var h=this.getLeftPage(),a=this.getRightPage(),p=this.getNextPage(),c=this.getPrevPage();if(!this.options.rotateCameraOnMouseDrag||a&&a.dragging||h&&h.dragging||"rotate"!=this.onMouseMove&&"scroll"!=this.onMouseMove){if(("cancel"==e||"end"==e)&&n<=1){if(1==this.view&&this.draggingBook&&"left"==i)return this.nextPage(),void(this.draggingBook=!1);if(1==this.view&&this.draggingBook&&"right"==i)return this.prevPage(),void(this.draggingBook=!1);!(o<0)||a&&a.dragging?!(0<o)||h&&h.dragging?0==o&&this.clickedPage&&(this.clickedPage.isFlippedLeft?this.prevPage():this.nextPage()):this.nextPage():this.prevPage(),a&&(a.dragging=!1),h&&(h.dragging=!1)}if("move"==e&&n<=1){if(this.draggingBook)return this.centerContainer.position.x=this.draggingBookStartX-o,void this.updateHtmlLayerPosition();if(1==this.view&&this.isFocusedLeft()&&"left"==i)return this.draggingBookStartX=this.centerContainer.position.x,void(this.draggingBook=!0);if(1==this.view&&this.isFocusedRight()&&"right"==i)return this.draggingBookStartX=this.centerContainer.position.x,void(this.draggingBook=!0);if(o=180*o/this.wrapperW,h&&h.flipping||a&&a.flipping)return;a&&a.dragging||h&&h.dragging?h&&!a||h&&!a.dragging?o<=0&&h._setAngle(o,i):(a&&!h||a&&!h.dragging)&&0<=o&&a._setAngle(o,i):0!=o&&("right"!=i||!h||a&&a.dragging||!this.prevEnabled?"left"==i&&a&&this.nextEnabled&&(a._setAngle(o,i),a.positionZ(200),p&&p.showMat()):(h._setAngle(o,i),h.positionZ(200),c&&c.showMat()))}}}},FLIPBOOK.BookWebGL.prototype.onResize=function(){var t=this.model,e=t.wrapperW,i=t.wrapperH,o=this.options,s=e/i,n=o.pageWidth/o.pageHeight;if(i<1e3&&1==window.devicePixelRatio)this.renderer.setPixelRatio(2);else{var r=window.devicePixelRatio<o.minPixelRatio?o.minPixelRatio:window.devicePixelRatio;this.renderer.setPixelRatio(r)}var h=Math.min(this.zoom,1),a=Number(o.zoomMin);o.responsiveView&&e<=o.responsiveViewTreshold&&s<2*n?(this.view=1,this.sc=s<n?a*s/(n*h):1,0==this.rightIndex||this.isFocusedRight()?this.focusRight():this.focusLeft()):(this.view=2,this.sc=s<2*n?a*s/(2*n*h):1,0==this.flippedleft?this.focusRight():0==this.flippedright?this.focusLeft():this.focusBoth()),this.renderer.setSize(e,i),this.htmlLayer&&(this.cssRenderer.setSize(e,i),this.htmlLayer.scale.set(this.sc,this.sc,this.sc)),this.Camera.aspect=e/i,this.Camera.updateProjectionMatrix(),this.updateCameraPosition(),this.updateBookPosition(),this.wrapperW=e,this.wrapperH=i},FLIPBOOK.BookWebGL.prototype.updateCameraPosition=function(){var t,e=Math.PI*this.tilt/180,i=this.options.cameraDistance*Math.sin(e)/this.zoom,o=this.options.cameraDistance*Math.cos(e)/this.zoom;this.centerContainer.scale.set(this.sc,this.sc,this.sc),e=Math.PI*this.pan/180,t=Math.sin(e)*o,o=Math.cos(e)*o,this.cameraZ=o,this.Camera.position.set(Math.round(t),Math.round(i),Math.round(o)),this.Camera.lookAt(this.Scene.position),this.needsUpdate=!0},FLIPBOOK.BookWebGL.prototype.createPages=function(){var t,e,i,o=this,s=o.options,n=s.pageMiddleShadowSize,r=document.createElement("canvas");r.width=64,r.height=64;var h=r.getContext("2d"),a=h.createLinearGradient(64-n,0,64,0);a.addColorStop(0,"#AAAAAA"),a.addColorStop(1,s.pageMiddleShadowColorL),h.fillStyle=a,h.fillRect(0,0,64,64);var p=new THREE.CanvasTexture(r);p.needsUpdate=!0,o.specularB=p;var c=document.createElement("canvas");c.width=64,c.height=64;var l=c.getContext("2d"),d=l.createLinearGradient(0,0,n,0);d.addColorStop(0,s.pageMiddleShadowColorR),d.addColorStop(1,"#AAAAAA"),l.fillStyle=d,l.fillRect(0,0,64,64);var u,f,g=new THREE.CanvasTexture(c);if(g.needsUpdate=!0,o.specularF=g,o.options.pagePreloader){var m=(new THREE.TextureLoader).load(o.options.pagePreloader,function(){});o.options.lights?(u=new THREE.MeshStandardMaterial({map:m,roughness:o.options.pageRoughness,metalness:o.options.pageMetalness,emissive:0,color:15592941,lightMap:o.specularF}),f=new THREE.MeshStandardMaterial({map:m,roughness:o.options.pageRoughness,metalness:o.options.pageMetalness,emissive:0,color:15592941,lightMap:o.specularB})):u=f=new THREE.MeshBasicMaterial({map:m,color:15592941})}else o.options.lights?(u=new THREE.MeshStandardMaterial({roughness:o.options.pageRoughness,metalness:o.options.pageMetalness,emissive:0,color:15592941,lightMap:o.specularF}),f=new THREE.MeshStandardMaterial({roughness:o.options.pageRoughness,metalness:o.options.pageMetalness,emissive:0,color:15592941,lightMap:o.specularB})):u=f=new THREE.MeshBasicMaterial({color:15592941});var y=o.options.pages;for(i=0;i<y.length/2;i++){t=0==i||i==y.length/2-1?o.options.coverHardness:o.options.pageHardness,e=new FLIPBOOK.PageWebGL(o,i,t,o.options,u,f),o.pages.push(e),o.centerContainer.add(e),o.flippedright++;0<i?(e.position.z=o.pages[i-1].position.z-2-2-1,this.bg&&(this.bg.position.z=e.position.z-5)):e.position.z=2}o.initialized=!0},FLIPBOOK.BookWebGL.prototype.getNumPages=function(){return this.pages.length},FLIPBOOK.BookWebGL.prototype.centerContainer=function(){return this.centerContainer},FLIPBOOK.BookWebGL.prototype.goToPage=function(t,e,i){if(this.initialized){if(t<0&&(t=0),t>this.options.pages.length&&(t=this.options.pages.length),1==this.view&&!i){var o=e?0:300;t%2==0?this.focusLeft(o):this.focusRight(o)}if(t%2!=0&&t--,t==this.rightIndex)return this.loadPages(),void this.turnPageComplete();this.goingToPage=!0;n=this;var s=1e3*this.options.pageFlipDuration/6;if(void 0!==e&&e){if(t>n.rightIndex)for(;n.rightIndex<t;)this.nextPageInstant();else for(;n.rightIndex>t;)this.prevPageInstant();return this.updateBookPosition(),this.loadPages(),void this.turnPageComplete()}this.rightIndex>t?(s=1/(this.rightIndex-t)*this.options.pageFlipDuration*1e3/6,10<this.rightIndex-t&&(s=0),this.rightIndex-2>t?(this.prevPage(!1),0<s?setTimeout(function(){n.goToPage(t,e,1)},s):n.goToPage(t,e,1)):(this.prevPage(),setTimeout(function(){if(void 0!==e&&e)for(var t=0;t<n.pages.length;t++)n.pages[t].duration=n.options.pageFlipDuration;n.loadPages()},s))):this.rightIndex<t&&(s=-1/(this.rightIndex-t)*this.options.pageFlipDuration*1e3/6,this.rightIndex-t<-10&&(s=0),this.rightIndex+2<t?(this.nextPage(!1),0<s?setTimeout(function(){n.goToPage(t,e,1)},s):n.goToPage(t,e,1)):(this.nextPage(),setTimeout(function(){if(void 0!==e&&e)for(var t=0;t<n.pages.length;t++)n.pages[t].duration=n.options.pageFlipDuration;n.loadPages()},s)))}else{var n=this;setTimeout(function(){n.goToPage(t,e)},100)}},FLIPBOOK.BookWebGL.prototype.nextPageInstant=function(t){if(0!=this.flippedright){var e;for(e=0;e<this.pages.length;e++)if(this.pages[e].flippingRight)return;if(1==this.view){if(this.isFocusedLeft()){if(!this.goingToPage)return this.focusRight(0),void this.turnPageComplete();this.focusLeft(0,0)}}else 1==this.flippedright?this.focusLeft(0):this.focusBoth(0);this.pages[this.pages.length-this.flippedright].flipLeftInstant(),this.flippedleft++,this.flippedright--,this.setRightIndex(this.rightIndex+2),this.updateBookPosition()}},FLIPBOOK.BookWebGL.prototype.setRightIndex=function(t){this.rightIndex=t},FLIPBOOK.BookWebGL.prototype.prevPageInstant=function(t){if(0!=this.flippedleft){var e;for(e=0;e<this.pages.length;e++)if(this.pages[e].flippingLeft)return;if(1==this.view){if(!this.goingToPage){if(this.isFocusedRight())return this.focusLeft(0),void this.turnPageComplete();this.focusRight(0,0)}}else 1==this.flippedleft?this.focusRight(0):this.focusBoth(0);this.pages[this.flippedleft-1].flipRightInstant(),this.flippedleft--,this.flippedright++,this.setRightIndex(this.rightIndex-2),this.updateBookPosition()}},FLIPBOOK.BookWebGL.prototype.nextPage=function(t){if(0!=this.flippedright&&(this.clickedPage=null,!(1==this.flippedright&&2*this.pages.length>this.options.numPages)||this.options.rightToLeft)){var e,i=0;for(e=0;e<this.pages.length;e++){if(this.pages[e].flippingRight)return;this.pages[e].flipping&&i++}var o=this.pages[this.pages.length-this.flippedright],s=(this.pages[o.index-2],this.pages[o.index-3],this.pages[o.index+1]);if(s&&i<5&&s.showMat(),1==this.view){if(!this.goingToPage){if(this.isFocusedLeft())return void this.focusRight(300,0,this.turnPageComplete);this.focusLeft(600,200)}}else 1==this.flippedright?this.focusLeft(500):this.focusBoth(500);if(!o.flipping){var n,r=this;void 0!==t&&!t||(n=function(t){r.loadPages(),r.turnPageComplete()}),o.flipLeft(n)}this.flippedleft++,this.flippedright--,this.setRightIndex(this.rightIndex+2)}},FLIPBOOK.BookWebGL.prototype.updateBookPosition=function(){1==this.view?0==this.flippedright?this.focusLeft():0==this.flippedleft?this.focusRight():this.isFocusedLeft()?this.focusLeft():this.focusRight():0==this.rightIndex?this.focusRight():this.rightIndex>=this.options.numPages?this.focusLeft():this.focusBoth(),this.updateHtmlLayerPosition(),this.needsUpdate=!0},FLIPBOOK.BookWebGL.prototype.updateHtmlLayerPosition=function(){this.htmlLayer&&(this.htmlLayer.position.x=this.centerContainer.position.x,this.htmlLayer.position.y=this.centerContainer.position.y),this.needsUpdate=!0},FLIPBOOK.BookWebGL.prototype.turnPageComplete=function(){this.goingToPage=!1,this.options.main.turnPageComplete()},FLIPBOOK.BookWebGL.prototype.loadPages=function(){for(var t=this.pages,e=this.options.main,i=0;i<t.length;i++){if((h=t[i]).flippingLeft||h.flippingRight)return}this.options.cornerCurl&&(0==this.flippedleft?this.pages[0].startCornerCurl():this.pages[0].stopCornerCurl());var o=this.pages[this.flippedleft],s=this.pages[this.flippedleft-1],n=(this.pages[this.flippedleft-2],this.pages[this.flippedleft+1],this.pages[this.flippedleft-3],this.pages[this.flippedleft+2],this.updateHtmlLayer),r=this.loadMorePages;for(i=0;i<t.length;i++){var h;(h=t[i])!==o&&h!==s||h.showMat(),s&&h.index<s.index-2&&(h.hideMat(),this.options.pdfMode||h.disposeMat()),o&&h.index>o.index+2&&(h.hideMat(),this.options.pdfMode||h.disposeMat())}o=this.pages[this.flippedleft],s=this.pages[this.flippedleft-1],this.pages[this.flippedleft-2],this.pages[this.flippedleft+1],this.pages[this.flippedleft-3],this.pages[this.flippedleft+2],n=this.updateHtmlLayer,r=this.loadMorePages;var a=this;t=this.pages;(e=this.options.main).setLoadingProgress(.1),s?s.load("back",function(t){o?o.load("front",function(t){s.loadHTML("back",function(){o.loadHTML("front",function(){n.call(a)})}),e.setLoadingProgress(1),r.call(a)}):(s.loadHTML("back",function(){n.call(a)}),e.setLoadingProgress(1),r.call(a))}):o.load("front",function(t){o.loadHTML("front",function(){n.call(a)}),e.setLoadingProgress(1),r.call(a)})},FLIPBOOK.BookWebGL.prototype.focusLeft=function(t,e,i){this.options.pageHeight;var o=this.options.pageWidth,s=(this.wrapperW,this.wrapperH,this.zoom,.5*o*this.centerContainer.scale.x);this.moveToPos({x:s,y:0},t,e,i)},FLIPBOOK.BookWebGL.prototype.focusRight=function(t,e,i){this.options.pageHeight;var o=this.options.pageWidth,s=(this.wrapperW,this.wrapperH,this.zoom,.5*-o*this.centerContainer.scale.x);this.moveToPos({x:s,y:0},t,e,i)},FLIPBOOK.BookWebGL.prototype.focusBoth=function(t,e,i){this.options.pageHeight,this.options.pageWidth,this.wrapperW,this.wrapperH,this.zoom;this.moveToPos({x:0,y:0},t,e,i)},FLIPBOOK.BookWebGL.prototype.moveToPos=function(t,e,i,o){if(e&&this.movingTo!=t&&this.centerContainer.position.x!=t.x){var s=this;this.movingTo=t,this.bookMoveTween&&this.bookMoveTween.stop(),this.bookMoveTween=new FLIPBOOK.TWEEN.Tween(this.centerContainer.position).to({x:t.x,y:t.y},e).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.Out).onUpdate(function(){s.updateHtmlLayerPosition()}).onComplete(function(){s.movingTo=null,s.updateHtmlLayerPosition(),o&&o.call(s)}).delay(i||0).start()}else this.centerContainer.position.x=t.x,this.centerContainer.position.y=t.y,o&&o.call(this)},FLIPBOOK.BookWebGL.prototype.isFocusedLeft=function(){return 0<this.centerContainer.position.x},FLIPBOOK.BookWebGL.prototype.isFocusedRight=function(){return this.centerContainer.position.x<0},FLIPBOOK.BookWebGL.prototype.getCurrentPageNumber=function(){var t;if(1==this.view)return this.options.rightToLeft?(t=this.options.pages.length-this.rightIndex,this.isFocusedRight()?t:t+1):(t=this.rightIndex,this.isFocusedLeft()?t:t+1)},FLIPBOOK.BookWebGL.prototype.prevPage=function(t){if(0!=this.flippedleft&&(this.clickedPage=null,1!=this.flippedleft||2*this.pages.length!=this.options.numPages||!this.options.rightToLeft||!this.options.oddPages)){var e,i=0;for(e=0;e<this.pages.length;e++){if(this.pages[e].flippingLeft)return;this.pages[e].flipping&&i++}var o=this.pages[this.flippedleft-1],s=this.pages[o.index-1];this.pages[o.index+2],this.pages[o.index+3];if(s&&i<5&&s.showMat(),1==this.view){if(!this.goingToPage){if(this.isFocusedRight())return void this.focusLeft(300,0,this.turnPageComplete);this.focusRight(600,200)}}else 1==this.flippedleft?this.focusRight(500):this.focusBoth(500);if(!o.flipping){var n,r=this;void 0!==t&&!t||(n=function(t){r.loadPages(),r.turnPageComplete()}),o.flipRight(n)}this.flippedleft--,this.flippedright++,this.setRightIndex(this.rightIndex-2)}},FLIPBOOK.BookWebGL.prototype.firstPage=function(){},FLIPBOOK.BookWebGL.prototype.flipFinnished=function(){this.needsUpdate=!0},FLIPBOOK.BookWebGL.prototype.lastPage=function(){},FLIPBOOK.BookWebGL.prototype.updateVisiblePages=function(){},FLIPBOOK.BookWebGL.prototype.loadMorePages=function(){for(var t=this.options.loadPagesF,e=this.options.loadPagesB,i=this.pages[this.flippedleft],o=this.pages[this.flippedleft-1],s=0;s<t;s++)(o=this.pages[this.flippedleft+s])&&o.load("back",function(){}),(i=this.pages[this.flippedleft+1+s])&&i.load("front",function(){});for(s=0;s<e;s++)(o=this.pages[this.flippedleft-2+s])&&o.load("back",function(){}),(i=this.pages[this.flippedleft-1+s])&&i.load("front",function(){})},FLIPBOOK.BookWebGL.prototype.updateHtmlLayer=function(){if(this.htmlLayer){for(var t=0;t<this.pages.length;t++)if(this.pages[t].flipping)return;this.htmlContentRightIndex=this.rightIndex,this.htmlLayerVisible=!1;var e=this.options.rightToLeft?this.options.pages.length-this.rightIndex-1:this.rightIndex,i=this.options.rightToLeft?e+1:e-1;if(this.options.doublePage)if(0==this.rightIndex){var o=this.options.pages[e].htmlContent;if(this.$pageL.hide(),this.$pageC.hide(),o){this.$pageRInner.empty();jQuery(o).appendTo(this.$pageRInner);this.$pageR.show(),this.htmlLayerVisible=!0}else this.$pageR.hide()}else if(this.rightIndex==2*this.pages.length){o=this.options.pages[i].htmlContent;if(this.$pageR.hide(),this.$pageC.hide(),o){this.$pageLInner.empty();jQuery(o).appendTo(this.$pageLInner);this.$pageL.show(),this.htmlLayerVisible=!0}else this.$pageL.hide()}else{if(this.$pageL.hide(),this.$pageR.hide(),o=this.options.pages[i].htmlContent||this.options.pages[e].htmlContent){this.$pageCInner.empty();jQuery(o).appendTo(this.$pageCInner);this.$pageC.show(),this.htmlLayerVisible=!0}else this.$pageC.hide()}else{if(this.$pageC.hide(),0==this.rightIndex)this.$pageL.hide();else if(this.options.pages[i].htmlContent){this.$pageLInner.empty();jQuery(this.options.pages[i].htmlContent).appendTo(this.$pageLInner);this.$pageL.show(),this.htmlLayerVisible=!0}else this.$pageL.hide();if(this.rightIndex==2*this.pages.length)this.$pageR.hide();else if(this.options.pages[e].htmlContent){this.$pageRInner.empty();jQuery(this.options.pages[e].htmlContent).appendTo(this.$pageRInner);this.$pageR.show(),this.htmlLayerVisible=!0}else this.$pageR.hide()}this.updateTool()}},FLIPBOOK.BookWebGL.prototype.updateTool=function(){"toolSelect"==this.options.main.tool?jQuery(".flipbook-textLayer").css("pointer-events","auto").removeClass(".flipbook-noselect"):jQuery(".flipbook-textLayer").css("pointer-events","none").addClass(".flipbook-noselect")},FLIPBOOK.BookWebGL.prototype.onZoom=function(){},FLIPBOOK.BookWebGL.prototype.render=function(t){this.rendering=t},FLIPBOOK.BookWebGL.prototype.zoomTo=function(t,e,i,o){if(!this.zooming){void 0===e&&(e=0);var s=this.centerContainer.position;if(void 0!==i&&void 0!==o){var n=this.zoom*this.wrapper.clientHeight/1e3,r=t*this.wrapper.clientHeight/1e3,h=(this.zoom,this.centerContainer.position),a=(i-this.wrapper.clientWidth/2)/n-h.x,p=(-o+this.wrapper.clientHeight/2)/n-h.y,c=(i-this.wrapper.clientWidth/2)/r-h.x,l=(-o+this.wrapper.clientHeight/2)/r-h.y;(s=h).x=h.x-(a-c),s.y=h.y-(p-l)}var d=this;this.options;if(newZoom=t>this.options.zoomMax?this.options.zoomMax:t,newZoom=t<this.options.zoomMin?this.options.zoomMin:t,newZoom==this.options.zoom){this.options;var u=this.isFocusedLeft();1==this.view?u?this.focusLeft():this.focusRight():this.centerContainer.position.set(0,0,0),this.updateBookPosition()}(e=0)<e?this.zooming||(this.zooming=!0,new FLIPBOOK.TWEEN.Tween(this).to({zoom:newZoom},e).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.In).onUpdate(this.updateCameraPosition).onComplete(function(){d.zooming=!1}).start(),new FLIPBOOK.TWEEN.Tween(this.centerContainer.position).to({x:s.x,y:s.y},e).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.In).onUpdate(function(){}).onComplete(function(){}).start(),this.htmlLayer&&new FLIPBOOK.TWEEN.Tween(this.htmlLayer.position).to({x:s.x,y:s.y},e).easing(FLIPBOOK.TWEEN.Easing.Sinusoidal.In).start()):(this.zoom=newZoom,this.centerContainer.position.set(s.x,s.y,0),d.updateHtmlLayerPosition(),this.updateCameraPosition(),this.zooming=!1),t<=1&&t<=this.zoom&&this.updateBookPosition(),this.options.main.onZoom(newZoom),this.loadPages()}},FLIPBOOK.BookWebGL.prototype.tiltTo=function(t){var e=this.tilt+.3*t;e=(e=e>this.options.tiltMax?this.options.tiltMax:e)<this.options.tiltMin?this.options.tiltMin:e,this.tilt=e,this.updateCameraPosition()},FLIPBOOK.BookWebGL.prototype.panTo=function(t){var e=this.pan-.2*t;e=(e=e>this.options.panMax?this.options.panMax:e)<this.options.panMin?this.options.panMin:e,this.pan=e,this.updateCameraPosition()},FLIPBOOK.BookWebGL.prototype._bind=function(t,e,i){(e||this.wrapper).addEventListener(t,this,!!i)},FLIPBOOK.BookWebGL.prototype.handleEvent=function(t){var e=this;switch(t.type){case"mousedown":e._start(t);break;case"touchstart":e._touchstart(t);break;case"touchmove":e._touchmove(t);break;case"mousemove":e._move(t);break;case"mouseout":case"mouseup":case"touchend":e._end(t)}},FLIPBOOK.BookWebGL.prototype.resetCameraPosition=function(){this.centerContainer.position.set(0,0,0)},FLIPBOOK.BookWebGL.prototype._start=function(t){this.mouseDown=!0,this.onMouseMove="",this.pointX=t.pageX,this.pointY=t.pageY,this.startPoint=t;var e=this._getVector(t);e.unproject(this.Camera);var i=new THREE.Raycaster(this.Camera.position,e.sub(this.Camera.position).normalize()).intersectObjects(this.pages,!0);this.pageMouseDown=0<i.length,"canvas"==t.target.nodeName.toLowerCase()&&!this.pageMouseDown&&this.options.lightBox&&this.options.lightboxCloseOnClick&&this.options.main.lightbox.closeLightbox()},FLIPBOOK.BookWebGL.prototype._touchstart=function(t){if(1<t.touches.length){this.touches=[],this.touches[0]={pageX:t.touches[0].pageX,pageY:t.touches[0].pageY},this.touches[1]={pageX:t.touches[1].pageX,pageY:t.touches[1].pageY};var e=Math.abs(this.touches[0].pageX-this.touches[1].pageX),i=Math.abs(this.touches[0].pageY-this.touches[1].pageY);this.touchesDistStart=Math.sqrt(e*e+i*i)}else t=t.touches[0],this._start(t)},FLIPBOOK.BookWebGL.prototype._getVector=function(t){var e=jQuery(this.canvas).width(),i=jQuery(this.canvas).height(),o=t.pageX-jQuery(this.canvas).offset().left,s=t.pageY-jQuery(this.canvas).offset().top;jQuery(this.canvas).offset().x,jQuery(this.canvas).offset().y;return new THREE.Vector3(o/e*2-1,-s/i*2+1,.5)},FLIPBOOK.BookWebGL.prototype._touchmove=function(t){1<t.touches.length||(t=t.touches[0],this._move(t))},FLIPBOOK.BookWebGL.prototype._move=function(t){var e=this._getVector(t);e.unproject(this.Camera);var i=new THREE.Raycaster(this.Camera.position,e.sub(this.Camera.position).normalize()).intersectObjects(this.pages,!0),o=t,s=.5*(o.pageX-this.pointX),n=.5*(o.pageY-this.pointY);if(this.pointX=o.pageX,this.pointY=o.pageY,!this.mouseDown)return this.onMouseMove="",void(this.options.rotateCameraOnMouseMove&&(this.tilt=this.options.tiltMin2+(this.options.tiltMax2-this.options.tiltMin2)*(1-this.pointY/jQuery(this.canvas).height()),this.pan=this.options.panMin2+(this.options.panMax2-this.options.panMin2)*this.pointX/jQuery(this.canvas).width(),this.updateCameraPosition()));if(0<i.length?""==this.onMouseMove&&1<this.zoom&&(this.onMouseMove="scroll"):""==this.onMouseMove&&(this.onMouseMove="rotate"),"scroll"==this.onMouseMove){if("toolSelect"==this.options.main.tool)return;0==s&&0==n||(this.moved=!0,this.centerContainer.position.x+=1e4*s/(this.cameraZ*this.zoom*this.zoom),this.centerContainer.position.y-=1e4*n/(this.cameraZ*this.zoom*this.zoom)),this.updateHtmlLayerPosition()}else if("rotate"==this.onMouseMove){var r=this.getRightPage(),h=this.getLeftPage();this.options.rotateCameraOnMouseMove||!this.options.rotateCameraOnMouseDrag||h&&h.dragging||r&&r.dragging||this.tiltTo(n)}},FLIPBOOK.BookWebGL.prototype._end=function(t){this.mouseDown=!1,void 0!==t.changedTouches&&(t=t.changedTouches[0]),this.pointX=t.pageX,this.pointY=t.pageY,this.endPoint=t;var e=this._getVector(this.endPoint);e.unproject(this.Camera);var i=new THREE.Raycaster(this.Camera.position,e.sub(this.Camera.position).normalize()).intersectObjects(this.pages,!0);if(0<i.length&&this.pageMouseDown&&!this.moved){var o=i[0];this.clickedPage=o.object.parent}this.pageMouseDown=!1,this.moved=!1},FLIPBOOK.BookWebGL.prototype.moveCamera=function(t,e){},FLIPBOOK.BookWebGL.prototype.enable=function(){this.enabled||(this.enabled=!0,this.initialized||(this.init3d(),this.createPages(),this.rendering=!1,this.onResize()),this.render(!0)),this.onResize()},FLIPBOOK.BookWebGL.prototype.disable=function(){this.enabled=!1,this.render(!1)};var MOD3=MOD3||{};!function(t){t.Constants={PI:Math.PI,invPI:1/Math.PI,halfPI:.5*Math.PI,doublePI:2*Math.PI,toRad:1/180*Math.PI,toDeg:1/180*Math.PI},t.ModConstant={LEFT:-1,RIGHT:1,NONE:0,X:1,Y:2,Z:4}}(MOD3),function(o){var e=o.Constants;o.XMath={},o.XMath.normalize=function(t,e,i){return e-t==0?1:o.XMath.trim(0,1,(i-t)/e)},o.XMath.toRange=function(t,e,i){return e-t==0?0:t+(e-t)*i},o.XMath.inRange=function(t,e,i,o){return void 0===o&&(o=!1),o?t<=i&&i<=e:t<i&&i<e},o.XMath.sign=function(t,e){return void 0===e&&(e=0),0==t?e:0<t?1:-1},o.XMath.trim=function(t,e,i){return Math.min(e,Math.max(t,i))},o.XMath.wrap=function(t,e,i){return i<t?i+(e-t):e<=i?i-(e-t):i},o.XMath.degToRad=function(t){return t*e.toRad},o.XMath.radToDeg=function(t){return t*e.toDeg},o.XMath.presicion=function(t,e){var i=Math.pow(10,e);return Math.round(t*i)/i},o.XMath.uceil=function(t){return t<0?Math.floor(t):Math.ceil(t)}}(MOD3),function(e){e.Range=function(t,e){this.start=0,this.end=1,void 0!==t&&(this.start=t),void 0!==e&&(this.end=e)},e.Range.prototype.getSize=function(){return this.end-this.start},e.Range.prototype.move=function(t){this.start+=t,this.end+=t},e.Range.prototype.isIn=function(t){return t>=this.start&&t<=this.end},e.Range.prototype.normalize=function(t){return e.XMath.normalize(this.start,this.end,t)},e.Range.prototype.toRange=function(t){return e.XMath.toRange(this.start,this.end,t)},e.Range.prototype.trim=function(t){return e.XMath.trim(this.start,this.end,t)},e.Range.prototype.interpolate=function(t,e){return this.toRange(e.normalize(t))},e.Range.prototype.toString=function(){return"["+this.start+" - "+this.end+"]"}}(MOD3),function(t){t.Phase=function(t){void(this.value=0)!==t&&(this.value=t)},t.Phase.prototype.getPhasedValue=function(){return Math.sin(this.value)},t.Phase.prototype.getAbsPhasedValue=function(){return Math.abs(this.getPhasedValue())},t.Phase.prototype.getNormValue=function(){return.5*(this.getPhasedValue()+1)}}(MOD3),function(t){t.Point=function(t,e){this.y=this.x=0,void 0!==t&&(this.x=t),void 0!==e&&(this.y=e)},t.Point.prototype.clone=function(){return new t.Point(this.x,this.y)}}(MOD3),function(e){e.Matrix=function(t,e,i,o){this.m11=1,this.m21=this.m12=0,this.m22=1,void 0!==t&&(this.m11=t),void 0!==e&&(this.m12=e),void 0!==i&&(this.m21=i),void 0!==o&&(this.m22=o)},e.Matrix.prototype.rotate=function(t){var e=Math.cos(t);t=Math.sin(t);return this.m11=e,this.m12=-t,this.m21=t,this.m22=e,this},e.Matrix.prototype.scale=function(t,e){return this.m21=this.m12=0,void 0!==t&&(this.m22=this.m11=t),void 0!==e&&(this.m22=e),this},e.Matrix.prototype.multiply=function(t){var e=this.m11,i=this.m12,o=this.m21,s=this.m22,n=t.m11,r=t.m12,h=t.m21;t=t.m22;return this.m11=e*n+i*h,this.m12=e*r+i*t,this.m21=o*n+s*h,this.m22=o*r+s*t,this},e.Matrix.prototype.transformPoint=function(t){return new e.Point(this.m11*t.x+this.m12*t.y,this.m21*t.x+this.m22*t.y)}}(MOD3),function(a){a.Vector3=function(t,e,i){this.z=this.y=this.x=null,this.x=t,this.y=e,this.z=i},a.Vector3.ZERO=function(){return new a.Vector3(0,0,0)},a.Vector3.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.Vector3.prototype.clone=function(){return new a.Vector3(this.x,this.y,this.z)},a.Vector3.prototype.equals=function(t){return this.x==t.x&&this.y==t.y&&this.z==t.z},a.Vector3.prototype.zero=function(){this.x=this.y=this.z=0},a.Vector3.prototype.negate=function(){return new a.Vector3(-this.x,-this.y,-this.z)},a.Vector3.prototype.add=function(t){return new a.Vector3(this.x+t.x,this.y+t.y,this.z+t.z)},a.Vector3.prototype.subtract=function(t){return new a.Vector3(this.x-t.x,this.y-t.y,this.z-t.z)},a.Vector3.prototype.multiplyScalar=function(t){return new a.Vector3(this.x*t,this.y*t,this.z*t)},a.Vector3.prototype.multiply=function(t){return new a.Vector3(this.x*t.x,this.y*t.y,this.z*t.z)},a.Vector3.prototype.divide=function(t){return t=1/t,new a.Vector3(this.x*t,this.y*t,this.z*t)},a.Vector3.prototype.normalize=function(){var t=this.x,e=this.y,i=this.z;0<(t=t*t+e*e+i*i)&&(t=1/Math.sqrt(t),this.x*=t,this.y*=t,this.z*=t)},a.Vector3.prototype.getMagnitude=function(){var t=this.x,e=this.y,i=this.z;return Math.sqrt(t*t+e*e+i*i)},a.Vector3.prototype.setMagnitude=function(t){this.normalize(),this.x*=t,this.y*=t,this.z*=t},a.Vector3.prototype.toString=function(){return"["+this.x+" , "+this.y+" , "+this.z+"]"},a.Vector3.prototype.sum=function(t,e){return t.add(e)},a.Vector3.prototype.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},a.Vector3.prototype.cross=function(t,e){var i=t.x,o=t.y,s=t.z,n=e.x,r=e.y,h=e.z;return new a.Vector3(o*h-s*r,s*n-i*h,i*r-o*n)},a.Vector3.prototype.distance=function(t,e){var i=t.x-e.x,o=t.y-e.y,s=t.z-e.z;return Math.sqrt(i*i+o*o+s*s)}}(MOD3),function(t){t.Matrix4=function(t,e,i,o,s,n,r,h,a,p,c,l,d,u,f,g){this.n11=1,this.n21=this.n14=this.n13=this.n12=0,this.n22=1,this.n32=this.n31=this.n24=this.n23=0,this.n33=1,this.n43=this.n42=this.n41=this.n34=0,this.n44=1,void 0!==t&&(this.n11=t),void 0!==e&&(this.n12=e),void 0!==i&&(this.n13=i),void 0!==o&&(this.n14=o),void 0!==s&&(this.n21=s),void 0!==n&&(this.n22=n),void 0!==r&&(this.n23=r),void 0!==h&&(this.n24=h),void 0!==a&&(this.n31=a),void 0!==p&&(this.n32=p),void 0!==c&&(this.n33=c),void 0!==l&&(this.n34=l),void 0!==d&&(this.n41=d),void 0!==u&&(this.n42=u),void 0!==f&&(this.n43=f),void 0!==g&&(this.n44=g)},t.Matrix4.prototype.translationMatrix=function(t,e,i){return this.n14=t,this.n24=e,this.n34=i,this},t.Matrix4.prototype.scaleMatrix=function(t,e,i){return this.n11=t,this.n22=e,this.n33=i,this},t.Matrix4.prototype.rotationMatrix=function(t,e,i,o){var s=Math.cos(o),n=Math.sin(o),r=t*e*(o=1-s),h=e*i*o,a=t*i*o,p=n*i,c=n*e;return n*=t,this.n11=s+t*t*o,this.n12=r-p,this.n13=c+a,this.n14=0,this.n21=p+r,this.n22=s+e*e*o,this.n23=h-n,this.n24=0,this.n31=a-c,this.n32=n+h,this.n33=s+i*i*o,this.n34=0,this},t.Matrix4.prototype.calculateMultiply=function(t,e){var i=t.n11,o=e.n11,s=t.n21,n=e.n21,r=t.n31,h=e.n31,a=t.n12,p=e.n12,c=t.n22,l=e.n22,d=t.n32,u=e.n32,f=t.n13,g=e.n13,m=t.n23,y=e.n23,x=t.n33,M=e.n33,v=t.n14,P=e.n14,L=t.n24,O=e.n24,b=t.n34,w=e.n34;this.n11=i*o+a*n+f*h,this.n12=i*p+a*l+f*u,this.n13=i*g+a*y+f*M,this.n14=i*P+a*O+f*w+v,this.n21=s*o+c*n+m*h,this.n22=s*p+c*l+m*u,this.n23=s*g+c*y+m*M,this.n24=s*P+c*O+m*w+L,this.n31=r*o+d*n+x*h,this.n32=r*p+d*l+x*u,this.n33=r*g+d*y+x*M,this.n34=r*P+d*O+x*w+b},t.Matrix4.prototype.multiply=function(t,e){return this.calculateMultiply(t,e),this},t.Matrix4.prototype.multiplyVector=function(t,e){var i=e.x,o=e.y,s=e.z;e.x=i*t.n11+o*t.n12+s*t.n13+t.n14,e.y=i*t.n21+o*t.n22+s*t.n23+t.n24,e.z=i*t.n31+o*t.n32+s*t.n33+t.n34}}(MOD3),function(i){i.VertexProxy=function(t){this.originalZ=this.originalY=this.originalX=this.ratioZ=this.ratioY=this.ratioX=null,void 0!==t&&(this.vertex=t)},i.VertexProxy.prototype.setVertex=function(){},i.VertexProxy.prototype.setRatios=function(t,e,i){this.ratioX=t,this.ratioY=e,this.ratioZ=i},i.VertexProxy.prototype.setOriginalPosition=function(t,e,i){this.originalX=t,this.originalY=e,this.originalZ=i},i.VertexProxy.prototype.getX=function(){},i.VertexProxy.prototype.getY=function(){},i.VertexProxy.prototype.getZ=function(){},i.VertexProxy.prototype.setX=function(){},i.VertexProxy.prototype.setY=function(){},i.VertexProxy.prototype.setZ=function(){},i.VertexProxy.prototype.getValue=function(t){switch(t){case i.ModConstant.X:return this.getX();case i.ModConstant.Y:return this.getY();case i.ModConstant.Z:return this.getZ()}return 0},i.VertexProxy.prototype.setValue=function(t,e){switch(t){case i.ModConstant.X:this.setX(e);break;case i.ModConstant.Y:this.setY(e);break;case i.ModConstant.Z:this.setZ(e)}},i.VertexProxy.prototype.getRatio=function(t){switch(t){case i.ModConstant.X:return this.ratioX;case i.ModConstant.Y:return this.ratioY;case i.ModConstant.Z:return this.ratioZ}return-1},i.VertexProxy.prototype.getOriginalValue=function(t){switch(t){case i.ModConstant.X:return this.originalX;case i.ModConstant.Y:return this.originalY;case i.ModConstant.Z:return this.originalZ}return 0},i.VertexProxy.prototype.reset=function(){this.setX(this.originalX),this.setY(this.originalY),this.setZ(this.originalZ)},i.VertexProxy.prototype.collapse=function(){this.originalX=this.getX(),this.originalY=this.getY(),this.originalZ=this.getZ()},i.VertexProxy.prototype.getVector=function(){return new i.Vector3(this.getX(),this.getY(),this.getZ())},i.VertexProxy.prototype.setVector=function(t){this.setX(t.x),this.setY(t.y),this.setZ(t.z)},i.VertexProxy.prototype.getRatioVector=function(){return new i.Vector3(this.ratioX,this.ratioY,this.ratioZ)}}(MOD3),function(t){t.FaceProxy=function(){this.vertices=[]},t.FaceProxy.prototype.addVertex=function(t){this.vertices.push(t)},t.FaceProxy.prototype.getVertices=function(){return this.vertices}}(MOD3),function(m){m.MeshProxy=function(){this.depth=this.height=this.width=this.minAxis=this.midAxis=this.maxAxis=this.minZ=this.minY=this.minX=this.maxZ=this.maxY=this.maxX=null,this.vertices=[],this.faces=[],this.mesh=null},m.MeshProxy.prototype.getVertices=function(){return this.vertices},m.MeshProxy.prototype.getFaces=function(){return this.faces},m.MeshProxy.prototype.analyzeGeometry=function(){for(var t,e,i,o,s,n,r,h,a,p,c=this.getVertices(),l=c.length,d=l,u=!0,f=Math.min,g=Math.max;0<=--d;)e=(t=c[d]).getX(),i=t.getY(),o=t.getZ(),u?(s=n=e,r=h=i,a=p=o,u=!1):(s=f(s,e),r=f(r,i),a=f(a,o),n=g(n,e),h=g(h,i),p=g(p,o)),t.setOriginalPosition(e,i,o);for(e=n-s,i=h-r,depth=p-a,this.width=e,this.height=i,this.depth=depth,this.minX=s,this.maxX=n,this.minY=r,this.maxY=h,this.minZ=a,this.maxZ=p,d=g(e,g(i,depth)),f=f(e,f(i,depth)),d==e&&f==i?(this.minAxis=m.ModConstant.Y,this.midAxis=m.ModConstant.Z,this.maxAxis=m.ModConstant.X):d==e&&f==depth?(this.minAxis=m.ModConstant.Z,this.midAxis=m.ModConstant.Y,this.maxAxis=m.ModConstant.X):d==i&&f==e?(this.minAxis=m.ModConstant.X,this.midAxis=m.ModConstant.Z,this.maxAxis=m.ModConstant.Y):d==i&&f==depth?(this.minAxis=m.ModConstant.Z,this.midAxis=m.ModConstant.X,this.maxAxis=m.ModConstant.Y):d==depth&&f==e?(this.minAxis=m.ModConstant.X,this.midAxis=m.ModConstant.Y,this.maxAxis=m.ModConstant.Z):d==depth&&f==i&&(this.minAxis=m.ModConstant.Y,this.midAxis=m.ModConstant.X,this.maxAxis=m.ModConstant.Z),d=l;0<=--d;)(t=c[d]).setRatios((t.getX()-s)/e,(t.getY()-r)/i,(t.getZ()-a)/depth)},m.MeshProxy.prototype.resetGeometry=function(){for(var t=this.getVertices(),e=t.length;0<=--e;)t[e].reset()},m.MeshProxy.prototype.collapseGeometry=function(){for(var t=this.getVertices(),e=t.length;0<=--e;)t[e].collapse();this.analyzeGeometry()},m.MeshProxy.prototype.getMin=function(t){switch(t){case m.ModConstant.X:return this.minX;case m.ModConstant.Y:return this.minY;case m.ModConstant.Z:return this.minZ}return-1},m.MeshProxy.prototype.getMax=function(t){switch(t){case m.ModConstant.X:return this.maxX;case m.ModConstant.Y:return this.maxY;case m.ModConstant.Z:return this.maxZ}return-1},m.MeshProxy.prototype.getSize=function(t){switch(t){case m.ModConstant.X:return this.width;case m.ModConstant.Y:return this.height;case m.ModConstant.Z:return this.depth}return-1},m.MeshProxy.prototype.setMesh=function(t){this.mesh=t,this.vertices=[],this.faces=[]},m.MeshProxy.prototype.postApply=function(){},m.MeshProxy.prototype.updateMeshPosition=function(){}}(MOD3),function(t){t.Modifier=function(){this.mod=null},t.Modifier.prototype.setModifiable=function(t){this.mod=t},t.Modifier.prototype.getVertices=function(){return this.mod.getVertices()},t.Modifier.prototype.apply=function(){}}(MOD3),MOD3.Library3d=function(){this.id="",this.vertexClass=this.meshClass=null},function(t){t.PluginFactory={},t.PluginFactory.getMeshProxy=function(t){return new t.meshClass}}(MOD3),function(i){i.ModifierStack=function(t,e){this.lib3d=t,this.stack=this.baseMesh=null,this.baseMesh=i.PluginFactory.getMeshProxy(t),this.baseMesh.setMesh(e),this.baseMesh.analyzeGeometry(),this.stack=[]},i.ModifierStack.prototype.addModifier=function(t){t.setModifiable(this.baseMesh),this.stack.push(t)},i.ModifierStack.prototype.apply=function(){this.baseMesh.resetGeometry();for(var t=this.stack,e=t.length,i=0;i<e;)t[i++].apply();this.baseMesh.postApply()},i.ModifierStack.prototype.collapse=function(){this.apply(),this.baseMesh.collapseGeometry(),this.stack=[]},i.ModifierStack.prototype.clear=function(){this.stack=[]},i.ModifierStack.prototype.getMeshInfo=function(){return this.baseMesh}}(MOD3),function(o){o.Pivot=function(t,e,i){this.pivot=new o.Vector3(t,e,i)},o.Pivot.prototype=new o.Modifier,o.Pivot.prototype.constructor=o.Pivot,o.Pivot.prototype.setMeshCenter=function(){var t=this.mod;this.pivot=new o.Vector3(-(t.minX+.5*t.width),-(t.minY+.5*t.height),-(t.minZ+.5*t.depth))},o.Pivot.prototype.apply=function(){for(var t,e,i=this.mod.getVertices(),o=i.length,s=this.pivot;0<=--o;)e=(t=i[o]).getVector().clone(),t.setVector(e.add(s));this.mod.updateMeshPosition(s.clone().negate())}}(MOD3),function(P){P.Bend=function(t,e,i){this.diagAngle=this.angle=this.offset=this.force=null,this.constraint=P.ModConstant.NONE,this.m2=this.m1=this.origin=this.height=this.width=this.mid=this.min=this.max=null,this.switchAxes=!1,this.force=t,this.offset=e,this.setAngle(i)},P.Bend.prototype=new P.Modifier,P.Bend.prototype.constructor=P.Bend,P.Bend.prototype.setAngle=function(t){this.angle=t,this.m1=new P.Matrix,this.m1.rotate(t),this.m2=new P.Matrix,this.m2.rotate(-t)},P.Bend.prototype.setModifiable=function(t){P.Modifier.prototype.setModifiable.call(this,t),this.max=this.switchAxes?this.mod.midAxis:this.mod.maxAxis,this.min=this.mod.minAxis,this.mid=this.switchAxes?this.mod.maxAxis:this.mod.midAxis,this.width=this.mod.getSize(this.max),this.height=this.mod.getSize(this.mid),this.origin=this.mod.getMin(this.max),this.diagAngle=Math.atan(this.width/this.height)},P.Bend.prototype.apply=function(){if(0!=this.force)for(var t,e,i,o,s=this.mod.getVertices(),n=s.length,r=this.width,h=this.offset,a=this.origin,p=this.max,c=this.min,l=this.mid,d=this.m1,u=this.m2,f=a+r*h,g=r/Math.PI/this.force,m=P.Constants.doublePI*(r/(g*P.Constants.doublePI)),y=1/r,x=P.Constants.halfPI,M=Math.sin,v=Math.cos;0<=--n;)t=(r=s[n]).getValue(p),e=r.getValue(l),i=r.getValue(c),t=(e=d.transformPoint(new P.Point(t,e))).x,e=e.y,o=(t-a)*y,this.constraint==P.ModConstant.LEFT&&o<=h||this.constraint==P.ModConstant.RIGHT&&h<=o||(t=M(o=x-m*h+m*o)*(g+i),o=v(o)*(g+i),i=t-g,t=f-o),t=(e=u.transformPoint(new P.Point(t,e))).x,e=e.y,r.setValue(p,t),r.setValue(l,e),r.setValue(c,i)}}(MOD3),function(t){t.Bloat=function(){this.center=t.Vector3.ZERO(),this.radius=0,this.a=.01,this.u=t.Vector3.ZERO()},t.Bloat.prototype=new t.Modifier,t.Bloat.prototype.constructor=t.Bloat,t.Bloat.prototype.setRadius=function(t){this.radius=Math.max(0,t)},t.Bloat.prototype.setA=function(t){this.a=Math.max(0,t)},t.Bloat.prototype.apply=function(){for(var t,e,i=this.mod.getVertices(),o=i.length,s=this.center,n=this.radius,r=this.a;0<=--o;)t=i[o],this.u.x=t.getX()-s.x,this.u.y=t.getY()-s.y,this.u.z=t.getZ()-s.z,e=this.u.getMagnitude(),this.u.setMagnitude(e+n*Math.exp(-e*r)),t.setX(this.u.x+s.x),t.setY(this.u.y+s.y),t.setZ(this.u.z+s.z)}}(MOD3),function(h){h.Twist=function(t){this.vector=new h.Vector3(0,1,0),this.angle=t,this.center=h.Vector3.ZERO()},h.Twist.prototype=new h.Modifier,h.Twist.prototype.constructor=h.Twist,h.Twist.prototype.apply=function(){this.vector.normalize();var t,e=(r=this.mod).getVertices(),i=e.length,o=this.vector,s=this.angle,n=this.center,r=1/new h.Vector3(.5*r.maxX,.5*r.maxY,.5*r.maxZ).getMagnitude()*s;for(n=-h.Vector3.dot(o,n);0<=--i;)t=(s=e[i]).getX()*o.x+s.getY()*o.y+s.getZ()*o.z+n,this.twistPoint(s,t*r)},h.Twist.prototype.twistPoint=function(t,e){var i=(new h.Matrix4).translationMatrix(t.getX(),t.getY(),t.getZ());i=(new h.Matrix4).multiply((new h.Matrix4).rotationMatrix(this.vector.x,this.vector.y,this.vector.z,e),i);t.setX(i.n14),t.setY(i.n24),t.setZ(i.n34)}}(MOD3),function(g){g.Skew=function(t){this.force=0,this.skewAxis=null,void 0!==t&&(this.force=t),this.offset=.5,this.constraint=g.ModConstant.NONE,this.falloff=this.power=1,this.swapAxes=this.oneSide=this.inverseFalloff=!1},g.Skew.prototype=new g.Modifier,g.Skew.prototype.constructor=g.Skew,g.Skew.prototype.setModifiable=function(t){g.Modifier.prototype.setModifiable.call(this,t),this.skewAxis=this.skewAxis||this.mod.maxAxis},g.Skew.prototype.apply=function(){for(var t,e,i,o=this.mod.getVertices(),s=o.length,n=this.constraint,r=this.skewAxis,h=this.offset,a=this.oneSide,p=this.inverseFalloff,c=this.falloff,l=1-c,d=this.power,u=this.force,f=this.getDisplaceAxis();0<=--s;)t=o[s],n==g.ModConstant.LEFT&&t.getRatio(r)<=h||n==g.ModConstant.RIGHT&&t.getRatio(r)>h||(e=t.getRatio(r)-h,a&&(e=Math.abs(e)),i=t.getRatio(f),p&&(i=1-i),i=c+i*l,e=Math.pow(Math.abs(e),d)*g.XMath.sign(e,1),e=t.getValue(f)+u*e*i,t.setValue(f,e))},g.Skew.prototype.getDisplaceAxis=function(){switch(this.skewAxis){case g.ModConstant.X:return this.swapAxes?g.ModConstant.Z:g.ModConstant.Y;case g.ModConstant.Y:return this.swapAxes?g.ModConstant.Z:g.ModConstant.X;case g.ModConstant.Z:return this.swapAxes?g.ModConstant.Y:g.ModConstant.X;default:return 0}}}(MOD3),function(p){p.Taper=function(t){this.power=this.force=null,this.start=0,this.end=1,this.vector=new p.Vector3(1,0,1),this.vector2=new p.Vector3(0,1,0),void 0!==t&&(this.force=t),this.power=1},p.Taper.prototype=new p.Modifier,p.Taper.prototype.constructor=p.Taper,p.Taper.prototype.setFalloff=function(t,e){this.start=0,this.end=1,void 0!==t&&(this.start=t),void 0!==e&&(this.end=e)},p.Taper.prototype.apply=function(){for(var t,e,i,o=this.mod.getVertices(),s=o.length,n=this.vector,r=this.vector2,h=this.force,a=this.power;0<=--s;)e=(t=o[s]).getRatioVector().multiply(r),e=h*Math.pow(e.getMagnitude(),a),e=(new p.Matrix4).scaleMatrix(1+e*n.x,1+e*n.y,1+e*n.z),i=t.getVector(),(new p.Matrix4).multiplyVector(e,i),t.setVector(i)}}(MOD3),function(h){h.Wheel=function(){this.radius=this.roll=this.turn=this.speed=null,this.steerVector=new h.Vector3(0,1,0),this.rollVector=new h.Vector3(0,0,1),this.roll=this.turn=this.speed=0},h.Wheel.prototype=new h.Modifier,h.Wheel.prototype.constructor=h.Wheel,h.Wheel.prototype.setModifiable=function(t){h.Modifier.prototype.setModifiable.call(this,t),this.radius=.5*this.mod.width},h.Wheel.prototype.apply=function(){this.roll+=this.speed;var t,e=this.mod.getVertices(),i=e.length,o=this.steerVector,s=this.turn,n=this.rollVector,r=this.roll;for(r=0!=s?(t=(new h.Matrix4).rotationMatrix(o.x,o.y,o.z,s),o=n.clone(),(new h.Matrix4).multiplyVector(t,o),(new h.Matrix4).rotationMatrix(o.x,o.y,o.z,r)):(new h.Matrix4).rotationMatrix(n.x,n.y,n.z,r);0<=--i;)n=(o=e[i]).getVector().clone(),0!=s&&(new h.Matrix4).multiplyVector(t,n),(new h.Matrix4).multiplyVector(r,n),o.setX(n.x),o.setY(n.y),o.setZ(n.z)},h.Wheel.prototype.getStep=function(){return this.radius*this.speed*h.Constants.invPI},h.Wheel.prototype.getPerimeter=function(){return this.radius*h.Constants.doublePI}}(MOD3),function(a){a.Break=function(t,e){this.bv=new a.Vector3(0,1,0),this.angle=this.offset=0,void 0!==t&&(this.offset=t),void 0!==e&&(this.angle=e),this.range=new a.Range(0,1)},a.Break.prototype=new a.Modifier,a.Break.prototype.constructor=a.Break,a.Break.prototype.apply=function(){var t,e,i,o=(i=this.mod).getVertices(),s=o.length,n=this.range,r=this.angle,h=this.bv;for(t=(i=new a.Vector3(0,0,-(i.minZ+i.depth*this.offset))).negate(),e=(new a.Matrix4).rotationMatrix(h.x,h.y,h.z,r);0<=--s;)0<=(h=(h=(r=o[s]).getVector()).add(i)).z&&n.isIn(r.ratioY)&&(new a.Matrix4).multiplyVector(e,h),h=h.add(t),r.setX(h.x),r.setY(h.y),r.setZ(h.z)}}(MOD3),function(e){e.Noise=function(t){this.force=0,this.axc=e.ModConstant.NONE,this.end=this.start=0,void 0!==t&&(this.force=t)},e.Noise.prototype=new e.Modifier,e.Noise.prototype.constructor=e.Noise,e.Noise.prototype.constraintAxes=function(t){this.axc=t},e.Noise.prototype.setFalloff=function(t,e){this.start=0,this.end=1,void 0!==t&&(this.start=t),void 0!==e&&(this.end=e)},e.Noise.prototype.apply=function(){for(var t,e,i,o=this.mod,s=this.axc,n=this.start,r=this.end,h=o.getVertices(),a=h.length,p=this.force,c=.5*p,l=Math.random;0<=--a;)t=h[a],e=l()*p-c,i=t.getRatio(o.maxAxis),n<r?(i<n&&(i=0),r<i&&(i=1)):r<n?(n<(i=1-i)&&(i=0),i<r&&(i=1)):i=1,1&s||t.setX(t.getX()+e*i),s>>1&1||t.setY(t.getY()+e*i),s>>2&1||t.setZ(t.getZ()+e*i)}}(MOD3),function(t){t.LibraryThree=function(){this.id="Three.js",this.meshClass=t.MeshThree,this.vertexClass=t.VertexThree},t.LibraryThree.prototype=new t.Library3d,t.LibraryThree.prototype.constructor=t.LibraryThree}(MOD3),function(t){t.VertexThree=function(t){this.mesh=t},t.VertexThree.prototype=new t.VertexProxy,t.VertexThree.prototype.setVertex=function(t){this.vertex=t,this.originalX=t.x,this.originalY=t.y,this.originalZ=t.z},t.VertexThree.prototype.getX=function(){return this.vertex.x},t.VertexThree.prototype.getY=function(){return this.vertex.y},t.VertexThree.prototype.getZ=function(){return this.vertex.z},t.VertexThree.prototype.setX=function(t){this.vertex.x=t,(t=this.mesh).geometry.verticesNeedUpdate=!0,t.geometry.normalsNeedUpdate=!0,t.geometry.buffersNeedUpdate=!0,t.geometry.dynamic=!0},t.VertexThree.prototype.setY=function(t){this.vertex.y=t,(t=this.mesh).geometry.verticesNeedUpdate=!0,t.geometry.normalsNeedUpdate=!0,t.geometry.buffersNeedUpdate=!0,t.geometry.dynamic=!0},t.VertexThree.prototype.setZ=function(t){this.vertex.z=t,(t=this.mesh).geometry.verticesNeedUpdate=!0,t.geometry.normalsNeedUpdate=!0,t.geometry.buffersNeedUpdate=!0,t.geometry.dynamic=!0}}(MOD3),function(h){h.MeshThree=function(){},h.MeshThree.prototype=new h.MeshProxy,h.MeshThree.prototype.setMesh=function(t){h.MeshProxy.prototype.setMesh.call(this,t);t=[];var e,i=0,o=this.mesh.geometry.vertices,s=o.length,n=this.mesh.geometry.faces,r=n.length;for(i=0;i<s;)(e=new h.VertexThree(this.mesh)).setVertex(o[i]),this.vertices.push(e),t[o[i]]=e,i++;for(i=0;i<r;)s=new h.FaceProxy,n[i]instanceof THREE.Face3?(s.addVertex(t[o[n[i].a]]),s.addVertex(t[o[n[i].b]]),s.addVertex(t[o[n[i].c]])):n[i]instanceof THREE.Face4&&(s.addVertex(t[o[n[i].a]]),s.addVertex(t[o[n[i].b]]),s.addVertex(t[o[n[i].c]]),s.addVertex(t[o[n[i].d]])),this.faces.push(s),i++;delete lookup},h.MeshThree.prototype.updateMeshPosition=function(t){var e=this.mesh;e.position.x+=t.x,e.position.y+=t.y,e.position.z+=t.z}}(MOD3),function(t){t.LibraryPre3D=function(){this.id="pre3d.js",this.meshClass=t.MeshPre3D,this.vertexClass=t.VertexPre3D},t.LibraryThree.prototype=new t.Library3d,t.LibraryThree.prototype.constructor=t.LibraryPre3D}(MOD3),function(t){t.VertexPre3D=function(){},t.VertexPre3D.prototype=new t.VertexProxy,t.VertexPre3D.prototype.setVertex=function(t){this.vertex=t,this.originalX=t.x,this.originalY=t.y,this.originalZ=t.z},t.VertexPre3D.prototype.getX=function(){return this.vertex.x},t.VertexPre3D.prototype.getY=function(){return this.vertex.y},t.VertexPre3D.prototype.getZ=function(){return this.vertex.z},t.VertexPre3D.prototype.setX=function(t){this.vertex.x=t},t.VertexPre3D.prototype.setY=function(t){this.vertex.y=t},t.VertexPre3D.prototype.setZ=function(t){this.vertex.z=t}}(MOD3),function(h){h.MeshPre3D=function(){},h.MeshPre3D.prototype=new h.MeshProxy,h.MeshPre3D.prototype.setMesh=function(t){h.MeshProxy.prototype.setMesh.call(this,t);t=[];for(var e=this.mesh.vertices,i=this.mesh.quads,o=e.length,s=i.length,n=0;n<o;n++){var r=new h.VertexPre3D;r.setVertex(e[n]),this.vertices.push(r),t[e[n]]=r}for(n=0;n<s;n++)o=new h.FaceProxy,i[n]instanceof Pre3d.QuadFace&&(o.addVertex(t[e[i[n].i0]]),o.addVertex(t[e[i[n].i1]]),o.addVertex(t[e[i[n].i2]]),null!=i[n].i3&&o.addVertex(t[e[i[n].i3]])),this.faces.push(o);delete lookup},h.MeshPre3D.prototype.updateMeshPosition=function(){}}(MOD3),function(t){t.LibraryJ3D=function(){this.id="J3D",this.meshClass=t.MeshJ3D,this.vertexClass=t.VertexJ3D},t.LibraryJ3D.prototype=new t.Library3d,t.LibraryJ3D.prototype.constructor=t.LibraryJ3D}(MOD3),function(t){t.VertexJ3D=function(t){this.geometry=t},t.VertexJ3D.prototype=new t.VertexProxy,t.VertexJ3D.prototype.setVertex=function(t){this.vertex=t;var e=this.geometry;this.originalX=e.vertexPositionBuffer.data[t],this.originalY=e.vertexPositionBuffer.data[t+1],this.originalZ=e.vertexPositionBuffer.data[t+2]},t.VertexJ3D.prototype.getX=function(){return this.geometry.vertexPositionBuffer.data[this.vertex]},t.VertexJ3D.prototype.getY=function(){return this.geometry.vertexPositionBuffer.data[this.vertex+1]},t.VertexJ3D.prototype.getZ=function(){return this.geometry.vertexPositionBuffer.data[this.vertex+2]},t.VertexJ3D.prototype.setX=function(t){var e=this.geometry;e.vertexPositionBuffer.data[this.vertex]=t,e.replaceArray(e.vertexPositionBuffer,e.vertexPositionBuffer.data)},t.VertexJ3D.prototype.setY=function(t){var e=this.geometry;e.vertexPositionBuffer.data[this.vertex+1]=t,e.replaceArray(e.vertexPositionBuffer,e.vertexPositionBuffer.data)},t.VertexJ3D.prototype.setZ=function(t){var e=this.geometry;e.vertexPositionBuffer.data[this.vertex+2]=t,e.replaceArray(e.vertexPositionBuffer,e.vertexPositionBuffer.data)}}(MOD3),function(n){n.MeshJ3D=function(){},n.MeshJ3D.prototype=new n.MeshProxy,n.MeshJ3D.prototype.setMesh=function(t){n.MeshProxy.prototype.setMesh.call(this,t);var e,i=0,o=t.geometry.vertexPositionBuffer.data.length,s=t.geometry.vertexPositionBuffer.itemSize;for(i=0;i<o;)(e=new n.VertexJ3D(t.geometry)).setVertex(i),this.vertices.push(e),i+=s;this.faces=null},n.MeshJ3D.prototype.updateMeshPosition=function(t){var e=this.mesh;e.position.x+=t.x,e.position.y+=t.y,e.position.z+=t.z}}(MOD3),function(t){t.LibraryCopperlicht=function(){this.id="Copperlicht",this.meshClass=t.MeshCopperlicht,this.vertexClass=t.VertexCopperlicht},t.LibraryCopperlicht.prototype=new t.Library3d,t.LibraryCopperlicht.prototype.constructor=t.LibraryCopperlicht}(MOD3),function(t){t.VertexCopperlicht=function(t,e){this.node=t,this.buffer=e},t.VertexCopperlicht.prototype=new t.VertexProxy,t.VertexCopperlicht.prototype.setVertex=function(t){this.vertex=t,this.originalX=this.vertex.Pos.X,this.originalY=this.vertex.Pos.Y,this.originalZ=this.vertex.Pos.Z},t.VertexCopperlicht.prototype.getX=function(){return this.vertex.Pos.X},t.VertexCopperlicht.prototype.getY=function(){return this.vertex.Pos.Y},t.VertexCopperlicht.prototype.getZ=function(){return this.vertex.Pos.Z},t.VertexCopperlicht.prototype.setX=function(t){this.vertex.Pos.X=t,this.buffer.update(!0)},t.VertexCopperlicht.prototype.setY=function(t){this.vertex.Pos.Y=t,this.buffer.update(!0)},t.VertexCopperlicht.prototype.setZ=function(t){this.vertex.Pos.Z=t,this.buffer.update(!0)}}(MOD3),function(r){r.MeshCopperlicht=function(){},r.MeshCopperlicht.prototype=new r.MeshProxy,r.MeshCopperlicht.prototype.setMesh=function(t){r.MeshProxy.prototype.setMesh.call(this,t);t=this.mesh.getMesh().GetMeshBuffers();for(var e=[],i=0;i<t.length;i++)for(var o=(e=t[i].Vertices).length,s=0;s<o;s++){var n=new r.VertexCopperlicht(this.mesh,t[i]);n.setVertex(e[s]),this.vertices.push(n)}this.faces=null,delete lookup},r.MeshCopperlicht.prototype.updateMeshPosition=function(t){this.mesh.Pos.X+=t.x,this.mesh.Pos.Y+=t.y,this.mesh.Pos.Z+=t.z}}(MOD3),function(t){if("performance"in t==!1&&(t.performance={}),Date.now=Date.now||function(){return(new Date).getTime()},"now"in t.performance==!1){var e=t.performance.timing&&t.performance.timing.navigationStart?performance.timing.navigationStart:Date.now();t.performance.now=function(){return Date.now()-e}}}(this),FLIPBOOK.TWEEN=FLIPBOOK.TWEEN||function(){var i=[];return{REVISION:"14",getAll:function(){return i},removeAll:function(){i=[]},add:function(t){i.push(t)},remove:function(t){var e=i.indexOf(t);-1!==e&&i.splice(e,1)},update:function(t){if(0===i.length)return!1;var e=0;for(t=void 0!==t?t:window.performance.now();e<i.length;)i[e].update(t)?e++:i.splice(e,1);return!0}}}(),FLIPBOOK.TWEEN.Tween=function(t){var p=t,c={},l={},d={},u=1e3,f=0,g=!1,i=!1,m=0,y=null,x=FLIPBOOK.TWEEN.Easing.Linear.None,M=FLIPBOOK.TWEEN.Interpolation.Linear,v=[],P=null,L=!1,O=null,b=null,e=null;for(var o in t)c[o]=parseFloat(t[o],10);this.to=function(t,e){return void 0!==e&&(u=e),l=t,this},this.start=function(t){for(var e in FLIPBOOK.TWEEN.add(this),L=!(i=!0),y=void 0!==t?t:window.performance.now(),y+=m,l){if(l[e]instanceof Array){if(0===l[e].length)continue;l[e]=[p[e]].concat(l[e])}c[e]=p[e],c[e]instanceof Array==!1&&(c[e]*=1),d[e]=c[e]||0}return this},this.stop=function(){return i&&(FLIPBOOK.TWEEN.remove(this),i=!1,null!==e&&e.call(p),this.stopChainedTweens()),this},this.stopChainedTweens=function(){for(var t=0,e=v.length;t<e;t++)v[t].stop()},this.delay=function(t){return m=t,this},this.repeat=function(t){return f=t,this},this.yoyo=function(t){return g=t,this},this.easing=function(t){return x=t,this},this.interpolation=function(t){return M=t,this},this.chain=function(){return v=arguments,this},this.onStart=function(t){return P=t,this},this.onUpdate=function(t){return O=t,this},this.onComplete=function(t){return b=t,this},this.onStop=function(t){return e=t,this},this.update=function(t){var e;if(t<y)return!0;!1===L&&(null!==P&&P.call(p),L=!0);var i=(t-y)/u,o=x(i=1<i?1:i);for(e in l){var s=c[e]||0,n=l[e];n instanceof Array?p[e]=M(n,o):("string"==typeof n&&(n=s+parseFloat(n,10)),"number"==typeof n&&(p[e]=s+(n-s)*o))}if(null!==O&&O.call(p,o),1!=i)return!0;if(0<f){for(e in isFinite(f)&&f--,d){if("string"==typeof l[e]&&(d[e]=d[e]+parseFloat(l[e],10)),g){var r=d[e];d[e]=l[e],l[e]=r}c[e]=d[e]}return g&&0,y=t+m,!0}null!==b&&b.call(p);for(var h=0,a=v.length;h<a;h++)v[h].start(t);return!1}},FLIPBOOK.TWEEN.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var e,i=.1;return 0===t?0:1===t?1:(e=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*--t)*Math.sin((t-e)*(2*Math.PI)/.4))},Out:function(t){var e,i=.1;return 0===t?0:1===t?1:(e=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},InOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(e=!i||i<1?(i=1,.1):.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*--t)*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*--t)*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return--t*t*(2.70158*t+1.70158)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((1+e)*t-e)*.5:.5*((t-=2)*t*((1+e)*t+e)+2)}},Bounce:{In:function(t){return 1-FLIPBOOK.TWEEN.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*FLIPBOOK.TWEEN.Easing.Bounce.In(2*t):.5*FLIPBOOK.TWEEN.Easing.Bounce.Out(2*t-1)+.5}}},FLIPBOOK.TWEEN.Interpolation={Linear:function(t,e){var i=t.length-1,o=i*e,s=Math.floor(o),n=FLIPBOOK.TWEEN.Interpolation.Utils.Linear;return e<0?n(t[0],t[1],o):1<e?n(t[i],t[i-1],i-o):n(t[s],t[i<s+1?i:s+1],o-s)},Bezier:function(t,e){var i,o=0,s=t.length-1,n=Math.pow,r=FLIPBOOK.TWEEN.Interpolation.Utils.Bernstein;for(i=0;i<=s;i++)o+=n(1-e,s-i)*n(e,i)*t[i]*r(s,i);return o},CatmullRom:function(t,e){var i=t.length-1,o=i*e,s=Math.floor(o),n=FLIPBOOK.TWEEN.Interpolation.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(s=Math.floor(o=i*(1+e))),n(t[(s-1+i)%i],t[s],t[(s+1)%i],t[(s+2)%i],o-s)):e<0?t[0]-(n(t[0],t[0],t[1],t[1],-o)-t[0]):1<e?t[i]-(n(t[i],t[i],t[i-1],t[i-1],o-i)-t[i]):n(t[s?s-1:0],t[s],t[i<s+1?i:s+1],t[i<s+2?i:s+2],o-s)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=FLIPBOOK.TWEEN.Interpolation.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:function(){var o=[1];return function(t){var e,i=1;if(o[t])return o[t];for(e=t;1<e;e--)i*=e;return o[t]=i}}(),CatmullRom:function(t,e,i,o,s){var n=.5*(i-t),r=.5*(o-e),h=s*s;return(2*e-2*i+n+r)*(s*h)+(-3*e+3*i-2*n-r)*h+n*s+e}}},FLIPBOOK.CSS3DObject=function(t){THREE.Object3D.call(this),this.element=t,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&null!==t.element.parentNode&&t.element.parentNode.removeChild(t.element)})})},FLIPBOOK.CSS3DObject.prototype=Object.create(THREE.Object3D.prototype),FLIPBOOK.CSS3DObject.prototype.constructor=FLIPBOOK.CSS3DObject,FLIPBOOK.CSS3DSprite=function(t){FLIPBOOK.CSS3DObject.call(this,t)},FLIPBOOK.CSS3DSprite.prototype=Object.create(FLIPBOOK.CSS3DObject.prototype),FLIPBOOK.CSS3DSprite.prototype.constructor=FLIPBOOK.CSS3DSprite,FLIPBOOK.CSS3DRenderer=function(){var i,o,h,a,l=this,d=new THREE.Matrix4,u={camera:{fov:0,style:""},objects:new WeakMap},p=document.createElement("div");p.style.overflow="hidden",this.domElement=p;var f=document.createElement("div");f.style.WebkitTransformStyle="preserve-3d",f.style.transformStyle="preserve-3d",f.style.pointerEvents="none",p.appendChild(f);var g=/Trident/i.test(navigator.userAgent);function c(t){return Math.abs(t)<1e-10?0:t}function m(t){var e=t.elements;return"matrix3d("+c(e[0])+","+c(-e[1])+","+c(e[2])+","+c(e[3])+","+c(e[4])+","+c(-e[5])+","+c(e[6])+","+c(e[7])+","+c(e[8])+","+c(-e[9])+","+c(e[10])+","+c(e[11])+","+c(e[12])+","+c(-e[13])+","+c(e[14])+","+c(e[15])+")"}function y(t,e){var i=t.elements,o="matrix3d("+c(i[0])+","+c(i[1])+","+c(i[2])+","+c(i[3])+","+c(-i[4])+","+c(-i[5])+","+c(-i[6])+","+c(-i[7])+","+c(i[8])+","+c(i[9])+","+c(i[10])+","+c(i[11])+","+c(i[12])+","+c(i[13])+","+c(i[14])+","+c(i[15])+")";return g?"translate(-50%,-50%)translate("+h+"px,"+a+"px)"+e+o:"translate(-50%,-50%)"+o}this.getSize=function(){return{width:i,height:o}},this.setSize=function(t,e){h=(i=t)/2,a=(o=e)/2,p.style.width=t+"px",p.style.height=e+"px",f.style.width=t+"px",f.style.height=e+"px"};var s,n,x=(s=new THREE.Vector3,n=new THREE.Vector3,function(t,e){return s.setFromMatrixPosition(t.matrixWorld),n.setFromMatrixPosition(e.matrixWorld),s.distanceToSquared(n)});function M(t){for(var e,i=(e=[],t.traverse(function(t){t instanceof THREE.CSS3DObject&&e.push(t)}),e).sort(function(t,e){return u.objects.get(t).distanceToCameraSquared-u.objects.get(e).distanceToCameraSquared}),o=i.length,s=0,n=i.length;s<n;s++)i[s].element.style.zIndex=o-s}this.render=function(t,e){var i=e.projectionMatrix.elements[5]*a;if(u.camera.fov!==i&&(e.isPerspectiveCamera?(p.style.WebkitPerspective=i+"px",p.style.perspective=i+"px"):(p.style.WebkitPerspective="",p.style.perspective=""),u.camera.fov=i),!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),e.isOrthographicCamera)var o=-(e.right+e.left)/2,s=(e.top+e.bottom)/2;var n=e.isOrthographicCamera?"scale("+i+")translate("+c(o)+"px,"+c(s)+"px)"+m(e.matrixWorldInverse):"translateZ("+i+"px)"+m(e.matrixWorldInverse),r=n+"translate("+h+"px,"+a+"px)";u.camera.style===r||g||(f.style.WebkitTransform=r,f.style.transform=r,u.camera.style=r),function t(e,i,o,s){if(e instanceof FLIPBOOK.CSS3DObject){var n;e.onBeforeRender(l,i,o),n=e instanceof FLIPBOOK.CSS3DSprite?(d.copy(o.matrixWorldInverse),d.transpose(),d.copyPosition(e.matrixWorld),d.scale(e.scale),d.elements[3]=0,d.elements[7]=0,d.elements[11]=0,d.elements[15]=1,y(d,s)):y(e.matrixWorld,s);var r=e.element,h=u.objects.get(e);if(void 0===h||h.style!==n){r.style.WebkitTransform=n;var a={style:r.style.transform=n};g&&(a.distanceToCameraSquared=x(o,e)),u.objects.set(e,a)}r.parentNode!==f&&f.appendChild(r),e.onAfterRender(l,i,o)}for(var p=0,c=e.children.length;p<c;p++)t(e.children[p],i,o,s)}(t,t,e,n),g&&M(t)}};