@magflip/minjs
Version:
Provides a bundled JavaScript file containing all magFlip-related packages, which can be easily added and used via a <script> tag.
1 lines • 73.8 kB
JavaScript
!function(e){"use strict";class t{constructor(e,t){this.width=e,this.height=t,this.diagonal=Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}}class i{constructor(e){this.closed=new t(e.closed.width,e.closed.height),this.opened=new t(e.opened.width,e.opened.height)}}let o=class{constructor(){this.listeners={}}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter((e=>e!==t)))}emitEvent(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}};e.PageType=void 0,function(e){e.Page="Page",e.Cover="Cover",e.Empty="Empty",e.Blank="Blank"}(e.PageType||(e.PageType={})),e.PageLabelType=void 0,function(e){e.Default="Default",e.Empty="Empty"}(e.PageLabelType||(e.PageLabelType={})),e.DefaultSize=void 0,function(e){e[e.bookWidth=600]="bookWidth",e[e.bookHeight=900]="bookHeight",e[e.pageWidth=600]="pageWidth",e[e.pageHeight=900]="pageHeight"}(e.DefaultSize||(e.DefaultSize={})),e.BookType=void 0,function(e){e.Book="Book",e.Magazine="Magazine",e.Newspaper="Newspaper"}(e.BookType||(e.BookType={})),e.BookStatus=void 0,function(e){e.Open="Open",e.Close="Close"}(e.BookStatus||(e.BookStatus={})),e.EventStatus=void 0,function(e){e[e.None=0]="None",e[e.AutoFlip=8]="AutoFlip",e[e.AutoFlipFromCorner=12]="AutoFlipFromCorner",e[e.AutoFlipToCorner=10]="AutoFlipToCorner",e[e.Flipping=128]="Flipping",e[e.SnappingBack=144]="SnappingBack",e[e.FlippingForward=160]="FlippingForward",e[e.FlippingBackward=192]="FlippingBackward",e[e.Dragging=2048]="Dragging"}(e.EventStatus||(e.EventStatus={})),e.Zone=void 0,function(e){e[e.LT=66]="LT",e[e.LC=34]="LC",e[e.LB=18]="LB",e[e.RT=65]="RT",e[e.RC=33]="RC",e[e.RB=17]="RB",e[e.Left=2]="Left",e[e.Right=1]="Right",e[e.Top=64]="Top",e[e.Center=32]="Center",e[e.Bottom=16]="Bottom"}(e.Zone||(e.Zone={})),e.AutoFlipType=void 0,function(e){e[e.FixedWidth=0]="FixedWidth",e[e.MouseCursor=1]="MouseCursor"}(e.AutoFlipType||(e.AutoFlipType={})),e.ViewerType=void 0,function(e){e.Flipping="flipping",e.Scrolling="scrolling"}(e.ViewerType||(e.ViewerType={}));let n=class{constructor(e){this.x=(null==e?void 0:e.x)||0,this.y=(null==e?void 0:e.y)||0}toString(){return`${this.x},${this.y}`}},a=class{constructor(e){this.left=(null==e?void 0:e.left)||0,this.right=(null==e?void 0:e.right)||0,this.top=(null==e?void 0:e.top)||0,this.bottom=(null==e?void 0:e.bottom)||0,this.width=(null==e?void 0:e.width)||0,this.height=(null==e?void 0:e.height)||0,this.center=new n({x:(this.left+this.right)/2,y:(this.top+this.bottom)/2})}get leftTop(){return{x:this.left,y:this.top}}get leftCenter(){return{x:this.left,y:this.center.y}}get leftBottom(){return{x:this.left,y:this.bottom}}get rightTop(){return{x:this.right,y:this.top}}get rightCenter(){return{x:this.right,y:this.center.y}}get rightBottom(){return{x:this.right,y:this.bottom}}get centerTop(){return{x:this.center.x,y:this.top}}get centerCenter(){return this.center}get centerBottom(){return{x:this.center.x,y:this.bottom}}};function s(e,t){for(const i in t)t[i]instanceof Object&&i in e?s(e[i],t[i]):e[i]=t[i];return e}class r extends o{constructor(){super()}}function l(e,t,i,o){return new(i||(i=Promise))((function(t,n){function a(e){try{r(o.next(e))}catch(e){n(e)}}function s(e){try{r(o.throw(e))}catch(e){n(e)}}function r(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(a,s)}r((o=o.apply(e,[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class h extends r{constructor(e){super(),({element:this.element,contentEl:this.contentEl}=this.createPageLabelElement(e))}createPageLabelElement(t){var i;const o=document.createElement("div");o.className="page-label",o.style.top=t.top?t.top+"px":t.index*((null===(i=t.size)||void 0===i?void 0:i.height)||37)+30+"px",t.type==e.PageLabelType.Empty&&o.classList.add("blank");const n=document.createElement("div");return n.className="page-label-content",n.innerHTML=t.content,n.style.backgroundColor=t.backgroundColor||"rgb(48, 171, 237)",n.style.opacity=t.opacity?t.opacity.toString():"1",o.appendChild(n),t.onClick&&n.addEventListener("click",(e=>{t.onClick&&t.onClick(t.pageIndex)})),{element:o,contentEl:n}}resetLabelEls(){Array.from(this.element.children).forEach((e=>{if(e===this.contentEl){Array.from(e.children).forEach((t=>{e.removeChild(t)}))}else this.element.removeChild(e)}))}}class d extends r{constructor(e){super(),this.thumbnails=e.thumbnails||{spine:"resources/default_spine.webp",small:"resources/default_small.webp",medium:"resources/default_medium.webp",cover:{front:"resources/default_front_cover.webp",back:"resources/default_back_cover.webp"}};const t=this.createBookElement();this.elementOnShelf=t.bookOnShelfEl,this.element=t.bookEl,this.pageContainerEl=t.containerEl,this.labelContainerEl=t.labelContainerEl,this.createLabels(e.labels||{})}appendPageEl(e){this.pageContainerEl.appendChild(e)}prependPageEl(e){this.pageContainerEl.prepend(e)}removePageEl(e){this.pageContainerEl.removeChild(e)}createBookElement(){const e=document.createElement("div");e.className="book-on-shelf";const t=document.createElement("img");t.src=this.thumbnails.medium,e.appendChild(t);const i=document.createElement("div"),o=document.createElement("div"),n=document.createElement("div");return n.className="label-container",i.className="book",o.className="container",i.appendChild(n),i.appendChild(o),{bookOnShelfEl:e,bookEl:i,containerEl:o,labelContainerEl:n}}createLabels(e){Object.keys(e).forEach((t=>{this.addLabelEl(e[t])}))}addLabelEl(e){const t=new h(e);this.labelContainerEl.appendChild(t.element)}clearPageEls(){this.pageContainerEl.innerHTML=""}resetBookEls(){Array.from(this.element.children).forEach((e=>{e!==this.pageContainerEl&&this.element.removeChild(e)})),this.clearPageEls()}}class p extends r{constructor(e){super(),({element:this.element,contentContainerEl:this.contentContainerEl,contentEl:this.contentEl}=this.createPageElement(e))}createPageElement(t){const i=document.createElement("div");if(i.className="page",i.setAttribute("pageIdx",`${t.index}`),t.type==e.PageType.Empty){const e=document.createElement("div");e.className="content-container";const t=document.createElement("div");return t.className="content",e.appendChild(t),i.classList.add("empty"),i.appendChild(e),{element:i,contentContainerEl:e,contentEl:t}}if(t.type==e.PageType.Blank){const e=document.createElement("div");e.className="content-container";const t=document.createElement("div");return t.className="content",e.appendChild(t),i.classList.add("blank"),i.appendChild(e),{element:i,contentContainerEl:e,contentEl:t}}{const e=document.createElement("div");e.className="content-container";const o=document.createElement("div");return o.className="content",o.innerHTML=t.content||"",o.innerHTML+=t.image?`<img src="${t.image}"/>`:"",e.appendChild(o),i.appendChild(e),{element:i,contentContainerEl:e,contentEl:o}}}resetPageEls(){Array.from(this.element.children).forEach((e=>{if(e===this.contentContainerEl){Array.from(e.children).forEach((t=>{t!==this.contentEl&&e.removeChild(t)}))}else this.element.removeChild(e)}))}}e.PageEvent=void 0,e.PageEvent||(e.PageEvent={});class c extends p{constructor(t){super(t),this.id=t.id,this.type=t.type||e.PageType.Page,this.number=t.number||void 0,this.size=t.size||{width:e.DefaultSize.pageWidth,height:e.DefaultSize.pageHeight},this.index=t.index,this.ignore=t.ignore||!1,this.content=t.content||"",this.image=t.image||"",this.setEvents()}static emptyPage(t,i){return this.createEmptyOrBlankPage(e.PageType.Empty,t,i)}static blankPage(t,i){return this.createEmptyOrBlankPage(e.PageType.Blank,t,i)}static createEmptyOrBlankPage(e,t,i){return new c({id:`emptyPage${t}`,type:e,size:i,number:void 0,index:t,ignore:!0,content:""})}setEvents(){}}class g extends h{constructor(t){super(t),this.index=t.index,this.pageIndex=t.pageIndex,this.type=t.type||e.PageLabelType.Default,this.size=t.size||{width:e.DefaultSize.pageWidth,height:e.DefaultSize.pageHeight},this.index=t.index,this.ignore=t.ignore||!1,this.content=t.content||"",this.setEvents()}setEvents(){}}e.BookEvent=void 0,function(e){e.pageAdded="pageAdded"}(e.BookEvent||(e.BookEvent={}));class u extends d{constructor(o){super(o),this.bookData={id:"book1",status:e.BookStatus.Close,type:e.BookType.Book,title:"",author:"",publication:{name:"",location:"",publishedDate:""},lastPageIndex:0,labels:{},size:{closed:new t(e.DefaultSize.bookWidth,e.DefaultSize.bookHeight),opened:new t(2*e.DefaultSize.bookWidth,e.DefaultSize.bookHeight)},thumbnails:{spine:"",small:"",medium:"",cover:{front:"",back:""}}};const n=s(this.bookData,o);this.id=n.id,this.status=e.BookStatus.Close,this.type=n.type||e.BookType.Book,this.title=n.title||"Title",this.author=n.author||"Author",this.publication=n.publication||{name:"Publisher",location:"Location",publishedDate:"Published Date"},this.size=new i(n.size||{closed:new t(e.DefaultSize.bookWidth,e.DefaultSize.bookHeight),opened:new t(2*e.DefaultSize.bookWidth,e.DefaultSize.bookHeight)}),this.lastPageIndex=n.lastPageIndex%2==0?n.lastPageIndex+1:n.lastPageIndex,this.pages={},this.pageLabels={},Object.keys(n.labels||{}).forEach((e=>{this.pageLabels[e]=new g(n.labels[e])})),this.thumbnails=n.thumbnails||{spine:"resources/default_spine.webp",small:"resources/default_small.webp",medium:"resources/default_medium.webp",cover:{front:"resources/default_front_cover.webp",back:"resources/default_back_cover.webp"}}}fetchPage(t){return l(this,0,void 0,(function*(){const i={id:`page${t}`,type:e.PageType.Page,size:{width:600,height:900},index:t,number:void 0,ignore:!1,content:"",image:`./resources/page${t}.jpg`},o=new c(i);return this.addPage(o,t),new Promise(((e,t)=>{e(i)}))}))}fetchPages(t){return l(this,0,void 0,(function*(){let i=t.start;i<0&&(i=0);const o=[];let n=i+t.cnt;n>this.lastPageIndex&&(n=this.lastPageIndex);for(let t=i;t<n;t++)this.pages[t]||o.push({id:`page${t}`,type:e.PageType.Page,size:{width:600,height:900},index:t,number:void 0,ignore:!1,content:"",image:`./resources/page${t}.jpg`});return o.forEach((e=>{const t=new c(e);this.addPage(t,t.index)})),new Promise(((e,t)=>{e(o)}))}))}importPages(e,i){this.size.closed=new t(i.width,i.height),this.size.opened=new t(2*i.width,i.height),e.forEach((e=>{const t=new c(e);this.addPage(t,t.index)}))}addPage(t,i){this.pages[i]=t,this.emitEvent(e.BookEvent.pageAdded,t)}removePage(e){delete this.pages[e]}getPage(e,t=!1){return this.pages[e]||(t?this.createEmptyPage(e):void 0)}getPages(){return this.pages}getPageCnt(){return Object.keys(this.pages).length}getPageEl(e){return this.pages[e].element}createEmptyPage(e,t){const i=c.emptyPage(e,t||this.size.closed);return this.addPage(i,e),i}setEvents(e,t){}resetBook(){return new Promise(((t,i)=>{this.element.removeAttribute("style"),this.resetBookEls();for(const t in this.pages){const i=this.pages[t];i.type==e.PageType.Empty&&this.removePage(Number(t)),i.resetPageEls()}t()}))}}class f{constructor(e){this.booksOnShelf={},this.bookManager=e,this.bookShelfDocId="bookShelf",this.element=this.createElement()}createElement(){let e=document.getElementById(this.bookShelfDocId);return e||(e=document.createElement("div"),e.id=this.bookShelfDocId,document.body.appendChild(e)),e.classList.toggle("hidden",this.bookManager.config.hideBookShelf),e}getBookHolder(e){return this.booksOnShelf[e].bookHolderEl}getBook(e){return this.booksOnShelf[e].book}addBook(e,t){const i=e.elementOnShelf,o=document.createElement("div");o.className="book-holder",o.appendChild(i),this.element.appendChild(o),this.booksOnShelf[e.id]={book:e,bookHolderEl:o,position:Object.keys(this.booksOnShelf).length};for(const e in t)i.addEventListener(e,t[e])}putbackBook(e){if(e.elementOnShelf){this.getBookHolder(e.id).appendChild(e.elementOnShelf)}}}class w extends r{get bookContainerEl(){return this._bookContainerEl}set bookContainerEl(e){this._bookContainerEl=e}constructor(e){super(),this.zoomLevel=1,this.registeredViews={},this.registeredEventHandlers={},this.callbackEventHandler=(e,t)=>{this.registeredEventHandlers[e]&&this.registeredEventHandlers[e](t)},this.bookViewerDocId="bookViewer",this.bookShelfManager=e,e.config.onViewerClose&&(this.registeredEventHandlers.close=e.config.onViewerClose),({bookViewerEl:this.element}=this.createViewerElements())}createViewerElements(){let e=document.getElementById(this.bookViewerDocId);e?e.innerHTML="":(e=document.createElement("div"),e.id=this.bookViewerDocId,document.body.appendChild(e)),e.className="",e.classList.add("hidden");const t=document.createElement("button");return t.id="btnClose",t.innerHTML="X",t.addEventListener("click",(e=>{this.closeViewer()})),e.appendChild(t),{bookViewerEl:e}}getView(e){return this.registeredViews[e]}registerView(e){this.registeredViews[e.id]=e,this.curView||(this.curView=e)}setZoomLevel(e){var t;this.zoomLevel=e,null===(t=this.curView)||void 0===t||t.zoom(e)}setCurView(e){this.curView=this.getView(e)}view(e,t=0){if(!this.curView)throw new Error("Please select one view.");this.book=e,this.element.className="hidden";const i=this.bookContainerEl=this.curView.getBookContainerEl();this.element.appendChild(i),this.element.classList.add(this.curView.id),this.curView.view(e,t),this.element.classList.remove("hidden")}closeViewer(){var e;this.element.className="hidden",this.bookContainerEl&&this.element.removeChild(this.bookContainerEl),null===(e=this.curView)||void 0===e||e.closeViewer(),this.bookShelfManager.returnBookToShelf(this.book),this.book&&(this.book.resetBook(),this.bookContainerEl&&(this.bookContainerEl.className="",this.bookContainerEl.removeChild(this.book.element),this.bookContainerEl=void 0),this.book=void 0),this.callbackEventHandler("close")}changeView(e){this.getView(e)&&this.setCurView(e)}}class b{constructor(e=0,t=0,i=0){this.leftX=e,this.rightX=t,this.y=i,this._leftP={x:e,y:i},this._rightP={x:t,y:i},this._centerP={x:(e+t)/2,y:i}}get leftP(){return this._leftP}get rightP(){return this._rightP}get centerP(){return this._centerP}}class m{constructor(e){this.alpa=0,this.a=0,this.b=0,this.c=0,this.d=0,this.alpa=e.alpa,this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.page2=e.page2,this.mask=e.mask,this.shadow=e.shadow}printPage1MaskShape(e){const t=this.mask.page1;return`${t.p1.x/e},${t.p1.y/e} ${t.p2.x/e},${t.p2.y/e} ${t.p3.x/e},${t.p3.y/e} ${t.p4.x/e},${t.p4.y/e}`}printPage2MaskShape(e){const t=this.mask.page2;return`${t.p1.x/e},${t.p1.y/e} ${t.p2.x/e},${t.p2.y/e} ${t.p3.x/e},${t.p3.y/e} ${t.p4.x/e},${t.p4.y/e}`}printShadow6(e){return this.mask.page1,`0,0 ${e.width},0 ${e.width},${e.height} 0,${e.height}`}}class v{constructor(){this.listeners={}}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter((e=>e!==t)))}emitEvent(e,...t){this.listeners[e]&&this.listeners[e].forEach((e=>e(...t)))}}var k,x,y,P,E,C,z,S,L,B;!function(e){e.Page="Page",e.Cover="Cover",e.Empty="Empty",e.Blank="Blank"}(k||(k={})),function(e){e.Default="Default",e.Empty="Empty"}(x||(x={})),function(e){e[e.bookWidth=600]="bookWidth",e[e.bookHeight=900]="bookHeight",e[e.pageWidth=600]="pageWidth",e[e.pageHeight=900]="pageHeight"}(y||(y={})),function(e){e.Book="Book",e.Magazine="Magazine",e.Newspaper="Newspaper"}(P||(P={})),function(e){e.Open="Open",e.Close="Close"}(E||(E={})),function(e){e[e.None=0]="None",e[e.AutoFlip=8]="AutoFlip",e[e.AutoFlipFromCorner=12]="AutoFlipFromCorner",e[e.AutoFlipToCorner=10]="AutoFlipToCorner",e[e.Flipping=128]="Flipping",e[e.SnappingBack=144]="SnappingBack",e[e.FlippingForward=160]="FlippingForward",e[e.FlippingBackward=192]="FlippingBackward",e[e.Dragging=2048]="Dragging"}(C||(C={})),function(e){e[e.LT=66]="LT",e[e.LC=34]="LC",e[e.LB=18]="LB",e[e.RT=65]="RT",e[e.RC=33]="RC",e[e.RB=17]="RB",e[e.Left=2]="Left",e[e.Right=1]="Right",e[e.Top=64]="Top",e[e.Center=32]="Center",e[e.Bottom=16]="Bottom"}(z||(z={})),function(e){e[e.FixedWidth=0]="FixedWidth",e[e.MouseCursor=1]="MouseCursor"}(S||(S={})),function(e){e.Flipping="flipping",e.Scrolling="scrolling"}(L||(L={}));class A{constructor(e){this.x=(null==e?void 0:e.x)||0,this.y=(null==e?void 0:e.y)||0}toString(){return`${this.x},${this.y}`}}class F{constructor(e,t){this.p1=e,this.p2=t}}class M{constructor(e){this.left=(null==e?void 0:e.left)||0,this.right=(null==e?void 0:e.right)||0,this.top=(null==e?void 0:e.top)||0,this.bottom=(null==e?void 0:e.bottom)||0,this.width=(null==e?void 0:e.width)||0,this.height=(null==e?void 0:e.height)||0,this.center=new A({x:(this.left+this.right)/2,y:(this.top+this.bottom)/2})}get leftTop(){return{x:this.left,y:this.top}}get leftCenter(){return{x:this.left,y:this.center.y}}get leftBottom(){return{x:this.left,y:this.bottom}}get rightTop(){return{x:this.right,y:this.top}}get rightCenter(){return{x:this.right,y:this.center.y}}get rightBottom(){return{x:this.right,y:this.bottom}}get centerTop(){return{x:this.center.x,y:this.top}}get centerCenter(){return this.center}get centerBottom(){return{x:this.center.x,y:this.bottom}}}class V{static findSymmetricPoint(e,t){return{x:2*e.x-t.x,y:2*e.y-t.y}}static getDegree(e,t){return 180*V.getRadian(e,t)/Math.PI}static getDegreePositive(e,t){let i=180*V.getRadian(e,t)/Math.PI%360;return i<0&&(i+=360),i}static getRadian(e,t){const i=t.x-e.x,o=t.y-e.y;return Math.atan2(o,i)}static getRadianPositive(e,t){const i=t.x-e.x,o=t.y-e.y;let n=Math.atan2(o,i)%(2*Math.PI);return n<0&&(n+=2*Math.PI),n}static getOffset(e){var t,i,o=0,n=0;let a=e.getBoundingClientRect();i=a.height,t=a.width;do{a=e.getBoundingClientRect(),o+=a.top,n+=a.left,null!==(e=e.offsetParent)&&(a=e.getBoundingClientRect(),o-=a.top-window.scrollY,n-=a.left-window.scrollX)}while(e);return{top:o,left:n,width:t,height:i,bottom:o+i,right:n+t}}static getOffset4Fixed(e){var t,i,o=0,n=0;let a=e.getBoundingClientRect();i=a.height,t=a.width;do{a=e.getBoundingClientRect(),o+=a.top,n+=a.left,null!==(e=e.offsetParent)&&(a=e.getBoundingClientRect(),o-=a.top,n-=a.left)}while(e);return new M({top:o,left:n,width:t,height:i,bottom:o+i,right:n+t})}static getLength(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static findPointOnLine(e,t,i){const o=t.x-e.x,n=t.y-e.y,a=Math.sqrt(o*o+n*n),s=o/a,r=n/a;return{x:e.x+s*i,y:e.y+r*i}}static findPerpendicularFoot(e,t){const i=e.p2.x-e.p1.x,o=e.p2.y-e.p1.y,n=i*i+o*o;if(0===n)return e.p1;const a=((t.x-e.p1.x)*i+(t.y-e.p1.y)*o)/n;return{x:e.p1.x+i*a,y:e.p1.y+o*a}}}function T(e,t){for(const i in t)t[i]instanceof Object&&i in e?T(e[i],t[i]):e[i]=t[i];return e}"function"==typeof SuppressedError&&SuppressedError,function(e){e.pageAdded="pageAdded"}(B||(B={}));class R{get length(){return this._length}get radian(){return this._radian}constructor(e,t){this._length=0,this._radian=0,this._length=V.getLength(e,t),this._radian=V.getRadianPositive(e,t)}}class D{constructor(e,t){const i=new A,o={x:(null==e?void 0:e.left)||0,y:(null==t?void 0:t.y)||0},n={x:(null==e?void 0:e.right)||0,y:(null==t?void 0:t.y)||0},a=(null==e?void 0:e.centerTop)||i,s=(null==e?void 0:e.centerBottom)||i,r=new R(s,o),l=new R(s,n),h=new R(a,o),d=new R(a,n);l.radian,d.radian||Math.PI,this.area1={length:r.length,radian:{low:r.radian,high:l.radian||2*Math.PI}},this.area2={length:h.length,radian:{low:d.radian,high:h.radian}},this.area3={length:0,radian:{low:l.radian,high:d.radian||2*Math.PI}},this.area4={length:0,radian:{low:h.radian,high:r.radian}}}}class $ extends M{constructor(e){super(e)}get topPoint(){return{x:this.left,y:this.top}}get bottomPoint(){return{x:this.left,y:this.bottom}}}class I extends v{constructor(){super(),this.windowSize=6,this.windows=[];for(let e=0;e<this.windowSize;e++)this.windows[e]={page:void 0}}loadPageToWindow(e,t){this.windows[e].page=t}loadPagesToWindow(e){for(let t=0;t<this.windowSize;t++)this.windows[t].page=e[t]}clearPageWindow(){this.windows=[];for(let e=0;e<this.windowSize;e++)this.windows[e]={page:void 0}}moveRight(e,t){this.windows.shift(),this.windows.shift(),this.windows.push({page:e}),this.windows.push({page:t})}moveLeft(e,t){this.windows.pop(),this.windows.pop(),this.windows.unshift({page:t}),this.windows.unshift({page:e})}getPageInWindow(e){return this.windows[e].page}}class O extends I{set eventStatus(e){this._eventStatus=e}get eventStatus(){return this._eventStatus}constructor(){super(),this._eventStatus=C.None,this.flipGRect=new M,this.gutter=new $,this.eventZone=z.RB,this.oldEventZone=z.RT,this.activeCenterGP=new A,this.activeCornerGP=new A,this.activeCornerOppositeGP=new A,this.diagonals=new D,this.flipActionLine=new b,this.curAutoFlipWidth={x:0,y:0},this.autoFlipDimension={top:{width:0,height:0},center:{width:0,height:0},bottom:{width:0,height:0}},this.zoneDimension={top:{width:0,height:0},center:{width:0,height:0},bottom:{width:0,height:0}},this.curMouseGP=new A,this.setting={autoFlip:{type:S.MouseCursor}}}setInitFlipping(e,t,i,o){this.eventZone=e;let n=t.y;switch(e){case z.LT:case z.RT:n=this.gutter.top;break;case z.LB:case z.RB:n=this.gutter.bottom}const a=i.left==this.gutter.left?i.left-i.width:i.left,s=i.right==this.gutter.right?i.right+i.width:i.right;this.flipGRect=new M({left:a,right:s,top:this.gutter.top,bottom:this.gutter.bottom,width:s-a,height:this.gutter.height}),this.flipActionLine=new b(a,s,n),this.diagonals=new D(this.flipGRect,this.flipActionLine.centerP),this.activeCenterGP=this.flipActionLine.centerP;let r=0;switch(e){case z.LT:case z.LC:case z.LB:r=this.flipGRect.width/2,this.activeCornerGP=this.flipActionLine.leftP;break;case z.RT:case z.RC:case z.RB:r=0,this.activeCornerGP=this.flipActionLine.rightP}this.activeCornerOppositeGP=V.findSymmetricPoint(this.activeCenterGP,this.activeCornerGP);const l=this.flipActionLine.y-i.top,h=document;h.documentElement.style.setProperty("--page2-origin",`${r/o}px ${l/o}px`);const d=h.getElementById("mzZoneLT"),p=h.getElementById("mzZoneLC"),c=h.getElementById("mzZoneLB"),g=h.getElementById("mzZoneRT"),u=h.getElementById("mzZoneRC"),f=h.getElementById("mzZoneRB");this.zoneDimension={top:{width:(null==d?void 0:d.clientWidth)||(null==g?void 0:g.clientWidth)||0,height:(null==d?void 0:d.clientHeight)||(null==g?void 0:g.clientHeight)||0},center:{width:(null==p?void 0:p.clientWidth)||(null==u?void 0:u.clientWidth)||0,height:(null==p?void 0:p.clientHeight)||(null==u?void 0:u.clientHeight)||0},bottom:{width:(null==c?void 0:c.clientWidth)||(null==f?void 0:f.clientWidth)||0,height:(null==c?void 0:c.clientHeight)||(null==f?void 0:f.clientHeight)||0}},this.autoFlipDimension={top:{width:.9*this.zoneDimension.top.width,height:.9*this.zoneDimension.top.height},center:{width:.9*this.zoneDimension.center.width,height:.9*this.zoneDimension.center.height},bottom:{width:.9*this.zoneDimension.bottom.width,height:.9*this.zoneDimension.bottom.height}}}getTargetCorner(e){const t=V.getLength(e,this.activeCornerGP);return V.getLength(e,this.activeCornerOppositeGP)<t?this.activeCornerOppositeGP:this.activeCornerGP}getInfoToFlip(e){const t=this.getTargetCorner(e);return{targetCornerGP:t,isSnappingBack:t==this.activeCornerGP,isFlippingForward:t.x<this.gutter.left}}animateReadyToFlip(e,t,i,o){let n=this.curAutoFlipWidth;const a=this.setting.autoFlip.type==S.MouseCursor,s={x:0,y:0};a&&!e&&(t=this.activeCornerGP);const r=performance.now();let l=new A,h=new A;switch(this.eventZone){case z.LT:e&&(s.x=this.autoFlipDimension.top.width,s.y=this.autoFlipDimension.top.height),l={x:this.activeCornerGP.x+n.x,y:this.activeCornerGP.y+n.y},h=a?t:{x:this.activeCornerGP.x+s.x,y:this.activeCornerGP.y+s.y};break;case z.LC:e&&(s.x=this.autoFlipDimension.center.width),l={x:this.activeCornerGP.x+n.x,y:this.activeCornerGP.y},h=a?t:{x:this.activeCornerGP.x+s.x,y:this.activeCornerGP.y};break;case z.LB:e&&(s.x=this.autoFlipDimension.bottom.width,s.y=this.autoFlipDimension.bottom.height),l={x:this.activeCornerGP.x+n.x,y:this.activeCornerGP.y-n.y},h=a?t:{x:this.activeCornerGP.x+s.x,y:this.activeCornerGP.y-s.y};break;case z.RT:e&&(s.x=this.autoFlipDimension.top.width,s.y=this.autoFlipDimension.top.height),l={x:this.activeCornerGP.x-n.x,y:this.activeCornerGP.y+n.y},h=a?t:{x:this.activeCornerGP.x-s.x,y:this.activeCornerGP.y+s.y};break;case z.RC:e&&(s.x=this.autoFlipDimension.center.width),l={x:this.activeCornerGP.x-n.x,y:this.activeCornerGP.y},h=a?t:{x:this.activeCornerGP.x-s.x,y:this.activeCornerGP.y};break;case z.RB:e&&(s.x=this.autoFlipDimension.bottom.width,s.y=this.autoFlipDimension.bottom.height),l={x:this.activeCornerGP.x-n.x,y:this.activeCornerGP.y-n.y},h=a?t:{x:this.activeCornerGP.x-s.x,y:this.activeCornerGP.y-s.y}}if(!a&&n==s)return o();const d=t=>{const p=this.eventStatus;if(a&&(e?h=this.adjustPointerToZone(this.eventZone,this.curMouseGP):l=this.adjustPointerToZone(this.eventZone,this.curMouseGP)),p!=C.AutoFlipToCorner&&p!=C.AutoFlipFromCorner||e&&p==C.AutoFlipToCorner||!e&&p==C.AutoFlipFromCorner)return o();const c=(t-r)/300,g=Math.min(c,1),u=this.easeInOutQuad(g),f=l.x+(h.x-l.x)*u,w=l.y+(h.y-l.y)*u;a||(e?(n.x=g*s.x,n.y=g*s.y):(n.x=n.x-g*n.x,n.y=n.y-g*n.y),this.curAutoFlipWidth=n),i({x:f,y:w}),g<1?requestAnimationFrame(d):o()};requestAnimationFrame(d)}adjustPointerToZone(e,t){let i=t.x,o=t.y;switch(e){case z.LT:t.x>this.flipGRect.left+this.zoneDimension.top.width&&(i=this.flipGRect.left+this.zoneDimension.top.width);break;case z.LC:t.x>this.flipGRect.left+this.zoneDimension.center.width&&(i=this.flipGRect.left+this.zoneDimension.center.width);break;case z.LB:t.x>this.flipGRect.left+this.zoneDimension.bottom.width&&(i=this.flipGRect.left+this.zoneDimension.bottom.width);break;case z.RT:t.x<this.flipGRect.right-this.zoneDimension.top.width&&(i=this.flipGRect.right-this.zoneDimension.top.width);break;case z.RC:t.x<this.flipGRect.right-this.zoneDimension.center.width&&(i=this.flipGRect.right-this.zoneDimension.center.width);break;case z.RB:t.x<this.flipGRect.right-this.zoneDimension.bottom.width&&(i=this.flipGRect.right-this.zoneDimension.bottom.width)}return e&z.Top?t.y<this.flipGRect.top?o=this.flipGRect.top:t.y>this.flipGRect.top+this.zoneDimension.top.height&&(o=this.flipGRect.top+this.zoneDimension.top.height):e&z.Center?o=this.activeCornerGP.y:e&z.Bottom&&(t.y>this.flipGRect.bottom?o=this.flipGRect.bottom:t.y<this.flipGRect.bottom-this.zoneDimension.bottom.height&&(o=this.flipGRect.bottom-this.zoneDimension.bottom.height)),{x:i,y:o}}animateFlipFromCorner(e,t,i){this.oldEventZone!=this.eventZone&&(this.curAutoFlipWidth={x:0,y:0}),this.oldEventZone=this.eventZone,this.animateReadyToFlip(!0,e,t,i)}animateFlipToCorner(e,t,i){this.oldEventZone=this.eventZone,this.animateReadyToFlip(!1,e,t,i)}easeInOutQuad(e){return e<.5?2*e*e:(4-2*e)*e-1}animateFlip(e,t,i,o){const n=performance.now(),a=s=>{if(this.eventStatus==C.Flipping)return;const r=(s-n)/400,l=Math.min(r,1),h=this.easeInOutQuad(l),d=e.x+(t.x-e.x)*h,p=e.y+(t.y-e.y)*h;i({x:d,y:p}),l<1?requestAnimationFrame(a):o()};requestAnimationFrame(a)}updateMousePointOnArea(e){const t=V.getRadianPositive(this.gutter.centerBottom,e),i=e.y<this.flipActionLine.y&&V.getLength(this.gutter.centerBottom,e)>this.diagonals.area1.length&&this.diagonals.area1.radian.low<=t&&t<=this.diagonals.area1.radian.high,o=V.getRadianPositive(this.gutter.centerTop,e),n=e.y>this.flipActionLine.y&&V.getLength(this.gutter.centerTop,e)>this.diagonals.area2.length&&this.diagonals.area2.radian.low<=o&&o<=this.diagonals.area2.radian.high,a=V.getRadianPositive(this.flipActionLine.rightP,e),s=this.diagonals.area3.radian.low,r=this.diagonals.area3.radian.high,l=e.x>this.flipActionLine.rightX&&V.getLength(this.flipActionLine.rightP,e)>this.diagonals.area3.length&&(s<=a&&a<=r||s>r&&s<=a||a<=r),h=V.getRadianPositive(this.flipActionLine.leftP,e),d=e.x<this.flipActionLine.leftX&&V.getLength(this.flipActionLine.leftP,e)>this.diagonals.area4.length&&this.diagonals.area4.radian.low<=h&&h<=this.diagonals.area4.radian.high;return i?e=V.findPointOnLine(this.gutter.centerBottom,e,this.diagonals.area1.length):n?e=V.findPointOnLine(this.gutter.centerTop,e,this.diagonals.area2.length):l?e=this.flipActionLine.rightP:d&&(e=this.flipActionLine.leftP),e}flip(e,t,i){const o=t.width,n=t.height;let a,s,r=0,l=1;switch(e=this.updateMousePointOnArea(e),this.eventZone){case z.LT:case z.LC:case z.LB:a={x:o,y:n},s={x:0,y:n},r=0,l=-1;break;case z.RT:case z.RC:case z.RB:a={x:0,y:n},s={x:o,y:n},r=i?o:0,l=1;break;default:throw new Error("Not found an event zone.")}const h=Math.PI/2,d=this.gutter.bottom-this.flipActionLine.y,p=V.getRadianPositive(this.activeCornerGP,e),c=l*(3*h-p),g=r+(e.x-this.gutter.left),u=e.y-this.flipActionLine.y,f=e.x-this.activeCornerGP.x,w=e.y-this.activeCornerGP.y,b=Math.cos(2*p-h),v=Math.tan(-h-l*p),k=0==w?n:-f/b+d,x=0==w?-f*l/2:k/v,y={x:a.x,y:a.y};let P={x:a.x+x*l,y:a.y},E={x:0,y:0};const C={x:a.x,y:a.y-k},S=V.getLength(e,this.activeCornerOppositeGP);0==w?E={x:P.x,y:C.y}:x<0?(E.x=a.x-l*x*(n-k)/k,E.y=C.y=n-a.y,y.y=a.y-k,P=y):k<0?(E.x=a.x+l*x*(k-n)/k,E.y=C.y=n-a.y):k<n?E=C:k>n&&(E.x=a.x+l*x*(k-n)/k,E.y=C.y=n-a.y);const L={x:s.x,y:s.y},B={x:s.x+a.x-P.x,y:P.y},A={x:s.x+a.x-E.x,y:E.y},F={x:s.x,y:C.y};return new m({page2:{top:u,left:g,rotate:2*p%(2*Math.PI)},mask:{page2:{p1:y,p2:P,p3:E,p4:C},page1:{p1:L,p2:B,p3:A,p4:F}},alpa:c,a:f,b:w,c:x,d:k,shadow:{closingDistance:S,rect:{rotate:c,origin:{x:P.x,y:0}}}})}}function N(e,t,i,o){return new(i||(i=Promise))((function(t,n){function a(e){try{r(o.next(e))}catch(e){n(e)}}function s(e){try{r(o.throw(e))}catch(e){n(e)}}function r(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(a,s)}r((o=o.apply(e,[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;function G(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}G('body,html{font-family:Noto Sans KR,sans-serif;margin:0;padding:0}#bookShelf{box-sizing:border-box;display:flex;flex-direction:row;gap:20px;padding:20px;width:100vw}#bookShelf .book-holder{border:1px solid #eee;border-radius:5px;box-shadow:1px 1px 5px #eee;padding:3px;position:relative}#bookShelf .book-holder:before{align-items:center;color:#eee;content:"MagZog";display:flex;font-size:24px;height:100%;justify-content:center;position:absolute;width:100%;z-index:-1}#bookShelf .book,#bookShelf .book-holder,#bookShelf .book-on-shelf{width:300px}#bookShelf .book-on-shelf img{height:100%;width:100%}#bookShelf .book-on-shelf:hover{cursor:pointer}#bookViewer.hidden{display:none}#bookViewer{align-items:center;background:hsla(0,0%,100%,.9);box-sizing:border-box;display:flex;height:100vh;justify-content:center;left:0;padding:0;position:fixed;top:0;width:100vw}#bookViewer.flip-view{--s:87px;--c1:#f2f2f2;--c2:#efeeec;--_s:calc(var(--s)*2) calc(var(--s)*2);--_g:35.36% 35.36% at;--_c:#0000 66%,var(--c2) 68% 70%,#0000 72%;background:radial-gradient(var(--_g) 100% 25%,var(--_c)) var(--s) var(--s)/var(--_s),radial-gradient(var(--_g) 0 75%,var(--_c)) var(--s) var(--s)/var(--_s),radial-gradient(var(--_g) 100% 25%,var(--_c)) 0 0/var(--_s),radial-gradient(var(--_g) 0 75%,var(--_c)) 0 0/var(--_s),repeating-conic-gradient(var(--c1) 0 25%,#0000 0 50%) 0 0/var(--_s),radial-gradient(var(--_c)) 0 calc(var(--s)/2)/var(--s) var(--s) var(--c1)}.noselect{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}#bookViewer #btnClose{background-color:#222;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:18px;height:30px;line-height:30px;margin:0;padding:0;position:absolute;right:10px;top:10px;width:30px;z-index:100}img{height:100%;width:100%}');function _(e,t,i,o){return new(i||(i=Promise))((function(t,n){function a(e){try{r(o.next(e))}catch(e){n(e)}}function s(e){try{r(o.throw(e))}catch(e){n(e)}}function r(e){var o;e.done?t(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(a,s)}r((o=o.apply(e,[])).next())}))}G(':root{--closed-book-width:0px;--opened-book-width:0px;--book-height:0px;--page-width:0px;--page-height:0px;--zone-width:50px;--page2-top:0px;--page2-left:0px;--page2-rotate:0rad;--page2-origin:"0px 0px";--page-diagonal-length:0px;--shadow-origin-x:0px;--shadow-origin-y:0px;--shadow-left:calc(var(--page-width) - var(--page-diagonal-length));--shadow-rotate:0rad;--shadow5-opacity:0}#bookViewer.flip-view.hidden{display:none}#bookViewer.flip-view #bookContainer{align-items:center;display:flex;justify-content:center;position:relative}#bookViewer.flip-view #bookContainer .book,#bookViewer.flip-view .book>.container>.page{height:100%;width:100%}#bookViewer.flip-view #bookContainer{filter:drop-shadow(0 0 50px rgba(0,0,0,.4))}#bookViewer.flip-view #bookContainer.ready-to-open .book{width:var(--closed-book-width)}#bookViewer.flip-view #bookContainer.ready-to-open.front .book{border-radius:0 20px 20px 0}#bookViewer.flip-view #bookContainer.ready-to-open.end .book{border-radius:20px 0 0 20px}#bookViewer.flip-view #bookContainer .book{align-items:center;box-sizing:content-box;display:flex;height:var(--book-height);justify-content:center;width:var(--opened-book-width)}#bookViewer.flip-view .book>.container{align-items:center;background:transparent;display:flex;height:100%;justify-content:center;position:relative;width:100%}#bookViewer.flip-view #bookContainer.ready-to-open .book>.container>.page{width:100%}#bookViewer.flip-view .book>.container>.page.empty:nth-child(3){opacity:0}#bookViewer.flip-view #bookContainer.ready-to-open.end .book>.container>.page.empty:nth-child(n+4):nth-child(-n+6),#bookViewer.flip-view #bookContainer.ready-to-open.front .book>.container>.page.empty:nth-child(-n+3){display:none}#bookViewer.flip-view .book>.container>.page{border:0;box-sizing:border-box;height:var(--page-height);position:absolute;width:var(--page-width)}#bookViewer.flip-view .book .page:nth-child(-n+3){left:-.5px}#bookViewer.flip-view .book .page:nth-child(n+4):nth-child(-n+6){left:calc(50% - .5px)}#bookViewer.flip-view .book .page:nth-child(2),#bookViewer.flip-view .book .page:nth-child(5){display:none}#bookViewer.flip-view #bookContainer.ready-to-open .book .page:nth-child(-n+6){left:-.5px}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(3),#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(4){z-index:9}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(2),#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(5){display:block;filter:drop-shadow(0 0 40px rgba(0,0,0,var(--shadow5-opacity)));left:var(--page2-left);top:var(--page2-top);transform:rotate(var(--page2-rotate));transform-origin:var(--page2-origin);z-index:10}#bookViewer.flip-view .book>.container>.page>.content-container{box-sizing:border-box;height:100%;left:0;overflow:hidden;position:absolute;top:0;width:100%}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(3)>.content-container,#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(4)>.content-container{mask-composite:exclude;-webkit-mask-composite:xor;mask-image:url(#mask1);-webkit-mask-image:url(#mask1);mask-size:cover}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(2)>.content-container,#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(5)>.content-container{-webkit-mask-composite:intersect;mask-composite:intersect;-webkit-mask-image:url(#mask2);mask-image:url(#mask2);-webkit-mask-mode:alpha;mask-mode:alpha}#bookViewer.flip-view .book>.container>.page>.content-container>.content{height:100%;left:0;position:absolute;top:0;width:100%}#bookViewer.flip-view .shadow1{bottom:-10%;height:10%;left:0;position:absolute;width:100%}#bookViewer.flip-view .shadow1 path{display:none}#bookViewer.flip-view .shadow1 path.sh1-path1,#bookViewer.flip-view .shadow1 path.sh1-path2{fill:url(#shadow1);filter:url(#sh1BlurFilter)}#bookViewer.flip-view .book>.container>.page:nth-child(3) .shadow1 path.sh1-path1,#bookViewer.flip-view .book>.container>.page:nth-child(4) .shadow1 path.sh1-path2{display:block}#bookViewer.flip-view .shadow6 polygon{fill:url(#shadow6)}#bookViewer.flip-view .book .page .shadow6{display:none;height:100%;width:100%}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(3)>.shadow6{display:block;height:100%;left:0;position:absolute;top:0;width:calc(var(--page-width)*2)}#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(4)>.shadow6{display:block;height:100%;left:calc(var(--page-width)*-1);position:absolute;top:0;width:calc(var(--page-width)*2)}#bookViewer.flip-view #bookContainer.ready-to-open.left-page-flipping .book>.container>.page:nth-child(3)>.shadow6,#bookViewer.flip-view #bookContainer.ready-to-open.right-page-flipping .book>.container>.page:nth-child(4)>.shadow6{display:none}#bookViewer.flip-view .book>.container>.page>.content-container>.content,#bookViewer.flip-view .book>.container>.page>.shadow3{box-sizing:border-box;overflow:hidden}#bookViewer.flip-view .book>.container>.page:nth-child(odd)>.content-container,#bookViewer.flip-view .book>.container>.page:nth-child(odd)>.content-container>.content,#bookViewer.flip-view .book>.container>.page:nth-child(odd)>.shadow3{border-radius:20px 0 0 20px;border-right-width:0!important}#bookViewer.flip-view .book>.container>.page:nth-child(2n)>.content-container,#bookViewer.flip-view .book>.container>.page:nth-child(2n)>.content-container>.content,#bookViewer.flip-view .book>.container>.page:nth-child(2n)>.shadow3{border-left-width:0!important;border-radius:0 20px 20px 0}#bookViewer.flip-view .book>.container>.page>.shadow3{display:none;height:100%;left:0;position:absolute;top:0;width:100%}#bookViewer.flip-view #bookContainer.left-page-flipping .book>.container>.page:nth-child(2)>.shadow3,#bookViewer.flip-view #bookContainer.right-page-flipping .book>.container>.page:nth-child(5)>.shadow3{display:block}#bookViewer.flip-view .book>.container>.page.empty .shadow2{display:none}#bookViewer.flip-view .book>.container>.page:nth-child(odd) .shadow2{background-image:-webkit-linear-gradient(left,transparent,rgba(0,0,0,.3) 210%);border-right:1px solid rgba(71,71,71,.1);height:100%;position:absolute;right:0;top:0;width:7%}#bookViewer.flip-view .book>.container>.page:nth-child(2n) .shadow2{background-image:-webkit-linear-gradient(right,transparent,rgba(0,0,0,.3) 210%);border-left:1px solid rgba(71,71,71,.1);height:100%;left:0;position:absolute;top:0;width:7%}#bookViewer.flip-view .page.border>.content-container>.content{border:1px solid #fff}#bookViewer.flip-view .page.border>.shadow3{border:1px solid transparent}#bookViewer.flip-view .page.border .shadow3>.shape{stroke:#fff;stroke-width:1px}#bookViewer.flip-view .page:first-child{z-index:1}#bookViewer.flip-view .page:nth-child(2){z-index:2}#bookViewer.flip-view .page:nth-child(3),#bookViewer.flip-view .page:nth-child(4){z-index:3}#bookViewer.flip-view .page:nth-child(5){z-index:2}#bookViewer.flip-view .page:nth-child(6){z-index:1}#bookViewer.flip-view #bookContainer.ready-to-open.end .event-zone.right,#bookViewer.flip-view #bookContainer.ready-to-open.front .event-zone.left{display:none}#bookViewer.flip-view .event-zone{background:transparent;position:absolute;z-index:20}#bookViewer.flip-view #mzZoneLT{height:calc(var(--zone-width)*2);left:0;top:0;width:calc(var(--zone-width)*3)}#bookViewer.flip-view #mzZoneLC{height:calc(var(--page-height) - var(--zone-width)*4);left:0;top:calc(var(--zone-width)*2);width:var(--zone-width)}#bookViewer.flip-view #mzZoneLB{bottom:0;left:0}#bookViewer.flip-view #mzZoneLB,#bookViewer.flip-view #mzZoneRT{height:calc(var(--zone-width)*2);width:calc(var(--zone-width)*3)}#bookViewer.flip-view #mzZoneRT{right:0;top:0}#bookViewer.flip-view #mzZoneRC{height:calc(var(--page-height) - var(--zone-width)*4);right:0;top:calc(var(--zone-width)*2);width:var(--zone-width)}#bookViewer.flip-view #mzZoneRB{bottom:0;height:calc(var(--zone-width)*2);right:0;width:calc(var(--zone-width)*3)}:root{--mz-label-bg:rgba(48,171,237,.5);--mz-label-width:400px;--mz-label-height:30px;--mz-label-font-size:12px;--mz-label-line-height:16px;--mz-label-color:#fff;--mz-label-font-family:"Geologica",sans-serif;--mz-label-border-radius-right:0 5px 5px 0;--mz-label-border-radius-left:5px 0 0 5px;--mz-label-padding:5px 10px 5px 10px;--mz-label-offset-x:30px}#bookViewer .label-container{height:100%;left:0;padding-top:10px;position:absolute;top:0;width:100%}#bookViewer .page-label{height:0;position:absolute;width:0}#bookViewer #bookContainer.ready-to-open.front .page-label,#bookViewer .page-label{right:var(--mz-label-offset-x);top:0}#bookViewer #bookContainer.ready-to-open.end .page-label{left:var(--mz-label-offset-x);top:0}#bookViewer .page-label:before{background-color:var(--mz-label-bg);bottom:0;content:"";left:0;position:absolute;right:0;top:0}#bookViewer .page-label-content{color:var(--mz-label-color);cursor:pointer;display:inline-block;font-family:var(--mz-label-font-family);font-size:var(--mz-label-font-size);left:0;line-height:var(--mz-label-line-height);padding:var(--mz-label-padding);position:absolute;white-space:nowrap}#bookViewer #bookContainer.ready-to-open.front .page-label-content,#bookViewer .page-label-content{border-radius:var(--mz-label-border-radius-right);padding-left:calc(var(--mz-label-offset-x) + 5px)}#bookViewer #bookContainer.ready-to-open.end .page-label-content{border-radius:var(--mz-label-border-radius-left);left:unset;padding:var(--mz-label-padding);padding-right:calc(var(--mz-label-offset-x) + 5px);right:0}#bookViewer .page-label-content:hover{opacity:1!important;transform:translateX(10px);transition:transform .3s ease,opacity .3s ease}#bookViewer #bookContainer.ready-to-open.end .page-label-content:hover{opacity:1!important;transform:translateX(-10px)}img{height:100%;width:100%}'),"function"==typeof SuppressedError&&SuppressedError;!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("#bookViewer.scroll-type.hidden{display:none}#bookViewer.scroll-view{align-items:center;background:hsla(0,0%,100%,.9);box-sizing:border-box;display:flex;height:100vh;justify-content:center;left:0;padding:0;position:fixed;top:0;width:100vw}.noselect{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}#bookViewer.scroll-view #bookContainer{align-items:center;display:flex;height:100%;justify-content:center;position:relative;width:100%}#bookViewer.scroll-view #bookContainer .book{align-items:center;box-sizing:content-box;display:flex;height:100%;justify-content:center;width:100%}#bookViewer.scroll-view .book>.container{background:transparent;height:100%;overflow-y:auto;position:relative;width:100%}#bookViewer.scroll-view .book>.container>.page.empty{opacity:0}#bookViewer.scroll-view .book>.container>.page{border:0;box-sizing:border-box;height:var(--page-height);margin:10px auto;position:relative;width:var(--page-width)}#bookViewer.scroll-view .book>.container>.page>.content-container{box-sizing:border-box;height:100%;left:0;overflow:hidden;position:absolute;top:0;width:100%}#bookViewer.scroll-view .book>.container>.page>.content-container>.content{height:100%;left:0;position:absolute;top:0;width:100%}img{height:100%;width:100%}");!function(e,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}('body,html{font-family:Noto Sans KR,sans-serif;margin:0;padding:0}#bookShelf{box-sizing:border-box;display:flex;flex-direction:row;gap:20px;padding:20px;width:100vw}#bookShelf .book-holder{border:1px solid #eee;border-radius:5px;box-shadow:1px 1px 5px #eee;padding:3px;position:relative}#bookShelf .book-holder:before{align-items:center;color:#eee;content:"MagZog";display:flex;font-size:24px;height:100%;justify-content:center;position:absolute;width:100%;z-index:-1}#bookShelf .book,#bookShelf .book-holder,#bookShelf .book-on-shelf{width:300px}#bookShelf .book-on-shelf img{height:100%;width:100%}#bookShelf .book-on-shelf:hover{cursor:pointer}#bookViewer.hidden{display:none}#bookViewer{align-items:center;background:hsla(0,0%,100%,.9);box-sizing:border-box;display:flex;height:100vh;justify-content:center;left:0;padding:0;position:fixed;top:0;width:100vw}#bookViewer.flip-view{--s:87px;--c1:#f2f2f2;--c2:#efeeec;--_s:calc(var(--s)*2) calc(var(--s)*2);--_g:35.36% 35.36% at;--_c:#0000 66%,var(--c2) 68% 70%,#0000 72%;background:radial-gradient(var(--_g) 100% 25%,var(--_c)) var(--s) var(--s)/var(--_s),radial-gradient(var(--_g) 0 75%,var(--_c)) var(--s) var(--s)/var(--_s),radial-gradient(var(--_g) 100% 25%,var(--_c)) 0 0/var(--_s),radial-gradient(var(--_g) 0 75%,var(--_c)) 0 0/var(--_s),repeating-conic-gradient(var(--c1) 0 25%,#0000 0 50%) 0 0/var(--_s),radial-gradient(var(--_c)) 0 calc(var(--s)/2)/var(--s) var(--s) var(--c1)}.noselect{user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}#bookViewer #btnClose{background-color:#222;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:18px;height:30px;line-height:30px;margin:0;padding:0;position:absolute;right:10px;top:10px;width:30px;z-index:100}img{height:100%;width:100%}'),e.Base=r,e.Book=u,e.BookEl=d,e.BookShelf=f,e.BookShelfManager=class{constructor(e){this.config={hideBookShelf:!1},this.config=s(this.config,e),this.bookShelf=new f(this),this.bookViewer=new w(this)}getBookViewer(){return this.bookViewer}getBookHolder(e){return this.bookShelf.getBookHolder(e)}getBook(e){return this.bookShelf.getBook(e)}loadAndAddBooks(){return l(this,0,void 0,(function*(){[{id:"book1",status:e.BookStatus.Close,title:"Book 1",type:e.BookType.Magazine,author:"Shinkee",publication:{name:"Magzog",location:"Auckland in New Zealand",publishedDate:"2022-09-01"},size:new i({closed:{width:600,height:900,diagonal:0},opened:{width:1200,height:900,diagonal:0}}),lastPageIndex:5,thumbnails:{spine:"resources/cover.jpg",small:"resources/cover.jpg",medium:"resources/cover.jpg",cover:{front:"resources/cover.jpg",back:"resources/cover.jpg"}}}].forEach((e=>{this.addBookToShelf(e)}))}))}loadAndAddBook(t){return l(this,0,void 0,(function*(){const t={id:"book6",status:e.BookStatus.Close,title:"The Great Gatsby",type:e.BookType.Magazine,author:"Shinkee",publication:{name:"Magzog",location:"Auckland in New Zealand",publishedDate:"2021-09-01"},size:new i({closed:{width:600,height:900,diagonal:0},opened:{width:1200,height:900,diagonal:0}}),lastPageIndex:5,thumbnails:{spine:"resources/cover.webp",small:"resources/cover.webp",medium:"resources/cover.webp",cover:{front:"resources/cover.webp",back:"resources/cover.webp"}}};this.addBookToShelf(t)}))}importBookToShelf(e){this.bookShelf.addBook(e,{click:t=>{this.pickupAndView(this.getBook(e.id))}})}addBookToShelf(e){this.bookShelf.addBook(new u(e),{click:t=>{this.pickupAndView(this.getBook(e.id))}})}pickupAndView(t){var i;t.status!=e.BookStatus.Open&&(t.status=e.BookStatus.Open,null===(i=this.bookViewer)||void 0===i||i.view(t))}returnBookToShelf(t){if(t){if(t.status==e.BookStatus.Close)return;t.status=e.BookStatus.Close,this.bookShelf.putbackBook(t)}else;}},e.BookSize=i,e.BookViewer=w,e.FlipActionLine=b,e.FlipData=m,e.FlipDiagonal=R,e.FlipDiagonals=D,e.FlipView=class{get pageContainerRect(){var e;const t=null===(e=this.book)||void 0===e?void 0:e.pageContainerEl;if(!t)throw new Error("Not found the page container.");return t&&V.getOffset4Fixed(t)}get isReadyToOpen(){return this.curOpenLeftPageIndex<0}get isClosed(){return this.curOpenLeftPageIndex>=this.bookLastPageIndex}get isFlipping(){return this.flipManager.eventStatus&C.AutoFlip||this.flipManager.eventStatus&C.Flipping||this.flipManager.eventStatus&C.Dragging}get isLeftPageFlipping(){return this.isFlipping&&this.flipManager.eventZone&z.Left}get isRightPageFlipping(){return this.isFlipping&&this.flipManager.eventZone&z.Right}get isFirstPageOpening(){var e;return this.isRightPageFlipping&&0==(null===(e=this.getActivePage(1))||void 0===e?void 0:e.index)}get isFirstPageClosing(){var e;return this.isLeftPageFlipping&&0==(null===(e=this.getActivePage(2))||void 0===e?void 0:e.index)}get isLastPageOpening(){var e;return this.isLeftPageFlipping&&(null===(e=this.getActivePage(1))||void 0===e?void 0:e.index)==this.bookLastPageIndex}get isLastPageClosing(){var e;return this.isRightPageFlipping&&(null===(e=this.getActivePage(2))||void 0===e?void 0:e.index)==this.bookLastPageIndex}getActivePage(e){return this.isLeftPageFlipping?this.flipManager.windows[3-e].page:this.flipManager.windows[2+e].page}get activePage2(){return this.getActivePage(2)}get activePage1El(){var e;return null===(e=this.getActivePage(1))||void 0===e?void 0:e.element}get activePage2El(){var e;return null===(e=this.getActivePage(2))||void 0===e?void 0:e.element}get shadow3El(){return this._shadow3El||(this._shadow3El=document.getElementById("shadow3"))}get shadow6El(){return this._shadow6El||(this._shadow6El=document.getElementById("shadow6"))}constructor(e){this.config={autoFlip:{duration:500,forward:{offsetY:100},backward:{offsetY:-100}}},this.zoomLevel=1,this.id="flip-view",this.bookLastPageIndex=0,this.curOpenLeftPageIndex=-1,this.isSpreadOpen=!1,this._shadow3El=null,this._shadow6El=null,this.flipManager=new O,this.checkNum=0,({bookContainerEl:this.bookContainerEl,zoneLT:this.zoneLT,zoneLC:this.zoneLC,zoneLB:this.zoneLB,zoneRT:this.zoneRT,zoneRC:this.zoneRC,zoneRB:this.zoneRB,mask1Shap