seepur/resources/scripts/applications/home/components/flipbook/flipbook.min.js

29 lines
24 KiB
JavaScript

/*!
* @license
* flipbook-vue v0.8.1
* Copyright © 2020 Takeshi Sone.
* Released under the MIT License.
*/
!function(){"use strict";
/*! @license Rematrix v0.4.1
Copyright 2019 Julian Lloyd.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/function t(t){if(t.constructor!==Array)throw new TypeError("Expected array.");if(16===t.length)return t;if(6===t.length){var e=i();return e[0]=t[0],e[1]=t[1],e[4]=t[2],e[5]=t[3],e[12]=t[4],e[13]=t[5],e}throw new RangeError("Expected array with either 6 or 16 values.")}function i(){for(var t=[],i=0;i<16;i++)i%5==0?t.push(1):t.push(0);return t}var e,n,r,o,s=function(){function e(t){t?t.m?this.m=[].concat(t.m):this.m=[].concat(t):this.m=i()}return e.prototype.clone=function(){return new e(this)},e.prototype.multiply=function(i){return this.m=function(i,e){for(var n=t(i),r=t(e),o=[],s=0;s<4;s++)for(var a=[n[s],n[s+4],n[s+8],n[s+12]],h=0;h<4;h++){var l=4*h,u=[r[l],r[l+1],r[l+2],r[l+3]],c=a[0]*u[0]+a[1]*u[1]+a[2]*u[2]+a[3]*u[3];o[s+l]=c}return o}(this.m,i)},e.prototype.perspective=function(t){return this.multiply((e=t,(n=i())[11]=-1/e,n));var e,n},e.prototype.transformX=function(t){return(t*this.m[0]+this.m[12])/(t*this.m[3]+this.m[15])},e.prototype.translate=function(t,e){return this.multiply((n=t,r=e,(o=i())[12]=n,r&&(o[13]=r),o));var n,r,o},e.prototype.translate3d=function(t,e,n){return this.multiply((r=t,o=e,s=n,a=i(),void 0!==r&&void 0!==o&&void 0!==s&&(a[12]=r,a[13]=o,a[14]=s),a));var r,o,s,a},e.prototype.rotateY=function(t){return this.multiply((e=t,n=Math.PI/180*e,(r=i())[0]=r[10]=Math.cos(n),r[2]=r[8]=Math.sin(n),r[2]*=-1,r));var e,n,r},e.prototype.toString=function(){return"matrix3d("+t(this.m).join(", ")+")"},e}();n=function(t){return Math.pow(t,2)},o=function(t){return 1-n(1-t)},r=function(t){return t<.5?n(2*t)/2:.5+o(2*(t-.5))/2},e=/Trident/.test(navigator.userAgent);var a={props:{enabled:{type:Boolean,required:!0},pages:{type:Array,required:!0},pagesHiRes:{type:Array,default:function(){return[]}},flipDuration:{type:Number,default:1e3},zoomDuration:{type:Number,default:500},zooms:{type:Array,default:function(){return[1,2,4]}},perspective:{type:Number,default:2400},nPolygons:{type:Number,default:10},ambient:{type:Number,default:.4},gloss:{type:Number,default:.6},swipeMin:{type:Number,default:3},singlePage:{type:Boolean,default:!1},forwardDirection:{validator:function(t){return"right"===t||"left"===t},default:"right"},centering:{type:Boolean,default:!0},startPage:{type:Number,default:null}},data:function(){return{viewWidth:0,viewHeight:0,imageWidth:null,imageHeight:null,displayedPages:1,nImageLoad:0,nImageLoadTrigger:0,imageLoadCallback:null,currentPage:0,firstPage:0,secondPage:1,zoomIndex:0,zoom:1,zooming:!1,touchStartX:null,touchStartY:null,maxMove:0,activeCursor:null,hasTouchEvents:!1,hasPointerEvents:!1,minX:Infinity,maxX:-Infinity,preloadedImages:{},flip:{progress:0,direction:null,frontImage:null,backImage:null,auto:!1,opacity:1},currentCenterOffset:null,animatingCenter:!1,startScrollLeft:0,startScrollTop:0,scrollLeft:0,scrollTop:0}},computed:{canFlipLeft:function(){return"left"===this.forwardDirection?this.canGoForward:this.canGoBack},canFlipRight:function(){return"right"===this.forwardDirection?this.canGoForward:this.canGoBack},canZoomIn:function(){return!this.zooming&&this.zoomIndex<this.zooms_.length-1},canZoomOut:function(){return!this.zooming&&this.zoomIndex>0},numPages:function(){return null===this.pages[0]?this.pages.length-1:this.pages.length},page:function(){return null!==this.pages[0]?this.currentPage+1:Math.max(1,this.currentPage)},zooms_:function(){return this.zooms||[1]},canGoForward:function(){return!this.flip.direction&&this.currentPage<this.pages.length-this.displayedPages},canGoBack:function(){return!this.flip.direction&&this.currentPage>=this.displayedPages&&!(1===this.displayedPages&&!this.pageUrl(this.firstPage-1))},leftPage:function(){return"right"===this.forwardDirection||1===this.displayedPages?this.firstPage:this.secondPage},rightPage:function(){return"left"===this.forwardDirection?this.firstPage:this.secondPage},showLeftPage:function(){return this.pageUrl(this.leftPage)},showRightPage:function(){return this.pageUrl(this.rightPage)&&2===this.displayedPages},cursor:function(){return this.activeCursor?this.activeCursor:e?"auto":this.canZoomIn?"zoom-in":this.canZoomOut?"zoom-out":"grab"},pageScale:function(){var t,i,e;return(t=(i=this.viewWidth/this.displayedPages/this.imageWidth)<(e=this.viewHeight/this.imageHeight)?i:e)<1?t:1},pageWidth:function(){return Math.round(this.imageWidth*this.pageScale)},pageHeight:function(){return Math.round(this.imageHeight*this.pageScale)},xMargin:function(){return(this.viewWidth-this.pageWidth*this.displayedPages)/2},yMargin:function(){return(this.viewHeight-this.pageHeight)/2},polygonWidth:function(){var t;return t=this.pageWidth/this.nPolygons,(t=Math.ceil(t+1/this.zoom))+"px"},polygonHeight:function(){return this.pageHeight+"px"},polygonBgSize:function(){return this.pageWidth+"px "+this.pageHeight+"px"},polygonArray:function(){return this.makePolygonArray("front").concat(this.makePolygonArray("back"))},boundingLeft:function(){var t;return 1===this.displayedPages?this.xMargin:(t=this.pageUrl(this.leftPage)?this.xMargin:this.viewWidth/2)<this.minX?t:this.minX},boundingRight:function(){var t;return 1===this.displayedPages?this.viewWidth-this.xMargin:(t=this.pageUrl(this.rightPage)?this.viewWidth-this.xMargin:this.viewWidth/2)>this.maxX?t:this.maxX},centerOffset:function(){var t;return t=this.centering?Math.round(this.viewWidth/2-(this.boundingLeft+this.boundingRight)/2):0,null===this.currentCenterOffset&&null!==this.imageWidth&&(this.currentCenterOffset=t),t},centerOffsetSmoothed:function(){return Math.round(this.currentCenterOffset)},dragToScroll:function(){return!this.hasTouchEvents},scrollLeftMin:function(){var t;return(t=(this.boundingRight-this.boundingLeft)*this.zoom)<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom},scrollLeftMax:function(){var t;return(t=(this.boundingRight-this.boundingLeft)*this.zoom)<this.viewWidth?(this.boundingLeft+this.centerOffsetSmoothed)*this.zoom-(this.viewWidth-t)/2:(this.boundingRight+this.centerOffsetSmoothed)*this.zoom-this.viewWidth},scrollTopMin:function(){var t;return(t=this.pageHeight*this.zoom)<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:this.yMargin*this.zoom},scrollTopMax:function(){var t;return(t=this.pageHeight*this.zoom)<this.viewHeight?this.yMargin*this.zoom-(this.viewHeight-t)/2:(this.yMargin+this.pageHeight)*this.zoom-this.viewHeight},scrollLeftLimited:function(){return Math.min(this.scrollLeftMax,Math.max(this.scrollLeftMin,this.scrollLeft))},scrollTopLimited:function(){return Math.min(this.scrollTopMax,Math.max(this.scrollTopMin,this.scrollTop))}},mounted:function(){return window.addEventListener("resize",this.onResize,{passive:!0}),this.onResize(),this.preloadImages(),this.zoom=this.zooms_[0],this.goToPage(this.startPage)},beforeDestroy:function(){return window.removeEventListener("resize",this.onResize,{passive:!0})},methods:{onResize:function(){var t;if(t=this.$refs.viewport)return this.viewWidth=t.clientWidth,this.viewHeight=t.clientHeight,this.displayedPages=this.viewWidth>this.viewHeight&&!this.singlePage?2:1,2===this.displayedPages&&(this.currentPage&=-2),this.fixFirstPage(),this.minX=Infinity,this.maxX=-Infinity},fixFirstPage:function(){if(1===this.displayedPages&&0===this.currentPage&&this.pages.length&&!this.pageUrl(0))return this.currentPage++},pageUrl:function(t,i){var e;return void 0===i&&(i=!1),i&&this.zoom>1&&!this.zooming&&(e=this.pagesHiRes[t])?e:this.pages[t]||null},flipLeft:function(){if(this.canFlipLeft)return this.flipStart("left",!0)},flipRight:function(){if(this.canFlipRight)return this.flipStart("right",!0)},makePolygonArray:function(t){var i,e,n,r,o,a,h,l,u,c,g,f,d,p,m,v,y,w,P,b,M,z,x,I,L,T,S;if(!this.flip.direction)return[];for(v=this.flip.progress,o=this.flip.direction,1===this.displayedPages&&o!==this.forwardDirection&&(v=1-v,o=this.forwardDirection),this.flip.opacity=1===this.displayedPages&&v>.7?1-(v-.7)/.3:1,i=(h="front"===t?this.flip.frontImage:this.flip.backImage)&&"url('"+h+"')",m=this.pageWidth/this.nPolygons,p=this.xMargin,g=!1,1===this.displayedPages?"right"===this.forwardDirection?"back"===t&&(g=!0,p=this.xMargin-this.pageWidth):"left"===o?"back"===t?p=this.pageWidth-this.xMargin:g=!0:"front"===t?p=this.pageWidth-this.xMargin:g=!0:"left"===o?"back"===t?p=this.viewWidth/2:g=!0:"front"===t?p=this.viewWidth/2:g=!0,(f=new s).translate(this.viewWidth/2),f.perspective(this.perspective),f.translate(-this.viewWidth/2),f.translate(p,this.yMargin),d=0,v>.5&&(d=2*-(v-.5)*180),"left"===o&&(d=-d),"back"===t&&(d+=180),d&&(g&&f.translate(this.pageWidth),f.rotateY(d),g&&f.translate(-this.pageWidth)),0===(x=v<.5?2*v*Math.PI:(1-2*(v-.5))*Math.PI)&&(x=1e-9),P=this.pageWidth/x,w=0,z=(n=x/this.nPolygons)/2/Math.PI*180,r=n/Math.PI*180,g&&(z=-x/Math.PI*180+r/2),"back"===t&&(z=-z,r=-r),this.minX=Infinity,this.maxX=-Infinity,M=[],a=l=0,b=this.nPolygons;0<=b?l<b:l>b;a=0<=b?++l:--l)e=a/(this.nPolygons-1)*100+"% 0px",c=f.clone(),y=g?x-w:w,I=Math.sin(y)*P,g&&(I=this.pageWidth-I),S=(1-Math.cos(y))*P,"back"===t&&(S=-S),c.translate3d(I,0,S),c.rotateY(-z),L=c.transformX(0),T=c.transformX(m),this.maxX=Math.max(Math.max(L,T),this.maxX),this.minX=Math.min(Math.min(L,T),this.minX),u=this.computeLighting(d-z,r),w+=n,z+=r,M.push([t+a,i,u,e,c.toString(),Math.abs(Math.round(S))]);return M},computeLighting:function(t,i){var n,r,o,s,a;return o=[],s=[-.5,-.25,0,.25,.5],this.ambient<1&&(n=1-this.ambient,r=s.map((function(e){return(1-Math.cos((t-i*e)/180*Math.PI))*n})),o.push("linear-gradient(to right,\n rgba(0, 0, 0, "+r[0]+"),\n rgba(0, 0, 0, "+r[1]+") 25%,\n rgba(0, 0, 0, "+r[2]+") 50%,\n rgba(0, 0, 0, "+r[3]+") 75%,\n rgba(0, 0, 0, "+r[4]+"))")),this.gloss>0&&!e&&(30,200,a=s.map((function(e){return Math.max(Math.pow(Math.cos((t+30-i*e)/180*Math.PI),200),Math.pow(Math.cos((t-30-i*e)/180*Math.PI),200))})),o.push("linear-gradient(to right,\n rgba(255, 255, 255, "+a[0]*this.gloss+"),\n rgba(255, 255, 255, "+a[1]*this.gloss+") 25%,\n rgba(255, 255, 255, "+a[2]*this.gloss+") 50%,\n rgba(255, 255, 255, "+a[3]*this.gloss+") 75%,\n rgba(255, 255, 255, "+a[4]*this.gloss+"))")),o.join(",")},flipStart:function(t,i){var e=this;return t!==this.forwardDirection?1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage-1),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.firstPage),this.flip.backImage=this.pageUrl(this.currentPage-this.displayedPages+1)):1===this.displayedPages?(this.flip.frontImage=this.pageUrl(this.currentPage),this.flip.backImage=null):(this.flip.frontImage=this.pageUrl(this.secondPage),this.flip.backImage=this.pageUrl(this.currentPage+this.displayedPages)),this.flip.direction=t,this.flip.progress=0,requestAnimationFrame((function(){return requestAnimationFrame((function(){if(e.flip.direction!==e.forwardDirection?2===e.displayedPages&&(e.firstPage=e.currentPage-e.displayedPages):1===e.displayedPages?e.firstPage=e.currentPage+e.displayedPages:e.secondPage=e.currentPage+1+e.displayedPages,i)return e.flipAuto(!0)}))}))},flipAuto:function(t){var i,e,n,o,s=this;return o=Date.now(),e=this.flipDuration*(1-this.flip.progress),n=this.flip.progress,this.flip.auto=!0,this.$emit("flip-"+this.flip.direction+"-start",this.page),(i=function(){return requestAnimationFrame((function(){var a,h;return h=Date.now()-o,(a=n+h/e)>1&&(a=1),s.flip.progress=t?r(a):a,a<1?i():(s.flip.direction!==s.forwardDirection?s.currentPage-=s.displayedPages:s.currentPage+=s.displayedPages,s.$emit("flip-"+s.flip.direction+"-end",s.page),1===s.displayedPages&&s.flip.direction===s.forwardDirection?s.flip.direction=null:s.onImageLoad(1,(function(){return s.flip.direction=null})),s.flip.auto=!1)}))})()},flipRevert:function(){var t,i,e,n,r=this;return n=Date.now(),i=this.flipDuration*this.flip.progress,e=this.flip.progress,this.flip.auto=!0,(t=function(){return requestAnimationFrame((function(){var o,s;return s=Date.now()-n,(o=e-e*s/i)<0&&(o=0),r.flip.progress=o,o>0?t():(r.firstPage=r.currentPage,r.secondPage=r.currentPage+1,1===r.displayedPages&&r.flip.direction!==r.forwardDirection?r.flip.direction=null:r.onImageLoad(1,(function(){return r.flip.direction=null})),r.flip.auto=!1)}))})()},onImageLoad:function(t,i){return this.nImageLoad=0,this.nImageLoadTrigger=t,this.imageLoadCallback=i},didLoadImage:function(t){if(null===this.imageWidth&&(this.imageWidth=(t.target||t.path[0]).naturalWidth,this.imageHeight=(t.target||t.path[0]).naturalHeight),this.imageLoadCallback)return++this.nImageLoad>=this.nImageLoadTrigger?(this.imageLoadCallback(),this.imageLoadCallback=null):void 0},zoomIn:function(){if(this.canZoomIn)return this.zoomIndex+=1,this.zoomTo(this.zooms_[this.zoomIndex])},zoomOut:function(){if(this.canZoomOut)return this.zoomIndex-=1,this.zoomTo(this.zooms_[this.zoomIndex])},zoomTo:function(t,i,n){var o,s,a,h,l,u,c,g,f,d=this;if(l=this.zoom,s=t,f=this.$refs.viewport,u=f.scrollLeft,c=f.scrollTop,i||(i=f.clientWidth/2),n||(n=f.clientHeight/2),a=(i+u)/l*s-i,h=(n+c)/l*s-n,g=Date.now(),this.zooming=!0,this.$emit("zoom-start",t),(o=function(){return requestAnimationFrame((function(){var i,n;return((i=(n=Date.now()-g)/d.zoomDuration)>1||e)&&(i=1),i=r(i),d.zoom=l+(s-l)*i,d.scrollLeft=u+(a-u)*i,d.scrollTop=c+(h-c)*i,n<d.zoomDuration?o():(d.$emit("zoom-end",t),d.zooming=!1,d.zoom=t,d.scrollLeft=a,d.scrollTop=h)}))})(),s>1)return this.preloadImages(!0)},zoomAt:function(t){var i,e,n;return i=this.$refs.viewport.getBoundingClientRect(),e=t.pageX-i.left,n=t.pageY-i.top,this.zoomIndex=(this.zoomIndex+1)%this.zooms_.length,this.zoomTo(this.zooms_[this.zoomIndex],e,n)},swipeStart:function(t){if(this.enabled)return this.touchStartX=t.pageX,this.touchStartY=t.pageY,this.maxMove=0,this.zoom<=1?this.activeCursor="grab":(this.startScrollLeft=this.$refs.viewport.scrollLeft,this.startScrollTop=this.$refs.viewport.scrollTop,this.activeCursor="all-scroll")},swipeMove:function(t){var i,e;if(null!=this.touchStartX)if(i=t.pageX-this.touchStartX,e=t.pageY-this.touchStartY,this.maxMove=Math.max(this.maxMove,Math.abs(i)),this.maxMove=Math.max(this.maxMove,Math.abs(e)),this.zoom>1)this.dragToScroll&&this.dragScroll(i,e);else if(!(Math.abs(e)>Math.abs(i)))return this.activeCursor="grabbing",i>0?(null===this.flip.direction&&this.canFlipLeft&&i>=this.swipeMin&&this.flipStart("left",!1),"left"===this.flip.direction&&(this.flip.progress=i/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))):(null===this.flip.direction&&this.canFlipRight&&i<=-this.swipeMin&&this.flipStart("right",!1),"right"===this.flip.direction&&(this.flip.progress=-i/this.pageWidth,this.flip.progress>1&&(this.flip.progress=1))),!0},swipeEnd:function(t){if(null!=this.touchStartX)return this.maxMove<this.swipeMin&&this.zoomAt(t),null===this.flip.direction||this.flip.auto||(this.flip.progress>1/4?this.flipAuto(!1):this.flipRevert()),this.touchStartX=null,this.activeCursor=null},onTouchStart:function(t){return this.hasTouchEvents=!0,this.swipeStart(t.changedTouches[0])},onTouchMove:function(t){if(this.swipeMove(t.changedTouches[0])&&t.cancelable)return t.preventDefault()},onTouchEnd:function(t){return this.swipeEnd(t.changedTouches[0])},onPointerDown:function(t){if(this.hasPointerEvents=!0,!(this.hasTouchEvents||t.which&&1!==t.which)){this.swipeStart(t);try{return t.target.setPointerCapture(t.pointerId)}catch(t){}}},onPointerMove:function(t){if(!this.hasTouchEvents)return this.swipeMove(t)},onPointerUp:function(t){if(!this.hasTouchEvents){this.swipeEnd(t);try{return t.target.releasePointerCapture(t.pointerId)}catch(t){}}},onMouseDown:function(t){if(!(this.hasTouchEvents||this.hasPointerEvents||t.which&&1!==t.which))return this.swipeStart(t)},onMouseMove:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeMove(t)},onMouseUp:function(t){if(!this.hasTouchEvents&&!this.hasPointerEvents)return this.swipeEnd(t)},dragScroll:function(t,i){return this.scrollLeft=this.startScrollLeft-t,this.scrollTop=this.startScrollTop-i},onWheel:function(t){if(this.zoom>1&&this.dragToScroll&&(this.scrollLeft=this.$refs.viewport.scrollLeft+t.deltaX,this.scrollTop=this.$refs.viewport.scrollTop+t.deltaY,t.cancelable))return t.preventDefault()},preloadImages:function(t){var i,e,n,r,o,s,a,h,l;for(void 0===t&&(t=!1),Object.keys(this.preloadedImages).length>=10&&(this.preloadedImages={}),i=n=o=this.currentPage-3,s=this.currentPage+3;o<=s?n<=s:n>=s;i=o<=s?++n:--n)(l=this.pageUrl(i))&&(this.preloadedImages[l]||((e=new Image).src=l,this.preloadedImages[l]=e));if(t)for(i=r=a=this.currentPage,h=this.currentPage+this.displayedPages;a<=h?r<h:r>h;i=a<=h?++r:--r)(l=this.pagesHiRes[i])&&(this.preloadedImages[l]||((e=new Image).src=l,this.preloadedImages[l]=e))},goToPage:function(t){if(null!==t&&t!==this.page)return null===this.pages[0]?2===this.displayedPages&&1===t?this.currentPage=0:this.currentPage=t:this.currentPage=t-1,this.minX=Infinity,this.maxX=-Infinity,this.currentCenterOffset=this.centerOffset}},watch:{currentPage:function(){return this.firstPage=this.currentPage,this.secondPage=this.currentPage+1,this.preloadImages()},centerOffset:function(){var t,i=this;if(!this.animatingCenter)return t=function(){return requestAnimationFrame((function(){var e;return.1,e=i.centerOffset-i.currentCenterOffset,Math.abs(e)<.5?(i.currentCenterOffset=i.centerOffset,i.animatingCenter=!1):(i.currentCenterOffset+=.1*e,t())}))},this.animatingCenter=!0,t()},scrollLeftLimited:function(t){var i=this;return e?requestAnimationFrame((function(){return i.$refs.viewport.scrollLeft=t})):this.$refs.viewport.scrollLeft=t},scrollTopLimited:function(t){var i=this;return e?requestAnimationFrame((function(){return i.$refs.viewport.scrollTop=t})):this.$refs.viewport.scrollTop=t},pages:function(t,i){if(this.fixFirstPage(),!(null!=i?i.length:void 0)&&(null!=t?t.length:void 0)&&this.startPage>1&&null===t[0])return this.currentPage++},startPage:function(t){return this.goToPage(t)}}};var h,l="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var u={};var c=function(t,i,e,n,r,o,s,a,h,l){"boolean"!=typeof s&&(h=a,a=s,s=!1);var u,c="function"==typeof e?e.options:e;if(t&&t.render&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),n&&(c._scopeId=n),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,h(t)),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):i&&(u=s?function(t){i.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){i.call(this,a(t))}),u)if(c.functional){var g=c.render;c.render=function(t,i){return u.call(i),g(t,i)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,u):[u]}return e}({render:function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",[t._t("default",null,null,{canFlipLeft:t.canFlipLeft,canFlipRight:t.canFlipRight,canZoomIn:t.canZoomIn,canZoomOut:t.canZoomOut,page:t.page,numPages:t.numPages,flipLeft:t.flipLeft,flipRight:t.flipRight,zoomIn:t.zoomIn,zoomOut:t.zoomOut}),t._v(" "),e("div",{ref:"viewport",staticClass:"viewport",class:{zoom:t.zooming||t.zoom>1,"drag-to-scroll":t.dragToScroll},style:{cursor:"grabbing"==t.cursor?"grabbing":"auto"},on:{touchmove:t.onTouchMove,pointermove:t.onPointerMove,mousemove:t.onMouseMove,touchend:t.onTouchEnd,touchcancel:t.onTouchEnd,pointerup:t.onPointerUp,pointercancel:t.onPointerUp,mouseup:t.onMouseUp,wheel:t.onWheel}},[e("div",{staticClass:"book-container",style:{transform:"scale("+t.zoom+")"}},[e("div",{style:{transform:"translateX("+t.centerOffsetSmoothed+"px)"}},[t.showLeftPage?e("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.xMargin+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrl(t.leftPage,!0)},on:{load:function(i){return t.didLoadImage(i)}}}):t._e(),t._v(" "),t.showRightPage?e("img",{staticClass:"page fixed",style:{width:t.pageWidth+"px",height:t.pageHeight+"px",left:t.viewWidth/2+"px",top:t.yMargin+"px"},attrs:{src:t.pageUrl(t.rightPage,!0)},on:{load:function(i){return t.didLoadImage(i)}}}):t._e(),t._v(" "),e("div",{style:{opacity:t.flip.opacity}},t._l(t.polygonArray,(function(i){var n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],h=i[5];return e("div",{key:n,staticClass:"polygon",class:{blank:!r},style:{backgroundImage:r,backgroundSize:t.polygonBgSize,backgroundPosition:s,width:t.polygonWidth,height:t.polygonHeight,transform:a,zIndex:h}},[e("div",{directives:[{name:"show",rawName:"v-show",value:o.length,expression:"lighting.length"}],staticClass:"lighting",style:{backgroundImage:o}})])})),0),t._v(" "),e("div",{staticClass:"bounding-box",style:{left:t.boundingLeft+"px",top:t.yMargin+"px",width:t.boundingRight-t.boundingLeft+"px",height:t.pageHeight+"px",cursor:t.cursor},on:{touchstart:t.onTouchStart,pointerdown:t.onPointerDown,mousedown:t.onMouseDown}})])])])],2)},staticRenderFns:[]},(function(t){t&&t("data-v-16acf8ed_0",{source:".viewport[data-v-16acf8ed]{-webkit-overflow-scrolling:touch;width:100%;height:95%}.viewport.zoom[data-v-16acf8ed]{overflow:scroll}.viewport.zoom.drag-to-scroll[data-v-16acf8ed]{overflow:hidden}.book-container[data-v-16acf8ed]{position:relative;width:100%;height:95%;transform-origin:top left;-webkit-user-select:none;-ms-user-select:none;user-select:none}.click-to-flip[data-v-16acf8ed]{position:absolute;width:50%;height:100%;top:0;-webkit-user-select:none;-ms-user-select:none;user-select:none}.click-to-flip.left[data-v-16acf8ed]{left:0}.click-to-flip.right[data-v-16acf8ed]{right:0}.bounding-box[data-v-16acf8ed]{position:absolute;-webkit-user-select:none;-ms-user-select:none;user-select:none}.page[data-v-16acf8ed]{position:absolute;-webkit-backface-visibility:hidden;backface-visibility:hidden}.polygon[data-v-16acf8ed]{position:absolute;top:0;left:0;background-repeat:no-repeat;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:center left}.polygon.blank[data-v-16acf8ed]{background-color:#ddd}.polygon .lighting[data-v-16acf8ed]{width:100%;height:100%}",map:void 0,media:void 0})}),a,"data-v-16acf8ed",!1,void 0,!1,(function(t){return function(t,i){return function(t,i){var e=l?i.media||"default":t,n=u[e]||(u[e]={ids:new Set,styles:[]});if(!n.ids.has(t)){n.ids.add(t);var r=i.source;if(i.map&&(r+="\n/*# sourceURL="+i.map.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i.map))))+" */"),n.element||(n.element=document.createElement("style"),n.element.type="text/css",i.media&&n.element.setAttribute("media",i.media),void 0===h&&(h=document.head||document.getElementsByTagName("head")[0]),h.appendChild(n.element)),"styleSheet"in n.element)n.styles.push(r),n.element.styleSheet.cssText=n.styles.filter(Boolean).join("\n");else{var o=n.ids.size-1,s=document.createTextNode(r),a=n.element.childNodes;a[o]&&n.element.removeChild(a[o]),a.length?n.element.insertBefore(s,a[o]):n.element.appendChild(s)}}}(t,i)}}),void 0,void 0);Vue.component("flipbook",c)}();